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

This commit is contained in:
高嵩
2023-03-30 13:38:31 +08:00
parent b5d5c61536
commit 544b081826
4 changed files with 100 additions and 29 deletions
@@ -80,6 +80,9 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
String otaId = (String) json.get("otaId");
if (StringUtils.isNotEmpty(otaId)) {
oldList = getByOtaId(otaId);
if (ObjectUtils.isEmpty(oldList)) {
oldList = setDefault(otaId);
}
deleteByOtaId(otaId);
JSONArray list = json.getJSONArray("list");
for (Object obj : list) {
@@ -177,12 +180,32 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
return list();
}
public List<OtaBaCxKsjjsmccs> setDefault(String otaId) {
Date now = new Date();
List<OtaBaCxKsjjsmccs> res = new ArrayList<>();
String[] titles = {"前向碰撞预警(FCW)", "车道偏离预警(LDW)", "百区监测(BSD)", "驾驶员疲劳监测(DFM)",
"自动紧急制动(AEB)", "自适应巡航控制(ACC)", "车道保持辅助(LKA)", "智能泊车辅助(IPA)", "交通拥堵辅助(TJA)"};
for (String t : titles) {
OtaBaCxKsjjsmccs cs = new OtaBaCxKsjjsmccs();
cs.setOtaId(otaId);
cs.setGnmc(t);
cs.setCreateTime(now);
cs.setId(UUID.randomUUID().toString().replace("-", ""));
res.add(cs);
}
saveBatch(res);
return res;
}
@Override
public JSONObject queryByOtaId(String otaId, String otaIdT) {
List<OtaBaCxKsjjsmccs> res = this.getByOtaId(otaId);
if (ObjectUtil.isEmpty(res)) {
res = getByOtaId(otaIdT);
}
if (ObjectUtil.isEmpty(res)) {
res = setDefault(otaId);
}
JSONObject json = new JSONObject();
json.put("list", res);
OtaBaCxList otaBaCxList = otaBaCxListService.queryById(otaId);
@@ -81,6 +81,9 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
String otaId = (String) json.get("otaId");
if (StringUtils.isNotEmpty(otaId)) {
oldList = getByOtaId(otaId);
if (ObjectUtils.isEmpty(oldList)) {
oldList = setDefault(otaId);
}
deleteByOtaId(otaId);
JSONArray list = json.getJSONArray("list");
for (Object obj : list) {
@@ -245,12 +248,32 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
return list();
}
public List<OtaBaCxKsjxtmccs> setDefault(String otaId) {
Date now = new Date();
List<OtaBaCxKsjxtmccs> res = new ArrayList<>();
String[] titles = {"动力系统", "传动系统", "转向系统", "制动系统", "车身系统", "车载能源系统"};
for (String t : titles) {
OtaBaCxKsjxtmccs cs = new OtaBaCxKsjxtmccs();
cs.setOtaId(otaId);
cs.setXtlb(t);
cs.setCreateTime(now);
cs.setId(UUID.randomUUID().toString().replace("-", ""));
res.add(cs);
}
saveBatch(res);
return res;
}
@Override
public JSONObject queryByOtaId(String otaId, String otaIdT) {
List<OtaBaCxKsjxtmccs> res = getByOtaId(otaId);
if (ObjectUtil.isEmpty(res)) {
res = getByOtaId(otaIdT);
}
if (ObjectUtil.isEmpty(res)) {
res = setDefault(otaId);
}
JSONObject json = new JSONObject();
json.put("list", res);
OtaBaCxList otaBaCxList = otaBaCxListService.queryById(otaId);
@@ -67,7 +67,7 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
public void add(OtaBaSjGgnrfs otaBaSjGgnrfs) {
Date now = new Date();
if (null != otaBaSjGgnrfs) {
OtaBaSjGgnrfs otaBaSjGgnrfsOld = this.getByOtaId(otaBaSjGgnrfs.getOtaId());
OtaBaSjGgnrfs otaBaSjGgnrfsOld = this.queryByOtaId(otaBaSjGgnrfs.getOtaId(), "");
String oldFjStr = "";
if (null != otaBaSjGgnrfsOld) {
otaBaSjGgnrfs.setId(otaBaSjGgnrfsOld.getId());
@@ -76,13 +76,12 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
otaBaSjGgnrfs.setCreateTime(now);
}
otaBaSjGgnrfs.setUpdateTime(now);
saveOrUpdate(otaBaSjGgnrfs);
ComparisonUtil cu = new ComparisonUtil();
if (ObjectUtils.isEmpty(otaBaSjGgnrfsOld)) {
otaBaSjGgnrfsOld = new OtaBaSjGgnrfs();
}
saveOrUpdate(otaBaSjGgnrfs);
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaSjGgnrfs.getOtaId(), OtaModuleEnum.SJ_YHGZNRFS, otaBaSjGgnrfsOld, otaBaSjGgnrfs, sysDictService);
reList.addAll(cu.comparisonRecord(otaBaSjGgnrfs.getOtaId(), otaBaSjGgnrfs.getXgwj(), oldFjStr, OtaModuleEnum.SJ_YHGZNRFS, "附件", ossFileService));
otaBaCxTxjlService.saveBatch(reList);
}
@@ -150,6 +149,28 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
if (ObjectUtils.isEmpty(res)) {
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");
}
return res;
}
@@ -74,7 +74,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
String newZmcl = otaBaSjSjyxpg.getClfj();
String oldZmcl = "";
OtaBaSjSjyxpg otaBaSjSjyxpgOld = this.getByOtaId(otaBaSjSjyxpg.getOtaId());
OtaBaSjSjyxpg otaBaSjSjyxpgOld = this.queryByOtaId(otaBaSjSjyxpg.getOtaId(),"");
if (null != otaBaSjSjyxpgOld) {
otaBaSjSjyxpg.setId(otaBaSjSjyxpgOld.getId());
oldYzcl = otaBaSjSjyxpgOld.getBgfj();
@@ -91,31 +91,6 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
reList.addAll(cu.comparisonRecord(otaBaSjSjyxpg.getOtaId(), newYzcl, oldYzcl, OtaModuleEnum.SJ_SJMBCL, "验证材料", ossFileService));
reList.addAll(cu.comparisonRecord(otaBaSjSjyxpg.getOtaId(), newZmcl, oldZmcl, OtaModuleEnum.SJ_SJMBCL, "证明材料", ossFileService));
if (null == otaBaSjSjyxpg.getFhgd()) {
otaBaSjSjyxpg.setFhgd(2);
}
if (null == otaBaSjSjyxpg.getZdjsxg()) {
otaBaSjSjyxpg.setZdjsxg(1);
}
if (null == otaBaSjSjyxpg.getZxsj()) {
otaBaSjSjyxpg.setZxsj(2);
}
if (StringUtils.isEmpty(otaBaSjSjyxpg.getAqjz())) {
otaBaSjSjyxpg.setAqjz("2");
}
if (null == otaBaSjSjyxpg.getSfyxaq()) {
otaBaSjSjyxpg.setSfyxaq(2);
}
if (null == otaBaSjSjyxpg.getYhqr()) {
otaBaSjSjyxpg.setYhqr(1);
}
if (StringUtils.isEmpty(otaBaSjSjyxpg.getSjbcs())) {
otaBaSjSjyxpg.setSjbcs("3,4");
}
if (null == otaBaSjSjyxpg.getAqkkx()) {
otaBaSjSjyxpg.setAqkkx(1);
}
saveOrUpdate(otaBaSjSjyxpg);
otaBaCxTxjlService.saveBatch(reList);
}
@@ -183,6 +158,35 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
if (ObjectUtils.isEmpty(res)) {
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);
}
return res;
}