修改OTA批量编辑
This commit is contained in:
+69
-35
@@ -1093,6 +1093,17 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
|
||||
return StringUtils.equals(str1, str2);
|
||||
}
|
||||
|
||||
private Map<String, String> queryProjectName(List<OtaManageApplyEO> list) {
|
||||
Map<String, String> res = new HashMap<>();
|
||||
List<String> idList = list.stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getProjectVersion()))
|
||||
.map(OtaManageApplyEO::getProjectVersion).distinct().collect(Collectors.toList());
|
||||
List<ProjectLibraryBase> proList = projectLibraryBaseService.queryList(idList);
|
||||
for (ProjectLibraryBase plb : proList) {
|
||||
res.put(plb.getId(), plb.getShowName());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void temporarySave(List<OtaManageApplyEO> list, String cut) {
|
||||
@@ -1104,6 +1115,10 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
|
||||
|
||||
//已存在的数据
|
||||
List<OtaManageApplyEO> omaOldList = this.getBaseMapper().selectBatchIds(idList);
|
||||
List<OtaManageApplyEO> queryProNameList = new ArrayList<>();
|
||||
queryProNameList.addAll(omaOldList);
|
||||
queryProNameList.addAll(list);
|
||||
Map<String, String> proNameMap = queryProjectName(queryProNameList);
|
||||
//历史记录
|
||||
List<OtaManageHistory> hisList = new ArrayList<>();
|
||||
List<OtaManageApplyEO> saveList = new ArrayList<>();
|
||||
@@ -1127,7 +1142,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
|
||||
conSb.append(user.getUsername()).append(" : ");
|
||||
conSbEn.append(user.getUsername()).append(" : ");
|
||||
if (!paramsEquals(oma.getProjectVersion(), omaOld.getProjectVersion())) {
|
||||
conSb.append("‘项目版本’ 由 ‘").append(omaOld.getProjectVersionText()).append("’ 改为 ‘").append(oma.getProjectVersionText()).append("‘.");
|
||||
conSb.append("‘项目版本’ 由 ‘").append(proNameMap.get(omaOld.getProjectVersion())).append("’ 改为 ‘").append(proNameMap.get(oma.getProjectVersion())).append("‘.");
|
||||
conSbEn.append("‘Project Version‘ change from ‘").append(omaOld.getProjectVersionText()).append("‘ to ‘").append(oma.getProjectVersionText()).append("‘.");
|
||||
}
|
||||
if (!paramsEquals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule())) {
|
||||
@@ -1158,8 +1173,8 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
|
||||
conSb.append(user.getUsername()).append(" : ");
|
||||
conSbEn.append(user.getUsername()).append(" : ");
|
||||
if (StringUtils.isNotEmpty(oma.getProjectVersion())) {
|
||||
conSb.append("‘项目版本‘ 由 ‘空‘").append(" 改为 ‘").append(oma.getProjectVersionText()).append("‘.");
|
||||
conSbEn.append("‘Project Version‘ change from ‘null‘").append(" to ‘").append(oma.getProjectVersionText()).append("‘.");
|
||||
conSb.append("‘项目版本‘ 由 ‘空‘").append(" 改为 ‘").append(proNameMap.get(oma.getProjectVersion())).append("‘.");
|
||||
conSbEn.append("‘Project Version‘ change from ‘null‘").append(" to ‘").append(proNameMap.get(oma.getProjectVersion())).append("‘.");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(oma.getAttestationSchedule())) {
|
||||
conSb.append("‘认证进度‘ 由 ‘空‘").append(" 改为 ‘").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName()).append("‘.");
|
||||
@@ -1221,48 +1236,67 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
|
||||
@Override
|
||||
public List<String> updateVdrBatch(List<OtaManageApplyEO> list, String projectVersion, String attestationSchedule, String remark, String cut) {
|
||||
ProjectLibraryBase plb = projectLibraryBaseService.selectById(projectVersion);
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//历史记录
|
||||
List<OtaManageHistory> hisList = new ArrayList<>();
|
||||
List<String> msgList = new ArrayList<>();
|
||||
List<OtaManageApplyEO> changeList = new ArrayList<>();
|
||||
boolean isStudio = isStudio();
|
||||
boolean isOtaManager = isOtaManager();
|
||||
for (OtaManageApplyEO oma : list) {
|
||||
StringBuilder conOtaCn = new StringBuilder();
|
||||
StringBuilder conOtaEn = new StringBuilder();
|
||||
conOtaCn.append(user.getUsername() + " 批量编辑了 VDR: ").append(oma.getVdr());
|
||||
conOtaEn.append(user.getUsername() + " edited VDR: ").append(oma.getVdr());
|
||||
boolean isChanged = false;
|
||||
if (isStudio() && (StringUtils.isEmpty(oma.getMatchStatus()) || oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey()))) {
|
||||
if (StringUtils.isNotEmpty(projectVersion)) {
|
||||
isChanged = true;
|
||||
oma.setProjectVersion(projectVersion);
|
||||
conOtaCn.append(" 修改了 ").append("项目版本 ").append(" 改为 ").append(plb.getShowName());
|
||||
conOtaEn.append(" modified ").append("Project Version change to ").append(plb.getShowName());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(attestationSchedule)) {
|
||||
isChanged = true;
|
||||
oma.setAttestationSchedule(attestationSchedule);
|
||||
conOtaCn.append(" 修改了 ").append("认证进度 ").append(" 改为 ").append(CertificationProgressEnum.getByValue(attestationSchedule).getName());
|
||||
conOtaEn.append(" modified ").append("Homologation Progress change to ").append(CertificationProgressEnum.getByValue(attestationSchedule).getValue());
|
||||
if (StringUtils.isNotEmpty(projectVersion)) {
|
||||
if (isStudio) {
|
||||
if (StringUtils.isEmpty(oma.getMatchStatus())
|
||||
|| oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey())
|
||||
|| oma.getMatchStatus().equals(OtaStatusEnum.REJECTED.getKey())) {
|
||||
isChanged = true;
|
||||
oma.setProjectVersion(projectVersion);
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
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_MATCHED.getNameEN() + " or " + OtaStatusEnum.REJECTED.getNameEN() + "!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
msgList.add("VDR:" + oma.getVdr() + " 只有Studio角色可以编辑项目版本!");
|
||||
} else {
|
||||
msgList.add("VDR:" + oma.getVdr() + " Only Studio roles can edit Project Version!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isStudio() || isOtaManager()) {
|
||||
if (StringUtils.isNotEmpty(remark)) {
|
||||
isChanged = true;
|
||||
oma.setRemark(remark);
|
||||
conOtaCn.append(" 修改了 ").append("备注 ").append(" 改为 ").append(remark);
|
||||
conOtaEn.append(" modified ").append("Remark change to ").append(remark);
|
||||
if (StringUtils.isNotEmpty(attestationSchedule)) {
|
||||
if (isStudio) {
|
||||
if (StringUtils.isEmpty(oma.getMatchStatus())
|
||||
|| oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey())
|
||||
|| oma.getMatchStatus().equals(OtaStatusEnum.REJECTED.getKey())) {
|
||||
isChanged = true;
|
||||
oma.setAttestationSchedule(attestationSchedule);
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
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_MATCHED.getNameEN() + " or " + OtaStatusEnum.REJECTED.getNameEN() + "!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
msgList.add("VDR:" + oma.getVdr() + " 只有Studio角色可以编辑认证进度!");
|
||||
} else {
|
||||
msgList.add("VDR:" + oma.getVdr() + " Only Studio roles can edit Homologation Progress!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(remark) && !remark.equals("--")) {
|
||||
isChanged = true;
|
||||
oma.setRemark(remark);
|
||||
}
|
||||
if (isChanged) {
|
||||
OtaManageHistory his = new OtaManageHistory();
|
||||
his.setApplyId(oma.getId());
|
||||
his.setContentCn(conOtaCn.toString());
|
||||
his.setContentEn(conOtaEn.toString());
|
||||
hisList.add(his);
|
||||
changeList.add(oma);
|
||||
}
|
||||
}
|
||||
this.saveOrUpdateBatch(list);
|
||||
otaManageHistoryService.saveBatch(hisList);
|
||||
if (CollectionUtils.isNotEmpty(changeList)) {
|
||||
this.temporarySave(changeList, cut);
|
||||
}
|
||||
return msgList;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user