| | |
| | | import com.panzhihua.common.constants.ReturnMsgConstants; |
| | | import com.panzhihua.common.enums.SanShuoEventStatusEnum; |
| | | import com.panzhihua.common.model.dtos.community.sanshuo.IndexDateDTO; |
| | | import com.panzhihua.common.model.dtos.user.IndexDataDTO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.sanshuo.*; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.CopyUtil; |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.common.utlis.Snowflake; |
| | |
| | | import com.panzhihua.service_community.model.dos.ComStreetDO; |
| | | import com.panzhihua.service_community.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.apache.commons.lang3.RandomUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | import static java.util.Objects.nonNull; |
| | |
| | | @Resource |
| | | private ComEventMapper comEventMapper; |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @Resource |
| | | private CommediateTypeService commediateTypeService; |
| | | |
| | | @Override |
| | | public R pageByComEvent(ComEvent comEvent, Page pagination) { |
| | | IPage<ComEvent> list = baseMapper.pageByComEvent(comEvent, pagination); |
| | |
| | | List<ComEventResource> resourceList = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getRefId, comEvent1.getId())); |
| | | List<ComEventRequestImageVO> comEventRequestImageVO = CopyUtil.deepCopyListObject(resourceList, ComEventRequestImageVO.class); |
| | | comEvent1.setImages(comEventRequestImageVO); |
| | | comEvent1.setIcon(userService.getUserInfoByUserId(comEvent1.getRequestUserId().toString()).getData().getImageUrl()); |
| | | ComMediateType category = commediateTypeService.getById(comEvent1.getEventCategory()); |
| | | comEvent1.setEventCategoryName(category.getName()); |
| | | }); |
| | | return R.ok(list); |
| | | } |
| | |
| | | if (comEvent.getRequestUserCommunity() != null) { |
| | | ComActDO community = comActDAO.selectById(comEvent.getRequestUserCommunity()); |
| | | comEvent.setCurrentOrgName(community.getName()); |
| | | comEvent.setCurrentOrgId(community.getCommunityId().toString()); |
| | | comEvent.setCurrentProcessType(2); |
| | | } |
| | | if (comEvent.getCenterId() != null) { |
| | | if (!StringUtils.isEmpty(comEvent.getCenterId())) { |
| | | ComSanshuoIndustryCenter center = comSanShuoIndustryCenterService.getById(comEvent.getCenterId()); |
| | | comEvent.setCurrentOrgName(center.getName()); |
| | | comEvent.setCurrentOrgId(center.getId().toString()); |
| | | comEvent.setCurrentProcessType(1); |
| | | } |
| | | comEvent.setUserEventStatus(2); |
| | | comEvent.setEventProcessStatus(SanShuoEventStatusEnum.UNDO.getCode()); |
| | |
| | | if (!flag) { |
| | | return R.fail(ReturnMsgConstants.DATA_EXIST); |
| | | } |
| | | saveEventImageList(comEvent.getImages(), comEvent.getId()); |
| | | saveEventImageList(comEvent.getImages(), comEvent.getId(),null,1); |
| | | return R.ok(ReturnMsgConstants.SAVE_SUCCESS); |
| | | } |
| | | |
| | | private Boolean saveEventImageList(List<ComEventRequestImageVO> images, Long id) { |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean saveEventImageList(List<ComEventRequestImageVO> images, Long id,Long transferId,Integer status) { |
| | | List<ComEventResource> comEventResourceList = new ArrayList<>(); |
| | | if (!StringUtils.isEmpty(images)) { |
| | | List<ComEventRequestImageVO> imagesList = images; |
| | |
| | | ComEventResource comEventResource = new ComEventResource(); |
| | | comEventResource.setId(Snowflake.getId()); |
| | | comEventResource.setRefId(id); |
| | | comEventResource.setStatus(1); |
| | | comEventResource.setTransferId(transferId); |
| | | comEventResource.setStatus(status); |
| | | comEventResource.setType(1); |
| | | comEventResource.setResourceName(comEventRequestImageVO.getName()); |
| | | comEventResource.setResourceSize(comEventRequestImageVO.getSize()); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R updateComEvent(ComEvent comEvent) { |
| | | if (checkExist(comEvent.getOrderSn(), null)) { |
| | | /* if (checkExist(comEvent.getOrderSn(), comEvent.getId())) { |
| | | return R.fail(ReturnMsgConstants.DATA_EXIST); |
| | | } |
| | | }*/ |
| | | int flag = baseMapper.updateById(comEvent); |
| | | return flag > 0 ? R.ok(comEvent, ReturnMsgConstants.UPDATE_SUCCESS) : R.fail(ReturnMsgConstants.UPDATE_FALSE); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R conciliationEvent(ComEventConciliationVO comEventConciliationVO) { |
| | | saveEventImageList(comEventConciliationVO.getImages(), comEventConciliationVO.getId()); |
| | | public R conciliationEvent(ComEventConciliationVO comEventConciliationVO, LoginUserInfoVO loginUserInfo) { |
| | | saveEventImageList(comEventConciliationVO.getImages(), comEventConciliationVO.getId(),null,4); |
| | | ComEvent comEvent = baseMapper.selectById(comEventConciliationVO.getId()); |
| | | comEvent.setEventSucceed(comEventConciliationVO.getEventSucceed()); |
| | | comEvent.setEventResult(comEventConciliationVO.getEventResult()); |
| | | comEvent.setReportSuperior(comEventConciliationVO.getReportSuperior()); |
| | | if(comEventConciliationVO.getEventSucceed() ==2){ |
| | | comEvent.setEventProcessStatus(6); |
| | | } |
| | | comEvent.setCurrentEventProcessResult(comEventConciliationVO.getCurrentEventProcessResult()); |
| | | //如果当前请求,需要上报上级进行处理 |
| | | if (comEventConciliationVO.getReportSuperior()) { |
| | |
| | | } |
| | | } |
| | | } |
| | | baseMapper.updateById(comEvent); |
| | | return R.ok(); |
| | | int flag = baseMapper.updateById(comEvent); |
| | | ComEventTransferRecord comEventTransferRecord = new ComEventTransferRecord(); |
| | | comEventTransferRecord.setEventId(comEvent.getId()); |
| | | comEventTransferRecord.setSave(true); |
| | | comEventTransferRecord.setProcessResult(comEvent.getCurrentEventProcessResult()); |
| | | comEventTransferRecord.setProcessResultData(new Date().toString()); |
| | | comEventTransferRecord.setProcessDate(new Date()); |
| | | comEventTransferRecord.setProcessBy(loginUserInfo.getUserId()); |
| | | comEventTransferRecord.setProcessByName(loginUserInfo.getName()); |
| | | comEventTransferRecord.setProcessType(1); |
| | | comEventTransferRecord.setCreateAt(new Date()); |
| | | comEventTransferRecord.setSpecialistId(comEvent.getSpecialistId()); |
| | | comEventTransferRecord.setSpecialistOrg(comEvent.getCurrentOrgId()); |
| | | comEventTransferRecord.setSpecialistLevel(comEvent.getSpecialistLevel()); |
| | | comEventTransferRecord.setSpecialistName(comEvent.getSpecialistName()); |
| | | comEventTransferRecord.setEventResult(comEvent.getEventSucceed()); |
| | | comEventTransferRecord.setEventStatus(comEvent.getEventProcessStatus()); |
| | | saveEventImageList(comEvent.getImages(),comEvent.getId(),comEventTransferRecord.getId(),4); |
| | | comEventTransferRecordService.insertComEventTransferRecord(comEventTransferRecord); |
| | | return flag > 0 ? R.ok() : R.fail(ReturnMsgConstants.UPDATE_FALSE); |
| | | } |
| | | |
| | | @Override |
| | |
| | | comEvent.setUserEventStatus(4); |
| | | comEvent.setEventProcessStatus(SanShuoEventStatusEnum.CANCEL.getCode()); |
| | | comEvent.setRevokeDes("用户手动取消"); |
| | | baseMapper.updateById(comEvent); |
| | | return R.ok(); |
| | | int flag = baseMapper.updateById(comEvent); |
| | | return flag > 0 ? R.ok() : R.fail(ReturnMsgConstants.UPDATE_FALSE); |
| | | } else { |
| | | return R.fail("当前申请已经受理,不能取消!"); |
| | | } |
| | |
| | | ComEvent comEvent = baseMapper.selectById(id); |
| | | ComSanshuoExpert specter = comSanShuoExpertService.getById(comEvent.getSpecialistId()); |
| | | CopyUtil.copyProperties(comEvent, comEventDetailVO); |
| | | List<ComEventResource> resourceList = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getRefId, id)); |
| | | List<ComEventResource> resourceList = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getRefId, id) |
| | | .eq(ComEventResource::getStatus,1)); |
| | | List<ComEventRequestImageVO> comEventRequestImageVO = CopyUtil.deepCopyListObject(resourceList, ComEventRequestImageVO.class); |
| | | comEventDetailVO.setImages(comEventRequestImageVO); |
| | | map.put("specter", specter); |
| | | map.put("eventDetail", comEventDetailVO); |
| | | List<ComEventTransferRecord> transferRecord = comEventTransferRecordService.list(new QueryWrapper<ComEventTransferRecord>().lambda().eq(ComEventTransferRecord::getEventId, id)); |
| | | transferRecord.forEach(comEventTransferRecord -> { |
| | | List<ComEventResource> list = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getTransferId, comEventTransferRecord.getId())); |
| | | List<ComEventRequestImageVO> ImageVO = CopyUtil.deepCopyListObject(list, ComEventRequestImageVO.class); |
| | | comEventTransferRecord.setImages(ImageVO); |
| | | }); |
| | | map.put("transferLog", transferRecord); |
| | | List<ComEventResource> resource = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getRefId, id) |
| | | .eq(ComEventResource::getStatus, 5)); |
| | |
| | | comEvent.setSpecialistAcceptTime(new Date()); |
| | | comEvent.setSpecialistName(specter.getName()); |
| | | comEvent.setEventProcessStatus(SanShuoEventStatusEnum.ACCEPT.getCode()); |
| | | baseMapper.updateById(comEvent); |
| | | return R.ok(); |
| | | int flag = baseMapper.updateById(comEvent); |
| | | return flag > 0 ? R.ok() : R.fail(ReturnMsgConstants.UPDATE_FALSE); |
| | | } |
| | | |
| | | @Override |
| | |
| | | comEvent.setSpecialistAcceptTime(new Date()); |
| | | comEvent.setSpecialistName(specter.getName()); |
| | | comEvent.setEventProcessStatus(SanShuoEventStatusEnum.ACCEPT.getCode()); |
| | | baseMapper.updateById(comEvent); |
| | | return R.ok(); |
| | | int flag = baseMapper.updateById(comEvent); |
| | | return flag > 0 ? R.ok() : R.fail(ReturnMsgConstants.UPDATE_FALSE); |
| | | } |
| | | |
| | | @Override |
| | | public R calculate() { |
| | | List<ComEventCalculateVO> calculateList = baseMapper.calculate(); |
| | | ComEventCalculateVO comEventCalculateVO =new ComEventCalculateVO(); |
| | | comEventCalculateVO.setStatus("0"); |
| | | comEventCalculateVO.setSum(baseMapper.selectCount(new QueryWrapper<ComEvent>().lambda()).toString()); |
| | | calculateList.add(comEventCalculateVO); |
| | | return R.ok(calculateList); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R archiveRequest(ComEventArchiveVO comEventArchiveVO, LoginUserInfoVO sysUser) { |
| | | ComEvent comEvent = baseMapper.selectById(comEventArchiveVO.getId()); |
| | | comEvent.setEventProcessStatus(6); |
| | | if (comEvent.getEventSucceed() == 2) { |
| | | comEvent.setEventProcessStatus(7); |
| | | } else { |
| | | comEvent.setEventProcessStatus(6); |
| | | } |
| | | comEvent.setResult(comEventArchiveVO.getResult()); |
| | | baseMapper.updateById(comEvent); |
| | | ComEventTransferRecord comEventTransferRecord = new ComEventTransferRecord(); |
| | |
| | | comEventTransferRecord.setSpecialistName(comEvent.getSpecialistName()); |
| | | comEventTransferRecord.setEventResult(comEvent.getEventSucceed()); |
| | | comEventTransferRecord.setEventStatus(comEvent.getEventProcessStatus()); |
| | | comEventTransferRecordService.insertComEventTransferRecord(comEventTransferRecord); |
| | | return R.ok(); |
| | | return comEventTransferRecordService.insertComEventTransferRecord(comEventTransferRecord); |
| | | } |
| | | |
| | | /** |