2025年08月21日 1.0.4 删除定时任务定时推送和获取数据,迁移到项目GetDataInterface中

main
gaoshuguang 5 months ago
parent 3c72f41bc8
commit 43691ed329

@ -212,7 +212,12 @@
<artifactId>httpmime</artifactId>
<version>4.5.13</version>
</dependency>
<!-- SM4加密依赖包 -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.78.1</version>
</dependency>
</dependencies>
<dependencyManagement>

@ -32,9 +32,6 @@ public class CorsConfig implements WebMvcConfigurer {
.addPathPatterns("/**")
// 是否允许证书
.excludePathPatterns(
"/ManualGetFeeEvasionInfo**",
"/ManualSendProBlackList**",
"/ReceptionProBlackList**",
"/index**",
"/XNPJhome**",
"/Gantry**",

@ -1,62 +0,0 @@
package com.nmggs.query.common.timetask;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @author: shuguang
* @date: 20250627 10:35
* @description: 线
*/
@Configuration
@EnableScheduling // 开启定时任务
@EnableAsync //开启对异步定时任务的支持
public class TaskThreadPoolConfig {
@Bean("threadPoolSendProBlackList") // bean的名称默认为首字母小写的方法名
public Executor threadPoolSendProBlackList() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//线程前缀名
executor.setThreadNamePrefix("threadPoolSendProBlackList-thread-");
//最大线程数
executor.setMaxPoolSize(1);
//核心线程数
executor.setCorePoolSize(1);
//任务队列的大小
executor.setQueueCapacity(5);
//executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
//线程初始化
executor.initialize();
return executor;
}
@Bean("threadPoolGetFeeEvasionInfo") // bean的名称默认为首字母小写的方法名
public Executor threadPoolGetFeeEvasionInfo() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//线程前缀名
executor.setThreadNamePrefix("threadPoolGetFeeEvasionInf-thread-");
//最大线程数
executor.setMaxPoolSize(1);
//核心线程数
executor.setCorePoolSize(1);
//任务队列的大小
executor.setQueueCapacity(5);
//executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
//线程初始化
executor.initialize();
return executor;
}
}

@ -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: 20250627 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: 20250626 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: 20250626 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);
}

@ -1,291 +0,0 @@
package com.nmggs.query.service.impl;
import com.alibaba.fastjson2.JSON;
import com.nmggs.query.common.emnu.MessageEnum;
import com.nmggs.query.common.exception.PPException;
import com.nmggs.query.common.utils.DateTimeUtil;
import com.nmggs.query.entity.sendproblacklist.FeeEvasionInfo;
import com.nmggs.query.entity.sendproblacklist.LoginAuthentication;
import com.nmggs.query.entity.sendproblacklist.ProBlackList;
import com.nmggs.query.entity.sendproblacklist.ResponseData;
import com.nmggs.query.mapper.FeeEvasionInfoMapper;
import com.nmggs.query.service.SendProBlackListService;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* @author: shuguang
* @date: 20250626 15:31
* @description:
*/
@Service
@Slf4j
public class SendProBlackListServiceImpl implements SendProBlackListService {
private static final String DRIVER_NAME = "oracle.jdbc.driver.OracleDriver";
private static final String DB_URL = "jdbc:oracle:thin:@10.15.100.5:1521/TORCL";
private static final String DB_USER_NAME = "NMGLWADMIN";
private static final String DB_PASS_WORD = "nmlwzx2021[]";
private static final String SQL_STR = "select BEGDATE,CARDID,CARDNO,DT,PLATECOLOR,VERNO,CASH,TYPE from hang_table_collect_all WHERE JTFLAG =1 and PLATECOLOR ='黄'";
private static final int INT_200 = 200;
@Resource
private FeeEvasionInfoMapper feeEvasionInfoMapper;
/**
*
*
* @param uuid uuid
* @param loginAuthenticationAccount
* @param loginAuthenticationPassword
* @param loginAuthenticationUrl
* @param getFeeEvasionInfoUrl
* @author shuguang
* @date 2025-06-30 8:34
*/
@Override
public void getFeeEvasionInfo(String uuid, String loginAuthenticationAccount, String loginAuthenticationPassword, String loginAuthenticationUrl, String getFeeEvasionInfoUrl) {
log.info("[uuid:{}]-开始登录鉴权获取token", uuid);
String token = loginAndGetToken(uuid,loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl);
log.info("[uuid:{}}]-获取到token{}",uuid, token);
log.info("[uuid:{}}]-开始向指定接口:{},获取逃费记录数据",uuid, getFeeEvasionInfoUrl);
List<FeeEvasionInfo> feeEvasionInfoList = getDataToServer(uuid, getFeeEvasionInfoUrl, token);
log.info("[uuid:{}}]-获取到逃费记录数据条数:{}",uuid, feeEvasionInfoList.size());
if (feeEvasionInfoList.size() > 0) {
Date now = new Date();
for (FeeEvasionInfo feeEvasionInfo : feeEvasionInfoList) {
feeEvasionInfo.setInsertTime(now);
feeEvasionInfoMapper.insert(feeEvasionInfo);
}
}
log.info("[uuid:{}}]-获取到逃费记录数据入库到FEE_EVASION_INFO_JAVA表入库条数为{}",uuid, feeEvasionInfoList.size());
}
/**
*
*
* @param uuid uuid
* @param loginAuthenticationAccount
* @param loginAuthenticationPassword
* @param loginAuthenticationUrl
* @param sendProBlackListUrl
* @author shuguang
* @date 2025-06-27 8:34
*/
@Override
public void sendProBlackListToInterface(String uuid, String loginAuthenticationAccount, String loginAuthenticationPassword, String loginAuthenticationUrl, String sendProBlackListUrl) {
log.info("[uuid:{}]-开始登录鉴权获取token", uuid);
String token = loginAndGetToken(uuid,loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl);
//String token = "test123";
log.info("[uuid:{}}]-获取到token{}",uuid, token);
List<ProBlackList> dataList = fetchData(uuid);
//List<ProBlackList> dataList = testDate();
log.info("[uuid:{}}]-查询到最新的省内黑名单数据条数:{}",uuid, dataList.size());
String json = JSON.toJSONString(dataList);
log.info("[uuid:{}}]-开始向指定接口:{},推送最新的省内黑名单数据",uuid, sendProBlackListUrl);
pushDataToServer(uuid,sendProBlackListUrl, token, json);
}
private static List<ProBlackList> testDate() {
Date date = new Date();
List<ProBlackList> dataList = new ArrayList<>();
ProBlackList proBlackList = new ProBlackList();
proBlackList.setBegdate(DateTimeUtil.getFormateString(date, "yyyy-MM-dd HH:mm:ss"));
proBlackList.setCardid("蒙A12345");
proBlackList.setCardno("test");
proBlackList.setDt(DateTimeUtil.getFormateString(date, "yyyy-MM-dd HH:mm:ss"));
proBlackList.setPlatecolor("蓝");
proBlackList.setVerno(25063001);
proBlackList.setCash(10L);
proBlackList.setType(1);
dataList.add(proBlackList);
ProBlackList proBlackList2 = new ProBlackList();
proBlackList2.setBegdate(DateTimeUtil.getFormateString(date, "yyyy-MM-dd HH:mm:ss"));
proBlackList2.setCardid("蒙A12346");
proBlackList2.setCardno("test");
proBlackList2.setDt(DateTimeUtil.getFormateString(date, "yyyy-MM-dd HH:mm:ss"));
proBlackList2.setPlatecolor("蓝");
proBlackList2.setVerno(25063001);
proBlackList2.setCash(10L);
proBlackList2.setType(1);
dataList.add(proBlackList2);
return dataList;
}
private String loginAndGetToken(String uuid,String loginAuthenticationAccount, String loginAuthenticationPassword, String loginAuthenticationUrl) {
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
HttpPost httpPost = new HttpPost(loginAuthenticationUrl);
List<BasicNameValuePair> formParams = new ArrayList<>();
formParams.add(new BasicNameValuePair("account", loginAuthenticationAccount));
formParams.add(new BasicNameValuePair("password", loginAuthenticationPassword));
httpPost.setEntity(new UrlEncodedFormEntity(formParams, "UTF-8"));
HttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
String responseString = "";
if (entity != null) {
responseString = EntityUtils.toString(entity, "UTF-8");
}
String chineseResponseString = convertUnicodeToChinese(responseString);
log.info("[uuid:{}]-登录鉴权返回数据:{}", uuid, chineseResponseString);
LoginAuthentication loginAuthentication = JSON.parseObject(chineseResponseString, LoginAuthentication.class);
if (loginAuthentication.getCode() == INT_200) {
return loginAuthentication.getData();
} else {
throw new PPException(MessageEnum..getCode(), MessageEnum..getMessage());
}
} catch (Exception e) {
log.error("[uuid:{}}]-登录鉴权失败,报错:{}",uuid, e);
throw new PPException(MessageEnum..getCode(), MessageEnum..getMessage());
}
}
private List<ProBlackList> fetchData(String uuid) {
List<ProBlackList> list = new ArrayList<>();
// 定义日期格式
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Class.forName(SendProBlackListServiceImpl.DRIVER_NAME);
try (Connection connection = DriverManager.getConnection(SendProBlackListServiceImpl.DB_URL, SendProBlackListServiceImpl.DB_USER_NAME, SendProBlackListServiceImpl.DB_PASS_WORD);
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(SendProBlackListServiceImpl.SQL_STR)) {
while (rs.next()) {
ProBlackList proBlackList = new ProBlackList();
Timestamp begdate = rs.getTimestamp("BEGDATE");
Timestamp dt = rs.getTimestamp("DT");
String cardid = rs.getString("CARDID");
String cardno = rs.getString("CARDNO");
String platecolor = rs.getString("PLATECOLOR");
int verno = rs.getInt("VERNO");
long cash = rs.getLong("CASH");
int type = rs.getInt("TYPE");
// 检查字段是否为空如果不为空则设置字段值并添加到list中
if (begdate != null && dt != null && cardid != null && cardno != null &&
platecolor != null && verno != 0 && cash != 0 && type != 0) {
proBlackList.setBegdate(dateFormat.format(begdate));
proBlackList.setDt(dateFormat.format(dt));
proBlackList.setCardid(cardid);
proBlackList.setCardno(cardno);
proBlackList.setPlatecolor(platecolor);
proBlackList.setVerno(verno);
proBlackList.setCash(cash);
proBlackList.setType(type);
list.add(proBlackList);
}
}
}
return list;
} catch (ClassNotFoundException e) {
log.error("[uuid:{}}]-数据库连接异常,报错:{}", uuid, e);
throw new PPException(MessageEnum..getCode(), MessageEnum..getMessage());
} catch (SQLException e) {
log.error("[uuid:{}}]-数据库执行sql失败报错{}", uuid, e);
throw new PPException(MessageEnum.sql.getCode(), MessageEnum.sql.getMessage());
}
}
private List<FeeEvasionInfo> getDataToServer(String uuid, String interfaceUrl, String token) {
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
HttpGet httpGet = new HttpGet(interfaceUrl);
httpGet.setHeader("Authorization", token);
HttpResponse response = httpClient.execute(httpGet);
HttpEntity entity = response.getEntity();
String responseString = "";
if (entity != null) {
responseString = EntityUtils.toString(entity, "UTF-8");
}
String chineseResponseString = convertUnicodeToChinese(responseString);
log.info("[uuid:{}}]-请求接口:{},返回数据为{}",uuid, interfaceUrl, chineseResponseString);
// 解析响应数据
ResponseData responseData = JSON.parseObject(chineseResponseString, ResponseData.class);
if (responseData.getCode() == INT_200) {
log.info("[uuid:{}] - 请求接口:{}, 获取数据成功", uuid, interfaceUrl);
return responseData.getData();
} else {
log.info("[uuid:{}] - 请求接口:{}, 获取数据失败", uuid, interfaceUrl);
// 返回空列表
return Collections.emptyList();
}
} catch (Exception e) {
log.error("[uuid:{}}]-获取逃费记录数据失败,报错:{}",uuid, e);
throw new PPException(MessageEnum..getCode(), MessageEnum..getMessage());
}
}
private void pushDataToServer(String uuid,String interfaceUrl, String token, String json) {
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
HttpPost httpPost = new HttpPost(interfaceUrl);
httpPost.setHeader("Content-Type", "application/json; charset=UTF-8");
httpPost.setHeader("Authorization", token);
httpPost.setEntity(new StringEntity(json, "UTF-8"));
HttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
String responseString = "";
if (entity != null) {
responseString = EntityUtils.toString(entity, "UTF-8");
}
String chineseResponseString = convertUnicodeToChinese(responseString);
log.info("[uuid:{}}]-请求接口:{},返回数据为{}",uuid, interfaceUrl, chineseResponseString);
LoginAuthentication loginAuthentication = JSON.parseObject(chineseResponseString, LoginAuthentication.class);
if (loginAuthentication.getCode() == INT_200) {
log.info("[uuid:{}}]-请求接口:{},推送数据成功",uuid, interfaceUrl);
} else {
log.info("[uuid:{}}]-请求接口:{},推送数据失败",uuid, interfaceUrl);
throw new PPException(MessageEnum..getCode(), MessageEnum..getMessage());
}
} catch (Exception e) {
log.error("[uuid:{}}]-推送省内黑名单数据失败,报错:{}",uuid, e);
throw new PPException(MessageEnum..getCode(), MessageEnum..getMessage());
}
}
public static void main(String[] args) {
List<ProBlackList> proBlackLists = testDate();
String json = JSON.toJSONString(proBlackLists);
System.out.println( json);
}
public static String convertUnicodeToChinese(String unicodeStr) {
StringBuilder sb = new StringBuilder();
int i = 0;
while (i < unicodeStr.length()) {
if (unicodeStr.charAt(i) == '\\' && unicodeStr.charAt(i + 1) == 'u') {
StringBuilder unicode = new StringBuilder();
int j = i + 2;
for (int k = 0; k < 4; k++) {
unicode.append(Character.toUpperCase(unicodeStr.charAt(j++)));
}
sb.append((char) Integer.parseInt(unicode.toString(), 16));
i = j;
} else {
sb.append(unicodeStr.charAt(i++));
}
}
return sb.toString();
}
}

@ -0,0 +1,9 @@
序号 日期 版本号 说明
1 2025年03月27日 1.0.0 收费站效能评价系统相关页面及代码(55-乌银高速分中心5514-巴彦浩特南)
2 2025年05月29日 1.0.1 增加集团和分公司页面
3 2025年06月30日 1.0.2 增加定时推送省内黑名单到指定接口配置文件中isSendProBlackList是否启用下发省内黑名单到指定接口 1-下发,其他值为不下发
loginAuthenticationAccount,loginAuthenticationPassword,loginAuthenticationUrl,sendProBlackListUrl
每天凌晨一点获取逃费记录并入库FEE_EVASION_INFO_JAVA
4 2025年07月01日 1.0.3 推送省内黑名单到指定接口时使用select BEGDATE,CARDID,CARDNO,DT,PLATECOLOR,VERNO,CASH,TYPE from hang_table_collect_all WHERE JTFLAG =1 and PLATECOLOR ='黄'查询数据
5 2025年08月21日 1.0.4 删除定时任务定时推送和获取数据迁移到项目GetDataInterface中

@ -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}

@ -0,0 +1,9 @@
序号 日期 版本号 说明
1 2025年03月27日 1.0.0 收费站效能评价系统相关页面及代码(55-乌银高速分中心5514-巴彦浩特南)
2 2025年05月29日 1.0.1 增加集团和分公司页面
3 2025年06月30日 1.0.2 增加定时推送省内黑名单到指定接口配置文件中isSendProBlackList是否启用下发省内黑名单到指定接口 1-下发,其他值为不下发
loginAuthenticationAccount,loginAuthenticationPassword,loginAuthenticationUrl,sendProBlackListUrl
每天凌晨一点获取逃费记录并入库FEE_EVASION_INFO_JAVA
4 2025年07月01日 1.0.3 推送省内黑名单到指定接口时使用select BEGDATE,CARDID,CARDNO,DT,PLATECOLOR,VERNO,CASH,TYPE from hang_table_collect_all WHERE JTFLAG =1 and PLATECOLOR ='黄'查询数据
Loading…
Cancel
Save