修改OTA待办中心

This commit is contained in:
高嵩
2023-09-17 18:56:31 +08:00
parent 5ac493610b
commit c02f35a118
10 changed files with 252 additions and 55 deletions
@@ -8,6 +8,7 @@ import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.util.PageUtil;
import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.jero.modules.ota.entity.OtaManageReceiveNsdp;
import com.jero.modules.ota.service.IOtaManageApplyEOService;
import com.jero.modules.ota.vo.VersionVO;
import com.jero.modules.project.entity.ProjectLibraryBase;
@@ -344,5 +345,20 @@ public class OtaManageApplyEOController extends JeroController<OtaManageApplyEO,
return otaManageApplyEOService.oneCarExportXls(request, otaManageApplyEO);
}
/**
* OTA管理待办中心列表
*/
@AutoLog(value = "OTA管理列表和全车型列表-OTA管理待办中心列表")
@ApiOperation(value="OTA管理列表和全车型列表-OTA管理待办中心列表", notes="OTA管理列表和全车型列表-OTA管理待办中心列表")
@GetMapping(value = "/getOtaTodoList")
public Result<?> getOtaTodoList(OtaManageReceiveNsdp otaManageReceiveNsdp,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
List<OtaManageReceiveNsdp> list = otaManageApplyEOService.getOtaTodoList(otaManageReceiveNsdp);
Page pages = PageUtil.getPages(pageNo, pageSize, list);
return Result.OK(pages);
}
}
@@ -221,6 +221,10 @@ public class OtaManageApplyEO implements Serializable {
@ApiModelProperty(value = "发布类型")
private String releaseType;
@TableField(exist = false)
@ApiModelProperty(value = "车型(匹配版本号后)")
private String vehicleMatch;
@TableField(exist = false)
@ApiModelProperty(value = "中英文切换")
private String cut;
@@ -71,4 +71,9 @@ public class OtaManagePermission implements Serializable {
@ApiModelProperty(value = "对应applyID")
private String applyId;
/**车型*/
@Excel(name = "车型", width = 15)
@ApiModelProperty(value = "车型")
private String vehicle;
}
@@ -116,6 +116,16 @@ public class OtaManageReceive implements Serializable {
@ApiModelProperty(value = "发布时间")
private String releaseDate;
/**车型(匹配版本号后)*/
@Excel(name = "车型(匹配版本号后)", width = 15)
@ApiModelProperty(value = "车型(匹配版本号后)")
private String vehicleMatch;
/**发布类型*/
@Excel(name = "发布类型", width = 15)
@ApiModelProperty(value = "发布类型")
private String releaseType;
}
@@ -17,6 +17,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Service
public class OtaDataUpdate implements Job {
@@ -93,7 +94,6 @@ public class OtaDataUpdate implements Job {
otaManageReceiveService.updateBatchById(updateList);
}
List<OtaManageReceiveNsdp> omrnSyncList = otaManageReceiveNsdpService.getOtaManageReceiveNsdpSync();
List<OtaManageReceiveNsdp> omrnList = otaManageReceiveNsdpService.queryList();
@@ -117,9 +117,6 @@ public class OtaDataUpdate implements Job {
}
}
Map<String, Date> releaceDateMap = new HashMap<>();
Date today = new Date();
for (OtaManageReceiveNsdp omrnSync : omrnSyncList) {
boolean addFlag = true;
for (OtaManageReceiveNsdp omrn : omrnList) {
@@ -138,20 +135,7 @@ public class OtaDataUpdate implements Job {
}
addNsdpList.add(omrnSync);
}
//找到最快来临的发布时间
Date releaceDate = releaceDateMap.get(omrnSync.getReleaseName());
try {
Date syncDate = sdf.parse(omrnSync.getReleaseDate());
if (null == releaceDate) {
releaceDateMap.put(omrnSync.getReleaseName(), syncDate);
} else {
if (syncDate.after(today) && syncDate.before(releaceDate)) {
releaceDateMap.put(omrnSync.getReleaseName(), syncDate);
}
}
} catch (ParseException e) {
e.printStackTrace();
}
}
if (CollectionUtils.isNotEmpty(addNsdpList)) {
@@ -164,14 +148,101 @@ public class OtaDataUpdate implements Job {
otaManageReceiveNsdpService.updateBatchById(updateNsdpList);
}
//记录发布时间
Map<String, Date> releaceDateMap = new HashMap<>();
//记录车型列表
Map<String ,Set<String>> omrnVehicleMap = new HashMap<>();
Map<String ,String> releaceTypeMap = new HashMap<>();
Date today = new Date();
List<OtaManageReceiveNsdp> omrnLastList = otaManageReceiveNsdpService.queryList();
for (OtaManageReceiveNsdp omrn : omrnLastList) {
//找到最快来临的发布时间
Date releaceDate = releaceDateMap.get(omrn.getReleaseName());
try {
Date syncDate = sdf.parse(omrn.getReleaseDate());
if (null == releaceDate) {
releaceDateMap.put(omrn.getReleaseName(), syncDate);
} else {
if (syncDate.after(today) && syncDate.before(releaceDate)) {
releaceDateMap.put(omrn.getReleaseName(), syncDate);
}
}
} catch (ParseException e) {
e.printStackTrace();
}
//处理车型字符串
Set<String> vehicleSet = omrnVehicleMap.get(omrn.getReleaseName());
if(null == vehicleSet){
vehicleSet = new HashSet<>();
}
String appliedVehicleProject = omrn.getVehicle();
if(StringUtils.isNotEmpty(appliedVehicleProject)){
for (String s : appliedVehicleProject.split(",")) {
String[] split = s.split(" ");
if (split.length == 3) {
String projectName = split[0];
String market = split[2];
vehicleSet.add(projectName + " " + market);
}
}
}
omrnVehicleMap.put(omrn.getReleaseName(),vehicleSet);
releaceTypeMap.put(omrn.getReleaseName(),omrn.getReleaseType());
}
//开始刷新 otaManageReceive中的车型和发布时间
List<OtaManageReceive> dateUpdateList = new ArrayList<>();
List<OtaManageReceive> omrListForDate = otaManageReceiveService.queryList();
for (OtaManageReceive omr : omrListForDate) {
//处理发布时间
if (releaceDateMap.containsKey(omr.getPlannedBpLaunchBatch())) {
omr.setReleaseDate(sdf.format(releaceDateMap.get(omr.getPlannedBpLaunchBatch())));
dateUpdateList.add(omr);
}
//处理车型
String appliedVehicleProject = omr.getAppliedVehicleProject();
Set<String> vehicleSet = new HashSet<>();
if(StringUtils.isNotEmpty(appliedVehicleProject)){
Set<String> omrnVehicleSet = omrnVehicleMap.get(omr.getPlannedBpLaunchBatch());
if(CollectionUtils.isEmpty(omrnVehicleSet)){
omrnVehicleSet = new HashSet<>();
}
for (String s : appliedVehicleProject.split(",")) {
String[] split = s.split(" ");
if (split.length == 1 && "All".equals(split[0])) {
vehicleSet.addAll(omrnVehicleSet);
}else if (split.length == 2) {
if("All".equals(split[1])){
for (String val : omrnVehicleSet) {
if(val.contains(split[0])){
vehicleSet.add(val);
}
}
}else{
for (String val : omrnVehicleSet) {
if(val.contains(s)){
vehicleSet.add(val);
}
}
}
}else if (split.length == 3) {
for (String val : omrnVehicleSet) {
if(val.contains(split[0]+" "+split[2])){
vehicleSet.add(val);
}
}
}
}
if(!vehicleSet.isEmpty()){
omr.setVehicleMatch(vehicleSet.stream().collect(Collectors.joining(",")));
}
omr.setReleaseType(releaceTypeMap.get(omr.getPlannedBpLaunchBatch()));
}
dateUpdateList.add(omr);
}
if (CollectionUtils.isNotEmpty(dateUpdateList)) {
otaManageReceiveService.updateBatchById(dateUpdateList);
@@ -72,7 +72,7 @@
omr.summary,omr.status,
omr.homologation_impact,omr.homologation,
omr.impact_cn_homo,omr.impact_eu_homo,
omr.master_domain,omr.applied_vehicle_project,
omr.master_domain,omr.applied_vehicle_project,omr.vehicle_match,
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
@@ -92,9 +92,6 @@
and (omr.impact_cn_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%')
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}),'%')
</if>
<if test="otaManageApplyEO.homologationImpact != null and otaManageApplyEO.homologationImpact != ''">
and omr.homologation_impact LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.homologationImpact}),'%')
</if>
@@ -2,6 +2,7 @@ package com.jero.modules.ota.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.jero.modules.ota.entity.OtaManageReceiveNsdp;
import com.jero.modules.ota.vo.VersionVO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import org.springframework.web.servlet.ModelAndView;
@@ -134,4 +135,6 @@ public interface IOtaManageApplyEOService extends IService<OtaManageApplyEO> {
ModelAndView allCarExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO);
ModelAndView oneCarExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO);
List<OtaManageReceiveNsdp> getOtaTodoList(OtaManageReceiveNsdp otaManageReceiveNsdp);
}
@@ -4,6 +4,7 @@ import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.jero.modules.ota.entity.OtaManageReceive;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* @Description: OTA管理
@@ -64,6 +65,8 @@ public interface IOtaManageReceiveService extends IService<OtaManageReceive> {
List<OtaManageReceive> getReceiveByplanned(String plannedBpLaunchBatch);
List<OtaManageReceive> getReceiveByplannedList(List<String> plannedBpLaunchBatchList);
List<OtaManageReceive> getReceiveSync();
@@ -833,27 +833,31 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
manageApplyEO.setVehicleType("");
}
}
String appliedVehicleProject = manageApplyEO.getAppliedVehicleProject();
String appliedVehicleProject = manageApplyEO.getVehicleMatch();
if (StringUtils.isNotBlank(appliedVehicleProject)) {
String[] appliedVehicleProjectArr = appliedVehicleProject.split(",");
for (String appliedVehicleProjectTemp : appliedVehicleProjectArr) {
String[] split = appliedVehicleProjectTemp.split(" ");
if (split.length == 1) {
if(carMarket.equals(appliedVehicleProjectTemp)){
omaMap.put(manageApplyEO.getVdr(), manageApplyEO);
break;
} else if (split.length == 2) {
if (Arrays.equals(conditionSplit, split)) {
omaMap.put(manageApplyEO.getVdr(), manageApplyEO);
break;
}
} else if (split.length == 3) {
List<String> listTemp = Arrays.asList(split);
List<String> conditionList = Arrays.asList(conditionSplit);
if (listTemp.containsAll(conditionList)) {
omaMap.put(manageApplyEO.getVdr(), manageApplyEO);
break;
}
}
// String[] split = appliedVehicleProjectTemp.split(" ");
// if (split.length == 1) {
// omaMap.put(manageApplyEO.getVdr(), manageApplyEO);
// break;
// } else if (split.length == 2) {
// if (Arrays.equals(conditionSplit, split)) {
// omaMap.put(manageApplyEO.getVdr(), manageApplyEO);
// break;
// }
// } else if (split.length == 3) {
// List<String> listTemp = Arrays.asList(split);
// List<String> conditionList = Arrays.asList(conditionSplit);
// if (listTemp.containsAll(conditionList)) {
// omaMap.put(manageApplyEO.getVdr(), manageApplyEO);
// break;
// }
// }
}
}
}
@@ -1449,7 +1453,6 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
*/
List<OtaManageReceiveNsdp> dataList = otaManageReceiveNsdpService.getListByReleaseName(id);
//车型
Set<String> vehicleSet = new HashSet<>();
@@ -1459,15 +1462,8 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
for (String s : appliedVehicleProject.split(",")) {
String[] split = s.split(" ");
if (split.length == 3) {
String projectName = split[0].toUpperCase(Locale.ROOT);
String market = "";
if (split[2].equals("CN")) {
market = "China";
} else if (split[2].equals("RHD")) {
market = "UK";
} else {
market = split[2];
}
String projectName = split[0];
String market = split[2];
vehicleSet.add(projectName + " " + market);
}
}
@@ -1478,33 +1474,50 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
ProjectLibraryBase plbSearch = new ProjectLibraryBase();
plbSearch.setDigitalPlatform("NT2");
List<ProjectLibraryBase> plbList = projectLibraryBaseService.getList(plbSearch);
//存储符合条件的项目中Studio的用户ID
Set<String> matchStudioSet = new HashSet();
//存储符合条件的项目中Studio的用户ID,value车型列表
Map<String,Set<String>> matchStudioMap = new HashMap<>();
for (ProjectLibraryBase plb : plbList) {
String projectName = plb.getProjectName().toUpperCase(Locale.ROOT);
String projectName = plb.getProjectName();
if(projectName.equals("FORCE")){
projectName = "Force";
}
boolean flag = false;
String targetMarket = plb.getTargetMarket();
String[] targetMarkets = targetMarket.split(",");
for (String tm : targetMarkets) {
String vehicleStr =projectName + " " + tm;
String tmStr = tm.trim();
if (tm.equals("China")) {
tmStr = "CN";
} else if (tm.equals("UK")) {
tmStr = "RHD";
}
String vehicleStr = projectName + " " + tmStr;
if (vehicleSet.contains(vehicleStr)) {
matchStudioSet.add(plb.getStudioEngineer());
Set vehset = null;
if (matchStudioMap.containsKey(plb.getStudioEngineer())) {
vehset = matchStudioMap.get(plb.getStudioEngineer());
} else {
vehset = new HashSet<>();
}
vehset.add(vehicleStr);
matchStudioMap.put(plb.getStudioEngineer(), vehset);
}
}
}
List<OtaManagePermission> ompList = new ArrayList<>();
for (String studioId : matchStudioSet) {
for (String studioId : matchStudioMap.keySet()) {
OtaManagePermission omp = new OtaManagePermission();
omp.setApplyId(id);
omp.setUserId(studioId);
omp.setVehicle(matchStudioMap.get(studioId).stream().collect(Collectors.joining(",")));
ompList.add(omp);
}
otaManagePermissionService.saveBatch(ompList);
//给studio发消息
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Map<String, Object> params = new HashMap<>();
List<String> userIdList = new ArrayList<>(matchStudioSet);
List<String> userIdList = new ArrayList<>(matchStudioMap.keySet());
params.put("userIdList", userIdList);
params.put("contentCn", "您好,请及时查看处理此项任务,谢谢!-请在PC端查看");
params.put("contentEn", "Hello! Please check and address the task in a timely manner. Thank you!-Check on the PC");
@@ -2264,4 +2277,62 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
}
public List<OtaManageApplyEO> getListByVdrList(List<String> vdrList) {
if(CollectionUtils.isEmpty(vdrList)){
return new ArrayList<>();
}
QueryWrapper<OtaManageApplyEO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(OtaManageApplyEO::getVdr, vdrList);
List<OtaManageApplyEO> resList = this.list(queryWrapper);
return resList;
}
@Override
public List<OtaManageReceiveNsdp> getOtaTodoList(OtaManageReceiveNsdp otaManageReceiveNsdp) {
List<OtaManageReceiveNsdp> resList = new ArrayList<>();
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = user.getId();
//查询所有此人权限
List<OtaManagePermission> ompList = otaManagePermissionService.queryByUserId(userId);
//筛选版本号ID
List<String> plannedList = ompList.stream().map(OtaManagePermission::getApplyId).distinct().collect(Collectors.toList());
//查询所有VDR
List<OtaManageReceive> omrList = otaManageReceiveService.getReceiveByplannedList(plannedList);
List<String> vdrList = omrList.stream().map(OtaManageReceive::getId).distinct().collect(Collectors.toList());
List<OtaManageApplyEO> omaList = this.getListByVdrList(vdrList);
for (OtaManagePermission omp : ompList) {
String vehicleStr = omp.getVehicle();
String[] vehicleList = vehicleStr.split(",");
for (String vehicle : vehicleList) {
List<OtaManageReceive> omrVehicleList = omrList.stream()
.filter(obj -> StringUtils.isNotEmpty(obj.getPlannedBpLaunchBatch()) && obj.getPlannedBpLaunchBatch().equals(omp.getApplyId())
&& StringUtils.isNotEmpty(obj.getVehicleMatch()) && obj.getVehicleMatch().contains(vehicle))
.collect(Collectors.toList());
for (OtaManageReceive mrVehicle : omrVehicleList) {
if (!OtaHomoImpactEnum.YES.getValue().equals(mrVehicle.getHomologationImpact())
&& !OtaHomoImpactEnum.INTER_VALID.getValue().equals(mrVehicle.getHomologationImpact())) {
List<OtaManageApplyEO> applyList = omaList.stream()
.filter(obj -> StringUtils.isNotEmpty(obj.getVdr()) && obj.getVdr().equals(mrVehicle.getId())
&& StringUtils.isNotEmpty(obj.getVehicleType()) && obj.getVehicleType().equals(vehicle))
.collect(Collectors.toList());
if(CollectionUtils.isEmpty(applyList) || OtaStatusEnum.TO_BE_MATCHED.getKey().equals(applyList.get(0).getMatchStatus())){
OtaManageReceiveNsdp omrn = new OtaManageReceiveNsdp();
omrn.setId(UUID.randomUUID().toString().replace("-", ""));
omrn.setReleaseName(omp.getApplyId());
omrn.setReleaseType(mrVehicle.getReleaseType());
omrn.setVehicle(vehicle);
omrn.setReleaseDate(mrVehicle.getReleaseDate());
resList.add(omrn);
break;
}
}
}
}
}
return resList;
}
}
@@ -4,9 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.modules.ota.entity.OtaManageReceive;
import com.jero.modules.ota.mapper.OtaManageReceiveMapper;
import com.jero.modules.ota.service.IOtaManageReceiveService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Date;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
@@ -100,6 +106,17 @@ public class OtaManageReceiveServiceImpl extends ServiceImpl<OtaManageReceiveMap
return this.list(queryWrapper);
}
@Override
public List<OtaManageReceive> getReceiveByplannedList(List<String> plannedBpLaunchBatchList) {
if(CollectionUtils.isEmpty(plannedBpLaunchBatchList)){
return new ArrayList<>();
}
QueryWrapper<OtaManageReceive> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(OtaManageReceive::getPlannedBpLaunchBatch, plannedBpLaunchBatchList);
List<OtaManageReceive> resList = this.list(queryWrapper);
return resList;
}
@Override
public List<OtaManageReceive> getReceiveSync() {
return this.getBaseMapper().getReceiveSync();