开发OTA备案工具-车辆升级
This commit is contained in:
+1
-1
@@ -88,7 +88,7 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
|
||||
cpxh = cpxh.replace("%", "\\%");
|
||||
queryWrapper.like(OtaBaSjList::getCpxh, cpxh);
|
||||
}
|
||||
|
||||
queryWrapper.orderByDesc(OtaBaSjList::getCreateTime);
|
||||
IPage<OtaBaSjList> pageList = otaBaSjListService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
+1
@@ -69,6 +69,7 @@ public class OtaBaSjGgnrfs implements Serializable {
|
||||
/**升级目的*/
|
||||
@Excel(name = "升级目的", width = 15)
|
||||
@ApiModelProperty(value = "升级目的")
|
||||
@Dict(dicCode = "uipgrade_purpose")
|
||||
private java.lang.String sjmd;
|
||||
|
||||
/**由于软件升级活动而导致的车辆功能的任何变化*/
|
||||
|
||||
+5
-1
@@ -273,7 +273,11 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
|
||||
break;
|
||||
} else {
|
||||
mssc.setOtaId(otaId);
|
||||
mssc.setGnmc(ImportFileUtil.getCellValue(cell, wb));
|
||||
String gnmc = ImportFileUtil.getCellValue(cell, wb);
|
||||
if (StringUtils.isEmpty(gnmc)) {
|
||||
continue;
|
||||
}
|
||||
mssc.setGnmc(gnmc);
|
||||
cell = row.getCell(1);
|
||||
mssc.setPzqk(ImportFileUtil.getCellValueYesOrNo(cell, wb));
|
||||
cell = row.getCell(2);
|
||||
|
||||
+5
-1
@@ -339,7 +339,11 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
|
||||
break;
|
||||
} else {
|
||||
mssc.setOtaId(otaId);
|
||||
mssc.setXtlb(ImportFileUtil.getCellValue(cell, wb));
|
||||
String xtlb = ImportFileUtil.getCellValue(cell, wb);
|
||||
if (StringUtils.isEmpty(xtlb)) {
|
||||
continue;
|
||||
}
|
||||
mssc.setXtlb(xtlb);
|
||||
cell = row.getCell(1);
|
||||
mssc.setSfksj(ImportFileUtil.getCellValueYesOrNo(cell, wb));
|
||||
cell = row.getCell(2);
|
||||
|
||||
+33
-5
@@ -6,14 +6,17 @@ import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.ota.entity.OtaBaCxTxjl;
|
||||
import com.jero.modules.ota.entity.OtaBaSjGgnrfs;
|
||||
import com.jero.modules.ota.entity.OtaBaSjSjyxpg;
|
||||
import com.jero.modules.ota.enums.OtaModuleEnum;
|
||||
import com.jero.modules.ota.mapper.OtaBaSjGgnrfsMapper;
|
||||
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
|
||||
import com.jero.modules.ota.service.IOtaBaSjGgnrfsService;
|
||||
import com.jero.modules.ota.service.IOtaBaSjSjyxpgService;
|
||||
import com.jero.modules.ota.utils.ComparisonUtil;
|
||||
import com.jero.modules.ota.utils.ImportFileUtil;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -24,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description: 升级备案-用户告知内容及方式
|
||||
@@ -49,6 +53,10 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
|
||||
@Autowired
|
||||
private IOSSFileService ossFileService;
|
||||
|
||||
@Autowired
|
||||
private IOtaBaSjSjyxpgService otaBaSjSjyxpgService;
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -168,18 +176,38 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
|
||||
@Override
|
||||
public void parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
||||
File attFile = null;
|
||||
File upFile = null;
|
||||
for (File f : upLoadFiles) {
|
||||
if (f.isDirectory() && f.getName().equals("用户告知内容及方式")) {
|
||||
attFile = f;
|
||||
}
|
||||
// else if (f.getName().equals("用户告知内容及方式.xlsx")) {
|
||||
// upFile = f;
|
||||
// }
|
||||
}
|
||||
if (null == upFile || null == attFile) {
|
||||
if (null == attFile) {
|
||||
throw new JeroBootException("请上传正确的文件");
|
||||
}
|
||||
OtaBaSjGgnrfs fs = parseFile(attFile, otaId, cut);
|
||||
add(fs);
|
||||
}
|
||||
|
||||
private OtaBaSjGgnrfs parseFile(File attFile, String otaId, String cut) throws Exception {
|
||||
OtaBaSjGgnrfs fs = new OtaBaSjGgnrfs();
|
||||
fs.setOtaId(otaId);
|
||||
OtaBaSjSjyxpg pg = otaBaSjSjyxpgService.queryByOtaId(otaId, "");
|
||||
if (StringUtils.isNotEmpty(pg.getSjmd())) {
|
||||
fs.setSjmd(pg.getSjmd());
|
||||
}
|
||||
StringBuilder attStr1 = new StringBuilder();
|
||||
File[] attFiles1 = attFile.listFiles();
|
||||
for (int i = 0; i < attFiles1.length; i++) {
|
||||
if (!attFiles1[i].isDirectory() && (attFiles1[i].getName().contains(".doc") || attFiles1[i].getName().contains(".docx") || attFiles1[i].getName().contains(".pdf"))) {
|
||||
if (i >= attFiles1.length - 1) {
|
||||
attStr1.append(ImportFileUtil.uploadFiles(attFiles1[i], ossFileService));
|
||||
} else {
|
||||
attStr1.append(ImportFileUtil.uploadFiles(attFiles1[i], ossFileService)).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
fs.setXgwj(attStr1.toString());
|
||||
return fs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -188,7 +188,7 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
|
||||
public OtaBaSjSjmbcx parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
||||
File upFile = null;
|
||||
for (File f : upLoadFiles) {
|
||||
if (f.getName().equals("车型基本信息.xlsx")) {
|
||||
if (f.getName().equals("升级目标车型.xlsx")) {
|
||||
upFile = f;
|
||||
}
|
||||
}
|
||||
|
||||
+48
-3
@@ -183,7 +183,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
|
||||
return sjyxpg;
|
||||
}
|
||||
|
||||
private OtaBaSjSjyxpg parseFile(File upFile, String cut) throws Exception {
|
||||
private OtaBaSjSjyxpg parseFile(File upFile, File attFile1, File attFile2, String cut) throws Exception {
|
||||
OtaBaSjSjyxpg sjyxpg = new OtaBaSjSjyxpg();
|
||||
InputStream is = new FileInputStream(upFile);
|
||||
XWPFDocument doc = new XWPFDocument(is);
|
||||
@@ -201,21 +201,66 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
|
||||
}
|
||||
sjyxpg.setSjmd(sb.toString());
|
||||
}
|
||||
StringBuilder attStr1 = new StringBuilder();
|
||||
File[] attFiles1 = attFile1.listFiles();
|
||||
for (int i = 0; i < attFiles1.length; i++) {
|
||||
if (!attFiles1[i].isDirectory() && (attFiles1[i].getName().contains(".doc") || attFiles1[i].getName().contains(".docx") || attFiles1[i].getName().contains(".pdf"))) {
|
||||
if (i >= attFiles1.length - 1) {
|
||||
attStr1.append(ImportFileUtil.uploadFiles(attFiles1[i], ossFileService));
|
||||
} else {
|
||||
attStr1.append(ImportFileUtil.uploadFiles(attFiles1[i], ossFileService)).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
sjyxpg.setBgfj(attStr1.toString());
|
||||
StringBuilder attStr2 = new StringBuilder();
|
||||
File[] attFiles2 = attFile2.listFiles();
|
||||
for (int i = 0; i < attFiles2.length; i++) {
|
||||
if (!attFiles2[i].isDirectory() && (attFiles2[i].getName().contains(".doc") || attFiles2[i].getName().contains(".docx") || attFiles2[i].getName().contains(".pdf"))) {
|
||||
if (i >= attFiles2.length - 1) {
|
||||
attStr2.append(ImportFileUtil.uploadFiles(attFiles2[i], ossFileService));
|
||||
} else {
|
||||
attStr2.append(ImportFileUtil.uploadFiles(attFiles2[i], ossFileService)).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
sjyxpg.setClfj(attStr2.toString());
|
||||
return sjyxpg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OtaBaSjSjyxpg parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
||||
File upFile = null;
|
||||
File attFile = null;
|
||||
File attFile1 = null;
|
||||
File attFile2 = null;
|
||||
for (File f : upLoadFiles) {
|
||||
if (f.getName().equals("升级影响评估.docx")) {
|
||||
upFile = f;
|
||||
}
|
||||
if (f.isDirectory() && f.getName().equals("升级影响评估")) {
|
||||
attFile = f;
|
||||
}
|
||||
}
|
||||
if (null == upFile) {
|
||||
|
||||
if (null == upFile || null == attFile) {
|
||||
throw new JeroBootException("请上传正确的文件");
|
||||
}
|
||||
OtaBaSjSjyxpg sjyxpg = parseFile(upFile, cut);
|
||||
|
||||
for (File f : attFile.listFiles()) {
|
||||
if (f.isDirectory() && f.getName().equals("测试报告")) {
|
||||
attFile1 = f;
|
||||
}
|
||||
if (f.isDirectory() && f.getName().equals("硬件版本号附件")) {
|
||||
attFile2 = f;
|
||||
}
|
||||
}
|
||||
if (null == attFile1 || null == attFile2) {
|
||||
throw new JeroBootException("请上传正确的文件");
|
||||
}
|
||||
|
||||
|
||||
OtaBaSjSjyxpg sjyxpg = parseFile(upFile, attFile1, attFile2, cut);
|
||||
sjyxpg.setOtaId(otaId);
|
||||
add(sjyxpg);
|
||||
return sjyxpg;
|
||||
|
||||
+9
@@ -294,6 +294,15 @@ public class ImportFileUtil {
|
||||
return res;
|
||||
}
|
||||
|
||||
public static String uploadFiles(File attFile, IOSSFileService ossFileService) throws Exception {
|
||||
String res = "";
|
||||
OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(attFile), "", null, null);
|
||||
if (ObjectUtils.isNotEmpty(ossFile)) {
|
||||
res = ossFile.getId();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static String uploadFiles(File attFile, String[] strs, IOSSFileService ossFileService) throws Exception {
|
||||
String res = "";
|
||||
for (int i = 0; i < strs.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user