Browse Source

维权督办-定时任务支持手动测试

master
buaixuexideshitongxue 3 weeks ago
parent
commit
33e69c6b4d
  1. 10
      src/main/java/com/biutag/supervision/controller/rightsComfort/SuperviseController.java
  2. 20
      src/main/java/com/biutag/supervision/job/Job.java

10
src/main/java/com/biutag/supervision/controller/rightsComfort/SuperviseController.java

@ -1,5 +1,6 @@
package com.biutag.supervision.controller.rightsComfort; package com.biutag.supervision.controller.rightsComfort;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -18,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date;
@RestController @RestController
@RequestMapping("/rights/supervise") @RequestMapping("/rights/supervise")
@ -36,9 +38,13 @@ public class SuperviseController {
* */ * */
@GetMapping @GetMapping
public Result<Page<RpcApplyVo>> list(RpcApplySupervisionQueryParam queryParam){ public Result<Page<RpcApplyVo>> list(RpcApplySupervisionQueryParam queryParam){
if ("20252222".equals(queryParam.getCaseNumber())){ if ("更新维权督办".equals(queryParam.getCaseNumber())){
try { try {
job.rights(); if (CollectionUtil.isNotEmpty(queryParam.getHappenTime()) && queryParam.getHappenTime().size()>=2){
Date startTime = queryParam.getHappenTime().get(0);
Date endTime = queryParam.getHappenTime().get(1);
job.rights(startTime, endTime);
}
} catch (ParseException e) { } catch (ParseException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

20
src/main/java/com/biutag/supervision/job/Job.java

@ -138,16 +138,28 @@ public class Job {
private final RpcPersonService rpcPersonService; private final RpcPersonService rpcPersonService;
private final SupDictDataService dictDataService; private final SupDictDataService dictDataService;
@Scheduled(cron = "0 30 23 * * ?")
public void rights() throws ParseException {
Date startTime = Date.from(LocalDateTime.now().minusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0).atZone(ZoneId.systemDefault()).toInstant());
Date endTime = Date.from(LocalDateTime.now().minusDays(1).withHour(23).withMinute(59).withSecond(59).atZone(ZoneId.systemDefault()).toInstant());
rights(startTime, endTime);
}
// 每天一次 23:30:00 // 每天一次 23:30:00
//todo 维权信息 //todo 维权信息
// @Scheduled(cron = "0 30 23 * * ?") // @Scheduled(cron = "0 30 23 * * ?")
public void rights() throws ParseException { public void rights(Date startTime, Date endTime) throws ParseException {
log.info("rights--------------------"); log.info("rights--------------------");
log.info("维权信息抓取中---------------------"); log.info("维权信息抓取中---------------------");
// 维权 // 维权
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date startTime = sdf.parse("2025-12-01 00:00:00"); // Date startTime = sdf.parse("2025-12-01 00:00:00");
Date endTime = sdf.parse("2025-12-30 00:00:00"); // Date endTime = sdf.parse("2025-12-30 00:00:00");
// Date startTime = Date.from(LocalDateTime.now().minusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0).atZone(ZoneId.systemDefault()).toInstant()); // Date startTime = Date.from(LocalDateTime.now().minusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0).atZone(ZoneId.systemDefault()).toInstant());
// Date endTime = Date.from(LocalDateTime.now().minusDays(1).withHour(23).withMinute(59).withSecond(59).atZone(ZoneId.systemDefault()).toInstant()); // Date endTime = Date.from(LocalDateTime.now().minusDays(1).withHour(23).withMinute(59).withSecond(59).atZone(ZoneId.systemDefault()).toInstant());

Loading…
Cancel
Save