修改OTA列表查询

This commit is contained in:
高嵩
2023-08-24 17:43:57 +08:00
parent 8bc58a0edb
commit 3840da7193
2 changed files with 92 additions and 71 deletions
@@ -61,7 +61,7 @@
omr.homologation_impact,omr.homologation, omr.homologation_impact,omr.homologation,
omr.impact_cn_homo,omr.impact_eu_homo, omr.impact_cn_homo,omr.impact_eu_homo,
omr.master_domain,omr.applied_vehicle_project, omr.master_domain,omr.applied_vehicle_project,
oma.id,oma.project_version,oma.attestation_schedule,oma.match_status,oma.remark oma.id,oma.project_version,oma.attestation_schedule,oma.match_status,oma.remark,oma.vehicle_type
from ota_manage_receive omr from ota_manage_receive omr
left join ota_manage_apply oma on oma.vdr = omr.id left join ota_manage_apply oma on oma.vdr = omr.id
<where> <where>
@@ -196,13 +196,13 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<OtaManageApplyEO> dataList = new ArrayList<>(); List<OtaManageApplyEO> dataList = new ArrayList<>();
//去跟manager和studio权限 //去跟manager和studio权限
if(otaManager){ if (otaManager) {
dataList = otaManageApplyEOList; dataList = otaManageApplyEOList;
}else{ } else {
LambdaQueryWrapper<OtaManagePermission> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OtaManagePermission> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OtaManagePermission::getUserId,currentUser.getId()); wrapper.eq(OtaManagePermission::getUserId, currentUser.getId());
List<OtaManagePermission> managePermissionList = otaManagePermissionService.list(wrapper); List<OtaManagePermission> managePermissionList = otaManagePermissionService.list(wrapper);
if(!managePermissionList.isEmpty()){ if (!managePermissionList.isEmpty()) {
List<String> applyIdList = managePermissionList.stream().map(OtaManagePermission::getApplyId).distinct().collect(Collectors.toList()); List<String> applyIdList = managePermissionList.stream().map(OtaManagePermission::getApplyId).distinct().collect(Collectors.toList());
List<OtaManageApplyEO> collect = otaManageApplyEOList.stream().filter(e -> applyIdList.contains(e.getPlannedBpLaunchBatch())).collect(Collectors.toList()); List<OtaManageApplyEO> collect = otaManageApplyEOList.stream().filter(e -> applyIdList.contains(e.getPlannedBpLaunchBatch())).collect(Collectors.toList());
dataList = collect; dataList = collect;
@@ -223,21 +223,21 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<OtaManageApplyEO> otaManageApplyEOS = dataList.stream() List<OtaManageApplyEO> otaManageApplyEOS = dataList.stream()
.filter(e -> plannedBpLaunchBatch.equals(e.getPlannedBpLaunchBatch())).collect(Collectors.toList()); .filter(e -> plannedBpLaunchBatch.equals(e.getPlannedBpLaunchBatch())).collect(Collectors.toList());
if(!otaManageApplyEOS.isEmpty()){ if (!otaManageApplyEOS.isEmpty()) {
//发布时间 //发布时间
manageApplyEO.setReleaseDate(otaManageApplyEOS.get(0).getReleaseDate()); manageApplyEO.setReleaseDate(otaManageApplyEOS.get(0).getReleaseDate());
List<String> appliedVehicleProjectList = otaManageApplyEOS.stream() List<String> appliedVehicleProjectList = otaManageApplyEOS.stream()
.filter(e->StringUtils.isNotBlank(e.getAppliedVehicleProject())) .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject()))
.map(OtaManageApplyEO::getAppliedVehicleProject).collect(Collectors.toList()); .map(OtaManageApplyEO::getAppliedVehicleProject).collect(Collectors.toList());
List<String> carList = new ArrayList<>(); List<String> carList = new ArrayList<>();
for (String appliedVehicleProject : appliedVehicleProjectList) { for (String appliedVehicleProject : appliedVehicleProjectList) {
carList.addAll(Arrays.asList(appliedVehicleProject.split(","))); carList.addAll(Arrays.asList(appliedVehicleProject.split(",")));
} }
if(!carList.isEmpty()){ if (!carList.isEmpty()) {
//适用车型 //适用车型
carList = carList.stream().distinct().collect(Collectors.toList()); carList = carList.stream().distinct().collect(Collectors.toList());
manageApplyEO.setAppliedVehicleProject(StringUtils.join(carList,",")); manageApplyEO.setAppliedVehicleProject(StringUtils.join(carList, ","));
//市场 //市场
for (String appliedVehicleProject : carList) { for (String appliedVehicleProject : carList) {
Set<String> marketSet = new HashSet<>(); Set<String> marketSet = new HashSet<>();
@@ -280,6 +280,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
} }
return result; return result;
} }
/** /**
* OTA管理列表和全车型列表-分页列表查询 * OTA管理列表和全车型列表-分页列表查询
* *
@@ -639,6 +640,9 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
String[] conditionSplit = carMarket.split(" "); String[] conditionSplit = carMarket.split(" ");
for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) { for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) {
if (StringUtils.isNotEmpty(manageApplyEO.getVehicleType()) && !manageApplyEO.getVehicleType().equals(otaManageApplyEO.getAppliedVehicleProject())) {
continue;
}
if (StringUtils.isEmpty(manageApplyEO.getId()) || manageApplyEO.getId().length() < 20) { if (StringUtils.isEmpty(manageApplyEO.getId()) || manageApplyEO.getId().length() < 20) {
manageApplyEO.setId(UUID.randomUUID().toString().replace("-", "")); manageApplyEO.setId(UUID.randomUUID().toString().replace("-", ""));
} }
@@ -680,6 +684,14 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<ProjectTaskPlanning> projectTaskPlanningList = projectTaskPlanningService.queryList(StringUtils.join(projectVersionList, ",")); List<ProjectTaskPlanning> projectTaskPlanningList = projectTaskPlanningService.queryList(StringUtils.join(projectVersionList, ","));
boolean isDisabled = isDisabled(); boolean isDisabled = isDisabled();
for (OtaManageApplyEO manageApplyEO : list) { for (OtaManageApplyEO manageApplyEO : list) {
if (StringUtils.isBlank(manageApplyEO.getVehicleType())) {
manageApplyEO.setVehicleType(otaManageApplyEO.getAppliedVehicleProject());
manageApplyEO.setId(UUID.randomUUID().toString().replace("-", ""));
manageApplyEO.setProjectVersion(null);
manageApplyEO.setAttestationSchedule(null);
manageApplyEO.setMatchStatus(null);
manageApplyEO.setRemark(null);
}
if (StringUtils.isNotBlank(manageApplyEO.getProjectVersion())) { if (StringUtils.isNotBlank(manageApplyEO.getProjectVersion())) {
List<ProjectTaskPlanning> taskPlanningList = projectTaskPlanningList.stream() List<ProjectTaskPlanning> taskPlanningList = projectTaskPlanningList.stream()
.filter(e -> manageApplyEO.getProjectVersion().equals(e.getProjectId())).collect(Collectors.toList()); .filter(e -> manageApplyEO.getProjectVersion().equals(e.getProjectId())).collect(Collectors.toList());
@@ -1061,76 +1073,85 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
@Override @Override
public void temporarySave(List<OtaManageApplyEO> list, String cut) { public void temporarySave(List<OtaManageApplyEO> list, String cut) {
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> idList = list.stream() if (CollectionUtils.isNotEmpty(list)) {
.filter(e -> StringUtils.isNotBlank(e.getId())) List<String> idList = list.stream()
.map(OtaManageApplyEO::getId).distinct().collect(Collectors.toList()); .filter(e -> StringUtils.isNotBlank(e.getId()))
.map(OtaManageApplyEO::getId).distinct().collect(Collectors.toList());
//已存在的数据 //已存在的数据
List<OtaManageApplyEO> omaOldList = this.getBaseMapper().selectBatchIds(idList); List<OtaManageApplyEO> omaOldList = this.getBaseMapper().selectBatchIds(idList);
//历史记录 //历史记录
List<OtaManageHistory> hisList = new ArrayList<>(); List<OtaManageHistory> hisList = new ArrayList<>();
List<OtaManageApplyEO> saveList = new ArrayList<>();
for (OtaManageApplyEO oma : list) { for (OtaManageApplyEO oma : list) {
boolean flag = false; if (oma.getId().length() < 20) {
for (OtaManageApplyEO omaOld : omaOldList) { continue;
flag = true; }
if (StringUtils.equals(oma.getProjectVersionText(), omaOld.getProjectVersionText()) saveList.add(oma);
|| StringUtils.equals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule()) boolean flag = false;
|| StringUtils.equals(oma.getRemark(), omaOld.getRemark())) { for (OtaManageApplyEO omaOld : omaOldList) {
OtaManageHistory his = new OtaManageHistory(); flag = true;
his.setApplyId(oma.getId()); if (StringUtils.equals(oma.getProjectVersionText(), omaOld.getProjectVersionText())
StringBuilder conSb = new StringBuilder(); || StringUtils.equals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule())
StringBuilder conSbEn = new StringBuilder(); || StringUtils.equals(oma.getRemark(), omaOld.getRemark())) {
conSb.append(user.getUsername()).append("编辑了 VDR:").append(oma.getVdr()); OtaManageHistory his = new OtaManageHistory();
conSbEn.append(user.getUsername()).append("edited VDR:").append(oma.getVdr()); his.setApplyId(oma.getId());
if (StringUtils.equals(oma.getProjectVersionText(), omaOld.getProjectVersionText())) { StringBuilder conSb = new StringBuilder();
conSb.append(" 修改了 ").append("项目版本 由 ").append(omaOld.getProjectVersionText()).append(" 改为 ").append(oma.getProjectVersionText()); StringBuilder conSbEn = new StringBuilder();
conSbEn.append(" modified ").append("Project Version from ").append(omaOld.getProjectVersionText()).append(" to ").append(oma.getProjectVersionText()); conSb.append(user.getUsername()).append("编辑了 VDR:").append(oma.getVdr());
conSbEn.append(user.getUsername()).append("edited VDR:").append(oma.getVdr());
if (StringUtils.equals(oma.getProjectVersionText(), omaOld.getProjectVersionText())) {
conSb.append(" 修改了 ").append("项目版本 由 ").append(omaOld.getProjectVersionText()).append(" 改为 ").append(oma.getProjectVersionText());
conSbEn.append(" modified ").append("Project Version from ").append(omaOld.getProjectVersionText()).append(" to ").append(oma.getProjectVersionText());
}
if (StringUtils.equals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule())) {
conSb.append(" 修改了 ").append("认证进度 由 ").append(CertificationProgressEnum.getByValue(omaOld.getAttestationSchedule()).getName()).append(" 改为 ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName());
conSbEn.append(" modified ").append("Homologation Progress from ").append(CertificationProgressEnum.getByValue(omaOld.getAttestationSchedule()).getValue()).append(" to ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getValue());
}
if (StringUtils.equals(oma.getRemark(), omaOld.getRemark())) {
conSb.append(" 修改了 ").append("备注 由 ").append(omaOld.getRemark()).append(" 改为 ").append(oma.getRemark());
conSbEn.append(" modified ").append("Remark from ").append(omaOld.getRemark()).append(" to ").append(oma.getRemark());
}
his.setContentCn(conSb.toString());
his.setContentEn(conSbEn.toString());
hisList.add(his);
} }
if (StringUtils.equals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule())) { break;
conSb.append(" 修改了 ").append("认证进度 由 ").append(CertificationProgressEnum.getByValue(omaOld.getAttestationSchedule()).getName()).append(" 改为 ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName()); }
conSbEn.append(" modified ").append("Homologation Progress from ").append(CertificationProgressEnum.getByValue(omaOld.getAttestationSchedule()).getValue()).append(" to ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getValue()); if (!flag) {
if (StringUtils.isNotEmpty(oma.getProjectVersionText())
|| StringUtils.isNotEmpty(oma.getAttestationSchedule())
|| StringUtils.isNotEmpty(oma.getRemark())) {
OtaManageHistory his = new OtaManageHistory();
his.setApplyId(oma.getId());
StringBuilder conSb = new StringBuilder();
StringBuilder conSbEn = new StringBuilder();
conSb.append(user.getUsername()).append("编辑了 VDR:").append(oma.getVdr());
conSbEn.append(user.getUsername()).append("edited VDR:").append(oma.getVdr());
if (StringUtils.isNotEmpty(oma.getProjectVersionText())) {
conSb.append(" 修改了 ").append("项目版本 由 空").append(" 改为 ").append(oma.getProjectVersionText());
conSbEn.append(" modified ").append("Project Version from null").append(" to ").append(oma.getProjectVersionText());
}
if (StringUtils.isNotEmpty(oma.getAttestationSchedule())) {
conSb.append(" 修改了 ").append("认证进度 由 空").append(" 改为 ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName());
conSbEn.append(" modified ").append("Homologation Progress from null").append(" to ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getValue());
}
if (StringUtils.isNotEmpty(oma.getRemark())) {
conSb.append(" 修改了 ").append("备注 由 空").append(" 改为 ").append(oma.getRemark());
conSbEn.append(" modified ").append("Remark from null").append(" to ").append(oma.getRemark());
}
his.setContentCn(conSb.toString());
his.setContentEn(conSbEn.toString());
hisList.add(his);
} }
if (StringUtils.equals(oma.getRemark(), omaOld.getRemark())) {
conSb.append(" 修改了 ").append("备注 由 ").append(omaOld.getRemark()).append(" 改为 ").append(oma.getRemark());
conSbEn.append(" modified ").append("Remark from ").append(omaOld.getRemark()).append(" to ").append(oma.getRemark());
}
his.setContentCn(conSb.toString());
his.setContentEn(conSbEn.toString());
hisList.add(his);
} }
break;
} }
if (!flag) { if (saveList.size() > 0) {
if (StringUtils.isNotEmpty(oma.getProjectVersionText()) this.saveOrUpdateBatch(list);
|| StringUtils.isNotEmpty(oma.getAttestationSchedule()) otaManageHistoryService.saveBatch(hisList);
|| StringUtils.isNotEmpty(oma.getRemark())) {
OtaManageHistory his = new OtaManageHistory();
his.setApplyId(oma.getId());
StringBuilder conSb = new StringBuilder();
StringBuilder conSbEn = new StringBuilder();
conSb.append(user.getUsername()).append("编辑了 VDR:").append(oma.getVdr());
conSbEn.append(user.getUsername()).append("edited VDR:").append(oma.getVdr());
if (StringUtils.isNotEmpty(oma.getProjectVersionText())) {
conSb.append(" 修改了 ").append("项目版本 由 空").append(" 改为 ").append(oma.getProjectVersionText());
conSbEn.append(" modified ").append("Project Version from null").append(" to ").append(oma.getProjectVersionText());
}
if (StringUtils.isNotEmpty(oma.getAttestationSchedule())) {
conSb.append(" 修改了 ").append("认证进度 由 空").append(" 改为 ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName());
conSbEn.append(" modified ").append("Homologation Progress from null").append(" to ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getValue());
}
if (StringUtils.isNotEmpty(oma.getRemark())) {
conSb.append(" 修改了 ").append("备注 由 空").append(" 改为 ").append(oma.getRemark());
conSbEn.append(" modified ").append("Remark from null").append(" to ").append(oma.getRemark());
}
his.setContentCn(conSb.toString());
his.setContentEn(conSbEn.toString());
hisList.add(his);
}
} }
} }
this.saveOrUpdateBatch(list);
otaManageHistoryService.saveBatch(hisList);
} }
@Override @Override