mitao
2025-05-23 dbaee59a4cc2b5498af17eda8bb14eb0020e4063
Merge remote-tracking branch '喜望/dev-2.0.1' into dev-2.0.1

# Conflicts:
# springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
6个文件已修改
160 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/ComplaintRejectController.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/dao/ComplaintRejectMapper.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintRejectService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintRejectServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintRejectMapper.xml 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/ComplaintRejectController.java
@@ -2,10 +2,14 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo;
import com.panzhihua.sangeshenbian.model.entity.SystemUserLevel;
import com.panzhihua.sangeshenbian.model.query.ComplaintRejectQuery;
import com.panzhihua.sangeshenbian.model.vo.ComplaintRejectVo;
import com.panzhihua.sangeshenbian.service.IComplaintRejectService;
import com.panzhihua.sangeshenbian.service.ISystemUserLevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
@@ -13,6 +17,9 @@
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -25,17 +32,68 @@
@RestController
@RequestMapping("/complaint-reject")
@Api
public class ComplaintRejectController {
public class ComplaintRejectController extends BaseController {
    @Resource
    private IComplaintRejectService complaintRejectService;
    @Resource
    private ISystemUserLevelService systemUserLevelService;
    @GetMapping("/list")
    @ApiOperation(value = "获取问题驳回统计列表", tags = {"三个身边后台-问题驳回统计"})
    public R<IPage<ComplaintRejectVo>> list(ComplaintRejectQuery query){
        SystemUserVo loginUserInfoSanGeShenBian = getLoginUserInfoSanGeShenBian();
        Integer id = loginUserInfoSanGeShenBian.getId();
        List<SystemUserLevel> listBySystemUsers = systemUserLevelService.getListBySystemUserId(id);
        SystemUserLevel systemUserLevel = listBySystemUsers.stream().filter(e -> e.getLevel() == 1).findFirst().orElse(null);
        List<String> districtsCodes=new ArrayList<>();
        List<String> streetIds=new ArrayList<>();
        List<Long> communityIds=new ArrayList<>();
        // 看是否直接是市级账号
        if(systemUserLevel==null){
            // 不是市级 查看是否是区县账号
            List<SystemUserLevel> systemUserLevels2 = listBySystemUsers.stream().filter(e -> e.getLevel() == 2).collect(Collectors.toList());
            if(!systemUserLevels2.isEmpty()){
                // 区县账号 找出code
                districtsCodes = systemUserLevels2.stream().map(SystemUserLevel::getDistrictsCode).collect(Collectors.toList());
            }else {
                districtsCodes.add("-1");
            }
        IPage<ComplaintRejectVo> list  = complaintRejectService.getComplaintRejectList(query);
        return R.ok(list);
            List<SystemUserLevel> systemUserLevels3 = listBySystemUsers.stream().filter(e -> e.getLevel() == 3).collect(Collectors.toList());
            if(!systemUserLevels3.isEmpty()){
                // 街道账号 找出id 且不在上面的区县下的街道
                List<String> finalDistrictsCodes1 = districtsCodes;
                streetIds = systemUserLevels3.stream().filter(e -> !finalDistrictsCodes1.contains(e.getDistrictsCode())).map(SystemUserLevel::getStreetId).collect(Collectors.toList());
                if(streetIds.isEmpty()){
                    streetIds.add("-1");
                }
            }else {
                streetIds.add("-1");
            }
            List<SystemUserLevel> systemUserLevels4 = listBySystemUsers.stream().filter(e -> e.getLevel() == 4).collect(Collectors.toList());
            if(!systemUserLevels4.isEmpty()){
                // community账号 找出id 且不在上面的街道下的社区
                List<String> finalStreetIds1 = streetIds;
                List<String> finalDistrictsCodes2 = districtsCodes;
                communityIds = systemUserLevels4.stream().filter(e -> !finalStreetIds1.contains(e.getStreetId()) && !finalDistrictsCodes2.contains(e.getDistrictsCode())).map(SystemUserLevel::getCommunityId).collect(Collectors.toList());
            }else {
                communityIds.add(-1L);
            }
            List<String> finalDistrictsCodes = districtsCodes;
            List<String> finalStreetIds = streetIds;
            List<Long> finalCommunityIds = communityIds;
            IPage<ComplaintRejectVo> list  = complaintRejectService.getComplaintRejectListOther(query,finalDistrictsCodes,finalStreetIds,finalCommunityIds);
            return R.ok(list);
        }else {
            IPage<ComplaintRejectVo> list  = complaintRejectService.getComplaintRejectList(query);
            return R.ok(list);
        }
    }
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/dao/ComplaintRejectMapper.java
@@ -6,8 +6,9 @@
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;
import java.util.List;
/**
 * <p>
@@ -22,6 +23,5 @@
    IPage<ComplaintRejectVo> getComplaintRejectList(@Param("page") Page<ComplaintRejectVo> page, @Param("applyStartTime") String applyStartTime, @Param("applyEndTime") String applyEndTime, @Param("examineStartTime") String examineStartTime, @Param("examineEndTime") String examineEndTime, @Param("query") ComplaintRejectQuery query);
    IPage<ComplaintRejectVo> getComplaintRejectListOther(@Param("page") Page<ComplaintRejectVo> page, @Param("applyStartTime") String applyStartTime, @Param("applyEndTime") String applyEndTime, @Param("examineStartTime") String examineStartTime, @Param("examineEndTime") String examineEndTime, @Param("query") ComplaintRejectQuery query, @Param("finalDistrictsCodes") List<String> finalDistrictsCodes, @Param("finalStreetIds") List<String> finalStreetIds, @Param("finalCommunityIds") List<Long> finalCommunityIds);
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintRejectService.java
@@ -6,6 +6,8 @@
import com.panzhihua.sangeshenbian.model.query.ComplaintRejectQuery;
import com.panzhihua.sangeshenbian.model.vo.ComplaintRejectVo;
import java.util.List;
/**
 * <p>
 * 诉求驳回表 服务类
@@ -23,4 +25,10 @@
     * @return
     */
    IPage<ComplaintRejectVo> getComplaintRejectList(ComplaintRejectQuery query);
    IPage<ComplaintRejectVo> getComplaintRejectListOther(ComplaintRejectQuery query, List<String> finalDistrictsCodes, List<String> finalStreetIds, List<Long> finalCommunityIds);
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintRejectServiceImpl.java
@@ -11,6 +11,8 @@
import com.panzhihua.sangeshenbian.service.IComplaintRejectService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * <p>
 * 诉求驳回表 服务实现类
@@ -41,4 +43,24 @@
        }
        return this.baseMapper.getComplaintRejectList(page,applyStartTime,applyEndTime,examineStartTime,examineEndTime,query);
    }
    @Override
    public IPage<ComplaintRejectVo> getComplaintRejectListOther(ComplaintRejectQuery query, List<String> finalDistrictsCodes, List<String> finalStreetIds, List<Long> finalCommunityIds) {
        Page<ComplaintRejectVo> page = new Page<>(query.getPageNum(), query.getPageSize());
        String applyStartTime=null;
        String applyEndTime=null;
        String examineStartTime=null;
        String examineEndTime=null;
        if(StringUtils.isNotEmpty(query.getApplyTime())){
            String[] split = query.getApplyTime().split(" - ");
            applyStartTime=split[0]+" 00:00:00";
            applyEndTime=split[1]+" 23:59:59";
        }
        if(StringUtils.isNotEmpty(query.getExamineTime())){
            String[] split = query.getExamineTime().split(" - ");
            examineStartTime=split[0]+" 00:00:00";
            examineEndTime=split[1]+" 23:59:59";
        }
        return this.baseMapper.getComplaintRejectListOther(page,applyStartTime,applyEndTime,examineStartTime,examineEndTime,query,finalDistrictsCodes,finalStreetIds,finalCommunityIds);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -1468,9 +1468,13 @@
        } else {
            lastYearMonth = LocalDate.now().minusMonths(1).getYear() + "-" + LocalDate.now().minusMonths(1).getMonth().getValue();
        }
        // 要根据驳回表来改状态
        List<Long> ids = complaints.stream().map(Complaint::getId).collect(Collectors.toList());
        complaints = this.baseMapper.getStatusForList(ids);
        AnalyticStatisticsOneVo vo = new AnalyticStatisticsOneVo();
        // 诉求单量总计
@@ -1561,6 +1565,8 @@
            if (lastMonthSize > 0) {
                BigDecimal multiply2 = BigDecimal.valueOf(count2).divide(new BigDecimal(lastMonthSize), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
                vo.setLastMonthCompareSatisfactionRate(vo.getThisMonthSatisfactionRate() - multiply2.doubleValue());
            }else {
                vo.setLastMonthCompareSatisfactionRate(vo.getThisMonthSatisfactionRate());
            }
        }
        return vo;
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintRejectMapper.xml
@@ -44,4 +44,58 @@
        </where>
        order by t3.create_time desc
    </select>
    <select id="getComplaintRejectListOther"
            resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintRejectVo">
        select t3.reject_reason remark,t3.audit_time examineTime,t2.id complaintId,t2.serial_number serialNumber,t2.report_user_name reportUserName,t2.status,
        t2.report_user_phone reportUserPhone,t3.auditor_name examineUserName,t3.create_time applyTime,t3.apply_name applyUserName
        from sgsb_complaint_audit_record t3
        left join sgsb_complaint t2 on t3.complaint_id = t2.id
        <where>
            t3.audit_status=2
            <if test="query.serialNumber != null and query.serialNumber != ''">
                and t2.serial_number = #{query.serialNumber}
            </if>
            <if test="query.reportUserName != null and query.reportUserName != ''">
                and t2.report_user_name like concat("%",#{query.reportUserName},"%")
            </if>
            <if test="query.status != null">
                and t2.status = #{query.status}
            </if>
            <if test="query.reportUserPhone != null and query.reportUserPhone != ''">
                and t2.report_user_phone like concat("%",#{query.reportUserPhone},"%")
            </if>
            <if test="query.applyUserName != null and query.applyUserName != ''">
                and t3.apply_name like concat("%",#{query.applyUserName},"%")
            </if>
            <if test="query.examineUserName != null and query.examineUserName != ''">
                and t3.auditor_name like concat("%",#{query.examineUserName},"%")
            </if>
            <if test="applyStartTime !=null">
                and t3.create_time between #{applyStartTime} and #{applyEndTime}
            </if>
            <if test="examineStartTime !=null">
                and t3.audit_time between #{examineStartTime} and #{examineEndTime}
            </if>
            and (t2.community_id in
            <foreach collection="finalCommunityIds" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
            or t2.street_id in
            <foreach collection="finalStreetIds" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
            or t2.districts_code in
            <foreach collection="finalDistrictsCodes" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
            )
        </where>
        order by t3.create_time desc
    </select>
</mapper>