Commit 47ad5b19 authored by zhangyingbin's avatar zhangyingbin

修改根据type获取当前登录所在单位下的项目中的所有资源列表接口

parent f75e7df6
......@@ -238,9 +238,9 @@ public class ProjectResourceController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/getResourceInfo")
@ApiOperation(httpMethod = "GET",value = "根据type获取当前登录所在单位下的项目中的所有资源列表", notes = "根据type获取当前登录所在单位下的项目中的所有资源列表")
public ResponseModel<IPage> getResourceInfo(String type,String current,String size){
@PostMapping(value = "/getResourceInfo")
@ApiOperation(httpMethod = "POST",value = "根据type获取当前登录所在单位下的项目中的所有资源列表", notes = "根据type获取当前登录所在单位下的项目中的所有资源列表")
public ResponseModel<IPage> getResourceInfo(String type,String current,String size,@RequestBody JSONObject jsonObject){
IPage page = new Page();
page.setSize(Long.parseLong(size));
page.setCurrent(Long.parseLong(current));
......
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectMaterialDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderEquipmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.alibaba.fastjson.JSON;
......@@ -30,11 +31,8 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum.*;
......@@ -214,8 +212,10 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
List<Long> projectIdList = new ArrayList<>();
List<Long> idList = new ArrayList<>();
List list = new ArrayList<>();
Map map = new HashMap();
for(Project project:projectList){
projectIdList.add(project.getSequenceNbr());
map.put(project.getSequenceNbr(),project.getName());
}
for(Long projectId:projectIdList){
LambdaQueryWrapper<ProjectResource> projectResourceWrapper = new LambdaQueryWrapper<>();
......@@ -224,22 +224,33 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
IPage<ProjectResource> projectResourceList = this.page(page,projectResourceWrapper);
for(ProjectResource projectResource : projectResourceList.getRecords()){
idList.add(projectResource.getResourceId());
map.put(projectResource.getResourceId(),map.get(projectId));
}
}
if(焊工资源.getCode().equals(type)){
List<Map> mapList = new ArrayList<>();
for(Long welderId:idList){
mapList.add(orgService.getdetialInfo(String.valueOf(welderId)));
Map detailMap = orgService.getdetialInfo(String.valueOf(welderId));
detailMap.put("projectName",map.get(welderId));
mapList.add(detailMap);
}
page.setRecords(mapList);
}else if(管材资源.getCode().equals(type)){
for(Long id:idList){
list.add(materialService.getById(id));
ProjectMaterialDto projectMaterialDto = new ProjectMaterialDto();
BeanUtils.copyProperties(materialService.getById(id),projectMaterialDto);
projectMaterialDto.setProjectName(String.valueOf(map.get(id)));
projectMaterialDto.setProjectResourceId(id);
list.add(projectMaterialDto);
}
page.setRecords(list);
}else {
for(Long id:idList){
list.add(equipmentService.getById(id));
WelderEquipmentDto welderEquipmentDto = new WelderEquipmentDto();
BeanUtils.copyProperties(equipmentService.getById(id),welderEquipmentDto);
welderEquipmentDto.setProjectName(String.valueOf(map.get(id)));
welderEquipmentDto.setProjectResourceId(String.valueOf(id));
list.add(welderEquipmentDto);
}
page.setRecords(list);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment