开发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,60 +2,63 @@ package com.jero.modules.ota.service;
import com.jero.modules.ota.entity.OtaBaSjGnxtwh;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: 车型备案-功能系统维护
* @Author: jero-boot
* @Date: 2023-03-28
* @Date: 2023-03-28
* @Version: V1.0
*/
public interface IOtaBaSjGnxtwhService extends IService<OtaBaSjGnxtwh> {
/**
* 保存
*
* @param otaBaSjGnxtwh
* @return
*/
/**
* 保存
*
* @param otaBaSjGnxtwh
* @return
*/
void add(OtaBaSjGnxtwh otaBaSjGnxtwh);
/**
* 更新
*
* @param otaBaSjGnxtwh
* @return
*/
/**
* 更新
*
* @param otaBaSjGnxtwh
* @return
*/
void editById(OtaBaSjGnxtwh otaBaSjGnxtwh);
/**
* 通过id删除
*
* @param id
* @return
*/
/**
* 通过id删除
*
* @param id
* @return
*/
void deleteById(String id);
/**
* 批量删除
*
* @param ids
* @return
*/
/**
* 批量删除
*
* @param ids
* @return
*/
void deleteByIds(List<String> ids);
/**
* 通过id查询
*
* @param id
* @return
*/
/**
* 通过id查询
*
* @param id
* @return
*/
OtaBaSjGnxtwh queryById(String id);
String queryGnxtByKzq(String kzq);
/**
* 列表查询
*
* @return
*/
* 列表查询
*
* @return
*/
List<OtaBaSjGnxtwh> queryList();
}
@@ -4,26 +4,28 @@ 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;
/**
* @Description: 车型备案-功能系统维护
* @Author: jero-boot
* @Date: 2023-03-28
* @Date: 2023-03-28
* @Version: V1.0
*/
@Service
public class OtaBaSjGnxtwhServiceImpl extends ServiceImpl<OtaBaSjGnxtwhMapper, OtaBaSjGnxtwh> implements IOtaBaSjGnxtwhService {
/**
* 保存
*
* @param otaBaSjGnxtwh
* @return
*/
@Override
/**
* 保存
*
* @param otaBaSjGnxtwh
* @return
*/
@Override
public void add(OtaBaSjGnxtwh otaBaSjGnxtwh) {
Date now = new Date();
otaBaSjGnxtwh.setCreateTime(now);
@@ -31,58 +33,74 @@ public class OtaBaSjGnxtwhServiceImpl extends ServiceImpl<OtaBaSjGnxtwhMapper, O
save(otaBaSjGnxtwh);
}
/**
* 更新
*
* @param otaBaSjGnxtwh
* @return
*/
@Override
/**
* 更新
*
* @param otaBaSjGnxtwh
* @return
*/
@Override
public void editById(OtaBaSjGnxtwh otaBaSjGnxtwh) {
Date now = new Date();
Date now = new Date();
otaBaSjGnxtwh.setUpdateTime(now);
saveOrUpdate(otaBaSjGnxtwh);
saveOrUpdate(otaBaSjGnxtwh);
}
/**
* 通过id删除
*
* @param id
* @return
*/
@Override
/**
* 通过id删除
*
* @param id
* @return
*/
@Override
public void deleteById(String id) {
removeById(id);
}
/**
* 批量删除
*
* @param ids
* @return
*/
@Override
/**
* 批量删除
*
* @param ids
* @return
*/
@Override
public void deleteByIds(List<String> ids) {
removeByIds(ids);
}
/**
* 通过id查询
*
* @param id
* @return
*/
@Override
/**
* 通过id查询
*
* @param id
* @return
*/
@Override
public OtaBaSjGnxtwh queryById(String id) {
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;
}
/**
* 列表查询
*
* @return
*/
@Override
* 列表查询
*
* @return
*/
@Override
public List<OtaBaSjGnxtwh> queryList() {
return list();
}
@@ -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);