开发OTA备案工具-车辆升级

This commit is contained in:
高嵩
2023-03-30 15:36:30 +08:00
parent 610f3cb350
commit 02dfee780f
5 changed files with 53 additions and 54 deletions
@@ -84,6 +84,7 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
}
otaBaCxJbxx.setOtaId(otaBaCxJbxx.getOtaId());
otaBaCxJbxx.setUpdateTime(now);
deleteById(otaBaCxJbxx.getId());
saveOrUpdate(otaBaCxJbxx);
ComparisonUtil cu = new ComparisonUtil();
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaCxJbxx.getOtaId(), OtaModuleEnum.CX_CXJBXX, otaBaCxJbxxOld, otaBaCxJbxx, sysDictService);
@@ -28,6 +28,7 @@ import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
/**
* @Description: 升级备案-用户告知内容及方式
@@ -143,6 +144,22 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
return list();
}
public OtaBaSjGgnrfs setDefault(String otaId) {
OtaBaSjGgnrfs res = new OtaBaSjGgnrfs();
Date now = new Date();
res.setSjky("车辆解闭锁功能可用,但不可驾驶");
res.setSjbkygn("除解闭锁均不可用");
res.setSjsfcg(1);
res.setGzbg(1);
res.setGzscnr(1);
res.setGzyhfs("1,3");
res.setCreateTime(now);
res.setUpdateTime(now);
res.setOtaId(otaId);
res.setId(UUID.randomUUID().toString().replace("-", ""));
return res;
}
@Override
public OtaBaSjGgnrfs queryByOtaId(String otaId, String otaIdT) {
OtaBaSjGgnrfs res = getByOtaId(otaId);
@@ -150,26 +167,7 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
res = getByOtaId(otaIdT);
}
if (ObjectUtils.isEmpty(res)) {
res = new OtaBaSjGgnrfs();
res.setOtaId(otaId);
}
if (StringUtils.isEmpty(res.getSjky())) {
res.setSjky("车辆解闭锁功能可用,但不可驾驶");
}
if (StringUtils.isEmpty(res.getSjbkygn())) {
res.setSjbkygn("除解闭锁均不可用");
}
if (null == res.getSjsfcg()) {
res.setSjsfcg(1);
}
if (null == res.getGzbg()) {
res.setGzbg(1);
}
if (null == res.getGzscnr()) {
res.setGzscnr(1);
}
if (StringUtils.isEmpty(res.getGzyhfs())) {
res.setGzyhfs("1,3");
res = setDefault(otaId);
}
return res;
}
@@ -182,6 +182,7 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
if (ObjectUtil.isEmpty(res)) {
res = getByOtaId(otaIdT);
}
JSONObject json = new JSONObject();
json.put("list", res);
return json;
@@ -67,14 +67,13 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
public void add(OtaBaSjSjyxpg otaBaSjSjyxpg) {
Date now = new Date();
if (null != otaBaSjSjyxpg) {
String newYzcl = otaBaSjSjyxpg.getBgfj();
String oldYzcl = "";
String newZmcl = otaBaSjSjyxpg.getClfj();
String oldZmcl = "";
OtaBaSjSjyxpg otaBaSjSjyxpgOld = this.queryByOtaId(otaBaSjSjyxpg.getOtaId(),"");
OtaBaSjSjyxpg otaBaSjSjyxpgOld = this.queryByOtaId(otaBaSjSjyxpg.getOtaId(), "");
if (null != otaBaSjSjyxpgOld) {
otaBaSjSjyxpg.setId(otaBaSjSjyxpgOld.getId());
oldYzcl = otaBaSjSjyxpgOld.getBgfj();
@@ -84,13 +83,11 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
}
otaBaSjSjyxpg.setUpdateTime(now);
ComparisonUtil cu = new ComparisonUtil();
if (ObjectUtils.isEmpty(otaBaSjSjyxpgOld)) {
otaBaSjSjyxpgOld = new OtaBaSjSjyxpg();
}
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaSjSjyxpg.getOtaId(), OtaModuleEnum.SJ_SJYXPG, otaBaSjSjyxpgOld, otaBaSjSjyxpg, sysDictService);
reList.addAll(cu.comparisonRecord(otaBaSjSjyxpg.getOtaId(), newYzcl, oldYzcl, OtaModuleEnum.SJ_SJMBCL, "验证材料", ossFileService));
reList.addAll(cu.comparisonRecord(otaBaSjSjyxpg.getOtaId(), newZmcl, oldZmcl, OtaModuleEnum.SJ_SJMBCL, "证明材料", ossFileService));
deleteById(otaBaSjSjyxpg.getId());
saveOrUpdate(otaBaSjSjyxpg);
otaBaCxTxjlService.saveBatch(reList);
}
@@ -152,6 +149,24 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
return list();
}
public OtaBaSjSjyxpg setDefault(String otaId) {
Date now = new Date();
OtaBaSjSjyxpg res = new OtaBaSjSjyxpg();
res.setOtaId(otaId);
res.setFhgd(2);
res.setZdjsxg(1);
res.setZxsj(2);
res.setAqjz("2");
res.setSfyxaq(2);
res.setYhqr(1);
res.setSjbcs("3,4");
res.setAqkkx(1);
res.setCreateTime(now);
res.setUpdateTime(now);
return res;
}
@Override
public OtaBaSjSjyxpg queryByOtaId(String otaId, String otaIdT) {
OtaBaSjSjyxpg res = getByOtaId(otaId);
@@ -159,33 +174,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
res = getByOtaId(otaIdT);
}
if (ObjectUtils.isEmpty(res)) {
res = new OtaBaSjSjyxpg();
res.setOtaId(otaId);
}
if (null == res.getFhgd()) {
res.setFhgd(2);
}
if (null == res.getZdjsxg()) {
res.setZdjsxg(1);
}
if (null == res.getZxsj()) {
res.setZxsj(2);
}
if (StringUtils.isEmpty(res.getAqjz())) {
res.setAqjz("2");
}
if (null == res.getSfyxaq()) {
res.setSfyxaq(2);
}
if (null == res.getYhqr()) {
res.setYhqr(1);
}
if (StringUtils.isEmpty(res.getSjbcs())) {
res.setSjbcs("3,4");
}
if (null == res.getAqkkx()) {
res.setAqkkx(1);
res = setDefault(otaId);
}
return res;
}
@@ -241,9 +241,19 @@ public class ComparisonUtil<T> {
res = "";
for (int i = 0; i < newValStr.length; i++) {
if (i == newValStr.length - 1) {
res += sysDictService.queryDictTextByKey(ote.getType(), newValStr[i]);
String s = sysDictService.queryDictTextByKey(ote.getType(), newValStr[i]);
if (StringUtils.isNotEmpty(s)) {
res += s;
} else {
res += "";
}
} else {
res += sysDictService.queryDictTextByKey(ote.getType(), newValStr[i]) + ",";
String s = sysDictService.queryDictTextByKey(ote.getType(), newValStr[i]);
if (StringUtils.isNotEmpty(s)) {
res += s + ",";
} else {
res += "空,";
}
}
}
}