Merge remote-tracking branch 'origin/dev_20230808_OTA' into dev_20230808_OTA

This commit is contained in:
zyx.net
2023-08-24 10:59:42 +08:00
5 changed files with 74 additions and 66 deletions
@@ -89,16 +89,20 @@ public class OtaManageApplyEO implements Serializable {
@ApiModelProperty(value = "备注")
private java.lang.String remark;
/**适用车型*/
@Excel(name = "适用车型", width = 15)
@ApiModelProperty(value = "适用车型")
private java.lang.String appliedVehicleProject;
private java.lang.String vehicleType;
//--------------------------------------------------------
@TableField(exist = false)
@ApiModelProperty(value = "软件版本")
private java.lang.String plannedBpLaunchBatch;
@TableField(exist = false)
@ApiModelProperty(value = "适用车型")
private java.lang.String appliedVehicleProject;
@TableField(exist = false)
@@ -107,7 +111,7 @@ public class OtaManageApplyEO implements Serializable {
@TableField(exist = false)
@ApiModelProperty(value = "软件发布时间")
private String releaseName;
private String releaseDate;
@TableField(exist = false)
@ApiModelProperty(value = "软件发布时间")
@@ -81,7 +81,7 @@
and omr.impact_eu_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%'))
</if>
<if test="otaManageApplyEO.appliedVehicleProject != null and otaManageApplyEO.appliedVehicleProject != ''">
and omr.applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.appliedVehicleProject}),'%'
and omr.vehicle_type LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.appliedVehicleProject}),'%')
</if>
</where>
order by omr.id desc
@@ -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);
});
}
@@ -765,9 +768,9 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
public List<String> getCarList(String cut) {
List<OtaManageApplyEO> otaManageApplyEOS = this.getBaseMapper().getOtaCarList();
List<String> result = new LinkedList<>();
if(CutEnum.CN.getValue().equals(cut)){
if (CutEnum.CN.getValue().equals(cut)) {
result.add("全部");
}else{
} else {
result.add("All");
}
if (!otaManageApplyEOS.isEmpty()) {
@@ -777,13 +780,13 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
.filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject()))
.map(OtaManageApplyEO::getAppliedVehicleProject).distinct().collect(Collectors.toList());
//过滤掉特殊的适用车型
List<String> otaNameList = OtaCarEnum.getOtaNameList();
List<String> otaNameList = OtaCarEnum.getOtaNameList();
for (String appliedVehicleProject : appliedVehicleProjectList) {
for (String s : appliedVehicleProject.split(",")) {
String[] split = s.split(" ");
if (split.length == 2) {
if(!otaNameList.contains(s)){
if (!otaNameList.contains(s)) {
result.add(s);
}
} else if (split.length == 3) {
@@ -1105,14 +1108,15 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
} else {
msgList.add("VDR:" + oma.getVdr() + " Must first select the Project Version");
}
} else if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())
} else if (StringUtils.isNotEmpty(oma.getMatchStatus())
&& (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())
|| oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey())
|| oma.getMatchStatus().equals(OtaStatusEnum.NA.getKey())) {
|| oma.getMatchStatus().equals(OtaStatusEnum.NA.getKey()))) {
//状态不对
if (CutEnum.CN.getValue().equals(cut)) {
msgList.add("VDR:" + oma.getVdr() + " 状态必须为" + OtaStatusEnum.TO_BE_APPROVED.getNameCN() + "");
msgList.add("VDR:" + oma.getVdr() + " 状态必须为" + OtaStatusEnum.TO_BE_MATCHED.getNameCN() + "" + OtaStatusEnum.REJECTED.getNameCN() + "");
} else {
msgList.add("VDR:" + oma.getVdr() + " The state must be" + OtaStatusEnum.TO_BE_APPROVED.getNameEN() + "");
msgList.add("VDR:" + oma.getVdr() + " The state must be" + OtaStatusEnum.TO_BE_MATCHED.getNameEN() + " or " + OtaStatusEnum.REJECTED.getNameEN() + "");
}
} else {
oma.setMatchStatus(OtaStatusEnum.TO_BE_APPROVED.getKey());
@@ -1140,7 +1144,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
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 (isStudio() && (StringUtils.isEmpty(oma.getMatchStatus()) || oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey()))) {
if (StringUtils.isNotEmpty(projectVersion)) {
isChanged = true;
oma.setProjectVersion(projectVersion);
@@ -1185,7 +1189,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<String> idList = Arrays.asList(ids.split(","));
List<OtaManageApplyEO> omaList = this.getListByIds(idList);
for (OtaManageApplyEO oma : omaList) {
if (oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey())) {
if (StringUtils.isNotEmpty(oma.getMatchStatus()) && oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey())) {
oma.setMatchStatus(OtaStatusEnum.TO_BE_APPROVED.getKey());
oma.setProjectVersion(projectVersion);
@@ -1218,7 +1222,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<String> idList = Arrays.asList(ids.split(","));
List<OtaManageApplyEO> omaList = this.getListByIds(idList);
for (OtaManageApplyEO oma : omaList) {
if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) {
if (StringUtils.isNotEmpty(oma.getMatchStatus()) && oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) {
oma.setMatchStatus(OtaStatusEnum.LOCKED.getKey());
OtaManageHistory his = new OtaManageHistory();
his.setApplyId(oma.getId());
@@ -1249,13 +1253,13 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<String> idList = Arrays.asList(ids.split(","));
List<OtaManageApplyEO> omaList = this.getListByIds(idList);
for (OtaManageApplyEO oma : omaList) {
if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) {
if (StringUtils.isNotEmpty(oma.getMatchStatus()) && oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) {
oma.setMatchStatus(OtaStatusEnum.REJECTED.getKey());
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);
his.setContentCn(user.getUsername() + " 退回了 VDR:" + oma.getVdr() + " 退回原因:" + rejectReason);
his.setContentEn(user.getUsername() + " returned VDR:" + oma.getVdr() + " Reason for return:" + rejectReason);
hisList.add(his);
} else {
//状态不对
@@ -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;
}