MDM公用文件

This commit is contained in:
yuqh 2024-07-04 11:59:44 +08:00
parent d57bba9621
commit d873dce529
1 changed files with 18 additions and 37 deletions

View File

@ -1,5 +1,6 @@
package com.hzya.frame.sysnew.comparison.masterData.service.impl; package com.hzya.frame.sysnew.comparison.masterData.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@ -60,9 +61,9 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) { for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
// applicationCache.get() // applicationCache.get()
// logger.info("入参数据"+jsonObject.toString()); // logger.info("入参数据"+jsonObject.toString());
String startTime = DateUtil.format(json.getDate("startTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间 String startTime = DateUtil.format(json.getDate("startTime"),"yyyy-MM-dd HH:mm");//定时任务执行时传入的开始时间
String endTime = DateUtil.format(json.getDate("endTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的结束时间 String endTime = DateUtil.format(json.getDate("endTime"),"yyyy-MM-dd HH:mm");//定时任务执行时传入的结束时间
// logger.info("本次任务查询区间开始时间:{} 结束时间:{}",startTime,endTime); logger.info("本次任务查询区间开始时间:{} 结束时间:{}",startTime,endTime);
String tableName = ""; String tableName = "";
try { try {
//通过不同的应用类型用于拼接sql //通过不同的应用类型用于拼接sql
@ -75,6 +76,9 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
} }
// if(!"10003".equals(mdmCode)){ // if(!"10003".equals(mdmCode)){
// continue; // continue;
// }
// if(1==1){
// continue;
// } // }
switch (appTyp) {//1致远OA 2用友U8C 3用友BIP switch (appTyp) {//1致远OA 2用友U8C 3用友BIP
case "1": case "1":
@ -101,7 +105,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
if (null != listAll && listAll.size() > 0) { if (null != listAll && listAll.size() > 0) {
ParametricAssembly(mdmModuleSourceEntity, listAll, mdmCode, tableName); ParametricAssembly(mdmModuleSourceEntity, listAll, mdmCode, tableName);
} else { } else {
logger.info("U8C主数据档案没有需要同步中台的数据"); logger.info("U8C主数据档案没有需要同步中台的数据"+mdmCode);
} }
} catch (Exception e) { } catch (Exception e) {
logger.info("主数据同步错误:{}",e.getMessage()); logger.info("主数据同步错误:{}",e.getMessage());
@ -153,7 +157,14 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
sb.append(" and a.modify_date < '"+endTime+"'"); sb.append(" and a.modify_date < '"+endTime+"'");
} }
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("SELECT id as data_id,field0013 AS code,field0014 AS name,field0016 AS pk_custclass,field0015 AS shortname,field0012 AS pk_org FROM formmain_0177 a WHERE 1=1 " +sb.toString()); stringBuffer.append("SELECT a.id as data_id, field0013 AS code, field0014 AS name,\n" +
"0 AS custprop, 1 AS custstate, 2 AS enablestate,\n" +
"'CN' AS pk_country, 'P0800' AS pk_timezone, 'ZH-CN' AS pk_format,\n" +
"'ycjf' AS pk_group, item.code AS pk_custclass_code,item.SHOWVALUE AS pk_custclass,'项目' as custprop_type, field0015 AS shortname,\n" +
"'ycjf' AS pk_org \n" +
"FROM formmain_0177 a\n" +
"LEFT JOIN ctp_enum_item item ON a.field0031 = item.id " +
"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);
if(CollectionUtils.isNotEmpty(hashMaps)){ if(CollectionUtils.isNotEmpty(hashMaps)){
@ -196,40 +207,10 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
}else{ }else{
// ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss"); // ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
sb.append(" and a.update_time >= '"+startTime+"'"); sb.append(" and a.update_time >= '"+startTime+"'");
sb.append(" and a.update_time <> '"+endTime+"'"); sb.append(" and a.update_time < '"+endTime+"'");
} }
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("SELECT\n" + stringBuffer.append("SELECT a.id AS data_id, a.NAME AS user_name, a.CODE AS user_code, e.LOGIN_NAME AS login_name, 'Hzya@1314' as user_password, 'N' as islocked, '1' as user_type, '0' as base_doc_type, '静态密码验证' as identityverifycode, '0000' as pk_org, 'ZH-CN' as format, 'Y' as isca, '2' as enablestate, 'ZH' as contentlang, a.CODE as user_code_q, CASE WHEN EXT_ATTR_11 = '1' THEN '男' WHEN EXT_ATTR_11 = '2' THEN '女' ELSE NULL END AS gender, CASE WHEN ( a.EXT_ATTR_1 IS NULL OR a.EXT_ATTR_1 = '' ) THEN '11111111111' ELSE a.EXT_ATTR_1 END AS mobile FROM org_member a LEFT JOIN org_principal e ON a.id = e.MEMBER_ID WHERE 1=1 and e.LOGIN_NAME IS not null"+ sb.toString()+"" );//
"\ta.id AS data_id,\n" +
"\ta.NAME AS user_name,\n" +
"\ta.CODE AS user_code,\n" +
"\te.LOGIN_NAME AS login_name,\n" +
"\t'hzya@1314' as user_password,\n" +
"\t'N' as islocked,\n" +
"\t'1' as user_type,\n" +
"\t'0' as base_doc_type,\n" +
"\t'静态密码验证' as identityverifycode,\n" +
"\t'0000' as pk_org,\n" +
"\t'ZH-CN' as format,\n" +
"\t'Y' as isca,\n" +
"\t'2' as enablestate,\n" +
"\t'ZH' as contentlang,\n" +
"\ta.CODE as user_code_q,\n" +
"CASE\n" +
"\t\t\n" +
"\t\tWHEN EXT_ATTR_11 = '1' THEN\n" +
"\t\t'男' \n" +
"\t\tWHEN EXT_ATTR_11 = '2' THEN\n" +
"\t\t'女' ELSE NULL \n" +
"\tEND AS gender,\n" +
"CASE\n" +
"\t\t\n" +
"\t\tWHEN ( a.EXT_ATTR_1 IS NULL OR a.EXT_ATTR_1 = '' ) THEN\n" +
"\t\t'11111111111' ELSE a.EXT_ATTR_1 \n" +
"\tEND AS mobile \n" +
"FROM\n" +
"\torg_member a\n" +
"\tLEFT JOIN org_principal e ON a.id = e.MEMBER_ID WHERE 1=1 and e.LOGIN_NAME IS not null"+ sb.toString() );//
// " WHERE 1=1 and a.id = '-2698997042624247722'"); // " WHERE 1=1 and a.id = '-2698997042624247722'");
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);