Browse Source

Merge branch 'develop' of http://39.106.31.193:9211/mengff/jihe-dc into develop

develop
lau572 1 year ago
parent
commit
70ccb50395
  1. 2
      zc-business/src/main/java/com/zc/business/domain/DcEventAccident.java
  2. 14
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  3. 3
      zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java
  4. 4
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  5. 7
      zc-business/src/main/resources/mapper/business/DcEventAccidentMapper.xml

2
zc-business/src/main/java/com/zc/business/domain/DcEventAccident.java

@ -158,9 +158,11 @@ public class DcEventAccident extends BaseEntity {
* 3-行3 * 3-行3
* 4-行4 * 4-行4
*/ */
/*
@ApiModelProperty("车道占用") @ApiModelProperty("车道占用")
private Long laneOccupancy; private Long laneOccupancy;
*/
/** /**
* 小型车() * 小型车()

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

@ -1,6 +1,7 @@
package com.zc.business.message.device.handler; package com.zc.business.message.device.handler;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.zc.business.constant.RedisKeyConstants; import com.zc.business.constant.RedisKeyConstants;
@ -14,6 +15,7 @@ import com.zc.business.service.IDcDeviceService;
import com.zc.business.service.IDcWarningService; import com.zc.business.service.IDcWarningService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -39,6 +41,9 @@ public class DeviceMessageHandler {
@Resource @Resource
private RedisCache redisCache; private RedisCache redisCache;
@Value("${iot.address}")
private String iotAddress;
/** /**
* 更新设备状态 * 更新设备状态
* *
@ -128,6 +133,15 @@ public class DeviceMessageHandler {
dcWarning.setDeptId(dcDevice.getGroupId()); dcWarning.setDeptId(dcDevice.getGroupId());
} }
JSONArray pictures = data.getJSONArray("pictures");
List<String> pictureList = pictures.stream().map(picture -> (iotAddress + "/profile" + picture)).collect(Collectors.toList());
JSONObject otherConfig = new JSONObject();
otherConfig.put("pictures", pictureList);
dcWarning.setOtherConfig(otherConfig.toString());
dcWarningService.insertDcWarning(dcWarning); dcWarningService.insertDcWarning(dcWarning);
} }

3
zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java

@ -24,6 +24,7 @@ import java.util.Map;
/** /**
* 设备属性上报消息监听 * 设备属性上报消息监听
*/ */
@Component @Component
public class DevicePropertyReportListener implements StreamListener<String, ObjectRecord<String, String>> public class DevicePropertyReportListener implements StreamListener<String, ObjectRecord<String, String>>
{ {
@ -62,5 +63,7 @@ public class DevicePropertyReportListener implements StreamListener<String, Obje
}); });
// 消费完后直接删除消息 // 消费完后直接删除消息
redisStream.del(streamKay, String.valueOf(recordId)); redisStream.del(streamKay, String.valueOf(recordId));
} }
} }

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

@ -109,8 +109,12 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
dcEvent.setEventState(0L); dcEvent.setEventState(0L);
//获取部门信息 //获取部门信息
dcEvent.setDeptId(SecurityUtils.getDeptId()); dcEvent.setDeptId(SecurityUtils.getDeptId());
//用户
dcEvent.setUserId(SecurityUtils.getUserId());
dcEvent.setCreateTime(DateUtils.getNowDate()); dcEvent.setCreateTime(DateUtils.getNowDate());
int i7 = dcEventMapper.insertDcEvent(dcEvent); int i7 = dcEventMapper.insertDcEvent(dcEvent);
if (i7>0){ if (i7>0){
//获取事件类型 //获取事件类型
int eventType = Math.toIntExact(dcEvent.getEventType()); int eventType = Math.toIntExact(dcEvent.getEventType());

7
zc-business/src/main/resources/mapper/business/DcEventAccidentMapper.xml

@ -21,7 +21,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="onCurve" column="on_curve" /> <result property="onCurve" column="on_curve" />
<result property="spillageItem" column="spillage_item" /> <result property="spillageItem" column="spillage_item" />
<result property="vehicleOwnerPhone" column="vehicle_owner_phone" /> <result property="vehicleOwnerPhone" column="vehicle_owner_phone" />
<result property="laneOccupancy" column="lane_occupancy" />
<result property="smallCar" column="small_car" /> <result property="smallCar" column="small_car" />
<result property="trucks" column="trucks" /> <result property="trucks" column="trucks" />
<result property="buses" column="buses" /> <result property="buses" column="buses" />
@ -34,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectDcEventAccidentVo"> <sql id="selectDcEventAccidentVo">
select id, reporter_name, reporter_phone_number, accident_type, location_type, traffic_jam, weather_condition, impact_level, is_reverse_cargo, is_maintenance, police_contact, towing_service_contact, congestion_ahead, at_intersection, on_curve, spillage_item, vehicle_owner_phone, lane_occupancy, small_car, trucks, buses, tankers, minor_injuries, serious_injuries, fatalities, is_private, facility_id from dc_event_accident select id, reporter_name, reporter_phone_number, accident_type, location_type, traffic_jam, weather_condition, impact_level, is_reverse_cargo, is_maintenance, police_contact, towing_service_contact, congestion_ahead, at_intersection, on_curve, spillage_item, vehicle_owner_phone, small_car, trucks, buses, tankers, minor_injuries, serious_injuries, fatalities, is_private, facility_id from dc_event_accident
</sql> </sql>
<select id="selectDcEventAccidentList" parameterType="DcEventAccident" resultMap="DcEventAccidentResult"> <select id="selectDcEventAccidentList" parameterType="DcEventAccident" resultMap="DcEventAccidentResult">
@ -56,7 +55,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="onCurve != null "> and on_curve = #{onCurve}</if> <if test="onCurve != null "> and on_curve = #{onCurve}</if>
<if test="spillageItem != null and spillageItem != ''"> and spillage_item = #{spillageItem}</if> <if test="spillageItem != null and spillageItem != ''"> and spillage_item = #{spillageItem}</if>
<if test="vehicleOwnerPhone != null and vehicleOwnerPhone != ''"> and vehicle_owner_phone = #{vehicleOwnerPhone}</if> <if test="vehicleOwnerPhone != null and vehicleOwnerPhone != ''"> and vehicle_owner_phone = #{vehicleOwnerPhone}</if>
<if test="laneOccupancy != null "> and lane_occupancy = #{laneOccupancy}</if>
<if test="smallCar != null "> and small_car = #{smallCar}</if> <if test="smallCar != null "> and small_car = #{smallCar}</if>
<if test="trucks != null "> and trucks = #{trucks}</if> <if test="trucks != null "> and trucks = #{trucks}</if>
<if test="buses != null "> and buses = #{buses}</if> <if test="buses != null "> and buses = #{buses}</if>
@ -94,7 +92,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="onCurve != null">on_curve,</if> <if test="onCurve != null">on_curve,</if>
<if test="spillageItem != null">spillage_item,</if> <if test="spillageItem != null">spillage_item,</if>
<if test="vehicleOwnerPhone != null">vehicle_owner_phone,</if> <if test="vehicleOwnerPhone != null">vehicle_owner_phone,</if>
<if test="laneOccupancy != null">lane_occupancy,</if>
<if test="smallCar != null">small_car,</if> <if test="smallCar != null">small_car,</if>
<if test="trucks != null">trucks,</if> <if test="trucks != null">trucks,</if>
<if test="buses != null">buses,</if> <if test="buses != null">buses,</if>
@ -123,7 +120,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="onCurve != null">#{onCurve},</if> <if test="onCurve != null">#{onCurve},</if>
<if test="spillageItem != null">#{spillageItem},</if> <if test="spillageItem != null">#{spillageItem},</if>
<if test="vehicleOwnerPhone != null">#{vehicleOwnerPhone},</if> <if test="vehicleOwnerPhone != null">#{vehicleOwnerPhone},</if>
<if test="laneOccupancy != null">#{laneOccupancy},</if>
<if test="smallCar != null">#{smallCar},</if> <if test="smallCar != null">#{smallCar},</if>
<if test="trucks != null">#{trucks},</if> <if test="trucks != null">#{trucks},</if>
<if test="buses != null">#{buses},</if> <if test="buses != null">#{buses},</if>
@ -155,7 +151,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="onCurve != null">on_curve = #{onCurve},</if> <if test="onCurve != null">on_curve = #{onCurve},</if>
<if test="spillageItem != null">spillage_item = #{spillageItem},</if> <if test="spillageItem != null">spillage_item = #{spillageItem},</if>
<if test="vehicleOwnerPhone != null">vehicle_owner_phone = #{vehicleOwnerPhone},</if> <if test="vehicleOwnerPhone != null">vehicle_owner_phone = #{vehicleOwnerPhone},</if>
<if test="laneOccupancy != null">lane_occupancy = #{laneOccupancy},</if>
<if test="smallCar != null">small_car = #{smallCar},</if> <if test="smallCar != null">small_car = #{smallCar},</if>
<if test="trucks != null">trucks = #{trucks},</if> <if test="trucks != null">trucks = #{trucks},</if>
<if test="buses != null">buses = #{buses},</if> <if test="buses != null">buses = #{buses},</if>

Loading…
Cancel
Save