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

This commit is contained in:
高嵩
2023-03-30 00:56:14 +08:00
parent 61b1672d84
commit 9fdde4fe56
3 changed files with 127 additions and 93 deletions
@@ -2,6 +2,7 @@ package com.jero.modules.ota.service;
import com.jero.modules.ota.entity.OtaBaSjGnxtwh;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
@@ -52,6 +53,8 @@ public interface IOtaBaSjGnxtwhService extends IService<OtaBaSjGnxtwh> {
*/
OtaBaSjGnxtwh queryById(String id);
String queryGnxtByKzq(String kzq);
/**
* 列表查询
*
@@ -4,8 +4,10 @@ import com.jero.modules.ota.entity.OtaBaSjGnxtwh;
import com.jero.modules.ota.mapper.OtaBaSjGnxtwhMapper;
import com.jero.modules.ota.service.IOtaBaSjGnxtwhService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
@@ -77,6 +79,22 @@ public class OtaBaSjGnxtwhServiceImpl extends ServiceImpl<OtaBaSjGnxtwhMapper, O
return getById(id);
}
@Override
public String queryGnxtByKzq(String kzq) {
List<OtaBaSjGnxtwh> list = list();
for (OtaBaSjGnxtwh wh : list) {
String[] strs = wh.getDykzq().split(",");
for (String str : strs) {
if (str.equals(kzq)) {
return wh.getGnxt();
}
}
}
return null;
}
/**
* 列表查询
*
@@ -11,11 +11,12 @@ import com.jero.modules.ota.enums.OtaModuleEnum;
import com.jero.modules.ota.enums.OtaTitleEnum;
import com.jero.modules.ota.mapper.OtaBaSjSjxtbhMapper;
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
import com.jero.modules.ota.service.IOtaBaSjGnxtwhService;
import com.jero.modules.ota.service.IOtaBaSjSjxtbhService;
import com.jero.modules.ota.utils.ComparisonUtil;
import com.jero.modules.ota.utils.ImportFileUtil;
import com.jero.modules.system.service.ISysDictService;
import com.jero.modules.system.util.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
@@ -52,6 +53,9 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
@Autowired
private IOSSFileService ossFileService;
@Autowired
private IOtaBaSjGnxtwhService otaBaSjGnxtwhService;
@Value(value = "${ota.templatePath}")
private String templatePath;
@@ -221,7 +225,8 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
oldList = new ArrayList<>();
}
ComparisonUtil cu = new ComparisonUtil();
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJXTMCBH, OtaTitleEnum.SJKZQMC.getName(), oldList, newList, sysDictService);
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJXTMCBH, OtaTitleEnum.XTMC.getName(), oldList, newList, sysDictService);
deleteByOtaId(otaId);
saveOrUpdateBatch(newList);
otaBaCxTxjlService.saveBatch(reList);
}
@@ -233,30 +238,38 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
Sheet s = wb.getSheetAt(0);
int rows = s.getPhysicalNumberOfRows();
for (int i = 4; i < rows; i++) {
Row row = s.getRow(i);
Cell cell = row.getCell(0);
OtaBaSjSjxtbh xtbh = new OtaBaSjSjxtbh();
cell = row.getCell(1);
xtbh.setOtaId(otaId);
Row row = s.getRow(i);
Cell cell = row.getCell(2);
String kzq = ImportFileUtil.getCellValue(cell, wb);
if (StringUtils.isNotEmpty(kzq)) {
xtbh.setSjkzqmc(kzq);
String gnxt = otaBaSjGnxtwhService.queryGnxtByKzq(kzq);
if (StringUtils.isNotEmpty(gnxt)) {
xtbh.setXtmc(gnxt);
}
}
cell = row.getCell(0);
xtbh.setSjqbgcs(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(2);
cell = row.getCell(1);
xtbh.setSjhbgcs(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(3);
xtbh.setSjkzqmc(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(4);
xtbh.setYjbb(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(5);
cell = row.getCell(4);
xtbh.setSjqrjbb(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(6);
cell = row.getCell(5);
xtbh.setSjhrjbb(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(7);
cell = row.getCell(6);
xtbh.setSjqczxt(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(8);
cell = row.getCell(7);
xtbh.setSjhczxt(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(9);
cell = row.getCell(8);
xtbh.setSjbyzsj(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(10);
cell = row.getCell(9);
xtbh.setSjbdx(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(11);
cell = row.getCell(10);
xtbh.setSfcfsj(ImportFileUtil.getCellValue(cell, wb));
xtbh.setCreateTime(now);
xtbh.setUpdateTime(now);