|
@@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
import com.fdkankan.fusion.common.ResultData;
|
|
|
+import com.fdkankan.fusion.common.util.CaseNumTypeUtil;
|
|
|
+import com.fdkankan.fusion.common.util.SceneTypeUtil;
|
|
|
import com.fdkankan.fusion.entity.*;
|
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
|
import com.fdkankan.fusion.common.PageInfo;
|
|
|
import com.fdkankan.fusion.mapper.ICaseMapper;
|
|
|
import com.fdkankan.fusion.request.CaseParam;
|
|
|
+import com.fdkankan.fusion.request.SceneNumParam;
|
|
|
import com.fdkankan.fusion.request.ScenePram;
|
|
|
import com.fdkankan.fusion.response.CaseVo;
|
|
|
import com.fdkankan.fusion.response.HotVo;
|
|
@@ -64,53 +67,10 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
|
|
|
if(StringUtils.isNotBlank(param.getCaseTitle())){
|
|
|
wrapper.like(CaseEntity::getCaseTitle,param.getCaseTitle());
|
|
|
}
|
|
|
- List<String> deptIds = tmDepartmentService.getDeptIds();
|
|
|
- if(deptIds.size() <=0){
|
|
|
- return PageInfo.PageInfo(new Page<>(param.getPageNum(),param.getPageSize()));
|
|
|
- }
|
|
|
- List<String> deptIds2 = tmDepartmentService.getSonByDeptIdAndDeptIds(deptIds, param.getDeptId());
|
|
|
- wrapper.in(CaseEntity::getDeptId,deptIds2);
|
|
|
- //wrapper.eq(CaseEntity::getUserName,userName);
|
|
|
wrapper.eq(CaseEntity::getType,0);
|
|
|
+ wrapper.eq(CaseEntity::getUserName,param.getUserName());
|
|
|
wrapper.orderByDesc(CaseEntity::getCreateTime);
|
|
|
Page<CaseEntity> page = this.page( new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
|
|
|
-
|
|
|
-
|
|
|
- Set<String> tmProIds = page.getRecords().stream().filter(entity -> StringUtils.isNotBlank(entity.getTmProjectId()))
|
|
|
- .map(CaseEntity::getTmProjectId).collect(Collectors.toSet());
|
|
|
- HashMap<String, TmProject> proMap = tmProjectService.getMapByIds(tmProIds);
|
|
|
-
|
|
|
- for (CaseEntity record : page.getRecords()) {
|
|
|
- if(StringUtils.isNotBlank(record.getTmProjectId())){
|
|
|
- TmProject project = proMap.get(record.getTmProjectId());
|
|
|
- if(project != null){
|
|
|
- record.setDeptId(project.getDeptId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Set<String> deptIds1 = page.getRecords().stream().filter(entity -> StringUtils.isNotBlank(entity.getDeptId()))
|
|
|
- .map(CaseEntity::getDeptId).collect(Collectors.toSet());
|
|
|
- HashMap<String, TmDepartment> mapByDeptIds = tmDepartmentService.getMapByDeptIds(deptIds1);
|
|
|
-
|
|
|
- for (CaseEntity record : page.getRecords()) {
|
|
|
- TmDepartment department = mapByDeptIds.get(record.getDeptId());
|
|
|
- if(department != null){
|
|
|
- record.setDeptName(department.getName());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- List<Integer> mapIds = page.getRecords().stream().map(CaseEntity::getMapId).collect(Collectors.toList());
|
|
|
- if(!mapIds.isEmpty()){
|
|
|
- HashMap<Integer,MapConfig> map = mapConfigService.getMapByIds(mapIds);
|
|
|
- for (CaseEntity caseEntity : page.getRecords()) {
|
|
|
- if(caseEntity.getMapId() != null && map.get(caseEntity.getMapId()) != null){
|
|
|
- MapConfig mapConfig = map.get(caseEntity.getMapId());
|
|
|
- caseEntity.setMapConfig(mapConfig);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
return PageInfo.PageInfo(page);
|
|
|
}
|
|
|
|
|
@@ -123,19 +83,37 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
|
|
|
HashMap<Integer, List<String>> typeMap = caseNumService.getTypeMap(param.getCaseId());
|
|
|
param.setTypeMap(typeMap);
|
|
|
}
|
|
|
+ List<SceneVo> listAll = new ArrayList<>();
|
|
|
+ HashMap<String,List<String>> numListMap = new HashMap<>();
|
|
|
+
|
|
|
+ for (Integer type : param.getTypeMap().keySet()) {
|
|
|
+ List<String> numList = param.getTypeMap().get(type);
|
|
|
+ if(numList ==null || numList.size() <=0 || type ==3){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String mapKey = "mesh";
|
|
|
+ if(SceneTypeUtil.isLaser(type)){
|
|
|
+ mapKey = "laser";
|
|
|
+ }
|
|
|
+ if(numListMap.get(mapKey) == null){
|
|
|
+ numListMap.put(mapKey,numList);
|
|
|
+ }else {
|
|
|
+ numListMap.get(mapKey).addAll(numList);
|
|
|
+ }
|
|
|
|
|
|
- List<CaseNumEntity> caseNumEntities = caseNumService.getByCaseId(param.getCaseId());
|
|
|
- List<String> collect = caseNumEntities.stream().map(CaseNumEntity::getNum).collect(Collectors.toList());
|
|
|
+ }
|
|
|
|
|
|
- List<SceneVo> listAll = new ArrayList<>();
|
|
|
- ScenePram scenePram = new ScenePram();
|
|
|
- scenePram.setPageNum(1);
|
|
|
- scenePram.setPageSize(99999);
|
|
|
- scenePram.setNumList(collect);
|
|
|
- PageInfo pageInfo = sceneService.pageList(scenePram);
|
|
|
- List<SceneVo> list1 = (List<SceneVo>) pageInfo.getList();
|
|
|
+ for (String key : numListMap.keySet()) {
|
|
|
+ ScenePram scenePram = new ScenePram();
|
|
|
+ scenePram.setPageNum(1);
|
|
|
+ scenePram.setPageSize(99999);
|
|
|
+ scenePram.setNumList(numListMap.get(key));
|
|
|
+ scenePram.setIsObj("laser".equals(key) ?0 :1);
|
|
|
+ PageInfo pageInfo = sceneService.pageList(scenePram);
|
|
|
+ List<SceneVo> list1 = (List<SceneVo>) pageInfo.getList();
|
|
|
+ listAll.addAll(list1);
|
|
|
+ }
|
|
|
|
|
|
- listAll.addAll(list1);
|
|
|
|
|
|
if(listAll.size() >0){
|
|
|
List<String> numList = listAll.parallelStream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
@@ -191,18 +169,9 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Set<String> deptIdset = listAll.stream().filter(entity ->StringUtils.isNotBlank(entity.getDeptId())&& StringUtils.isBlank(entity.getDeptName()))
|
|
|
- .map(SceneVo::getDeptId).collect(Collectors.toSet());
|
|
|
- HashMap<String, TmDepartment> mapByDept = tmDepartmentService.getMapByDeptIds(deptIdset);
|
|
|
HashMap<Integer,FusionNum> fusionNumHashMap = fusionNumService.getByCaseId(param.getCaseId());
|
|
|
|
|
|
for (SceneVo sceneVo : listAll) {
|
|
|
- if(StringUtils.isNotBlank(sceneVo.getDeptId())){
|
|
|
- TmDepartment tmDepartment = mapByDept.get(sceneVo.getDeptId());
|
|
|
- if(tmDepartment != null){
|
|
|
- sceneVo.setDeptName(tmDepartment.getName());
|
|
|
- }
|
|
|
- }
|
|
|
if(sceneVo.getModelId() != null && fusionNumHashMap.get(sceneVo.getModelId()) != null){
|
|
|
sceneVo.setInFusion(true);
|
|
|
}
|
|
@@ -234,8 +203,46 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void addOrUpdate(CaseEntity param) {
|
|
|
- this.saveOrUpdate(param);
|
|
|
+ public CaseEntity addOrUpdate(CaseEntity caseEntity) {
|
|
|
+ if( StringUtils.isNotBlank(caseEntity.getCaseTitle())){
|
|
|
+ this.saveOrUpdate(caseEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(caseEntity.getSceneNumParam() != null){
|
|
|
+ this.addScene(getAddSceneParam(caseEntity,caseEntity.getCaseId()));
|
|
|
+ }
|
|
|
+ return caseEntity;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ CaseNumTypeUtil caseNumTypeUtil;
|
|
|
+ private CaseParam getAddSceneParam(CaseEntity param,Integer caseId){
|
|
|
+ HashMap<Integer,HashSet<String>> numTypeMap = new HashMap<>();
|
|
|
+ for (Integer type : CaseNumTypeUtil.getNumType()) {
|
|
|
+ numTypeMap.put(type,new HashSet<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ for (SceneNumParam caseNumType : param.getSceneNumParam()) {
|
|
|
+ List<Integer> numType = CaseNumTypeUtil.getNumType(caseNumType.getType());
|
|
|
+ for (Integer type : numType) {
|
|
|
+ List<String> numList = caseNumType.getNumList().stream().filter(e ->StringUtils.isNotBlank(e) && caseNumTypeUtil.getCaseNumType(e, caseNumType.getType()) != null
|
|
|
+ && caseNumTypeUtil.getCaseNumType(e, caseNumType.getType()).equals(type)).collect(Collectors.toList());
|
|
|
+ if(numTypeMap.get(type) != null){
|
|
|
+ numTypeMap.get(type).addAll(numList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<SceneNumParam> newParam = new ArrayList<>();
|
|
|
+ CaseParam param1 = new CaseParam();
|
|
|
+ for (Integer type : numTypeMap.keySet()) {
|
|
|
+ SceneNumParam numType1 = new SceneNumParam();
|
|
|
+ numType1.setType(type);
|
|
|
+ numType1.setNumList(new ArrayList<>(numTypeMap.get(type)));
|
|
|
+ newParam.add(numType1);
|
|
|
+ }
|
|
|
+ param1.setSceneNumParam(newParam);
|
|
|
+ param1.setCaseId(caseId);
|
|
|
+ return param1;
|
|
|
}
|
|
|
|
|
|
@Override
|