yanghui
2022-10-20 27dd2bfde5f6c23f44a00064007945be27725d47
#feat 修改双报道统计查询
4个文件已修改
190 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/common/PagePbCheckUnitCommonDto.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbCheckUnitMapper.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbCheckUnitServiceImpl.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/resources/mapper/ComPbCheckUnitMapper.xml 105 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/common/PagePbCheckUnitCommonDto.java
@@ -4,6 +4,8 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * @title: PagePbCheckUnitCommonDto
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
@@ -29,5 +31,9 @@
    @ApiModelProperty("单位性质")
    private String natureName;
    @ApiModelProperty(value = "社区id集合")
    private List<Long> communityIds;
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbCheckUnitMapper.java
@@ -59,12 +59,12 @@
    /**
     * 报到单位统计-顶部数据
     * @param communityId
     * @param communityIds
     * @param belongTo
     * @param choice
     * @return
     */
    PbCheckUnitStatisticsVo unitStatisticsTop(@Param("communityId") Long communityId, @Param("belongTo") String belongTo, @Param("choice") String choice);
    PbCheckUnitStatisticsVo unitStatisticsTop(@Param("communityIds") List<Long> communityIds, @Param("belongTo") String belongTo, @Param("choice") String choice);
    /**
     * 报到单位统计
@@ -76,13 +76,13 @@
    /**
     * 报到党员统计-顶部数据
     * @param communityId
     * @param communityIds
     * @param belongTo
     * @param choice
     * @param checkUnitId
     * @return
     */
    PbCheckUnitStatisticsVo pbStatisticsTop(@Param("communityId") Long communityId, @Param("belongTo") String belongTo, @Param("choice") String choice, @Param("checkUnitId") Long checkUnitId);
    PbCheckUnitStatisticsVo pbStatisticsTop(@Param("communityIds") List<Long> communityIds, @Param("belongTo") String belongTo, @Param("choice") String choice, @Param("checkUnitId") Long checkUnitId);
    /**
     * 报到党员统计-按单位归属统计
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbCheckUnitServiceImpl.java
@@ -280,7 +280,19 @@
     */
    @Override
    public R unitStatisticsTop(Long communityId, String belongTo, String choice) {
        return R.ok(this.baseMapper.unitStatisticsTop(communityId, belongTo, choice));
        R r = communityService.selectCommunityIds(communityId);
        List<Long> communityIds = null;
        if(R.isOk(r)){
            communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class);
            if (CollUtil.isEmpty(communityIds)) {
                communityIds = new ArrayList<>();
                communityIds.add(communityId);
            }
        }else {
            communityIds = new ArrayList<>();
            communityIds.add(communityId);
        }
        return R.ok(this.baseMapper.unitStatisticsTop(communityIds, belongTo, choice));
    }
    /**
@@ -290,6 +302,20 @@
     */
    @Override
    public R unitStatistics(PagePbCheckUnitCommonDto commonDto) {
        Long communityId = commonDto.getCommunityId();
        R r = communityService.selectCommunityIds(communityId);
        List<Long> communityIds = null;
        if(R.isOk(r)){
            communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class);
            if (CollUtil.isEmpty(communityIds)) {
                communityIds = new ArrayList<>();
                communityIds.add(communityId);
            }
        }else {
            communityIds = new ArrayList<>();
            communityIds.add(communityId);
        }
        commonDto.setCommunityIds(communityIds);
        return R.ok(this.baseMapper.unitStatistics(commonDto, new Page(commonDto.getPageNum(), commonDto.getPageSize())));
    }
@@ -303,7 +329,20 @@
     */
    @Override
    public R pbStatisticsTop(Long communityId, String belongTo, String choice, Long checkUnitId) {
        return R.ok(this.baseMapper.pbStatisticsTop(communityId, belongTo, choice, checkUnitId));
        R r = communityService.selectCommunityIds(communityId);
        List<Long> communityIds = null;
        if(R.isOk(r)){
            communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class);
            if (CollUtil.isEmpty(communityIds)) {
                communityIds = new ArrayList<>();
                communityIds.add(communityId);
            }
        }else {
            communityIds = new ArrayList<>();
            communityIds.add(communityId);
        }
        return R.ok(this.baseMapper.pbStatisticsTop(communityIds, belongTo, choice, checkUnitId));
    }
    /**
@@ -313,6 +352,20 @@
     */
    @Override
    public R pbStatisticsBelong(PagePbCheckUnitCommonDto commonDto) {
        Long communityId = commonDto.getCommunityId();
        R r = communityService.selectCommunityIds(communityId);
        List<Long> communityIds = null;
        if(R.isOk(r)){
            communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class);
            if (CollUtil.isEmpty(communityIds)) {
                communityIds = new ArrayList<>();
                communityIds.add(communityId);
            }
        }else {
            communityIds = new ArrayList<>();
            communityIds.add(communityId);
        }
        commonDto.setCommunityIds(communityIds);
        return R.ok(this.baseMapper.pbStatisticsBelong(commonDto, new Page(commonDto.getPageNum(), commonDto.getPageSize())));
    }
@@ -323,6 +376,20 @@
     */
    @Override
    public R pbStatisticsUnit(PagePbCheckUnitCommonDto commonDto) {
        Long communityId = commonDto.getCommunityId();
        R r = communityService.selectCommunityIds(communityId);
        List<Long> communityIds = null;
        if(R.isOk(r)){
            communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class);
            if (CollUtil.isEmpty(communityIds)) {
                communityIds = new ArrayList<>();
                communityIds.add(communityId);
            }
        }else {
            communityIds = new ArrayList<>();
            communityIds.add(communityId);
        }
        commonDto.setCommunityIds(communityIds);
        return R.ok(this.baseMapper.pbStatisticsUnit(commonDto, new Page(commonDto.getPageNum(), commonDto.getPageSize())));
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/resources/mapper/ComPbCheckUnitMapper.xml
@@ -101,9 +101,13 @@
            resultType="com.panzhihua.common.model.vos.common.PbCheckUnitStatisticsVo">
        SELECT
        (SELECT COUNT( id ) FROM com_pb_check_unit WHERE 1=1
            <if test="communityId != null">
                AND community_id = #{communityId}
            <if test="communityIds != null and communityIds.size() >0">
                AND community_id IN
                <foreach collection="communityIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            <if test="belongTo != null and belongTo != ''">
                AND belong_to = #{belongTo}
            </if>
@@ -112,8 +116,11 @@
            </if>
        ) AS unitTotal,
        (SELECT COUNT( id ) FROM com_pb_check_unit WHERE nature_name = '机关单位'
            <if test="communityId != null">
                AND community_id = #{communityId}
            <if test="communityIds != null and communityIds.size() >0">
                AND community_id IN
                <foreach collection="communityIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            <if test="belongTo != null and belongTo != ''">
                AND belong_to = #{belongTo}
@@ -123,8 +130,11 @@
            </if>
        ) AS organTotal,
        (SELECT COUNT( id ) FROM com_pb_check_unit WHERE nature_name = '企事业单位'
            <if test="communityId != null">
                AND community_id = #{communityId}
            <if test="communityIds != null and communityIds.size() >0">
                AND community_id IN
                <foreach collection="communityIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            <if test="belongTo != null and belongTo != ''">
                AND belong_to = #{belongTo}
@@ -134,8 +144,11 @@
            </if>
        ) AS businessTotal,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
            <if test="communityId != null">
                AND m.community_id = #{communityId}
            <if test="communityIds != null and communityIds.size() >0">
                AND community_id IN
                <foreach collection="communityIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            <if test="belongTo != null and belongTo != ''">
                AND cpcu.belong_to = #{belongTo}
@@ -148,8 +161,12 @@
    <select id="unitStatistics" resultType="com.panzhihua.common.model.vos.common.PbCheckUnitStatisticsVo">
        SELECT temp.*,
        (SELECT COUNT( id ) FROM com_pb_check_unit WHERE nature_name = '机关单位'
            <if test="commonDto.communityId != null">
                AND community_id = #{commonDto.communityId}
            <if test="commonDto.communityIds != null and commonDto.communityIds.size() >0">
                AND community_id IN
                <foreach collection="commonDto.communityIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
         AND belong_to = temp.belong_to) AS organTotal,
        (SELECT COUNT( id ) FROM com_pb_check_unit WHERE nature_name = '企事业单位'
@@ -158,14 +175,20 @@
            </if>
        AND belong_to = temp.belong_to) AS businessTotal,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
            <if test="commonDto.communityId != null">
                AND m.community_id = #{commonDto.communityId}
            <if test="commonDto.communityIds != null and commonDto.communityIds.size() >0">
                AND community_id IN
                <foreach collection="commonDto.communityIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
         AND cpcu.belong_to = temp.belong_to) AS partyMemberTotal
        FROM (SELECT belong_to,COUNT( id ) AS unitTotal FROM com_pb_check_unit WHERE 1=1
        <if test="commonDto.communityId != null">
            AND community_id = #{commonDto.communityId}
        </if>
            <if test="commonDto.communityIds != null and commonDto.communityIds.size() >0">
                AND community_id IN
                <foreach collection="commonDto.communityIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        <if test="commonDto.belongTo != null and commonDto.belongTo != ''">
            AND belong_to = #{commonDto.belongTo}
        </if>
@@ -175,9 +198,13 @@
        SELECT
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
        AND cpcu.nature_name = '机关单位'
        <if test="communityId != null">
            AND m.community_id = #{communityId}
        <if test="communityIds != null and communityIds.size() >0">
            AND m.community_id IN
            <foreach collection="communityIds" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="belongTo != null and belongTo != ''">
            AND cpcu.belong_to = #{belongTo}
        </if>
@@ -190,8 +217,11 @@
        ) AS organTotal,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
        AND cpcu.nature_name = '企事业单位'
        <if test="communityId != null">
            AND m.community_id = #{communityId}
        <if test="communityIds != null and communityIds.size() >0">
            AND m.community_id IN
            <foreach collection="communityIds" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="belongTo != null and belongTo != ''">
            AND cpcu.belong_to = #{belongTo}
@@ -204,8 +234,11 @@
        </if>
        ) AS businessTotal,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
        <if test="communityId != null">
            AND m.community_id = #{communityId}
        <if test="communityIds != null and communityIds.size() >0">
            AND m.community_id IN
            <foreach collection="communityIds" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="belongTo != null and belongTo != ''">
            AND cpcu.belong_to = #{belongTo}
@@ -221,19 +254,28 @@
    <select id="pbStatisticsBelong" resultType="com.panzhihua.common.model.vos.common.PbCheckUnitStatisticsVo">
        SELECT temp.*,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
            <if test="commonDto.communityId != null">
                AND m.community_id = #{commonDto.communityId}
            <if test="commonDto.communityIds != null and commonDto.communityIds.size() >0">
                AND m.community_id IN
                <foreach collection="commonDto.communityIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        AND AND m.check_unit_id is not null AND cpcu.nature_name = '机关单位' AND cpcu.belong_to = temp.belong_to) AS organTotal,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
            <if test="commonDto.communityId != null">
                AND m.community_id = #{commonDto.communityId}
            <if test="commonDto.communityIds != null and commonDto.communityIds.size() >0">
                AND m.community_id IN
                <foreach collection="commonDto.communityIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        AND cpcu.nature_name = '企事业单位' AND cpcu.belong_to = temp.belong_to) AS businessTotal
        FROM (SELECT cpcu.belong_to,COUNT( m.id ) AS partyMemberTotal FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
        <if test="commonDto.communityId != null">
            AND m.community_id = #{commonDto.communityId}
        </if>
            <if test="commonDto.communityIds != null and commonDto.communityIds.size() >0">
                AND m.community_id IN
                <foreach collection="commonDto.communityIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        <if test="commonDto.belongTo != null and commonDto.belongTo != ''">
            AND cpcu.belong_to = #{commonDto.belongTo}
        </if>
@@ -253,8 +295,11 @@
        LEFT JOIN com_pb_check_unit AS cpcu ON m.check_unit_id = cpcu.id
        WHERE
        m.audit_result = 1
        <if test="commonDto.communityId != null">
            AND m.community_id = #{commonDto.communityId}
        <if test="commonDto.communityIds != null and commonDto.communityIds.size() >0">
            AND m.community_id IN
            <foreach collection="commonDto.communityIds" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="commonDto.belongTo != null and commonDto.belongTo != ''">
            AND cpcu.belong_to = #{commonDto.belongTo}