Ota状态统计

This commit is contained in:
zhn
2024-01-18 19:14:11 +08:00
parent d49e6c9cb9
commit 9d195fb59c
4 changed files with 225 additions and 33 deletions
@@ -1,13 +1,11 @@
package com.jero.modules.ota.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.jero.modules.ota.entity.OtaManageReceiveNsdpEO;
import com.jero.modules.ota.vo.VersionVO;
import org.apache.ibatis.annotations.Param;
import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.pptx4j.pml.STTLTriggerRuntimeNode;
import java.util.List;
@@ -29,6 +27,8 @@ public interface OtaManageApplyEOMapper extends BaseMapper<OtaManageApplyEO> {
*/
List<OtaManageApplyEO> getOtaCarPage(@Param("otaManageApplyEO") OtaManageApplyEO otaManageApplyEO);
List<OtaManageApplyEO> getOtaCarInfoList(@Param("otaManageApplyEO") OtaManageApplyEO otaManageApplyEO);
List<VersionVO> getByAppliedVehicleProject(@Param("appliedVehicleProject") String appliedVehicleProject);
List<OtaManageApplyEO> getOtaCarList(@Param("plannedBpLaunchBatch") String plannedBpLaunchBatch);
@@ -101,6 +101,41 @@
</where>
order by omr.id desc
</select>
<select id="getOtaCarInfoList" resultType="com.jero.modules.ota.entity.OtaManageApplyEO">
select omr.vdr_id,omr.id as vdr,omr.planned_bp_launch_batch,omr.update_date,
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.vehicle_match,omr.is_del,
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_id = omr.vdr_id
<where>
1=1
<if test="otaManageApplyEO.plannedBpLaunchBatch != null and otaManageApplyEO.plannedBpLaunchBatch != ''">
and omr.planned_bp_launch_batch =#{otaManageApplyEO.plannedBpLaunchBatch}
</if>
<if test="otaManageApplyEO.vdr != null and otaManageApplyEO.vdr != ''">
and omr.id LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.vdr}),'%')
</if>
<if test="otaManageApplyEO.summary != null and otaManageApplyEO.summary != ''">
and omr.summary LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.summary}),'%')
</if>
<if test="otaManageApplyEO.impactHomo != null and otaManageApplyEO.impactHomo != ''">
and (omr.impact_cn_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%')
and omr.impact_eu_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%'))
</if>
<if test="otaManageApplyEO.homologationImpact != null and otaManageApplyEO.homologationImpact != ''">
and omr.homologation_impact LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.homologationImpact}),'%')
</if>
<if test="otaManageApplyEO.homologation != null and otaManageApplyEO.homologation != ''">
and omr.homologation LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.homologation}),'%')
</if>
and omr.is_del is null
</where>
order by omr.id desc
</select>
<select id="getByAppliedVehicleProject" resultType="com.jero.modules.ota.vo.VersionVO">
@@ -792,29 +792,191 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
if (StringUtils.isNotBlank(appliedVehicleProject)) {
String[] appliedVehicleProjectArr = appliedVehicleProject.split(",");
for (String appliedVehicleProjectTemp : appliedVehicleProjectArr) {
for (String s : carMarket.split(",")) {
if(s.equals(appliedVehicleProjectTemp)){
omaMap.put(manageApplyEO.getVdr(), manageApplyEO);
break;
if(carMarket.contains(appliedVehicleProjectTemp)){
omaMap.put(manageApplyEO.getVdr(), manageApplyEO);
break;
}
}
}
}
}
List<SysDictItem> regionDictList = sysDictItemServiceImpl.selectItemsByDictCode(DicCodeEnum.CERTIFICATION_PROGRESS.getCode());
list = new ArrayList<>(omaMap.values());
if (!list.isEmpty()) {
List<VersionVO> vprojectVersionList = getProjectVersionList(otaManageApplyEO.getAppliedVehicleProject(), null);
//项目版本id
List<String> projectVersionList = list.stream()
.map(OtaManageApplyEO::getProjectVersion).distinct().collect(Collectors.toList());
//studio
List<ProjectLibraryBase> projectList = projectLibraryBaseService.queryList(projectVersionList);
List<String> studioEngineerUserIdList = projectList.stream().map(ProjectLibraryBase::getStudioEngineer).distinct().collect(Collectors.toList());
List<SysUser> studioEngineerUserInfo = this.sysUserService.querySysUserListByIdList(studioEngineerUserIdList);
String allStudioName = "";
List<String> allStudioIdList = vprojectVersionList.stream()
.map(VersionVO::getStudio).distinct().collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(allStudioIdList)){
List<SysUser> allStudioList = this.sysUserService.querySysUserListByIdList(allStudioIdList);
List<String> allStudioNameList = allStudioList.stream()
.map(SysUser::getUsername).distinct().collect(Collectors.toList());
allStudioName = StringUtils.listToString(allStudioNameList);
}
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("--");
}
if (StringUtils.isNotBlank(manageApplyEO.getProjectVersion())) {
List<ProjectTaskPlanning> taskPlanningList = projectTaskPlanningList.stream()
.filter(e -> manageApplyEO.getProjectVersion().equals(e.getProjectId())).collect(Collectors.toList());
//设置认证开始,认证批准,认证申报
if (!taskPlanningList.isEmpty()) {
Date attestationStartTime = taskPlanningList.get(0).getAttestationStartTime();//认证开始
Date attestationEndTime = taskPlanningList.get(0).getAttestationEndTime();//认证批准
Date certificationSubmission = taskPlanningList.get(0).getCertificationSubmission();//认证申报
manageApplyEO.setAttestationStartTime(attestationStartTime);
manageApplyEO.setAttestationEndTime(attestationEndTime);
manageApplyEO.setCertificationSubmission(certificationSubmission);
}
//设置studio
boolean havePro = false;
for (ProjectLibraryBase pro : projectList) {
if (pro.getId().equals(manageApplyEO.getProjectVersion())) {
manageApplyEO.setStudio(pro.getStudioEngineer());
havePro = true;
break;
}
}
if (!havePro && !ComplianceFlowStatusEnum.UNINVOLVED.getValue().equals(manageApplyEO.getProjectVersion())) {
//找不到项目的话
manageApplyEO.setProjectVersion(null);
manageApplyEO.setStudio(null);
manageApplyEO.setAttestationEndTime(null);
manageApplyEO.setAttestationStartTime(null);
manageApplyEO.setCertificationSubmission(null);
}
if (StringUtils.isNotEmpty(manageApplyEO.getStudio())) {
if (CollectionUtils.isNotEmpty(studioEngineerUserInfo)) {
String studioEngineerUserName = studioEngineerUserInfo.stream().filter(studioEngineerUser -> {
boolean flag = false;
if (StringUtils.equals(manageApplyEO.getStudio(), studioEngineerUser.getId())) {
flag = true;
}
return flag;
}).map(SysUser::getUsername).collect(Collectors.joining(","));
manageApplyEO.setStudioText(studioEngineerUserName);
}
}
//项目版本
List<VersionVO> collect = vprojectVersionList.stream().filter(e -> e.getProjectId().equals(manageApplyEO.getProjectVersion())).distinct().collect(Collectors.toList());
if (!collect.isEmpty()) {
if("NA".equals(collect.get(0).getProjectId())){
if (CutEnum.CN.getValue().equals(cut)) {
manageApplyEO.setProjectVersionText("不涉及");
} else {
manageApplyEO.setProjectVersionText("NA");
}
}else{
manageApplyEO.setProjectVersionText(collect.get(0).getCar() + "-" + collect.get(0).getYearName() + "-" + collect.get(0).getMarket()+"-"+collect.get(0).getVersionNumber() );
}
}
}else{
//没有设置项目版本的情况
manageApplyEO.setStudioText(allStudioName);
}
manageApplyEO.setDisabled(isDisabled || OtaStatusEnum.LOCKED.getKey().equals(manageApplyEO.getMatchStatus()));
if (StringUtils.isBlank(manageApplyEO.getRemark())) {
manageApplyEO.setRemark("--");
}
if (OtaHomoImpactEnum.YES.getValue().equals(manageApplyEO.getHomologationImpact())
|| OtaHomoImpactEnum.INTER_VALID.getValue().equals(manageApplyEO.getHomologationImpact())) {
manageApplyEO.setMatchStatus(OtaStatusEnum.NA.getKey());
manageApplyEO.setDisabled(true);
}
if(isRegulationOwner && !isStudio){
manageApplyEO.setDisabled(true);
}
if ((StringUtils.isNotBlank(manageApplyEO.getIsDel()) && manageApplyEO.getIsDel().equals("1"))
|| (StringUtils.isNotBlank(manageApplyEO.getStatus()) && manageApplyEO.getStatus().equals("Discard"))) {
manageApplyEO.setDiscard(true);
manageApplyEO.setDisabled(true);
}
if (StringUtils.isNotBlank(manageApplyEO.getAttestationSchedule())) {
List<SysDictItem> collect = regionDictList.stream()
.filter(e -> e.getItemValue().equals(manageApplyEO.getAttestationSchedule())).collect(Collectors.toList());
if (CutEnum.CN.getValue().equals(cut)) {
manageApplyEO.setAttestationScheduleText(collect.get(0).getItemText());
} else {
manageApplyEO.setAttestationScheduleText(collect.get(0).getEnName());
}
}
if (StringUtils.isBlank(manageApplyEO.getMatchStatus())) {
manageApplyEO.setMatchStatus(OtaStatusEnum.TO_BE_MATCHED.getKey());
if (CutEnum.CN.getValue().equals(cut)) {
manageApplyEO.setMatchStatusText(OtaStatusEnum.TO_BE_MATCHED.getNameCN());
} else {
manageApplyEO.setMatchStatusText(OtaStatusEnum.TO_BE_MATCHED.getNameEN());
}
} else {
OtaStatusEnum osEnum = OtaStatusEnum.getByKey(manageApplyEO.getMatchStatus());
if (CutEnum.CN.getValue().equals(cut)) {
manageApplyEO.setMatchStatusText(osEnum.getNameCN());
} else {
manageApplyEO.setMatchStatusText(osEnum.getNameEN());
}
}
}
}
if (!list.isEmpty()) {
//表头排序
heartSort(otaManageApplyEO, list);
}
return list;
}
public List<OtaManageApplyEO> getOtaCarInfoList(OtaManageApplyEO otaManageApplyEO, String cut) {
if(!hasPermission(otaManageApplyEO.getPlannedBpLaunchBatch())){
return new ArrayList<>();
}
boolean isStudio = isStudio();
boolean isRegulationOwner = isRegulationOwner();
List<OtaManageApplyEO> otaManageApplyEOList = this.getBaseMapper().getOtaCarPage(otaManageApplyEO);
List<OtaManageApplyEO> list = new ArrayList<>();
Map<String, OtaManageApplyEO> omaMap = new HashMap<>();
String carMarket = otaManageApplyEO.getAppliedVehicleProject();
if (StringUtils.isNotBlank(carMarket) && !"全部".equals(carMarket) && !"All".equals(carMarket) && !otaManageApplyEOList.isEmpty()) {
String[] conditionSplit = carMarket.split(" ");
for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) {
if (omaMap.containsKey(manageApplyEO.getVdr())
&& StringUtils.isNotEmpty(omaMap.get(manageApplyEO.getVdr()).getVehicleType())
&& omaMap.get(manageApplyEO.getVdr()).getVehicleType().equals(otaManageApplyEO.getAppliedVehicleProject())) {
continue;
} else {
if (!otaManageApplyEO.getAppliedVehicleProject().equals(manageApplyEO.getVehicleType())) {
manageApplyEO.setId(UUID.randomUUID().toString().replace("-", ""));
manageApplyEO.setProjectVersion(null);
manageApplyEO.setAttestationSchedule(null);
manageApplyEO.setMatchStatus(null);
manageApplyEO.setRemark("--");
manageApplyEO.setVehicleType("");
}
}
String appliedVehicleProject = manageApplyEO.getVehicleMatch();
if (StringUtils.isNotBlank(appliedVehicleProject)) {
String[] appliedVehicleProjectArr = appliedVehicleProject.split(",");
for (String appliedVehicleProjectTemp : appliedVehicleProjectArr) {
if(carMarket.contains(appliedVehicleProjectTemp)){
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;
// }
// }
}
}
}
@@ -2101,13 +2263,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
OtaManageApplyEO otaManageApplyEO = new OtaManageApplyEO();
otaManageApplyEO.setPlannedBpLaunchBatch(plannedBpLaunchBatch);
otaManageApplyEO.setAppliedVehicleProject(appliedVehicleProject);
List<OtaManageApplyEO> receiveList = getOtaCarPage(otaManageApplyEO,cut);
// List<OtaManageApplyEO> receiveList = this.getBaseMapper().getListByProjectId(null, plannedBpLaunchBatch);
// receiveList = receiveList.stream()
// .filter(e -> (StringUtils.isNotBlank(e.getProjectVersion()) && projectId.equals(e.getProjectVersion()))
// || (StringUtils.isBlank(e.getProjectVersion()) && "to_be_matched".equals(e.getMatchStatus())))
// .collect(Collectors.toList());
List<OtaManageApplyEO> receiveList = getOtaCarInfoList(otaManageApplyEO,cut);
if (!receiveList.isEmpty()) {
List<String> plannedBpLaunchBatchList = receiveList.stream()
@@ -3993,6 +3993,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
}
private void exportOtaCollecting(HSSFWorkbook workbook, Map<String, Object> params) {
String cut = (String) params.get("cut");
String appliedVehicleProject = (String) params.get("appliedVehicleProject");
String sheetName = "OTA状态";
String firstTitle = "匹配状态统计,OTA认证进度统计";
String secondTitle = "软件版本,待匹配,待审批,锁定,退回,未开始,进行中,实验通过,实验失败,部件报告未提交,部件报告已提交,部件报告已入库";
@@ -4040,7 +4041,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
}
String projectLibraryId = (String) params.get("projectLibraryId");
List<Map<String, Object>> mapList = otaManageApplyEOService.getStatisticalStatus(projectLibraryId, null, cut,null,null);
List<Map<String, Object>> mapList = otaManageApplyEOService.getStatisticalStatus(projectLibraryId, null, cut,null,appliedVehicleProject);
if(ObjectUtils.isNotEmpty(mapList)){
int dataIndex = 2;