From 3559c7739d7c2eb957a972b9b459b783814ee4f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=B5=A9?= Date: Wed, 29 Mar 2023 21:56:12 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=BC=80=E5=8F=91OTA=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=B7=A5=E5=85=B7-=E8=BD=A6=E8=BE=86=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jero/modules/ota/entity/VinObj.java | 58 +++++++++++++++ .../impl/OtaBaSjSjmbclServiceImpl.java | 72 ++++++++++++++++--- 2 files changed, 121 insertions(+), 9 deletions(-) create mode 100644 jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/VinObj.java diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/VinObj.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/VinObj.java new file mode 100644 index 000000000..a0511aaaf --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/VinObj.java @@ -0,0 +1,58 @@ +package com.jero.modules.ota.entity; + +import com.jero.modules.extRepo.entity.ERFTreeData; +import com.jero.modules.ota.service.impl.OtaBaSjSjmbclServiceImpl; +import org.jetbrains.annotations.NotNull; + +import java.util.Date; + +public class VinObj { + + + String vin; + String cx; + String gglx; + Date scrq; + String scrqStr; + + public String getVin() { + return vin; + } + + public void setVin(String vin) { + this.vin = vin; + } + + public String getCx() { + return cx; + } + + public void setCx(String cx) { + this.cx = cx; + } + + public String getGglx() { + return gglx; + } + + public void setGglx(String gglx) { + this.gglx = gglx; + } + + public Date getScrq() { + return scrq; + } + + public void setScrq(Date scrq) { + this.scrq = scrq; + } + + public String getScrqStr() { + return scrqStr; + } + + public void setScrqStr(String scrqStr) { + this.scrqStr = scrqStr; + } + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbclServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbclServiceImpl.java index 266fce976..0edcd6d15 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbclServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbclServiceImpl.java @@ -2,15 +2,13 @@ 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.extRepo.entity.ERFTreeData; 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; -import com.jero.modules.ota.service.IOtaBaCxTxjlService; -import com.jero.modules.ota.service.IOtaBaSjListService; -import com.jero.modules.ota.service.IOtaBaSjLsjlService; -import com.jero.modules.ota.service.IOtaBaSjSjmbclService; +import com.jero.modules.ota.service.*; import com.jero.modules.ota.utils.ComparisonUtil; import com.jero.modules.ota.utils.ImportFileUtil; import com.jero.modules.system.service.ISysDictService; @@ -20,14 +18,14 @@ import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.io.File; -import java.util.List; -import java.util.Date; -import java.util.UUID; +import java.text.SimpleDateFormat; +import java.util.*; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.web.multipart.MultipartFile; @@ -44,6 +42,8 @@ import javax.servlet.http.HttpServletResponse; @Service public class OtaBaSjSjmbclServiceImpl extends ServiceImpl implements IOtaBaSjSjmbclService { + private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); + @Value(value = "${ota.templatePath}") private String templatePath; @@ -59,6 +59,10 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl vinList = new ArrayList<>(); + for (int i = 1; i < rows; i++) { + VinObj vinObj = new VinObj(); + Row row = s.getRow(i); + Cell cell = row.getCell(0); + vinObj.setVin(ImportFileUtil.getCellValue(cell, wb)); + cell = row.getCell(1); + vinObj.setCx(ImportFileUtil.getCellValue(cell, wb)); + if (!cx.equals(vinObj.getCx())) { + continue; + } + cell = row.getCell(2); + vinObj.setGglx(ImportFileUtil.getCellValue(cell, wb)); + cell = row.getCell(3); + vinObj.setScrq(cell.getDateCellValue()); + vinObj.setScrqStr(sdf.format(vinObj.getScrq())); + vinList.add(vinObj); + } + + + mbcl.setOtaId(otaId); + if (ObjectUtils.isNotEmpty(vinList)) { + // 匿名比较器排序 + Collections.sort(vinList, new Comparator() { + @Override + public int compare(VinObj p1, VinObj p2) { + return p1.getScrq().compareTo(p2.getScrq()); + } + }); + mbcl.setZsl(String.valueOf(vinList.size())); + mbcl.setScrqks(vinList.get(0).getScrq()); + mbcl.setScrqjs(vinList.get(vinList.size() - 1).getScrq()); + // 匿名比较器排序 + Collections.sort(vinList, new Comparator() { + @Override + public int compare(VinObj p1, VinObj p2) { + return p1.getVin().compareTo(p2.getVin()); + } + }); + mbcl.setVinList(vinList.get(0).getVin() + "-" + vinList.get(vinList.size() - 1).getVin()); + } + } return mbcl; } @@ -205,4 +258,5 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl Date: Wed, 29 Mar 2023 22:43:38 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E5=B8=82=E5=9C=BA?= =?UTF-8?q?=E6=B8=85=E5=8D=95=E5=AF=BC=E5=85=A5=E6=97=B6=E7=9A=84=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AuthDummyInventoryInfoEOServiceImpl.java | 386 +++++++++++++++++- .../ProjectCertificationInventoryEOEn.java | 2 +- ...ctCertificationInventoryEOServiceImpl.java | 2 +- 3 files changed, 371 insertions(+), 19 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/service/impl/AuthDummyInventoryInfoEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/service/impl/AuthDummyInventoryInfoEOServiceImpl.java index 722c114cb..ccc0b9946 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/service/impl/AuthDummyInventoryInfoEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/service/impl/AuthDummyInventoryInfoEOServiceImpl.java @@ -28,6 +28,7 @@ import com.jero.modules.dummy.enums.DummyInventoryBaseFieldEnum; import com.jero.modules.dummy.service.impl.DummyLogEOServiceImpl; import com.jero.modules.dummy.util.DeepCopyListUtil; import com.jero.modules.oss.service.IOSSFileService; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; import com.jero.modules.project.enums.ProjectInventoryFieldEnum; import com.jero.modules.split.common.FileUnZip; import com.jero.modules.system.entity.SysCategory; @@ -513,9 +514,9 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl categoryList = sysCategoryService.list(); -// //普通数据字典 -// List dictItemList = sysDictItemServiceImpl.selectItemsAll(); -// importDatas(datas, categoryList, dictItemList, zipEntryName,saveDirectory,authDummyInventoryInfoEO); - String cut = authDummyInventoryInfoEO.getCut(); - importDisposeData(datas,cut); + List categoryList = sysCategoryService.list(); + //普通数据字典 + List dictItemList = sysDictItemServiceImpl.selectItemsAll(); + importDatas(datas, categoryList, dictItemList, zipEntryName,saveDirectory,authDummyInventoryInfoEO); +// String cut = authDummyInventoryInfoEO.getCut(); +// importDisposeData(datas,cut); //删除原上传文件 FileUnZip.deleteDir(saveDirectory); }else{ @@ -720,6 +721,357 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl datas, + List categoryList, List dictItemList, + String zipEntryName, File saveDirectory, + AuthDummyInventoryInfoEO authDummyInventoryInfoEOTemp) { + List msgList = new ArrayList<>(); + + //模板数据验证 + msgList = dataTemplateVerify(datas, dictItemList, zipEntryName, authDummyInventoryInfoEOTemp, categoryList); + if (msgList.size() > 0) { + //返回报错信息 + String html = ""; + for (String s : msgList) { + html += s + "
"; + } + FileUnZip.deleteDir(saveDirectory); + throw new JeroBootException(html); + }else { + if (datas.size() != 0) { + this.saveBatch(datas); + } + } + } + + private List dataTemplateVerify(List datas, + List dictItemList, String zipEntryName, + AuthDummyInventoryInfoEO authDummyInventoryInfoEOTemp, + List categoryList) { + String dictId = sysCategoryMapper.getDictId("ren4_zheng4_-_jiao1_fu4_wu4_lei4_xing2"); + List collect = categoryList.stream().filter(e -> e.getSysDictId().equals(dictId)).collect(Collectors.toList()); + List treeNameList = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + treeNameList = collect.stream().map(SysCategory::getName).collect(Collectors.toList()); + }else{ + treeNameList = collect.stream().map(SysCategory::getEnName).collect(Collectors.toList()); + } + int i = 2; + List msgList = new ArrayList<>(); + String value = ""; + boolean flag = true; + + //编号验证 + verifySerialNumber(datas,authDummyInventoryInfoEOTemp); + for(AuthDummyInventoryInfoEO authDummyInventoryInfoEO :datas){ + i++; + String errorMsg = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + errorMsg = "第" + i + "行:"; + }else{ + errorMsg = i + " line:"; + } + //类别 + String category = authDummyInventoryInfoEO.getCategory(); + //检验项目 + String inspectionItem = authDummyInventoryInfoEO.getInspectionItem(); + //配置项 + String configItem = authDummyInventoryInfoEO.getConfigItem(); + //WVTA ID + String wvtaId = authDummyInventoryInfoEO.getWvtaId(); + //标准编号 + String serialNumber = authDummyInventoryInfoEO.getSerialNumber(); + //责任领域 + String dutyTerritory = authDummyInventoryInfoEO.getDutyTerritoryName(); + //交付物类型 + String deliverableType = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){ + deliverableType = authDummyInventoryInfoEO.getDeliverableTypeName(); + }else { + deliverableType = authDummyInventoryInfoEO.getDeliverableTypeNameEn(); + } + + //编号必填 + flag = must(authDummyInventoryInfoEO, errorMsg, msgList, serialNumber, "编号", "Number"); + + //WVTA ID + + if(StringUtils.isNotBlank(wvtaId)){ + if(wvtaId.length() > 100){ + String message = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + message = errorMsg + "WVTA ID不能超过100个字符, "; + }else{ + message = errorMsg + " The WVTA ID cannot contain more than 100 characters, "; + } + msgList.add(message); + } + } else { + String message = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + message = errorMsg + "WVTA ID不能为空, "; + }else{ + message = errorMsg + " The WVTA ID cannot null, "; + } + msgList.add(message); + } + //类别 + + if(StringUtils.isNotBlank(category)){ + if(category.length() > 100){ + String message = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + message = errorMsg + "类别不能超过100个字符, "; + }else{ + message = errorMsg + " The Category cannot contain more than 100 characters, "; + } + msgList.add(message); + } + }else { + String message = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + message = errorMsg + "类别不能为空, "; + }else{ + message = errorMsg + " The Category cannot null, "; + } + msgList.add(message); + } + //检验项目 + + if(StringUtils.isNotBlank(inspectionItem)){ + if(inspectionItem.length() > 100){ + String message = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + message = errorMsg + "检验项目不能超过100个字符, "; + }else{ + message = errorMsg + " The InspectionItem cannot contain more than 100 characters, "; + } + msgList.add(message); + } + }else { + String message = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + message = errorMsg + "检验项目不能为空, "; + }else{ + message = errorMsg + " The InspectionItem cannot null, "; + } + msgList.add(message); + } + //配置项 + + if(StringUtils.isNotBlank(configItem)){ + if(configItem.length() > 100){ + String message = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + message = errorMsg + "配置项不能超过100个字符, "; + }else{ + message = errorMsg + " The ConfigItem cannot contain more than 100 characters, "; + } + msgList.add(message); + } + }else { + String message = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + message = errorMsg + "配置项不能为空, "; + }else{ + message = errorMsg + " The ConfigItem cannot null, "; + } + msgList.add(message); + } + //责任领域 + if(StringUtils.isNotBlank(dutyTerritory)){ + value = pullMore(dictItemList, authDummyInventoryInfoEO, errorMsg, dutyTerritory,msgList,"责任领域","Responsible Field","duty_territory"); + if(StringUtils.isNotBlank(value)){ + authDummyInventoryInfoEO.setDutyTerritory(value); + } + }else { + String message = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + message = errorMsg + "责任领域不能为空, "; + }else{ + message = errorMsg + " The Responsible Field cannot null, "; + } + msgList.add(message); + } + //交付物类型 + if(StringUtils.isNotEmpty(deliverableType)){ + value = tree(categoryList,treeNameList, authDummyInventoryInfoEO, errorMsg, deliverableType,msgList,"交付物类型","Deliverable Type","deliverable_template"); + if(StringUtils.isNotBlank(value)){ + String treeId = getTreeId(categoryList, authDummyInventoryInfoEOTemp, treeNameList, value); + authDummyInventoryInfoEO.setDeliverableType(treeId); + } + }else{ + String message = ""; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){ + message = errorMsg + "交付物类型不能为空, "; + }else{ + message = errorMsg + " The Deliverable Type cannot null, "; + } + msgList.add(message); + } + } + return msgList; + } + + private String getTreeId(List categoryList, AuthDummyInventoryInfoEO authDummyInventoryInfoEOTemp, + List treeNameList, String value) { + StringBuilder sb = new StringBuilder(); + for (String valueTemp : value.split(",")) { + if (treeNameList.contains(valueTemp)) { + List sysCategoryList = new ArrayList<>(); + if (CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())) { + sysCategoryList = categoryList.stream().filter(e -> e.getName().equals(valueTemp)).collect(Collectors.toList()); + } else { + sysCategoryList = categoryList.stream().filter(e -> e.getEnName().equals(valueTemp)).collect(Collectors.toList()); + } + if (sysCategoryList.size() != 0) { + sb.append(sysCategoryList.get(0).getId() + ","); + } + } + } + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + return substring; + } + return null; + } + + private String tree(List categoryList, List nameList, + AuthDummyInventoryInfoEO authDummyInventoryInfoEO, + String errorMsg, String value, List msgList, + String nameCn, String nameEn, String dictCode) { + if (StringUtils.isNotBlank(value)) { + StringBuilder sb = new StringBuilder(); + for (String s : value.split(",")) { + if(!nameList.contains(s)){ + sb.append(s+","); + } + } + if(StringUtils.isNotBlank(sb)){ + String substring = sb.substring(0, sb.length() - 1); + if (CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())) { + errorMsg += nameCn + "中的" + substring + "与数据字典不匹配, "; + } else { + errorMsg += nameEn + " " + substring + " does not match the data dictionary, "; + } + msgList.add(errorMsg); + }else{ + StringBuilder sbTemp = new StringBuilder(); + for (String s : value.split(",")) { + List collect = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){ + collect = categoryList.stream().filter(e -> s.equals(e.getName())).collect(Collectors.toList()); + if(collect.size() != 0){ + sbTemp.append(collect.get(0).getName()+","); + } + }else{ + collect = categoryList.stream().filter(e -> s.equals(e.getEnName())).collect(Collectors.toList()); + if(collect.size() != 0){ + sbTemp.append(collect.get(0).getEnName()+","); + } + } + } + if(StringUtils.isNotBlank(sbTemp)){ + String substring = sbTemp.substring(0, sbTemp.length() - 1); + return substring; + } + } + } + return null; + } + + private String pullMore(List dictItemList, AuthDummyInventoryInfoEO authDummyInventoryInfoEO, + String errorMsg, String value, List msgList, String nameCn, + String nameEn, String dictCode) { + List valueList = new ArrayList<>(); + if (StringUtils.isNotBlank(value)) { + List list = Arrays.asList(value.split(",")); + List sysDictItemList = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){ + sysDictItemList = dictItemList.stream().filter(e ->dictCode.equals(e.getDictCode()) && list.contains(e.getItemText())).collect(Collectors.toList()); + }else{ + sysDictItemList = dictItemList.stream().filter(e ->dictCode.equals(e.getDictCode()) && list.contains(e.getEnName())).collect(Collectors.toList()); + } + + if(list.size() == sysDictItemList.size()){ + valueList = sysDictItemList.stream().map(SysDictItem::getItemValue).collect(Collectors.toList()); + + }else{ + //数据中有与数据字典不匹配的值 + List finalValueList = valueList; + List diffList = list.stream().filter(e -> !finalValueList.contains(e)).collect(Collectors.toList()); + if (CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())) { + errorMsg += nameCn + "中的" + StringUtils.join(diffList,",") + "与数据字典不匹配, "; + } else { + errorMsg += nameEn + " " + StringUtils.join(diffList,",") + " does not match the data dictionary, "; + } + msgList.add(errorMsg); + } + } + return StringUtils.join(valueList,","); + } + + private boolean must(AuthDummyInventoryInfoEO authDummyInventoryInfoEO, + String errorMsg, List msgList, String serialNumber, + String nameCn, String nameEn) { + int errorCount = 0; + if(StringUtils.isBlank(serialNumber)){ + errorCount ++; + if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){ + errorMsg += nameCn + "为必填项,不能为空, "; + }else{ + errorMsg += nameEn + "This parameter is mandatory and cannot be empty, "; + } + msgList.add(errorMsg); + } + if(errorCount == 0){ + return true; + }else{ + return false; + } + } + + private void verifySerialNumber(List datas, + AuthDummyInventoryInfoEO authDummyInventoryInfoEOTemp) { + //1. 验证标准号在文档库中是否存在 + List serialNumberList = datas.stream().map(AuthDummyInventoryInfoEO::getSerialNumber).collect(Collectors.toList()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(BussDocumentLibraryEO::getSerialNumber,serialNumberList); + List bussDocumentLibraryEOList = iBussDocumentLibraryEOService.list(wrapper); + //文档库中可能存在重复的标准号 + List serialNumberListTemp = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).distinct().collect(Collectors.toList()); + if(serialNumberList.size() != serialNumberListTemp.size()){ + //存在文档库没有的数据 + List collect = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList()); + List serialNumbers = serialNumberList.stream().filter(e -> !collect.contains(e)).collect(Collectors.toList()); + if(serialNumbers.size() > 0){ + if(CutEnum.CN.getValue().equals(datas.get(0).getCut())){ + throw new JeroBootException(StringUtils.join(serialNumbers,",")+"文档库中不存在,不能添加"); + }else{ + throw new JeroBootException(StringUtils.join(serialNumbers,",")+" does not exist in the document library and cannot be added"); + } + } + }else{ + for (AuthDummyInventoryInfoEO authDummyInventoryInfoEO : datas) { + List collect = bussDocumentLibraryEOList.stream() + .filter(e -> e.getSerialNumber().equals(authDummyInventoryInfoEO.getSerialNumber())).collect(Collectors.toList()); + authDummyInventoryInfoEO.setBussDocumentLibraryId(collect.get(0).getId()); + } + } +// //2. 验证标准号在法规清单中是否添加过 +// LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); +// lambdaQueryWrapper.in(ProjectCertificationInventoryEO::getSerialNumber,serialNumberList).in(ProjectCertificationInventoryEO::getProjectLibraryId,projectCertificationInventoryEOTemp.getProjectLibraryId()); +// List projectCertificationInventoryEOList = this.list(lambdaQueryWrapper); +// List serialNumberTempList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getSerialNumber).collect(Collectors.toList()); +// if(projectCertificationInventoryEOList.size() > 0){ +// if(CutEnum.CN.getValue().equals(datas.get(0).getCut())){ +// throw new JeroBootException(StringUtils.join(serialNumberTempList,",")+"已存在,不能重复添加"); +// }else{ +// throw new JeroBootException(StringUtils.join(serialNumberTempList,",")+" already exists and cannot be added again"); +// } +// } + } + @Override public Result batchAdd(JSONObject json) { try { @@ -763,21 +1115,21 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl Date: Wed, 29 Mar 2023 22:55:58 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=8B=E8=BD=BD=E5=A2=9E=E5=8A=A0=E4=B8=89?= =?UTF-8?q?=E4=B8=AA=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectCertificationInventoryEOServiceImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java index e19d7b423..42836a268 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java @@ -3837,19 +3837,19 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl list = Arrays.asList(title.split(",")); int index = 0; if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ - index = list.indexOf("*截止日期") + 1; + index = list.indexOf("生产企业名称") + 1; }else{ - index = list.indexOf("*Due Date") + 1; + index = list.indexOf("Name Of Manufacturer") + 1; } //创建临时文件夹 @@ -3869,7 +3869,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl Date: Wed, 29 Mar 2023 23:52:39 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E5=BC=80=E5=8F=91OTA=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=B7=A5=E5=85=B7-=E8=BD=A6=E8=BE=86=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/OtaBaSjSjmbclServiceImpl.java | 40 +++- .../com/jero/modules/ota/utils/CSVUtil.java | 198 ++++++++++++++++++ 2 files changed, 228 insertions(+), 10 deletions(-) create mode 100644 jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/utils/CSVUtil.java diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbclServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbclServiceImpl.java index 0edcd6d15..52a54ee7c 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbclServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjmbclServiceImpl.java @@ -1,14 +1,21 @@ package com.jero.modules.ota.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.constant.enums.CutEnum; import com.jero.common.exception.JeroBootException; -import com.jero.modules.extRepo.entity.ERFTreeData; 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.entity.OtaBaCxTxjl; +import com.jero.modules.ota.entity.OtaBaSjSjmbcl; +import com.jero.modules.ota.entity.OtaBaSjSjmbcx; +import com.jero.modules.ota.entity.VinObj; import com.jero.modules.ota.enums.OtaModuleEnum; import com.jero.modules.ota.mapper.OtaBaSjSjmbclMapper; -import com.jero.modules.ota.service.*; +import com.jero.modules.ota.service.IOtaBaCxTxjlService; +import com.jero.modules.ota.service.IOtaBaSjSjmbclService; +import com.jero.modules.ota.service.IOtaBaSjSjmbcxService; +import com.jero.modules.ota.utils.CSVUtil; import com.jero.modules.ota.utils.ComparisonUtil; import com.jero.modules.ota.utils.ImportFileUtil; import com.jero.modules.system.service.ISysDictService; @@ -18,20 +25,16 @@ import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; - -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.*; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.*; /** * @Description: 升级备案-升级目标车辆 @@ -219,6 +222,7 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl(); + Map vrow = null; + for (int i = 0; i < vinList.size(); i++) { + vrow = new LinkedHashMap(); + vrow.put("1", vinList.get(i).getVin()); + exportData.add(vrow); + } + String fileName = "VIN码.csv"; + File file = CSVUtil.createCSVFile(exportData, map, uploadPath + System.currentTimeMillis(), fileName); + String filePath = uploadPath + "/" + file.getName(); + OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "/ota", "", CutEnum.CN.getValue()); + mbcl.setCsv(ossFile.getId()); } } return mbcl; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/utils/CSVUtil.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/utils/CSVUtil.java new file mode 100644 index 000000000..423f532ad --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/utils/CSVUtil.java @@ -0,0 +1,198 @@ +package com.jero.modules.ota.utils; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.beanutils.BeanUtils; + +/** + * 文件操作 + */ +public class CSVUtil { + + /** + * 生成为CVS文件 + * + * @param exportData 源数据List + * @param map csv文件的列表头map + * @param outPutPath 文件路径 + * @param fileName 文件名称 + * @return + */ + @SuppressWarnings("rawtypes") + public static File createCSVFile(List exportData, LinkedHashMap map, + String outPutPath, String fileName) { + File csvFile = null; + BufferedWriter csvFileOutputStream = null; + try { + // 定义文件名格式并创建 + File file = new File(outPutPath); + if (!file.exists()) { + file.mkdir(); + } + csvFile = new File(outPutPath + "/" + fileName); + System.out.println("csvFile:" + csvFile); + // UTF-8使正确读取分隔符"," + csvFileOutputStream = new BufferedWriter( + new OutputStreamWriter( + new FileOutputStream(csvFile), "UTF-8"), 1024); + System.out.println("csvFileOutputStream:" + csvFileOutputStream); + // 写入文件头部 + for (Iterator propertyIterator = map.entrySet().iterator(); + propertyIterator.hasNext(); ) { + java.util.Map.Entry propertyEntry = + (java.util.Map.Entry) propertyIterator.next(); + csvFileOutputStream.write( + "" + (String) propertyEntry.getValue() != null ? + (String) propertyEntry.getValue() : "" + ""); + if (propertyIterator.hasNext()) { + csvFileOutputStream.write(","); + } + } + csvFileOutputStream.newLine(); + // 写入文件内容 + for (Iterator iterator = exportData.iterator(); iterator.hasNext(); ) { + Object row = (Object) iterator.next(); + for (Iterator propertyIterator = map.entrySet().iterator(); + propertyIterator.hasNext(); ) { + java.util.Map.Entry propertyEntry = + (java.util.Map.Entry) propertyIterator.next(); + csvFileOutputStream.write((String) BeanUtils.getProperty( + row, (String) propertyEntry.getKey())); + if (propertyIterator.hasNext()) { + csvFileOutputStream.write(","); + } + } + if (iterator.hasNext()) { + csvFileOutputStream.newLine(); + } + } + csvFileOutputStream.flush(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + csvFileOutputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return csvFile; + } + + /** + * 下载文件 + * + * @param response + * @param csvFilePath 文件路径 + * @param fileName 文件名称 + * @throws IOException + */ + public static void exportFile(HttpServletResponse response, + String csvFilePath, String fileName) + throws IOException { + response.setContentType("application/csv;charset=UTF-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + + URLEncoder.encode(fileName, "UTF-8")); + + InputStream in = null; + try { + in = new FileInputStream(csvFilePath); + int len = 0; + byte[] buffer = new byte[1024]; + response.setCharacterEncoding("UTF-8"); + OutputStream out = response.getOutputStream(); + while ((len = in.read(buffer)) > 0) { + out.write(new byte[]{(byte) 0xEF, (byte) 0xBB, (byte) 0xBF}); + out.write(buffer, 0, len); + } + } catch (FileNotFoundException e) { + System.out.println(e); + } finally { + if (in != null) { + try { + in.close(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + } + + /** + * 删除该目录filePath下的所有文件 + * + * @param filePath 文件目录路径 + */ + public static void deleteFiles(String filePath) { + File file = new File(filePath); + if (file.exists()) { + File[] files = file.listFiles(); + for (int i = 0; i < files.length; i++) { + if (files[i].isFile()) { + files[i].delete(); + } + } + } + } + + /** + * 删除单个文件 + * + * @param filePath 文件目录路径 + * @param fileName 文件名称 + */ + public static void deleteFile(String filePath, String fileName) { + File file = new File(filePath); + if (file.exists()) { + File[] files = file.listFiles(); + for (int i = 0; i < files.length; i++) { + if (files[i].isFile()) { + if (files[i].getName().equals(fileName)) { + files[i].delete(); + return; + } + } + } + } + } + + /** + * 测试数据 + * + * @param args + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + public static void main(String[] args) { + List exportData = new ArrayList(); + Map row1 = new LinkedHashMap(); + row1.put("1", "11"); + exportData.add(row1); + row1 = new LinkedHashMap(); + row1.put("1", "21"); + exportData.add(row1); + LinkedHashMap map = new LinkedHashMap(); + map.put("1", "第一列"); + + String path = "c:/export/"; + String fileName = "文件导出"; + File file = CSVUtil.createCSVFile(exportData, map, path, fileName); + String fileName2 = file.getName(); + System.out.println("文件名称:" + fileName2); + } +} From 61b1672d8483db06f618469b2a71dffa1c03f210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=B5=A9?= Date: Thu, 30 Mar 2023 00:23:00 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E5=BC=80=E5=8F=91OTA=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=B7=A5=E5=85=B7-=E8=BD=A6=E8=BE=86=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/OtaBaSjSjyxpgServiceImpl.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjyxpgServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjyxpgServiceImpl.java index d60a46d82..be7d94fc9 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjyxpgServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjyxpgServiceImpl.java @@ -14,11 +14,17 @@ 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.apache.poi.xwpf.usermodel.XWPFDocument; +import org.apache.poi.xwpf.usermodel.XWPFTable; +import org.apache.poi.xwpf.usermodel.XWPFTableCell; +import org.apache.poi.xwpf.usermodel.XWPFTableRow; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; import java.util.List; import java.util.Date; @@ -177,8 +183,24 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl tables = doc.getTables(); + String sjmdStr = tables.get(1).getRow(0).getCell(2).getText(); + if (StringUtils.isNotEmpty(sjmdStr)) { + StringBuilder sb = new StringBuilder(); + String[] strs = sjmdStr.split("、"); + for (int i = 0; i < strs.length; i++) { + if (i >= strs.length - 1) { + sb.append(sysDictService.queryDictItemByValue("uipgrade_purpose", strs[i], cut)); + } else { + sb.append(sysDictService.queryDictItemByValue("uipgrade_purpose", strs[i], cut)).append(","); + } + } + sjyxpg.setSjmd(sb.toString()); + } return sjyxpg; } @@ -186,7 +208,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl upLoadFiles, String otaId, String cut) throws Exception { File upFile = null; for (File f : upLoadFiles) { - if (f.getName().equals("车型基本信息.xlsx")) { + if (f.getName().equals("升级影响评估.docx")) { upFile = f; } } From 9fdde4fe568cbbb940fba3e4e38bb32b98a98c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=B5=A9?= Date: Thu, 30 Mar 2023 00:56:14 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E5=BC=80=E5=8F=91OTA=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=B7=A5=E5=85=B7-=E8=BD=A6=E8=BE=86=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ota/service/IOtaBaSjGnxtwhService.java | 73 ++++++------ .../impl/OtaBaSjGnxtwhServiceImpl.java | 104 ++++++++++-------- .../impl/OtaBaSjSjxtbhServiceImpl.java | 43 +++++--- 3 files changed, 127 insertions(+), 93 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjGnxtwhService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjGnxtwhService.java index f96073061..557d2f6ff 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjGnxtwhService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaBaSjGnxtwhService.java @@ -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 { - /** - * 保存 - * - * @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 ids); - /** - * 通过id查询 - * - * @param id - * @return - */ + /** + * 通过id查询 + * + * @param id + * @return + */ OtaBaSjGnxtwh queryById(String id); + String queryGnxtByKzq(String kzq); + /** - * 列表查询 - * - * @return - */ + * 列表查询 + * + * @return + */ List queryList(); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjGnxtwhServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjGnxtwhServiceImpl.java index 416da171e..50f834b56 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjGnxtwhServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjGnxtwhServiceImpl.java @@ -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 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 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 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 queryList() { return list(); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjxtbhServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjxtbhServiceImpl.java index 11f9bf2b5..4a5ed30b7 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjxtbhServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjSjxtbhServiceImpl.java @@ -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(); } ComparisonUtil cu = new ComparisonUtil(); - List reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJXTMCBH, OtaTitleEnum.SJKZQMC.getName(), oldList, newList, sysDictService); + List 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 Date: Thu, 30 Mar 2023 01:31:35 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E5=BC=80=E5=8F=91OTA=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=B7=A5=E5=85=B7-=E8=BD=A6=E8=BE=86=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/OtaBaSjListServiceImpl.java | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjListServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjListServiceImpl.java index 26ed5e1db..6bb47d691 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjListServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaSjListServiceImpl.java @@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; +import java.io.FileOutputStream; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -48,9 +49,6 @@ public class OtaBaSjListServiceImpl extends ServiceImpl Date: Thu, 30 Mar 2023 02:07:42 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E5=BC=80=E5=8F=91OTA=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=B7=A5=E5=85=B7-=E8=BD=A6=E8=BE=86=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ota/controller/OtaBaCxTxjlController.java | 283 +++++++++--------- .../modules/ota/entity/OtaBaSjGgnrfs.java | 1 + .../jero/modules/ota/enums/OtaTitleEnum.java | 32 +- .../modules/ota/utils/ComparisonUtil.java | 10 +- 4 files changed, 171 insertions(+), 155 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaCxTxjlController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaCxTxjlController.java index 0f395f100..b946675a7 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaCxTxjlController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaCxTxjlController.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import com.jero.common.api.vo.Result; import com.jero.common.system.query.QueryGenerator; import com.jero.modules.ota.entity.OtaBaCxTxjl; @@ -13,6 +14,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; import com.jero.common.system.base.controller.JeroController; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -22,164 +24,169 @@ import io.swagger.annotations.ApiOperation; import com.jero.common.aspect.annotation.AutoLog; - /** +/** * @Description: 车型备案-填写记录表 * @Author: jero-boot - * @Date: 2023-03-25 + * @Date: 2023-03-25 * @Version: V1.0 */ -@Api(tags="车型备案-填写记录表") +@Api(tags = "车型备案-填写记录表") @RestController @RequestMapping("/ota/otaBaCxTxjl") @Slf4j public class OtaBaCxTxjlController extends JeroController { - @Autowired - private IOtaBaCxTxjlService otaBaCxTxjlService; - - /** - * 分页列表查询 - * - * @param otaBaCxTxjl - * @param pageNo - * @param pageSize - * @param req - * @return - */ - @AutoLog(value = "车型备案-填写记录表-分页列表查询") - @ApiOperation(value="车型备案-填写记录表-分页列表查询", notes="车型备案-填写记录表-分页列表查询") - @GetMapping(value = "/page") - public Result queryPageList(OtaBaCxTxjl otaBaCxTxjl, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(otaBaCxTxjl, req.getParameterMap()); - queryWrapper.orderByDesc("create_time"); - Page page = new Page(pageNo, pageSize); - IPage pageList = otaBaCxTxjlService.page(page, queryWrapper); - return Result.OK(pageList); - } + @Autowired + private IOtaBaCxTxjlService otaBaCxTxjlService; /** - * 列表查询 - * - * @return - */ - @AutoLog(value = "车型备案-填写记录表-列表查询") - @ApiOperation(value="车型备案-填写记录表-列表查询", notes="车型备案-填写记录表-列表查询") - @GetMapping(value = "/list") - public Result> queryList() { + * 分页列表查询 + * + * @param otaBaCxTxjl + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "车型备案-填写记录表-分页列表查询") + @ApiOperation(value = "车型备案-填写记录表-分页列表查询", notes = "车型备案-填写记录表-分页列表查询") + @GetMapping(value = "/page") + public Result queryPageList(OtaBaCxTxjl otaBaCxTxjl, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + + Page page = new Page(pageNo, pageSize); + String otaId = req.getParameter("otaId"); + if (StringUtils.isEmpty(otaId)) { + return Result.OK(page); + } + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(otaBaCxTxjl, req.getParameterMap()); + queryWrapper.orderByDesc("create_time"); + IPage pageList = otaBaCxTxjlService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "车型备案-填写记录表-列表查询") + @ApiOperation(value = "车型备案-填写记录表-列表查询", notes = "车型备案-填写记录表-列表查询") + @GetMapping(value = "/list") + public Result> queryList() { List list = otaBaCxTxjlService.queryList(); return Result.OK(list); - } - - /** - * 添加 - * - * @param otaBaCxTxjl - * @return - */ - @AutoLog(value = "车型备案-填写记录表-添加") - @ApiOperation(value="车型备案-填写记录表-添加", notes="车型备案-填写记录表-添加") - @PostMapping(value = "/add") - public Result add(@Validated @RequestBody OtaBaCxTxjl otaBaCxTxjl) { - otaBaCxTxjlService.add(otaBaCxTxjl); - return Result.OK("添加成功!"); - } - - /** - * 编辑 - * - * @param otaBaCxTxjl - * @return - */ - @AutoLog(value = "车型备案-填写记录表-编辑") - @ApiOperation(value="车型备案-填写记录表-编辑", notes="车型备案-填写记录表-编辑") - @PutMapping(value = "/edit") - public Result edit(@Validated @RequestBody OtaBaCxTxjl otaBaCxTxjl) { - otaBaCxTxjlService.editById(otaBaCxTxjl); - return Result.OK("编辑成功!"); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "车型备案-填写记录表-通过id删除") - @ApiOperation(value="车型备案-填写记录表-通过id删除", notes="车型备案-填写记录表-通过id删除") - @DeleteMapping(value = "/delete") - public Result delete(@RequestParam(name="id",required=true) String id) { - otaBaCxTxjlService.deleteById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "车型备案-填写记录表-批量删除") - @ApiOperation(value="车型备案-填写记录表-批量删除", notes="车型备案-填写记录表-批量删除") - @DeleteMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.otaBaCxTxjlService.deleteByIds(Arrays.asList(ids.split(","))); - return Result.OK("批量删除成功!"); - } - - /** - * 通过id查询 - * - * @param id - * @return - */ - @AutoLog(value = "车型备案-填写记录表-通过id查询") - @ApiOperation(value="车型备案-填写记录表-通过id查询", notes="车型备案-填写记录表-通过id查询") - @GetMapping(value = "/queryById") - public Result queryById(@RequestParam(name="id",required=true) String id) { - OtaBaCxTxjl otaBaCxTxjl = otaBaCxTxjlService.queryById(id); - if(otaBaCxTxjl==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(otaBaCxTxjl); - } - - /** - * 通过otaId查询 - * - * @param otaId - * @return - */ - @AutoLog(value = "车型备案-填写记录表-通过otaId查询") - @ApiOperation(value="车型备案-填写记录表-通过otaId查询", notes="车型备案-填写记录表-通过otaId查询") - @GetMapping(value = "/queryByOtaId") - public Result queryByOtaId(@RequestParam(name="otaId",required=true) String otaId) { - List otaBaCxTxjlList = otaBaCxTxjlService.queryByOtaId(otaId); - if(otaBaCxTxjlList==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(otaBaCxTxjlList); - } + } /** - * 导出excel - * - * @param request - * @param otaBaCxTxjl - */ + * 添加 + * + * @param otaBaCxTxjl + * @return + */ + @AutoLog(value = "车型备案-填写记录表-添加") + @ApiOperation(value = "车型备案-填写记录表-添加", notes = "车型备案-填写记录表-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody OtaBaCxTxjl otaBaCxTxjl) { + otaBaCxTxjlService.add(otaBaCxTxjl); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param otaBaCxTxjl + * @return + */ + @AutoLog(value = "车型备案-填写记录表-编辑") + @ApiOperation(value = "车型备案-填写记录表-编辑", notes = "车型备案-填写记录表-编辑") + @PutMapping(value = "/edit") + public Result edit(@Validated @RequestBody OtaBaCxTxjl otaBaCxTxjl) { + otaBaCxTxjlService.editById(otaBaCxTxjl); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "车型备案-填写记录表-通过id删除") + @ApiOperation(value = "车型备案-填写记录表-通过id删除", notes = "车型备案-填写记录表-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + otaBaCxTxjlService.deleteById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "车型备案-填写记录表-批量删除") + @ApiOperation(value = "车型备案-填写记录表-批量删除", notes = "车型备案-填写记录表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.otaBaCxTxjlService.deleteByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "车型备案-填写记录表-通过id查询") + @ApiOperation(value = "车型备案-填写记录表-通过id查询", notes = "车型备案-填写记录表-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + OtaBaCxTxjl otaBaCxTxjl = otaBaCxTxjlService.queryById(id); + if (otaBaCxTxjl == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(otaBaCxTxjl); + } + + /** + * 通过otaId查询 + * + * @param otaId + * @return + */ + @AutoLog(value = "车型备案-填写记录表-通过otaId查询") + @ApiOperation(value = "车型备案-填写记录表-通过otaId查询", notes = "车型备案-填写记录表-通过otaId查询") + @GetMapping(value = "/queryByOtaId") + public Result queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId) { + List otaBaCxTxjlList = otaBaCxTxjlService.queryByOtaId(otaId); + if (otaBaCxTxjlList == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(otaBaCxTxjlList); + } + + /** + * 导出excel + * + * @param request + * @param otaBaCxTxjl + */ @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, OtaBaCxTxjl otaBaCxTxjl) { return super.exportXls(request, otaBaCxTxjl, OtaBaCxTxjl.class, "车型备案-填写记录表"); } /** - * 通过excel导入数据 - * - * @param request - * @param response - * @return - */ + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, OtaBaCxTxjl.class); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaBaSjGgnrfs.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaBaSjGgnrfs.java index bf9b04d3a..33d1299d9 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaBaSjGgnrfs.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaBaSjGgnrfs.java @@ -114,6 +114,7 @@ public class OtaBaSjGgnrfs implements Serializable { /**告知用户方式(可多选)*/ @Excel(name = "告知用户方式(可多选)", width = 15) @ApiModelProperty(value = "告知用户方式(可多选)") + @Dict(dicCode = "user_notification_mode") private java.lang.String gzyhfs; /**用户告知相关文件*/ diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/enums/OtaTitleEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/enums/OtaTitleEnum.java index 5822dcd65..194b039e6 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/enums/OtaTitleEnum.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/enums/OtaTitleEnum.java @@ -154,21 +154,21 @@ public enum OtaTitleEnum { BABH("babh", "备案编号", "0"), BAPC("bapc", "备案批次", "0"), ZSL("zsl", "总数量", "0"), - SCRQKS("scrqks", "生产日期开始", "0"), - SCRQJS("scrqjs", "生产日期结束", "0"), + SCRQKS("scrqks", "生产日期开始", "3"), + SCRQJS("scrqjs", "生产日期结束", "3"), VIN_LIST("vinList", "VIN码清单", "0"), SJMD("sjmd", "升级目的", "uipgrade_purpose"), - SFBGCS("sfbgcs", "是否变更对应车型的《公告》技术参数", "0"), - JSXNBH("jsxnbh", "是否涉及性能变化", "0"), - FHGD("fhgd", "是否符合国家法律、行政法规、规章规定,以及道路机动车辆公告管理相关国家技术标准及安全技术条件等", "0"), - ZDJSXG("zdjsxg", "是否涉及汽车自动驾驶功能相关升级", "0"), - JRXXG("jrxxg", "兼容性评估相关", "0"), + SFBGCS("sfbgcs", "是否变更对应车型的《公告》技术参数", "2"), + JSXNBH("jsxnbh", "是否涉及性能变化", "2"), + FHGD("fhgd", "是否符合国家法律、行政法规、规章规定,以及道路机动车辆公告管理相关国家技术标准及安全技术条件等", "2"), + ZDJSXG("zdjsxg", "是否涉及汽车自动驾驶功能相关升级", "2"), + JRXXG("jrxxg", "兼容性评估相关", "2"), ZXSJ("zxsj", "如何执行升级", "conditions_upgrades"), AQJZ("aqjz", "升级失败或中断后,车辆采取的安全机制", "upgrade_failed"), - SFYXAQ("sfyxaq", "升级活动是否影响车辆安全", "0"), - YHQR("yhqr", "升级活动是否提供用户确认选项", "0"), + SFYXAQ("sfyxaq", "升级活动是否影响车辆安全", "2"), + YHQR("yhqr", "升级活动是否提供用户确认选项", "2"), SJBCS("sjbcs", "升级包测试", "package_test"), - AQKKX("aqkkx", "是杏已验证确认在线升级活动的安全性和可靠性", "0"), + AQKKX("aqkkx", "是否已验证确认在线升级活动的安全性和可靠性", "2"), // BGFJ("bgfj", "提供变更或扩展后的《公告》批次及证明材料", "0"), // CLFJ("clfj", "提供证明材料", "0"), XTMC("xtmc", "系统名称", "0"), @@ -193,14 +193,14 @@ public enum OtaTitleEnum { SJKY("sjky", "升级执行期问,车辆是否可用", "0"), SJBKYGN("sjbkygn", "升级执行期间不可用的车辆功能", "0"), ZDXX("zdxx", "帮助车辆用户安全执行升级的任何指导信息", "0"), - SJSFCG("sjsfcg", "告知用户升级成功或失败", "0"), - GZBG("gzbg", "告知实施的变更", "0"), - GZSCNR("gzscnr", "告知了对用户手册的全部更新内容", "0"), - GZYHFS("gzyhfs", "告知用户方式(可多选)", "0"), + SJSFCG("sjsfcg", "告知用户升级成功或失败", "2"), + GZBG("gzbg", "告知实施的变更", "2"), + GZSCNR("gzscnr", "告知了对用户手册的全部更新内容", "2"), + GZYHFS("gzyhfs", "告知用户方式(可多选)", "user_notification_mode"), // XGWJ("xgwj", "用户告知相关文件", "0"), RWMC("rwmc", "任务名称", "0"), - SJFBSJ("sjfbsj", "升级发布时间", "0"), - SJJZSJ("sjjzsj", "升级计划截止时间", "0"); + SJFBSJ("sjfbsj", "升级发布时间", "3"), + SJJZSJ("sjjzsj", "升级计划截止时间", "3"); String name; String value; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/utils/ComparisonUtil.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/utils/ComparisonUtil.java index 6c42e3acc..568052a49 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/utils/ComparisonUtil.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/utils/ComparisonUtil.java @@ -10,6 +10,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import java.lang.reflect.Field; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; @@ -20,12 +21,14 @@ import java.util.List; * @param */ public class ComparisonUtil { + private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + public ComparisonUtil() { } - public List comparisonRecord(String otaId, String newFj,String oldFjStr,OtaModuleEnum otaModuleEnum, String title, IOSSFileService ossFileService) { + public List comparisonRecord(String otaId, String newFj, String oldFjStr, OtaModuleEnum otaModuleEnum, String title, IOSSFileService ossFileService) { List reList = new ArrayList<>(); String[] newFjList = {}; if (StringUtils.isNotEmpty(newFj)) { @@ -57,6 +60,7 @@ public class ComparisonUtil { } 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); @@ -226,6 +230,10 @@ public class ComparisonUtil { res = "否"; } } + } else if ("3".equals(ote.getType())) { + if (ObjectUtils.isNotEmpty(newVal)) { + res = sdf.format(newVal); + } } else { newVal = field.get(clazz); if (ObjectUtils.isNotEmpty(newVal)) { From c1d0d8568150d4e37ffba5dd04506c27920cf264 Mon Sep 17 00:00:00 2001 From: "zyx.net" Date: Thu, 30 Mar 2023 09:14:35 +0800 Subject: [PATCH 09/11] bug 67621 --- .../otamanagement/upgradeactivity/index.vue | 21 ++++++------------- .../components/usernotification.vue | 2 +- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/jero-web/src/views/otamanagement/upgradeactivity/index.vue b/jero-web/src/views/otamanagement/upgradeactivity/index.vue index dfaff90fc..cd82f1401 100644 --- a/jero-web/src/views/otamanagement/upgradeactivity/index.vue +++ b/jero-web/src/views/otamanagement/upgradeactivity/index.vue @@ -201,7 +201,8 @@ export default { //url传参严格按照当前命名 url: { list: '/lawsTechnologyEvaluation/lawsTechnologyEvaluationEO/page', - deleteBatch: '/ota/otaBaSjList/delete' + deleteBatch: '/ota/otaBaSjList/delete', + importZipUrl: '/ota/otaBaSjList/importData',//导入 }, visible: false, @@ -435,22 +436,12 @@ export default { }, // 导出 handleExport(row) { - let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys)) - let text = '' + let text = '升级活动备案' + row.ggpc let flag - if (this.activeTab == this.$t('ImplementationDate')) { - flag = 0 - text = this.$t('ImplementationDate') - } else { - text = this.$t('vehicleInProductionDate') - flag = 1 - } let query = { - id: selectedRowKeys.join(','), - ...this.searchParmes, - flag: flag + otaId: row.id } - downloadFile(this.url.exportData, text + '.xls', query, this.Deselect) + downloadFile('/ota/otaBaSjList/exportData', text + '.zip', query, this.Deselect) }, // 结束升级 endUpgrade(record,flag){ @@ -486,7 +477,7 @@ export default { }, // 模板下载 handleModule(){ - downloadFile('params/paramsInfo/exportTemplate', this.$t('parameterTemplateExportName') + '.xlsx', {}) + downloadFile('ota/otaBaSjList/exportTemplate', '升级活动备案' + '.zip', {}) }, addModelList(record){ record.sjzt=1 diff --git a/jero-web/src/views/otamanagement/upgradeactivityrecord/components/usernotification.vue b/jero-web/src/views/otamanagement/upgradeactivityrecord/components/usernotification.vue index 79f27f620..be32f2114 100644 --- a/jero-web/src/views/otamanagement/upgradeactivityrecord/components/usernotification.vue +++ b/jero-web/src/views/otamanagement/upgradeactivityrecord/components/usernotification.vue @@ -162,7 +162,7 @@
- {{$t('allupdatestotheusermanualareinformed')}} + {{$t('userinformstherelevantfile')}}
From a3fe427a1cb1a5c13576ea6abfd5cfb04cf76a2c Mon Sep 17 00:00:00 2001 From: "zyx.net" Date: Thu, 30 Mar 2023 09:18:52 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E5=A4=87=E6=A1=88-=E6=A8=A1=E6=9D=BF=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jero-web/src/views/otamanagement/upgradeactivity/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jero-web/src/views/otamanagement/upgradeactivity/index.vue b/jero-web/src/views/otamanagement/upgradeactivity/index.vue index cd82f1401..07caabdb7 100644 --- a/jero-web/src/views/otamanagement/upgradeactivity/index.vue +++ b/jero-web/src/views/otamanagement/upgradeactivity/index.vue @@ -179,7 +179,7 @@