diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java index beb4c48e..2a84c1a3 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java @@ -470,7 +470,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { } } }else {//执行正常下发 - + logger.info("==========开始执行正常主数据下发============="); //查询主数据 MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity(); queryMdmModuleEntity.setSts("Y"); @@ -509,13 +509,17 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { queryFildRule.setRuleCode("service"); List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule); - //新增 - doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); - //修改 - doUpdate(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); - //删除 - doDelete(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); - + if(mdmModuleEntities.get(i).getMdmCode()!= 10045L){ + //新增 + doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + //修改 + doUpdate(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + //删除 + doDelete(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + }else{ + logger.info("主数据编码为10045,已经在业务数据下发执行,主数据下发不执行"); + continue; + } } } @@ -827,6 +831,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { /** body */ String bodys = doObjects.get(i).toJSONString(); if(scriptEntity != null && scriptEntity.getId() != null ){ + logger.info("=========开始执行正常主数据修改下发脚本,第一次=============="); groovy.put("code",scriptEntity.getScriptCode()); groovy.put("className",scriptEntity.getClassName()); groovy.put("name",scriptEntity.getScriptName()); @@ -854,6 +859,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { headers.putAll(header); } if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) { + logger.info("=========正常主数据修改开始执行登录接口=============="); //找到登陆接口 SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort()); if (null == loginApi) { @@ -874,12 +880,15 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { continue; } JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString()); + logger.info("=======主数据正常修改下发登录返回数据:{}========",attritube.toJSONString()); querys = getQuery(apiEntity,querys,attritube); headers = getHeaders(apiEntity,headers,attritube); bodys = getBodys(apiEntity,bodys,attritube); } //组装数据发送 + logger.info("=========开始执行主业务修改数据下发脚本,第二次=============="); JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); + logger.info("=====主数据修改下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString()); if(jsonResultEntity.isFlag()){ //保存日志 saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2"); @@ -911,7 +920,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { * @param mdmModuleDistributeEntities * @return void **/ - private void doAdd(String mdmId,Long mainCode,List mdmModuleDbEntities, List mdmModuleDistributeEntities,List mdmModuleDbFiledsRuleEntities,List mdmModuleDbFiledsEntities ) throws Exception { + private void + doAdd(String mdmId,Long mainCode,List mdmModuleDbEntities, List mdmModuleDistributeEntities,List mdmModuleDbFiledsRuleEntities,List mdmModuleDbFiledsEntities ) throws Exception { //查询一千条数据 String mainDb = null; List objects = new ArrayList<>(); @@ -1029,6 +1039,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { /** body */ String bodys = doObjects.get(i).toJSONString(); if(scriptEntity != null && scriptEntity.getId() != null ){ + logger.info("=========开始执行正常主数据新增下发脚本,第一次=============="); groovy.put("code",scriptEntity.getScriptCode()); groovy.put("className",scriptEntity.getClassName()); groovy.put("name",scriptEntity.getScriptName()); @@ -1056,6 +1067,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { headers.putAll(header); } if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) { + logger.info("=========正常主数据新增开始执行登录接口=============="); //找到登陆接口 SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort()); if (null == loginApi) { @@ -1076,15 +1088,19 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { continue; } JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString()); + logger.info("=======主数据正常新增下发登录返回数据:{}========",attritube.toJSONString()); querys = getQuery(apiEntity,querys,attritube); headers = getHeaders(apiEntity,headers,attritube); bodys = getBodys(apiEntity,bodys,attritube); } //组装数据发送 + logger.info("=========开始执行主业务新增数据下发脚本,第二次=============="); JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); + logger.info("=====主数据新增下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString()); if(jsonResultEntity.isFlag()){ if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) { + logger.info("=========开始执行主数据新增返回脚本=============="); JSONObject backScriptJson = new JSONObject(); backScriptJson.put("data", jsonResultEntity.getAttribute()); groovy.put("code", scriptEntity.getScriptCode()+"back"); @@ -1124,11 +1140,13 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { //保存日志 saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1"); objects.get(i).put("sendsanfzt123",true); + logger.info("========主数据新增下发完成,日志保存为成功============"); continue; }else { //保存日志 saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1"); objects.get(i).put("sendsanfzt123",false); + logger.info("========主数据新增下发完成,日志保存为失败============"); continue; } } diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/entity/ProjectMainFlowEntity.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/projectMainFlow/entity/ProjectMainFlowEntity.java index 1ffbdd94..4c21783f 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 @@ -34,6 +34,24 @@ public class ProjectMainFlowEntity extends BaseEntity { private String auditResult;//审定推送结果 private String archivistResult;//归档推送结果 private String archivistStatus;//归档推送状态 + private String def8;//完工服务额 + private String def7;//J审定服务金额 + + public String getDef8() { + return def8; + } + + public void setDef8(String def8) { + this.def8 = def8; + } + + public String getDef7() { + return def7; + } + + public void setDef7(String def7) { + this.def7 = def7; + } public String getCompletemoney() { return completemoney; 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 d28dd044..29ffca4c 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 @@ -19,26 +19,26 @@ ,'666' as pkOrg -- 公司编码 ,field0274 as contractno -- 合同号 ,field0279 as contractname -- 合同名称 - ,field0081 as creator -- 创建人 + ,m4.name as creator -- 创建人 ,field0003 as creationtime -- 创建时间 ,field0007 as projectno -- 项目号 - ,field0120 as completemoney -- 完工金额 + ,field0116 as completemoney -- 完工金额 ,field0294 as completedate -- 完工日期 - ,field0108 as completepersion -- 完工填单人 + ,m1.name as completepersion -- 完工填单人 ,field0149 as pinspectionmoney -- 初验金额 ,field0147 as pinspectiondate -- 初验时间 - ,field0159 as pinspectionpersion -- 初验填单人 - ,field0213 as auditmoney -- 审计金额 + ,m2.name as pinspectionpersion -- 初验填单人 + ,field0209 as auditmoney -- 审计金额 ,field0297 as auditdate -- 审计时间 - ,field0237 as auditpersion -- 审计填单人 + ,m3.name as auditpersion -- 审计填单人 ,null as forecastRevenue -- 预估收入确认 ,field0138 as vnote -- 备注 - ,field0120 as completemoney -- 完工服务额 + ,field0120 as def8 -- 完工服务额 ,field0320 as def2 -- F完工辅材额公司 ,field0321 as def3 -- F完工辅材额自购 ,field0294 as completedate -- 完工完成时间 ,field0112 as def4 -- F实际完工日期 - ,field0213 as auditmoney -- J审定服务金额 + ,field0213 as def7 -- J审定服务金额 ,field0354 as def5 -- J审定辅材额公司 ,field0355 as def6 -- J审定辅材额自购 ,field0297 as auditdate -- 审计完成时间 @@ -57,6 +57,10 @@ from formmain_0219 LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0219.id LEFT JOIN CTP_AFFAIR ON CTP_AFFAIR.object_id = COL_SUMMARY.id + LEFT JOIN org_member m1 ON m1.id=field0108 + LEFT JOIN org_member m2 ON m2.id=field0159 + LEFT JOIN org_member m3 ON m3.id=field0237 + 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 field0427 is null @@ -72,6 +76,10 @@ from formmain_0219 LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0219.id LEFT JOIN CTP_AFFAIR ON CTP_AFFAIR.object_id = COL_SUMMARY.id + LEFT JOIN org_member m1 ON m1.id=field0108 + LEFT JOIN org_member m2 ON m2.id=field0159 + LEFT JOIN org_member m3 ON m3.id=field0237 + 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' 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 5860277f..9585fe46 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 @@ -182,6 +182,8 @@ public class ProjectMainFlowArchivistPluginInitializer extends PluginBaseEntity htdd01slave4_htdd01slave4.put("def4",projectMainFlowEntity.getDef4()); htdd01slave4_htdd01slave4.put("def5",projectMainFlowEntity.getDef5()); htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6()); + htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7()); + htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8()); jsonArray.add(htdd01slave4_htdd01slave4); bill.put("htdd01Master",htdd01Master); bill.put("htdd01slave4_htdd01slave4",jsonArray); 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 75f6d9b9..1ba41d6f 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 @@ -174,6 +174,8 @@ public class ProjectMainFlowAuditPluginInitializer extends PluginBaseEntity { htdd01slave4_htdd01slave4.put("def4",projectMainFlowEntity.getDef4()); htdd01slave4_htdd01slave4.put("def5",projectMainFlowEntity.getDef5()); htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6()); + htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7()); + htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8()); jsonArray.add(htdd01slave4_htdd01slave4); bill.put("htdd01Master",htdd01Master); bill.put("htdd01slave4_htdd01slave4",jsonArray); diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataServiceImpl.java index 4593a65e..b587caa4 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataServiceImpl.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataServiceImpl.java @@ -80,7 +80,7 @@ public class MasterDataServiceImpl extends BaseService case "1": //通过主数据编码判断,不同的接口走不通的查询逻辑 switch (mdmCode){ - case "10003"://致远用户信息 + /*case "10003"://致远用户信息 tableName = "mdm_user"; listAll = bindingUser(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); break; @@ -91,15 +91,19 @@ public class MasterDataServiceImpl extends BaseService case "10007"://银行信息 tableName = "mdm_bank"; listAll = binDingBank(jsonObject, mdmModuleSourceEntity, dbCode); - break; - case "10046"://BIP供应商档案 + break;*/ + /* case "10047"://BIP供应商档案 tableName = "mdm_bip_supplier"; listAll = binDingSupplier(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); - break; - case "10047"://BIP项目档案 + break;*/ + case "10048"://BIP项目档案 tableName = "mdm_bip_project"; listAll = binDingProject(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); break; + /* case "10049"://BIP供应商银行档案 + tableName = "mdm_bip_supplier_bank"; + listAll = binDingSupplierBank(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); + break;*/ default: logger.info("未匹配到主数据的编码,请检查"); break; @@ -123,15 +127,12 @@ public class MasterDataServiceImpl extends BaseService private List binDingProject(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception { List list = new ArrayList<>(); StringBuffer sb = new StringBuffer(); - if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){ - String code = jsonObject.getString("code"); - sb.append(" and code = '"+code+"'"); - }else{ - sb.append(" and to_char(main.update_time,'yyyy-MM-dd HH:mm:ss') >= '"+startTime+"'"); - sb.append(" and to_char(main.update_time,'yyyy-MM-dd HH:mm:ss') <> '"+endTime+"'"); + if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){ + sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') "); + sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') "); } StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append(""); + stringBuffer.append("select * from v_hzya_project where 1=1 "+sb.toString()); mdmModuleSourceEntity.setDataSourceCode(dbCode); List> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity); int i = 0; @@ -140,7 +141,7 @@ public class MasterDataServiceImpl extends BaseService JSONObject main = new JSONObject(); JSONObject mdm = new JSONObject(); for(String key:hashMap.keySet()) { - mdm.put(key, hashMap.get(key)); + mdm.put(key.toLowerCase(), hashMap.get(key)); } main.put("mdm_bip_project",mdm); list.add(main); @@ -149,26 +150,44 @@ public class MasterDataServiceImpl extends BaseService return list; } + //绑定供应商银行账户 + private List binDingSupplierBank(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception { + List list = new ArrayList<>(); + StringBuffer sb = new StringBuffer(); + if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){ + sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') "); + sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') "); + } + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("select * from v_hzya_supplier_bank where 1=1 "+sb.toString()); + mdmModuleSourceEntity.setDataSourceCode(dbCode); + List> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity); + int i = 0; + if(CollectionUtils.isNotEmpty(hashMaps)){ + for (HashMap hashMap : hashMaps) { + JSONObject main = new JSONObject(); + JSONObject mdm = new JSONObject(); + for(String key:hashMap.keySet()) { + mdm.put(key.toLowerCase(), hashMap.get(key)); + } + main.put("mdm_bip_supplier_bank",mdm); + list.add(main); + } + } + return list; + } + //绑定供应商 private List binDingSupplier(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception { List list = new ArrayList<>(); StringBuffer sb = new StringBuffer(); - if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){ - String code = jsonObject.getString("code"); - sb.append(" and code = '"+code+"'"); - }else{ - sb.append(" and to_char(main.update_time,'yyyy-MM-dd HH:mm:ss') >= '"+startTime+"'"); - sb.append(" and to_char(main.update_time,'yyyy-MM-dd HH:mm:ss') <> '"+endTime+"'"); + if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){ + sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') "); + sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') "); } StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select \n" + - "main.id as data_id,field0139 as orgcode,field0123 as code,field0125 as abbreviate,field0124 as name,\n" + - "field0148 as category_code,field0127 as taxpayerid,field0142 as linkaddress,field0132 as linkman,\n" + - "field0121 as telephone\n" + - "from formmain_11208 main\n" + - " LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = main.id\n" + - " left join ORG_MEMBER ORG_MEMBER on main.field0001=ORG_MEMBER.id\n" + - " WHERE 1=1 and summary.state in ('1','3') "); + stringBuffer.append("select * from v_hzya_supplier where 1=1 "+sb.toString()); + logger.info("主数据抽取供应商的sql语句为:{}",stringBuffer.toString()); mdmModuleSourceEntity.setDataSourceCode(dbCode); List> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity); int i = 0; @@ -177,7 +196,7 @@ public class MasterDataServiceImpl extends BaseService JSONObject main = new JSONObject(); JSONObject mdm = new JSONObject(); for(String key:hashMap.keySet()) { - mdm.put(key, hashMap.get(key)); + mdm.put(key.toLowerCase(), hashMap.get(key)); } main.put("mdm_bip_supplier",mdm); list.add(main); @@ -300,49 +319,45 @@ public class MasterDataServiceImpl extends BaseService //查询档案参数组装 public JsonResultEntity ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List hashMaps,String mdmCode,String tableName)throws Exception{ - for (JSONObject hashMap : hashMaps) { - JSONObject main = hashMap.getJSONObject(tableName); - - JSONObject jsonObjectUser = new JSONObject(); - JSONObject jsonStr = new JSONObject(); - jsonObjectUser.put("data_id", main.get("data_id")); - jsonObjectUser.put("mdmCode", mdmCode); - jsonStr.put("jsonStr", jsonObjectUser); - //先查询编码和名称查询是否存在 - Object attribute = comparisonServiceimpl.queryEntityPage(jsonStr); - logger.info("得到的attribute值为:{}", jsonStr.toJSONString(attribute)); - JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute); - JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list"); - //如果jsonArrayList为null,说明没有值,在表中不存在 - if (jsonArrayList == null || jsonArrayList.size() == 0) { -// //将查询出来得数据调用通用接口新增,保存到表中 -// JSONObject main = new JSONObject(); -// for(String key:hashMap.keySet()) { -// main.put(key, hashMap.get(key)); -// } -// jsonObjectUser.put("main", main); - hashMap.put("appName","数智中台"); - hashMap.put("appCode","800004"); - hashMap.put("mdmCode", mdmCode); - hashMap.put("optionName", "数智中台"); - jsonStr.put("jsonStr", hashMap); - Object result = comparisonServiceimpl.saveEntity(jsonStr); - logger.info("新增结果为:{}", JSON.toJSONString(result)); -// if(!result.isFlag()){ -// throw new BaseSystemException("主数据保存失败"+ result.getMsg()); -// } - } else { - hashMap.put("appName","数智中台"); - hashMap.put("appCode","800004"); - hashMap.put("mdmCode", mdmCode); - hashMap.put("optionName", "数智中台"); - jsonStr.put("jsonStr", hashMap); - Object result = comparisonServiceimpl.updateEntity(jsonStr); - logger.info("更新结果为:{}", JSON.toJSONString(result)); -// if(!result.isFlag()){ -// //throw new BaseSystemException("主数据更新失败"+ result.getMsg()); -// } + JSONObject jsonObjectUser = new JSONObject(); + List result=new ArrayList<>(); + try { + for (JSONObject hashMap : hashMaps) { + JSONObject main = hashMap.getJSONObject(tableName); + JSONObject jsonStr = new JSONObject(); + jsonObjectUser.put("data_id", main.get("data_id")); + jsonObjectUser.put("mdmCode", mdmCode); + jsonStr.put("jsonStr", jsonObjectUser); + //先查询编码和名称查询是否存在 + Object attribute = comparisonServiceimpl.queryEntityPage(jsonStr); + logger.info("得到的attribute值为:{}", jsonStr.toJSONString(attribute)); + JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute); + JSONObject pageInfo = jsonObjectAttribute.getJSONObject("pageInfo"); + JSONArray jsonArrayList = pageInfo.getJSONArray("list"); + //如果jsonArrayList为null,说明没有值,在表中不存在 + if (jsonArrayList == null || jsonArrayList.size() == 0) { + hashMap.put("appName","数智中台"); + hashMap.put("appCode","800004"); + hashMap.put("mdmCode", mdmCode); + hashMap.put("optionName", "数智中台"); + jsonStr.put("jsonStr", hashMap); + Object object = comparisonServiceimpl.saveEntity(jsonStr); + logger.info("新增结果为:{}", JSON.toJSONString(object)); + result.add(object); + } else { + hashMap.put("appName","数智中台"); + hashMap.put("appCode","800004"); + hashMap.put("mdmCode", mdmCode); + hashMap.put("optionName", "数智中台"); + jsonStr.put("jsonStr", hashMap); + Object object = comparisonServiceimpl.updateEntity(jsonStr); + logger.info("更新结果为:{}", JSON.toJSONString(result)); + result.add(object); + } } + }catch (Exception e){ + logger.info("将数据查询之后进行组装调用通用方法错误:{}",e.getMessage()); + e.printStackTrace(); } return null; } diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/service/impl/ServiceDataServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/service/impl/ServiceDataServiceImpl.java index 0e4ffbd6..08ee168c 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/service/impl/ServiceDataServiceImpl.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/comparison/serviceData/service/impl/ServiceDataServiceImpl.java @@ -304,7 +304,7 @@ public class ServiceDataServiceImpl extends BaseService "push_status_field,summary_id,bip_payment_number_field,bip_amount_field,\n" + "vdef1,pk_acceptorg,creator,pk_group,pk_org,applydate,pk_trantypecode,pk_busitype,vdef2,pk_currtype,\n" + "pk_supplier,pk_bankacc_r,pk_bankacc_p,pk_decidedept,vdef10,vdef12,vdef3,vdef4,vdef5,vdef6,applysum,\n" + - "vdef7,vdef8,vdef9,vdef21 from v_cmp_apply where 1=1 and vdef1 is not null and push_status is null and applysum >0"); + "vdef7,vdef8,vdef9,vdef21,vdef11,vdef17,vdef20 from v_cmp_apply where 1=1 and vdef1 is not null and push_status is null and applysum >0"); mdmModuleSourceEntity.setDataSourceCode(dbCode); List> hashMaps = serviceDataDao.queryListBySWSource(stringBuffer.toString(), mdmModuleSourceEntity); int i = 0; @@ -321,7 +321,7 @@ public class ServiceDataServiceImpl extends BaseService StringBuffer stringBufferDetails = new StringBuffer(); stringBufferDetails.append("select d_id as data_id,tab_name,pk_balatype,pk_acceptorg,pk_org,pk_group,pk_busitype,rowno,\n" + "pk_supplier,pk_bankacc_r,customer,pk_currtype,pk_decidedept,gllcrate,applysum,applymny,vdef1,pk_project,vdef2,vdef3,\n" + - "vdef4,vdef10 from v_cmp_apply_b where formmain_id= '"+formmainId+"' " ); + "vdef4,vdef10,vdef14 from v_cmp_apply_b where formmain_id= '"+formmainId+"' " ); List> hashMapsDetails = serviceDataDao.queryListBySWSource(stringBufferDetails.toString(),mdmModuleSourceEntity); JSONArray cmp_apply_b = new JSONArray(); if(CollectionUtils.isNotEmpty(hashMapsDetails)){