springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/ComplaintProgressController.java
@@ -1,6 +1,18 @@ package com.panzhihua.sangeshenbian.controller; import com.panzhihua.common.model.vos.R; import com.panzhihua.sangeshenbian.model.dto.ComplaintProcessDTO; import com.panzhihua.sangeshenbian.service.IComplaintProgressService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -13,8 +25,23 @@ * @author * @since 2025-02-22 */ @Api(tags = {"【2.0.1】诉求办理进度相关接口"}) @RestController @RequestMapping("/complaint-progress") @RequestMapping("/applet/complaint-progress") @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class ComplaintProgressController { private final IComplaintProgressService complaintProgressService; @DeleteMapping("/{id}") @ApiOperation("【2.0.1】删除办理进度") public R<?> delete(@ApiParam(name = "id", value = "进度id", required = true) @PathVariable("id") Long id) { complaintProgressService.removeById(id); return R.ok(); } @PutMapping("/edit") @ApiOperation("【2.0.1】编辑办理进度") public R<?> edit(@RequestBody ComplaintProcessDTO dto) { complaintProgressService.edit(dto); return R.ok(); } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/StaticsController.java
New file @@ -0,0 +1,21 @@ package com.panzhihua.sangeshenbian.controller; import com.panzhihua.sangeshenbian.service.impl.StaticsService; import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @author mitao * @date 2025/5/9 */ @Api(tags = {"【2.0.1】统计分析相关接口"}) @RestController @RequestMapping("/applet/statics") @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class StaticsController { private final StaticsService staticsService; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/SuperviseController.java
New file @@ -0,0 +1,46 @@ package com.panzhihua.sangeshenbian.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; import com.panzhihua.sangeshenbian.model.query.SuperviseQuery; import com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO; import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; import com.panzhihua.sangeshenbian.service.impl.SuperviseService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; /** * @author mitao * @date 2025/5/7 */ @Api(tags = {"小程序-诉求监督"}) @Validated @RestController @RequestMapping("/applet/supervise") @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class SuperviseController extends BaseController { private final SuperviseService superviseService; @PostMapping("/processing-record-page") @ApiOperation("诉求监督-处理记录") public R<Page<ComplaintVO>> queryProcessingRecordPage(@RequestBody SuperviseQuery query) { LoginUserInfoVO loginUserInfo = super.getLoginUserInfo(); return R.ok(superviseService.queryProcessingRecordPage(query,loginUserInfo)); } @PostMapping("/reject-record-page") @ApiOperation("诉求监督-问题驳回池") public R<Page<AppComplaintRejectVO>> queryRejectRecordPage(@RequestBody SuperviseQuery query) { LoginUserInfoVO loginUserInfo = super.getLoginUserInfo(); return R.ok(superviseService.queryRejectRecordPage(query,loginUserInfo)); } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/dao/ComplaintMapper.java
@@ -5,6 +5,7 @@ import com.panzhihua.sangeshenbian.model.entity.Complaint; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.panzhihua.sangeshenbian.model.query.ComplaintQuery; import com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO; import com.panzhihua.sangeshenbian.model.vo.ComplaintTodoVO; import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; import com.panzhihua.sangeshenbian.warpper.MgtComplaintQuery; @@ -88,4 +89,17 @@ * @return */ ComplaintVO getDetailBg(Long id); /** * * @param page * @param keyword * @param accountLevel * @param targetId * @return */ Page<ComplaintVO> queryProcessingRecordPage(Page<ComplaintVO> page,@Param("keyword")String keyword, @Param("accountLevel") Integer accountLevel, @Param("targetId") Long targetId); Page<AppComplaintRejectVO> queryRejectRecordPage(Page<ComplaintVO> page, @Param("keyword") String keyword, @Param("accountLevel") Integer accountLevel, @Param("targetId") Long targetId); } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/dao/ComplaintRejectMapper.java
@@ -6,6 +6,7 @@ import com.panzhihua.sangeshenbian.model.entity.ComplaintReject; import com.panzhihua.sangeshenbian.model.query.ComplaintRejectQuery; import com.panzhihua.sangeshenbian.model.vo.ComplaintRejectVo; import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; import org.apache.ibatis.annotations.Param; /** springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/dto/ComplaintProcessDTO.java
@@ -18,6 +18,9 @@ @ApiModel public class ComplaintProcessDTO { @ApiModelProperty(value = "主键") private Long id; @ApiModelProperty(value = "诉求id") @NotNull(message = "诉求id不能为空") private Long complaintId; springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/dto/UserIdentityDTO.java
@@ -1,8 +1,10 @@ package com.panzhihua.sangeshenbian.model.dto; import io.swagger.annotations.ApiModel; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** * @author mitao @@ -11,6 +13,8 @@ @Data @Builder @ApiModel("用户身份层级") @NoArgsConstructor @AllArgsConstructor public class UserIdentityDTO { /** * 身份标识 1:党员 2:管理员 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/ComplaintAuditRecord.java
@@ -131,5 +131,8 @@ @TableField("apply_name") private String applyName; @ApiModelProperty(value = "审核时间") @TableField("audit_time") private Date auditTime; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/query/SuperviseQuery.java
New file @@ -0,0 +1,18 @@ package com.panzhihua.sangeshenbian.model.query; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; /** * @author mitao * @date 2025/5/7 */ @Data @EqualsAndHashCode(callSuper = true) @ApiModel(value = "诉求监督查询数据传输对象") public class SuperviseQuery extends BasePage{ @ApiModelProperty("关键字") private String keyword; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/AppComplaintRejectVO.java
New file @@ -0,0 +1,39 @@ package com.panzhihua.sangeshenbian.model.vo; import com.fasterxml.jackson.annotation.JsonFormat; import com.panzhihua.sangeshenbian.model.entity.Complaint; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.Date; /** * @author mitao * @date 2025/5/7 */ @Data @EqualsAndHashCode(callSuper = true) @ApiModel("问题驳回视图对象") public class AppComplaintRejectVO extends Complaint { @ApiModelProperty("申请时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; @ApiModelProperty("申请人") private String reporter; @ApiModelProperty("审批时间") private Date auditTime; @ApiModelProperty("审批人") private String auditorName; @ApiModelProperty("驳回理由") private String rejectReason; @ApiModelProperty("驳回类型 1:延期被驳回 2:上报被驳回") private Integer auditType; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/ComplaintVO.java
@@ -90,4 +90,14 @@ @ApiModelProperty(value = "语音文件集合") private List<String> voiceFileList; @ApiModelProperty(value = "添加办理进度数") private Integer progressCount; @ApiModelProperty(value = "已下派次数") private Integer assignmentCount; @ApiModelProperty(value = "已上报次数") private Integer reportCount; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintProgressService.java
@@ -1,5 +1,6 @@ package com.panzhihua.sangeshenbian.service; import com.panzhihua.sangeshenbian.model.dto.ComplaintProcessDTO; import com.panzhihua.sangeshenbian.model.entity.ComplaintProgress; import com.baomidou.mybatisplus.extension.service.IService; @@ -13,4 +14,5 @@ */ public interface IComplaintProgressService extends IService<ComplaintProgress> { void edit(ComplaintProcessDTO dto); } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintProgressServiceImpl.java
@@ -1,10 +1,16 @@ package com.panzhihua.sangeshenbian.service.impl; import cn.hutool.core.bean.BeanUtil; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.sangeshenbian.model.dto.ComplaintProcessDTO; import com.panzhihua.sangeshenbian.model.entity.ComplaintProgress; import com.panzhihua.sangeshenbian.dao.ComplaintProgressMapper; import com.panzhihua.sangeshenbian.service.IComplaintProgressService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.util.Objects; /** * <p> @@ -16,5 +22,12 @@ */ @Service public class ComplaintProgressServiceImpl extends ServiceImpl<ComplaintProgressMapper, ComplaintProgress> implements IComplaintProgressService { @Override public void edit(ComplaintProcessDTO dto) { if (Objects.nonNull(dto.getId())) { throw new ServiceException("办理进度id不能为空"); } ComplaintProgress complaintProgress = BeanUtil.copyProperties(dto, ComplaintProgress.class); this.updateById(complaintProgress); } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -924,6 +924,7 @@ } complaintAuditRecord.setAuditorName(systemUser.getName()); complaintAuditRecord.setAuditorPhone(systemUser.getPhone()); complaintAuditRecord.setAuditTime(new Date()); if (complaintReporAuditDTO.getAuditResult().equals(1)) { complaintAuditRecord.setAuditStatus(1); complaintAuditRecord.setAuditorId(loginUserInfoVO.getUserId()); @@ -1080,6 +1081,7 @@ } complaintAuditRecord.setAuditorName(systemUser.getName()); complaintAuditRecord.setAuditorPhone(systemUser.getPhone()); complaintAuditRecord.setAuditTime(new Date()); //审核通过后,设置诉求延期 if (complaintAuditRecord.getAuditType().equals(1) && complaintAuditRecord.getAuditStatus().equals(0) && dto.getAuditResult().equals(1)) { Complaint complaint = getById(complaintAuditRecord.getComplaintId()); springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/IdentityInformationServiceImpl.java
@@ -60,29 +60,22 @@ // 获取当前身份 if (userIdentityDTO == null){ if (systemUser != null){ handleSystemUserLevelId(phone, systemUser, 2, identityInformationVO); }else if (partyMember != null && partyMember.getAuditStatus() == 1){ identityInformationVO.setIdentity(1); UserIdentityDTO build = UserIdentityDTO.builder().identity(1).build(); redisUtils.set("identity:" + phone, build); }else { identityInformationVO.setIdentity(null); } handleSystemUserLevelId(phone, systemUser, 2, identityInformationVO, partyMember); }else { Integer identity = userIdentityDTO.getIdentity(); identityInformationVO.setIdentity(identity); if (identity == 1 && (partyMember == null || partyMember.getAuditStatus() != 1)){ identityInformationVO.setIdentity(null); redisUtils.remove("identity:" + phone); }else if (identity == 2 && systemUser == null){ identityInformationVO.setIdentity(null); redisUtils.remove("identity:" + phone); }else { }else if (identity == 2){ Integer levelId = userIdentityDTO.getLevelId(); //验证账号所属层级 SystemUserLevel userLevel = systemUserLevelService.getById(levelId); if (Objects.isNull(userLevel)) { handleSystemUserLevelId(phone, systemUser, identity, identityInformationVO); handleSystemUserLevelId(phone, systemUser, identity, identityInformationVO,partyMember); } else { identityInformationVO.setLevelId(levelId); identityInformationVO.setSuperviseFlag(userLevel.getSuperviseFlag()); @@ -157,20 +150,49 @@ * @param identity * @param identityInformationVO */ private void handleSystemUserLevelId(String phone, SystemUser systemUser, Integer identity, IdentityInformation identityInformationVO) { SystemUserLevel userLevel; //当前所属层级不存在,默认为第一个添加的层级 Optional<SystemUserLevel> levelOptional = systemUserLevelService.getByLevelByUserId(systemUser.getId()); if (levelOptional.isPresent()) { userLevel = levelOptional.get(); UserIdentityDTO build = UserIdentityDTO.builder().identity(identity).levelId(userLevel.getId()).build(); private void handleSystemUserLevelId(String phone, SystemUser systemUser, Integer identity, IdentityInformation identityInformationVO, PartyMember partyMember) { // 情况1:系统用户存在 if (Objects.nonNull(systemUser)) { Optional<SystemUserLevel> levelOptional = systemUserLevelService.getByLevelByUserId(systemUser.getId()); if (levelOptional.isPresent()) { // 系统用户有关联的用户级别 SystemUserLevel userLevel = levelOptional.get(); // 设置用户身份信息为系统用户身份 identityInformationVO.setIdentity(identity); identityInformationVO.setLevelId(userLevel.getId()); identityInformationVO.setSuperviseFlag(userLevel.getSuperviseFlag()); identityInformationVO.setSystemUserLevel(userLevel); // 存储到Redis UserIdentityDTO build = UserIdentityDTO.builder() .identity(identity) .levelId(userLevel.getId()) .build(); redisUtils.set("identity:" + phone, build); } else if (partyMember != null && partyMember.getAuditStatus() == 1) { // 系统用户无关联级别,但是有党员身份且审核通过 identityInformationVO.setIdentity(1); UserIdentityDTO build = UserIdentityDTO.builder() .identity(1) .build(); redisUtils.set("identity:" + phone, build); } else { // 系统用户无关联级别,也没有党员身份,清除身份信息 redisUtils.remove("identity:" + phone); } } else if (partyMember != null && partyMember.getAuditStatus() == 1) { // 情况2:不是系统用户,但是党员身份且审核通过 identityInformationVO.setIdentity(1); UserIdentityDTO build = UserIdentityDTO.builder() .identity(1) .build(); redisUtils.set("identity:" + phone, build); identityInformationVO.setIdentity(identity); identityInformationVO.setLevelId(userLevel.getId()); identityInformationVO.setSuperviseFlag(userLevel.getSuperviseFlag()); identityInformationVO.setSystemUserLevel(userLevel); } else { //当前账号没有管理员账号所属层级,清空账号当前层级信息 // 情况3:既不是系统用户也不是审核通过的党员,清除身份信息 redisUtils.remove("identity:" + phone); } } @@ -184,20 +206,20 @@ throw new ServiceException("您的账号已被冻结,请联系管理员"); } List<PermissionsVO> permissions = identityInformation.getPermissions(); if (CollectionUtil.isEmpty(permissions)){ if (CollectionUtil.isEmpty(permissions) || Objects.isNull(identityInformation.getIdentity())){ throw new ServiceException("请先完成认证"); } SystemUser systemUser = identityInformation.getSystemUser(); if (systemUser == null && identityInformation.getIdentity() == 2) { if (identityInformation.getIdentity() == 2 && Objects.isNull(systemUser)) { throw new ServiceException("管理员信息不存在"); } SystemUserLevel systemUserLevel = identityInformation.getSystemUserLevel(); if (systemUserLevel == null && identityInformation.getIdentity() == 2) { if (identityInformation.getIdentity() == 2&&Objects.isNull(systemUserLevel)) { throw new ServiceException("管理员所属层级不存在"); } PartyMember partyMember = identityInformation.getPartyMember(); if (partyMember == null && identityInformation.getIdentity() == 1) { if (identityInformation.getIdentity() == 1 && Objects.isNull(partyMember)) { throw new ServiceException("党员信息不存在"); } return identityInformation; springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/StaticsService.java
New file @@ -0,0 +1,25 @@ package com.panzhihua.sangeshenbian.service.impl; import com.panzhihua.sangeshenbian.service.IBcRegionService; import com.panzhihua.sangeshenbian.service.IComActService; import com.panzhihua.sangeshenbian.service.IComStreetService; import com.panzhihua.sangeshenbian.service.IComplaintService; import com.panzhihua.sangeshenbian.service.IdentityInformationService; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; /** * @author mitao * @date 2025/5/9 */ @RequiredArgsConstructor(onConstructor_ = {@Lazy}) @Service public class StaticsService { private final IdentityInformationService identityInformationService; private final IComplaintService complaintService; private final IBcRegionService bcRegionService; private final IComStreetService comStreetService; private final IComActService comActService; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SuperviseService.java
New file @@ -0,0 +1,87 @@ package com.panzhihua.sangeshenbian.service.impl; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.sangeshenbian.dao.ComplaintMapper; import com.panzhihua.sangeshenbian.dao.ComplaintRejectMapper; import com.panzhihua.sangeshenbian.model.entity.SystemUserLevel; import com.panzhihua.sangeshenbian.model.query.SuperviseQuery; import com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO; import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; import com.panzhihua.sangeshenbian.service.IdentityInformationService; import com.panzhihua.sangeshenbian.warpper.IdentityInformation; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; /** * @author mitao * @date 2025/5/7 */ @Service @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class SuperviseService { private final IdentityInformationService identityInformationService; private final ComplaintMapper complaintMapper; public Page<ComplaintVO> queryProcessingRecordPage(SuperviseQuery query, LoginUserInfoVO loginUserInfo) { IdentityInformation currentIdentityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfo); Integer identity = currentIdentityInformation.getIdentity(); if (!identity.equals(2)) { throw new ServiceException("当前账号无权限"); } Long targetId = null; SystemUserLevel systemUserLevel = currentIdentityInformation.getSystemUserLevel(); Integer accountLevel = systemUserLevel.getLevel(); switch (accountLevel) { case 1: //市级 targetId = 510400L; break; case 2: //区县级 targetId = Long.valueOf(systemUserLevel.getDistrictsCode()); break; case 3: //街道 targetId = Long.valueOf(systemUserLevel.getStreetId()); break; case 4: //社区 targetId = systemUserLevel.getCommunityId(); break; } return complaintMapper.queryProcessingRecordPage(new Page<>(query.getPageNum(), query.getPageSize()), query.getKeyword(), accountLevel, targetId); } public Page<AppComplaintRejectVO> queryRejectRecordPage(SuperviseQuery query, LoginUserInfoVO loginUserInfo) { IdentityInformation currentIdentityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfo); Integer identity = currentIdentityInformation.getIdentity(); if (!identity.equals(2) || currentIdentityInformation.getSuperviseFlag().equals(0)) { throw new ServiceException("当前账号无权限"); } Long targetId = null; SystemUserLevel systemUserLevel = currentIdentityInformation.getSystemUserLevel(); Integer accountLevel = systemUserLevel.getLevel(); switch (accountLevel) { case 1: //市级 targetId = 510400L; break; case 2: //区县级 targetId = Long.valueOf(systemUserLevel.getDistrictsCode()); break; case 3: //街道 targetId = Long.valueOf(systemUserLevel.getStreetId()); break; case 4: //社区 targetId = systemUserLevel.getCommunityId(); break; } return complaintMapper.queryRejectRecordPage(new Page<>(query.getPageNum(), query.getPageSize()), query.getKeyword(), accountLevel, targetId); } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
@@ -87,10 +87,21 @@ sc.images, sc.videos, CASE /* 当诉求是当前用户处理的,显示正常状态 */ WHEN (scar.superior_id = #{targetId} OR scar.create_by = #{query.userId}) THEN CASE WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 7 WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 5 WHEN sc.status = 0 and scar.audit_status = 2 THEN 6 WHEN sc.status = 0 and scar.audit_status = 2 and scar.audit_type = 2 THEN 6 WHEN sc.status = 0 and scar.audit_status = 2 and scar.audit_type = 1 THEN 9 ELSE sc.status END /* 当诉求不是当前用户处理的,已办结(3)保持不变,其他状态都显示为正在办理(0) */ ELSE CASE WHEN sc.status = 3 THEN 3 ELSE 0 END END AS status, sc.report_type, sc.superior_id, @@ -129,26 +140,28 @@ and sc.city_code = #{targetId} </if> <if test="2 == accountLevel"> and (sc.districts_code = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) and (sc.districts_code = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) </if> <if test="3 == accountLevel"> and (sc.street_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) and (sc.street_id = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) </if> <if test="4 == accountLevel"> and (sc.community_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) and (sc.community_id = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) </if> <if test="5 == accountLevel"> and (sc.party_member_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) and (sc.party_member_id = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) </if> <if test="query.type!=null and query.type == 0"> AND (scar.superior_id = #{targetId} or scar.create_by = #{query.userId}) AND sc.status IN(0,1,2) and scar.audit_status = 0 </if> <if test="query.type!=null and query.type == 1"> AND (sc.status IN(0,1,2) and scar.audit_status != 0 || sc.status IN(0,1,2) and scar.audit_status is null) OR ( scar.superior_id != #{targetId} AND scar.create_by != #{query.userId} AND sc.status IN(0,1,2) and scar.audit_status = 0 AND ( /* 如果是当前用户处理的诉求,正常显示正在办理的诉求 */ ((scar.superior_id = #{targetId} OR scar.create_by = #{query.userId}) AND sc.status IN(0,1,2)) OR /* 如果不是当前用户处理的诉求,只要不是已办结(3)或已评价(8)的都算作正在办理 */ ((scar.superior_id != #{targetId} AND scar.create_by != #{query.userId} OR scar.superior_id IS NULL) AND sc.status NOT IN(3,8)) ) </if> <if test="query.type!=null and query.type == 2"> @@ -309,17 +322,17 @@ and t.city_code = 510400 </if> <if test="2 == loginUserInfo.accountLevel"> and (t.districts_code = #{loginUserInfo.districtsCode} || t.id in (select complaint_id from and (t.districts_code = #{loginUserInfo.districtsCode} OR t.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.districtsCode})) </if> <if test="3 == loginUserInfo.accountLevel"> and (t.street_id = #{loginUserInfo.streetId} || t.id in (select complaint_id from and (t.street_id = #{loginUserInfo.streetId} OR t.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.streetId})) </if> <if test="4 == loginUserInfo.accountLevel"> and (t.community_id = #{loginUserInfo.communityId} || t.id in (select complaint_id from and (t.community_id = #{loginUserInfo.communityId} OR t.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.communityId})) </if> @@ -408,17 +421,17 @@ and t.city_code = 510400 </if> <if test="2 == loginUserInfo.accountLevel"> and (t.districts_code = #{loginUserInfo.districtsCode} || t.id in (select complaint_id from and (t.districts_code = #{loginUserInfo.districtsCode} OR t.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.districtsCode})) </if> <if test="3 == loginUserInfo.accountLevel"> and (t.street_id = #{loginUserInfo.streetId} || t.id in (select complaint_id from and (t.street_id = #{loginUserInfo.streetId} OR t.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.streetId})) </if> <if test="4 == loginUserInfo.accountLevel"> and (t.community_id = #{loginUserInfo.communityId} || t.id in (select complaint_id from and (t.community_id = #{loginUserInfo.communityId} OR t.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.communityId})) </if> @@ -512,4 +525,115 @@ WHERE t.id = #{id} GROUP BY t.id </select> <select id="queryProcessingRecordPage" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO"> SELECT sc.id, sc.serial_number, sc.time, sc.problem_type, sc.name, sc.contact_number, sc.location, sc.detailed_address, sc.description_title, sc.description_content, sc.images, sc.videos, CASE WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 7 WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 5 WHEN sc.status = 0 and scar.audit_status = 2 THEN 6 ELSE sc.status END AS status, sc.report_type, sc.superior_id, sc.create_by, sc.create_time, sc.update_by, sc.update_time, sc.completion_description, sc.completion_images, sc.completion_videos, sc.completion_other_description, sc.completion_time, sc.completion_user_id, sc.completion_username, sc.completion_user_phone, sc.closing_time, sc.over_time_days, sc.latitude, sc.longitude, scar.audit_type, scar.audit_status, scar.reporter_level, scar.comment, scar.create_time AS reportTime, scar.system_user_id, scar.create_by as auditCreateBy, scar.reporter, scar.reporter_id, scar.superior_id superiorId2, scar.department_name, scar.department_id, (SELECT COUNT(*) FROM sgsb_complaint_progress WHERE complaint_id = sc.id) AS progress_count, (SELECT COUNT(*) FROM sgsb_complaint_audit_record WHERE complaint_id = sc.id AND audit_type = 3 AND audit_status = 1) AS assignment_count, (SELECT COUNT(*) FROM sgsb_complaint_audit_record WHERE complaint_id = sc.id AND audit_type = 2 AND audit_status = 1) AS report_count FROM sgsb_complaint sc LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 <where> <if test="1 == accountLevel"> and sc.city_code = #{targetId} </if> <if test="2 == accountLevel"> and (sc.districts_code = #{targetId} or sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) </if> <if test="3 == accountLevel"> and (sc.street_id = #{targetId} or sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) </if> <if test="4 == accountLevel"> and (sc.community_id = #{targetId} or sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) </if> <if test="keyword!=null and keyword != ''"> AND (sc.name like concat('%',#{keyword},'%') or sc.id in (select complaint_id from sgsb_complaint_progress where create_by_name like concat('%',#{keyword},'%')) or sc.report_user_name like concat('%',#{keyword},'%')) </if> </where> ORDER BY sc.create_time DESC </select> <select id="queryRejectRecordPage" resultType="com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO"> SELECT scar.*, sc.serial_number, sc.latitude, sc.longitude, sc.location, sc.detailed_address, sc.problem_type, sc.name, sc.contact_number FROM sgsb_complaint_audit_record scar LEFT JOIN sgsb_complaint sc ON scar.complaint_id = sc.id <where> scar.audit_type != 3 AND scar.audit_status = 2 <if test="1 == accountLevel"> and sc.city_code = #{targetId} </if> <if test="2 == accountLevel"> and (sc.districts_code = #{targetId} </if> <if test="3 == accountLevel"> and (sc.street_id = #{targetId}) </if> <if test="4 == accountLevel"> and (sc.community_id = #{targetId}) </if> <if test="keyword!=null and keyword != ''"> AND (scar.reporter like concat('%',#{keyword},'%') or scar.auditor_name like concat('%',#{keyword},'%') or sc.name like concat('%',#{keyword},'%')or sc.report_user_name like concat('%',#{keyword},'%')) </if> </where> ORDER BY sc.create_time DESC </select> </mapper>