|  |  | @ -229,6 +229,9 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit | 
			
		
	
		
			
				
					|  |  |  |         IcEventEntity entity = ConvertUtils.sourceToTarget(formDTO, IcEventEntity.class); | 
			
		
	
		
			
				
					|  |  |  |         entity.setAgencyId(gridInfo.getPid()); | 
			
		
	
		
			
				
					|  |  |  |         entity.setGridPids(gridInfo.getPids()); | 
			
		
	
		
			
				
					|  |  |  |         entity.setHappenTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |         entity.setLatestOperatedTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |         entity.setAuditStatus(TopicConstant.AUTO_PASSED); | 
			
		
	
		
			
				
					|  |  |  |         insert(entity); | 
			
		
	
		
			
				
					|  |  |  |         //3-2.附件数据保存
 | 
			
		
	
		
			
				
					|  |  |  |         List<IcEventAttachmentEntity> imageEntityList = new ArrayList<>(); | 
			
		
	
	
		
			
				
					|  |  | @ -511,4 +514,71 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         return resultList; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * @Author sun | 
			
		
	
		
			
				
					|  |  |  |      * @Description 事件管理-回复 | 
			
		
	
		
			
				
					|  |  |  |      **/ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     @Transactional(rollbackFor = Exception.class) | 
			
		
	
		
			
				
					|  |  |  |     public void reply(IcEventReplyFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         //1.查询事件数据 判断是否允许回复
 | 
			
		
	
		
			
				
					|  |  |  |         IcEventEntity entity = baseDao.selectById(formDTO.getIcEventId()); | 
			
		
	
		
			
				
					|  |  |  |         if (null == entity || "1".equals(entity.getOperationType()) || "2".equals(entity.getOperationType())) { | 
			
		
	
		
			
				
					|  |  |  |             throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前事件不允许回复"); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //2.修改事件数据
 | 
			
		
	
		
			
				
					|  |  |  |         if (StringUtils.isNotBlank(formDTO.getOperationType()) && "closed_case".equals(formDTO.getStatus())){ | 
			
		
	
		
			
				
					|  |  |  |             entity.setStatus(formDTO.getStatus()); | 
			
		
	
		
			
				
					|  |  |  |             entity.setCloseCaseTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         entity.setLatestOperatedTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |         baseDao.updateById(entity); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //3.新增回复数据
 | 
			
		
	
		
			
				
					|  |  |  |         //获取当前工作人员缓存信息
 | 
			
		
	
		
			
				
					|  |  |  |         CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |         if (null == staffInfo) { | 
			
		
	
		
			
				
					|  |  |  |             throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         IcEventReplyEntity replyEntity = new IcEventReplyEntity(); | 
			
		
	
		
			
				
					|  |  |  |         replyEntity.setCustomerId(formDTO.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |         replyEntity.setIcEventId(formDTO.getIcEventId()); | 
			
		
	
		
			
				
					|  |  |  |         replyEntity.setFromUserId(formDTO.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |         replyEntity.setContent(formDTO.getContent()); | 
			
		
	
		
			
				
					|  |  |  |         replyEntity.setUserShowName(staffInfo.getAgencyName() + "-" + staffInfo.getRealName()); | 
			
		
	
		
			
				
					|  |  |  |         icEventReplyService.insert(replyEntity); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //4.判断新增或修改分类数据
 | 
			
		
	
		
			
				
					|  |  |  |         if (StringUtils.isNotBlank(formDTO.getOperationType())) { | 
			
		
	
		
			
				
					|  |  |  |             //查询分类信息
 | 
			
		
	
		
			
				
					|  |  |  |             List<String> categoryList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |             categoryList.add(formDTO.getCategoryId()); | 
			
		
	
		
			
				
					|  |  |  |             CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList); | 
			
		
	
		
			
				
					|  |  |  |             AtomicReference<IcEventCategoryEntity> categoryEntity = null; | 
			
		
	
		
			
				
					|  |  |  |             category.getCategoryList().forEach(ca -> { | 
			
		
	
		
			
				
					|  |  |  |                 if (ca.getId().equals(formDTO.getCategoryId())) { | 
			
		
	
		
			
				
					|  |  |  |                     categoryEntity.set(new IcEventCategoryEntity()); | 
			
		
	
		
			
				
					|  |  |  |                     categoryEntity.get().setCustomerId(formDTO.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |                     categoryEntity.get().setIcEventId(entity.getId()); | 
			
		
	
		
			
				
					|  |  |  |                     categoryEntity.get().setCategoryId(ca.getId()); | 
			
		
	
		
			
				
					|  |  |  |                     categoryEntity.get().setCategoryPids(ca.getPids()); | 
			
		
	
		
			
				
					|  |  |  |                     categoryEntity.get().setCategoryCode(ca.getCategoryCode()); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |             IcEventCategoryEntity icEventCategory = icEventCategoryService.getByEventId(formDTO.getIcEventId()); | 
			
		
	
		
			
				
					|  |  |  |             if (null == category) { | 
			
		
	
		
			
				
					|  |  |  |                 icEventCategoryService.insert(categoryEntity.get()); | 
			
		
	
		
			
				
					|  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |                 categoryEntity.get().setId(icEventCategory.getId()); | 
			
		
	
		
			
				
					|  |  |  |                 icEventCategoryService.updateById(categoryEntity.get()); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //5.新增操作记录数据
 | 
			
		
	
		
			
				
					|  |  |  |         IcEventOperationLogEntity logEntity = logEntity(formDTO.getCustomerId(), formDTO.getIcEventId(), formDTO.getUserId(), new Date(), "reply", "reply"); | 
			
		
	
		
			
				
					|  |  |  |         icEventOperationLogService.insert(logEntity); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } |