OTA列表

This commit is contained in:
zhn
2023-08-24 10:38:23 +08:00
parent e46d71df18
commit 381525e808
4 changed files with 51 additions and 48 deletions
@@ -107,7 +107,7 @@ public class OtaManageApplyEO implements Serializable {
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "软件发布时间") @ApiModelProperty(value = "软件发布时间")
private String releaseName; private String releaseDate;
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "软件发布时间") @ApiModelProperty(value = "软件发布时间")
@@ -190,72 +190,75 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
@Override @Override
public List<OtaManageApplyEO> getOtaPage(OtaManageApplyEO otaManageApplyEO) { public List<OtaManageApplyEO> getOtaPage(OtaManageApplyEO otaManageApplyEO) {
List<OtaManageApplyEO> otaManageApplyEOList = this.getBaseMapper().getOtaList(otaManageApplyEO); List<OtaManageApplyEO> otaManageApplyEOList = this.getBaseMapper().getOtaList(otaManageApplyEO);
List<OtaManageApplyEO> result = new ArrayList<>();
if (!otaManageApplyEOList.isEmpty()) { if (!otaManageApplyEOList.isEmpty()) {
List<String> otaNameList = OtaCarEnum.getOtaNameList(); List<String> otaNameList = OtaCarEnum.getOtaNameList();
List<String> plannedBpLaunchBatchList = otaManageApplyEOList.stream() List<String> plannedBpLaunchBatchList = otaManageApplyEOList.stream()
.filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch())) .filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch()))
.map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList()); .map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList());
if (!plannedBpLaunchBatchList.isEmpty()) { if (!plannedBpLaunchBatchList.isEmpty()) {
List<OtaManageReceiveNsdpEO> manageReceiveNsdpEOList = this.getBaseMapper().getReleaseDate(plannedBpLaunchBatchList); for (String plannedBpLaunchBatch : plannedBpLaunchBatchList) {
for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) { OtaManageApplyEO manageApplyEO = new OtaManageApplyEO();
manageApplyEO.setVdr(manageApplyEO.getId()); manageApplyEO.setPlannedBpLaunchBatch(plannedBpLaunchBatch);
List<OtaManageReceiveNsdpEO> collect = manageReceiveNsdpEOList.stream()
.filter(e -> StringUtils.isNotBlank(e.getReleaseName()) List<OtaManageApplyEO> otaManageApplyEOS = otaManageApplyEOList.stream()
&& e.getReleaseName().equals(manageApplyEO.getPlannedBpLaunchBatch())).collect(Collectors.toList()); .filter(e -> plannedBpLaunchBatch.equals(e.getPlannedBpLaunchBatch())).collect(Collectors.toList());
if (!collect.isEmpty()) { if(!otaManageApplyEOS.isEmpty()){
List<String> releaseDateList = collect.stream().map(OtaManageReceiveNsdpEO::getReleaseDate).distinct().collect(Collectors.toList()); //发布时间
List<Integer> list = new ArrayList<>(); manageApplyEO.setReleaseDate(otaManageApplyEOS.get(0).getReleaseDate());
for (String s : releaseDateList) {
list.add(Integer.parseInt(s.replaceAll("-", ""))); List<String> appliedVehicleProjectList = otaManageApplyEOS.stream()
.filter(e->StringUtils.isNotBlank(e.getAppliedVehicleProject()))
.map(OtaManageApplyEO::getAppliedVehicleProject).collect(Collectors.toList());
List<String> carList = new ArrayList<>();
for (String appliedVehicleProject : appliedVehicleProjectList) {
carList.addAll(Arrays.asList(appliedVehicleProject.split(",")));
} }
Integer max = Collections.max(list); if(!carList.isEmpty()){
try { //适用车型
//发布时间 carList = carList.stream().distinct().collect(Collectors.toList());
manageApplyEO.setReleaseName(sdf.format(dateFormat.parse(max.toString()))); manageApplyEO.setAppliedVehicleProject(StringUtils.join(carList,","));
manageApplyEO.setReleaseNameDate(dateFormat.parse(max.toString())); //市场
} catch (ParseException e) { for (String appliedVehicleProject : carList) {
log.error(e.getMessage(), e); Set<String> marketSet = new HashSet<>();
} for (String s : appliedVehicleProject.split(",")) {
} String[] split = s.split(" ");
//市场 if (split.length == 2) {
String appliedVehicleProject = manageApplyEO.getAppliedVehicleProject(); if (!otaNameList.contains(s)) {
if (StringUtils.isNotBlank(appliedVehicleProject)) { marketSet.add(split[1]);
Set<String> marketSet = new HashSet<>(); }
for (String s : appliedVehicleProject.split(",")) { } else if (split.length == 3) {
String[] split = s.split(" "); if (!otaNameList.contains(s)) {
if (split.length == 2) { marketSet.add(split[2]);
if (!otaNameList.contains(s)) { }
marketSet.add(split[1]); }
} }
} else if (split.length == 3) { if (!marketSet.isEmpty()) {
if (!otaNameList.contains(s)) { manageApplyEO.setMarket(StringUtils.join(marketSet, ","));
marketSet.add(split[2]);
} }
} }
} }
if (!marketSet.isEmpty()) {
manageApplyEO.setMarket(StringUtils.join(marketSet, ","));
}
} }
result.add(manageApplyEO);
} }
} }
} }
if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeStart())) { if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeStart())) {
otaManageApplyEOList = otaManageApplyEOList.stream() result = result.stream()
.filter(e -> StringUtils.isNotBlank(e.getReleaseName()) .filter(e -> StringUtils.isNotBlank(e.getReleaseDate())
&& (e.getReleaseNameDate().after(otaManageApplyEO.getSoftwareIssueTimeStart()) && (e.getReleaseNameDate().after(otaManageApplyEO.getSoftwareIssueTimeStart())
|| e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeStart()))).collect(Collectors.toList()); || e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeStart()))).collect(Collectors.toList());
} }
if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeEnd())) { if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeEnd())) {
otaManageApplyEOList = otaManageApplyEOList.stream().filter(e -> StringUtils.isNotBlank(e.getReleaseName()) result = result.stream().filter(e -> StringUtils.isNotBlank(e.getReleaseDate())
&& (e.getReleaseNameDate().before(otaManageApplyEO.getSoftwareIssueTimeEnd()) && (e.getReleaseNameDate().before(otaManageApplyEO.getSoftwareIssueTimeEnd())
|| e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeEnd()))).collect(Collectors.toList()); || e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeEnd()))).collect(Collectors.toList());
} }
if (!otaManageApplyEOList.isEmpty()) { if (!result.isEmpty()) {
//表头排序 //表头排序
heartSort(otaManageApplyEO, otaManageApplyEOList); heartSort(otaManageApplyEO, result);
} }
return otaManageApplyEOList; return result;
} }
private void heartSort(OtaManageApplyEO otaManageApplyEO, List<OtaManageApplyEO> otaManageApplyEOList) { private void heartSort(OtaManageApplyEO otaManageApplyEO, List<OtaManageApplyEO> otaManageApplyEOList) {
@@ -312,14 +315,14 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
if ("releaseName".equals(otaManageApplyEO.getOrderByField())) { if ("releaseName".equals(otaManageApplyEO.getOrderByField())) {
if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) {
Collections.sort(otaManageApplyEOList, (e1, e2) -> { Collections.sort(otaManageApplyEOList, (e1, e2) -> {
String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseName()) ? e1.getReleaseName() : ""; String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseDate()) ? e1.getReleaseDate() : "";
String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseName()) ? e2.getReleaseName() : ""; String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseDate()) ? e2.getReleaseDate() : "";
return comparator.compare(e1ReleaseName, e2ReleaseName); return comparator.compare(e1ReleaseName, e2ReleaseName);
}); });
} else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) {
Collections.sort(otaManageApplyEOList, (e1, e2) -> { Collections.sort(otaManageApplyEOList, (e1, e2) -> {
String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseName()) ? e1.getReleaseName() : ""; String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseDate()) ? e1.getReleaseDate() : "";
String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseName()) ? e2.getReleaseName() : ""; String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseDate()) ? e2.getReleaseDate() : "";
return comparator.compare(e2ReleaseName, e1ReleaseName); return comparator.compare(e2ReleaseName, e1ReleaseName);
}); });
} }
@@ -29,6 +29,6 @@ public class OtaExportCnVO {
@Excel(name = "软件发布时间", width = 15) @Excel(name = "软件发布时间", width = 15)
@ApiModelProperty(value = "软件发布时间") @ApiModelProperty(value = "软件发布时间")
private String releaseName; private String releaseDate;
} }
@@ -26,6 +26,6 @@ public class OtaExportEnVO {
@Excel(name = "Software release time", width = 15) @Excel(name = "Software release time", width = 15)
@ApiModelProperty(value = "软件发布时间") @ApiModelProperty(value = "软件发布时间")
private String releaseName; private String releaseDate;
} }