张天森
2022-10-13 db2c9312bd76cb8c498562283e78c8f555c07c50
三说会堂事件流程处理
6个文件已修改
162 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoEventController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComEventMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/ComEvent.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/IComEventService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComEventMapper.xml 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoEventController.java
@@ -318,7 +318,7 @@
    @ApiOperation("事件各种状态(处理状态1待处理2待验证3专家已受理4专家未受理,拒绝5调解中6已结案归档7调解取消8 已删除)数据统计")
    @GetMapping("/status/calculate")
    public R calculate() {
        return comEventService.calculate();
        return comEventService.calculate(getLoginUserInfo());
    }
    /**
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComEventMapper.java
@@ -51,7 +51,9 @@
       */
   List<ComEvent> listByComEvent(@Param("comEvent") ComEvent comEvent,@Param("requestUserId") Long requestUserId);
    List<ComEventCalculateVO> calculate();
    List<ComEventCalculateVO> calculate(ComEvent comEvent);
    int caculateSum(ComEvent comEvent);
    /**
     * 大屏事件统计
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/ComEvent.java
@@ -188,4 +188,6 @@
    private Integer isArchive;
    @TableField(exist = false)
    private Integer hasPerm;
    @TableField(exist = false)
    private List<Long> communityIds;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/IComEventService.java
@@ -83,7 +83,7 @@
    R reappoint(Long id, Long specialistId);
    R calculate();
    R calculate(LoginUserInfoVO loginUserInfo);
    R archiveRequest(ComEventArchiveVO comEventArchiveVO, LoginUserInfoVO sysUser);
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java
@@ -1,8 +1,11 @@
package com.panzhihua.service_community.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.generator.SnowflakeGenerator;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -14,6 +17,7 @@
import com.panzhihua.common.model.dtos.community.sanshuo.IndexDateDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.switchs.CommunitySwitchAllAppletsVO;
import com.panzhihua.common.model.vos.sanshuo.*;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.CopyUtil;
@@ -82,6 +86,7 @@
        log.info("=================当前登陆的用户信息,用户类型"+loginUserInfoVO.getType()+"社区id"+loginUserInfoVO.getCommunityId());
        Boolean isExpertCheck=false;
        Long expertId=null;
        Boolean isStretAccount = isStreetAccount(loginUserInfoVO);
        if (nonNull(comEvent.getUserType())){
            if (comEvent.getUserType().equals(1)){
                //个人账号权限
@@ -113,6 +118,12 @@
                //社区后台权限
                comEvent.setUserType(4);
                comEvent.setCommunityId(loginUserInfoVO.getCommunityId());
            }else if (isStretAccount){
                //街道权限,查看街道范围下的所有社区事件
                //获取街道下属社区id
                List<Long> cids = comActDAO.selectCommunityByStreetId(loginUserInfoVO.getStreetId());
                comEvent.setUserType(5);
                comEvent.setCommunityIds(cids);
            }
        }
        if (nonNull(loginUserInfoVO.getAccount())){
@@ -123,7 +134,8 @@
        IPage<ComEvent> list=null;
        log.info("=====================当前的userType"+comEvent.getUserType());
        log.info("=====================是否专家账号查看"+isExpertCheck);
        if (isExpertCheck){
        //是否为专家查看自己发布的事件
        if (isExpertCheck && comEvent.getUserType()!=1){
            if (nonNull(comEventMapper.listEventIds(expertId))){
                list = comEventMapper.pageByComEventExpert(comEventMapper.listEventIds(expertId), comEvent, pagination);
            }
@@ -172,8 +184,25 @@
            if (!comEvent.getCurrentProcessType().equals(4)){
                perm=0;
            }
        }else if (isStreetAccount(sysUser)){
            if (!comEvent.getCurrentProcessType().equals(3)){
                perm=0;
            }
        }
        return perm;
    }
    /**
     * 是否为综治后台街道账号
     * */
    public Boolean isStreetAccount(LoginUserInfoVO sysUser){
        Boolean flag=false;
        String[] account={"glpz","qxpjd","tjdjd","dbdjd","yqjd","bcg","hmkjd","dhjd","jsgyy","dzhljd"};
        if (nonNull(sysUser.getAccount())){
            if (ArrayUtil.contains(account,sysUser.getAccount() )){
                flag=true;
            }
        }
        return flag;
    }
    @Override
    public List<ComEvent> listByComEvent(ComEvent comEvent,LoginUserInfoVO loginUserInfoVO) {
@@ -472,11 +501,61 @@
    }
    @Override
    public R calculate() {
        List<ComEventCalculateVO> calculateList = baseMapper.calculate();
    public R calculate(LoginUserInfoVO loginUserInfoVO) {
        ComEvent comEvent=new ComEvent();
        Boolean isExpertCheck=false;
        Long expertId=null;
        Boolean isStretAccount = isStreetAccount(loginUserInfoVO);
        if (nonNull(comEvent.getUserType())){
            if (comEvent.getUserType().equals(1)){
                //个人账号权限
                comEvent.setRequestUserId(loginUserInfoVO.getUserId());
            }else if (comEvent.getUserType().equals(2) || loginUserInfoVO.getType().equals(13) || loginUserInfoVO.getType().equals(11)){
                ComSanshuoExpert expert=new ComSanshuoExpert();
                //专家账号权限(小程序和后台)
                if (nonNull(loginUserInfoVO.getPhone())){
                    expert = comSanShuoExpertService.getOne(new QueryWrapper<ComSanshuoExpert>().lambda().eq(ComSanshuoExpert::getPhone, loginUserInfoVO.getPhone()));
                }else{
                    //账号获取
                    expert = comSanShuoExpertService.getOne(new QueryWrapper<ComSanshuoExpert>().lambda().eq(ComSanshuoExpert::getAccount, loginUserInfoVO.getAccount()));
                }
                comEvent.setUserType(2);
                if (nonNull(expert)){
                    comEvent.setSpecialistId(expert.getId());
                    isExpertCheck=true;
                    expertId=expert.getId();
                }
            }else if (loginUserInfoVO.getType().equals(12)){
                //行业分中心权限
                comEvent.setUserType(3);
                //获取行业分中心id
                ComSanshuoIndustryCenter center = comSanShuoIndustryCenterService.getOne(new QueryWrapper<ComSanshuoIndustryCenter>().lambda().eq(ComSanshuoIndustryCenter::getAccount, loginUserInfoVO.getAccount()));
                if (nonNull(center)){
                    comEvent.setCenterId(center.getId().toString());
                }
            }else if (loginUserInfoVO.getType().equals(3)){
                //社区后台权限
                comEvent.setUserType(4);
                comEvent.setCommunityId(loginUserInfoVO.getCommunityId());
            }else if (isStretAccount){
                //街道权限,查看街道范围下的所有社区事件
                //获取街道下属社区id
                List<Long> cids = comActDAO.selectCommunityByStreetId(loginUserInfoVO.getStreetId());
                comEvent.setUserType(5);
                comEvent.setCommunityIds(cids);
            }
        }
        if (nonNull(loginUserInfoVO.getAccount())){
            if (loginUserInfoVO.getAccount().equals("admin")){
                comEvent.setUserType(null);
            }
        }
        log.info("=====================当前的userType"+comEvent.getUserType());
        log.info("=====================是否专家账号查看"+isExpertCheck);
        List<ComEventCalculateVO> calculateList = baseMapper.calculate(comEvent);
        ComEventCalculateVO comEventCalculateVO =new ComEventCalculateVO();
        comEventCalculateVO.setStatus("0");
        comEventCalculateVO.setSum(baseMapper.selectCount(new QueryWrapper<ComEvent>().lambda().notIn(ComEvent::getEventProcessStatus,(9))).toString());
        comEventCalculateVO.setSum(baseMapper.caculateSum(comEvent)+"");
        calculateList.add(comEventCalculateVO);
        return R.ok(calculateList);
    }
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComEventMapper.xml
@@ -90,6 +90,12 @@
            <if test="comEvent.userType == 4">
                AND request_user_community=#{comEvent.communityId}
            </if>
            <if test="comEvent.userType == 5">
                AND request_user_community in
                <foreach collection="comEvent.communityIds" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </if>
        </where>
        order by create_at desc
    </select>
@@ -154,8 +160,65 @@
    <select id="calculate" resultType="com.panzhihua.common.model.vos.sanshuo.ComEventCalculateVO">
        select event_process_status as status ,count(1) as  sum
        from com_sanshuo_event_info
        <where>
            event_process_status not in (9)
        <if test="eventIds != null">
            AND id in
            <foreach collection="eventIds" item="id" separator="," open="(" close=")">
             #{id}
            </foreach>
        </if>
        <if test="comEvent.userType == 1">
            AND request_user_id=#{comEvent.requestUserId}
        </if>
        <if test="comEvent.userType == 2">
            AND specialist_id=#{comEvent.specialistId}
        </if>
        <if test="comEvent.userType == 3">
            AND center_id=#{comEvent.centerId}
        </if>
        <if test="comEvent.userType == 4">
            AND request_user_community=#{comEvent.communityId}
        </if>
        <if test="comEvent.userType == 5">
            AND request_user_community in
            <foreach collection="comEvent.communityIds" item="id" separator="," open="(" close=")">
                #{id}
            </foreach>
        </if>
    </where>
        group by event_process_status
        having event_process_status not in (9)
    </select>
    <select id="caculateSum" resultType="int">
        select count(id) as  sum
        from com_sanshuo_event_info
        <where>
            event_process_status not in (9)
            <if test="eventIds != null">
                AND id in
                <foreach collection="eventIds" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </if>
            <if test="comEvent.userType == 1">
                AND request_user_id=#{comEvent.requestUserId}
            </if>
            <if test="comEvent.userType == 2">
                AND specialist_id=#{comEvent.specialistId}
            </if>
            <if test="comEvent.userType == 3">
                AND center_id=#{comEvent.centerId}
            </if>
            <if test="comEvent.userType == 4">
                AND request_user_community=#{comEvent.communityId}
            </if>
            <if test="comEvent.userType == 5">
                AND request_user_community in
                <foreach collection="comEvent.communityIds" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </if>
        </where>
    </select>
    <select id="dateAnalysis" resultType="com.panzhihua.common.model.vos.sanshuo.IndexDateVO">
        SELECT