Browse Source

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

master
yinzuomei 3 years ago
parent
commit
cee4288924
  1. 96
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcServiceFeedbackV2AddFormDTO.java
  2. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceFeedbackV2Controller.java
  3. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceFeedbackV2Service.java
  4. 62
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceFeedbackV2ServiceImpl.java

96
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcServiceFeedbackV2AddFormDTO.java

@ -0,0 +1,96 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* 服务记录反馈表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-07-18
*/
@Data
public class IcServiceFeedbackV2AddFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 服务ID
*/
@NotBlank(message = "服务Id不能为空", groups = {UpdateGroup.class})
private String serviceRecordId;
/**
* 服务目标
*/
private String serviceGoal;
/**
* 服务效果
*/
private String serviceEffect;
/**
* 服务人数
*/
private Integer servicePeopleNumber;
/**
* 满意度满意度 - 不满意:bad基本满意:good非常满意:perfect
*/
private String satisfaction;
/**
* 服务状态[服务状态cancel取消closed已关闭underway进行中]
*/
private String serviceStatus;
/**
* 地址
*/
private String address;
/**
* 地址经度
*/
private String longitude;
/**
* 地址纬度
*/
private String latitude;
/**
* 地址纬度
*/
private List<FileDTO> fileList;
private String customerId;
private String userId;
@Data
public static class FileDTO {
/**
* 文件名
*/
private String name;
/**
* url地址
*/
private String url;
/**
* 文件类型(图片 - image 视频 - video 语音 - voice 文档 - doc)
*/
private String type;
/**
* 后缀名
*/
private String format;
/**
* 文件大小 kb
*/
private Integer size;
/**
* 语音或视频文件时长单位秒
*/
private Integer duration;
}
}

12
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceFeedbackV2Controller.java

@ -1,7 +1,9 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -9,6 +11,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcServiceFeedbackV2DTO;
import com.epmet.dto.form.IcServiceFeedbackV2AddFormDTO;
import com.epmet.service.IcServiceFeedbackV2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -43,10 +46,11 @@ public class IcServiceFeedbackV2Controller {
@NoRepeatSubmit
@PostMapping("save")
public Result save(@RequestBody IcServiceFeedbackV2DTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
icServiceFeedbackV2Service.save(dto);
public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcServiceFeedbackV2AddFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
icServiceFeedbackV2Service.save(formDTO);
return new Result();
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceFeedbackV2Service.java

@ -3,6 +3,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcServiceFeedbackV2DTO;
import com.epmet.dto.form.IcServiceFeedbackV2AddFormDTO;
import com.epmet.entity.IcServiceFeedbackV2Entity;
import java.util.List;
@ -54,7 +55,7 @@ public interface IcServiceFeedbackV2Service extends BaseService<IcServiceFeedbac
* @author generator
* @date 2022-07-18
*/
void save(IcServiceFeedbackV2DTO dto);
void save(IcServiceFeedbackV2AddFormDTO dto);
/**
* 默认更新

62
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceFeedbackV2ServiceImpl.java

@ -1,19 +1,32 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcServiceFeedbackV2Dao;
import com.epmet.dto.IcServiceFeedbackV2DTO;
import com.epmet.dto.form.IcServiceFeedbackV2AddFormDTO;
import com.epmet.entity.HeartAttachmentEntity;
import com.epmet.entity.IcServiceFeedbackV2Entity;
import com.epmet.entity.IcServiceOrgEntity;
import com.epmet.entity.IcServiceRecordV2Entity;
import com.epmet.service.HeartAttachmentService;
import com.epmet.service.IcServiceFeedbackV2Service;
import com.epmet.service.IcServiceRecordV2Service;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -25,7 +38,13 @@ import java.util.Map;
* @since v1.0.0 2022-07-18
*/
@Service
@Slf4j
public class IcServiceFeedbackV2ServiceImpl extends BaseServiceImpl<IcServiceFeedbackV2Dao, IcServiceFeedbackV2Entity> implements IcServiceFeedbackV2Service {
@Autowired
private IcServiceRecordV2Service icServiceRecordV2Service;
@Autowired
private HeartAttachmentService heartAttachmentService;
@Override
public PageData<IcServiceFeedbackV2DTO> page(Map<String, Object> params) {
@ -60,9 +79,46 @@ public class IcServiceFeedbackV2ServiceImpl extends BaseServiceImpl<IcServiceFee
@Override
@Transactional(rollbackFor = Exception.class)
public void save(IcServiceFeedbackV2DTO dto) {
IcServiceFeedbackV2Entity entity = ConvertUtils.sourceToTarget(dto, IcServiceFeedbackV2Entity.class);
insert(entity);
public void save(IcServiceFeedbackV2AddFormDTO formDTO) {
//1.查询服务记录是否存在
IcServiceRecordV2Entity recordV2Entity = icServiceRecordV2Service.selectById(formDTO.getServiceRecordId());
if (null == recordV2Entity) {
log.error(String.format("新增服务反馈记录失败,未查询到服务记录,服务记录Id->%s", formDTO.getServiceRecordId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "新增服务反馈记录失败,未查询到服务记录");
}
//2.校验是否已存在服务反馈
LambdaQueryWrapper<IcServiceFeedbackV2Entity> tWrapper = new LambdaQueryWrapper<>();
tWrapper.eq(IcServiceFeedbackV2Entity::getServiceRecordId, formDTO.getServiceRecordId());
List<IcServiceFeedbackV2Entity> feedbackList = baseDao.selectList(tWrapper);
if (!CollectionUtils.isEmpty(feedbackList)) {
log.error(String.format("新增服务反馈记录失败,当前服务记录已存在反馈记录,服务记录Id->%s", formDTO.getServiceRecordId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "新增服务反馈记录失败,当前服务记录已存在反馈记录");
}
//3.更新服务记录表数据状态
recordV2Entity.setServiceStatus(formDTO.getServiceStatus());
icServiceRecordV2Service.updateById(recordV2Entity);
//4.新增服务反馈记录
IcServiceFeedbackV2Entity feedback = ConvertUtils.sourceToTarget(formDTO, IcServiceFeedbackV2Entity.class);
feedback.setCustomerId(formDTO.getCustomerId());
feedback.setServiceRecordId(formDTO.getServiceRecordId());
baseDao.insert(feedback);
List<HeartAttachmentEntity> AttachmentList = new ArrayList<>();
if (!CollectionUtils.isEmpty(formDTO.getFileList())) {
int sort = 0;
for (IcServiceFeedbackV2AddFormDTO.FileDTO file : formDTO.getFileList()) {
HeartAttachmentEntity attachment = ConvertUtils.sourceToTarget(file, HeartAttachmentEntity.class);
attachment.setCustomerId(formDTO.getCustomerId());
attachment.setBusinessId(feedback.getId());
attachment.setAttachTo("ic_service_record_v2");
attachment.setSort(sort++);
attachment.setStatus("auto_passed");
AttachmentList.add(attachment);
}
heartAttachmentService.insertBatch(AttachmentList);
}
}
@Override

Loading…
Cancel
Save