Merge branch 'ht' of http://ufidahz.com.cn:9015/hzya/kangarooDataCenterV3 into ht
# Conflicts: # base-buildpackage/pom.xml
This commit is contained in:
commit
f416e7e07b
|
@ -49,6 +49,12 @@
|
|||
<profile.active>xel</profile.active>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>llg</id> <!--开发环境-->
|
||||
<properties>
|
||||
<profile.active>llg</profile.active>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
<build>
|
||||
<finalName>kangarooDataCenterV3</finalName>
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.hzya.frame.plugin.incomeInvoiceData.dao;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户档案(mdm_customer: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public interface IIncomeInvoiceDao extends IBaseDao<IncomeInvoiceEntity, String> {
|
||||
|
||||
|
||||
List<JSONObject> queryData(JSONObject saveData);
|
||||
|
||||
int saveDetailData(JSONObject saveDetailData);
|
||||
|
||||
int saveData(JSONObject saveData);
|
||||
|
||||
List<IncomeInvoiceEntity> queryOaZb(IncomeInvoiceEntity incomeInvoiceEntity);
|
||||
|
||||
List<IncomeInvoiceEntity> queryOaMx(IncomeInvoiceEntity incomeInvoiceEntity);
|
||||
|
||||
int updateMx(IncomeInvoiceEntity incomeInvoiceEntity);
|
||||
|
||||
int saveMx(IncomeInvoiceEntity incomeInvoiceEntity);
|
||||
|
||||
List<IncomeInvoiceEntity> queryZtzz(IncomeInvoiceEntity entity);
|
||||
|
||||
List<JSONObject> queryByAloneId(IncomeInvoiceEntity jnquerydata);
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package com.hzya.frame.plugin.incomeInvoiceData.dao.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.dao.IIncomeInvoiceDao;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class IncomeInvoiceDaoImpl extends MybatisGenericDao<IncomeInvoiceEntity, String> implements IIncomeInvoiceDao {
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryData(JSONObject saveData) {
|
||||
List<JSONObject> o = (List<JSONObject>) super.selectList(getSqlIdPrifx() + "queryData", saveData);
|
||||
return o;
|
||||
}
|
||||
@Override
|
||||
public int saveData(JSONObject saveData) {
|
||||
return super.insert(getSqlIdPrifx() + "saveData", saveData);
|
||||
}
|
||||
@Override
|
||||
public int saveDetailData(JSONObject saveData) {
|
||||
return super.insert(getSqlIdPrifx() + "saveDetailData", saveData);
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<IncomeInvoiceEntity> queryOaZb(IncomeInvoiceEntity entity) {
|
||||
List<IncomeInvoiceEntity> o = (List<IncomeInvoiceEntity>) super.selectList(getSqlIdPrifx() + "queryOaZb", entity);
|
||||
return o;
|
||||
}
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<IncomeInvoiceEntity> queryOaMx(IncomeInvoiceEntity entity) {
|
||||
List<IncomeInvoiceEntity> o = (List<IncomeInvoiceEntity>) super.selectList(getSqlIdPrifx() + "queryOaMx", entity);
|
||||
return o;
|
||||
}
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public int updateMx(IncomeInvoiceEntity entity) {
|
||||
return super.update(getSqlIdPrifx() + "updateMx", entity);
|
||||
}
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public int saveMx(IncomeInvoiceEntity entity) {
|
||||
return super.insert(getSqlIdPrifx() + "saveMx", entity);
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<IncomeInvoiceEntity> queryZtzz(IncomeInvoiceEntity entity) {
|
||||
List<IncomeInvoiceEntity> o = (List<IncomeInvoiceEntity>) super.selectList(getSqlIdPrifx() + "queryZtzz", entity);
|
||||
return o;
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<JSONObject> queryByAloneId(IncomeInvoiceEntity entity) {
|
||||
List<JSONObject> o = (List<JSONObject>) super.selectList(getSqlIdPrifx() + "queryByAloneId", entity);
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
package com.hzya.frame.plugin.incomeInvoiceData.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
/**
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class IncomeInvoiceEntity extends BaseEntity {
|
||||
|
||||
//发票字段
|
||||
private Integer dataId;
|
||||
private Integer formmainId;
|
||||
private String field0127;
|
||||
private String field0128;
|
||||
private String field0129;
|
||||
private String field0130;
|
||||
private String field0003;
|
||||
|
||||
|
||||
//财报数据 字段
|
||||
private String aloneId;
|
||||
private String sysData;
|
||||
private String orgCode;
|
||||
private String orgName;
|
||||
private String iufoVer;
|
||||
|
||||
|
||||
public String getAloneId() {
|
||||
return aloneId;
|
||||
}
|
||||
|
||||
public void setAloneId(String aloneId) {
|
||||
this.aloneId = aloneId;
|
||||
}
|
||||
|
||||
public String getSysData() {
|
||||
return sysData;
|
||||
}
|
||||
|
||||
public void setSysData(String sysData) {
|
||||
this.sysData = sysData;
|
||||
}
|
||||
|
||||
public String getOrgCode() {
|
||||
return orgCode;
|
||||
}
|
||||
|
||||
public void setOrgCode(String orgCode) {
|
||||
this.orgCode = orgCode;
|
||||
}
|
||||
|
||||
public String getOrgName() {
|
||||
return orgName;
|
||||
}
|
||||
|
||||
public void setOrgName(String orgName) {
|
||||
this.orgName = orgName;
|
||||
}
|
||||
|
||||
public String getIufoVer() {
|
||||
return iufoVer;
|
||||
}
|
||||
|
||||
public void setIufoVer(String iufoVer) {
|
||||
this.iufoVer = iufoVer;
|
||||
}
|
||||
|
||||
public Integer getDataId() {
|
||||
return dataId;
|
||||
}
|
||||
|
||||
public void setDataId(Integer dataId) {
|
||||
this.dataId = dataId;
|
||||
}
|
||||
|
||||
public Integer getFormmainId() {
|
||||
return formmainId;
|
||||
}
|
||||
|
||||
public void setFormmainId(Integer formmainId) {
|
||||
this.formmainId = formmainId;
|
||||
}
|
||||
|
||||
public String getField0127() {
|
||||
return field0127;
|
||||
}
|
||||
|
||||
public void setField0127(String field0127) {
|
||||
this.field0127 = field0127;
|
||||
}
|
||||
|
||||
public String getField0128() {
|
||||
return field0128;
|
||||
}
|
||||
|
||||
public void setField0128(String field0128) {
|
||||
this.field0128 = field0128;
|
||||
}
|
||||
|
||||
public String getField0129() {
|
||||
return field0129;
|
||||
}
|
||||
|
||||
public void setField0129(String field0129) {
|
||||
this.field0129 = field0129;
|
||||
}
|
||||
|
||||
public String getField0130() {
|
||||
return field0130;
|
||||
}
|
||||
|
||||
public void setField0130(String field0130) {
|
||||
this.field0130 = field0130;
|
||||
}
|
||||
|
||||
public String getField0003() {
|
||||
return field0003;
|
||||
}
|
||||
|
||||
public void setField0003(String field0003) {
|
||||
this.field0003 = field0003;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,538 @@
|
|||
<?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.plugin.incomeInvoiceData.dao.impl.IncomeInvoiceDaoImpl">
|
||||
|
||||
|
||||
<select id="queryData" resultType="com.alibaba.fastjson.JSONObject" parameterType="com.alibaba.fastjson.JSONObject">
|
||||
select
|
||||
*
|
||||
from mdm_fp
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="fphm != null and fphm != ''"> and fphm = #{fphm} </if>
|
||||
and sts = 'Y' and data_status != 'N'
|
||||
</trim>
|
||||
</select>
|
||||
<insert id="saveData" parameterType="com.alibaba.fastjson.JSONObject">
|
||||
insert into mdm_fp(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
<if test="document_rule != null and document_rule != ''"> document_rule , </if>
|
||||
<if test="document_rule_num != null"> document_rule_num , </if>
|
||||
<if test="data_status != null and data_status != ''"> data_status , </if>
|
||||
<if test="add_status != null and add_status != ''"> add_status , </if>
|
||||
<if test="update_status != null and update_status != ''"> update_status , </if>
|
||||
<if test="delete_status != null and delete_status != ''"> delete_status , </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="fphm != null and fphm != ''"> fphm , </if>
|
||||
<if test="fpdm != null and fpdm != ''"> fpdm , </if>
|
||||
<if test="kprq != null and kprq != ''"> kprq , </if>
|
||||
<if test="xfsh != null and xfsh != ''"> xfsh , </if>
|
||||
<if test="xfmc != null and xfmc != ''"> xfmc , </if>
|
||||
<if test="gfsh != null and gfsh != ''"> gfsh , </if>
|
||||
<if test="gfmc != null and gfmc != ''"> gfmc , </if>
|
||||
<if test="hjje != null and hjje != ''"> hjje , </if>
|
||||
<if test="hjse != null and hjse != ''"> hjse , </if>
|
||||
<if test="jshj != null and jshj != ''"> jshj , </if>
|
||||
<if test="jym != null and jym != ''"> jym , </if>
|
||||
<if test="xfdzdh != null and xfdzdh != ''"> xfdzdh , </if>
|
||||
<if test="xfyhzh != null and xfyhzh != ''"> xfyhzh , </if>
|
||||
<if test="gfdzdh != null and gfdzdh != ''"> gfdzdh , </if>
|
||||
<if test="gfyhzh != null and gfyhzh != ''"> gfyhzh , </if>
|
||||
<if test="mmq != null and mmq != ''"> mmq , </if>
|
||||
<if test="bz != null and bz != ''"> bz , </if>
|
||||
<if test="jqbh != null and jqbh != ''"> jqbh , </if>
|
||||
<if test="jdhm != null and jdhm != ''"> jdhm , </if>
|
||||
<if test="kpr != null and kpr != ''"> kpr , </if>
|
||||
<if test="skr != null and skr != ''"> skr , </if>
|
||||
<if test="fhr != null and fhr != ''"> fhr , </if>
|
||||
<if test="url != null and url != ''"> url , </if>
|
||||
<if test="ofdurl != null and ofdurl != ''"> ofdurl , </if>
|
||||
<if test="xmlurl != null and xmlurl != ''"> xmlurl , </if>
|
||||
<if test="htbh != null and htbh != ''"> htbh , </if>
|
||||
|
||||
|
||||
</trim>
|
||||
)values
|
||||
(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> #{id} , </if>
|
||||
<if test="document_rule != null and document_rule != ''"> #{document_rule} , </if>
|
||||
<if test="document_rule_num != null"> #{document_rule_num} , </if>
|
||||
<if test="data_status != null and data_status != ''"> #{data_status} , </if>
|
||||
<if test="add_status != null and add_status != ''"> #{add_status} , </if>
|
||||
<if test="update_status != null and update_status != ''"> #{update_status} , </if>
|
||||
<if test="delete_status != null and delete_status != ''"> #{delete_status} , </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="fphm != null and fphm != ''"> #{fphm} , </if>
|
||||
<if test="fpdm != null and fpdm != ''"> #{fpdm} , </if>
|
||||
<if test="kprq != null and kprq != ''"> #{kprq} , </if>
|
||||
<if test="xfsh != null and xfsh != ''"> #{xfsh} , </if>
|
||||
<if test="xfmc != null and xfmc != ''"> #{xfmc} , </if>
|
||||
<if test="gfsh != null and gfsh != ''"> #{gfsh} , </if>
|
||||
<if test="gfmc != null and gfmc != ''"> #{gfmc} , </if>
|
||||
<if test="hjje != null and hjje != ''"> #{hjje} , </if>
|
||||
<if test="hjse != null and hjse != ''"> #{hjse} , </if>
|
||||
<if test="jshj != null and jshj != ''"> #{jshj} , </if>
|
||||
<if test="jym != null and jym != ''"> #{jym} , </if>
|
||||
<if test="xfdzdh != null and xfdzdh != ''"> #{xfdzdh} , </if>
|
||||
<if test="xfyhzh != null and xfyhzh != ''"> #{xfyhzh} , </if>
|
||||
<if test="gfdzdh != null and gfdzdh != ''"> #{gfdzdh} , </if>
|
||||
<if test="gfyhzh != null and gfyhzh != ''"> #{gfyhzh} , </if>
|
||||
<if test="mmq != null and mmq != ''"> #{mmq} , </if>
|
||||
<if test="bz != null and bz != ''"> #{bz} , </if>
|
||||
<if test="jqbh != null and jqbh != ''"> #{jqbh} , </if>
|
||||
<if test="jdhm != null and jdhm != ''"> #{jdhm} , </if>
|
||||
<if test="kpr != null and kpr != ''"> #{kpr} , </if>
|
||||
<if test="skr != null and skr != ''"> #{skr} , </if>
|
||||
<if test="fhr != null and fhr != ''"> #{fhr} , </if>
|
||||
<if test="url != null and url != ''"> #{url} , </if>
|
||||
<if test="ofdurl != null and ofdurl != ''"> #{ofdurl} , </if>
|
||||
<if test="xmlurl != null and xmlurl != ''"> #{xmlurl} , </if>
|
||||
<if test="htbh != null and htbh != ''"> #{htbh} , </if>
|
||||
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<insert id="saveDetailData" parameterType="com.alibaba.fastjson.JSONObject">
|
||||
insert into mdm_fp_detail(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
<if test="formmain_id != null and formmain_id != ''"> formmain_id , </if>
|
||||
<if test="data_status != null and data_status != ''"> data_status , </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="remark != null and remark != ''"> remark , </if>
|
||||
|
||||
<if test="xh != null and xh != ''"> xh , </if>
|
||||
<if test="ssflbm != null and ssflbm != ''"> ssflbm , </if>
|
||||
<if test="xmmc != null and xmmc != ''"> xmmc , </if>
|
||||
<if test="ggxh != null and ggxh != ''"> ggxh , </if>
|
||||
<if test="dw != null and dw != ''"> dw , </if>
|
||||
<if test="sl != null and sl != ''"> sl , </if>
|
||||
<if test="dj != null and dj != ''"> dj , </if>
|
||||
<if test="je != null and je != ''"> je , </if>
|
||||
<if test="slv != null and slv != ''"> slv , </if>
|
||||
<if test="se != null and se != ''"> se , </if>
|
||||
|
||||
|
||||
|
||||
</trim>
|
||||
)values
|
||||
(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> #{id} , </if>
|
||||
<if test="formmain_id != null and formmain_id != ''"> #{formmain_id} , </if>
|
||||
<if test="data_status != null and data_status != ''"> #{data_status}, </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="remark != null and remark != ''"> #{remark} , </if>
|
||||
|
||||
<if test="xh != null and xh != ''"> #{xh} , </if>
|
||||
<if test="ssflbm != null and ssflbm != ''"> #{ssflbm} , </if>
|
||||
<if test="xmmc != null and xmmc != ''"> #{xmmc} , </if>
|
||||
<if test="ggxh != null and ggxh != ''"> #{ggxh} , </if>
|
||||
<if test="dw != null and dw != ''"> #{dw} , </if>
|
||||
<if test="sl != null and sl != ''"> #{sl} , </if>
|
||||
<if test="dj != null and dj != ''"> #{dj} , </if>
|
||||
<if test="je != null and je != ''"> #{je} , </if>
|
||||
<if test="slv != null and slv != ''"> #{slv} , </if>
|
||||
<if test="se != null and se != ''"> #{se} , </if>
|
||||
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<select id="queryOaZb" resultType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity" parameterType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity">
|
||||
select
|
||||
id as dataId,
|
||||
field0003
|
||||
from formmain_0323
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="field0003 != null and field0003 != ''"> and field0003 = #{field0003} </if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="queryOaMx" resultType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity" parameterType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity">
|
||||
select
|
||||
id as dataId
|
||||
from formson_0702
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="field0128 != null and field0128 != ''"> and field0128 = #{field0128} </if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<update id="updateMx" parameterType = "com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity" >
|
||||
update formson_0702 set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="field0127 != null and field0127 != ''"> field0127 = #{field0127},</if>
|
||||
<if test="field0128 != null and field0128 != ''"> field0128 = #{field0128},</if>
|
||||
<if test="field0129 != null and field0129 != ''"> field0129 = #{field0129},</if>
|
||||
<if test="field0130 != null and field0130 != ''"> field0130 = #{field0130},</if>
|
||||
</trim>
|
||||
where id = #{dataId}
|
||||
</update>
|
||||
|
||||
<insert id="saveMx" parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
|
||||
insert into formson_0702(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="dataId != null and dataId != ''">id ,</if>
|
||||
<if test="formmainId != null and formmainId != ''">formmain_id ,</if>
|
||||
<if test="field0127 != null and field0127 != ''">field0127 ,</if>
|
||||
<if test="field0128 != null and field0128 != ''">field0128 ,</if>
|
||||
<if test="field0129 != null and field0129 != ''">field0129 ,</if>
|
||||
<if test="field0130 != null and field0130 != ''">field0130 ,</if>
|
||||
|
||||
</trim>
|
||||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="dataId != null and dataId != ''">#{dataId} ,</if>
|
||||
<if test="formmainId != null and formmainId != ''">#{formmainId} ,</if>
|
||||
<if test="field0127 != null and field0127 != ''">#{field0127} ,</if>
|
||||
<if test="field0128 != null and field0128 != ''">#{field0128} ,</if>
|
||||
<if test="field0129 != null and field0129 != ''">#{field0129} ,</if>
|
||||
<if test="field0130 != null and field0130 != ''">#{field0130} ,</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="queryZtzz" resultType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity" parameterType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
iufo.alone_id AS aloneId,
|
||||
iufo.keyword2 AS sysData,
|
||||
orgs.code AS orgCode,
|
||||
orgs.name AS orgName,
|
||||
iufo.ver AS iufoVer
|
||||
FROM
|
||||
IUFO_MEASPUB_VIOU iufo
|
||||
LEFT JOIN org_orgs orgs ON iufo.keyword1 = orgs.pk_org
|
||||
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="orgCode != null and orgCode !='' "> and orgs.code = #{orgCode} </if>
|
||||
and ver = '0'
|
||||
<if test="sysData != null and sysData !='' "> and iufo.keyword2 LIKE CONCAT(#{sysData}, '%') </if>
|
||||
</trim>
|
||||
ORDER BY
|
||||
iufo.keyword2 DESC
|
||||
)
|
||||
WHERE
|
||||
ROWNUM = 1
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryByAloneId" resultType="com.alibaba.fastjson.JSONObject" parameterType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity">
|
||||
|
||||
SELECT
|
||||
a.ALONE_ID as ALONE_ID,
|
||||
a.M10004 as aM10004,
|
||||
a.M10005 as aM10005,
|
||||
a.M10010 as aM10010,
|
||||
a.M10012 as aM10012,
|
||||
a.M10014 as aM10014,
|
||||
a.M10019 as aM10019,
|
||||
a.M10020 as aM10020,
|
||||
a.M10021 as aM10021,
|
||||
a.M10022 as aM10022,
|
||||
a.M10025 as aM10025,
|
||||
a.M10110 as aM10110,
|
||||
a.M10027 as aM10027,
|
||||
a.M10112 as aM10112,
|
||||
a.M10029 as aM10029,
|
||||
a.M10032 as aM10032,
|
||||
a.M10033 as aM10033,
|
||||
a.M10034 as aM10034,
|
||||
a.M10035 as aM10035,
|
||||
a.M10040 as aM10040,
|
||||
a.M10128 as aM10128,
|
||||
a.M10042 as aM10042,
|
||||
a.M10130 as aM10130,
|
||||
a.M10044 as aM10044,
|
||||
a.M10045 as aM10045,
|
||||
a.M10046 as aM10046,
|
||||
a.M10047 as aM10047,
|
||||
a.M10048 as aM10048,
|
||||
a.M10049 as aM10049,
|
||||
a.M10050 as aM10050,
|
||||
a.M10051 as aM10051,
|
||||
a.M10052 as aM10052,
|
||||
a.M10053 as aM10053,
|
||||
a.M10054 as aM10054,
|
||||
a.M10055 as aM10055,
|
||||
a.M10057 as aM10057,
|
||||
a.M10059 as aM10059,
|
||||
a.M10060 as aM10060,
|
||||
a.M10061 as aM10061,
|
||||
a.M10062 as aM10062,
|
||||
a.M10063 as aM10063,
|
||||
a.M10064 as aM10064,
|
||||
a.M10065 as aM10065,
|
||||
a.M10066 as aM10066,
|
||||
a.M10073 as aM10073,
|
||||
a.M10146 as aM10146,
|
||||
a.M10075 as aM10075,
|
||||
a.M10148 as aM10148,
|
||||
a.M10077 as aM10077,
|
||||
a.M10078 as aM10078,
|
||||
a.M10079 as aM10079,
|
||||
a.M10080 as aM10080,
|
||||
a.M10081 as aM10081,
|
||||
a.M10082 as aM10082,
|
||||
a.M10083 as aM10083,
|
||||
a.M10084 as aM10084,
|
||||
a.M10087 as aM10087,
|
||||
a.M10088 as aM10088,
|
||||
a.M10091 as aM10091,
|
||||
a.M10164 as aM10164,
|
||||
a.M10093 as aM10093,
|
||||
a.M10166 as aM10166,
|
||||
a.M10095 as aM10095,
|
||||
a.M10096 as aM10096,
|
||||
a.M10097 as aM10097,
|
||||
a.M10098 as aM10098,
|
||||
a.M10099 as aM10099,
|
||||
a.M10100 as aM10100,
|
||||
a.M10101 as aM10101,
|
||||
a.M10102 as aM10102,
|
||||
a.M10105 as aM10105,
|
||||
a.M10106 as aM10106,
|
||||
a.M10109 as aM10109,
|
||||
a.M10182 as aM10182,
|
||||
a.M10111 as aM10111,
|
||||
a.M10184 as aM10184,
|
||||
a.M10113 as aM10113,
|
||||
a.M10114 as aM10114,
|
||||
a.M10115 as aM10115,
|
||||
a.M10116 as aM10116,
|
||||
a.M10117 as aM10117,
|
||||
a.M10118 as aM10118,
|
||||
a.M10119 as aM10119,
|
||||
a.M10120 as aM10120,
|
||||
a.M10123 as aM10123,
|
||||
a.M10124 as aM10124,
|
||||
a.M10127 as aM10127,
|
||||
a.M10200 as aM10200,
|
||||
a.M10129 as aM10129,
|
||||
a.M10202 as aM10202,
|
||||
a.M10131 as aM10131,
|
||||
a.M10132 as aM10132,
|
||||
a.M10133 as aM10133,
|
||||
a.M10134 as aM10134,
|
||||
a.M10135 as aM10135,
|
||||
a.M10138 as aM10138,
|
||||
a.M10141 as aM10141,
|
||||
a.M10142 as aM10142,
|
||||
a.M10143 as aM10143,
|
||||
a.M10144 as aM10144,
|
||||
a.M10145 as aM10145,
|
||||
a.M10147 as aM10147,
|
||||
a.M10149 as aM10149,
|
||||
a.M10150 as aM10150,
|
||||
a.M10151 as aM10151,
|
||||
a.M10152 as aM10152,
|
||||
a.M10153 as aM10153,
|
||||
a.M10154 as aM10154,
|
||||
a.M10155 as aM10155,
|
||||
a.M10156 as aM10156,
|
||||
a.M10257 as aM10257,
|
||||
a.M10259 as aM10259,
|
||||
a.M10159 as aM10159,
|
||||
a.M10160 as aM10160,
|
||||
a.M10161 as aM10161,
|
||||
a.M10162 as aM10162,
|
||||
a.M10163 as aM10163,
|
||||
a.M10165 as aM10165,
|
||||
a.M10167 as aM10167,
|
||||
a.M10168 as aM10168,
|
||||
a.M10169 as aM10169,
|
||||
a.M10170 as aM10170,
|
||||
a.M10171 as aM10171,
|
||||
a.M10172 as aM10172,
|
||||
a.M10173 as aM10173,
|
||||
a.M10174 as aM10174,
|
||||
a.M10281 as aM10281,
|
||||
a.M10283 as aM10283,
|
||||
a.M10179 as aM10179,
|
||||
a.M10180 as aM10180,
|
||||
a.M10181 as aM10181,
|
||||
a.M10222 as aM10222,
|
||||
a.M10183 as aM10183,
|
||||
a.M10224 as aM10224,
|
||||
a.M10185 as aM10185,
|
||||
a.M10186 as aM10186,
|
||||
a.M10187 as aM10187,
|
||||
a.M10188 as aM10188,
|
||||
a.M10189 as aM10189,
|
||||
a.M10190 as aM10190,
|
||||
a.M10191 as aM10191,
|
||||
a.M10192 as aM10192,
|
||||
a.M10295 as aM10295,
|
||||
a.M10193 as aM10193,
|
||||
a.M10297 as aM10297,
|
||||
a.M10194 as aM10194,
|
||||
a.M10195 as aM10195,
|
||||
a.M10196 as aM10196,
|
||||
a.M10197 as aM10197,
|
||||
a.M10198 as aM10198,
|
||||
a.M10199 as aM10199,
|
||||
a.M10201 as aM10201,
|
||||
a.M10203 as aM10203,
|
||||
a.M10208 as aM10208,
|
||||
a.M10209 as aM10209,
|
||||
a.M10212 as aM10212,
|
||||
a.M10310 as aM10310,
|
||||
a.M10214 as aM10214,
|
||||
a.M10312 as aM10312,
|
||||
a.M10216 as aM10216,
|
||||
a.M10217 as aM10217,
|
||||
a.M10218 as aM10218,
|
||||
a.M10219 as aM10219,
|
||||
a.M10220 as aM10220,
|
||||
a.M10221 as aM10221,
|
||||
a.M10223 as aM10223,
|
||||
a.M10225 as aM10225,
|
||||
a.M10226 as aM10226,
|
||||
a.M10227 as aM10227,
|
||||
a.M10230 as aM10230,
|
||||
a.M10231 as aM10231,
|
||||
a.M10234 as aM10234,
|
||||
a.M10325 as aM10325,
|
||||
a.M10236 as aM10236,
|
||||
a.M10327 as aM10327,
|
||||
a.M10238 as aM10238,
|
||||
a.M10239 as aM10239,
|
||||
a.M10240 as aM10240,
|
||||
a.M10241 as aM10241,
|
||||
a.M10242 as aM10242,
|
||||
a.M10243 as aM10243,
|
||||
a.M10244 as aM10244,
|
||||
a.M10245 as aM10245,
|
||||
a.M10246 as aM10246,
|
||||
a.M10247 as aM10247,
|
||||
a.M10248 as aM10248,
|
||||
a.M10249 as aM10249,
|
||||
a.M10250 as aM10250,
|
||||
a.M10251 as aM10251,
|
||||
a.M10252 as aM10252,
|
||||
a.M10253 as aM10253,
|
||||
a.M10256 as aM10256,
|
||||
a.M10340 as aM10340,
|
||||
a.M10258 as aM10258,
|
||||
a.M10342 as aM10342,
|
||||
a.M10260 as aM10260,
|
||||
a.M10265 as aM10265,
|
||||
a.M10266 as aM10266,
|
||||
a.M10267 as aM10267,
|
||||
a.M10268 as aM10268,
|
||||
a.M10269 as aM10269,
|
||||
a.M10276 as aM10276,
|
||||
a.M10277 as aM10277,
|
||||
a.M10280 as aM10280,
|
||||
a.M10282 as aM10282,
|
||||
a.M10284 as aM10284,
|
||||
a.M10287 as aM10287,
|
||||
a.M10288 as aM10288,
|
||||
a.M10289 as aM10289,
|
||||
a.M10290 as aM10290,
|
||||
a.M10291 as aM10291,
|
||||
a.M10292 as aM10292,
|
||||
a.M10293 as aM10293,
|
||||
a.M10294 as aM10294,
|
||||
a.M10011 as aM10011,
|
||||
a.M10296 as aM10296,
|
||||
a.M10013 as aM10013,
|
||||
a.M10298 as aM10298,
|
||||
a.M10299 as aM10299,
|
||||
a.M10300 as aM10300,
|
||||
a.M10301 as aM10301,
|
||||
a.M10304 as aM10304,
|
||||
a.M10305 as aM10305,
|
||||
a.M10306 as aM10306,
|
||||
a.M10307 as aM10307,
|
||||
a.M10308 as aM10308,
|
||||
a.M10309 as aM10309,
|
||||
a.M10026 as aM10026,
|
||||
a.M10311 as aM10311,
|
||||
a.M10028 as aM10028,
|
||||
a.M10313 as aM10313,
|
||||
a.M10314 as aM10314,
|
||||
a.M10315 as aM10315,
|
||||
a.M10316 as aM10316,
|
||||
a.M10319 as aM10319,
|
||||
a.M10320 as aM10320,
|
||||
a.M10321 as aM10321,
|
||||
a.M10323 as aM10323,
|
||||
a.M10326 as aM10326,
|
||||
a.M10041 as aM10041,
|
||||
a.M10328 as aM10328,
|
||||
a.M10043 as aM10043,
|
||||
a.M10329 as aM10329,
|
||||
a.M10334 as aM10334,
|
||||
a.M10335 as aM10335,
|
||||
a.M10336 as aM10336,
|
||||
a.M10338 as aM10338,
|
||||
a.M10337 as aM10337,
|
||||
a.M10339 as aM10339,
|
||||
a.M10341 as aM10341,
|
||||
a.M10056 as aM10056,
|
||||
a.M10343 as aM10343,
|
||||
a.M10058 as aM10058,
|
||||
a.M10344 as aM10344,
|
||||
a.M10347 as aM10347,
|
||||
a.M10348 as aM10348,
|
||||
a.M10349 as aM10349,
|
||||
a.M10350 as aM10350,
|
||||
a.M10351 as aM10351,
|
||||
a.M10352 as aM10352,
|
||||
a.M10353 as aM10353,
|
||||
a.M10354 as aM10354,
|
||||
b.MPQW10U as bMPQW10U,
|
||||
b.MP81A2Z as bMP81A2Z,
|
||||
b.MS13DPL as bMS13DPL,
|
||||
b.M6TFKPL as bM6TFKPL,
|
||||
c.M10002 as cM10002,
|
||||
c.M10000 as cM10000,
|
||||
c.M10004 as cM10004,
|
||||
c.M10003 as cM10003,
|
||||
c.M10001 as cM10001
|
||||
FROM
|
||||
iufo_measure_data_qi0xy5nl a
|
||||
LEFT JOIN iufo_measure_data_v40w9co7 b on a.ALONE_ID = b.ALONE_ID
|
||||
LEFT JOIN iufo_measure_data_jz8zffdp c on a.ALONE_ID = c.ALONE_ID
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="aloneId != null and aloneId != ''"> and a.ALONE_ID = #{aloneId} </if>
|
||||
</trim>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.hzya.frame.plugin.incomeInvoiceData.plugin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.service.IIncomeInvoiceService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* 主数据同步
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class FinancialReportPluginInitializer extends PluginBaseEntity{
|
||||
Logger logger = LoggerFactory.getLogger(FinancialReportPluginInitializer.class);
|
||||
|
||||
@Autowired
|
||||
private IIncomeInvoiceService incomeInvoiceService;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "执行初始化方法initialize()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "执行销毁方法destroy()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "FinancialReportPlugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "FinancialReportPlugin插件";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "FinancialReportPlugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||
try {
|
||||
logger.info("======开始执行财务信息同步========");
|
||||
return incomeInvoiceService.sendFinancialReportPlugin(requestJson);
|
||||
}catch (Exception e){
|
||||
logger.info("======执行财务同步失败:{}========",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.hzya.frame.plugin.incomeInvoiceData.plugin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.service.IIncomeInvoiceService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* 主数据同步
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class IncomeInvoicePluginInitializer extends PluginBaseEntity{
|
||||
Logger logger = LoggerFactory.getLogger(IncomeInvoicePluginInitializer.class);
|
||||
|
||||
@Autowired
|
||||
private IIncomeInvoiceService incomeInvoiceService;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "执行初始化方法initialize()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "执行销毁方法destroy()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "IncomeInvoicePlugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "IncomeInvoicePlugin插件";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "IncomeInvoicePlugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||
try {
|
||||
logger.info("======开始执行进项全量发票主数据信息同步========");
|
||||
return incomeInvoiceService.getIncomeInvoiceData(requestJson);
|
||||
}catch (Exception e){
|
||||
logger.info("======执行进项全量发票主数据同步失败:{}========",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.hzya.frame.plugin.incomeInvoiceData.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public interface IIncomeInvoiceService extends IBaseService<IncomeInvoiceEntity, String> {
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 全量发票数据
|
||||
* @Date 4:28 下午 2025/4/16
|
||||
* @param requestJson
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity getIncomeInvoiceData(JSONObject requestJson);
|
||||
SysExtensionApiEntity setData(SysExtensionApiEntity entity) throws Exception;
|
||||
|
||||
JsonResultEntity sendFinancialReportPlugin(JSONObject requestJson);
|
||||
}
|
|
@ -0,0 +1,894 @@
|
|||
package com.hzya.frame.plugin.incomeInvoiceData.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.dao.IIncomeInvoiceDao;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity;
|
||||
import com.hzya.frame.plugin.incomeInvoiceData.service.IIncomeInvoiceService;
|
||||
import com.hzya.frame.seeyon.util.YzfSignUtil;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.sysnew.comparison.controlsLog.dao.impl.ControlsLogDaoImpl;
|
||||
import com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity;
|
||||
import com.hzya.frame.sysnew.comparison.dao.IComparisonDao;
|
||||
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
|
||||
import com.hzya.frame.uuid.UUIDLong;
|
||||
import com.hzya.frame.uuid.UUIDUtils;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
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.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.conn.ssl.NoopHostnameVerifier;
|
||||
import org.apache.http.conn.ssl.TrustAllStrategy;
|
||||
import org.apache.http.entity.ByteArrayEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.ssl.SSLContextBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, String> implements IIncomeInvoiceService {
|
||||
|
||||
private IIncomeInvoiceDao incomeInvoiceDao;
|
||||
@Autowired
|
||||
private ControlsLogDaoImpl controlsLogDaoimpl;
|
||||
@Autowired
|
||||
private IComparisonDao comparisonDao;
|
||||
@Autowired
|
||||
public void setIncomeInvoiceDao(IIncomeInvoiceDao dao) {
|
||||
this.incomeInvoiceDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
String cbUrl = "http://oapi.nanofintax.com/api/collect/uploadFinancialReport?accessToken=";
|
||||
String dataUrl = "http://oapi.nanofintax.com/api/invoice_receive/fp/v1/query?accessToken=";
|
||||
String tokenUrl = "http://oapi.nanofintax.com/api/getToken";
|
||||
String accessKey = "6X3B526P5HqE6ums";
|
||||
String accessSecret = "34e5fc32ac894a2ba2ade8c3852c7a0a";
|
||||
String taxNo = "91330110MAC5FPUY2U";
|
||||
Integer size = 50;
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 全量发票数据
|
||||
* @Date 4:28 下午 2025/4/16
|
||||
* @param requestJson
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity getIncomeInvoiceData(JSONObject requestJson) {
|
||||
//1、调用token
|
||||
String access_token = getToken();
|
||||
if (access_token == null) {
|
||||
return BaseResult.getFailureMessageEntity("token获取失败");
|
||||
}
|
||||
Date date = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String times = sdf.format(date);
|
||||
//2、调用接口获取数据
|
||||
Integer queryCursor = 1;
|
||||
JSONArray datalist = new JSONArray();
|
||||
sendBusinessData(datalist, access_token, queryCursor,times);
|
||||
|
||||
if(datalist != null && datalist.size() > 0){
|
||||
for (int i = 0; i < datalist.size(); i++) {
|
||||
JSONObject saveData = new JSONObject();
|
||||
//3、对照数据
|
||||
JSONObject jsonObject = datalist.getJSONObject(i);
|
||||
JSONObject content = jsonObject.getJSONObject("content");
|
||||
|
||||
//发票号码
|
||||
String fphm = jsonObject.getString("fphm");
|
||||
if(fphm == null || "".equals(fphm) ){
|
||||
continue;
|
||||
}
|
||||
saveData.put("fphm",fphm);
|
||||
//判断是否有这个数据
|
||||
List<JSONObject> checkData = incomeInvoiceDao.queryData(saveData);
|
||||
if(checkData != null && checkData.size() > 0){
|
||||
continue;
|
||||
}
|
||||
saveData.put("id", String.valueOf(UUIDLong.longUUID()));
|
||||
saveData.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
saveData.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
saveData.put("org_id", "0");
|
||||
saveData.put("create_time", new Date());
|
||||
saveData.put("modify_time", new Date());
|
||||
saveData.put("sts", "Y");
|
||||
saveData.put("data_status", "Y");//新增状态
|
||||
saveData.put("add_status", "0");//新增状态
|
||||
saveData.put("update_status", "1");//修改状态
|
||||
saveData.put("delete_status", "1");//删除状态
|
||||
ComparisonEntity comparisonEntityRule = new ComparisonEntity();
|
||||
comparisonEntityRule.setRulePrefix("FP");
|
||||
comparisonEntityRule.setRuleMiddle("%Y-%m-%d");
|
||||
comparisonEntityRule.setRuleSuffix(5);
|
||||
comparisonEntityRule.setDbName("mdm_fp");
|
||||
ComparisonEntity comparisonEntityRuleGz = comparisonDao.queryComparisonRule(comparisonEntityRule);
|
||||
saveData.put("document_rule", comparisonEntityRuleGz.getDocumentRule());//单据规则
|
||||
saveData.put("document_rule_num", comparisonEntityRuleGz.getDocumentRuleNum());//单据规则流水号
|
||||
|
||||
saveData.put("fphm",fphm);
|
||||
saveData.put("fpdm",content.getString("fpdm"));
|
||||
saveData.put("kprq",jsonObject.getString("kprq"));
|
||||
saveData.put("xfsh",content.getString("xfsh"));
|
||||
saveData.put("xfmc",content.getString("xfmc"));
|
||||
saveData.put("gfsh",content.getString("gfsh"));
|
||||
saveData.put("gfmc",content.getString("gfmc"));
|
||||
saveData.put("hjje",content.getString("hjje"));
|
||||
saveData.put("hjse",content.getString("hjse"));
|
||||
saveData.put("jshj",content.getString("jshj"));
|
||||
saveData.put("jym",content.getString("jym"));
|
||||
saveData.put("xfdzdh",content.getString("xfdzdh"));
|
||||
saveData.put("xfyhzh",content.getString("xfyhzh"));
|
||||
saveData.put("gfdzdh",content.getString("gfdzdh"));
|
||||
saveData.put("gfyhzh",content.getString("gfyhzh"));
|
||||
saveData.put("mmq",content.getString("mmq"));
|
||||
saveData.put("bz",content.getString("bz"));
|
||||
saveData.put("jqbh",content.getString("jqbh"));
|
||||
saveData.put("jdhm",content.getString("jdhm"));
|
||||
saveData.put("kpr",content.getString("kpr"));
|
||||
saveData.put("skr",content.getString("skr"));
|
||||
saveData.put("fhr",content.getString("fhr"));
|
||||
saveData.put("url",content.getString("url"));
|
||||
saveData.put("ofdurl",content.getString("ofdUrl"));
|
||||
saveData.put("xmlurl",content.getString("xmlUrl"));
|
||||
saveData.put("htbh",content.getString("contraceNumber"));
|
||||
|
||||
JSONArray detaildata = content.getJSONArray("items");
|
||||
if(detaildata != null && detaildata.size() > 0){
|
||||
for (int i1 = 0; i1 < detaildata.size(); i1++) {
|
||||
JSONObject saveDetailData = new JSONObject();
|
||||
|
||||
saveDetailData.put("id", String.valueOf(UUIDLong.longUUID()));
|
||||
saveDetailData.put("formmain_id", saveData.getString("id"));
|
||||
saveDetailData.put("data_status", "Y");//新增状态
|
||||
|
||||
saveDetailData.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
saveDetailData.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
saveDetailData.put("org_id", "0");
|
||||
saveDetailData.put("create_time", new Date());
|
||||
saveDetailData.put("modify_time", new Date());
|
||||
saveDetailData.put("sts", "Y");
|
||||
saveDetailData.put("xh", detaildata.getJSONObject(i1).getString("xh"));
|
||||
saveDetailData.put("ssflbm", detaildata.getJSONObject(i1).getString("ssflbm"));
|
||||
saveDetailData.put("xmmc", detaildata.getJSONObject(i1).getString("xmmc"));
|
||||
saveDetailData.put("ggxh", detaildata.getJSONObject(i1).getString("ggxh"));
|
||||
saveDetailData.put("dw", detaildata.getJSONObject(i1).getString("dw"));
|
||||
saveDetailData.put("sl", detaildata.getJSONObject(i1).getString("sl"));
|
||||
saveDetailData.put("dj", detaildata.getJSONObject(i1).getString("dj"));
|
||||
saveDetailData.put("je", detaildata.getJSONObject(i1).getString("je"));
|
||||
saveDetailData.put("slv", detaildata.getJSONObject(i1).getString("slv"));
|
||||
saveDetailData.put("se", detaildata.getJSONObject(i1).getString("se"));
|
||||
|
||||
incomeInvoiceDao.saveDetailData(saveDetailData);
|
||||
}
|
||||
}
|
||||
incomeInvoiceDao.saveData(saveData);
|
||||
|
||||
//5、保存写入日志
|
||||
ControlsLogEntity controlsLogEntity=new ControlsLogEntity();
|
||||
controlsLogEntity.setId(UUIDUtils.getUUID());
|
||||
controlsLogEntity.setFormmainId(saveData.getString("id"));
|
||||
controlsLogEntity.setSourceName("数智中台");
|
||||
controlsLogEntity.setCode("800004");
|
||||
controlsLogEntity.setSourceData(jsonObject.toString());
|
||||
controlsLogEntity.setOptionType("接口新增");
|
||||
controlsLogEntity.setOptionName("数智中台");
|
||||
controlsLogEntity.setDbName("mdm_fp_option_log");
|
||||
controlsLogEntity.setDataType("1");
|
||||
controlsLogEntity.setCreate_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
controlsLogEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
controlsLogEntity.setOrg_id("0");
|
||||
controlsLogEntity.setRemark("插件新增");
|
||||
controlsLogDaoimpl.saveControlsLog(saveData.getString("id"), "数智中台", "800004", jsonObject.toJSONString(), "接口新增", "数智中台", "mdm_fp_option_log", "1");
|
||||
}
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("处理成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 获取业务数据
|
||||
* @Date 4:31 下午 2025/4/9
|
||||
* @param datalist
|
||||
* @param access_token
|
||||
* @param queryCursor
|
||||
* @param dataTime
|
||||
* @return void
|
||||
**/
|
||||
private void sendBusinessData(JSONArray datalist, String access_token, Integer queryCursor, String dataTime) {
|
||||
String url = dataUrl+access_token;
|
||||
JSONObject dayabody = new JSONObject();
|
||||
dayabody.put("accessKey",accessKey);
|
||||
long timestamp = System.currentTimeMillis();
|
||||
dayabody.put("timestamp",timestamp);
|
||||
JSONObject queryParams = new JSONObject();
|
||||
queryParams.put("page",queryCursor);
|
||||
queryParams.put("size",size);
|
||||
//queryParams.put("kprqq",dataTime);
|
||||
//queryParams.put("kprqz",dataTime);
|
||||
queryParams.put("taxNo",taxNo);
|
||||
dayabody.put("queryParams",queryParams);
|
||||
Map<String, Object> parametersMap = new HashMap<>();
|
||||
parametersMap.put("accessKey",accessKey);
|
||||
parametersMap.put("timestamp",timestamp);
|
||||
String a = YzfSignUtil.signRequest(parametersMap,accessSecret);
|
||||
dayabody.put("sign",a);
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Content-Type", "application/json; charset=utf-8");
|
||||
String returndata = sendPost(url, headers, dayabody.toJSONString());
|
||||
|
||||
if (returndata != null && JSONObject.isValidObject(returndata)) {
|
||||
JSONObject dataJson = JSONObject.parseObject(returndata);
|
||||
if(dataJson != null && dataJson.getString("code") != null && "0".equals( dataJson.getString("code"))){
|
||||
JSONObject data = dataJson.getJSONObject("result");
|
||||
if(data != null ){
|
||||
JSONArray businessList = data.getJSONArray("data");
|
||||
if(data.getInteger("total") > queryCursor*size){
|
||||
queryCursor = queryCursor+1;
|
||||
sendBusinessData(datalist, access_token, queryCursor, dataTime);
|
||||
}
|
||||
if(businessList != null && businessList.size() > 0){
|
||||
datalist.addAll(businessList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getOAToken(String name) {
|
||||
String url = "http://60.204.152.210/seeyon/rest/token";
|
||||
Map<String, String> headers = null;
|
||||
String bodys = "{\"password\":\"a5ce21b8-91db-4cec-b3e3-3e44719655fd\",\"userName\":\"hzyaRest\",\"loginName\":\""+name+"\"}";
|
||||
String tokenData = sendPost(url, headers, bodys);
|
||||
String access_token = null;
|
||||
if (tokenData != null && JSONObject.isValidObject(tokenData)) {
|
||||
JSONObject tokendataJson = JSONObject.parseObject(tokenData);
|
||||
if (tokendataJson != null && tokendataJson.getString("id") != null) {
|
||||
access_token = tokendataJson.getString("id");
|
||||
}
|
||||
}
|
||||
return access_token;
|
||||
}
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 获取token
|
||||
* @Date 4:18 下午 2025/4/9
|
||||
* @param
|
||||
* @return java.lang.String
|
||||
**/
|
||||
private String getToken() {
|
||||
String url = tokenUrl;
|
||||
JSONObject tokenJson = new JSONObject();
|
||||
tokenJson.put("accessKey",accessKey);
|
||||
tokenJson.put("accessSecret",accessSecret);
|
||||
String bodys = tokenJson.toJSONString();
|
||||
StringBuilder body = new StringBuilder();
|
||||
SSLContext sslContext = null;
|
||||
try {
|
||||
sslContext = new SSLContextBuilder()
|
||||
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
CloseableHttpClient closeableHttpClient = HttpClients.custom()
|
||||
.setSSLContext(sslContext)
|
||||
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
|
||||
.build();
|
||||
|
||||
HttpPost post = new HttpPost(url);
|
||||
CloseableHttpResponse response = null;
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(6000).build();
|
||||
post.setConfig(requestConfig);//设置请求参数【超时时间】
|
||||
post.setHeader("Content-Type", "application/json; charset=utf-8");
|
||||
try {
|
||||
if (bodys != null && !"".equals(bodys)) {
|
||||
ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
|
||||
entity.setContentType("application/json");
|
||||
post.setEntity(entity);
|
||||
}
|
||||
response = closeableHttpClient.execute(post);
|
||||
|
||||
HttpEntity entity = response.getEntity();
|
||||
body.append(EntityUtils.toString(entity, "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
body.append(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
// 关闭响应对象
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
// 关闭响应对象
|
||||
if (closeableHttpClient != null) {
|
||||
closeableHttpClient.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
logger.info("token返回结果{}",body);
|
||||
JSONObject bodyJson = JSONObject.parseObject(body.toString());
|
||||
if(bodyJson.getString("code") == null || !"0".equals(bodyJson.getString("code"))){
|
||||
return null;
|
||||
}
|
||||
JSONObject resultJson = bodyJson.getJSONObject("result");
|
||||
if(resultJson == null){
|
||||
return null;
|
||||
}
|
||||
if(resultJson.getString("accessToken") != null && !"".equals(resultJson.getString("accessToken"))){
|
||||
return resultJson.getString("accessToken");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sendPost(String url, Map<String, String> headers, String bodys) {
|
||||
logger.info("url:"+url+"。bodys:"+bodys);
|
||||
|
||||
SSLContext sslContext = null;
|
||||
try {
|
||||
sslContext = new SSLContextBuilder()
|
||||
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
CloseableHttpClient closeableHttpClient = HttpClients.custom()
|
||||
.setSSLContext(sslContext)
|
||||
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
|
||||
.build();
|
||||
HttpPost post = new HttpPost(url);
|
||||
CloseableHttpResponse response = null;
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(60000).build();
|
||||
post.setConfig(requestConfig);//设置请求参数【超时时间】
|
||||
if (headers != null && headers.size() > 0) {
|
||||
for (String key : headers.keySet()) {
|
||||
post.setHeader(key, headers.get(key));
|
||||
}
|
||||
}
|
||||
StringBuilder body = new StringBuilder();
|
||||
try {
|
||||
if (bodys != null && !"".equals(bodys)) {
|
||||
ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
|
||||
entity.setContentType("application/json");
|
||||
post.setEntity(entity);
|
||||
}
|
||||
response = closeableHttpClient.execute(post);
|
||||
HttpEntity entity = response.getEntity();
|
||||
body.append(EntityUtils.toString(entity, "UTF-8"));
|
||||
logger.info("返回结果:" + body);
|
||||
} catch (Exception e) {
|
||||
logger.error("请求错误:" + e.getMessage());
|
||||
body = new StringBuilder();
|
||||
} finally {
|
||||
try {
|
||||
// 关闭响应对象
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
// 关闭响应对象
|
||||
if (closeableHttpClient != null) {
|
||||
closeableHttpClient.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
logger.info("url:"+url+"。bodys:"+bodys+"。body"+body);
|
||||
|
||||
return body.toString();
|
||||
}
|
||||
private String sendGet(String url, Map<String, String> headers) {
|
||||
SSLContext sslContext = null;
|
||||
try {
|
||||
sslContext = new SSLContextBuilder()
|
||||
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
CloseableHttpClient closeableHttpClient = HttpClients.custom()
|
||||
.setSSLContext(sslContext)
|
||||
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
|
||||
.build();
|
||||
// HttpClient
|
||||
HttpGet get = new HttpGet(url);
|
||||
CloseableHttpResponse response = null;
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(60000).build();
|
||||
get.setConfig(requestConfig);//设置请求参数【超时时间】
|
||||
if (headers != null && headers.size() > 0) {
|
||||
for (String key : headers.keySet()) {
|
||||
get.setHeader(key, headers.get(key));
|
||||
}
|
||||
}
|
||||
StringBuilder body = new StringBuilder();
|
||||
|
||||
try {
|
||||
response = closeableHttpClient.execute(get);
|
||||
HttpEntity entity = response.getEntity();
|
||||
body.append(EntityUtils.toString(entity,"UTF-8"));
|
||||
logger.info("返回结果:" + body);
|
||||
} catch (Exception e) {
|
||||
logger.error("请求错误:" + e.getMessage());
|
||||
body.append(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
// 关闭响应对象
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
// 关闭响应对象
|
||||
if (closeableHttpClient != null) {
|
||||
closeableHttpClient.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return body.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听前置方法,绑定数据源
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public SysExtensionApiEntity setData(SysExtensionApiEntity entity) throws Exception {
|
||||
try {
|
||||
JSONObject sendBody = new JSONObject();
|
||||
String bodys = entity.getBodys();
|
||||
Map<String, String> headers = entity.getHeaders();
|
||||
JSONObject jsonObject = JSONObject.parseObject(bodys);
|
||||
String loginName = "hzya";
|
||||
String dataXml = getXml(jsonObject);
|
||||
//处理xml数据
|
||||
String oaToken = getOAToken(loginName);
|
||||
headers.put("token",oaToken);
|
||||
sendBody.put("token",oaToken);
|
||||
sendBody.put("loginName",loginName);
|
||||
sendBody.put("dataXml",dataXml);
|
||||
entity.setBodys(sendBody.toJSONString());
|
||||
//修改明细表
|
||||
if(jsonObject.getString("htbh") != null){
|
||||
IncomeInvoiceEntity incomeInvoiceEntity = new IncomeInvoiceEntity();
|
||||
incomeInvoiceEntity.setDataSourceCode("master");//todo
|
||||
//incomeInvoiceEntity.setDataSourceCode("HT-OA");//todo
|
||||
incomeInvoiceEntity.setField0003(jsonObject.getString("htbh"));//合同号
|
||||
incomeInvoiceEntity.setField0127(jsonObject.getString("fpdm"));//发票代码
|
||||
incomeInvoiceEntity.setField0128(jsonObject.getString("fphm"));//发票号码
|
||||
incomeInvoiceEntity.setField0129(jsonObject.getString("jshj"));//发票总额
|
||||
incomeInvoiceEntity.setField0130(jsonObject.getString("fpwj"));//发票文件 todo
|
||||
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryOaZb(incomeInvoiceEntity);
|
||||
if(list != null && list.size() == 1){
|
||||
incomeInvoiceEntity.setFormmainId(list.get(0).getDataId());
|
||||
}
|
||||
List<IncomeInvoiceEntity> mxlist = incomeInvoiceDao.queryOaMx(incomeInvoiceEntity);
|
||||
if(mxlist != null && mxlist.size() == 1){
|
||||
incomeInvoiceEntity.setDataId(mxlist.get(0).getDataId());
|
||||
incomeInvoiceDao.updateMx(incomeInvoiceEntity);
|
||||
}
|
||||
if(mxlist == null || mxlist.size() == 0){
|
||||
incomeInvoiceEntity.setDataId(1);
|
||||
incomeInvoiceDao.saveMx(incomeInvoiceEntity);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String getXml(JSONObject jsonObject) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("<forms version=\"2.1\">");
|
||||
stringBuffer.append("<formExport>");
|
||||
stringBuffer.append("<summary id=\"142379148423086857\" name=\"formmain_0705\"/>");
|
||||
stringBuffer.append("<definitions>");
|
||||
stringBuffer.append("<column id=\"field0001\" type=\"0\" name=\"发票代码\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0002\" type=\"0\" name=\"发票号码\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0003\" type=\"3\" name=\"开票日期\" isNullable=\"false\" length=\"255\"/>");
|
||||
stringBuffer.append("<column id=\"field0004\" type=\"0\" name=\"销方税号\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0005\" type=\"0\" name=\"销方名称\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0006\" type=\"0\" name=\"购方税号\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0007\" type=\"0\" name=\"购方名称\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0008\" type=\"4\" name=\"合计金额\" isNullable=\"false\" length=\"20\"/>");
|
||||
stringBuffer.append("<column id=\"field0009\" type=\"4\" name=\"合计税额\" isNullable=\"false\" length=\"20\"/>");
|
||||
stringBuffer.append("<column id=\"field0010\" type=\"4\" name=\"价税合计\" isNullable=\"false\" length=\"20\"/>");
|
||||
stringBuffer.append("<column id=\"field0011\" type=\"0\" name=\"校验码\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0012\" type=\"0\" name=\"销售方地址电话\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0013\" type=\"0\" name=\"销售方开户行及账号\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0014\" type=\"0\" name=\"购买方地址电话\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0015\" type=\"0\" name=\"购买方开户行及账号\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0017\" type=\"0\" name=\"备注\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0018\" type=\"0\" name=\"机器编号\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0019\" type=\"0\" name=\"机打号码\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0020\" type=\"0\" name=\"开票人\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0021\" type=\"0\" name=\"收款人\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0022\" type=\"0\" name=\"复核人\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0033\" type=\"0\" name=\"合同编号\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0034\" type=\"0\" name=\"发票文件\" isNullable=\"false\" length=\"20\"/>");
|
||||
stringBuffer.append("</definitions>");
|
||||
stringBuffer.append("<values>");
|
||||
|
||||
stringBuffer.append("<column name=\"发票代码\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("fpdm") != null?"<![CDATA["+jsonObject.getString("fpdm")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"发票号码\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("fphm") != null?"<![CDATA["+jsonObject.getString("fphm")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"开票日期\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("kprq") != null?"<![CDATA["+jsonObject.getString("kprq")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"销方税号\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("xfsh") != null?"<![CDATA["+jsonObject.getString("xfsh")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"销方名称\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("xfmc") != null?"<![CDATA["+jsonObject.getString("xfmc")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"购方税号\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("gfsh") != null?"<![CDATA["+jsonObject.getString("gfsh")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"购方名称\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("gfmc") != null?"<![CDATA["+jsonObject.getString("gfmc")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"合计金额\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("hjje") != null?"<![CDATA["+jsonObject.getString("hjje")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"合计税额\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("hjse") != null?"<![CDATA["+jsonObject.getString("hjse")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"价税合计\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("jshj") != null?"<![CDATA["+jsonObject.getString("jshj")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"校验码\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("jym") != null?"<![CDATA["+jsonObject.getString("jym")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"销售方地址电话\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("xfdzdh") != null?"<![CDATA["+jsonObject.getString("xfdzdh")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"销售方开户行及账号\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("xfyhzh") != null?"<![CDATA["+jsonObject.getString("xfyhzh")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"购买方地址电话\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("gfdzdh") != null?"<![CDATA["+jsonObject.getString("gfdzdh")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"购买方开户行及账号\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("gfyhzh") != null?"<![CDATA["+jsonObject.getString("gfyhzh")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"备注\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("bz") != null?"<![CDATA["+jsonObject.getString("bz")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"机器编号\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("jqbh") != null?"<![CDATA["+jsonObject.getString("jqbh")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"机打号码\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("jdhm") != null?"<![CDATA["+jsonObject.getString("jdhm")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"开票人\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("kpr") != null?"<![CDATA["+jsonObject.getString("kpr")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"收款人\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("skr") != null?"<![CDATA["+jsonObject.getString("skr")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"复核人\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("fhr") != null?"<![CDATA["+jsonObject.getString("fhr")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"合同编号\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("htbm") != null?"<![CDATA["+jsonObject.getString("htbm")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
stringBuffer.append("<column name=\"发票文件\">").append("<value>");
|
||||
stringBuffer.append(jsonObject.getString("fpwj") != null?"<![CDATA["+jsonObject.getString("url")+"]]>":"");
|
||||
stringBuffer.append("</value>").append("</column>");
|
||||
|
||||
|
||||
stringBuffer.append("</values>");
|
||||
stringBuffer.append("<subForms>");
|
||||
stringBuffer.append("<subForm>");
|
||||
stringBuffer.append("<definitions>");
|
||||
stringBuffer.append("<column id=\"field0023\" type=\"4\" name=\"序号1\" isNullable=\"false\" length=\"20\"/>");
|
||||
stringBuffer.append("<column id=\"field0024\" type=\"0\" name=\"税收分类编码\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0025\" type=\"0\" name=\"项目名称\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0026\" type=\"0\" name=\"规格型号\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0027\" type=\"0\" name=\"单位\" isNullable=\"false\" length=\"100\"/>");
|
||||
stringBuffer.append("<column id=\"field0028\" type=\"4\" name=\"数量\" isNullable=\"false\" length=\"20\"/>");
|
||||
stringBuffer.append("<column id=\"field0029\" type=\"4\" name=\"单价\" isNullable=\"false\" length=\"20\"/>");
|
||||
stringBuffer.append("<column id=\"field0030\" type=\"4\" name=\"金额\" isNullable=\"false\" length=\"20\"/>");
|
||||
stringBuffer.append("<column id=\"field0031\" type=\"4\" name=\"税率\" isNullable=\"false\" length=\"20\"/>");
|
||||
stringBuffer.append("<column id=\"field0032\" type=\"4\" name=\"税额\" isNullable=\"false\" length=\"20\"/>");
|
||||
stringBuffer.append("</definitions>");
|
||||
stringBuffer.append("<values>");
|
||||
|
||||
JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("mdm_fp_detail"));
|
||||
if(jsonArray != null&& jsonArray.size() > 0){
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject detailObject = jsonArray.getJSONObject(i);
|
||||
stringBuffer.append("<row>");
|
||||
stringBuffer.append("<column name=\"序号1\"><value>").append(detailObject.getString("xh") != null?"<![CDATA["+detailObject.getString("xh")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"税收分类编码\"><value>").append(detailObject.getString("ssflbm") != null?"<![CDATA["+detailObject.getString("ssflbm")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"项目名称\"><value>").append(detailObject.getString("xmmc") != null?"<![CDATA["+detailObject.getString("xmmc")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"规格型号\"><value>").append(detailObject.getString("ggxh") != null?"<![CDATA["+detailObject.getString("ggxh")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"单位\"><value>").append(detailObject.getString("dw") != null?"<![CDATA["+detailObject.getString("dw")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"数量\"><value>").append(detailObject.getString("sl") != null?"<![CDATA["+detailObject.getString("sl")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"单价\"><value>").append(detailObject.getString("dj") != null?"<![CDATA["+detailObject.getString("dj")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"金额\"><value>").append(detailObject.getString("je") != null?"<![CDATA["+detailObject.getString("je")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"税率\"><value>").append(detailObject.getString("slv") != null?"<![CDATA["+detailObject.getString("slv")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"税额\"><value>").append(detailObject.getString("se") != null?"<![CDATA["+detailObject.getString("se")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("</row>");
|
||||
}
|
||||
}
|
||||
stringBuffer.append("</values>");
|
||||
stringBuffer.append("</subForm>");
|
||||
stringBuffer.append("</subForms>");
|
||||
stringBuffer.append("</formExport>");
|
||||
stringBuffer.append("</forms>");
|
||||
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 财报数据推送
|
||||
* @Date 4:28 下午 2025/4/16
|
||||
* @param requestJson
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity sendFinancialReportPlugin(JSONObject requestJson) {
|
||||
|
||||
logger.error("财报数据推送入参"+requestJson.toJSONString());
|
||||
JSONObject jsonStr = requestJson.getJSONObject("jsonStr");
|
||||
JSONObject businessDataStr = jsonStr.getJSONObject("businessDataStr");
|
||||
String eventType = jsonStr.getString("eventType");
|
||||
switch (eventType) {
|
||||
case "onProcessFinished"://流程结束事件,同步物料到U8C
|
||||
JSONObject businessData = businessDataStr.getJSONObject("formmain_0708");
|
||||
if(businessData.getString("field0007") == null){//数据类型
|
||||
return BaseResult.getFailureMessageEntity("数据类型为空");
|
||||
}
|
||||
if(businessData.getString("field0007").equals("1")){//科目余额
|
||||
|
||||
}
|
||||
if(businessData.getString("field0007").equals("2")){//财报
|
||||
return sendFinancialReport(businessData);
|
||||
}
|
||||
if(businessData.getString("field0007").equals("3")){//进项发票
|
||||
return BaseResult.getFailureMessageEntity("数据类型错误");
|
||||
}
|
||||
if(businessData.getString("field0007").equals("4")){//销项发票
|
||||
return BaseResult.getFailureMessageEntity("数据类型错误");
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("推送数据成功");
|
||||
default:
|
||||
return BaseResult.getFailureMessageEntity("未匹配到流程监听事件!当前传入的eventType:" + eventType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 发送财报数据
|
||||
* @Date 5:28 下午 2025/4/22
|
||||
* @param businessData
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
private JsonResultEntity sendFinancialReport(JSONObject businessData) {
|
||||
String access_token = getToken();
|
||||
if (access_token == null) {
|
||||
return BaseResult.getFailureMessageEntity("token获取失败");
|
||||
}
|
||||
String url = cbUrl+access_token;
|
||||
String ztbm = businessData.getString("field0005");//账套编码
|
||||
String sh = businessData.getString("field0006");//税号
|
||||
String sjlx = businessData.getString("field0007");//数据类型
|
||||
String cjzq = businessData.getString("field0008");//采集账期
|
||||
String rwbm = businessData.getString("field0009");//任务编码
|
||||
if(ztbm == null || "".equals(ztbm)){
|
||||
return BaseResult.getSuccessMessageEntity("账套编码为空");
|
||||
}
|
||||
if(cjzq == null || "".equals(cjzq)){
|
||||
return BaseResult.getSuccessMessageEntity("采集账期为空");
|
||||
}
|
||||
if(rwbm == null || "".equals(rwbm)){
|
||||
return BaseResult.getSuccessMessageEntity("任务编码为空");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Date date = null;
|
||||
String qncjzq = null;
|
||||
|
||||
IncomeInvoiceEntity dyAloneId = null;
|
||||
JSONObject dydata = null;
|
||||
JSONObject qndata = null;
|
||||
IncomeInvoiceEntity qnAloneId = null;
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
try {
|
||||
date = sdf.parse(cjzq);
|
||||
} catch (ParseException e) {
|
||||
return BaseResult.getSuccessMessageEntity("采集账期格式错误");
|
||||
}
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.YEAR, -1);
|
||||
Date qn = calendar.getTime();
|
||||
qncjzq = sdf.format(qn);
|
||||
|
||||
//查询当月帐套组织
|
||||
IncomeInvoiceEntity jnentity = new IncomeInvoiceEntity();
|
||||
jnentity.setDataSourceCode("");
|
||||
jnentity.setSysData(cjzq);
|
||||
jnentity.setOrgCode(ztbm);
|
||||
List<IncomeInvoiceEntity> jnlist = incomeInvoiceDao.queryZtzz(jnentity);
|
||||
if(jnlist != null && jnlist.size() == 1){
|
||||
dyAloneId = jnlist.get(0);
|
||||
}else {
|
||||
return BaseResult.getSuccessMessageEntity("未查询到当月的财报数据,不推送");
|
||||
}
|
||||
//查询去年当帐套组织
|
||||
IncomeInvoiceEntity qnentity = new IncomeInvoiceEntity();
|
||||
qnentity.setDataSourceCode("");
|
||||
qnentity.setSysData(qncjzq);
|
||||
qnentity.setOrgCode(ztbm);
|
||||
List<IncomeInvoiceEntity> qnlist = incomeInvoiceDao.queryZtzz(qnentity);
|
||||
if(qnlist != null && qnlist.size() == 1){
|
||||
qnAloneId = qnlist.get(0);
|
||||
}else {
|
||||
logger.info("未查询到去年当期的财报数据");
|
||||
}
|
||||
|
||||
//查询当月的财报数据
|
||||
IncomeInvoiceEntity jnquerydata = new IncomeInvoiceEntity();
|
||||
jnquerydata.setDataSourceCode("");
|
||||
jnquerydata.setAloneId(dyAloneId.getAloneId());
|
||||
List<JSONObject> dydataList = incomeInvoiceDao.queryByAloneId(jnquerydata);
|
||||
if(dydataList != null && dydataList.size() == 1){
|
||||
dydata = dydataList.get(0);
|
||||
}else {
|
||||
return BaseResult.getSuccessMessageEntity("未查询到当月的财报数据,不推送");
|
||||
}
|
||||
//查询去年当期的财报数据
|
||||
if(qnAloneId != null){
|
||||
//查找去年数据
|
||||
IncomeInvoiceEntity qnquerydata = new IncomeInvoiceEntity();
|
||||
qnquerydata.setDataSourceCode("");
|
||||
qnquerydata.setAloneId(qnAloneId.getAloneId());
|
||||
List<JSONObject> qndataList = incomeInvoiceDao.queryByAloneId(qnquerydata);
|
||||
if(qndataList != null && qndataList.size() == 1){
|
||||
qndata = qndataList.get(0);
|
||||
}
|
||||
}
|
||||
//拼接数据
|
||||
JSONObject sendData = new JSONObject();
|
||||
sendData.put("accessKey",accessKey);
|
||||
long timestamp = System.currentTimeMillis();
|
||||
sendData.put("timestamp",timestamp);
|
||||
sendData.put("taskNo",rwbm);
|
||||
sendData.put("period",cjzq);
|
||||
|
||||
JSONArray reportList = new JSONArray();
|
||||
|
||||
JSONObject zcfzb = new JSONObject();//资产负债表
|
||||
zcfzb.put("period",cjzq);
|
||||
zcfzb.put("reportType",1);
|
||||
JSONArray reportSubjects1 = new JSONArray();
|
||||
setDataToArray("subjectName","12312",1,reportSubjects1);
|
||||
zcfzb.put("reportSubjects",reportSubjects1);
|
||||
|
||||
JSONObject llb = new JSONObject();//利润表
|
||||
llb.put("period",cjzq);
|
||||
llb.put("reportType",2);
|
||||
JSONArray reportSubjects2 = new JSONArray();
|
||||
llb.put("reportSubjects",reportSubjects2);
|
||||
|
||||
JSONObject xjll = new JSONObject();//现金流量表
|
||||
xjll.put("period",cjzq);
|
||||
xjll.put("reportType",3);
|
||||
JSONArray reportSubjects3 = new JSONArray();
|
||||
xjll.put("reportSubjects",reportSubjects3);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
reportList.add(zcfzb);
|
||||
reportList.add(llb);
|
||||
reportList.add(xjll);
|
||||
|
||||
sendData.put("reportList",reportList);
|
||||
String a = YzfSignUtil.signRequest(sendData,accessSecret);
|
||||
sendData.put("sign",a);
|
||||
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Content-Type", "application/json; charset=utf-8");
|
||||
String returndata = sendPost(url, headers, sendData.toJSONString());
|
||||
|
||||
if (returndata != null && JSONObject.isValidObject(returndata)) {
|
||||
JSONObject dataJson = JSONObject.parseObject(returndata);
|
||||
if(dataJson != null && dataJson.getString("code") != null && "0".equals( dataJson.getString("code"))){
|
||||
JSONObject data = dataJson.getJSONObject("result");
|
||||
if(data != null ){
|
||||
if(data != null && data.getString("resultCode") != null && "0".equals( data.getString("resultCode"))){
|
||||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("发送失败:"+returndata);
|
||||
}
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("发送失败:"+returndata);
|
||||
}
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("发送失败:"+returndata);
|
||||
}
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("发送失败:"+returndata);
|
||||
}
|
||||
}
|
||||
|
||||
private void setDataToArray(String subjectName, String value, Integer valueType, JSONArray reportSubjects) {
|
||||
if(value != null && !"".equals(value)){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("subjectName",subjectName);
|
||||
jsonObject.put("value",new BigDecimal(value));
|
||||
jsonObject.put("valueType",valueType);
|
||||
reportSubjects.add(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -470,9 +470,10 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
}else {//执行正常下发
|
||||
|
||||
logger.info("==========开始执行正常主数据下发=============");
|
||||
//查询主数据
|
||||
MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity();
|
||||
queryMdmModuleEntity.setMdmCode(10050L);
|
||||
queryMdmModuleEntity.setSts("Y");
|
||||
List<MdmModuleEntity> mdmModuleEntities = mdmModuleDao.queryBase(queryMdmModuleEntity);
|
||||
if(mdmModuleEntities == null || mdmModuleEntities.size() == 0){
|
||||
|
@ -509,13 +510,17 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
queryFildRule.setRuleCode("service");
|
||||
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
|
||||
|
||||
if(mdmModuleEntities.get(i).getMdmCode()!= 10045L){
|
||||
//新增
|
||||
doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
//修改
|
||||
doUpdate(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
//删除
|
||||
doDelete(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
|
||||
}else{
|
||||
logger.info("主数据编码为10045,已经在业务数据下发执行,主数据下发不执行");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -739,7 +744,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
map1.put("tableName",mainDb);
|
||||
//map1.put("dataStatus", "F");
|
||||
map1.put("updateStatus", "0");
|
||||
map1.put("size", 50);
|
||||
//map1.put("size", 50);
|
||||
objects = mdmModuleDao.queryMdmSTs(map1);
|
||||
objects = toLowerCaseKeys(objects);
|
||||
|
||||
|
@ -827,6 +832,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
/** body */
|
||||
String bodys = doObjects.get(i).toJSONString();
|
||||
if(scriptEntity != null && scriptEntity.getId() != null ){
|
||||
logger.info("=========开始执行正常主数据修改下发脚本,第一次==============");
|
||||
groovy.put("code",scriptEntity.getScriptCode());
|
||||
groovy.put("className",scriptEntity.getClassName());
|
||||
groovy.put("name",scriptEntity.getScriptName());
|
||||
|
@ -854,6 +860,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
headers.putAll(header);
|
||||
}
|
||||
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||
logger.info("=========正常主数据修改开始执行登录接口==============");
|
||||
//找到登陆接口
|
||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||
if (null == loginApi) {
|
||||
|
@ -874,12 +881,15 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
continue;
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
logger.info("=======主数据正常修改下发登录返回数据:{}========",attritube.toJSONString());
|
||||
querys = getQuery(apiEntity,querys,attritube);
|
||||
headers = getHeaders(apiEntity,headers,attritube);
|
||||
bodys = getBodys(apiEntity,bodys,attritube);
|
||||
}
|
||||
//组装数据发送
|
||||
logger.info("=========开始执行主业务修改数据下发脚本,第二次==============");
|
||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||
logger.info("=====主数据修改下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
|
||||
if(jsonResultEntity.isFlag()){
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
|
||||
|
@ -911,7 +921,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
* @param mdmModuleDistributeEntities
|
||||
* @return void
|
||||
**/
|
||||
private void doAdd(String mdmId,Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities,List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities ) throws Exception {
|
||||
private void
|
||||
doAdd(String mdmId,Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities,List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities ) throws Exception {
|
||||
//查询一千条数据
|
||||
String mainDb = null;
|
||||
List<JSONObject> objects = new ArrayList<>();
|
||||
|
@ -927,7 +938,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
map1.put("tableName",mainDb);
|
||||
//map1.put("dataStatus", "Y");
|
||||
map1.put("addStatus", "0");
|
||||
map1.put("size", 50);
|
||||
//map1.put("size", 50);
|
||||
objects = mdmModuleDao.queryMdmSTs(map1);
|
||||
objects = toLowerCaseKeys(objects);
|
||||
|
||||
|
@ -999,6 +1010,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
mdmModuleSendLogEntity.setOptionType("1");
|
||||
Integer num = mdmModuleSendLogDao.getCount(mdmModuleSendLogEntity);
|
||||
if(num > 0){//已经新增过不发送
|
||||
objects.get(i).put("sendsanfzt123",true);
|
||||
continue;
|
||||
}
|
||||
getDetailData(mdmModuleDbEntities,doObjects.get(i),mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
|
@ -1029,6 +1041,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
/** body */
|
||||
String bodys = doObjects.get(i).toJSONString();
|
||||
if(scriptEntity != null && scriptEntity.getId() != null ){
|
||||
logger.info("=========开始执行正常主数据新增下发脚本,第一次==============");
|
||||
groovy.put("code",scriptEntity.getScriptCode());
|
||||
groovy.put("className",scriptEntity.getClassName());
|
||||
groovy.put("name",scriptEntity.getScriptName());
|
||||
|
@ -1056,6 +1069,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
headers.putAll(header);
|
||||
}
|
||||
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||
logger.info("=========正常主数据新增开始执行登录接口==============");
|
||||
//找到登陆接口
|
||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||
if (null == loginApi) {
|
||||
|
@ -1076,15 +1090,19 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
continue;
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
logger.info("=======主数据正常新增下发登录返回数据:{}========",attritube.toJSONString());
|
||||
querys = getQuery(apiEntity,querys,attritube);
|
||||
headers = getHeaders(apiEntity,headers,attritube);
|
||||
bodys = getBodys(apiEntity,bodys,attritube);
|
||||
}
|
||||
|
||||
//组装数据发送
|
||||
logger.info("=========开始执行主业务新增数据下发脚本,第二次==============");
|
||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||
logger.info("=====主数据新增下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
|
||||
if(jsonResultEntity.isFlag()){
|
||||
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
|
||||
logger.info("=========开始执行主数据新增返回脚本==============");
|
||||
JSONObject backScriptJson = new JSONObject();
|
||||
backScriptJson.put("data", jsonResultEntity.getAttribute());
|
||||
groovy.put("code", scriptEntity.getScriptCode()+"back");
|
||||
|
@ -1124,11 +1142,13 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
//保存日志
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||
objects.get(i).put("sendsanfzt123",true);
|
||||
logger.info("========主数据新增下发完成,日志保存为成功============");
|
||||
continue;
|
||||
}else {
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||
objects.get(i).put("sendsanfzt123",false);
|
||||
logger.info("========主数据新增下发完成,日志保存为失败============");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1136,7 +1156,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
|
||||
//所有下发发送完成,修改数据状态
|
||||
for (int i = 0; i < objects.size(); i++) {
|
||||
if(objects.get(i).getBoolean("sendsanfzt123")){
|
||||
if(objects.get(i).getString("sendsanfzt123") != null && objects.get(i).getBoolean("sendsanfzt123")){
|
||||
Map<String, Object> updateMap = new HashMap<>();
|
||||
updateMap.put("tableName",mainDb);
|
||||
//updateMap.put("dataStatus", "Y");
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
#######################本地环境#######################
|
||||
logging:
|
||||
#日志级别 指定目录级别
|
||||
level:
|
||||
root: info
|
||||
encodings: UTF-8
|
||||
file:
|
||||
# 日志保存路径
|
||||
path: /Users/apple/Desktop/log/local
|
||||
spring:
|
||||
data:
|
||||
mongodb:
|
||||
# host: 192.168.2.237
|
||||
# port: 27017
|
||||
# database: businesscenter
|
||||
# auto-index-creation: true
|
||||
# password: hzya1314
|
||||
# username: hzya
|
||||
flyway:
|
||||
# 启动flyway migration, 默认为true
|
||||
enabled: false
|
||||
datasource:
|
||||
dynamic:
|
||||
druid:
|
||||
filters: stat,log4j2
|
||||
datasource:
|
||||
master:
|
||||
# url: jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
|
||||
# username: hzyazt
|
||||
# password: 62e4295b615a30dbf3b8ee96f41c820b
|
||||
# driver-class-name: dm.jdbc.driver.DmDriver
|
||||
# type: com.alibaba.druid.pool.DruidDataSource
|
||||
url: jdbc:mysql://ufidahz.com.cn:9014/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
|
||||
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
|
||||
# url: jdbc:dm://hzya.ufyct.com:9040/businesscenter?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
|
||||
# url: jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
|
||||
# username: hzyazt
|
||||
# password: 62e4295b615a30dbf3b8ee96f41c820b
|
||||
# driver-class-name: dm.jdbc.driver.DmDriver
|
||||
savefile:
|
||||
# 文件保存路径
|
||||
path: /Users/apple/Desktop/log/local
|
||||
tomcatpath: /Users/apple/Desktop/log/local
|
||||
pluginpath: /Users/apple/Desktop/log/local
|
||||
zt:
|
||||
url: http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface
|
||||
cbs8:
|
||||
appId: 1P4AGrpz
|
||||
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
|
||||
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
|
||||
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
|
||||
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
|
||||
# 这个私钥到时候上传到cbs,和下面到是同一对
|
||||
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
|
||||
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
|
||||
cbs_public_key: 0469146F06BF3B01236E84632441E826
|
||||
#电子回单下载临时存放位置
|
||||
elec_path: /Users/xiangerlin/Downloads/
|
||||
OA:
|
||||
data_source_code: yc_oa
|
||||
server:
|
||||
port: 10086
|
||||
|
||||
# mysqldump -d mylm -hhzya.ufyct.com -p9096 -uroot -phzya1314 >%dirName%\table_view.sql
|
||||
|
||||
|
||||
database:
|
||||
databaseName: businesscenter
|
||||
host: 192.168.2.237
|
||||
port: 3306
|
||||
username: root
|
||||
password: hzya@1314
|
||||
filePase: /Users/apple/Desktop/log
|
||||
fileName: data.sql
|
||||
#sftp:
|
||||
# host: 192.168.2.237
|
||||
# port: 9091
|
||||
# username: cs237
|
||||
# password: hzya@1314
|
||||
# filePase: /databaseBack
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
<id>IncomeInvoicePlugin</id>
|
||||
<name>IncomeInvoicePlugin插件</name>
|
||||
<category>202404080001</category>
|
||||
</plugin>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="incomeInvoiceDao" class="com.hzya.frame.plugin.incomeInvoiceData.dao.impl.IncomeInvoiceDaoImpl" />
|
||||
</beans>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="IncomeInvoicePlugin_Initializer" class="com.hzya.frame.plugin.incomeInvoiceData.plugin.IncomeInvoicePluginInitializer" />
|
||||
<bean name="FinancialReportPlugin_Initializer" class="com.hzya.frame.plugin.incomeInvoiceData.plugin.FinancialReportPluginInitializer" />
|
||||
</beans>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="incomeInvoiceService" class="com.hzya.frame.plugin.incomeInvoiceData.service.impl.IncomeInvoiceServiceImpl" />
|
||||
</beans>
|
|
@ -64,6 +64,9 @@ public class ApplicationCache {
|
|||
case "2": //
|
||||
o = applicationApiMap.get(key);
|
||||
break;
|
||||
case "5": //
|
||||
o = applicationApiMap.get(key);
|
||||
break;
|
||||
case "3": //
|
||||
o = applicationApiAuthMap.get(key);
|
||||
break;
|
||||
|
@ -96,6 +99,7 @@ public class ApplicationCache {
|
|||
if(receiveApiList != null && receiveApiList.size() > 0){
|
||||
for (int i = 0; i < receiveApiList.size(); i++) {
|
||||
applicationApiMap.put("appId"+receiveApiList.get(i).getAppId()+"apiCode"+receiveApiList.get(i).getApiCode(), receiveApiList.get(i));
|
||||
applicationApiMap.put("apiId"+receiveApiList.get(i).getId(), receiveApiList.get(i));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -3054,10 +3054,15 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(receiveApi.getReturnSuccessValue().equals(body)){
|
||||
sysMessageManageLogEntity.setStatus("3");//返回信息
|
||||
sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + body);//返回信息
|
||||
}else {
|
||||
sysMessageManageLogEntity.setStatus("4");//返回信息
|
||||
sysMessageManageLogEntity.setRemark("接口调用失败,返回格式错误,不是JSON");//返回信息
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sysMessageManageLogEntity.setStatus("4");//返回信息
|
||||
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
||||
|
@ -3094,6 +3099,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
return sysMessageManageLogEntity;
|
||||
}
|
||||
|
||||
|
||||
private void sendMssage(SysPushMessageEntity sysPushMessageEntity) {
|
||||
sysSendMessageLogService.sendMessage(sysPushMessageEntity);
|
||||
}
|
||||
|
|
|
@ -66,6 +66,13 @@ public interface ISeeYonInterFace {
|
|||
*/
|
||||
SysExtensionApiEntity colEventPre(SysExtensionApiEntity sysExtensionApi) throws Exception;
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听前置方法,绑定数据源
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
SysExtensionApiEntity getToken(SysExtensionApiEntity entity) throws Exception;
|
||||
/**
|
||||
* seeyon流程事件监听
|
||||
*
|
||||
|
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
@ -13,12 +14,14 @@ import com.hzya.frame.seeyon.dao.ISeeYonInterFaceDao;
|
|||
import com.hzya.frame.seeyon.entity.OAWorkflowEventDataEntity;
|
||||
import com.hzya.frame.seeyon.entity.SeeYonInterFaceEntity;
|
||||
import com.hzya.frame.seeyon.service.ISeeYonInterFace;
|
||||
import com.hzya.frame.sys.sysenum.SysEnum;
|
||||
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||
import com.hzya.frame.sysnew.application.api.service.ISysApplicationApiService;
|
||||
import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao;
|
||||
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.sysnew.application.service.impl.ApplicationCache;
|
||||
import com.hzya.frame.util.PluginUtils;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
@ -26,12 +29,22 @@ import com.hzya.frame.web.exception.BaseSystemException;
|
|||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -77,6 +90,10 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
private ISeeYonInterFaceDao seeYonInterFaceDao;
|
||||
//上一次同步时间
|
||||
private final String LAST_SYNCHRONISED_TIME = "";
|
||||
@Value("${zt.url}")
|
||||
private String url ;
|
||||
@Resource
|
||||
private ApplicationCache applicationCache;
|
||||
|
||||
{
|
||||
eventTypeBuffer.append("发起前事件 onBeforeStart ,");
|
||||
|
@ -564,4 +581,264 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SysExtensionApiEntity getToken(SysExtensionApiEntity entity) {
|
||||
Map<String, String> headers = entity.getHeaders();
|
||||
SysApplicationApiEntity sysApplicationEntity = entity.getReceiveApi();
|
||||
SysApplicationEntity sendApp = entity.getSendApp();
|
||||
SysApplicationEntity receiveApp = entity.getReceiveApp();
|
||||
if("1".equals(sysApplicationEntity.getNeedLogin()) && sysApplicationEntity.getAuthenticationPort() != null){
|
||||
SysApplicationApiEntity loginApi = getApiByAppIdApiCode(sysApplicationEntity.getAuthenticationPort());
|
||||
if (null == loginApi) {
|
||||
return entity;
|
||||
}
|
||||
String rzquerys = getQuery(loginApi,null,null);
|
||||
Map<String, String> headersa = new HashMap<>();
|
||||
headersa.put("publicKey", sendApp.getPublicKey());
|
||||
headersa.put("secretKey", sendApp.getSecretKey());
|
||||
headersa.put("appId", receiveApp.getAppId().toString());
|
||||
headersa.put("apiCode", loginApi.getApiCode().toString());
|
||||
Map<String, String> rzheaders = getHeaders(loginApi,headersa,null);
|
||||
String rzbodys = getBodys(loginApi,null,null);
|
||||
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
||||
if (!rzjsonResultEntity.isFlag()) {
|
||||
return entity;
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
headers.put("token",attritube.getJSONObject("attribute").getString("id"));
|
||||
}
|
||||
entity.setHeaders(headers);
|
||||
return entity;
|
||||
}
|
||||
private SysApplicationApiEntity getApiByAppIdApiCode(String apiId) {
|
||||
|
||||
String str = "apiId" + apiId ;
|
||||
Object o = applicationCache.get("5", str);
|
||||
if (o != null) {
|
||||
return (SysApplicationApiEntity) o;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private JsonResultEntity sendData(SysApplicationApiEntity applicationApiEntity, Map<String, String> headers ,String bodys ,String querys) {
|
||||
StringBuffer urls = new StringBuffer(url);
|
||||
if (querys != null) {
|
||||
urls.append("?");
|
||||
urls.append(querys);
|
||||
}
|
||||
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
||||
// HttpClient
|
||||
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
|
||||
HttpPost post = new HttpPost(urls.toString());
|
||||
CloseableHttpResponse response = null;
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(Integer.valueOf(applicationApiEntity.getTimeoutPeriod())).build();
|
||||
post.setConfig(requestConfig);//设置请求参数【超时时间】
|
||||
|
||||
if (headers != null && headers.size() > 0) {
|
||||
for (String key : headers.keySet()) {
|
||||
post.setHeader(key, headers.get(key));
|
||||
}
|
||||
}
|
||||
StringBuilder body = new StringBuilder();
|
||||
boolean flag = true;
|
||||
try {
|
||||
if (bodys != null && !"".equals(bodys)) {
|
||||
ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
|
||||
entity.setContentType("application/json");
|
||||
post.setEntity(entity);
|
||||
}
|
||||
response = closeableHttpClient.execute(post);
|
||||
|
||||
HttpEntity entity = response.getEntity();
|
||||
body.append(EntityUtils.toString(entity,"UTF-8"));
|
||||
flag = true;
|
||||
logger.info("返回结果:" + body);
|
||||
} catch (Exception e) {
|
||||
logger.error("请求错误:" + e.getMessage());
|
||||
body.append(e.getMessage());
|
||||
flag = false;
|
||||
} finally {
|
||||
try {
|
||||
// 关闭响应对象
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
// 关闭响应对象
|
||||
if (closeableHttpClient != null) {
|
||||
closeableHttpClient.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
if (flag) {
|
||||
if (JSONUtil.isTypeJSON(body.toString())) {
|
||||
JsonResultEntity jsonResultEntity = JSONObject.parseObject(body.toString(),JsonResultEntity.class);
|
||||
if(jsonResultEntity.isFlag()){
|
||||
return BaseResult.getSuccessMessageEntity("转发成功", body);
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("转发失败", body);
|
||||
}
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("转发失败", body);
|
||||
}
|
||||
} else {
|
||||
return BaseResult.getFailureMessageEntity("转发失败", body);
|
||||
}
|
||||
}
|
||||
|
||||
private String getBodys(SysApplicationApiEntity loginApi,String sendDatastr, JSONObject loginData) {
|
||||
JSONObject sendData = new JSONObject();
|
||||
if(sendDatastr != null ){
|
||||
sendData = JSONObject.parseObject(sendDatastr);
|
||||
}
|
||||
if(loginData == null){
|
||||
loginData = new JSONObject();
|
||||
}
|
||||
if (loginApi.getBodyIn() != null && !"".equals(loginApi.getBodyIn())) {
|
||||
if (JSONUtil.isTypeJSONArray(loginApi.getBodyIn())) {
|
||||
JSONArray headerbodyArray = JSON.parseArray(loginApi.getBodyIn());
|
||||
JSONObject bodyjson = headerbodyArray.getJSONObject(0);
|
||||
JSONArray headerArray = bodyjson.getJSONArray("children");
|
||||
for (int i = 0; i < headerArray.size(); i++) {
|
||||
//获取到第一个数据
|
||||
JSONObject querys = headerArray.getJSONObject(i);
|
||||
if (SysEnum.FUNDAMENTAL.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型
|
||||
String query = querys.getString(SysEnum.EXAMPLE.getValue());
|
||||
if (query != null && !"".equals(query)) {
|
||||
sendData.put(querys.getString(SysEnum.PARAMETERNAME.getValue()),query);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sendData.toString();
|
||||
}
|
||||
|
||||
private Map<String, String> getHeaders(SysApplicationApiEntity loginApi,Map<String, String> map,JSONObject loginData) {
|
||||
if(loginData == null){
|
||||
loginData = new JSONObject();
|
||||
}
|
||||
if (loginApi.getHeaderIn() != null && !"".equals(loginApi.getHeaderIn())) {
|
||||
if (JSONUtil.isTypeJSONArray(loginApi.getHeaderIn())) {
|
||||
JSONArray headerArray = JSON.parseArray(loginApi.getHeaderIn());
|
||||
for (int i = 0; i < headerArray.size(); i++) {
|
||||
JSONObject querys = headerArray.getJSONObject(i);
|
||||
//query 只有基本类型,不用循环判断下级
|
||||
//判断参数是否有值
|
||||
//获取对象下面的层级数据
|
||||
if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型
|
||||
String query = querys.getString(SysEnum.EXAMPLE.getValue());
|
||||
if (query != null && !"".equals(query)) {
|
||||
JSONArray example = JSONArray.parseArray(query);
|
||||
String logValue = getObjectValue(loginData, example);
|
||||
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), logValue);
|
||||
}
|
||||
} else {
|
||||
if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加
|
||||
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue()));
|
||||
}
|
||||
} else {//没有值直接拼接
|
||||
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loginData
|
||||
* @param example
|
||||
* @return java.lang.String
|
||||
* @Author lvleigang
|
||||
* @Description 根据jsonArray 获取jsonobject中的值
|
||||
* @Date 11:47 上午 2023/8/31
|
||||
**/
|
||||
private String getObjectValue(JSONObject loginData, JSONArray example) {
|
||||
String values = "";
|
||||
if (example != null && example.size() > 0) {
|
||||
for (int i = 0; i < example.size(); i++) {
|
||||
if (loginData.getString(example.getString(i)) != null && !"".equals(loginData.getString(example.getString(i)))) {
|
||||
if (i == (example.size() - 1)) {
|
||||
values = loginData.getString(example.getString(i));
|
||||
} else {
|
||||
loginData = JSONObject.parseObject(loginData.getString(example.getString(i)));
|
||||
}
|
||||
} else {
|
||||
return values;
|
||||
}
|
||||
}
|
||||
}
|
||||
return values;
|
||||
}
|
||||
private String getQuery(SysApplicationApiEntity loginApi,String sendDatastr,JSONObject loginData) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if(sendDatastr != null){
|
||||
String[] parts = sendDatastr.split("&");
|
||||
if(parts != null && parts.length > 0){
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
String[] part = parts[i].split("=");
|
||||
if(part != null && part.length >=2 ){
|
||||
for (int a = 0; a < part.length; a++) {
|
||||
map.put(part[0],part[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(loginData == null){
|
||||
loginData = new JSONObject();
|
||||
}
|
||||
if (loginApi.getQueryIn() != null && !"".equals(loginApi.getQueryIn())) {
|
||||
if (JSONUtil.isTypeJSONArray(loginApi.getQueryIn())) {
|
||||
JSONArray headerArray = JSON.parseArray(loginApi.getQueryIn());
|
||||
for (int i = 0; i < headerArray.size(); i++) {
|
||||
JSONObject querys = headerArray.getJSONObject(i);
|
||||
//query 只有基本类型,不用循环判断下级
|
||||
//判断参数是否有值
|
||||
//获取对象下面的层级数据
|
||||
if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型
|
||||
String query = querys.getString(SysEnum.EXAMPLE.getValue());
|
||||
if (query != null && !"".equals(query)) {
|
||||
JSONArray example = JSONArray.parseArray(query);
|
||||
String logValue = getObjectValue(loginData, example);
|
||||
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), logValue);
|
||||
}
|
||||
} else {
|
||||
//不是认证类型直接取值
|
||||
if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加
|
||||
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue()));
|
||||
}
|
||||
} else {//没有值直接拼接
|
||||
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
StringBuffer returnStr = new StringBuffer();
|
||||
if(map != null && map.size() > 0){
|
||||
for (String key : map.keySet()) {
|
||||
if("".equals(returnStr)){
|
||||
returnStr.append(key).append("=").append(map.get(key));
|
||||
}else {
|
||||
returnStr.append("&").append(key).append("=").append(map.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnStr.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,11 +67,10 @@ public class ZxBankServiceImpl extends BaseService<ZxBankEntity, String> impleme
|
|||
@Value("${zt.url}")
|
||||
private String url;
|
||||
|
||||
|
||||
@Value("${zx.privateKey}")
|
||||
@Value("${zx.privateKey:}")
|
||||
private String privateKey;
|
||||
|
||||
@Value("${zx.publicKey}")
|
||||
@Value("${zx.publicKey:}")
|
||||
private String publicKey;
|
||||
@Override
|
||||
public JsonResultEntity queryArchives(JSONObject json) {
|
||||
|
|
Loading…
Reference in New Issue