diff --git a/GetDataInterface/src/main/java/com/nmggs/query/controller/ZDYHDataController.java b/GetDataInterface/src/main/java/com/nmggs/query/controller/ZDYHDataController.java index 132de05..aeceba3 100644 --- a/GetDataInterface/src/main/java/com/nmggs/query/controller/ZDYHDataController.java +++ b/GetDataInterface/src/main/java/com/nmggs/query/controller/ZDYHDataController.java @@ -19,6 +19,21 @@ import java.util.Map; public class ZDYHDataController { @Resource private ZDYHDataService zdyhDataService; + @PostMapping("/ZDYH/getFatigueData") + public Result getFatigueData(@RequestBody Map params) { + String uuid = UuidUtil.getUuid(); + return zdyhDataService.getFatigueData(params, uuid); + } + @PostMapping("/ZDYH/getHiddenDangerAreaData") + public Result getHiddenDangerAreaData(@RequestBody Map params) { + String uuid = UuidUtil.getUuid(); + return zdyhDataService.getHiddenDangerAreaData(params, uuid); + } + @PostMapping("/ZDYH/getFenceData") + public Result getFenceData(@RequestBody Map params) { + String uuid = UuidUtil.getUuid(); + return zdyhDataService.getFenceData(params, uuid); + } @PostMapping("/ZDYH/getWarningData") public Result getWarningData(@RequestBody Map params) { String uuid = UuidUtil.getUuid(); diff --git a/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/FatigueVehicle.java b/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/FatigueVehicle.java new file mode 100644 index 0000000..976e7fa --- /dev/null +++ b/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/FatigueVehicle.java @@ -0,0 +1,107 @@ +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: 2025-10-09 + */ +@Data +@TableName("zdyh_fatigue_vehicle") +public class FatigueVehicle { + + /** + * 车牌号码 + */ + @TableField("plateno") + @JSONField(name = "plateno") + private String plateno; + + /** + * 车辆类型:1-客车 2-货车 3-危货车 + */ + @TableField("vehicletype") + @JSONField(name = "vehicletype") + private Integer vehicletype; + /** + * 数据类型:1-疲劳违法,2-超速违法,3-安全设施不全违法,4-逃费违法 + */ + @TableField("datatype") + @JSONField(name = "datatype") + private Integer datatype; + /** + * 设备编号 + */ + @TableField("equipmentid") + @JSONField(name = "equipmentid") + private Integer equipmentid; + + /** + * 所属组织 + */ + @TableField("equipmentname") + @JSONField(name = "equipmentname") + private String equipmentname; + + /** + * 执法时间(格式:YYYY-MM-DD HH:mm:ss) + */ + @TableField("enforcementtime") + @JSONField(name = "enforcementtime") + private String enforcementtime; + + /** + * 违法开始时间(格式:YYYY-MM-DD HH:mm:ss) + */ + @TableField("violationstarttime") + @JSONField(name = "violationstarttime") + private String violationstarttime; + + /** + * 违法结束时间(格式:YYYY-MM-DD HH:mm:ss) + */ + @TableField("violationendtime") + @JSONField(name = "violationendtime") + private String violationendtime; + + /** + * 违法时长(单位:分钟) + */ + @TableField("violationminute") + @JSONField(name = "violationminute") + private Integer violationminute; + /** + * 限速(单位:km/h) + */ + @TableField("speedlimit") + @JSONField(name = "speedlimit") + private Integer speedlimit; + /** + * 实际速度(单位:km/h) + */ + @TableField("actualspeed") + @JSONField(name = "actualspeed") + private Integer actualspeed; + /** + * 最后在线时间 + */ + @TableField("endviolationtime") + @JSONField(name = "endviolationtime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private String endviolationtime; + /** + * 入库时间 + */ + @TableField("inserttime") + @JSONField(name = "inserttime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date inserttime; +} diff --git a/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/FenceInfo.java b/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/FenceInfo.java new file mode 100644 index 0000000..a3df57a --- /dev/null +++ b/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/FenceInfo.java @@ -0,0 +1,163 @@ +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: 2025年10月09日 + * @description: 电子围栏信息表 + */ +@Data +@TableName("zdyh_fence_info") +public class FenceInfo { + + /** + * 电子围栏编号 + */ + @TableField("fenceid") + @JSONField(name = "fenceid") + private String fenceid; + + /** + * 设备编号 + */ + @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("pilenumber") + @JSONField(name = "pilenumber") + private String pilenumber; + + /** + * 经度 + */ + @TableField("lng") + @JSONField(name = "lng") + private String lng; + + /** + * 纬度 + */ + @TableField("lat") + @JSONField(name = "lat") + private String lat; + + /** + * 高速限速(单位:km/h) + */ + @TableField("highwayspeedlimit") + @JSONField(name = "highwayspeedlimit") + private Integer highwayspeedlimit; + + /** + * 低速限速(单位:km/h) + */ + @TableField("lowspeedlimit") + @JSONField(name = "lowspeedlimit") + private Integer lowspeedlimit; + + /** + * 是否可以停车:1-是,2-否 + */ + @TableField("ispark") + @JSONField(name = "ispark") + private Integer ispark; + + /** + * 监控公里数(单位:km) + */ + @TableField("monitormileage") + @JSONField(name = "monitormileage") + private Integer monitormileage; + /** + * 数据更新时间 + */ + @TableField("updatetime") + @JSONField(name = "updatetime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date updatetime; + /** + * 开始左纬度 + */ + @TableField("beginLeftLat") + @JSONField(name = "beginLeftLat") + private String beginLeftLat; + + /** + * 开始左经度 + */ + @TableField("beginLeftLng") + @JSONField(name = "beginLeftLng") + private String beginLeftLng; + /** + * 开始右纬度 + */ + @TableField("beginRightLat") + @JSONField(name = "beginRightLat") + private String beginRightLat; + + /** + * 开始右经度 + */ + @TableField("beginRightLng") + @JSONField(name = "beginRightLng") + private String beginRightLng; + /** + * 结束左纬度 + */ + @TableField("endLeftLat") + @JSONField(name = "endLeftLat") + private String endLeftLat; + + /** + * 结束左经度 + */ + @TableField("endLeftLng") + @JSONField(name = "endLeftLng") + private String endLeftLng; + /** + * 结束右纬度 + */ + @TableField("endRightLat") + @JSONField(name = "endRightLat") + private String endRightLat; + + /** + * 结束右经度 + */ + @TableField("endRightLon") + @JSONField(name = "endRightLon") + private String endRightLon; + +} diff --git a/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/HiddenDangerAreaInfo.java b/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/HiddenDangerAreaInfo.java new file mode 100644 index 0000000..224ee7f --- /dev/null +++ b/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/HiddenDangerAreaInfo.java @@ -0,0 +1,217 @@ +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: 2025-10-09 + * @description: 隐患区域数据表 + */ +@Data +@TableName("zdyh_hidden_danger_area_info") +public class HiddenDangerAreaInfo { + + /** + * 统计日期(格式:YYYY-MM-DD) + */ + @TableField("classdate") + @JSONField(name = "classdate") + private String classdate; + + /** + * 电子围栏编号 + */ + @TableField("fenceid") + @JSONField(name = "fenceid") + private String fenceid; + + /** + * 设备编号 + */ + @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("pilenumber") + @JSONField(name = "pilenumber") + private String pilenumber; + + + + /** + * 疲劳驾驶违法数量 + */ + @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 feeevasioncount; + + /** + * 逃费货车数量 + */ + @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; +} diff --git a/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/MobileWeighInfo.java b/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/MobileWeighInfo.java index 0a93a8e..234d181 100644 --- a/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/MobileWeighInfo.java +++ b/GetDataInterface/src/main/java/com/nmggs/query/entity/fx/MobileWeighInfo.java @@ -219,6 +219,12 @@ public class MobileWeighInfo { @JSONField(name = "UploadAddress") @TableField("UploadAddress") private String uploadAddress; + /** + * 归属站名称 + */ + @JSONField(name = "StaName") + @TableField("StaName") + private String staName; @TableField("insertTime") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") diff --git a/GetDataInterface/src/main/java/com/nmggs/query/mapper/fx/FatigueVehicleMapper.java b/GetDataInterface/src/main/java/com/nmggs/query/mapper/fx/FatigueVehicleMapper.java new file mode 100644 index 0000000..7620db2 --- /dev/null +++ b/GetDataInterface/src/main/java/com/nmggs/query/mapper/fx/FatigueVehicleMapper.java @@ -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.FatigueVehicle; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author: shuguang + * @date: 2025年10月09日 16:52 + * @description: + */ +@Mapper +@DS("fx") +public interface FatigueVehicleMapper extends BaseMapper { +} diff --git a/GetDataInterface/src/main/java/com/nmggs/query/mapper/fx/FenceInfoMapper.java b/GetDataInterface/src/main/java/com/nmggs/query/mapper/fx/FenceInfoMapper.java new file mode 100644 index 0000000..4e6eb3d --- /dev/null +++ b/GetDataInterface/src/main/java/com/nmggs/query/mapper/fx/FenceInfoMapper.java @@ -0,0 +1,17 @@ +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.FenceInfo; +import com.nmggs.query.entity.fx.HiddenDangerAreaInfo; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author: shuguang + * @date: 2025年10月09日 16:52 + * @description: + */ +@Mapper +@DS("fx") +public interface FenceInfoMapper extends BaseMapper { +} diff --git a/GetDataInterface/src/main/java/com/nmggs/query/mapper/fx/HiddenDangerAreaInfoMapper.java b/GetDataInterface/src/main/java/com/nmggs/query/mapper/fx/HiddenDangerAreaInfoMapper.java new file mode 100644 index 0000000..4c1e6f7 --- /dev/null +++ b/GetDataInterface/src/main/java/com/nmggs/query/mapper/fx/HiddenDangerAreaInfoMapper.java @@ -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.HiddenDangerAreaInfo; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author: shuguang + * @date: 2025年10月09日 16:53 + * @description: + */ +@Mapper +@DS("fx") +public interface HiddenDangerAreaInfoMapper extends BaseMapper { +} diff --git a/GetDataInterface/src/main/java/com/nmggs/query/service/ZDYHDataService.java b/GetDataInterface/src/main/java/com/nmggs/query/service/ZDYHDataService.java index a820525..a6858e6 100644 --- a/GetDataInterface/src/main/java/com/nmggs/query/service/ZDYHDataService.java +++ b/GetDataInterface/src/main/java/com/nmggs/query/service/ZDYHDataService.java @@ -42,4 +42,38 @@ public interface ZDYHDataService { * @date 2025-09-16 15:47 */ Result getWarningData(Map params, String uuid); + + /** + * 接收电子围栏数据 + * + * @param params 数据 + * @param uuid uuid + * @return com.nmggs.query.common.exception.Result + * @author shuguang + * @date 2025-09-16 15:47 + */ + Result getFenceData(Map params, String uuid); + + /** + * 接收隐患区域数据 + * + * @param params 数据 + * @param uuid uuid + * @return com.nmggs.query.common.exception.Result + * @author shuguang + * @date 2025-09-16 15:47 + */ + Result getHiddenDangerAreaData(Map params, String uuid); + + /** + * 接收违法车辆数据 + * + * @param params 数据 + * @param uuid uuid + * @return com.nmggs.query.common.exception.Result + * @author shuguang + * @date 2025-09-16 15:47 + */ + Result getFatigueData(Map params, String uuid); + } diff --git a/GetDataInterface/src/main/java/com/nmggs/query/service/impl/ZDYHDataServiceImpl.java b/GetDataInterface/src/main/java/com/nmggs/query/service/impl/ZDYHDataServiceImpl.java index b000fab..8af2844 100644 --- a/GetDataInterface/src/main/java/com/nmggs/query/service/impl/ZDYHDataServiceImpl.java +++ b/GetDataInterface/src/main/java/com/nmggs/query/service/impl/ZDYHDataServiceImpl.java @@ -13,10 +13,16 @@ 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.EquipmentStatistics; +import com.nmggs.query.entity.fx.FatigueVehicle; +import com.nmggs.query.entity.fx.FenceInfo; +import com.nmggs.query.entity.fx.HiddenDangerAreaInfo; 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.EquipmentStatisticsMapper; +import com.nmggs.query.mapper.fx.FatigueVehicleMapper; +import com.nmggs.query.mapper.fx.FenceInfoMapper; +import com.nmggs.query.mapper.fx.HiddenDangerAreaInfoMapper; import com.nmggs.query.mapper.fx.UseInfoMapper; import com.nmggs.query.mapper.fx.WarningInfoMapper; import com.nmggs.query.service.ZDYHDataService; @@ -44,6 +50,12 @@ public class ZDYHDataServiceImpl implements ZDYHDataService { private WarningInfoMapper warningInfoMapper; @Resource private EquipmentStatisticsMapper equipmentStatisticsMapper; + @Resource + private FatigueVehicleMapper fatigueVehicleMapper; + @Resource + private FenceInfoMapper fenceInfoMapper; + @Resource + private HiddenDangerAreaInfoMapper hiddenDangerAreaInfoMapper; /** * 接收重点隐患车辆设备信息 @@ -219,6 +231,179 @@ 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 getFenceData(Map 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)); + // 将解密后的数据解析为 FenceInfo 列表 + List infoList = JSON.parseArray(decryptedData, FenceInfo.class); + int updateCount = 0; + int insertCount = 0; + if (infoList != null && infoList.size() > 0) { + for (FenceInfo info : infoList) { + String fenceid = info.getFenceid(); + String pilenumber = info.getPilenumber(); + info.setUpdatetime(new Date()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("fenceid", fenceid) + .eq("pilenumber",pilenumber); + boolean exists = fenceInfoMapper.exists(queryWrapper); + if (exists) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("fenceid", fenceid) + .eq("pilenumber",pilenumber); + fenceInfoMapper.update(info, updateWrapper); + updateCount++; + } else { + fenceInfoMapper.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 + @ExecutionTimeLogger + public Result getHiddenDangerAreaData(Map 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)); + // 将解密后的数据解析为 HiddenDangerAreaInfo 列表 + List infoList = JSON.parseArray(decryptedData, HiddenDangerAreaInfo.class); + int updateCount = 0; + int insertCount = 0; + if (infoList != null && infoList.size() > 0) { + for (HiddenDangerAreaInfo info : infoList) { + String fenceid = info.getFenceid(); + String pilenumber = info.getPilenumber(); + info.setUpdatetime(new Date()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper + .eq("fenceid", fenceid) + .eq("pilenumber", pilenumber) + .eq("classdate", info.getClassdate()); + boolean exists = hiddenDangerAreaInfoMapper.exists(queryWrapper); + if (exists) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper + .eq("fenceid", fenceid) + .eq("pilenumber", pilenumber) + .eq("classdate", info.getClassdate()); + hiddenDangerAreaInfoMapper.update(info, updateWrapper); + updateCount++; + } else { + hiddenDangerAreaInfoMapper.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 + @ExecutionTimeLogger + public Result getFatigueData(Map 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)); + // 将解密后的数据解析为 FatigueVehicle 列表 + List infoList = JSON.parseArray(decryptedData, FatigueVehicle.class); + int updateCount = 0; + int insertCount = 0; + if (infoList != null && infoList.size() > 0) { + for (FatigueVehicle info : infoList) { + String plateno = info.getPlateno(); + Integer vehicletype = info.getVehicletype(); + Integer datatype = info.getDatatype(); + String enforcementtime = info.getEnforcementtime(); + info.setInserttime(new Date()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper + .eq("plateno", plateno) + .eq("vehicletype", vehicletype) + .eq("datatype", datatype) + .eq("enforcementtime", enforcementtime); + boolean exists = fatigueVehicleMapper.exists(queryWrapper); + if (exists) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper + .eq("plateno", plateno) + .eq("vehicletype", vehicletype) + .eq("datatype", datatype) + .eq("enforcementtime", enforcementtime); + fatigueVehicleMapper.update(info, updateWrapper); + updateCount++; + } else { + fatigueVehicleMapper.insert(info); + insertCount++; + } + } + } + log.info("[uuid:{}]-接收重点隐患车辆违法车辆数据完成,更新数量:{},插入数量:{}", uuid, updateCount, insertCount); + + return Result.success("接收数据成功"); + } + + + private String conversionJson(Map map, String uuid) { String result = ""; // 使用ObjectMapper将List>转换为JSON字符串 diff --git a/GetDataInterface/src/main/resources/version/1.0.2.txt b/GetDataInterface/src/main/resources/version/1.0.4.txt similarity index 82% rename from GetDataInterface/src/main/resources/version/1.0.2.txt rename to GetDataInterface/src/main/resources/version/1.0.4.txt index c32fce2..211081b 100644 --- a/GetDataInterface/src/main/resources/version/1.0.2.txt +++ b/GetDataInterface/src/main/resources/version/1.0.4.txt @@ -12,3 +12,7 @@ 同时增加返回json进行SM4加密,文件也进行SM4加密 2 2025年09月10日 1.0.1 修改通过堡垒机转发相关请求 3 2025年09月28日 1.0.2 增加ETC 门架计费扣费交易数据上传接口/DCPC/uploadEtcGantryPassData +4 2025年09月29日 1.0.3 mobile_weigh_info增加StaName字段 +5 2025年10月10日 1.0.4 增加重点隐患车辆电子围栏接口/ZDYH/getFenceData + 隐患区域数据接口/ZDYH/getHiddenDangerAreaData + 违法车辆数据接口/ZDYH/getFatigueData