2025年09月10日 1.0.1 修改通过堡垒机转发相关请求

main
gaoshuguang 2 months ago
parent 9a35c664f6
commit d6ab1278da

@ -5,6 +5,8 @@ import com.nmggs.query.common.emnu.Constant;
import com.nmggs.query.common.utils.DateTimeUtil;
import com.nmggs.query.common.utils.PropertiesUtil;
import com.nmggs.query.common.utils.UuidUtil;
import com.nmggs.query.service.NewRequestInterfaceService;
import com.nmggs.query.service.NewSendProBlackListService;
import com.nmggs.query.service.RequestInterfaceService;
import com.nmggs.query.service.SendProBlackListService;
import lombok.extern.slf4j.Slf4j;
@ -35,6 +37,11 @@ public class TimeTaskInfo {
@Resource
private RequestInterfaceService requestInterfaceService;
@Resource
private NewSendProBlackListService newSendProBlackListService;
@Resource
private NewRequestInterfaceService newRequestInterfaceService;
/**
* CPC
@ -51,22 +58,28 @@ public class TimeTaskInfo {
Stopwatch stopwatch = Stopwatch.createStarted();
try {
String isOpenDCPCTimeTask = PropertiesUtil.getValue("isOpenDCPCTimeTask");
if(StringUtils.isBlank(isOpenDCPCTimeTask) || !Constant.STR_ONE.equals(isOpenDCPCTimeTask.trim())){
String isEnableTransit = PropertiesUtil.getValue("isEnableTransit");
if (StringUtils.isBlank(isOpenDCPCTimeTask) || !Constant.STR_ONE.equals(isOpenDCPCTimeTask.trim())) {
log.info("[uuid:{}]-定时执行获取国道CPC对账文件进行入库操作未开启", uuid);
}else{
} else {
//获取前一天
String beforeDateString = DateTimeUtil.getFormateString(DateTimeUtil.addDateDays(new Date(), -1), Constant.YYYY_MM_DD);
requestInterfaceService.getRequestInterface(uuid,beforeDateString);
if (Constant.STR_ONE.equals(isEnableTransit)) {
newRequestInterfaceService.getRequestInterface(uuid, beforeDateString);
} else {
requestInterfaceService.getRequestInterface(uuid, beforeDateString);
}
}
} catch (Exception e) {
log.error("[uuid:{}]-定时执行获取国道CPC对账文件进行入库操作服务异常", uuid, e);
}
finally {
} finally {
stopwatch.stop();
log.info("[uuid:{}]-定时执行获取国道CPC对账文件进行入库操作服务执行完成耗时{}毫秒", uuid, stopwatch.elapsed(TimeUnit.MILLISECONDS));
}
}
/**
*
*
@ -85,6 +98,7 @@ public class TimeTaskInfo {
String loginAuthenticationPassword = PropertiesUtil.getValue("loginAuthenticationPassword");
String loginAuthenticationUrl = PropertiesUtil.getValue("loginAuthenticationUrl");
String getFeeEvasionInfoUrl = PropertiesUtil.getValue("sendProBlackListUrl");
String isEnableTransit = PropertiesUtil.getValue("isEnableTransit");
log.info("[uuid:{}]-定时执行获取逃费车辆信息,获取到的配置文件参数loginAuthenticationAccount={},loginAuthenticationPassword={},loginAuthenticationUrl={},sendProBlackListUrl={}"
, uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, getFeeEvasionInfoUrl);
try {
@ -94,18 +108,23 @@ public class TimeTaskInfo {
&& StringUtils.isNotBlank(loginAuthenticationUrl)
&& StringUtils.isNotBlank(getFeeEvasionInfoUrl)
) {
sendProBlackListService.getFeeEvasionInfo(uuid,loginAuthenticationAccount,loginAuthenticationPassword,loginAuthenticationUrl,getFeeEvasionInfoUrl);
if (Constant.STR_ONE.equals(isEnableTransit)) {
newSendProBlackListService.getFeeEvasionInfo(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, getFeeEvasionInfoUrl);
} else {
sendProBlackListService.getFeeEvasionInfo(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, getFeeEvasionInfoUrl);
}
} else {
log.info("[uuid:{}}]-暂停定时获取逃费车辆信息:{}",uuid, getFeeEvasionInfoUrl);
log.info("[uuid:{}}]-暂停定时获取逃费车辆信息:{}", uuid, getFeeEvasionInfoUrl);
}
} catch (Exception e) {
log.error("[uuid:{}}]-定时执行获取逃费车辆信息:{}报错{}",uuid, getFeeEvasionInfoUrl, e);
log.error("[uuid:{}}]-定时执行获取逃费车辆信息:{}报错{}", uuid, getFeeEvasionInfoUrl, e);
} finally {
stopwatch.stop();
}
log.info("[uuid:{}}]-定时执行获取逃费车辆信息:{},耗时:{}毫秒", uuid, getFeeEvasionInfoUrl, stopwatch.elapsed(TimeUnit.MILLISECONDS));
}
/**
*
*
@ -124,6 +143,7 @@ public class TimeTaskInfo {
String loginAuthenticationPassword = PropertiesUtil.getValue("loginAuthenticationPassword");
String loginAuthenticationUrl = PropertiesUtil.getValue("loginAuthenticationUrl");
String sendProBlackListUrl = PropertiesUtil.getValue("sendProBlackListUrl");
String isEnableTransit = PropertiesUtil.getValue("isEnableTransit");
log.info("[uuid:{}]-定时执行下发省内黑名单,获取到的配置文件参数loginAuthenticationAccount={},loginAuthenticationPassword={},loginAuthenticationUrl={},sendProBlackListUrl={}"
, uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, sendProBlackListUrl);
try {
@ -133,12 +153,16 @@ public class TimeTaskInfo {
&& StringUtils.isNotBlank(loginAuthenticationUrl)
&& StringUtils.isNotBlank(sendProBlackListUrl)
) {
sendProBlackListService.sendProBlackListToInterface(uuid,loginAuthenticationAccount,loginAuthenticationPassword,loginAuthenticationUrl,sendProBlackListUrl);
if (Constant.STR_ONE.equals(isEnableTransit)) {
newSendProBlackListService.sendProBlackListToInterface(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, sendProBlackListUrl);
} else {
sendProBlackListService.sendProBlackListToInterface(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, sendProBlackListUrl);
}
} else {
log.info("[uuid:{}}]-暂停定时执行下发省内黑名单到指定接口:{}",uuid, sendProBlackListUrl);
log.info("[uuid:{}}]-暂停定时执行下发省内黑名单到指定接口:{}", uuid, sendProBlackListUrl);
}
} catch (Exception e) {
log.error("[uuid:{}}]-定时执行下发省内黑名单到指定接口:{}报错{}",uuid, sendProBlackListUrl, e);
log.error("[uuid:{}}]-定时执行下发省内黑名单到指定接口:{}报错{}", uuid, sendProBlackListUrl, e);
} finally {
stopwatch.stop();
}

@ -1,16 +1,13 @@
package com.nmggs.query.controller;
import com.alibaba.fastjson2.JSON;
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.entity.Res;
import com.nmggs.query.entity.sendproblacklist.LoginAuthentication;
import com.nmggs.query.service.NewSendProBlackListService;
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;
@ -37,7 +34,13 @@ public class ManualSendProBlackListController {
String getFeeEvasionInfoUrl = PropertiesUtil.getValue("sendProBlackListUrl");
log.info("[uuid:{}]-手动执行获取逃费车辆信息,获取到的配置文件参数loginAuthenticationAccount={},loginAuthenticationPassword={},loginAuthenticationUrl={},sendProBlackListUrl={}"
, uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, getFeeEvasionInfoUrl);
newSendProBlackListService.getFeeEvasionInfo(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, getFeeEvasionInfoUrl);
String isEnableTransit = PropertiesUtil.getValue("isEnableTransit");
if (Constant.STR_ONE.equals(isEnableTransit)) {
newSendProBlackListService.getFeeEvasionInfo(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, getFeeEvasionInfoUrl);
}else {
sendProBlackListService.getFeeEvasionInfo(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, getFeeEvasionInfoUrl);
}
log.info("[uuid:{}]-手动执行获取逃费车辆信息完成", uuid);
return Res.success();
}
@ -50,19 +53,13 @@ public class ManualSendProBlackListController {
String sendProBlackListUrl = PropertiesUtil.getValue("sendProBlackListUrl");
log.info("[uuid:{}]-手动执行下发省内黑名单,获取到的配置文件参数loginAuthenticationAccount={},loginAuthenticationPassword={},loginAuthenticationUrl={},sendProBlackListUrl={}"
, uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, sendProBlackListUrl);
newSendProBlackListService.sendProBlackListToInterface(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, sendProBlackListUrl);
String isEnableTransit = PropertiesUtil.getValue("isEnableTransit");
if (Constant.STR_ONE.equals(isEnableTransit)) {
newSendProBlackListService.sendProBlackListToInterface(uuid, loginAuthenticationAccount, loginAuthenticationPassword, loginAuthenticationUrl, sendProBlackListUrl);
}else {
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);
}
}

@ -19,6 +19,16 @@ import java.util.Map;
public class ZDYHDataController {
@Resource
private ZDYHDataService zdyhDataService;
@PostMapping("/ZDYH/getWarningData")
public Result getWarningData(@RequestBody Map<String, Object> params) {
String uuid = UuidUtil.getUuid();
return zdyhDataService.getWarningData(params, uuid);
}
@PostMapping("/ZDYH/getUseFrequency")
public Result getUseFrequency(@RequestBody Map<String, Object> params) {
String uuid = UuidUtil.getUuid();
return zdyhDataService.getUseFrequency(params, uuid);
}
@PostMapping("/ZDYH/getEquipmentInfo")
public Result getEquipmentInfo(@RequestBody Map<String, Object> params) {
String uuid = UuidUtil.getUuid();

@ -24,6 +24,18 @@ public class EquipmentInfo {
@JSONField(name = "equipmentid")
private Integer equipmentid;
/**
*
*/
@TableField("equipmentname")
@JSONField(name = "equipmentname")
private String equipmentname;
/**
* --
*/
@TableField("equipmenttype")
@JSONField(name = "equipmenttype")
private String equipmenttype;
/**
*
*/

@ -23,6 +23,12 @@ public class MobileWeighInfo {
@JSONField(name = "uuid")
private String uuid;
/**
* ID
*/
@JSONField(name = "SiteID")
@TableField("SiteID")
private String siteId;
/**
*
*/
@ -214,7 +220,7 @@ public class MobileWeighInfo {
@TableField("UploadAddress")
private String uploadAddress;
@TableField("insert_time")
@TableField("insertTime")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date insert_time;
private Date insertTime;
}

@ -0,0 +1,97 @@
package com.nmggs.query.entity.fx;
import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* @author: shuguang
* @date: 20250916
* @description: 使
*/
@Data
@TableName("zdyh_use_info")
public class UseInfo {
/**
*
*/
@TableField("classdate")
@JSONField(name = "classdate")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date classdate;
/**
*
*/
@TableField("equipmentid")
@JSONField(name = "equipmentid")
private Integer equipmentid;
/**
*
*/
@TableField("equipmentname")
@JSONField(name = "equipmentname")
private String equipmentname;
/**
*
*/
@TableField("departmentno")
@JSONField(name = "departmentno")
private Integer departmentno;
/**
*
*/
@TableField("departmentname")
@JSONField(name = "departmentname")
private String departmentname;
/**
* 使
*/
@TableField("usehour")
@JSONField(name = "usehour")
private Double usehour;
/**
*
*/
@TableField("passcount")
@JSONField(name = "passcount")
private Integer passcount;
/**
*
*/
@TableField("truckpasscount")
@JSONField(name = "truckpasscount")
private Integer truckpasscount;
/**
*
*/
@TableField("dangerpasscount")
@JSONField(name = "dangerpasscount")
private Integer dangerpasscount;
/**
*
*/
@TableField("carpasscount")
@JSONField(name = "carpasscount")
private Integer carpasscount;
/**
*
*/
@TableField("updatetime")
@JSONField(name = "updatetime")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatetime;
}

@ -0,0 +1,216 @@
package com.nmggs.query.entity.fx;
import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* @author: shuguang
* @date: 20250916
* @description:
*/
@Data
@TableName("zdyh_warning_info")
public class WarningInfo {
/**
*
*/
@TableField("classdate")
@JSONField(name = "classdate")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date classdate;
/**
*
*/
@TableField("equipmentid")
@JSONField(name = "equipmentid")
private Integer equipmentid;
/**
*
*/
@TableField("equipmentname")
@JSONField(name = "equipmentname")
private String equipmentname;
/**
*
*/
@TableField("departmentno")
@JSONField(name = "departmentno")
private Integer departmentno;
/**
*
*/
@TableField("departmentname")
@JSONField(name = "departmentname")
private String departmentname;
/**
*
*/
@TableField("passcount")
@JSONField(name = "passcount")
private Integer passcount;
/**
*
*/
@TableField("warncount")
@JSONField(name = "warncount")
private Integer warncount;
/**
*
*/
@TableField("fatiguecount")
@JSONField(name = "fatiguecount")
private Integer fatiguecount;
/**
*
*/
@TableField("truckfatiguecount")
@JSONField(name = "truckfatiguecount")
private Integer truckfatiguecount;
/**
*
*/
@TableField("dangerfatiguecount")
@JSONField(name = "dangerfatiguecount")
private Integer dangerfatiguecount;
/**
*
*/
@TableField("carfatiguecount")
@JSONField(name = "carfatiguecount")
private Integer carfatiguecount;
/**
*
*/
@TableField("severefatiguecount")
@JSONField(name = "severefatiguecount")
private Integer severefatiguecount;
/**
*
*/
@TableField("truckseverefatiguecount")
@JSONField(name = "truckseverefatiguecount")
private Integer truckseverefatiguecount;
/**
*
*/
@TableField("dangerseverefatiguecount")
@JSONField(name = "dangerseverefatiguecount")
private Integer dangerseverefatiguecount;
/**
*
*/
@TableField("carseverefatiguecount")
@JSONField(name = "carseverefatiguecount")
private Integer carseverefatiguecount;
/**
*
*/
@TableField("speedcount")
@JSONField(name = "speedcount")
private Integer speedcount;
/**
*
*/
@TableField("truckspeedcount")
@JSONField(name = "truckspeedcount")
private Integer truckspeedcount;
/**
*
*/
@TableField("dangerspeedcount")
@JSONField(name = "dangerspeedcount")
private Integer dangerspeedcount;
/**
*
*/
@TableField("carspeedcount")
@JSONField(name = "carspeedcount")
private Integer carspeedcount;
/**
*
*/
@TableField("facilitycount")
@JSONField(name = "facilitycount")
private Integer facilitycount;
/**
*
*/
@TableField("truckfacilitycount")
@JSONField(name = "truckfacilitycount")
private Integer truckfacilitycount;
/**
*
*/
@TableField("dangerfacilitycount")
@JSONField(name = "dangerfacilitycount")
private Integer dangerfacilitycount;
/**
*
*/
@TableField("carfacilitycount")
@JSONField(name = "carfacilitycount")
private Integer carfacilitycount;
/**
*
*/
@TableField("feeevasioncount")
@JSONField(name = "feeevasioncount")
private Integer feevasioncount;
/**
*
*/
@TableField("truckfeeevasioncount")
@JSONField(name = "truckfeeevasioncount")
private Integer truckfeeevasioncount;
/**
*
*/
@TableField("dangerfeeevasioncount")
@JSONField(name = "dangerfeeevasioncount")
private Integer dangerfeeevasioncount;
/**
*
*/
@TableField("carfeeevasioncount")
@JSONField(name = "carfeeevasioncount")
private Integer carfeeevasioncount;
/**
*
*/
@TableField("updatetime")
@JSONField(name = "updatetime")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatetime;
}

@ -0,0 +1,16 @@
package com.nmggs.query.mapper.fx;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nmggs.query.entity.fx.UseInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* @author: shuguang
* @date: 20250916 15:25
* @description:
*/
@Mapper
@DS("fx")
public interface UseInfoMapper extends BaseMapper<UseInfo> {
}

@ -0,0 +1,16 @@
package com.nmggs.query.mapper.fx;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nmggs.query.entity.fx.WarningInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* @author: shuguang
* @date: 20250916 15:38
* @description:
*/
@Mapper
@DS("fx")
public interface WarningInfoMapper extends BaseMapper<WarningInfo> {
}

@ -11,12 +11,35 @@ import java.util.Map;
*/
public interface ZDYHDataService {
/**
*
* @author shuguang
* @date 2025-09-10 15:35
*
*
* @param params
* @param uuid uuid
* @param uuid uuid
* @return com.nmggs.query.common.exception.Result
* @author shuguang
* @date 2025-09-10 15:35
*/
Result getEquipmentInfo(Map<String, Object> params, String uuid);
/**
* 使
*
* @param params
* @param uuid uuid
* @return com.nmggs.query.common.exception.Result
* @author shuguang
* @date 2025-09-16 15:47
*/
Result getUseFrequency(Map<String, Object> params, String uuid);
/**
*
*
* @param params
* @param uuid uuid
* @return com.nmggs.query.common.exception.Result
* @author shuguang
* @date 2025-09-16 15:47
*/
Result getWarningData(Map<String, Object> params, String uuid);
}

@ -50,7 +50,7 @@ public class ReceptionDataServiceImpl implements ReceptionDataService {
throw new PPException(MessageEnum..getCode(), MessageEnum..getMessage());
}
mobileWeighInfo.setUuid(uuid);
mobileWeighInfo.setInsert_time(new Date());
mobileWeighInfo.setInsertTime(new Date());
insert = mobileWeighInfoMapper.insert(mobileWeighInfo);
} catch (Exception e) {
log.error("[uuid:" + uuid + "]-接收移动称重数据异常:" + e.getMessage());

@ -11,7 +11,11 @@ import com.nmggs.query.common.utils.PropertiesUtil;
import com.nmggs.query.common.utils.SM4Utils;
import com.nmggs.query.entity.ResData;
import com.nmggs.query.entity.fx.EquipmentInfo;
import com.nmggs.query.entity.fx.UseInfo;
import com.nmggs.query.entity.fx.WarningInfo;
import com.nmggs.query.mapper.fx.EquipmentInfoMapper;
import com.nmggs.query.mapper.fx.UseInfoMapper;
import com.nmggs.query.mapper.fx.WarningInfoMapper;
import com.nmggs.query.service.ZDYHDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -31,6 +35,10 @@ import java.util.Map;
public class ZDYHDataServiceImpl implements ZDYHDataService {
@Resource
private EquipmentInfoMapper equipmentInfoMapper;
@Resource
private UseInfoMapper useInfoMapper;
@Resource
private WarningInfoMapper warningInfoMapper;
/**
*
@ -83,6 +91,110 @@ public class ZDYHDataServiceImpl implements ZDYHDataService {
return Result.success("接收重点隐患车辆设备数据成功");
}
/**
* 使
*
* @param params
* @param uuid uuid
* @return com.nmggs.query.common.exception.Result
* @author shuguang
* @date 2025-09-16 15:47
*/
@Override
@ExecutionTimeLogger
public Result getUseFrequency(Map<String, Object> params, String uuid) {
log.info("[uuid:{}]-开始接收重点隐患车辆使用频次数据" ,uuid);
String authKey = PropertiesUtil.getValue("authKey");
String dataJson = conversionJson(params, uuid);
// 解析响应数据
ResData resData = JSON.parseObject(dataJson, ResData.class);
// 提取密钥和加密数据
String returnedKey = resData.getKey();
String encryptedData = resData.getData();
// 解密数据
String decryptedData = SM4Utils.sm4Decrypt(encryptedData, SM4Utils.sm4Decrypt(returnedKey, authKey));
// 将解密后的数据解析为 UseInfo列表
List<UseInfo> infoList = JSON.parseArray(decryptedData, UseInfo.class);
int updateCount=0;
int insertCount=0;
if(infoList!=null && infoList.size()>0){
for (UseInfo info : infoList) {
Integer equipmentid = info.getEquipmentid();
info.setUpdatetime(new Date());
QueryWrapper<UseInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipmentid", equipmentid)
.eq("classdate", info.getClassdate());
boolean exists = useInfoMapper.exists(queryWrapper);
if (exists) {
UpdateWrapper<UseInfo> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("equipmentid", equipmentid)
.eq("classdate", info.getClassdate());
useInfoMapper.update(info, updateWrapper);
updateCount++;
}else {
useInfoMapper.insert(info);
insertCount++;
}
}
}
log.info("[uuid:{}]-接收重点隐患车辆使用频次数据完成,更新数量:{},插入数量:{}", uuid, updateCount, insertCount);
return Result.success("接收数据成功");
}
/**
*
*
* @param params
* @param uuid uuid
* @return com.nmggs.query.common.exception.Result
* @author shuguang
* @date 2025-09-16 15:47
*/
@Override
public Result getWarningData(Map<String, Object> params, String uuid) {
log.info("[uuid:{}]-开始接收重点隐患车辆预警结果数据" ,uuid);
String authKey = PropertiesUtil.getValue("authKey");
String dataJson = conversionJson(params, uuid);
// 解析响应数据
ResData resData = JSON.parseObject(dataJson, ResData.class);
// 提取密钥和加密数据
String returnedKey = resData.getKey();
String encryptedData = resData.getData();
// 解密数据
String decryptedData = SM4Utils.sm4Decrypt(encryptedData, SM4Utils.sm4Decrypt(returnedKey, authKey));
// 将解密后的数据解析为 WarningInfo 列表
List<WarningInfo> infoList = JSON.parseArray(decryptedData, WarningInfo.class);
int updateCount=0;
int insertCount=0;
if(infoList!=null && infoList.size()>0){
for (WarningInfo info : infoList) {
Integer equipmentid = info.getEquipmentid();
info.setUpdatetime(new Date());
QueryWrapper<WarningInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipmentid", equipmentid)
.eq("classdate", info.getClassdate());
boolean exists = warningInfoMapper.exists(queryWrapper);
if (exists) {
UpdateWrapper<WarningInfo> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("equipmentid", equipmentid)
.eq("classdate", info.getClassdate());
warningInfoMapper.update(info, updateWrapper);
updateCount++;
}else {
warningInfoMapper.insert(info);
insertCount++;
}
}
}
log.info("[uuid:{}]-接收重点隐患车辆预警结果数据完成,更新数量:{},插入数量:{}", uuid, updateCount, insertCount);
return Result.success("接收数据成功");
}
private String conversionJson(Map<String, Object> map, String uuid) {
String result = "";
// 使用ObjectMapper将List<Map<String, Object>>转换为JSON字符串

@ -2,8 +2,6 @@ package com.nmggs.query.test;
import com.alibaba.fastjson2.JSON;
import com.nmggs.query.common.utils.SM4Utils;
import com.nmggs.query.common.utils.SignUtil;
import com.nmggs.query.common.utils.UuidUtil;
import com.nmggs.query.entity.ResData;
/**
@ -20,24 +18,62 @@ public class Test250825 {
String json ="[\n" +
" {\n" +
" \"equipmentid\": 1,\n" +
" \"departmentno\": 101,\n" +
" \"departmentname\": \"高速一支队\",\n" +
" \"state\": 1,\n" +
" \"type\": 1,\n" +
" \"lng\": \"116.46\",\n" +
" \"lat\": \"39.92\",\n" +
" \"lasttime\": \"2024-09-10 15:00:00\"\n" +
" \"classdate\": \"2025-09-15\",\n" +
" \"equipmentid\": 487,\n" +
" \"equipmentname\": \"高速二支队\u200C\u200C赤峰大队\",\n" +
" \"departmentno\": 16,\n" +
" \"departmentname\": \"高速二支队\",\n" +
" \"passcount\": 120,\n" +
" \"warncount\": 5,\n" +
" \"fatiguecount\": 3,\n" +
" \"truckfatiguecount\": 1,\n" +
" \"dangerfatiguecount\": 1,\n" +
" \"carfatiguecount\": 1,\n" +
" \"severefatiguecount\": 2,\n" +
" \"truckseverefatiguecount\": 1,\n" +
" \"dangerseverefatiguecount\": 1,\n" +
" \"carseverefatiguecount\": 1,\n" +
" \"speedcount\": 10,\n" +
" \"truckspeedcount\": 3,\n" +
" \"dangerspeedcount\": 2,\n" +
" \"carspeedcount\": 5,\n" +
" \"facilitycount\": 8,\n" +
" \"truckfacilitycount\": 3,\n" +
" \"dangerfacilitycount\": 2,\n" +
" \"carfacilitycount\": 3,\n" +
" \"feeevasioncount\": 5,\n" +
" \"truckfeeevasioncount\": 2,\n" +
" \"dangerfeeevasioncount\": 1,\n" +
" \"carfeeevasioncount\": 2\n" +
" },\n" +
" {\n" +
" \"equipmentid\": 2,\n" +
" \"departmentno\": 102,\n" +
" \"departmentname\": \"高速二支队\",\n" +
" \"state\": 1,\n" +
" \"type\": 1,\n" +
" \"lng\": \"126.46\",\n" +
" \"lat\": \"49.92\",\n" +
" \"lasttime\": \"2024-09-10 16:00:00\"\n" +
" \"classdate\": \"2025-09-16\",\n" +
" \"equipmentid\": 335,\n" +
" \"equipmentname\": \"高速一支队\u200C\u200C苏木山大队\",\n" +
" \"departmentno\": 15,\n" +
" \"departmentname\": \"高速一支队\",\n" +
" \"passcount\": 150,\n" +
" \"warncount\": 7,\n" +
" \"fatiguecount\": 4,\n" +
" \"truckfatiguecount\": 2,\n" +
" \"dangerfatiguecount\": 1,\n" +
" \"carfatiguecount\": 1,\n" +
" \"severefatiguecount\": 3,\n" +
" \"truckseverefatiguecount\": 1,\n" +
" \"dangerseverefatiguecount\": 1,\n" +
" \"carseverefatiguecount\": 1,\n" +
" \"speedcount\": 12,\n" +
" \"truckspeedcount\": 4,\n" +
" \"dangerspeedcount\": 3,\n" +
" \"carspeedcount\": 5,\n" +
" \"facilitycount\": 10,\n" +
" \"truckfacilitycount\": 4,\n" +
" \"dangerfacilitycount\": 3,\n" +
" \"carfacilitycount\": 3,\n" +
" \"feeevasioncount\": 6,\n" +
" \"truckfeeevasioncount\": 3,\n" +
" \"dangerfeeevasioncount\": 2,\n" +
" \"carfeeevasioncount\": 1\n" +
" }\n" +
"]";
String sm4Encrypt = SM4Utils.sm4Encrypt(json, s);

@ -1,9 +0,0 @@
Manifest-Version: 1.0
Created-By: IntelliJ IDEA
Built-By: shuguang
Build-Jdk: Oracle OpenJDK version 1.8.0_181
Implementation-Title: GetDataInterface
Implementation-Version: 0.0.1-SNAPSHOT
Implementation-Vendor-Id: com.nmggs
Main-Class: ${start-class}
Loading…
Cancel
Save