stjdydayou hace 4 años
padre
commit
15f2c41c7d

+ 46 - 0
src/main/java/com/zhiqiyun/open/router/apis/ComplaintApi.java

@@ -0,0 +1,46 @@
+package com.zhiqiyun.open.router.apis;
+
+import com.dliyun.oap.framework.annotation.ServiceMethod;
+import com.dliyun.oap.framework.annotation.ServiceMethodBean;
+import com.dliyun.oap.framework.response.OapResponse;
+import com.zhiqiyun.open.core.enmus.ComplaintState;
+import com.zhiqiyun.open.core.models.statistics.ComplaintInfo;
+import com.zhiqiyun.open.core.service.ComplaintInfoService;
+import com.zhiqiyun.open.core.service.SequenceService;
+import com.zhiqiyun.open.router.request.SaveComplaintInfoRequest;
+import com.zhiqiyun.open.utils.DateUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@Slf4j
+@ServiceMethodBean
+public class ComplaintApi {
+
+	@Autowired
+	private ComplaintInfoService complaintInfoService;
+
+	@Autowired
+	private SequenceService sequenceService;
+
+	@ServiceMethod(method = "save.complaint.info", title = "保存客诉信息")
+	public OapResponse listPlaceCategory(SaveComplaintInfoRequest request) {
+
+		Long id = this.sequenceService.nextId();
+
+		ComplaintInfo entity = new ComplaintInfo();
+		entity.setTitle(request.getTitle());
+		entity.setCategory(request.getCategory());
+		entity.setChannel(request.getChannel());
+		entity.setLitpics(request.getLitpics());
+		entity.setContent(request.getContent());
+
+		entity.setState(ComplaintState.PENDING);
+		entity.setCreatedTime(DateUtil.current());
+		entity.setId(id);
+
+		this.complaintInfoService.save(entity);
+
+		return OapResponse.success();
+	}
+}

+ 35 - 0
src/main/java/com/zhiqiyun/open/router/request/SaveComplaintInfoRequest.java

@@ -0,0 +1,35 @@
+package com.zhiqiyun.open.router.request;
+
+import com.dliyun.oap.framework.annotation.ServiceParamField;
+import com.dliyun.oap.framework.request.AbstractOapRequest;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class SaveComplaintInfoRequest extends AbstractOapRequest {
+
+	@NotBlank
+	@ServiceParamField(describe = "标题")
+	private String title;
+
+	@NotBlank
+	@ServiceParamField(describe = "类型")
+	private String category;
+
+	@NotBlank
+	@ServiceParamField(describe = "渠道")
+	private String channel;
+
+	@NotNull
+	@ServiceParamField(describe = "图片")
+	private List<String> litpics;
+
+	@NotBlank
+	@ServiceParamField(describe = "投诉内容")
+	private String content;
+}