Merge pull request 'lvleigang' (#12) from lvleigang into dev

Reviewed-on: http://192.168.2.237:3000/root/kangarooDataCenterV3/pulls/12
This commit is contained in:
13758950345 2024-04-26 08:38:08 +08:00
commit 5ed5393efe
19 changed files with 1569 additions and 6 deletions

View File

@ -51,6 +51,12 @@
<profile.active>dev</profile.active> <profile.active>dev</profile.active>
</properties> </properties>
</profile> </profile>
<profile>
<id>ax</id> <!--澳星-->
<properties>
<profile.active>ax</profile.active>
</properties>
</profile>
</profiles> </profiles>
<build> <build>
<finalName>kangarooDataCenterV3</finalName> <finalName>kangarooDataCenterV3</finalName>

View File

@ -0,0 +1,22 @@
#######################澳星环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
file:
# 日志保存路径
path: E:\yongansystem\log
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: E:\yongansystem\file
ax:
url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -15,4 +15,6 @@ spring:
password: bd993088e8a7c3dc5f44441617f9b4bf password: bd993088e8a7c3dc5f44441617f9b4bf
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile: savefile:
path: /home/webservice/zt/file path: /home/webservice/zt/file
ax:
url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -17,4 +17,6 @@ spring:
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile: savefile:
# 文件保存路径 # 文件保存路径
path: /Users/apple/Desktop/log/local path: /Users/apple/Desktop/log/local
ax:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -18,8 +18,10 @@ public class temButtom {
@Test @Test
public void test01() { public void test01() {
String a = AESUtil.encrypt("hzya1314"); String a = AESUtil.encrypt("hzya@1314");
System.out.println(a); System.out.println(a);
//String sa= "{\n \\"status\\": \\"success\\",\n \\"data\\": \\"[{\\\\"pk_corp\\\\":\\\\"1001\\\\",\\\\"unitcode\\\\":\\\\"01\\\\",\\\\"unitname\\\\":\\\\"临安奥星电子股份有限公司\\\\",\\\\"createdate\\\\":\\\\"2024-04-24\\\\",\\\\"deptattr\\\\":\\\\"1\\\\",\\\\"deptname\\\\":\\\\"DEV测试一级部门\\\\",\\\\"deptcode\\\\":\\\\"99\\\\",\\\\"pk_deptdoc\\\\":\\\\"1001F1100000000067AS\\\\"}]\\",\n \\"taskNumber\\": \\"202404250041\\"\n}";
} }

View File

@ -0,0 +1,24 @@
package com.hzya.frame.u8c.ax.dao;
import com.hzya.frame.u8c.ax.entity.ArchivesEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
import java.util.List;
/**
* (bd_corp: table)表数据库访问层
*
* @author makejava
* @since 2023-09-06 14:47:17
*/
public interface IAxDao extends IBaseDao<ArchivesEntity, String> {
List<ArchivesEntity> queryArchivesData(ArchivesEntity archivesEntity);
ArchivesEntity saveArchivesByType(ArchivesEntity archivesEntity);
Integer updateArchivesByType(ArchivesEntity archivesEntity);
Integer deleteArchivesByType(ArchivesEntity archivesEntity);
}

View File

@ -0,0 +1,42 @@
package com.hzya.frame.u8c.ax.dao.impl;
import com.hzya.frame.sysnew.user.entity.SysUserEntity;
import com.hzya.frame.u8c.ax.dao.IAxDao;
import com.hzya.frame.u8c.ax.entity.ArchivesEntity;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import java.util.List;
/**
* (BdCorp)表数据库访问层
*
* @author makejava
* @since 2023-09-06 14:47:17
*/
@Repository("axDaoImpl")
public class AxDaoImpl extends MybatisGenericDao<ArchivesEntity, String> implements IAxDao {
@Override
public List<ArchivesEntity> queryArchivesData(ArchivesEntity entity) {
List<ArchivesEntity> o = super.query(getSqlIdPrifx() + "queryArchivesData", entity);
return o;
}
@Override
public ArchivesEntity saveArchivesByType(ArchivesEntity entity) {
entity = super.save(getSqlIdPrifx() + "saveArchivesByType", entity);
return entity;
}
@Override
public Integer updateArchivesByType(ArchivesEntity entity) {
Integer o = super.update(getSqlIdPrifx() + "updateArchivesByType", entity);
return o;
}
@Override
public Integer deleteArchivesByType(ArchivesEntity entity) {
Integer o = super.update(getSqlIdPrifx() + "deleteArchivesByType", entity);
return o;
}
}

View File

@ -0,0 +1,170 @@
package com.hzya.frame.u8c.ax.entity;
import cn.dev33.satoken.stp.StpUtil;
import com.hzya.frame.uuid.UUIDUtils;
import com.hzya.frame.web.entity.BaseEntity;
import java.util.Date;
/**
* (BdCorp)实体类
*
* @author makejava
* @since 2023-09-06 14:47:18
*/
public class ArchivesEntity extends BaseEntity {
private String archivesType;//类型
private String leftCode;//左编码
private String rightCode;//右编码
private String leftAppId;//左应用id
private String leftAppCode;//左应用编码
private String leftAppName;//左应用名称
private String leftApiId;//左接口ID
private String leftId;//左id
private String leftName;//左名称
private String rightAppId;//右应用id
private String rightAppCode;//右应用编码
private String rightAppName;//右应用名称
private String rightApiId;//右接口ID
private String rightId;//右id
private String rightName;//右名称
public String getArchivesType() {
return archivesType;
}
public void setArchivesType(String archivesType) {
this.archivesType = archivesType;
}
public String getLeftCode() {
return leftCode;
}
public void setLeftCode(String leftCode) {
this.leftCode = leftCode;
}
public String getRightCode() {
return rightCode;
}
public void setRightCode(String rightCode) {
this.rightCode = rightCode;
}
public String getLeftAppId() {
return leftAppId;
}
public void setLeftAppId(String leftAppId) {
this.leftAppId = leftAppId;
}
public String getLeftAppCode() {
return leftAppCode;
}
public void setLeftAppCode(String leftAppCode) {
this.leftAppCode = leftAppCode;
}
public String getLeftAppName() {
return leftAppName;
}
public void setLeftAppName(String leftAppName) {
this.leftAppName = leftAppName;
}
public String getLeftApiId() {
return leftApiId;
}
public void setLeftApiId(String leftApiId) {
this.leftApiId = leftApiId;
}
public String getLeftId() {
return leftId;
}
public void setLeftId(String leftId) {
this.leftId = leftId;
}
public String getLeftName() {
return leftName;
}
public void setLeftName(String leftName) {
this.leftName = leftName;
}
public String getRightAppId() {
return rightAppId;
}
public void setRightAppId(String rightAppId) {
this.rightAppId = rightAppId;
}
public String getRightAppCode() {
return rightAppCode;
}
public void setRightAppCode(String rightAppCode) {
this.rightAppCode = rightAppCode;
}
public String getRightAppName() {
return rightAppName;
}
public void setRightAppName(String rightAppName) {
this.rightAppName = rightAppName;
}
public String getRightApiId() {
return rightApiId;
}
public void setRightApiId(String rightApiId) {
this.rightApiId = rightApiId;
}
public String getRightId() {
return rightId;
}
public void setRightId(String rightId) {
this.rightId = rightId;
}
public String getRightName() {
return rightName;
}
public void setRightName(String rightName) {
this.rightName = rightName;
}
public void setCreate() {
this.setId(UUIDUtils.getUUID());
this.setSts("Y");
this.setCreate_user_id("1");
this.setModify_user_id("1");
this.setCreate_time(new Date());
this.setModify_time(new Date());
this.setOrg_id("0");
this.setCompanyId("0");
}
//修改信息
public void setUpdate() {
this.setModify_user_id("1");
this.setModify_time(new Date());
}
}

View File

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.u8c.ax.dao.impl.AxDaoImpl">
<resultMap id="get-ArchivesEntity-result" type="com.hzya.frame.u8c.ax.entity.ArchivesEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="leftAppId" column="left_app_id" jdbcType="VARCHAR"/>
<result property="leftAppCode" column="left_app_code" jdbcType="VARCHAR"/>
<result property="leftAppName" column="left_app_name" jdbcType="VARCHAR"/>
<result property="leftApiId" column="left_api_id" jdbcType="VARCHAR"/>
<result property="leftId" column="left_id" jdbcType="VARCHAR"/>
<result property="leftCode" column="left_code" jdbcType="VARCHAR"/>
<result property="leftName" column="left_name" jdbcType="VARCHAR"/>
<result property="rightAppId" column="right_app_id" jdbcType="VARCHAR"/>
<result property="rightAppCode" column="right_app_code" jdbcType="VARCHAR"/>
<result property="rightAppName" column="right_app_name" jdbcType="VARCHAR"/>
<result property="rightApiId" column="right_api_id" jdbcType="VARCHAR"/>
<result property="rightId" column="right_id" jdbcType="VARCHAR"/>
<result property="rightCode" column="right_code" jdbcType="VARCHAR"/>
<result property="rightName" column="right_name" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
</resultMap>
<select id="queryArchivesData" resultMap="get-ArchivesEntity-result"
parameterType="com.hzya.frame.u8c.ax.entity.ArchivesEntity">
select
right_code
from
<choose>
<when test="archivesType == '1'.toString()"> sys_personnel_control </when>
<when test="archivesType == '2'.toString()"> sys_org_control </when>
<when test="archivesType == '6'.toString()"> sys_stock_control </when>
<when test="archivesType == '73'.toString()"> sys_merchant_control </when>
<when test="archivesType == 'D01'.toString()"> sys_taxrate_control </when>
<when test="archivesType == 'jobass'.toString()"> sys_project_control </when>
<when test="archivesType == '93'.toString()"> sys_bank_control </when>
<when test="archivesType == '96'.toString()"> sys_bankaccount_control </when>
<when test="archivesType == '22'.toString()"> sys_assets_control </when>
</choose>
<trim prefix="where" prefixOverrides="and">
<if test="leftCode != null and leftCode != ''">and left_code = #{leftCode}</if>
and sts='Y'
</trim>
</select>
<!--新增所有列-->
<insert id="saveArchivesByType" parameterType = "com.hzya.frame.u8c.ax.entity.ArchivesEntity">
insert into
<choose>
<when test="archivesType == '1'.toString()"> sys_personnel_control </when>
<when test="archivesType == '2'.toString()"> sys_org_control </when>
<when test="archivesType == '6'.toString()"> sys_stock_control </when>
<when test="archivesType == '73'.toString()"> sys_merchant_control </when>
<when test="archivesType == 'D01'.toString()"> sys_taxrate_control </when>
<when test="archivesType == 'jobass'.toString()"> sys_project_control </when>
<when test="archivesType == '93'.toString()"> sys_bank_control </when>
<when test="archivesType == '96'.toString()"> sys_bankaccount_control </when>
<when test="archivesType == '22'.toString()"> sys_assets_control </when>
</choose>
(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="leftAppId != null and leftAppId != ''"> left_app_id , </if>
<if test="leftAppCode != null and leftAppCode != ''"> left_app_code , </if>
<if test="leftAppName != null and leftAppName != ''"> left_app_name , </if>
<if test="leftApiId != null and leftApiId != ''"> left_api_id , </if>
<if test="leftId != null and leftId != ''"> left_id , </if>
<if test="leftCode != null and leftCode != ''"> left_code , </if>
<if test="leftName != null and leftName != ''"> left_name , </if>
<if test="rightAppId != null and rightAppId != ''"> right_app_id , </if>
<if test="rightAppCode != null and rightAppCode != ''"> right_app_code , </if>
<if test="rightAppName != null and rightAppName != ''"> right_app_name , </if>
<if test="rightApiId != null and rightApiId != ''"> right_api_id , </if>
<if test="rightId != null and rightId != ''"> right_id , </if>
<if test="rightCode != null and rightCode != ''"> right_code , </if>
<if test="rightName != null and rightName != ''"> right_name , </if>
<if test="sorts != null"> sorts , </if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="create_time != null"> create_time , </if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
<if test="modify_time != null"> modify_time , </if>
<if test="sts != null and sts != ''"> sts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if>
<if test="sts == null ">sts,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> #{id} ,</if>
<if test="leftAppId != null and leftAppId != ''"> #{leftAppId} ,</if>
<if test="leftAppCode != null and leftAppCode != ''"> #{leftAppCode} ,</if>
<if test="leftAppName != null and leftAppName != ''"> #{leftAppName} ,</if>
<if test="leftApiId != null and leftApiId != ''"> #{leftApiId} ,</if>
<if test="leftId != null and leftId != ''"> #{leftId} ,</if>
<if test="leftCode != null and leftCode != ''"> #{leftCode} ,</if>
<if test="leftName != null and leftName != ''"> #{leftName} ,</if>
<if test="rightAppId != null and rightAppId != ''"> #{rightAppId} ,</if>
<if test="rightAppCode != null and rightAppCode != ''"> #{rightAppCode} ,</if>
<if test="rightAppName != null and rightAppName != ''"> #{rightAppName} ,</if>
<if test="rightApiId != null and rightApiId != ''"> #{rightApiId} ,</if>
<if test="rightId != null and rightId != ''"> #{rightId} ,</if>
<if test="rightCode != null and rightCode != ''"> #{rightCode} ,</if>
<if test="rightName != null and rightName != ''"> #{rightName} ,</if>
<if test="sorts != null"> #{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="create_time != null"> #{create_time} ,</if>
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
<if test="modify_time != null"> #{modify_time} ,</if>
<if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!--通过主键修改方法-->
<update id="updateArchivesByType" parameterType = "com.hzya.frame.u8c.ax.entity.ArchivesEntity" >
update
<choose>
<when test="archivesType == '1'.toString()"> sys_personnel_control </when>
<when test="archivesType == '2'.toString()"> sys_org_control </when>
<when test="archivesType == '6'.toString()"> sys_stock_control </when>
<when test="archivesType == '73'.toString()"> sys_merchant_control </when>
<when test="archivesType == 'D01'.toString()"> sys_taxrate_control </when>
<when test="archivesType == 'jobass'.toString()"> sys_project_control </when>
<when test="archivesType == '93'.toString()"> sys_bank_control </when>
<when test="archivesType == '96'.toString()"> sys_bankaccount_control </when>
<when test="archivesType == '22'.toString()"> sys_assets_control </when>
</choose>
set
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id = #{id},</if>
<if test="leftAppId != null and leftAppId != ''"> left_app_id = #{leftAppId},</if>
<if test="leftAppCode != null and leftAppCode != ''"> left_app_code = #{leftAppCode},</if>
<if test="leftAppName != null and leftAppName != ''"> left_app_name = #{leftAppName},</if>
<if test="leftApiId != null and leftApiId != ''"> left_api_id = #{leftApiId},</if>
<if test="leftId != null and leftId != ''"> left_id = #{leftId},</if>
<if test="leftCode != null and leftCode != ''"> left_code = #{leftCode},</if>
<if test="leftName != null and leftName != ''"> left_name = #{leftName},</if>
<if test="rightAppId != null and rightAppId != ''"> right_app_id = #{rightAppId},</if>
<if test="rightAppCode != null and rightAppCode != ''"> right_app_code = #{rightAppCode},</if>
<if test="rightAppName != null and rightAppName != ''"> right_app_name = #{rightAppName},</if>
<if test="rightApiId != null and rightApiId != ''"> right_api_id = #{rightApiId},</if>
<if test="rightId != null and rightId != ''"> right_id = #{rightId},</if>
<if test="rightCode != null and rightCode != ''"> right_code = #{rightCode},</if>
<if test="rightName != null and rightName != ''"> right_name = #{rightName},</if>
<if test="sorts != null"> sorts = #{sorts},</if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
<if test="create_time != null"> create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null"> modify_time = #{modify_time},</if>
<if test="sts != null and sts != ''"> sts = #{sts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
</trim>
where right_id = #{rightId}
</update>
<!-- 多条件逻辑删除 -->
<update id="deleteArchivesByType" parameterType = "com.hzya.frame.u8c.ax.entity.ArchivesEntity" >
update
<choose>
<when test="archivesType == '1'.toString()"> sys_personnel_control </when>
<when test="archivesType == '2'.toString()"> sys_org_control </when>
<when test="archivesType == '6'.toString()"> sys_stock_control </when>
<when test="archivesType == '73'.toString()"> sys_merchant_control </when>
<when test="archivesType == 'D01'.toString()"> sys_taxrate_control </when>
<when test="archivesType == 'jobass'.toString()"> sys_project_control </when>
<when test="archivesType == '93'.toString()"> sys_bank_control </when>
<when test="archivesType == '96'.toString()"> sys_bankaccount_control </when>
<when test="archivesType == '22'.toString()"> sys_assets_control </when>
</choose>
set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="leftAppId != null and leftAppId != ''"> and left_app_id = #{leftAppId} </if>
<if test="leftAppCode != null and leftAppCode != ''"> and left_app_code = #{leftAppCode} </if>
<if test="leftAppName != null and leftAppName != ''"> and left_app_name = #{leftAppName} </if>
<if test="leftApiId != null and leftApiId != ''"> and left_api_id = #{leftApiId} </if>
<if test="leftId != null and leftId != ''"> and left_id = #{leftId} </if>
<if test="leftCode != null and leftCode != ''"> and left_code = #{leftCode} </if>
<if test="leftName != null and leftName != ''"> and left_name = #{leftName} </if>
<if test="rightAppId != null and rightAppId != ''"> and right_app_id = #{rightAppId} </if>
<if test="rightAppCode != null and rightAppCode != ''"> and right_app_code = #{rightAppCode} </if>
<if test="rightAppName != null and rightAppName != ''"> and right_app_name = #{rightAppName} </if>
<if test="rightApiId != null and rightApiId != ''"> and right_api_id = #{rightApiId} </if>
<if test="rightId != null and rightId != ''"> and right_id = #{rightId} </if>
<if test="rightCode != null and rightCode != ''"> and right_code = #{rightCode} </if>
<if test="rightName != null and rightName != ''"> and right_name = #{rightName} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
and sts='Y'
</trim>
</update>
</mapper>

View File

@ -0,0 +1,24 @@
package com.hzya.frame.u8c.ax.entity;
public class Ass {
private String checktypecode;
private String checkvaluecode;
public String getChecktypecode() {
return checktypecode;
}
public void setChecktypecode(String checktypecode) {
this.checktypecode = checktypecode;
}
public String getCheckvaluecode() {
return checkvaluecode;
}
public void setCheckvaluecode(String checkvaluecode) {
this.checkvaluecode = checkvaluecode;
}
}

View File

@ -0,0 +1,23 @@
package com.hzya.frame.u8c.ax.entity;
public class Cashflow {
private String money;
private String pk_cashflow;
public String getMoney() {
return money;
}
public void setMoney(String money) {
this.money = money;
}
public String getPk_cashflow() {
return pk_cashflow;
}
public void setPk_cashflow(String pk_cashflow) {
this.pk_cashflow = pk_cashflow;
}
}

View File

@ -0,0 +1,60 @@
package com.hzya.frame.u8c.ax.entity;
import java.util.List;
public class Voucher {
private List<VoucherDetails> details;
private String no;
private String pk_corp;
private String pk_glorgbook;
private String pk_prepared;
private String pk_vouchertype;
public List<VoucherDetails> getDetails() {
return details;
}
public void setDetails(List<VoucherDetails> details) {
this.details = details;
}
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public String getPk_corp() {
return pk_corp;
}
public void setPk_corp(String pk_corp) {
this.pk_corp = pk_corp;
}
public String getPk_glorgbook() {
return pk_glorgbook;
}
public void setPk_glorgbook(String pk_glorgbook) {
this.pk_glorgbook = pk_glorgbook;
}
public String getPk_prepared() {
return pk_prepared;
}
public void setPk_prepared(String pk_prepared) {
this.pk_prepared = pk_prepared;
}
public String getPk_vouchertype() {
return pk_vouchertype;
}
public void setPk_vouchertype(String pk_vouchertype) {
this.pk_vouchertype = pk_vouchertype;
}
}

View File

@ -0,0 +1,87 @@
package com.hzya.frame.u8c.ax.entity;
import java.util.List;
public class VoucherDetails {
private List<Ass> ass;
private List<Cashflow> cashflow;
private String creditamount;
private String debitamount;
private String explanation;
private String localcreditamount;
private String localdebitamount;
private String pk_accsubj;
private String pk_currtype;
public List<Ass> getAss() {
return ass;
}
public void setAss(List<Ass> ass) {
this.ass = ass;
}
public List<Cashflow> getCashflow() {
return cashflow;
}
public void setCashflow(List<Cashflow> cashflow) {
this.cashflow = cashflow;
}
public String getCreditamount() {
return creditamount;
}
public void setCreditamount(String creditamount) {
this.creditamount = creditamount;
}
public String getDebitamount() {
return debitamount;
}
public void setDebitamount(String debitamount) {
this.debitamount = debitamount;
}
public String getExplanation() {
return explanation;
}
public void setExplanation(String explanation) {
this.explanation = explanation;
}
public String getLocalcreditamount() {
return localcreditamount;
}
public void setLocalcreditamount(String localcreditamount) {
this.localcreditamount = localcreditamount;
}
public String getLocaldebitamount() {
return localdebitamount;
}
public void setLocaldebitamount(String localdebitamount) {
this.localdebitamount = localdebitamount;
}
public String getPk_accsubj() {
return pk_accsubj;
}
public void setPk_accsubj(String pk_accsubj) {
this.pk_accsubj = pk_accsubj;
}
public String getPk_currtype() {
return pk_currtype;
}
public void setPk_currtype(String pk_currtype) {
this.pk_currtype = pk_currtype;
}
}

View File

@ -0,0 +1,14 @@
package com.hzya.frame.u8c.ax.entity;
import java.util.List;
public class VoucherRoot {
private List<Voucher> voucher;
public List<Voucher> getVoucher() {
return voucher;
}
public void setVoucher(List<Voucher> voucher) {
this.voucher = voucher;
}
}

View File

@ -0,0 +1,41 @@
package com.hzya.frame.u8c.ax.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.u8c.ax.entity.ArchivesEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
public interface IAxService extends IBaseService<ArchivesEntity, String>{
/**
* @Author lvleigang
* @Description 凭证新增
* @Date 3:42 下午 2024/4/24
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
Object thirdInterfaceVoucherInsert(JSONObject object);
/**
* @Author lvleigang
* @Description 档案新增
* @Date 3:42 下午 2024/4/24
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity thirdInterfaceArchivesInsert(JSONObject object);
/**
* @Author lvleigang
* @Description 档案修改
* @Date 3:42 下午 2024/4/24
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity thirdInterfaceArchivesUpdate(JSONObject object);
/**
* @Author lvleigang
* @Description 档案删除
* @Date 3:42 下午 2024/4/24
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity thirdInterfaceArchivesDelete(JSONObject object);
}

View File

@ -0,0 +1,724 @@
package com.hzya.frame.u8c.ax.service.impl;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.u8c.ax.dao.IAxDao;
import com.hzya.frame.u8c.ax.entity.ArchivesEntity;
import com.hzya.frame.u8c.ax.entity.Ass;
import com.hzya.frame.u8c.ax.entity.Voucher;
import com.hzya.frame.u8c.ax.entity.VoucherDetails;
import com.hzya.frame.u8c.ax.entity.VoucherRoot;
import com.hzya.frame.u8c.ax.service.IAxService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* (BdCorp)表服务实现类
*
* @author makejava
* @since 2023-09-06 14:47:18
*/
@Service("axServiceImpl")
public class AxServiceImpl extends BaseService<ArchivesEntity, String> implements IAxService {
private IAxDao axDao;
@Autowired
public void setAxDao(IAxDao dao) {
this.axDao = dao;
this.dao = dao;
}
@Value("${ax.url}")
private String voucherUrl;
private final String publicKey = "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj";
private final String secretKey = "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=";
private final String appId = "800016";
private final String pzApiCode = "8000160014";//凭证新增
private final String ryApiCodexz = "8000160014";//人员对照新增
private final String ryApiCodexg = "8000160014";//人员对照修改
private final String ryApiCodesc = "8000160014";//人员对照删除
private final String bmApiCodexz = "8000160015";//部门档案新增
private final String bmApiCodexg = "8000160016";//部门档案修改
private final String bmApiCodesc = "8000160017";//部门档案删除
private final String chApiCodexz = "8000160021";//存货对照新增
private final String chApiCodexg = "8000160022";//存货对照修改
private final String chApiCodesc = "8000160023";//存货对照删除
private final String ksApiCodexz = "8000160014";//客商辅助核算新增
private final String ksApiCodexg = "8000160014";//客商辅助核算修改
private final String ksApiCodesc = "8000160014";//客商辅助核算删除
private final String slApiCodexz = "8000160014";//税率新增
private final String slApiCodexg = "8000160014";//税率修改
private final String slApiCodesc = "8000160014";//税率删除
private final String xmApiCodexz = "8000160021";//项目辅助核算新增
private final String xmApiCodexg = "8000160022";//项目辅助核算修改
private final String xmApiCodesc = "8000160023";//项目辅助核算删除
private final String yhlbApiCodexz = "8000160014";//银行类别新增
private final String yhlbApiCodexg = "8000160014";//银行类别修改
private final String yhlbApiCodesc = "8000160014";//银行类别删除
private final String yhzhApiCodexz = "8000160014";//银行账户新增
private final String yhzhApiCodexg = "8000160014";//银行账户修改
private final String yhzhApiCodesc = "8000160014";//银行账户删除
private final String zcApiCodexz = "8000160014";//资产类别新增
private final String zcApiCodexg = "8000160014";//资产类别修改
private final String zcApiCodesc = "8000160014";//资产类别删除
private final Object lock = new Object();
/**
* @Author lvleigang
* @Description 凭证新增
* @Date 3:42 下午 2024/4/24
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
@Override
public Object thirdInterfaceVoucherInsert(JSONObject object) {
JSONObject jsonObject = object.getJSONObject("jsonStr");
if(jsonObject == null ){
return BaseResult.getFailureMessageEntity("数据为空,请先传递数据");
}
if(!checkStr(jsonObject.getString("usercode"))){
return BaseResult.getFailureMessageEntity("usercode为空");
}
if(!checkStr(jsonObject.getString("password"))){
return BaseResult.getFailureMessageEntity("password为空");
}
if(!checkStr(jsonObject.getString("trantype"))){
return BaseResult.getFailureMessageEntity("trantype为空");
}
if(!checkStr(jsonObject.getString("system"))){
return BaseResult.getFailureMessageEntity("system为空");
}
if(!checkStr(jsonObject.getString("data"))){
return BaseResult.getFailureMessageEntity("data为空");
}
VoucherRoot entity = getData("data", jsonObject, VoucherRoot.class);
if(entity == null || entity.getVoucher() == null || entity.getVoucher().size() == 0){
return BaseResult.getFailureMessageEntity("data为空");
}
List<String> fzhs = Arrays.asList(new String[]{"1", "2", "6", "73", "D01" , "jobass" , "93" , "96", "22"});
for (int i = 0; i < entity.getVoucher().size(); i++) {
Voucher voucher = entity.getVoucher().get(i);
if(voucher.getDetails() != null && voucher.getDetails().size() > 0){
for (int a = 0; a < voucher.getDetails().size(); a++) {
VoucherDetails voucherDetails = voucher.getDetails().get(a);
if(voucherDetails.getAss() != null && voucherDetails.getAss().size() > 0){
for (int b = 0; b < voucherDetails.getAss().size(); b++) {
Ass ass = voucherDetails.getAss().get(b);
if(ass.getChecktypecode() != null && !"".equals(ass.getChecktypecode())){
//存在需要转换的
if(fzhs.contains(ass.getChecktypecode())){
ArchivesEntity archivesEntity = new ArchivesEntity();
archivesEntity.setArchivesType(ass.getChecktypecode());
archivesEntity.setLeftCode(ass.getCheckvaluecode());
//List<ArchivesEntity> archivesEntities = axDao.queryArchivesData(archivesEntity);
//if(archivesEntities != null && archivesEntities.size() > 0){
// ass.setCheckvaluecode(archivesEntities.get(0).getRightCode());
//}
}
}
}
}
}
}
}
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
// HttpClient
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
HttpPost post = new HttpPost(voucherUrl);
CloseableHttpResponse response = null;
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(60000).build();
post.setConfig(requestConfig);//设置请求参数超时时间
post.setHeader("usercode", jsonObject.getString("usercode"));
post.setHeader("password", jsonObject.getString("password"));
post.setHeader("trantype", jsonObject.getString("trantype"));
post.setHeader("system", jsonObject.getString("system"));
post.setHeader("publicKey", publicKey);
post.setHeader("secretKey", secretKey);
post.setHeader("appId", appId);
post.setHeader("apiCode", pzApiCode);
StringBuilder body = new StringBuilder();
String bodys = JSON.toJSONString(entity);
try {
if (bodys != null && !"".equals(bodys)) {
ByteArrayEntity byteArrayEntity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
byteArrayEntity.setContentType("application/json");
post.setEntity(byteArrayEntity);
}
response = closeableHttpClient.execute(post);
HttpEntity httpEntity = response.getEntity();
synchronized (lock) {
body.append(EntityUtils.toString(httpEntity));
}
logger.info("返回结果:" + body);
JsonResultEntity resultEntity = JSON.parseObject(body.toString(),JsonResultEntity.class);
return resultEntity.getAttribute();
} catch (Exception e) {
logger.error("请求错误:" + e.getMessage());
body.append(e.getMessage());
return BaseResult.getFailureMessageEntity("转发失败",body);
}finally {
try {
// 关闭响应对象
if (response != null) {
response.close();
}
// 关闭响应对象
if (closeableHttpClient != null) {
closeableHttpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* @Author lvleigang
* @Description 档案新增
* @Date 3:42 下午 2024/4/24
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
@Override
public JsonResultEntity thirdInterfaceArchivesInsert(JSONObject object) {
JSONObject jsonObject = object.getJSONObject("jsonStr");
if(jsonObject == null ){
return BaseResult.getFailureMessageEntity("数据为空,请先传递数据");
}
if(!checkStr(jsonObject.getString("archivesType"))){
return BaseResult.getFailureMessageEntity("档案类型为空");
}
if(!checkStr(jsonObject.getString("usercode"))){
return BaseResult.getFailureMessageEntity("usercode为空");
}
if(!checkStr(jsonObject.getString("password"))){
return BaseResult.getFailureMessageEntity("password为空");
}
if(!checkStr(jsonObject.getString("trantype"))){
return BaseResult.getFailureMessageEntity("trantype为空");
}
if(!checkStr(jsonObject.getString("system"))){
return BaseResult.getFailureMessageEntity("system为空");
}
if(!checkStr(jsonObject.getString("data"))){
return BaseResult.getFailureMessageEntity("data为空");
}
List<String> fzhs = Arrays.asList(new String[]{"1", "2", "6", "73", "D01" , "jobass" , "93" , "96", "22"});
if(!fzhs.contains(jsonObject.getString("archivesType"))){
return BaseResult.getFailureMessageEntity("档案类型错误,请联系管理员");
}
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
// HttpClient
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
HttpPost post = new HttpPost(voucherUrl);
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(60000).build();
post.setConfig(requestConfig);//设置请求参数超时时间
post.setHeader("usercode", jsonObject.getString("usercode"));
post.setHeader("password", jsonObject.getString("password"));
post.setHeader("trantype", jsonObject.getString("trantype"));
post.setHeader("system", jsonObject.getString("system"));
post.setHeader("publicKey", publicKey);
post.setHeader("secretKey", secretKey);
post.setHeader("appId", appId);
CloseableHttpResponse response = null;
switch (jsonObject.getString("archivesType")){
case "1"://人员对照
post.setHeader("apiCode", ryApiCodexz);
break;
case "2"://部门档案
post.setHeader("apiCode", bmApiCodexz);
break;
case "6"://存货对照
post.setHeader("apiCode", chApiCodexz);
break;
case "73"://客商辅助核算
post.setHeader("apiCode", ksApiCodexz);
break;
case "D01"://税率
post.setHeader("apiCode", slApiCodexz);
break;
case "jobass"://项目辅助核算
post.setHeader("apiCode", xmApiCodexz);
break;
case "93"://银行类别
post.setHeader("apiCode", yhlbApiCodexz);
break;
case "96"://银行账户
post.setHeader("apiCode", yhzhApiCodexz);
break;
case "22"://资产类别
post.setHeader("apiCode", zcApiCodexz);
break;
default:
break;
}
StringBuilder body = new StringBuilder();
try {
ByteArrayEntity byteArrayEntity = new ByteArrayEntity(jsonObject.getString("data").getBytes("UTF-8"));
byteArrayEntity.setContentType("application/json");
post.setEntity(byteArrayEntity);
response = closeableHttpClient.execute(post);
HttpEntity httpEntity = response.getEntity();
synchronized (lock) {
body.append(EntityUtils.toString(httpEntity));
}
logger.info("返回结果:" + body);
JsonResultEntity resultEntity = JSON.parseObject(body.toString(),JsonResultEntity.class);
if(resultEntity.isFlag() && "200".equals(resultEntity.getStatus())){
if(JSONUtil.isTypeJSON(resultEntity.getAttribute().toString())){
//JSONObject attribute = JSONObject.parseObject(resultEntity.getAttribute().toString());
JSONObject attribute = JSONObject.parseObject("{\n" +
" \"status\": \"success\",\n" +
" \"data\": \"[{\\\"pk_invcl\\\":\\\"0001F11000000000I6NN\\\",\\\"invclasscode\\\":\\\"04\\\",\\\"invclassname\\\":\\\"成品测试\\\",\\\"invclasslev\\\":\\\"1\\\",\\\"pk_corp\\\":\\\"0001\\\",\\\"unitcode\\\":\\\"0001\\\",\\\"unitname\\\":\\\"集团\\\"}]\",\n" +
" \"taskNumber\": \"202404250048\"\n" +
"}");
if("success".equals(attribute.getString("status"))){
if(attribute.getString("data") == null || "".equals(attribute.getString("data")) ){
return resultEntity;
}
JSONArray jsonArray = JSONArray.parseArray(attribute.getString("data"));
if(jsonArray == null || jsonArray.size() == 0 ){
return resultEntity;
}
//解析具体数据
switch (jsonObject.getString("archivesType")){
case "1"://人员对照
break;
case "2"://部门档案
break;
case "6"://存货对照
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object1 = jsonArray.getJSONObject(i);
ArchivesEntity archivesEntity = new ArchivesEntity();
archivesEntity.setArchivesType(jsonObject.getString("archivesType"));
archivesEntity.setCreate();
archivesEntity.setLeftCode(object1.getString("invclasscode"));//
archivesEntity.setLeftName(object1.getString("invclassname"));//
archivesEntity.setRightId(object1.getString("pk_invcl"));//
archivesEntity.setRightCode(object1.getString("invclasscode"));//
archivesEntity.setRightName(object1.getString("invclassname"));//
axDao.saveArchivesByType(archivesEntity);
}
break;
case "73"://客商辅助核算
break;
case "D01"://税率
break;
case "jobass"://项目辅助核算
break;
case "93"://银行类别
break;
case "96"://银行账户
break;
case "22"://资产类别
break;
default:
break;
}
return resultEntity;
}else {
return resultEntity;
}
}else {
return resultEntity;
}
}else {
//解析返回
return resultEntity;
}
} catch (Exception e) {
logger.error("请求错误:" + e.getMessage());
body.append(e.getMessage());
return BaseResult.getFailureMessageEntity("转发失败",body);
}finally {
try {
// 关闭响应对象
if (response != null) {
response.close();
}
// 关闭响应对象
if (closeableHttpClient != null) {
closeableHttpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* @Author lvleigang
* @Description 档案修改
* @Date 3:42 下午 2024/4/24
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
@Override
public JsonResultEntity thirdInterfaceArchivesUpdate(JSONObject object) {
JSONObject jsonObject = object.getJSONObject("jsonStr");
if(jsonObject == null ){
return BaseResult.getFailureMessageEntity("数据为空,请先传递数据");
}
if(!checkStr(jsonObject.getString("archivesType"))){
return BaseResult.getFailureMessageEntity("档案类型为空");
}
if(!checkStr(jsonObject.getString("usercode"))){
return BaseResult.getFailureMessageEntity("usercode为空");
}
if(!checkStr(jsonObject.getString("password"))){
return BaseResult.getFailureMessageEntity("password为空");
}
if(!checkStr(jsonObject.getString("trantype"))){
return BaseResult.getFailureMessageEntity("trantype为空");
}
if(!checkStr(jsonObject.getString("system"))){
return BaseResult.getFailureMessageEntity("system为空");
}
if(!checkStr(jsonObject.getString("data"))){
return BaseResult.getFailureMessageEntity("data为空");
}
List<String> fzhs = Arrays.asList(new String[]{"1", "2", "6", "73", "D01" , "jobass" , "93" , "96", "22"});
if(!fzhs.contains(jsonObject.getString("archivesType"))){
return BaseResult.getFailureMessageEntity("档案类型错误,请联系管理员");
}
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
// HttpClient
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
HttpPost post = new HttpPost(voucherUrl);
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(60000).build();
post.setConfig(requestConfig);//设置请求参数超时时间
post.setHeader("usercode", jsonObject.getString("usercode"));
post.setHeader("password", jsonObject.getString("password"));
post.setHeader("trantype", jsonObject.getString("trantype"));
post.setHeader("system", jsonObject.getString("system"));
post.setHeader("publicKey", publicKey);
post.setHeader("secretKey", secretKey);
post.setHeader("appId", appId);
CloseableHttpResponse response = null;
switch (jsonObject.getString("archivesType")){
case "1"://人员对照
post.setHeader("apiCode", ryApiCodexg);
break;
case "2"://部门档案
post.setHeader("apiCode", bmApiCodexg);
break;
case "6"://存货对照
post.setHeader("apiCode", chApiCodexg);
break;
case "73"://客商辅助核算
post.setHeader("apiCode", ksApiCodexg);
break;
case "D01"://税率
post.setHeader("apiCode", slApiCodexg);
break;
case "jobass"://项目辅助核算
post.setHeader("apiCode", xmApiCodexg);
break;
case "93"://银行类别
post.setHeader("apiCode", yhlbApiCodexg);
break;
case "96"://银行账户
post.setHeader("apiCode", yhzhApiCodexg);
break;
case "22"://资产类别
post.setHeader("apiCode", zcApiCodexg);
break;
default:
break;
}
StringBuilder body = new StringBuilder();
try {
ByteArrayEntity byteArrayEntity = new ByteArrayEntity(jsonObject.getString("data").getBytes("UTF-8"));
byteArrayEntity.setContentType("application/json");
post.setEntity(byteArrayEntity);
response = closeableHttpClient.execute(post);
HttpEntity httpEntity = response.getEntity();
synchronized (lock) {
body.append(EntityUtils.toString(httpEntity));
}
logger.info("返回结果:" + body);
JsonResultEntity resultEntity = JSON.parseObject(body.toString(),JsonResultEntity.class);
if(resultEntity.isFlag() && "200".equals(resultEntity.getStatus())){
if(JSONUtil.isTypeJSON(resultEntity.getAttribute().toString())){
//JSONObject attribute = JSONObject.parseObject(resultEntity.getAttribute().toString());
JSONObject attribute = JSONObject.parseObject("{\n" +
" \"status\": \"success\",\n" +
" \"data\": \"[{\\\"pk_invcl\\\":\\\"0001F11000000000I6NN\\\",\\\"invclasscode\\\":\\\"04\\\",\\\"invclassname\\\":\\\"成品测试\\\",\\\"invclasslev\\\":\\\"1\\\",\\\"pk_corp\\\":\\\"0001\\\",\\\"unitcode\\\":\\\"0001\\\",\\\"unitname\\\":\\\"集团\\\"}]\",\n" +
" \"taskNumber\": \"202404250048\"\n" +
"}");
if("success".equals(attribute.getString("status"))){
if(attribute.getString("data") == null || "".equals(attribute.getString("data")) ){
return resultEntity;
}
JSONArray jsonArray = JSONArray.parseArray(attribute.getString("data"));
if(jsonArray == null || jsonArray.size() == 0 ){
return resultEntity;
}
//解析具体数据
switch (jsonObject.getString("archivesType")){
case "1"://人员对照
break;
case "2"://部门档案
break;
case "6"://存货对照
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object1 = jsonArray.getJSONObject(i);
ArchivesEntity archivesEntity = new ArchivesEntity();
archivesEntity.setArchivesType(jsonObject.getString("archivesType"));
archivesEntity.setUpdate();
archivesEntity.setLeftCode(object1.getString("invclasscode"));//
archivesEntity.setLeftName(object1.getString("invclassname"));//
archivesEntity.setRightId(object1.getString("pk_invcl"));//
archivesEntity.setRightCode(object1.getString("invclasscode"));//
archivesEntity.setRightName(object1.getString("invclassname"));//
axDao.updateArchivesByType(archivesEntity);
}
break;
case "73"://客商辅助核算
break;
case "D01"://税率
break;
case "jobass"://项目辅助核算
break;
case "93"://银行类别
break;
case "96"://银行账户
break;
case "22"://资产类别
break;
default:
break;
}
return resultEntity;
}else {
return resultEntity;
}
}else {
return resultEntity;
}
}else {
//解析返回
return resultEntity;
}
} catch (Exception e) {
logger.error("请求错误:" + e.getMessage());
body.append(e.getMessage());
return BaseResult.getFailureMessageEntity("转发失败",body);
}finally {
try {
// 关闭响应对象
if (response != null) {
response.close();
}
// 关闭响应对象
if (closeableHttpClient != null) {
closeableHttpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* @Author lvleigang
* @Description 档案删除
* @Date 3:42 下午 2024/4/24
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
@Override
public JsonResultEntity thirdInterfaceArchivesDelete(JSONObject object) {
JSONObject jsonObject = object.getJSONObject("jsonStr");
if(jsonObject == null ){
return BaseResult.getFailureMessageEntity("数据为空,请先传递数据");
}
if(!checkStr(jsonObject.getString("archivesType"))){
return BaseResult.getFailureMessageEntity("档案类型为空");
}
if(!checkStr(jsonObject.getString("usercode"))){
return BaseResult.getFailureMessageEntity("usercode为空");
}
if(!checkStr(jsonObject.getString("password"))){
return BaseResult.getFailureMessageEntity("password为空");
}
if(!checkStr(jsonObject.getString("trantype"))){
return BaseResult.getFailureMessageEntity("trantype为空");
}
if(!checkStr(jsonObject.getString("system"))){
return BaseResult.getFailureMessageEntity("system为空");
}
if(!checkStr(jsonObject.getString("data"))){
return BaseResult.getFailureMessageEntity("data为空");
}
List<String> fzhs = Arrays.asList(new String[]{"1", "2", "6", "73", "D01" , "jobass" , "93" , "96", "22"});
if(!fzhs.contains(jsonObject.getString("archivesType"))){
return BaseResult.getFailureMessageEntity("档案类型错误,请联系管理员");
}
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
// HttpClient
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
HttpPost post = new HttpPost(voucherUrl);
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(60000).build();
post.setConfig(requestConfig);//设置请求参数超时时间
post.setHeader("usercode", jsonObject.getString("usercode"));
post.setHeader("password", jsonObject.getString("password"));
post.setHeader("trantype", jsonObject.getString("trantype"));
post.setHeader("system", jsonObject.getString("system"));
post.setHeader("publicKey", publicKey);
post.setHeader("secretKey", secretKey);
post.setHeader("appId", appId);
CloseableHttpResponse response = null;
switch (jsonObject.getString("archivesType")){
case "1"://人员对照
post.setHeader("apiCode", ryApiCodesc);
break;
case "2"://部门档案
post.setHeader("apiCode", bmApiCodesc);
break;
case "6"://存货对照
post.setHeader("apiCode", chApiCodesc);
break;
case "73"://客商辅助核算
post.setHeader("apiCode", ksApiCodesc);
break;
case "D01"://税率
post.setHeader("apiCode", slApiCodesc);
break;
case "jobass"://项目辅助核算
post.setHeader("apiCode", xmApiCodesc);
break;
case "93"://银行类别
post.setHeader("apiCode", yhlbApiCodesc);
break;
case "96"://银行账户
post.setHeader("apiCode", yhzhApiCodesc);
break;
case "22"://资产类别
post.setHeader("apiCode", zcApiCodesc);
break;
default:
break;
}
StringBuilder body = new StringBuilder();
try {
ByteArrayEntity byteArrayEntity = new ByteArrayEntity(jsonObject.getString("data").getBytes("UTF-8"));
byteArrayEntity.setContentType("application/json");
post.setEntity(byteArrayEntity);
response = closeableHttpClient.execute(post);
HttpEntity httpEntity = response.getEntity();
synchronized (lock) {
body.append(EntityUtils.toString(httpEntity));
}
logger.info("返回结果:" + body);
JsonResultEntity resultEntity = JSON.parseObject(body.toString(),JsonResultEntity.class);
if(resultEntity.isFlag() && "200".equals(resultEntity.getStatus())){
if(JSONUtil.isTypeJSON(resultEntity.getAttribute().toString())){
//JSONObject attribute = JSONObject.parseObject(resultEntity.getAttribute().toString());
JSONObject attribute = JSONObject.parseObject("{\n" +
" \"status\": \"success\",\n" +
" \"data\": \"[{\\\"pk_invcl\\\":\\\"0001F11000000000I6NN\\\",\\\"invclasscode\\\":\\\"04\\\",\\\"invclassname\\\":\\\"成品测试\\\",\\\"invclasslev\\\":\\\"1\\\",\\\"pk_corp\\\":\\\"0001\\\",\\\"unitcode\\\":\\\"0001\\\",\\\"unitname\\\":\\\"集团\\\"}]\",\n" +
" \"taskNumber\": \"202404250048\"\n" +
"}");
if("success".equals(attribute.getString("status"))){
if(attribute.getString("data") == null || "".equals(attribute.getString("data")) ){
return resultEntity;
}
JSONArray jsonArray = JSONArray.parseArray(attribute.getString("data"));
if(jsonArray == null || jsonArray.size() == 0 ){
return resultEntity;
}
//解析具体数据
switch (jsonObject.getString("archivesType")){
case "1"://人员对照
break;
case "2"://部门档案
break;
case "6"://存货对照
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object1 = jsonArray.getJSONObject(i);
ArchivesEntity archivesEntity = new ArchivesEntity();
archivesEntity.setArchivesType(jsonObject.getString("archivesType"));
archivesEntity.setUpdate();
archivesEntity.setLeftCode(object1.getString("invclasscode"));//
archivesEntity.setLeftName(object1.getString("invclassname"));//
archivesEntity.setRightId(object1.getString("pk_invcl"));//
archivesEntity.setRightCode(object1.getString("invclasscode"));//
archivesEntity.setRightName(object1.getString("invclassname"));//
axDao.deleteArchivesByType(archivesEntity);
}
break;
case "73"://客商辅助核算
break;
case "D01"://税率
break;
case "jobass"://项目辅助核算
break;
case "93"://银行类别
break;
case "96"://银行账户
break;
case "22"://资产类别
break;
default:
break;
}
return resultEntity;
}else {
return resultEntity;
}
}else {
return resultEntity;
}
}else {
//解析返回
return resultEntity;
}
} catch (Exception e) {
logger.error("请求错误:" + e.getMessage());
body.append(e.getMessage());
return BaseResult.getFailureMessageEntity("转发失败",body);
}finally {
try {
// 关闭响应对象
if (response != null) {
response.close();
}
// 关闭响应对象
if (closeableHttpClient != null) {
closeableHttpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@ -56,6 +56,13 @@ public class EntranceController {
public JsonResultEntity option(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { public JsonResultEntity option(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
return entranceService.doBusiness(servletRequest, servletResponse); return entranceService.doBusiness(servletRequest, servletResponse);
} }
//平台接口
@RequestMapping(value = "/platformInterface")
@ResponseBody
public Object centerInterFace(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
return entranceService.platformInterface(servletRequest, servletResponse);
}
/*** /***
* 文件上传接口 /entranceController/fileUpload * 文件上传接口 /entranceController/fileUpload
* @param * @param

View File

@ -8,6 +8,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import java.lang.reflect.InvocationTargetException;
/** /**
* @Content * @Content
@ -40,5 +41,6 @@ public interface IEntranceService {
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
**/ **/
JsonResultEntity fileUpload(MultipartFile file, FileResultEntity entity, ServletRequest servletRequest, ServletResponse servletResponse) throws Exception; JsonResultEntity fileUpload(MultipartFile file, FileResultEntity entity, ServletRequest servletRequest, ServletResponse servletResponse) throws Exception;
//平台接口
Object platformInterface(ServletRequest servletRequest, ServletResponse servletResponse) throws InvocationTargetException, IllegalAccessException;
} }

View File

@ -237,8 +237,113 @@ public class EntranceServiceImpl implements IEntranceService {
return BaseResult.getSuccessMessageEntity("附件上传成功",entity); return BaseResult.getSuccessMessageEntity("附件上传成功",entity);
} }
@Override
public Object platformInterface(ServletRequest servletRequest, ServletResponse servletResponse) throws InvocationTargetException, IllegalAccessException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
//tailuo 要访问的Bean名称
String service = request.getHeader("tl");
//bean方法
String serviceMethod = request.getHeader("dj");
String body = ServletUtil.getBody(servletRequest);
//获取类
Object object = null;
if(service == null || "".equals(service) || serviceMethod == null || "".equals(serviceMethod)){
return BaseResult.getFailureMessageEntity("非法请求,请检查");
}
try {
object = ApplicationContextUtil.getBeanByName(service);
} catch (SecurityException e) {
return BaseResult.getFailureMessageEntity(service + "未找到");
}
//获取类下面的方法
Method[] methods = object.getClass().getMethods();
logger.info("methodsLength:" + methods.length);
if (methods == null || methods.length == 0) {
logger.info("当前methods:" + methods + "methodsLength = " + methods.length);
return BaseResult.getFailureMessageEntity(service + "未找到" + serviceMethod + "方法");
} else {
logger.error("当前methods:" + methods + "methodsLength = " + methods.length);
}
for (Method m : methods) {
logger.info("当前mnAME:" + m.getName() + " :serviceMethod = " + serviceMethod.trim());
if (null != m) {
if (m.getName().equals(serviceMethod.trim())) {
if (m.getName().startsWith("thirdInterface")) {//TODO 后续可能要加强校验规则
logger.info("第三方接口,不校验是否登陆");
}else if (!"doLogin".equals(m.getName())) {
try {
StpUtil.checkLogin();
//校验当前登陆人是否有权限
boolean flag = false;
String userId = StpUtil.getLoginIdAsString();
//获取接口
SysInterfaceEntity sysInterfaceEntity = (SysInterfaceEntity) interfaceCache.get("6","beanName"+service+"interfacName"+serviceMethod);
if(sysInterfaceEntity == null || sysInterfaceEntity.getId() == null){
//todo 接口权限验证
return BaseResult.getFailureMessageEntity("用户无访问权限,请联系管理员");
}
//查询用户权限
if(!flag){
SysPopedomInterfaceEntity userPopedomInterfaceEntity = (SysPopedomInterfaceEntity) interfaceCache.get("4","userId"+userId+"interfaceId"+sysInterfaceEntity.getId());
if(userPopedomInterfaceEntity != null && userPopedomInterfaceEntity.getId() != null ){
flag = true;
}
}
//查询用户角色的权限
if(!flag){
List<SysUserRolesEntity> userRoleMap = (List<SysUserRolesEntity>) interfaceCache.get("3",null);
if(userRoleMap != null && userRoleMap.size() > 0){
for (SysUserRolesEntity sysUserRolesEntity : userRoleMap) {
if(sysUserRolesEntity.getUserId().equals(userId)){
SysPopedomInterfaceEntity sysPopedomInterfaceEntity = (SysPopedomInterfaceEntity) interfaceCache.get("5","roleId"+sysUserRolesEntity.getRoleId()+"interfaceId"+sysInterfaceEntity.getId());
if(sysPopedomInterfaceEntity != null && sysPopedomInterfaceEntity.getId() != null ){
flag = true;
break;
}
}
}
}
}
if(!flag){
//todo 接口权限验证
return BaseResult.getFailureMessageEntity("用户无访问权限,请联系管理员");
}
} catch (NotLoginException e) {
logger.error("token无效");
return BaseResult.getFailureMessageEntity("token无效");
}
}
logger.info("m.getNameEquals成功");
JSONObject jsonObject = new JSONObject();
if (!ObjectUtils.isEmpty(body)) {
jsonObject.put("jsonStr", body);
}
JsonResultEntity jsonResultEntity;
try {
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
logger.info("请求的参数jsonObject" + jsonObject.toJSONString());
Object result = m.invoke(object, jsonObject);
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
return result;
} catch (Exception e) {
logger.error("METHOD doBusiness invokeException{}", e.getMessage());
if (e instanceof InvocationTargetException) {
Throwable targetException = ((InvocationTargetException) e).getTargetException();
if (targetException instanceof BaseSystemException) {
throw new BaseSystemException(targetException.getMessage());
} else {
logger.info("METHOD doBusiness :{}", e.getMessage());
throw e;
}
} else {
throw e;
}
}
}
}
}
throw new BaseSystemException( service + "未找到" + serviceMethod + "方法") ;
}
@Override @Override