Browse Source

Merge remote-tracking branch 'origin/dev_zhili' into dev_zhili

master
sunyuchao 3 years ago
parent
commit
73fd3d3f4d
  1. 55
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/AddEventFromResiFormDTO.java
  2. 16
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java
  3. 9
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java
  4. 79
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  5. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java

55
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/AddEventFromResiFormDTO.java

@ -0,0 +1,55 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.FileCommonDTO;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* @DateTime 2022/5/19 11:14
* @DESC
*/
@Data
public class AddEventFromResiFormDTO implements Serializable {
private static final long serialVersionUID = -2238068041964629750L;
public interface AddEventFromResiForm{}
private String content;
private String address;
@NotBlank(message = "gridId不能为空",groups = AddEventFromResiForm.class)
private String gridId;
/**
* 图片附件列表
*/
private List<FileCommonDTO> attachmentList;
/**
* 语音附件列表
*/
private List<FileCommonDTO> voiceList;
/**
* 纬度
*/
private String latitude;
/**
* 经度
*/
private String longitude;
private String customerId;
private String userId;
}

16
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java

@ -289,4 +289,20 @@ public class IcEventController {
return new Result();
}
/**
* Desc: 新增随手拍
* @param tokenDto
* @param formDTO
* @author zxc
* @date 2022/5/19 13:38
*/
@PostMapping("add-event-resi")
public Result addEventFromResi(@LoginUser TokenDto tokenDto,@RequestBody AddEventFromResiFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AddEventFromResiFormDTO.AddEventFromResiForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
icEventService.addEventFromResi(formDTO);
return new Result();
}
}

9
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java

@ -177,4 +177,13 @@ public interface IcEventService extends BaseService<IcEventEntity> {
* @Description 需求完成/项目结案时 修改事件数据
**/
void closeProjectOrDemand(ColseProjectOrDemandFormDTO formDTO);
/**
* Desc: 新增随手拍
* @param formDTO
* @author zxc
* @date 2022/5/19 13:38
*/
void addEventFromResi(AddEventFromResiFormDTO formDTO);
}

79
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java

@ -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);
}
}
}

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java

@ -484,7 +484,7 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
return list;
}
private void scanContent(String eventContent, List<FileCommonDTO> attachmentList) {
public void scanContent(String eventContent, List<FileCommonDTO> attachmentList) {
//事件内容
if (StringUtils.isNotBlank(eventContent)) {
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();

Loading…
Cancel
Save