2025年08月21日 1.0.4 删除定时任务定时推送和获取数据,迁移到项目GetDataInterface中
parent
3c72f41bc8
commit
43691ed329
@ -1,113 +0,0 @@
|
||||
package com.nmggs.query.common.timetask;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.nmggs.query.common.emnu.Constant;
|
||||
import com.nmggs.query.common.utils.PropertiesUtil;
|
||||
import com.nmggs.query.common.utils.UuidUtil;
|
||||
import com.nmggs.query.service.SendProBlackListService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author: shuguang
|
||||
* @date: 2025年06月27日 10:35
|
||||
* @description: 定时执行线程任务
|
||||
*/
|
||||
@PropertySource(value = "classpath:static/timeTask.properties")
|
||||
@Component
|
||||
@EnableAsync
|
||||
@Slf4j
|
||||
public class TimeTaskInfo {
|
||||
@Resource
|
||||
private SendProBlackListService sendProBlackListService;
|
||||
|
||||
|
||||
/**
|
||||
* 定时获取内蒙省内拍照执法设备预警的逃费车辆信息
|
||||
*
|
||||
* @author shuguang
|
||||
* @date 2025-06-30 09:25
|
||||
*/
|
||||
@Async("threadPoolGetFeeEvasionInfo")
|
||||
@Scheduled(cron = "${time.corn2}")
|
||||
public void timeTaskGetFeeEvasionInfo() {
|
||||
String uuid = UuidUtil.getUuid();
|
||||
// 启动计时器
|
||||
Stopwatch stopwatch = Stopwatch.createStarted();
|
||||
//获取isSendProBlackList是否启用下发省内黑名单到指定接口 1-下发,其他值为不下发
|
||||
String isSendProBlackList = PropertiesUtil.getValue("isSendProBlackList");
|
||||
String loginAuthenticationAccount = PropertiesUtil.getValue("loginAuthenticationAccount");
|
||||
String loginAuthenticationPassword = PropertiesUtil.getValue("loginAuthenticationPassword");
|
||||
String loginAuthenticationUrl = PropertiesUtil.getValue("loginAuthenticationUrl");
|
||||
String getFeeEvasionInfoUrl = PropertiesUtil.getValue("sendProBlackListUrl");
|
||||
log.info("[uuid:{}]-定时执行获取逃费车辆信息,获取到的配置文件参数loginAuthenticationAccount={},loginAuthenticationPassword={},loginAuthenticationUrl={},sendProBlackListUrl={}"
|
||||
, uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, getFeeEvasionInfoUrl);
|
||||
try {
|
||||
if (Constant.STR_ONE.equals(isSendProBlackList)
|
||||
&& StringUtils.isNotBlank(loginAuthenticationAccount)
|
||||
&& StringUtils.isNotBlank(loginAuthenticationPassword)
|
||||
&& StringUtils.isNotBlank(loginAuthenticationUrl)
|
||||
&& StringUtils.isNotBlank(getFeeEvasionInfoUrl)
|
||||
) {
|
||||
sendProBlackListService.getFeeEvasionInfo(uuid,loginAuthenticationAccount,loginAuthenticationPassword,loginAuthenticationUrl,getFeeEvasionInfoUrl);
|
||||
} else {
|
||||
log.info("[uuid:{}}]-暂停定时获取逃费车辆信息:{}",uuid, getFeeEvasionInfoUrl);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[uuid:{}}]-定时执行获取逃费车辆信息:{}报错{}",uuid, getFeeEvasionInfoUrl, e);
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
}
|
||||
log.info("[uuid:{}}]-定时执行获取逃费车辆信息:{},耗时:{}毫秒", uuid, getFeeEvasionInfoUrl, stopwatch.elapsed(TimeUnit.MILLISECONDS));
|
||||
|
||||
}
|
||||
/**
|
||||
* 定时推送省内黑名单数据到指定接口
|
||||
*
|
||||
* @author shuguang
|
||||
* @date 2025-06-27 11:25
|
||||
*/
|
||||
@Async("threadPoolSendProBlackList")
|
||||
@Scheduled(cron = "${time.corn1}")
|
||||
public void timeTaskSendProBlackList() {
|
||||
String uuid = UuidUtil.getUuid();
|
||||
// 启动计时器
|
||||
Stopwatch stopwatch = Stopwatch.createStarted();
|
||||
//获取isSendProBlackList是否启用下发省内黑名单到指定接口 1-下发,其他值为不下发
|
||||
String isSendProBlackList = PropertiesUtil.getValue("isSendProBlackList");
|
||||
String loginAuthenticationAccount = PropertiesUtil.getValue("loginAuthenticationAccount");
|
||||
String loginAuthenticationPassword = PropertiesUtil.getValue("loginAuthenticationPassword");
|
||||
String loginAuthenticationUrl = PropertiesUtil.getValue("loginAuthenticationUrl");
|
||||
String sendProBlackListUrl = PropertiesUtil.getValue("sendProBlackListUrl");
|
||||
log.info("[uuid:{}]-定时执行下发省内黑名单,获取到的配置文件参数loginAuthenticationAccount={},loginAuthenticationPassword={},loginAuthenticationUrl={},sendProBlackListUrl={}"
|
||||
, uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, sendProBlackListUrl);
|
||||
try {
|
||||
if (Constant.STR_ONE.equals(isSendProBlackList)
|
||||
&& StringUtils.isNotBlank(loginAuthenticationAccount)
|
||||
&& StringUtils.isNotBlank(loginAuthenticationPassword)
|
||||
&& StringUtils.isNotBlank(loginAuthenticationUrl)
|
||||
&& StringUtils.isNotBlank(sendProBlackListUrl)
|
||||
) {
|
||||
sendProBlackListService.sendProBlackListToInterface(uuid,loginAuthenticationAccount,loginAuthenticationPassword,loginAuthenticationUrl,sendProBlackListUrl);
|
||||
} else {
|
||||
log.info("[uuid:{}}]-暂停定时执行下发省内黑名单到指定接口:{}",uuid, sendProBlackListUrl);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[uuid:{}}]-定时执行下发省内黑名单到指定接口:{}报错{}",uuid, sendProBlackListUrl, e);
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
}
|
||||
log.info("[uuid:{}}]-定时执行下发省内黑名单到指定接口:{},耗时:{}毫秒", uuid, sendProBlackListUrl, stopwatch.elapsed(TimeUnit.MILLISECONDS));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
package com.nmggs.query.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.nmggs.query.common.utils.PropertiesUtil;
|
||||
import com.nmggs.query.common.utils.UuidUtil;
|
||||
import com.nmggs.query.entity.Res;
|
||||
import com.nmggs.query.entity.sendproblacklist.LoginAuthentication;
|
||||
import com.nmggs.query.service.SendProBlackListService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author: shuguang
|
||||
* @date: 2025年06月26日 16:26
|
||||
* @description: 手动下发省内黑名单到指定接口
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class ManualSendProBlackListController {
|
||||
@Resource
|
||||
private SendProBlackListService sendProBlackListService;
|
||||
|
||||
@GetMapping("/ManualGetFeeEvasionInfo")
|
||||
public Res manualGetFeeEvasionInfo() {
|
||||
String uuid = UuidUtil.getUuid();
|
||||
String loginAuthenticationAccount = PropertiesUtil.getValue("loginAuthenticationAccount");
|
||||
String loginAuthenticationPassword = PropertiesUtil.getValue("loginAuthenticationPassword");
|
||||
String loginAuthenticationUrl = PropertiesUtil.getValue("loginAuthenticationUrl");
|
||||
String getFeeEvasionInfoUrl = PropertiesUtil.getValue("sendProBlackListUrl");
|
||||
log.info("[uuid:{}]-手动执行获取逃费车辆信息,获取到的配置文件参数loginAuthenticationAccount={},loginAuthenticationPassword={},loginAuthenticationUrl={},sendProBlackListUrl={}"
|
||||
, uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, getFeeEvasionInfoUrl);
|
||||
sendProBlackListService.getFeeEvasionInfo(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, getFeeEvasionInfoUrl);
|
||||
log.info("[uuid:{}]-手动执行获取逃费车辆信息完成", uuid);
|
||||
return Res.success();
|
||||
}
|
||||
@GetMapping("/ManualSendProBlackList")
|
||||
public Res manualSendProBlackList() {
|
||||
String uuid = UuidUtil.getUuid();
|
||||
String loginAuthenticationAccount = PropertiesUtil.getValue("loginAuthenticationAccount");
|
||||
String loginAuthenticationPassword = PropertiesUtil.getValue("loginAuthenticationPassword");
|
||||
String loginAuthenticationUrl = PropertiesUtil.getValue("loginAuthenticationUrl");
|
||||
String sendProBlackListUrl = PropertiesUtil.getValue("sendProBlackListUrl");
|
||||
log.info("[uuid:{}]-手动执行下发省内黑名单,获取到的配置文件参数loginAuthenticationAccount={},loginAuthenticationPassword={},loginAuthenticationUrl={},sendProBlackListUrl={}"
|
||||
, uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, sendProBlackListUrl);
|
||||
sendProBlackListService.sendProBlackListToInterface(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, sendProBlackListUrl);
|
||||
log.info("[uuid:{}]-手动执行下发省内黑名单完成", uuid);
|
||||
return Res.success();
|
||||
}
|
||||
|
||||
@PostMapping("/ReceptionProBlackList")
|
||||
public String receptionProBlackList(@RequestBody String json) {
|
||||
System.out.println(json);
|
||||
LoginAuthentication loginAuthentication = new LoginAuthentication();
|
||||
loginAuthentication.setCode(200);
|
||||
loginAuthentication.setData("推送成功");
|
||||
loginAuthentication.setMessage("请求成功");
|
||||
loginAuthentication.setSuccess(true);
|
||||
return JSON.toJSONString(loginAuthentication);
|
||||
}
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
package com.nmggs.query.service;
|
||||
|
||||
/**
|
||||
* @author: shuguang
|
||||
* @date: 2025年06月26日 15:31
|
||||
* @description:
|
||||
*/
|
||||
public interface SendProBlackListService {
|
||||
|
||||
/**
|
||||
* 拉取内蒙省内拍照执法设备预警的逃费车辆信息
|
||||
*
|
||||
* @param uuid uuid
|
||||
* @param loginAuthenticationAccount 登录用户名
|
||||
* @param loginAuthenticationPassword 登录密码
|
||||
* @param loginAuthenticationUrl 登录鉴权接口地址
|
||||
* @param getFeeEvasionInfoUrl 获取逃费记录接口地址
|
||||
* @author shuguang
|
||||
* @date 2025-06-30 8:34
|
||||
*/
|
||||
void getFeeEvasionInfo(String uuid, String loginAuthenticationAccount, String loginAuthenticationPassword, String loginAuthenticationUrl, String getFeeEvasionInfoUrl);
|
||||
|
||||
/**
|
||||
* 推送全量省内黑名单到指定接口
|
||||
*
|
||||
* @param uuid uuid
|
||||
* @param loginAuthenticationAccount 登录用户名
|
||||
* @param loginAuthenticationPassword 登录密码
|
||||
* @param loginAuthenticationUrl 登录鉴权接口地址
|
||||
* @param sendProBlackListUrl 推送全量省内黑名单接口地址
|
||||
* @author shuguang
|
||||
* @date 2025-06-27 8:34
|
||||
*/
|
||||
void sendProBlackListToInterface(String uuid, String loginAuthenticationAccount, String loginAuthenticationPassword, String loginAuthenticationUrl, String sendProBlackListUrl);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
Manifest-Version: 1.0
|
||||
Created-By: IntelliJ IDEA
|
||||
Built-By: shuguang
|
||||
Build-Jdk: Oracle OpenJDK version 1.8.0_181
|
||||
Implementation-Title: StaPerformanceEvaluation
|
||||
Implementation-Version: 0.0.1-SNAPSHOT
|
||||
Implementation-Vendor-Id: com.nmggs
|
||||
Main-Class: ${start-class}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue