|
|
@ -1,4 +1,5 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
@ -7,6 +8,7 @@ import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
|
import com.epmet.commons.tools.dto.form.FileCommonDTO; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.enums.DictTypeEnum; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
@ -94,6 +96,8 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit |
|
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private OperCrmOpenFeignClient crmOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private ResiEventServiceImpl resiEventService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -1022,5 +1026,80 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 新增【随手拍、讲】 |
|
|
|
* @param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2022/5/19 13:38 |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public void addEventFromResi(AddEventFromResiFormDTO formDTO) { |
|
|
|
if(StringUtils.isBlank(formDTO.getContent()) && CollectionUtils.isEmpty(formDTO.getVoiceList())) { |
|
|
|
//话题内容和语音不能同时为空
|
|
|
|
log.error("事件内容和语音不能同时为空"); |
|
|
|
throw new RenException(EpmetErrorCode.RESI_EVENT_SUBMIT.getCode(), EpmetErrorCode.RESI_EVENT_SUBMIT.getMsg()); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(formDTO.getVoiceList()) && StringUtils.isBlank(formDTO.getContent())) { |
|
|
|
formDTO.setContent("语音事件"); |
|
|
|
} |
|
|
|
resiEventService.scanContent(formDTO.getContent(), formDTO.getAttachmentList()); |
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId()); |
|
|
|
if (null == gridInfo){ |
|
|
|
throw new EpmetException("未查询到此网格信息"+formDTO.getGridId()); |
|
|
|
} |
|
|
|
IcEventEntity entity = ConvertUtils.sourceToTarget(formDTO,IcEventEntity.class); |
|
|
|
entity.setAgencyId(gridInfo.getPid()); |
|
|
|
entity.setGridPids(gridInfo.getPids()); |
|
|
|
Result<List<UserBaseInfoResultDTO>> userResult = userOpenFeignClient.queryUserBaseInfo(Arrays.asList(formDTO.getUserId())); |
|
|
|
if (!userResult.success() && CollectionUtils.isEmpty(userResult.getData())){ |
|
|
|
throw new EpmetException("查询用户信息失败"+formDTO.getUserId()); |
|
|
|
} |
|
|
|
entity.setReportUserId(formDTO.getUserId()); |
|
|
|
userResult.getData().forEach(u -> { |
|
|
|
if (u.getUserId().equals(formDTO.getUserId())){ |
|
|
|
entity.setName(u.getRealName()); |
|
|
|
entity.setMobile(u.getMobile()); |
|
|
|
entity.setIdCard(u.getIdNum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 0代表 随手拍和随时讲
|
|
|
|
entity.setSourceType(NumConstant.ZERO_STR); |
|
|
|
entity.setHappenTime(new Date()); |
|
|
|
entity.setEventContent(formDTO.getContent()); |
|
|
|
entity.setStatus("processing"); |
|
|
|
entity.setReadFlag(0); |
|
|
|
entity.setRedDot(0); |
|
|
|
entity.setLatestOperatedTime(new Date()); |
|
|
|
entity.setAuditStatus(TopicConstant.AUTO_PASSED); |
|
|
|
baseDao.insert(entity); |
|
|
|
//3-2.附件数据保存
|
|
|
|
List<IcEventAttachmentEntity> attachmentEntityList = new ArrayList<>(); |
|
|
|
if (!CollectionUtils.isEmpty(formDTO.getAttachmentList())) { |
|
|
|
disposeAttachment(formDTO.getAttachmentList(), attachmentEntityList,entity.getId(),formDTO.getCustomerId(),formDTO.getUserId()); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(formDTO.getVoiceList())) { |
|
|
|
disposeAttachment(formDTO.getVoiceList(), attachmentEntityList,entity.getId(),formDTO.getCustomerId(),formDTO.getUserId()); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(attachmentEntityList)){ |
|
|
|
icEventAttachmentService.insertBatch(attachmentEntityList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void disposeAttachment(List<FileCommonDTO> list,List<IcEventAttachmentEntity> attachmentEntityList,String id,String customerId,String userId){ |
|
|
|
int sort = NumConstant.ZERO; |
|
|
|
for (FileCommonDTO a : list) { |
|
|
|
IcEventAttachmentEntity attachment = new IcEventAttachmentEntity(); |
|
|
|
attachment.setCustomerId(customerId); |
|
|
|
attachment.setIcEventId(id); |
|
|
|
attachment.setCreatedBy(userId); |
|
|
|
attachment.setAttachmentFormat(a.getFormat()); |
|
|
|
attachment.setAttachmentType(a.getType()); |
|
|
|
attachment.setAttachmentUrl(a.getUrl()); |
|
|
|
attachment.setStatus(TopicConstant.AUTO_PASSED); |
|
|
|
attachment.setSort(sort++); |
|
|
|
attachmentEntityList.add(attachment); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |