diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/admintask/AdminTaskQueryCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/admintask/AdminTaskQueryCmdExe.java index 39164463..55af35b7 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/admintask/AdminTaskQueryCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/admintask/AdminTaskQueryCmdExe.java @@ -1,6 +1,7 @@ package com.red.circle.other.app.command.admintask; import com.red.circle.other.domain.admintask.AdminTaskRecord; +import com.red.circle.other.domain.admintask.AdminTaskType; import com.red.circle.other.domain.gateway.AdminTaskGateway; import com.red.circle.other.app.dto.cmd.AdminTaskQueryCmd; import com.red.circle.other.infra.database.mongo.service.team.TeamBillCycleUtils; @@ -9,7 +10,10 @@ import org.springframework.stereotype.Component; import java.time.LocalDate; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 管理员任务查询执行器 @@ -26,7 +30,17 @@ public class AdminTaskQueryCmdExe { public List execute(AdminTaskQueryCmd cmd) { LocalDate cycleStartDate = cmd.getCycleStartDate() != null ? cmd.getCycleStartDate() : LocalDate.parse(TeamBillCycleUtils.getCalcBillBelong().toString(), DateTimeFormatter.ofPattern("yyyyMMdd")); - return adminTaskGateway.findByUserIdAndCycle(cmd.getUserId(), cycleStartDate); + List records = adminTaskGateway.findByUserIdAndCycle(cmd.getUserId(), cycleStartDate); + Map taskRecordMap = records.stream().collect(Collectors.toMap(AdminTaskRecord::getTaskType, e -> e)); + + List recordList = new ArrayList<>(); + for (AdminTaskType value : AdminTaskType.values()) { + AdminTaskRecord record = taskRecordMap.get(value.getCode()); + if (record != null) { + recordList.add(record); + } + } + return recordList; } /**