From 3840da71932d17cb553fee89043c90d348ddfd6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=B5=A9?= Date: Thu, 24 Aug 2023 17:43:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9OTA=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ota/mapper/xml/OtaManageApplyEOMapper.xml | 2 +- .../impl/OtaManageApplyEOServiceImpl.java | 161 ++++++++++-------- 2 files changed, 92 insertions(+), 71 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml index ee351c024..16bfd694e 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml @@ -61,7 +61,7 @@ omr.homologation_impact,omr.homologation, omr.impact_cn_homo,omr.impact_eu_homo, omr.master_domain,omr.applied_vehicle_project, - oma.id,oma.project_version,oma.attestation_schedule,oma.match_status,oma.remark + oma.id,oma.project_version,oma.attestation_schedule,oma.match_status,oma.remark,oma.vehicle_type from ota_manage_receive omr left join ota_manage_apply oma on oma.vdr = omr.id diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java index ca76791c1..4c98c601e 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java @@ -196,13 +196,13 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl dataList = new ArrayList<>(); //去跟manager和studio权限 - if(otaManager){ + if (otaManager) { dataList = otaManageApplyEOList; - }else{ + } else { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(OtaManagePermission::getUserId,currentUser.getId()); + wrapper.eq(OtaManagePermission::getUserId, currentUser.getId()); List managePermissionList = otaManagePermissionService.list(wrapper); - if(!managePermissionList.isEmpty()){ + if (!managePermissionList.isEmpty()) { List applyIdList = managePermissionList.stream().map(OtaManagePermission::getApplyId).distinct().collect(Collectors.toList()); List collect = otaManageApplyEOList.stream().filter(e -> applyIdList.contains(e.getPlannedBpLaunchBatch())).collect(Collectors.toList()); dataList = collect; @@ -223,21 +223,21 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl otaManageApplyEOS = dataList.stream() .filter(e -> plannedBpLaunchBatch.equals(e.getPlannedBpLaunchBatch())).collect(Collectors.toList()); - if(!otaManageApplyEOS.isEmpty()){ + if (!otaManageApplyEOS.isEmpty()) { //发布时间 manageApplyEO.setReleaseDate(otaManageApplyEOS.get(0).getReleaseDate()); List appliedVehicleProjectList = otaManageApplyEOS.stream() - .filter(e->StringUtils.isNotBlank(e.getAppliedVehicleProject())) + .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) .map(OtaManageApplyEO::getAppliedVehicleProject).collect(Collectors.toList()); List carList = new ArrayList<>(); for (String appliedVehicleProject : appliedVehicleProjectList) { carList.addAll(Arrays.asList(appliedVehicleProject.split(","))); } - if(!carList.isEmpty()){ + if (!carList.isEmpty()) { //适用车型 carList = carList.stream().distinct().collect(Collectors.toList()); - manageApplyEO.setAppliedVehicleProject(StringUtils.join(carList,",")); + manageApplyEO.setAppliedVehicleProject(StringUtils.join(carList, ",")); //市场 for (String appliedVehicleProject : carList) { Set marketSet = new HashSet<>(); @@ -280,6 +280,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl projectTaskPlanningList = projectTaskPlanningService.queryList(StringUtils.join(projectVersionList, ",")); boolean isDisabled = isDisabled(); for (OtaManageApplyEO manageApplyEO : list) { + if (StringUtils.isBlank(manageApplyEO.getVehicleType())) { + manageApplyEO.setVehicleType(otaManageApplyEO.getAppliedVehicleProject()); + manageApplyEO.setId(UUID.randomUUID().toString().replace("-", "")); + manageApplyEO.setProjectVersion(null); + manageApplyEO.setAttestationSchedule(null); + manageApplyEO.setMatchStatus(null); + manageApplyEO.setRemark(null); + } if (StringUtils.isNotBlank(manageApplyEO.getProjectVersion())) { List taskPlanningList = projectTaskPlanningList.stream() .filter(e -> manageApplyEO.getProjectVersion().equals(e.getProjectId())).collect(Collectors.toList()); @@ -1061,76 +1073,85 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl list, String cut) { LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - List idList = list.stream() - .filter(e -> StringUtils.isNotBlank(e.getId())) - .map(OtaManageApplyEO::getId).distinct().collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(list)) { + List idList = list.stream() + .filter(e -> StringUtils.isNotBlank(e.getId())) + .map(OtaManageApplyEO::getId).distinct().collect(Collectors.toList()); - //已存在的数据 - List omaOldList = this.getBaseMapper().selectBatchIds(idList); - //历史记录 - List hisList = new ArrayList<>(); + //已存在的数据 + List omaOldList = this.getBaseMapper().selectBatchIds(idList); + //历史记录 + List hisList = new ArrayList<>(); + List saveList = new ArrayList<>(); - for (OtaManageApplyEO oma : list) { - boolean flag = false; - for (OtaManageApplyEO omaOld : omaOldList) { - flag = true; - if (StringUtils.equals(oma.getProjectVersionText(), omaOld.getProjectVersionText()) - || StringUtils.equals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule()) - || StringUtils.equals(oma.getRemark(), omaOld.getRemark())) { - OtaManageHistory his = new OtaManageHistory(); - his.setApplyId(oma.getId()); - StringBuilder conSb = new StringBuilder(); - StringBuilder conSbEn = new StringBuilder(); - conSb.append(user.getUsername()).append("编辑了 VDR:").append(oma.getVdr()); - conSbEn.append(user.getUsername()).append("edited VDR:").append(oma.getVdr()); - if (StringUtils.equals(oma.getProjectVersionText(), omaOld.getProjectVersionText())) { - conSb.append(" 修改了 ").append("项目版本 由 ").append(omaOld.getProjectVersionText()).append(" 改为 ").append(oma.getProjectVersionText()); - conSbEn.append(" modified ").append("Project Version from ").append(omaOld.getProjectVersionText()).append(" to ").append(oma.getProjectVersionText()); + for (OtaManageApplyEO oma : list) { + if (oma.getId().length() < 20) { + continue; + } + saveList.add(oma); + boolean flag = false; + for (OtaManageApplyEO omaOld : omaOldList) { + flag = true; + if (StringUtils.equals(oma.getProjectVersionText(), omaOld.getProjectVersionText()) + || StringUtils.equals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule()) + || StringUtils.equals(oma.getRemark(), omaOld.getRemark())) { + OtaManageHistory his = new OtaManageHistory(); + his.setApplyId(oma.getId()); + StringBuilder conSb = new StringBuilder(); + StringBuilder conSbEn = new StringBuilder(); + conSb.append(user.getUsername()).append("编辑了 VDR:").append(oma.getVdr()); + conSbEn.append(user.getUsername()).append("edited VDR:").append(oma.getVdr()); + if (StringUtils.equals(oma.getProjectVersionText(), omaOld.getProjectVersionText())) { + conSb.append(" 修改了 ").append("项目版本 由 ").append(omaOld.getProjectVersionText()).append(" 改为 ").append(oma.getProjectVersionText()); + conSbEn.append(" modified ").append("Project Version from ").append(omaOld.getProjectVersionText()).append(" to ").append(oma.getProjectVersionText()); + } + if (StringUtils.equals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule())) { + conSb.append(" 修改了 ").append("认证进度 由 ").append(CertificationProgressEnum.getByValue(omaOld.getAttestationSchedule()).getName()).append(" 改为 ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName()); + conSbEn.append(" modified ").append("Homologation Progress from ").append(CertificationProgressEnum.getByValue(omaOld.getAttestationSchedule()).getValue()).append(" to ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getValue()); + } + if (StringUtils.equals(oma.getRemark(), omaOld.getRemark())) { + conSb.append(" 修改了 ").append("备注 由 ").append(omaOld.getRemark()).append(" 改为 ").append(oma.getRemark()); + conSbEn.append(" modified ").append("Remark from ").append(omaOld.getRemark()).append(" to ").append(oma.getRemark()); + } + his.setContentCn(conSb.toString()); + his.setContentEn(conSbEn.toString()); + hisList.add(his); } - if (StringUtils.equals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule())) { - conSb.append(" 修改了 ").append("认证进度 由 ").append(CertificationProgressEnum.getByValue(omaOld.getAttestationSchedule()).getName()).append(" 改为 ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName()); - conSbEn.append(" modified ").append("Homologation Progress from ").append(CertificationProgressEnum.getByValue(omaOld.getAttestationSchedule()).getValue()).append(" to ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getValue()); + break; + } + if (!flag) { + if (StringUtils.isNotEmpty(oma.getProjectVersionText()) + || StringUtils.isNotEmpty(oma.getAttestationSchedule()) + || StringUtils.isNotEmpty(oma.getRemark())) { + OtaManageHistory his = new OtaManageHistory(); + his.setApplyId(oma.getId()); + StringBuilder conSb = new StringBuilder(); + StringBuilder conSbEn = new StringBuilder(); + conSb.append(user.getUsername()).append("编辑了 VDR:").append(oma.getVdr()); + conSbEn.append(user.getUsername()).append("edited VDR:").append(oma.getVdr()); + if (StringUtils.isNotEmpty(oma.getProjectVersionText())) { + conSb.append(" 修改了 ").append("项目版本 由 空").append(" 改为 ").append(oma.getProjectVersionText()); + conSbEn.append(" modified ").append("Project Version from null").append(" to ").append(oma.getProjectVersionText()); + } + if (StringUtils.isNotEmpty(oma.getAttestationSchedule())) { + conSb.append(" 修改了 ").append("认证进度 由 空").append(" 改为 ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName()); + conSbEn.append(" modified ").append("Homologation Progress from null").append(" to ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getValue()); + } + if (StringUtils.isNotEmpty(oma.getRemark())) { + conSb.append(" 修改了 ").append("备注 由 空").append(" 改为 ").append(oma.getRemark()); + conSbEn.append(" modified ").append("Remark from null").append(" to ").append(oma.getRemark()); + } + his.setContentCn(conSb.toString()); + his.setContentEn(conSbEn.toString()); + hisList.add(his); } - if (StringUtils.equals(oma.getRemark(), omaOld.getRemark())) { - conSb.append(" 修改了 ").append("备注 由 ").append(omaOld.getRemark()).append(" 改为 ").append(oma.getRemark()); - conSbEn.append(" modified ").append("Remark from ").append(omaOld.getRemark()).append(" to ").append(oma.getRemark()); - } - his.setContentCn(conSb.toString()); - his.setContentEn(conSbEn.toString()); - hisList.add(his); } - break; } - if (!flag) { - if (StringUtils.isNotEmpty(oma.getProjectVersionText()) - || StringUtils.isNotEmpty(oma.getAttestationSchedule()) - || StringUtils.isNotEmpty(oma.getRemark())) { - OtaManageHistory his = new OtaManageHistory(); - his.setApplyId(oma.getId()); - StringBuilder conSb = new StringBuilder(); - StringBuilder conSbEn = new StringBuilder(); - conSb.append(user.getUsername()).append("编辑了 VDR:").append(oma.getVdr()); - conSbEn.append(user.getUsername()).append("edited VDR:").append(oma.getVdr()); - if (StringUtils.isNotEmpty(oma.getProjectVersionText())) { - conSb.append(" 修改了 ").append("项目版本 由 空").append(" 改为 ").append(oma.getProjectVersionText()); - conSbEn.append(" modified ").append("Project Version from null").append(" to ").append(oma.getProjectVersionText()); - } - if (StringUtils.isNotEmpty(oma.getAttestationSchedule())) { - conSb.append(" 修改了 ").append("认证进度 由 空").append(" 改为 ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName()); - conSbEn.append(" modified ").append("Homologation Progress from null").append(" to ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getValue()); - } - if (StringUtils.isNotEmpty(oma.getRemark())) { - conSb.append(" 修改了 ").append("备注 由 空").append(" 改为 ").append(oma.getRemark()); - conSbEn.append(" modified ").append("Remark from null").append(" to ").append(oma.getRemark()); - } - his.setContentCn(conSb.toString()); - his.setContentEn(conSbEn.toString()); - hisList.add(his); - } + if (saveList.size() > 0) { + this.saveOrUpdateBatch(list); + otaManageHistoryService.saveBatch(hisList); } } - this.saveOrUpdateBatch(list); - otaManageHistoryService.saveBatch(hisList); } @Override