张天森
2022-10-18 eaac6d9314b98ea313c16f62b41f01ddbd1114f3
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java
@@ -12,6 +12,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.constants.ReturnMsgConstants;
import com.panzhihua.common.enums.SanShuoEventStatusEnum;
import com.panzhihua.common.model.dtos.community.sanshuo.IndexDateDTO;
@@ -85,6 +86,7 @@
    @Override
    public R pageByComEvent(ComEvent comEvent, Page pagination,LoginUserInfoVO loginUserInfoVO) {
        log.info("=================当前登陆的用户信息,用户类型"+loginUserInfoVO.getType()+"社区id"+loginUserInfoVO.getCommunityId());
        log.info("=====================当前的userType1:="+comEvent.getUserType());
        Boolean isExpertCheck=false;
        Long expertId=null;
        Boolean isStretAccount = isStreetAccount(loginUserInfoVO);
@@ -127,13 +129,13 @@
                comEvent.setCommunityIds(cids);
            }
        }
//        if (nonNull(loginUserInfoVO.getAccount())){
//            if (loginUserInfoVO.getAccount().equals("admin")){
//                comEvent.setUserType(null);
//            }
//        }
        if (nonNull(loginUserInfoVO.getAccount())){
            if (loginUserInfoVO.getAccount().equals("admin") && loginUserInfoVO.getStreetId().equals(Constants.ADMIN_STREET_ID)){
                comEvent.setUserType(null);
            }
        }
        IPage<ComEvent> list=null;
        log.info("=====================当前的userType"+comEvent.getUserType());
        log.info("=====================当前的userType2:="+comEvent.getUserType());
        log.info("=====================是否专家账号查看"+isExpertCheck);
        //是否为专家查看自己发布的事件
        if (isExpertCheck && comEvent.getUserType()!=1){
@@ -143,7 +145,6 @@
        }else{
            list = baseMapper.pageByComEvent(comEvent, pagination);
        }
        if (list.getRecords().size() < 1) {
            return R.ok(Collections.emptyList());
        }
@@ -222,12 +223,13 @@
                comEvent.setSolve(0);
                return;
            }//未上报,根据状态决定权限
            if (comEvent.getEventProcessStatus().equals(1) || comEvent.getEventProcessStatus().equals(2)){
            if (comEvent.getEventProcessStatus().equals(1)){
                //待受理和待验证状态,仅有查看和受理权限,可能为用户选择该专家或上级单位分配给该专家
                //关闭调解和归档
                comEvent.setArchive(0);
                comEvent.setConciliation(0);
            } else if (comEvent.getEventProcessStatus().equals(5)){
            }
            else if (comEvent.getEventProcessStatus().equals(5)){
                //调解中,可以查看,调解
                comEvent.setArchive(0);
                comEvent.setSolve(0);
@@ -246,13 +248,23 @@
            //如果未上报到街道,当前事件权限和专家一样
            if (comEvent.getCurrentProcessType().equals(5)){
                //根据事件状态决定权限
                if (comEvent.getEventProcessStatus().equals(1) || comEvent.getEventProcessStatus().equals(2)){
                if (comEvent.getEventProcessStatus().equals(1) ){
                    //待受理和待验证状态,可以受理,分配专家
                    //关闭调解和归档
                    comEvent.setArchive(0);
                    comEvent.setConciliation(0);
                    comEvent.setChangeExpert(0);
                } else if (comEvent.getEventProcessStatus().equals(5)){
                } else if(comEvent.getEventProcessStatus().equals(2)){
                    //待分配和待验证状态,可以受理,分配专家
                    //关闭调解和归档
                    comEvent.setArchive(0);
                    comEvent.setConciliation(0);
                    comEvent.setChangeExpert(0);
                    if (comEvent.getSpecialistName().equals("待分配")){
                        comEvent.setSolve(0);
                    }
                }
                else if (comEvent.getEventProcessStatus().equals(5)){
                    //调解中,可以查看,调解,更换专家,删除
                    comEvent.setDistribution(0);
                    comEvent.setSolve(0);
@@ -323,13 +335,22 @@
        }else if (userType.equals(3)){
            //分配行业分中心操作权限
            //是否上报到行业分中心
            if (comEvent.getReportCenter().equals(1) || comEvent.getCurrentProcessType().equals(1)){
            if (comEvent.getCurrentProcessType().equals(1)){
                //已经报到行业分中心
                if (comEvent.getEventProcessStatus().equals(1) || comEvent.getEventProcessStatus().equals(2)){
                if (comEvent.getEventProcessStatus().equals(1) ){
                    //待受理和待验证状态,可以受理,分配专家
                    //关闭调解和归档
                    comEvent.setArchive(0);
                    comEvent.setConciliation(0);
                }else if(comEvent.getEventProcessStatus().equals(2)){
                    //待分配和待验证状态,可以受理,分配专家
                    //关闭调解和归档
                    comEvent.setArchive(0);
                    comEvent.setConciliation(0);
                    comEvent.setChangeExpert(0);
                    if (comEvent.getSpecialistName().equals("待分配")){
                        comEvent.setSolve(0);
                    }
                }
                else if (comEvent.getEventProcessStatus().equals(3)){
                    //分配新专家后
@@ -367,9 +388,9 @@
        }else if (userType.equals(5)  || isStreet){
            //街道权限,操作街道下属社区的所有事件
            //是否上报到街道
            if (comEvent.getReportStreet().equals(1) || comEvent.getCurrentProcessType().equals(3)){
            if (comEvent.getCurrentProcessType().equals(3)){
                //已上报到街道
                if (comEvent.getEventProcessStatus().equals(1) || comEvent.getEventProcessStatus().equals(2)){
                if (comEvent.getEventProcessStatus().equals(1) ){
                    //待受理和待验证状态,可以受理,分配专家
                    //关闭调解和归档
                    comEvent.setArchive(0);
@@ -377,7 +398,16 @@
                    comEvent.setChangeExpert(0);
                    //comEvent.setDistribution(0);
                    comEvent.setSolve(0);
                } else if (comEvent.getEventProcessStatus().equals(5)){
                } else if(comEvent.getEventProcessStatus().equals(2)){
                    //待分配和待验证状态,可以受理,分配专家
                    //关闭调解和归档
                    comEvent.setArchive(0);
                    comEvent.setConciliation(0);
                    comEvent.setChangeExpert(0);
                    if (comEvent.getSpecialistName().equals("待分配")){
                        comEvent.setSolve(0);
                    }
                }else if (comEvent.getEventProcessStatus().equals(5)){
                    //调解中,可以查看,调解,更换专家,删除
                    comEvent.setDistribution(0);
                    comEvent.setArchive(0);
@@ -410,8 +440,14 @@
                    comEvent.setChangeExpert(0);
                    comEvent.setConciliation(0);
                }
            }else{
            }else if (comEvent.getCurrentProcessType().equals(4)){
                //未上报到街道,仅查看
                comEvent.setSolve(0);
                comEvent.setDistribution(0);
                comEvent.setChangeExpert(0);
                comEvent.setConciliation(0);
            }else {
                comEvent.setArchive(0);
                comEvent.setSolve(0);
                comEvent.setDistribution(0);
@@ -423,17 +459,46 @@
            // 是否上报到三说会堂
            if (comEvent.getCurrentProcessType().equals(4) || comEvent.getReportHall().equals(1)){
                //已上报到三说会堂,可以操作
                if (comEvent.getEventProcessStatus().equals(1) || comEvent.getEventProcessStatus().equals(2)){
                if (comEvent.getEventProcessStatus().equals(1)){
                    //待受理和待验证状态,可以受理,分配专家
                    //关闭调解和归档
                    comEvent.setArchive(0);
                    comEvent.setSolve(0);
                    comEvent.setConciliation(0);
                } else if (comEvent.getEventProcessStatus().equals(5)){
                    //调解中,可以查看,调解,更换专家,删除
                    comEvent.setChangeExpert(0);
                }
                else if(comEvent.getEventProcessStatus().equals(2)){
                    //待分配和待验证状态,可以受理,分配专家
                    //关闭调解和归档
                    comEvent.setArchive(0);
                    comEvent.setConciliation(0);
                    comEvent.setChangeExpert(0);
                    if (comEvent.getSpecialistName().equals("待分配")){
                        comEvent.setSolve(0);
                    }
                }else if (comEvent.getEventProcessStatus().equals(3)){
                    //新分配给专家并且专家还未受理
                    comEvent.setDistribution(0);
                    comEvent.setArchive(0);
                } else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventSucceed().equals(2)){
                    //comEvent.setConciliation(0);
                    comEvent.setChangeExpert(0);
                    comEvent.setSolve(0);
                }
                else if (comEvent.getEventProcessStatus().equals(5)){
                    //调解中,可以查看,调解,更换专家,删除
                    comEvent.setDistribution(0);
                    comEvent.setSolve(0);
                    comEvent.setArchive(0);
                } else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventResult().equals(1)){
                    //失败后转交三说会堂
                    comEvent.setSolve(0);
                    comEvent.setDistribution(0);
                    comEvent.setConciliation(0);
                    //comEvent.setChangeExpert(0);
                }
                else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventSucceed().equals(2)){
                    //调解完成,可以归档,查看
                    comEvent.setConciliation(0);
                    comEvent.setSolve(0);
                    comEvent.setDistribution(0);
                    comEvent.setChangeExpert(0);
@@ -444,6 +509,7 @@
                comEvent.setSolve(0);
                comEvent.setDistribution(0);
                comEvent.setChangeExpert(0);
                comEvent.setConciliation(0);
            }
        }
    }
@@ -795,22 +861,21 @@
        Boolean isExpertCheck=false;
        Long expertId=null;
        Boolean isStretAccount = isStreetAccount(loginUserInfoVO);
        if (nonNull(comEvent.getUserType())){
             if (loginUserInfoVO.getType().equals(13) || loginUserInfoVO.getType().equals(11)){
        if (loginUserInfoVO.getType().equals(13) || loginUserInfoVO.getType().equals(11)){
                ComSanshuoExpert expert=new ComSanshuoExpert();
                //专家账号权限(后台)
                if (nonNull(loginUserInfoVO.getPhone())){
            if (nonNull(loginUserInfoVO.getPhone())){
                    expert = comSanShuoExpertService.getOne(new QueryWrapper<ComSanshuoExpert>().lambda().eq(ComSanshuoExpert::getPhone, loginUserInfoVO.getPhone()));
                }else{
            }else{
                    //账号获取
                    expert = comSanShuoExpertService.getOne(new QueryWrapper<ComSanshuoExpert>().lambda().eq(ComSanshuoExpert::getAccount, loginUserInfoVO.getAccount()));
                }
                comEvent.setUserType(2);
                if (nonNull(expert)){
            }
            comEvent.setUserType(2);
            if (nonNull(expert)){
                    comEvent.setSpecialistId(expert.getId());
                    isExpertCheck=true;
                    expertId=expert.getId();
                }
            }
            }else if (loginUserInfoVO.getType().equals(12)){
                //行业分中心权限
                comEvent.setUserType(3);
@@ -829,8 +894,7 @@
                List<Long> cids = comActDAO.selectCommunityByStreetId(loginUserInfoVO.getStreetId());
                comEvent.setUserType(5);
                comEvent.setCommunityIds(cids);
            }
        }
         }
        if (isExpertCheck && comEvent.getUserType()!=1){
            if (nonNull(comEventMapper.listEventIds(expertId))){
                List<Long> eventIds = comEventMapper.listEventIds(expertId);