|
@@ -3,18 +3,14 @@ package cn.cslg.pas.service;
|
|
|
import cn.cslg.pas.common.core.base.Constants;
|
|
|
import cn.cslg.pas.common.core.exception.CustomException;
|
|
|
import cn.cslg.pas.common.model.PersonnelVO;
|
|
|
-import cn.cslg.pas.common.model.dto.TaskWebSocketDTO;
|
|
|
import cn.cslg.pas.common.model.dto.UploadFileDTO;
|
|
|
+import cn.cslg.pas.common.model.params.*;
|
|
|
import cn.cslg.pas.common.model.vo.*;
|
|
|
+import cn.cslg.pas.common.utils.*;
|
|
|
import cn.cslg.pas.common.utils.SecurityUtils.SecurityUtils;
|
|
|
import cn.cslg.pas.domain.*;
|
|
|
-import cn.cslg.pas.common.utils.*;
|
|
|
-import cn.cslg.pas.common.model.params.*;
|
|
|
-import cn.cslg.pas.common.utils.ExcelUtils;
|
|
|
-import cn.cslg.pas.common.utils.WebSocketServer;
|
|
|
import cn.cslg.pas.mapper.ProjectMapper;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
-import cn.cslg.pas.common.utils.PatentUtils;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.IterUtil;
|
|
|
import cn.hutool.core.date.DateField;
|
|
@@ -27,8 +23,9 @@ import cn.hutool.extra.spring.SpringUtil;
|
|
|
import cn.hutool.poi.excel.ExcelReader;
|
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
|
import cn.hutool.poi.excel.ExcelWriter;
|
|
|
-import com.alibaba.fastjson2.JSONArray;
|
|
|
-import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -113,10 +110,10 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
}
|
|
|
|
|
|
public IPage<Project> getPageList(ProjectVO params) {
|
|
|
- Map<String,Object> m =new HashMap<>();
|
|
|
- m.put("token",params.getToken());
|
|
|
- m.put("loginId",4);
|
|
|
- m.put("functionId",8);
|
|
|
+ Map<String, Object> m = new HashMap<>();
|
|
|
+ m.put("token", params.getToken());
|
|
|
+ m.put("loginId", 4);
|
|
|
+ m.put("functionId", 8);
|
|
|
PersonnelVO user = cacheUtils.getLoginUserPersonnel(3);
|
|
|
List<Integer> projectIds = new ArrayList<Integer>() {{
|
|
|
add(-1);
|
|
@@ -132,18 +129,39 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
SecurityUtils.startDataScope(m);
|
|
|
IPage<Project> pageList = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);
|
|
|
List<Project> dataList = pageList.getRecords();
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("departmentId", dataList.stream().map(Project::getDepartmentId).collect(Collectors.toList()));
|
|
|
-// try {
|
|
|
-// JSONArray jsonObject = apiUtils.invokeApi(new JSONObject(map), "/permission/api/system/getDepartmentById", "post", "data");
|
|
|
-// for (int i = 0; i < dataList.size(); i++) {
|
|
|
-// dataList.get(i).setDepartmentName((String) jsonObject.get(i));
|
|
|
-// }
|
|
|
-// } catch (IOException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// this.setDataList(dataList);
|
|
|
-// pageList.setRecords(dataList);
|
|
|
+
|
|
|
+ try {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("departmentId", dataList.stream().map(Project::getDepartmentId).collect(Collectors.toList()));
|
|
|
+ String jsonObject = apiUtils.invokeApi(new JSONObject(map), "/permission/api/system/getDepartmentById", "post", "data");
|
|
|
+ JSONArray jsonArray1 = JSON.parseArray(jsonObject);
|
|
|
+ List<ProjectVO.Department> departmentList = jsonArray1.toJavaList(ProjectVO.Department.class);
|
|
|
+ for (Project project : dataList) {
|
|
|
+ for (ProjectVO.Department department : departmentList) {
|
|
|
+ if (project.getDepartmentId().equals(department.getId())) {
|
|
|
+ project.setDepartmentName(department.getDepartmentName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
+ map1.put("personnelId", dataList.stream().map(Project::getPersonnelId).collect(Collectors.toList()));
|
|
|
+ String jsonObject1 = apiUtils.invokeApi(new JSONObject(map1), "/permission/api/system/getPersonnelById", "post", "data");
|
|
|
+ JSONArray jsonArray = JSON.parseArray(jsonObject1);
|
|
|
+ List<ProjectVO.Personnel> personnelList = jsonArray.toJavaList(ProjectVO.Personnel.class);
|
|
|
+ for (Project project : dataList) {
|
|
|
+ for (ProjectVO.Personnel personnel : personnelList) {
|
|
|
+ if (project.getPersonnelId().equals(personnel.getId())) {
|
|
|
+ project.setPersonnelName(personnel.getPersonnelName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ this.setDataList(dataList);
|
|
|
+ pageList.setRecords(dataList);
|
|
|
return pageList;
|
|
|
}
|
|
|
|