Merge remote-tracking branch 'origin/dev_20230808_OTA' into dev_20230808_OTA

This commit is contained in:
zyx.net
2023-08-25 16:45:35 +08:00
2 changed files with 210 additions and 26 deletions
@@ -13,7 +13,6 @@ import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.jero.modules.ota.entity.OtaManageHistory;
import com.jero.modules.ota.entity.OtaManagePermission;
import com.jero.modules.ota.entity.OtaManageReceive;
import com.jero.modules.ota.entity.OtaManageReceiveNsdpEO;
import com.jero.modules.ota.enums.OtaCarEnum;
import com.jero.modules.ota.enums.OtaHomoImpactEnum;
import com.jero.modules.ota.enums.OtaStatusEnum;
@@ -30,10 +29,12 @@ import com.jero.modules.ota.vo.OtaExportCnVO;
import com.jero.modules.ota.vo.OtaExportEnVO;
import com.jero.modules.ota.vo.VersionVO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectNameInfoEO;
import com.jero.modules.project.entity.ProjectTaskPlanning;
import com.jero.modules.project.enums.CertificationProgressEnum;
import com.jero.modules.project.enums.ComplianceFlowStatusEnum;
import com.jero.modules.project.service.IProjectLibraryBaseService;
import com.jero.modules.project.service.impl.ProjectNameInfoEOServiceImpl;
import com.jero.modules.project.service.impl.ProjectTaskPlanningServiceImpl;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.entity.SysUser;
@@ -60,7 +61,6 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.text.Collator;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -108,6 +108,8 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
@Autowired
private ISysDictService sysDictService;
@Autowired
private ProjectNameInfoEOServiceImpl projectNameInfoEOService;
@Value(value = "${jero.path.upload}")
private String upLoadPath;
@@ -296,6 +298,10 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
@Override
public List<OtaManageApplyEO> getAllCarPage(OtaManageApplyEO otaManageApplyEO) {
List<OtaManageApplyEO> otaManageApplyEOList = this.getBaseMapper().getOtaList(otaManageApplyEO);
//studio数据权限
if(isStudio()) {
otaManageApplyEOList = getStudioData(otaManageApplyEO, otaManageApplyEOList);
}
if (!otaManageApplyEOList.isEmpty()) {
for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) {
manageApplyEO.setVdr(manageApplyEO.getId());
@@ -306,6 +312,42 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
return otaManageApplyEOList;
}
private List<OtaManageApplyEO> getStudioData(OtaManageApplyEO otaManageApplyEO, List<OtaManageApplyEO> otaManageApplyEOList) {
List<OtaManageApplyEO> list = new ArrayList<>();
List<String> studioCarList = getStudioCarList(otaManageApplyEO.getPlannedBpLaunchBatch());
for (String carMarket : studioCarList) {
String[] conditionSplit = carMarket.split(" ");
for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) {
String appliedVehicleProject = manageApplyEO.getAppliedVehicleProject();
if (StringUtils.isNotBlank(appliedVehicleProject)) {
String[] appliedVehicleProjectArr = appliedVehicleProject.split(",");
for (String appliedVehicleProjectTemp : appliedVehicleProjectArr) {
String[] split = appliedVehicleProjectTemp.split(" ");
if (split.length == 1) {
list.add(manageApplyEO);
break;
} else if (split.length == 2) {
if (Arrays.equals(conditionSplit, split)) {
list.add(manageApplyEO);
break;
}
} else if (split.length == 3) {
List<String> listTemp = Arrays.asList(split);
List<String> conditionList = Arrays.asList(conditionSplit);
if (listTemp.containsAll(conditionList)) {
list.add(manageApplyEO);
break;
}
}
}
}
}
}
otaManageApplyEOList= list;
return otaManageApplyEOList;
}
private void heartSort(OtaManageApplyEO otaManageApplyEO, List<OtaManageApplyEO> otaManageApplyEOList) {
Collator comparator = Collator.getInstance(Locale.CHINESE);
// 软件版本,
@@ -646,8 +688,14 @@ 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.isNotEmpty(manageApplyEO.getVehicleType())
&& !manageApplyEO.getVehicleType().equals(otaManageApplyEO.getAppliedVehicleProject())) {
manageApplyEO.setVehicleType(otaManageApplyEO.getAppliedVehicleProject());
manageApplyEO.setId(UUID.randomUUID().toString().replace("-", ""));
manageApplyEO.setProjectVersion(null);
manageApplyEO.setAttestationSchedule(null);
manageApplyEO.setMatchStatus(null);
manageApplyEO.setRemark("--");
}
if (StringUtils.isEmpty(manageApplyEO.getId()) || manageApplyEO.getId().length() < 20) {
manageApplyEO.setId(UUID.randomUUID().toString().replace("-", ""));
@@ -719,7 +767,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
break;
}
}
if(!havePro){
if (!havePro && !ComplianceFlowStatusEnum.UNINVOLVED.getValue().equals(manageApplyEO.getProjectVersion())) {
//找不到项目的话
manageApplyEO.setProjectVersion(null);
manageApplyEO.setStudio(null);
@@ -832,6 +880,40 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
*/
@Override
public List<String> getCarList(String cut, String plannedBpLaunchBatch) {
Set<String> set = new HashSet<>();
if(isStudio()){
List<ProjectNameInfoEO> nameInfoEOList = projectNameInfoEOService.list();
List<DictModel> targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//studio在项目库所拥有的权限的项目
LambdaQueryWrapper<ProjectLibraryBase> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ProjectLibraryBase::getStudioEngineer,currentUser.getId());
List<ProjectLibraryBase> libraryBaseList = projectLibraryBaseService.list(wrapper);
for (ProjectLibraryBase projectLibraryBase : libraryBaseList) {
String carId = projectLibraryBase.getProjectNameId();
String marketId = projectLibraryBase.getTargetMarket();
List<ProjectNameInfoEO> projectNameInfoEOList = nameInfoEOList.stream().filter(e -> e.getId().equals(carId)).collect(Collectors.toList());
String finalMarket = marketId;
List<DictModel> dictModelList = targetMarketList.stream().filter(e -> e.getValue().equals(finalMarket)).collect(Collectors.toList());
if(!projectNameInfoEOList.isEmpty() && !dictModelList.isEmpty()){
String market = dictModelList.get(0).getTextEn();
if ("China".equals(market)) {
//项目库里市场存的是China 不是CN
market = "CN";
} else if ("UK".equals(market)) {
//RHD目前代表UK
market = "RHD";
}
String car = projectNameInfoEOList.get(0).getProjectName();
if("FORCE".equals(car)){
car = "Force";
}
set.add(car + " " + market);
}
}
}
List<OtaManageApplyEO> otaManageApplyEOS = this.getBaseMapper().getOtaCarList(plannedBpLaunchBatch);
List<String> result = new LinkedList<>();
if (CutEnum.CN.getValue().equals(cut)) {
@@ -862,6 +944,75 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
}
}
result = result.stream().distinct().collect(Collectors.toList());
if(isStudio()){
result.retainAll(set);
if (CutEnum.CN.getValue().equals(cut)) {
result.add("全部");
} else {
result.add("All");
}
}
return result;
}
public List<String> getStudioCarList(String plannedBpLaunchBatch) {
Set<String> set = new HashSet<>();
List<ProjectNameInfoEO> nameInfoEOList = projectNameInfoEOService.list();
List<DictModel> targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//studio在项目库所拥有的权限的项目
LambdaQueryWrapper<ProjectLibraryBase> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ProjectLibraryBase::getStudioEngineer, currentUser.getId());
List<ProjectLibraryBase> libraryBaseList = projectLibraryBaseService.list(wrapper);
for (ProjectLibraryBase projectLibraryBase : libraryBaseList) {
String carId = projectLibraryBase.getProjectNameId();
String marketId = projectLibraryBase.getTargetMarket();
List<ProjectNameInfoEO> projectNameInfoEOList = nameInfoEOList.stream().filter(e -> e.getId().equals(carId)).collect(Collectors.toList());
String finalMarket = marketId;
List<DictModel> dictModelList = targetMarketList.stream().filter(e -> e.getValue().equals(finalMarket)).collect(Collectors.toList());
if (!projectNameInfoEOList.isEmpty() && !dictModelList.isEmpty()) {
String market = dictModelList.get(0).getTextEn();
if ("China".equals(market)) {
//项目库里市场存的是China 不是CN
market = "CN";
} else if ("UK".equals(market)) {
//RHD目前代表UK
market = "RHD";
}
String car = projectNameInfoEOList.get(0).getProjectName();
if("FORCE".equals(car)){
car = "Force";
}
set.add(car + " " + market);
}
}
List<OtaManageApplyEO> otaManageApplyEOS = this.getBaseMapper().getOtaCarList(plannedBpLaunchBatch);
List<String> result = new LinkedList<>();
if (!otaManageApplyEOS.isEmpty()) {
//适用车型 appliedVehicleProject
List<String> appliedVehicleProjectList = otaManageApplyEOS.stream()
.filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject()))
.map(OtaManageApplyEO::getAppliedVehicleProject).distinct().collect(Collectors.toList());
//过滤掉特殊的适用车型
List<String> otaNameList = OtaCarEnum.getOtaNameList();
for (String appliedVehicleProject : appliedVehicleProjectList) {
for (String s : appliedVehicleProject.split(",")) {
String[] split = s.split(" ");
if (split.length == 2) {
if (!otaNameList.contains(s)) {
result.add(s);
}
} else if (split.length == 3) {
result.add(split[0] + " " + split[2]);
}
}
}
}
result = result.stream().distinct().collect(Collectors.toList());
result.retainAll(set);
return result;
}
@@ -911,13 +1062,13 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
dictModelList.addAll(dictModelListTemp);
}
String targetMarket = "";
if(dictModelList.size() != 0){
if (dictModelList.size() != 0) {
StringBuilder sb = new StringBuilder();
for (DictModel dictModel : dictModelList) {
sb.append(dictModel.getTextEn()+",");
sb.append(dictModel.getTextEn() + ",");
}
if(StringUtils.isNotBlank(sb)){
targetMarket = sb.substring(0,sb.length()-1);
if (StringUtils.isNotBlank(sb)) {
targetMarket = sb.substring(0, sb.length() - 1);
}
}
versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getYearName() + "-" + targetMarket + "-" + versionVO.getVersionNumber());
@@ -925,9 +1076,9 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
//ComplianceFlowStatusEnum
VersionVO versionVO = new VersionVO();
versionVO.setProjectId("busheji");
versionVO.setProjectId(ComplianceFlowStatusEnum.UNINVOLVED.getValue());
if (CutEnum.CN.getValue().equals(cut)) {
versionVO.setVersionName("不涉及");
versionVO.setVersionName(ComplianceFlowStatusEnum.UNINVOLVED.getCnName());
} else {
versionVO.setVersionName(ComplianceFlowStatusEnum.UNINVOLVED.getEnName());
}
@@ -944,7 +1095,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
* @return
*/
@Override
public List<VersionVO> getVersionInfo(String vdr, String car,String cut) {
public List<VersionVO> getVersionInfo(String vdr, String car, String cut) {
//认证进度数据字典 certification_progress
List<SysDictItem> regionDictList = sysDictItemServiceImpl.selectItemsByDictCode("certification_progress");
@@ -972,12 +1123,12 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<String> list = new LinkedList<>();
for (String s : market.split(",")) {
List<DictModel> collect = regionList.stream().filter(e -> e.getValue().equals(s)).collect(Collectors.toList());
if(!collect.isEmpty()){
if (!collect.isEmpty()) {
list.add(collect.get(0).getTextEn());
}
}
if(!list.isEmpty()){
market = StringUtils.join(list,",");
if (!list.isEmpty()) {
market = StringUtils.join(list, ",");
}
if (StringUtils.isBlank(versionVO.getProjectVersion())) {
versionVO.setVersionName(versionVO.getCar() + "-" + market);
@@ -988,9 +1139,9 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
if (StringUtils.isNotBlank(versionVO.getAttestationSchedule())) {
List<SysDictItem> collect = regionDictList.stream()
.filter(e -> e.getItemValue().equals(versionVO.getAttestationSchedule())).collect(Collectors.toList());
if(CutEnum.CN.getValue().equals(cut)){
if (CutEnum.CN.getValue().equals(cut)) {
versionVO.setAttestationSchedule(collect.get(0).getItemText());
}else{
} else {
versionVO.setAttestationSchedule(collect.get(0).getEnName());
}
}
@@ -1142,20 +1293,48 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
return StringUtils.equals(str1, str2);
}
private Map<String, String> queryProjectName(List<OtaManageApplyEO> list) {
public OtaManageApplyEOServiceImpl() {
super();
}
private Map<String, String> queryProjectName(List<OtaManageApplyEO> list, String cut) {
List<DictModel> regionList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
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.getListByIds(idList);
for (ProjectLibraryBase plb : proList) {
String market = plb.getTargetMarket();
List<String> strlist = new LinkedList<>();
for (String s : market.split(",")) {
List<DictModel> collect = regionList.stream().filter(e -> e.getValue().equals(s)).collect(Collectors.toList());
if (!collect.isEmpty()) {
strlist.add(collect.get(0).getTextEn());
}
}
if (!strlist.isEmpty()) {
market = StringUtils.join(strlist, ",");
}
plb.setTargetMarket(market);
res.put(plb.getId(), plb.getShowName());
}
if (CutEnum.CN.getValue().equals(cut)) {
res.put(ComplianceFlowStatusEnum.UNINVOLVED.getValue(), ComplianceFlowStatusEnum.UNINVOLVED.getCnName());
} else {
res.put(ComplianceFlowStatusEnum.UNINVOLVED.getValue(), ComplianceFlowStatusEnum.UNINVOLVED.getEnName());
}
return res;
}
@Override
public void temporarySave(List<OtaManageApplyEO> list, String cut) {
temporarySave(list, false, cut);
}
public void temporarySave(List<OtaManageApplyEO> list, boolean isSubmit, String cut) {
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (CollectionUtils.isNotEmpty(list)) {
List<String> idList = list.stream()
@@ -1167,7 +1346,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
List<OtaManageApplyEO> queryProNameList = new ArrayList<>();
queryProNameList.addAll(omaOldList);
queryProNameList.addAll(list);
Map<String, String> proNameMap = queryProjectName(queryProNameList);
Map<String, String> proNameMap = queryProjectName(queryProNameList, cut);
//历史记录
List<OtaManageHistory> hisList = new ArrayList<>();
List<OtaManageApplyEO> saveList = new ArrayList<>();
@@ -1190,12 +1369,16 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
conSb.append(user.getUsername()).append(" : ");
conSbEn.append(user.getUsername()).append(" : ");
if (!paramsEquals(oma.getProjectVersion(), omaOld.getProjectVersion())) {
oma.setMatchStatus(OtaStatusEnum.TO_BE_MATCHED.getKey());
if (!isSubmit && OtaStatusEnum.TO_BE_APPROVED.getKey().equals(oma.getMatchStatus())) {
oma.setMatchStatus(OtaStatusEnum.TO_BE_MATCHED.getKey());
}
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())) {
oma.setMatchStatus(OtaStatusEnum.TO_BE_MATCHED.getKey());
if (!isSubmit && OtaStatusEnum.TO_BE_APPROVED.getKey().equals(oma.getMatchStatus())) {
oma.setMatchStatus(OtaStatusEnum.TO_BE_MATCHED.getKey());
}
conSb.append("’认证进度’ 由 ").append(CertificationProgressEnum.getByValue(omaOld.getAttestationSchedule()).getName())
.append(" 改为 ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName()).append(".");
conSbEn.append("Homologation Progress change from ").append(CertificationProgressEnum.getByValue(omaOld.getAttestationSchedule()).getValue())
@@ -1284,7 +1467,8 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
hisList.add(his);
}
}
this.saveOrUpdateBatch(list);
this.temporarySave(list, true, cut);
otaManageHistoryService.saveBatch(hisList);
return msgList;
}
@@ -1487,10 +1671,10 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
}
@Override
public List<Map<String, Object>> getStatisticalStatus(String projectId, String plannedBpLaunchBatch, String cut,List<ProjectLibraryBase> plbEoList) {
public List<Map<String, Object>> getStatisticalStatus(String projectId, String plannedBpLaunchBatch, String cut, List<ProjectLibraryBase> plbEoList) {
List<Map<String, Object>> result = new ArrayList<>();
List<ProjectLibraryBase> projectLibraryBaseList = new ArrayList<>();
if(!plbEoList.isEmpty()){
if (!plbEoList.isEmpty()) {
projectLibraryBaseList = plbEoList.stream().filter(e -> e.getId().equals(projectId)).collect(Collectors.toList());
}
List<OtaManageApplyEO> receiveList = this.getBaseMapper().getListByProjectId(projectId, plannedBpLaunchBatch);
@@ -1587,7 +1771,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue().replace(" ", "_"), stored);
statisticalMap.put("attestationScheduleMap", attestationScheduleMap);
if(!projectLibraryBaseList.isEmpty()){
if (!projectLibraryBaseList.isEmpty()) {
statisticalMap.put("showName", projectLibraryBaseList.get(0).getShowName());
}
result.add(statisticalMap);
@@ -15,7 +15,7 @@ public enum CertificationProgressEnum {
COMPONENT_REPORT_NOT_SUBMITTED("部件报告未提交","Component report not submitted","5"),
COMPONENT_REPORT_SUBMITTED("部件报告已提交","Component report submitted","6"),
COMPONENT_REPORT_HAS_BEEN_STORED("部件报告已入库","Component report has been stored","7"),
NA("","null","8"),
NA("null","null","8"),
;