修改适配达梦

This commit is contained in:
lvleigang 2024-06-28 14:00:52 +08:00
parent 197c7620c5
commit c333f3f84f
8 changed files with 324 additions and 127 deletions

View File

@ -247,6 +247,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
map.put("documentRule",documentRule);
object = mdmModuleDao.queryMdmST(map);
object = toLowerCaseKeys(object);
if(object.getString("id") == null || "".equals(object.getString("id")) ){
taskDetailEntity.setResult("当前数据不存在");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
@ -258,6 +259,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
checkData.put("documentRule",documentRule);
checkData.put("mdmModuleDistributeDetailEntities",mdmModuleDistributeDetailEntities);
JSONObject object1 = mdmModuleDao.queryMdmST(checkData);
object1 = toLowerCaseKeys(object1);
if(object1.getString("id") == null || "".equals(object1.getString("id")) ){
taskDetailEntity.setResult("当前数据不符合规则不发送");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
@ -278,6 +281,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
String[] idss = ids.split(",");
mapDetail.put("id", idss[idss.length-1]);
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
objectDetail = toLowerCaseKeys(objectDetail);
object.put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail);
}
}
@ -295,6 +299,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
map.put("formmainId",object.getString("id"));
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
detail = toLowerCaseKeys(detail);
//查看主表是否有字段是关联的
if(detail != null && detail.size() > 0){
if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){
@ -312,6 +318,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
mapDetail.put("id", idss[idss.length-1]);
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
objectDetail = toLowerCaseKeys(objectDetail);
detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail);
}
@ -482,6 +490,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map1.put("deleteStatus", "0");
map1.put("size", 1000);
objects = mdmModuleDao.queryMdmSTs(map1);
objects = toLowerCaseKeys(objects);
if(objects == null || objects.size() == 0){
return;
@ -500,6 +509,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
map.put("ids", objects);
List<JSONObject> doObjects = mdmModuleDao.queryMdmSTs(map);
doObjects = toLowerCaseKeys(doObjects);
if(doObjects == null || doObjects.size() == 0){
continue;
}
@ -657,6 +668,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map1.put("updateStatus", "0");
map1.put("size", 1000);
objects = mdmModuleDao.queryMdmSTs(map1);
objects = toLowerCaseKeys(objects);
if(objects == null || objects.size() == 0){
return;
@ -675,6 +687,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
map.put("ids", objects);
List<JSONObject> doObjects = mdmModuleDao.queryMdmSTs(map);
doObjects = toLowerCaseKeys(doObjects);
if(doObjects == null || doObjects.size() == 0){
continue;
}
@ -830,6 +844,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map1.put("addStatus", "0");
map1.put("size", 1000);
objects = mdmModuleDao.queryMdmSTs(map1);
objects = toLowerCaseKeys(objects);
if(objects == null || objects.size() == 0){
return;
@ -848,6 +863,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
map.put("ids", objects);
List<JSONObject> doObjects = mdmModuleDao.queryMdmSTs(map);
doObjects = toLowerCaseKeys(doObjects);
if(doObjects == null || doObjects.size() == 0){
continue;
}
@ -1016,6 +1033,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
map.put("formmainId",object.getString("id"));
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
detail = toLowerCaseKeys(detail);
//查看主表是否有字段是关联的
if(detail != null && detail.size() > 0){
if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){
@ -1032,6 +1051,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
String[] idss = ids.split(",");
mapDetail.put("id", idss[idss.length-1]);
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
objectDetail = toLowerCaseKeys(objectDetail);
detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail);
}
}
@ -1275,4 +1296,23 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
}
return sendData.toString();
}
public JSONObject toLowerCaseKeys(JSONObject jsonObject) {
JSONObject lowerCaseJson = new JSONObject();
if (jsonObject != null) {
for (String key : jsonObject.keySet()) {
Object value = jsonObject.get(key);
lowerCaseJson.put(key.toLowerCase(), value);
}
}
return lowerCaseJson;
}
public List<JSONObject> toLowerCaseKeys(List<JSONObject> list) {
List<JSONObject> jsonObjects = new ArrayList<>();
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
jsonObjects.add(toLowerCaseKeys(list.get(i)));
}
}
return jsonObjects;
}
}

View File

@ -22,12 +22,15 @@ spring:
# password: 62e4295b615a30dbf3b8ee96f41c820b
# driver-class-name: dm.jdbc.driver.DmDriver
# type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://hzya.ufyct.com:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
# url: jdbc:mysql://hzya.ufyct.com:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
# username: root
# password: 62e4295b615a30dbf3b8ee96f41c820b
# driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
# url: jdbc:dm://hzya.ufyct.com:9040/businesscenter?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
url: jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
username: hzyazt
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: dm.jdbc.driver.DmDriver
savefile:
# 文件保存路径
path: /Users/apple/Desktop/log/local

View File

@ -63,6 +63,6 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> {
* @param
* @return java.util.List<java.lang.Object>
**/
List<String> queryMdMFields(Map<String, Object> maps);
//List<String> queryMdMFields(Map<String, Object> maps);
}

View File

@ -114,10 +114,10 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
@Override
public List<HashMap<String, Object>> queryMdmShowData(MdmQuery entity) {
HashMap<String, Object> maps = new HashMap<>();
maps.put("tableName",entity.getTableName());
List<String> fields = queryMdMFields(maps);
entity.setFields(fields);
//HashMap<String, Object> maps = new HashMap<>();
//maps.put("tableName",entity.getTableName());
//List<String> fields = queryMdMFields(maps);
//entity.setFields(fields);
List<HashMap<String, Object>> o = (List<HashMap<String, Object>>) super.selectList(getSqlIdPrifx() + "queryMdmShowData", entity);
return o;
}
@ -155,9 +155,8 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
@Override
public JSONObject queryMdmST(Map<String, Object> maps) {
List<String> fields = queryMdMFields(maps);
maps.put("fields",fields);
//List<String> fields = queryMdMFields(maps);
//maps.put("fields",fields);
JSONObject o = (JSONObject) super.selectOne(getSqlIdPrifx() + "queryMdmST", maps);
return o;
}
@ -172,16 +171,16 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
super.update(getSqlIdPrifx() + "updateMdmSTs", maps);
}
@Override
public List<String> queryMdMFields(Map<String, Object> maps) {
List<String> o = (List<String>) super.selectList(getSqlIdPrifx() + "queryMdMFields", maps);
return o;
}
//@Override
//public List<String> queryMdMFields(Map<String, Object> maps) {
// List<String> o = (List<String>) super.selectList(getSqlIdPrifx() + "queryMdMFields", maps);
// return o;
//}
@Override
public List<JSONObject> queryMdmSTDetail(Map<String, Object> maps) {
List<String> fields = queryMdMFields(maps);
maps.put("fields", fields );
//List<String> fields = queryMdMFields(maps);
//maps.put("fields", fields );
List<JSONObject> o = (List<JSONObject>) super.selectList(getSqlIdPrifx() + "queryMdmSTDetail", maps);
return o;
}

View File

@ -554,10 +554,7 @@ where id = #{id}
</trim>
</if>
<if test="returnField == null or returnField.size == 0">
<foreach item="field" collection="fields" separator="," >
a.${field}
</foreach>
a.*
</if>
from ${tableName} a
<trim prefix="where" prefixOverrides="and">
@ -663,11 +660,61 @@ where id = #{id}
</if>
</foreach>
</if>
modify_time = now(),
</trim>
where id = #{id}
</update>
<insert id="saveForm" databaseId="oracle" parameterType="com.hzya.frame.mdm.entity.MdmDataDto">
insert into ${tableName}(
<trim suffix="" suffixOverrides=",">
<if test="mdmDataFiledDtos != null and mdmDataFiledDtos.size>0">
<foreach collection="mdmDataFiledDtos" item="item" index="index">
<if test="item.filedsName != 'logid'.toString() ">
${item.filedsName},
</if>
<if test="item.filedsName == 'logid'.toString() ">
create_user_id,
modify_user_id,
</if>
</foreach>
</if>
create_time,
modify_time,
sts,
<if test="dbType == '1'.toString()">
document_rule,
document_rule_num,
</if>
</trim>
)values
(
<trim suffix="" suffixOverrides=",">
<if test="mdmDataFiledDtos != null and mdmDataFiledDtos.size>0">
<foreach collection="mdmDataFiledDtos" item="item" index="index">
<if test="item.filedsName != 'logid'.toString() ">
#{item.filedsValue},
</if>
<if test="item.filedsName == 'logid'.toString() ">
#{item.filedsValue},
#{item.filedsValue},
</if>
</foreach>
</if>
now(),
now(),
'Y',
<if test="dbType == '1'.toString()">
concat(#{documentRule},
LPAD( CAST( ( SELECT IFNULL( MAX(f.document_rule_num), 0 )+ 1 FROM ${tableName} f WHERE DATE_FORMAT( f.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' ) ) AS varchar(50) ), ${documentRuleNum} , '0' )
),
(SELECT IFNULL( MAX(f.document_rule_num), 0 )+ 1 FROM ${tableName} f WHERE DATE_FORMAT( f.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )
)
</if>
</trim>
)
</insert>
<insert id="saveForm" parameterType="com.hzya.frame.mdm.entity.MdmDataDto">
insert into ${tableName}(
<trim suffix="" suffixOverrides=",">
@ -822,9 +869,15 @@ where id = #{id}
<!-- 分页查询列表 采用like格式 -->
<select id="queryMdmST" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.util.HashMap">
select
<if test="field != null and field.size>0">
<foreach item="field" collection="fields" separator="," >
${field}
</foreach>
</if>
<if test="field == null or field.size == 0">
*
</if>
from ${tableName}
<trim prefix="where" prefixOverrides="and">
<if test="documentRule != null and documentRule !='' ">and document_rule = #{documentRule}</if>
@ -894,9 +947,14 @@ where id = #{id}
<select id="queryMdmSTDetail" resultType="com.alibaba.fastjson.JSONObject"
parameterType="java.util.HashMap">
select
<if test="field != null and field.size>0">
<foreach item="field" collection="fields" separator="," >
${field}
</foreach>
</if>
<if test="field == null or field.size == 0">
*
</if>
from ${tableName} where sts='Y' and formmain_id = #{formmainId}
</select>

View File

@ -610,7 +610,7 @@ public class MdmServiceImpl implements IMdmService {
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){
if (entity.getMdmCode() != null && !"".equals(entity.getMdmCode())) {
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) {
return BaseResult.getFailureMessageEntity("主数据设置错误");
@ -619,11 +619,25 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId());
mdmModuleDbEntity.setSts("Y");
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId());
mdmModuleDbFiledsEntity.setSts("Y");
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity);
if (mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0) {
return BaseResult.getFailureMessageEntity("主数据设置错误");
}
if (mdmModuleDbFiledsEntities == null || mdmModuleDbFiledsEntities.size() == 0) {
return BaseResult.getFailureMessageEntity("主数据设置错误");
}
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
if ("1".equals(mdmModuleDbEntities.get(i).getDbType())) {
List<String> returnField = new ArrayList<>();
for (int i1 = 0; i1 < mdmModuleDbFiledsEntities.size(); i1++) {
if (mdmModuleDbEntities.get(i).getId().equals(mdmModuleDbFiledsEntities.get(i1).getDbId())) {
returnField.add(mdmModuleDbFiledsEntities.get(i1).getEnName());
}
}
entity.setReturnField(returnField);
entity.setTableName(mdmModuleDbEntities.get(i).getDbName());
break;
}
@ -642,8 +656,9 @@ public class MdmServiceImpl implements IMdmService {
PageInfo pageInfo = new PageInfo(businessResult);
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
}
//强制转换数据库字段为小写,出问题在说
public static void convertKeysToLowerCase(List<HashMap<String, Object>> list) {
public void convertKeysToLowerCase(List<HashMap<String, Object>> list) {
for (HashMap<String, Object> map : list) {
HashMap<String, Object> lowerCaseMap = new HashMap<>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
@ -653,6 +668,16 @@ public class MdmServiceImpl implements IMdmService {
map.putAll(lowerCaseMap); // 将转换后的Map全部放回原位
}
}
//强制转换数据库字段为小写,出问题在说
public void convertKeysToLowerCase(HashMap<String, Object> list) {
HashMap<String, Object> lowerCaseMap = new HashMap<>();
for (Map.Entry<String, Object> entry : list.entrySet()) {
lowerCaseMap.put(entry.getKey().toLowerCase(), entry.getValue());
}
list.clear(); // 清空原来的Map避免重复存储
list.putAll(lowerCaseMap); // 将转换后的Map全部放回原位
}
//
///**
// * @param object
@ -761,10 +786,12 @@ public class MdmServiceImpl implements IMdmService {
if (entity.getPageNum() != null && entity.getPageSize() != null) {
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
List<HashMap<String, Object>> mapList = mdmModuleDao.querySelectData(entity);
convertKeysToLowerCase(mapList);
PageInfo pageInfo = new PageInfo(mapList);
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
} else {
List<HashMap<String, Object>> mapList = mdmModuleDao.querySelectData(entity);
convertKeysToLowerCase(mapList);
return BaseResult.getSuccessMessageEntity("查询数据成功", mapList);
}
}
@ -792,7 +819,7 @@ public class MdmServiceImpl implements IMdmService {
if (entity.getUpId() == null || "".equals(entity.getUpId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){
if (entity.getMdmCode() != null && !"".equals(entity.getMdmCode())) {
//查询模版
MdmModuleEntity mdmModuleEntities = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
if (mdmModuleEntities == null) {
@ -812,6 +839,7 @@ public class MdmServiceImpl implements IMdmService {
break;
}
}
entity.setTableName(mdmModuleDbEntity.getDbName());
}
@ -827,6 +855,7 @@ public class MdmServiceImpl implements IMdmService {
List<HashMap<String, Object>> returnList = new ArrayList<>();
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
}
convertKeysToLowerCase(mapList);
List<HashMap<String, Object>> returnList = gettochilder(strArray, 0, mapList);
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
} else {
@ -835,8 +864,12 @@ public class MdmServiceImpl implements IMdmService {
List<HashMap<String, Object>> returnList = new ArrayList<>();
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
}
HashMap<String, Object> lowerCaseMap = new HashMap<>();
for (Map.Entry<String, Object> entry : mapList.entrySet()) {
lowerCaseMap.put(entry.getKey().toLowerCase(), entry.getValue());
}
List<HashMap<String, Object>> returnList = new ArrayList<>();
returnList.add(mapList);
returnList.add(lowerCaseMap);
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
}
} else {
@ -844,6 +877,7 @@ public class MdmServiceImpl implements IMdmService {
List<HashMap<String, Object>> returnList = new ArrayList<>();
if (mapList != null && mapList.size() > 0) {
convertKeysToLowerCase(mapList);
for (int i = 0; i < mapList.size(); i++) {
//默认为根
if (mapList.get(i).get(entity.getUpId()) == null || "".equals(mapList.get(i).get(entity.getUpId()))) {
@ -1315,7 +1349,7 @@ public class MdmServiceImpl implements IMdmService {
//String tablename = null;
JSONObject jsonObject = new JSONObject();
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
if("1".equals(mdmModuleDbEntityList.get(i).getDbType()) || "2".equals(mdmModuleDbEntityList.get(i).getDbType())){
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType()) || "2".equals(mdmModuleDbEntityList.get(i).getDbType())) {
//查询数据
Map<String, Object> queryData = new HashMap<>();
queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名
@ -1323,12 +1357,15 @@ public class MdmServiceImpl implements IMdmService {
queryData.put("detailFlag", false);//是否明细
queryData.put("id", entity.getId());//字段
HashMap<String, Object> datas = mdmModuleDbDao.getServiceDataById(queryData);
convertKeysToLowerCase(datas);
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas);
//tablename = mdmModuleDbEntityList.get(i).getDbName() + "_distribute";
} else {
queryData.put("detailFlag", true);//是否明细
queryData.put("id", entity.getId());//字段
List<HashMap<String, Object>> datas = mdmModuleDbDao.getServiceByFormmainId(queryData);
convertKeysToLowerCase(datas);
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas);
}
}
@ -1380,7 +1417,7 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
return BaseResult.getFailureMessageEntity("系统错误");
}
String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList,"界面修改");
String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList, "界面修改");
if (res == null || "".equals(res)) {
return BaseResult.getSuccessMessageEntity("修改数据成功");
@ -1426,7 +1463,7 @@ public class MdmServiceImpl implements IMdmService {
}
String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList,"界面新增");
String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList, "界面新增");
if (res == null || "".equals(res)) {
return BaseResult.getSuccessMessageEntity("保存数据成功");
@ -1435,9 +1472,9 @@ public class MdmServiceImpl implements IMdmService {
}
}
private void saveOption(String dbname ,Long mdmCode ,JSONObject jsonObject,String id,String msg) {
private void saveOption(String dbname, Long mdmCode, JSONObject jsonObject, String id, String msg) {
MdmModuleOptionLogEntity mdmModuleOptionLogEntity = new MdmModuleOptionLogEntity();
mdmModuleOptionLogEntity.setTableName(dbname+"_option_log");
mdmModuleOptionLogEntity.setTableName(dbname + "_option_log");
mdmModuleOptionLogEntity.setMdmCode(mdmCode);
mdmModuleOptionLogEntity.setFormmainId(id);
mdmModuleOptionLogEntity.setSourceName("数智中台");
@ -1447,7 +1484,7 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleOptionLogEntity.setSourceData(jsonObject.toJSONString());
mdmModuleOptionLogEntity.setOptionType(msg);
SysUserEntity sysUserEntity = sysUserDao.get(StpUtil.getLoginIdAsString());
if(sysUserEntity != null){
if (sysUserEntity != null) {
mdmModuleOptionLogEntity.setOptionName(sysUserEntity.getPersonName());
}
mdmModuleOptionLogEntity.setCreate();
@ -1516,6 +1553,8 @@ public class MdmServiceImpl implements IMdmService {
queryData.put("detailFlag", false);//是否明细
queryData.put("id", jsonObject.getString("id"));//字段
HashMap<String, Object> datas = mdmModuleDbDao.getServiceDataById(queryData);
convertKeysToLowerCase(datas);
String upValue = null;
if (datas != null && datas.get(mdmModuleViewEntity.getUpIdFiled()) != null) {
upValue = datas.get(mdmModuleViewEntity.getUpIdFiled()).toString();
@ -1540,10 +1579,31 @@ public class MdmServiceImpl implements IMdmService {
}
saveOption(dbname,mdmModuleEntity.getMdmCode(),jsonObject,jsonObject.getString("id"),"界面删除");
saveOption(dbname, mdmModuleEntity.getMdmCode(), jsonObject, jsonObject.getString("id"), "界面删除");
return BaseResult.getSuccessMessageEntity("删除数据成功");
}
public JSONObject toLowerCaseKeys(JSONObject jsonObject) {
JSONObject lowerCaseJson = new JSONObject();
if (jsonObject != null) {
for (String key : jsonObject.keySet()) {
Object value = jsonObject.get(key);
lowerCaseJson.put(key.toLowerCase(), value);
}
}
return lowerCaseJson;
}
public List<JSONObject> toLowerCaseKeys(List<JSONObject> list) {
List<JSONObject> jsonObjects = new ArrayList<>();
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
jsonObjects.add(toLowerCaseKeys(list.get(i)));
}
}
return jsonObjects;
}
/**
* @param jsonStr
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -1660,6 +1720,7 @@ public class MdmServiceImpl implements IMdmService {
map.put("tableName", mdmModuleDbEntities.get(i).getDbName());
map.put("id", id);
object = mdmModuleDao.queryMdmST(map);
object = toLowerCaseKeys(object);
if (object.getString("id") == null || "".equals(object.getString("id"))) {
return BaseResult.getFailureMessageEntity("当前数据不存在");
}
@ -1669,6 +1730,7 @@ public class MdmServiceImpl implements IMdmService {
checkData.put("id", id);
checkData.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
JSONObject object1 = mdmModuleDao.queryMdmST(checkData);
object1 = toLowerCaseKeys(object1);
if (object1 == null || object1.getString("id") == null || "".equals(object1.getString("id"))) {
return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送");
}
@ -1680,13 +1742,14 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) {
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
if(object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null){
if (object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null) {
Map<String, Object> mapDetail = new HashMap<>();
mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
String ids = object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName());
String[] idss = ids.split(",");
mapDetail.put("id", idss[idss.length-1]);
mapDetail.put("id", idss[idss.length - 1]);
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
objectDetail = toLowerCaseKeys(objectDetail);
object.put(mdmModuleDbFiledsEntities.get(i2).getEnName(), objectDetail);
}
}
@ -1706,6 +1769,7 @@ public class MdmServiceImpl implements IMdmService {
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
//查看主表是否有字段是关联的
if (detail != null && detail.size() > 0) {
detail = toLowerCaseKeys(detail);
if (mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0) {
for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
if (mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())) {
@ -1713,13 +1777,15 @@ public class MdmServiceImpl implements IMdmService {
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
for (int i3 = 0; i3 < detail.size(); i3++) {
if(detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null){
if (detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null) {
Map<String, Object> mapDetail = new HashMap<>();
mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
String ids = detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName());
String[] idss = ids.split(",");
mapDetail.put("id", idss[idss.length-1]);
mapDetail.put("id", idss[idss.length - 1]);
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
objectDetail = toLowerCaseKeys(objectDetail);
detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(), objectDetail);
}
}
@ -1777,41 +1843,42 @@ public class MdmServiceImpl implements IMdmService {
//找到登陆接口
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
if (null == loginApi) {
saveMdmModuleSendLogEntity("2","转发失败,认证接口不存在",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
saveMdmModuleSendLogEntity("2", "转发失败,认证接口不存在", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误,认证接口不存在");
}
String rzquerys = getQuery(loginApi,null,null);
String rzquerys = getQuery(loginApi, null, null);
Map<String, String> headersa = new HashMap<>();
headersa.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
headersa.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
headersa.put("appId", sysApplicationEntity.getAppId().toString());
headersa.put("apiCode", loginApi.getApiCode().toString());
Map<String, String> rzheaders = getHeaders(loginApi,headersa,null);
String rzbodys = getBodys(loginApi,null,null);
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
Map<String, String> rzheaders = getHeaders(loginApi, headersa, null);
String rzbodys = getBodys(loginApi, null, null);
JsonResultEntity rzjsonResultEntity = sendData(loginApi, rzheaders, rzbodys, rzquerys);
if (!rzjsonResultEntity.isFlag()) {
saveMdmModuleSendLogEntity("2","转发失败,认证接口调用失败",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误:"+rzjsonResultEntity.getMsg());
saveMdmModuleSendLogEntity("2", "转发失败,认证接口调用失败", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误:" + rzjsonResultEntity.getMsg());
}
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
//JSONObject attritube = attritube1.getJSONObject("attribute");
querys = getQuery(apiEntity,querys,attritube);
headers = getHeaders(apiEntity,headers,attritube);
bodys = getBodys(apiEntity,bodys,attritube);
querys = getQuery(apiEntity, querys, attritube);
headers = getHeaders(apiEntity, headers, attritube);
bodys = getBodys(apiEntity, bodys, attritube);
}
//组装数据发送
JsonResultEntity jsonResultEntity = sendData(apiEntity, headers,bodys,querys);
JsonResultEntity jsonResultEntity = sendData(apiEntity, headers, bodys, querys);
if (jsonResultEntity.isFlag()) {
saveMdmModuleSendLogEntity("1","发送成功",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
saveMdmModuleSendLogEntity("1", "发送成功", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
return BaseResult.getSuccessMessageEntity("发送成功");
} else {
saveMdmModuleSendLogEntity("2","转发失败",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误:"+jsonResultEntity.getMsg());
saveMdmModuleSendLogEntity("2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误:" + jsonResultEntity.getMsg());
}
}
private Map<String, String> getHeaders(SysApplicationApiEntity loginApi,Map<String, String> map,JSONObject loginData) {
if(loginData == null){
private Map<String, String> getHeaders(SysApplicationApiEntity loginApi, Map<String, String> map, JSONObject loginData) {
if (loginData == null) {
loginData = new JSONObject();
}
if (loginApi.getHeaderIn() != null && !"".equals(loginApi.getHeaderIn())) {
@ -1831,11 +1898,11 @@ public class MdmServiceImpl implements IMdmService {
}
} else {
if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值如果没有不添加
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
if (map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null) {
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue()));
}
} else {//没有值直接拼接
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
if (map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null) {
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), "");
}
}
@ -1846,27 +1913,25 @@ public class MdmServiceImpl implements IMdmService {
return map;
}
private String getQuery(SysApplicationApiEntity loginApi,String sendDatastr,JSONObject loginData) {
private String getQuery(SysApplicationApiEntity loginApi, String sendDatastr, JSONObject loginData) {
Map<String, String> map = new HashMap<>();
if(sendDatastr != null){
if (sendDatastr != null) {
String[] parts = sendDatastr.split("&");
if(parts != null && parts.length > 0){
if (parts != null && parts.length > 0) {
for (int i = 0; i < parts.length; i++) {
String[] part = parts[i].split("=");
if(part != null && part.length >=2 ){
if (part != null && part.length >= 2) {
for (int a = 0; a < part.length; a++) {
map.put(part[0],part[1]);
map.put(part[0], part[1]);
}
}
}
}
}
if(loginData == null){
if (loginData == null) {
loginData = new JSONObject();
}
if (loginApi.getQueryIn() != null && !"".equals(loginApi.getQueryIn())) {
@ -1887,11 +1952,11 @@ public class MdmServiceImpl implements IMdmService {
} else {
//不是认证类型直接取值
if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值如果没有不添加
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
if (map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null) {
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue()));
}
} else {//没有值直接拼接
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
if (map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null) {
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), "");
}
}
@ -1900,17 +1965,18 @@ public class MdmServiceImpl implements IMdmService {
}
}
StringBuffer returnStr = new StringBuffer();
if(map != null && map.size() > 0){
if (map != null && map.size() > 0) {
for (String key : map.keySet()) {
if("".equals(returnStr)){
if ("".equals(returnStr)) {
returnStr.append(key).append("=").append(map.get(key));
}else {
} else {
returnStr.append("&").append(key).append("=").append(map.get(key));
}
}
}
return returnStr.toString();
}
/**
* @param loginData
* @param example
@ -1936,12 +2002,13 @@ public class MdmServiceImpl implements IMdmService {
}
return values;
}
private String getBodys(SysApplicationApiEntity loginApi,String sendDatastr, JSONObject loginData) {
private String getBodys(SysApplicationApiEntity loginApi, String sendDatastr, JSONObject loginData) {
JSONObject sendData = new JSONObject();
if(sendDatastr != null ){
if (sendDatastr != null) {
sendData = JSONObject.parseObject(sendDatastr);
}
if(loginData == null){
if (loginData == null) {
loginData = new JSONObject();
}
if (loginApi.getBodyIn() != null && !"".equals(loginApi.getBodyIn())) {
@ -1955,7 +2022,7 @@ public class MdmServiceImpl implements IMdmService {
if (query != null && !"".equals(query)) {
JSONArray example = JSONArray.parseArray(query);
String logValue = getObjectValue(loginData, example);
sendData.put(querys.getString(SysEnum.PARAMETERNAME.getValue()),logValue);
sendData.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), logValue);
}
}
}
@ -1963,6 +2030,7 @@ public class MdmServiceImpl implements IMdmService {
}
return sendData.toString();
}
/**
* @param querys 设置的字段属性
* @param sendData 发送数据
@ -2077,15 +2145,15 @@ public class MdmServiceImpl implements IMdmService {
//设置api的参数
//返回数据
JSONArray sendArray = sendData.getJSONArray(querys.getString(SysEnum.PARAMETERNAME.getValue()));
if(sendArray == null || sendArray.size() == 0){
if (sendArray == null || sendArray.size() == 0) {
return new JSONArray();
}
String childers = querys.getString(SysEnum.CHILDREN.getValue());
if(childers == null || "".equals(childers)){
if (childers == null || "".equals(childers)) {
return new JSONArray();
}
JSONArray childersObj = JSONArray.parseArray(childers);
if(childersObj == null || childersObj.size() == 0){
if (childersObj == null || childersObj.size() == 0) {
return new JSONArray();
}
JSONArray obj = new JSONArray();
@ -2194,9 +2262,9 @@ public class MdmServiceImpl implements IMdmService {
}
}
private void saveMdmModuleSendLogEntity(String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) {
private void saveMdmModuleSendLogEntity(String dataType, String remark, String dbname, String formmain_id, String target_app, String target_api, String source_data, String option_type) {
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
mdmModuleSendLogEntity.setTableName(dbname + "_send_log");
mdmModuleSendLogEntity.setCreate();
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
mdmModuleSendLogEntity.setSts("Y");
@ -2228,11 +2296,11 @@ public class MdmServiceImpl implements IMdmService {
* @Description 校验数据
* @Date 11:20 上午 2023/11/6
**/
private String checkDataOnly(long mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List<MdmModuleDbEntity> mdmModuleDbEntityList,String msg) {
private String checkDataOnly(long mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List<MdmModuleDbEntity> mdmModuleDbEntityList, String msg) {
StringBuffer str = new StringBuffer();
String dbname = null;
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) {
dbname = mdmModuleDbEntityList.get(i).getDbName();
}
}
@ -2398,12 +2466,29 @@ public class MdmServiceImpl implements IMdmService {
List<MdmDataFiledDto> mdmDataFiledDtos = new ArrayList<>();
for (int i1 = 0; i1 < fileds.size(); i1++) {
if (jsonObject.get(fileds.get(i1).getEnName()) != null) {
if (flag && "update_status".equals(fileds.get(i1).getEnName())) {
MdmDataFiledDto update_status = new MdmDataFiledDto();
update_status.setFiledsName("update_status");
update_status.setFiledsValue("0");
mdmDataFiledDtos.add(update_status);
}else if(flag && "data_status".equals(fileds.get(i1).getEnName())) {
MdmDataFiledDto data_status = new MdmDataFiledDto();
data_status.setFiledsName("data_status");
data_status.setFiledsValue("F");
mdmDataFiledDtos.add(data_status);
}else if(flag && "modify_user_id".equals(fileds.get(i1).getEnName())) {
MdmDataFiledDto data_status = new MdmDataFiledDto();
data_status.setFiledsName("modify_user_id");
data_status.setFiledsValue("F");
//mdmDataFiledDtos.add(data_status);
}else {
MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto();
mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName());
mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName()));
mdmDataFiledDtos.add(mdmDataFiledDto);
}
}
}
MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto();
mdmDataFiledDto.setFiledsName("logid");
mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString());
@ -2412,15 +2497,7 @@ public class MdmServiceImpl implements IMdmService {
if (flag) {
mdmDataDto.setId(jsonObject.getString("id"));
id = jsonObject.getString("id");
MdmDataFiledDto update_status = new MdmDataFiledDto();
update_status.setFiledsName("update_status");
update_status.setFiledsValue("0");
mdmDataFiledDtos.add(update_status);
MdmDataFiledDto data_status = new MdmDataFiledDto();
data_status.setFiledsName("data_status");
data_status.setFiledsValue("F");
;
mdmDataFiledDtos.add(data_status);
int a = mdmModuleDao.updateForm(mdmDataDto);
} else {
@ -2496,7 +2573,7 @@ public class MdmServiceImpl implements IMdmService {
mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName());
List<MdmDataFiledDto> mdmDataFiledDtos = new ArrayList<>();
for (int i1 = 0; i1 < fileds.size(); i1++) {
if("id".equals(fileds.get(i1).getEnName())){
if ("id".equals(fileds.get(i1).getEnName())) {
if (jsonObject.getString("id") != null) {
MdmDataFiledDto ids = new MdmDataFiledDto();
ids.setFiledsName("id");
@ -2508,12 +2585,12 @@ public class MdmServiceImpl implements IMdmService {
ids.setFiledsValue(UUIDUtils.getUUID());
mdmDataFiledDtos.add(ids);
}
}else if("formmain_id".equals(fileds.get(i1).getEnName())){
} else if ("formmain_id".equals(fileds.get(i1).getEnName())) {
MdmDataFiledDto formain_id = new MdmDataFiledDto();
formain_id.setFiledsName("formmain_id");
formain_id.setFiledsValue(id);
mdmDataFiledDtos.add(formain_id);
}else if("data_status".equals(fileds.get(i1).getEnName())){
} else if ("data_status".equals(fileds.get(i1).getEnName())) {
if (jsonObject.getString("id") != null) {
MdmDataFiledDto ids = new MdmDataFiledDto();
ids.setFiledsName("data_status");
@ -2525,9 +2602,9 @@ public class MdmServiceImpl implements IMdmService {
ids.setFiledsValue("Y");
mdmDataFiledDtos.add(ids);
}
}else if("sorts".equals(fileds.get(i1).getEnName())){
} else if ("sorts".equals(fileds.get(i1).getEnName())) {
}else if("create_user_id".equals(fileds.get(i1).getEnName())){
} else if ("create_user_id".equals(fileds.get(i1).getEnName())) {
//if (jsonObject.getString("id") != null) {
//
//} else {
@ -2536,28 +2613,28 @@ public class MdmServiceImpl implements IMdmService {
// ids.setFiledsValue(UUIDUtils.getUUID());
// mdmDataFiledDtos.add(ids);
//}
}else if("create_time".equals(fileds.get(i1).getEnName())){
} else if ("create_time".equals(fileds.get(i1).getEnName())) {
}else if("modify_user_id".equals(fileds.get(i1).getEnName())){
} else if ("modify_user_id".equals(fileds.get(i1).getEnName())) {
//MdmDataFiledDto ids = new MdmDataFiledDto();
//ids.setFiledsName("modify_user_id");
//ids.setFiledsValue(UUIDUtils.getUUID());
//mdmDataFiledDtos.add(ids);
}else if("company_id".equals(fileds.get(i1).getEnName())){
} else if ("company_id".equals(fileds.get(i1).getEnName())) {
MdmDataFiledDto ids = new MdmDataFiledDto();
ids.setFiledsName("company_id");
ids.setFiledsValue("0");
mdmDataFiledDtos.add(ids);
}else if("org_id".equals(fileds.get(i1).getEnName())){
} else if ("org_id".equals(fileds.get(i1).getEnName())) {
MdmDataFiledDto ids = new MdmDataFiledDto();
ids.setFiledsName("org_id");
ids.setFiledsValue("0");
mdmDataFiledDtos.add(ids);
}else if("modify_time".equals(fileds.get(i1).getEnName())){
} else if ("modify_time".equals(fileds.get(i1).getEnName())) {
}else if("sts".equals(fileds.get(i1).getEnName())){
} else if ("sts".equals(fileds.get(i1).getEnName())) {
}else {
} else {
MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto();
mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName());
mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName()));
@ -2581,7 +2658,7 @@ public class MdmServiceImpl implements IMdmService {
}
}
}
saveOption(dbname,mdmCode,saveData,id,msg);
saveOption(dbname, mdmCode, saveData, id, msg);
}
return str.toString();
}
@ -2639,15 +2716,15 @@ public class MdmServiceImpl implements IMdmService {
}
return flag;
}
/***
* 查询所有的字段根据表名称
* @content:
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2024-06-27 16:29
* @param
* @return java.util.List<com.alibaba.fastjson.JSONObject>
**/
private List<String> queryMdMFields(Map<String, Object> maps){
return mdmModuleDao.queryMdMFields(maps);
}
///***
// * 查询所有的字段根据表名称
// * @content:
// * @author 👻👻👻👻👻👻👻👻 gjh
// * @date 2024-06-27 16:29
// * @param
// * @return java.util.List<com.alibaba.fastjson.JSONObject>
// **/
//private List<String> queryMdMFields(Map<String, Object> maps){
// return mdmModuleDao.queryMdMFields(maps);
//}
}

View File

@ -259,7 +259,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
jsonStr.put("jsonStr", hashMap);
JsonResultEntity result = comparisonServiceimpl.updateEntity(jsonStr);
if(!result.isFlag()){
throw new BaseSystemException("主数据更新失败"+ result.getMsg());
//throw new BaseSystemException("主数据更新失败"+ result.getMsg());
}
}
}

View File

@ -318,5 +318,25 @@ where id = #{id}
concat(replace(replace(DATE_FORMAT(now(),'%Y-%m-%d'),'-',''),'-',ifnull(max(right(task_code,4)), 0)+1)) end as task_code
from integration_task where sts='Y' and task_code like concat('%',substring(replace(DATE_FORMAT(now(),'%Y-%m-%d'),'-',''),1,10),'%')
</select>
<!--查询最大编码+1-->
<select id="IntegrationTaskEntity_maxCode" databaseId="oracle" resultMap="get-IntegrationTaskEntity-result">
SELECT decode(LENGTH(IFNULL(max(RIGHT (task_code, 4)), 0)+ 1),
1,concat(concat(
REPLACE (DATE_FORMAT(now(), '%Y-%m-%d'), '-', ''), '-', '000'), IFNULL(max(RIGHT (task_code, 4)), 0)+ 1),
2,concat(concat(
REPLACE (DATE_FORMAT(now(), '%Y-%m-%d'), '-', ''), '-', '00'), IFNULL(max(RIGHT (task_code, 4)), 0)+ 1),
3,concat(concat(
REPLACE (DATE_FORMAT(now(), '%Y-%m-%d'), '-', ''), '-', '0'), IFNULL(max(RIGHT (task_code, 4)), 0)+ 1),
concat(concat(
REPLACE (DATE_FORMAT(now(), '%Y-%m-%d'), '-', ''), '-', ''), IFNULL(max(RIGHT (task_code, 4)), 0)+ 1)) AS task_code
FROM
integration_task
WHERE
sts = 'Y'
AND task_code LIKE concat('%', substring(
REPLACE (DATE_FORMAT(now(), '%Y-%m-%d'), '-', ''), 1, 10), '%')
</select>
</mapper>