From 35937db22a05e571e012b7956dbce043e378baba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=B5=A9?= Date: Fri, 31 Mar 2023 02:52:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91OTA=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=B7=A5=E5=85=B7-=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ota/controller/OtaBaSjListController.java | 5 +- .../ota/service/IOtaBaSjGgnrfsService.java | 79 ++++++++++--------- .../ota/service/IOtaBaSjListService.java | 2 +- .../ota/service/IOtaBaSjSjfzbhService.java | 4 +- .../ota/service/IOtaBaSjSjmbclService.java | 4 +- .../ota/service/IOtaBaSjSjmbcxService.java | 4 +- .../ota/service/IOtaBaSjSjxtbhService.java | 4 +- .../ota/service/IOtaBaSjSjyxpgService.java | 4 +- .../impl/OtaBaSjGgnrfsServiceImpl.java | 10 +-- .../service/impl/OtaBaSjListServiceImpl.java | 16 ++-- .../impl/OtaBaSjSjfzbhServiceImpl.java | 13 +-- .../impl/OtaBaSjSjmbclServiceImpl.java | 10 +-- .../impl/OtaBaSjSjmbcxServiceImpl.java | 12 +-- .../impl/OtaBaSjSjxtbhServiceImpl.java | 12 +-- .../impl/OtaBaSjSjyxpgServiceImpl.java | 10 +-- 15 files changed, 99 insertions(+), 90 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaSjListController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaSjListController.java index 51bd9d829..4bcd03f36 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaSjListController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaSjListController.java @@ -233,13 +233,14 @@ public class OtaBaSjListController extends JeroController importData(@RequestParam(value = "file", required = false) MultipartFile file, @RequestParam(value = "cut", required = false) String cut) throws Exception { + StringBuilder errMsg = new StringBuilder(); try { - this.otaBaSjListService.importData(file, cut); + this.otaBaSjListService.importData(file, cut, errMsg); } catch (Exception e) { e.printStackTrace(); return Result.error(e.getMessage()); } - return Result.OK("导入成功"); + return Result.error(errMsg.toString()); } @ApiOperation(value = "升级备案-数据导出") diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjGgnrfsService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjGgnrfsService.java index e37910f4c..0f41d278d 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjGgnrfsService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjGgnrfsService.java @@ -12,64 +12,65 @@ import java.util.List; /** * @Description: 升级备案-用户告知内容及方式 * @Author: jero-boot - * @Date: 2023-03-17 + * @Date: 2023-03-17 * @Version: V1.0 */ public interface IOtaBaSjGgnrfsService extends IService { - /** - * 保存 - * - * @param otaBaSjGgnrfs - * @return - */ + /** + * 保存 + * + * @param otaBaSjGgnrfs + * @return + */ void add(OtaBaSjGgnrfs otaBaSjGgnrfs); - /** - * 更新 - * - * @param otaBaSjGgnrfs - * @return - */ + /** + * 更新 + * + * @param otaBaSjGgnrfs + * @return + */ void editById(OtaBaSjGgnrfs otaBaSjGgnrfs); - /** - * 通过id删除 - * - * @param id - * @return - */ + /** + * 通过id删除 + * + * @param id + * @return + */ void deleteById(String id); - /** - * 批量删除 - * - * @param ids - * @return - */ + /** + * 批量删除 + * + * @param ids + * @return + */ void deleteByIds(List ids); - /** - * 通过id查询 - * - * @param id - * @return - */ + /** + * 通过id查询 + * + * @param id + * @return + */ OtaBaSjGgnrfs queryById(String id); /** - * 列表查询 - * - * @return - */ + * 列表查询 + * + * @return + */ List queryList(); OtaBaSjGgnrfs queryByOtaId(String otaId, String otaIdT); - void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception; + void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception; - void importData(MultipartFile file, String otaId, String cut) throws Exception; + void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception; - void parseFileList(List upLoadFiles, String otaId, String cut) throws Exception; + void parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception; - void exportData(File file, File fsAttFile, String otaId, String cut) throws Exception;} + void exportData(File file, File fsAttFile, String otaId, String cut) throws Exception; +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjListService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjListService.java index d7b14bae9..8546e69e4 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjListService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjListService.java @@ -70,7 +70,7 @@ public interface IOtaBaSjListService extends IService { void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception; - void importData(MultipartFile file, String cut) throws Exception; + void importData(MultipartFile file, String cut, StringBuilder errMsg) throws Exception; void exportData(String otaId, HttpServletResponse response, HttpServletRequest request) throws Exception; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjfzbhService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjfzbhService.java index ff3bfa535..a660411a0 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjfzbhService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjfzbhService.java @@ -69,9 +69,9 @@ public interface IOtaBaSjSjfzbhService extends IService { void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception; - void importData(MultipartFile file, String otaId, String cut) throws Exception; + void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception; - void parseFileList(List upLoadFiles, String otaId, String cut) throws Exception; + void parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception; void exportData(File file, String otaId, String cut) throws Exception; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjmbclService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjmbclService.java index 6d7d6a66c..31d68ecb2 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjmbclService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjmbclService.java @@ -69,9 +69,9 @@ public interface IOtaBaSjSjmbclService extends IService { void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception; - OtaBaSjSjmbcl parseFileList(List upLoadFiles, String otaId, String cut) throws Exception; + OtaBaSjSjmbcl parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception; - OtaBaSjSjmbcl importData(MultipartFile file, String otaId, String cut) throws Exception; + OtaBaSjSjmbcl importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception; void exportData(File file, File mbclAttFile, String otaId, String cut) throws Exception; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjmbcxService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjmbcxService.java index 32be72b65..4695ad5bc 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjmbcxService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjmbcxService.java @@ -70,9 +70,9 @@ public interface IOtaBaSjSjmbcxService extends IService { void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception; - OtaBaSjSjmbcx importData(MultipartFile file, String otaId, String cut) throws Exception; + OtaBaSjSjmbcx importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception; - OtaBaSjSjmbcx parseFileList(List upLoadFiles, String otaId, String cut) throws Exception; + OtaBaSjSjmbcx parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception; void exportData(File file, String otaId, String cut) throws Exception; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjxtbhService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjxtbhService.java index 17b9bb40e..02b5f148d 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjxtbhService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjxtbhService.java @@ -67,9 +67,9 @@ public interface IOtaBaSjSjxtbhService extends IService { void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception; - void importData(MultipartFile file, String otaId, String cut) throws Exception; + void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception; - void parseFileList(List upLoadFiles, String otaId, String cut) throws Exception; + void parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception; void exportData(File file, String otaId, String cut) throws Exception; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjyxpgService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjyxpgService.java index 78419ac34..cd020b1ce 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjyxpgService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjSjyxpgService.java @@ -69,9 +69,9 @@ public interface IOtaBaSjSjyxpgService extends IService { void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception; - OtaBaSjSjyxpg importData(MultipartFile file, String otaId, String cut) throws Exception; + OtaBaSjSjyxpg importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception; - OtaBaSjSjyxpg parseFileList(List upLoadFiles, String otaId, String cut) throws Exception; + OtaBaSjSjyxpg parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception; void exportData(File file, File attFile, File attFile2, String otaId, String cut) throws Exception; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjGgnrfsServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjGgnrfsServiceImpl.java index 2cd2a3801..331e66439 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjGgnrfsServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjGgnrfsServiceImpl.java @@ -194,13 +194,13 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath); - parseFileList(upLoadFiles, otaId, cut); + parseFileList(upLoadFiles, otaId, cut,errMsg); } @Override - public void parseFileList(List upLoadFiles, String otaId, String cut) throws Exception { + public void parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception{ File attFile = null; for (File f : upLoadFiles) { if (f.isDirectory() && f.getName().equals("用户告知内容及方式")) { @@ -210,11 +210,11 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl fileList = ImportFileUtil.importZip(file, cut, uploadPath); - OtaBaSjSjmbcx mbcx = otaBaSjSjmbcxService.parseFileList(fileList, "", cut); + OtaBaSjSjmbcx mbcx = otaBaSjSjmbcxService.parseFileList(fileList, "", cut, errMsg); String otaId = mbcx.getOtaId(); if (StringUtils.isNotEmpty(otaId)) { - otaBaSjSjmbclService.parseFileList(fileList, otaId, cut); - otaBaSjSjmbcxService.parseFileList(fileList, otaId, cut); - otaBaSjSjyxpgService.parseFileList(fileList, otaId, cut); - otaBaSjSjxtbhService.parseFileList(fileList, otaId, cut); - otaBaSjSjfzbhService.parseFileList(fileList, otaId, cut); - otaBaSjGgnrfsService.parseFileList(fileList, otaId, cut); + otaBaSjSjmbclService.parseFileList(fileList, otaId, cut, errMsg); + otaBaSjSjmbcxService.parseFileList(fileList, otaId, cut, errMsg); + otaBaSjSjyxpgService.parseFileList(fileList, otaId, cut, errMsg); + otaBaSjSjxtbhService.parseFileList(fileList, otaId, cut, errMsg); + otaBaSjSjfzbhService.parseFileList(fileList, otaId, cut, errMsg); + otaBaSjGgnrfsService.parseFileList(fileList, otaId, cut, errMsg); } else { throw new JeroBootException("导入失败"); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjfzbhServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjfzbhServiceImpl.java index e4e9e4dcd..cda41306c 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjfzbhServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjfzbhServiceImpl.java @@ -204,13 +204,13 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath); - parseFileList(upLoadFiles, otaId, cut); + parseFileList(upLoadFiles, otaId, cut,errMsg); } @Override - public void parseFileList(List upLoadFiles, String otaId, String cut) throws Exception { + public void parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception { File upFile = null; for (File f : upLoadFiles) { if (f.getName().equals("本次升级的驾驶辅助功能与参数变化.xlsx")) { @@ -225,7 +225,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl(); } - List newList = parseFile(upFile, otaId, cut); + List newList = parseFile(upFile, otaId, cut,errMsg); ComparisonUtil cu = new ComparisonUtil(); List reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJJSMCBH, OtaTitleEnum.GNMC.getName(), oldList, newList, sysDictService); deleteByOtaId(otaId); @@ -233,7 +233,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl parseFile(File upFile, String otaId, String cut) throws Exception { + private List parseFile(File upFile, String otaId, String cut, StringBuilder errMsg) throws Exception { Date now = new Date(); List fzbhList = new ArrayList<>(); Workbook wb = ImportFileUtil.readExcel(upFile); @@ -264,6 +264,9 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl upLoadFiles, String otaId, String cut) throws Exception { + public OtaBaSjSjmbcl parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception { File upFile = null; for (File f : upLoadFiles) { if (f.getName().equals("本次升级涉及的目标车辆.xlsx")) { @@ -191,13 +191,13 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath); - OtaBaSjSjmbcl mbcl = parseFileList(upLoadFiles, otaId, cut); + OtaBaSjSjmbcl mbcl = parseFileList(upLoadFiles, otaId, cut, errMsg); return mbcl; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbcxServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbcxServiceImpl.java index 76a4b9dc6..e9ef5aa34 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbcxServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbcxServiceImpl.java @@ -179,14 +179,14 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath); - OtaBaSjSjmbcx mbcx = parseFileList(upLoadFiles, otaId, cut); + OtaBaSjSjmbcx mbcx = parseFileList(upLoadFiles, otaId, cut, errMsg); return mbcx; } @Override - public OtaBaSjSjmbcx parseFileList(List upLoadFiles, String otaId, String cut) throws Exception { + public OtaBaSjSjmbcx parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception { File upFile = null; for (File f : upLoadFiles) { if (f.getName().equals("升级目标车型.xlsx")) { @@ -196,13 +196,13 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath); - parseFileList(upLoadFiles, otaId, cut); + parseFileList(upLoadFiles, otaId, cut,errMsg); } @Override - public void parseFileList(List upLoadFiles, String otaId, String cut) throws Exception { + public void parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception{ File upFile = null; for (File f : upLoadFiles) { if (f.getName().equals("本次升级的系统名称与变更参数.xlsx")) { @@ -221,7 +221,7 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl newList = parseFile(upFile, otaId, cut); + List newList = parseFile(upFile, otaId, cut,errMsg); List oldList = getByOtaId(otaId); if (ObjectUtils.isEmpty(oldList)) { oldList = new ArrayList<>(); @@ -233,7 +233,7 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl parseFile(File upFile, String otaId, String cut) throws Exception { + private List parseFile(File upFile, String otaId, String cut, StringBuilder errMsg) throws Exception{ Date now = new Date(); List list = new ArrayList<>(); Workbook wb = ImportFileUtil.readExcel(upFile); @@ -271,6 +271,8 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath); - OtaBaSjSjyxpg sjyxpg = parseFileList(upLoadFiles, otaId, cut); + OtaBaSjSjyxpg sjyxpg = parseFileList(upLoadFiles, otaId, cut, errMsg); return sjyxpg; } - private OtaBaSjSjyxpg parseFile(File upFile, File attFile1, File attFile2, String cut) throws Exception { + private OtaBaSjSjyxpg parseFile(File upFile, File attFile1, File attFile2, String cut, StringBuilder errMsg) throws Exception { OtaBaSjSjyxpg sjyxpg = new OtaBaSjSjyxpg(); InputStream is = new FileInputStream(upFile); XWPFDocument doc = new XWPFDocument(is); @@ -253,7 +253,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl upLoadFiles, String otaId, String cut) throws Exception { + public OtaBaSjSjyxpg parseFileList(List upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception { File upFile = null; File attFile = null; File attFile1 = null; @@ -284,7 +284,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl