|
@@ -4,24 +4,31 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
-import com.fdkankan.manage_jp.entity.ProjectSceneGps;
|
|
|
+import com.fdkankan.manage_jp.entity.*;
|
|
|
import com.fdkankan.manage_jp.httpClient.service.LaserService;
|
|
|
import com.fdkankan.manage_jp.mapper.IProjectSceneGpsMapper;
|
|
|
-import com.fdkankan.manage_jp.service.IProjectSceneGpsService;
|
|
|
+import com.fdkankan.manage_jp.mapper.ISceneProMapper;
|
|
|
+import com.fdkankan.manage_jp.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.fdkankan.manage_jp.service.IScenePlusExtService;
|
|
|
-import com.fdkankan.manage_jp.service.IScenePlusService;
|
|
|
import com.fdkankan.manage_jp.vo.request.ProjectParam;
|
|
|
-import com.fdkankan.manage_jp.vo.response.SceneExtGpsVo;
|
|
|
-import com.fdkankan.manage_jp.vo.response.SceneGpsDb;
|
|
|
-import com.fdkankan.manage_jp.vo.response.SceneGpsVo;
|
|
|
+import com.fdkankan.manage_jp.vo.request.SceneGpsParam;
|
|
|
+import com.fdkankan.manage_jp.vo.request.SceneParam;
|
|
|
+import com.fdkankan.manage_jp.vo.response.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -43,6 +50,8 @@ public class ProjectSceneGpsServiceImpl extends ServiceImpl<IProjectSceneGpsMapp
|
|
|
FYunFileServiceInterface fYunFileServiceInterface;
|
|
|
@Autowired
|
|
|
LaserService laserService;
|
|
|
+ @Autowired
|
|
|
+ IUserRoleService userRoleService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -118,9 +127,86 @@ public class ProjectSceneGpsServiceImpl extends ServiceImpl<IProjectSceneGpsMapp
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ISceneProMapper sceneProMapper;
|
|
|
+ @Autowired
|
|
|
+ ITmContractorNumService tmContractorNumService;
|
|
|
+ @Autowired
|
|
|
+ IProjectService projectService;
|
|
|
+ @Autowired
|
|
|
+ IProjectNumService projectNumService;
|
|
|
+
|
|
|
@Override
|
|
|
- public List<ProjectSceneGps> allSceneGps() {
|
|
|
+ public Object allSceneGps(SceneGpsParam param) {
|
|
|
+ if(param.getUserId() == null){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ List<UserRole> roleIdList = userRoleService.getByUserId((param.getUserId()));
|
|
|
+ List<Long> roleIds = roleIdList.stream().map(UserRole::getRoleId).collect(Collectors.toList());
|
|
|
+ HashMap<Integer,List<String>> projectNumMap = new HashMap<>();
|
|
|
+ HashMap<Integer,Project> projectMap = new HashMap<>();
|
|
|
+ if(param.getType() == 0){ //项目场景
|
|
|
+ List<Project> projectList = new ArrayList<>();
|
|
|
+ if(!roleIds.contains(5L)) { //平台管理员
|
|
|
+ projectList = projectService.listByCompanyId(param.getCompanyId());
|
|
|
+ }else {
|
|
|
+ projectList = projectService.list();
|
|
|
+ }
|
|
|
+ for (Project project : projectList) {
|
|
|
+ projectMap.put(project.getId(),project);
|
|
|
+ }
|
|
|
+ List<Integer> projectIds = projectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
+ List<ProjectNum> projectNums = projectNumService.getByProjectId(projectIds);
|
|
|
+ for (ProjectNum projectNum : projectNums) {
|
|
|
+ if(projectNumMap.get(projectNum.getProjectId()) == null){
|
|
|
+ List<String> proNumList = new ArrayList<>();
|
|
|
+ proNumList.add(projectNum.getNum());
|
|
|
+ projectNumMap.put(projectNum.getProjectId(),proNumList);
|
|
|
+ }else {
|
|
|
+ projectNumMap.get(projectNum.getProjectId()).add(projectNum.getNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> numList = projectNums.stream().map(ProjectNum::getNum).collect(Collectors.toList());
|
|
|
|
|
|
- return this.list();
|
|
|
+ param.setNumList(numList);
|
|
|
+
|
|
|
+ }
|
|
|
+ if(param.getType() == 1){
|
|
|
+ if(roleIds.contains(5L)) { //平台管理员
|
|
|
+ param.setUserId(null);
|
|
|
+ param.setCompanyId(null);
|
|
|
+ }
|
|
|
+ List<String> numList = tmContractorNumService.getNumListByCompanyId(param.getCompanyId());
|
|
|
+ param.setCooperateSceneCodes(numList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SceneGpsDbVp> sceneGpsDbVps = this.getBaseMapper().listGps(param);
|
|
|
+ if(param.getType() == 1){
|
|
|
+ return sceneGpsDbVps;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(param.getType() == 0){
|
|
|
+ List< ProjectSceneMapVo> voList = new ArrayList<>();
|
|
|
+ HashMap<String,SceneGpsDbVp> scenMap = new HashMap<>();
|
|
|
+ for (SceneGpsDbVp sceneGpsDbVp : sceneGpsDbVps) {
|
|
|
+ scenMap.put(sceneGpsDbVp.getNum(),sceneGpsDbVp);
|
|
|
+ }
|
|
|
+ for (Integer projectId : projectMap.keySet()) {
|
|
|
+ ProjectSceneMapVo vo = new ProjectSceneMapVo();
|
|
|
+ BeanUtils.copyProperties(projectMap.get(projectId),vo);
|
|
|
+ List<String> list = projectNumMap.get(projectId);
|
|
|
+ List<SceneGpsDbVp> listScene = new ArrayList<>();
|
|
|
+ for (String num : list) {
|
|
|
+ SceneGpsDbVp sceneGpsDbVp = scenMap.get(num);
|
|
|
+ if(sceneGpsDbVp != null){
|
|
|
+ listScene.add(sceneGpsDbVp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vo.setSceneList(listScene);
|
|
|
+ voList.add(vo);
|
|
|
+ }
|
|
|
+ return voList;
|
|
|
+ }
|
|
|
+ return new ArrayList<>();
|
|
|
}
|
|
|
}
|