三维OA对接BIP,定时任务抽取和下发

This commit is contained in:
hecan 2024-12-13 09:06:47 +08:00
parent 36abbdda0a
commit c996ade1ee
11 changed files with 902 additions and 31 deletions

View File

@ -27,6 +27,8 @@ import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao;
import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity;
import com.hzya.frame.sysnew.comparison.serviceData.dao.IServiceDataDao;
import com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity;
import com.hzya.frame.sysnew.comparison.serviceData.service.IServiceDataService;
import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
@ -34,6 +36,7 @@ import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTa
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;
@ -81,6 +84,8 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
private IMdmServiceCache mdmServiceCache;
@Resource
private IMdmModuleSendLogDao mdmModuleSendLogDao;
@Autowired
private IServiceDataDao serviceDataDao;
@Resource
private IMdmModuleDistributeTripartiteDao mdmModuleDistributeTripartiteDao;
@Value("${zt.url}")
@ -123,6 +128,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try{
//重试方法
//重试方法
if (null != requestJson) {
//如果这个id不为空说明是重试的
@ -389,7 +395,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
}
}
Map<String, String> headers = new HashMap<>();
headers.put("publicKey","/ObJxb7dT7sD8HPRDZJYAWb7lhAUTYqekPkU+uHJv1GAgyhCe7eDIk+3zDUT+v578prj");
headers.put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
headers.put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
headers.put("appId",sysApplicationEntity.getAppId().toString());
headers.put("apiCode",apiEntity.getApiCode().toString());
@ -449,8 +455,27 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
mdmModuleDistributeTripartiteEntity.setMdmId(mdmModuleEntity.getId());
mdmModuleDistributeTripartiteEntity.setDataId(object.getString("id"));
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId"));
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("vbillno"));
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
//根据OA单据编号更新BIP付款申请单号
JSONObject jsonObjectBody = JSONObject.parseObject(bodys);
String parent = jsonObjectBody.getString("parent");
JSONObject jsonObjectParent = JSONObject.parseObject(parent);
ServiceDataEntity serviceDataEntity=new ServiceDataEntity();
serviceDataEntity.setBillCode(jsonObjectParent.getString("vdef1"));
serviceDataEntity.setDataSourceCode("SW-OA");
List<ServiceDataEntity> query = serviceDataDao.query(serviceDataEntity);
if(CollectionUtils.isNotEmpty(query)){
logger.info("===下发时候开始根据OA单据编号{}更新BIP付款申请单号:{}",jsonObjectParent.getString("vdef1"),backJsonResultEntity.getString("vbillno"));
serviceDataEntity.setTabName(query.get(0).getTabName());
serviceDataEntity.setBipPaymentNumberField(query.get(0).getBipPaymentNumberField());
serviceDataEntity.setBipPaymentNumber(query.get(0).getBipPaymentNumber());
serviceDataEntity.setId(query.get(0).getId());
serviceDataDao.updateBipPaymentNumber(serviceDataEntity);
logger.info("===下发时候根据OA单据编号{}更新BIP付款申请单号:{}完毕",jsonObjectParent.getString("vdef1"),backJsonResultEntity.getString("vbillno"));
}else{
logger.info("======下发时候根据单据编号:{}未能在三维OA查询到数据Bip付款申请单号不回写",jsonObjectParent.getString("vdef1"));
}
}
}
} catch (Exception e) {
@ -515,9 +540,9 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
//新增
doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
//修改
doUpdate(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);
//doDelete(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
}
@ -1115,8 +1140,27 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
mdmModuleDistributeTripartiteEntity.setMdmId(mdmId);
mdmModuleDistributeTripartiteEntity.setDataId(objects.get(i).getString("id"));
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId"));
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("vbillno"));
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
//根据OA单据编号更新BIP付款申请单号
JSONObject jsonObjectBody = JSONObject.parseObject(bodys);
String parent = jsonObjectBody.getString("parent");
JSONObject jsonObjectParent = JSONObject.parseObject(parent);
ServiceDataEntity serviceDataEntity=new ServiceDataEntity();
serviceDataEntity.setBillCode(jsonObjectParent.getString("vdef1"));
serviceDataEntity.setDataSourceCode("SW-OA");
List<ServiceDataEntity> query = serviceDataDao.query(serviceDataEntity);
if(CollectionUtils.isNotEmpty(query)){
logger.info("===下发时候开始根据OA单据编号{}更新BIP付款申请单号:{}",jsonObjectParent.getString("vdef1"),backJsonResultEntity.getString("vbillno"));
serviceDataEntity.setTabName(query.get(0).getTabName());
serviceDataEntity.setBipPaymentNumberField(query.get(0).getBipPaymentNumberField());
serviceDataEntity.setBipPaymentNumber(backJsonResultEntity.getString("vbillno"));
serviceDataEntity.setId(query.get(0).getId());
serviceDataDao.updateBipPaymentNumber(serviceDataEntity);
logger.info("===下发时候根据OA单据编号{}更新BIP付款申请单号:{}完毕",jsonObjectParent.getString("vdef1"),backJsonResultEntity.getString("vbillno"));
}else{
logger.info("======下发时候根据单据编号:{}未能在三维OA查询到数据Bip付款申请单号不回写",jsonObjectParent.getString("vdef1"));
}
}
}
} catch (Exception e) {

View File

@ -0,0 +1,7 @@
package com.hzya.frame.sysnew.comparison.serviceData.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity;
public interface ICtpAttachmentDao extends IBaseDao<CtpAttachmentEntity,String> {
}

View File

@ -2,12 +2,12 @@ package com.hzya.frame.sysnew.comparison.serviceData.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity;
import java.util.HashMap;
import java.util.List;
public interface IServiceDataDao extends IBaseDao<ComparisonEntity,String> {
public interface IServiceDataDao extends IBaseDao<ServiceDataEntity,String> {
/**
*
* @content 查询三维单据视图
@ -17,4 +17,64 @@ public interface IServiceDataDao extends IBaseDao<ComparisonEntity,String> {
* @Date 2024-11-28 14:50
* **/
List<HashMap<String, Object>> queryListBySWSource(String str , MdmModuleSourceEntity entity);
/**
*
* @content 数据抽取成功更新推送标识
* @Param
* @Return
* @Author hecan
* @Date 2024-12-05 17:58
* **/
Integer updatePushStatus(ServiceDataEntity entity);
/**
*
* @content 数据下发成功将Bip付款申请单回写
* @Param
* @Return
* @Author hecan
* @Date 2024-12-07 9:34
* **/
Integer updateBipPaymentNumber(ServiceDataEntity entity);
/**
*
* @content 付款申请单支付状态和支付时间回写
* @Param
* @Return
* @Author hecan
* @Date 2024-12-07 9:32
* **/
Integer updatePayResult(ServiceDataEntity entity);
/**
*
* @content 查询支付结果不为成功失败等状态得数据
* @Param
* @Return
* @Author hecan
* @Date 2024-12-07 9:55
* **/
List<ServiceDataEntity> querySeriveDateResult(ServiceDataEntity entity);
/**
*
* @content 查询电子回单为空并且支付状态为成功的数据
* @Param
* @Return
* @Author hecan
* @Date 2024-12-09 10:20
* **/
List<ServiceDataEntity> queryServiceElectronic(ServiceDataEntity entity);
/**
*
* @content 更新电子回单数据
* @Param
* @Return
* @Author hecan
* @Date 2024-12-09 11:56
* **/
Integer updateElectronic(ServiceDataEntity entity);
}

View File

@ -0,0 +1,11 @@
package com.hzya.frame.sysnew.comparison.serviceData.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.sysnew.comparison.serviceData.dao.ICtpAttachmentDao;
import com.hzya.frame.sysnew.comparison.serviceData.dao.IServiceDataDao;
import com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity;
import org.springframework.stereotype.Repository;
@Repository(value = "CtpAttachmentDaoImpl")
public class CtpAttachmentDaoImpl extends MybatisGenericDao<CtpAttachmentEntity,String> implements ICtpAttachmentDao {
}

View File

@ -6,6 +6,7 @@ import com.hzya.frame.execsql.service.IExecSqlService;
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import com.hzya.frame.sysnew.comparison.serviceData.dao.IServiceDataDao;
import com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -14,7 +15,7 @@ import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
@Repository(value = "ServiceDataDaoImpl")
public class ServiceDataDaoImpl extends MybatisGenericDao<ComparisonEntity,String> implements IServiceDataDao {
public class ServiceDataDaoImpl extends MybatisGenericDao<ServiceDataEntity,String> implements IServiceDataDao {
@Autowired
private IExecSqlService execSqlService;
@ -31,4 +32,39 @@ public class ServiceDataDaoImpl extends MybatisGenericDao<ComparisonEntity,Strin
return null;
}
}
@DS("#entity.dataSourceCode")
@Override
public Integer updatePushStatus(ServiceDataEntity entity) {
return super.update("updatePushStatus",entity);
}
@DS("#entity.dataSourceCode")
@Override
public Integer updateBipPaymentNumber(ServiceDataEntity entity) {
return super.update("updateBipPaymentNumber",entity);
}
@DS("#entity.dataSourceCode")
@Override
public Integer updatePayResult(ServiceDataEntity entity) {
return super.update("updatePayResult",entity);
}
@DS("#entity.dataSourceCode")
@Override
public List<ServiceDataEntity> querySeriveDateResult(ServiceDataEntity entity) {
return (List<ServiceDataEntity>) super.selectList("querySeriveDateResult",entity);
}
@DS("#entity.dataSourceCode")
@Override
public List<ServiceDataEntity> queryServiceElectronic(ServiceDataEntity entity) {
return (List<ServiceDataEntity>) super.selectList("queryServiceElectronic",entity);
}
@Override
public Integer updateElectronic(ServiceDataEntity entity) {
return super.update("updateElectronic",entity);
}
}

View File

@ -0,0 +1,129 @@
package com.hzya.frame.sysnew.comparison.serviceData.entity;
import com.hzya.frame.web.entity.BaseEntity;
import java.util.Date;
/**
*
* @content OA附件业务表
* @Param
* @Return
* @Author hecan
* @Date 2023/11/30 16:04
* **/
public class CtpAttachmentEntity extends BaseEntity {
private String id;//主键ID
private String sub_reference;//次数据ID此id为真正写在流程表单中的ID
private String category; //应用分类
private String type;//分类
private String filename;//附件名称
private String file_url;//附件链接
private String mime_type;//
private Date createdate;//创建时间
private String attachment_size;//附件大小
private String sort;//序号
private String att_reference;//流程表的IDcol_summary
private String uuid;
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
public String getSub_reference() {
return sub_reference;
}
public void setSub_reference(String sub_reference) {
this.sub_reference = sub_reference;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getFile_url() {
return file_url;
}
public void setFile_url(String file_url) {
this.file_url = file_url;
}
public String getMime_type() {
return mime_type;
}
public void setMime_type(String mime_type) {
this.mime_type = mime_type;
}
public Date getCreatedate() {
return createdate;
}
public void setCreatedate(Date createdate) {
this.createdate = createdate;
}
public String getAttachment_size() {
return attachment_size;
}
public void setAttachment_size(String attachment_size) {
this.attachment_size = attachment_size;
}
@Override
public String getSort() {
return sort;
}
@Override
public void setSort(String sort) {
this.sort = sort;
}
public String getAtt_reference() {
return att_reference;
}
public void setAtt_reference(String att_reference) {
this.att_reference = att_reference;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
}

View File

@ -0,0 +1,89 @@
<?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.sysnew.comparison.serviceData.dao.impl.CtpAttachmentDaoImpl">
<resultMap id="get-CtpAttachmentEntity-result" type="com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity">
<result property="id" column="id" />
<result property="sub_reference" column="sub_reference" />
<result property="category" column="category" />
<result property="type" column="type" />
<result property="filename" column="filename" />
<result property="file_url" column="file_url" />
<result property="mime_type" column="mime_type" />
<result property="createdate" column="createdate" />
<result property="attachment_size" column="attachment_size" />
<result property="sort" column="sort" />
<result property="att_reference" column="att_reference" />
</resultMap>
<sql id="CtpAttachmentEntity_Column_List">
id,
sub_reference,
category,
type,
filename,
file_url,
mime_type,
createdate,
attachment_size,
sort,
att_reference
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-CtpAttachmentEntity-result" parameterType="com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity">
select
<include refid="CtpAttachmentEntity_Column_List" />
from CTP_ATTACHMENT
<trim prefix="where" prefixOverrides="and">
<if test="file_url != null and file_url !='' ">file_url = #{file_url} </if>
</trim>
</select>
<!-- 新增 -->
<insert id="entity_insert" parameterType="com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity">
insert into CTP_ATTACHMENT(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id !='' "> id, </if>
<if test="sub_reference != null and sub_reference !='' "> sub_reference, </if>
<if test="category != null and category !='' "> category, </if>
<if test="type != null and type !='' "> type, </if>
<if test="filename != null and filename !='' "> filename, </if>
<if test="file_url != null and file_url !='' "> file_url, </if>
<if test="mime_type != null and mime_type !='' "> mime_type, </if>
<if test="attachment_size != null and attachment_size !='' "> attachment_size, </if>
<if test="sort != null and sort !='' "> sort, </if>
<if test="att_reference != null and att_reference !='' "> att_reference, </if>
<if test="createdate != null"> createdate</if>
</trim>
)values
(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id !='' "> #{id}, </if>
<if test="sub_reference != null and sub_reference !='' "> #{sub_reference}, </if>
<if test="category != null and category !='' "> #{category}, </if>
<if test="type != null and type !='' "> #{type}, </if>
<if test="filename != null and filename !='' "> #{filename}, </if>
<if test="file_url != null and file_url !='' "> #{file_url}, </if>
<if test="mime_type != null and mime_type !='' "> #{mime_type}, </if>
<if test="attachment_size != null and attachment_size !='' "> #{attachment_size}, </if>
<if test="sort != null and sort !='' "> #{sort}, </if>
<if test="att_reference != null and att_reference !='' "> #{att_reference}, </if>
<if test="createdate != null "> #{createdate}</if>
</trim>
)
</insert>
<!-- 修改 付款单中的电子回单字段-->
<update id="entity_update" parameterType="com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity">
update CTP_ATTACHMENT set
<trim suffix="" suffixOverrides=",">
<if test="sub_reference != null and sub_reference !='' "> sub_reference = #{sub_reference},</if>
<if test="att_reference != null and att_reference !='' "> att_reference = #{att_reference}</if>
</trim>
where file_url = #{file_url}
</update>
</mapper>

View File

@ -0,0 +1,126 @@
package com.hzya.frame.sysnew.comparison.serviceData.entity;
import com.hzya.frame.web.entity.BaseEntity;
public class ServiceDataEntity extends BaseEntity {
private String tabName;//表名
private String pushStatusField;//推送标识字段
private String pushStatus;//推送标识值
private String bipPaymentNumber;//Bip付款申请单号字段
private String bipPaymentNumberField;//bip付款申请单号值
private String payResult;//支付结果值
private String payDate;//支付时间值
private String payResultFiled;//支付结果字段
private String payDateFiled;//支付时间字段
private String receiptFiled;//电子回单字段
private String receipt;//电子回单值
private String billCode;//单据编号
private String summary_id;//summary_id
public String getSummary_id() {
return summary_id;
}
public void setSummary_id(String summary_id) {
this.summary_id = summary_id;
}
public String getTabName() {
return tabName;
}
public void setTabName(String tabName) {
this.tabName = tabName;
}
public String getPushStatusField() {
return pushStatusField;
}
public void setPushStatusField(String pushStatusField) {
this.pushStatusField = pushStatusField;
}
public String getPushStatus() {
return pushStatus;
}
public void setPushStatus(String pushStatus) {
this.pushStatus = pushStatus;
}
public String getBipPaymentNumber() {
return bipPaymentNumber;
}
public void setBipPaymentNumber(String bipPaymentNumber) {
this.bipPaymentNumber = bipPaymentNumber;
}
public String getBipPaymentNumberField() {
return bipPaymentNumberField;
}
public void setBipPaymentNumberField(String bipPaymentNumberField) {
this.bipPaymentNumberField = bipPaymentNumberField;
}
public String getPayResult() {
return payResult;
}
public void setPayResult(String payResult) {
this.payResult = payResult;
}
public String getPayDate() {
return payDate;
}
public void setPayDate(String payDate) {
this.payDate = payDate;
}
public String getPayResultFiled() {
return payResultFiled;
}
public void setPayResultFiled(String payResultFiled) {
this.payResultFiled = payResultFiled;
}
public String getPayDateFiled() {
return payDateFiled;
}
public void setPayDateFiled(String payDateFiled) {
this.payDateFiled = payDateFiled;
}
public String getReceiptFiled() {
return receiptFiled;
}
public void setReceiptFiled(String receiptFiled) {
this.receiptFiled = receiptFiled;
}
public String getReceipt() {
return receipt;
}
public void setReceipt(String receipt) {
this.receipt = receipt;
}
public String getBillCode() {
return billCode;
}
public void setBillCode(String billCode) {
this.billCode = billCode;
}
}

View File

@ -0,0 +1,95 @@
<?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.sysnew.comparison.serviceData.dao.impl.ServiceDataDaoImpl">
<resultMap id="get-ServiceDataEntity-result" type="com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
</resultMap>
<sql id = "ServiceDataEntity_Base_Column_List">
oa_id as id
,tab_name as tabName
,pay_result_field as payResultFiled
,pay_result as payResult
,pay_date_field as payDateFiled
,receipt_filed as receiptFiled
,receipt as receipt
,vdef1 as billCode
,summary_id
,bip_payment_number_field as bipPaymentNumberField
,bip_payment_number as bipPaymentNumber
</sql>
<select id="entity_list_base" resultMap="get-ServiceDataEntity-result" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity">
select
<include refid="ServiceDataEntity_Base_Column_List" />
from V_CMP_APPLY
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="tabName != null and tabName != ''"> and tab_name = #{tabName} </if>
<if test="payResultFiled != null and payResultFiled != ''"> and pay_result_field = #{payResultFiled} </if>
<if test="payResult != null and payResult != ''"> and pay_result = #{payResult} </if>
<if test="payDateFiled != null and payDateFiled != ''"> and pay_date_field = #{payDateFiled} </if>
<if test="receiptFiled != null and receiptFiled != ''"> and receipt_filed = #{receiptFiled} </if>
<if test="receipt != null and receipt != ''"> and receipt = #{receipt} </if>
<if test="billCode != null and billCode != ''"> and vdef1 = #{billCode} </if>
</trim>
</select>
<!-- 查询 采用==查询 -->
<select id="querySeriveDateResult" resultMap="get-ServiceDataEntity-result" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity">
select
<include refid="ServiceDataEntity_Base_Column_List" />
from V_CMP_APPLY
<trim prefix="where" prefixOverrides="and">
<if test="billCode != null and billCode != ''"> and vdef1 = #{billCode} </if>
and (pay_result is null
or pay_result not in ('审批撤销','审批拒绝','处理失败','退票','支付成功','取消支付','修改支付','支付失败'))
</trim>
</select>
<!-- 查询 采用==查询 -->
<select id="queryServiceElectronic" resultMap="get-ServiceDataEntity-result" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity">
select
<include refid="ServiceDataEntity_Base_Column_List" />
from V_CMP_APPLY where vdef1 = #{billCode} and pay_result='支付成功' and receipt is null
</select>
<!--通过主键修改方法-->
<update id="updatePushStatus" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity" >
update ${tabName} set ${pushStatusField} =#{pushStatus} where id=#{id}
</update>
<!--通过主键修改方法-->
<update id="updateBipPaymentNumber" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity" >
update ${tabName} set ${bipPaymentNumberField} =#{bipPaymentNumber} where id=#{id}
</update>
<!--通过主键修改方法-->
<update id="updatePayResult" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity" >
update ${tabName} set
<trim suffix="" suffixOverrides=",">
<if test="payDate != null and payDate != ''"> ${payDateFiled} = #{payDate},</if>
<if test="payResult != null and payResult != ''"> ${payResultFiled} = #{payResult}</if>
</trim>
where id=#{id}
</update>
<!--通过主键修改方法-->
<update id="updateElectronic" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity" >
update ${tabName} set
set ${receiptFiled} = #{receipt}
where id=#{id}
</update>
</mapper>

View File

@ -2,6 +2,7 @@ package com.hzya.frame.sysnew.comparison.serviceData.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
@ -9,11 +10,34 @@ public interface IServiceDataService extends IBaseService<ComparisonEntity,Strin
/**
*
* @content 查询数据
* @content 查询需要抽取得数据
* @Param
* @Return
* @Author hecan
* @Date 2024-11-28 14:54
* **/
JsonResultEntity queryDocumentView(JSONObject json);
/**
*
* @content 查询支付状态和支付时间未回写得数据,并且查询电子回单数据
* @Param
* @Return
* @Author hecan
* @Date 2024-12-07 10:14
* **/
JsonResultEntity queryResultIsNull(JSONObject json);
/**
*
* @content 扩展方法 获取数据源
* @Param
* @Return
* @Author hecan
* @Date 2024-12-07 10:48
* **/
SysExtensionApiEntity addDataSourceCode(SysExtensionApiEntity entity);
SysExtensionApiEntity getToken(SysExtensionApiEntity entity);
}

View File

@ -1,27 +1,46 @@
package com.hzya.frame.sysnew.comparison.serviceData.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.dateutil.DateUtil;
import com.hzya.frame.mdm.mdmModuleSource.dao.impl.MdmModuleSourceDaoImpl;
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
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.comparison.entity.ComparisonEntity;
import com.hzya.frame.sysnew.comparison.service.impl.ComparisonServiceImpl;
import com.hzya.frame.sysnew.comparison.serviceData.dao.ICtpAttachmentDao;
import com.hzya.frame.sysnew.comparison.serviceData.dao.IServiceDataDao;
import com.hzya.frame.sysnew.comparison.serviceData.dao.impl.ServiceDataDaoImpl;
import com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity;
import com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity;
import com.hzya.frame.sysnew.comparison.serviceData.service.IServiceDataService;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.impl.IntegrationTaskLivingDetailsServiceImpl;
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 com.hzya.frame.web.exception.BaseSystemException;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
@Service(value = "ServiceDataServiceImpl")
public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String> implements IServiceDataService {
@ -32,6 +51,12 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl;
@Autowired
private ComparisonServiceImpl comparisonServiceimpl;
@Autowired
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Autowired
private ISysApplicationDatabaseDao sysApplicationDatabaseDao;
@Autowired
private ICtpAttachmentDao ctpAttachmentDao;
@Override
public JsonResultEntity queryDocumentView(JSONObject json) {
JSONObject jsonObject = json.getJSONObject("jsonStr");
@ -43,11 +68,12 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
}
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
String tableName = "";
List<Object> object=new ArrayList<>();
List<JSONObject> listAll = new ArrayList<>();
try {
String appTyp = mdmModuleSourceEntity.getAppType();//系统类型 1致远OA 2用友U8C 3用友BIP
String dbCode = mdmModuleSourceEntity.getDbCode();//数据源编码
String mdmCode = mdmModuleSourceEntity.getMdmCode();//主数据编码
List<JSONObject> listAll = new ArrayList<>();
switch (appTyp){
case "1":
switch (mdmCode){
@ -64,26 +90,212 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
}
//将查询出来的数据进行组装调用通用方法新增或者更新
if (null != listAll && listAll.size() > 0) {
ParametricDocument(listAll, mdmCode, tableName);
object = ParametricDocument(listAll, mdmCode, tableName);
if (CollectionUtils.isNotEmpty(object)) {
for (Object obj : object) {
//更新单据视图推送标识不再抽取
JSONObject attributeResult = (JSONObject) JSON.toJSON(obj);
if (attributeResult.getString("status").equals("200")) {
String resultString = attributeResult.getString("list");
if ("10045".equals(mdmCode)) {
JSONArray jsonArray = JSONArray.parseArray(resultString);
if (CollectionUtils.isNotEmpty(jsonArray)) {
for (Object o : jsonArray) {
JSONObject attributeArray = (JSONObject) JSON.toJSON(o);
String cmpApply = attributeArray.getString(tableName);
JSONObject jsonObjectCmpApply = JSONObject.parseObject(cmpApply);
String pushStatusField = jsonObjectCmpApply.getString("push_status_field");//推送标识字段
String id = jsonObjectCmpApply.getString("data_id");//主表id
String vdef1 = jsonObjectCmpApply.getString("vdef1");//主表id
logger.info("=====开始根据单据id:{},单据号:{},更新表:{}的推送标识", id, vdef1, tableName);
ServiceDataEntity serviceDataEntity = new ServiceDataEntity();
serviceDataEntity.setTabName(jsonObjectCmpApply.getString("tab_name"));
serviceDataEntity.setPushStatusField(pushStatusField);
serviceDataEntity.setPushStatus("1");
serviceDataEntity.setId(id);
serviceDataEntity.setDataSourceCode(mdmModuleSourceEntity.getDataSourceCode());
serviceDataDao.updatePushStatus(serviceDataEntity);
//保存业务数据日志
saveTaskLivingDetails(id, jsonObjectCmpApply.getString("vdef1"), listAll.get(0).toString(), object.toString(), true);
}
}
}
} else {
logger.info("U8C主数据档案没有需要同步中台的数据");
saveTaskLivingDetails(JSONObject.parseObject(listAll.get(0).getString("cmp_apply")).getString("data_id"), JSONObject.parseObject(listAll.get(0).getString("cmp_apply")).getString("vdef1"), listAll.get(0).toString(), JSON.parseObject(JSON.toJSONString(object)).getString("msg"), false);
}
}
}
} else {
logger.info("三维单据视图数据没有需要同步中台的数据");
}
}catch (Exception e){
logger.info("业务数据同步失败:{}",e.getMessage());
saveTaskLivingDetails(JSONObject.parseObject(listAll.get(0).getString("cmp_apply")).getString("data_id"),JSONObject.parseObject(listAll.get(0).getString("cmp_apply")).getString("vdef1"),listAll.get(0).toString(),JSON.parseObject(JSON.toJSONString(object)).getString("msg")==null?JSON.parseObject(JSON.toJSONString(object)).getString("list"):JSON.parseObject(JSON.toJSONString(object)).getString("msg"),false);
e.printStackTrace();
}
}
return BaseResult.getSuccessMessageEntity("业务数据同步成功");
}
private List<JSONObject> bindingDocument(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode) {
@Override
public JsonResultEntity queryResultIsNull(JSONObject json) {
try {
JSONObject jsonObject = json.getJSONObject("jsonStr");
if (!checkStr(jsonObject.getString("billCode"))) {
logger.info("====传递的单据编号为空====");
return BaseResult.getFailureMessageEntity("请传递单据编码");
}
if(null==jsonObject.getString("fileUrl")) {
if (!checkStr(jsonObject.getString("payResult"))) {
logger.info("====传递的支付状态为空====");
return BaseResult.getFailureMessageEntity("请传递支付状态");
}
//查询支付状态为空的数据
ServiceDataEntity serviceData = new ServiceDataEntity();
serviceData.setBillCode(jsonObject.getString("billCode"));
serviceData.setDataSourceCode(jsonObject.getString("dataSourceCode"));
List<ServiceDataEntity> serviceDataEntities = serviceDataDao.querySeriveDateResult(serviceData);
Integer integer = null;
if (CollectionUtils.isNotEmpty(serviceDataEntities)) {
for (ServiceDataEntity serviceDataEntity : serviceDataEntities) {
//判断传递的单据号与查询的单据号是否相同
if (jsonObject.getString("billCode").equals(serviceDataEntity.getBillCode())) {
serviceDataEntity.setPayResult(jsonObject.getString("payResult"));
serviceDataEntity.setPayDate(jsonObject.getString("payDate"));
serviceDataEntity.setDataSourceCode(jsonObject.getString("dataSourceCode"));
logger.info("====开始根据单据号:{},表名称:{},表单id:{}更新支付状态和时间======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId());
integer = serviceDataDao.updatePayResult(serviceDataEntity);
logger.info("====根据单据号:{},表名称:{},表单id:{}更新支付状态和时间完成======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId());
}
}
return BaseResult.getSuccessMessageEntity("更新成功", integer);
} else {
logger.info("=========没有支付状态为空的数据=======");
return BaseResult.getSuccessMessageEntity("查询成功,没有支付结果需要更新得数据");
}
}else{
if (null != jsonObject.getString("fileUrl")) {
//根据单据编号查询电子回单为空并且支付状态为成功得
ServiceDataEntity serviceData=new ServiceDataEntity();
serviceData.setBillCode(jsonObject.getString("billCode"));
serviceData.setDataSourceCode(jsonObject.getString("dataSourceCode"));
List<ServiceDataEntity> serviceDataEntities = serviceDataDao.queryServiceElectronic(serviceData);
if(CollectionUtils.isEmpty(serviceDataEntities)){
logger.info("======根据单据编号:{}未查询到支付成功并且电子回单为空的数据",jsonObject.getString("billCode"));
return BaseResult.getSuccessMessageEntity("查询成功,没有电子回单需要更新得数据");
}else {
for (ServiceDataEntity serviceDataEntity : serviceDataEntities) {
//表单的附件字段=ctpAttachment的Sub_reference表单的Summary_id=ctpAttachment的att_reference
String sub_reference = String.valueOf(UUIDLong.longUUID());
serviceDataEntity.setReceipt(sub_reference);//将sub_reference赋值给电子回单
serviceDataEntity.setDataSourceCode(jsonObject.getString("dataSourceCode"));
logger.info("更新电子回单的表名称为:{},字段名称为:{},字段值为:{},oaid为:{}", serviceDataEntity.getTabName(), serviceDataEntity.getReceiptFiled(), serviceDataEntity.getReceipt(), serviceDataEntity.getId());
serviceDataDao.updateElectronic(serviceDataEntity);
logger.info("表单电子回单字段更新成功");
//根据附件id查询附件业务数据
String file_url = jsonObject.getString("fileUrl");
CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity();
ctpAttachmentEntity.setFile_url(file_url);
String att_reference = serviceDataEntity.getSummary_id();//Summary_id
ctpAttachmentEntity.setSub_reference(sub_reference);
ctpAttachmentEntity.setAtt_reference(att_reference);
List<CtpAttachmentEntity> ctpAttachmentEntityListBase = ctpAttachmentDao.query(ctpAttachmentEntity);
//如果没有查询到数据就新增附件业务否则更新
if (ctpAttachmentEntityListBase.size() == 0) {
String category = jsonObject.getString("category");
String type = jsonObject.getString("type");
String filename = jsonObject.getString("filename");
String mime_type = jsonObject.getString("mimeType");
String attachment_size = jsonObject.getString("size");
String id = String.valueOf(UUIDLong.longUUID());
ctpAttachmentEntity.setCategory(category);
ctpAttachmentEntity.setFilename(filename);
ctpAttachmentEntity.setType(type);
ctpAttachmentEntity.setMime_type(mime_type);
ctpAttachmentEntity.setAttachment_size(attachment_size);
ctpAttachmentEntity.setId(id);
ctpAttachmentEntity.setCategory("2");
ctpAttachmentEntity.setCreatedate(new Date());
ctpAttachmentEntity.setDataSourceCode(jsonObject.getString("dataSourceCode"));
ctpAttachmentDao.save(ctpAttachmentEntity);
logger.info("OA附件新增成功");
} else {
if (ctpAttachmentEntityListBase.size() > 1) {
throw new BaseSystemException("OA附件业务表中查到多条记录");
}
//更新数据到OA附件业务表中
ctpAttachmentDao.save(ctpAttachmentEntity);
logger.info("OA附件更新成功");
}
}
}
}
}
}catch (Exception e){
logger.info("查询三维付款申请单支付状态和时间失败:{}",e.getMessage());
}
return null;
}
@Override
public SysExtensionApiEntity addDataSourceCode(SysExtensionApiEntity entity) {
try {
SysApplicationEntity applicationEntity = entity.getReceiveApp();
SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity();
sysApplicationDatabaseEntity.setSts("Y");
sysApplicationDatabaseEntity.setDbStatus("1");
sysApplicationDatabaseEntity.setAppId(applicationEntity.getId());
sysApplicationDatabaseEntity.setDataSourceCode("master");
List<SysApplicationDatabaseEntity> sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity);
if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){
String parm = entity.getBodys();
JSONObject jsonObject = JSONObject.parseObject(parm);
jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode());
entity.setBodys(jsonObject.toJSONString());
}
} catch (Exception e) {
e.printStackTrace();
}
return entity;
}
@Override
public SysExtensionApiEntity getToken(SysExtensionApiEntity entity) {
try {
logger.info("==========开始获取token============");
//获取oatoken
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("userName", "hzyaRestUser");
hashMap.put("password", "hzya1314");
hashMap.put("loginName","fkmanager");
String result = HttpUtil.post("https://swoa.sunwave.com.cn:9999" + "/seeyon/rest/token", JSON.toJSONString(hashMap));
logger.info("===========获取token结果为:{}=========",result);
JSONObject jsonObject = JSONObject.parseObject(result);
if (null != jsonObject) {
logger.info(result);
logger.info("======token{}======" + jsonObject.getString("id"));
StringBuffer querys = new StringBuffer();
querys.append("token="+jsonObject.getString("id"));
entity.setQuerys(querys.toString());
}
}catch (Exception e){
logger.info("======扩展类获取token失败:{}",e.getMessage());
e.printStackTrace();
}
return entity;
}
private List<JSONObject> bindingDocument(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode) {
String formmainId=null;
String vdef1=null;
List<JSONObject> list = new ArrayList<>();
StringBuffer sb = new StringBuffer();
try {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("select oa_id as data_id,vdef1 as vdef1,applysum,pk_acceptorg,pk_group,pk_trantypecode,pk_busitype,\n" +
" pk_supplier,pk_bankacc_r as pk_bankacc_r\n" +
" from v_OA_TO_BIP where 1=1 " + sb.toString());
stringBuffer.append("select oa_id as data_id,tab_name,title,pay_company,bill_name,pay_result_field,pay_date_field,receipt_filed,\n" +
"push_status_field,summary_id,bip_payment_number_field,\n" +
"vdef1,pk_acceptorg,creator,pk_group,pk_org,applydate,pk_trantypecode,pk_busitype,vdef2,pk_currtype,\n" +
"pk_supplier,pk_bankacc_r,pk_bankacc_p,pk_decidedept,vdef10,vdef12,vdef3,vdef4,vdef5,vdef6,applysum,\n" +
"vdef7,vdef8,vdef9 from v_cmp_apply where 1=1 and vdef1 is not null and push_status is null ");
mdmModuleSourceEntity.setDataSourceCode(dbCode);
List<HashMap<String, Object>> hashMaps = serviceDataDao.queryListBySWSource(stringBuffer.toString(), mdmModuleSourceEntity);
int i = 0;
@ -92,20 +304,22 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
JSONObject main = new JSONObject();
JSONObject cmp_apply = new JSONObject();
for (String key : hashMap.keySet()) {
cmp_apply.put(key, hashMap.get(key));
cmp_apply.put(key.toLowerCase(), hashMap.get(key));
}
//获取明细信息
String formmainId = (String) hashMap.get("data_id");
formmainId = cmp_apply.getString("data_id");
vdef1=cmp_apply.getString("vdef1");
StringBuffer stringBufferDetails = new StringBuffer();
stringBufferDetails.append("select d_id as data_id,tab_name,pk_supplier,pk_bankacc_r,pk_currtype,vdef1,vdef2,vdef3,vdef4\n" +
" from v_OA_TO_BIP_DETAILS where formmain_id= '"+formmainId+"' " );
stringBufferDetails.append("select d_id as data_id,tab_name,pk_balatype,pk_acceptorg,pk_org,pk_group,pk_busitype,rowno,\n" +
"pk_supplier,pk_bankacc_r,pk_currtype,pk_decidedept,gllcrate,applysum,applymny,vdef1,pk_project,vdef2,vdef3,\n" +
"vdef4 from v_cmp_apply_b where formmain_id= '"+formmainId+"' " );
List<HashMap<String, Object>> hashMapsDetails = serviceDataDao.queryListBySWSource(stringBufferDetails.toString(),mdmModuleSourceEntity);
JSONArray cmp_apply_b = new JSONArray();
if(CollectionUtils.isNotEmpty(hashMapsDetails)){
for (HashMap<String, Object> detailsMap : hashMapsDetails) {
JSONObject details = new JSONObject();
for (String key : detailsMap.keySet()) {
details.put(key, detailsMap.get(key));
details.put(key.toLowerCase(), detailsMap.get(key));
}
cmp_apply_b.add(details);
}
@ -118,16 +332,19 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
return list;
} catch (Exception e) {
logger.info("组装单据是图查询参数失败:{}", e.getMessage());
//保存业务数据日志
saveTaskLivingDetails(formmainId,vdef1,list.toString(),null,false);
e.printStackTrace();
}
return null;
}
private JsonResultEntity ParametricDocument(List<JSONObject> hashMaps,String mdmCode,String tableName){
private List<Object> ParametricDocument(List<JSONObject> hashMaps,String mdmCode,String tableName){
JSONObject jsonObjectUser = new JSONObject();
List<Object> result=new ArrayList<>();
try {
for (JSONObject hashMap : hashMaps) {
JSONObject main = hashMap.getJSONObject(tableName);
JSONObject jsonObjectUser = new JSONObject();
JSONObject jsonStr = new JSONObject();
jsonObjectUser.put("data_id", main.get("data_id"));
jsonObjectUser.put("mdmCode", mdmCode);
@ -145,23 +362,56 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
hashMap.put("mdmCode", mdmCode);
hashMap.put("optionName", "数智中台");
jsonStr.put("jsonStr", hashMap);
Object result = comparisonServiceimpl.saveEntity(jsonStr);
logger.info("单据视图新增结果为:{}", JSON.toJSONString(result));
Object object = comparisonServiceimpl.saveEntity(jsonStr);
logger.info("单据视图新增结果为:{}", JSON.toJSONString(object));
result.add(object);
} else {
hashMap.put("appName","数智中台");
hashMap.put("appCode","800004");
hashMap.put("mdmCode", mdmCode);
hashMap.put("optionName", "数智中台");
jsonStr.put("jsonStr", hashMap);
Object result = comparisonServiceimpl.updateEntity(jsonStr);
Object object = comparisonServiceimpl.updateEntity(jsonStr);
logger.info("单据视图更新结果为:{}", JSON.toJSONString(result));
result.add(object);
}
}
return result;
}catch (Exception e){
logger.info("将数据查询之后进行组装调用通用方法错误:{}",e.getMessage());
//保存业务数据日志
saveTaskLivingDetails(jsonObjectUser.getString("data_id"),hashMaps.get(0).getString("vdef1"),hashMaps.get(0).toString(),result.toString(),false);
e.printStackTrace();
}
return null;
}
private void saveTaskLivingDetails(String rootAppPk,String rootAppBill,String rootAppNewData,String newTransmitInfo,boolean flag) {
try {
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setId(UUIDUtils.getUUID());
integrationTaskLivingDetailsEntity.setSts("Y");
integrationTaskLivingDetailsEntity.setCreate_user_id("1");
integrationTaskLivingDetailsEntity.setModify_user_id("1");
integrationTaskLivingDetailsEntity.setCreate_time(new Date());
integrationTaskLivingDetailsEntity.setModify_time(new Date());
integrationTaskLivingDetailsEntity.setOrg_id("0");
integrationTaskLivingDetailsEntity.setCompanyId("0");
integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk);
integrationTaskLivingDetailsEntity.setRootAppBill(rootAppBill);
integrationTaskLivingDetailsEntity.setPluginId("ServiceDataPluginInitializer");
integrationTaskLivingDetailsEntity.setRootAppNewData(rootAppNewData);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(newTransmitInfo);
if(flag){
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
}else {
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
}
}catch (Exception e){
logger.info("业务数据抽取保存日志到集成任务日志明细中失败:{}",e.getMessage());
e.printStackTrace();
}
}
}