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)
@ApiModelProperty(value = "软件发布时间")
private String releaseName;
private String releaseDate;
@TableField(exist = false)
@ApiModelProperty(value = "软件发布时间")
@@ -190,72 +190,75 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
@Override
public List<OtaManageApplyEO> getOtaPage(OtaManageApplyEO otaManageApplyEO) {
List<OtaManageApplyEO> otaManageApplyEOList = this.getBaseMapper().getOtaList(otaManageApplyEO);
List<OtaManageApplyEO> result = new ArrayList<>();
if (!otaManageApplyEOList.isEmpty()) {
List<String> otaNameList = OtaCarEnum.getOtaNameList();
List<String> plannedBpLaunchBatchList = otaManageApplyEOList.stream()
.filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch()))
.map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList());
if (!plannedBpLaunchBatchList.isEmpty()) {
List<OtaManageReceiveNsdpEO> manageReceiveNsdpEOList = this.getBaseMapper().getReleaseDate(plannedBpLaunchBatchList);
for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) {
manageApplyEO.setVdr(manageApplyEO.getId());
List<OtaManageReceiveNsdpEO> collect = manageReceiveNsdpEOList.stream()
.filter(e -> StringUtils.isNotBlank(e.getReleaseName())
&& e.getReleaseName().equals(manageApplyEO.getPlannedBpLaunchBatch())).collect(Collectors.toList());
if (!collect.isEmpty()) {
List<String> releaseDateList = collect.stream().map(OtaManageReceiveNsdpEO::getReleaseDate).distinct().collect(Collectors.toList());
List<Integer> list = new ArrayList<>();
for (String s : releaseDateList) {
list.add(Integer.parseInt(s.replaceAll("-", "")));
for (String plannedBpLaunchBatch : plannedBpLaunchBatchList) {
OtaManageApplyEO manageApplyEO = new OtaManageApplyEO();
manageApplyEO.setPlannedBpLaunchBatch(plannedBpLaunchBatch);
List<OtaManageApplyEO> otaManageApplyEOS = otaManageApplyEOList.stream()
.filter(e -> plannedBpLaunchBatch.equals(e.getPlannedBpLaunchBatch())).collect(Collectors.toList());
if(!otaManageApplyEOS.isEmpty()){
//发布时间
manageApplyEO.setReleaseDate(otaManageApplyEOS.get(0).getReleaseDate());
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);
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<String> marketSet = new HashSet<>();
for (String s : appliedVehicleProject.split(",")) {
String[] split = s.split(" ");
if (split.length == 2) {
if (!otaNameList.contains(s)) {
marketSet.add(split[1]);
if(!carList.isEmpty()){
//适用车型
carList = carList.stream().distinct().collect(Collectors.toList());
manageApplyEO.setAppliedVehicleProject(StringUtils.join(carList,","));
//市场
for (String appliedVehicleProject : carList) {
Set<String> 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]);
}
}
}
} else if (split.length == 3) {
if (!otaNameList.contains(s)) {
marketSet.add(split[2]);
if (!marketSet.isEmpty()) {
manageApplyEO.setMarket(StringUtils.join(marketSet, ","));
}
}
}
if (!marketSet.isEmpty()) {
manageApplyEO.setMarket(StringUtils.join(marketSet, ","));
}
}
result.add(manageApplyEO);
}
}
}
if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeStart())) {
otaManageApplyEOList = otaManageApplyEOList.stream()
.filter(e -> StringUtils.isNotBlank(e.getReleaseName())
result = result.stream()
.filter(e -> StringUtils.isNotBlank(e.getReleaseDate())
&& (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())
result = result.stream().filter(e -> StringUtils.isNotBlank(e.getReleaseDate())
&& (e.getReleaseNameDate().before(otaManageApplyEO.getSoftwareIssueTimeEnd())
|| 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) {
@@ -312,14 +315,14 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
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() : "";
String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseDate()) ? e1.getReleaseDate() : "";
String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseDate()) ? e2.getReleaseDate() : "";
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() : "";
String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseDate()) ? e1.getReleaseDate() : "";
String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseDate()) ? e2.getReleaseDate() : "";
return comparator.compare(e2ReleaseName, e1ReleaseName);
});
}
@@ -29,6 +29,6 @@ public class OtaExportCnVO {
@Excel(name = "软件发布时间", width = 15)
@ApiModelProperty(value = "软件发布时间")
private String releaseName;
private String releaseDate;
}
@@ -26,6 +26,6 @@ public class OtaExportEnVO {
@Excel(name = "Software release time", width = 15)
@ApiModelProperty(value = "软件发布时间")
private String releaseName;
private String releaseDate;
}