5-27 fix
parent
58516ab64a
commit
b6b8a98676
|
|
@ -3,14 +3,13 @@ package com.zcloud.safetyDutyList.command.query.tasklist;
|
|||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safetyDutyList.domain.enums.FeedbackCycleEnum;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.FeedbackGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.FeedbackE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.*;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.FeedbackListQry;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.FeedbackPeriodGroupQry;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.FeedbackDO;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskDetailDO;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.FeedbackRepository;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.TaskDetailRepository;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -21,29 +20,21 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 反馈查询执行器
|
||||
* <p>
|
||||
* 处理执行反馈相关的查询业务:
|
||||
* - 反馈周期分组列表(按周期标识分组统计反馈数量)
|
||||
* - 指定周期的反馈列表查询
|
||||
* - 反馈详情查询(含关联任务信息)
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class FeedbackQueryExe {
|
||||
private final FeedbackGateway feedbackGateway;
|
||||
private final TaskDetailGateway taskDetailGateway;
|
||||
private final FeedbackRepository feedbackRepository;
|
||||
private final TaskDetailRepository taskDetailRepository;
|
||||
|
||||
public MultiResponse<FeedbackPeriodGroupCO> periodGroupList(FeedbackPeriodGroupQry qry) {
|
||||
List<FeedbackE> feedbackList = feedbackGateway.listByTaskDetailId(qry.getTaskDetailId());
|
||||
List<FeedbackDO> feedbackList = feedbackRepository.listByTaskDetailId(qry.getTaskDetailId());
|
||||
if (feedbackList == null || feedbackList.isEmpty()) {
|
||||
return MultiResponse.of(new ArrayList<>());
|
||||
}
|
||||
|
||||
Map<String, List<FeedbackE>> groupedByPeriod = feedbackList.stream()
|
||||
Map<String, List<FeedbackDO>> groupedByPeriod = feedbackList.stream()
|
||||
.filter(f -> f.getFeedbackPeriodFlag() != null)
|
||||
.collect(Collectors.groupingBy(FeedbackE::getFeedbackPeriodFlag));
|
||||
.collect(Collectors.groupingBy(FeedbackDO::getFeedbackPeriodFlag));
|
||||
|
||||
List<FeedbackPeriodGroupCO> result = new ArrayList<>();
|
||||
groupedByPeriod.forEach((periodFlag, feedbacks) -> {
|
||||
|
|
@ -52,10 +43,10 @@ public class FeedbackQueryExe {
|
|||
co.setFeedbackPeriodFlag(periodFlag);
|
||||
co.setFeedbackCount(feedbacks.size());
|
||||
if (!feedbacks.isEmpty()) {
|
||||
FeedbackE first = feedbacks.get(0);
|
||||
FeedbackDO first = feedbacks.get(0);
|
||||
co.setFeedbackPeriodStartTime(first.getFeedbackPeriodStartTime());
|
||||
co.setFeedbackPeriodEndTime(first.getFeedbackPeriodEndTime());
|
||||
co.setFeedbackUserName(first.getCreateName());
|
||||
co.setFeedbackUserName(first.getFeedbackUserName());
|
||||
}
|
||||
result.add(co);
|
||||
});
|
||||
|
|
@ -63,34 +54,34 @@ public class FeedbackQueryExe {
|
|||
}
|
||||
|
||||
public MultiResponse<FeedbackCO> feedbackList(FeedbackListQry qry) {
|
||||
List<FeedbackE> feedbackList = feedbackGateway.listByTaskDetailId(qry.getTaskDetailId());
|
||||
List<FeedbackDO> feedbackList = feedbackRepository.listByTaskDetailId(qry.getTaskDetailId());
|
||||
if (feedbackList == null || feedbackList.isEmpty()) {
|
||||
return MultiResponse.of(new ArrayList<>());
|
||||
}
|
||||
List<FeedbackCO> coList = new ArrayList<>();
|
||||
for (FeedbackE feedbackE : feedbackList) {
|
||||
if (!StringUtil.isEmpty(qry.getFeedbackPeriodFlag()) && !qry.getFeedbackPeriodFlag().equals(feedbackE.getFeedbackPeriodFlag())) {
|
||||
for (FeedbackDO feedbackDO : feedbackList) {
|
||||
if (!StringUtil.isEmpty(qry.getFeedbackPeriodFlag()) && !qry.getFeedbackPeriodFlag().equals(feedbackDO.getFeedbackPeriodFlag())) {
|
||||
continue;
|
||||
}
|
||||
FeedbackCO co = new FeedbackCO();
|
||||
BeanUtils.copyProperties(feedbackE, co);
|
||||
BeanUtils.copyProperties(feedbackDO, co);
|
||||
coList.add(co);
|
||||
}
|
||||
return MultiResponse.of(coList);
|
||||
}
|
||||
|
||||
public SingleResponse<FeedbackInfoCO> getByFeedbackId(String feedbackId) {
|
||||
FeedbackE feedbackE = feedbackGateway.getByFeedbackId(feedbackId);
|
||||
if (feedbackE == null) {
|
||||
FeedbackDO feedbackDO = feedbackRepository.getByFeedbackId(feedbackId);
|
||||
if (feedbackDO == null) {
|
||||
throw new BizException("反馈记录不存在");
|
||||
}
|
||||
FeedbackInfoCO co = new FeedbackInfoCO();
|
||||
BeanUtils.copyProperties(feedbackE, co);
|
||||
BeanUtils.copyProperties(feedbackDO, co);
|
||||
|
||||
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(feedbackE.getTaskDetailId());
|
||||
if (detailE != null) {
|
||||
co.setExecuteContent(detailE.getExecuteContent());
|
||||
co.setFeedbackCycleType(detailE.getFeedbackCycleType());
|
||||
TaskDetailDO detailDO = taskDetailRepository.getByTaskDetailId(feedbackDO.getTaskDetailId());
|
||||
if (detailDO != null) {
|
||||
co.setExecuteContent(detailDO.getExecuteContent());
|
||||
co.setFeedbackCycleType(detailDO.getFeedbackCycleType());
|
||||
}
|
||||
return SingleResponse.of(co);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.zcloud.safetyDutyList.command.tasklist;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskDetailUpdateScoreCmd;
|
||||
|
|
@ -23,6 +25,11 @@ public class TaskDetailUpdateScoreExe {
|
|||
private final TaskDetailGateway taskDetailGateway;
|
||||
|
||||
public void execute(TaskDetailUpdateScoreCmd cmd) {
|
||||
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
if (ssoUser == null) {
|
||||
throw new BizException("用户未登录");
|
||||
}
|
||||
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(cmd.getTaskDetailId());
|
||||
if (detailE == null) {
|
||||
throw new BizException("任务不存在");
|
||||
|
|
@ -38,8 +45,10 @@ public class TaskDetailUpdateScoreExe {
|
|||
}
|
||||
detailE.setTaskRating(cmd.getTaskRating());
|
||||
detailE.setRatingTime(LocalDateTime.now());
|
||||
detailE.setRatingDepartmentId(cmd.getRatingDeptId());
|
||||
detailE.setRatingUserId(cmd.getRatingUserId());
|
||||
|
||||
detailE.setRatingDepartmentId(ssoUser.getOrgId());
|
||||
detailE.setRatingUserId(ssoUser.getUserId());
|
||||
|
||||
boolean res = taskDetailGateway.update(detailE);
|
||||
if (!res) {
|
||||
throw new BizException("评分失败");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.safetyDutyList.dto.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageQuery;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -11,7 +12,7 @@ import javax.validation.constraints.NotEmpty;
|
|||
* 用于查询指定任务在指定周期标识下的反馈列表
|
||||
*/
|
||||
@Data
|
||||
public class FeedbackListQry {
|
||||
public class FeedbackListQry extends PageQuery {
|
||||
@ApiModelProperty(value = "任务ID", required = true)
|
||||
@NotEmpty(message = "任务ID不能为空")
|
||||
private String taskDetailId;
|
||||
|
|
|
|||
|
|
@ -26,12 +26,4 @@ public class TaskDetailUpdateScoreCmd implements Serializable {
|
|||
@ApiModelProperty(value = "分数(不能超过任务分值)", required = true)
|
||||
@NotNull(message = "分数不能为空")
|
||||
private BigDecimal taskRating;
|
||||
|
||||
@ApiModelProperty(value = "评分部门ID", required = true)
|
||||
@NotNull(message = "评分部门ID不能为空")
|
||||
private Long ratingDeptId;
|
||||
|
||||
@ApiModelProperty(value = "评分人员ID", required = true)
|
||||
@NotNull(message = "评分人员ID不能为空")
|
||||
private Long ratingUserId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,9 +42,20 @@
|
|||
</select>
|
||||
|
||||
<select id="listByTaskDetailId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.FeedbackDO">
|
||||
SELECT * FROM safety_accountability_feedback
|
||||
WHERE task_detail_id = #{taskDetailId} AND delete_enum = 'FALSE'
|
||||
ORDER BY feedback_time DESC
|
||||
SELECT f.*,
|
||||
td.execute_content AS executeContent,
|
||||
tl.task_list_name AS taskListName,
|
||||
fb_user.name AS feedbackUserName,
|
||||
fb_dept.name AS feedbackDepartmentName,
|
||||
fb_corp.corp_name AS feedbackCorpName
|
||||
FROM safety_accountability_feedback f
|
||||
LEFT JOIN safety_accountability_task_detail td ON f.task_detail_id = td.task_detail_id AND td.delete_enum = 'FALSE'
|
||||
LEFT JOIN safety_accountability_task_list tl ON f.task_list_id = tl.task_list_id AND tl.delete_enum = 'FALSE'
|
||||
LEFT JOIN user fb_user ON f.feedback_user_id = fb_user.id
|
||||
LEFT JOIN department fb_dept ON f.feedback_department_id = fb_dept.id
|
||||
LEFT JOIN corp_info fb_corp ON f.feedback_corp_id = fb_corp.id
|
||||
WHERE f.task_detail_id = #{taskDetailId} AND f.delete_enum = 'FALSE'
|
||||
ORDER BY f.feedback_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getByFeedbackId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.FeedbackDO">
|
||||
|
|
|
|||
Loading…
Reference in New Issue