| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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)){ |
| | | //个人账号权限 |
| | |
| | | //社区后台权限 |
| | | 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())){ |
| | |
| | | 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); |
| | | } |
| | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | @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); |
| | | } |