|
@@ -1,6 +1,7 @@
|
|
|
package cn.cslg.pas.service;
|
|
|
|
|
|
import cn.cslg.pas.common.model.vo.ProjectExportVO;
|
|
|
+import cn.cslg.pas.common.model.vo.ProjectVO;
|
|
|
import cn.cslg.pas.common.utils.FileUtils;
|
|
|
import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
|
|
|
import cn.cslg.pas.common.utils.StringUtils;
|
|
@@ -9,6 +10,8 @@ import cn.cslg.pas.domain.User;
|
|
|
import cn.cslg.pas.mapper.ProjectExportMapper;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -18,6 +21,8 @@ import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -32,19 +37,25 @@ import java.util.stream.Collectors;
|
|
|
public class ProjectExportService extends ServiceImpl<ProjectExportMapper, ProjectExport> {
|
|
|
|
|
|
private final FileUtils fileUtils;
|
|
|
- private final UserService userService;
|
|
|
private final LoginUtils loginUtils;
|
|
|
- public IPage<ProjectExport> getPageList(ProjectExportVO params) {
|
|
|
+ private final RequestService requestService;
|
|
|
+ public IPage<ProjectExport> getPageList(ProjectExportVO params) throws IOException {
|
|
|
LambdaQueryWrapper<ProjectExport> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
if (params.getProjectId() != null) {
|
|
|
queryWrapper.eq(ProjectExport::getProjectId, params.getProjectId());
|
|
|
}
|
|
|
queryWrapper.orderByDesc(ProjectExport::getCreateTime);
|
|
|
IPage<ProjectExport> pageList = this.page(new Page<>(params.getCurrent(), params.getSize()), queryWrapper);
|
|
|
- List<User> userList = userService.getUserByIds(pageList.getRecords().stream().map(ProjectExport::getCreateBy).collect(Collectors.toList()));
|
|
|
- pageList.getRecords().forEach(data -> {
|
|
|
- data.setCreateName(userList.stream().filter(item -> item.getId().equals(data.getCreateBy())).findFirst().orElse(new User()).getName());
|
|
|
- });
|
|
|
+ List<Integer> personIds = pageList.getRecords().stream().map(ProjectExport::getCreateBy).collect(Collectors.toList());
|
|
|
+ List<ProjectVO.Personnel> personnelList =new ArrayList<>();
|
|
|
+ if(personIds.size()!=0){
|
|
|
+ String jsonObject1 = requestService.getPersonnelFromPCS(personIds);
|
|
|
+ JSONArray jsonArray = JSON.parseArray(jsonObject1);
|
|
|
+ personnelList = jsonArray.toJavaList(ProjectVO.Personnel.class);
|
|
|
+ }
|
|
|
+ for(ProjectExport data: pageList.getRecords()) {
|
|
|
+ data.setCreateName(personnelList.stream().filter(item -> item.getId().equals(data.getCreateBy())).findFirst().orElse(new ProjectVO.Personnel()).getPersonnelName());
|
|
|
+ }
|
|
|
return pageList;
|
|
|
}
|
|
|
|