Commit 23eef1d9 authored by wanglong's avatar wanglong

添加设备 管材筛选 项目资源类别枚举判断

parent 06ff998b
package com.yeejoin.amos.boot.module.ugp.api.Enum;
import java.util.HashMap;
import java.util.Map;
public enum ProjectResourceEnum {
焊工资源("焊工","welder"),
设备资源("设备","equipment"),
管材资源("管材","material");
private String status;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
ProjectResourceEnum(String status, String state) {
this.status = status;
this.state = state;
}
private String state;
public static final Map<String,String> map=new HashMap<>();
static {
for (ProjectResourceEnum projectResourceEnum:ProjectResourceEnum.values()){
map.put(projectResourceEnum.status, projectResourceEnum.state);
}
}
}
......@@ -12,5 +12,5 @@ import java.util.List;
* @date 2022-09-22
*/
public interface IWeldService {
List<Weld> getCode(Long projectCode, int number) throws Exception;
List<Weld> getCode(Long projectCode, int number);
}
......@@ -127,7 +127,7 @@ public class EquipmentController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "设备数据名称查询", notes = "设备数据名称查询")
@GetMapping(value = "/selectName")
public ResponseModel<List<JSONObject>> selectName() {
return ResponseHelper.buildResponse(equipmentServiceImpl.selectName());
public ResponseModel<List<JSONObject>> selectName(@RequestParam(value = "unitId")String installationUnitId) {
return ResponseHelper.buildResponse(equipmentServiceImpl.selectName(installationUnitId));
}
}
......@@ -136,7 +136,7 @@ public class MaterialController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "材料信息表列表全部数据查询", notes = "材料信息表列表全部数据查询")
@GetMapping(value = "/selectName")
public ResponseModel<List<JSONObject>> selectName() {
return ResponseHelper.buildResponse(materialServiceImpl.selectName());
public ResponseModel<List<JSONObject>> selectName(@RequestParam(value = "unitId")String installationUnitId) {
return ResponseHelper.buildResponse(materialServiceImpl.selectName(installationUnitId));
}
}
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IEquipmentService;
......@@ -12,6 +13,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 设备信息表服务实现类
......@@ -43,10 +45,14 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
*
* @return
*/
public List<JSONObject> selectName() {
public List<JSONObject> selectName(String installationUnitId) {
List<JSONObject> names = new ArrayList<>();
//查询所有设备数据
List<Equipment> equipment = equipmentMapper.selectList(null);
//添加查询条件
QueryWrapper<Equipment> wrapper = new QueryWrapper<>();
wrapper.eq("company_id", installationUnitId);
List<Equipment> equipment = equipmentMapper.selectList(wrapper);
for (Equipment i : equipment) {
JSONObject name = new JSONObject();
name.put("name", i.getName());
......
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.MaterialDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Material;
import com.yeejoin.amos.boot.module.ugp.api.mapper.MaterialMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IMaterialService;
......@@ -38,10 +40,14 @@ public class MaterialServiceImpl extends BaseService<MaterialDto, Material, Mate
/**
* 获取材料名称跟企业id
*/
public List<JSONObject> selectName() {
public List<JSONObject> selectName(String installationUnitId) {
List<JSONObject> names = new ArrayList<>();
//添加查询条件
QueryWrapper<Material> wrapper = new QueryWrapper<>();
wrapper.eq("company_id", installationUnitId);
List<Material> materials = baseMapper.selectList(wrapper);
List<Material> materials = baseMapper.selectList(null);
for (Material i : materials) {
JSONObject name = new JSONObject();
name.put("name", i.getName());
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
......@@ -13,7 +14,11 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum.*;
/**
* 项目资源表(包括焊工、管材、设备)服务实现类
......@@ -53,11 +58,19 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,
for (Object json2 : subForm) {
String select = JSON.parseObject(JSON.toJSONString(json2)).getString("select");
String type = JSON.parseObject(JSON.toJSONString(json2)).getString("type");
String companyId = jsonObject.getString("company_id");
String type = jsonObject.getString("type");
if (type.equals(设备资源.getStatus())) {
projectResource.setType(设备资源.getState());
}
if (type.equals(焊工资源.getStatus())) {
projectResource.setType(焊工资源.getState());
}
if (type.equals(管材资源.getStatus())) {
projectResource.setType(管材资源.getState());
}
projectResource.setProjectId(Long.valueOf(companyId));
projectResource.setResourceId(Long.valueOf(select));
projectResource.setType(type);
this.save(projectResource);
}
......
......@@ -65,13 +65,12 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
}
}
if (projectId == null) {
return weldDtoPage;
} else {
//如果不为空则过滤
if (projectId != null) {
List<WeldDto> L = weldDtoPage.getRecords().stream().filter(b -> b.getProjectId().equals(projectId)).collect(Collectors.toList());
weldDtoPage.setRecords(L);
return weldDtoPage;
}
return weldDtoPage;
}
......
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