From cb1b43963da2a463aa44ca1bb5d603d9bb946608 Mon Sep 17 00:00:00 2001 From: hshansha Date: Tue, 15 Jul 2025 10:47:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=80=83=E6=A0=B8=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/kaohe/util/JsonDeepMerge.java | 2 +- .../java/com/ruoyi/quartz/task/RyTask.java | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/util/JsonDeepMerge.java b/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/util/JsonDeepMerge.java index 829506d..b486dd4 100644 --- a/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/util/JsonDeepMerge.java +++ b/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/util/JsonDeepMerge.java @@ -64,7 +64,7 @@ public class JsonDeepMerge { public static String jsonGroupSum(JSONArray jsonInput,String groupKey,String sumKey) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); // 解析JSON数组为List - List> inputList = mapper.readValue(jsonInput.toString(2), List.class); + List> inputList = mapper.readValue(jsonInput.toString(), List.class); // 使用Map按khdx分组并累加值 Map sumMap = new HashMap<>(); diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java index 9749c3d..2517922 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java @@ -1,6 +1,8 @@ package com.ruoyi.quartz.task; +import com.ruoyi.kaohe.domain.KhPingce; import com.ruoyi.kaohe.domain.KhVote; +import com.ruoyi.kaohe.service.IKhPingceService; import com.ruoyi.kaohe.service.IKhVoteService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -19,11 +21,14 @@ public class RyTask { @Autowired private IKhVoteService khVoteService; + @Autowired + private IKhPingceService khPingceService; public void performTask() { System.out.println("进入定时任务-------------------------------------------------------------"); //获取所有未完成的评分任务 List list = khVoteService.selectUnfinishedVote(); + //根据时间自动修改评分任务状态 for (KhVote vote : list) { Date sTime = vote.getsTime(); Date eTime = vote.geteTime(); @@ -42,6 +47,27 @@ public class RyTask System.out.println("执行定时任务: " + System.currentTimeMillis() + " 修改评分任务: " + vote.getVoteTitle() + " 状态为已完成"); } } + + //修改考核任务状态,当考核任务下的所有评分任务状态为已完成时 考核任务状态进行中修改为已完成 + KhPingce param = new KhPingce(); + param.setState("1"); + List khPingces = khPingceService.selectKhPingceList(param); + for (KhPingce khPingce : khPingces) { + KhVote vote = new KhVote(); + vote.setPingceId(khPingce.getId()); + List khVotes = khVoteService.selectKhVoteList(vote); + boolean finished = true; + for (KhVote khVote : khVotes) { + if( khVote.getState().equals("0")|| khVote.getState().equals("1")){ + finished=false; + break; + } + } + if(finished){ + khPingce.setState("2"); + } + } + } public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)