Commit 9faa82a6 authored by wanglong's avatar wanglong

添加焊口编码条件筛选

parent da1e0ec0
......@@ -101,9 +101,21 @@ public class WeldController extends BaseController {
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "焊口信息表分页查询", notes = "焊口信息表分页查询")
public ResponseModel<Page<WeldDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size,String projectId) {
(value = "size") int size) {
return ResponseHelper.buildResponse(weldServiceImpl.queryForWeldPage(current, size,projectId));
return ResponseHelper.buildResponse(weldServiceImpl.queryForWeldPage(current, size));
}
/**
* 更新焊口编码任务状态
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/updateTask")
@ApiOperation(httpMethod = "GET", value = "更新焊口编码任务状态", notes = "更新焊口编码任务状态")
public ResponseModel<String> updateTask(Weld weld) {
return ResponseHelper.buildResponse(weldServiceImpl.updateTask(weld));
}
/**
......
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.ugp.api.Enum.WeldCodeEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.WeldMethodEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.WeldDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.SuperviseRuleMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.WeldMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IWeldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
......@@ -34,15 +40,22 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
WeldMapper weldMapper;
@Autowired
ProjectMapper projectMapper;
@Autowired
OrgServiceImpl orgService;
@Autowired
SuperviseRuleMapper superviseRuleMapper;
// Logger logger = LoggerFactory.getLogger(WeldServiceImpl.class);
private final String 安装单位="INSTALL";
private final String 监察单位="SUPERVISION";
/**
* 分页查询
* 分页查询(安装单位管理员只能查看本单位项目所有焊口信息。
* 监检机构管理员可查看所有项目焊口信息。)
*/
public Page<WeldDto> queryForWeldPage(int current, int size, String projectId) {
public Page<WeldDto> queryForWeldPage(int current, int size) {
Page<WeldDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
......@@ -65,15 +78,46 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
}
}
//如果不为空则过滤
if (projectId != null) {
List<WeldDto> L = weldDtoPage.getRecords().stream().filter(b -> b.getProjectId().equals(projectId)).collect(Collectors.toList());
//获取登录人信息
OrgUsr orgUsr = orgService.getOrgUsr();
//获取登录人企业下的所有焊口
if (orgUsr.getOrgExpandAttr1() == 安装单位) {
List<WeldDto> L = weldDtoPage.getRecords().stream().filter(b -> b.getInstallCompany().equals(orgUsr.getParentId())).collect(Collectors.toList());
weldDtoPage.setRecords(L);
}
//根据 所在地 筛选焊口
if (orgUsr.getOrgExpandAttr1() == 监察单位) {
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
LambdaQueryWrapper<SuperviseRule> eq = wrapper.eq(SuperviseRule::getSuperviseDeptId, orgUsr.getParentId());
List<SuperviseRule> superviseRules = superviseRuleMapper.selectList(eq);
for (SuperviseRule i : superviseRules) {
List<WeldDto> L = weldDtoPage.getRecords().stream().filter(b -> b.getRegion().equals(i.getAdminRegion())).collect(Collectors.toList());
weldDtoPage.setRecords(L);
}
}
return weldDtoPage;
}
/**
* 更新焊口编码任务状态
*/
public String updateTask(Weld weld) {
LambdaQueryWrapper<Weld> wrapper = new LambdaQueryWrapper<>();
//根据焊口编码修改任务状态
wrapper.eq(Weld::getCode, weld.getCode());
int update = weldMapper.update(weld, wrapper);
return "成功更新" + update + "条";
}
/**
* 列表查询 示例
*/
......
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