ComplaintApi.java 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.zhiqiyun.open.router.apis;
  2. import com.dliyun.oap.framework.annotation.ServiceMethod;
  3. import com.dliyun.oap.framework.annotation.ServiceMethodBean;
  4. import com.dliyun.oap.framework.response.OapResponse;
  5. import com.zhiqiyun.open.core.enmus.ComplaintState;
  6. import com.zhiqiyun.open.core.models.statistics.ComplaintInfo;
  7. import com.zhiqiyun.open.core.service.ComplaintInfoService;
  8. import com.zhiqiyun.open.core.service.SequenceService;
  9. import com.zhiqiyun.open.router.request.SaveComplaintInfoRequest;
  10. import com.zhiqiyun.open.utils.DateUtil;
  11. import lombok.extern.slf4j.Slf4j;
  12. import org.springframework.beans.BeanUtils;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. @Slf4j
  15. @ServiceMethodBean
  16. public class ComplaintApi {
  17. @Autowired
  18. private ComplaintInfoService complaintInfoService;
  19. @Autowired
  20. private SequenceService sequenceService;
  21. @ServiceMethod(method = "save.complaint.info", title = "保存客诉信息")
  22. public OapResponse saveComplaintInfo(SaveComplaintInfoRequest request) {
  23. Long id = this.sequenceService.nextId();
  24. ComplaintInfo entity = new ComplaintInfo();
  25. entity.setTitle(request.getTitle());
  26. entity.setCategory(request.getCategory());
  27. entity.setChannel(request.getChannel());
  28. entity.setLitpics(request.getLitpics());
  29. entity.setContent(request.getContent());
  30. entity.setState(ComplaintState.PENDING);
  31. entity.setCreatedTime(DateUtil.current());
  32. entity.setId(id);
  33. this.complaintInfoService.save(entity);
  34. return OapResponse.success();
  35. }
  36. }