From 74acc62a129af32307aa43171b93415ac6225bcb Mon Sep 17 00:00:00 2001 From: 张天森 <1292933220@qq.com> Date: 星期四, 13 十月 2022 17:30:14 +0800 Subject: [PATCH] 三说会堂事件操作权限处理 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java | 105 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 91 insertions(+), 14 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java index 3d063d5..d327b89 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java @@ -40,6 +40,7 @@ import javax.annotation.Resource; import java.util.*; +import static java.util.Objects.isNull; import static java.util.Objects.nonNull; /** @@ -155,15 +156,82 @@ } ComMediateType category = commediateTypeService.getById(comEvent1.getEventCategory()); comEvent1.setEventCategoryName(category.getName()); - //当前账号能否操作此条记录,根据事件流转记录是否有归档的记录决定当前用户能否对添加归档记录 - ComEventTransferRecord archiveRecord = comEventTransferRecordService.getOne(new QueryWrapper<ComEventTransferRecord>().lambda().eq(ComEventTransferRecord::getEventId, comEvent1.getId()).eq(ComEventTransferRecord::getFromUserId, loginUserInfoVO.getUserId()).eq(ComEventTransferRecord::getEventStatus, 7)); - comEvent1.setIsArchive(1); - if(nonNull(archiveRecord)){ - comEvent1.setIsArchive(0); - } comEvent1.setHasPerm(hasPermission(comEvent1,loginUserInfoVO )); + if (!comEvent.getUserType().equals(1)){ + this.accountMenu(comEvent1,comEvent.getUserType(),loginUserInfoVO ); + } }); return R.ok(list); + } + + + /** + * 当前账号对事件的操作权限 + * 1:有权限 0无权限 + * */ + public void accountMenu(ComEvent comEvent,Integer userType,LoginUserInfoVO loginUserInfoVO){ + //四个账号级别 + if (isNull(userType)){ + return; + } + comEvent.setDelete(1); + comEvent.setArchive(1); + comEvent.setSolve(1); + comEvent.setConciliation(1); + comEvent.setDistribution(1); + comEvent.setChangeExpert(1); + if (userType.equals(2)){ + //专家后台权限,根据事件的流转信息决定专家对此事件的操作权限 + //获取专家信息 + ComSanshuoExpert expert=new ComSanshuoExpert(); + comEvent.setDistribution(0); + comEvent.setChangeExpert(0); + comEvent.setDelete(0); + if (!comEvent.getCurrentProcessType().equals(5)){ + comEvent.setSolve(0); + } + 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())); + } + if (!comEvent.getSpecialistId().equals(expert.getId())){ + //已经上报或者重新分配专家 + comEvent.setConciliation(0); + //comEvent.setDelete(0); + comEvent.setArchive(0); + } + }else if (userType.equals(4)){ + //社区后台权限 + if (comEvent.getEventProcessStatus().equals(5) && comEvent.getEventResult().equals(2)){ + comEvent.setChangeExpert(0); + } + if (comEvent.getReportStreet().equals(1)){ + comEvent.setChangeExpert(0); + comEvent.setDelete(0); + } + if (!comEvent.getEventProcessStatus().equals(5)){ + comEvent.setArchive(0); + } + }else if (userType.equals(3)){ + //分配行业分中心操作权限 + if (!comEvent.getReportCenter().equals(1)){ + comEvent.setArchive(0); + comEvent.setConciliation(0); + comEvent.setDistribution(0); + comEvent.setSolve(0); + comEvent.setChangeExpert(0); + } + }else if (userType.equals(5)){ + if (!comEvent.getReportStreet().equals(1)){ + comEvent.setArchive(0); + comEvent.setConciliation(0); + comEvent.setDistribution(0); + comEvent.setSolve(0); + } + } + } /** @@ -204,6 +272,7 @@ } return flag; } + @Override public List<ComEvent> listByComEvent(ComEvent comEvent,LoginUserInfoVO loginUserInfoVO) { List<ComEvent> list = baseMapper.listByComEvent(comEvent,null); @@ -326,6 +395,7 @@ comEvent.setCurrentProcessType(2); comEvent.setSpecialistName("待分配"); comEvent.setSpecialistId(99999L); + comEvent.setReportCommunity(1); ComActDO comActDO = comActDAO.selectById(expert.getCommunityId()); comEvent.setCurrentOrgId(comActDO.getStreetId().toString()); //生成一次流转记录 @@ -336,6 +406,7 @@ comEvent.setReportLevel(4); }else if (expert.getLevel().equals(2)){ //上报到行业分中心 + comEvent.setReportCenter(1); comEvent.setCurrentProcessType(1); comEvent.setCurrentOrgId(expert.getIndustryCenterId().toString()); comEvent.setSpecialistName("待分配"); @@ -352,6 +423,7 @@ comEvent.setCurrentProcessType(4); comEvent.setCurrentOrgId("99999"); //生成一次流转记录 + comEvent.setReportHall(1); comEvent.setCurrentEventProcessResult("行业分中心上报到区三说会堂"); comEventTransferRecord.setFromId(comEvent.getSpecialistId()); comEventTransferRecord.setToId(99999L); @@ -361,6 +433,7 @@ //社区上报到街道 comEvent.setCurrentProcessType(3); //获取街道id + comEvent.setReportStreet(1); ComActDO comActDO = comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getCommunityId, comEvent.getRequestUserCommunity()).eq(ComActDO::getAppId, "wx0cef797390444b75")); comEvent.setCurrentOrgId(comActDO.getStreetId().toString()); //生成一次流转记录 @@ -372,6 +445,7 @@ }else if(comEvent.getCurrentProcessType() == 3){ //街道上报到区三说会堂 comEvent.setCurrentProcessType(4); + comEvent.setReportHall(1); comEvent.setCurrentOrgId("99999"); //生成一次流转记录 comEvent.setCurrentEventProcessResult("街道上报到区三说会堂"); @@ -446,7 +520,7 @@ comEventDetailVO.setImages(comEventRequestImageVO); map.put("specter", specter); map.put("eventDetail", comEventDetailVO); - List<ComEventTransferRecord> transferRecord = comEventTransferRecordService.list(new QueryWrapper<ComEventTransferRecord>().lambda().eq(ComEventTransferRecord::getEventId, id).orderByAsc(ComEventTransferRecord::getCreateAt)); + List<ComEventTransferRecord> transferRecord = comEventTransferRecordService.list(new QueryWrapper<ComEventTransferRecord>().lambda().eq(ComEventTransferRecord::getEventId, id).orderByDesc(ComEventTransferRecord::getCreateAt)); transferRecord.forEach(comEventTransferRecord -> { List<ComEventResource> list = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getRefId, comEvent.getId()).notIn(ComEventResource::getStatus,(1)).eq(ComEventResource::getTransferId, comEventTransferRecord.getId())); List<ComEventRequestImageVO> ImageVO = CopyUtil.deepCopyListObject(list, ComEventRequestImageVO.class); @@ -503,16 +577,14 @@ @Override public R calculate(LoginUserInfoVO loginUserInfoVO) { ComEvent comEvent=new ComEvent(); + comEvent.setUserType(3); 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)){ + if (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{ @@ -557,8 +629,6 @@ comEvent.setUserType(null); } } - log.info("=====================当前的userType"+comEvent.getUserType()); - log.info("=====================是否专家账号查看"+isExpertCheck); List<ComEventCalculateVO> calculateList = baseMapper.calculate(comEvent); ComEventCalculateVO comEventCalculateVO =new ComEventCalculateVO(); comEventCalculateVO.setStatus("0"); @@ -677,6 +747,13 @@ return R.ok(eventRateVOS); } } + + @Override + public void updateEventStransferRecord(Long id) { + ComEvent comEvent = comEventMapper.selectById(id); + comEventMapper.updateLog(id,comEvent.getSpecialistId()); + } + public String typeToName(Integer type){ switch (type){ case 1: -- Gitblit v1.7.1