Merge remote-tracking branch 'origin/dev_2nd_LCYH' into dev_2nd_LCYH
This commit is contained in:
+7
-7
@@ -8,7 +8,7 @@ public enum OtaTitleEnum {
|
||||
CPSB("cpsb", "产品商标", "0"),
|
||||
CPMC("cpmc", "产品名称", "0"),
|
||||
CPXH("cpxh", "产品型号", "0"),
|
||||
BAZT("bazt", "备案状态", "1"),
|
||||
BAZT("bazt", "备案状态", "recordstatus"),
|
||||
BATJSJ("batjsj", "备案提交时间", "0"),
|
||||
CJSJ("cjsj", "创建时间", "0"),
|
||||
BZ("bz", "备注", "0"),
|
||||
@@ -19,7 +19,7 @@ public enum OtaTitleEnum {
|
||||
CPLB("cplb", "产品类别", "0"),
|
||||
DLLX1("dllx1", "车辆动力类型", "0"),
|
||||
DLLX2("dllx2", "车辆动力类型", "0"),
|
||||
TXZD("txzd", "通信终端", "1"),
|
||||
TXZD("txzd", "通信终端", "communication_terminal"),
|
||||
CDOTASJ("cdotasj", "车端OTA升级管理系统", "0"),
|
||||
|
||||
BHSJB("bhsjb", "保护升级包", "2"),
|
||||
@@ -34,10 +34,10 @@ public enum OtaTitleEnum {
|
||||
SJZT("sjzt", "升级结果状态", "2"),
|
||||
ZMCL("zmcl", "证明材料", "0"),
|
||||
|
||||
BHJZ("bhjz", "保护机制", "1"),
|
||||
FSXJZ("fsxjz", "防失效机制", "1"),
|
||||
SJSBCS("sjsbcs", "升级失败措施", "1"),
|
||||
XXAQJZ("xxaqjz", "信息安全机制", "1"),
|
||||
BHJZ("bhjz", "保护机制", "protection_mechanism"),
|
||||
FSXJZ("fsxjz", "防失效机制", "fail_safe_mechanism"),
|
||||
SJSBCS("sjsbcs", "升级失败措施", "upgrade_failure"),
|
||||
XXAQJZ("xxaqjz", "信息安全机制", "Information_security_mechanism"),
|
||||
|
||||
XTLB("xtlb", "系统类别", "0"),
|
||||
SFKSJ("sfksj", "是否可升级", "2"),
|
||||
@@ -57,7 +57,7 @@ public enum OtaTitleEnum {
|
||||
|
||||
GNMC("gnmc", "功能名称", "0"),
|
||||
PZQK("pzqk", "配置情况", "2"),
|
||||
JSZDHJB("jszdhjb", "驾驶自动化级别", "1"),
|
||||
JSZDHJB("jszdhjb", "驾驶自动化级别", "driving_automation_level"),
|
||||
SJGGCS("sjggcs", "升级可能变更的《公告》技术参数", "0"),
|
||||
GNMS("gnms", "功能描述", "0"),
|
||||
SYTJ("sytj", "适用条件", "0"),
|
||||
|
||||
+6
-1
@@ -11,6 +11,7 @@ import com.jero.modules.ota.mapper.OtaBaCxAqcsMapper;
|
||||
import com.jero.modules.ota.service.IOtaBaCxAqcsService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
|
||||
import com.jero.modules.ota.utils.ComparisonUtil;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -33,6 +34,10 @@ public class OtaBaCxAqcsServiceImpl extends ServiceImpl<OtaBaCxAqcsMapper, OtaBa
|
||||
@Autowired
|
||||
private IOtaBaCxTxjlService otaBaCxTxjlService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -62,7 +67,7 @@ public class OtaBaCxAqcsServiceImpl extends ServiceImpl<OtaBaCxAqcsMapper, OtaBa
|
||||
if (ObjectUtils.isEmpty(otaBaCxAqcsOld)) {
|
||||
otaBaCxAqcsOld = new OtaBaCxAqcs();
|
||||
}
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaCxAqcsOld.getOtaId(), OtaModuleEnum.CX_AQCS, otaBaCxAqcsOld, otaBaCxAqcs);
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaCxAqcsOld.getOtaId(), OtaModuleEnum.CX_AQCS, otaBaCxAqcsOld, otaBaCxAqcs, sysDictService);
|
||||
otaBaCxTxjlService.saveBatch(reList);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -11,6 +11,7 @@ import com.jero.modules.ota.service.IOtaBaCxJbxxService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxListService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
|
||||
import com.jero.modules.ota.utils.ComparisonUtil;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -35,6 +36,9 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
|
||||
@Autowired
|
||||
private IOtaBaCxTxjlService otaBaCxTxjlService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -63,7 +67,7 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
|
||||
otaBaCxJbxx.setUpdateTime(now);
|
||||
saveOrUpdate(otaBaCxJbxx);
|
||||
ComparisonUtil cu = new ComparisonUtil();
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaCxJbxx.getOtaId(), OtaModuleEnum.CX_CXJBXX, OtaBaCxJbxxOld, otaBaCxJbxx);
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaCxJbxx.getOtaId(), OtaModuleEnum.CX_CXJBXX, OtaBaCxJbxxOld, otaBaCxJbxx, sysDictService);
|
||||
otaBaCxTxjlService.saveBatch(reList);
|
||||
return otaBaCxJbxx;
|
||||
}
|
||||
|
||||
+16
-6
@@ -14,6 +14,7 @@ import com.jero.modules.ota.service.IOtaBaCxJsfzbacsService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxSjmkService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
|
||||
import com.jero.modules.ota.utils.ComparisonUtil;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -36,6 +37,9 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
|
||||
@Autowired
|
||||
private IOtaBaCxSjmkService OtaBaCxSjmkService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@@ -51,18 +55,18 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
|
||||
otaBaCxJsfzbacs.setUpdateTime(now);
|
||||
saveOrUpdate(otaBaCxJsfzbacs);
|
||||
ComparisonUtil cu = new ComparisonUtil();
|
||||
if(ObjectUtils.isEmpty(otaBaCxJsfzbacsOld)){
|
||||
if (ObjectUtils.isEmpty(otaBaCxJsfzbacsOld)) {
|
||||
otaBaCxJsfzbacsOld = new OtaBaCxJsfzbacs();
|
||||
}
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaId, OtaModuleEnum.CX_JSFZXTJCBACS, otaBaCxJsfzbacsOld, otaBaCxJsfzbacs);
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaId, OtaModuleEnum.CX_JSFZXTJCBACS, otaBaCxJsfzbacsOld, otaBaCxJsfzbacs, sysDictService);
|
||||
|
||||
//处理控制器列表,先删除,后添加
|
||||
List<OtaBaCxSjmk> oldList = OtaBaCxSjmkService.queryByOtaId(otaId);
|
||||
OtaBaCxSjmkService.deleteByOtaId(otaId);
|
||||
JSONArray kzq = json.getJSONArray("kzq");
|
||||
List<OtaBaCxSjmk> sjmkList = parseKzqData(kzq, otaId);
|
||||
OtaBaCxSjmkService.saveBatch(sjmkList);
|
||||
cu.comparisonListRecord(otaId, OtaModuleEnum.CX_JSFZXTJCBACS, OtaTitleEnum.BJMC.getName(), oldList, sjmkList);
|
||||
OtaBaCxSjmkService.saveOrUpdateBatch(sjmkList);
|
||||
cu.comparisonListRecord(otaId, OtaModuleEnum.CX_JSFZXTJCBACS, OtaTitleEnum.BJMC.getName(), oldList, sjmkList, sysDictService);
|
||||
otaBaCxTxjlService.saveBatch(reList);
|
||||
}
|
||||
|
||||
@@ -78,11 +82,14 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
|
||||
OtaBaCxSjmk sjmk = new OtaBaCxSjmk();
|
||||
sjmk.setOtaId(otaId);
|
||||
for (Field field : fields) {
|
||||
if (field.getName().equals("createTime") || field.getName().equals("updateTime")) {
|
||||
continue;
|
||||
}
|
||||
Object kzqObj = kzqMap.get(field.getName());
|
||||
if (null != kzqObj) {
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
field.set(sjmk, kzqObj);
|
||||
field.set(sjmk, kzqObj.toString());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -102,11 +109,14 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
|
||||
Map<String, Object> bjMap = bj.getInnerMap();
|
||||
Field[] fields = OtaBaCxJsfzbacs.class.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if (field.getName().equals("createTime") || field.getName().equals("updateTime")) {
|
||||
continue;
|
||||
}
|
||||
Object bjObj = bjMap.get(field.getName());
|
||||
if (null != bjObj) {
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
field.set(otaBaCxJsfzbacs, bjObj);
|
||||
field.set(otaBaCxJsfzbacs, bjObj.toString());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
+5
-1
@@ -12,6 +12,7 @@ import com.jero.modules.ota.service.IOtaBaCxKsjjsmccsService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxListService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
|
||||
import com.jero.modules.ota.utils.ComparisonUtil;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -38,6 +39,9 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
|
||||
@Autowired
|
||||
private IOtaBaCxTxjlService otaBaCxTxjlService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -78,7 +82,7 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
|
||||
newList.add(otaBaCxJsfzbacs);
|
||||
}
|
||||
ComparisonUtil cu = new ComparisonUtil();
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.CX_KZXSJDJSFZGNMCYCS, OtaTitleEnum.GNMC.getName(), oldList, newList);
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.CX_KZXSJDJSFZGNMCYCS, OtaTitleEnum.GNMC.getName(), oldList, newList, sysDictService);
|
||||
otaBaCxTxjlService.saveBatch(reList);
|
||||
String fj = (String) json.get("fj");
|
||||
if (StringUtils.isNotEmpty(fj)) {
|
||||
|
||||
+5
-1
@@ -12,6 +12,7 @@ import com.jero.modules.ota.service.IOtaBaCxKsjxtmccsService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxListService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
|
||||
import com.jero.modules.ota.utils.ComparisonUtil;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -37,6 +38,9 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
|
||||
@Autowired
|
||||
private IOtaBaCxTxjlService otaBaCxTxjlService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -77,7 +81,7 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
|
||||
newList.add(otaBaCxKsjxtmccs);
|
||||
}
|
||||
ComparisonUtil cu = new ComparisonUtil();
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.CX_KSJDXTMCYCS, OtaTitleEnum.XTLB.getName(), oldList, newList);
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.CX_KSJDXTMCYCS, OtaTitleEnum.XTLB.getName(), oldList, newList, sysDictService);
|
||||
otaBaCxTxjlService.saveBatch(reList);
|
||||
String fj = (String) json.get("fj");
|
||||
if (StringUtils.isNotEmpty(fj)) {
|
||||
|
||||
+6
-2
@@ -9,6 +9,7 @@ import com.jero.modules.ota.mapper.OtaBaCxQtMapper;
|
||||
import com.jero.modules.ota.service.IOtaBaCxQtService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
|
||||
import com.jero.modules.ota.utils.ComparisonUtil;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -30,6 +31,9 @@ public class OtaBaCxQtServiceImpl extends ServiceImpl<OtaBaCxQtMapper, OtaBaCxQt
|
||||
@Autowired
|
||||
private IOtaBaCxTxjlService otaBaCxTxjlService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -49,10 +53,10 @@ public class OtaBaCxQtServiceImpl extends ServiceImpl<OtaBaCxQtMapper, OtaBaCxQt
|
||||
otaBaCxQt.setUpdateTime(now);
|
||||
saveOrUpdate(otaBaCxQt);
|
||||
ComparisonUtil cu = new ComparisonUtil();
|
||||
if(ObjectUtils.isEmpty(otaBaCxQtOld)){
|
||||
if (ObjectUtils.isEmpty(otaBaCxQtOld)) {
|
||||
otaBaCxQtOld = new OtaBaCxQt();
|
||||
}
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaCxQt.getOtaId(), OtaModuleEnum.CX_QT, otaBaCxQtOld, otaBaCxQt);
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaCxQt.getOtaId(), OtaModuleEnum.CX_QT, otaBaCxQtOld, otaBaCxQt, sysDictService);
|
||||
otaBaCxTxjlService.saveBatch(reList);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -12,6 +12,7 @@ import com.jero.modules.ota.mapper.OtaBaCxZxsjyqMapper;
|
||||
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
|
||||
import com.jero.modules.ota.service.IOtaBaCxZxsjyqService;
|
||||
import com.jero.modules.ota.utils.ComparisonUtil;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -35,6 +36,10 @@ public class OtaBaCxZxsjyqServiceImpl extends ServiceImpl<OtaBaCxZxsjyqMapper, O
|
||||
@Autowired
|
||||
private IOtaBaCxTxjlService otaBaCxTxjlService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -66,7 +71,7 @@ public class OtaBaCxZxsjyqServiceImpl extends ServiceImpl<OtaBaCxZxsjyqMapper, O
|
||||
if (ObjectUtils.isEmpty(otaBaCxZxsjyqOld)) {
|
||||
otaBaCxZxsjyqOld = new OtaBaCxZxsjyq();
|
||||
}
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaCxZxsjyq.getOtaId(), OtaModuleEnum.CX_ZXSJYQ, otaBaCxZxsjyqOld, otaBaCxZxsjyq);
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaCxZxsjyq.getOtaId(), OtaModuleEnum.CX_ZXSJYQ, otaBaCxZxsjyqOld, otaBaCxZxsjyq, sysDictService);
|
||||
otaBaCxTxjlService.saveBatch(reList);
|
||||
}
|
||||
|
||||
|
||||
+28
-24
@@ -3,6 +3,7 @@ package com.jero.modules.ota.utils;
|
||||
import com.jero.modules.ota.entity.OtaBaCxTxjl;
|
||||
import com.jero.modules.ota.enums.OtaModuleEnum;
|
||||
import com.jero.modules.ota.enums.OtaTitleEnum;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@@ -23,7 +24,7 @@ public class ComparisonUtil<T> {
|
||||
/**
|
||||
* 对比字段并添加到记录
|
||||
*/
|
||||
public List<OtaBaCxTxjl> comparisonRecord(String otaId, OtaModuleEnum otaModuleEnum, T oldClazz, T newClazz) {
|
||||
public List<OtaBaCxTxjl> comparisonRecord(String otaId, OtaModuleEnum otaModuleEnum, T oldClazz, T newClazz, ISysDictService sysDictService) {
|
||||
List<OtaBaCxTxjl> resList = new ArrayList<>();
|
||||
Field[] fields = newClazz.getClass().getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
@@ -34,8 +35,8 @@ public class ComparisonUtil<T> {
|
||||
}
|
||||
title = ote.getValue();
|
||||
field.setAccessible(true);
|
||||
String newStr = parseDictText(ote, field, newClazz);
|
||||
String oldStr = parseDictText(ote, field, oldClazz);
|
||||
String newStr = parseDictText(ote, field, newClazz, sysDictService);
|
||||
String oldStr = parseDictText(ote, field, oldClazz, sysDictService);
|
||||
if (!newStr.equals(oldStr)) {
|
||||
String content = "由" + title + "的" + oldStr + "改为" + newStr;
|
||||
resList.add(new OtaBaCxTxjl(otaId, otaModuleEnum.getName(), content));
|
||||
@@ -44,7 +45,7 @@ public class ComparisonUtil<T> {
|
||||
return resList;
|
||||
}
|
||||
|
||||
public List<OtaBaCxTxjl> comparisonListRecord(String otaId, OtaModuleEnum otaModuleEnum, String tableTitle, List<T> oldList, List<T> newList) {
|
||||
public List<OtaBaCxTxjl> comparisonListRecord(String otaId, OtaModuleEnum otaModuleEnum, String tableTitle, List<T> oldList, List<T> newList, ISysDictService sysDictService) {
|
||||
List<OtaBaCxTxjl> resList = new ArrayList<>();
|
||||
try {
|
||||
for (T newObj : newList) {
|
||||
@@ -76,7 +77,7 @@ public class ComparisonUtil<T> {
|
||||
for (T oldObj : oldList) {
|
||||
String oldId = idField.get(oldObj).toString();
|
||||
if (oldId.equals(id.toString())) {
|
||||
resList.addAll(comparisonCertRecord(otaId, otaModuleEnum, tableTitle, newObj, oldObj));
|
||||
resList.addAll(comparisonCertRecord(otaId, otaModuleEnum, tableTitle, newObj, oldObj, sysDictService));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,7 +115,7 @@ public class ComparisonUtil<T> {
|
||||
}
|
||||
|
||||
|
||||
public List<OtaBaCxTxjl> comparisonCertRecord(String otaId, OtaModuleEnum otaModuleEnum, String tableTitle, T oldClazz, T newClazz) {
|
||||
public List<OtaBaCxTxjl> comparisonCertRecord(String otaId, OtaModuleEnum otaModuleEnum, String tableTitle, T oldClazz, T newClazz, ISysDictService sysDictService) {
|
||||
List<OtaBaCxTxjl> resList = new ArrayList<>();
|
||||
Field[] fields = newClazz.getClass().getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
@@ -126,16 +127,17 @@ public class ComparisonUtil<T> {
|
||||
}
|
||||
title = ote.getValue();
|
||||
field.setAccessible(true);
|
||||
String newStr = parseDictText(ote, field, newClazz);
|
||||
String oldStr = parseDictText(ote, field, oldClazz);
|
||||
String newStr = parseDictText(ote, field, newClazz, sysDictService);
|
||||
String oldStr = parseDictText(ote, field, oldClazz, sysDictService);
|
||||
|
||||
if (!newStr.equals(oldStr)) {
|
||||
//TODO null
|
||||
Object newVal = field.get(newClazz);
|
||||
Object newTitleVal = newVal.getClass().getDeclaredField(tableTitle).get(newVal);
|
||||
String newTitleStr = "空";
|
||||
if (ObjectUtils.isNotEmpty(newTitleVal)) {
|
||||
newTitleStr = newTitleVal.toString();
|
||||
if (ObjectUtils.isNotEmpty(newVal)) {
|
||||
Object newTitleVal = newVal.getClass().getDeclaredField(tableTitle).get(newVal);
|
||||
if (ObjectUtils.isNotEmpty(newTitleVal)) {
|
||||
newTitleStr = newTitleVal.toString();
|
||||
}
|
||||
}
|
||||
String content = newTitleStr + "的" + title + "由" + oldStr + "改为" + newStr;
|
||||
resList.add(new OtaBaCxTxjl(otaId, otaModuleEnum.getName(), content));
|
||||
@@ -147,20 +149,13 @@ public class ComparisonUtil<T> {
|
||||
return resList;
|
||||
}
|
||||
|
||||
private String parseDictText(OtaTitleEnum ote, Field field, T clazz) {
|
||||
private String parseDictText(OtaTitleEnum ote, Field field, T clazz, ISysDictService sysDictService) {
|
||||
String res = "空";
|
||||
try {
|
||||
Object newVal = field.get(clazz);
|
||||
if ("1".equals(ote.getType())) {
|
||||
try {
|
||||
Field fieldDict = clazz.getClass().getDeclaredField(field.getName() + "_dictText");
|
||||
fieldDict.setAccessible(true);
|
||||
Object newValDict = fieldDict.get(clazz);
|
||||
if (ObjectUtils.isNotEmpty(newValDict)) {
|
||||
res = newValDict.toString();
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
if ("0".equals(ote.getType())) {
|
||||
if (ObjectUtils.isNotEmpty(newVal)) {
|
||||
res = newVal.toString();
|
||||
}
|
||||
} else if ("2".equals(ote.getType())) {
|
||||
if (ObjectUtils.isNotEmpty(newVal)) {
|
||||
@@ -171,8 +166,17 @@ public class ComparisonUtil<T> {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
newVal = field.get(clazz);
|
||||
if (ObjectUtils.isNotEmpty(newVal)) {
|
||||
res = newVal.toString();
|
||||
String[] newValStr = newVal.toString().split(",");
|
||||
res = "";
|
||||
for (int i = 0; i < newValStr.length; i++) {
|
||||
if (i == newValStr.length - 1) {
|
||||
res += sysDictService.queryDictTextByKey(ote.getType(), newValStr[i]);
|
||||
} else {
|
||||
res += sysDictService.queryDictTextByKey(ote.getType(), newValStr[i]) + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
|
||||
Reference in New Issue
Block a user