Commit 96edbe07 authored by zhangyingbin's avatar zhangyingbin

修改根据项目id查询项目下的管材接口

修改根据项目id查询项目下的设备接口
parent 318d5d80
......@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.MaterialServiceImpl;
import org.aspectj.bridge.Message;
import org.springframework.validation.ValidationUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -22,14 +23,17 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.ProjectResourceServiceImpl;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import javax.xml.bind.ValidationEvent;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -221,7 +225,7 @@ public class ProjectResourceController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/projectEquipment")
@ApiOperation(httpMethod = "GET" ,value = "根据项目id获取项目使用到的设备" , notes = "根据项目id获取项目使用到的设备")
public ResponseModel<List<ProjectResource>> projectEquipment(@RequestParam String projectId){
public ResponseModel<List<JSONObject>> projectEquipment(@RequestParam String projectId){
return ResponseHelper.buildResponse(projectResourceServiceImpl.getProjectEquipment(projectId));
}
......@@ -234,7 +238,7 @@ public class ProjectResourceController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/projectMaterial")
@ApiOperation( httpMethod = "GET",value = "根据项目ID获取项目使用到的管材", notes = "根据项目ID获取项目使用到的管材")
public ResponseModel<List<ProjectResource>> projectMaterial(@RequestParam String projectId){
public ResponseModel<List<JSONObject>> projectMaterial(@RequestParam String projectId){
return ResponseHelper.buildResponse(projectResourceServiceImpl.getProjectMaterial(projectId));
}
......@@ -281,7 +285,13 @@ public class ProjectResourceController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/getResourceInfo")
@ApiOperation(httpMethod = "POST",value = "根据type获取当前登录所在单位下的项目中的所有资源列表", notes = "根据type获取当前登录所在单位下的项目中的所有资源列表")
public ResponseModel<IPage> getResourceInfo(Long current,Long size,String type,@RequestBody(required = false) ProjectResourceDto projectResourceinfo){
public ResponseModel<IPage> getResourceInfo(@RequestParam(required = false) Long current,@RequestParam(required = false) Long size,String type,@RequestBody(required = false) ProjectResourceDto projectResourceinfo){
if(ValidationUtil.isEmpty(size)){
size = Long.MAX_VALUE;
}
if(ValidationUtil.isEmpty(current)){
current = 0L;
}
IPage page = new Page();
page.setSize(size);
page.setCurrent(current);
......
......@@ -201,9 +201,17 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
* @param projectId
* @return
*/
public List<ProjectResource> getProjectEquipment(String projectId){
return getProjectResources(projectId, 设备资源);
public List<JSONObject> getProjectEquipment(String projectId){
List<ProjectResource> resourceList = getProjectResources(projectId, 设备资源);
List<JSONObject> mapList = new ArrayList<>();
for (ProjectResource projectResource : resourceList) {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(projectResource));
LambdaQueryWrapper<Equipment> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Equipment::getSequenceNbr,projectResource.getResourceId());
jsonObject.putAll(equipmentService.getMap(wrapper));
mapList.add(jsonObject);
}
return mapList;
}
/**
......@@ -211,8 +219,17 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
* @param projectId
* @return
*/
public List<ProjectResource> getProjectMaterial(String projectId){
return getProjectResources(projectId, 管材资源);
public List<JSONObject> getProjectMaterial(String projectId){
List<ProjectResource> resourceList = getProjectResources(projectId, 管材资源);
List<JSONObject> mapList = new ArrayList<>();
for (ProjectResource projectResource : resourceList) {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(projectResource));
LambdaQueryWrapper<Equipment> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Equipment::getSequenceNbr,projectResource.getResourceId());
jsonObject.putAll(equipmentService.getMap(wrapper));
mapList.add(jsonObject);
}
return mapList;
}
/**
......
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