diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/SendContract/plugin/SendContractPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/SendContract/plugin/SendContractPluginInitializer.java index 1d139efe..b11689e1 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/SendContract/plugin/SendContractPluginInitializer.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/SendContract/plugin/SendContractPluginInitializer.java @@ -23,7 +23,7 @@ import java.util.Date; import java.util.List; /** - * 业务数据同步 + * 未定合同号 * * @author makejava * @since 2024-06-21 13:52:35 diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/dao/IBusinessDao.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/dao/IBusinessDao.java new file mode 100644 index 00000000..c354963b --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/dao/IBusinessDao.java @@ -0,0 +1,23 @@ +package com.hzya.frame.plugin.businessData.dao; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.plugin.businessData.entity.BusinessEntity; + +import java.util.List; + +/** + * 客户档案(mdm_customer: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-21 13:52:35 + */ +public interface IBusinessDao extends IBaseDao { + + List queryData(JSONObject saveData); + + int saveData(JSONObject saveData); + + int saveDetailData(JSONObject saveDetailData); +} + diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/dao/impl/BusinessDaoImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/dao/impl/BusinessDaoImpl.java new file mode 100644 index 00000000..00726aee --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/dao/impl/BusinessDaoImpl.java @@ -0,0 +1,32 @@ +package com.hzya.frame.plugin.businessData.dao.impl; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.plugin.businessData.dao.IBusinessDao; +import com.hzya.frame.plugin.businessData.entity.BusinessEntity; + +import java.util.List; + +/** + * + * @author makejava + * @since 2024-06-21 13:52:35 + */ +public class BusinessDaoImpl extends MybatisGenericDao implements IBusinessDao { + + @Override + public List queryData(JSONObject saveData) { + List o = (List) 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); + } +} + diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/entity/BusinessEntity.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/entity/BusinessEntity.java new file mode 100644 index 00000000..4b137aef --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/entity/BusinessEntity.java @@ -0,0 +1,14 @@ +package com.hzya.frame.plugin.businessData.entity; + +import com.hzya.frame.web.entity.BaseEntity; +/** + * + * @author makejava + * @since 2024-06-21 13:52:35 + */ +public class BusinessEntity extends BaseEntity { + + + +} + diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/entity/BusinessEntity.xml b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/entity/BusinessEntity.xml new file mode 100644 index 00000000..fb80d9ee --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/entity/BusinessEntity.xml @@ -0,0 +1,134 @@ + + + + + + + + + insert into mdm_ccd( + + id , + document_rule , + document_rule_num , + data_status , + add_status , + update_status , + delete_status , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + field0011 , + field0001 , + field0002 , + field0012 , + field0013 , + field0014 , + field0003 , + field0015 , + field0016 , + field0017 , + field0018 , + field0019 , + field0020 , + field0021 , + + + )values + ( + + #{id} , + #{document_rule} , + #{document_rule_num} , + #{data_status} , + #{add_status} , + #{update_status} , + #{delete_status} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{company_id} , + #{field0011} , + #{field0001} , + #{field0002} , + #{field0012} , + #{field0013} , + #{field0014} , + #{field0003} , + #{field0015} , + #{field0016} , + #{field0017} , + #{field0018} , + #{field0019} , + #{field0020} , + #{field0021} , + + + ) + + + insert into mdm_ccd_detail( + + id , + formmain_id , + data_status , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + field0004 , + field0005 , + field0022 , + field0008 , + field0006 , + field0007 , + field0009 , + + )values + ( + + #{id} , + #{formmain_id} , + #{data_status}, + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{company_id} , + #{field0004} , + #{field0005} , + #{field0022} , + #{field0008} , + #{field0006} , + #{field0007} , + #{field0009} , + + + ) + + + diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/plugin/BusinessPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/plugin/BusinessPluginInitializer.java new file mode 100644 index 00000000..9d85e7d0 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/plugin/BusinessPluginInitializer.java @@ -0,0 +1,63 @@ +package com.hzya.frame.plugin.businessData.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.businessData.service.IBusinessService; +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 BusinessPluginInitializer extends PluginBaseEntity{ + Logger logger = LoggerFactory.getLogger(BusinessPluginInitializer.class); + + @Autowired + private IBusinessService businessService; + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "BusinessPlugin"; + } + + @Override + public String getPluginName() { + return "BusinessPlugin插件"; + } + + @Override + public String getPluginLabel() { + return "BusinessPlugin"; + } + + @Override + public String getPluginType() { + return "1"; + } + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try { + logger.info("======开始执行主数据信息同步========"); + return businessService.getBusinessData(requestJson); + }catch (Exception e){ + logger.info("======执行主数据同步失败:{}========",e.getMessage()); + e.printStackTrace(); + } + return null; + } +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/service/IBusinessService.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/service/IBusinessService.java new file mode 100644 index 00000000..d16ae235 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/service/IBusinessService.java @@ -0,0 +1,17 @@ +package com.hzya.frame.plugin.businessData.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.plugin.businessData.entity.BusinessEntity; +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 IBusinessService extends IBaseService { + JsonResultEntity getBusinessData(JSONObject requestJson); + SysExtensionApiEntity setData(SysExtensionApiEntity entity) throws Exception; +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/service/impl/BusinessServiceImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/service/impl/BusinessServiceImpl.java new file mode 100644 index 00000000..f7859781 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/businessData/service/impl/BusinessServiceImpl.java @@ -0,0 +1,664 @@ +package com.hzya.frame.plugin.businessData.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.plugin.businessData.dao.IBusinessDao; +import com.hzya.frame.plugin.businessData.entity.BusinessEntity; +import com.hzya.frame.plugin.businessData.service.IBusinessService; +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.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.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.HttpClientBuilder; +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.C; +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.text.SimpleDateFormat; +import java.util.ArrayList; +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 BusinessServiceImpl extends BaseService implements IBusinessService { + + private IBusinessDao businessDao; + @Autowired + private ControlsLogDaoImpl controlsLogDaoimpl; + + + @Autowired + private IComparisonDao comparisonDao; + @Autowired + public void setBusinessCustomerDao(IBusinessDao dao) { + this.businessDao = dao; + this.dao = dao; + } + + //@Override + //public JsonResultEntity getBusinessData(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); + //times = "2025-02-08";// + // //2、调用接口获取数据 + // String queryCursor = null; + // String startDate = times+" 00:00:00"; + // String endDate = times+" 23:59:59"; + // JSONArray datalist = new JSONArray(); + // sendBusinessData(datalist, access_token, queryCursor, startDate, endDate); + // + // if(datalist != null && datalist.size() > 0){ + // for (int i = 0; i < datalist.size(); i++) { + // JSONObject saveData = new JSONObject(); + // //3、对照数据 + // JSONObject jsonObject = datalist.getJSONObject(i); + // //field0011 申请单号 + // String field0011 = jsonObject.getString("serialNumber"); + // if(field0011 == null || "".equals(field0011) ){ + // continue; + // } + // saveData.put("field0011",field0011); + // //判断是否有这个数据 + // List checkData = businessDao.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("CCD"); + // comparisonEntityRule.setRuleMiddle("%Y-%m-%d"); + // comparisonEntityRule.setRuleSuffix(5); + // comparisonEntityRule.setDbName("mdm_ccd"); + // ComparisonEntity comparisonEntityRuleGz = comparisonDao.queryComparisonRule(comparisonEntityRule); + // saveData.put("document_rule", comparisonEntityRuleGz.getDocumentRule());//单据规则 + // saveData.put("document_rule_num", comparisonEntityRuleGz.getDocumentRuleNum());//单据规则流水号 + // saveData.put("field0001",jsonObject.getString("applyUser"));//申请人 + // saveData.put("field0002",jsonObject.getString("jobNumber"));//申请人工号 + // String oaToken = getOAToken(""); + // JSONObject user = getUser(jsonObject.getString("jobNumber"),oaToken); + // saveData.put("field0012",user.getString("orgPostName")); + // saveData.put("field0013",user.getString("orgDepartmentName")); + // saveData.put("field0014",user.getString("telNumber")); + // saveData.put("field0003",jsonObject.getString("startDateTime"));// 出差时间 + // saveData.put("field0015",jsonObject.getString("documentType")); + // saveData.put("field0017",jsonObject.getString("dayValOfDuration"));// 出差时长(天) + // saveData.put("field0018",jsonObject.getString("extshifouzhanhuichucha_109372_807255447"));// 是否境外出差 + // saveData.put("field0019",jsonObject.getString("extshifouxuyaoapecka_109372_294746269"));// 是否需要APEC卡 + // saveData.put("field0020",jsonObject.getString("extshifoujingwaichucha_109372_295886206"));// 是否展会出差 + // saveData.put("field0021",jsonObject.getString("reason"));// 出差事由 + // + // JSONArray detaildata = jsonObject.getJSONArray("businessDetailsSync"); + // if(detaildata != null && detaildata.size() > 0){ + // for (int i1 = 0; i1 < detaildata.size(); i1++) { + // JSONObject saveDetailData = new JSONObject(); + // saveDetailData.put("field0004",detaildata.getJSONObject(i1).getString("startDateTime"));//明细表-出发时间 + // saveDetailData.put("field0005",detaildata.getJSONObject(i1).getString("stopDateTime"));//明细表-结束时间 + // saveDetailData.put("field0022",detaildata.getJSONObject(i1).getString("businessDuration"));//明细表-出差时长 + // + // if(detaildata.getJSONObject(i1).getString("businessVehicle") != null){// 明细表-交通工具 + // if("0".equals(detaildata.getJSONObject(i1).getString("businessVehicle"))){ + // saveDetailData.put("field0008","飞机"); + // } + // if("1".equals(detaildata.getJSONObject(i1).getString("businessVehicle"))){ + // saveDetailData.put("field0008","火车"); + // } + // if("2".equals(detaildata.getJSONObject(i1).getString("businessVehicle"))){ + // saveDetailData.put("field0008","汽车"); + // } + // if("3".equals(detaildata.getJSONObject(i1).getString("businessVehicle"))){ + // saveDetailData.put("field0008","轮船"); + // } + // } + // saveDetailData.put("field0006",detaildata.getJSONObject(i1).getString("departurePlace"));//明细表-出发地 + // saveDetailData.put("field0007",detaildata.getJSONObject(i1).getString("destination"));//明细表-目的地 + // saveDetailData.put("field0009",detaildata.getJSONObject(i1).getString("expectedCost"));//明细表-预计费用 + // saveData.put("field0016",detaildata.getJSONObject(i1).getString("destination"));// 出差城市 + // + // + // 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"); + // businessDao.saveDetailData(saveDetailData); + // } + // } + // businessDao.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_ccd_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_ccd_option_log", "1","插件新增"); + // } + // } + // return BaseResult.getSuccessMessageEntity("处理成功"); + //} + @Override + public JsonResultEntity getBusinessData(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; + String startDate = times+" 00:00:00"; + String endDate = times+" 23:59:59"; + JSONArray datalist = new JSONArray(); + sendBusinessData(datalist, access_token, queryCursor, startDate, endDate); + + if(datalist != null && datalist.size() > 0){ + for (int i = 0; i < datalist.size(); i++) { + JSONObject saveData = new JSONObject(); + //3、对照数据 + JSONObject jsonObject = datalist.getJSONObject(i); + //field0011 申请单号 + String field0011 = jsonObject.getString("SerialNumber"); + if(field0011 == null || "".equals(field0011) ){ + continue; + } + saveData.put("field0011",field0011); + //判断是否有这个数据 + List checkData = businessDao.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("CCD"); + comparisonEntityRule.setRuleMiddle("%Y-%m-%d"); + comparisonEntityRule.setRuleSuffix(5); + comparisonEntityRule.setDbName("mdm_ccd"); + ComparisonEntity comparisonEntityRuleGz = comparisonDao.queryComparisonRule(comparisonEntityRule); + saveData.put("document_rule", comparisonEntityRuleGz.getDocumentRule());//单据规则 + saveData.put("document_rule_num", comparisonEntityRuleGz.getDocumentRuleNum());//单据规则流水号 + saveData.put("field0001",jsonObject.getString("ApplyUser"));//申请人 + saveData.put("field0002",jsonObject.getString("JobNumber"));//申请人工号 + String oaToken = getOAToken(""); + JSONObject user = getUser(jsonObject.getString("JobNumber"),oaToken); + if(jsonObject.getString("ApplyUser") != null && !"".equals(jsonObject.getString("ApplyUser"))){ + saveData.put("field0001",jsonObject.getString("ApplyUser"));//申请人 + }else { + saveData.put("field0001",user.getString("name"));//申请人 + } + saveData.put("field0012",user.getString("orgPostName")); + saveData.put("field0013",user.getString("orgDepartmentName")); + saveData.put("field0014",user.getString("telNumber")); + saveData.put("field0003",jsonObject.getString("StartDateTime"));// 出差时间 + saveData.put("field0015",jsonObject.getString("DocumentType")); + saveData.put("field0017",jsonObject.getString("DayValOfDuration"));// 出差时长(天) + if(jsonObject.getString("extshifouzhanhuichucha_109372_807255447") != null && "true".equals(jsonObject.getString("extshifouzhanhuichucha_109372_807255447"))){ + saveData.put("field0018","是");// 是否境外出差 + }else { + saveData.put("field0018","否");// 是否境外出差 + } + if(jsonObject.getString("extshifouxuyaoapecka_109372_294746269") != null && "true".equals(jsonObject.getString("extshifouxuyaoapecka_109372_294746269"))){ + saveData.put("field0019","是");// 是否需要APEC卡 + }else { + saveData.put("field0019","否");// 是否需要APEC卡 + } + if(jsonObject.getString("extshifoujingwaichucha_109372_295886206") != null && "true".equals(jsonObject.getString("extshifoujingwaichucha_109372_295886206"))){ + saveData.put("field0020","是");// 是否展会出差 + }else { + saveData.put("field0020","否");// 是否展会出差 + } + saveData.put("field0021",jsonObject.getString("Reason"));// 出差事由 + + JSONArray detaildata = jsonObject.getJSONArray("BusinessDetailsSync"); + if(detaildata != null && detaildata.size() > 0){ + for (int i1 = 0; i1 < detaildata.size(); i1++) { + JSONObject saveDetailData = new JSONObject(); + saveDetailData.put("field0004",detaildata.getJSONObject(i1).getString("StartDateTime"));//明细表-出发时间 + saveDetailData.put("field0005",detaildata.getJSONObject(i1).getString("StopDateTime"));//明细表-结束时间 + saveDetailData.put("field0022",detaildata.getJSONObject(i1).getString("BusinessDuration"));//明细表-出差时长 + + if(detaildata.getJSONObject(i1).getString("BusinessVehicle") != null){// 明细表-交通工具 + if("0".equals(detaildata.getJSONObject(i1).getString("BusinessVehicle"))){ + saveDetailData.put("field0008","飞机"); + } + if("1".equals(detaildata.getJSONObject(i1).getString("BusinessVehicle"))){ + saveDetailData.put("field0008","火车"); + } + if("2".equals(detaildata.getJSONObject(i1).getString("BusinessVehicle"))){ + saveDetailData.put("field0008","汽车"); + } + if("3".equals(detaildata.getJSONObject(i1).getString("BusinessVehicle"))){ + saveDetailData.put("field0008","轮船"); + } + } + saveDetailData.put("field0006",detaildata.getJSONObject(i1).getString("DeparturePlace"));//明细表-出发地 + saveDetailData.put("field0007",detaildata.getJSONObject(i1).getString("Destination"));//明细表-目的地 + saveDetailData.put("field0009",detaildata.getJSONObject(i1).getString("ExpectedCost"));//明细表-预计费用 + saveData.put("field0016",detaildata.getJSONObject(i1).getString("Destination"));// 出差城市 + + + 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"); + businessDao.saveDetailData(saveDetailData); + } + } + businessDao.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_ccd_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_ccd_option_log", "1","插件新增"); + } + } + return BaseResult.getSuccessMessageEntity("处理成功"); + } + + //private void sendBusinessData(JSONArray datalist, String access_token, String queryCursor, String startDate, String endDate) { + // String url = "https://openapi.italent.cn/AttendanceOpen/api/v1/Business/GetApprovalCompletedBusinessListByDate"; + // Map headers = new HashMap<>(); + // headers.put("Authorization", "Bearer " + access_token); + // JSONObject jsonObject = new JSONObject(); + // jsonObject.put("startDate", startDate); + // jsonObject.put("endDate", endDate); + // jsonObject.put("pageSize", 100); + // if (queryCursor != null) { + // jsonObject.put("queryCursor", queryCursor); + // } + // String returndata = sendPost(url, headers, jsonObject.toString()); + // + // if (returndata != null && JSONObject.isValidObject(returndata)) { + // JSONObject dataJson = JSONObject.parseObject(returndata); + // if(dataJson != null && dataJson.getString("code") != null && "200".equals( dataJson.getString("code"))){ + // JSONObject data = dataJson.getJSONObject("data"); + // if(data != null ){ + // JSONArray businessList = data.getJSONArray("businessList"); + // if(!data.getBoolean("isLastPage")){ + // queryCursor = data.getString("sortCursor"); + // sendBusinessData(datalist, access_token, queryCursor, startDate, endDate); + // } + // if(businessList != null && businessList.size() > 0){ + // datalist.addAll(businessList); + // } + // } + // } + // } + // + //} + private void sendBusinessData(JSONArray datalist, String access_token, Integer queryCursor, String startDate, String endDate) { + String url = "https://openapi.italent.cn/AttendanceOpen/api/v1/Business/GetApprovalCompletedBusinessList"; + Map headers = new HashMap<>(); + headers.put("Authorization", "Bearer " + access_token); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("StartDate", startDate); + jsonObject.put("EndDate", endDate); + jsonObject.put("PageIndex", queryCursor); + jsonObject.put("PageSize", 100); + + String returndata = sendPost(url, headers, jsonObject.toString()); + + if (returndata != null && JSONObject.isValidObject(returndata)) { + JSONObject dataJson = JSONObject.parseObject(returndata); + if(dataJson != null && dataJson.getString("Code") != null && "200".equals( dataJson.getString("Code"))){ + JSONObject data = dataJson.getJSONObject("Data"); + if(data != null ){ + JSONArray businessList = data.getJSONArray("BusinessList"); + if(data.getInteger("Total") > queryCursor*100){ + queryCursor = queryCursor+1; + sendBusinessData(datalist, access_token, queryCursor, startDate, endDate); + } + if(businessList != null && businessList.size() > 0){ + datalist.addAll(businessList); + } + } + } + } + } + private JSONObject getUser(String usercode,String access_token) { + JSONObject jsonObject = new JSONObject(); + String url = "https://swoa.sunwave.com.cn:9999/seeyon/rest/orgMembers/code/"+usercode+"?pageNo=0&pageSize=100"; + Map headers = new HashMap<>(); + headers.put("token",access_token); + + String returndata = sendGet(url, headers); + if (returndata != null && JSONArray.isValidArray(returndata)) { + JSONArray dataJson = JSONObject.parseArray(returndata); + if(dataJson != null && dataJson.size() > 0){ + for (int i = 0; i < dataJson.size(); i++) { + if(dataJson.getJSONObject(i).getString("code") != null && !"".equals(dataJson.getJSONObject(i).getString("code")) + && usercode.toLowerCase().equals(dataJson.getJSONObject(i).getString("code").toLowerCase())){ + jsonObject.put("telNumber",dataJson.getJSONObject(i).getString("telNumber")); + jsonObject.put("orgDepartmentName",dataJson.getJSONObject(i).getString("orgDepartmentName")); + jsonObject.put("orgPostName",dataJson.getJSONObject(i).getString("orgPostName")); + jsonObject.put("name",dataJson.getJSONObject(i).getString("name")); + break; + } + } + } + } + return jsonObject; + } + private String getOAToken(String name) { + String url = "https://swoa.sunwave.com.cn:9999/seeyon/rest/token"; + Map headers = null; + String bodys = "{\"password\":\"64de4de7-23ce-4946-ac91-dd9e322d86e5\",\"userName\":\"beis\",\"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; + } + private String getToken() { + String url = "https://openapi.italent.cn/token"; + Map headers = null; + String bodys = "{\"grant_type\":\"client_credentials\",\"app_key\":\"1CBEBF66FABD4A25A94DF8BB7B0074E7\",\"app_secret\":\"AEFCFCE92804440E89682A3B9FA9BBB8774DDF4FB812428AB7EC340C54CC472B\"}"; + 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("access_token") != null) { + access_token = tokendataJson.getString("access_token"); + } + } + return access_token; + } + + private String sendPost(String url, Map 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 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 headers = entity.getHeaders(); + JSONObject jsonObject = JSONObject.parseObject(bodys); + String loginName = jsonObject.getString("field0002"); + 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()); + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + + private String getXml(JSONObject jsonObject) { + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0011") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0001") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0002") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0012") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0013") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0014") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0003") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0015") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0016") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0017") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0018") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0019") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0020") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + stringBuffer.append(jsonObject.getString("field0021") != null?"":""); + stringBuffer.append(""); + stringBuffer.append(""); + //处理明细 + JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("mdm_ccd_detail")); + if(jsonArray != null&& jsonArray.size() > 0){ + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject detailObject = jsonArray.getJSONObject(i); + stringBuffer.append(""); + stringBuffer.append("").append(detailObject.getString("field0004") != null?"":"").append(""); + stringBuffer.append("").append(detailObject.getString("field0005") != null?"":"").append(""); + stringBuffer.append("").append(detailObject.getString("field0022") != null?"":"").append(""); + stringBuffer.append("").append(detailObject.getString("field0006") != null?"":"").append(""); + stringBuffer.append("").append(detailObject.getString("field0007") != null?"":"").append(""); + stringBuffer.append("").append(detailObject.getString("field0008") != null?"":"").append(""); + stringBuffer.append("").append(detailObject.getString("field0009") != null?"":"").append(""); + stringBuffer.append(""); + } + } + stringBuffer.append(""); + return stringBuffer.toString(); + } + + + +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java index beb4c48e..2a84c1a3 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java @@ -470,7 +470,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { } } }else {//执行正常下发 - + logger.info("==========开始执行正常主数据下发============="); //查询主数据 MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity(); queryMdmModuleEntity.setSts("Y"); @@ -509,13 +509,17 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { queryFildRule.setRuleCode("service"); List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule); - //新增 - 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); - + 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; + } } } @@ -827,6 +831,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 +859,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 +880,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 +920,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { * @param mdmModuleDistributeEntities * @return void **/ - private void doAdd(String mdmId,Long mainCode,List mdmModuleDbEntities, List mdmModuleDistributeEntities,List mdmModuleDbFiledsRuleEntities,List mdmModuleDbFiledsEntities ) throws Exception { + private void + doAdd(String mdmId,Long mainCode,List mdmModuleDbEntities, List mdmModuleDistributeEntities,List mdmModuleDbFiledsRuleEntities,List mdmModuleDbFiledsEntities ) throws Exception { //查询一千条数据 String mainDb = null; List objects = new ArrayList<>(); @@ -1029,6 +1039,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 +1067,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 +1088,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 +1140,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; } } diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/dao/IProjectMainFlowDao.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/dao/IProjectMainFlowDao.java new file mode 100644 index 00000000..be836719 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/dao/IProjectMainFlowDao.java @@ -0,0 +1,42 @@ +package com.hzya.frame.plugin.projectMainFlow.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity; + +import java.util.List; + +public interface IProjectMainFlowDao extends IBaseDao { + + /** + * + * @content 查询审定完成节点得项目主流程档案 + * @Param + * @Return + * @Author hecan + * @Date 2025-01-06 16:50 + * **/ + List queryProjectMainFlowAudit(ProjectMainFlowEntity projectMainFlowEntity); + + /** + * + * @content 查询归档节点得项目主流程档案 + * @Param + * @Return + * @Author hecan + * @Date 2025-01-06 16:50 + * **/ + List queryProjectMainFlowArchivist(ProjectMainFlowEntity projectMainFlowEntity); + + /** + * + * @content 更新项目主流程审定和归档推送标识和结果 + * @Param + * @Return + * @Author hecan + * @Date 2025-01-08 11:48 + * **/ + Integer updateProjectMainFlow(ProjectMainFlowEntity projectMainFlowEntity); + + + +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/dao/impl/ProjectMainFlowDaoImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/dao/impl/ProjectMainFlowDaoImpl.java new file mode 100644 index 00000000..a00133d3 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/dao/impl/ProjectMainFlowDaoImpl.java @@ -0,0 +1,30 @@ +package com.hzya.frame.plugin.projectMainFlow.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.plugin.projectMainFlow.dao.IProjectMainFlowDao; +import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +public class ProjectMainFlowDaoImpl extends MybatisGenericDao implements IProjectMainFlowDao { + @DS("#entity.dataSourceCode") + @Override + public List queryProjectMainFlowAudit(ProjectMainFlowEntity entity) { + return (List)super.selectList("queryProjectMainFlowAudit",entity); + } + + @DS("#entity.dataSourceCode") + @Override + public List queryProjectMainFlowArchivist(ProjectMainFlowEntity entity) { + return (List)super.selectList("queryProjectMainFlowArchivist",entity); + } + + @DS("#entity.dataSourceCode") + @Override + public Integer updateProjectMainFlow(ProjectMainFlowEntity entity) { + return super.update("updateProjectMainFlow",entity); + } + +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/entity/ProjectMainFlowEntity.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/entity/ProjectMainFlowEntity.java new file mode 100644 index 00000000..4c21783f --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/entity/ProjectMainFlowEntity.java @@ -0,0 +1,287 @@ +package com.hzya.frame.plugin.projectMainFlow.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +public class ProjectMainFlowEntity extends BaseEntity { + private String completemoney;//F完工服务额 + private String def2;//F完工辅材额公司 + private String def3;//F完工辅材额自购 + private String completedate;//完工完成时间 + private String def4;//F实际完工日期 + private String auditmoney;//J审定服务金额 + private String def5;//J审定辅材额公司 + private String def6;//J审定辅材额自购 + private String auditdate;//审计完成时间 + private String pinspectiondate;//H实际初验日期 + private String def1;//I终验日期 + + private String ts;//时间 + private String pkGroup;//集团编码 + private String pkOrg;//公司编码 + private String contractno;//合同号编码 + private String contractname;//合同档案名称 + private String creator;//创建人 + private String creationtime;//创建时间 + private String projectno;//项目号 + private String completepersion;//完工填单人 + private String pinspectionmoney;//初验金额 + private String pinspectionpersion;//初验填单人 + private String auditpersion;//审计填单人 + private String forecastRevenue;//预估收入确认 + private String vnote;//备注 + + private String auditStatus;//审定推送状态 + private String auditResult;//审定推送结果 + private String archivistResult;//归档推送结果 + private String archivistStatus;//归档推送状态 + private String def8;//完工服务额 + private String def7;//J审定服务金额 + + public String getDef8() { + return def8; + } + + public void setDef8(String def8) { + this.def8 = def8; + } + + public String getDef7() { + return def7; + } + + public void setDef7(String def7) { + this.def7 = def7; + } + + public String getCompletemoney() { + return completemoney; + } + + public void setCompletemoney(String completemoney) { + this.completemoney = completemoney; + } + + public String getDef2() { + return def2; + } + + public void setDef2(String def2) { + this.def2 = def2; + } + + public String getDef3() { + return def3; + } + + public void setDef3(String def3) { + this.def3 = def3; + } + + public String getCompletedate() { + return completedate; + } + + public void setCompletedate(String completedate) { + this.completedate = completedate; + } + + public String getDef4() { + return def4; + } + + public void setDef4(String def4) { + this.def4 = def4; + } + + public String getAuditmoney() { + return auditmoney; + } + + public void setAuditmoney(String auditmoney) { + this.auditmoney = auditmoney; + } + + public String getDef5() { + return def5; + } + + public void setDef5(String def5) { + this.def5 = def5; + } + + public String getDef6() { + return def6; + } + + public void setDef6(String def6) { + this.def6 = def6; + } + + public String getAuditdate() { + return auditdate; + } + + public void setAuditdate(String auditdate) { + this.auditdate = auditdate; + } + + public String getPinspectiondate() { + return pinspectiondate; + } + + public void setPinspectiondate(String pinspectiondate) { + this.pinspectiondate = pinspectiondate; + } + + public String getDef1() { + return def1; + } + + public void setDef1(String def1) { + this.def1 = def1; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + public String getPkGroup() { + return pkGroup; + } + + public void setPkGroup(String pkGroup) { + this.pkGroup = pkGroup; + } + + public String getPkOrg() { + return pkOrg; + } + + public void setPkOrg(String pkOrg) { + this.pkOrg = pkOrg; + } + + public String getContractno() { + return contractno; + } + + public void setContractno(String contractno) { + this.contractno = contractno; + } + + public String getContractname() { + return contractname; + } + + public void setContractname(String contractname) { + this.contractname = contractname; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public String getCreationtime() { + return creationtime; + } + + public void setCreationtime(String creationtime) { + this.creationtime = creationtime; + } + + public String getProjectno() { + return projectno; + } + + public void setProjectno(String projectno) { + this.projectno = projectno; + } + + public String getCompletepersion() { + return completepersion; + } + + public void setCompletepersion(String completepersion) { + this.completepersion = completepersion; + } + + public String getPinspectionmoney() { + return pinspectionmoney; + } + + public void setPinspectionmoney(String pinspectionmoney) { + this.pinspectionmoney = pinspectionmoney; + } + + public String getPinspectionpersion() { + return pinspectionpersion; + } + + public void setPinspectionpersion(String pinspectionpersion) { + this.pinspectionpersion = pinspectionpersion; + } + + public String getAuditpersion() { + return auditpersion; + } + + public void setAuditpersion(String auditpersion) { + this.auditpersion = auditpersion; + } + + public String getForecastRevenue() { + return forecastRevenue; + } + + public void setForecastRevenue(String forecastRevenue) { + this.forecastRevenue = forecastRevenue; + } + + public String getVnote() { + return vnote; + } + + public void setVnote(String vnote) { + this.vnote = vnote; + } + + public String getAuditStatus() { + return auditStatus; + } + + public void setAuditStatus(String auditStatus) { + this.auditStatus = auditStatus; + } + + public String getAuditResult() { + return auditResult; + } + + public void setAuditResult(String auditResult) { + this.auditResult = auditResult; + } + + public String getArchivistResult() { + return archivistResult; + } + + public void setArchivistResult(String archivistResult) { + this.archivistResult = archivistResult; + } + + public String getArchivistStatus() { + return archivistStatus; + } + + public void setArchivistStatus(String archivistStatus) { + this.archivistStatus = archivistStatus; + } +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/entity/ProjectMainFlowEntity.xml b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/entity/ProjectMainFlowEntity.xml new file mode 100644 index 00000000..29ffca4c --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/entity/ProjectMainFlowEntity.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + formmain_0219.id as id + ,'SW01' as pkGroup -- 集团编码 + ,'666' as pkOrg -- 公司编码 + ,field0274 as contractno -- 合同号 + ,field0279 as contractname -- 合同名称 + ,m4.name as creator -- 创建人 + ,field0003 as creationtime -- 创建时间 + ,field0007 as projectno -- 项目号 + ,field0116 as completemoney -- 完工金额 + ,field0294 as completedate -- 完工日期 + ,m1.name as completepersion -- 完工填单人 + ,field0149 as pinspectionmoney -- 初验金额 + ,field0147 as pinspectiondate -- 初验时间 + ,m2.name as pinspectionpersion -- 初验填单人 + ,field0209 as auditmoney -- 审计金额 + ,field0297 as auditdate -- 审计时间 + ,m3.name as auditpersion -- 审计填单人 + ,null as forecastRevenue -- 预估收入确认 + ,field0138 as vnote -- 备注 + ,field0120 as def8 -- 完工服务额 + ,field0320 as def2 -- F完工辅材额公司 + ,field0321 as def3 -- F完工辅材额自购 + ,field0294 as completedate -- 完工完成时间 + ,field0112 as def4 -- F实际完工日期 + ,field0213 as def7 -- J审定服务金额 + ,field0354 as def5 -- J审定辅材额公司 + ,field0355 as def6 -- J审定辅材额自购 + ,field0297 as auditdate -- 审计完成时间 + ,field0147 as pinspectiondate -- H实际初验日期 + ,field0161 as def1 -- I终验日期 + ,field0427 as auditStatus -- 审定推送状态 + ,field0428 as auditResult -- 审定推送结果 + ,field0426 as archivistResult -- 归档推送结果 + ,field0425 as archivistStatus -- 归档推送状态 + + + + + + + + + + + update formmain_0219 set + + field0427 = #{auditStatus}, + field0428 = #{auditResult}, + field0426 = #{archivistResult}, + field0425 = #{archivistStatus}, + + where id = #{id} + + + + + + diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/plugin/ProjectMainFlowArchivistPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/plugin/ProjectMainFlowArchivistPluginInitializer.java new file mode 100644 index 00000000..9585fe46 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/plugin/ProjectMainFlowArchivistPluginInitializer.java @@ -0,0 +1,219 @@ +package com.hzya.frame.plugin.projectMainFlow.plugin; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.SendContract.entity.SendContractEntity; +import com.hzya.frame.plugin.projectMainFlow.dao.IProjectMainFlowDao; +import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +import java.util.Date; +import java.util.List; + +public class ProjectMainFlowArchivistPluginInitializer extends PluginBaseEntity { + + Logger logger = LoggerFactory.getLogger(ProjectMainFlowArchivistPluginInitializer.class); + + @Autowired + private IProjectMainFlowDao projectMainFlowDao; + + @Autowired + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + + @Value("${zt.url}") + private String url; + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "ProjectMainFlowArchivistPluginInitializer"; + } + + @Override + public String getPluginName() { + return "项目主流程审定"; + } + + @Override + public String getPluginLabel() { + return "ProjectMainFlowArchivistPluginInitializer"; + } + + @Override + public String getPluginType() { + return "1"; + } + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try { + logger.info("======开始执行项目主流程归档推送BIP========"); + //重试方法 + if (null != requestJson) { + //如果这个id不为空,说明是重试的 + String id = requestJson.getString("integration_task_living_details_id"); + //执行重新发送 + ProjectMainFlowEntity projectMainFlowEntity = new ProjectMainFlowEntity(); + projectMainFlowEntity.setDataSourceCode("SW-OA"); + if (StrUtil.isNotEmpty(id)) { + projectMainFlowEntity.setId(id); + } + //查询审定之后数据 + List projectMainFlowEntities = projectMainFlowDao.queryProjectMainFlowArchivist(projectMainFlowEntity); + if(projectMainFlowEntities == null || projectMainFlowEntities.size() == 0){ + logger.info("=====查询项目主流程归档数据有:{}条",projectMainFlowEntities.size()); + return BaseResult.getSuccessMessageEntity("查询成功"); + } + for (ProjectMainFlowEntity mainFlowEntity : projectMainFlowEntities) { + //组装数据 + JSONObject sendData = getSendData(mainFlowEntity); + JSONObject tokenData = getBipTokenData(); + mainFlowEntity.setDataSourceCode("SW-OA"); + //获取TOKEN + String tokenResult = HttpRequest.post(url). + header("appId", "800050"). + header("apiCode", "8000500003"). + header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj"). + header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="). + body(tokenData.toString()). + execute(). + body(); + logger.error("项目主流程归档BIPtoken返回结果:"+tokenResult); + JSONObject tokenResultJson = JSONObject.parseObject(tokenResult); + if(!tokenResultJson.getBoolean("flag")){ + mainFlowEntity.setArchivistStatus("0"); + mainFlowEntity.setArchivistResult("执行失败,Token获取失败"); + projectMainFlowDao.updateProjectMainFlow(mainFlowEntity); + continue; + } + String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token"); + //发送数据 + String result = HttpRequest.post(url). + header("appId", "800050"). + header("apiCode", "8000500016"). + header("access_token", tokenBody). + header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj"). + header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="). + body(sendData.toString()). + execute(). + body(); + logger.error("项目主流程归档之后返回结果:"+result); + JSONObject resultJson = JSONObject.parseObject(result); + if(!resultJson.getBoolean("flag")){ + mainFlowEntity.setArchivistStatus("0"); + mainFlowEntity.setArchivistResult("归档发送失败"+resultJson.getString("msg")); + projectMainFlowDao.updateProjectMainFlow(mainFlowEntity); + saveTaskLivingDetails(mainFlowEntity.getId(),mainFlowEntity.getId(),sendData.toString(),resultJson.toJSONString(),false); + }else { + mainFlowEntity.setArchivistStatus("1"); + mainFlowEntity.setArchivistResult("归档发送成功"); + projectMainFlowDao.updateProjectMainFlow(mainFlowEntity); + saveTaskLivingDetails(mainFlowEntity.getId(),mainFlowEntity.getId(),sendData.toString(),resultJson.toJSONString(),true); + } + } + } + logger.info("=======项目主流程归档推送BIP执行成功======="); + return BaseResult.getSuccessMessageEntity("项目主流程归档执行成功"); + } catch (Exception e) { + logger.info("======执行项目主流程归档推送BIP失败:{}========", e.getMessage()); + e.printStackTrace(); + } + return BaseResult.getFailureMessageEntity("项目主流程归档执行失败"); + } + + + private JSONObject getBipTokenData() { + JSONObject jsonObject = new JSONObject(); + + + + return jsonObject; + } + + + private JSONObject getSendData(ProjectMainFlowEntity projectMainFlowEntity) { + JSONObject htdd01Master = new JSONObject(); + JSONObject bill = new JSONObject(); + JSONObject htdd01slave4_htdd01slave4 = new JSONObject(); + JSONArray jsonArray=new JSONArray(); + htdd01Master.put("pk_group",projectMainFlowEntity.getPkGroup()); + htdd01Master.put("pk_org",projectMainFlowEntity.getPkOrg()); + htdd01Master.put("contractno",projectMainFlowEntity.getContractno()); + htdd01Master.put("name",projectMainFlowEntity.getContractname()); + // htdd01Master.put("creator",projectMainFlowEntity.getCreator()); + // htdd01Master.put("creationtime",projectMainFlowEntity.getCreationtime()); + + htdd01slave4_htdd01slave4.put("contractno",projectMainFlowEntity.getContractno()); + htdd01slave4_htdd01slave4.put("projectno",projectMainFlowEntity.getProjectno()); + htdd01slave4_htdd01slave4.put("completemoney",projectMainFlowEntity.getCompletemoney()); + htdd01slave4_htdd01slave4.put("completedate",projectMainFlowEntity.getCompletedate()); + htdd01slave4_htdd01slave4.put("completepersion",projectMainFlowEntity.getCompletepersion()); + htdd01slave4_htdd01slave4.put("pinspectionmoney",projectMainFlowEntity.getPinspectionmoney()); + htdd01slave4_htdd01slave4.put("pinspectiondate",projectMainFlowEntity.getPinspectiondate()); + htdd01slave4_htdd01slave4.put("pinspectionpersion",projectMainFlowEntity.getPinspectionpersion()); + htdd01slave4_htdd01slave4.put("auditmoney",projectMainFlowEntity.getAuditmoney()); + htdd01slave4_htdd01slave4.put("auditdate",projectMainFlowEntity.getAuditdate()); + htdd01slave4_htdd01slave4.put("auditpersion",projectMainFlowEntity.getAuditpersion()); + htdd01slave4_htdd01slave4.put("forecast_revenue",projectMainFlowEntity.getForecastRevenue()); + htdd01slave4_htdd01slave4.put("vnote",projectMainFlowEntity.getVnote()); + htdd01slave4_htdd01slave4.put("def1",projectMainFlowEntity.getDef1()); + htdd01slave4_htdd01slave4.put("def2",projectMainFlowEntity.getDef2()); + htdd01slave4_htdd01slave4.put("def3",projectMainFlowEntity.getDef3()); + htdd01slave4_htdd01slave4.put("def4",projectMainFlowEntity.getDef4()); + htdd01slave4_htdd01slave4.put("def5",projectMainFlowEntity.getDef5()); + htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6()); + htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7()); + htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8()); + jsonArray.add(htdd01slave4_htdd01slave4); + bill.put("htdd01Master",htdd01Master); + bill.put("htdd01slave4_htdd01slave4",jsonArray); + return bill; + } + + + 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("ProjectMainFlowArchivistPluginInitializer"); + integrationTaskLivingDetailsEntity.setRootAppNewData(rootAppNewData); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(newTransmitInfo); + if(flag){ + taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity); + }else { + taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity); + } + }catch (Exception e){ + logger.info("保存日志到集成任务日志明细中失败:{}",e.getMessage()); + } + } +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/plugin/ProjectMainFlowAuditPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/plugin/ProjectMainFlowAuditPluginInitializer.java new file mode 100644 index 00000000..1ba41d6f --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/plugin/ProjectMainFlowAuditPluginInitializer.java @@ -0,0 +1,211 @@ +package com.hzya.frame.plugin.projectMainFlow.plugin; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.SendContract.entity.SendContractEntity; +import com.hzya.frame.plugin.projectMainFlow.dao.IProjectMainFlowDao; +import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +import java.util.Date; +import java.util.List; + +public class ProjectMainFlowAuditPluginInitializer extends PluginBaseEntity { + + Logger logger = LoggerFactory.getLogger(ProjectMainFlowAuditPluginInitializer.class); + + @Autowired + private IProjectMainFlowDao projectMainFlowDao; + + @Autowired + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + + @Value("${zt.url}") + private String url; + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "ProjectMainFlowAuditPluginInitializer"; + } + + @Override + public String getPluginName() { + return "项目主流程审定"; + } + + @Override + public String getPluginLabel() { + return "ProjectMainFlowAuditPluginInitializer"; + } + + @Override + public String getPluginType() { + return "1"; + } + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try { + logger.info("======开始执行项目主流程审定完成之后推送BIP========"); + //重试方法 + if (null != requestJson) { + //如果这个id不为空,说明是重试的 + String id = requestJson.getString("integration_task_living_details_id"); + //执行重新发送 + ProjectMainFlowEntity projectMainFlowEntity = new ProjectMainFlowEntity(); + projectMainFlowEntity.setDataSourceCode("SW-OA"); + if (StrUtil.isNotEmpty(id)) { + projectMainFlowEntity.setId(id); + } + //查询审定之后数据 + List projectMainFlowEntities = projectMainFlowDao.queryProjectMainFlowAudit(projectMainFlowEntity); + if(projectMainFlowEntities == null || projectMainFlowEntities.size() == 0){ + logger.info("=====查询项目主流程审定完成数据有:{}条",projectMainFlowEntities.size()); + return BaseResult.getSuccessMessageEntity("查询成功"); + } + for (ProjectMainFlowEntity mainFlowEntity : projectMainFlowEntities) { + //组装数据 + JSONObject sendData = getSendData(mainFlowEntity); + JSONObject tokenData = new JSONObject(); + mainFlowEntity.setDataSourceCode("SW-OA"); + //获取TOKEN + String tokenResult = HttpRequest.post(url). + header("appId", "800050"). + header("apiCode", "8000500003"). + header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj"). + header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="). + body(tokenData.toString()). + execute(). + body(); + logger.error("项目主流程审定之后BIPtoken返回结果:"+tokenResult); + JSONObject tokenResultJson = JSONObject.parseObject(tokenResult); + if(!tokenResultJson.getBoolean("flag")){ + mainFlowEntity.setAuditStatus("0"); + mainFlowEntity.setAuditResult("执行失败,Token获取失败"); + projectMainFlowDao.updateProjectMainFlow(mainFlowEntity); + continue; + } + String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token"); + logger.info("====项目主流程审定请求参数======:{}",sendData.toJSONString()); + //发送数据 + String result = HttpRequest.post(url). + header("appId", "800050"). + header("apiCode", "8000500016"). + header("access_token", tokenBody). + header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj"). + header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="). + body(sendData.toString()). + execute(). + body(); + logger.error("项目主流程审定之后返回结果:"+result); + JSONObject resultJson = JSONObject.parseObject(result); + if(!resultJson.getBoolean("flag")){ + mainFlowEntity.setAuditStatus("0"); + mainFlowEntity.setAuditResult("审定发送失败"+resultJson.getString("msg")); + projectMainFlowDao.updateProjectMainFlow(mainFlowEntity); + saveTaskLivingDetails(mainFlowEntity.getId(),mainFlowEntity.getId(),sendData.toString(),resultJson.toJSONString(),false); + }else { + mainFlowEntity.setAuditStatus("1"); + mainFlowEntity.setAuditResult("审定发送成功"); + projectMainFlowDao.updateProjectMainFlow(mainFlowEntity); + saveTaskLivingDetails(mainFlowEntity.getId(),mainFlowEntity.getId(),sendData.toString(),resultJson.toJSONString(),true); + } + } + } + logger.info("=======项目主流程审定完成之后推送BIP执行成功======="); + return BaseResult.getSuccessMessageEntity("项目主流程审定执行成功"); + } catch (Exception e) { + logger.info("======执行项目主流程审定完成之后推送BIP失败:{}========", e.getMessage()); + e.printStackTrace(); + } + return BaseResult.getFailureMessageEntity("项目主流程审定执行失败"); + } + + + private JSONObject getSendData(ProjectMainFlowEntity projectMainFlowEntity) { + JSONObject htdd01Master = new JSONObject(); + JSONObject bill = new JSONObject(); + JSONObject htdd01slave4_htdd01slave4 = new JSONObject(); + JSONArray jsonArray=new JSONArray(); + htdd01Master.put("pk_group",projectMainFlowEntity.getPkGroup()); + htdd01Master.put("pk_org",projectMainFlowEntity.getPkOrg()); + htdd01Master.put("contractno",projectMainFlowEntity.getContractno()); + htdd01Master.put("name",projectMainFlowEntity.getContractname()); + // htdd01Master.put("creator",projectMainFlowEntity.getCreator()); + // htdd01Master.put("creationtime",projectMainFlowEntity.getCreationtime()); + + htdd01slave4_htdd01slave4.put("contractno",projectMainFlowEntity.getContractno()); + htdd01slave4_htdd01slave4.put("projectno",projectMainFlowEntity.getProjectno()); + htdd01slave4_htdd01slave4.put("completemoney",projectMainFlowEntity.getCompletemoney()); + htdd01slave4_htdd01slave4.put("completedate",projectMainFlowEntity.getCompletedate()); + htdd01slave4_htdd01slave4.put("completepersion",projectMainFlowEntity.getCompletepersion()); + htdd01slave4_htdd01slave4.put("pinspectionmoney",projectMainFlowEntity.getPinspectionmoney()); + htdd01slave4_htdd01slave4.put("pinspectiondate",projectMainFlowEntity.getPinspectiondate()); + htdd01slave4_htdd01slave4.put("pinspectionpersion",projectMainFlowEntity.getPinspectionpersion()); + htdd01slave4_htdd01slave4.put("auditmoney",projectMainFlowEntity.getAuditmoney()); + htdd01slave4_htdd01slave4.put("auditdate",projectMainFlowEntity.getAuditdate()); + htdd01slave4_htdd01slave4.put("auditpersion",projectMainFlowEntity.getAuditpersion()); + htdd01slave4_htdd01slave4.put("forecast_revenue",projectMainFlowEntity.getForecastRevenue()); + htdd01slave4_htdd01slave4.put("vnote",projectMainFlowEntity.getVnote()); + htdd01slave4_htdd01slave4.put("def1",projectMainFlowEntity.getDef1()); + htdd01slave4_htdd01slave4.put("def2",projectMainFlowEntity.getDef2()); + htdd01slave4_htdd01slave4.put("def3",projectMainFlowEntity.getDef3()); + htdd01slave4_htdd01slave4.put("def4",projectMainFlowEntity.getDef4()); + htdd01slave4_htdd01slave4.put("def5",projectMainFlowEntity.getDef5()); + htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6()); + htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7()); + htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8()); + jsonArray.add(htdd01slave4_htdd01slave4); + bill.put("htdd01Master",htdd01Master); + bill.put("htdd01slave4_htdd01slave4",jsonArray); + return bill; + } + + + 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("ProjectMainFlowAuditPluginInitializer"); + integrationTaskLivingDetailsEntity.setRootAppNewData(rootAppNewData); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(newTransmitInfo); + if(flag){ + taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity); + }else { + taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity); + } + }catch (Exception e){ + logger.info("保存日志到集成任务日志明细中失败:{}",e.getMessage()); + } + } +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/service/IProjectMainFlowService.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/service/IProjectMainFlowService.java new file mode 100644 index 00000000..ca376bfa --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/service/IProjectMainFlowService.java @@ -0,0 +1,9 @@ +package com.hzya.frame.plugin.projectMainFlow.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface IProjectMainFlowService extends IBaseService { +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/service/impl/ProjectMainFlowServiceImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/service/impl/ProjectMainFlowServiceImpl.java new file mode 100644 index 00000000..3010db59 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/service/impl/ProjectMainFlowServiceImpl.java @@ -0,0 +1,24 @@ +package com.hzya.frame.plugin.projectMainFlow.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.plugin.SendContract.dao.ISendContractDao; +import com.hzya.frame.plugin.projectMainFlow.dao.IProjectMainFlowDao; +import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity; +import com.hzya.frame.plugin.projectMainFlow.service.IProjectMainFlowService; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +public class ProjectMainFlowServiceImpl extends BaseService implements IProjectMainFlowService { + + private IProjectMainFlowDao projectMainFlowDao; + + @Autowired + public void setProjectMainFlowDao(IProjectMainFlowDao dao) { + this.projectMainFlowDao = dao; + this.dao = dao; + } + +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/ServiceDataDistributePluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/ServiceDataDistributePluginInitializer.java index f4de7c1a..84f9389b 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/ServiceDataDistributePluginInitializer.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/ServiceDataDistributePluginInitializer.java @@ -1055,6 +1055,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ } for (int i = 0; i < doObjects.size(); i++) { + logger.info("=========需要下发的数据有{}条,单据编号为:{}======",doObjects.size(),doObjects.get(i).getString("vdef1")); //查询是否已经手动发送过。只有新增校验,查询发送日志是否已经有这条数据 MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity(); mdmModuleSendLogEntity.setTableName(mainDb+"_send_log"); @@ -1154,7 +1155,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ //组装数据发送 logger.info("=========开始执行正常业务数据下发脚本,第二次=============="); JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); - logger.info("=====业务数据下发重试调用BIP付款申请返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString()); + logger.info("=====业务数据下发调用BIP付款申请返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString()); if(jsonResultEntity.isFlag()){ if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) { logger.info("=========开始执行正常业务返回脚本=============="); @@ -1203,6 +1204,12 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ serviceDataEntity.setId(query.get(0).getId()); serviceDataDao.updateBipPaymentNumber(serviceDataEntity); logger.info("===正常下发时候,根据OA单据编号:{}更新BIP付款申请单号:{}完毕",jsonObjectParent.getString("vdef1"),backJsonResultEntity.getString("vbillno")); + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + //updateMap.put("dataStatus", "Y"); + updateMap.put("addStatus", "1"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); }else{ logger.info("======正常下发时候根据单据编号:{}未能在三维OA查询到数据,Bip付款申请单号不回写",jsonObjectParent.getString("vdef1")); } @@ -1217,27 +1224,28 @@ public class ServiceDataDistributePluginInitializer 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; } } } - - //所有下发发送完成,修改数据状态 - for (int i = 0; i < objects.size(); i++) { - if(objects.get(i).getBoolean("sendsanfzt123")){ + /* //所有下发发送完成,修改数据状态 + for (int ii = 0; ii < objects.size(); ii++) { + if(objects.get(ii).getBoolean("sendsanfzt123")){ Map updateMap = new HashMap<>(); updateMap.put("tableName",mainDb); //updateMap.put("dataStatus", "Y"); updateMap.put("addStatus", "1"); - updateMap.put("id", objects.get(i).getString("id")); + updateMap.put("id", objects.get(ii).getString("id")); mdmModuleDao.updateMdmSTs(updateMap); } - } + }*/ } private void saveMdmModuleSendLogEntity(Long mdmCode,String distributeId,String dataType,String remark,String dbname,String formmain_id, String target_app, String appId, String target_api,String apiID, String source_data, String option_type) throws Exception { diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/SendContract/spring/spring-buildpackage-plugin.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/SendContract/spring/spring-buildpackage-plugin.xml index 356648db..00629376 100644 --- a/base-buildpackage/src/main/resources/cfgHome/plugin/SendContract/spring/spring-buildpackage-plugin.xml +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/SendContract/spring/spring-buildpackage-plugin.xml @@ -2,5 +2,5 @@ - + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/pluginCfg.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/pluginCfg.xml new file mode 100644 index 00000000..586b80ac --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/pluginCfg.xml @@ -0,0 +1,6 @@ + + +businessPlugin +businessPlugin插件 +20250219 + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/spring/spring-buildpackage-dao.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..013e6a56 --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/spring/spring-buildpackage-plugin.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..313af48d --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/spring/spring-buildpackage-service.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/spring/spring-buildpackage-service.xml new file mode 100644 index 00000000..a6d6cc58 --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/businessData/spring/spring-buildpackage-service.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/projectMainFlow/pluginCfg.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/projectMainFlow/pluginCfg.xml new file mode 100644 index 00000000..f3c30ca6 --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/projectMainFlow/pluginCfg.xml @@ -0,0 +1,6 @@ + + +ProjectMainFlowAuditPluginInitializer +ProjectMainFlowAuditPluginInitializer插件 +90000001 + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/projectMainFlow/spring/spring-buildpackage-dao.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/projectMainFlow/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..31689d52 --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/projectMainFlow/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/projectMainFlow/spring/spring-buildpackage-plugin.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/projectMainFlow/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..e1a4e5f1 --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/projectMainFlow/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java index 23026b1c..d4a1f9bd 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java @@ -61,11 +61,15 @@ 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.entity.ContentType; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.SSLContextBuilder; import org.apache.http.util.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -76,6 +80,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import javax.annotation.Resource; +import javax.net.ssl.SSLContext; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; @@ -1888,9 +1893,19 @@ public class SysApplicationServiceImpl extends BaseService + // } diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataServiceImpl.java index 357a2ec6..b587caa4 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataServiceImpl.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataServiceImpl.java @@ -28,15 +28,15 @@ import java.util.List; @Service("MasterDataServiceImpl") public class MasterDataServiceImpl extends BaseService implements IMasterDataService { - @Autowired + @Autowired private MasterDataDaoImpl masterDataDaoImpl; - @Autowired - private ComparisonServiceImpl comparisonServiceimpl; - @Autowired - private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl; + @Autowired + private ComparisonServiceImpl comparisonServiceimpl; + @Autowired + private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl; - @Autowired - private ApplicationCache applicationCache; + @Autowired + private ApplicationCache applicationCache; private String ts = ""; /** @@ -60,8 +60,8 @@ public class MasterDataServiceImpl extends BaseService for (MdmModuleSourceEntity mdmModuleSourceEntity : list) { // applicationCache.get() // logger.info("入参数据"+jsonObject.toString()); - String startTime = DateUtil.format(json.getDate("startTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间 - String endTime = DateUtil.format(json.getDate("endTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的结束时间 + String startTime = DateUtil.format(json.getDate("startTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间 + String endTime = DateUtil.format(json.getDate("endTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的结束时间 // logger.info("本次任务查询区间开始时间:{} 结束时间:{}",startTime,endTime); String tableName = ""; try { @@ -71,7 +71,7 @@ public class MasterDataServiceImpl extends BaseService String mdmCode = mdmModuleSourceEntity.getMdmCode(); List listAll = new ArrayList<>(); if("10007".equals(mdmCode)){ - continue; + continue; } // if(!"10003".equals(mdmCode)){ // continue; @@ -80,7 +80,7 @@ public class MasterDataServiceImpl extends BaseService case "1": //通过主数据编码判断,不同的接口走不通的查询逻辑 switch (mdmCode){ - case "10003"://致远用户信息 + /*case "10003"://致远用户信息 tableName = "mdm_user"; listAll = bindingUser(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); break; @@ -91,7 +91,19 @@ public class MasterDataServiceImpl extends BaseService case "10007"://银行信息 tableName = "mdm_bank"; listAll = binDingBank(jsonObject, mdmModuleSourceEntity, dbCode); + break;*/ + /* case "10047"://BIP供应商档案 + tableName = "mdm_bip_supplier"; + listAll = binDingSupplier(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); + break;*/ + case "10048"://BIP项目档案 + tableName = "mdm_bip_project"; + listAll = binDingProject(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); break; + /* case "10049"://BIP供应商银行档案 + tableName = "mdm_bip_supplier_bank"; + listAll = binDingSupplierBank(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); + break;*/ default: logger.info("未匹配到主数据的编码,请检查"); break; @@ -110,6 +122,89 @@ public class MasterDataServiceImpl extends BaseService } return BaseResult.getSuccessMessageEntity("主数据同步成功"); } + + //绑定项目 + private List binDingProject(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception { + List list = new ArrayList<>(); + StringBuffer sb = new StringBuffer(); + if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){ + sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') "); + sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') "); + } + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("select * from v_hzya_project where 1=1 "+sb.toString()); + mdmModuleSourceEntity.setDataSourceCode(dbCode); + List> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity); + int i = 0; + if(CollectionUtils.isNotEmpty(hashMaps)){ + for (HashMap hashMap : hashMaps) { + JSONObject main = new JSONObject(); + JSONObject mdm = new JSONObject(); + for(String key:hashMap.keySet()) { + mdm.put(key.toLowerCase(), hashMap.get(key)); + } + main.put("mdm_bip_project",mdm); + list.add(main); + } + } + return list; + } + + //绑定供应商银行账户 + private List binDingSupplierBank(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception { + List list = new ArrayList<>(); + StringBuffer sb = new StringBuffer(); + if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){ + sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') "); + sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') "); + } + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("select * from v_hzya_supplier_bank where 1=1 "+sb.toString()); + mdmModuleSourceEntity.setDataSourceCode(dbCode); + List> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity); + int i = 0; + if(CollectionUtils.isNotEmpty(hashMaps)){ + for (HashMap hashMap : hashMaps) { + JSONObject main = new JSONObject(); + JSONObject mdm = new JSONObject(); + for(String key:hashMap.keySet()) { + mdm.put(key.toLowerCase(), hashMap.get(key)); + } + main.put("mdm_bip_supplier_bank",mdm); + list.add(main); + } + } + return list; + } + + //绑定供应商 + private List binDingSupplier(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception { + List list = new ArrayList<>(); + StringBuffer sb = new StringBuffer(); + if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){ + sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') "); + sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') "); + } + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("select * from v_hzya_supplier where 1=1 "+sb.toString()); + logger.info("主数据抽取供应商的sql语句为:{}",stringBuffer.toString()); + mdmModuleSourceEntity.setDataSourceCode(dbCode); + List> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity); + int i = 0; + if(CollectionUtils.isNotEmpty(hashMaps)){ + for (HashMap hashMap : hashMaps) { + JSONObject main = new JSONObject(); + JSONObject mdm = new JSONObject(); + for(String key:hashMap.keySet()) { + mdm.put(key.toLowerCase(), hashMap.get(key)); + } + main.put("mdm_bip_supplier",mdm); + list.add(main); + } + } + return list; + } + //绑定银行 private List binDingBank(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode)throws Exception { List list = new ArrayList<>(); @@ -187,7 +282,8 @@ public class MasterDataServiceImpl extends BaseService } //绑定OA用户参数 - private List bindingUser(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception { + private List + bindingUser(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception { List list = new ArrayList<>(); StringBuffer sb = new StringBuffer(); if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){ @@ -209,7 +305,7 @@ public class MasterDataServiceImpl extends BaseService if(CollectionUtils.isNotEmpty(hashMaps)){ for (HashMap hashMap : hashMaps) { JSONObject main = new JSONObject(); - JSONObject mdm_user = new JSONObject(); + JSONObject mdm_user = new JSONObject(); for(String key:hashMap.keySet()) { mdm_user.put(key, hashMap.get(key)); } @@ -223,10 +319,11 @@ public class MasterDataServiceImpl extends BaseService //查询档案参数组装 public JsonResultEntity ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List hashMaps,String mdmCode,String tableName)throws Exception{ + JSONObject jsonObjectUser = new JSONObject(); + List 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); @@ -235,39 +332,34 @@ public class MasterDataServiceImpl extends BaseService Object attribute = comparisonServiceimpl.queryEntityPage(jsonStr); logger.info("得到的attribute值为:{}", jsonStr.toJSONString(attribute)); JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute); - JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list"); + JSONObject pageInfo = jsonObjectAttribute.getJSONObject("pageInfo"); + JSONArray jsonArrayList = pageInfo.getJSONArray("list"); //如果jsonArrayList为null,说明没有值,在表中不存在 if (jsonArrayList == null || jsonArrayList.size() == 0) { -// //将查询出来得数据调用通用接口新增,保存到表中 -// JSONObject main = new JSONObject(); -// for(String key:hashMap.keySet()) { -// main.put(key, hashMap.get(key)); -// } -// jsonObjectUser.put("main", main); hashMap.put("appName","数智中台"); hashMap.put("appCode","800004"); hashMap.put("mdmCode", mdmCode); hashMap.put("optionName", "数智中台"); jsonStr.put("jsonStr", hashMap); - Object result = comparisonServiceimpl.saveEntity(jsonStr); - logger.info("新增结果为:{}", JSON.toJSONString(result)); -// if(!result.isFlag()){ -// throw new BaseSystemException("主数据保存失败"+ result.getMsg()); -// } + 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)); -// if(!result.isFlag()){ -// //throw new BaseSystemException("主数据更新失败"+ result.getMsg()); -// } + result.add(object); } } - return null; + }catch (Exception e){ + logger.info("将数据查询之后进行组装调用通用方法错误:{}",e.getMessage()); + e.printStackTrace(); + } + return null; } } diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/ICtpAttachmentDao.java b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/ICtpAttachmentDao.java index fe2503ea..f90cd9b9 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/ICtpAttachmentDao.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/ICtpAttachmentDao.java @@ -4,4 +4,34 @@ import com.hzya.frame.basedao.dao.IBaseDao; import com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity; public interface ICtpAttachmentDao extends IBaseDao { + + /** + * + * @content 根据附件id查询附件信息 + * @Param + * @Return + * @Author hecan + * @Date 2025-01-15 14:08 + * **/ + CtpAttachmentEntity queryCtpAttachmentEntity(CtpAttachmentEntity entity); + + /** + * + * @content 新增 + * @Param + * @Return + * @Author hecan + * @Date 2025-01-15 14:46 + * **/ + CtpAttachmentEntity saveCtpAttachmentEntity(CtpAttachmentEntity entity); + + /** + * + * @content 更新 + * @Param + * @Return + * @Author hecan + * @Date 2025-01-15 14:47 + * **/ + Integer updateCtpAttachmentEntity(CtpAttachmentEntity entity); } diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/impl/CtpAttachmentDaoImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/impl/CtpAttachmentDaoImpl.java index 4661361b..87721574 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/impl/CtpAttachmentDaoImpl.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/impl/CtpAttachmentDaoImpl.java @@ -1,5 +1,6 @@ package com.hzya.frame.sysnew.comparison.serviceData.dao.impl; +import com.baomidou.dynamic.datasource.annotation.DS; 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; @@ -8,4 +9,21 @@ import org.springframework.stereotype.Repository; @Repository(value = "CtpAttachmentDaoImpl") public class CtpAttachmentDaoImpl extends MybatisGenericDao implements ICtpAttachmentDao { + @DS("#entity.dataSourceCode") + @Override + public CtpAttachmentEntity queryCtpAttachmentEntity(CtpAttachmentEntity entity) { + return (CtpAttachmentEntity) super.selectOne("queryCtpAttachmentEntity",entity); + } + + @DS("#entity.dataSourceCode") + @Override + public CtpAttachmentEntity saveCtpAttachmentEntity(CtpAttachmentEntity entity) { + return super.save("saveCtpAttachmentEntity",entity); + } + + @DS("#entity.dataSourceCode") + @Override + public Integer updateCtpAttachmentEntity(CtpAttachmentEntity entity) { + return super.update("updateCtpAttachmentEntity",entity); + } } diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/CtpAttachmentEntity.xml b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/CtpAttachmentEntity.xml index 60e32bb5..81b71307 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/CtpAttachmentEntity.xml +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/CtpAttachmentEntity.xml @@ -41,8 +41,19 @@ + + + - + insert into CTP_ATTACHMENT( id, @@ -76,7 +87,7 @@ - + update CTP_ATTACHMENT set sub_reference = #{sub_reference}, diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/ServiceDataEntity.java b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/ServiceDataEntity.java index 9f72712a..3281f97e 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/ServiceDataEntity.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/ServiceDataEntity.java @@ -16,7 +16,7 @@ public class ServiceDataEntity extends BaseEntity { private String receipt;//电子回单值 private String billCode;//单据编号 - private String summary_id;//summary_id + private String summaryId;//summaryId private String bipAmountField;//BIP打款金额字段 private String bipAmount;//BIP打款金额 @@ -37,12 +37,12 @@ public class ServiceDataEntity extends BaseEntity { this.bipAmount = bipAmount; } - public String getSummary_id() { - return summary_id; + public String getSummaryId() { + return summaryId; } - public void setSummary_id(String summary_id) { - this.summary_id = summary_id; + public void setSummaryId(String summaryId) { + this.summaryId = summaryId; } public String getTabName() { diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/ServiceDataEntity.xml b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/ServiceDataEntity.xml index 8f5fa7e4..fd6ee872 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/ServiceDataEntity.xml +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/entity/ServiceDataEntity.xml @@ -22,7 +22,7 @@ ,receipt_filed as receiptFiled ,receipt as receipt ,vdef1 as billCode - ,summary_id + ,summary_id as summaryId ,bip_payment_number_field as bipPaymentNumberField ,bip_payment_number as bipPaymentNumber ,bip_amount_field as bipAmountField @@ -90,7 +90,7 @@ update ${tabName} set - ${payDateFiled} = #{payDate}, + ${payDateFiled} = to_date(#{payDate},'YYYY-MM-DD HH24:MI:SS'), ${bipAmountField} = #{bipAmount}, ${payResultFiled} = #{payResult} @@ -100,7 +100,7 @@ update ${tabName} set - set ${receiptFiled} = #{receipt} + ${receiptFiled} = #{receipt} where id=#{id} diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/service/impl/ServiceDataServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/service/impl/ServiceDataServiceImpl.java index 096ecf33..08ee168c 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/service/impl/ServiceDataServiceImpl.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/service/impl/ServiceDataServiceImpl.java @@ -197,38 +197,46 @@ public class ServiceDataServiceImpl extends BaseService String file_url = jsonObject.getString("fileUrl"); CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity(); ctpAttachmentEntity.setFile_url(file_url); - String att_reference = serviceDataEntity.getSummary_id();//Summary_id + String att_reference = serviceDataEntity.getSummaryId();//Summary_id + logger.info("==========oa_id:{}的表单的Summary_id值为:{}",serviceDataEntity.getId(),att_reference); ctpAttachmentEntity.setSub_reference(sub_reference); ctpAttachmentEntity.setAtt_reference(att_reference); + ctpAttachmentEntity.setDataSourceCode(serviceDataEntity.getDataSourceCode()); List ctpAttachmentEntityListBase = ctpAttachmentDao.query(ctpAttachmentEntity); + logger.info("====根据附件id:{}查询出来在CTP_ATTACHMENT表中的数据有:{}条",file_url,ctpAttachmentEntityListBase.size()); + CtpAttachmentEntity ctpAttachment = ctpAttachmentDao.queryCtpAttachmentEntity(ctpAttachmentEntity); + logger.info("====根据附件id:{}查询在CTP_file表中的文件名称为",file_url,ctpAttachment.getFilename()); //如果没有查询到数据,就新增附件业务,否则更新 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附件新增成功"); + if(null !=ctpAttachment) { + String type =ctpAttachment.getType(); + String filename = ctpAttachment.getFilename(); + String mime_type =ctpAttachment.getMime_type(); + String attachment_size = ctpAttachment.getAttachment_size(); + String id = String.valueOf(UUIDLong.longUUID()); + ctpAttachmentEntity.setCategory("66"); + ctpAttachmentEntity.setFilename(filename); + ctpAttachmentEntity.setType(type); + ctpAttachmentEntity.setMime_type(mime_type); + ctpAttachmentEntity.setAttachment_size(attachment_size); + ctpAttachmentEntity.setId(id); + ctpAttachmentEntity.setCreatedate(new Date()); + ctpAttachmentEntity.setDataSourceCode(serviceDataEntity.getDataSourceCode()); + ctpAttachmentDao.saveCtpAttachmentEntity(ctpAttachmentEntity); + logger.info("OA附件新增成功"); + }else{ + logger.info("======根据附件id:{}查询在CTP_file表中不存在======"); + } } else { if (ctpAttachmentEntityListBase.size() > 1) { throw new BaseSystemException("OA附件业务表中查到多条记录"); } //更新数据到OA附件业务表中 - ctpAttachmentDao.save(ctpAttachmentEntity); + ctpAttachmentDao.updateCtpAttachmentEntity(ctpAttachmentEntity); logger.info("OA附件更新成功"); } } + return BaseResult.getSuccessMessageEntity("电子回单更新成功"); } } } @@ -296,7 +304,7 @@ public class ServiceDataServiceImpl extends BaseService "push_status_field,summary_id,bip_payment_number_field,bip_amount_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 and applysum >0"); + "vdef7,vdef8,vdef9,vdef21,vdef11,vdef17,vdef20 from v_cmp_apply where 1=1 and vdef1 is not null and push_status is null and applysum >0"); mdmModuleSourceEntity.setDataSourceCode(dbCode); List> hashMaps = serviceDataDao.queryListBySWSource(stringBuffer.toString(), mdmModuleSourceEntity); int i = 0; @@ -312,8 +320,8 @@ public class ServiceDataServiceImpl extends BaseService vdef1=cmp_apply.getString("vdef1"); StringBuffer stringBufferDetails = new StringBuffer(); 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+"' " ); + "pk_supplier,pk_bankacc_r,customer,pk_currtype,pk_decidedept,gllcrate,applysum,applymny,vdef1,pk_project,vdef2,vdef3,\n" + + "vdef4,vdef10,vdef14 from v_cmp_apply_b where formmain_id= '"+formmainId+"' " ); List> hashMapsDetails = serviceDataDao.queryListBySWSource(stringBufferDetails.toString(),mdmModuleSourceEntity); JSONArray cmp_apply_b = new JSONArray(); if(CollectionUtils.isNotEmpty(hashMapsDetails)){ diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/entity/IntegrationTaskLivingDetailsEntity.xml b/base-service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/entity/IntegrationTaskLivingDetailsEntity.xml index fb8310d6..bcf014cd 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/entity/IntegrationTaskLivingDetailsEntity.xml +++ b/base-service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/entity/IntegrationTaskLivingDetailsEntity.xml @@ -671,8 +671,8 @@ update integration_task_living_details set sts= 'N' ,modify_time = #{modify_tim and repair_pust like concat('%',#{repair_pust},'%') and sence_id like concat('%',#{sence_id},'%') - and plugin_id like concat(#{plugin_id},'%') - and new_state like concat(#{new_state},'%') + and plugin_id = #{plugin_id} + and new_state = #{new_state} and create_time like concat('%',#{create_time},'%') and create_user_id like concat('%',#{create_user_id},'%')