澳星档案新增

This commit is contained in:
lvleigang 2024-04-25 13:39:17 +08:00
parent ed310c5802
commit 822de45128
9 changed files with 885 additions and 27 deletions

View File

@ -1,20 +1,22 @@
#######################本地环境#######################
#######################澳星环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
file:
# 日志保存路径
path: /Users/apple/Desktop/log/local
path: E:\yongansystem\log
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?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
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: bd993088e8a7c3dc5f44441617f9b4bf
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /Users/apple/Desktop/log/local
path: E:\yongansystem\file
ax:
url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -15,4 +15,6 @@ spring:
password: bd993088e8a7c3dc5f44441617f9b4bf
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
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可省略此配置
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
public void test01() {
String a = AESUtil.encrypt("hzya1314");
String a = AESUtil.encrypt("hzya@1314");
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

@ -14,5 +14,11 @@ import java.util.List;
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

@ -22,5 +22,21 @@ public class AxDaoImpl extends MybatisGenericDao<ArchivesEntity, String> impleme
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

@ -1,7 +1,11 @@
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)实体类
*
@ -14,6 +18,19 @@ public class ArchivesEntity extends BaseEntity {
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;
}
@ -37,5 +54,117 @@ public class ArchivesEntity extends BaseEntity {
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

@ -2,25 +2,46 @@
<!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="leftCode" column="left_code" jdbcType="VARCHAR"/>
<result property="rightCode" column="right_code" jdbcType="VARCHAR"/>
<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.sysnew.user.entity.SysUserEntity">
parameterType="com.hzya.frame.u8c.ax.entity.ArchivesEntity">
select
right_code
from
<choose>
<when test="archivesType == '1'"> sys_personnel_control </when>
<when test="archivesType == '2'"> sys_org_control </when>
<when test="archivesType == '6'"> sys_stock_control </when>
<when test="archivesType == '73'"> sys_merchant_control </when>
<when test="archivesType == 'D01'"> sys_taxrate_control </when>
<when test="archivesType == 'jobass'"> sys_project_control </when>
<when test="archivesType == '93'"> sys_bank_control </when>
<when test="archivesType == '96'"> sys_bankaccount_control </when>
<when test="archivesType == '22'"> sys_assets_control </when>
<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>
@ -29,7 +50,157 @@
</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

@ -1,8 +1,9 @@
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.sysnew.user.entity.SysUserEntity;
import com.hzya.frame.u8c.ax.dao.IAxDao;
import com.hzya.frame.u8c.ax.entity.ArchivesEntity;
import com.hzya.frame.u8c.ax.entity.Ass;
@ -20,11 +21,14 @@ 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;
@ -42,11 +46,49 @@ public class AxServiceImpl extends BaseService<ArchivesEntity, String> implement
this.axDao = dao;
this.dao = dao;
}
private final String voucherUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface";
@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 apiCode = "8000160014";
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();
/**
@ -123,7 +165,7 @@ public class AxServiceImpl extends BaseService<ArchivesEntity, String> implement
post.setHeader("publicKey", publicKey);
post.setHeader("secretKey", secretKey);
post.setHeader("appId", appId);
post.setHeader("apiCode", apiCode);
post.setHeader("apiCode", pzApiCode);
StringBuilder body = new StringBuilder();
String bodys = JSON.toJSONString(entity);
try {
@ -169,7 +211,169 @@ public class AxServiceImpl extends BaseService<ArchivesEntity, String> implement
**/
@Override
public JsonResultEntity thirdInterfaceArchivesInsert(JSONObject object) {
return null;
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
@ -180,7 +384,169 @@ public class AxServiceImpl extends BaseService<ArchivesEntity, String> implement
**/
@Override
public JsonResultEntity thirdInterfaceArchivesUpdate(JSONObject object) {
return null;
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
@ -191,6 +557,168 @@ public class AxServiceImpl extends BaseService<ArchivesEntity, String> implement
**/
@Override
public JsonResultEntity thirdInterfaceArchivesDelete(JSONObject object) {
return null;
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();
}
}
}
}