Browse Source

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

develop
wangsixiang 1 year ago
parent
commit
aa2d3e6fc0
  1. 8
      ruoyi-admin/src/main/resources/application-druid.yml
  2. 4
      zc-business/pom.xml
  3. 43
      zc-business/src/main/java/com/zc/business/controller/DcRampController.java
  4. 15
      zc-business/src/main/java/com/zc/business/controller/VideoController.java
  5. 14
      zc-business/src/main/java/com/zc/business/domain/DcEvent.java
  6. 6
      zc-business/src/main/java/com/zc/business/domain/DcEventAccident.java
  7. 121
      zc-business/src/main/java/com/zc/business/domain/DcEventConstruction.java
  8. 8
      zc-business/src/main/java/com/zc/business/domain/DcEventTrafficCongestion.java
  9. 9
      zc-business/src/main/java/com/zc/business/domain/DcEventVehicleAccident.java
  10. 1
      zc-business/src/main/java/com/zc/business/domain/DcRamp.java
  11. 194
      zc-business/src/main/java/com/zc/business/domain/MdDeviceData.java
  12. 17
      zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java
  13. 33
      zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java
  14. 7
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  15. 33
      zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java
  16. 9
      zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java
  17. 43
      zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java
  18. 15
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  19. 17
      zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java
  20. 71
      zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java
  21. 10
      zc-business/src/main/resources/mapper/business/DcEventAccidentMapper.xml
  22. 17
      zc-business/src/main/resources/mapper/business/DcEventConstructionMapper.xml
  23. 3
      zc-business/src/main/resources/mapper/business/DcEventMapper.xml
  24. 17
      zc-business/src/main/resources/mapper/business/DcEventTrafficCongestionMapper.xml
  25. 23
      zc-business/src/main/resources/mapper/business/DcEventVehicleAccidentMapper.xml
  26. 38
      zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml
  27. 40
      zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml

8
ruoyi-admin/src/main/resources/application-druid.yml

@ -15,10 +15,10 @@ spring:
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
enabled: true
url: jdbc:mysql://10.168.56.204:3306/jihe-md?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: root
password: Platform123!@#
# 初始连接数
initialSize: 5
# 最小连接池数量

4
zc-business/pom.xml

@ -39,6 +39,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
</dependency>
</dependencies>
<groupId>com.zc</groupId>
<version>1.0.0</version>

43
zc-business/src/main/java/com/zc/business/controller/DcRampController.java

@ -5,6 +5,8 @@ import javax.servlet.http.HttpServletResponse;
import com.zc.business.domain.DcRamp;
import com.zc.business.service.IDcRampService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -29,6 +31,8 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @author ruoyi
* @date 2024-01-12
*/
@Api(value = "匝道信息",tags = {"匝道信息"})
@RestController
@RequestMapping("/system/ramp")
public class DcRampController extends BaseController
@ -39,18 +43,33 @@ public class DcRampController extends BaseController
/**
* 查询匝道信息列表
*/
@PreAuthorize("@ss.hasPermi('system:ramp:list')")
@ApiOperation("查询匝道信息列表")
//@PreAuthorize("@ss.hasPermi('system:ramp:list')")
@GetMapping("/list")
public TableDataInfo list(DcRamp dcRamp)
{
startPage();
List<DcRamp> list = dcRampService.selectDcRampList(dcRamp);
return getDataTable(list);
} /**
* 无分页查询匝道信息列表
*/
@ApiOperation("无分页查询匝道信息列表")
//@PreAuthorize("@ss.hasPermi('system:ramp:list')")
@GetMapping("/listAll")
public TableDataInfo listAll(DcRamp dcRamp)
{
List<DcRamp> list = dcRampService.selectDcRampList(dcRamp);
return getDataTable(list);
}
/**
* 根据设施类型 查询匝道信息列表
*/
// @PreAuthorize("@ss.hasPermi('system:ramp:list')")
@ApiOperation("根据设施类型 查询匝道信息列表")
// @PreAuthorize("@ss.hasPermi('system:ramp:list')")
@GetMapping("/listAll/{type}")
public TableDataInfo listAll(@PathVariable("type") Long type)
{
@ -61,7 +80,9 @@ public class DcRampController extends BaseController
/**
* 导出匝道信息列表
*/
@PreAuthorize("@ss.hasPermi('system:ramp:export')")
@ApiOperation("导出匝道信息列表")
// @PreAuthorize("@ss.hasPermi('system:ramp:export')")
@Log(title = "匝道信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DcRamp dcRamp)
@ -74,7 +95,9 @@ public class DcRampController extends BaseController
/**
* 获取匝道信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:ramp:query')")
@ApiOperation("获取匝道信息详细信息")
// @PreAuthorize("@ss.hasPermi('system:ramp:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
@ -84,7 +107,9 @@ public class DcRampController extends BaseController
/**
* 新增匝道信息
*/
@PreAuthorize("@ss.hasPermi('system:ramp:add')")
@ApiOperation("新增匝道信息")
// @PreAuthorize("@ss.hasPermi('system:ramp:add')")
@Log(title = "匝道信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcRamp dcRamp)
@ -95,7 +120,9 @@ public class DcRampController extends BaseController
/**
* 修改匝道信息
*/
@PreAuthorize("@ss.hasPermi('system:ramp:edit')")
@ApiOperation("修改匝道信息")
// @PreAuthorize("@ss.hasPermi('system:ramp:edit')")
@Log(title = "匝道信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcRamp dcRamp)
@ -106,7 +133,9 @@ public class DcRampController extends BaseController
/**
* 删除匝道信息
*/
@PreAuthorize("@ss.hasPermi('system:ramp:remove')")
@ApiOperation("删除匝道信息")
// @PreAuthorize("@ss.hasPermi('system:ramp:remove')")
@Log(title = "匝道信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)

15
zc-business/src/main/java/com/zc/business/controller/VideoController.java

@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.zc.business.domain.DcDevice;
import com.zc.business.service.IDcDeviceService;
import com.zc.business.service.IMiddleDatabaseService;
import com.zc.common.core.httpclient.OkHttp;
import com.zc.common.core.httpclient.exception.HttpException;
import com.zc.common.core.httpclient.request.RequestParams;
@ -59,6 +60,9 @@ public class VideoController extends BaseController {
@Resource
private IDcDeviceService iDcDeviceService;
@Resource
private IMiddleDatabaseService middleDatabaseService;
/**
* 查询附近相机
*/
@ -137,6 +141,10 @@ public class VideoController extends BaseController {
}
iDcDeviceService.batchUpdate(list);
//更新中间库的设备状态
middleDatabaseService.updateMiddleDatabaseDeviceByList(list);
logger.debug("执行:同步数据平台视频设备的设备状态成功!!");
}
@ -153,6 +161,10 @@ public class VideoController extends BaseController {
dcDevices.add(dcDevice);
}
iDcDeviceService.batchUpdate(dcDevices);
//更新中间库的设备状态
middleDatabaseService.updateMiddleDatabaseDeviceByList(dcDevices);
logger.debug("执行:同步物联平台设备的设备状态成功!!");
}
@ -168,6 +180,9 @@ public class VideoController extends BaseController {
LambdaQueryWrapper<DcDevice> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DcDevice::getIotDeviceId, dcDevice.getIotDeviceId());
iDcDeviceService.update(dcDevice, queryWrapper);
//更新中间库的设备状态
middleDatabaseService.updateMiddleDatabaseDevice(dcDevice);
}
logger.debug("执行:同步广播设备的设备状态成功!!");

14
zc-business/src/main/java/com/zc/business/domain/DcEvent.java

@ -40,8 +40,10 @@ public class DcEvent extends BaseEntity {
* 所属部门
*/
@ApiModelProperty("所属部门")
@Excel(name = "所属部门")
private Long deptId;
@Excel(name = "所属部门")
private String deptName;
/**
* 所在桩号
*/
@ -59,7 +61,8 @@ public class DcEvent extends BaseEntity {
* 2-
* 3-
*/
@Excel(name = "方向")
@Excel(name = "方向", readConverterExp = "1=上行,3=下行")
//@Excel(name = "方向")
@ApiModelProperty("方向")
private String direction;
/**
@ -196,10 +199,10 @@ public class DcEvent extends BaseEntity {
/**
* 是否处在隧道
*/
@Excel(name = "是否处在隧道")
@Excel(name = "是否处在隧道" , readConverterExp = "0=否,1=是")
@ApiModelProperty("是否处在隧道 0 表示 false,1 表示 true")
private Integer inTunnel;
@Excel(name = "高速")
//@Excel(name = "高速")
@ApiModelProperty("高速公路")
private Long roadId;
@ -210,9 +213,10 @@ public class DcEvent extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("发生时间")
private Date occurrenceTime;
@Excel(name = "是否是感知事件")
@Excel(name = "是否是感知事件" , readConverterExp = "0=否,1=是")
@ApiModelProperty("是否是感知事件 0 表示 false,1 表示 true")
private Integer isPerceived;
@Excel(name = "影响车道")
@ApiModelProperty("影响车道 车道占用:0-应急1-行1,2-行2,3-行3,4-行4")
private String lang;

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

@ -222,9 +222,13 @@ public class DcEventAccident extends BaseEntity {
* 设施关联
*/
@ApiModelProperty("设施关联")
private Integer facilityId;
@ApiModelProperty("匝道")
private Integer rampId;
@ApiModelProperty("地点")
private String location;
@ApiModelProperty("事件信息实体")
//事件信息表
@TableField(exist = false)

121
zc-business/src/main/java/com/zc/business/domain/DcEventConstruction.java

@ -1,20 +1,18 @@
package com.zc.business.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 施工建设事件
"施工分类"为事件事件子类对象 dc_event_construction
* <p>
* "施工分类"为事件事件子类对象 dc_event_construction
*
* @author ruoyi
* @date 2024-01-12
@ -23,77 +21,104 @@ import com.ruoyi.common.core.domain.BaseEntity;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DcEventConstruction extends BaseEntity
{
public class DcEventConstruction extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("事件编号")
@ApiModelProperty("事件编号")
/** 事件编号 */
private String id;
/** 管制方式
1-封闭
2-不封闭 */
@ApiModelProperty("管制方式")
/**
* 管制方式
* 1-封闭
* 2-不封闭
*/
@ApiModelProperty("管制方式")
private Long controlMode;
/** 地点类型
1-单点
2-多点 */
@ApiModelProperty("地点类型:1-单点2-多点")
/**
* 地点类型
* 1-单点
* 2-多点
*/
@ApiModelProperty("地点类型:1-单点2-多点")
private Long locationType;
/** 特殊地点描述 */
/**
* 特殊地点描述
*/
@Excel(name = "特殊地点描述")
@ApiModelProperty("特殊地点描述")
private String specialPlaceDescription;
/** 专项施工
1-专项工程施工
2-改扩建专项工程施工
3-桥梁专项工程施工
4-其他专项工程施工 */
@ApiModelProperty(" 专项施工:1-专项工程施工2-改扩建专项工程施工3-桥梁专项工程施工\4-其他专项工程施工 ")
/**
* 专项施工
* 1-专项工程施工
* 2-改扩建专项工程施工
* 3-桥梁专项工程施工
* 4-其他专项工程施工
*/
@ApiModelProperty(" 专项施工:1-专项工程施工2-改扩建专项工程施工3-桥梁专项工程施工\4-其他专项工程施工 ")
private Long specialConstruction;
/** 其他施工名称 */
/**
* 其他施工名称
*/
@Excel(name = "其他施工名称")
@ApiModelProperty("其他施工名称")
private String otherConstructionName;
/** 施工措施
0-
1-并道行驶
2-临时保通
3-借路侧服务区通行 */
@ApiModelProperty("施工措施 0-无1-并道行驶2-临时保通3-借路侧服务区通行")
/**
* 施工措施
* 0-
* 1-并道行驶
* 2-临时保通
* 3-借路侧服务区通行
*/
@ApiModelProperty("施工措施 0-无1-并道行驶2-临时保通3-借路侧服务区通行")
private Long constructionMeasurement;
/** 字段名称对应
互通立交
收费站
服务区
*/
@ApiModelProperty("字段名称对应:互通立交 收费站 服务区")
/**
* 字段名称对应
* 互通立交
* 收费站
* 服务区
*/
@ApiModelProperty("字段名称对应:互通立交 收费站 服务区")
private Long facilityId;
/** 出入口收费站/服务区
1-出口
2-入口 */
/**
* 出入口收费站/服务区
* 1-出口
* 2-入口
*/
@ApiModelProperty(" 出入口(收费站/服务区):1-出口 2-入口 ")
@Excel(name = "出入口", readConverterExp = "收=费站/服务区")
private Long exitsInlets;
/** 占用车道
*/
@ApiModelProperty("占用车道")
/**
* 占用车道
*/
@ApiModelProperty("占用车道")
private String laneOccupancy;
/** 通行情况
1-通行正常
2-通行受阻 */
@ApiModelProperty("通行情况:1-通行正常 2-通行受阻")
/**
* 通行情况
* 1-通行正常
* 2-通行受阻
*/
@ApiModelProperty("通行情况:1-通行正常 2-通行受阻")
private Long trafficCondition;
@ApiModelProperty("匝道")
private Long rampId;
@ApiModelProperty("施工方式")
private Long constructionMethod;
@ApiModelProperty("地方道路名称")
private String localRoadName;
@ApiModelProperty("结束桩号")
private String endStakeMark;
@ApiModelProperty("地点")
private String location;
@ApiModelProperty("事件信息实体")
//事件信息表

8
zc-business/src/main/java/com/zc/business/domain/DcEventTrafficCongestion.java

@ -75,6 +75,14 @@ public class DcEventTrafficCongestion extends BaseEntity
@ApiModelProperty("地点(收费站):1-入口 2-出口 3-入口内广场 4--出口内广场5-外广场6-入口车道7-出口车道8-入口匝道9-出口匝道 ")
private Long location;
@ApiModelProperty("详细原因")
private Integer detailedReasons;
@ApiModelProperty("地点类型")
private Integer locationType;
@ApiModelProperty("地点描述")
private String locationDescription;
@ApiModelProperty("事件信息实体")
//事件信息表

9
zc-business/src/main/java/com/zc/business/domain/DcEventVehicleAccident.java

@ -114,6 +114,15 @@ public class DcEventVehicleAccident extends BaseEntity
/** 私密事件 */
@ApiModelProperty( "私密事件")
private Integer isPrivate;
@ApiModelProperty("设施关联")
private Integer facilityId;
@ApiModelProperty("匝道")
private Integer rampId;
@ApiModelProperty("地点")
private String location;
@ApiModelProperty("事件信息实体")
//事件信息表

1
zc-business/src/main/java/com/zc/business/domain/DcRamp.java

@ -48,6 +48,7 @@ public class DcRamp extends BaseEntity
@ApiModelProperty("匝道宽度(米)")
private Long widthMeters;
public void setId(Long id)
{
this.id = id;

194
zc-business/src/main/java/com/zc/business/domain/MdDeviceData.java

@ -0,0 +1,194 @@
package com.zc.business.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
/**
* @Description 中间库设备数据
*
* @author liuwenge
* @date 2024/2/20 17:30
*/
public class MdDeviceData {
/** 主键 */
private Long id;
/** 设备编号 */
@Excel(name = "设备编号")
private String devNo;
/** 设备类型 */
@Excel(name = "设备类型")
private String devType;
/** 时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date timeStamp;
/** 自定义字段 */
@Excel(name = "自定义字段")
private String expands;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date creationTime;
/** 创建人 */
@Excel(name = "创建人")
private String creatorUserId;
/** 最后修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "最后修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lastModificationTime;
/** 最后修改人 */
@Excel(name = "最后修改人")
private Long lastModifierUserId;
/** 是否删除 */
@Excel(name = "是否删除")
private Integer isDeleted;
/** 删除人 */
@Excel(name = "删除人")
private Long deleterUserId;
/** 删除时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date deletionTime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDevNo(String devNo)
{
this.devNo = devNo;
}
public String getDevNo()
{
return devNo;
}
public String getDevType() {
return devType;
}
public void setDevType(String devType) {
this.devType = devType;
}
public void setTimeStamp(Date timeStamp)
{
this.timeStamp = timeStamp;
}
public Date getTimeStamp()
{
return timeStamp;
}
public void setExpands(String expands)
{
this.expands = expands;
}
public String getExpands()
{
return expands;
}
public void setCreationTime(Date creationTime)
{
this.creationTime = creationTime;
}
public Date getCreationTime()
{
return creationTime;
}
public void setCreatorUserId(String creatorUserId)
{
this.creatorUserId = creatorUserId;
}
public String getCreatorUserId()
{
return creatorUserId;
}
public void setLastModificationTime(Date lastModificationTime)
{
this.lastModificationTime = lastModificationTime;
}
public Date getLastModificationTime()
{
return lastModificationTime;
}
public void setLastModifierUserId(Long lastModifierUserId)
{
this.lastModifierUserId = lastModifierUserId;
}
public Long getLastModifierUserId()
{
return lastModifierUserId;
}
public void setIsDeleted(Integer isDeleted)
{
this.isDeleted = isDeleted;
}
public Integer getIsDeleted()
{
return isDeleted;
}
public void setDeleterUserId(Long deleterUserId)
{
this.deleterUserId = deleterUserId;
}
public Long getDeleterUserId()
{
return deleterUserId;
}
public void setDeletionTime(Date deletionTime)
{
this.deletionTime = deletionTime;
}
public Date getDeletionTime()
{
return deletionTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("devNo", getDevNo())
.append("timeStamp", getTimeStamp())
.append("expands", getExpands())
.append("creationTime", getCreationTime())
.append("creatorUserId", getCreatorUserId())
.append("lastModificationTime", getLastModificationTime())
.append("lastModifierUserId", getLastModifierUserId())
.append("isDeleted", getIsDeleted())
.append("deleterUserId", getDeleterUserId())
.append("deletionTime", getDeletionTime())
.toString();
}
}

17
zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java

@ -2,6 +2,7 @@ package com.zc.business.mapper;
import java.util.List;
import com.zc.business.domain.DcMeteorologicalDetectorData;
import com.zc.business.domain.MdDeviceData;
/**
* 气象检测器数据Mapper接口
@ -43,22 +44,6 @@ public interface DcMeteorologicalDetectorDataMapper
*/
int updateDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
/**
* 中间库新增气象检测器数据
*
* @param dcMeteorologicalDetectorData 气象检测器数据
* @return 结果
*/
Boolean insertIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
/**
* 中间库修改气象检测器数据
*
* @param dcMeteorologicalDetectorData 气象检测器数据
* @return 结果
*/
Boolean updateIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
/**
* 删除气象检测器数据
*

33
zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java

@ -0,0 +1,33 @@
package com.zc.business.mapper;
import com.zc.business.domain.DcBoardReleaseLog;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.MdDeviceData;
import java.util.List;
/**
* 中间库Mapper接口
*
* @author ruoyi
* @date 2024-01-05
*/
public interface MiddleDatabaseMapper
{
/**
* 中间库新增设备数据
*
* @param mdDeviceData 气象检测器数据
* @return 结果
*/
Boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData);
/**
* 更新中间库设备
*
* @param dcDevice 设备
* @return 结果
*/
boolean updateMiddleDatabaseDevice(DcDevice dcDevice);
}

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

@ -13,6 +13,7 @@ import com.zc.business.enums.WarningStateEnum;
import com.zc.business.enums.WarningSubclassEnum;
import com.zc.business.service.IDcDeviceService;
import com.zc.business.service.IDcWarningService;
import com.zc.business.service.IMiddleDatabaseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@ -42,6 +43,9 @@ public class DeviceMessageHandler {
@Resource
private IDcWarningService dcWarningService;
@Resource
private IMiddleDatabaseService middleDatabaseService;
@Resource
private RedisCache redisCache;
@ -65,6 +69,9 @@ public class DeviceMessageHandler {
// 批量更新设备状态
dcDeviceService.batchUpdate(dcDevices);
// 批量更新中间库设备状态
middleDatabaseService.updateMiddleDatabaseDeviceByList(dcDevices);
}
/**

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

@ -1,11 +1,14 @@
package com.zc.business.message.device.listener;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.DcMeteorologicalDetectorData;
import com.zc.business.domain.MdDeviceData;
import com.zc.business.enums.IotProductEnum;
import com.zc.business.service.IDcMeteorologicalDetectorDataService;
import com.zc.business.service.IMiddleDatabaseService;
import com.zc.common.core.redis.stream.RedisStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -17,6 +20,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -36,6 +40,8 @@ public class DevicePropertyReportListener implements StreamListener<String, Obje
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Autowired
private IDcMeteorologicalDetectorDataService meteorologicalDetectorDataService;
@Autowired
private IMiddleDatabaseService middleDatabaseService;
@Override
public void onMessage(ObjectRecord<String, String> message) {
@ -53,8 +59,31 @@ public class DevicePropertyReportListener implements StreamListener<String, Obje
meteorologicalDetectorData.setIotDeviceId(data.get("deviceId").toString());
meteorologicalDetectorDataService.insertDcMeteorologicalDetectorData(meteorologicalDetectorData);
//设计院中间库
meteorologicalDetectorDataService.insertIntermediateWarehouseData(meteorologicalDetectorData);
//设计院中间库 插入设备数据
MdDeviceData mdDeviceData = new MdDeviceData();
mdDeviceData.setDevNo(meteorologicalDetectorData.getIotDeviceId());
mdDeviceData.setDevType("3");
mdDeviceData.setTimeStamp(new Date());
mdDeviceData.setCreatorUserId("自动存储");
Map<String,Object> expands = new HashMap<>();
expands.put("rainFall",meteorologicalDetectorData.getRainfall()); //雨量
expands.put("windSpeed",meteorologicalDetectorData.getWindSpeed()); //风速
expands.put("windDirection",meteorologicalDetectorData.getWindDirection()); //风向
expands.put("temperature",meteorologicalDetectorData.getTemperature()); //大气温度
expands.put("humidity",meteorologicalDetectorData.getHumidity()); //大气湿度
expands.put("airPressure",meteorologicalDetectorData.getAtmosphericPressure()); //数字气压
expands.put("wet",meteorologicalDetectorData.getWetSlipperyCoefficient()); //湿滑
expands.put("rainXingTai",meteorologicalDetectorData.getPrecipitationType()); //雨量降水形态
expands.put("visibility",meteorologicalDetectorData.getVisibility()); //能见度
expands.put("pathContactLu",meteorologicalDetectorData.getRoadSurfaceTemperature()); //路面温度
expands.put("pathContactBing",meteorologicalDetectorData.getFreezingPointTemperature()); //冰点温度
expands.put("pathContactYan",meteorologicalDetectorData.getSalinityValue()); //路面盐度
expands.put("pathContactZhuang",meteorologicalDetectorData.getRemoteRoadSurfaceStatus()); //路面状况
mdDeviceData.setExpands(JSONObject.toJSONString(expands));
middleDatabaseService.insertMiddleDatabaseDeviceData(mdDeviceData);
} else if (IotProductEnum.ONE_STOP_PRODUCT.value().equals(productId)){
//交调

9
zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java

@ -2,6 +2,7 @@ package com.zc.business.service;
import java.util.List;
import com.zc.business.domain.DcMeteorologicalDetectorData;
import com.zc.business.domain.MdDeviceData;
/**
* 气象检测器数据Service接口
@ -35,14 +36,6 @@ public interface IDcMeteorologicalDetectorDataService
*/
int insertDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
/**
* 中间库新增气象检测器数据
*
* @param dcMeteorologicalDetectorData 气象检测器数据
* @return 结果
*/
boolean insertIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
/**
* 修改气象检测器数据
*

43
zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java

@ -0,0 +1,43 @@
package com.zc.business.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcBoardPublish;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.MdDeviceData;
import java.util.List;
/**
* 中间库Service接口
*
* @author ruoyi
* @date 2024-01-03
*/
public interface IMiddleDatabaseService
{
/**
* 中间库新增设备数据
*
* @param mdDeviceData 气象检测器数据
* @return 结果
*/
boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData);
/**
* 批量更新中间库设备
*
* @param listDevice 设备列表
* @return 结果
*/
boolean updateMiddleDatabaseDeviceByList(List<DcDevice> listDevice);
/**
* 更新中间库设备
*
* @param device 设备
* @return 结果
*/
boolean updateMiddleDatabaseDevice(DcDevice device);
}

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

@ -8,6 +8,7 @@ import java.util.Map;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysDeptService;
import com.zc.business.domain.*;
import com.zc.business.mapper.*;
import com.zc.business.service.IDcEventService;
@ -54,6 +55,9 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
private DcProcessConfigMapper dcProcessConfigMapper;
@Autowired
private DcWarningMapper dcWarningMapper;
//部门信息
@Autowired
private ISysDeptService deptService;
@ -89,6 +93,16 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
String replace1 = dcEvent.getEndStakeMark().replace(" ", "+");
dcEvent.setEndStakeMark(replace1);
}
List<DcEvent> dcEventList = dcEventMapper.selectDcEventList(dcEvent);
for (DcEvent dcEvents : dcEventList) {
// 根据 deptId 获取部门名称
Long deptId = dcEvents.getDeptId();
String deptName = deptService.selectDeptById(deptId).getDeptName();
// 将部门名称赋值给 deptName 字段
dcEvents.setDeptName(deptName);
}
return dcEventMapper.selectDcEventList(dcEvent);
}
@ -112,6 +126,7 @@ dcEvent.setDeptId(SecurityUtils.getDeptId());
//用户
dcEvent.setUserId(SecurityUtils.getUserId());
dcEvent.setCreateTime(DateUtils.getNowDate());
int i7 = dcEventMapper.insertDcEvent(dcEvent);

17
zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java

@ -5,6 +5,7 @@ import java.util.List;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.MdDeviceData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zc.business.mapper.DcMeteorologicalDetectorDataMapper;
@ -59,22 +60,6 @@ public class DcMeteorologicalDetectorDataServiceImpl implements IDcMeteorologica
return dcMeteorologicalDetectorDataMapper.insertDcMeteorologicalDetectorData(dcMeteorologicalDetectorData);
}
/**
* 中间库新增气象检测器数据
*
* @param dcMeteorologicalDetectorData 气象检测器数据
* @return 结果
*/
@DataSource(value = DataSourceType.SLAVE)//切换数据源
@Override
public boolean insertIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData)
{
if (!dcMeteorologicalDetectorDataMapper.updateIntermediateWarehouseData(dcMeteorologicalDetectorData)){
return dcMeteorologicalDetectorDataMapper.insertIntermediateWarehouseData(dcMeteorologicalDetectorData);
}
return false;
}
/**
* 修改气象检测器数据
*

71
zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java

@ -0,0 +1,71 @@
package com.zc.business.service.impl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.MdDeviceData;
import com.zc.business.mapper.MiddleDatabaseMapper;
import com.zc.business.service.IMiddleDatabaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 中间库Service业务层处理
*
* @author ruoyi
* @date 2024-01-03
*/
@Service
public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService {
@Autowired
private MiddleDatabaseMapper middleDatabaseMapper;
/**
* 中间库新增设备数据
*
* @param mdDeviceData 气象检测器数据
* @return 结果
*/
@DataSource(value = DataSourceType.SLAVE)//切换数据源
@Override
public boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData)
{
return middleDatabaseMapper.insertMiddleDatabaseDeviceData(mdDeviceData);
}
/**
* 批量更新中间库设备
*
* @param listDevice 设备列表
* @return 结果
*/
@DataSource(value = DataSourceType.SLAVE)//切换数据源
@Override
public boolean updateMiddleDatabaseDeviceByList(List<DcDevice> listDevice)
{
for (DcDevice dcDevice : listDevice) {
middleDatabaseMapper.updateMiddleDatabaseDevice(dcDevice);
}
return true;
}
/**
* 更新中间库设备
*
* @param device 设备
* @return 结果
*/
@DataSource(value = DataSourceType.SLAVE)//切换数据源
@Override
public boolean updateMiddleDatabaseDevice(DcDevice device)
{
return middleDatabaseMapper.updateMiddleDatabaseDevice(device);
}
}

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

@ -30,10 +30,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="fatalities" column="fatalities" />
<result property="isPrivate" column="is_private" />
<result property="facilityId" column="facility_id" />
<result property="rampId" column="ramp_id" />
<result property="location" column="location" />
</resultMap>
<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, 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,location,ramp_id from dc_event_accident
</sql>
<select id="selectDcEventAccidentList" parameterType="DcEventAccident" resultMap="DcEventAccidentResult">
@ -101,6 +103,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fatalities != null">fatalities,</if>
<if test="isPrivate != null">is_private,</if>
<if test="facilityId != null">facility_id,</if>
<if test="rampId != null">ramp_id,</if>
<if test="location != null">location,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -129,6 +133,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fatalities != null">#{fatalities},</if>
<if test="isPrivate != null">#{isPrivate},</if>
<if test="facilityId != null">#{facilityId},</if>
<if test="location != null">#{location},</if>
<if test="rampId != null">#{rampId},</if>
</trim>
</insert>
@ -160,6 +166,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fatalities != null">fatalities = #{fatalities},</if>
<if test="isPrivate != null">is_private = #{isPrivate},</if>
<if test="facilityId != null">facility_id = #{facilityId},</if>
<if test="rampId != null">ramp_id = #{rampId},</if>
<if test="location != null">location = #{location},</if>
</trim>
where id = #{id}
</update>

17
zc-business/src/main/resources/mapper/business/DcEventConstructionMapper.xml

@ -16,6 +16,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="exitsInlets" column="exits_inlets" />
<result property="laneOccupancy" column="lane_occupancy" />
<result property="trafficCondition" column="traffic_condition" />
<result property="endStakeMark" column="end_stake_mark" />
<result property="localRoadName" column="local_road_name" />
<result property="location" column="location" />
<result property="dcFacility.facilityName" column="facility_name" />
<result property="dcFacility.facilityType" column="facility_type" />
@ -26,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDcEventConstructionVo">
select id, control_mode, location_type, special_place_description, special_construction, other_construction_name, construction_measurement, facility_id, exits_inlets, lane_occupancy, traffic_condition from dc_event_construction
select location,local_road_name,end_stake_mark,id, control_mode, location_type, special_place_description, special_construction, other_construction_name, construction_measurement, facility_id, exits_inlets, lane_occupancy, traffic_condition from dc_event_construction
</sql>
<sql id="selectDcEventConstructionVoById">
SELECT
@ -41,6 +44,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dc_event_construction.exits_inlets as exits_inlets,
dc_event_construction.lane_occupancy as lane_occupancy,
dc_event_construction.traffic_condition as traffic_condition,
dc_event_construction.local_road_name as local_road_name,
dc_event_construction.end_stake_mark as end_stake_mark,
dc_event_construction.location as location,
dc_facility.other_config as other_config,
dc_facility.remark as remark,
dc_facility.stake_mark as stake_mark,
@ -86,6 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="exitsInlets != null">exits_inlets,</if>
<if test="laneOccupancy != null">lane_occupancy,</if>
<if test="trafficCondition != null">traffic_condition,</if>
<if test="endStakeMark != null">end_stake_mark,</if>
<if test="localRoadName != null">local_road_name,</if>
<if test="location != null">location,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -99,6 +108,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="exitsInlets != null">#{exitsInlets},</if>
<if test="laneOccupancy != null">#{laneOccupancy},</if>
<if test="trafficCondition != null">#{trafficCondition},</if>
<if test="endStakeMark != null">#{endStakeMark},</if>
<if test="localRoadName != null">#{localRoadName},</if>
<if test="location != null">#{location},</if>
</trim>
</insert>
@ -115,6 +127,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="exitsInlets != null">exits_inlets = #{exitsInlets},</if>
<if test="laneOccupancy != null">lane_occupancy = #{laneOccupancy},</if>
<if test="trafficCondition != null">traffic_condition = #{trafficCondition},</if>
<if test="endStakeMark != null">end_stake_mark = #{endStakeMark},</if>
<if test="localRoadName != null">local_road_name = #{localRoadName},</if>
<if test="location != null">location = #{location},</if>
</trim>
where id = #{id}
</update>

3
zc-business/src/main/resources/mapper/business/DcEventMapper.xml

@ -246,7 +246,8 @@
event_source_tips,
occurrence_time,
in_tunnel,
road_id
road_id,
lang
FROM
dc_event
LEFT JOIN sys_user on dc_event.user_id = sys_user.user_id

17
zc-business/src/main/resources/mapper/business/DcEventTrafficCongestionMapper.xml

@ -12,6 +12,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="rampId" column="ramp_id" />
<result property="location" column="location" />
<result property="maxCongestionMileage" column="max_congestion_mileage" />
<result property="locationDescription" column="location_description" />
<result property="locationType" column="location_type" />
<result property="detailedReasons" column="detailed_reasons" />
<result property="dcFacility.facilityName" column="facility_name" />
<result property="dcFacility.facilityType" column="facility_type" />
@ -23,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDcEventTrafficCongestionVo">
select id, congestion_mileage, congestion_cause, facility_id, ramp_id, location,max_congestion_mileage from dc_event_traffic_congestion
select location_type,location_description,detailed_reasons,id, congestion_mileage, congestion_cause, facility_id, ramp_id, location,max_congestion_mileage from dc_event_traffic_congestion
</sql>
<!-- -->
<sql id="selectDcEventTrafficCongestionVoById">
@ -35,6 +38,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dc_event_traffic_congestion.location as location,
dc_event_traffic_congestion.ramp_id as ramp_id,
dc_event_traffic_congestion.max_congestion_mileage as max_congestion_mileage,
dc_event_traffic_congestion.location_type as location_type,
dc_event_traffic_congestion.location_description as location_description,
dc_event_traffic_congestion.detailed_reasons as detailed_reasons,
dc_facility.other_config as other_config,
dc_facility.remark as remark,
@ -72,6 +78,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rampId != null">ramp_id,</if>
<if test="location != null">location,</if>
<if test="maxCongestionMileage != null">max_congestion_mileage,</if>
<if test="locationDescription != null">location_description,</if>
<if test="locationType != null">location_type,</if>
<if test="detailedReasons != null">detailed_reasons,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -81,6 +90,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rampId != null">#{rampId},</if>
<if test="location != null">#{location},</if>
<if test="maxCongestionMileage != null">#{maxCongestionMileage},</if>
<if test="locationDescription != null">#{locationDescription},</if>
<if test="locationType != null">#{locationType},</if>
<if test="detailedReasons != null">#{detailedReasons},</if>
</trim>
</insert>
@ -93,6 +105,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rampId != null">ramp_id = #{rampId},</if>
<if test="location != null">location = #{location},</if>
<if test="maxCongestionMileage != null">max_congestion_mileage = #{maxCongestionMileage},</if>
<if test="locationDescription != null">location_description = #{locationDescription},</if>
<if test="locationType != null">location_type = #{locationType},</if>
<if test="detailedReasons != null">detailed_reasons = #{detailedReasons},</if>
</trim>
where id = #{id}
</update>

23
zc-business/src/main/resources/mapper/business/DcEventVehicleAccidentMapper.xml

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcEventVehicleAccidentMapper">
<resultMap type="DcEventVehicleAccident" id="DcEventVehicleAccidentResult">
<resultMap type="com.zc.business.domain.DcEventVehicleAccident" id="DcEventVehicleAccidentResult">
<result property="id" column="id" />
<result property="reporterName" column="reporter_name" />
<result property="reporterPhoneNumber" column="reporter_phone_number" />
@ -14,7 +14,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="congestionAhead" column="congestion_ahead" />
<result property="atIntersection" column="at_intersection" />
<result property="onCurve" column="on_curve" />
<result property="laneOccupancy" column="lane_occupancy" />
<result property="smallCar" column="small_car" />
<result property="trucks" column="trucks" />
<result property="buses" column="buses" />
@ -23,10 +22,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="seriousInjuries" column="serious_injuries" />
<result property="fatalities" column="fatalities" />
<result property="isPrivate" column="is_private" />
<result property="location" column="location" />
<result property="rampId" column="ramp_id" />
<result property="facilityId" column="facility_id" />
</resultMap>
<sql id="selectDcEventVehicleAccidentVo">
select id, reporter_name, reporter_phone_number, location_type, traffic_jam, weather_condition, congestion_ahead, at_intersection, on_curve, lane_occupancy, small_car, trucks, buses, tankers, minor_injuries, serious_injuries, fatalities, is_private from dc_event_vehicle_accident
select location,ramp_id,facility_id, id, reporter_name, reporter_phone_number, location_type, traffic_jam, weather_condition, congestion_ahead, at_intersection, on_curve, small_car, trucks, buses, tankers, minor_injuries, serious_injuries, fatalities, is_private from dc_event_vehicle_accident
</sql>
<select id="selectDcEventVehicleAccidentList" parameterType="DcEventVehicleAccident" resultMap="DcEventVehicleAccidentResult">
@ -40,7 +44,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="congestionAhead != null "> and congestion_ahead = #{congestionAhead}</if>
<if test="atIntersection != null "> and at_intersection = #{atIntersection}</if>
<if test="onCurve != null "> and on_curve = #{onCurve}</if>
<if test="laneOccupancy != null "> and lane_occupancy = #{laneOccupancy}</if>
<if test="smallCar != null "> and small_car = #{smallCar}</if>
<if test="trucks != null "> and trucks = #{trucks}</if>
<if test="buses != null "> and buses = #{buses}</if>
@ -69,7 +72,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="congestionAhead != null">congestion_ahead,</if>
<if test="atIntersection != null">at_intersection,</if>
<if test="onCurve != null">on_curve,</if>
<if test="laneOccupancy != null">lane_occupancy,</if>
<if test="smallCar != null">small_car,</if>
<if test="trucks != null">trucks,</if>
<if test="buses != null">buses,</if>
@ -78,6 +80,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="seriousInjuries != null">serious_injuries,</if>
<if test="fatalities != null">fatalities,</if>
<if test="isPrivate != null">is_private,</if>
<if test="location != null">location,</if>
<if test="rampId != null">ramp_id,</if>
<if test="facilityId != null">facility_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -89,7 +94,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="congestionAhead != null">#{congestionAhead},</if>
<if test="atIntersection != null">#{atIntersection},</if>
<if test="onCurve != null">#{onCurve},</if>
<if test="laneOccupancy != null">#{laneOccupancy},</if>
<if test="smallCar != null">#{smallCar},</if>
<if test="trucks != null">#{trucks},</if>
<if test="buses != null">#{buses},</if>
@ -98,6 +102,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="seriousInjuries != null">#{seriousInjuries},</if>
<if test="fatalities != null">#{fatalities},</if>
<if test="isPrivate != null">#{isPrivate},</if>
<if test="location != null">#{location},</if>
<if test="rampId != null">#{rampId},</if>
<if test="facilityId != null">#{facilityId},</if>
</trim>
</insert>
@ -112,7 +119,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="congestionAhead != null">congestion_ahead = #{congestionAhead},</if>
<if test="atIntersection != null">at_intersection = #{atIntersection},</if>
<if test="onCurve != null">on_curve = #{onCurve},</if>
<if test="laneOccupancy != null">lane_occupancy = #{laneOccupancy},</if>
<if test="smallCar != null">small_car = #{smallCar},</if>
<if test="trucks != null">trucks = #{trucks},</if>
<if test="buses != null">buses = #{buses},</if>
@ -121,6 +127,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="seriousInjuries != null">serious_injuries = #{seriousInjuries},</if>
<if test="fatalities != null">fatalities = #{fatalities},</if>
<if test="isPrivate != null">is_private = #{isPrivate},</if>
<if test="location != null">location = #{location},</if>
<if test="rampId != null">ramp_id = #{rampId},</if>
<if test="facilityId != null">facility_id = #{facilityId},</if>
</trim>
where id = #{id}
</update>

38
zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml

@ -146,44 +146,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<insert id="insertIntermediateWarehouseData" parameterType="DcMeteorologicalDetectorData" useGeneratedKeys="true" keyProperty="id">
insert into meteorological_detector_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="iotDeviceId != null">device_id,</if>
<if test="temperature != null">temperature,</if>
<if test="humidity != null">humidity,</if>
<if test="precipitationType != null">precipitation_type,</if>
<if test="rainfall != null">rainfall,</if>
<if test="roadSurfaceStatus != null">road_surface_status,</if>
<if test="waterFilmThickness != null">water_film_thickness,</if>
update_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="iotDeviceId != null">#{iotDeviceId},</if>
<if test="temperature != null">#{temperature},</if>
<if test="humidity != null">#{humidity},</if>
<if test="precipitationType != null">#{precipitationType},</if>
<if test="rainfall != null">#{rainfall},</if>
<if test="roadSurfaceStatus != null">#{roadSurfaceStatus},</if>
<if test="waterFilmThickness != null">#{waterFilmThickness},</if>
current_date
</trim>
</insert>
<update id="updateIntermediateWarehouseData" parameterType="DcMeteorologicalDetectorData">
update meteorological_detector_data
<trim prefix="SET" suffixOverrides=",">
<if test="temperature != null">temperature = #{temperature},</if>
<if test="humidity != null">humidity = #{humidity},</if>
<if test="precipitationType != null">precipitation_type = #{precipitationType},</if>
<if test="rainfall != null">rainfall = #{rainfall},</if>
<if test="roadSurfaceStatus != null">road_surface_status = #{roadSurfaceStatus},</if>
<if test="waterFilmThickness != null">water_film_thickness = #{waterFilmThickness},</if>
update_time = current_date
</trim>
where device_id = #{iotDeviceId}
</update>
<delete id="deleteDcMeteorologicalDetectorDataById" parameterType="Long">
delete from dc_meteorological_detector_data where id = #{id}
</delete>

40
zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.MiddleDatabaseMapper">
<insert id="insertMiddleDatabaseDeviceData" parameterType="MdDeviceData" useGeneratedKeys="true" keyProperty="id">
insert into device_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="devNo != null">devNo,</if>
<if test="devType != null">devType,</if>
<if test="timeStamp != null">`timeStamp`,</if>
<if test="expands != null">expands,</if>
<if test="creatorUserId != null">CreatorUserId,</if>
<if test="lastModificationTime != null">LastModificationTime,</if>
<if test="lastModifierUserId != null">LastModifierUserId,</if>
<if test="isDeleted != null">IsDeleted,</if>
<if test="deleterUserId != null">DeleterUserId,</if>
<if test="deletionTime != null">DeletionTime,</if>
CreationTime
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="devNo != null">#{devNo},</if>
<if test="devType != null">#{devType},</if>
<if test="timeStamp != null">#{timeStamp},</if>
<if test="expands != null">#{expands},</if>
<if test="creatorUserId != null">#{creatorUserId},</if>
<if test="lastModificationTime != null">#{lastModificationTime},</if>
<if test="isDeleted != null">#{isDeleted},</if>
<if test="deleterUserId != null">#{deleterUserId},</if>
<if test="deletionTime != null">#{deletionTime},</if>
current_date
</trim>
</insert>
<update id="updateMiddleDatabaseDevice">
update device set dev_status = #{deviceState} where dev_no = #{iotDeviceId}
</update>
</mapper>
Loading…
Cancel
Save