项目主流程,供应商新增、变更,项目档案新增

This commit is contained in:
hecan 2025-03-12 09:10:29 +08:00
parent ad0e66d7b0
commit 797fd1ae75
7 changed files with 152 additions and 89 deletions

View File

@ -470,7 +470,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
} }
} }
}else {//执行正常下发 }else {//执行正常下发
logger.info("==========开始执行正常主数据下发=============");
//查询主数据 //查询主数据
MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity(); MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity();
queryMdmModuleEntity.setSts("Y"); queryMdmModuleEntity.setSts("Y");
@ -509,13 +509,17 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
queryFildRule.setRuleCode("service"); queryFildRule.setRuleCode("service");
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule); List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
//新增 if(mdmModuleEntities.get(i).getMdmCode()!= 10045L){
doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); //新增
//修改 doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
doUpdate(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); //修改
//删除 doUpdate(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
doDelete(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); //删除
doDelete(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
}else{
logger.info("主数据编码为10045已经在业务数据下发执行主数据下发不执行");
continue;
}
} }
} }
@ -827,6 +831,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
/** body */ /** body */
String bodys = doObjects.get(i).toJSONString(); String bodys = doObjects.get(i).toJSONString();
if(scriptEntity != null && scriptEntity.getId() != null ){ if(scriptEntity != null && scriptEntity.getId() != null ){
logger.info("=========开始执行正常主数据修改下发脚本,第一次==============");
groovy.put("code",scriptEntity.getScriptCode()); groovy.put("code",scriptEntity.getScriptCode());
groovy.put("className",scriptEntity.getClassName()); groovy.put("className",scriptEntity.getClassName());
groovy.put("name",scriptEntity.getScriptName()); groovy.put("name",scriptEntity.getScriptName());
@ -854,6 +859,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
headers.putAll(header); headers.putAll(header);
} }
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) { if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
logger.info("=========正常主数据修改开始执行登录接口==============");
//找到登陆接口 //找到登陆接口
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort()); SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
if (null == loginApi) { if (null == loginApi) {
@ -874,12 +880,15 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
continue; continue;
} }
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString()); JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
logger.info("=======主数据正常修改下发登录返回数据:{}========",attritube.toJSONString());
querys = getQuery(apiEntity,querys,attritube); querys = getQuery(apiEntity,querys,attritube);
headers = getHeaders(apiEntity,headers,attritube); headers = getHeaders(apiEntity,headers,attritube);
bodys = getBodys(apiEntity,bodys,attritube); bodys = getBodys(apiEntity,bodys,attritube);
} }
//组装数据发送 //组装数据发送
logger.info("=========开始执行主业务修改数据下发脚本,第二次==============");
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
logger.info("=====主数据修改下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
if(jsonResultEntity.isFlag()){ 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"); 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 * @param mdmModuleDistributeEntities
* @return void * @return void
**/ **/
private void doAdd(String mdmId,Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities,List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities ) throws Exception { private void
doAdd(String mdmId,Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities,List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities ) throws Exception {
//查询一千条数据 //查询一千条数据
String mainDb = null; String mainDb = null;
List<JSONObject> objects = new ArrayList<>(); List<JSONObject> objects = new ArrayList<>();
@ -1029,6 +1039,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
/** body */ /** body */
String bodys = doObjects.get(i).toJSONString(); String bodys = doObjects.get(i).toJSONString();
if(scriptEntity != null && scriptEntity.getId() != null ){ if(scriptEntity != null && scriptEntity.getId() != null ){
logger.info("=========开始执行正常主数据新增下发脚本,第一次==============");
groovy.put("code",scriptEntity.getScriptCode()); groovy.put("code",scriptEntity.getScriptCode());
groovy.put("className",scriptEntity.getClassName()); groovy.put("className",scriptEntity.getClassName());
groovy.put("name",scriptEntity.getScriptName()); groovy.put("name",scriptEntity.getScriptName());
@ -1056,6 +1067,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
headers.putAll(header); headers.putAll(header);
} }
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) { if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
logger.info("=========正常主数据新增开始执行登录接口==============");
//找到登陆接口 //找到登陆接口
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort()); SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
if (null == loginApi) { if (null == loginApi) {
@ -1076,15 +1088,19 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
continue; continue;
} }
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString()); JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
logger.info("=======主数据正常新增下发登录返回数据:{}========",attritube.toJSONString());
querys = getQuery(apiEntity,querys,attritube); querys = getQuery(apiEntity,querys,attritube);
headers = getHeaders(apiEntity,headers,attritube); headers = getHeaders(apiEntity,headers,attritube);
bodys = getBodys(apiEntity,bodys,attritube); bodys = getBodys(apiEntity,bodys,attritube);
} }
//组装数据发送 //组装数据发送
logger.info("=========开始执行主业务新增数据下发脚本,第二次==============");
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
logger.info("=====主数据新增下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
if(jsonResultEntity.isFlag()){ if(jsonResultEntity.isFlag()){
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) { if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
logger.info("=========开始执行主数据新增返回脚本==============");
JSONObject backScriptJson = new JSONObject(); JSONObject backScriptJson = new JSONObject();
backScriptJson.put("data", jsonResultEntity.getAttribute()); backScriptJson.put("data", jsonResultEntity.getAttribute());
groovy.put("code", scriptEntity.getScriptCode()+"back"); 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"); 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); objects.get(i).put("sendsanfzt123",true);
logger.info("========主数据新增下发完成,日志保存为成功============");
continue; continue;
}else { }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(),doObjects.get(i).toJSONString(),"1");
objects.get(i).put("sendsanfzt123",false); objects.get(i).put("sendsanfzt123",false);
logger.info("========主数据新增下发完成,日志保存为失败============");
continue; continue;
} }
} }

View File

@ -34,6 +34,24 @@ public class ProjectMainFlowEntity extends BaseEntity {
private String auditResult;//审定推送结果 private String auditResult;//审定推送结果
private String archivistResult;//归档推送结果 private String archivistResult;//归档推送结果
private String archivistStatus;//归档推送状态 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() { public String getCompletemoney() {
return completemoney; return completemoney;

View File

@ -19,26 +19,26 @@
,'666' as pkOrg -- 公司编码 ,'666' as pkOrg -- 公司编码
,field0274 as contractno -- 合同号 ,field0274 as contractno -- 合同号
,field0279 as contractname -- 合同名称 ,field0279 as contractname -- 合同名称
,field0081 as creator -- 创建人 ,m4.name as creator -- 创建人
,field0003 as creationtime -- 创建时间 ,field0003 as creationtime -- 创建时间
,field0007 as projectno -- 项目号 ,field0007 as projectno -- 项目号
,field0120 as completemoney -- 完工金额 ,field0116 as completemoney -- 完工金额
,field0294 as completedate -- 完工日期 ,field0294 as completedate -- 完工日期
,field0108 as completepersion -- 完工填单人 ,m1.name as completepersion -- 完工填单人
,field0149 as pinspectionmoney -- 初验金额 ,field0149 as pinspectionmoney -- 初验金额
,field0147 as pinspectiondate -- 初验时间 ,field0147 as pinspectiondate -- 初验时间
,field0159 as pinspectionpersion -- 初验填单人 ,m2.name as pinspectionpersion -- 初验填单人
,field0213 as auditmoney -- 审计金额 ,field0209 as auditmoney -- 审计金额
,field0297 as auditdate -- 审计时间 ,field0297 as auditdate -- 审计时间
,field0237 as auditpersion -- 审计填单人 ,m3.name as auditpersion -- 审计填单人
,null as forecastRevenue -- 预估收入确认 ,null as forecastRevenue -- 预估收入确认
,field0138 as vnote -- 备注 ,field0138 as vnote -- 备注
,field0120 as completemoney -- 完工服务额 ,field0120 as def8 -- 完工服务额
,field0320 as def2 -- F完工辅材额公司 ,field0320 as def2 -- F完工辅材额公司
,field0321 as def3 -- F完工辅材额自购 ,field0321 as def3 -- F完工辅材额自购
,field0294 as completedate -- 完工完成时间 ,field0294 as completedate -- 完工完成时间
,field0112 as def4 -- F实际完工日期 ,field0112 as def4 -- F实际完工日期
,field0213 as auditmoney -- J审定服务金额 ,field0213 as def7 -- J审定服务金额
,field0354 as def5 -- J审定辅材额公司 ,field0354 as def5 -- J审定辅材额公司
,field0355 as def6 -- J审定辅材额自购 ,field0355 as def6 -- J审定辅材额自购
,field0297 as auditdate -- 审计完成时间 ,field0297 as auditdate -- 审计完成时间
@ -57,6 +57,10 @@
from formmain_0219 from formmain_0219
LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0219.id 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 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 WHERE 1=1
and CTP_AFFAIR.node_policy = '审计完成' AND CTP_AFFAIR.complete_time is not null 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 CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0427 is null
@ -72,6 +76,10 @@
from formmain_0219 from formmain_0219
LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0219.id 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 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 WHERE 1=1
and CTP_AFFAIR.node_policy = '归档' AND CTP_AFFAIR.complete_time is not null 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 formmain_0219.id='4000079310249084585'

View File

@ -182,6 +182,8 @@ public class ProjectMainFlowArchivistPluginInitializer extends PluginBaseEntity
htdd01slave4_htdd01slave4.put("def4",projectMainFlowEntity.getDef4()); htdd01slave4_htdd01slave4.put("def4",projectMainFlowEntity.getDef4());
htdd01slave4_htdd01slave4.put("def5",projectMainFlowEntity.getDef5()); htdd01slave4_htdd01slave4.put("def5",projectMainFlowEntity.getDef5());
htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6()); htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6());
htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7());
htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8());
jsonArray.add(htdd01slave4_htdd01slave4); jsonArray.add(htdd01slave4_htdd01slave4);
bill.put("htdd01Master",htdd01Master); bill.put("htdd01Master",htdd01Master);
bill.put("htdd01slave4_htdd01slave4",jsonArray); bill.put("htdd01slave4_htdd01slave4",jsonArray);

View File

@ -174,6 +174,8 @@ public class ProjectMainFlowAuditPluginInitializer extends PluginBaseEntity {
htdd01slave4_htdd01slave4.put("def4",projectMainFlowEntity.getDef4()); htdd01slave4_htdd01slave4.put("def4",projectMainFlowEntity.getDef4());
htdd01slave4_htdd01slave4.put("def5",projectMainFlowEntity.getDef5()); htdd01slave4_htdd01slave4.put("def5",projectMainFlowEntity.getDef5());
htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6()); htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6());
htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7());
htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8());
jsonArray.add(htdd01slave4_htdd01slave4); jsonArray.add(htdd01slave4_htdd01slave4);
bill.put("htdd01Master",htdd01Master); bill.put("htdd01Master",htdd01Master);
bill.put("htdd01slave4_htdd01slave4",jsonArray); bill.put("htdd01slave4_htdd01slave4",jsonArray);

View File

@ -80,7 +80,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
case "1": case "1":
//通过主数据编码判断不同的接口走不通的查询逻辑 //通过主数据编码判断不同的接口走不通的查询逻辑
switch (mdmCode){ switch (mdmCode){
case "10003"://致远用户信息 /*case "10003"://致远用户信息
tableName = "mdm_user"; tableName = "mdm_user";
listAll = bindingUser(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); listAll = bindingUser(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime);
break; break;
@ -91,15 +91,19 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
case "10007"://银行信息 case "10007"://银行信息
tableName = "mdm_bank"; tableName = "mdm_bank";
listAll = binDingBank(jsonObject, mdmModuleSourceEntity, dbCode); listAll = binDingBank(jsonObject, mdmModuleSourceEntity, dbCode);
break; break;*/
case "10046"://BIP供应商档案 /* case "10047"://BIP供应商档案
tableName = "mdm_bip_supplier"; tableName = "mdm_bip_supplier";
listAll = binDingSupplier(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); listAll = binDingSupplier(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime);
break; break;*/
case "10047"://BIP项目档案 case "10048"://BIP项目档案
tableName = "mdm_bip_project"; tableName = "mdm_bip_project";
listAll = binDingProject(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime); listAll = binDingProject(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime);
break; break;
/* case "10049"://BIP供应商银行档案
tableName = "mdm_bip_supplier_bank";
listAll = binDingSupplierBank(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime);
break;*/
default: default:
logger.info("未匹配到主数据的编码,请检查"); logger.info("未匹配到主数据的编码,请检查");
break; break;
@ -123,15 +127,12 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
private List<JSONObject> binDingProject(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception { private List<JSONObject> binDingProject(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception {
List<JSONObject> list = new ArrayList<>(); List<JSONObject> list = new ArrayList<>();
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){ if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){
String code = jsonObject.getString("code"); sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') ");
sb.append(" and code = '"+code+"'"); sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') ");
}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+"'");
} }
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(""); stringBuffer.append("select * from v_hzya_project where 1=1 "+sb.toString());
mdmModuleSourceEntity.setDataSourceCode(dbCode); mdmModuleSourceEntity.setDataSourceCode(dbCode);
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity); List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
int i = 0; int i = 0;
@ -140,7 +141,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
JSONObject main = new JSONObject(); JSONObject main = new JSONObject();
JSONObject mdm = new JSONObject(); JSONObject mdm = new JSONObject();
for(String key:hashMap.keySet()) { for(String key:hashMap.keySet()) {
mdm.put(key, hashMap.get(key)); mdm.put(key.toLowerCase(), hashMap.get(key));
} }
main.put("mdm_bip_project",mdm); main.put("mdm_bip_project",mdm);
list.add(main); list.add(main);
@ -149,26 +150,44 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
return list; return list;
} }
//绑定供应商银行账户
private List<JSONObject> binDingSupplierBank(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception {
List<JSONObject> 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<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
int i = 0;
if(CollectionUtils.isNotEmpty(hashMaps)){
for (HashMap<String, Object> 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<JSONObject> binDingSupplier(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception { private List<JSONObject> binDingSupplier(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception {
List<JSONObject> list = new ArrayList<>(); List<JSONObject> list = new ArrayList<>();
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){ if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){
String code = jsonObject.getString("code"); sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') ");
sb.append(" and code = '"+code+"'"); sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') ");
}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+"'");
} }
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("select \n" + stringBuffer.append("select * from v_hzya_supplier where 1=1 "+sb.toString());
"main.id as data_id,field0139 as orgcode,field0123 as code,field0125 as abbreviate,field0124 as name,\n" + logger.info("主数据抽取供应商的sql语句为:{}",stringBuffer.toString());
"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') ");
mdmModuleSourceEntity.setDataSourceCode(dbCode); mdmModuleSourceEntity.setDataSourceCode(dbCode);
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity); List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
int i = 0; int i = 0;
@ -177,7 +196,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
JSONObject main = new JSONObject(); JSONObject main = new JSONObject();
JSONObject mdm = new JSONObject(); JSONObject mdm = new JSONObject();
for(String key:hashMap.keySet()) { for(String key:hashMap.keySet()) {
mdm.put(key, hashMap.get(key)); mdm.put(key.toLowerCase(), hashMap.get(key));
} }
main.put("mdm_bip_supplier",mdm); main.put("mdm_bip_supplier",mdm);
list.add(main); list.add(main);
@ -300,49 +319,45 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
//查询档案参数组装 //查询档案参数组装
public JsonResultEntity ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List<JSONObject> hashMaps,String mdmCode,String tableName)throws Exception{ public JsonResultEntity ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List<JSONObject> hashMaps,String mdmCode,String tableName)throws Exception{
for (JSONObject hashMap : hashMaps) { JSONObject jsonObjectUser = new JSONObject();
JSONObject main = hashMap.getJSONObject(tableName); List<Object> result=new ArrayList<>();
try {
JSONObject jsonObjectUser = new JSONObject(); for (JSONObject hashMap : hashMaps) {
JSONObject jsonStr = new JSONObject(); JSONObject main = hashMap.getJSONObject(tableName);
jsonObjectUser.put("data_id", main.get("data_id")); JSONObject jsonStr = new JSONObject();
jsonObjectUser.put("mdmCode", mdmCode); jsonObjectUser.put("data_id", main.get("data_id"));
jsonStr.put("jsonStr", jsonObjectUser); jsonObjectUser.put("mdmCode", mdmCode);
//先查询编码和名称查询是否存在 jsonStr.put("jsonStr", jsonObjectUser);
Object attribute = comparisonServiceimpl.queryEntityPage(jsonStr); //先查询编码和名称查询是否存在
logger.info("得到的attribute值为{}", jsonStr.toJSONString(attribute)); Object attribute = comparisonServiceimpl.queryEntityPage(jsonStr);
JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute); logger.info("得到的attribute值为{}", jsonStr.toJSONString(attribute));
JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list"); JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute);
//如果jsonArrayList为null说明没有值在表中不存在 JSONObject pageInfo = jsonObjectAttribute.getJSONObject("pageInfo");
if (jsonArrayList == null || jsonArrayList.size() == 0) { JSONArray jsonArrayList = pageInfo.getJSONArray("list");
// //将查询出来得数据调用通用接口新增保存到表中 //如果jsonArrayList为null说明没有值在表中不存在
// JSONObject main = new JSONObject(); if (jsonArrayList == null || jsonArrayList.size() == 0) {
// for(String key:hashMap.keySet()) { hashMap.put("appName","数智中台");
// main.put(key, hashMap.get(key)); hashMap.put("appCode","800004");
// } hashMap.put("mdmCode", mdmCode);
// jsonObjectUser.put("main", main); hashMap.put("optionName", "数智中台");
hashMap.put("appName","数智中台"); jsonStr.put("jsonStr", hashMap);
hashMap.put("appCode","800004"); Object object = comparisonServiceimpl.saveEntity(jsonStr);
hashMap.put("mdmCode", mdmCode); logger.info("新增结果为:{}", JSON.toJSONString(object));
hashMap.put("optionName", "数智中台"); result.add(object);
jsonStr.put("jsonStr", hashMap); } else {
Object result = comparisonServiceimpl.saveEntity(jsonStr); hashMap.put("appName","数智中台");
logger.info("新增结果为:{}", JSON.toJSONString(result)); hashMap.put("appCode","800004");
// if(!result.isFlag()){ hashMap.put("mdmCode", mdmCode);
// throw new BaseSystemException("主数据保存失败"+ result.getMsg()); hashMap.put("optionName", "数智中台");
// } jsonStr.put("jsonStr", hashMap);
} else { Object object = comparisonServiceimpl.updateEntity(jsonStr);
hashMap.put("appName","数智中台"); logger.info("更新结果为:{}", JSON.toJSONString(result));
hashMap.put("appCode","800004"); result.add(object);
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());
// }
} }
}catch (Exception e){
logger.info("将数据查询之后进行组装调用通用方法错误:{}",e.getMessage());
e.printStackTrace();
} }
return null; return null;
} }

View File

@ -304,7 +304,7 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
"push_status_field,summary_id,bip_payment_number_field,bip_amount_field,\n" + "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" + "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" + "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); mdmModuleSourceEntity.setDataSourceCode(dbCode);
List<HashMap<String, Object>> hashMaps = serviceDataDao.queryListBySWSource(stringBuffer.toString(), mdmModuleSourceEntity); List<HashMap<String, Object>> hashMaps = serviceDataDao.queryListBySWSource(stringBuffer.toString(), mdmModuleSourceEntity);
int i = 0; int i = 0;
@ -321,7 +321,7 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
StringBuffer stringBufferDetails = new StringBuffer(); 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" + 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" + "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<HashMap<String, Object>> hashMapsDetails = serviceDataDao.queryListBySWSource(stringBufferDetails.toString(),mdmModuleSourceEntity); List<HashMap<String, Object>> hashMapsDetails = serviceDataDao.queryListBySWSource(stringBufferDetails.toString(),mdmModuleSourceEntity);
JSONArray cmp_apply_b = new JSONArray(); JSONArray cmp_apply_b = new JSONArray();
if(CollectionUtils.isNotEmpty(hashMapsDetails)){ if(CollectionUtils.isNotEmpty(hashMapsDetails)){