修改适配达梦
This commit is contained in:
parent
197c7620c5
commit
c333f3f84f
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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()))) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -1544,6 +1583,27 @@ public class MdmServiceImpl implements IMdmService {
|
|||
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("当前数据不符合规则不发送");
|
||||
}
|
||||
|
@ -1687,6 +1749,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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())) {
|
||||
|
@ -1720,6 +1784,8 @@ public class MdmServiceImpl implements IMdmService {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1810,6 +1876,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
return BaseResult.getFailureMessageEntity("发送错误:" + jsonResultEntity.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> getHeaders(SysApplicationApiEntity loginApi, Map<String, String> map, JSONObject loginData) {
|
||||
if (loginData == null) {
|
||||
loginData = new JSONObject();
|
||||
|
@ -1846,8 +1913,6 @@ public class MdmServiceImpl implements IMdmService {
|
|||
return map;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1911,6 +1976,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
return returnStr.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loginData
|
||||
* @param example
|
||||
|
@ -1936,6 +2002,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
private String getBodys(SysApplicationApiEntity loginApi, String sendDatastr, JSONObject loginData) {
|
||||
JSONObject sendData = new JSONObject();
|
||||
if (sendDatastr != null) {
|
||||
|
@ -1963,6 +2030,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
return sendData.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param querys 设置的字段属性
|
||||
* @param sendData 发送数据
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -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);
|
||||
//}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue