定时任务修改考核状态

main
hshansha 5 months ago
parent 8ce8bc668f
commit cb1b43963d

@ -64,7 +64,7 @@ public class JsonDeepMerge {
public static String jsonGroupSum(JSONArray jsonInput,String groupKey,String sumKey) throws JsonProcessingException { public static String jsonGroupSum(JSONArray jsonInput,String groupKey,String sumKey) throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
// 解析JSON数组为List<Map> // 解析JSON数组为List<Map>
List<Map<String, Object>> inputList = mapper.readValue(jsonInput.toString(2), List.class); List<Map<String, Object>> inputList = mapper.readValue(jsonInput.toString(), List.class);
// 使用Map按khdx分组并累加值 // 使用Map按khdx分组并累加值
Map<String, BigDecimal> sumMap = new HashMap<>(); Map<String, BigDecimal> sumMap = new HashMap<>();

@ -1,6 +1,8 @@
package com.ruoyi.quartz.task; package com.ruoyi.quartz.task;
import com.ruoyi.kaohe.domain.KhPingce;
import com.ruoyi.kaohe.domain.KhVote; import com.ruoyi.kaohe.domain.KhVote;
import com.ruoyi.kaohe.service.IKhPingceService;
import com.ruoyi.kaohe.service.IKhVoteService; import com.ruoyi.kaohe.service.IKhVoteService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -19,11 +21,14 @@ public class RyTask
{ {
@Autowired @Autowired
private IKhVoteService khVoteService; private IKhVoteService khVoteService;
@Autowired
private IKhPingceService khPingceService;
public void performTask() { public void performTask() {
System.out.println("进入定时任务-------------------------------------------------------------"); System.out.println("进入定时任务-------------------------------------------------------------");
//获取所有未完成的评分任务 //获取所有未完成的评分任务
List<KhVote> list = khVoteService.selectUnfinishedVote(); List<KhVote> list = khVoteService.selectUnfinishedVote();
//根据时间自动修改评分任务状态
for (KhVote vote : list) { for (KhVote vote : list) {
Date sTime = vote.getsTime(); Date sTime = vote.getsTime();
Date eTime = vote.geteTime(); Date eTime = vote.geteTime();
@ -42,6 +47,27 @@ public class RyTask
System.out.println("执行定时任务: " + System.currentTimeMillis() + " 修改评分任务: " + vote.getVoteTitle() + " 状态为已完成"); System.out.println("执行定时任务: " + System.currentTimeMillis() + " 修改评分任务: " + vote.getVoteTitle() + " 状态为已完成");
} }
} }
//修改考核任务状态,当考核任务下的所有评分任务状态为已完成时 考核任务状态进行中修改为已完成
KhPingce param = new KhPingce();
param.setState("1");
List<KhPingce> khPingces = khPingceService.selectKhPingceList(param);
for (KhPingce khPingce : khPingces) {
KhVote vote = new KhVote();
vote.setPingceId(khPingce.getId());
List<KhVote> 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) public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)

Loading…
Cancel
Save