master
tianxinlei 2026-05-28 10:54:56 +08:00
parent bfc6417c0f
commit 14d6f93390
5 changed files with 81 additions and 0 deletions

View File

@ -38,6 +38,12 @@ public class FeedbackController {
return taskListService.deleteFeedback(id); return taskListService.deleteFeedback(id);
} }
@ApiOperation("编辑反馈")
@PostMapping("/edit")
public SingleResponse<FeedbackCO> editFeedback(@Validated @RequestBody FeedbackEditCmd cmd) {
return taskListService.editFeedback(cmd);
}
@ApiOperation("获取反馈周期分组列表") @ApiOperation("获取反馈周期分组列表")
@PostMapping("/periodGroupList") @PostMapping("/periodGroupList")
public MultiResponse<FeedbackPeriodGroupCO> periodGroupList(@RequestBody FeedbackPeriodGroupQry qry) { public MultiResponse<FeedbackPeriodGroupCO> periodGroupList(@RequestBody FeedbackPeriodGroupQry qry) {

View File

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

View File

@ -53,6 +53,8 @@ public class TaskListServiceImpl implements TaskListServiceI {
private final FeedbackAddExe feedbackAddExe; private final FeedbackAddExe feedbackAddExe;
/** 反馈删除执行器 */ /** 反馈删除执行器 */
private final FeedbackDeleteExe feedbackDeleteExe; private final FeedbackDeleteExe feedbackDeleteExe;
/** 反馈编辑执行器 */
private final FeedbackEditExe feedbackEditExe;
/** 清单查询执行器 */ /** 清单查询执行器 */
private final TaskListQueryExe taskListQueryExe; private final TaskListQueryExe taskListQueryExe;
/** 任务详情查询执行器 */ /** 任务详情查询执行器 */
@ -165,6 +167,12 @@ public class TaskListServiceImpl implements TaskListServiceI {
return SingleResponse.buildSuccess(); return SingleResponse.buildSuccess();
} }
@Override
public SingleResponse<FeedbackCO> editFeedback(FeedbackEditCmd cmd) {
FeedbackCO co = feedbackEditExe.execute(cmd);
return SingleResponse.of(co);
}
@Override @Override
public MultiResponse<FeedbackPeriodGroupCO> feedbackPeriodGroupList(FeedbackPeriodGroupQry qry) { public MultiResponse<FeedbackPeriodGroupCO> feedbackPeriodGroupList(FeedbackPeriodGroupQry qry) {
return feedbackQueryExe.periodGroupList(qry); return feedbackQueryExe.periodGroupList(qry);

View File

@ -155,6 +155,14 @@ public interface TaskListServiceI {
*/ */
SingleResponse deleteFeedback(Long id); SingleResponse deleteFeedback(Long id);
/**
*
*
* @param cmd ID
* @return
*/
SingleResponse<FeedbackCO> editFeedback(FeedbackEditCmd cmd);
/** /**
* *
* *

View File

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