src/main/java/org/springblade/modules/taskPlaceRectification/dto/TaskPlaceRectificationDTO.java
@@ -98,5 +98,15 @@ @ApiModelProperty(value = "结束时间", example = "") private String endTime; /** * 角色名称 */ private String roleName; /** * 社区编号 */ private String communityCode; } src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.java
@@ -61,10 +61,12 @@ * @param taskPlaceRectificationDTO 场所整改任务表 * @return 场所整改任务表集合 */ public List<TaskPlaceRectificationVO> selectTaskPlaceRectificationList(IPage page, List<TaskPlaceRectificationVO> selectTaskPlaceRectificationList(IPage page, @Param("taskPalce") TaskPlaceRectificationDTO taskPlaceRectificationDTO, @Param("regionChildCodesList") List<String> regionChildCodesList, @Param("isAdministrator") Integer isAdministrator); @Param("isAdministrator") Integer isAdministrator, @Param("gridCodeList") List<String> gridCodeList, @Param("nineTypeList") List<String> nineTypeList); List<Map<String, Object>> getNineTypeStatistics(String code, List<String> regionChildCodesList, @@ -73,5 +75,7 @@ List<TaskPlaceRectificationExcel> export(@Param("taskPalce") TaskPlaceRectificationsVO taskPlaceRectification, @Param("regionChildCodesList") List<String> regionChildCodesList, @Param("isAdministrator") Integer isAdministrator); @Param("isAdministrator") Integer isAdministrator, @Param("gridCodeList") List<String> gridCodeList, @Param("nineTypeList") List<String> nineTypeList); } src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml
@@ -198,15 +198,14 @@ bu.`name`, jpe.legal_tel, jpe.legal_person, jda.address_name jp.location as address_name FROM jczz_task_place_rectification jtpr LEFT JOIN jczz_place jp ON jtpr.house_code = jp.house_code LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code LEFT JOIN jczz_place jp ON jtpr.house_code = jp.house_code and jp.is_deleted = 0 LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code and jg.is_deleted = 0 LEFT JOIN blade_region br ON br.`code` = jg.community_code LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id LEFT JOIN blade_user bu ON bu.id = jtpr.create_user LEFT JOIN jczz_doorplate_address jda on jda.address_code=jtpr.house_code LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code <where> <if test="taskPalce.id != null ">and jtpr.id = #{taskPalce.id}</if> @@ -228,15 +227,18 @@ </if> <if test="taskPalce.addressName!=null and taskPalce.addressName!=''"> and jda.address_name like concat('%',#{taskPalce.addressName},'%') and jp.location like concat('%',#{taskPalce.addressName},'%') </if> <if test="taskPalce.deptName!=null and taskPalce.deptName!=''"> and jpag.pcs_name like concat('%',#{taskPalce.deptName},'%') </if> <if test="taskPalce.nineType!=null"> and jp.nine_type = #{taskPalce.nineType} <if test="nineTypeList!=null and nineTypeList.size()>0"> and jp.nine_type in <foreach collection="nineTypeList" separator="," open="(" close=")" item="nineType"> #{nineType} </foreach> </if> <if test="taskPalce.punishFlag!=null"> @@ -275,25 +277,57 @@ </if> <if test="isAdministrator==2"> <choose> <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> and ( jg.grid_code in <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> #{code} </foreach> or br.village_code in <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> #{code} </foreach> ) <when test="taskPalce.roleName != null and taskPalce.roleName != ''"> <if test="taskPalce.roleName=='wgy'"> <choose> <when test="gridCodeList !=null and gridCodeList.size()>0"> and jp.grid_code in <foreach collection="gridCodeList" item="code" open="(" close=")" separator=","> #{code} </foreach> </when> <otherwise> and jp.grid_code in ('') </otherwise> </choose> </if> <if test="taskPalce.roleName=='mj'"> <choose> <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> and jpag.community_code in <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> #{code} </foreach> </when> <otherwise> and jpag.community_code in ('') </otherwise> </choose> </if> </when> <otherwise> and ( jg.grid_code in ('') or br.village_code in ('') ) <choose> <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> and ( jg.grid_code in <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> #{code} </foreach> or jpag.community_code in <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> #{code} </foreach> ) </when> <otherwise> and ( jg.grid_code in ('') or jpag.community_code in in ('') ) </otherwise> </choose> </otherwise> </choose> </if> @@ -430,7 +464,7 @@ bu.`name`, jpe.legal_tel, jpe.legal_person, jda.address_name jp.location as address_name FROM jczz_task_place_rectification jtpr LEFT JOIN jczz_place jp ON jtpr.house_code = jp.house_code @@ -438,7 +472,6 @@ LEFT JOIN blade_region br ON br.`code` = jg.community_code LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id LEFT JOIN blade_user bu ON bu.id = jtpr.create_user LEFT JOIN jczz_doorplate_address jda on jda.address_code=jtpr.house_code LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code <where> <if test="taskPalce.id != null ">and jtpr.id = #{taskPalce.id}</if> @@ -460,15 +493,18 @@ </if> <if test="taskPalce.addressName!=null and taskPalce.addressName!=''"> and jda.address_name like concat('%',#{taskPalce.addressName},'%') and jp.location like concat('%',#{taskPalce.addressName},'%') </if> <if test="taskPalce.deptName!=null and taskPalce.deptName!=''"> and jpag.pcs_name like concat('%',#{taskPalce.deptName},'%') </if> <if test="taskPalce.nineType!=null"> and jp.nine_type = #{taskPalce.nineType} <if test="nineTypeList!=null and nineTypeList.size()>0"> and jp.nine_type in <foreach collection="nineTypeList" separator="," open="(" close=")" item="nineType"> #{nineType} </foreach> </if> <if test="taskPalce.punishFlag!=null"> @@ -507,25 +543,57 @@ </if> <if test="isAdministrator==2"> <choose> <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> and ( jg.grid_code in <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> #{code} </foreach> or br.village_code in <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> #{code} </foreach> ) <when test="taskPalce.roleName != null and taskPalce.roleName != ''"> <if test="taskPalce.roleName=='wgy'"> <choose> <when test="gridCodeList !=null and gridCodeList.size()>0"> and jp.grid_code in <foreach collection="gridCodeList" item="code" open="(" close=")" separator=","> #{code} </foreach> </when> <otherwise> and jp.grid_code in ('') </otherwise> </choose> </if> <if test="taskPalce.roleName=='mj'"> <choose> <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> and jpag.community_code in <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> #{code} </foreach> </when> <otherwise> and jpag.community_code in ('') </otherwise> </choose> </if> </when> <otherwise> and ( jg.grid_code in ('') or br.village_code in ('') ) <choose> <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> and ( jg.grid_code in <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> #{code} </foreach> or jpag.community_code in <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> #{code} </foreach> ) </when> <otherwise> and ( jg.grid_code in ('') or jpag.community_code in in ('') ) </otherwise> </choose> </otherwise> </choose> </if> src/main/java/org/springblade/modules/taskPlaceRectification/service/impl/TaskPlaceRectificationServiceImpl.java
@@ -17,16 +17,20 @@ package org.springblade.modules.taskPlaceRectification.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import liquibase.repackaged.org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.util.Strings; import org.springblade.common.cache.SysCache; import org.springblade.common.utils.SpringUtils; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.SpringUtil; import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService; import org.springblade.modules.grid.service.IGridService; import org.springblade.modules.patrol.entity.PatrolRecord; import org.springblade.modules.patrol.service.IPatrolRecordService; import org.springblade.modules.patrol.vo.PatrolRecordVO; @@ -52,6 +56,7 @@ import org.springblade.modules.taskPlaceRectification.service.ITaskPlaceRectificationService; import org.springblade.modules.taskPlaceRectification.vo.TaskPlaceRectificationVO; import org.springblade.modules.taskPlaceRectification.vo.TaskPlaceRectificationsVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; @@ -59,6 +64,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; /** * 场所整改任务表 服务实现类 @@ -68,6 +74,9 @@ */ @Service public class TaskPlaceRectificationServiceImpl extends ServiceImpl<TaskPlaceRectificationMapper, TaskPlaceRectificationEntity> implements ITaskPlaceRectificationService { @Autowired private IDictBizService dictBizService; @Override public IPage<TaskPlaceRectificationVO> selectTaskPlaceRectificationPage(IPage<TaskPlaceRectificationVO> page, TaskPlaceRectificationVO taskPlaceRectification) { @@ -95,9 +104,48 @@ @Override public IPage<TaskPlaceRectificationVO> selectTaskPlaceRectificationList(IPage<TaskPlaceRectificationVO> page, TaskPlaceRectificationDTO taskPlaceRectificationDTO) { // 数据过滤 todo String roleName = SpringUtils.getRequestParam("roleName"); String communityCode = SpringUtils.getRequestParam("communityCode"); if (!Strings.isBlank(communityCode)){ // 校验社区编号是否合规 if(null!=SpringUtils.getBean(IRegionService.class).getById(communityCode)) { taskPlaceRectificationDTO.setCommunityCode(communityCode); } } List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2; List<TaskPlaceRectificationVO> taskPlaceRectificationVOS = baseMapper.selectTaskPlaceRectificationList(page, taskPlaceRectificationDTO, regionChildCodesList, isAdministrator); Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; // 网格编号集合 List<String> gridCodeList = new ArrayList<>(); // 民警角色 if (!Strings.isBlank(roleName)){ taskPlaceRectificationDTO.setRoleName(roleName); if(roleName.equals("mj")) { regionChildCodesList = SpringUtil.getBean(IPoliceAffairsGridService.class).getCommunityCodeListByUserId(AuthUtil.getUserId()); } if (roleName.equals("wgy")) { gridCodeList = SpringUtil.getBean(IGridService.class).getGridListByUserId(AuthUtil.getUserId()); } } List<String> strings = new ArrayList<>(); if (null!=taskPlaceRectificationDTO.getNineType()){ QueryWrapper<DictBiz> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("is_deleted",0).eq("dict_key",taskPlaceRectificationDTO.getNineType()).eq("code","nineType"); // 先查询当前 DictBiz one = dictBizService.getOne(queryWrapper); // 查询本身和子集的key List<DictBiz> list = dictBizService.getList("nineType", one.getId()); if (list.size()==0){ strings.add(taskPlaceRectificationDTO.getNineType()); }else { strings = list.stream().map(DictBiz::getDictKey).collect(Collectors.toList()); } } List<TaskPlaceRectificationVO> taskPlaceRectificationVOS = baseMapper.selectTaskPlaceRectificationList(page, taskPlaceRectificationDTO, regionChildCodesList, isAdministrator, gridCodeList, strings); for (TaskPlaceRectificationVO taskPlaceRectificationVO : taskPlaceRectificationVOS) { StringBuilder builder = new StringBuilder(""); List<PatrolRecordVO> patrolRecordVOList = taskPlaceRectificationVO.getPatrolRecordVOList(); @@ -166,10 +214,49 @@ @Override public List<TaskPlaceRectificationExcel> export(TaskPlaceRectificationsVO taskPlaceRectificationVO) { // todo // 数据过滤 todo String roleName = SpringUtils.getRequestParam("roleName"); String communityCode = SpringUtils.getRequestParam("communityCode"); if (!Strings.isBlank(communityCode)){ // 校验社区编号是否合规 if(null!=SpringUtils.getBean(IRegionService.class).getById(communityCode)) { taskPlaceRectificationVO.setCommunityCode(communityCode); } } List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2; List<TaskPlaceRectificationExcel> export = baseMapper.export(taskPlaceRectificationVO, regionChildCodesList, isAdministrator); Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; // 网格编号集合 List<String> gridCodeList = new ArrayList<>(); // 民警角色 if (!Strings.isBlank(roleName)){ taskPlaceRectificationVO.setRoleName(roleName); if(roleName.equals("mj")) { regionChildCodesList = SpringUtil.getBean(IPoliceAffairsGridService.class).getCommunityCodeListByUserId(AuthUtil.getUserId()); } if (roleName.equals("wgy")) { gridCodeList = SpringUtil.getBean(IGridService.class).getGridListByUserId(AuthUtil.getUserId()); } } List<String> strings = new ArrayList<>(); if (null!=taskPlaceRectificationVO.getNineType()){ QueryWrapper<DictBiz> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("is_deleted",0).eq("dict_key",taskPlaceRectificationVO.getNineType()).eq("code","nineType"); // 先查询当前 DictBiz one = dictBizService.getOne(queryWrapper); // 查询本身和子集的key List<DictBiz> list = dictBizService.getList("nineType", one.getId()); if (list.size()==0){ strings.add(taskPlaceRectificationVO.getNineType()); }else { strings = list.stream().map(DictBiz::getDictKey).collect(Collectors.toList()); } } List<TaskPlaceRectificationExcel> export = baseMapper.export( taskPlaceRectificationVO, regionChildCodesList, isAdministrator, gridCodeList, strings); IDictBizService bean = SpringUtils.getBean(IDictBizService.class); List<DictBiz> nineType = bean.list(Wrappers.<DictBiz>lambdaQuery().eq(DictBiz::getCode, "nineType").eq(DictBiz::getIsDeleted, 0)); for (TaskPlaceRectificationExcel taskPlaceRectificationExcel : export) { src/main/java/org/springblade/modules/taskPlaceRectification/vo/TaskPlaceRectificationsVO.java
@@ -95,6 +95,16 @@ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date endTime; /** * 角色名称 */ private String roleName; /** * 社区编号 */ private String communityCode; }