Commit 7fc55c6a authored by limei's avatar limei

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 5cfdbde7 95b2570c
......@@ -26,5 +26,5 @@ public interface ProjectMapper extends BaseMapper<Project> {
ProjectDto getDetail(Long sequenceNbr);
//项目模糊筛选
List<ProjectDto> queryProjectPage(Project projectParam);
IPage<ProjectDto> queryProjectPage(IPage<ProjectDto> page, Project project);
}
......@@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.*;
import com.yeejoin.amos.boot.module.ugp.api.entity.Material;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.aspectj.weaver.ast.Test;
import java.util.List;
/**
* 项目资源表(包括焊工、管材、设备) Mapper 接口
*
......@@ -33,4 +36,10 @@ public interface ProjectResourceMapper extends BaseMapper<ProjectResource> {
//根据resource_id删除项目焊工人员信息
Boolean deleteByResourceId(Long resourceId);
/**
* 获取当前登录人所在单位下的所有项目
* 根据登录人角色去筛选
*/
List<Project> getProjectPage(String roleName, String companyId);
}
......@@ -16,6 +16,6 @@ import java.util.Map;
*/
public interface WorkHistoryMapper extends BaseMapper<WorkHistory> {
IPage<WorkHistoryDto> pageList(Page<WorkHistoryDto> page, WorkHistoryDto tzUgpWorkHistory);
IPage<WorkHistoryDto> pageList(Page<WorkHistoryDto> page, WorkHistoryDto tzUgpWorkHistory,String sequenceNbr);
}
package com.yeejoin.amos.boot.module.ugp.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto;
......@@ -14,5 +15,6 @@ import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
* @date 2022-09-22
*/
public interface IProjectService {
Page<ProjectDto> queryProjectPage(int current, int size, Project project);
IPage<ProjectDto> queryProjectPage(IPage<ProjectDto> page, Project project);
}
......@@ -21,11 +21,11 @@
<select id="queryProjectPage" resultType="com.yeejoin.amos.boot.module.ugp.api.entity.Project">
select * from tz_ugp_project
<where>
<if test="name != '' and name != null">
and `name` like concat('%',#{name},'%')
<if test="project.name != '' and project.name != null">
and `name` like concat('%',#{project.name},'%')
</if>
<if test="constructionUnit != '' and constructionUnit != null">
and `construction_Unit` like concat('%',#{constructionUnit},'%')
<if test="project.constructionUnit != '' and project.constructionUnit != null">
and `construction_Unit` like concat('%',#{project.constructionUnit},'%')
</if>
</where>
</select>
......
......@@ -111,4 +111,22 @@
delete FROM tz_ugp_project_resource where resource_id=#{resourceId}
</delete>
<select id="getProjectPage" resultType="com.yeejoin.amos.boot.module.ugp.api.entity.Project">
SELECT * FROM tz_ugp_project
<where>
<if test="roleName == '建设单位'">
and construction_unit_id = #{companyId}
</if>
<if test="roleName == '安装单位'">
and installation_unit_id = #{companyId}
</if>
<if test="roleName == '设计单位'">
and design_unit_id = #{companyId}
</if>
<if test="roleName == '监察部门' or roleName == '监检机构'">
and install_region_code = #{companyId}
</if>
</where>
</select>
</mapper>
......@@ -23,8 +23,8 @@
<if test="tzUgpWorkHistory.endDate!='' and tzUgpWorkHistory.endDate!=null">
and wh.end_date like concat("%",#{tzUgpWorkHistory.endDate},"%")
</if>
<if test="tzUgpWorkHistory.sequenceNbr!='' and tzUgpWorkHistory.sequenceNbr!=null">
and wh.sequence_nbr = #{tzUgpWorkHistory.sequenceNbr}
<if test="sequenceNbr!='' and sequenceNbr!=null">
and wh.welder_id = #{sequenceNbr}
</if>
</where>
</select>
......
......@@ -159,13 +159,16 @@ public class ProjectController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "项目信息表分页查询", notes = "项目信息表分页查询")
public ResponseModel<Page<ProjectDto>> queryForPage(
public ResponseModel<IPage<ProjectDto>> queryForPage(
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, Project project) {
return ResponseHelper.buildResponse(projectServiceImpl.queryProjectPage(current,size,project));
IPage<ProjectDto> page = new Page<>();
page.setSize(size);
page.setCurrent(current);
return ResponseHelper.buildResponse(projectServiceImpl.queryProjectPage(page,project));
}
/**
* 列表全部数据查询
*
......
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.netflix.ribbon.proxy.annotation.Http;
import com.yeejoin.amos.boot.module.ugp.api.dto.MaterialDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectMaterialDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderEquipmentDto;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.MaterialServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -228,4 +226,20 @@ public class ProjectResourceController extends BaseController {
jsonObject.getLong("sequenceNbr");
return ResponseHelper.buildResponse(materialServiceImpl.groupBySeq(sequenceNbr));
}
/**
* 根据type获取当前登录所在单位下的项目中的所有资源列表
* type:welder(焊工)、equipment(设备)、material(管材)
* @return
*/
@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){
IPage page = new Page();
page.setSize(size);
page.setCurrent(current);
return ResponseHelper.buildResponse(projectResourceServiceImpl.getResourceInfo(type,page));
}
}
......@@ -20,6 +20,7 @@ import com.yeejoin.amos.boot.module.ugp.biz.service.impl.SuperviseRuleServiceImp
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
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;
......@@ -66,17 +67,19 @@ public class SuperviseRuleController extends BaseController {
model.setAdminRegion(map.get(model.getAdminRegionCode()));
//外网调不到内网 暂时预留
OrgUsr orgUsr = orgServiceImpl.getOrgUsr();
model.setSequenceNbr(orgUsr.getSequenceNbr());
model.setCreateUnitId(orgUsr.getSequenceNbr());
model = superviseRuleServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
public void getMap(Map map,Collection<RegionModel> collection){
Iterator<RegionModel> iterator = collection.iterator();
if(iterator.hasNext()){
while(iterator.hasNext()){
RegionModel regionModel = iterator.next();
map.put(regionModel.getRegionCode(),regionModel.getRegionName());
getMap(map,regionModel.getChildren());
if(!ValidationUtil.isEmpty(regionModel.getChildren())){
getMap(map,regionModel.getChildren());
}
}
}
......
......@@ -153,9 +153,9 @@ public class WorkHistoryController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询")
@GetMapping(value = "/pageList")
public ResponseModel<IPage<WorkHistoryDto>> pageList(String pageNum, String pageSize, WorkHistoryDto tzUgpWorkHistory){
@ApiOperation(httpMethod = "POST",value = "分页查询", notes = "分页查询")
@PostMapping(value = "/pageList")
public ResponseModel<IPage<WorkHistoryDto>> pageList(String pageNum, String pageSize,String sequenceNbr,@RequestBody WorkHistoryDto tzUgpWorkHistory){
if(ValidationUtil.isEmpty(pageNum)){
pageNum = "1";
}
......@@ -163,6 +163,6 @@ public class WorkHistoryController extends BaseController {
pageNum = "15";
}
Page<WorkHistoryDto> page = new Page(Integer.parseInt(pageNum),Integer.parseInt(pageSize));
return ResponseHelper.buildResponse(workHistoryServiceImpl.pageList(page, tzUgpWorkHistory));
return ResponseHelper.buildResponse(workHistoryServiceImpl.pageList(page, tzUgpWorkHistory,sequenceNbr));
}
}
......@@ -177,7 +177,7 @@ public class OrgServiceImpl {
if(ValidationUtil.isEmpty(code)){
c = 0001;
}else{
c = Integer.parseInt(code.substring(code.indexOf("-"),code.length() - 1))+1;
c = Integer.parseInt(code.substring(code.indexOf("-")+1,code.length()))+1;
}
String welderCode = OrgEnum.焊工.getKey() +"-"+ c;
......@@ -368,8 +368,12 @@ public class OrgServiceImpl {
throw new Exception("该企业/部门下还有人员,不可删除!");
}
}
orgUsrServiceImpl.deleteBySeq(Long.valueOf(sequencenNbr));
}
/**
* 获取企业下的人员信息列表
* @param companyId 单位/企业id
......
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.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;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule;
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.api.service.IProjectResourceService;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectResourceDto;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import io.swagger.annotations.Api;
import org.aspectj.weaver.ast.Test;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Arrays;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum.*;
......@@ -42,6 +52,18 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
@Autowired
EquipmentMapper equipmentMapper;
@Autowired
OrgServiceImpl orgService;
@Autowired
SuperviseRuleServiceImpl superviseRuleService;
@Autowired
MaterialServiceImpl materialService;
@Autowired
EquipmentServiceImpl equipmentService;
/**
* 分页查询
*/
......@@ -147,7 +169,91 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
this.save(projectResource);
}
return Resource;
}
/**
* 获取当前登录人所在单位下的所有项目列表
* @return
*/
@BusinessIdentify
List<Project> getProjectList(){
ReginParams reginParams = orgService.getReginParams();
ReginParams.BusinessInfo businessInfo = reginParams.getBusinessInfo();
String companyId = String.valueOf(businessInfo.getCompanySequenceNbr());
String roleName = reginParams.getRole().getRoleName();
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
List<Project> projectList = new ArrayList<>();
String reginCode = "";
if(OrgEnum.监察部门.getName().equals(roleName)){
wrapper.eq(SuperviseRule::getSuperviseDeptId,companyId);
reginCode = superviseRuleService.getOne(wrapper).getAdminRegion();
} else if(OrgEnum.监检机构.getName().equals(roleName)){
wrapper.eq(SuperviseRule::getInspectionUnitId,companyId);
reginCode = superviseRuleService.getOne(wrapper).getAdminRegion();
} else {
projectList = projectResourceMapper.getProjectPage(roleName,companyId);
}
if(!ValidationUtil.isEmpty(reginCode)){
projectList = projectResourceMapper.getProjectPage(roleName,reginCode);
}
return projectList;
}
/**
* 获取当前登录所在单位下的项目中的所有资源列表
* @return
*/
@BusinessIdentify
public IPage getResourceInfo(String type,IPage page){
List<Project> projectList = this.getProjectList();
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<>();
projectResourceWrapper.eq(ProjectResource::getType, type)
.eq(ProjectResource::getProjectId,projectId);
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){
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){
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){
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);
}
return page;
}
}
\ No newline at end of file
......@@ -4,11 +4,14 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectInitiation;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
......@@ -169,14 +172,7 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
}
//项目模糊筛选
public Page<ProjectDto> queryProjectPage(int current, int size, Project project) {
Page<ProjectDto> page = new Page<>();
page.setSize(size);
page.setCurrent(current);
this.list();
List<ProjectDto> projects = projectMapper.queryProjectPage(project);
page.setRecords(projects);
return page;
public IPage<ProjectDto> queryProjectPage(IPage<ProjectDto> page, Project project) {
return projectMapper.queryProjectPage(page,project);
}
}
\ No newline at end of file
......@@ -39,16 +39,13 @@ public class WelderServiceImpl {
String secretKey;
/**
* 获取当前登录所在单位下的项目中的所有焊工列表
* @return
*/
@BusinessIdentify
public List<Map> getInfo(){
ReginParams reginParams = orgService.getReginParams();
ReginParams.BusinessInfo businessInfo = reginParams.getBusinessInfo();
Long companySequenceNbr = businessInfo.getCompanySequenceNbr();
//默认建设单位
LambdaQueryWrapper<Project> projectWrapper = new LambdaQueryWrapper<>();
projectWrapper.eq(Project::getConstructionUnitId,companySequenceNbr);
List<Project> projectList = projectService.list(projectWrapper);
List<Project> projectList = projectResourceService.getProjectList();
List<Long> projectIdList = new ArrayList<>();
List<Long> welderIdList = new ArrayList<>();
for(Project project:projectList){
......
......@@ -37,7 +37,7 @@ public class WorkHistoryServiceImpl extends BaseService<WorkHistoryDto,WorkHisto
return this.queryForList("" , false);
}
public IPage<WorkHistoryDto> pageList(Page<WorkHistoryDto> page, WorkHistoryDto tzUgpWorkHistory){
return workHistoryMapper.pageList(page, tzUgpWorkHistory);
public IPage<WorkHistoryDto> pageList(Page<WorkHistoryDto> page, WorkHistoryDto tzUgpWorkHistory,String sequenceNbr){
return workHistoryMapper.pageList(page, tzUgpWorkHistory,sequenceNbr);
}
}
\ No newline at end of file
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