From dd7539c66697411b32c89e0f3eb66f12adcb174b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=B5=A9?= Date: Thu, 24 Aug 2023 09:05:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9OTA=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OtaManageHistoryController.java | 11 +- .../modules/ota/entity/OtaManageHistory.java | 15 +- .../ota/service/IOtaManageHistoryService.java | 2 +- .../impl/OtaManageApplyEOServiceImpl.java | 2549 +++++++++-------- .../impl/OtaManageHistoryServiceImpl.java | 6 +- .../enums/CertificationProgressEnum.java | 12 + 6 files changed, 1391 insertions(+), 1204 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaManageHistoryController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaManageHistoryController.java index 52c00f00a..2d7ca3eee 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaManageHistoryController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaManageHistoryController.java @@ -5,6 +5,7 @@ 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.constant.enums.CutEnum; import com.jero.common.system.query.QueryGenerator; import com.jero.modules.ota.entity.OtaManageHistory; import com.jero.modules.ota.service.IOtaManageHistoryService; @@ -48,7 +49,7 @@ public class OtaManageHistoryController extends JeroController queryPageList(OtaManageHistory otaManageHistory, + public Result queryPageList(OtaManageHistory otaManageHistory,String cut, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { @@ -56,6 +57,14 @@ public class OtaManageHistoryController extends JeroController page = new Page(pageNo, pageSize); IPage pageList = otaManageHistoryService.page(page, queryWrapper); + List records = pageList.getRecords(); + for (OtaManageHistory omh : records) { + if (CutEnum.CN.getValue().equals(cut)) { + omh.setContent(omh.getContentCn()); + } else { + omh.setContent(omh.getContentEn()); + } + } return Result.OK(pageList); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageHistory.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageHistory.java index f82a06420..7a7730941 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageHistory.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageHistory.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -66,8 +67,18 @@ public class OtaManageHistory implements Serializable { @ApiModelProperty(value = "关联applyID") private String applyId; - /**操作记录*/ - @Excel(name = "操作记录", width = 15) + /**操作记录cn*/ + @Excel(name = "操作记录cn", width = 15) + @ApiModelProperty(value = "操作记录cn") + private String contentCn; + + /**操作记录en*/ + @Excel(name = "操作记录en", width = 15) + @ApiModelProperty(value = "操作记录en") + private String contentEn; + + + @TableField(exist = false) @ApiModelProperty(value = "操作记录") private String content; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageHistoryService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageHistoryService.java index c16382cb4..2afa9fbea 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageHistoryService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageHistoryService.java @@ -21,7 +21,7 @@ public interface IOtaManageHistoryService extends IService { void add(OtaManageHistory otaManageHistory); - void add(String appId,String content); + void add(String appId,String contentCn, String contentEn); /** * 更新 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 f6fba2f10..541020de0 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 @@ -8,10 +8,7 @@ import com.jero.common.util.DateUtils; import com.jero.common.util.oConvertUtils; import com.jero.modules.cert.template.entity.CertCategoryParamsInfoEO; import com.jero.modules.dummy.enums.OrderEnum; -import com.jero.modules.ota.entity.OtaManageApplyEO; -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.entity.*; import com.jero.modules.ota.enums.OtaCarEnum; import com.jero.modules.ota.enums.OtaHomoImpactEnum; import com.jero.modules.ota.enums.OtaStatusEnum; @@ -63,46 +60,45 @@ import java.util.stream.Collectors; /** * @Description: 数据对接表 * @Author: jero-boot - * @Date: 2023-08-09 + * @Date: 2023-08-09 * @Version: V1.0 */ @Service public class OtaManageApplyEOServiceImpl extends ServiceImpl implements IOtaManageApplyEOService { - @Autowired - private ProjectTaskPlanningServiceImpl projectTaskPlanningService; - @Autowired - private SysBaseApiImpl sysBaseApi; - @Autowired - private SysDictItemServiceImpl sysDictItemServiceImpl; - @Autowired - private IProjectLibraryBaseService projectLibraryBaseService; - @Autowired - private SysUserRoleMapper sysUserRoleMapper; - @Autowired - private ISysUserService sysUserService; - @Autowired - private IOtaManageHistoryService otaManageHistoryService; - @Autowired - private IOtaManageReceiveService otaManageReceiveService; - @Autowired - private IOtaManagePermissionService otaManagePermissionService; + @Autowired + private ProjectTaskPlanningServiceImpl projectTaskPlanningService; + @Autowired + private SysBaseApiImpl sysBaseApi; + @Autowired + private SysDictItemServiceImpl sysDictItemServiceImpl; + @Autowired + private IProjectLibraryBaseService projectLibraryBaseService; + @Autowired + private SysUserRoleMapper sysUserRoleMapper; + @Autowired + private ISysUserService sysUserService; + @Autowired + private IOtaManageHistoryService otaManageHistoryService; + @Autowired + private IOtaManageReceiveService otaManageReceiveService; + @Autowired + private IOtaManagePermissionService otaManagePermissionService; + @Value(value = "${jero.path.upload}") + private String upLoadPath; - @Value(value = "${jero.path.upload}") - private String upLoadPath; + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); - private static SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); - private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); - - /** - * 保存 - * - * @param otaManageApplyEO - * @return - */ - @Override + /** + * 保存 + * + * @param otaManageApplyEO + * @return + */ + @Override public void add(OtaManageApplyEO otaManageApplyEO) { Date now = new Date(); otaManageApplyEO.setCreateTime(now); @@ -110,1242 +106,1399 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl ids) { removeByIds(ids); } - /** - * 通过适用车型查询 - * - * @param appliedVehicleProject - * @return - */ - @Override + /** + * 通过适用车型查询 + * + * @param appliedVehicleProject + * @return + */ + @Override public List getByAppliedVehicleProject(String appliedVehicleProject) { - this.getBaseMapper().getByAppliedVehicleProject(appliedVehicleProject); + this.getBaseMapper().getByAppliedVehicleProject(appliedVehicleProject); - return new ArrayList<>(); + return new ArrayList<>(); } /** - * 列表查询 - * - * @return - */ - @Override + * 列表查询 + * + * @return + */ + @Override public List queryList() { return list(); } - /** - * OTA管理列表和全车型列表-分页列表查询 - * @param otaManageApplyEO - * @return - */ - @Override - public List getOtaPage(OtaManageApplyEO otaManageApplyEO) { - List otaManageApplyEOList = this.getBaseMapper().getOtaList(otaManageApplyEO); - if(!otaManageApplyEOList.isEmpty()){ - List otaNameList = OtaCarEnum.getOtaNameList(); - List plannedBpLaunchBatchList = otaManageApplyEOList.stream() - .filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch())) - .map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList()); - if(!plannedBpLaunchBatchList.isEmpty()){ - List manageReceiveNsdpEOList = this.getBaseMapper().getReleaseDate(plannedBpLaunchBatchList); - for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) { - manageApplyEO.setVdr(manageApplyEO.getId()); - List collect = manageReceiveNsdpEOList.stream() - .filter(e -> StringUtils.isNotBlank(e.getReleaseName()) - && e.getReleaseName().equals(manageApplyEO.getPlannedBpLaunchBatch())).collect(Collectors.toList()); - if(!collect.isEmpty()){ - List releaseDateList = collect.stream().map(OtaManageReceiveNsdpEO::getReleaseDate).distinct().collect(Collectors.toList()); - List list = new ArrayList<>(); - for (String s : releaseDateList) { - list.add(Integer.parseInt(s.replaceAll("-",""))); - } - Integer max = Collections.max(list); - try { - //发布时间 - manageApplyEO.setReleaseName(sdf.format(dateFormat.parse(max.toString()))); - manageApplyEO.setReleaseNameDate(dateFormat.parse(max.toString())); - } catch (ParseException e) { - log.error(e.getMessage(), e); - } - } - //市场 - String appliedVehicleProject = manageApplyEO.getAppliedVehicleProject(); - if(StringUtils.isNotBlank(appliedVehicleProject)){ - Set marketSet = new HashSet<>(); - for (String s : appliedVehicleProject.split(",")) { - String[] split = s.split(" "); - if(split.length == 2){ - if (!otaNameList.contains(s)) { - marketSet.add(split[1]); - } - }else if(split.length == 3){ - if (!otaNameList.contains(s)) { - marketSet.add(split[2]); - } - } - } - if(!marketSet.isEmpty()){ - manageApplyEO.setMarket(StringUtils.join(marketSet, ",")); - } - } - } - } - } - if(ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeStart())){ - otaManageApplyEOList = otaManageApplyEOList.stream() - .filter(e->StringUtils.isNotBlank(e.getReleaseName()) - && (e.getReleaseNameDate().after(otaManageApplyEO.getSoftwareIssueTimeStart()) - || e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeStart()))).collect(Collectors.toList()); - } - if(ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeEnd())){ - otaManageApplyEOList = otaManageApplyEOList.stream().filter(e-> StringUtils.isNotBlank(e.getReleaseName()) - && (e.getReleaseNameDate().before(otaManageApplyEO.getSoftwareIssueTimeEnd()) - || e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeEnd()))).collect(Collectors.toList()); - } - if(!otaManageApplyEOList.isEmpty()) { - //表头排序 - heartSort(otaManageApplyEO, otaManageApplyEOList); - } - return otaManageApplyEOList; - } + /** + * OTA管理列表和全车型列表-分页列表查询 + * + * @param otaManageApplyEO + * @return + */ + @Override + public List getOtaPage(OtaManageApplyEO otaManageApplyEO) { + List otaManageApplyEOList = this.getBaseMapper().getOtaList(otaManageApplyEO); + if (!otaManageApplyEOList.isEmpty()) { + List otaNameList = OtaCarEnum.getOtaNameList(); + List plannedBpLaunchBatchList = otaManageApplyEOList.stream() + .filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch())) + .map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList()); + if (!plannedBpLaunchBatchList.isEmpty()) { + List manageReceiveNsdpEOList = this.getBaseMapper().getReleaseDate(plannedBpLaunchBatchList); + for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) { + manageApplyEO.setVdr(manageApplyEO.getId()); + List collect = manageReceiveNsdpEOList.stream() + .filter(e -> StringUtils.isNotBlank(e.getReleaseName()) + && e.getReleaseName().equals(manageApplyEO.getPlannedBpLaunchBatch())).collect(Collectors.toList()); + if (!collect.isEmpty()) { + List releaseDateList = collect.stream().map(OtaManageReceiveNsdpEO::getReleaseDate).distinct().collect(Collectors.toList()); + List list = new ArrayList<>(); + for (String s : releaseDateList) { + list.add(Integer.parseInt(s.replaceAll("-", ""))); + } + Integer max = Collections.max(list); + try { + //发布时间 + manageApplyEO.setReleaseName(sdf.format(dateFormat.parse(max.toString()))); + manageApplyEO.setReleaseNameDate(dateFormat.parse(max.toString())); + } catch (ParseException e) { + log.error(e.getMessage(), e); + } + } + //市场 + String appliedVehicleProject = manageApplyEO.getAppliedVehicleProject(); + if (StringUtils.isNotBlank(appliedVehicleProject)) { + Set marketSet = new HashSet<>(); + for (String s : appliedVehicleProject.split(",")) { + String[] split = s.split(" "); + if (split.length == 2) { + if (!otaNameList.contains(s)) { + marketSet.add(split[1]); + } + } else if (split.length == 3) { + if (!otaNameList.contains(s)) { + marketSet.add(split[2]); + } + } + } + if (!marketSet.isEmpty()) { + manageApplyEO.setMarket(StringUtils.join(marketSet, ",")); + } + } + } + } + } + if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeStart())) { + otaManageApplyEOList = otaManageApplyEOList.stream() + .filter(e -> StringUtils.isNotBlank(e.getReleaseName()) + && (e.getReleaseNameDate().after(otaManageApplyEO.getSoftwareIssueTimeStart()) + || e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeStart()))).collect(Collectors.toList()); + } + if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeEnd())) { + otaManageApplyEOList = otaManageApplyEOList.stream().filter(e -> StringUtils.isNotBlank(e.getReleaseName()) + && (e.getReleaseNameDate().before(otaManageApplyEO.getSoftwareIssueTimeEnd()) + || e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeEnd()))).collect(Collectors.toList()); + } + if (!otaManageApplyEOList.isEmpty()) { + //表头排序 + heartSort(otaManageApplyEO, otaManageApplyEOList); + } + return otaManageApplyEOList; + } - private void heartSort(OtaManageApplyEO otaManageApplyEO, List otaManageApplyEOList) { - Collator comparator = Collator.getInstance(Locale.CHINESE); - // 软件版本, - if("plannedBpLaunchBatch".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1PlannedBpLaunchBatch = StringUtils.isNotBlank(e1.getPlannedBpLaunchBatch()) ? e1.getPlannedBpLaunchBatch() : ""; - String e2PlannedBpLaunchBatch = StringUtils.isNotBlank(e2.getPlannedBpLaunchBatch()) ? e2.getPlannedBpLaunchBatch() : ""; - return comparator.compare(e1PlannedBpLaunchBatch,e2PlannedBpLaunchBatch); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1PlannedBpLaunchBatch = StringUtils.isNotBlank(e1.getPlannedBpLaunchBatch()) ? e1.getPlannedBpLaunchBatch() : ""; - String e2PlannedBpLaunchBatch = StringUtils.isNotBlank(e2.getPlannedBpLaunchBatch()) ? e2.getPlannedBpLaunchBatch() : ""; - return comparator.compare(e2PlannedBpLaunchBatch,e1PlannedBpLaunchBatch); - }); - } - } - // 市场, - if("market".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1Market = StringUtils.isNotBlank(e1.getMarket()) ? e1.getMarket() : ""; - String e2Market = StringUtils.isNotBlank(e2.getMarket()) ? e2.getMarket() : ""; - return comparator.compare(e1Market,e2Market); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1Market = StringUtils.isNotBlank(e1.getMarket()) ? e1.getMarket() : ""; - String e2Market = StringUtils.isNotBlank(e2.getMarket()) ? e2.getMarket() : ""; - return comparator.compare(e2Market,e1Market); - }); - } - } - // 适用车型, - if("appliedVehicleProject".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1AppliedVehicleProject = StringUtils.isNotBlank(e1.getAppliedVehicleProject()) ? e1.getAppliedVehicleProject() : ""; - String e2AppliedVehicleProject = StringUtils.isNotBlank(e2.getAppliedVehicleProject()) ? e2.getAppliedVehicleProject() : ""; - return comparator.compare(e1AppliedVehicleProject,e2AppliedVehicleProject); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1AppliedVehicleProject = StringUtils.isNotBlank(e1.getAppliedVehicleProject()) ? e1.getAppliedVehicleProject() : ""; - String e2AppliedVehicleProject = StringUtils.isNotBlank(e2.getAppliedVehicleProject()) ? e2.getAppliedVehicleProject() : ""; - return comparator.compare(e2AppliedVehicleProject,e1AppliedVehicleProject); - }); - } - } - // 软件发布时间, - if("releaseName".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseName()) ? e1.getReleaseName() : ""; - String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseName()) ? e2.getReleaseName() : ""; - return comparator.compare(e1ReleaseName,e2ReleaseName); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseName()) ? e1.getReleaseName() : ""; - String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseName()) ? e2.getReleaseName() : ""; - return comparator.compare(e2ReleaseName,e1ReleaseName); - }); - } - } - //VDR - if("vdr".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1Vdr = StringUtils.isNotBlank(e1.getVdr()) ? e1.getVdr() : ""; - String e2Vdr = StringUtils.isNotBlank(e2.getVdr()) ? e2.getVdr() : ""; - return comparator.compare(e1Vdr,e2Vdr); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1Vdr = StringUtils.isNotBlank(e1.getVdr()) ? e1.getVdr() : ""; - String e2Vdr = StringUtils.isNotBlank(e2.getVdr()) ? e2.getVdr() : ""; - return comparator.compare(e2Vdr,e1Vdr); - }); - } - } - //主题 - if("summary".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1Summary = StringUtils.isNotBlank(e1.getSummary()) ? e1.getSummary() : ""; - String e2Summary = StringUtils.isNotBlank(e2.getSummary()) ? e2.getSummary() : ""; - return comparator.compare(e1Summary,e2Summary); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1Summary = StringUtils.isNotBlank(e1.getSummary()) ? e1.getSummary() : ""; - String e2Summary = StringUtils.isNotBlank(e2.getSummary()) ? e2.getSummary() : ""; - return comparator.compare(e2Summary,e1Summary); - }); - } - } - //VDR状态 - if("status".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1Status = StringUtils.isNotBlank(e1.getStatus()) ? e1.getStatus() : ""; - String e2Status = StringUtils.isNotBlank(e2.getStatus()) ? e2.getStatus() : ""; - return comparator.compare(e1Status,e2Status); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1Status = StringUtils.isNotBlank(e1.getStatus()) ? e1.getStatus() : ""; - String e2Status = StringUtils.isNotBlank(e2.getStatus()) ? e2.getStatus() : ""; - return comparator.compare(e2Status,e1Status); - }); - } - } - //认证影响 - if("homologationImpact".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1HomologationImpact = StringUtils.isNotBlank(e1.getHomologationImpact()) ? e1.getHomologationImpact() : ""; - String e2HomologationImpact = StringUtils.isNotBlank(e2.getHomologationImpact()) ? e2.getHomologationImpact() : ""; - return comparator.compare(e1HomologationImpact,e2HomologationImpact); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1HomologationImpact = StringUtils.isNotBlank(e1.getHomologationImpact()) ? e1.getHomologationImpact() : ""; - String e2HomologationImpact = StringUtils.isNotBlank(e2.getHomologationImpact()) ? e2.getHomologationImpact() : ""; - return comparator.compare(e2HomologationImpact,e1HomologationImpact); - }); - } - } - //影响描述, - if("homologation".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1Homologation = StringUtils.isNotBlank(e1.getHomologation()) ? e1.getHomologation() : ""; - String e2Homologation = StringUtils.isNotBlank(e2.getHomologation()) ? e2.getHomologation() : ""; - return comparator.compare(e1Homologation,e2Homologation); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1Homologation = StringUtils.isNotBlank(e1.getHomologation()) ? e1.getHomologation() : ""; - String e2Homologation = StringUtils.isNotBlank(e2.getHomologation()) ? e2.getHomologation() : ""; - return comparator.compare(e2Homologation,e1Homologation); - }); - } - } - //影响法规-cn, - if("impactCnHomo".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1ImpactCnHomo = StringUtils.isNotBlank(e1.getImpactCnHomo()) ? e1.getImpactCnHomo() : ""; - String e2ImpactCnHomo = StringUtils.isNotBlank(e2.getImpactCnHomo()) ? e2.getImpactCnHomo() : ""; - return comparator.compare(e1ImpactCnHomo,e2ImpactCnHomo); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1ImpactCnHomo = StringUtils.isNotBlank(e1.getImpactCnHomo()) ? e1.getImpactCnHomo() : ""; - String e2ImpactCnHomo = StringUtils.isNotBlank(e2.getImpactCnHomo()) ? e2.getImpactCnHomo() : ""; - return comparator.compare(e2ImpactCnHomo,e1ImpactCnHomo); - }); - } - } - //影响法规-EU, - if("impactEuHomo".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1ImpactEuHomo = StringUtils.isNotBlank(e1.getImpactEuHomo()) ? e1.getImpactEuHomo() : ""; - String e2ImpactEuHomo = StringUtils.isNotBlank(e2.getImpactEuHomo()) ? e2.getImpactEuHomo() : ""; - return comparator.compare(e1ImpactEuHomo,e2ImpactEuHomo); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1ImpactEuHomo = StringUtils.isNotBlank(e1.getImpactEuHomo()) ? e1.getImpactEuHomo() : ""; - String e2ImpactEuHomo = StringUtils.isNotBlank(e2.getImpactEuHomo()) ? e2.getImpactEuHomo() : ""; - return comparator.compare(e2ImpactEuHomo,e1ImpactEuHomo); - }); - } - } - //责任部门 - if("masterDomain".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1MasterDomain = StringUtils.isNotBlank(e1.getMasterDomain()) ? e1.getMasterDomain() : ""; - String e2MasterDomain = StringUtils.isNotBlank(e2.getMasterDomain()) ? e2.getMasterDomain() : ""; - return comparator.compare(e1MasterDomain,e2MasterDomain); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1MasterDomain = StringUtils.isNotBlank(e1.getMasterDomain()) ? e1.getMasterDomain() : ""; - String e2MasterDomain = StringUtils.isNotBlank(e2.getMasterDomain()) ? e2.getMasterDomain() : ""; - return comparator.compare(e2MasterDomain,e1MasterDomain); - }); - } - } - //项目版本 - if("projectVersionName".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1ProjectVersionText = StringUtils.isNotBlank(e1.getProjectVersionText()) ? e1.getProjectVersionText() : ""; - String e2ProjectVersionText = StringUtils.isNotBlank(e2.getProjectVersionText()) ? e2.getProjectVersionText() : ""; - return comparator.compare(e1ProjectVersionText,e2ProjectVersionText); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1ProjectVersionText = StringUtils.isNotBlank(e1.getProjectVersionText()) ? e1.getProjectVersionText() : ""; - String e2ProjectVersionText = StringUtils.isNotBlank(e2.getProjectVersionText()) ? e2.getProjectVersionText() : ""; - return comparator.compare(e2ProjectVersionText,e1ProjectVersionText); - }); - } - } - //studio - if("studioText".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1Studio = StringUtils.isNotBlank(e1.getStudioText()) ? e1.getStudioText() : ""; - String e2Studio = StringUtils.isNotBlank(e2.getStudioText()) ? e2.getStudioText() : ""; - return comparator.compare(e1Studio,e2Studio); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1Studio = StringUtils.isNotBlank(e1.getStudioText()) ? e1.getStudioText() : ""; - String e2Studio = StringUtils.isNotBlank(e2.getStudioText()) ? e2.getStudioText() : ""; - return comparator.compare(e2Studio,e1Studio); - }); - } - } - //认证开始 - if("attestationStartTime".equals(otaManageApplyEO.getOrderByField())){ - if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { - Collections.sort(otaManageApplyEOList, (e1, e2) -> { - String e1AttestationStartTime = ObjectUtils.isNotEmpty(e1.getAttestationStartTime()) ? DateUtils.formatDate(e1.getAttestationStartTime()) : ""; - String e2AttestationStartTime = ObjectUtils.isNotEmpty(e2.getAttestationStartTime()) ? DateUtils.formatDate(e2.getAttestationStartTime()) : ""; - return comparator.compare(e1AttestationStartTime, e2AttestationStartTime); - }); - } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { - Collections.sort(otaManageApplyEOList, (e1, e2) -> { - String e1AttestationStartTime = ObjectUtils.isNotEmpty(e1.getAttestationStartTime()) ? DateUtils.formatDate(e1.getAttestationStartTime()) : ""; - String e2AttestationStartTime = ObjectUtils.isNotEmpty(e2.getAttestationStartTime()) ? DateUtils.formatDate(e2.getAttestationStartTime()) : ""; - return comparator.compare(e2AttestationStartTime, e1AttestationStartTime); - }); - } - } - //认证申报 - if("certificationSubmission".equals(otaManageApplyEO.getOrderByField())){ - if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { - Collections.sort(otaManageApplyEOList, (e1, e2) -> { - String e1CertificationSubmission = ObjectUtils.isNotEmpty(e1.getCertificationSubmission()) ? DateUtils.formatDate(e1.getCertificationSubmission()) : ""; - String e2CertificationSubmission = ObjectUtils.isNotEmpty(e2.getCertificationSubmission()) ? DateUtils.formatDate(e2.getCertificationSubmission()) : ""; - return comparator.compare(e1CertificationSubmission, e2CertificationSubmission); - }); - } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { - Collections.sort(otaManageApplyEOList, (e1, e2) -> { - String e1CertificationSubmission = ObjectUtils.isNotEmpty(e1.getCertificationSubmission()) ? DateUtils.formatDate(e1.getCertificationSubmission()) : ""; - String e2CertificationSubmission = ObjectUtils.isNotEmpty(e2.getCertificationSubmission()) ? DateUtils.formatDate(e2.getCertificationSubmission()) : ""; - return comparator.compare(e2CertificationSubmission, e1CertificationSubmission); - }); - } - } - //认证批准 - if("attestationEndTime".equals(otaManageApplyEO.getOrderByField())){ - if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { - Collections.sort(otaManageApplyEOList, (e1, e2) -> { - String e1AttestationEndTime = ObjectUtils.isNotEmpty(e1.getAttestationEndTime()) ? DateUtils.formatDate(e1.getAttestationEndTime()) : ""; - String e2AttestationEndTime = ObjectUtils.isNotEmpty(e2.getAttestationEndTime()) ? DateUtils.formatDate(e2.getAttestationEndTime()) : ""; - return comparator.compare(e1AttestationEndTime, e2AttestationEndTime); - }); - } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { - Collections.sort(otaManageApplyEOList, (e1, e2) -> { - String e1AttestationEndTime = ObjectUtils.isNotEmpty(e1.getAttestationEndTime()) ? DateUtils.formatDate(e1.getAttestationEndTime()) : ""; - String e2AttestationEndTime = ObjectUtils.isNotEmpty(e2.getAttestationEndTime()) ? DateUtils.formatDate(e2.getAttestationEndTime()) : ""; - return comparator.compare(e2AttestationEndTime, e1AttestationEndTime); - }); - } - } - //认证进度 - if("attestationSchedule".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1AttestationSchedule = StringUtils.isNotBlank(e1.getAttestationSchedule()) ? e1.getAttestationSchedule() : ""; - String e2AttestationSchedule = StringUtils.isNotBlank(e2.getAttestationSchedule()) ? e2.getAttestationSchedule() : ""; - return comparator.compare(e1AttestationSchedule,e2AttestationSchedule); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1AttestationSchedule = StringUtils.isNotBlank(e1.getAttestationSchedule()) ? e1.getAttestationSchedule() : ""; - String e2AttestationSchedule = StringUtils.isNotBlank(e2.getAttestationSchedule()) ? e2.getAttestationSchedule() : ""; - return comparator.compare(e2AttestationSchedule,e1AttestationSchedule); - }); - } - } - //匹配状态 - if("matchStatusText".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1MatchStatus = StringUtils.isNotBlank(e1.getMatchStatusText()) ? e1.getMatchStatusText() : ""; - String e2MatchStatus = StringUtils.isNotBlank(e2.getMatchStatusText()) ? e2.getMatchStatusText() : ""; - return comparator.compare(e1MatchStatus,e2MatchStatus); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1MatchStatus = StringUtils.isNotBlank(e1.getMatchStatusText()) ? e1.getMatchStatusText() : ""; - String e2MatchStatus = StringUtils.isNotBlank(e2.getMatchStatusText()) ? e2.getMatchStatusText() : ""; - return comparator.compare(e2MatchStatus,e1MatchStatus); - }); - } - } - //备注 - if("remark".equals(otaManageApplyEO.getOrderByField())){ - if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1, e2)->{ - String e1Remark = StringUtils.isNotBlank(e1.getRemark()) ? e1.getRemark() : ""; - String e2Remark = StringUtils.isNotBlank(e2.getRemark()) ? e2.getRemark() : ""; - return comparator.compare(e1Remark,e2Remark); - }); - }else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){ - Collections.sort(otaManageApplyEOList,(e1,e2)->{ - String e1Remark = StringUtils.isNotBlank(e1.getRemark()) ? e1.getRemark() : ""; - String e2Remark = StringUtils.isNotBlank(e2.getRemark()) ? e2.getRemark() : ""; - return comparator.compare(e2Remark,e1Remark); - }); - } - } - } + private void heartSort(OtaManageApplyEO otaManageApplyEO, List otaManageApplyEOList) { + Collator comparator = Collator.getInstance(Locale.CHINESE); + // 软件版本, + if ("plannedBpLaunchBatch".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1PlannedBpLaunchBatch = StringUtils.isNotBlank(e1.getPlannedBpLaunchBatch()) ? e1.getPlannedBpLaunchBatch() : ""; + String e2PlannedBpLaunchBatch = StringUtils.isNotBlank(e2.getPlannedBpLaunchBatch()) ? e2.getPlannedBpLaunchBatch() : ""; + return comparator.compare(e1PlannedBpLaunchBatch, e2PlannedBpLaunchBatch); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1PlannedBpLaunchBatch = StringUtils.isNotBlank(e1.getPlannedBpLaunchBatch()) ? e1.getPlannedBpLaunchBatch() : ""; + String e2PlannedBpLaunchBatch = StringUtils.isNotBlank(e2.getPlannedBpLaunchBatch()) ? e2.getPlannedBpLaunchBatch() : ""; + return comparator.compare(e2PlannedBpLaunchBatch, e1PlannedBpLaunchBatch); + }); + } + } + // 市场, + if ("market".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Market = StringUtils.isNotBlank(e1.getMarket()) ? e1.getMarket() : ""; + String e2Market = StringUtils.isNotBlank(e2.getMarket()) ? e2.getMarket() : ""; + return comparator.compare(e1Market, e2Market); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Market = StringUtils.isNotBlank(e1.getMarket()) ? e1.getMarket() : ""; + String e2Market = StringUtils.isNotBlank(e2.getMarket()) ? e2.getMarket() : ""; + return comparator.compare(e2Market, e1Market); + }); + } + } + // 适用车型, + if ("appliedVehicleProject".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1AppliedVehicleProject = StringUtils.isNotBlank(e1.getAppliedVehicleProject()) ? e1.getAppliedVehicleProject() : ""; + String e2AppliedVehicleProject = StringUtils.isNotBlank(e2.getAppliedVehicleProject()) ? e2.getAppliedVehicleProject() : ""; + return comparator.compare(e1AppliedVehicleProject, e2AppliedVehicleProject); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1AppliedVehicleProject = StringUtils.isNotBlank(e1.getAppliedVehicleProject()) ? e1.getAppliedVehicleProject() : ""; + String e2AppliedVehicleProject = StringUtils.isNotBlank(e2.getAppliedVehicleProject()) ? e2.getAppliedVehicleProject() : ""; + return comparator.compare(e2AppliedVehicleProject, e1AppliedVehicleProject); + }); + } + } + // 软件发布时间, + if ("releaseName".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseName()) ? e1.getReleaseName() : ""; + String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseName()) ? e2.getReleaseName() : ""; + return comparator.compare(e1ReleaseName, e2ReleaseName); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseName()) ? e1.getReleaseName() : ""; + String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseName()) ? e2.getReleaseName() : ""; + return comparator.compare(e2ReleaseName, e1ReleaseName); + }); + } + } + //VDR + if ("vdr".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Vdr = StringUtils.isNotBlank(e1.getVdr()) ? e1.getVdr() : ""; + String e2Vdr = StringUtils.isNotBlank(e2.getVdr()) ? e2.getVdr() : ""; + return comparator.compare(e1Vdr, e2Vdr); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Vdr = StringUtils.isNotBlank(e1.getVdr()) ? e1.getVdr() : ""; + String e2Vdr = StringUtils.isNotBlank(e2.getVdr()) ? e2.getVdr() : ""; + return comparator.compare(e2Vdr, e1Vdr); + }); + } + } + //主题 + if ("summary".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Summary = StringUtils.isNotBlank(e1.getSummary()) ? e1.getSummary() : ""; + String e2Summary = StringUtils.isNotBlank(e2.getSummary()) ? e2.getSummary() : ""; + return comparator.compare(e1Summary, e2Summary); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Summary = StringUtils.isNotBlank(e1.getSummary()) ? e1.getSummary() : ""; + String e2Summary = StringUtils.isNotBlank(e2.getSummary()) ? e2.getSummary() : ""; + return comparator.compare(e2Summary, e1Summary); + }); + } + } + //VDR状态 + if ("status".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Status = StringUtils.isNotBlank(e1.getStatus()) ? e1.getStatus() : ""; + String e2Status = StringUtils.isNotBlank(e2.getStatus()) ? e2.getStatus() : ""; + return comparator.compare(e1Status, e2Status); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Status = StringUtils.isNotBlank(e1.getStatus()) ? e1.getStatus() : ""; + String e2Status = StringUtils.isNotBlank(e2.getStatus()) ? e2.getStatus() : ""; + return comparator.compare(e2Status, e1Status); + }); + } + } + //认证影响 + if ("homologationImpact".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1HomologationImpact = StringUtils.isNotBlank(e1.getHomologationImpact()) ? e1.getHomologationImpact() : ""; + String e2HomologationImpact = StringUtils.isNotBlank(e2.getHomologationImpact()) ? e2.getHomologationImpact() : ""; + return comparator.compare(e1HomologationImpact, e2HomologationImpact); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1HomologationImpact = StringUtils.isNotBlank(e1.getHomologationImpact()) ? e1.getHomologationImpact() : ""; + String e2HomologationImpact = StringUtils.isNotBlank(e2.getHomologationImpact()) ? e2.getHomologationImpact() : ""; + return comparator.compare(e2HomologationImpact, e1HomologationImpact); + }); + } + } + //影响描述, + if ("homologation".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Homologation = StringUtils.isNotBlank(e1.getHomologation()) ? e1.getHomologation() : ""; + String e2Homologation = StringUtils.isNotBlank(e2.getHomologation()) ? e2.getHomologation() : ""; + return comparator.compare(e1Homologation, e2Homologation); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Homologation = StringUtils.isNotBlank(e1.getHomologation()) ? e1.getHomologation() : ""; + String e2Homologation = StringUtils.isNotBlank(e2.getHomologation()) ? e2.getHomologation() : ""; + return comparator.compare(e2Homologation, e1Homologation); + }); + } + } + //影响法规-cn, + if ("impactCnHomo".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1ImpactCnHomo = StringUtils.isNotBlank(e1.getImpactCnHomo()) ? e1.getImpactCnHomo() : ""; + String e2ImpactCnHomo = StringUtils.isNotBlank(e2.getImpactCnHomo()) ? e2.getImpactCnHomo() : ""; + return comparator.compare(e1ImpactCnHomo, e2ImpactCnHomo); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1ImpactCnHomo = StringUtils.isNotBlank(e1.getImpactCnHomo()) ? e1.getImpactCnHomo() : ""; + String e2ImpactCnHomo = StringUtils.isNotBlank(e2.getImpactCnHomo()) ? e2.getImpactCnHomo() : ""; + return comparator.compare(e2ImpactCnHomo, e1ImpactCnHomo); + }); + } + } + //影响法规-EU, + if ("impactEuHomo".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1ImpactEuHomo = StringUtils.isNotBlank(e1.getImpactEuHomo()) ? e1.getImpactEuHomo() : ""; + String e2ImpactEuHomo = StringUtils.isNotBlank(e2.getImpactEuHomo()) ? e2.getImpactEuHomo() : ""; + return comparator.compare(e1ImpactEuHomo, e2ImpactEuHomo); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1ImpactEuHomo = StringUtils.isNotBlank(e1.getImpactEuHomo()) ? e1.getImpactEuHomo() : ""; + String e2ImpactEuHomo = StringUtils.isNotBlank(e2.getImpactEuHomo()) ? e2.getImpactEuHomo() : ""; + return comparator.compare(e2ImpactEuHomo, e1ImpactEuHomo); + }); + } + } + //责任部门 + if ("masterDomain".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1MasterDomain = StringUtils.isNotBlank(e1.getMasterDomain()) ? e1.getMasterDomain() : ""; + String e2MasterDomain = StringUtils.isNotBlank(e2.getMasterDomain()) ? e2.getMasterDomain() : ""; + return comparator.compare(e1MasterDomain, e2MasterDomain); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1MasterDomain = StringUtils.isNotBlank(e1.getMasterDomain()) ? e1.getMasterDomain() : ""; + String e2MasterDomain = StringUtils.isNotBlank(e2.getMasterDomain()) ? e2.getMasterDomain() : ""; + return comparator.compare(e2MasterDomain, e1MasterDomain); + }); + } + } + //项目版本 + if ("projectVersionName".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1ProjectVersionText = StringUtils.isNotBlank(e1.getProjectVersionText()) ? e1.getProjectVersionText() : ""; + String e2ProjectVersionText = StringUtils.isNotBlank(e2.getProjectVersionText()) ? e2.getProjectVersionText() : ""; + return comparator.compare(e1ProjectVersionText, e2ProjectVersionText); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1ProjectVersionText = StringUtils.isNotBlank(e1.getProjectVersionText()) ? e1.getProjectVersionText() : ""; + String e2ProjectVersionText = StringUtils.isNotBlank(e2.getProjectVersionText()) ? e2.getProjectVersionText() : ""; + return comparator.compare(e2ProjectVersionText, e1ProjectVersionText); + }); + } + } + //studio + if ("studioText".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Studio = StringUtils.isNotBlank(e1.getStudioText()) ? e1.getStudioText() : ""; + String e2Studio = StringUtils.isNotBlank(e2.getStudioText()) ? e2.getStudioText() : ""; + return comparator.compare(e1Studio, e2Studio); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Studio = StringUtils.isNotBlank(e1.getStudioText()) ? e1.getStudioText() : ""; + String e2Studio = StringUtils.isNotBlank(e2.getStudioText()) ? e2.getStudioText() : ""; + return comparator.compare(e2Studio, e1Studio); + }); + } + } + //认证开始 + if ("attestationStartTime".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1AttestationStartTime = ObjectUtils.isNotEmpty(e1.getAttestationStartTime()) ? DateUtils.formatDate(e1.getAttestationStartTime()) : ""; + String e2AttestationStartTime = ObjectUtils.isNotEmpty(e2.getAttestationStartTime()) ? DateUtils.formatDate(e2.getAttestationStartTime()) : ""; + return comparator.compare(e1AttestationStartTime, e2AttestationStartTime); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1AttestationStartTime = ObjectUtils.isNotEmpty(e1.getAttestationStartTime()) ? DateUtils.formatDate(e1.getAttestationStartTime()) : ""; + String e2AttestationStartTime = ObjectUtils.isNotEmpty(e2.getAttestationStartTime()) ? DateUtils.formatDate(e2.getAttestationStartTime()) : ""; + return comparator.compare(e2AttestationStartTime, e1AttestationStartTime); + }); + } + } + //认证申报 + if ("certificationSubmission".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1CertificationSubmission = ObjectUtils.isNotEmpty(e1.getCertificationSubmission()) ? DateUtils.formatDate(e1.getCertificationSubmission()) : ""; + String e2CertificationSubmission = ObjectUtils.isNotEmpty(e2.getCertificationSubmission()) ? DateUtils.formatDate(e2.getCertificationSubmission()) : ""; + return comparator.compare(e1CertificationSubmission, e2CertificationSubmission); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1CertificationSubmission = ObjectUtils.isNotEmpty(e1.getCertificationSubmission()) ? DateUtils.formatDate(e1.getCertificationSubmission()) : ""; + String e2CertificationSubmission = ObjectUtils.isNotEmpty(e2.getCertificationSubmission()) ? DateUtils.formatDate(e2.getCertificationSubmission()) : ""; + return comparator.compare(e2CertificationSubmission, e1CertificationSubmission); + }); + } + } + //认证批准 + if ("attestationEndTime".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1AttestationEndTime = ObjectUtils.isNotEmpty(e1.getAttestationEndTime()) ? DateUtils.formatDate(e1.getAttestationEndTime()) : ""; + String e2AttestationEndTime = ObjectUtils.isNotEmpty(e2.getAttestationEndTime()) ? DateUtils.formatDate(e2.getAttestationEndTime()) : ""; + return comparator.compare(e1AttestationEndTime, e2AttestationEndTime); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1AttestationEndTime = ObjectUtils.isNotEmpty(e1.getAttestationEndTime()) ? DateUtils.formatDate(e1.getAttestationEndTime()) : ""; + String e2AttestationEndTime = ObjectUtils.isNotEmpty(e2.getAttestationEndTime()) ? DateUtils.formatDate(e2.getAttestationEndTime()) : ""; + return comparator.compare(e2AttestationEndTime, e1AttestationEndTime); + }); + } + } + //认证进度 + if ("attestationSchedule".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1AttestationSchedule = StringUtils.isNotBlank(e1.getAttestationSchedule()) ? e1.getAttestationSchedule() : ""; + String e2AttestationSchedule = StringUtils.isNotBlank(e2.getAttestationSchedule()) ? e2.getAttestationSchedule() : ""; + return comparator.compare(e1AttestationSchedule, e2AttestationSchedule); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1AttestationSchedule = StringUtils.isNotBlank(e1.getAttestationSchedule()) ? e1.getAttestationSchedule() : ""; + String e2AttestationSchedule = StringUtils.isNotBlank(e2.getAttestationSchedule()) ? e2.getAttestationSchedule() : ""; + return comparator.compare(e2AttestationSchedule, e1AttestationSchedule); + }); + } + } + //匹配状态 + if ("matchStatusText".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1MatchStatus = StringUtils.isNotBlank(e1.getMatchStatusText()) ? e1.getMatchStatusText() : ""; + String e2MatchStatus = StringUtils.isNotBlank(e2.getMatchStatusText()) ? e2.getMatchStatusText() : ""; + return comparator.compare(e1MatchStatus, e2MatchStatus); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1MatchStatus = StringUtils.isNotBlank(e1.getMatchStatusText()) ? e1.getMatchStatusText() : ""; + String e2MatchStatus = StringUtils.isNotBlank(e2.getMatchStatusText()) ? e2.getMatchStatusText() : ""; + return comparator.compare(e2MatchStatus, e1MatchStatus); + }); + } + } + //备注 + if ("remark".equals(otaManageApplyEO.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Remark = StringUtils.isNotBlank(e1.getRemark()) ? e1.getRemark() : ""; + String e2Remark = StringUtils.isNotBlank(e2.getRemark()) ? e2.getRemark() : ""; + return comparator.compare(e1Remark, e2Remark); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1Remark = StringUtils.isNotBlank(e1.getRemark()) ? e1.getRemark() : ""; + String e2Remark = StringUtils.isNotBlank(e2.getRemark()) ? e2.getRemark() : ""; + return comparator.compare(e2Remark, e1Remark); + }); + } + } + } - /** - * 分车型列表-分页列表查询 - * @param otaManageApplyEO - * @return - */ - @Override - public List getOtaCarPage(OtaManageApplyEO otaManageApplyEO,String cut) { - List otaManageApplyEOList = this.getBaseMapper().getOtaCarPage(otaManageApplyEO); - List list = new ArrayList<>(); - String carMarket = otaManageApplyEO.getAppliedVehicleProject(); - if(StringUtils.isNotBlank(carMarket) && !"全部".equals(carMarket) && !otaManageApplyEOList.isEmpty()){ + /** + * 分车型列表-分页列表查询 + * + * @param otaManageApplyEO + * @return + */ + @Override + public List getOtaCarPage(OtaManageApplyEO otaManageApplyEO, String cut) { + List otaManageApplyEOList = this.getBaseMapper().getOtaCarPage(otaManageApplyEO); + List list = new ArrayList<>(); + String carMarket = otaManageApplyEO.getAppliedVehicleProject(); + if (StringUtils.isNotBlank(carMarket) && !"全部".equals(carMarket) && !otaManageApplyEOList.isEmpty()) { - String[] conditionSplit = carMarket.split(" "); + String[] conditionSplit = carMarket.split(" "); - for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) { - if (StringUtils.isEmpty(manageApplyEO.getId())||manageApplyEO.getId().length() < 20) { - manageApplyEO.setId(UUID.randomUUID().toString().replace("-", "")); - } - 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; - } - } - } - } - } - } - if(!list.isEmpty()){ - List vprojectVersionList = getProjectVersionList(otaManageApplyEO.getAppliedVehicleProject()); - //项目版本id - List projectVersionList = list.stream() - .map(OtaManageApplyEO::getProjectVersion).distinct().collect(Collectors.toList()); - //studio - List projectList = projectLibraryBaseService.queryList(projectVersionList); - List studioEngineerUserIdList = projectList.stream().map(ProjectLibraryBase::getStudioEngineer).distinct().collect(Collectors.toList()); - List studioEngineerUserInfo = this.sysUserService.querySysUserListByIdList(studioEngineerUserIdList); + for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) { + if (StringUtils.isEmpty(manageApplyEO.getId()) || manageApplyEO.getId().length() < 20) { + manageApplyEO.setId(UUID.randomUUID().toString().replace("-", "")); + } + 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; + } + } + } + } + } + } + if (!list.isEmpty()) { + List vprojectVersionList = getProjectVersionList(otaManageApplyEO.getAppliedVehicleProject()); + //项目版本id + List projectVersionList = list.stream() + .map(OtaManageApplyEO::getProjectVersion).distinct().collect(Collectors.toList()); + //studio + List projectList = projectLibraryBaseService.queryList(projectVersionList); + List studioEngineerUserIdList = projectList.stream().map(ProjectLibraryBase::getStudioEngineer).distinct().collect(Collectors.toList()); + List studioEngineerUserInfo = this.sysUserService.querySysUserListByIdList(studioEngineerUserIdList); - List projectTaskPlanningList = projectTaskPlanningService.queryList(StringUtils.join(projectVersionList,",")); - boolean isDisabled = isDisabled(); - for (OtaManageApplyEO manageApplyEO : list) { - if(StringUtils.isNotBlank(manageApplyEO.getProjectVersion())){ - List taskPlanningList = projectTaskPlanningList.stream() - .filter(e -> manageApplyEO.getProjectVersion().equals(e.getProjectId())).collect(Collectors.toList()); - //设置认证开始,认证批准,认证申报 - if(!taskPlanningList.isEmpty()){ - Date attestationStartTime = taskPlanningList.get(0).getAttestationStartTime();//认证开始 - Date attestationEndTime = taskPlanningList.get(0).getAttestationEndTime();//认证批准 - Date certificationSubmission = taskPlanningList.get(0).getCertificationSubmission();//认证申报 - manageApplyEO.setAttestationStartTime(attestationStartTime); - manageApplyEO.setAttestationEndTime(attestationEndTime); - manageApplyEO.setCertificationSubmission(certificationSubmission); - } - //设置studio - for (ProjectLibraryBase pro : projectList) { - if(pro.getId().equals(manageApplyEO.getProjectVersion())){ - manageApplyEO.setStudio(pro.getStudioEngineer()); - break; - } - } - if(StringUtils.isNotEmpty(manageApplyEO.getStudio())){ - if(CollectionUtils.isNotEmpty(studioEngineerUserInfo)){ - String studioEngineerUserName = studioEngineerUserInfo.stream().filter(studioEngineerUser -> { - boolean flag = false; - if (StringUtils.equals(manageApplyEO.getStudio(), studioEngineerUser.getId())) { - flag = true; - } - return flag; - }).map(SysUser::getUsername).collect(Collectors.joining(",")); - manageApplyEO.setStudioText(studioEngineerUserName); - } - } - //项目版本 - List collect = vprojectVersionList.stream().filter(e -> e.getProjectId().equals(manageApplyEO.getProjectVersion())).distinct().collect(Collectors.toList()); - if(!collect.isEmpty()){ - manageApplyEO.setProjectVersionText(collect.get(0).getCar()+"-"+collect.get(0).getYearName()+"-"+collect.get(0).getMarket()); - } - } - manageApplyEO.setDisabled(isDisabled); - if(StringUtils.isBlank(manageApplyEO.getRemark())){ - manageApplyEO.setRemark("-"); - } - if (OtaHomoImpactEnum.YES.getValue().equals(manageApplyEO.getHomologationImpact()) - || OtaHomoImpactEnum.INTER_VALID.getValue().equals(manageApplyEO.getHomologationImpact())) { - manageApplyEO.setMatchStatus(OtaStatusEnum.NA.getKey()); - manageApplyEO.setDisabled(true); - } - if (StringUtils.isBlank(manageApplyEO.getMatchStatus())) { - manageApplyEO.setMatchStatus(OtaStatusEnum.TO_BE_MATCHED.getKey()); - if (CutEnum.CN.getValue().equals(cut)) { - manageApplyEO.setMatchStatusText(OtaStatusEnum.TO_BE_MATCHED.getNameCN()); - } else { - manageApplyEO.setMatchStatusText(OtaStatusEnum.TO_BE_MATCHED.getNameEN()); - } - } else { - OtaStatusEnum osEnum = OtaStatusEnum.getByKey(manageApplyEO.getMatchStatus()); - if (CutEnum.CN.getValue().equals(cut)) { - manageApplyEO.setMatchStatusText(osEnum.getNameCN()); - } else { - manageApplyEO.setMatchStatusText(osEnum.getNameEN()); - } - } - } - } - if(!list.isEmpty()) { - //表头排序 - heartSort(otaManageApplyEO, list); - } - return list; - } + List projectTaskPlanningList = projectTaskPlanningService.queryList(StringUtils.join(projectVersionList, ",")); + boolean isDisabled = isDisabled(); + for (OtaManageApplyEO manageApplyEO : list) { + if (StringUtils.isNotBlank(manageApplyEO.getProjectVersion())) { + List taskPlanningList = projectTaskPlanningList.stream() + .filter(e -> manageApplyEO.getProjectVersion().equals(e.getProjectId())).collect(Collectors.toList()); + //设置认证开始,认证批准,认证申报 + if (!taskPlanningList.isEmpty()) { + Date attestationStartTime = taskPlanningList.get(0).getAttestationStartTime();//认证开始 + Date attestationEndTime = taskPlanningList.get(0).getAttestationEndTime();//认证批准 + Date certificationSubmission = taskPlanningList.get(0).getCertificationSubmission();//认证申报 + manageApplyEO.setAttestationStartTime(attestationStartTime); + manageApplyEO.setAttestationEndTime(attestationEndTime); + manageApplyEO.setCertificationSubmission(certificationSubmission); + } + //设置studio + for (ProjectLibraryBase pro : projectList) { + if (pro.getId().equals(manageApplyEO.getProjectVersion())) { + manageApplyEO.setStudio(pro.getStudioEngineer()); + break; + } + } + if (StringUtils.isNotEmpty(manageApplyEO.getStudio())) { + if (CollectionUtils.isNotEmpty(studioEngineerUserInfo)) { + String studioEngineerUserName = studioEngineerUserInfo.stream().filter(studioEngineerUser -> { + boolean flag = false; + if (StringUtils.equals(manageApplyEO.getStudio(), studioEngineerUser.getId())) { + flag = true; + } + return flag; + }).map(SysUser::getUsername).collect(Collectors.joining(",")); + manageApplyEO.setStudioText(studioEngineerUserName); + } + } + //项目版本 + List collect = vprojectVersionList.stream().filter(e -> e.getProjectId().equals(manageApplyEO.getProjectVersion())).distinct().collect(Collectors.toList()); + if (!collect.isEmpty()) { + manageApplyEO.setProjectVersionText(collect.get(0).getCar() + "-" + collect.get(0).getYearName() + "-" + collect.get(0).getMarket()); + } + } + manageApplyEO.setDisabled(isDisabled); + if (StringUtils.isBlank(manageApplyEO.getRemark())) { + manageApplyEO.setRemark("-"); + } + if (OtaHomoImpactEnum.YES.getValue().equals(manageApplyEO.getHomologationImpact()) + || OtaHomoImpactEnum.INTER_VALID.getValue().equals(manageApplyEO.getHomologationImpact())) { + manageApplyEO.setMatchStatus(OtaStatusEnum.NA.getKey()); + manageApplyEO.setDisabled(true); + } + if (StringUtils.isBlank(manageApplyEO.getMatchStatus())) { + manageApplyEO.setMatchStatus(OtaStatusEnum.TO_BE_MATCHED.getKey()); + if (CutEnum.CN.getValue().equals(cut)) { + manageApplyEO.setMatchStatusText(OtaStatusEnum.TO_BE_MATCHED.getNameCN()); + } else { + manageApplyEO.setMatchStatusText(OtaStatusEnum.TO_BE_MATCHED.getNameEN()); + } + } else { + OtaStatusEnum osEnum = OtaStatusEnum.getByKey(manageApplyEO.getMatchStatus()); + if (CutEnum.CN.getValue().equals(cut)) { + manageApplyEO.setMatchStatusText(osEnum.getNameCN()); + } else { + manageApplyEO.setMatchStatusText(osEnum.getNameEN()); + } + } + } + } + if (!list.isEmpty()) { + //表头排序 + heartSort(otaManageApplyEO, list); + } + return list; + } - /** - * 下拉数据-软件版本,适用车型,市场 - * @return - */ - @Override - public Map getPullDownList() { - List otaManageApplyEOS = this.getBaseMapper().getOtaCarList(); - Map result = new HashMap<>(); - if(!otaManageApplyEOS.isEmpty()){ - //软件版本 planned_bp_launch_batch_ - List plannedBpLaunchBatchList = otaManageApplyEOS.stream() - .filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch())) - .map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList()); + /** + * 下拉数据-软件版本,适用车型,市场 + * + * @return + */ + @Override + public Map getPullDownList() { + List otaManageApplyEOS = this.getBaseMapper().getOtaCarList(); + Map result = new HashMap<>(); + if (!otaManageApplyEOS.isEmpty()) { + //软件版本 planned_bp_launch_batch_ + List plannedBpLaunchBatchList = otaManageApplyEOS.stream() + .filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch())) + .map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList()); - //适用车型 appliedVehicleProject - List appliedVehicleProjectList = otaManageApplyEOS.stream() - .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) - .map(OtaManageApplyEO::getAppliedVehicleProject).distinct().collect(Collectors.toList()); - //过滤掉特殊的适用车型 - List otaNameList = OtaCarEnum.getOtaNameList(); + //适用车型 appliedVehicleProject + List appliedVehicleProjectList = otaManageApplyEOS.stream() + .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) + .map(OtaManageApplyEO::getAppliedVehicleProject).distinct().collect(Collectors.toList()); + //过滤掉特殊的适用车型 + List otaNameList = OtaCarEnum.getOtaNameList(); - Set carSet = new HashSet<>();//适用车型 - Set marketSet = new HashSet<>();//市场 - for (String appliedVehicleProject : appliedVehicleProjectList) { - for (String s : appliedVehicleProject.split(",")) { - String[] split = s.split(" "); - if(split.length == 2){ - if (!otaNameList.contains(s)) { - carSet.add(split[0]); - marketSet.add(split[1]); - } - }else if(split.length == 3){ - if (!otaNameList.contains(s)) { - carSet.add(split[0]); - marketSet.add(split[2]); - } - } - } - } - result.put("plannedBpLaunchBatchList",plannedBpLaunchBatchList); - result.put("carSet",carSet); - result.put("marketSet",marketSet); - } - return result; - } + Set carSet = new HashSet<>();//适用车型 + Set marketSet = new HashSet<>();//市场 + for (String appliedVehicleProject : appliedVehicleProjectList) { + for (String s : appliedVehicleProject.split(",")) { + String[] split = s.split(" "); + if (split.length == 2) { + if (!otaNameList.contains(s)) { + carSet.add(split[0]); + marketSet.add(split[1]); + } + } else if (split.length == 3) { + if (!otaNameList.contains(s)) { + carSet.add(split[0]); + marketSet.add(split[2]); + } + } + } + } + result.put("plannedBpLaunchBatchList", plannedBpLaunchBatchList); + result.put("carSet", carSet); + result.put("marketSet", marketSet); + } + return result; + } - /** - * 下拉数据-全部和分车型(不含年款) - * @return - */ - @Override - public List getCarList() { - List otaManageApplyEOS = this.getBaseMapper().getOtaCarList(); - List result = new LinkedList<>(); - result.add("全部"); - if(!otaManageApplyEOS.isEmpty()){ + /** + * 下拉数据-全部和分车型(不含年款) + * + * @return + */ + @Override + public List getCarList() { + List otaManageApplyEOS = this.getBaseMapper().getOtaCarList(); + List result = new LinkedList<>(); + result.add("全部"); + if (!otaManageApplyEOS.isEmpty()) { - //适用车型 appliedVehicleProject - List appliedVehicleProjectList = otaManageApplyEOS.stream() - .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) - .map(OtaManageApplyEO::getAppliedVehicleProject).distinct().collect(Collectors.toList()); - //过滤掉特殊的适用车型 + //适用车型 appliedVehicleProject + List appliedVehicleProjectList = otaManageApplyEOS.stream() + .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) + .map(OtaManageApplyEO::getAppliedVehicleProject).distinct().collect(Collectors.toList()); + //过滤掉特殊的适用车型 // List otaNameList = OtaCarEnum.getOtaNameList(); - Set carSet = new HashSet<>();//适用车型 - Set marketSet = new HashSet<>();//市场 - for (String appliedVehicleProject : appliedVehicleProjectList) { - for (String s : appliedVehicleProject.split(",")) { - String[] split = s.split(" "); - if (split.length == 2) { - result.add(s); - } else if (split.length == 3) { - result.add(split[0]+" "+split[2]); - } - } - } - } - result = result.stream().distinct().collect(Collectors.toList()); - return result; - } + Set carSet = new HashSet<>();//适用车型 + Set marketSet = new HashSet<>();//市场 + for (String appliedVehicleProject : appliedVehicleProjectList) { + for (String s : appliedVehicleProject.split(",")) { + String[] split = s.split(" "); + if (split.length == 2) { + result.add(s); + } else if (split.length == 3) { + result.add(split[0] + " " + split[2]); + } + } + } + } + result = result.stream().distinct().collect(Collectors.toList()); + return result; + } - @Override - public List getProjectVersionList(String carMarket) { + @Override + public List getProjectVersionList(String carMarket) { - List result = new LinkedList<>(); - if(StringUtils.isNotBlank(carMarket)){ - List versionVOList = new LinkedList<>(); - //根据适用车型查询项目版本 - String[] conditionSplit = carMarket.split(" "); - String car = conditionSplit[0]; - String market = ""; - if(conditionSplit.length > 1){ - market = conditionSplit[1]; - } - if (StringUtils.isNotBlank(market)) { - if (market.equals("CN")) { - //项目库里市场存的是China 不是CN - market = "China"; - } else if (market.equals("RHD")) { - //RHD目前代表UK - market = "UK"; - } - } - versionVOList = this.getBaseMapper().getProjectVersion(car, market); - List oneList = versionVOList.stream().filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList()); - List twoList = versionVOList.stream().filter(e -> StringUtils.isNotBlank(e.getParentId())).collect(Collectors.toList()); + List result = new LinkedList<>(); + if (StringUtils.isNotBlank(carMarket)) { + List versionVOList = new LinkedList<>(); + //根据适用车型查询项目版本 + String[] conditionSplit = carMarket.split(" "); + String car = conditionSplit[0]; + String market = ""; + if (conditionSplit.length > 1) { + market = conditionSplit[1]; + } + if (StringUtils.isNotBlank(market)) { + if (market.equals("CN")) { + //项目库里市场存的是China 不是CN + market = "China"; + } else if (market.equals("RHD")) { + //RHD目前代表UK + market = "UK"; + } + } + versionVOList = this.getBaseMapper().getProjectVersion(car, market); + List oneList = versionVOList.stream().filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList()); + List twoList = versionVOList.stream().filter(e -> StringUtils.isNotBlank(e.getParentId())).collect(Collectors.toList()); - for (VersionVO versionVO : oneList) { - result.add(versionVO); - List collect = twoList.stream().filter(e -> versionVO.getProjectId().equals(e.getParentId())).collect(Collectors.toList()); - Collections.sort(collect, new Comparator() { - @Override - public int compare(VersionVO o1, VersionVO o2) { - return Integer.valueOf(o1.getVersionNumber()).compareTo(Integer.valueOf(o2.getVersionNumber())); - } - }); - result.addAll(collect); - } - for (VersionVO versionVO : result) { - versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getYearName() + "-" + versionVO.getMarket() + "-" +versionVO.getVersionNumber()); - } - } - return result; - } + for (VersionVO versionVO : oneList) { + result.add(versionVO); + List collect = twoList.stream().filter(e -> versionVO.getProjectId().equals(e.getParentId())).collect(Collectors.toList()); + Collections.sort(collect, new Comparator() { + @Override + public int compare(VersionVO o1, VersionVO o2) { + return Integer.valueOf(o1.getVersionNumber()).compareTo(Integer.valueOf(o2.getVersionNumber())); + } + }); + result.addAll(collect); + } + for (VersionVO versionVO : result) { + versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getYearName() + "-" + versionVO.getMarket() + "-" + versionVO.getVersionNumber()); + } + } + return result; + } - /** - * 全车型和分车型详情 - * @param vdr - * @return - */ - @Override - public List getVersionInfo(String vdr) { - //认证进度数据字典 certification_progress - List regionDictList = sysDictItemServiceImpl.selectItemsByDictCode("certification_progress"); + /** + * 全车型和分车型详情 + * + * @param vdr + * @return + */ + @Override + public List getVersionInfo(String vdr) { + //认证进度数据字典 certification_progress + List regionDictList = sysDictItemServiceImpl.selectItemsByDictCode("certification_progress"); - List versionVOList = this.getBaseMapper().getVersionInfo(vdr); - List result = new LinkedList<>(); - if(!versionVOList.isEmpty()){ - List oneList = versionVOList.stream().filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList()); - List twoList = versionVOList.stream().filter(e -> StringUtils.isNotBlank(e.getParentId())).collect(Collectors.toList()); + List versionVOList = this.getBaseMapper().getVersionInfo(vdr); + List result = new LinkedList<>(); + if (!versionVOList.isEmpty()) { + List oneList = versionVOList.stream().filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList()); + List twoList = versionVOList.stream().filter(e -> StringUtils.isNotBlank(e.getParentId())).collect(Collectors.toList()); - for (VersionVO versionVO : oneList) { - result.add(versionVO); - List collect = twoList.stream().filter(e -> versionVO.getProjectId().equals(e.getParentId())).collect(Collectors.toList()); - Collections.sort(collect, new Comparator() { - @Override - public int compare(VersionVO o1, VersionVO o2) { - return Integer.valueOf(o1.getVersionNumber()).compareTo(Integer.valueOf(o2.getVersionNumber())); - } - }); - result.addAll(collect); - } - for (VersionVO versionVO : result) { - if(StringUtils.isBlank(versionVO.getProjectVersion())){ - versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getMarket()); - }else{ - versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getYearName() + "-" + versionVO.getMarket() + "-" +versionVO.getVersionNumber()); - } - //认证进度 - if(StringUtils.isNotBlank(versionVO.getAttestationSchedule())){ - List collect = regionDictList.stream() - .filter(e -> e.getItemValue().equals(versionVO.getAttestationSchedule())).collect(Collectors.toList()); - versionVO.setAttestationScheduleText(collect.get(0).getItemText()); - } - } - } - return result; - } + for (VersionVO versionVO : oneList) { + result.add(versionVO); + List collect = twoList.stream().filter(e -> versionVO.getProjectId().equals(e.getParentId())).collect(Collectors.toList()); + Collections.sort(collect, new Comparator() { + @Override + public int compare(VersionVO o1, VersionVO o2) { + return Integer.valueOf(o1.getVersionNumber()).compareTo(Integer.valueOf(o2.getVersionNumber())); + } + }); + result.addAll(collect); + } + for (VersionVO versionVO : result) { + if (StringUtils.isBlank(versionVO.getProjectVersion())) { + versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getMarket()); + } else { + versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getYearName() + "-" + versionVO.getMarket() + "-" + versionVO.getVersionNumber()); + } + //认证进度 + if (StringUtils.isNotBlank(versionVO.getAttestationSchedule())) { + List collect = regionDictList.stream() + .filter(e -> e.getItemValue().equals(versionVO.getAttestationSchedule())).collect(Collectors.toList()); + versionVO.setAttestationScheduleText(collect.get(0).getItemText()); + } + } + } + return result; + } - /** - * 下发通知 - */ - @Override - public void issueNotice(String id) { - if (StringUtils.isNotEmpty(id)) { - //根据版本查出所有vdr - List omrList = otaManageReceiveService.getReceiveByplanned(id); - List appliedVehicleProjectList = omrList.stream() - .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) - .map(OtaManageReceive::getAppliedVehicleProject).distinct().collect(Collectors.toList()); - Map appMap = new HashMap<>(); - for (String appStr : appliedVehicleProjectList) { - if (StringUtils.isNotEmpty(appStr)) { - String[] appStrs = appStr.split(","); - for (String str : appStrs) { - String[] s = str.split(" "); - if (appStrs.length == 1) { - if (!appMap.containsKey(s[0])) { - appMap.put(s[0], null); - } - } else if (s.length == 2) { - String projectName = s[0].toUpperCase(Locale.ROOT); - Set appSet = appMap.get(projectName); - if (ObjectUtils.isEmpty(appSet)) { - appSet = new HashSet(); - } - if(s[1].equals("CN")){ - appSet.add("China"); - }else if(s[1].equals("RHD")){ - appSet.add("UK"); - }else{ - appSet.add(s[1]); - } - appMap.put(projectName, appSet); - } else if (s.length == 3) { - String projectName = s[0].toUpperCase(Locale.ROOT); - Set appSet = appMap.get(projectName); - if (ObjectUtils.isEmpty(appSet)) { - appSet = new HashSet(); - } - if(s[2].equals("CN")){ - appSet.add("China"); - }else if(s[2].equals("RHD")){ - appSet.add("UK"); - }else{ - appSet.add(s[2]); - } - appMap.put(projectName, appSet); - } - } - } - } - //查询所有NT2平台的项目 - ProjectLibraryBase plbSearch = new ProjectLibraryBase(); - plbSearch.setDigitalPlatform("NT2"); - List plbList = projectLibraryBaseService.getList(plbSearch); - //存储符合条件的项目中Studio的用户ID - Set matchStudioSet = new HashSet(); - for (ProjectLibraryBase plb : plbList) { - boolean flag = false; - if (appMap.containsKey("All")) { - matchStudioSet.add(plb.getStudioEngineer()); - continue; - } - String targetMarket = plb.getTargetMarket(); - String projectName = plb.getProjectName().toUpperCase(Locale.ROOT); - String[] targetMarkets = targetMarket.split(","); - for (String tm : targetMarkets) { - if ((appMap.containsKey("CN") && tm.equals("China")) - || (appMap.containsKey("EU") && tm.equals("EU")) - || (appMap.containsKey("RHD") && tm.equals("UK"))) { - //三个ALL的市场类型 - matchStudioSet.add(plb.getStudioEngineer()); - continue; - } - if(appMap.containsKey(projectName)){ - Set appSet = appMap.get(projectName); - if(appSet.contains(tm)){ - matchStudioSet.add(plb.getStudioEngineer()); - continue; - } - } - } - } - //TODO 给studio发消息 - List ompList = new ArrayList<>(); - for (String studioId : matchStudioSet) { - OtaManagePermission omp = new OtaManagePermission(); - omp.setApplyId(id); - omp.setUserId(studioId); - ompList.add(omp); - } - otaManagePermissionService.saveBatch(ompList); - } - } + /** + * 下发通知 + */ + @Override + public void issueNotice(String id) { + if (StringUtils.isNotEmpty(id)) { + //根据版本查出所有vdr + List omrList = otaManageReceiveService.getReceiveByplanned(id); + List appliedVehicleProjectList = omrList.stream() + .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) + .map(OtaManageReceive::getAppliedVehicleProject).distinct().collect(Collectors.toList()); + Map appMap = new HashMap<>(); + for (String appStr : appliedVehicleProjectList) { + if (StringUtils.isNotEmpty(appStr)) { + String[] appStrs = appStr.split(","); + for (String str : appStrs) { + String[] s = str.split(" "); + if (appStrs.length == 1) { + if (!appMap.containsKey(s[0])) { + appMap.put(s[0], null); + } + } else if (s.length == 2) { + String projectName = s[0].toUpperCase(Locale.ROOT); + Set appSet = appMap.get(projectName); + if (ObjectUtils.isEmpty(appSet)) { + appSet = new HashSet(); + } + if (s[1].equals("CN")) { + appSet.add("China"); + } else if (s[1].equals("RHD")) { + appSet.add("UK"); + } else { + appSet.add(s[1]); + } + appMap.put(projectName, appSet); + } else if (s.length == 3) { + String projectName = s[0].toUpperCase(Locale.ROOT); + Set appSet = appMap.get(projectName); + if (ObjectUtils.isEmpty(appSet)) { + appSet = new HashSet(); + } + if (s[2].equals("CN")) { + appSet.add("China"); + } else if (s[2].equals("RHD")) { + appSet.add("UK"); + } else { + appSet.add(s[2]); + } + appMap.put(projectName, appSet); + } + } + } + } + //查询所有NT2平台的项目 + ProjectLibraryBase plbSearch = new ProjectLibraryBase(); + plbSearch.setDigitalPlatform("NT2"); + List plbList = projectLibraryBaseService.getList(plbSearch); + //存储符合条件的项目中Studio的用户ID + Set matchStudioSet = new HashSet(); + for (ProjectLibraryBase plb : plbList) { + boolean flag = false; + if (appMap.containsKey("All")) { + matchStudioSet.add(plb.getStudioEngineer()); + continue; + } + String targetMarket = plb.getTargetMarket(); + String projectName = plb.getProjectName().toUpperCase(Locale.ROOT); + String[] targetMarkets = targetMarket.split(","); + for (String tm : targetMarkets) { + if ((appMap.containsKey("CN") && tm.equals("China")) + || (appMap.containsKey("EU") && tm.equals("EU")) + || (appMap.containsKey("RHD") && tm.equals("UK"))) { + //三个ALL的市场类型 + matchStudioSet.add(plb.getStudioEngineer()); + continue; + } + if (appMap.containsKey(projectName)) { + Set appSet = appMap.get(projectName); + if (appSet.contains(tm)) { + matchStudioSet.add(plb.getStudioEngineer()); + continue; + } + } + } + } + //TODO 给studio发消息 + List ompList = new ArrayList<>(); + for (String studioId : matchStudioSet) { + OtaManagePermission omp = new OtaManagePermission(); + omp.setApplyId(id); + omp.setUserId(studioId); + ompList.add(omp); + } + otaManagePermissionService.saveBatch(ompList); + } + } - /** - * 是否为OTA管理员并且不是STUDIO - */ - private boolean isDisabled() { - boolean isOtaManager = false; - boolean isStudio = false; + /** + * 是否为OTA管理员并且不是STUDIO + */ + private boolean isDisabled() { + return isOtaManager() && !isStudio(); + } - LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - List userRoleList = this.sysUserRoleMapper.selectList(new QueryWrapper().lambda().eq(SysUserRole::getUserId, currentUser.getId())); // 查询用户所有角色 - if (CollectionUtils.isNotEmpty(userRoleList)) { - for (SysUserRole role : userRoleList) { - if (role.getRoleId().equals(RoleEnum.OTA_MANAGER.getId())) { - isOtaManager = true; - } - if (role.getRoleId().equals(RoleEnum.STUDIO.getId())) { - isStudio = true; - } - } - } - if (isOtaManager && !isStudio) { - return true; - } - return false; - } + private boolean isOtaManager() { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List userRoleList = this.sysUserRoleMapper.selectList(new QueryWrapper().lambda().eq(SysUserRole::getUserId, currentUser.getId())); // 查询用户所有角色 + if (CollectionUtils.isNotEmpty(userRoleList)) { + for (SysUserRole role : userRoleList) { + if (role.getRoleId().equals(RoleEnum.OTA_MANAGER.getId())) { + return true; + } + } + } + return false; + } - @Override - public void temporarySave(List list, String cut) { - this.saveOrUpdateBatch(list); - } + private boolean isStudio() { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List userRoleList = this.sysUserRoleMapper.selectList(new QueryWrapper().lambda().eq(SysUserRole::getUserId, currentUser.getId())); // 查询用户所有角色 + if (CollectionUtils.isNotEmpty(userRoleList)) { + for (SysUserRole role : userRoleList) { + if (role.getRoleId().equals(RoleEnum.STUDIO.getId())) { + return true; + } + } + } + return false; + } - @Override - public List submit(List list, String cut) { - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - List msgList = new ArrayList<>(); - for (OtaManageApplyEO oma : list) { - if (StringUtils.isBlank(oma.getProjectVersion())) { - //需要先选版本 - msgList.add("VDR:" + oma.getVdr() + " 需要先选择版本!"); - } else if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey()) - || oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey()) - || oma.getMatchStatus().equals(OtaStatusEnum.NA.getKey())) { - //状态不对 - msgList.add("VDR:" + oma.getVdr() + " 状态不对!"); - } else { - oma.setMatchStatus(OtaStatusEnum.TO_BE_APPROVED.getKey()); - otaManageHistoryService.add(oma.getId(),user.getUsername() + " 提交了数据!"); - } - } - this.saveOrUpdateBatch(list); - return msgList; - } + @Override + public void temporarySave(List 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()); - @Override - public List updateVdrBatch(List list, String projectVersion, String attestationSchedule, String remark, String cut) { - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - List msgList = new ArrayList<>(); - //TODO 需要根据数据判断是否可以编辑 - for (OtaManageApplyEO oma : list) { - if (StringUtils.isNotEmpty(projectVersion)) { - oma.setProjectVersion(projectVersion); - } - if (StringUtils.isNotEmpty(attestationSchedule)) { - oma.setAttestationSchedule(attestationSchedule); - } - if (StringUtils.isNotEmpty(remark)) { - oma.setRemark(remark); - } - otaManageHistoryService.add(oma.getId(),user.getUsername() + " 编辑了数据!"); - } - this.saveOrUpdateBatch(list); - return msgList; - } + //已存在的数据 + List omaOldList = this.getBaseMapper().selectBatchIds(idList); + //历史记录 + List hisList = new ArrayList<>(); - @Override - public List applyRematch(String ids, String projectVersion, String cut) { - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - List msgList = new ArrayList<>(); - if (StringUtils.isNotEmpty(ids)) { - List idList = Arrays.asList(ids.split(",")); - List omaList = this.getListByIds(idList); - for (OtaManageApplyEO oma : omaList) { - if (oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey())) { - oma.setMatchStatus(OtaStatusEnum.TO_BE_APPROVED.getKey()); - oma.setProjectVersion(projectVersion); - otaManageHistoryService.add(oma.getId(),user.getUsername() + " 重新匹配了数据!"); - } else { - //状态不对 - msgList.add("VDR:" + oma.getVdr() + " 状态不对!"); - } - } - this.saveOrUpdateBatch(omaList); - } - return msgList; - } + 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()); + } + 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); + } + 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); + } + } + } + this.saveOrUpdateBatch(list); + otaManageHistoryService.saveBatch(hisList); + } - @Override - public List confirm(String ids, String cut) { - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - List msgList = new ArrayList<>(); - if (StringUtils.isNotEmpty(ids)) { - List idList = Arrays.asList(ids.split(",")); - List omaList = this.getListByIds(idList); - for (OtaManageApplyEO oma : omaList) { - if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) { - oma.setMatchStatus(OtaStatusEnum.LOCKED.getKey()); - } else { - //状态不对 - msgList.add("VDR:" + oma.getVdr() + " 状态不对!"); - otaManageHistoryService.add(oma.getId(),user.getUsername() + " 确认了数据!"); - } - } - this.saveOrUpdateBatch(omaList); - } - return msgList; - } + @Override + public List submit(List list, String cut) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List hisList = new ArrayList<>(); + List msgList = new ArrayList<>(); + for (OtaManageApplyEO oma : list) { + if (StringUtils.isBlank(oma.getProjectVersion())) { + //需要先选版本 + if (CutEnum.CN.getValue().equals(cut)) { + msgList.add("VDR:" + oma.getVdr() + " 需要先选择版本!"); + } else { + msgList.add("VDR:" + oma.getVdr() + " Must first select the Project Version!"); + } + } else if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey()) + || oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey()) + || oma.getMatchStatus().equals(OtaStatusEnum.NA.getKey())) { + //状态不对 + if (CutEnum.CN.getValue().equals(cut)) { + msgList.add("VDR:" + oma.getVdr() + " 状态必须为" + OtaStatusEnum.TO_BE_APPROVED.getNameCN() + "!"); + } else { + msgList.add("VDR:" + oma.getVdr() + " The state must be" + OtaStatusEnum.TO_BE_APPROVED.getNameEN() + "!"); + } + } else { + oma.setMatchStatus(OtaStatusEnum.TO_BE_APPROVED.getKey()); + OtaManageHistory his = new OtaManageHistory(); + his.setApplyId(oma.getId()); + his.setContentCn(user.getUsername() + " 提交了 VDR:" + oma.getVdr()); + his.setContentEn(user.getUsername() + " submitted VDR:" + oma.getVdr()); + hisList.add(his); + } + } + this.saveOrUpdateBatch(list); + return msgList; + } - @Override - public List reject(String ids, String rejectReason,String cut) { - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - List msgList = new ArrayList<>(); - if (StringUtils.isNotEmpty(ids)) { - List idList = Arrays.asList(ids.split(",")); - List omaList = this.getListByIds(idList); - for (OtaManageApplyEO oma : omaList) { - if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) { - oma.setMatchStatus(OtaStatusEnum.REJECTED.getKey()); - otaManageHistoryService.add(oma.getId(),user.getUsername() + " 退回了数据!退回原因:"+rejectReason); - } else { - //状态不对 - msgList.add("VDR:" + oma.getVdr() + " 状态不对!"); - } - } - this.saveOrUpdateBatch(omaList); - } - return msgList; - } + @Override + public List updateVdrBatch(List list, String projectVersion, String attestationSchedule, String remark, String cut) { + ProjectLibraryBase plb = projectLibraryBaseService.selectById(projectVersion); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + //历史记录 + List hisList = new ArrayList<>(); + List msgList = new ArrayList<>(); + for (OtaManageApplyEO oma : list) { + StringBuilder conOtaCn = new StringBuilder(); + StringBuilder conOtaEn = new StringBuilder(); + conOtaCn.append(user.getUsername() + " 批量编辑了 VDR: ").append(oma.getVdr()); + conOtaEn.append(user.getUsername() + " edited VDR: ").append(oma.getVdr()); + boolean isChanged = false; + if (isStudio() && oma.getStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey())) { + if (StringUtils.isNotEmpty(projectVersion)) { + isChanged = true; + oma.setProjectVersion(projectVersion); + conOtaCn.append(" 修改了 ").append("项目版本 ").append(" 改为 ").append(plb.getShowName()); + conOtaEn.append(" modified ").append("Project Version change to ").append(plb.getShowName()); + } + if (StringUtils.isNotEmpty(attestationSchedule)) { + isChanged = true; + oma.setAttestationSchedule(attestationSchedule); + conOtaCn.append(" 修改了 ").append("认证进度 ").append(" 改为 ").append(CertificationProgressEnum.getByValue(attestationSchedule).getName()); + conOtaEn.append(" modified ").append("Homologation Progress change to ").append(CertificationProgressEnum.getByValue(attestationSchedule).getValue()); + } + } + if (isStudio() || isOtaManager()) { + if (StringUtils.isNotEmpty(remark)) { + isChanged = true; + oma.setRemark(remark); + conOtaCn.append(" 修改了 ").append("备注 ").append(" 改为 ").append(remark); + conOtaEn.append(" modified ").append("Remark change to ").append(remark); + } + } + if (isChanged) { + OtaManageHistory his = new OtaManageHistory(); + his.setApplyId(oma.getId()); + his.setContentCn(conOtaCn.toString()); + his.setContentEn(conOtaEn.toString()); + hisList.add(his); + } + } + this.saveOrUpdateBatch(list); + otaManageHistoryService.saveBatch(hisList); + return msgList; + } - @Override - public List getVdrListByProject(String projectId, String cut) { - List receiveList = this.getBaseMapper().getListByProjectId(projectId, ""); - if (CollectionUtils.isNotEmpty(receiveList)) { - receiveList = receiveList.stream() - .collect(Collectors.collectingAndThen(Collectors - .toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getPlannedBpLaunchBatch()))), ArrayList::new)); - for (OtaManageApplyEO rec : receiveList) { - if (CutEnum.CN.getValue().equals(cut)) { - rec.setAppliedVehicleProject("全部"); - } else { - rec.setAppliedVehicleProject("All"); - } - } - } - return receiveList; - } + @Override + public List applyRematch(String ids, String projectVersion, String cut) { + ProjectLibraryBase plb = projectLibraryBaseService.selectById(projectVersion); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List hisList = new ArrayList<>(); + List msgList = new ArrayList<>(); + if (StringUtils.isNotEmpty(ids)) { + List idList = Arrays.asList(ids.split(",")); + List omaList = this.getListByIds(idList); + for (OtaManageApplyEO oma : omaList) { + if (oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey())) { + oma.setMatchStatus(OtaStatusEnum.TO_BE_APPROVED.getKey()); + oma.setProjectVersion(projectVersion); - @Override - public Map getStatisticalStatus(String projectId, String plannedBpLaunchBatch, String cut) { - List receiveList = this.getBaseMapper().getListByProjectId(projectId, plannedBpLaunchBatch); - int total = receiveList.size(); - //匹配状态 - int toBeMatched = 0;//待匹配 - int toBeApproved = 0;//待审批 - int locked = 0;//锁定 - int rejected = 0;//退回 - //认证进度 - int notStart = 0;//未开始 - int inProgress = 0;//进行中 - int testPassed = 0;//实验通过 - int testFailed = 0;//实验失败 - int notSubmitted = 0;//部件报告未提交 - int submitted = 0;//部件报告已提交 - int stored = 0;//部件报告已入库 + OtaManageHistory his = new OtaManageHistory(); + his.setApplyId(oma.getId()); + his.setContentCn(user.getUsername() + " 重新匹配了 VDR:" + oma.getVdr() + " 项目版本改为 " + plb.getShowName()); + his.setContentEn(user.getUsername() + " rematch VDR:" + oma.getVdr() + " Change Project Version to " + plb.getShowName()); + hisList.add(his); + } else { + //状态不对 + if (CutEnum.CN.getValue().equals(cut)) { + msgList.add("VDR:" + oma.getVdr() + " 状态必须为" + OtaStatusEnum.LOCKED.getNameCN() + "!"); + } else { + msgList.add("VDR:" + oma.getVdr() + " The state must be" + OtaStatusEnum.LOCKED.getNameEN() + "!"); + } + } + } + this.saveOrUpdateBatch(omaList); + otaManageHistoryService.saveBatch(hisList); + } + return msgList; + } - for (OtaManageApplyEO oma : receiveList) { - if (StringUtils.isBlank(oma.getMatchStatus()) || oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey())) { - toBeMatched++; - } else if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) { - toBeApproved++; - } else if (oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey())) { - locked++; - } else if (oma.getMatchStatus().equals(OtaStatusEnum.REJECTED.getKey())) { - rejected++; - } else { - toBeMatched++; - } - if (StringUtils.isBlank(oma.getAttestationSchedule()) || oma.getAttestationSchedule().equals(CertificationProgressEnum.NOT_START.getValue())) { - notStart++; - } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.IN_PROGRESS.getValue())) { - inProgress++; - } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.TEST_PASSED.getValue())) { - testPassed++; - } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.TEST_FAILED.getValue())) { - testFailed++; - } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue())) { - notSubmitted++; - } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue())) { - submitted++; - } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue())) { - stored++; - } else { - notStart++; - } - } + @Override + public List confirm(String ids, String cut) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List hisList = new ArrayList<>(); + List msgList = new ArrayList<>(); + if (StringUtils.isNotEmpty(ids)) { + List idList = Arrays.asList(ids.split(",")); + List omaList = this.getListByIds(idList); + for (OtaManageApplyEO oma : omaList) { + if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) { + oma.setMatchStatus(OtaStatusEnum.LOCKED.getKey()); + OtaManageHistory his = new OtaManageHistory(); + his.setApplyId(oma.getId()); + his.setContentCn(user.getUsername() + " 确认了 VDR:" + oma.getVdr()); + his.setContentEn(user.getUsername() + " confirm VDR:" + oma.getVdr()); + hisList.add(his); + } else { + //状态不对 + if (CutEnum.CN.getValue().equals(cut)) { + msgList.add("VDR:" + oma.getVdr() + " 状态必须为" + OtaStatusEnum.TO_BE_APPROVED.getNameCN() + "!"); + } else { + msgList.add("VDR:" + oma.getVdr() + " The state must be" + OtaStatusEnum.TO_BE_APPROVED.getNameEN() + "!"); + } + } + } + this.saveOrUpdateBatch(omaList); + otaManageHistoryService.saveBatch(hisList); + } + return msgList; + } - Map statisticalMap = new HashMap<>(); - statisticalMap.put("allCount", total); - List> matchStatusMapList = new ArrayList<>(); - matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.TO_BE_MATCHED.getKey(), toBeMatched)); - matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.TO_BE_APPROVED.getKey(), toBeApproved)); - matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.LOCKED.getKey(), locked)); - matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.REJECTED.getKey(), rejected)); - statisticalMap.put("matchStatusMapList", matchStatusMapList); + @Override + public List reject(String ids, String rejectReason, String cut) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List hisList = new ArrayList<>(); + List msgList = new ArrayList<>(); + if (StringUtils.isNotEmpty(ids)) { + List idList = Arrays.asList(ids.split(",")); + List omaList = this.getListByIds(idList); + for (OtaManageApplyEO oma : omaList) { + if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) { + oma.setMatchStatus(OtaStatusEnum.REJECTED.getKey()); - Map matchStatusMap = new HashMap<>(); - matchStatusMap.put(OtaStatusEnum.TO_BE_MATCHED.getKey(),toBeMatched); - matchStatusMap.put(OtaStatusEnum.TO_BE_APPROVED.getKey(),toBeApproved); - matchStatusMap.put(OtaStatusEnum.LOCKED.getKey(),locked); - matchStatusMap.put(OtaStatusEnum.REJECTED.getKey(),rejected); - statisticalMap.put("matchStatusMap", matchStatusMap); + OtaManageHistory his = new OtaManageHistory(); + his.setApplyId(oma.getId()); + his.setContentCn(user.getUsername() + " 退回了 VDR:" + oma.getVdr()+" 退回原因:" + rejectReason); + his.setContentEn(user.getUsername() + " returned VDR:"+ oma.getVdr()+ " Reason for return:" + rejectReason); + hisList.add(his); + } else { + //状态不对 + if (CutEnum.CN.getValue().equals(cut)) { + msgList.add("VDR:" + oma.getVdr() + " 状态必须为" + OtaStatusEnum.TO_BE_APPROVED.getNameCN() + "!"); + } else { + msgList.add("VDR:" + oma.getVdr() + " The state must be" + OtaStatusEnum.TO_BE_APPROVED.getNameEN() + "!"); + } + } + } + this.saveOrUpdateBatch(omaList); + otaManageHistoryService.saveBatch(hisList); + } + return msgList; + } - List> attestationScheduleMapList = new ArrayList<>(); - attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.NOT_START.getValue(), notStart)); - attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.IN_PROGRESS.getValue(), inProgress)); - attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.TEST_PASSED.getValue(), testPassed)); - attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.TEST_FAILED.getValue(), testFailed)); - attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue(), notSubmitted)); - attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue(), submitted)); - attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue(), stored)); - statisticalMap.put("attestationScheduleMapList", attestationScheduleMapList); + @Override + public List getVdrListByProject(String projectId, String cut) { + List receiveList = this.getBaseMapper().getListByProjectId(projectId, ""); + if (CollectionUtils.isNotEmpty(receiveList)) { + receiveList = receiveList.stream() + .collect(Collectors.collectingAndThen(Collectors + .toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getPlannedBpLaunchBatch()))), ArrayList::new)); + for (OtaManageApplyEO rec : receiveList) { + if (CutEnum.CN.getValue().equals(cut)) { + rec.setAppliedVehicleProject("全部"); + } else { + rec.setAppliedVehicleProject("All"); + } + } + } + return receiveList; + } - Map attestationScheduleMap = new HashMap<>(); - attestationScheduleMap.put(CertificationProgressEnum.NOT_START.getValue().replace(" ","_"),notStart); - attestationScheduleMap.put(CertificationProgressEnum.IN_PROGRESS.getValue().replace(" ","_"),inProgress); - attestationScheduleMap.put(CertificationProgressEnum.TEST_PASSED.getValue().replace(" ","_"),testPassed); - attestationScheduleMap.put(CertificationProgressEnum.TEST_FAILED.getValue().replace(" ","_"),testFailed); - attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue().replace(" ","_"),notSubmitted); - attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue().replace(" ","_"),submitted); - attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue().replace(" ","_"),stored); - statisticalMap.put("attestationScheduleMap", attestationScheduleMap); + @Override + public Map getStatisticalStatus(String projectId, String plannedBpLaunchBatch, String cut) { + List receiveList = this.getBaseMapper().getListByProjectId(projectId, plannedBpLaunchBatch); + int total = receiveList.size(); + //匹配状态 + int toBeMatched = 0;//待匹配 + int toBeApproved = 0;//待审批 + int locked = 0;//锁定 + int rejected = 0;//退回 + //认证进度 + int notStart = 0;//未开始 + int inProgress = 0;//进行中 + int testPassed = 0;//实验通过 + int testFailed = 0;//实验失败 + int notSubmitted = 0;//部件报告未提交 + int submitted = 0;//部件报告已提交 + int stored = 0;//部件报告已入库 - return statisticalMap; - } - private Map wrapStatMap(String key,String val,String keyStr,Object valObj) { - Map map = new HashMap<>(); - map.put(key,keyStr); - map.put(val,valObj); - return map; - } + for (OtaManageApplyEO oma : receiveList) { + if (StringUtils.isBlank(oma.getMatchStatus()) || oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey())) { + toBeMatched++; + } else if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) { + toBeApproved++; + } else if (oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey())) { + locked++; + } else if (oma.getMatchStatus().equals(OtaStatusEnum.REJECTED.getKey())) { + rejected++; + } else { + toBeMatched++; + } + if (StringUtils.isBlank(oma.getAttestationSchedule()) || oma.getAttestationSchedule().equals(CertificationProgressEnum.NOT_START.getValue())) { + notStart++; + } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.IN_PROGRESS.getValue())) { + inProgress++; + } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.TEST_PASSED.getValue())) { + testPassed++; + } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.TEST_FAILED.getValue())) { + testFailed++; + } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue())) { + notSubmitted++; + } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue())) { + submitted++; + } else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue())) { + stored++; + } else { + notStart++; + } + } - private List getListByIds(List idList) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().in(OtaManageApplyEO::getId, idList); - return this.list(queryWrapper); - } + Map statisticalMap = new HashMap<>(); + statisticalMap.put("allCount", total); + List> matchStatusMapList = new ArrayList<>(); + matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.TO_BE_MATCHED.getKey(), toBeMatched)); + matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.TO_BE_APPROVED.getKey(), toBeApproved)); + matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.LOCKED.getKey(), locked)); + matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.REJECTED.getKey(), rejected)); + statisticalMap.put("matchStatusMapList", matchStatusMapList); - @Override - public ModelAndView otaExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO) { - // Step.2 获取导出数据 - List pageList = getOtaPage(otaManageApplyEO); - List exportList = null; + Map matchStatusMap = new HashMap<>(); + matchStatusMap.put(OtaStatusEnum.TO_BE_MATCHED.getKey(), toBeMatched); + matchStatusMap.put(OtaStatusEnum.TO_BE_APPROVED.getKey(), toBeApproved); + matchStatusMap.put(OtaStatusEnum.LOCKED.getKey(), locked); + matchStatusMap.put(OtaStatusEnum.REJECTED.getKey(), rejected); + statisticalMap.put("matchStatusMap", matchStatusMap); - // 过滤选中数据 - String selections = request.getParameter("selections"); - if (oConvertUtils.isNotEmpty(selections)) { - List selectionList = Arrays.asList(selections.split(",")); - exportList = pageList.stream().filter(e -> selectionList.contains(e.getId())).collect(Collectors.toList()); - } else { - exportList = pageList; - } + List> attestationScheduleMapList = new ArrayList<>(); + attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.NOT_START.getValue(), notStart)); + attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.IN_PROGRESS.getValue(), inProgress)); + attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.TEST_PASSED.getValue(), testPassed)); + attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.TEST_FAILED.getValue(), testFailed)); + attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue(), notSubmitted)); + attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue(), submitted)); + attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue(), stored)); + statisticalMap.put("attestationScheduleMapList", attestationScheduleMapList); - // Step.3 AutoPoi 导出Excel - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); - if(CutEnum.CN.getValue().equals(otaManageApplyEO.getCut())){ - List dataList = new ArrayList<>(); - for (OtaManageApplyEO manageApplyEO : exportList) { - OtaExportCnVO otaExportCnVO = new OtaExportCnVO(); - BeanUtils.copyProperties(manageApplyEO, otaExportCnVO); - dataList.add(otaExportCnVO); - } - mv.addObject(NormalExcelConstants.CLASS, OtaExportCnVO.class); - mv.addObject(NormalExcelConstants.DATA_LIST, dataList); - ExportParams exportParams=new ExportParams("OTA软件版本", null, "OTA软件版本"); - mv.addObject(NormalExcelConstants.PARAMS,exportParams); - }else{ - List dataList = new ArrayList<>(); - for (OtaManageApplyEO manageApplyEO : exportList) { - OtaExportEnVO otaExportEnVO = new OtaExportEnVO(); - BeanUtils.copyProperties(manageApplyEO, otaExportEnVO); - dataList.add(otaExportEnVO); - } - mv.addObject(NormalExcelConstants.CLASS, OtaExportEnVO.class); - mv.addObject(NormalExcelConstants.DATA_LIST, dataList); - ExportParams exportParams=new ExportParams("OTA Software version", null, "OTA Software version"); - mv.addObject(NormalExcelConstants.PARAMS,exportParams); - } - return mv; - } + Map attestationScheduleMap = new HashMap<>(); + attestationScheduleMap.put(CertificationProgressEnum.NOT_START.getValue().replace(" ", "_"), notStart); + attestationScheduleMap.put(CertificationProgressEnum.IN_PROGRESS.getValue().replace(" ", "_"), inProgress); + attestationScheduleMap.put(CertificationProgressEnum.TEST_PASSED.getValue().replace(" ", "_"), testPassed); + attestationScheduleMap.put(CertificationProgressEnum.TEST_FAILED.getValue().replace(" ", "_"), testFailed); + attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue().replace(" ", "_"), notSubmitted); + attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue().replace(" ", "_"), submitted); + attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue().replace(" ", "_"), stored); + statisticalMap.put("attestationScheduleMap", attestationScheduleMap); - @Override - public ModelAndView allCarExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO) { - // Step.2 获取导出数据 - List pageList = getOtaPage(otaManageApplyEO); - List exportList = null; + return statisticalMap; + } - // 过滤选中数据 - String selections = request.getParameter("selections"); - if (oConvertUtils.isNotEmpty(selections)) { - List selectionList = Arrays.asList(selections.split(",")); - exportList = pageList.stream().filter(e -> selectionList.contains(e.getId())).collect(Collectors.toList()); - } else { - exportList = pageList; - } - // Step.3 AutoPoi 导出Excel - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + private Map wrapStatMap(String key, String val, String keyStr, Object valObj) { + Map map = new HashMap<>(); + map.put(key, keyStr); + map.put(val, valObj); + return map; + } - if(CutEnum.CN.getValue().equals(otaManageApplyEO.getCut())){ - List dataList = new ArrayList<>(); - for (OtaManageApplyEO manageApplyEO : exportList) { - AllCarExportCnVO allCarExportVO = new AllCarExportCnVO(); - BeanUtils.copyProperties(manageApplyEO, allCarExportVO); - dataList.add(allCarExportVO); - } - mv.addObject(NormalExcelConstants.CLASS, AllCarExportCnVO.class); - mv.addObject(NormalExcelConstants.DATA_LIST, dataList); - }else{ - List dataList = new ArrayList<>(); - for (OtaManageApplyEO manageApplyEO : exportList) { - AllCarExportEnVO allCarExportEnVO = new AllCarExportEnVO(); - BeanUtils.copyProperties(manageApplyEO, allCarExportEnVO); - dataList.add(allCarExportEnVO); - } - mv.addObject(NormalExcelConstants.CLASS, AllCarExportEnVO.class); - mv.addObject(NormalExcelConstants.DATA_LIST, dataList); - } + private List getListByIds(List idList) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(OtaManageApplyEO::getId, idList); + return this.list(queryWrapper); + } - ExportParams exportParams=new ExportParams(otaManageApplyEO.getExportName(), null, otaManageApplyEO.getExportName()); - mv.addObject(NormalExcelConstants.PARAMS,exportParams); - return mv; - } + @Override + public ModelAndView otaExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO) { + // Step.2 获取导出数据 + List pageList = getOtaPage(otaManageApplyEO); + List exportList = null; - @Override - public ModelAndView oneCarExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO) { - // Step.2 获取导出数据 - List pageList = getOtaCarPage(otaManageApplyEO,otaManageApplyEO.getCut()); - List exportList = null; + // 过滤选中数据 + String selections = request.getParameter("selections"); + if (oConvertUtils.isNotEmpty(selections)) { + List selectionList = Arrays.asList(selections.split(",")); + exportList = pageList.stream().filter(e -> selectionList.contains(e.getId())).collect(Collectors.toList()); + } else { + exportList = pageList; + } - // 过滤选中数据 - String selections = request.getParameter("selections"); - if (oConvertUtils.isNotEmpty(selections)) { - List selectionList = Arrays.asList(selections.split(",")); - exportList = pageList.stream().filter(e -> selectionList.contains(e.getId())).collect(Collectors.toList()); - } else { - exportList = pageList; - } + // Step.3 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + if (CutEnum.CN.getValue().equals(otaManageApplyEO.getCut())) { + List dataList = new ArrayList<>(); + for (OtaManageApplyEO manageApplyEO : exportList) { + OtaExportCnVO otaExportCnVO = new OtaExportCnVO(); + BeanUtils.copyProperties(manageApplyEO, otaExportCnVO); + dataList.add(otaExportCnVO); + } + mv.addObject(NormalExcelConstants.CLASS, OtaExportCnVO.class); + mv.addObject(NormalExcelConstants.DATA_LIST, dataList); + ExportParams exportParams = new ExportParams("OTA软件版本", null, "OTA软件版本"); + mv.addObject(NormalExcelConstants.PARAMS, exportParams); + } else { + List dataList = new ArrayList<>(); + for (OtaManageApplyEO manageApplyEO : exportList) { + OtaExportEnVO otaExportEnVO = new OtaExportEnVO(); + BeanUtils.copyProperties(manageApplyEO, otaExportEnVO); + dataList.add(otaExportEnVO); + } + mv.addObject(NormalExcelConstants.CLASS, OtaExportEnVO.class); + mv.addObject(NormalExcelConstants.DATA_LIST, dataList); + ExportParams exportParams = new ExportParams("OTA Software version", null, "OTA Software version"); + mv.addObject(NormalExcelConstants.PARAMS, exportParams); + } + return mv; + } - // Step.3 AutoPoi 导出Excel - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + @Override + public ModelAndView allCarExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO) { + // Step.2 获取导出数据 + List pageList = getOtaPage(otaManageApplyEO); + List exportList = null; - if(CutEnum.CN.getValue().equals(otaManageApplyEO.getCut())){ - List dataList = new ArrayList<>(); - for (OtaManageApplyEO manageApplyEO : exportList) { - OneCarExportCnVO oneCarExportCnVO = new OneCarExportCnVO(); - BeanUtils.copyProperties(manageApplyEO, oneCarExportCnVO); - dataList.add(oneCarExportCnVO); - } - mv.addObject(NormalExcelConstants.CLASS, OneCarExportCnVO.class); - mv.addObject(NormalExcelConstants.DATA_LIST, dataList); - }else{ - List dataList = new ArrayList<>(); - for (OtaManageApplyEO manageApplyEO : exportList) { - OneCarExportEnVO oneCarExportEnVO = new OneCarExportEnVO(); - BeanUtils.copyProperties(manageApplyEO, oneCarExportEnVO); - dataList.add(oneCarExportEnVO); - } - mv.addObject(NormalExcelConstants.CLASS, OneCarExportEnVO.class); - mv.addObject(NormalExcelConstants.DATA_LIST, dataList); - } + // 过滤选中数据 + String selections = request.getParameter("selections"); + if (oConvertUtils.isNotEmpty(selections)) { + List selectionList = Arrays.asList(selections.split(",")); + exportList = pageList.stream().filter(e -> selectionList.contains(e.getId())).collect(Collectors.toList()); + } else { + exportList = pageList; + } + // Step.3 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); - ExportParams exportParams=new ExportParams(otaManageApplyEO.getExportName(), null, otaManageApplyEO.getExportName()); - mv.addObject(NormalExcelConstants.PARAMS,exportParams); + if (CutEnum.CN.getValue().equals(otaManageApplyEO.getCut())) { + List dataList = new ArrayList<>(); + for (OtaManageApplyEO manageApplyEO : exportList) { + AllCarExportCnVO allCarExportVO = new AllCarExportCnVO(); + BeanUtils.copyProperties(manageApplyEO, allCarExportVO); + dataList.add(allCarExportVO); + } + mv.addObject(NormalExcelConstants.CLASS, AllCarExportCnVO.class); + mv.addObject(NormalExcelConstants.DATA_LIST, dataList); + } else { + List dataList = new ArrayList<>(); + for (OtaManageApplyEO manageApplyEO : exportList) { + AllCarExportEnVO allCarExportEnVO = new AllCarExportEnVO(); + BeanUtils.copyProperties(manageApplyEO, allCarExportEnVO); + dataList.add(allCarExportEnVO); + } + mv.addObject(NormalExcelConstants.CLASS, AllCarExportEnVO.class); + mv.addObject(NormalExcelConstants.DATA_LIST, dataList); + } - return mv; - } + ExportParams exportParams = new ExportParams(otaManageApplyEO.getExportName(), null, otaManageApplyEO.getExportName()); + mv.addObject(NormalExcelConstants.PARAMS, exportParams); + return mv; + } + + @Override + public ModelAndView oneCarExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO) { + // Step.2 获取导出数据 + List pageList = getOtaCarPage(otaManageApplyEO, otaManageApplyEO.getCut()); + List exportList = null; + + // 过滤选中数据 + String selections = request.getParameter("selections"); + if (oConvertUtils.isNotEmpty(selections)) { + List selectionList = Arrays.asList(selections.split(",")); + exportList = pageList.stream().filter(e -> selectionList.contains(e.getId())).collect(Collectors.toList()); + } else { + exportList = pageList; + } + + // Step.3 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + + if (CutEnum.CN.getValue().equals(otaManageApplyEO.getCut())) { + List dataList = new ArrayList<>(); + for (OtaManageApplyEO manageApplyEO : exportList) { + OneCarExportCnVO oneCarExportCnVO = new OneCarExportCnVO(); + BeanUtils.copyProperties(manageApplyEO, oneCarExportCnVO); + dataList.add(oneCarExportCnVO); + } + mv.addObject(NormalExcelConstants.CLASS, OneCarExportCnVO.class); + mv.addObject(NormalExcelConstants.DATA_LIST, dataList); + } else { + List dataList = new ArrayList<>(); + for (OtaManageApplyEO manageApplyEO : exportList) { + OneCarExportEnVO oneCarExportEnVO = new OneCarExportEnVO(); + BeanUtils.copyProperties(manageApplyEO, oneCarExportEnVO); + dataList.add(oneCarExportEnVO); + } + mv.addObject(NormalExcelConstants.CLASS, OneCarExportEnVO.class); + mv.addObject(NormalExcelConstants.DATA_LIST, dataList); + } + + ExportParams exportParams = new ExportParams(otaManageApplyEO.getExportName(), null, otaManageApplyEO.getExportName()); + mv.addObject(NormalExcelConstants.PARAMS, exportParams); + + return mv; + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageHistoryServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageHistoryServiceImpl.java index 60ddae4c7..24999fac2 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageHistoryServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageHistoryServiceImpl.java @@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class OtaManageHistoryServiceImpl extends ServiceImpl implements IOtaManageHistoryService { + /** * 保存 * @@ -32,10 +33,11 @@ public class OtaManageHistoryServiceImpl extends ServiceImpl