Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 5 months ago
parent
commit
e4a2d6fb6b
  1. 2
      ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
  2. 14
      zc-business/src/main/java/com/zc/business/constant/RedisStreamConstants.java
  3. 117
      zc-business/src/main/java/com/zc/business/controller/DcNoStakeWarningTableController.java
  4. 12
      zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java
  5. 32
      zc-business/src/main/java/com/zc/business/domain/DcNoStakeWarningTable.java
  6. 6
      zc-business/src/main/java/com/zc/business/domain/DcTrafficPolice.java
  7. 64
      zc-business/src/main/java/com/zc/business/enums/CauseTypeEnum.java
  8. 191
      zc-business/src/main/java/com/zc/business/enums/EventTypesEnum.java
  9. 2529
      zc-business/src/main/java/com/zc/business/enums/UniversalEnum.java
  10. 77
      zc-business/src/main/java/com/zc/business/enums/WeatherEventEnum.java
  11. 14
      zc-business/src/main/java/com/zc/business/mapper/DcNoStakeWarningTableMapper.java
  12. 49
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  13. 63
      zc-business/src/main/java/com/zc/business/service/IDcNoStakeWarningTableService.java
  14. 1
      zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java
  15. 10
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  16. 123
      zc-business/src/main/java/com/zc/business/service/impl/DcNoStakeWarningTableServiceImpl.java
  17. 6
      zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java
  18. 11
      zc-business/src/main/java/com/zc/business/utils/QYWXUtil.java

2
ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java

@ -75,7 +75,7 @@ public class RedisCache
*/
public Long getExpire(final String key)
{
return redisTemplate.getExpire(key);
return redisTemplate.getExpire(key,TimeUnit.SECONDS);
}
/**

14
zc-business/src/main/java/com/zc/business/constant/RedisStreamConstants.java

@ -10,7 +10,7 @@ public class RedisStreamConstants {
*/
public static class DeviceOnline {
public final static String KEY = "device:online";
public final static String GROUP = "group1";
public final static String GROUP = "group2";
public final static String CONSUMER = "consumer1";
}
@ -19,7 +19,7 @@ public class RedisStreamConstants {
*/
public static class DeviceOffline {
public final static String KEY = "device:offline";
public final static String GROUP = "group1";
public final static String GROUP = "group2";
public final static String CONSUMER = "consumer1";
}
@ -28,7 +28,7 @@ public class RedisStreamConstants {
*/
public static class DeviceEvent {
public final static String KEY = "device:event";
public final static String GROUP = "group1";
public final static String GROUP = "group2";
public final static String CONSUMER = "consumer1";
}
@ -37,7 +37,7 @@ public class RedisStreamConstants {
*/
public static class DevicePropertyReport {
public final static String KEY = "device:property:report";
public final static String GROUP = "group1";
public final static String GROUP = "group2";
public final static String CONSUMER = "consumer1";
}
@ -46,7 +46,7 @@ public class RedisStreamConstants {
*/
public static class DevicePropertyReadReply {
public final static String KEY = "device:property:read:reply";
public final static String GROUP = "group1";
public final static String GROUP = "group2";
public final static String CONSUMER = "consumer1";
}
@ -56,7 +56,7 @@ public class RedisStreamConstants {
*/
public static class DevicePropertyWriteReply {
public final static String KEY = "device:property:write:reply";
public final static String GROUP = "group1";
public final static String GROUP = "group2";
public final static String CONSUMER = "consumer1";
}
@ -65,7 +65,7 @@ public class RedisStreamConstants {
*/
public static class DeviceFunctionReply {
public final static String KEY = "device:function:reply";
public final static String GROUP = "group1";
public final static String GROUP = "group2";
public final static String CONSUMER = "consumer1";
}

117
zc-business/src/main/java/com/zc/business/controller/DcNoStakeWarningTableController.java

@ -0,0 +1,117 @@
package com.zc.business.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.zc.business.domain.DcFacility;
import com.zc.business.domain.DcNoStakeWarningTable;
import com.zc.business.service.IDcFacilityService;
import com.zc.business.service.IDcNoStakeWarningTableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/**
* 无桩号预警Controller
*
* @author zhaoxianglong
*/
@Api(tags = {"无桩号预警"})
@RestController
@RequestMapping("/business/facility")
public class DcNoStakeWarningTableController extends BaseController {
@Resource
private IDcNoStakeWarningTableService dcNoStakeWarningTableService;
//*********************************路网设施增删改查******************************************
/**
* 分页查询无桩号预警列表
*
* @param dcNoStakeWarningTable 请求参数
* @return 分页查询结果
*/
@ApiOperation("分页查询路网设施列表")
@PreAuthorize("@ss.hasPermi('iot:facility:list')")
@GetMapping("list")
public TableDataInfo listFacility(DcNoStakeWarningTable dcNoStakeWarningTable) {
return getDataTable(dcNoStakeWarningTableService.pageDcNoStakeWarningTable(dcNoStakeWarningTable));
}
/**
* 无分页查询无桩号预警列表
*
* @param dcNoStakeWarningTable 请求参数
* @return 查询结果
*/
@ApiOperation("无分页查询路网设施列表")
@PreAuthorize("@ss.hasPermi('iot:facility:query')")
@GetMapping("query")
public AjaxResult queryFacility(DcNoStakeWarningTable dcNoStakeWarningTable) {
return AjaxResult.success(dcNoStakeWarningTableService.listDcNoStakeWarningTable(dcNoStakeWarningTable));
}
/**
* 根据id查询无桩号预警信息
*
* @param id id
* @return 查询结果
*/
@ApiOperation("根据id查询路网设施信息")
@PreAuthorize("@ss.hasPermi('iot:facility:query')")
@GetMapping("{id}")
public AjaxResult getFacility(@PathVariable String id) {
return AjaxResult.success(dcNoStakeWarningTableService.getDcNoStakeWarningTable(id));
}
/**
* 新增
*
* @param dcNoStakeWarningTable 新增参数
* @return 新增操作结果
*/
@ApiOperation("新增")
@PreAuthorize("@ss.hasPermi('iot:facility:add')")
@Log(title = "新增路网设施", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult addFacility(@Valid @RequestBody DcNoStakeWarningTable dcNoStakeWarningTable) {
return toAjax(dcNoStakeWarningTableService.addDcNoStakeWarningTable(dcNoStakeWarningTable));
}
/**
* 修改
*
* @param dcNoStakeWarningTable 修改参数
* @return 修改操作结果
*/
@ApiOperation("修改")
@PreAuthorize("@ss.hasPermi('iot:facility:edit')")
@Log(title = "修改路网设施", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult editFacility(@Valid @RequestBody DcNoStakeWarningTable dcNoStakeWarningTable) {
return toAjax(dcNoStakeWarningTableService.editDcNoStakeWarningTable(dcNoStakeWarningTable));
}
/**
* 删除
*
* @param ids id集
* @return 删除操作结果
*/
@ApiOperation("删除")
@PreAuthorize("@ss.hasPermi('iot:facility:remove')")
@Log(title = "删除", businessType = BusinessType.DELETE)
@DeleteMapping("{ids}")
public AjaxResult removeFacility(@PathVariable List<String> ids) {
return toAjax(dcNoStakeWarningTableService.removeDcNoStakeWarningTable(ids));
}
}

12
zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java

@ -399,5 +399,17 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD
// 将查询结果封装为成功响应并返回
return AjaxResult.success(mapList);
}
/**
* 全路段双向实时车流量
* @param startDate 时间
* @param direction 方向
*/
@ApiOperation("集团双向实时车流量")
@GetMapping("/history/realTimeTrafficFlowHour2")
public AjaxResult realTimeTrafficFlowHour2(String startDate,Long direction) throws HttpException, IOException{
JSONArray mapList = dcTrafficStatisticsService.realTimeTrafficFlowHour2(startDate,direction);
// 将查询结果封装为成功响应并返回
return AjaxResult.success(mapList);
}
}

32
zc-business/src/main/java/com/zc/business/domain/DcNoStakeWarningTable.java

@ -0,0 +1,32 @@
package com.zc.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel(value = "DcNoStakeWarningTable", description = "无桩号预警实体")
public class DcNoStakeWarningTable {
@ApiModelProperty("ID")
@Excel(name = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty("预警描述")
@Excel(name = "预警描述")
private Long warningDescription;
@ApiModelProperty("预警类型")
@Excel(name = "预警类型", readConverterExp = "1=交通流预警,2=气象预警")
private String warningType;
@ApiModelProperty("创建时间")
@Excel(name = "创建时间")
private Date createTime;
@ApiModelProperty("预警时间")
@Excel(name = "预警时间")
private Date warningTime;
}

6
zc-business/src/main/java/com/zc/business/domain/DcTrafficPolice.java

@ -24,7 +24,7 @@ public class DcTrafficPolice extends BaseEntity
/** $column.columnComment */
@ApiModelProperty("名称")
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
@Excel(name = "名称")
private String name;
@ApiModelProperty("电话")
/** 电话 */
@ -32,12 +32,12 @@ public class DcTrafficPolice extends BaseEntity
private String phone;
@ApiModelProperty("开始桩号")
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
@Excel(name = "起始桩号")
private String stakeMake;
/** $column.columnComment */
@ApiModelProperty("结束桩号")
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
@Excel(name = "结束桩号")
private String endMake;
public void setId(Long id)

64
zc-business/src/main/java/com/zc/business/enums/CauseTypeEnum.java

@ -0,0 +1,64 @@
package com.zc.business.enums;
/**
* 情报板车道图标枚举
*
* @author
*/
public enum CauseTypeEnum {
//雨
THE_RAIN(3, "3-1", "雨"),
//雪
SNOW(3, "3-2", "雪"),
//雾
THE_FOG(3, "3-3", "雾"),
//道路积水
ROAD_WATER(3, "3-4", "道路积水"),
//道路湿滑
SLIPPERY_ROAD(3, "3-5", "道路湿滑"),
//道路结冰
ICY_ROADS(3, "3-6", "道路结冰"),
//沙尘暴
SANDSTORM(3, "3-7", "沙尘暴"),
// 专项工程施工
SPECIAL_PROJECT_CONSTRUCTION(4, "4-1", "专项工程施工"),
// 改扩建工程施工
RECONSTRUCTION_AND_EXPANSION_PROJECT_CONSTRUCTION(4, "4-2", "改扩建工程施工"),
// 其他施工
OTHER_CONSTRUCTION(4, "4-3", "其他施工");
private final int type;
private final String subtype;
private final String subtypeName;
CauseTypeEnum(int type, String subtype, String subtypeName) {
this.type = type;
this.subtype = subtype;
this.subtypeName = subtypeName;
}
public int getType() {
return type;
}
public String getSubtype() {
return subtype;
}
public String getSubtypeName() {
return subtypeName;
}
}

191
zc-business/src/main/java/com/zc/business/enums/EventTypesEnum.java

@ -0,0 +1,191 @@
package com.zc.business.enums;
/**
* 情报板车道图标枚举
*
* @author
*/
public enum EventTypesEnum {
// 追尾
REAR_END(1, "1-1", "追尾"),
// 侧翻
TURN_ON_ONE_S_SIDE(1, "1-2", "侧翻"),
// 撞护栏
CRASH_INTO_THE_BARRIER(1, "1-3", "撞护栏"),
// 自燃
SPONTANEOUS_COMBUSTION(1, "1-4", "自燃"),
// 其他事故
OTHER_ACCIDENTS(1, "1-5", "其他事故"),
// 车辆故障
VEHICLE_FAULT(2, "2-1", "车辆故障"),
//主线封闭和限行
THE_MAIN_LINE_IS_CLOSED_AND_RESTRICTED(3, "3-1", "主线封闭和限行"),
//收费站封闭和限行
TOLL_BOOTHS_ARE_CLOSED_AND_RESTRICTED(3, "3-2", "收费站封闭和限行"),
//立交封闭和限行
THE_INTERCHANGE_IS_CLOSED_AND_RESTRICTED(3, "3-3", "立交封闭和限行"),
//服务区封闭和限行
THE_SERVICE_AREA_IS_CLOSED_AND_RESTRICTED(3, "3-4", "服务区封闭和限行"),
// 道路拥堵
ROAD_CONGESTION(4, "4-1", "道路拥堵"),
// 立交拥堵
INTERCHANGE_CONGESTION(4, "4-2", "立交拥堵"),
// 收费站拥堵
TOLL_BOOTHS_ARE_CONGESTED(4, "4-3", "收费站拥堵"),
// 服务区拥堵
SERVICE_AREA_CONGESTION(4, "4-4", "服务区拥堵"),
// 行人
PEDESTRIAN(5, "5-1", "行人"),
// 非机动车
NON_MOTOR_VEHICLE(5, "5-2", "非机动车"),
// 摩托车
MOTORCYCLE(5, "5-3", "摩托车"),
// 其他
OTHER_FIVE_FOUR(5, "5-4", "其他"),
// 烟雾
SMOKE(6, "6-1", "烟雾"),
// 倒伏树木
FALLEN_TREE(6, "6-2", "倒伏树木"),
// 撒落物
OUTFALL(6, "6-3", "撒落物"),
// 动物
ZOON(6, "6-4", "动物"),
// 其他
OTHER_SIX_FIVE(6, "6-5", "其他"),
// 道路养护施工
ROAD_MAINTENANCE_CONSTRUCTION(7, "7-1", "道路养护施工"),
// 收费站养护施工
TOLL_STATION_MAINTENANCE_AND_CONSTRUCTION(7, "7-2", "收费站养护施工"),
// 服务区养护施工
MAINTENANCE_CONSTRUCTION_OF_SERVICE_AREA(7, "7-3", "服务区养护施工"),
// 枢纽立交匝道养护施工
MAINTENANCE_AND_CONSTRUCTION_OF_INTERCHANGE_RAMP(7, "7-4", "枢纽立交匝道养护施工"),
// 地方道路养护施工
LOCAL_ROAD_MAINTENANCE_CONSTRUCTION(7, "7-5", "地方道路养护施工"),
// 道路工程建设施工
ROAD_ENGINEERING_CONSTRUCTION(7, "7-6", "道路工程建设施工"),
// 收费站工程建设施工
TOLL_STATION_CONSTRUCTION(7, "7-7", "收费站工程建设施工"),
// 服务区工程建设施工
SERVICE_AREA_PROJECT_CONSTRUCTION(7, "7-8", "服务区工程建设施工"),
// 枢纽立交匝道工程建设施工
JUNCTION_INTERCHANGE_RAMP_PROJECT_CONSTRUCTION(7, "7-9", "枢纽立交匝道工程建设施工"),
// 地方道路工程建设施工
LOCAL_ROAD_ENGINEERING_CONSTRUCTION(7, "7-10", "地方道路工程建设施工"),
// 封闭
CLOSE(8, "8-1", "封闭、暂停营业"),
// 重要设施停用
SHUTDOWN_OF_CRITICAL_FACILITIES(8, "8-2", "重要设施停用"),
// 服务区其他异常
OTHERS_IN_THE_SERVICE_AREA_ARE_ABNORMAL(8, "8-3", "服务区其他异常"),
// 摄像机
CAMERA(9, "9-1", "摄像机"),
// 护栏
GUARDRAIL(9, "9-2", "护栏"),
// 隔离栅
ISOLATING_GRID(9, "9-3", "隔离栅"),
// 情报板
INTEL_BOARD(9, "9-4", "情报板"),
// 防炫板
ANTI_GLARE_PLATE(9, "9-5", "防炫板"),
// 其他
OTHER_NINE_SIX(9, "9-6", "其他"),
// 雨
THE_RAIN(1, "10-1", "雨"),
// 雪
SNOW(1, "10-2", "雪"),
// 雾
THE_FOG(1, "10-3", "雾"),
// 大风
GALE(1, "10-4", "大风"),
// 低温寒潮
LOW_TEMPERATURE_COLD_WAVE(1, "10-5", "低温寒潮"),
// 路面积雪
SNOW_ON_PAVEMENT(1, "10-6", "路面积雪"),
// 路面结冰
ICY_ROAD(1, "10-7", "路面结冰"),
// 路面积水
ROAD_WATER(1, "10-8", "路面积水"),
// 其他
OTHER_TEN_TO_NINE(10, "10-9", "其他"),
// 其他事件
OTHER_EVENTS(11, "11-1", "其他事件");
private final int type;
private final String subtype;
private final String subtypeName;
EventTypesEnum(int type, String subtype, String subtypeName) {
this.type = type;
this.subtype = subtype;
this.subtypeName = subtypeName;
}
public int getType() {
return type;
}
public String getSubtype() {
return subtype;
}
public String getSubtypeName() {
return subtypeName;
}
}

2529
zc-business/src/main/java/com/zc/business/enums/UniversalEnum.java

File diff suppressed because it is too large

77
zc-business/src/main/java/com/zc/business/enums/WeatherEventEnum.java

@ -0,0 +1,77 @@
package com.zc.business.enums;
/**
* 情报板车道图标枚举
* @author
*/
public enum WeatherEventEnum {
//雨雾
RAIN_AND_FOG("1-1","雨雾"),
//雨雪
RAIN_AND_SNOW("1-2","雨雪"),
//中雨
MODERATE_RAIN("1-3","中雨"),
//小雨
SPIT("1-4","小雨"),
//大雨
HEAVY_RAIN("1-5","大雨"),
//暴雨
RAINSTORM("1-6","暴雨"),
//小雪
LIGHT_SNOW("2-1","小雪"),
//中雪
MODERATE_SNOW("2-2","中雪"),
//大雪
HEAVY_SNOW("2-3","大雪"),
//暴雪
BLIZZARD_TWO_FOUR("2-4","暴雪"),
//大暴雪
BLIZZARD_TWO_FIVE("2-5","大暴雪"),
//特大暴雪
HEAVY_SNOWSTORM("2-6","特大暴雪"),
//轻雾
MIST("3-1","轻雾"),
//大雾
HEAVY_FOG_THREE_TWO("3-2","大雾"),
//浓雾
FOG("3-3","浓雾"),
//强浓雾
HEAVY_FOG_THREE_FOUR("3-4","强浓雾"),
//团雾
AGGLOMERATE_FOG("3-5","团雾");
private final String code;
private final String value;
WeatherEventEnum(String value, String broadcastLogUrl) {
this.code = value;
this.value = broadcastLogUrl;
}
public String getCode() {
return this.code;
}
public String getValue() {
return value;
}
}

14
zc-business/src/main/java/com/zc/business/mapper/DcNoStakeWarningTableMapper.java

@ -0,0 +1,14 @@
package com.zc.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zc.business.domain.DcNoStakeWarningTable;
import org.apache.ibatis.annotations.Mapper;
/**
* 无桩号预警Mapper接口
*
* @author zhaoxianglong
*/
@Mapper
public interface DcNoStakeWarningTableMapper extends BaseMapper<DcNoStakeWarningTable> {
}

49
zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

@ -588,6 +588,7 @@ public class DeviceMessageHandler {
String stakeMark = strings[1];
String direction = strings[2];
//设备名称
meteorologicalDetectorData.setDeviceName(deviceName);
//位置
@ -595,25 +596,60 @@ public class DeviceMessageHandler {
//方向
meteorologicalDetectorData.setDirection(direction);
//todo 首页推送事件消息 3气象检测器
//todo 首页推送事件消息 气象检测器
if (!meteorologicalDetectorData.getPrecipitationType().equals("0")) {//降水类型 0=无降;1=雨;2=雪;3=毛毛雨;4=雨夹雪;
WebSocketService.broadcast(WebSocketEvent.WARNING, meteorologicalDetectorData);
String precipitationType ="";
if (meteorologicalDetectorData.getPrecipitationType().equals("1")){
precipitationType="发生降雨异常天气事件";
}if (meteorologicalDetectorData.getPrecipitationType().equals("2")){
precipitationType="发生降雪异常天气事件";
}if (meteorologicalDetectorData.getPrecipitationType().equals("3")){
precipitationType="发生毛毛雨异常天气事件";
}if (meteorologicalDetectorData.getPrecipitationType().equals("4")){
precipitationType="发生雨夹雪异常天气事件";
}
String content= direction+ stakeMark+precipitationType;
Map<String,Object> contentMap = new HashMap<>();
contentMap.put("content",content);
contentMap.put("event",meteorologicalDetectorData);
WebSocketService.broadcast(WebSocketEvent.WARNING, contentMap);
JSONObject object = new JSONObject();
object.put("meteorologicalDetectorData", meteorologicalDetectorData);
String string = object.toString();
DcWarning dcWarning = new DcWarning();
dcWarning.setStakeMark(meteorologicalDetectorData.getStakeMark());
dcWarning.setWarningSource(7);//气象检测器
dcWarning.setOtherConfig(string);
dcWarning.setWarningTitle("气象预警");
if (direction.equals("菏泽方向")){
dcWarning.setDirection("1");
}
if (direction.equals("济南方向")){
dcWarning.setDirection("3");
}
dcWarningService.insertDcWarning(dcWarning);
//待确认数量
dcEventService.getCountNum();
}
if (!meteorologicalDetectorData.getVisibilityType().equals("4")) {// 能见度类型,4 表示能见度良好3表示阴霾 2表示雾 1表示浓雾;
WebSocketService.broadcast(WebSocketEvent.WARNING, meteorologicalDetectorData);
String precipitationType ="";
if (meteorologicalDetectorData.getVisibilityType().equals("3")){
precipitationType="发生阴霾异常天气事件";
}if (meteorologicalDetectorData.getVisibilityType().equals("2")){
precipitationType="发生雾异常天气事件";
}if (meteorologicalDetectorData.getVisibilityType().equals("1")){
precipitationType="发生浓雾异常天气事件";
}
String content= direction+ stakeMark+precipitationType;
Map<String,Object> contentMap = new HashMap<>();
contentMap.put("content",content);
contentMap.put("event",meteorologicalDetectorData);
WebSocketService.broadcast(WebSocketEvent.WARNING, contentMap);
JSONObject object = new JSONObject();
object.put("meteorologicalDetectorData", meteorologicalDetectorData);
String string = object.toString();
@ -622,7 +658,12 @@ public class DeviceMessageHandler {
dcWarning.setWarningSource(7);//气象检测器
dcWarning.setOtherConfig(string);
dcWarning.setWarningTitle("气象预警");
if (direction.equals("菏泽方向")){
dcWarning.setDirection("1");
}
if (direction.equals("济南方向")){
dcWarning.setDirection("3");
}
dcWarningService.insertDcWarning(dcWarning);
//待确认数量

63
zc-business/src/main/java/com/zc/business/service/IDcNoStakeWarningTableService.java

@ -0,0 +1,63 @@
package com.zc.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zc.business.domain.DcNoStakeWarningTable;
import java.util.List;
/**
* 无桩号预警Service接口
*
* @author zhaoxianglong
*/
public interface IDcNoStakeWarningTableService extends IService<DcNoStakeWarningTable> {
/**
* 添加无桩号预警
*
* @param dcNoStakeWarningTable 设备信息
* @return 操作结果
*/
boolean addDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable);
/**
* 修改无桩号预警
*
* @param dcNoStakeWarningTable 设备信息
* @return 操作结果
*/
boolean editDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable);
/**
* 删除无桩号预警
*
* @param ids 设备ID
* @return 操作结果
*/
boolean removeDcNoStakeWarningTable(List<String> ids);
/**
* 获取无桩号预警列表
*
* @param dcNoStakeWarningTable 参数
* @return 结果
*/
List<DcNoStakeWarningTable> pageDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable);
/**
* 获取无桩号预警列表
*
* @param dcNoStakeWarningTable 参数
* @return 结果
*/
List<DcNoStakeWarningTable> listDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable);
/**
* 根据id查询设备信息
*
* @param id 设备ID
* @return 设备信息
*/
DcNoStakeWarningTable getDcNoStakeWarningTable(String id);
}

1
zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java

@ -53,5 +53,6 @@ public interface IDcTrafficStatisticsService {
List<Map<String, Object>> realTimeTrafficFlowHour(String startDate,Long direction) throws HttpException, IOException;
JSONArray realTimeTrafficFlowHour2(String startDate,Long direction) throws HttpException, IOException;
}

10
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -232,9 +232,10 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
case 1:
if (dcEvent.getDcEventAccident() != null) {
dcEvent.getDcEventAccident().setId(uuid);
int i1 = dcEventAccidentMapper.insertDcEventAccident(dcEvent.getDcEventAccident());
if (dcEvent.getEventState() == 1) {
updateDcEventState(uuid,1);//直接确认
}
}
break;
//车辆事故
@ -242,6 +243,9 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
if (dcEvent.getDcEventVehicleAccident() != null) {
dcEvent.getDcEventVehicleAccident().setId(uuid);
int i5 = dcEventVehicleAccidentMapper.insertDcEventVehicleAccident(dcEvent.getDcEventVehicleAccident());
if (dcEvent.getEventState() ==1) {
updateDcEventState(uuid,1);//直接确认
}
}
break;
//交通管制
@ -573,7 +577,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
contentMap.put("content", content);
contentMap.put("event", dcEvent);
WebSocketService.broadcast(WebSocketEvent.EVENT, contentMap); //推送事件消息 0不是感知事件
WebSocketService.broadcast(WebSocketEvent.EVENT, contentMap); //推送事件消息 0 不是感知事件
getCountNum();

123
zc-business/src/main/java/com/zc/business/service/impl/DcNoStakeWarningTableServiceImpl.java

@ -0,0 +1,123 @@
package com.zc.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.PageUtils;
import com.zc.business.domain.DcFacility;
import com.zc.business.domain.DcNoStakeWarningTable;
import com.zc.business.mapper.DcFacilityMapper;
import com.zc.business.mapper.DcNoStakeWarningTableMapper;
import com.zc.business.service.IDcFacilityService;
import com.zc.business.service.IDcNoStakeWarningTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 无桩号预警Service业务层处理
*
* @author zhaoxianglong
*/
@Service
public class DcNoStakeWarningTableServiceImpl extends ServiceImpl<DcNoStakeWarningTableMapper, DcNoStakeWarningTable> implements IDcNoStakeWarningTableService {
public LambdaQueryWrapper<DcNoStakeWarningTable> noStakeWarningTableQueryWrapper(DcNoStakeWarningTable dcNoStakeWarningTable) {
LambdaQueryWrapper<DcNoStakeWarningTable> queryWrapper = new LambdaQueryWrapper<>();
// 设备ID
if (Objects.nonNull(dcNoStakeWarningTable.getId())) {
queryWrapper.eq(DcNoStakeWarningTable::getId, dcNoStakeWarningTable.getId());
}
// 设备ID
if (Objects.nonNull(dcNoStakeWarningTable.getWarningDescription())) {
queryWrapper.eq(DcNoStakeWarningTable::getWarningDescription, dcNoStakeWarningTable.getWarningDescription());
}
// 设备ID
if (Objects.nonNull(dcNoStakeWarningTable.getWarningTime())) {
queryWrapper.eq(DcNoStakeWarningTable::getWarningTime, dcNoStakeWarningTable.getWarningTime());
}
// 设备ID
if (Objects.nonNull(dcNoStakeWarningTable.getWarningType())) {
queryWrapper.eq(DcNoStakeWarningTable::getWarningType, dcNoStakeWarningTable.getWarningType());
}
// 设备ID
if (Objects.nonNull(dcNoStakeWarningTable.getCreateTime())) {
queryWrapper.eq(DcNoStakeWarningTable::getCreateTime, dcNoStakeWarningTable.getCreateTime());
}
// 木桩
return queryWrapper;
}
@Override
public boolean addDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable) {
Long id = dcNoStakeWarningTable.getId();
if (Objects.nonNull(id)) {
DcNoStakeWarningTable noStakeWarningTable = getById(id);
if (noStakeWarningTable != null) {
throw new ServiceException("预警ID[" + id + "]已存在", HttpStatus.BAD_REQUEST);
}
}
dcNoStakeWarningTable.setCreateTime(new Date());
return save(dcNoStakeWarningTable);
}
@Override
public boolean editDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable) {
Long id = dcNoStakeWarningTable.getId();
// 检查设备id是否重复
DcNoStakeWarningTable noStakeWarningTable = getById(id);
if (Objects.isNull(noStakeWarningTable)) {
throw new ServiceException("预警ID[" + id + "]不存在", HttpStatus.BAD_REQUEST);
}
return updateById(dcNoStakeWarningTable);
}
@Override
public boolean removeDcNoStakeWarningTable(List<String> ids) {
return removeByIds(ids);
}
@Override
public List<DcNoStakeWarningTable> pageDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable) {
// 分页
PageUtils.startPage();
return list(noStakeWarningTableQueryWrapper(dcNoStakeWarningTable));
}
@Override
public List<DcNoStakeWarningTable> listDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable) {
return list(noStakeWarningTableQueryWrapper(dcNoStakeWarningTable));
}
@Override
public DcNoStakeWarningTable getDcNoStakeWarningTable(String id) {
// 检查设备id是否重复
DcNoStakeWarningTable dcNoStakeWarningTable = getById(id);
if (Objects.isNull(dcNoStakeWarningTable)) {
throw new ServiceException("预警ID[" + id + "]不存在", HttpStatus.BAD_REQUEST);
}
return getById(id);
}
}

6
zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java

@ -800,7 +800,7 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi
}
return "";
}
public List<Map<String, Object>> realTimeTrafficFlowHour2(String startDate,Long direction) throws HttpException, IOException {
public JSONArray realTimeTrafficFlowHour2(String startDate,Long direction) throws HttpException, IOException {
OkHttp okHttp = new OkHttp();
RequestParams requestParams = new RequestParams();
@ -859,10 +859,10 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi
// 输出结果
return list;
return jsonArray;
}
return new ArrayList();
return null;
}
}

11
zc-business/src/main/java/com/zc/business/utils/QYWXUtil.java

@ -95,8 +95,9 @@ public class QYWXUtil {
int iErrorCode = objJsonObject.getIntValue("errcode");
if (iErrorCode == 0) {
String strAccessToken = objJsonObject.getString("access_token");
Integer expiresIn = objJsonObject.getInteger("expires_in");
// 设置到redis里,目前的存活时间为120分钟(7200秒)
redisCache.setCacheObject(RedisKeyConstants.QYWX_ACCESS_TOKEN,strAccessToken,7200, TimeUnit.SECONDS);
redisCache.setCacheObject(RedisKeyConstants.QYWX_ACCESS_TOKEN,strAccessToken,expiresIn, TimeUnit.SECONDS);
return strAccessToken;
}
}
@ -137,11 +138,11 @@ public class QYWXUtil {
if (iErrorCode == 0) {
//返回用户id
return objJsonObject.getString("userid");
} else if (iErrorCode == 42001){
} else if (iErrorCode == 42001 || iErrorCode == 40014){
//access_token过期,重新获取
getAccessTokenByHttp();
//重新获取userId
getUserIdByMobile(mobile);
return getUserIdByMobile(mobile);
}
System.out.println("通过手机号获取userId失败! 错误码:" + iErrorCode + ", 错误信息:" + objJsonObject.getString("errmsg"));
}
@ -209,11 +210,11 @@ public class QYWXUtil {
result.put("code","1");
result.put("msg","发送企业微信消息成功!");
result.put("data",msgId);
} else if (iErrorCode == 42001){
} else if (iErrorCode == 42001 || iErrorCode == 40014){
//access_token过期,重新获取
getAccessTokenByHttp();
//重新发送文本消息
sendMessageByWxUserId(userId,content);
return sendMessageByWxUserId(userId,content);
} else {
result.put("code","0");
result.put("msg","发送企业微信消息失败!错误码:" + iErrorCode + ", 错误信息:" + objJsonObject.getString("errmsg"));

Loading…
Cancel
Save