OTA-表头排序

This commit is contained in:
zhn
2023-08-21 11:26:29 +08:00
parent 9ac600e7de
commit 287b00f1a5
2 changed files with 341 additions and 0 deletions
@@ -194,5 +194,13 @@ public class OtaManageApplyEO implements Serializable {
@TableField(exist = false)
private boolean disabled;
@TableField(exist = false)
@ApiModelProperty(value = "表头排序字段")
private java.lang.String orderByField;
@TableField(exist = false)
@ApiModelProperty(value = "排序")
private java.lang.String orderBy;
}
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.DateUtils;
import com.jero.common.util.PageUtil;
import com.jero.modules.dummy.enums.OrderEnum;
import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.jero.modules.ota.entity.OtaManageReceiveNsdpEO;
import com.jero.modules.ota.enums.OtaCarEnum;
@@ -35,6 +37,7 @@ import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.Collator;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -216,10 +219,340 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
&& (e.getReleaseNameDate().before(otaManageApplyEO.getSoftwareIssueTimeEnd())
|| e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeEnd()))).collect(Collectors.toList());
}
if(!otaManageApplyEOList.isEmpty()) {
//表头排序
heartSort(otaManageApplyEO, otaManageApplyEOList);
}
Page pages = PageUtil.getPages(pageNo, pageSize, otaManageApplyEOList);
return pages;
}
private void heartSort(OtaManageApplyEO otaManageApplyEO, List<OtaManageApplyEO> 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(e1MasterDomain,e2MasterDomain);
});
}
}
//studio
if("studio".equals(otaManageApplyEO.getOrderByField())){
if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){
Collections.sort(otaManageApplyEOList,(e1, e2)->{
String e1Studio = StringUtils.isNotBlank(e1.getStudio()) ? e1.getStudio() : "";
String e2Studio = StringUtils.isNotBlank(e2.getStudio()) ? e2.getStudio() : "";
return comparator.compare(e1Studio,e2Studio);
});
}else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){
Collections.sort(otaManageApplyEOList,(e1,e2)->{
String e1Studio = StringUtils.isNotBlank(e1.getStudio()) ? e1.getStudio() : "";
String e2Studio = StringUtils.isNotBlank(e2.getStudio()) ? e2.getStudio() : "";
return comparator.compare(e2Studio,e1Studio);
});
}
}
//认证开始
if("attestationStartTime".equals(otaManageApplyEO.getOrderByField())){
if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) {
Collections.sort(otaManageApplyEOList, (e1, e2) -> {
if (e1.getAttestationStartTime() != null && e2.getAttestationStartTime() != null) {
String e1AttestationStartTime = DateUtils.formatDate(e1.getAttestationStartTime());
String e2AttestationStartTime = DateUtils.formatDate(e2.getAttestationStartTime());
return comparator.compare(e1AttestationStartTime, e2AttestationStartTime);
}
return -1;
});
} else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) {
Collections.sort(otaManageApplyEOList, (e1, e2) -> {
if (e1.getAttestationStartTime() != null && e2.getAttestationStartTime() != null) {
String e1AttestationStartTime = DateUtils.formatDate(e1.getAttestationStartTime());
String e2AttestationStartTime = DateUtils.formatDate(e2.getAttestationStartTime());
return comparator.compare(e2AttestationStartTime, e1AttestationStartTime);
}
return -1;
});
}
}
//认证申报
if("certificationSubmission".equals(otaManageApplyEO.getOrderByField())){
if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) {
Collections.sort(otaManageApplyEOList, (e1, e2) -> {
if (e1.getCertificationSubmission() != null && e2.getCertificationSubmission() != null) {
String e1CertificationSubmission = DateUtils.formatDate(e1.getCertificationSubmission());
String e2CertificationSubmission = DateUtils.formatDate(e2.getCertificationSubmission());
return comparator.compare(e1CertificationSubmission, e2CertificationSubmission);
}
return -1;
});
} else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) {
Collections.sort(otaManageApplyEOList, (e1, e2) -> {
if (e1.getCertificationSubmission() != null && e2.getCertificationSubmission() != null) {
String e1CertificationSubmission = DateUtils.formatDate(e1.getCertificationSubmission());
String e2CertificationSubmission = DateUtils.formatDate(e2.getCertificationSubmission());
return comparator.compare(e2CertificationSubmission, e1CertificationSubmission);
}
return -1;
});
}
}
//认证批准
if("attestationEndTime".equals(otaManageApplyEO.getOrderByField())){
if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) {
Collections.sort(otaManageApplyEOList, (e1, e2) -> {
if (e1.getAttestationEndTime() != null && e2.getAttestationEndTime() != null) {
String e1AttestationEndTime = DateUtils.formatDate(e1.getAttestationEndTime());
String e2AttestationEndTime = DateUtils.formatDate(e2.getAttestationEndTime());
return comparator.compare(e1AttestationEndTime, e2AttestationEndTime);
}
return -1;
});
} else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) {
Collections.sort(otaManageApplyEOList, (e1, e2) -> {
if (e1.getAttestationEndTime() != null && e2.getAttestationEndTime() != null) {
String e1AttestationEndTime = DateUtils.formatDate(e1.getAttestationEndTime());
String e2AttestationEndTime = DateUtils.formatDate(e2.getAttestationEndTime());
return comparator.compare(e2AttestationEndTime, e1AttestationEndTime);
}
return -1;
});
}
}
//认证进度
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("matchStatus".equals(otaManageApplyEO.getOrderByField())){
if(OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())){
Collections.sort(otaManageApplyEOList,(e1, e2)->{
String e1MatchStatus = StringUtils.isNotBlank(e1.getMatchStatus()) ? e1.getMatchStatus() : "";
String e2MatchStatus = StringUtils.isNotBlank(e2.getMatchStatus()) ? e2.getMatchStatus() : "";
return comparator.compare(e1MatchStatus,e2MatchStatus);
});
}else if(OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())){
Collections.sort(otaManageApplyEOList,(e1,e2)->{
String e1MatchStatus = StringUtils.isNotBlank(e1.getMatchStatus()) ? e1.getMatchStatus() : "";
String e2MatchStatus = StringUtils.isNotBlank(e2.getMatchStatus()) ? e2.getMatchStatus() : "";
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