Commit 9f0c274d authored by limei's avatar limei

项目列表、安装告知短信接口修改

parent 14a1039c
...@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Set;
/** /**
* 项目安装告知短信记录表 Mapper 接口 * 项目安装告知短信记录表 Mapper 接口
* *
...@@ -18,7 +20,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -18,7 +20,7 @@ import org.apache.ibatis.annotations.Param;
public interface InstallNoticeMsgMapper extends BaseMapper<InstallNoticeMsg> { public interface InstallNoticeMsgMapper extends BaseMapper<InstallNoticeMsg> {
//安装告知申请页面分页列表 //安装告知申请页面分页列表
Page<InstallNoticeMsgPageDto> InstallNoticeMsgPage(IPage<InstallNoticeMsgPageDto> page, @Param("name") String name, @Param("installationUnit") String installationUnit ); Page<InstallNoticeMsgPageDto> InstallNoticeMsgPage(IPage<InstallNoticeMsgPageDto> page, @Param("name") String name, @Param("installationUnit") String installationUnit,Set<String> seqs);
Page<InstallNoticeMsgPageDto> selectByName(Page<InstallNoticeMsgPageDto> page, @Param("name") String name, @Param("unit") String unit); Page<InstallNoticeMsgPageDto> selectByName(Page<InstallNoticeMsgPageDto> page, @Param("name") String name, @Param("unit") String unit);
......
...@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* 项目信息表 Mapper 接口 * 项目信息表 Mapper 接口
...@@ -27,5 +28,5 @@ public interface ProjectMapper extends BaseMapper<Project> { ...@@ -27,5 +28,5 @@ public interface ProjectMapper extends BaseMapper<Project> {
ProjectDto getDetail(Long sequenceNbr); ProjectDto getDetail(Long sequenceNbr);
//项目模糊筛选 //项目模糊筛选
Page<ProjectDto> queryProjectPage(IPage<ProjectDto> page, Project project); IPage<ProjectDto> queryProjectPage(IPage<ProjectDto> page, Project project, String roleName, String companyId,Set<String> codes);
} }
...@@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.ast.Test;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 项目资源表(包括焊工、管材、设备) Mapper 接口 * 项目资源表(包括焊工、管材、设备) Mapper 接口
...@@ -41,5 +42,5 @@ public interface ProjectResourceMapper extends BaseMapper<ProjectResource> { ...@@ -41,5 +42,5 @@ public interface ProjectResourceMapper extends BaseMapper<ProjectResource> {
* 获取当前登录人所在单位下的所有项目 * 获取当前登录人所在单位下的所有项目
* 根据登录人角色去筛选 * 根据登录人角色去筛选
*/ */
List<Project> getProjectPage(String roleName, String companyId); List<Project> getProjectPage(String roleName, String companyId, Set<String> codes);
} }
...@@ -16,5 +16,5 @@ import com.yeejoin.amos.boot.module.ugp.api.entity.Project; ...@@ -16,5 +16,5 @@ import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
*/ */
public interface IProjectService { public interface IProjectService {
Page<ProjectDto> queryProjectPage(Page<ProjectDto> page, Project project); public IPage<ProjectDto> queryProjectPage(String current,String size, Project project);
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="com.yeejoin.amos.boot.module.ugp.api.mapper.InstallNoticeMsgMapper"> <mapper namespace="com.yeejoin.amos.boot.module.ugp.api.mapper.InstallNoticeMsgMapper">
<select id="InstallNoticeMsgPage" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeMsgPageDto"> <select id="InstallNoticeMsgPage" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeMsgPageDto">
SELECT name, SELECT `name`,
install_region, install_region,
start_date, start_date,
construction_unit, construction_unit,
...@@ -24,6 +24,12 @@ ...@@ -24,6 +24,12 @@
<if test="installationUnit != null and installationUnit != ''"> <if test="installationUnit != null and installationUnit != ''">
and tz_ugp_project.installation_unit like concat("%",#{installationUnit},"%") and tz_ugp_project.installation_unit like concat("%",#{installationUnit},"%")
</if> </if>
<if test=" seqs != null">
and tz_ugp_install_notice_msg.install_notice_id in
<foreach collection="seqs" item = "item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select> </select>
<select id="selectByName" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeMsgPageDto"> <select id="selectByName" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeMsgPageDto">
SELECT name, SELECT name,
......
...@@ -21,6 +21,23 @@ ...@@ -21,6 +21,23 @@
<select id="queryProjectPage" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto"> <select id="queryProjectPage" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto">
select * from tz_ugp_project select * from tz_ugp_project
<where> <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="codes != null ">
<if test="roleName == '监察部门' or roleName == '监检机构'">
and install_region_code in
<foreach collection="codes" item = "item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="project.name != '' and project.name != null"> <if test="project.name != '' and project.name != null">
and `name` like concat('%',#{project.name},'%') and `name` like concat('%',#{project.name},'%')
</if> </if>
......
...@@ -123,8 +123,13 @@ ...@@ -123,8 +123,13 @@
<if test="roleName == '设计单位'"> <if test="roleName == '设计单位'">
and design_unit_id = #{companyId} and design_unit_id = #{companyId}
</if> </if>
<if test="codes != null ">
<if test="roleName == '监察部门' or roleName == '监检机构'"> <if test="roleName == '监察部门' or roleName == '监检机构'">
and install_region_code = #{companyId} and install_region_code in
<foreach collection="codes" item = "item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if> </if>
</where> </where>
</select> </select>
......
...@@ -160,16 +160,12 @@ public class ProjectController extends BaseController { ...@@ -160,16 +160,12 @@ public class ProjectController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "项目信息表分页查询", notes = "项目信息表分页查询") @ApiOperation(httpMethod = "GET",value = "项目信息表分页查询", notes = "项目信息表分页查询")
public ResponseModel<Page<ProjectDto>> queryForPage( public ResponseModel<IPage<ProjectDto>> queryForPage(String current,String size, Project project) {
@RequestParam(value = "current") int current, return ResponseHelper.buildResponse(projectServiceImpl.queryProjectPage(current,size,project));
@RequestParam(value = "size") int size, Project project) {
Page<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.service.impl; package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeMsgPageDto; import com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeMsgPageDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.InstallNotice;
import com.yeejoin.amos.boot.module.ugp.api.entity.InstallNoticeMsg; import com.yeejoin.amos.boot.module.ugp.api.entity.InstallNoticeMsg;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.mapper.InstallNoticeMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.InstallNoticeMsgMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.InstallNoticeMsgMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IInstallNoticeMsgService; import com.yeejoin.amos.boot.module.ugp.api.service.IInstallNoticeMsgService;
import com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeMsgDto; import com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeMsgDto;
...@@ -9,7 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,7 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 项目安装告知短信记录表服务实现类 * 项目安装告知短信记录表服务实现类
...@@ -22,6 +31,12 @@ public class InstallNoticeMsgServiceImpl extends BaseService<InstallNoticeMsgDto ...@@ -22,6 +31,12 @@ public class InstallNoticeMsgServiceImpl extends BaseService<InstallNoticeMsgDto
@Autowired @Autowired
InstallNoticeMsgMapper installNoticeMsgMapper; InstallNoticeMsgMapper installNoticeMsgMapper;
@Autowired
ProjectResourceServiceImpl projectResourceService;
@Autowired
InstallNoticeMapper installNoticeMapper;
@Autowired
InstallNoticeServiceImpl installNoticeService;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -41,7 +56,20 @@ public class InstallNoticeMsgServiceImpl extends BaseService<InstallNoticeMsgDto ...@@ -41,7 +56,20 @@ public class InstallNoticeMsgServiceImpl extends BaseService<InstallNoticeMsgDto
*/ */
@Override @Override
public Page<InstallNoticeMsgPageDto> installNoticeMsgList(Page<InstallNoticeMsgPageDto> page, String name, String installationUnit){ public Page<InstallNoticeMsgPageDto> installNoticeMsgList(Page<InstallNoticeMsgPageDto> page, String name, String installationUnit){
return this.getBaseMapper().InstallNoticeMsgPage(page, name, installationUnit); List<Project> projectList = projectResourceService.getProjectList();
List<InstallNotice> installNoticeList = new ArrayList<>();
for(Project project: projectList){
LambdaQueryWrapper<InstallNotice> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InstallNotice::getProjectId,project.getSequenceNbr());
List<InstallNotice> installNotice = installNoticeService.list(wrapper);
installNoticeList.addAll(installNotice);
}
Set<String> seqs = new HashSet<>();
for(InstallNotice installNotice : installNoticeList){
String seq = String.valueOf(installNotice.getSequenceNbr());
seqs.add(seq);
}
return installNoticeMsgMapper.InstallNoticeMsgPage(page, name, installationUnit,seqs);
} }
@Override @Override
......
...@@ -221,19 +221,24 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P ...@@ -221,19 +221,24 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
String roleName = reginParams.getRole().getRoleName(); String roleName = reginParams.getRole().getRoleName();
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
List<Project> projectList = new ArrayList<>(); List<Project> projectList = new ArrayList<>();
String reginCode = ""; Set<String> codes = new HashSet<>();
if(OrgEnum.监察部门.getName().equals(roleName)){ if(OrgEnum.监察部门.getName().equals(roleName)){
wrapper.eq(SuperviseRule::getSuperviseDeptId,companyId); wrapper.eq(SuperviseRule::getSuperviseDeptId,companyId);
reginCode = superviseRuleService.getOne(wrapper).getAdminRegion(); List<SuperviseRule> superviseRuleList = superviseRuleService.list(wrapper);
for (SuperviseRule superviseRule :superviseRuleList){
codes.add(String.valueOf(superviseRule.getAdminRegionCode()));
}
} else if(OrgEnum.监检机构.getName().equals(roleName)){ } else if(OrgEnum.监检机构.getName().equals(roleName)){
wrapper.eq(SuperviseRule::getInspectionUnitId,companyId); wrapper.eq(SuperviseRule::getInspectionUnitId,companyId);
reginCode = superviseRuleService.getOne(wrapper).getAdminRegion(); List<SuperviseRule> superviseRuleList = superviseRuleService.list(wrapper);
for (SuperviseRule superviseRule :superviseRuleList){
codes.add(String.valueOf(superviseRule.getAdminRegionCode()));
}
} else { } else {
projectList = projectResourceMapper.getProjectPage(roleName,companyId); projectList = projectResourceMapper.getProjectPage(roleName,companyId,codes);
} }
if(!ValidationUtil.isEmpty(codes)){
if(!ValidationUtil.isEmpty(reginCode)){ projectList = projectResourceMapper.getProjectPage(roleName,companyId,codes);
projectList = projectResourceMapper.getProjectPage(roleName,reginCode);
} }
return projectList; return projectList;
} }
......
...@@ -6,27 +6,26 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,27 +6,26 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectInitiationEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectInitiationEnum;
import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant; 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.dto.ProjectDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment; import com.yeejoin.amos.boot.module.ugp.api.entity.*;
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; 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.api.service.IProjectService; import com.yeejoin.amos.boot.module.ugp.api.service.IProjectService;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 项目信息表服务实现类 * 项目信息表服务实现类
...@@ -36,6 +35,7 @@ import java.util.List; ...@@ -36,6 +35,7 @@ import java.util.List;
*/ */
@Service @Service
public class ProjectServiceImpl extends BaseService<ProjectDto, Project, ProjectMapper> implements IProjectService { public class ProjectServiceImpl extends BaseService<ProjectDto, Project, ProjectMapper> implements IProjectService {
@Autowired @Autowired
ProjectMapper projectMapper; ProjectMapper projectMapper;
...@@ -48,6 +48,15 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project ...@@ -48,6 +48,15 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
@Autowired @Autowired
EquipmentServiceImpl equipmentService; EquipmentServiceImpl equipmentService;
@Autowired
OrgServiceImpl orgService;
@Autowired
SuperviseRuleServiceImpl superviseRuleService;
@Autowired
ProjectResourceMapper projectResourceMapper;
@Autowired @Autowired
AttachmentServiceImpl attachmentServiceImpl; AttachmentServiceImpl attachmentServiceImpl;
...@@ -175,14 +184,91 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project ...@@ -175,14 +184,91 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
return "ok"; return "ok";
} }
// //项目模糊筛选
// @Override
// public Page<ProjectDto> queryProjectPage(Page<ProjectDto> page, Project project) {
// Page<ProjectDto> projectDtoPage = projectMapper.queryProjectPage(page,project);
// List<ProjectDto> projects = projectDtoPage.getRecords();
// for(ProjectDto projectDto:projects){
// getProjectState(projectDto);
// }
// return projectDtoPage;
// }
//项目模糊筛选 //项目模糊筛选
// @BusinessIdentify
// @Override
// public IPage<ProjectDto> queryProjectPage(String current,String size, Project project) {
// IPage<ProjectDto> page = new Page<>();
// page.setCurrent(Long.parseLong(current));
// page.setSize(Long.parseLong(size));
// ReginParams reginParams = orgService.getReginParams();
// String companyId = String.valueOf(reginParams.getBusinessInfo().getCompanySequenceNbr());
// String roleName = reginParams.getRole().getRoleName();
// LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
// 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 {
// page = projectMapper.queryProjectPage(page, project, roleName, companyId);
// }
// if(!ValidationUtil.isEmpty(reginCode)){
// page = projectMapper.queryProjectPage(page, project, roleName, reginCode);
// }
// List<ProjectDto> projects = page.getRecords();
// for(ProjectDto projectDto:projects){
// getProjectState(projectDto);
// }
// return page;
// }
//
@BusinessIdentify
@Override @Override
public Page<ProjectDto> queryProjectPage(Page<ProjectDto> page, Project project) { public IPage<ProjectDto> queryProjectPage(String current,String size, Project project) {
Page<ProjectDto> projectDtoPage = projectMapper.queryProjectPage(page,project); IPage<ProjectDto> page = new Page<>();
List<ProjectDto> projects = projectDtoPage.getRecords(); page.setCurrent(Long.parseLong(current));
page.setSize(Long.parseLong(size));
ReginParams reginParams = orgService.getReginParams();
String companyId = String.valueOf(reginParams.getBusinessInfo().getCompanySequenceNbr());
String roleName = reginParams.getRole().getRoleName();
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
Set<String> codes = new HashSet<>();
if(OrgEnum.监察部门.getName().equals(roleName)){
wrapper.eq(SuperviseRule::getSuperviseDeptId,companyId);
List<SuperviseRule> superviseRuleList = superviseRuleService.list(wrapper);
for (SuperviseRule superviseRule :superviseRuleList){
codes.add(String.valueOf(superviseRule.getAdminRegionCode()));
}
} else if(OrgEnum.监检机构.getName().equals(roleName)){
wrapper.eq(SuperviseRule::getInspectionUnitId,companyId);
List<SuperviseRule> superviseRuleList = superviseRuleService.list(wrapper);
for (SuperviseRule superviseRule :superviseRuleList){
codes.add(String.valueOf(superviseRule.getAdminRegionCode()));
}
} else {
page = projectMapper.queryProjectPage(page, project, roleName, companyId,codes);
}
if(!ValidationUtil.isEmpty(codes)){
page = projectMapper.queryProjectPage(page, project, roleName,companyId,codes);
}
List<ProjectDto> projects = page.getRecords();
for(ProjectDto projectDto:projects){ for(ProjectDto projectDto:projects){
getProjectState(projectDto); getProjectState(projectDto);
} }
return projectDtoPage; return page;
} }
} }
\ 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