master
tianxinlei 2026-05-25 11:15:33 +08:00
parent 6b13f62e73
commit 8d041cda2d
9 changed files with 57 additions and 34 deletions

View File

@ -1,6 +1,6 @@
sdk:
server:
app-key: 002db3f140fe47d1b2754856c5172bd5
app-key: 09a491d02f9b4371968deb601898b467
client:
gateway:
url: ${common.gateway.network.http.external}

View File

@ -28,10 +28,16 @@ public class FeedbackController {
@ApiOperation("提交反馈")
@PostMapping("/save")
public SingleResponse addFeedback(@Validated @RequestBody FeedbackAddCmd cmd) {
public SingleResponse<FeedbackCO> addFeedback(@Validated @RequestBody FeedbackAddCmd cmd) {
return taskListService.addFeedback(cmd);
}
@ApiOperation("删除反馈")
@PostMapping("/delete/{id}")
public SingleResponse deleteFeedback(@PathVariable Long id) {
return taskListService.deleteFeedback(id);
}
@ApiOperation("获取反馈周期分组列表")
@PostMapping("/periodGroupList")
public MultiResponse<FeedbackPeriodGroupCO> periodGroupList(@RequestBody FeedbackPeriodGroupQry qry) {

View File

@ -36,7 +36,7 @@ public class TaskDetailController {
@ApiOperation("新增任务")
@PostMapping("/save")
public SingleResponse add(@Validated @RequestBody TaskDetailSaveCmd cmd) {
public SingleResponse<TaskDetailCO> add(@Validated @RequestBody TaskDetailSaveCmd cmd) {
return taskListService.addTaskDetail(cmd);
}

View File

@ -34,7 +34,7 @@ public class TaskListController {
@ApiOperation("新增任务清单")
@PostMapping("/save")
public SingleResponse add(@Validated @RequestBody TaskListAddCmd cmd) {
public SingleResponse<TaskListCO> add(@Validated @RequestBody TaskListAddCmd cmd) {
return taskListService.add(cmd);
}

View File

@ -1,7 +1,6 @@
package com.zcloud.safetyDutyList.command.tasklist;
import com.alibaba.cola.exception.BizException;
import com.zcloud.safetyDutyList.domain.enums.FeedbackStatusEnum;
import com.zcloud.safetyDutyList.domain.gateway.tasklist.FeedbackGateway;
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
@ -21,9 +20,10 @@ import java.time.LocalDateTime;
*
* <p>
*
* 1.
* 2.
* 1.
* 2.
* 3.
* 4.
*/
@Component
@AllArgsConstructor
@ -32,7 +32,7 @@ public class FeedbackAddExe {
private final TaskListGateway taskListGateway;
private final TaskDetailGateway taskDetailGateway;
public Boolean execute(FeedbackAddCmd cmd) {
public FeedbackCO execute(FeedbackAddCmd cmd) {
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(cmd.getTaskDetailId());
if (detailE == null) {
@ -59,6 +59,9 @@ public class FeedbackAddExe {
if (!res) {
throw new BizException("反馈保存失败");
}
return true;
FeedbackCO co = new FeedbackCO();
BeanUtils.copyProperties(feedbackE, co);
return co;
}
}

View File

@ -21,6 +21,7 @@ import java.util.List;
* 1.
* 2. 100
* 3.
* 4.
*/
@Component
@AllArgsConstructor
@ -28,14 +29,13 @@ public class TaskDetailSaveExe {
private final TaskDetailGateway taskDetailGateway;
private final TaskListGateway taskListGateway;
public Boolean execute(TaskDetailSaveCmd cmd) {
public TaskDetailCO execute(TaskDetailSaveCmd cmd) {
List<TaskDetailE> existDetails = taskDetailGateway.listByTaskListId(cmd.getTaskListId());
BigDecimal totalScore = existDetails.stream()
.map(TaskDetailE::getTaskScore)
.filter(s -> s != null)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 当前任务可设置的最大分值
BigDecimal diff = new BigDecimal("100").subtract(totalScore);
if (cmd.getTaskScore() != null) {
@ -54,6 +54,9 @@ public class TaskDetailSaveExe {
if (!res) {
throw new BizException("保存失败");
}
return true;
TaskDetailCO co = new TaskDetailCO();
BeanUtils.copyProperties(detailE, co);
return co;
}
}

View File

@ -1,39 +1,31 @@
package com.zcloud.safetyDutyList.command.tasklist;
import com.alibaba.cola.exception.BizException;
import com.zcloud.safetyDutyList.domain.enums.SwitchFlagEnum;
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskListCO;
import com.zcloud.safetyDutyList.dto.tasklist.TaskDetailAddCmd;
import com.zcloud.safetyDutyList.dto.tasklist.TaskListAddCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
*
* <p>
*
* 1.
* 2.
* 3.
* 3.
*/
@Component
@AllArgsConstructor
public class TaskListAddExe {
private final TaskListGateway taskListGateway;
private final TaskDetailGateway taskDetailGateway;
@Transactional(rollbackFor = Exception.class)
public Boolean execute(TaskListAddCmd cmd) {
public TaskListCO execute(TaskListAddCmd cmd) {
TaskListE taskListE = new TaskListE();
BeanUtils.copyProperties(cmd, taskListE);
taskListE.init();
@ -43,6 +35,9 @@ public class TaskListAddExe {
if (!res) {
throw new BizException("保存失败");
}
return true;
TaskListCO co = new TaskListCO();
BeanUtils.copyProperties(taskListE, co);
return co;
}
}

View File

@ -45,6 +45,8 @@ public class TaskListServiceImpl implements TaskListServiceI {
private final TaskDetailUpdateScoreExe taskDetailUpdateScoreExe;
/** 反馈新增执行器 */
private final FeedbackAddExe feedbackAddExe;
/** 反馈删除执行器 */
private final FeedbackDeleteExe feedbackDeleteExe;
/** 清单查询执行器 */
private final TaskListQueryExe taskListQueryExe;
/** 任务详情查询执行器 */
@ -64,9 +66,9 @@ public class TaskListServiceImpl implements TaskListServiceI {
}
@Override
public SingleResponse add(TaskListAddCmd cmd) {
taskListAddExe.execute(cmd);
return SingleResponse.buildSuccess();
public SingleResponse<TaskListCO> add(TaskListAddCmd cmd) {
TaskListCO co = taskListAddExe.execute(cmd);
return SingleResponse.of(co);
}
@Override
@ -111,9 +113,9 @@ public class TaskListServiceImpl implements TaskListServiceI {
}
@Override
public SingleResponse addTaskDetail(TaskDetailSaveCmd cmd) {
taskDetailSaveExe.execute(cmd);
return SingleResponse.buildSuccess();
public SingleResponse<TaskDetailCO> addTaskDetail(TaskDetailSaveCmd cmd) {
TaskDetailCO co = taskDetailSaveExe.execute(cmd);
return SingleResponse.of(co);
}
@Override
@ -134,8 +136,14 @@ public class TaskListServiceImpl implements TaskListServiceI {
}
@Override
public SingleResponse addFeedback(FeedbackAddCmd cmd) {
feedbackAddExe.execute(cmd);
public SingleResponse<FeedbackCO> addFeedback(FeedbackAddCmd cmd) {
FeedbackCO co = feedbackAddExe.execute(cmd);
return SingleResponse.of(co);
}
@Override
public SingleResponse deleteFeedback(Long id) {
feedbackDeleteExe.execute(id);
return SingleResponse.buildSuccess();
}

View File

@ -39,7 +39,7 @@ public interface TaskListServiceI {
* @param cmd
* @return
*/
SingleResponse edit(TaskListUpdateCmd cmd);
SingleResponse<TaskListCO> edit(TaskListUpdateCmd cmd);
/**
*
@ -63,7 +63,7 @@ public interface TaskListServiceI {
* @param cmd
* @return
*/
SingleResponse switchFlag(TaskListSwitchCmd cmd);
SingleResponse<TaskListCO> switchFlag(TaskListSwitchCmd cmd);
/**
*
@ -127,7 +127,15 @@ public interface TaskListServiceI {
* @param cmd
* @return
*/
SingleResponse addFeedback(FeedbackAddCmd cmd);
SingleResponse<FeedbackCO> addFeedback(FeedbackAddCmd cmd);
/**
*
*
* @param id ID
* @return
*/
SingleResponse deleteFeedback(Long id);
/**
*