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 = "备注") @ApiModelProperty(value = "备注")
private java.lang.String remark; private java.lang.String remark;
/**适用车型*/
@Excel(name = "适用车型", width = 15)
@ApiModelProperty(value = "适用车型") @ApiModelProperty(value = "适用车型")
private java.lang.String appliedVehicleProject; private java.lang.String vehicleType;
//-------------------------------------------------------- //--------------------------------------------------------
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "软件版本") @ApiModelProperty(value = "软件版本")
private java.lang.String plannedBpLaunchBatch; private java.lang.String plannedBpLaunchBatch;
@TableField(exist = false)
@ApiModelProperty(value = "适用车型")
private java.lang.String appliedVehicleProject;
@TableField(exist = false) @TableField(exist = false)
@@ -107,7 +111,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 = "软件发布时间")
@@ -81,7 +81,7 @@
and omr.impact_eu_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%')) and omr.impact_eu_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%'))
</if> </if>
<if test="otaManageApplyEO.appliedVehicleProject != null and otaManageApplyEO.appliedVehicleProject != ''"> <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> </if>
</where> </where>
order by omr.id desc order by omr.id desc
@@ -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);
}); });
} }
@@ -765,9 +768,9 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
public List<String> getCarList(String cut) { public List<String> getCarList(String cut) {
List<OtaManageApplyEO> otaManageApplyEOS = this.getBaseMapper().getOtaCarList(); List<OtaManageApplyEO> otaManageApplyEOS = this.getBaseMapper().getOtaCarList();
List<String> result = new LinkedList<>(); List<String> result = new LinkedList<>();
if(CutEnum.CN.getValue().equals(cut)){ if (CutEnum.CN.getValue().equals(cut)) {
result.add("全部"); result.add("全部");
}else{ } else {
result.add("All"); result.add("All");
} }
if (!otaManageApplyEOS.isEmpty()) { if (!otaManageApplyEOS.isEmpty()) {
@@ -777,13 +780,13 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
.filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject()))
.map(OtaManageApplyEO::getAppliedVehicleProject).distinct().collect(Collectors.toList()); .map(OtaManageApplyEO::getAppliedVehicleProject).distinct().collect(Collectors.toList());
//过滤掉特殊的适用车型 //过滤掉特殊的适用车型
List<String> otaNameList = OtaCarEnum.getOtaNameList(); List<String> otaNameList = OtaCarEnum.getOtaNameList();
for (String appliedVehicleProject : appliedVehicleProjectList) { for (String appliedVehicleProject : appliedVehicleProjectList) {
for (String s : appliedVehicleProject.split(",")) { for (String s : appliedVehicleProject.split(",")) {
String[] split = s.split(" "); String[] split = s.split(" ");
if (split.length == 2) { if (split.length == 2) {
if(!otaNameList.contains(s)){ if (!otaNameList.contains(s)) {
result.add(s); result.add(s);
} }
} else if (split.length == 3) { } else if (split.length == 3) {
@@ -1105,14 +1108,15 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
} else { } else {
msgList.add("VDR:" + oma.getVdr() + " Must first select the Project Version!"); 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.LOCKED.getKey())
|| oma.getMatchStatus().equals(OtaStatusEnum.NA.getKey())) { || oma.getMatchStatus().equals(OtaStatusEnum.NA.getKey()))) {
//状态不对 //状态不对
if (CutEnum.CN.getValue().equals(cut)) { 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 { } 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 { } else {
oma.setMatchStatus(OtaStatusEnum.TO_BE_APPROVED.getKey()); 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()); conOtaCn.append(user.getUsername() + " 批量编辑了 VDR: ").append(oma.getVdr());
conOtaEn.append(user.getUsername() + " edited VDR: ").append(oma.getVdr()); conOtaEn.append(user.getUsername() + " edited VDR: ").append(oma.getVdr());
boolean isChanged = false; 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)) { if (StringUtils.isNotEmpty(projectVersion)) {
isChanged = true; isChanged = true;
oma.setProjectVersion(projectVersion); oma.setProjectVersion(projectVersion);
@@ -1185,7 +1189,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<String> idList = Arrays.asList(ids.split(",")); List<String> idList = Arrays.asList(ids.split(","));
List<OtaManageApplyEO> omaList = this.getListByIds(idList); List<OtaManageApplyEO> omaList = this.getListByIds(idList);
for (OtaManageApplyEO oma : omaList) { 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.setMatchStatus(OtaStatusEnum.TO_BE_APPROVED.getKey());
oma.setProjectVersion(projectVersion); oma.setProjectVersion(projectVersion);
@@ -1218,7 +1222,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<String> idList = Arrays.asList(ids.split(",")); List<String> idList = Arrays.asList(ids.split(","));
List<OtaManageApplyEO> omaList = this.getListByIds(idList); List<OtaManageApplyEO> omaList = this.getListByIds(idList);
for (OtaManageApplyEO oma : omaList) { 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()); oma.setMatchStatus(OtaStatusEnum.LOCKED.getKey());
OtaManageHistory his = new OtaManageHistory(); OtaManageHistory his = new OtaManageHistory();
his.setApplyId(oma.getId()); his.setApplyId(oma.getId());
@@ -1249,13 +1253,13 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<String> idList = Arrays.asList(ids.split(",")); List<String> idList = Arrays.asList(ids.split(","));
List<OtaManageApplyEO> omaList = this.getListByIds(idList); List<OtaManageApplyEO> omaList = this.getListByIds(idList);
for (OtaManageApplyEO oma : omaList) { 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()); oma.setMatchStatus(OtaStatusEnum.REJECTED.getKey());
OtaManageHistory his = new OtaManageHistory(); OtaManageHistory his = new OtaManageHistory();
his.setApplyId(oma.getId()); his.setApplyId(oma.getId());
his.setContentCn(user.getUsername() + " 退回了 VDR:" + oma.getVdr()+" 退回原因:" + rejectReason); his.setContentCn(user.getUsername() + " 退回了 VDR:" + oma.getVdr() + " 退回原因:" + rejectReason);
his.setContentEn(user.getUsername() + " returned VDR:"+ oma.getVdr()+ " Reason for return:" + rejectReason); his.setContentEn(user.getUsername() + " returned VDR:" + oma.getVdr() + " Reason for return:" + rejectReason);
hisList.add(his); hisList.add(his);
} else { } else {
//状态不对 //状态不对
@@ -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;
} }