5-25 fix
parent
6b13f62e73
commit
8d041cda2d
|
|
@ -1,6 +1,6 @@
|
||||||
sdk:
|
sdk:
|
||||||
server:
|
server:
|
||||||
app-key: 002db3f140fe47d1b2754856c5172bd5
|
app-key: 09a491d02f9b4371968deb601898b467
|
||||||
client:
|
client:
|
||||||
gateway:
|
gateway:
|
||||||
url: ${common.gateway.network.http.external}
|
url: ${common.gateway.network.http.external}
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,16 @@ public class FeedbackController {
|
||||||
|
|
||||||
@ApiOperation("提交反馈")
|
@ApiOperation("提交反馈")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public SingleResponse addFeedback(@Validated @RequestBody FeedbackAddCmd cmd) {
|
public SingleResponse<FeedbackCO> addFeedback(@Validated @RequestBody FeedbackAddCmd cmd) {
|
||||||
return taskListService.addFeedback(cmd);
|
return taskListService.addFeedback(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除反馈")
|
||||||
|
@PostMapping("/delete/{id}")
|
||||||
|
public SingleResponse deleteFeedback(@PathVariable Long id) {
|
||||||
|
return taskListService.deleteFeedback(id);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("获取反馈周期分组列表")
|
@ApiOperation("获取反馈周期分组列表")
|
||||||
@PostMapping("/periodGroupList")
|
@PostMapping("/periodGroupList")
|
||||||
public MultiResponse<FeedbackPeriodGroupCO> periodGroupList(@RequestBody FeedbackPeriodGroupQry qry) {
|
public MultiResponse<FeedbackPeriodGroupCO> periodGroupList(@RequestBody FeedbackPeriodGroupQry qry) {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public class TaskDetailController {
|
||||||
|
|
||||||
@ApiOperation("新增任务")
|
@ApiOperation("新增任务")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public SingleResponse add(@Validated @RequestBody TaskDetailSaveCmd cmd) {
|
public SingleResponse<TaskDetailCO> add(@Validated @RequestBody TaskDetailSaveCmd cmd) {
|
||||||
return taskListService.addTaskDetail(cmd);
|
return taskListService.addTaskDetail(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public class TaskListController {
|
||||||
|
|
||||||
@ApiOperation("新增任务清单")
|
@ApiOperation("新增任务清单")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public SingleResponse add(@Validated @RequestBody TaskListAddCmd cmd) {
|
public SingleResponse<TaskListCO> add(@Validated @RequestBody TaskListAddCmd cmd) {
|
||||||
return taskListService.add(cmd);
|
return taskListService.add(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.zcloud.safetyDutyList.command.tasklist;
|
package com.zcloud.safetyDutyList.command.tasklist;
|
||||||
|
|
||||||
import com.alibaba.cola.exception.BizException;
|
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.FeedbackGateway;
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||||
|
|
@ -21,9 +20,10 @@ import java.time.LocalDateTime;
|
||||||
* 反馈新增执行器
|
* 反馈新增执行器
|
||||||
* <p>
|
* <p>
|
||||||
* 处理提交执行反馈的业务逻辑:
|
* 处理提交执行反馈的业务逻辑:
|
||||||
* 1. 创建反馈实体并初始化
|
* 1. 校验任务和清单是否存在且已下发
|
||||||
* 2. 若未指定反馈状态,默认设置为正常
|
* 2. 创建反馈实体并初始化,自动生成周期标识
|
||||||
* 3. 保存反馈记录
|
* 3. 保存反馈记录
|
||||||
|
* 4. 返回新增后的反馈信息
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|
@ -32,7 +32,7 @@ public class FeedbackAddExe {
|
||||||
private final TaskListGateway taskListGateway;
|
private final TaskListGateway taskListGateway;
|
||||||
private final TaskDetailGateway taskDetailGateway;
|
private final TaskDetailGateway taskDetailGateway;
|
||||||
|
|
||||||
public Boolean execute(FeedbackAddCmd cmd) {
|
public FeedbackCO execute(FeedbackAddCmd cmd) {
|
||||||
|
|
||||||
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(cmd.getTaskDetailId());
|
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(cmd.getTaskDetailId());
|
||||||
if (detailE == null) {
|
if (detailE == null) {
|
||||||
|
|
@ -59,6 +59,9 @@ public class FeedbackAddExe {
|
||||||
if (!res) {
|
if (!res) {
|
||||||
throw new BizException("反馈保存失败");
|
throw new BizException("反馈保存失败");
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
FeedbackCO co = new FeedbackCO();
|
||||||
|
BeanUtils.copyProperties(feedbackE, co);
|
||||||
|
return co;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
||||||
* 1. 查询该清单下已有任务详情,计算总分
|
* 1. 查询该清单下已有任务详情,计算总分
|
||||||
* 2. 校验新增后清单总分不超过100分
|
* 2. 校验新增后清单总分不超过100分
|
||||||
* 3. 创建任务详情实体并保存
|
* 3. 创建任务详情实体并保存
|
||||||
|
* 4. 返回新增后的任务详情信息
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|
@ -28,14 +29,13 @@ public class TaskDetailSaveExe {
|
||||||
private final TaskDetailGateway taskDetailGateway;
|
private final TaskDetailGateway taskDetailGateway;
|
||||||
private final TaskListGateway taskListGateway;
|
private final TaskListGateway taskListGateway;
|
||||||
|
|
||||||
public Boolean execute(TaskDetailSaveCmd cmd) {
|
public TaskDetailCO execute(TaskDetailSaveCmd cmd) {
|
||||||
List<TaskDetailE> existDetails = taskDetailGateway.listByTaskListId(cmd.getTaskListId());
|
List<TaskDetailE> existDetails = taskDetailGateway.listByTaskListId(cmd.getTaskListId());
|
||||||
BigDecimal totalScore = existDetails.stream()
|
BigDecimal totalScore = existDetails.stream()
|
||||||
.map(TaskDetailE::getTaskScore)
|
.map(TaskDetailE::getTaskScore)
|
||||||
.filter(s -> s != null)
|
.filter(s -> s != null)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
// 当前任务可设置的最大分值
|
|
||||||
BigDecimal diff = new BigDecimal("100").subtract(totalScore);
|
BigDecimal diff = new BigDecimal("100").subtract(totalScore);
|
||||||
|
|
||||||
if (cmd.getTaskScore() != null) {
|
if (cmd.getTaskScore() != null) {
|
||||||
|
|
@ -54,6 +54,9 @@ public class TaskDetailSaveExe {
|
||||||
if (!res) {
|
if (!res) {
|
||||||
throw new BizException("保存失败");
|
throw new BizException("保存失败");
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
TaskDetailCO co = new TaskDetailCO();
|
||||||
|
BeanUtils.copyProperties(detailE, co);
|
||||||
|
return co;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,31 @@
|
||||||
package com.zcloud.safetyDutyList.command.tasklist;
|
package com.zcloud.safetyDutyList.command.tasklist;
|
||||||
|
|
||||||
import com.alibaba.cola.exception.BizException;
|
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.enums.TaskStatusEnum;
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
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.domain.model.tasklist.TaskListE;
|
||||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskListCO;
|
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskListCO;
|
||||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskDetailAddCmd;
|
|
||||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskListAddCmd;
|
import com.zcloud.safetyDutyList.dto.tasklist.TaskListAddCmd;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清单新增执行器
|
* 清单新增执行器
|
||||||
* <p>
|
* <p>
|
||||||
* 处理新增安全责任清单的业务逻辑:
|
* 处理新增安全责任清单的业务逻辑:
|
||||||
* 1. 创建清单实体,初始化状态为进行中、开关为开启、下发状态为未下发
|
* 1. 创建清单实体,初始化状态为进行中、开关为开启、下发状态为未下发
|
||||||
* 2. 保存清单到数据库
|
* 2. 保存清单到数据库
|
||||||
* 3. 遍历命令中的任务详情列表,创建任务详情实体并批量保存
|
* 3. 返回新增后的清单信息
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TaskListAddExe {
|
public class TaskListAddExe {
|
||||||
private final TaskListGateway taskListGateway;
|
private final TaskListGateway taskListGateway;
|
||||||
private final TaskDetailGateway taskDetailGateway;
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean execute(TaskListAddCmd cmd) {
|
public TaskListCO execute(TaskListAddCmd cmd) {
|
||||||
TaskListE taskListE = new TaskListE();
|
TaskListE taskListE = new TaskListE();
|
||||||
BeanUtils.copyProperties(cmd, taskListE);
|
BeanUtils.copyProperties(cmd, taskListE);
|
||||||
taskListE.init();
|
taskListE.init();
|
||||||
|
|
@ -43,6 +35,9 @@ public class TaskListAddExe {
|
||||||
if (!res) {
|
if (!res) {
|
||||||
throw new BizException("保存失败");
|
throw new BizException("保存失败");
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
TaskListCO co = new TaskListCO();
|
||||||
|
BeanUtils.copyProperties(taskListE, co);
|
||||||
|
return co;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ public class TaskListServiceImpl implements TaskListServiceI {
|
||||||
private final TaskDetailUpdateScoreExe taskDetailUpdateScoreExe;
|
private final TaskDetailUpdateScoreExe taskDetailUpdateScoreExe;
|
||||||
/** 反馈新增执行器 */
|
/** 反馈新增执行器 */
|
||||||
private final FeedbackAddExe feedbackAddExe;
|
private final FeedbackAddExe feedbackAddExe;
|
||||||
|
/** 反馈删除执行器 */
|
||||||
|
private final FeedbackDeleteExe feedbackDeleteExe;
|
||||||
/** 清单查询执行器 */
|
/** 清单查询执行器 */
|
||||||
private final TaskListQueryExe taskListQueryExe;
|
private final TaskListQueryExe taskListQueryExe;
|
||||||
/** 任务详情查询执行器 */
|
/** 任务详情查询执行器 */
|
||||||
|
|
@ -64,9 +66,9 @@ public class TaskListServiceImpl implements TaskListServiceI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse add(TaskListAddCmd cmd) {
|
public SingleResponse<TaskListCO> add(TaskListAddCmd cmd) {
|
||||||
taskListAddExe.execute(cmd);
|
TaskListCO co = taskListAddExe.execute(cmd);
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.of(co);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -111,9 +113,9 @@ public class TaskListServiceImpl implements TaskListServiceI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse addTaskDetail(TaskDetailSaveCmd cmd) {
|
public SingleResponse<TaskDetailCO> addTaskDetail(TaskDetailSaveCmd cmd) {
|
||||||
taskDetailSaveExe.execute(cmd);
|
TaskDetailCO co = taskDetailSaveExe.execute(cmd);
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.of(co);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -134,8 +136,14 @@ public class TaskListServiceImpl implements TaskListServiceI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse addFeedback(FeedbackAddCmd cmd) {
|
public SingleResponse<FeedbackCO> addFeedback(FeedbackAddCmd cmd) {
|
||||||
feedbackAddExe.execute(cmd);
|
FeedbackCO co = feedbackAddExe.execute(cmd);
|
||||||
|
return SingleResponse.of(co);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse deleteFeedback(Long id) {
|
||||||
|
feedbackDeleteExe.execute(id);
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ public interface TaskListServiceI {
|
||||||
* @param cmd 修改命令
|
* @param cmd 修改命令
|
||||||
* @return 修改后的清单信息
|
* @return 修改后的清单信息
|
||||||
*/
|
*/
|
||||||
SingleResponse edit(TaskListUpdateCmd cmd);
|
SingleResponse<TaskListCO> edit(TaskListUpdateCmd cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除任务清单
|
* 删除任务清单
|
||||||
|
|
@ -63,7 +63,7 @@ public interface TaskListServiceI {
|
||||||
* @param cmd 开关切换命令
|
* @param cmd 开关切换命令
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
SingleResponse switchFlag(TaskListSwitchCmd cmd);
|
SingleResponse<TaskListCO> switchFlag(TaskListSwitchCmd cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭任务清单(同时关闭关联的所有任务详情)
|
* 关闭任务清单(同时关闭关联的所有任务详情)
|
||||||
|
|
@ -127,7 +127,15 @@ public interface TaskListServiceI {
|
||||||
* @param cmd 反馈提交命令
|
* @param cmd 反馈提交命令
|
||||||
* @return 反馈信息
|
* @return 反馈信息
|
||||||
*/
|
*/
|
||||||
SingleResponse addFeedback(FeedbackAddCmd cmd);
|
SingleResponse<FeedbackCO> addFeedback(FeedbackAddCmd cmd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除反馈记录
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
SingleResponse deleteFeedback(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询反馈周期分组列表(按周期标识分组统计反馈数量)
|
* 查询反馈周期分组列表(按周期标识分组统计反馈数量)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue