| | |
| | | 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.SanShuoMessageVO; |
| | | 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.Snowflake; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.api.ComSanShuoEventTransferRecordController; |
| | | import com.panzhihua.service_community.dao.ComActDAO; |
| | | import com.panzhihua.service_community.dao.ComEventMapper; |
| | | import com.panzhihua.service_community.dao.ComSanshuoExpertDao; |
| | | import com.panzhihua.service_community.dao.ComStreetDAO; |
| | | import com.panzhihua.service_community.dao.*; |
| | | import com.panzhihua.service_community.entity.*; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.model.dos.ComStreetDO; |
| | | import com.panzhihua.service_community.service.*; |
| | | import com.panzhihua.service_community.util.WXMessageUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.RandomUtils; |
| | | import org.checkerframework.checker.units.qual.A; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | import static java.util.Objects.isNull; |
| | |
| | | @Resource |
| | | private ComSanshuoExpertDao comSanshuoExpertDao; |
| | | |
| | | @Resource |
| | | private SysUserDao sysUserDao; |
| | | |
| | | |
| | | @Override |
| | | public R pageByComEvent(ComEvent comEvent, Page pagination,LoginUserInfoVO loginUserInfoVO) { |
| | | Boolean isExpertCheck=false; |
| | | Long expertId=null; |
| | | Boolean isStretAccount = isStreetAccount(loginUserInfoVO); |
| | | // comEvent.setAppId(loginUserInfoVO.getAppId()); |
| | | if (nonNull(comEvent.getUserType())){ |
| | | if (comEvent.getUserType().equals(1)){ |
| | | //个人账号权限 |
| | |
| | | comEvent.setArchive(0); |
| | | comEvent.setConciliation(0); |
| | | comEvent.setChangeExpert(0); |
| | | comEvent.setDistribution(0); |
| | | } else if(comEvent.getEventProcessStatus().equals(2)){ |
| | | //待分配和待验证状态,可以受理,分配专家 |
| | | //关闭调解和归档 |
| | |
| | | comEvent.setSolve(0); |
| | | comEvent.setArchive(0); |
| | | comEvent.setDistribution(0); |
| | | } else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventResult().equals(1)){ |
| | | } else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventResult().equals(1) && !comEvent.getIsEnd().equals(1)){ |
| | | //上报并且调解失败,此时事件的状态为6,事件结果为调解失败 |
| | | //comEvent.setDistribution(0); |
| | | comEvent.setEventResult(null); |
| | |
| | | //关闭所有权限 |
| | | comEvent.setDistribution(0); |
| | | comEvent.setSolve(0); |
| | | comEvent.setArchive(0); |
| | | //comEvent.setArchive(0); |
| | | comEvent.setChangeExpert(0); |
| | | comEvent.setConciliation(0); |
| | | } |
| | | |
| | | } |
| | | else{ |
| | | //已上报到街道或三说会堂,社区没有分配和受理权限权限 |
| | |
| | | //调解中,可以查看,调解,更换专家,删除 |
| | | comEvent.setDistribution(0); |
| | | comEvent.setArchive(0); |
| | | } else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventResult().equals(1)){ |
| | | comEvent.setSolve(0); |
| | | }else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventResult().equals(1) && !comEvent.getIsEnd().equals(1)){ |
| | | //调解完成,可以归档,查看 |
| | | comEvent.setEventResult(null); |
| | | comEvent.setEventProcessStatus(2); |
| | | comEvent.setSolve(0); |
| | | comEvent.setDistribution(0); |
| | | //comEvent.setChangeExpert(0); |
| | | //comEvent.setArchive(0); |
| | | comEvent.setConciliation(0); |
| | | }else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventSucceed().equals(2)){ |
| | | //调解完成,可以归档,查看 |
| | | comEvent.setSolve(0); |
| | | comEvent.setDistribution(0); |
| | | comEvent.setChangeExpert(0); |
| | | comEvent.setConciliation(0); |
| | | } |
| | | }else if (comEvent.getCurrentProcessType().equals(5)){ |
| | | //根据事件状态决定权限 |
| | | if (comEvent.getEventProcessStatus().equals(1) ){ |
| | | //待受理和待验证状态,可以受理,分配专家 |
| | | //关闭调解和归档 |
| | | comEvent.setArchive(0); |
| | | comEvent.setConciliation(0); |
| | | 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(5)){ |
| | | //调解中,可以查看,调解,更换专家,删除 |
| | | comEvent.setDistribution(0); |
| | | comEvent.setSolve(0); |
| | | comEvent.setArchive(0); |
| | | }else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventResult().equals(2) && comEvent.getEventSucceed().equals(2)){ |
| | | //调解完成并且成功,可以归档,查看 |
| | | comEvent.setSolve(0); |
| | | comEvent.setDistribution(0); |
| | | comEvent.setChangeExpert(0); |
| | | comEvent.setConciliation(0); |
| | | } |
| | | else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventSucceed().equals(2)){ |
| | | //调解完成,可以归档,查看 |
| | | comEvent.setSolve(0); |
| | | comEvent.setDistribution(0); |
| | | comEvent.setChangeExpert(0); |
| | | comEvent.setConciliation(0); |
| | | } |
| | | }else{ |
| | | } |
| | | else{ |
| | | //未上上报到行业分中心,或者已上报到区三说会堂,仅查看 |
| | | comEvent.setArchive(0); |
| | | //comEvent.setArchive(0); |
| | | comEvent.setSolve(0); |
| | | comEvent.setDistribution(0); |
| | | comEvent.setChangeExpert(0); |
| | | comEvent.setConciliation(0); |
| | | |
| | | } |
| | | }else if (userType.equals(5) || isStreet){ |
| | | //街道权限,操作街道下属社区的所有事件 |
| | |
| | | comEvent.setEventResult(null); |
| | | comEvent.setEventProcessStatus(1); |
| | | } |
| | | else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventResult().equals(1)){ |
| | | else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventResult().equals(1) && !comEvent.getIsEnd().equals(1)){ |
| | | //设置为待受理 |
| | | comEvent.setEventResult(null); |
| | | comEvent.setEventProcessStatus(2); |
| | |
| | | comEvent.setDistribution(0); |
| | | comEvent.setSolve(0); |
| | | comEvent.setArchive(0); |
| | | } else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventResult().equals(1)){ |
| | | } else if (comEvent.getEventProcessStatus().equals(6) && comEvent.getEventResult().equals(1) && !comEvent.getIsEnd().equals(1)){ |
| | | //失败后转交三说会堂 |
| | | comEvent.setSolve(0); |
| | | comEvent.setDistribution(0); |
| | |
| | | comEvent.setCurrentOrgId(community.getCommunityId().toString()); |
| | | comEvent.setCurrentProcessType(5); |
| | | } |
| | | if (!StringUtils.isEmpty(comEvent.getCenterId())) { |
| | | if (!StringUtils.isEmpty(comEvent.getCenterId())) { |
| | | //创建时处理级别都是专家 |
| | | ComSanshuoIndustryCenter center = comSanShuoIndustryCenterService.getById(comEvent.getCenterId()); |
| | | comEvent.setCurrentOrgName(center.getName()); |
| | | comEvent.setCurrentOrgId(center.getId().toString()); |
| | | comEvent.setCurrentProcessType(5); |
| | | } |
| | | if (StringUtils.isNotEmpty(comEvent.getCenterId())){ |
| | | comEvent.setRequestUserCommunity(null); |
| | | } |
| | | comEvent.setUserEventStatus(2); |
| | | //设置为未上报 |
| | |
| | | comEvent.setUpdateBy(comEvent.getRequestUserId()); |
| | | comEvent.setUpdateAt(new Date()); |
| | | boolean flag = save(comEvent); |
| | | //推送消息到专家微信 |
| | | sendMessage(comEvent.getSpecialistId(),comEvent); |
| | | //添加一条对应记录 |
| | | comEventMapper.insertEventAndExpertRecord(comEvent.getId(),expert.getId(),0); |
| | | if (!flag) { |
| | |
| | | //提交不视为一次流转记录,不保存图片 |
| | | saveEventImageList(comEvent.getImages(), comEvent.getId(),null,1); |
| | | return R.ok(ReturnMsgConstants.SAVE_SUCCESS); |
| | | } |
| | | |
| | | public void sendMessage(Long expertId,ComEvent comEvent){ |
| | | if (nonNull(comEvent.getRequestUserCommunity()) && comEvent.getRequestUserCommunity().equals(10172)){ |
| | | return; |
| | | } |
| | | //获取专家的openId |
| | | ComSanshuoExpert expert = comSanShuoExpertService.getById(expertId); |
| | | SysUser sysUser = sysUserDao.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getPhone, expert.getPhone()).eq(SysUser::getType, 1).eq(SysUser::getAppId,"wx0cef797390444b75" )); |
| | | SanShuoMessageVO vo=new SanShuoMessageVO(); |
| | | if (isNull(sysUser)){ |
| | | return; |
| | | } |
| | | if (isNull(sysUser.getOpenid())){ |
| | | log.info("专家未登陆APP,无法推送"); |
| | | return; |
| | | } |
| | | vo.setTouser(sysUser.getOpenid()); |
| | | vo.setThing1(commediateTypeService.getById(comEvent.getEventCategory()).getName()); |
| | | vo.setThing5("您有一个新的调解事件需处理"); |
| | | vo.setThing2(comEvent.getRequestUserName()); |
| | | vo.setTime3(DateUtil.now()); |
| | | WXMessageUtil.sendStatusMessage(vo); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | ComActDO comActDO = comActDAO.selectById(expert.getCommunityId()); |
| | | comEvent.setCurrentOrgId(comActDO.getStreetId().toString()); |
| | | //生成一次流转记录 |
| | | comEvent.setCurrentEventProcessResult("专家上报到社区"); |
| | | comEvent.setCurrentEventProcessResult("(专家上报到"+comActDO.getName()+")"+comEventConciliationVO.getCurrentEventProcessResult()); |
| | | //更改当前处理部门 |
| | | comEvent.setCurrentOrgName(comActDO.getName()+"调解站"); |
| | | comEventTransferRecord.setFromId(comEvent.getSpecialistId()); |
| | | comEventTransferRecord.setToId(Long.parseLong(comEvent.getCurrentOrgId())); |
| | | comEventTransferRecord.setReportLevel(4); |
| | |
| | | comEvent.setSpecialistName("待分配"); |
| | | comEvent.setSpecialistId(99999L); |
| | | //生成一次流转记录 |
| | | comEvent.setCurrentEventProcessResult("专家上报到行业分中心"); |
| | | ComSanshuoIndustryCenter center = comSanShuoIndustryCenterService.getById(comEvent.getCurrentOrgId()); |
| | | comEvent.setCurrentEventProcessResult("(专家上报到"+center.getName()+")"+comEventConciliationVO.getCurrentEventProcessResult()); |
| | | comEvent.setCurrentOrgName(expert.getUnit()); |
| | | comEventTransferRecord.setFromId(comEvent.getSpecialistId()); |
| | | comEventTransferRecord.setToId(expert.getIndustryCenterId()); |
| | | comEventTransferRecord.setReportLevel(3); |
| | |
| | | comEvent.setCurrentOrgId("99999"); |
| | | //生成一次流转记录 |
| | | comEvent.setReportHall(1); |
| | | comEvent.setCurrentEventProcessResult("行业分中心上报到区三说会堂"); |
| | | comEvent.setCurrentEventProcessResult("(行业分中心上报到区三说会堂中心)"+comEventConciliationVO.getCurrentEventProcessResult()); |
| | | comEvent.setCurrentOrgName("区三说会堂"); |
| | | comEventTransferRecord.setFromId(comEvent.getSpecialistId()); |
| | | comEventTransferRecord.setToId(99999L); |
| | | comEventTransferRecord.setReportLevel(5); |
| | |
| | | ComActDO comActDO = comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getCommunityId, comEvent.getRequestUserCommunity()).eq(ComActDO::getAppId, "wx0cef797390444b75")); |
| | | comEvent.setCurrentOrgId(comActDO.getStreetId().toString()); |
| | | //生成一次流转记录 |
| | | comEvent.setCurrentEventProcessResult("社区报到街道"); |
| | | comEvent.setCurrentEventProcessResult("(社区上报到"+comStreetDAO.selectById(comActDO.getStreetId()).getName()+")"+comEventConciliationVO.getCurrentEventProcessResult()); |
| | | comEvent.setCurrentOrgName(comStreetDAO.selectById(comActDO.getStreetId()).getName()+"调解站"); |
| | | comEventTransferRecord.setFromId(comEvent.getRequestUserCommunity()); |
| | | comEventTransferRecord.setToId(comActDO.getStreetId()); |
| | | comEventTransferRecord.setReportLevel(2); |
| | |
| | | comEvent.setCurrentProcessType(4); |
| | | comEvent.setReportHall(1); |
| | | comEvent.setCurrentOrgId("99999"); |
| | | comEvent.setCurrentOrgName("区三说会堂"); |
| | | //生成一次流转记录 |
| | | comEvent.setCurrentEventProcessResult("街道上报到区三说会堂"); |
| | | comEvent.setCurrentEventProcessResult("(街道上报到区三说会堂中心)"+comEventConciliationVO.getCurrentEventProcessResult()); |
| | | comEventTransferRecord.setFromId(Long.parseLong(comEvent.getCurrentOrgId())); |
| | | comEventTransferRecord.setReportLevel(1); |
| | | comEvent.setReportLevel(1); |
| | | }else { |
| | | //已是最高上报级别,无法上报 |
| | | } |
| | | } |
| | | |
| | | //是否为已完成并且不上报 |
| | | if (!comEventConciliationVO.getReportSuperior() && comEventConciliationVO.getEventSucceed().equals(2)){ |
| | | comEvent.setIsEnd(1); |
| | | } |
| | | int flag = baseMapper.updateById(comEvent); |
| | | comEventTransferRecord.setEventId(comEvent.getId()); |
| | |
| | | || comEvent.getEventProcessStatus() == SanShuoEventStatusEnum.VALID.getCode().intValue()) { |
| | | comEvent.setId(id); |
| | | comEvent.setUserEventStatus(4); |
| | | comEvent.setEventProcessStatus(8); |
| | | comEvent.setEventProcessStatus(9); |
| | | comEvent.setRevokeDes("用户手动取消"); |
| | | comEvent.setRevokeDate(new Date()); |
| | | int flag = baseMapper.updateById(comEvent); |
| | |
| | | List<ComEventResource> resource = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getRefId, id) |
| | | .eq(ComEventResource::getStatus, 5)); |
| | | map.put("archiveImage", resource); |
| | | map.put("contact", getPhone(comEvent)); |
| | | return map; |
| | | } |
| | | |
| | | public String getPhone(ComEvent comEvent){ |
| | | if (isNull(comEvent.getRequestUserCommunity())){ |
| | | return comSanShuoIndustryCenterService.getById(comEvent.getCenterId()).getPhone(); |
| | | }else { |
| | | String contactsPhone = comActDAO.selectById(comEvent.getRequestUserCommunity()).getContactsPhone(); |
| | | if (isNull(contactsPhone)){ |
| | | return null; |
| | | } |
| | | return contactsPhone; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | comEvent.setSpecialistName(specter.getName()); |
| | | comEvent.setEventProcessStatus(SanShuoEventStatusEnum.VALID.getCode()); |
| | | int flag = baseMapper.updateById(comEvent); |
| | | ComEvent comEvent1 = comEventMapper.selectById(id); |
| | | sendMessage(specialistId,comEvent1 ); |
| | | //添加一条对应记录 |
| | | comEventMapper.insertEventAndExpertRecord(id, specialistId,1); |
| | | return flag > 0 ? R.ok() : R.fail(ReturnMsgConstants.UPDATE_FALSE); |
| | | } |
| | | |
| | | @Override |
| | | public R calculate(LoginUserInfoVO loginUserInfoVO) { |
| | | public R calculate(LoginUserInfoVO loginUserInfoVO,Integer level,Long id) { |
| | | ComEvent comEvent=new ComEvent(); |
| | | Boolean isExpertCheck=false; |
| | | Long expertId=null; |
| | |
| | | } |
| | | } |
| | | log.info("当前userType===="+comEvent.getUserType()); |
| | | //comEvent.setAppId(loginUserInfoVO.getAppId()); |
| | | R<LoginUserInfoVO> r = userService.detailUser(loginUserInfoVO.getUserId()); |
| | | LoginUserInfoVO user = r.getData(); |
| | | if (nonNull(user.getAppId())){ |
| | | comEvent.setAppId(user.getAppId()); |
| | | } |
| | | if (nonNull(level) && nonNull(id)){ |
| | | comEvent.setLevel(level); |
| | | comEvent.setSearchId(id); |
| | | comEvent.setUserType(null); |
| | | } |
| | | List<ComEventCalculateVO> calculateList = baseMapper.calculate(comEvent); |
| | | ComEventCalculateVO comEventCalculateVO =new ComEventCalculateVO(); |
| | | comEventCalculateVO.setStatus("0"); |
| | |
| | | if (nonNull(vo.getSuccess()) && !vo.getSuccess().equals(0)){ |
| | | if (nonNull(vo.getAccepted()) && !vo.getAccepted().equals(0)){ |
| | | //计算成功率 |
| | | vo.setSuccessRate(NumberUtil.div(vo.getSuccess(),vo.getAccepted(),2)); |
| | | try { |
| | | vo.setSuccessRate(NumberUtil.div(vo.getSuccess(),vo.getAccepted(),2)); |
| | | }catch (NullPointerException e){ |
| | | vo.setSuccessRate(new BigDecimal(0)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | vo.setExpert(comSanshuoExpertDao.selectExpertCount(indexDataDTO)); |
| | |
| | | if (type.equals(1)){ |
| | | //受理级别占比 |
| | | List<EventRateVO> eventRateVOS = comEventMapper.eventRate(); |
| | | //获取专家受理的数量 |
| | | Integer expertCount=comEventMapper.expertSolveCountCommunity(); |
| | | //获取行业分中心受理数量 |
| | | Integer centerCount=comEventMapper.expertSolveCountCenter(); |
| | | for (EventRateVO eventRateVO : eventRateVOS) { |
| | | if (nonNull(eventRateVO)){ |
| | | eventRateVO.setName(typeToName(eventRateVO.getCurrentProcessType())); |
| | | eventRateVO.setName(typeToName(eventRateVO.getType())); |
| | | // if (eventRateVO.getCurrentProcessType().equals(2)){ |
| | | // eventRateVO.setCount(eventRateVO.getCount()+expertCount); |
| | | // } |
| | | // if (eventRateVO.getCurrentProcessType().equals(1)){ |
| | | // eventRateVO.setCount(eventRateVO.getCount()+centerCount); |
| | | // } |
| | | if (nonNull(eventCount) && !eventCount.equals(0)){ |
| | | //计算占比 |
| | | eventRateVO.setRate(NumberUtil.div(eventRateVO.getCount(),eventCount,2)); |
| | |
| | | case 1: |
| | | return "行业分中心受理"; |
| | | case 3: |
| | | return "街道调解站受理"; |
| | | return "镇/街道受理案件"; |
| | | case 2: |
| | | return "社区调解站受理"; |
| | | return "村/社区受理案件"; |
| | | case 4: |
| | | return "区三说会堂受理"; |
| | | return "区三说会堂中心受理"; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | public String typeToNameExpert(Integer type){ |
| | | switch (type){ |
| | | case 1: |
| | | return "区三说会堂专家"; |
| | | return "区三说会堂中心专家"; |
| | | case 2: |
| | | return "行业分中心专家"; |
| | | case 3: |
| | | return "街道调解站专家"; |
| | | return "镇/街道调解专家"; |
| | | case 4: |
| | | return "社区调解站专家"; |
| | | return "村/社区调解专家"; |
| | | } |
| | | return null; |
| | | } |