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

This commit is contained in:
zyx.net
2023-08-25 09:29:09 +08:00
9 changed files with 481 additions and 209 deletions
@@ -167,16 +167,16 @@ public class OtaManageApplyEOController extends JeroController<OtaManageApplyEO,
@AutoLog(value = "项目版本下拉数据")
@ApiOperation(value="项目版本下拉数据", notes="项目版本下拉数据")
@GetMapping(value = "/getProjectVersionList")
public Result<?> getProjectVersionList(String carMarket) {
List<VersionVO> result = otaManageApplyEOService.getProjectVersionList(carMarket);
public Result<?> getProjectVersionList(String carMarket,String cut) {
List<VersionVO> result = otaManageApplyEOService.getProjectVersionList(carMarket,cut);
return Result.OK(result);
}
@AutoLog(value = "全车型和分车型详情")
@ApiOperation(value="分车型详情", notes="分车型详情")
@GetMapping(value = "/getVersionInfo")
public Result<?> getVersionInfo(String vdr) {
List<VersionVO> result = otaManageApplyEOService.getVersionInfo(vdr);
public Result<?> getVersionInfo(String vdr,String car) {
List<VersionVO> result = otaManageApplyEOService.getVersionInfo(vdr,car);
return Result.OK(result);
}
@@ -292,8 +292,12 @@ public class OtaManageApplyEOController extends JeroController<OtaManageApplyEO,
@ApiOperation(value = "通过软件版本和项目ID查询状态", notes = "通过软件版本和项目ID查询状态")
@GetMapping(value = "/getStatisticalStatus")
public Result<?> getStatisticalStatus(String projectId, String plannedBpLaunchBatch, String cut) {
Map<String, Object> res = otaManageApplyEOService.getStatisticalStatus(projectId, plannedBpLaunchBatch, cut);
return Result.OK("操作成功!", res);
List<Map<String, Object>> res = otaManageApplyEOService.getStatisticalStatus(projectId, plannedBpLaunchBatch, cut);
if(!res.isEmpty()){
return Result.OK("操作成功!", res.get(0));
}else{
return Result.OK("操作成功!", new HashMap<>());
}
}
/**
@@ -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>
@@ -134,7 +134,7 @@
ptp.certification_submission,
oma.attestation_schedule,
oma.project_version,
pni.project_name,
pni.project_name car,
pyni.year_name
FROM
project_library_base plb
@@ -102,14 +102,14 @@ public interface IOtaManageApplyEOService extends IService<OtaManageApplyEO> {
* @param carMarket
* @return
*/
List<VersionVO> getProjectVersionList(String carMarket);
List<VersionVO> getProjectVersionList(String carMarket,String cut);
/**
* 全车型和分车型详情
* @param vdr
* @return
*/
List<VersionVO> getVersionInfo(String vdr);
List<VersionVO> getVersionInfo(String vdr,String car);
void issueNotice(String id);
@@ -127,7 +127,7 @@ public interface IOtaManageApplyEOService extends IService<OtaManageApplyEO> {
List<OtaManageApplyEO> getVdrListByProject(String projectId, String cut);
Map<String, Object> getStatisticalStatus(String projectId, String plannedBpLaunchBatch, String cut);
List<Map<String, Object>> getStatisticalStatus(String projectId, String plannedBpLaunchBatch, String cut);
ModelAndView otaExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO);
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.DateUtils;
import com.jero.common.util.oConvertUtils;
@@ -31,13 +32,16 @@ import com.jero.modules.ota.vo.VersionVO;
import com.jero.modules.project.entity.ProjectLibraryBase;
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.ProjectTaskPlanningServiceImpl;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.entity.SysUserRole;
import com.jero.modules.system.enums.DicCodeEnum;
import com.jero.modules.system.enums.RoleEnum;
import com.jero.modules.system.mapper.SysUserRoleMapper;
import com.jero.modules.system.service.ISysDictService;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysBaseApiImpl;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
@@ -102,6 +106,8 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
@Autowired
private IOtaManagePermissionService otaManagePermissionService;
@Autowired
private ISysDictService sysDictService;
@Value(value = "${jero.path.upload}")
private String upLoadPath;
@@ -196,13 +202,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 +229,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 +286,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
}
return result;
}
/**
* OTA管理列表和全车型列表-分页列表查询
*
@@ -639,6 +646,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("-", ""));
}
@@ -668,7 +678,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
}
}
if (!list.isEmpty()) {
List<VersionVO> vprojectVersionList = getProjectVersionList(otaManageApplyEO.getAppliedVehicleProject());
List<VersionVO> vprojectVersionList = getProjectVersionList(otaManageApplyEO.getAppliedVehicleProject(), null);
//项目版本id
List<String> projectVersionList = list.stream()
.map(OtaManageApplyEO::getProjectVersion).distinct().collect(Collectors.toList());
@@ -680,6 +690,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("--");
}
if (StringUtils.isNotBlank(manageApplyEO.getProjectVersion())) {
List<ProjectTaskPlanning> taskPlanningList = projectTaskPlanningList.stream()
.filter(e -> manageApplyEO.getProjectVersion().equals(e.getProjectId())).collect(Collectors.toList());
@@ -693,12 +711,22 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
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){
//找不到项目的话
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 -> {
@@ -717,9 +745,9 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
manageApplyEO.setProjectVersionText(collect.get(0).getCar() + "-" + collect.get(0).getYearName() + "-" + collect.get(0).getMarket());
}
}
manageApplyEO.setDisabled(isDisabled);
manageApplyEO.setDisabled(isDisabled || OtaStatusEnum.LOCKED.getKey().equals(manageApplyEO.getMatchStatus()));
if (StringUtils.isBlank(manageApplyEO.getRemark())) {
manageApplyEO.setRemark("-");
manageApplyEO.setRemark("--");
}
if (OtaHomoImpactEnum.YES.getValue().equals(manageApplyEO.getHomologationImpact())
|| OtaHomoImpactEnum.INTER_VALID.getValue().equals(manageApplyEO.getHomologationImpact())) {
@@ -803,7 +831,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
* @return
*/
@Override
public List<String> getCarList(String cut,String plannedBpLaunchBatch) {
public List<String> getCarList(String cut, String plannedBpLaunchBatch) {
List<OtaManageApplyEO> otaManageApplyEOS = this.getBaseMapper().getOtaCarList(plannedBpLaunchBatch);
List<String> result = new LinkedList<>();
if (CutEnum.CN.getValue().equals(cut)) {
@@ -838,7 +866,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
}
@Override
public List<VersionVO> getProjectVersionList(String carMarket) {
public List<VersionVO> getProjectVersionList(String carMarket, String cut) {
List<VersionVO> result = new LinkedList<>();
if (StringUtils.isNotBlank(carMarket)) {
@@ -874,9 +902,36 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
});
result.addAll(collect);
}
List<DictModel> targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
for (VersionVO versionVO : result) {
versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getYearName() + "-" + versionVO.getMarket() + "-" + versionVO.getVersionNumber());
List<DictModel> dictModelList = new ArrayList<>();
for (String s : versionVO.getMarket().split(",")) {
List<DictModel> dictModelListTemp = targetMarketList.stream()
.filter(e -> s.equals(e.getValue())).collect(Collectors.toList());
dictModelList.addAll(dictModelListTemp);
}
String targetMarket = "";
if(dictModelList.size() != 0){
StringBuilder sb = new StringBuilder();
for (DictModel dictModel : dictModelList) {
sb.append(dictModel.getTextEn()+",");
}
if(StringUtils.isNotBlank(sb)){
targetMarket = sb.substring(0,sb.length()-1);
}
}
versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getYearName() + "-" + targetMarket + "-" + versionVO.getVersionNumber());
}
//ComplianceFlowStatusEnum
VersionVO versionVO = new VersionVO();
versionVO.setProjectId("busheji");
if (CutEnum.CN.getValue().equals(cut)) {
versionVO.setVersionName("不涉及");
} else {
versionVO.setVersionName(ComplianceFlowStatusEnum.UNINVOLVED.getEnName());
}
result.add(versionVO);
}
return result;
}
@@ -889,7 +944,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
* @return
*/
@Override
public List<VersionVO> getVersionInfo(String vdr) {
public List<VersionVO> getVersionInfo(String vdr, String car) {
//认证进度数据字典 certification_progress
List<SysDictItem> regionDictList = sysDictItemServiceImpl.selectItemsByDictCode("certification_progress");
@@ -924,6 +979,11 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
}
}
}
if (result.isEmpty()) {
VersionVO versionVO = new VersionVO();
versionVO.setVersionName(car);
result.add(versionVO);
}
return result;
}
@@ -1058,79 +1118,121 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
return false;
}
private boolean paramsEquals(String str1, String str2) {
if (null == str1 && null == str2) {
return true;
}
return StringUtils.equals(str1, str2);
}
private Map<String, String> queryProjectName(List<OtaManageApplyEO> list) {
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) {
res.put(plb.getId(), plb.getShowName());
}
return res;
}
@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<OtaManageApplyEO> queryProNameList = new ArrayList<>();
queryProNameList.addAll(omaOldList);
queryProNameList.addAll(list);
Map<String, String> proNameMap = queryProjectName(queryProNameList);
//历史记录
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());
}
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);
for (OtaManageApplyEO oma : list) {
if (oma.getId().length() < 20) {
continue;
}
break;
boolean flag = false;
for (OtaManageApplyEO omaOld : omaOldList) {
if (omaOld.getId().equals(oma.getId())) {
flag = true;
if (!paramsEquals(oma.getProjectVersion(), omaOld.getProjectVersion())
|| !paramsEquals(oma.getAttestationSchedule(), omaOld.getAttestationSchedule())
|| !paramsEquals(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(" : ");
conSbEn.append(user.getUsername()).append(" : ");
if (!paramsEquals(oma.getProjectVersion(), omaOld.getProjectVersion())) {
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());
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())
.append(" to ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getValue()).append(".");
}
if (!paramsEquals(oma.getRemark(), omaOld.getRemark()) && (StringUtils.isNotEmpty(oma.getRemark()) && !oma.getRemark().equals("--"))) {
conSb.append("’备注’ 由 ").append(omaOld.getRemark()).append(" 改为 ").append(oma.getRemark()).append(".");
conSbEn.append("Remark change from ").append(omaOld.getRemark()).append(" to ").append(oma.getRemark()).append(".");
}
his.setContentCn(conSb.toString());
his.setContentEn(conSbEn.toString());
hisList.add(his);
}
break;
}
}
if (!flag) {
if (StringUtils.isNotEmpty(oma.getProjectVersion())
|| StringUtils.isNotEmpty(oma.getAttestationSchedule())
|| (StringUtils.isNotEmpty(oma.getRemark()) && !oma.getRemark().equals("--"))) {
OtaManageHistory his = new OtaManageHistory();
his.setApplyId(oma.getId());
StringBuilder conSb = new StringBuilder();
StringBuilder conSbEn = new StringBuilder();
conSb.append(user.getUsername()).append(" : ");
conSbEn.append(user.getUsername()).append(" : ");
if (StringUtils.isNotEmpty(oma.getProjectVersion())) {
conSb.append("‘项目版本‘ 由 null").append(" 改为 ").append(proNameMap.get(oma.getProjectVersion())).append(".");
conSbEn.append("Project Version change from null").append(" to ").append(proNameMap.get(oma.getProjectVersion())).append(".");
}
if (StringUtils.isNotEmpty(oma.getAttestationSchedule())) {
conSb.append("‘认证进度‘ 由 null").append(" 改为 ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getName()).append(".");
conSbEn.append("Homologation Progress change from null").append(" to ").append(CertificationProgressEnum.getByValue(oma.getAttestationSchedule()).getValue()).append(".");
}
if (StringUtils.isNotEmpty(oma.getRemark()) && !oma.getRemark().equals("--")) {
conSb.append("‘备注‘ 由 null").append(" 改为 ").append(oma.getRemark()).append(".");
conSbEn.append("Remark change from null").append(" to ").append(oma.getRemark()).append(".");
}
his.setContentCn(conSb.toString());
his.setContentEn(conSbEn.toString());
hisList.add(his);
}
}
saveList.add(oma);
}
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) {
List<String> delList = saveList.stream()
.filter(e -> StringUtils.isNotBlank(e.getId()))
.map(OtaManageApplyEO::getId).distinct().collect(Collectors.toList());
this.deleteByIds(delList);
this.saveOrUpdateBatch(saveList);
otaManageHistoryService.saveBatch(hisList);
}
}
this.saveOrUpdateBatch(list);
otaManageHistoryService.saveBatch(hisList);
}
@Override
@@ -1172,48 +1274,67 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
@Override
public List<String> updateVdrBatch(List<OtaManageApplyEO> list, String projectVersion, String attestationSchedule, String remark, String cut) {
ProjectLibraryBase plb = projectLibraryBaseService.selectById(projectVersion);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//历史记录
List<OtaManageHistory> hisList = new ArrayList<>();
List<String> msgList = new ArrayList<>();
List<OtaManageApplyEO> changeList = new ArrayList<>();
boolean isStudio = isStudio();
boolean isOtaManager = isOtaManager();
for (OtaManageApplyEO oma : list) {
StringBuilder conOtaCn = new StringBuilder();
StringBuilder conOtaEn = new StringBuilder();
conOtaCn.append(user.getUsername() + " 批量编辑了 VDR: ").append(oma.getVdr());
conOtaEn.append(user.getUsername() + " edited VDR: ").append(oma.getVdr());
boolean isChanged = false;
if (isStudio() && (StringUtils.isEmpty(oma.getMatchStatus()) || oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey()))) {
if (StringUtils.isNotEmpty(projectVersion)) {
isChanged = true;
oma.setProjectVersion(projectVersion);
conOtaCn.append(" 修改了 ").append("项目版本 ").append(" 改为 ").append(plb.getShowName());
conOtaEn.append(" modified ").append("Project Version change to ").append(plb.getShowName());
}
if (StringUtils.isNotEmpty(attestationSchedule)) {
isChanged = true;
oma.setAttestationSchedule(attestationSchedule);
conOtaCn.append(" 修改了 ").append("认证进度 ").append(" 改为 ").append(CertificationProgressEnum.getByValue(attestationSchedule).getName());
conOtaEn.append(" modified ").append("Homologation Progress change to ").append(CertificationProgressEnum.getByValue(attestationSchedule).getValue());
if (StringUtils.isNotEmpty(projectVersion)) {
if (isStudio) {
if (StringUtils.isEmpty(oma.getMatchStatus())
|| oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey())
|| oma.getMatchStatus().equals(OtaStatusEnum.REJECTED.getKey())) {
isChanged = true;
oma.setProjectVersion(projectVersion);
} else {
if (CutEnum.CN.getValue().equals(cut)) {
msgList.add("VDR:" + oma.getVdr() + " 状态必须为" + OtaStatusEnum.TO_BE_MATCHED.getNameCN() + "" + OtaStatusEnum.REJECTED.getNameCN() + "");
} else {
msgList.add("VDR:" + oma.getVdr() + " The state must be" + OtaStatusEnum.TO_BE_MATCHED.getNameEN() + " or " + OtaStatusEnum.REJECTED.getNameEN() + "");
}
}
} else {
if (CutEnum.CN.getValue().equals(cut)) {
msgList.add("VDR:" + oma.getVdr() + " 只有Studio角色可以编辑项目版本!");
} else {
msgList.add("VDR:" + oma.getVdr() + " Only Studio roles can edit Project Version");
}
}
}
if (isStudio() || isOtaManager()) {
if (StringUtils.isNotEmpty(remark)) {
isChanged = true;
oma.setRemark(remark);
conOtaCn.append(" 修改了 ").append("备注 ").append(" 改为 ").append(remark);
conOtaEn.append(" modified ").append("Remark change to ").append(remark);
if (StringUtils.isNotEmpty(attestationSchedule)) {
if (isStudio) {
if (StringUtils.isEmpty(oma.getMatchStatus())
|| oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey())
|| oma.getMatchStatus().equals(OtaStatusEnum.REJECTED.getKey())) {
isChanged = true;
oma.setAttestationSchedule(attestationSchedule);
} else {
if (CutEnum.CN.getValue().equals(cut)) {
msgList.add("VDR:" + oma.getVdr() + " 状态必须为" + OtaStatusEnum.TO_BE_MATCHED.getNameCN() + "" + OtaStatusEnum.REJECTED.getNameCN() + "");
} else {
msgList.add("VDR:" + oma.getVdr() + " The state must be" + OtaStatusEnum.TO_BE_MATCHED.getNameEN() + " or " + OtaStatusEnum.REJECTED.getNameEN() + "");
}
}
} else {
if (CutEnum.CN.getValue().equals(cut)) {
msgList.add("VDR:" + oma.getVdr() + " 只有Studio角色可以编辑认证进度!");
} else {
msgList.add("VDR:" + oma.getVdr() + " Only Studio roles can edit Homologation Progress");
}
}
}
if (StringUtils.isNotEmpty(remark) && !remark.equals("--")) {
isChanged = true;
oma.setRemark(remark);
}
if (isChanged) {
OtaManageHistory his = new OtaManageHistory();
his.setApplyId(oma.getId());
his.setContentCn(conOtaCn.toString());
his.setContentEn(conOtaEn.toString());
hisList.add(his);
changeList.add(oma);
}
}
this.saveOrUpdateBatch(list);
otaManageHistoryService.saveBatch(hisList);
if (CollectionUtils.isNotEmpty(changeList)) {
this.temporarySave(changeList, cut);
}
return msgList;
}
@@ -1321,103 +1442,132 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
receiveList = receiveList.stream()
.collect(Collectors.collectingAndThen(Collectors
.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getPlannedBpLaunchBatch()))), ArrayList::new));
for (OtaManageApplyEO rec : receiveList) {
if (CutEnum.CN.getValue().equals(cut)) {
rec.setAppliedVehicleProject("全部");
String name = "";
String market = "";
ProjectLibraryBase plb = projectLibraryBaseService.selectById(projectId);
if (ObjectUtils.isNotEmpty(plb)) {
if (StringUtils.isNotEmpty(plb.getProjectName()) && plb.getProjectName().equals("FORCE")) {
name = "Force";
} else {
rec.setAppliedVehicleProject("All");
name = plb.getProjectName();
}
if (StringUtils.isNotEmpty(plb.getTargetMarket())) {
String[] marketStrs = plb.getTargetMarket().split(",");
if (marketStrs[0].equals("china")) {
market = "CN";
} else if (marketStrs[0].equals("UK")) {
market = "RHD";
} else {
market = marketStrs[0];
}
}
}
for (OtaManageApplyEO rec : receiveList) {
rec.setAppliedVehicleProject(name + " " + market);
}
}
return receiveList;
}
@Override
public Map<String, Object> getStatisticalStatus(String projectId, String plannedBpLaunchBatch, String cut) {
public List<Map<String, Object>> getStatisticalStatus(String projectId, String plannedBpLaunchBatch, String cut) {
List<OtaManageApplyEO> receiveList = this.getBaseMapper().getListByProjectId(projectId, plannedBpLaunchBatch);
int total = receiveList.size();
//匹配状态
int toBeMatched = 0;//待匹配
int toBeApproved = 0;//待审批
int locked = 0;//锁定
int rejected = 0;//退回
//认证进度
int notStart = 0;//未开始
int inProgress = 0;//进行中
int testPassed = 0;//实验通过
int testFailed = 0;//实验失败
int notSubmitted = 0;//部件报告未提交
int submitted = 0;//部件报告已提交
int stored = 0;//部件报告已入库
List<Map<String, Object>> result = new ArrayList<>();
if (!receiveList.isEmpty()) {
List<String> plannedBpLaunchBatchList = receiveList.stream()
.filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch()))
.map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList());
for (OtaManageApplyEO oma : receiveList) {
if (StringUtils.isBlank(oma.getMatchStatus()) || oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey())) {
toBeMatched++;
} else if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) {
toBeApproved++;
} else if (oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey())) {
locked++;
} else if (oma.getMatchStatus().equals(OtaStatusEnum.REJECTED.getKey())) {
rejected++;
} else {
toBeMatched++;
}
if (StringUtils.isBlank(oma.getAttestationSchedule()) || oma.getAttestationSchedule().equals(CertificationProgressEnum.NOT_START.getValue())) {
notStart++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.IN_PROGRESS.getValue())) {
inProgress++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.TEST_PASSED.getValue())) {
testPassed++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.TEST_FAILED.getValue())) {
testFailed++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue())) {
notSubmitted++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue())) {
submitted++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue())) {
stored++;
} else {
notStart++;
for (String s : plannedBpLaunchBatchList) {
List<OtaManageApplyEO> otaManageApplyEOList = receiveList.stream()
.filter(e -> s.equals(e.getPlannedBpLaunchBatch())).collect(Collectors.toList());
int total = otaManageApplyEOList.size();
//匹配状态
int toBeMatched = 0;//待匹配
int toBeApproved = 0;//待审批
int locked = 0;//锁定
int rejected = 0;//退回
//认证进度
int notStart = 0;//未开始
int inProgress = 0;//进行中
int testPassed = 0;//实验通过
int testFailed = 0;//实验失败
int notSubmitted = 0;//部件报告未提交
int submitted = 0;//部件报告已提交
int stored = 0;//部件报告已入库
for (OtaManageApplyEO oma : otaManageApplyEOList) {
if (StringUtils.isBlank(oma.getMatchStatus()) || oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_MATCHED.getKey())) {
toBeMatched++;
} else if (oma.getMatchStatus().equals(OtaStatusEnum.TO_BE_APPROVED.getKey())) {
toBeApproved++;
} else if (oma.getMatchStatus().equals(OtaStatusEnum.LOCKED.getKey())) {
locked++;
} else if (oma.getMatchStatus().equals(OtaStatusEnum.REJECTED.getKey())) {
rejected++;
} else {
toBeMatched++;
}
if (StringUtils.isBlank(oma.getAttestationSchedule()) || oma.getAttestationSchedule().equals(CertificationProgressEnum.NOT_START.getValue())) {
notStart++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.IN_PROGRESS.getValue())) {
inProgress++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.TEST_PASSED.getValue())) {
testPassed++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.TEST_FAILED.getValue())) {
testFailed++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue())) {
notSubmitted++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue())) {
submitted++;
} else if (oma.getAttestationSchedule().equals(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue())) {
stored++;
} else {
notStart++;
}
}
Map<String, Object> statisticalMap = new HashMap<>();
statisticalMap.put("plannedBpLaunchBatch", s);
statisticalMap.put("allCount", total);
List<Map<String, Object>> matchStatusMapList = new ArrayList<>();
matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.TO_BE_MATCHED.getKey(), toBeMatched));
matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.TO_BE_APPROVED.getKey(), toBeApproved));
matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.LOCKED.getKey(), locked));
matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.REJECTED.getKey(), rejected));
statisticalMap.put("matchStatusMapList", matchStatusMapList);
Map<String, Object> matchStatusMap = new HashMap<>();
matchStatusMap.put(OtaStatusEnum.TO_BE_MATCHED.getKey(), toBeMatched);
matchStatusMap.put(OtaStatusEnum.TO_BE_APPROVED.getKey(), toBeApproved);
matchStatusMap.put(OtaStatusEnum.LOCKED.getKey(), locked);
matchStatusMap.put(OtaStatusEnum.REJECTED.getKey(), rejected);
statisticalMap.put("matchStatusMap", matchStatusMap);
List<Map<String, Object>> attestationScheduleMapList = new ArrayList<>();
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.NOT_START.getValue(), notStart));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.IN_PROGRESS.getValue(), inProgress));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.TEST_PASSED.getValue(), testPassed));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.TEST_FAILED.getValue(), testFailed));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue(), notSubmitted));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue(), submitted));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue(), stored));
statisticalMap.put("attestationScheduleMapList", attestationScheduleMapList);
Map<String, Object> attestationScheduleMap = new HashMap<>();
attestationScheduleMap.put(CertificationProgressEnum.NOT_START.getValue().replace(" ", "_"), notStart);
attestationScheduleMap.put(CertificationProgressEnum.IN_PROGRESS.getValue().replace(" ", "_"), inProgress);
attestationScheduleMap.put(CertificationProgressEnum.TEST_PASSED.getValue().replace(" ", "_"), testPassed);
attestationScheduleMap.put(CertificationProgressEnum.TEST_FAILED.getValue().replace(" ", "_"), testFailed);
attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue().replace(" ", "_"), notSubmitted);
attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue().replace(" ", "_"), submitted);
attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue().replace(" ", "_"), stored);
statisticalMap.put("attestationScheduleMap", attestationScheduleMap);
result.add(statisticalMap);
}
}
Map<String, Object> statisticalMap = new HashMap<>();
statisticalMap.put("allCount", total);
List<Map<String, Object>> matchStatusMapList = new ArrayList<>();
matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.TO_BE_MATCHED.getKey(), toBeMatched));
matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.TO_BE_APPROVED.getKey(), toBeApproved));
matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.LOCKED.getKey(), locked));
matchStatusMapList.add(wrapStatMap("matchStatus", "matchStatusCount", OtaStatusEnum.REJECTED.getKey(), rejected));
statisticalMap.put("matchStatusMapList", matchStatusMapList);
Map<String, Object> matchStatusMap = new HashMap<>();
matchStatusMap.put(OtaStatusEnum.TO_BE_MATCHED.getKey(), toBeMatched);
matchStatusMap.put(OtaStatusEnum.TO_BE_APPROVED.getKey(), toBeApproved);
matchStatusMap.put(OtaStatusEnum.LOCKED.getKey(), locked);
matchStatusMap.put(OtaStatusEnum.REJECTED.getKey(), rejected);
statisticalMap.put("matchStatusMap", matchStatusMap);
List<Map<String, Object>> attestationScheduleMapList = new ArrayList<>();
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.NOT_START.getValue(), notStart));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.IN_PROGRESS.getValue(), inProgress));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.TEST_PASSED.getValue(), testPassed));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.TEST_FAILED.getValue(), testFailed));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue(), notSubmitted));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue(), submitted));
attestationScheduleMapList.add(wrapStatMap("attestationSchedule", "attestationScheduleCount", CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue(), stored));
statisticalMap.put("attestationScheduleMapList", attestationScheduleMapList);
Map<String, Object> attestationScheduleMap = new HashMap<>();
attestationScheduleMap.put(CertificationProgressEnum.NOT_START.getValue().replace(" ", "_"), notStart);
attestationScheduleMap.put(CertificationProgressEnum.IN_PROGRESS.getValue().replace(" ", "_"), inProgress);
attestationScheduleMap.put(CertificationProgressEnum.TEST_PASSED.getValue().replace(" ", "_"), testPassed);
attestationScheduleMap.put(CertificationProgressEnum.TEST_FAILED.getValue().replace(" ", "_"), testFailed);
attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue().replace(" ", "_"), notSubmitted);
attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue().replace(" ", "_"), submitted);
attestationScheduleMap.put(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue().replace(" ", "_"), stored);
statisticalMap.put("attestationScheduleMap", attestationScheduleMap);
return statisticalMap;
return result;
}
private Map<String, Object> wrapStatMap(String key, String val, String keyStr, Object valObj) {
@@ -1479,7 +1629,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
@Override
public ModelAndView allCarExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO) {
// Step.2 获取导出数据
List<OtaManageApplyEO> pageList = getOtaPage(otaManageApplyEO);
List<OtaManageApplyEO> pageList = getAllCarPage(otaManageApplyEO);
List<OtaManageApplyEO> exportList = null;
// 过滤选中数据
@@ -26,4 +26,8 @@ public interface ProjectLibraryBaseMapper extends BaseMapper<ProjectLibraryBase>
List<ProjectLibraryBase> queryById(String id);
ProjectLibraryBase selectProjectName(@Param("projectLibraryId") String projectLibraryId);
List<ProjectLibraryBase> getListByIds(@Param("idList") List<String> idList);
}
@@ -290,4 +290,14 @@
WHERE
plb.id = #{projectLibraryId}
</select>
<select id="getListByIds" resultType="com.jero.modules.project.entity.ProjectLibraryBase">
<include refid="select_item"/>
where plb.id in
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
order by plb.create_time desc
</select>
</mapper>
@@ -186,4 +186,6 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
Result<?> overallReplacementUser(JSONObject json);
List<ProjectLibraryBase> queryList(List<String> projectIdList);
List<ProjectLibraryBase> getListByIds(List<String> projectIdList);
}
@@ -22,6 +22,8 @@ import com.jero.modules.cert.template.enums.ControlTypeEnum;
import com.jero.modules.dummy.enums.OrderEnum;
import com.jero.modules.enums.DictCodeEnum;
import com.jero.modules.feishu.enums.TemplateInfoEnum2;
import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.jero.modules.ota.service.impl.OtaManageApplyEOServiceImpl;
import com.jero.modules.project.entity.*;
import com.jero.modules.project.enums.*;
import com.jero.modules.project.mapper.ProjectLawsInventoryEOMapper;
@@ -48,6 +50,7 @@ import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService;
import com.jero.modules.top.entity.TopProjectEO;
import com.jero.modules.top.service.ITopProjectEOService;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import javafx.beans.binding.ObjectBinding;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -173,6 +176,8 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
@Autowired
private IProjectLibraryStatisticsService projectLibraryStatisticsService;
@Autowired
private OtaManageApplyEOServiceImpl otaManageApplyEOService;
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
private static DecimalFormat df = new DecimalFormat("#.00");
@@ -2576,6 +2581,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
this.exportRegulatoryManagement(workbook,params);
this.exportCertificationManagement(workbook,params);
this.exportParameterCollecting(workbook,params);
this.exportOtaCollecting(workbook,params);
try {
response.setHeader("Content-Disposition",
"attachment; filename=" + fileName);
@@ -3107,6 +3113,93 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
}
}
}
private void exportOtaCollecting(HSSFWorkbook workbook, Map<String, Object> params) {
String cut = (String) params.get("cut");
String sheetName = "OTA状态";
String firstTitle = "匹配状态统计,OTA认证进度统计";
String secondTitle = "软件版本,待匹配,待审批,锁定,退回,未开始,进行中,实验通过,实验失败,部件报告未提交,部件报告已提交,部件报告已入库";
if(StringUtils.equals(cut,CutEnum.EN.getValue())){
sheetName = "OTA status";
firstTitle = "Matching state statistics,OTA authentication progress statistics";
secondTitle = "Software version," +
"To be matched," +
"To be approved," +
"lock," +
"Reject,"+
"Not started," +
"Ongoing," +
"Test Passed," +
"Test Failed," +
"Component report not submitted," +
"Component report submitted," +
"Component report has been stored";
}
HSSFSheet sheet = workbook.createSheet(sheetName);
//合并单元格 起始行,结束行,起始列,结束列
CellRangeAddress region1 = new CellRangeAddress(0, 0, 1, 4);
sheet.addMergedRegion(region1);
CellRangeAddress region2 = new CellRangeAddress(0, 0, 5, 11);
sheet.addMergedRegion(region2);
String[] firstTitleArr = firstTitle.split(",");
String[] secondTitleArr = secondTitle.split(",");
Row firstRow = sheet.createRow(0);
Row secondRow = sheet.createRow(1);
CellStyle cellStyleTitle = workbook.createCellStyle();
cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
for (int i = 0; i <= 11; i++){
sheet.setColumnWidth(i, 3500);
Cell firstRowCell = firstRow.createCell(i);
firstRowCell.setCellStyle(cellStyleTitle);
if(i == 1){
firstRowCell.setCellValue(firstTitleArr[0]);
}else if(i==5){
firstRowCell.setCellValue(firstTitleArr[1]);
}
Cell secondRowCell = secondRow.createCell(i);
secondRowCell.setCellValue(secondTitleArr[i]);
}
String projectLibraryId = (String) params.get("projectLibraryId");
List<Map<String, Object>> mapList = otaManageApplyEOService.getStatisticalStatus(projectLibraryId, null, cut);
if(ObjectUtils.isNotEmpty(mapList)){
int dataIndex = 2;
for (Map<String, Object> map : mapList) {
String plannedBpLaunchBatch = (String) map.get("plannedBpLaunchBatch");
Map<String, Object> matchStatusMap = (Map<String, Object>)map.get("matchStatusMap");
Map<String, Object> attestationScheduleMap = (Map<String, Object>)map.get("attestationScheduleMap");
String.valueOf(matchStatusMap.get("locked"));
String locked = String.valueOf(matchStatusMap.get("locked"));
String rejected = String.valueOf(matchStatusMap.get("rejected"));
String to_be_approved = String.valueOf(matchStatusMap.get("to_be_approved"));
String to_be_matched = String.valueOf(matchStatusMap.get("to_be_matched"));
String Component_report_has_been_stored = String.valueOf(attestationScheduleMap.get("Component_report_has_been_stored"));
String Component_report_not_submitted = String.valueOf(attestationScheduleMap.get("Component_report_not_submitted"));
String Component_report_submitted = String.valueOf(attestationScheduleMap.get("Component_report_submitted"));
String In_progress = String.valueOf(attestationScheduleMap.get("In_progress"));
String Not_start =String.valueOf(attestationScheduleMap.get("Not_start"));
String Test_failed = String.valueOf(attestationScheduleMap.get("Test_failed"));
String Test_passed = String.valueOf(attestationScheduleMap.get("Test_passed"));
Row dataRow = sheet.createRow(dataIndex);
dataRow.createCell(0).setCellValue(plannedBpLaunchBatch);
dataRow.createCell(1).setCellValue(to_be_matched);
dataRow.createCell(2).setCellValue(to_be_approved);
dataRow.createCell(3).setCellValue(locked);
dataRow.createCell(4).setCellValue(rejected);
dataRow.createCell(5).setCellValue(Not_start);
dataRow.createCell(6).setCellValue(In_progress);
dataRow.createCell(7).setCellValue(Test_passed);
dataRow.createCell(8).setCellValue(Test_failed);
dataRow.createCell(9).setCellValue(Component_report_not_submitted);
dataRow.createCell(10).setCellValue(Component_report_submitted);
dataRow.createCell(11).setCellValue(Component_report_has_been_stored);
dataIndex ++;
}
}
}
/**
* 导出认证参数收集-设置数据
@@ -3432,6 +3525,15 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
List<ProjectLibraryBase> res = this.list(queryWrapper);
return res;
}
@Override
public List<ProjectLibraryBase> getListByIds(List<String> projectIdList) {
List<ProjectLibraryBase> res = new ArrayList<>();
if(CollectionUtils.isNotEmpty(projectIdList)){
res = this.getBaseMapper().getListByIds(projectIdList);
}
return res;
}
}
@@ -66,7 +66,7 @@
<a-row :gutter="24">
<a-col :span="24">
<div class='detail-box'>
<span class='detail-text'>{{item.versionName}}</span>
<span class='detail-text' style="width: 300px">{{item.versionName}}</span>
</div>
</a-col>
</a-row>