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

This commit is contained in:
高嵩
2023-03-29 20:26:32 +08:00
parent ec6bb00c62
commit e9c29074ba
4 changed files with 61 additions and 2 deletions
@@ -169,8 +169,8 @@ public enum OtaTitleEnum {
YHQR("yhqr", "升级活动是否提供用户确认选项", "0"),
SJBCS("sjbcs", "升级包测试", "package_test"),
AQKKX("aqkkx", "是杏已验证确认在线升级活动的安全性和可靠性", "0"),
BGFJ("bgfj", "提供变更或扩展后的《公告》批次及证明材料", "0"),
CLFJ("clfj", "提供证明材料", "0"),
// BGFJ("bgfj", "提供变更或扩展后的《公告》批次及证明材料", "0"),
// CLFJ("clfj", "提供证明材料", "0"),
XTMC("xtmc", "系统名称", "0"),
SJQBGCS("sjqbgcs", "升级前已变更《公告》参数的对应调整", "0"),
SJHBGCS("sjhbgcs", "升级后已变更《公告》参数的对应调整", "0"),
@@ -2,6 +2,8 @@ package com.jero.modules.ota.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.ota.entity.*;
import com.jero.modules.ota.enums.OtaModuleEnum;
import com.jero.modules.ota.mapper.OtaBaSjSjmbclMapper;
@@ -54,6 +56,9 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
@Autowired
private IOtaBaCxTxjlService otaBaCxTxjlService;
@Autowired
private IOSSFileService ossFileService;
/**
* 保存
*
@@ -64,9 +69,13 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
public void add(OtaBaSjSjmbcl otaBaSjSjmbcl) {
Date now = new Date();
if (null != otaBaSjSjmbcl) {
String newFj = otaBaSjSjmbcl.getCsv();
String oldFjStr = "";
OtaBaSjSjmbcl otaBaSjSjmbclOld = this.getByOtaId(otaBaSjSjmbcl.getOtaId());
if (null != otaBaSjSjmbclOld) {
otaBaSjSjmbcl.setId(otaBaSjSjmbclOld.getId());
oldFjStr = otaBaSjSjmbclOld.getCsv();
} else {
otaBaSjSjmbcl.setCreateTime(now);
}
@@ -78,6 +87,7 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
otaBaSjSjmbclOld = new OtaBaSjSjmbcl();
}
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaSjSjmbcl.getOtaId(), OtaModuleEnum.SJ_SJMBCL, otaBaSjSjmbclOld, otaBaSjSjmbcl, sysDictService);
reList.addAll(cu.comparisonRecord(otaBaSjSjmbcl.getOtaId(), newFj, oldFjStr, OtaModuleEnum.SJ_SJMBCL, "附件", ossFileService));
otaBaCxTxjlService.saveBatch(reList);
}
}
@@ -3,6 +3,7 @@ package com.jero.modules.ota.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.ota.entity.*;
import com.jero.modules.ota.enums.OtaModuleEnum;
import com.jero.modules.ota.mapper.OtaBaSjSjyxpgMapper;
@@ -49,6 +50,9 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
@Value(value = "${ota.uploadPath}")
private String uploadPath;
@Autowired
private IOSSFileService ossFileService;
/**
* 保存
*
@@ -59,9 +63,18 @@ 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.getByOtaId(otaBaSjSjyxpg.getOtaId());
if (null != otaBaSjSjyxpgOld) {
otaBaSjSjyxpg.setId(otaBaSjSjyxpgOld.getId());
oldYzcl = otaBaSjSjyxpgOld.getBgfj();
oldZmcl = otaBaSjSjyxpgOld.getClfj();
} else {
otaBaSjSjyxpg.setCreateTime(now);
}
@@ -72,6 +85,8 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
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));
otaBaCxTxjlService.saveBatch(reList);
}
}
@@ -1,5 +1,7 @@
package com.jero.modules.ota.utils;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.ota.entity.OtaBaCxTxjl;
import com.jero.modules.ota.enums.OtaModuleEnum;
import com.jero.modules.ota.enums.OtaTitleEnum;
@@ -23,6 +25,38 @@ public class ComparisonUtil<T> {
}
public List<OtaBaCxTxjl> comparisonRecord(String otaId, String newFj,String oldFjStr,OtaModuleEnum otaModuleEnum, String title, IOSSFileService ossFileService) {
List<OtaBaCxTxjl> reList = new ArrayList<>();
String[] newFjList = {};
if (StringUtils.isNotEmpty(newFj)) {
newFjList = newFj.split(",");
}
for (String nf : newFjList) {
if (StringUtils.isEmpty(oldFjStr) || !oldFjStr.contains(nf)) {
List<OSSFile> fileList = ossFileService.getFileInfos(nf);
if (ObjectUtils.isNotEmpty(fileList)) {
for (OSSFile f : fileList) {
reList.add(addAttRecord(otaId, otaModuleEnum, title, f.getFileName()));
}
}
}
}
String[] oldFjList = {};
if (StringUtils.isNotEmpty(oldFjStr)) {
oldFjList = oldFjStr.split(",");
}
for (String of : oldFjList) {
if (StringUtils.isEmpty(newFj) || !newFj.contains(of)) {
List<OSSFile> fileList = ossFileService.getFileInfos(of);
if (ObjectUtils.isNotEmpty(fileList)) {
for (OSSFile f : fileList) {
reList.add(delAttRecord(otaId, otaModuleEnum, title, f.getFileName()));
}
}
}
}
return reList;
}
public OtaBaCxTxjl addAttRecord(String otaId, OtaModuleEnum otaModuleEnum, String title, String attName) {
String content = title + "中添加了附件:'" + attName;
OtaBaCxTxjl jl = new OtaBaCxTxjl(otaId, otaModuleEnum.getName(), content);