5-28 fix
parent
bfc6417c0f
commit
14d6f93390
|
|
@ -38,6 +38,12 @@ public class FeedbackController {
|
|||
return taskListService.deleteFeedback(id);
|
||||
}
|
||||
|
||||
@ApiOperation("编辑反馈")
|
||||
@PostMapping("/edit")
|
||||
public SingleResponse<FeedbackCO> editFeedback(@Validated @RequestBody FeedbackEditCmd cmd) {
|
||||
return taskListService.editFeedback(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("获取反馈周期分组列表")
|
||||
@PostMapping("/periodGroupList")
|
||||
public MultiResponse<FeedbackPeriodGroupCO> periodGroupList(@RequestBody FeedbackPeriodGroupQry qry) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
package com.zcloud.safetyDutyList.command.tasklist;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.FeedbackGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.FeedbackE;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.FeedbackCO;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.FeedbackEditCmd;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.FeedbackDO;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.FeedbackRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class FeedbackEditExe {
|
||||
private final FeedbackGateway feedbackGateway;
|
||||
private final FeedbackRepository feedbackRepository;
|
||||
|
||||
public FeedbackCO execute(FeedbackEditCmd cmd) {
|
||||
FeedbackE feedbackE = feedbackGateway.getByFeedbackId(cmd.getFeedbackId());
|
||||
if (feedbackE == null) {
|
||||
throw new BizException("反馈记录不存在");
|
||||
}
|
||||
feedbackE.setFeedbackContent(cmd.getFeedbackContent());
|
||||
boolean res = feedbackGateway.update(feedbackE);
|
||||
if (!res) {
|
||||
throw new BizException("反馈编辑失败");
|
||||
}
|
||||
|
||||
FeedbackDO feedbackDO = feedbackRepository.getByFeedbackId(cmd.getFeedbackId());
|
||||
FeedbackCO co = new FeedbackCO();
|
||||
BeanUtils.copyProperties(feedbackDO, co);
|
||||
return co;
|
||||
}
|
||||
}
|
||||
|
|
@ -53,6 +53,8 @@ public class TaskListServiceImpl implements TaskListServiceI {
|
|||
private final FeedbackAddExe feedbackAddExe;
|
||||
/** 反馈删除执行器 */
|
||||
private final FeedbackDeleteExe feedbackDeleteExe;
|
||||
/** 反馈编辑执行器 */
|
||||
private final FeedbackEditExe feedbackEditExe;
|
||||
/** 清单查询执行器 */
|
||||
private final TaskListQueryExe taskListQueryExe;
|
||||
/** 任务详情查询执行器 */
|
||||
|
|
@ -165,6 +167,12 @@ public class TaskListServiceImpl implements TaskListServiceI {
|
|||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<FeedbackCO> editFeedback(FeedbackEditCmd cmd) {
|
||||
FeedbackCO co = feedbackEditExe.execute(cmd);
|
||||
return SingleResponse.of(co);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiResponse<FeedbackPeriodGroupCO> feedbackPeriodGroupList(FeedbackPeriodGroupQry qry) {
|
||||
return feedbackQueryExe.periodGroupList(qry);
|
||||
|
|
|
|||
|
|
@ -155,6 +155,14 @@ public interface TaskListServiceI {
|
|||
*/
|
||||
SingleResponse deleteFeedback(Long id);
|
||||
|
||||
/**
|
||||
* 编辑反馈记录
|
||||
*
|
||||
* @param cmd 编辑命令(含反馈ID和反馈内容)
|
||||
* @return 编辑后的反馈信息
|
||||
*/
|
||||
SingleResponse<FeedbackCO> editFeedback(FeedbackEditCmd cmd);
|
||||
|
||||
/**
|
||||
* 查询反馈周期分组列表(按周期标识分组统计反馈数量)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.zcloud.safetyDutyList.dto.tasklist;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FeedbackEditCmd implements Serializable {
|
||||
@ApiModelProperty(value = "反馈UUID", required = true)
|
||||
@NotEmpty(message = "反馈ID不能为空")
|
||||
private String feedbackId;
|
||||
|
||||
@ApiModelProperty(value = "反馈内容", required = true)
|
||||
@NotEmpty(message = "反馈内容不能为空")
|
||||
private String feedbackContent;
|
||||
}
|
||||
Loading…
Reference in New Issue