From 3a5c0938a0bbbafe45b0429b91c6cb3a1cd67d22 Mon Sep 17 00:00:00 2001 From: zhn <947514737@qq.com> Date: Fri, 25 Aug 2023 16:26:31 +0800 Subject: [PATCH] =?UTF-8?q?studio=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/OtaManageApplyEOServiceImpl.java | 159 +++++++++++++++++- 1 file changed, 155 insertions(+), 4 deletions(-) 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 afaf8ba55..7e4adbad4 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 @@ -13,7 +13,6 @@ import com.jero.modules.ota.entity.OtaManageApplyEO; import com.jero.modules.ota.entity.OtaManageHistory; import com.jero.modules.ota.entity.OtaManagePermission; import com.jero.modules.ota.entity.OtaManageReceive; -import com.jero.modules.ota.entity.OtaManageReceiveNsdpEO; import com.jero.modules.ota.enums.OtaCarEnum; import com.jero.modules.ota.enums.OtaHomoImpactEnum; import com.jero.modules.ota.enums.OtaStatusEnum; @@ -30,10 +29,12 @@ import com.jero.modules.ota.vo.OtaExportCnVO; import com.jero.modules.ota.vo.OtaExportEnVO; import com.jero.modules.ota.vo.VersionVO; import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.project.entity.ProjectNameInfoEO; import com.jero.modules.project.entity.ProjectTaskPlanning; import com.jero.modules.project.enums.CertificationProgressEnum; import com.jero.modules.project.enums.ComplianceFlowStatusEnum; import com.jero.modules.project.service.IProjectLibraryBaseService; +import com.jero.modules.project.service.impl.ProjectNameInfoEOServiceImpl; import com.jero.modules.project.service.impl.ProjectTaskPlanningServiceImpl; import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysUser; @@ -60,7 +61,6 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.text.Collator; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -108,6 +108,8 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getAllCarPage(OtaManageApplyEO otaManageApplyEO) { List otaManageApplyEOList = this.getBaseMapper().getOtaList(otaManageApplyEO); + //studio数据权限 + if(isStudio()) { + otaManageApplyEOList = getStudioData(otaManageApplyEO, otaManageApplyEOList); + } if (!otaManageApplyEOList.isEmpty()) { for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) { manageApplyEO.setVdr(manageApplyEO.getId()); @@ -306,6 +312,42 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getStudioData(OtaManageApplyEO otaManageApplyEO, List otaManageApplyEOList) { + List list = new ArrayList<>(); + List studioCarList = getStudioCarList(otaManageApplyEO.getPlannedBpLaunchBatch()); + for (String carMarket : studioCarList) { + String[] conditionSplit = carMarket.split(" "); + + for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) { + String appliedVehicleProject = manageApplyEO.getAppliedVehicleProject(); + if (StringUtils.isNotBlank(appliedVehicleProject)) { + String[] appliedVehicleProjectArr = appliedVehicleProject.split(","); + for (String appliedVehicleProjectTemp : appliedVehicleProjectArr) { + String[] split = appliedVehicleProjectTemp.split(" "); + if (split.length == 1) { + list.add(manageApplyEO); + break; + } else if (split.length == 2) { + if (Arrays.equals(conditionSplit, split)) { + list.add(manageApplyEO); + break; + } + } else if (split.length == 3) { + List listTemp = Arrays.asList(split); + List conditionList = Arrays.asList(conditionSplit); + if (listTemp.containsAll(conditionList)) { + list.add(manageApplyEO); + break; + } + } + } + } + } + } + otaManageApplyEOList= list; + return otaManageApplyEOList; + } + private void heartSort(OtaManageApplyEO otaManageApplyEO, List otaManageApplyEOList) { Collator comparator = Collator.getInstance(Locale.CHINESE); // 软件版本, @@ -646,8 +688,14 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getCarList(String cut, String plannedBpLaunchBatch) { + Set set = new HashSet<>(); + if(isStudio()){ + List nameInfoEOList = projectNameInfoEOService.list(); + List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + //studio在项目库所拥有的权限的项目 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ProjectLibraryBase::getStudioEngineer,currentUser.getId()); + List libraryBaseList = projectLibraryBaseService.list(wrapper); + + for (ProjectLibraryBase projectLibraryBase : libraryBaseList) { + String carId = projectLibraryBase.getProjectNameId(); + String marketId = projectLibraryBase.getTargetMarket(); + List projectNameInfoEOList = nameInfoEOList.stream().filter(e -> e.getId().equals(carId)).collect(Collectors.toList()); + String finalMarket = marketId; + List dictModelList = targetMarketList.stream().filter(e -> e.getValue().equals(finalMarket)).collect(Collectors.toList()); + if(!projectNameInfoEOList.isEmpty() && !dictModelList.isEmpty()){ + String market = dictModelList.get(0).getTextEn(); + if ("China".equals(market)) { + //项目库里市场存的是China 不是CN + market = "CN"; + } else if ("UK".equals(market)) { + //RHD目前代表UK + market = "RHD"; + } + String car = projectNameInfoEOList.get(0).getProjectName(); + if("FORCE".equals(car)){ + car = "Force"; + } + set.add(car + " " + market); + } + } + } List otaManageApplyEOS = this.getBaseMapper().getOtaCarList(plannedBpLaunchBatch); List result = new LinkedList<>(); if (CutEnum.CN.getValue().equals(cut)) { @@ -862,6 +944,75 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getStudioCarList(String plannedBpLaunchBatch) { + Set set = new HashSet<>(); + List nameInfoEOList = projectNameInfoEOService.list(); + List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + //studio在项目库所拥有的权限的项目 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ProjectLibraryBase::getStudioEngineer, currentUser.getId()); + List libraryBaseList = projectLibraryBaseService.list(wrapper); + + for (ProjectLibraryBase projectLibraryBase : libraryBaseList) { + String carId = projectLibraryBase.getProjectNameId(); + String marketId = projectLibraryBase.getTargetMarket(); + List projectNameInfoEOList = nameInfoEOList.stream().filter(e -> e.getId().equals(carId)).collect(Collectors.toList()); + String finalMarket = marketId; + List dictModelList = targetMarketList.stream().filter(e -> e.getValue().equals(finalMarket)).collect(Collectors.toList()); + if (!projectNameInfoEOList.isEmpty() && !dictModelList.isEmpty()) { + String market = dictModelList.get(0).getTextEn(); + if ("China".equals(market)) { + //项目库里市场存的是China 不是CN + market = "CN"; + } else if ("UK".equals(market)) { + //RHD目前代表UK + market = "RHD"; + } + String car = projectNameInfoEOList.get(0).getProjectName(); + if("FORCE".equals(car)){ + car = "Force"; + } + set.add(car + " " + market); + } + } + List otaManageApplyEOS = this.getBaseMapper().getOtaCarList(plannedBpLaunchBatch); + List result = new LinkedList<>(); + if (!otaManageApplyEOS.isEmpty()) { + + //适用车型 appliedVehicleProject + List appliedVehicleProjectList = otaManageApplyEOS.stream() + .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) + .map(OtaManageApplyEO::getAppliedVehicleProject).distinct().collect(Collectors.toList()); + //过滤掉特殊的适用车型 + List otaNameList = OtaCarEnum.getOtaNameList(); + + for (String appliedVehicleProject : appliedVehicleProjectList) { + for (String s : appliedVehicleProject.split(",")) { + String[] split = s.split(" "); + if (split.length == 2) { + if (!otaNameList.contains(s)) { + result.add(s); + } + } else if (split.length == 3) { + result.add(split[0] + " " + split[2]); + } + } + } + } + result = result.stream().distinct().collect(Collectors.toList()); + result.retainAll(set); return result; }