diff --git a/src/main/java/com/biutag/supervision/controller/rightsComfort/RightsController.java b/src/main/java/com/biutag/supervision/controller/rightsComfort/RightsController.java index 62610fd..aa9530f 100644 --- a/src/main/java/com/biutag/supervision/controller/rightsComfort/RightsController.java +++ b/src/main/java/com/biutag/supervision/controller/rightsComfort/RightsController.java @@ -3,13 +3,13 @@ package com.biutag.supervision.controller.rightsComfort; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.supervision.constants.enums.RpcApplyTypeEnum; import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.entity.RpcApplyPerson; import com.biutag.supervision.pojo.param.RpcApplyQueryParam; import com.biutag.supervision.pojo.vo.RpcApplyVo; +import com.biutag.supervision.service.RpcApplyPersonService; import com.biutag.supervision.service.RpcApplyService; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * @author wxc @@ -22,8 +22,19 @@ public class RightsController { private final RpcApplyService rpcApplyService; + private final RpcApplyPersonService rpcApplyPersonService; + @GetMapping public Result> list(RpcApplyQueryParam queryParam) { - return Result.success(rpcApplyService.page(queryParam, RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue())); +// return Result.success(rpcApplyService.page(queryParam, RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue())); + + return Result.success(rpcApplyService.pageData(queryParam,RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue())); + } + + + @DeleteMapping("{id}") + public Result del(@PathVariable String id) { + rpcApplyPersonService.removeById(id); + return Result.success(); } } diff --git a/src/main/java/com/biutag/supervision/job/Job.java b/src/main/java/com/biutag/supervision/job/Job.java index d1b30e3..a4e1956 100644 --- a/src/main/java/com/biutag/supervision/job/Job.java +++ b/src/main/java/com/biutag/supervision/job/Job.java @@ -127,7 +127,7 @@ public class Job { // 每天一次 23:30:00 //todo 维权信息 -// @Scheduled(cron = "0 30 23 * * ?") + @Scheduled(cron = "0 30 23 * * ?") public void rights() throws ParseException { log.info("rights--------------------"); log.info("维权信息抓取中---------------------"); diff --git a/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java b/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java index af7a1b2..7f09a8a 100644 --- a/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java @@ -216,6 +216,7 @@ public interface RpcApplyMapper extends BaseMapper { "HAVING `name` is NOT NULL ") List getSubOneIncidentOrg(Date beginTime, Date endTime, Integer departId); + Page queryRightsPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); Page queryPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); @Select("select max(number_index) from rpc_apply where year = #{year}") @@ -244,7 +245,7 @@ public interface RpcApplyMapper extends BaseMapper { * */ @Select(" select sdp.short_name as label,COUNT(*) as value from rpc_apply ra " + " LEFT JOIN sup_depart sdp on ra.second_depart_id = sdp.id " + - " WHERE sdp.statistics_group_id = #{departGroupId} and ra.type =1 " + + " WHERE sdp.statistics_group_id = #{departGroupId} and ra.type =1 and ra.verified= '2' " + " and ra.crt_time BETWEEN #{beginTime} and #{endTime} " + " GROUP BY sdp.short_name order by value desc ") List selectProtectRightsBarList(Date beginTime, Date endTime, Integer departGroupId); @@ -257,7 +258,7 @@ public interface RpcApplyMapper extends BaseMapper { @Select(" SELECT sdp.short_name as label, COUNT(*) as value from rpc_apply ra " + " left join sup_depart sdp on ra.depart_id = sdp.id " + " where sdp.pid = #{departId} " + - " and ra.type =1 and sdp.statistics_group_id = #{departGroupId} " + + " and ra.type =1 and sdp.statistics_group_id = #{departGroupId} and ra.verified= '2' " + " and ra.crt_time BETWEEN #{beginTime} AND #{endTime} " + " GROUP BY sdp.short_name order by value desc") List selectSubPcsProtectRightsBarList(Date beginTime, Date endTime, Integer departId, Integer departGroupId); @@ -269,7 +270,7 @@ public interface RpcApplyMapper extends BaseMapper { " left join sup_depart sdp on ra.depart_id = sdp.id " + " where sdp.pid = #{departId} " + " and ra.type =1 and sdp.statistics_group_id != #{departGroupId} " + - " and ra.crt_time BETWEEN #{beginTime} AND #{endTime} " + + " and ra.crt_time BETWEEN #{beginTime} AND #{endTime} and ra.verified= '2' " + " GROUP BY sdp.short_name order by value desc") List selectSubDdProtectRightsBarList(Date beginTime, Date endTime, Integer departId, Integer departGroupId); diff --git a/src/main/java/com/biutag/supervision/pojo/vo/RpcApplyVo.java b/src/main/java/com/biutag/supervision/pojo/vo/RpcApplyVo.java index f4e251a..2273d96 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/RpcApplyVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/RpcApplyVo.java @@ -16,6 +16,8 @@ import java.time.LocalDateTime; @Getter public class RpcApplyVo { + private String personId; + private String rpcId; private String number; diff --git a/src/main/java/com/biutag/supervision/service/RpcApplyService.java b/src/main/java/com/biutag/supervision/service/RpcApplyService.java index fd2284d..8e1e320 100644 --- a/src/main/java/com/biutag/supervision/service/RpcApplyService.java +++ b/src/main/java/com/biutag/supervision/service/RpcApplyService.java @@ -82,6 +82,40 @@ public class RpcApplyService extends ServiceImpl { return baseMapper.queryPage(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper); } + + + public Page pageData(RpcApplyQueryParam queryParam,String type){ + UserAuth user = UserContextHolder.getCurrentUser(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType())) { + List rightPeoples = rpcRightPersonService.list(user.getUserName()); + if (rightPeoples.isEmpty()) { + return new Page().setTotal(0).setRecords(new ArrayList<>()); + } + // 是否是市局维权专干 + if (rightPeoples.stream().noneMatch(item -> "1".equals(item.getCouncil()))) { + Set departIds = rightPeoples.stream().map(RpcRightPerson::getDepartId).collect(Collectors.toSet()); + List childrenIds = departService.getAllNodeIds(departIds); + queryWrapper.in("a.handle_depart_id", childrenIds); + } + } + queryWrapper.like(StrUtil.isNotBlank(queryParam.getApplicantEmpName()), "a.applicant_emp_name", queryParam.getApplicantEmpName()) + .eq(StrUtil.isNotBlank(queryParam.getDepartId()), "a.depart_id", queryParam.getDepartId()) + .eq("a.type", type) + .eq(StrUtil.isNotBlank(queryParam.getRpcStatus()), "a.rpc_status", queryParam.getRpcStatus()) + .orderByDesc("a.crt_time"); + if (queryParam.getApplyDate() != null && queryParam.getApplyDate().size() == 2) { + queryWrapper.between("a.apply_date", queryParam.getApplyDate().get(0), queryParam.getApplyDate().get(1)); + } + if (queryParam.getHappenTime() != null && queryParam.getHappenTime().size() == 2) { + queryWrapper.between("a.happen_time", queryParam.getHappenTime().get(0), queryParam.getHappenTime().get(1)); + } + if(StrUtil.isNotBlank(queryParam.getCode())){ + queryWrapper.eq("a.verified","2"); + } + return baseMapper.queryRightsPage(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper); + } + public Integer getNewNumberIndex(Integer year) { return NumberUtil.nullToZero(baseMapper.selectMaxNuberIndex(year)) + 1; } diff --git a/src/main/resources/mapper/RpcApplyMapper.xml b/src/main/resources/mapper/RpcApplyMapper.xml index 07b92f5..39e24a7 100644 --- a/src/main/resources/mapper/RpcApplyMapper.xml +++ b/src/main/resources/mapper/RpcApplyMapper.xml @@ -13,4 +13,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${ew.getCustomSqlSegment} +