修改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.impact_cn_homo,omr.impact_eu_homo,
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
left join ota_manage_apply oma on oma.vdr = omr.id
<where>
@@ -196,13 +196,13 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<OtaManageApplyEO> dataList = new ArrayList<>();
//去跟manager和studio权限
if(otaManager){
if (otaManager) {
dataList = otaManageApplyEOList;
}else{
} else {
LambdaQueryWrapper<OtaManagePermission> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OtaManagePermission::getUserId,currentUser.getId());
wrapper.eq(OtaManagePermission::getUserId, currentUser.getId());
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<OtaManageApplyEO> collect = otaManageApplyEOList.stream().filter(e -> applyIdList.contains(e.getPlannedBpLaunchBatch())).collect(Collectors.toList());
dataList = collect;
@@ -223,21 +223,21 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<OtaManageApplyEO> otaManageApplyEOS = dataList.stream()
.filter(e -> plannedBpLaunchBatch.equals(e.getPlannedBpLaunchBatch())).collect(Collectors.toList());
if(!otaManageApplyEOS.isEmpty()){
if (!otaManageApplyEOS.isEmpty()) {
//发布时间
manageApplyEO.setReleaseDate(otaManageApplyEOS.get(0).getReleaseDate());
List<String> appliedVehicleProjectList = otaManageApplyEOS.stream()
.filter(e->StringUtils.isNotBlank(e.getAppliedVehicleProject()))
.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(",")));
}
if(!carList.isEmpty()){
if (!carList.isEmpty()) {
//适用车型
carList = carList.stream().distinct().collect(Collectors.toList());
manageApplyEO.setAppliedVehicleProject(StringUtils.join(carList,","));
manageApplyEO.setAppliedVehicleProject(StringUtils.join(carList, ","));
//市场
for (String appliedVehicleProject : carList) {
Set<String> marketSet = new HashSet<>();
@@ -280,6 +280,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
}
return result;
}
/**
* OTA管理列表和全车型列表-分页列表查询
*
@@ -639,6 +640,9 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
String[] conditionSplit = carMarket.split(" ");
for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) {
if (StringUtils.isNotEmpty(manageApplyEO.getVehicleType()) && !manageApplyEO.getVehicleType().equals(otaManageApplyEO.getAppliedVehicleProject())) {
continue;
}
if (StringUtils.isEmpty(manageApplyEO.getId()) || manageApplyEO.getId().length() < 20) {
manageApplyEO.setId(UUID.randomUUID().toString().replace("-", ""));
}
@@ -680,6 +684,14 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<ProjectTaskPlanning> projectTaskPlanningList = projectTaskPlanningService.queryList(StringUtils.join(projectVersionList, ","));
boolean isDisabled = isDisabled();
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())) {
List<ProjectTaskPlanning> taskPlanningList = projectTaskPlanningList.stream()
.filter(e -> manageApplyEO.getProjectVersion().equals(e.getProjectId())).collect(Collectors.toList());
@@ -1061,76 +1073,85 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
@Override
public void temporarySave(List<OtaManageApplyEO> list, String cut) {
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> idList = list.stream()
.filter(e -> StringUtils.isNotBlank(e.getId()))
.map(OtaManageApplyEO::getId).distinct().collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) {
List<String> idList = list.stream()
.filter(e -> StringUtils.isNotBlank(e.getId()))
.map(OtaManageApplyEO::getId).distinct().collect(Collectors.toList());
//已存在的数据
List<OtaManageApplyEO> omaOldList = this.getBaseMapper().selectBatchIds(idList);
//历史记录
List<OtaManageHistory> hisList = new ArrayList<>();
//已存在的数据
List<OtaManageApplyEO> omaOldList = this.getBaseMapper().selectBatchIds(idList);
//历史记录
List<OtaManageHistory> hisList = new ArrayList<>();
List<OtaManageApplyEO> saveList = new ArrayList<>();
for (OtaManageApplyEO oma : list) {
boolean flag = false;
for (OtaManageApplyEO omaOld : omaOldList) {
flag = true;
if (StringUtils.equals(oma.getProjectVersionText(), omaOld.getProjectVersionText())
|| StringUtils.equals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule())
|| StringUtils.equals(oma.getRemark(), omaOld.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.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());
for (OtaManageApplyEO oma : list) {
if (oma.getId().length() < 20) {
continue;
}
saveList.add(oma);
boolean flag = false;
for (OtaManageApplyEO omaOld : omaOldList) {
flag = true;
if (StringUtils.equals(oma.getProjectVersionText(), omaOld.getProjectVersionText())
|| StringUtils.equals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule())
|| StringUtils.equals(oma.getRemark(), omaOld.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.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())) {
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());
break;
}
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 (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 (saveList.size() > 0) {
this.saveOrUpdateBatch(list);
otaManageHistoryService.saveBatch(hisList);
}
}
this.saveOrUpdateBatch(list);
otaManageHistoryService.saveBatch(hisList);
}
@Override