diff --git a/base-buildpackage/pom.xml b/base-buildpackage/pom.xml index 8b09a3b0..de11141c 100644 --- a/base-buildpackage/pom.xml +++ b/base-buildpackage/pom.xml @@ -56,6 +56,12 @@ hclocal + + xel + + xel + + kangarooDataCenterV3 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 33bdf4b8..87dfb6b9 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 @@ -185,7 +185,9 @@ public class SendContractPluginInitializer extends PluginBaseEntity { billhead.put("pk_group","SW01"); billhead.put("pk_org","666"); billhead.put("project_code",sendContractEntity.getProjectCode()); - billhead.put("project_name",sendContractEntity.getProjectName()); + //billhead.put("project_name",sendContractEntity.getProjectName()); + //2025年6月6日17:46:45 相二林修改, 三维通信BIP-致远OA接口群 胡飞洲让改的 + billhead.put("project_name",sendContractEntity.getProjectCode()); billhead.put("def1",sendContractEntity.getKhcode());//BIP客户编码 bill.put("billhead",billhead); ufinterface.put("bill",bill); diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/dao/IC4ProjectDao.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/dao/IC4ProjectDao.java new file mode 100644 index 00000000..95bafff3 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/dao/IC4ProjectDao.java @@ -0,0 +1,29 @@ +package com.hzya.frame.plugin.c4project.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.plugin.c4project.entity.C4ProjectEntity; + +import java.util.List; + +public interface IC4ProjectDao extends IBaseDao { + + /** + * + * @content 查询研发项目立项数据推送C4项目档案 + * @Param + * @Return + * @Author hecan + * @Date 2025-05-14 11:48 + * **/ + List queryProjectToC4(C4ProjectEntity entity); + + /** + * + * @content 新增数据到C4项目档案 + * @Param + * @Return + * @Author hecan + * @Date 2025-05-14 11:53 + * **/ + Integer saveC4Project(C4ProjectEntity entity); +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/dao/impl/C4ProjectDaoImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/dao/impl/C4ProjectDaoImpl.java new file mode 100644 index 00000000..c22e5e03 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/dao/impl/C4ProjectDaoImpl.java @@ -0,0 +1,22 @@ +package com.hzya.frame.plugin.c4project.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.plugin.c4project.dao.IC4ProjectDao; +import com.hzya.frame.plugin.c4project.entity.C4ProjectEntity; + +import java.util.List; + +public class C4ProjectDaoImpl extends MybatisGenericDao implements IC4ProjectDao { + @DS("#entity.dataSourceCode") + @Override + public List queryProjectToC4(C4ProjectEntity entity) { + return (List) super.selectList("queryProjectToC4",entity); + } + + @DS("#entity.dataSourceCode") + @Override + public Integer saveC4Project(C4ProjectEntity entity) { + return super.insert("saveC4Project",entity); + } +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/entity/C4ProjectEntity.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/entity/C4ProjectEntity.java new file mode 100644 index 00000000..60dd6f1f --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/entity/C4ProjectEntity.java @@ -0,0 +1,142 @@ +package com.hzya.frame.plugin.c4project.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +public class C4ProjectEntity extends BaseEntity { + private String caNo;//项目编号 + private String caName;//项目名称 + private String caTypenm;//项目类型 + private String caManagernm;//项目负责人 + private String caBegindate;//项目开始时间 + private String caEnddate;//项目结束时间 + private String caBudgetamt;//项目预算总额 + private String caBudgetorg;//公司id + private String caBudgetornm;//公司名称 + private String caFathernm;//项目档案 + private String caFactmat;//项目实际到账额 + private String caCoveramt;//项目实际报销额 + private String caFulllevelno;// + private String startTime;//开始时间 + private String endTime;//结束时间 + + + public String getCaBudgetorg() { + return caBudgetorg; + } + + public void setCaBudgetorg(String caBudgetorg) { + this.caBudgetorg = caBudgetorg; + } + + public String getCaBudgetornm() { + return caBudgetornm; + } + + public void setCaBudgetornm(String caBudgetornm) { + this.caBudgetornm = caBudgetornm; + } + + public String getCaFathernm() { + return caFathernm; + } + + public void setCaFathernm(String caFathernm) { + this.caFathernm = caFathernm; + } + + public String getCaFactmat() { + return caFactmat; + } + + public void setCaFactmat(String caFactmat) { + this.caFactmat = caFactmat; + } + + public String getCaCoveramt() { + return caCoveramt; + } + + public void setCaCoveramt(String caCoveramt) { + this.caCoveramt = caCoveramt; + } + + public String getCaFulllevelno() { + return caFulllevelno; + } + + public void setCaFulllevelno(String caFulllevelno) { + this.caFulllevelno = caFulllevelno; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getCaNo() { + return caNo; + } + + public void setCaNo(String caNo) { + this.caNo = caNo; + } + + public String getCaName() { + return caName; + } + + public void setCaName(String caName) { + this.caName = caName; + } + + public String getCaTypenm() { + return caTypenm; + } + + public void setCaTypenm(String caTypenm) { + this.caTypenm = caTypenm; + } + + public String getCaManagernm() { + return caManagernm; + } + + public void setCaManagernm(String caManagernm) { + this.caManagernm = caManagernm; + } + + public String getCaBegindate() { + return caBegindate; + } + + public void setCaBegindate(String caBegindate) { + this.caBegindate = caBegindate; + } + + public String getCaEnddate() { + return caEnddate; + } + + public void setCaEnddate(String caEnddate) { + this.caEnddate = caEnddate; + } + + public String getCaBudgetamt() { + return caBudgetamt; + } + + public void setCaBudgetamt(String caBudgetamt) { + this.caBudgetamt = caBudgetamt; + } +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/entity/C4ProjectEntity.xml b/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/entity/C4ProjectEntity.xml new file mode 100644 index 00000000..93e4590a --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/entity/C4ProjectEntity.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + main.id as id, + main.MODIFY_DATE as MODIFY_DATE, + 'formmain_9555' as tab_name, + field0047 as caNo, + field0012 as caName, + field0080 as caTypenm, + ORG_MEMBER.name as caManagernm, + field0044 as caBegindate, + field0045 as caEnddate, + field0077 as caBudgetamt, + '670869647114347' as caBudgetorg, + '三维通信股份有限公司' as caBudgetornm, + '项目档案' as caFathernm, + '0' as caFactmat, + '0' as caCoveramt + + + + + + + + insert into LEXMISC4_case( + + CA_BUDGETORG , + CA_BUDGETORGNM , + CA_NO , + CA_NAME , + CA_TYPENM , + CA_MANAGERNM , + CA_BEGINDATE , + CA_ENDDATE , + CA_FATHERNM , + CA_BUDGETAMT , + CA_FACTAMT , + CA_COVERAMT , + CA_FULLLEVELNO + + )values( + + #{caBudgetorg} , + #{caBudgetornm} , + #{caNo} , + #{caName} , + #{caTypenm} , + #{caManagernm} , + TO_TIMESTAMP(#{caBegindate}, 'SYYYY-MM-DD HH24:MI:SS:FF6') , + TO_TIMESTAMP(#{caEnddate}, 'SYYYY-MM-DD HH24:MI:SS:FF6') , + #{caFathernm} , + #{caBudgetamt} , + #{caFactmat} , + #{caCoveramt} , + #{caFulllevelno} + + ) + + + + + diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/plugin/C4ProjectPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/plugin/C4ProjectPluginInitializer.java new file mode 100644 index 00000000..af0372ba --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/c4project/plugin/C4ProjectPluginInitializer.java @@ -0,0 +1,124 @@ +package com.hzya.frame.plugin.c4project.plugin; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.c4project.dao.IC4ProjectDao; +import com.hzya.frame.plugin.c4project.dao.impl.C4ProjectDaoImpl; +import com.hzya.frame.plugin.c4project.entity.C4ProjectEntity; +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 java.util.Date; +import java.util.List; + +public class C4ProjectPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(C4ProjectPluginInitializer.class); + + @Autowired + private IC4ProjectDao ic4ProjectDao; + + @Autowired + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "C4ProjectPluginInitializer"; + } + + @Override + public String getPluginName() { + return "研发项目立项生成C4项目档案"; + } + + @Override + public String getPluginLabel() { + return "C4ProjectPluginInitializer"; + } + + @Override + public String getPluginType() { + return "1"; + } + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + try { + String startTime = DateUtil.format(requestJson.getDate("startTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间 + String endTime = DateUtil.format(requestJson.getDate("endTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间 + logger.info("=======研发项目立项推送C4项目档案的开始时间为:{}=======",startTime); + logger.info("=======研发项目立项推送C4项目档案的结束时间为:{}=======",endTime); + if(StrUtil.isEmpty(startTime)){ + DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"); + } + + logger.info("=======在:{}时间查询研发项目立项推送C4项目档案=======",startTime); + C4ProjectEntity c4ProjectEntity=new C4ProjectEntity(); + c4ProjectEntity.setStartTime(startTime); + c4ProjectEntity.setDataSourceCode("SW-OA"); + List c4ProjectEntities = ic4ProjectDao.queryProjectToC4(c4ProjectEntity); + if(c4ProjectEntities == null || c4ProjectEntities.size() == 0){ + logger.info("=====查询研发项目立项推送C4项目档案数据有:{}条",c4ProjectEntities.size()); + return BaseResult.getSuccessMessageEntity("查询成功"); + } + for (C4ProjectEntity projectEntity : c4ProjectEntities) { + projectEntity.setDataSourceCode("SW-OA"); + projectEntity.setCaFulllevelno("@"+projectEntity.getCaNo()+"@"); + projectEntity.setCaTypenm(projectEntity.getCaTypenm()==null?"项目类型":projectEntity.getCaTypenm()); + logger.info("======开始将项目编号:{},项目名称:{}新增到C4项目档案中=======",projectEntity.getCaNo(),projectEntity.getCaName()); + Integer integer = ic4ProjectDao.saveC4Project(projectEntity); + logger.info("======将项目编号:{},项目名称:{}新增到C4项目档案中完毕=======",projectEntity.getCaNo(),projectEntity.getCaName()); + saveTaskLivingDetails(projectEntity.getId(),projectEntity.getCaNo(),JSONObject.parseObject(projectEntity.toString()).toJSONString(),String.valueOf(integer),true); + } + logger.info("=======研发项目立项推送C4项目档案执行成功======="); + return BaseResult.getSuccessMessageEntity("研发项目立项推送C4项目档案执行成功"); + }catch (Exception e){ + logger.info("========研发项目立项推送C4项目档案失败,:{}",e.getMessage()); + e.printStackTrace(); + } + return BaseResult.getFailureMessageEntity("研发项目立项推送C4项目档案执行成功"); + } + + 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("C4ProjectPluginInitializer"); + 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/mdmDistribute/plugin/MdmModulePluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java index 2a84c1a3..62d9cb44 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 @@ -743,7 +743,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { map1.put("tableName",mainDb); //map1.put("dataStatus", "F"); map1.put("updateStatus", "0"); - map1.put("size", 50); + //map1.put("size", 50); objects = mdmModuleDao.queryMdmSTs(map1); objects = toLowerCaseKeys(objects); @@ -892,16 +892,30 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { 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"); + logger.info("=========主数据修改下发成功,修改下发状态为成功======"); + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + //updateMap.put("dataStatus", "F"); + updateMap.put("updateStatus", "1"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); 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(),"2"); + logger.info("=========主数据修改下发失败,修改下发状态为失败======"); + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + //updateMap.put("dataStatus", "F"); + updateMap.put("updateStatus", "2"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); continue; } } } - //所有下发发送完成,修改数据状态 + /* //所有下发发送完成,修改数据状态 for (int i = 0; i < objects.size(); i++) { Map updateMap = new HashMap<>(); updateMap.put("tableName",mainDb); @@ -909,7 +923,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { updateMap.put("updateStatus", "1"); updateMap.put("id", objects.get(i).getString("id")); mdmModuleDao.updateMdmSTs(updateMap); - } + }*/ } /** @@ -937,7 +951,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { map1.put("tableName",mainDb); //map1.put("dataStatus", "Y"); map1.put("addStatus", "0"); - map1.put("size", 50); + //map1.put("size", 50); objects = mdmModuleDao.queryMdmSTs(map1); objects = toLowerCaseKeys(objects); @@ -1129,6 +1143,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId()); mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId")); mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity); + logger.info("=========主数据下发成功,修改下发状态为成功======"); + 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("=========主数据下发失败,修改下发状态为失败======"); + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + //updateMap.put("dataStatus", "Y"); + updateMap.put("addStatus", "2"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); } } } catch (Exception e) { @@ -1147,12 +1176,19 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { 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("========主数据新增下发完成,日志保存为失败============"); + logger.info("=========主数据下发失败,修改下发状态为失败======"); + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + //updateMap.put("dataStatus", "Y"); + updateMap.put("addStatus", "2"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); continue; } } } - //所有下发发送完成,修改数据状态 + /* //所有下发发送完成,修改数据状态 for (int i = 0; i < objects.size(); i++) { if(objects.get(i).getBoolean("sendsanfzt123")){ Map updateMap = new HashMap<>(); @@ -1162,7 +1198,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { updateMap.put("id", objects.get(i).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/java/com/hzya/frame/plugin/projectMainFlow/entity/ProjectMainFlowEntity.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/entity/ProjectMainFlowEntity.java index 4c21783f..63161603 100644 --- 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 @@ -36,6 +36,24 @@ public class ProjectMainFlowEntity extends BaseEntity { private String archivistStatus;//归档推送状态 private String def8;//完工服务额 private String def7;//J审定服务金额 + private String def9;//D分包施工费率 + private String def10;//D辅材费率 + + public String getDef9() { + return def9; + } + + public void setDef9(String def9) { + this.def9 = def9; + } + + public String getDef10() { + return def10; + } + + public void setDef10(String def10) { + this.def10 = def10; + } public String getDef8() { return def8; 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 index 29ffca4c..a9bbd4d6 100644 --- 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 @@ -48,6 +48,8 @@ ,field0428 as auditResult -- 审定推送结果 ,field0426 as archivistResult -- 归档推送结果 ,field0425 as archivistStatus -- 归档推送状态 + ,field0032 as def9 -- D分包施工费率 + ,field0033 as def10 -- D辅材费率 @@ -64,6 +66,7 @@ WHERE 1=1 and CTP_AFFAIR.node_policy = '审计完成' AND CTP_AFFAIR.complete_time is not null and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0427 is null + and rownum < 100 -- and field0274 in ('浙S-QZWLJS2402YXZ001-05','浙S-QZWLJS2402YXZ001-04','浙D-NB2412TH15001') and id = #{id} @@ -82,7 +85,8 @@ LEFT JOIN org_member m4 ON m4.id=field0081 WHERE 1=1 and CTP_AFFAIR.node_policy = '归档' AND CTP_AFFAIR.complete_time is not null - and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0425 is null and formmain_0219.id='4000079310249084585' + and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0425 is null + and rownum < 100 -- and field0274 in ('浙S-QZWLJS2402YXZ001-05','浙S-QZWLJS2402YXZ001-04','浙D-NB2412TH15001') and 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 index 9585fe46..beffe79b 100644 --- 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 @@ -110,7 +110,7 @@ public class ProjectMainFlowArchivistPluginInitializer extends PluginBaseEntity //发送数据 String result = HttpRequest.post(url). header("appId", "800050"). - header("apiCode", "8000500016"). + header("apiCode", "8000500011"). header("access_token", tokenBody). header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj"). header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="). @@ -184,6 +184,8 @@ public class ProjectMainFlowArchivistPluginInitializer extends PluginBaseEntity htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6()); htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7()); htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8()); + htdd01slave4_htdd01slave4.put("def9",projectMainFlowEntity.getDef9()); + htdd01slave4_htdd01slave4.put("def10",projectMainFlowEntity.getDef10()); jsonArray.add(htdd01slave4_htdd01slave4); bill.put("htdd01Master",htdd01Master); bill.put("htdd01slave4_htdd01slave4",jsonArray); 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 index 1ba41d6f..2368abbb 100644 --- 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 @@ -111,7 +111,7 @@ public class ProjectMainFlowAuditPluginInitializer extends PluginBaseEntity { //发送数据 String result = HttpRequest.post(url). header("appId", "800050"). - header("apiCode", "8000500016"). + header("apiCode", "8000500011"). header("access_token", tokenBody). header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj"). header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="). @@ -176,6 +176,8 @@ public class ProjectMainFlowAuditPluginInitializer extends PluginBaseEntity { htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6()); htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7()); htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8()); + htdd01slave4_htdd01slave4.put("def9",projectMainFlowEntity.getDef9()); + htdd01slave4_htdd01slave4.put("def10",projectMainFlowEntity.getDef10()); jsonArray.add(htdd01slave4_htdd01slave4); bill.put("htdd01Master",htdd01Master); bill.put("htdd01slave4_htdd01slave4",jsonArray); diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/dao/ISalesContractDao.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/dao/ISalesContractDao.java new file mode 100644 index 00000000..46d1d990 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/dao/ISalesContractDao.java @@ -0,0 +1,59 @@ +package com.hzya.frame.plugin.salesContract.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity; + +import java.util.List; + +public interface ISalesContractDao extends IBaseDao { + + /** + * + * @content 查询未推送的销售合同 + * @Param + * @Return + * @Author hecan + * @Date 2025-04-03 11:07 + * **/ + List querySalesContract(SalesContractEntity salesContractEntity); + + /** + * + * @content 更新销售合同的推送标识 + * @Param + * @Return + * @Author hecan + * @Date 2025-04-03 11:09 + * **/ + Integer updateSalesContract(SalesContractEntity entity); + + /** + * + * @content 查询未上传文件的销售合同 + * @Param + * @Return + * @Author hecan + * @Date 2025-04-16 14:40 + * **/ + List queryContractAnnexFile(SalesContractEntity salesContractEntity); + + /** + * + * @content 查询未上传文件的销售合同IPO附件 + * @Param + * @Return + * @Author hecan + * @Date 2025-04-16 14:40 + * **/ + List queryIPOAnnexFile(SalesContractEntity salesContractEntity); + + /** + * + * @content 更新销售合同附件和ipo附件上传标识 + * @Param + * @Return + * @Author hecan + * @Date 2025-04-16 16:48 + * **/ + Integer updateAnnexFile(SalesContractEntity entity); +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/dao/impl/SalesContractDaoImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/dao/impl/SalesContractDaoImpl.java new file mode 100644 index 00000000..e2d91427 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/dao/impl/SalesContractDaoImpl.java @@ -0,0 +1,40 @@ +package com.hzya.frame.plugin.salesContract.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.plugin.salesContract.dao.ISalesContractDao; +import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity; + +import java.util.List; + +public class SalesContractDaoImpl extends MybatisGenericDao implements ISalesContractDao { + @DS("#entity.dataSourceCode") + @Override + public List querySalesContract(SalesContractEntity entity) { + return (List) super.selectList("querySalesContract",entity); + } + + @DS("#entity.dataSourceCode") + @Override + public Integer updateSalesContract(SalesContractEntity entity) { + return super.update("updateSalesContract",entity); + } + + @DS("#entity.dataSourceCode") + @Override + public List queryContractAnnexFile(SalesContractEntity entity) { + return (List) super.selectList("queryContractAnnexFile",entity); + } + + @DS("#entity.dataSourceCode") + @Override + public List queryIPOAnnexFile(SalesContractEntity entity) { + return (List) super.selectList("queryIPOAnnexFile",entity); + } + + @DS("#entity.dataSourceCode") + @Override + public Integer updateAnnexFile(SalesContractEntity entity) { + return super.update("updateAnnexFile",entity); + } +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/entity/SalesContractEntity.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/entity/SalesContractEntity.java new file mode 100644 index 00000000..f4357660 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/entity/SalesContractEntity.java @@ -0,0 +1,402 @@ +package com.hzya.frame.plugin.salesContract.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +public class SalesContractEntity extends BaseEntity { + private String pkGroup;//集团编码 + private String pkOrg;//公司编码 + private String contractno;//合同号 + private String contractName;//合同名称 + private String creator;//创建人用户 + private String creationtime;//创建时间 + private String contractor;//订单负责人名称 + private String cdeptid;//事业部 + private String approvestatus;//审批状态默认-1 + private String belongtodeptid;//单据归属部门 + private String dpk_custclass;//合同对应客户大类 + private String dcustomerid;//合同对应客户大类 + private String zcustomerid;// + private String cinvoicecustid;//开票客户名称 + private String cemployeeid;//业务人员 + private String ccurrencyid;//币种 + private String totalamount;//原币总金额 + private String rmbtotalamount;//人民币总金额 + private String presentrate;//汇率 CPO汇率 + private String def13;//IPO合同号 + private String def16;//IPO汇率 + private String def8;//贸易方式 + private String def27;//IPO币种 + private String def17;//收款账期 + private String def18;//账簿本币金额 + private String def26;//当前账簿兑人民币汇率 + private String pushStatus;//推送标识 + private String billdate;//申请日期 + private String custbillno;//CPO订单编码 + private String placementdate;//CPO下达日期 + private String country;//国家地区编码 + private String vnote;//备注 + private String def9;//合同类型 + private String def2;//合同性质 + private String def41;//单据归属区域 + private String billid;//单据主键 + private String billtype;//单据类型 + private String billcode;//单据号 + private String ipofilename;//ipo附件 文件名称 + private String htnrfilename;//合同内容附件 文件名称 + private String htnrid;//合同内容附件id + private String ipoid;//IPO附件id + private String htnrpush;//合同附件上传标识 + private String ipopush;//ipo附件上传标识 + + public String getHtnrpush() { + return htnrpush; + } + + public void setHtnrpush(String htnrpush) { + this.htnrpush = htnrpush; + } + + public String getIpopush() { + return ipopush; + } + + public void setIpopush(String ipopush) { + this.ipopush = ipopush; + } + + public String getHtnrid() { + return htnrid; + } + + public void setHtnrid(String htnrid) { + this.htnrid = htnrid; + } + + public String getIpoid() { + return ipoid; + } + + public void setIpoid(String ipoid) { + this.ipoid = ipoid; + } + + public String getBillid() { + return billid; + } + + public void setBillid(String billid) { + this.billid = billid; + } + + public String getBilltype() { + return billtype; + } + + public void setBilltype(String billtype) { + this.billtype = billtype; + } + + public String getBillcode() { + return billcode; + } + + public void setBillcode(String billcode) { + this.billcode = billcode; + } + + public String getIpofilename() { + return ipofilename; + } + + public void setIpofilename(String ipofilename) { + this.ipofilename = ipofilename; + } + + public String getHtnrfilename() { + return htnrfilename; + } + + public void setHtnrfilename(String htnrfilename) { + this.htnrfilename = htnrfilename; + } + + public String getCustbillno() { + return custbillno; + } + + public void setCustbillno(String custbillno) { + this.custbillno = custbillno; + } + + public String getPlacementdate() { + return placementdate; + } + + public void setPlacementdate(String placementdate) { + this.placementdate = placementdate; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public String getVnote() { + return vnote; + } + + public void setVnote(String vnote) { + this.vnote = vnote; + } + + public String getDef9() { + return def9; + } + + public void setDef9(String def9) { + this.def9 = def9; + } + + public String getDef2() { + return def2; + } + + public void setDef2(String def2) { + this.def2 = def2; + } + + public String getDef41() { + return def41; + } + + public void setDef41(String def41) { + this.def41 = def41; + } + + public String getBilldate() { + return billdate; + } + + public void setBilldate(String billdate) { + this.billdate = billdate; + } + + public String getPushStatus() { + return pushStatus; + } + + public void setPushStatus(String pushStatus) { + this.pushStatus = pushStatus; + } + + 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 getContractor() { + return contractor; + } + + public void setContractor(String contractor) { + this.contractor = contractor; + } + + public String getCdeptid() { + return cdeptid; + } + + public void setCdeptid(String cdeptid) { + this.cdeptid = cdeptid; + } + + public String getApprovestatus() { + return approvestatus; + } + + public void setApprovestatus(String approvestatus) { + this.approvestatus = approvestatus; + } + + public String getBelongtodeptid() { + return belongtodeptid; + } + + public void setBelongtodeptid(String belongtodeptid) { + this.belongtodeptid = belongtodeptid; + } + + public String getDpk_custclass() { + return dpk_custclass; + } + + public void setDpk_custclass(String dpk_custclass) { + this.dpk_custclass = dpk_custclass; + } + + public String getDcustomerid() { + return dcustomerid; + } + + public void setDcustomerid(String dcustomerid) { + this.dcustomerid = dcustomerid; + } + + public String getZcustomerid() { + return zcustomerid; + } + + public void setZcustomerid(String zcustomerid) { + this.zcustomerid = zcustomerid; + } + + public String getCinvoicecustid() { + return cinvoicecustid; + } + + public void setCinvoicecustid(String cinvoicecustid) { + this.cinvoicecustid = cinvoicecustid; + } + + public String getCemployeeid() { + return cemployeeid; + } + + public void setCemployeeid(String cemployeeid) { + this.cemployeeid = cemployeeid; + } + + public String getCcurrencyid() { + return ccurrencyid; + } + + public void setCcurrencyid(String ccurrencyid) { + this.ccurrencyid = ccurrencyid; + } + + public String getTotalamount() { + return totalamount; + } + + public void setTotalamount(String totalamount) { + this.totalamount = totalamount; + } + + public String getRmbtotalamount() { + return rmbtotalamount; + } + + public void setRmbtotalamount(String rmbtotalamount) { + this.rmbtotalamount = rmbtotalamount; + } + + public String getPresentrate() { + return presentrate; + } + + public void setPresentrate(String presentrate) { + this.presentrate = presentrate; + } + + public String getDef13() { + return def13; + } + + public void setDef13(String def13) { + this.def13 = def13; + } + + public String getDef16() { + return def16; + } + + public void setDef16(String def16) { + this.def16 = def16; + } + + public String getDef8() { + return def8; + } + + public void setDef8(String def8) { + this.def8 = def8; + } + + public String getDef27() { + return def27; + } + + public void setDef27(String def27) { + this.def27 = def27; + } + + public String getDef17() { + return def17; + } + + public void setDef17(String def17) { + this.def17 = def17; + } + + public String getDef18() { + return def18; + } + + public void setDef18(String def18) { + this.def18 = def18; + } + + public String getDef26() { + return def26; + } + + public void setDef26(String def26) { + this.def26 = def26; + } +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/entity/SalesContractEntity.xml b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/entity/SalesContractEntity.xml new file mode 100644 index 00000000..f666d829 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/entity/SalesContractEntity.xml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + formmain_8694.id as id, + 'SW01' as pkGroup, -- 集团编码 + field0132 as pkOrg, -- 公司编码 + field0009 as contractno, -- 合同号 + field0010 as contractName, -- 合同名称 + 'field0146' as pushStatusFiald, -- 推送标识字段 + field0146 as pushStatus, -- 推送标识 + 'OA' as creator, -- 创建人用户 + to_char(field0007,'yyyy-MM-dd HH24:mi:ss') as creationtime, -- 创建时间 + to_char(field0007,'yyyy-MM-dd') as billdate, -- 申请日期 + field0144 as contractor, -- 订单负责人名称 + '' as cdeptid, -- 事业部 + '-1' as approvestatus, -- 审批状态默认 + field0152 as belongtodeptid, -- 单据归属部门 + '' as dpk_custclass, -- 合同对应客户大类 + field0133 as dcustomerid, -- 合同对应客户大类 + '' as zcustomerid, + '' as cinvoicecustid, -- 开票客户名称 + field0145 as cemployeeid, -- 业务人员 + field0143 as ccurrencyid, -- 币种 + field0012 as totalamount, -- 原币总金额 + '' as rmbtotalamount, -- 人民币总金额 + '' as presentrate, -- 汇率 + field0148 as def13, -- IPO合同号 + '' as def16, -- IPO汇率 + myfs.SORTNUMBER as def8, -- 贸易方式 + '' as def27, -- IPO币种 + skzq.SORTNUMBER as def17, -- 收款账期 + '' as def18, -- 账簿本币金额 + '' as def26, -- 当前账簿兑人民币汇率 + field0147 as custbillno, -- CPO订单编码 + field0155 as placementdate, -- CPO下达日期 + field0151 as country, -- 国家地区编码 + '' as vnote, --备注 + field0140 as def9, -- 合同类型 + htxz.SORTNUMBER as def2, -- 合同性质 + djgsqy.SORTNUMBER as def41 -- 单据归属区域 + + + + + + + + + + + + + + update formmain_8694 set field0146 = #{pushStatus} where id = #{id} + + + + update formmain_8694 set + + field0154 = #{ipopush}, + field0153 = #{htnrpush} + + where id = #{id} + + + + + + diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/plugin/ContractAnnexFileUploadPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/plugin/ContractAnnexFileUploadPluginInitializer.java new file mode 100644 index 00000000..9498050e --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/plugin/ContractAnnexFileUploadPluginInitializer.java @@ -0,0 +1,255 @@ +package com.hzya.frame.plugin.salesContract.plugin; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.dateutil.DateUtil; +import com.hzya.frame.plugin.salesContract.dao.ISalesContractDao; +import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity; +import com.hzya.frame.seeyon.util.OARestUtil; +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.apache.commons.collections.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +import java.io.File; +import java.io.FileInputStream; +import java.util.Base64; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +public class ContractAnnexFileUploadPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(ContractAnnexFileUploadPluginInitializer.class); + + @Autowired + private ISalesContractDao salesContractDao; + + @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 "ContractAnnexFileUploadPluginInitializer"; + } + + @Override + public String getPluginName() { + return "销售合同附件上传"; + } + + @Override + public String getPluginLabel() { + return "ContractAnnexFileUploadPluginInitializer"; + } + + @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"); + //执行重新发送 + SalesContractEntity salesContractEntity = new SalesContractEntity(); + salesContractEntity.setDataSourceCode("SW-OA"); + if (StrUtil.isNotEmpty(id)) { + salesContractEntity.setId(id); + } + //查询未上传的数据 + List salesContractEntities = salesContractDao.queryContractAnnexFile(salesContractEntity); + if(salesContractEntities == null || salesContractEntities.size() == 0){ + logger.info("=====没有需要上传BIP的销售合同附件=========="); + return BaseResult.getSuccessMessageEntity("查询成功"); + } + JSONObject resultJson=null; + SalesContractEntity salesContract=new SalesContractEntity(); + salesContract.setDataSourceCode("SW-OA"); + for (SalesContractEntity contractEntity : salesContractEntities) { + if(null !=contractEntity.getHtnrfilename() && null==contractEntity.getHtnrpush()){ + contractEntity.setDataSourceCode("SW-OA"); + JSONArray jsonArray=new JSONArray(); + JSONObject jsonObject=new JSONObject(); + jsonObject.put("filename",contractEntity.getHtnrfilename()); + jsonObject.put("billtype",contractEntity.getBilltype()); + jsonObject.put("billid",contractEntity.getBillid()); + jsonObject.put("billcode",contractEntity.getBillcode()); + jsonObject.put("pk_org",contractEntity.getPkOrg()); + String file_url = contractEntity.getHtnrid(); + String newPath = "E:\\yongansystem\\upload\\reuce\\"+contractEntity.getHtnrfilename(); + downOaFile(file_url,contractEntity.getHtnrfilename(),newPath); + //本地文件转为base64 + String base64 = getBase64(newPath); + jsonObject.put("file",base64); + jsonArray.add(jsonObject); + resultJson = send(jsonArray, contractEntity); + logger.error("销售合同附件上传BIP返回结果:" + resultJson.toJSONString()); + salesContract.setId(contractEntity.getId()); + } + } + if(null !=resultJson ){ + if(!resultJson.getBoolean("flag")){ + logger.info("=========销售合同附件上传bip返回结果错误,开始修改销售合同附件上传推送标识为失败=========="); + salesContract.setHtnrpush("0"); + salesContractDao.updateAnnexFile(salesContract); + logger.info("=========销售合同附件上传获取bip返回结果错误,修改销售合同附件上传推送标识为失败完毕=========="); + // saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),false); + }else { + logger.info("=========销售合同附件上传bip返回结果成功,开始修改销售合同附件上传推送标识为成功=========="); + salesContract.setHtnrpush("1"); + salesContractDao.updateAnnexFile(salesContract); + logger.info("=========销售合同附件上传bip返回结果成功,修改销售合同附件上传推送标识为成功完毕=========="); + // saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),true); + } + }else{ + logger.info("=======没有销售合同附件上传BIP======="); + } + logger.info("=======销售合同附件上传BIP执行成功======="); + return BaseResult.getSuccessMessageEntity("销售合同附件上传执行成功"); + } + }catch (Exception e){ + logger.info("======执行销售合同附件上传BIP失败:{}========", e.getMessage()); + e.printStackTrace(); + } + return null; + } + + private void downOaFile(String fileUrl, String fileName,String newPath) { + logger.info("开始下载附件"+newPath); + String token = getToken(); + logger.info("获取的token信息"); + String baseUrl = "https://swoa.sunwave.com.cn:9999/seeyon/rest/attachment/file/"+fileUrl+"?fileName="+fileName+"&token="+token; + logger.info("要下载附件的URL"+baseUrl); + HttpResponse response = HttpRequest.get(baseUrl).timeout(20000).execute(); + File uploadFile = new File(newPath); + response.writeBody(uploadFile); + } + + private String getToken() { + JSONObject jsonObject = new JSONObject(); + HashMap hashMap = new HashMap<>(); + hashMap.put("userName","hzyaRestUser"); + hashMap.put("password","hzya1314"); + hashMap.put("loginName","fkmanager"); + String result = HttpUtil.post("https://swoa.sunwave.com.cn:9999/seeyon/rest/token", JSON.toJSONString(hashMap)); + jsonObject = JSONObject.parseObject(result); + if("".equals(result) || result == null){ + logger.info("获取token失败!"); + throw new RuntimeException("获取token失败!"); + }else{ + String token = jsonObject.get("id").toString(); + return token ; + } + } + + //将本地文件转为base64编码 + private String getBase64(String filePath) { + File file = new File(filePath); + try { + FileInputStream fileInputStream = new FileInputStream(file); + byte[] bytes = new byte[(int) file.length()]; + fileInputStream.read(bytes); + return Base64.getEncoder().encodeToString(bytes); + }catch (Exception e){ + logger.info("========文件转base64失败:{}=====",e.getMessage()); + e.printStackTrace(); + } + return null; + } + + private JSONObject send(JSONArray jsonArray,SalesContractEntity contractEntity){ + if(CollectionUtils.isNotEmpty(jsonArray)) { + JSONObject token = new JSONObject(); + //获取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(token.toString()). + execute(). + body(); + logger.error("销售合同附件上传BIPtoken返回结果:" + tokenResult); + JSONObject tokenResultJson = JSONObject.parseObject(tokenResult); + if (!tokenResultJson.getBoolean("flag")) { + logger.info("=========销售合同上传附件获取biptoken错误,开始修改销售合同附件上传推送标识为失败=========="); + contractEntity.setIpopush("0"); + contractEntity.setHtnrpush("0"); + salesContractDao.updateAnnexFile(contractEntity); + logger.info("=========销售合同附件上传获取biptoken错误,修改销售合同附件上传推送标识完毕=========="); + return null; + } + String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token"); + logger.error("销售合同附件上传推送BIP请求参数:" + JSON.toJSONString(jsonArray)); + //发送数据 + String result = HttpRequest.post(url). + header("appId", "800050"). + header("apiCode", "8000500022"). + header("access_token", tokenBody). + header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj"). + header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="). + body(JSON.toJSONString(jsonArray)). + execute(). + body(); + JSONObject resultJson = JSONObject.parseObject(result); + return resultJson; + } + return null; + } + + private void saveTaskLivingDetails(String rootAppPk,String rootAppBill,String rootAppNewData,String newTransmitInfo,boolean flag) { + try { + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setId(UUIDUtils.getUUID()); + integrationTaskLivingDetailsEntity.setSts("Y"); + integrationTaskLivingDetailsEntity.setCreate_user_id("1"); + integrationTaskLivingDetailsEntity.setModify_user_id("1"); + integrationTaskLivingDetailsEntity.setCreate_time(new Date()); + integrationTaskLivingDetailsEntity.setModify_time(new Date()); + integrationTaskLivingDetailsEntity.setOrg_id("0"); + integrationTaskLivingDetailsEntity.setCompanyId("0"); + integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk); + integrationTaskLivingDetailsEntity.setRootAppBill(rootAppBill); + integrationTaskLivingDetailsEntity.setPluginId("SalesContractPluginInitializer"); + 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/salesContract/plugin/IpoAnnexFileUploadPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/plugin/IpoAnnexFileUploadPluginInitializer.java new file mode 100644 index 00000000..da5f2f2d --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/plugin/IpoAnnexFileUploadPluginInitializer.java @@ -0,0 +1,252 @@ +package com.hzya.frame.plugin.salesContract.plugin; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.salesContract.dao.ISalesContractDao; +import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity; +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.apache.commons.collections.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +import java.io.File; +import java.io.FileInputStream; +import java.util.Base64; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +public class IpoAnnexFileUploadPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(IpoAnnexFileUploadPluginInitializer.class); + + @Autowired + private ISalesContractDao salesContractDao; + + @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 "IpoAnnexFileUploadPluginInitializer"; + } + + @Override + public String getPluginName() { + return "销售合同IPO附件上传"; + } + + @Override + public String getPluginLabel() { + return "IpoAnnexFileUploadPluginInitializer"; + } + + @Override + public String getPluginType() { + return "1"; + } + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try { + logger.info("======开始执行销售合同IPO附件上传BIP========"); + //重试方法 + if (null != requestJson) { + //如果这个id不为空,说明是重试的 + String id = requestJson.getString("integration_task_living_details_id"); + //执行重新发送 + SalesContractEntity salesContractEntity = new SalesContractEntity(); + salesContractEntity.setDataSourceCode("SW-OA"); + if (StrUtil.isNotEmpty(id)) { + salesContractEntity.setId(id); + } + //查询未上传的数据 + List salesContractEntities = salesContractDao.queryIPOAnnexFile(salesContractEntity); + if(salesContractEntities == null || salesContractEntities.size() == 0){ + logger.info("=====没有需要上传BIP的销售合同IPO附件=========="); + return BaseResult.getSuccessMessageEntity("查询成功"); + } + JSONObject resultJson=null; + SalesContractEntity salesContract=new SalesContractEntity(); + salesContract.setDataSourceCode("SW-OA"); + for (SalesContractEntity contractEntity : salesContractEntities) { + if(null !=contractEntity.getIpofilename() && null == contractEntity.getIpopush()){ + JSONArray jsonArray=new JSONArray(); + JSONObject jsonObject=new JSONObject(); + jsonObject.put("filename",contractEntity.getIpofilename()); + jsonObject.put("billtype",contractEntity.getBilltype()); + jsonObject.put("billid",contractEntity.getBillid()); + jsonObject.put("billcode",contractEntity.getBillcode()); + jsonObject.put("pk_org",contractEntity.getPkOrg()); + String file_url = contractEntity.getIpoid(); + String newPath = "E:\\yongansystem\\upload\\reuce\\"+contractEntity.getIpofilename(); + downOaFile(file_url,contractEntity.getIpofilename(),newPath); + //本地文件转为base64 + String base64 = getBase64(newPath); + jsonObject.put("file",base64); + jsonArray.add(jsonObject); + resultJson = send(jsonArray, contractEntity); + logger.error("销售合同ipo附件上传BIP返回结果:" + resultJson.toJSONString()); + salesContract.setId(contractEntity.getId()); + } + } + if(null !=resultJson){ + if(!resultJson.getBoolean("flag")){ + logger.info("=========销售合同ipo附件上传bip返回结果错误,开始修改销售合同ipo附件上传推送标识为失败=========="); + salesContract.setIpopush("0"); + salesContractDao.updateAnnexFile(salesContract); + logger.info("=========销售合同ipo附件上传获取bip返回结果错误,修改销售合同ipo附件上传推送标识为失败完毕=========="); + //saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),false); + }else { + logger.info("=========销售合同ipo附件上传bip返回结果成功,开始修改销售合同ipo附件上传推送标识为成功=========="); + salesContract.setIpopush("1"); + salesContractDao.updateAnnexFile(salesContract); + logger.info("=========销售合同ipo附件上传bip返回结果成功,修改销售合同ipo附件上传推送标识为成功完毕=========="); + // saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),true); + } + }else{ + logger.info("=======没有销售合同IPO附件上传BIP======="); + } + logger.info("=======销售合同IPO附件上传BIP执行成功======="); + return BaseResult.getSuccessMessageEntity("销售合同IPO附件上传执行成功"); + } + }catch (Exception e){ + logger.info("======执行销售合同IPO附件上传BIP失败:{}========", e.getMessage()); + e.printStackTrace(); + } + return null; + } + + private void downOaFile(String fileUrl, String fileName,String newPath) { + logger.info("开始下载附件"+newPath); + String token = getToken(); + logger.info("获取的token信息"); + String baseUrl = "https://swoa.sunwave.com.cn:9999/seeyon/rest/attachment/file/"+fileUrl+"?fileName="+fileName+"&token="+token; + logger.info("要下载附件的URL"+baseUrl); + HttpResponse response = HttpRequest.get(baseUrl).timeout(20000).execute(); + File uploadFile = new File(newPath); + response.writeBody(uploadFile); + } + + private String getToken() { + JSONObject jsonObject = new JSONObject(); + HashMap hashMap = new HashMap<>(); + hashMap.put("userName","hzyaRestUser"); + hashMap.put("password","hzya1314"); + hashMap.put("loginName","fkmanager"); + String result = HttpUtil.post("https://swoa.sunwave.com.cn:9999/seeyon/rest/token", JSON.toJSONString(hashMap)); + jsonObject = JSONObject.parseObject(result); + if("".equals(result) || result == null){ + logger.info("获取token失败!"); + throw new RuntimeException("获取token失败!"); + }else{ + String token = jsonObject.get("id").toString(); + return token ; + } + } + + //将本地文件转为base64编码 + private String getBase64(String filePath) { + File file = new File(filePath); + try { + FileInputStream fileInputStream = new FileInputStream(file); + byte[] bytes = new byte[(int) file.length()]; + fileInputStream.read(bytes); + return Base64.getEncoder().encodeToString(bytes); + }catch (Exception e){ + logger.info("========文件转base64失败:{}=====",e.getMessage()); + e.printStackTrace(); + } + return null; + } + + private JSONObject send(JSONArray jsonArray,SalesContractEntity contractEntity){ + if(CollectionUtils.isNotEmpty(jsonArray)) { + JSONObject token = new JSONObject(); + //获取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(token.toString()). + execute(). + body(); + logger.error("销售合同IPO附件上传BIPtoken返回结果:" + tokenResult); + JSONObject tokenResultJson = JSONObject.parseObject(tokenResult); + if (!tokenResultJson.getBoolean("flag")) { + logger.info("=========销售合同上传IPO附件获取biptoken错误,开始修改销售合同附件上传推送标识为失败=========="); + contractEntity.setIpopush("0"); + contractEntity.setHtnrpush("0"); + salesContractDao.updateAnnexFile(contractEntity); + logger.info("=========销售合同IPO附件上传获取biptoken错误,修改销售合同附件上传推送标识完毕=========="); + return null; + } + String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token"); + logger.error("销售合同IPO附件上传推送BIP请求参数:" + JSON.toJSONString(jsonArray)); + //发送数据 + String result = HttpRequest.post(url). + header("appId", "800050"). + header("apiCode", "8000500022"). + header("access_token", tokenBody). + header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj"). + header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="). + body(JSON.toJSONString(jsonArray)). + execute(). + body(); + JSONObject resultJson = JSONObject.parseObject(result); + return resultJson; + } + return null; + } + + private void saveTaskLivingDetails(String rootAppPk,String rootAppBill,String rootAppNewData,String newTransmitInfo,boolean flag) { + try { + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setId(UUIDUtils.getUUID()); + integrationTaskLivingDetailsEntity.setSts("Y"); + integrationTaskLivingDetailsEntity.setCreate_user_id("1"); + integrationTaskLivingDetailsEntity.setModify_user_id("1"); + integrationTaskLivingDetailsEntity.setCreate_time(new Date()); + integrationTaskLivingDetailsEntity.setModify_time(new Date()); + integrationTaskLivingDetailsEntity.setOrg_id("0"); + integrationTaskLivingDetailsEntity.setCompanyId("0"); + integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk); + integrationTaskLivingDetailsEntity.setRootAppBill(rootAppBill); + integrationTaskLivingDetailsEntity.setPluginId("SalesContractPluginInitializer"); + 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/salesContract/plugin/SalesContractPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/plugin/SalesContractPluginInitializer.java new file mode 100644 index 00000000..11f5b414 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/plugin/SalesContractPluginInitializer.java @@ -0,0 +1,223 @@ +package com.hzya.frame.plugin.salesContract.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.projectMainFlow.entity.ProjectMainFlowEntity; +import com.hzya.frame.plugin.salesContract.dao.ISalesContractDao; +import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity; +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 SalesContractPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(SalesContractPluginInitializer.class); + + @Autowired + private ISalesContractDao salesContractDao; + + @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 "SalesContractPluginInitializer"; + } + + @Override + public String getPluginName() { + return "销售合同新增"; + } + + @Override + public String getPluginLabel() { + return "SalesContractPluginInitializer"; + } + + @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"); + //执行重新发送 + SalesContractEntity salesContractEntity = new SalesContractEntity(); + salesContractEntity.setDataSourceCode("SW-OA"); + if (StrUtil.isNotEmpty(id)) { + salesContractEntity.setId(id); + } + //查询未推送的数据 + List salesContractEntities = salesContractDao.querySalesContract(salesContractEntity); + if(salesContractEntities == null || salesContractEntities.size() == 0){ + logger.info("=====没有需要推送BIP的销售合同=========="); + return BaseResult.getSuccessMessageEntity("查询成功"); + } + for (SalesContractEntity contractEntity : salesContractEntities) { + //组装数据 + JSONObject sendData = getSendData(contractEntity); + JSONObject tokenData = getBipTokenData(); + contractEntity.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")){ + logger.info("=========销售合同获取biptoken错误,开始修改销售合同推送标识为失败=========="); + contractEntity.setPushStatus("0"); + salesContractDao.updateSalesContract(contractEntity); + logger.info("=========销售合同获取biptoken错误,修改销售合同推送标识完毕=========="); + continue; + } + String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token"); + logger.error("销售合同推送BIP请求参数:"+sendData.toJSONString()); + //发送数据 + String result = HttpRequest.post(url). + header("appId", "800050"). + header("apiCode", "8000500012"). + 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("销售合同推送BIP返回结果:"+result); + JSONObject resultJson = JSONObject.parseObject(result); + if(!resultJson.getBoolean("flag")){ + logger.info("=========销售合同获取bip返回结果错误,开始修改销售合同推送标识为失败=========="); + contractEntity.setPushStatus("0"); + salesContractDao.updateSalesContract(contractEntity); + logger.info("=========销售合同获取bip返回结果错误,修改销售合同推送标识为失败完毕=========="); + saveTaskLivingDetails(contractEntity.getId(),contractEntity.getContractno(),sendData.toString(),resultJson.toJSONString(),false); + }else { + logger.info("=========销售合同获取bip返回结果成功,开始修改销售合同推送标识为成功=========="); + contractEntity.setPushStatus("1"); + salesContractDao.updateSalesContract(contractEntity); + logger.info("=========销售合同获取bip返回结果成功,修改销售合同推送标识为成功完毕=========="); + saveTaskLivingDetails(contractEntity.getId(),contractEntity.getContractno(),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(SalesContractEntity contractEntity) { + JSONObject bill = new JSONObject(); + bill.put("pk_group",contractEntity.getPkGroup());//集团编码 + bill.put("pk_org",contractEntity.getPkOrg());//公司编码 + bill.put("contractno",contractEntity.getContractno());//合同号 + bill.put("name",contractEntity.getContractName());//合同名称 + bill.put("creator",contractEntity.getCreator());//创建人用户 + bill.put("creationtime",contractEntity.getCreationtime());//创建时间 + bill.put("billdate",contractEntity.getBilldate());//申请日期 + bill.put("contractor",contractEntity.getContractor());//订单负责人名称 + bill.put("cdeptid",contractEntity.getCdeptid());//事业部 + bill.put("approvestatus",contractEntity.getApprovestatus());//审批状态默认 + bill.put("belongtodeptid",contractEntity.getBelongtodeptid());//单据归属部门 + bill.put("dpk_custclass",contractEntity.getDpk_custclass());//合同对应客户大类 + bill.put("dcustomerid",contractEntity.getDcustomerid());//合同对应客户大类 + bill.put("zcustomerid",contractEntity.getZcustomerid()); + bill.put("cinvoicecustid",contractEntity.getCinvoicecustid());//开票客户名称 + bill.put("cemployeeid",contractEntity.getCemployeeid());//业务人员 + bill.put("ccurrencyid",contractEntity.getCcurrencyid());//币种 + bill.put("totalamount",contractEntity.getTotalamount());//原币总金额 + bill.put("rmbtotalamount",contractEntity.getRmbtotalamount());//人民币总金额 + bill.put("presentrate",contractEntity.getPresentrate());//汇率 + bill.put("def13",contractEntity.getDef13());//IPO合同号 + bill.put("def16",contractEntity.getDef16());//IPO汇率 + bill.put("def8",contractEntity.getDef8());//贸易方式 + bill.put("def27",contractEntity.getDef27());//IPO币种 + bill.put("def17",contractEntity.getDef17());//收款账期 + bill.put("def18",contractEntity.getDef18());//账簿本币金额 + bill.put("def26",contractEntity.getDef26());//当前账簿兑人民币汇率 + + bill.put("custbillno",contractEntity.getCustbillno());//CPO订单编码 + bill.put("placementdate",contractEntity.getPlacementdate());//CPO下达日期 + bill.put("country",contractEntity.getCountry());//国家地区编码 + bill.put("vnote",contractEntity.getVnote());//备注 + bill.put("def9",contractEntity.getDef9());//合同类型 + bill.put("def2",contractEntity.getDef2());//合同性质 + bill.put("def41",contractEntity.getDef41());//单据归属区域 + JSONObject htdd01Master=new JSONObject(); + htdd01Master.put("htdd01Master",bill); + return htdd01Master; + } + + private JSONObject getBipTokenData() { + JSONObject jsonObject = new JSONObject(); + + + + return jsonObject; + } + + + 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("SalesContractPluginInitializer"); + 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/salesContract/service/ISalesContractService.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/service/ISalesContractService.java new file mode 100644 index 00000000..bb764464 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/service/ISalesContractService.java @@ -0,0 +1,7 @@ +package com.hzya.frame.plugin.salesContract.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity; + +public interface ISalesContractService extends IBaseService { +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/service/impl/SalesContractServiceImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/service/impl/SalesContractServiceImpl.java new file mode 100644 index 00000000..0e6c4e7a --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/salesContract/service/impl/SalesContractServiceImpl.java @@ -0,0 +1,18 @@ +package com.hzya.frame.plugin.salesContract.service.impl; + +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.plugin.salesContract.dao.ISalesContractDao; +import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity; +import com.hzya.frame.plugin.salesContract.service.ISalesContractService; +import org.springframework.beans.factory.annotation.Autowired; + +public class SalesContractServiceImpl extends BaseService implements ISalesContractService { + + private ISalesContractDao salesContractDao; + + @Autowired + public void setSalesContractDao(ISalesContractDao dao) { + this.salesContractDao = dao; + this.dao = dao; + } +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/MarginPaymentPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/MarginPaymentPluginInitializer.java index 80722ce3..2196ab9b 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/MarginPaymentPluginInitializer.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/MarginPaymentPluginInitializer.java @@ -53,6 +53,15 @@ public class MarginPaymentPluginInitializer extends PluginBaseEntity{ public String getPluginType() { return "1"; } + /** + * + * @content 保证金付款申请到哪同步BIP + * @className: Administrator + * @author laborer + * @date 2025-04-17 9:06 + * + */ + @Override public JsonResultEntity executeBusiness(JSONObject requestJson) { try { diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/PayReceivedPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/PayReceivedPluginInitializer.java new file mode 100644 index 00000000..e06dbce6 --- /dev/null +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/PayReceivedPluginInitializer.java @@ -0,0 +1,73 @@ +package com.hzya.frame.plugin.serviceData.plugin; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.seeyon.paybill.service.IPayBillService; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.annotation.Resource; + +/** + * 业务数据同步 + * + * @author makejava + * @since 2024-06-21 13:52:35 + */ +public class PayReceivedPluginInitializer extends PluginBaseEntity{ + Logger logger = LoggerFactory.getLogger(PayReceivedPluginInitializer.class); + + + @Resource + private IPayBillService payBillService; + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "PayReceivedPluginInitializer"; + } + + @Override + public String getPluginName() { + return "业务数据抽取"; + } + + @Override + public String getPluginLabel() { + return "PayReceivedPluginInitializer"; + } + + @Override + public String getPluginType() { + return "1"; + } + /** + * + * @content 付款申请单SW-D同步更新BIP + * @className: Administrator + * @author laborer + * @date 2025-04-17 9:08 + * + */ + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try { + logger.info("======开始执行业务数据信息同步========"); + return payBillService.sendPayReceivedToBip(requestJson); + }catch (Exception e){ + logger.info("======执行业务数据同步失败:{}========",e.getMessage()); + e.printStackTrace(); + } + return BaseResult.getSuccessMessageEntity("操作成功"); + } +} diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/ReceivedPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/ReceivedPluginInitializer.java index 50226084..2dea0c5e 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/ReceivedPluginInitializer.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/serviceData/plugin/ReceivedPluginInitializer.java @@ -50,6 +50,15 @@ public class ReceivedPluginInitializer extends PluginBaseEntity{ public String getPluginType() { return "1"; } + /** + * + * @content 保证金付款申请同步更新BIP + * @className: Administrator + * @author laborer + * @date 2025-04-17 9:06 + * + */ + @Override public JsonResultEntity executeBusiness(JSONObject requestJson) { try { 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 84f9389b..4756da16 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 @@ -612,7 +612,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ map1.put("tableName",mainDb); map1.put("dataStatus", "N"); map1.put("deleteStatus", "0"); - map1.put("size", 50); + //map1.put("size", 50); objects = mdmModuleDao.queryMdmSTs(map1); objects = toLowerCaseKeys(objects); @@ -807,7 +807,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ map1.put("tableName",mainDb); //map1.put("dataStatus", "F"); map1.put("updateStatus", "0"); - map1.put("size", 50); + //map1.put("size", 50); objects = mdmModuleDao.queryMdmSTs(map1); objects = toLowerCaseKeys(objects); @@ -995,7 +995,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ map1.put("tableName",mainDb); //map1.put("dataStatus", "Y"); map1.put("addStatus", "0"); - map1.put("size", 50); + //map1.put("size", 50); objects = mdmModuleDao.queryMdmSTs(map1); objects = toLowerCaseKeys(objects); @@ -1024,21 +1024,21 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ if(mdmModuleDistributeEntities.get(i1).getAddApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getAddApi())){ for (int i = 0; i < doObjects.size(); i++) { //taskLivingDetailsService.saveLogToSuccess(); - saveMdmModuleSendLogEntity( mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增接口未设置",mainDb,objects.get(i).getString("id"),null,null,null,null,doObjects.get(i).toJSONString(),"1"); + // saveMdmModuleSendLogEntity( mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增接口未设置",mainDb,objects.get(i).getString("id"),null,null,null,null,null,"1"); } return ; } SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getAddApi()); if(apiEntity == null || apiEntity.getId() == null ){ for (int i = 0; i < doObjects.size(); i++) { - saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增接口未查找到",mainDb,objects.get(i).getString("id"),null,null,null,null,doObjects.get(i).toJSONString(),"1"); + //saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增接口未查找到",mainDb,objects.get(i).getString("id"),null,null,null,null,null,"1"); } return ; } SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId()); if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){ for (int i = 0; i < doObjects.size(); i++) { - saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","应用未查找到",mainDb,objects.get(i).getString("id"),null,null,apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1"); + //saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","应用未查找到",mainDb,objects.get(i).getString("id"),null,null,apiEntity.getApiName(),apiEntity.getId(),null,"1"); } return ; } @@ -1048,7 +1048,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getAddScript()); if(scriptEntity == null || scriptEntity.getId() == null ){ for (int i = 0; i < doObjects.size(); i++) { - saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1"); + // saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1"); } return ; } @@ -1112,7 +1112,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ querys = jsonResultEntity.getString("querys"); bodys = jsonResultEntity.getString("bodys"); }catch (Exception e){ - saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1"); + // saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1"); continue; } } @@ -1129,7 +1129,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ //找到登陆接口 SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort()); if (null == loginApi) { - saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1"); + // saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1"); continue; } String rzquerys = getQuery(loginApi,null,null); @@ -1142,7 +1142,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ String rzbodys = getBodys(loginApi,null,null); JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys); if (!rzjsonResultEntity.isFlag()) { - saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1"); + // saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1"); continue; } JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString()); @@ -1155,6 +1155,15 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ //组装数据发送 logger.info("=========开始执行正常业务数据下发脚本,第二次=============="); JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); + //根据OA单据编号更新BIP付款申请单号 + JSONObject jsonObjectBody = JSONObject.parseObject(bodys); + String parent = jsonObjectBody.getString("parent"); + JSONObject jsonObjectParent = JSONObject.parseObject(parent); + ServiceDataEntity serviceDataEntity=new ServiceDataEntity(); + serviceDataEntity.setBillCode(jsonObjectParent.getString("vdef1")); + serviceDataEntity.setDataSourceCode("SW-OA"); + logger.info("========正常业务数据下发开始根据单据编号:{}查询数据==========",jsonObjectParent.getString("vdef1")); + List query = serviceDataDao.query(serviceDataEntity); logger.info("=====业务数据下发调用BIP付款申请返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString()); if(jsonResultEntity.isFlag()){ if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) { @@ -1187,15 +1196,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId()); mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("vbillno")); mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity); - //根据OA单据编号更新BIP付款申请单号 - JSONObject jsonObjectBody = JSONObject.parseObject(bodys); - String parent = jsonObjectBody.getString("parent"); - JSONObject jsonObjectParent = JSONObject.parseObject(parent); - ServiceDataEntity serviceDataEntity=new ServiceDataEntity(); - serviceDataEntity.setBillCode(jsonObjectParent.getString("vdef1")); - serviceDataEntity.setDataSourceCode("SW-OA"); - logger.info("========正常业务数据下发开始根据单据编号:{}查询数据==========",jsonObjectParent.getString("vdef1")); - List query = serviceDataDao.query(serviceDataEntity); + if(CollectionUtils.isNotEmpty(query)){ logger.info("===正常下发时候,开始根据OA单据编号:{}更新BIP付款申请单号:{}",jsonObjectParent.getString("vdef1"),backJsonResultEntity.getString("vbillno")); serviceDataEntity.setTabName(query.get(0).getTabName()); @@ -1203,6 +1204,14 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ serviceDataEntity.setBipPaymentNumber(backJsonResultEntity.getString("vbillno")); serviceDataEntity.setId(query.get(0).getId()); serviceDataDao.updateBipPaymentNumber(serviceDataEntity); + //更新支付结果为待支付 + serviceDataEntity.setPayResult("待支付"); + serviceDataEntity.setPayResultFiled(query.get(0).getPayResultFiled()); + serviceDataEntity.setDataSourceCode("SW-OA"); + logger.info("====开始根据单据号:{},表名称:{},表单id:{}更新支付状态为待支付======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId()); + serviceDataDao.updatePayResult(serviceDataEntity); + logger.info("====根据单据号:{},表名称:{},表单id:{}更新支付状态为待支付完成======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId()); + //修改下发状态 logger.info("===正常下发时候,根据OA单据编号:{}更新BIP付款申请单号:{}完毕",jsonObjectParent.getString("vdef1"),backJsonResultEntity.getString("vbillno")); Map updateMap = new HashMap<>(); updateMap.put("tableName",mainDb); @@ -1213,24 +1222,73 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{ }else{ logger.info("======正常下发时候根据单据编号:{}未能在三维OA查询到数据,Bip付款申请单号不回写",jsonObjectParent.getString("vdef1")); } + }else { + if (CollectionUtils.isNotEmpty(query)) { + //保存推送BIP返回的错误信息 + //将BIP返回的失败信息保存到支付结果中 + serviceDataEntity.setPayResult(backJsonResultEntity.getString("message")); + serviceDataEntity.setDataSourceCode("SW-OA"); + serviceDataEntity.setPayResultFiled(query.get(0).getPayResultFiled()); + serviceDataEntity.setId(query.get(0).getId()); + serviceDataEntity.setTabName(query.get(0).getTabName()); + logger.info("====开始根据单据号:{},表名称:{},表单id:{}更新支付状态为BIP返回的失败信息======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId()); + serviceDataDao.updatePayResult(serviceDataEntity); + logger.info("====根据单据号:{},表名称:{},表单id:{}更新支付状态为BIP返回的失败信息======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId()); + //修改下发状态 + logger.info("===下发失败时候,根据OA单据编号:{}更新下发状态",jsonObjectParent.getString("vdef1")); + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + //updateMap.put("dataStatus", "Y"); + updateMap.put("addStatus", "2"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); + }else{ + logger.info("======正常下发时候根据单据编号:{}未能在三维OA查询到数据,不将BIP返回的失败信息体现在支付结果中",jsonObjectParent.getString("vdef1")); + } } } } catch (Exception e) { logger.error("新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute()); - saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增返回脚本解析保存三方id错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1"); + // saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增返回脚本解析保存三方id错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1"); continue; } } //保存日志 - 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"); + // saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"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"); + // saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1"); objects.get(i).put("sendsanfzt123",false); logger.info("========业务数据下发完成,日志保存为失败============"); + if (CollectionUtils.isNotEmpty(query)) { + //保存推送BIP返回的错误信息 + //将BIP返回的失败信息保存到支付结果中 + String str = JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString(); + JSONObject jsonObject = JSONObject.parseObject(str); + String attribute = jsonObject.getString("attribute"); + JSONObject jsonAttribute = JSONObject.parseObject(attribute); + serviceDataEntity.setPayResult(jsonAttribute.getString("message")); + serviceDataEntity.setDataSourceCode("SW-OA"); + serviceDataEntity.setPayResultFiled(query.get(0).getPayResultFiled()); + serviceDataEntity.setId(query.get(0).getId()); + serviceDataEntity.setTabName(query.get(0).getTabName()); + logger.info("====开始根据单据号:{},表名称:{},表单id:{}更新支付状态为BIP返回的失败信息======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId()); + serviceDataDao.updatePayResult(serviceDataEntity); + logger.info("====根据单据号:{},表名称:{},表单id:{}更新支付状态为BIP返回的失败信息======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId()); + //修改下发状态 + logger.info("===下发失败时候,根据OA单据编号:{}更新下发状态",jsonObjectParent.getString("vdef1")); + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + //updateMap.put("dataStatus", "Y"); + updateMap.put("addStatus", "2"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); + }else{ + logger.info("======正常下发时候根据单据编号:{}未能在三维OA查询到数据,不将BIP返回的失败信息体现在支付结果中",jsonObjectParent.getString("vdef1")); + } continue; } } diff --git a/base-buildpackage/src/main/resources/application-xel.yml b/base-buildpackage/src/main/resources/application-xel.yml index e53ca4c4..829e8b72 100644 --- a/base-buildpackage/src/main/resources/application-xel.yml +++ b/base-buildpackage/src/main/resources/application-xel.yml @@ -19,17 +19,5 @@ spring: savefile: # 文件保存路径 path: /Users/xiangerlin/work/app/file/dev -cbs8: - appId: 1P4AGrpz - appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a - url: https://cbs8-openapi-reprd.csuat.cmburl.cn - # 测试用这个 这个是银行给的,和下面的公钥不是一对密钥 - ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44 - # 这个私钥到时候上传到cbs,和下面到是同一对 - #ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46 - ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde - cbs_public_key: 0469146F06BF3B01236E84632441E826F3067A6B93BC3839C836A06007869CD351FBBE388B51F742859388BBC1DE089923AAFBC69E448F15141DDF30EE6CE90185 - #电子回单下载临时存放位置 - elec_path: /Users/xiangerlin/Downloads/ -OA: - data_source_code: yc-test +zt: + url: http://127.0.0.1:9011/kangarooDataCenterV3/entranceController/externalCallInterface diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/c4project/pluginCfg.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/c4project/pluginCfg.xml new file mode 100644 index 00000000..0a47fd4e --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/c4project/pluginCfg.xml @@ -0,0 +1,6 @@ + + +C4ProjectPluginInitializer +C4ProjectPluginInitializer +90000098 + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/c4project/spring/spring-buildpackage-dao.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/c4project/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..29d92bf2 --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/c4project/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/c4project/spring/spring-buildpackage-plugin.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/c4project/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..ccd071a2 --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/c4project/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/salesContract/pluginCfg.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/salesContract/pluginCfg.xml new file mode 100644 index 00000000..de1112c8 --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/salesContract/pluginCfg.xml @@ -0,0 +1,6 @@ + + +SalesContractPluginInitializer +SalesContractPluginInitializer插件 +90000099 + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/salesContract/spring/spring-buildpackage-dao.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/salesContract/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..7c4bbce6 --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/salesContract/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/salesContract/spring/spring-buildpackage-plugin.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/salesContract/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..b37c38ab --- /dev/null +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/salesContract/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/base-buildpackage/src/main/resources/cfgHome/plugin/serviceData/spring/spring-buildpackage-plugin.xml b/base-buildpackage/src/main/resources/cfgHome/plugin/serviceData/spring/spring-buildpackage-plugin.xml index 7931e7bf..75ccf717 100644 --- a/base-buildpackage/src/main/resources/cfgHome/plugin/serviceData/spring/spring-buildpackage-plugin.xml +++ b/base-buildpackage/src/main/resources/cfgHome/plugin/serviceData/spring/spring-buildpackage-plugin.xml @@ -5,4 +5,5 @@ + diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/IServiceDataDao.java b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/IServiceDataDao.java index 165461c8..592f0b0c 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/IServiceDataDao.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/IServiceDataDao.java @@ -87,4 +87,24 @@ public interface IServiceDataDao extends IBaseDao { * @Date 2024-12-19 10:49 * **/ List queryDataByVdef1(ServiceDataEntity entity); + + /** + * + * @content 查询支付成功但是没有做凭证的数据 + * @Param + * @Return + * @Author hecan + * @Date 2025-05-09 17:15 + * **/ + List queryVoucherIsNull(ServiceDataEntity entity); + + /** + * + * @content 凭证号和凭证期间回写 + * @Param + * @Return + * @Author hecan + * @Date 2025-05-09 17:39 + * **/ + Integer updateVoucherResult(ServiceDataEntity entity); } diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/impl/ServiceDataDaoImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/impl/ServiceDataDaoImpl.java index dc8d734c..b4de66c4 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/impl/ServiceDataDaoImpl.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/dao/impl/ServiceDataDaoImpl.java @@ -74,4 +74,16 @@ public class ServiceDataDaoImpl extends MybatisGenericDao queryDataByVdef1(ServiceDataEntity entity) { return super.query("queryDataByVdef1",entity); } + + @DS("#entity.dataSourceCode") + @Override + public List queryVoucherIsNull(ServiceDataEntity entity) { + return (List) super.selectList("queryVoucherIsNull",entity); + } + + @DS("#entity.dataSourceCode") + @Override + public Integer updateVoucherResult(ServiceDataEntity entity) { + return super.update("updateVoucherResult",entity); + } } 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 3281f97e..cdf4b8eb 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 @@ -20,6 +20,60 @@ public class ServiceDataEntity extends BaseEntity { private String bipAmountField;//BIP打款金额字段 private String bipAmount;//BIP打款金额 + private String bipCbsDateFiled;//BIP推CBS时间字段 + private String voucherPeriodFiled;//凭证期间字段 + private String voucherNumberFiled;//凭证号字段 + private String bipCbsDate;//BIP推CBS时间 + private String voucherPeriod;//凭证期间 + private String voucherNumber;//凭证号 + + public String getBipCbsDateFiled() { + return bipCbsDateFiled; + } + + public void setBipCbsDateFiled(String bipCbsDateFiled) { + this.bipCbsDateFiled = bipCbsDateFiled; + } + + public String getVoucherPeriodFiled() { + return voucherPeriodFiled; + } + + public void setVoucherPeriodFiled(String voucherPeriodFiled) { + this.voucherPeriodFiled = voucherPeriodFiled; + } + + public String getVoucherNumberFiled() { + return voucherNumberFiled; + } + + public void setVoucherNumberFiled(String voucherNumberFiled) { + this.voucherNumberFiled = voucherNumberFiled; + } + + public String getBipCbsDate() { + return bipCbsDate; + } + + public void setBipCbsDate(String bipCbsDate) { + this.bipCbsDate = bipCbsDate; + } + + public String getVoucherPeriod() { + return voucherPeriod; + } + + public void setVoucherPeriod(String voucherPeriod) { + this.voucherPeriod = voucherPeriod; + } + + public String getVoucherNumber() { + return voucherNumber; + } + + public void setVoucherNumber(String voucherNumber) { + this.voucherNumber = voucherNumber; + } public String getBipAmountField() { return bipAmountField; 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 fd6ee872..483ee286 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 @@ -14,7 +14,7 @@ - oa_id as id + data_id as id ,tab_name as tabName ,pay_result_field as payResultFiled ,pay_result as payResult @@ -27,6 +27,12 @@ ,bip_payment_number as bipPaymentNumber ,bip_amount_field as bipAmountField ,bip_amount as bipAmount + ,bip_cbs_date_filed as bipCbsDateFiled + ,voucher_period_filed as voucherPeriodFiled + ,voucher_number_filed as voucherNumberFiled + ,bip_cbs_date as bipCbsDate + ,voucher_period as voucherPeriod + ,voucher_number as voucherNumber + + +