diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/enums/ExceptionEnum.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/enums/ExceptionEnum.java
new file mode 100644
index 0000000..9bb7532
--- /dev/null
+++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/enums/ExceptionEnum.java
@@ -0,0 +1,102 @@
+package com.hnac.hzims.common.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.springblade.core.tool.api.IResultCode;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 异常码枚举类
+ */
+@Getter
+@AllArgsConstructor
+public enum ExceptionEnum implements IResultCode {
+
+ /**
+ * 操作成功
+ */
+ SUCCESS(HttpServletResponse.SC_OK, "操作成功"),
+
+ /**
+ * 业务异常
+ */
+ FAILURE(HttpServletResponse.SC_BAD_REQUEST, "业务异常"),
+
+ /**
+ * 请求未授权
+ */
+ UN_AUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "请求未授权"),
+
+ /**
+ * 客户端请求未授权
+ */
+ CLIENT_UN_AUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "客户端请求未授权"),
+
+ /**
+ * 404 没找到请求
+ */
+ NOT_FOUND(HttpServletResponse.SC_NOT_FOUND, "404 没找到请求"),
+
+ /**
+ * 消息不能读取
+ */
+ MSG_NOT_READABLE(HttpServletResponse.SC_BAD_REQUEST, "消息不能读取"),
+
+ /**
+ * 不支持当前请求方法
+ */
+ METHOD_NOT_SUPPORTED(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "不支持当前请求方法"),
+
+ /**
+ * 不支持当前媒体类型
+ */
+ MEDIA_TYPE_NOT_SUPPORTED(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "不支持当前媒体类型"),
+
+ /**
+ * 请求被拒绝
+ */
+ REQ_REJECT(HttpServletResponse.SC_FORBIDDEN, "请求被拒绝"),
+
+ /**
+ * 服务器异常
+ */
+ INTERNAL_SERVER_ERROR(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "服务器异常"),
+
+ /**
+ * 缺少必要的请求参数
+ */
+ PARAM_MISS(HttpServletResponse.SC_BAD_REQUEST, "缺少必要的请求参数"),
+
+ /**
+ * 请求参数类型错误
+ */
+ PARAM_TYPE_ERROR(HttpServletResponse.SC_BAD_REQUEST, "请求参数类型错误"),
+
+ /**
+ * 请求参数绑定错误
+ */
+ PARAM_BIND_ERROR(HttpServletResponse.SC_BAD_REQUEST, "请求参数绑定错误"),
+
+ /**
+ * 参数校验失败
+ */
+ PARAM_VALID_ERROR(HttpServletResponse.SC_BAD_REQUEST, "参数校验失败"),
+
+
+ /**
+ * 模拟数据失败
+ */
+ SIMULATE_ERROR(400, "模拟数据失败"),
+
+ ;
+
+ /**
+ * code编码
+ */
+ final int code;
+ /**
+ * 中文信息描述
+ */
+ final String message;
+}
\ No newline at end of file
diff --git a/hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml b/hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml
deleted file mode 100644
index 277c4cb..0000000
--- a/hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml
+++ /dev/null
@@ -1,238 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hzims-service-api/pom.xml b/hzims-service-api/pom.xml
index 9974fff..59661cf 100644
--- a/hzims-service-api/pom.xml
+++ b/hzims-service-api/pom.xml
@@ -16,7 +16,6 @@
assets-api
-
topvision-api
equipment-api
basic-api
@@ -30,6 +29,7 @@
middle-api
alarm-api
big-model-api
+ suichang-api
diff --git a/hzims-service-api/spare-api/pom.xml b/hzims-service-api/spare-api/pom.xml
deleted file mode 100644
index b45831f..0000000
--- a/hzims-service-api/spare-api/pom.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- hzims-service-api
- com.hnac.hzims
- 4.0.0-SNAPSHOT
-
- 4.0.0
-
- spare-api
- ${project.artifactId}
- jar
-
-
diff --git a/hzims-service-api/spare-api/spare-api.iml b/hzims-service-api/spare-api/spare-api.iml
deleted file mode 100644
index 660192e..0000000
--- a/hzims-service-api/spare-api/spare-api.iml
+++ /dev/null
@@ -1,226 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/entity/Notice.java b/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/entity/Notice.java
deleted file mode 100644
index 0c328ed..0000000
--- a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/entity/Notice.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package com.hnac.hzims.spare.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.springblade.core.mp.base.BaseEntity;
-
-import java.util.Date;
-
-/**
- * 实体类
- *
- * @author Chill
- */
-@Data
-@TableName("blade_notice")
-@EqualsAndHashCode(callSuper = true)
-public class Notice extends BaseEntity {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 标题
- */
- @ApiModelProperty(value = "标题")
- private String title;
-
- /**
- * 通知类型
- */
- @ApiModelProperty(value = "通知类型")
- private Integer category;
-
- /**
- * 发布日期
- */
- @ApiModelProperty(value = "发布日期")
- private Date releaseTime;
-
- /**
- * 内容
- */
- @ApiModelProperty(value = "内容")
- private String content;
-
-
-}
diff --git a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/feign/INoticeClient.java b/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/feign/INoticeClient.java
deleted file mode 100644
index ff3206f..0000000
--- a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/feign/INoticeClient.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package com.hnac.hzims.spare.feign;
-
-import org.springblade.core.launch.constant.AppConstant;
-import org.springblade.core.tool.api.R;
-import com.hnac.hzims.spare.entity.Notice;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import java.util.List;
-
-/**
- * Notice Feign接口类
- *
- * @author Chill
- */
-@FeignClient(
- value = AppConstant.APPLICATION_DESK_NAME
-)
-public interface INoticeClient {
-
- String API_PREFIX = "/client";
- String TOP = API_PREFIX + "/top";
-
- /**
- * 获取notice列表
- *
- * @param number
- * @return
- */
- @GetMapping(TOP)
- R> top(@RequestParam("number") Integer number);
-
-}
diff --git a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/vo/NoticeVO.java b/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/vo/NoticeVO.java
deleted file mode 100644
index e367a45..0000000
--- a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/vo/NoticeVO.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.hnac.hzims.spare.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import com.hnac.hzims.spare.entity.Notice;
-
-/**
- * 通知公告视图类
- *
- * @author Chill
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class NoticeVO extends Notice {
-
- @ApiModelProperty(value = "通知类型名")
- private String categoryName;
-
-}
diff --git a/hzims-service-api/video-image-api/video-image-api.iml b/hzims-service-api/video-image-api/video-image-api.iml
deleted file mode 100644
index 3e0824c..0000000
--- a/hzims-service-api/video-image-api/video-image-api.iml
+++ /dev/null
@@ -1,239 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hzims-service-api/water-quality-api/water-quality-api.iml b/hzims-service-api/water-quality-api/water-quality-api.iml
deleted file mode 100644
index 3e0824c..0000000
--- a/hzims-service-api/water-quality-api/water-quality-api.iml
+++ /dev/null
@@ -1,239 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hzims-service-api/water-rain-api/water-rain-api.iml b/hzims-service-api/water-rain-api/water-rain-api.iml
deleted file mode 100644
index 3e0824c..0000000
--- a/hzims-service-api/water-rain-api/water-rain-api.iml
+++ /dev/null
@@ -1,239 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java
index 629d287..df732d1 100644
--- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java
@@ -193,9 +193,9 @@ public class InteractiveSchedule {
return ReturnT.SUCCESS;
}
- //@XxlJob(SYNCHRONOUS_FAULT_INSTRUCT) String params
- @Scheduled(cron = "0/10 * * * * ?")
- public ReturnT synchronousFaultInstruct() {
+ @XxlJob(SYNCHRONOUS_FAULT_INSTRUCT)
+ //@Scheduled(cron = "0/10 * * * * ?")
+ public ReturnT synchronousFaultInstruct(String params) {
Map request = new HashMap<>(2);
// 获取站点列表
R> stationsR = stationClient.list(new StationEntity());
diff --git a/hzims-service/hzims-simulate/pom.xml b/hzims-service/hzims-simulate/pom.xml
new file mode 100644
index 0000000..72cbbb0
--- /dev/null
+++ b/hzims-service/hzims-simulate/pom.xml
@@ -0,0 +1,129 @@
+
+
+
+ com.hnac.hzims
+ hzims-service
+ 4.0.0-SNAPSHOT
+
+
+ 4.0.0
+ hzims-simulate
+ jar
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ com.xuxueli
+ xxl-job-core
+
+
+ com.google.guava
+ failureaccess
+ 1.0.1
+
+
+ org.springblade
+ blade-common
+
+
+ org.springblade
+ blade-core-boot
+
+
+ org.springblade
+ blade-core-cloud
+
+
+
+
+ org.springblade
+ blade-starter-http
+
+
+ org.springblade
+ blade-core-cloud
+ compile
+
+
+
+ org.springblade
+ blade-starter-datascope
+ compile
+
+
+ org.projectlombok
+ lombok
+
+
+
+ com.hnac.hzims
+ equipment-api
+ 4.0.0-SNAPSHOT
+
+
+
+ com.hnac.hzims
+ weather-api
+ 4.0.0-SNAPSHOT
+
+
+
+ com.hzinfo.framework
+ hnac-framework-mqtt-starters
+
+
+
+ dom4j
+ dom4j
+ 1.6.1
+ compile
+
+
+ org.springblade
+ blade-core-cloud
+ 5.1.1.RELEASE.fix.1
+ compile
+
+
+
+
+
+
+ ${project.name}-${project.version}
+
+
+ src/main/java
+
+ **/*.xml
+
+ false
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 2.6.6
+
+
+
+ repackage
+
+
+ exec
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/SimulateApplication.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/SimulateApplication.java
new file mode 100644
index 0000000..59981d0
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/SimulateApplication.java
@@ -0,0 +1,28 @@
+package com.hnac.hzims.simulate;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springblade.core.cloud.feign.EnableBladeFeign;
+import org.springblade.core.launch.BladeApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.cloud.client.SpringCloudApplication;
+
+
+/**
+ * @author admin
+ */
+@EnableBladeFeign
+@SpringCloudApplication
+@MapperScan(basePackages={"com.hnac.hzims.**.mapper"})
+//@ComponentScan(basePackages = {"com.hnac.hzinfo.simulate"})
+public class SimulateApplication extends SpringBootServletInitializer {
+ static String APPLICATION_NAME="hzims-simulate";
+ public static void main(String[] args) {
+ BladeApplication.run(APPLICATION_NAME, SimulateApplication.class, args);
+ }
+
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
+ return BladeApplication.createSpringApplicationBuilder(builder, APPLICATION_NAME, SimulateApplication.class);
+ }
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/constants/WriteRealDataConstant.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/constants/WriteRealDataConstant.java
new file mode 100644
index 0000000..bd48066
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/constants/WriteRealDataConstant.java
@@ -0,0 +1,43 @@
+package com.hnac.hzims.simulate.constants;
+
+/**
+ * @author ysj
+ * @describe 实时数据写入常量
+ */
+public interface WriteRealDataConstant {
+
+ String REAL_DATA_V3 = "3";
+
+ String REAL_DATA_V4 = "4";
+
+ String GATE_FLOW = "过闸流量(m³/s)";
+
+ String OPENING_DEGREE = "开度(m)";
+
+ String GATE_STATUS = "闸门状态";
+
+ String WRITE_REAL_GATE_DATA = "writeRealGateData";
+
+ String WRITE_REAL_RAIN_DATA = "writeRealRainData";
+
+ Long OPEN = 0L;
+
+ Long CLOSE = 1L;
+
+ String WRITE_GATE = "1";
+
+ String WRITE_RAIN = "2";
+
+ // 降雨站属性标识
+ String ATTR_RAIN = "attr_rain";
+ String ATTR_WIND360 = "wind360";
+ String ATTR_WIND_SCALE = "wind_scale";
+ String ATTR_WIND_SPEED = "wind_speed ";
+ String ATTR_HUMIDITY = "humidity";
+ String ATTR_PRESSURE = "pressure";
+ String ATTR_VIS = "vis";
+ String ATTR_CLOUD = "cloud";
+ String ATTR_DEW = "dew";
+ String ATTR_FEELS_LIKE = "feels_like";
+ String ATTR_TEMP = "temp";
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/GageController.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/GageController.java
new file mode 100644
index 0000000..08ec0a8
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/GageController.java
@@ -0,0 +1,31 @@
+package com.hnac.hzims.simulate.controller;
+
+import com.hnac.hzims.simulate.service.WriteRealDataService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author ysj
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/gate")
+@Api(value = "闸门开关机模拟服务", tags = "闸门开关机模拟服务")
+public class GageController {
+
+ private final WriteRealDataService writeRealDataService;
+
+ @GetMapping("/isOpen")
+ @ApiOperation(value = "枢纽天气情况")
+ public R weather(@RequestParam("deviceCode") String deviceCode,
+ @RequestParam("isOpen") Long isOpen){
+ return R.data(writeRealDataService.isOpen(deviceCode,isOpen));
+ }
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/SimulationDataController.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/SimulationDataController.java
new file mode 100644
index 0000000..8d6d85c
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/SimulationDataController.java
@@ -0,0 +1,195 @@
+package com.hnac.hzims.simulate.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.google.common.collect.Maps;
+import com.hnac.hzims.common.enums.ExceptionEnum;
+import com.hnac.hzims.simulate.entity.DataModel;
+import com.hnac.hzims.simulate.entity.Device;
+import com.hnac.hzims.simulate.entity.DeviceField;
+import com.hnac.hzims.simulate.entity.DeviceFieldGap;
+import com.hnac.hzims.simulate.service.DeviceFieldGapService;
+import com.hnac.hzims.simulate.service.DeviceFieldService;
+import com.hnac.hzims.simulate.service.SimulationService;
+import com.hnac.hzims.simulate.util.ParseFacUtils;
+import com.hnac.hzims.simulate.util.TopicConstant;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.jackson.JsonUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.mqtt.producer.IMqttSender;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/simulationData")
+@Api(value = "数据模拟服务", tags = "数据模拟服务")
+@Slf4j
+public class SimulationDataController {
+
+ @Autowired
+ private SimulationService simulationService;
+
+ @Autowired
+ private DeviceFieldService deviceFieldService;
+
+ @Autowired
+ private DeviceFieldGapService deviceFieldGapService;
+
+ @Autowired
+ private IMqttSender mqttSender;
+
+ @Value("fac.path")
+ private String facPath;
+
+ public static Map cacheMap = Maps.newHashMap();
+
+ @ApiOperation(value = "解析v3.0场信息文件", notes = "解析场信息文件")
+ @GetMapping("/readFac")
+ public R readFac() {
+ InputStream inputStream = null;
+ try {
+ inputStream = new FileInputStream(new File(facPath+File.separator+"factory.fac"));
+ List list = ParseFacUtils.parsePoint(inputStream);
+ list.forEach(entity -> {
+ mqttSender.sendToMqtt(TopicConstant.TOPIC_DEVICE_MODEL, JsonUtil.toJson(entity));
+ });
+ return R.success("解析场信息文件成功");
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ return R.fail("解析场信息文件失败");
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ @ApiOperation(value = "分页范围配置", notes = "分页范围配置")
+ @GetMapping("/pageGap")
+ public R> pageGap(String stationId, Query query) {
+ List list=simulationService.getDeviceListByStationId(stationId);
+ List ids=list.stream().map(Device::getId).collect(Collectors.toList());
+ LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper();
+ lambdaQueryWrapper.in(DeviceFieldGap::getFacDeviceId,ids);
+ IPage pageList=deviceFieldGapService.page(Condition.getPage(query),lambdaQueryWrapper);
+ return R.data(pageList);
+ }
+
+ @ApiOperation(value = "更新设备属性范围配置", notes = "更新设备属性范围配置")
+ @PostMapping("/updateGap")
+ public R updateGap(@RequestBody DeviceFieldGap deviceFieldGap) {
+ deviceFieldGapService.updateById(deviceFieldGap);
+ return R.status(true);
+ }
+
+ @ApiOperation(value = "第一次同步设备属性", notes = "第一次同步设备属性")
+ @GetMapping("/syncOneGap")
+ public R syncGap() {
+ //存在表
+ int count=deviceFieldService.existGapTable();
+ if(count<=0){//建表
+ deviceFieldService.createGapTable();
+ }
+ //同步
+ List list=deviceFieldService.list();
+ List gaps=list.stream().map(result -> new DeviceFieldGap(result.getId(), result.getFacDeviceId(),
+ result.getSignage(),result.getName(), BigDecimal.ZERO,BigDecimal.ZERO))
+ .collect(Collectors.toList());
+ deviceFieldGapService.saveOrUpdateBatch(gaps);
+
+ return R.status(true);
+ }
+
+ @ApiOperation(value = "第二次同步设备属性", notes = "第二次同步设备属性")
+ @GetMapping("/syncTwoGap")
+ public R syncTwoGap() {
+ //同步
+ List list=deviceFieldService.queryNewInsert();
+ if(list!=null && !list.isEmpty()) {
+ List gaps = list.stream().map(result -> new DeviceFieldGap(result.getId(), result.getFacDeviceId(),
+ result.getSignage(), result.getName(), BigDecimal.ZERO, BigDecimal.ZERO))
+ .collect(Collectors.toList());
+ deviceFieldGapService.saveBatch(gaps);
+ }
+ return R.status(true);
+ }
+
+
+ @ApiOperation(value = "模拟单站的数据(循环,每隔sleepTime时长发送一次整站数据)", notes = "模拟单站的数据")
+ @GetMapping("/simulationMultiple")
+ public R simulationMultipleV3(String stationId, Long sleepTime) {
+ String key = "simulation:" + stationId;
+ String hasExc = cacheMap.get(key);
+ if (Func.isNotBlank(hasExc)) {
+ return R.fail("该站已经在模拟数据了");
+ }
+ try {
+ simulationService.simulationMultiple(stationId, sleepTime);
+ }catch (Exception e) {
+ throw new ServiceException(ExceptionEnum.SIMULATE_ERROR);
+ }
+ cacheMap.put(key, "true");
+ return R.status(true);
+
+ }
+
+ @ApiOperation(value = "模拟单站的数据(循环,每隔sleepTime时长发送一次整站数据)", notes = "模拟单站的数据")
+ @GetMapping("/simulationMultipleV4")
+ public R simulationMultipleV4(String stationId, Long sleepTime) {
+ String key = "simulation:" + stationId;
+ String hasExc = cacheMap.get(key);
+ if (Func.isNotBlank(hasExc)) {
+ return R.fail("该站已经在模拟数据了");
+ }
+ try {
+ simulationService.simulationMultipleV4(stationId, sleepTime);
+ }catch (Exception e) {
+ throw new ServiceException(ExceptionEnum.SIMULATE_ERROR);
+ }
+ cacheMap.put(key, "true");
+ return R.status(true);
+ }
+
+// @ApiOperation(value = "模拟单站的数据(循环,每隔sleepTime时长发送一次整站数据)", notes = "模拟单站的数据")
+// @GetMapping("/simulationMultipleFlow")
+// public R simulationMultipleInFlow() {
+// String key = "simulationMultipleInFlow";
+// String hasExc = cacheMap.get(key);
+// if (Func.isNotBlank(hasExc)) {
+// return R.fail("该站已经在模拟数据了");
+// }
+// simulationService.simulationMultipleInFlow();
+// cacheMap.put(key, "true");
+// return R.status(true);
+// }
+
+
+ @ApiOperation(value = "停止模拟", notes = "停止模拟")
+ @GetMapping("/stopStart")
+ public R stopStart() {
+ simulationService.stopStart();
+ return R.status(true);
+
+ }
+
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataItem.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataItem.java
new file mode 100644
index 0000000..633cbb8
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataItem.java
@@ -0,0 +1,20 @@
+package com.hnac.hzims.simulate.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class DataItem {
+
+ private String id;
+ private String signage;//hz3000定义的id
+ private String name;
+ private String type;
+ private String soeType;
+ private String eventType;
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataModel.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataModel.java
new file mode 100644
index 0000000..7771e95
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataModel.java
@@ -0,0 +1,46 @@
+package com.hnac.hzims.simulate.entity;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * {
+ * "station": "4543",
+ * "structType": "dataGroup",
+ * "id": "5016387599_0",
+ * "pid": "5016387585",
+ * "name": "温度传感器",
+ * "children": [{
+ * "id": "5016387607",
+ * "name": "温度",
+ * "type": "YC"
+ * },{
+ * "id": "5016387617",
+ * "name": "高度",
+ * "type": "YC"
+ * },{
+ * "id": "5016387608",
+ * "name": "工作状态",
+ * "type": "YX"
+ * },{
+ * "id": "5016387609",
+ * "name": "工作状态",
+ * "type": "SOE",
+ * "eventType": ""
+ * }]
+ * }
+ * 数据组
+ * @author ninglong
+ */
+@Data
+public class DataModel {
+ private String station;
+ private String structType;
+ private String id;
+ private String signage;//hz3000定义的id
+ private String pid;
+ private String name;
+ private List children;
+}
+
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Device.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Device.java
new file mode 100644
index 0000000..b3ed590
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Device.java
@@ -0,0 +1,66 @@
+package com.hnac.hzims.simulate.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 数据组
+ *
+ * @author ninglong
+ */
+@TableName(value = "hzinfo_fac_device")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class Device implements Serializable {
+
+ @ApiModelProperty(value = "id")
+ @TableId(type = IdType.INPUT)
+ private String id;
+
+ @ApiModelProperty(value = "名称")
+ private String name;
+
+ @ApiModelProperty(value = "0-云端cms,1-站端直传")
+ private Integer source;
+
+ @ApiModelProperty("hz3000定义的id,如果定义的是大id则值与id字段值相同")
+ private String sid;
+
+ @ApiModelProperty("version=v3,version=v4")
+ private String modelKind;
+
+ @DateTimeFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @JsonFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @ApiModelProperty("创建时间")
+ private Date createTime;
+
+ @JsonSerialize(
+ using = ToStringSerializer.class
+ )
+
+ @ApiModelProperty("项目id")
+ private String projectId;
+
+
+ @ApiModelProperty("写入方式")
+ private String isWrite;
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceData.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceData.java
new file mode 100644
index 0000000..411609c
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceData.java
@@ -0,0 +1,22 @@
+package com.hnac.hzims.simulate.entity;
+
+import com.google.common.collect.Lists;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 设备数据
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class DeviceData {
+ private String station;
+ private String time;
+ private List children = Lists.newArrayList();
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceDataV4.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceDataV4.java
new file mode 100644
index 0000000..6b6023d
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceDataV4.java
@@ -0,0 +1,19 @@
+package com.hnac.hzims.simulate.entity;
+
+import com.google.common.collect.Lists;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class DeviceDataV4 {
+ private String stationId;
+ private String time;
+ private List children = Lists.newArrayList();
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFacConfig.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFacConfig.java
new file mode 100644
index 0000000..80c449e
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFacConfig.java
@@ -0,0 +1,38 @@
+package com.hnac.hzims.simulate.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author ysj
+ */
+@TableName("hzinfo_fac_device_config")
+@Data
+public class DeviceFacConfig implements Serializable {
+ @ApiModelProperty("id")
+ @TableId(type = IdType.INPUT)
+ private String id;
+
+ @ApiModelProperty("设备id")
+ private String deviceCode;
+
+ @ApiModelProperty("字段标识")
+ private String facDeviceId;
+
+ @ApiModelProperty("站点Id")
+ private String stationId;
+
+ @ApiModelProperty("站点类型")
+ private String modelKind;
+
+ @ApiModelProperty("sid")
+ private String sid;
+
+ @ApiModelProperty("数据写入方式: 1-闸门,2-天气")
+ private String writeMethod;
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceField.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceField.java
new file mode 100644
index 0000000..c9660e2
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceField.java
@@ -0,0 +1,42 @@
+package com.hnac.hzims.simulate.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@TableName("hzinfo_fac_device_attr")
+@Data
+public class DeviceField implements Serializable {
+ @ApiModelProperty("id")
+ @TableId(type = IdType.INPUT)
+ private String id;
+ @ApiModelProperty("设备id")
+ private String facDeviceId;
+ @ApiModelProperty("字段标识")
+ private String signage;
+ @ApiModelProperty("字段名称")
+ private String name;
+ @ApiModelProperty("最大值")
+ private String projectId;
+
+ @DateTimeFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @JsonFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @ApiModelProperty("创建时间")
+ private Date createTime;
+
+ private Long modelClassifyId;
+ private String alarmType;
+
+
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFieldGap.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFieldGap.java
new file mode 100644
index 0000000..d3efad5
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFieldGap.java
@@ -0,0 +1,30 @@
+package com.hnac.hzims.simulate.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@TableName("hzinfo_fac_device_attr_gap")
+@Data
+@AllArgsConstructor
+public class DeviceFieldGap implements Serializable {
+ @ApiModelProperty("id")
+ @TableId(type = IdType.INPUT)
+ private String id;
+ @ApiModelProperty("设备id")
+ private String facDeviceId;
+ @ApiModelProperty("字段标识")
+ private String signage;
+ @ApiModelProperty("字段名称")
+ private String name;
+ @ApiModelProperty("最大值")
+ private BigDecimal maxVal;
+ @ApiModelProperty("最小值")
+ private BigDecimal minVal;
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceRainGap.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceRainGap.java
new file mode 100644
index 0000000..5363edd
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceRainGap.java
@@ -0,0 +1,33 @@
+package com.hnac.hzims.simulate.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author ysj
+ */
+@TableName("hzinfo_fac_device_rain_gap")
+@Data
+public class DeviceRainGap implements Serializable {
+
+ @ApiModelProperty("id")
+ @TableId(type = IdType.INPUT)
+ private String id;
+
+ @ApiModelProperty("设备id")
+ private String facDeviceId;
+
+ @ApiModelProperty("属性标识名称")
+ private String name;
+
+ @ApiModelProperty("属性标识")
+ private String attribute;
+
+ @ApiModelProperty("字段标识")
+ private String signage;
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Kvtq.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Kvtq.java
new file mode 100644
index 0000000..4a6c839
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Kvtq.java
@@ -0,0 +1,18 @@
+package com.hnac.hzims.simulate.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class Kvtq {
+
+ private String k;
+ private String v;
+ private String t;
+ private Integer q;
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/KvtqV4.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/KvtqV4.java
new file mode 100644
index 0000000..a5a8b0e
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/KvtqV4.java
@@ -0,0 +1,18 @@
+package com.hnac.hzims.simulate.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class KvtqV4 {
+ private String sid;
+ private String k;
+ private String v;
+ private String t;
+ private Integer q;
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.java
new file mode 100644
index 0000000..ad70ac9
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.java
@@ -0,0 +1,19 @@
+package com.hnac.hzims.simulate.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hnac.hzims.simulate.entity.DeviceFacConfig;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author ysj
+ */
+@Mapper
+public interface DeviceFacConfigMapper extends BaseMapper {
+
+ List queryConfigDevice(@Param("method") String method);
+
+ DeviceFacConfig configByDeviceCode(@Param("deviceCode") String deviceCode);
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.xml b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.xml
new file mode 100644
index 0000000..1dda78c
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.java
new file mode 100644
index 0000000..d3e85d4
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.java
@@ -0,0 +1,16 @@
+package com.hnac.hzims.simulate.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hnac.hzims.simulate.entity.DeviceFieldGap;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Mapper
+public interface DeviceFieldGapMapper extends BaseMapper {
+ List queryDeviceLimits(@Param("signages") List signages);
+
+ void updateLimitById(@Param("maxValue") BigDecimal maxValue, @Param("minValue") BigDecimal minValue,@Param("id") String id);
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.xml b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.xml
new file mode 100644
index 0000000..7a4fff8
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ UPDATE HZINFO_FAC_DEVICE_ATTR_GAP
+ SET max_val = #{maxValue},
+ min_val = #{minValue}
+ WHERE id = #{id}
+
+
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.java
new file mode 100644
index 0000000..e44fc5d
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.java
@@ -0,0 +1,19 @@
+package com.hnac.hzims.simulate.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hnac.hzims.simulate.entity.DeviceField;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface DeviceFieldMapper extends BaseMapper {
+ int existGapTable();
+ int createGapTable();
+ List queryNewInsert();
+
+ List queryDeviceFields(@Param("devices") List devices);
+
+ List querySignages(@Param("facDeviceId") String facDeviceId);
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.xml b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.xml
new file mode 100644
index 0000000..477ff69
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+ CREATE TABLE hzinfo_device_field_gap (
+ id varchar(64) COLLATE utf8mb4_bin NOT NULL COMMENT '字段类型',
+ fac_device_id varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '设备实例id',
+ signage varchar(25) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '字段标识',
+ name varchar(100) COLLATE utf8mb4_bin NOT NULL COMMENT '字段名称',
+ max_val decimal(9,3) DEFAULT NULL,
+ min_val decimal(9,3) DEFAULT NULL,
+ PRIMARY KEY (id)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='设备字段'
+
+
+
+
+
+
+
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.java
new file mode 100644
index 0000000..4edccd1
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.java
@@ -0,0 +1,15 @@
+package com.hnac.hzims.simulate.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hnac.hzims.simulate.entity.Device;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+@Mapper
+public interface DeviceMapper extends BaseMapper {
+ String getSid(@Param("stationId") String stationId);
+
+// List selectStcd();
+//
+// int insertData(@Param("param") Map param);
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.xml b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.xml
new file mode 100644
index 0000000..19587cf
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.java
new file mode 100644
index 0000000..5438aca
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.java
@@ -0,0 +1,17 @@
+package com.hnac.hzims.simulate.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hnac.hzims.simulate.entity.DeviceRainGap;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author ysj
+ */
+@Mapper
+public interface DeviceRainGapMapper extends BaseMapper {
+
+ List RainGapByFacDeviceId(@Param("facDeviceId") String facDeviceId);
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.xml b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.xml
new file mode 100644
index 0000000..95d531a
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/scheduled/WriteRealDataTask.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/scheduled/WriteRealDataTask.java
new file mode 100644
index 0000000..3032379
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/scheduled/WriteRealDataTask.java
@@ -0,0 +1,53 @@
+package com.hnac.hzims.simulate.scheduled;
+
+import com.hnac.hzims.simulate.constants.WriteRealDataConstant;
+import com.hnac.hzims.simulate.service.WriteRealDataService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+
+/**
+ * @author ysj
+ * @describe 实时数据写入定时任务
+ */
+@Slf4j
+@Component
+public class WriteRealDataTask {
+
+ @Autowired
+ private WriteRealDataService writeRealDataService;
+
+ /**
+ * 设备模型信息
+ */
+ @XxlJob(WriteRealDataConstant.WRITE_REAL_GATE_DATA)
+ //@Scheduled(cron = "0/40 * * * * ? ")
+ public ReturnT writeRealGateData(String param) {
+ if (Func.isBlank(param)) {
+ param = DateUtil.format(new Date(), "yyyy-MM");
+ }
+ writeRealDataService.writeRealGateData(param);
+ return new ReturnT<>("SUCCESS");
+ }
+
+ /**
+ * 设备模型信息
+ */
+ @XxlJob(WriteRealDataConstant.WRITE_REAL_RAIN_DATA)
+ //@Scheduled(cron = "0/40 * * * * ? ")
+ public ReturnT writeRealRainData(String param) {
+ if (Func.isBlank(param)) {
+ param = DateUtil.format(new Date(), "yyyy-MM");
+ }
+ writeRealDataService.writeRealRainData(param);
+ return new ReturnT<>("SUCCESS");
+ }
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldGapService.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldGapService.java
new file mode 100644
index 0000000..99868bb
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldGapService.java
@@ -0,0 +1,11 @@
+package com.hnac.hzims.simulate.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hnac.hzims.simulate.entity.DeviceFieldGap;
+import com.hnac.hzims.simulate.mapper.DeviceFieldGapMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DeviceFieldGapService extends ServiceImpl {
+
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldService.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldService.java
new file mode 100644
index 0000000..c97b7e9
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldService.java
@@ -0,0 +1,24 @@
+package com.hnac.hzims.simulate.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hnac.hzims.simulate.entity.DeviceField;
+import com.hnac.hzims.simulate.mapper.DeviceFieldMapper;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class DeviceFieldService extends ServiceImpl {
+
+ public int existGapTable(){
+ return this.baseMapper.existGapTable();
+ }
+
+ public int createGapTable(){
+ return this.baseMapper.createGapTable();
+ }
+
+ public List queryNewInsert(){
+ return this.baseMapper.queryNewInsert();
+ }
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceService.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceService.java
new file mode 100644
index 0000000..494b1e5
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceService.java
@@ -0,0 +1,21 @@
+package com.hnac.hzims.simulate.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hnac.hzims.simulate.entity.Device;
+import com.hnac.hzims.simulate.mapper.DeviceMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DeviceService extends ServiceImpl {
+ public String getSid(String stationId){
+ return this.baseMapper.getSid(stationId);
+ }
+
+// public List selectStcd(){
+// return this.baseMapper.selectStcd();
+// }
+//
+// public int insertData(Map param){
+// return this.baseMapper.insertData(param);
+// }
+}
diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/SimulationService.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/SimulationService.java
new file mode 100644
index 0000000..31903f9
--- /dev/null
+++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/SimulationService.java
@@ -0,0 +1,280 @@
+package com.hnac.hzims.simulate.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.hnac.hzims.simulate.entity.*;
+import com.hnac.hzims.simulate.util.DataConstants;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.tool.jackson.JsonUtil;
+import org.springblade.core.tool.utils.DateTimeUtil;
+import org.springblade.core.tool.utils.ThreadUtil;
+import org.springblade.mqtt.producer.IMqttSender;
+import com.hnac.hzims.simulate.util.TopicConstant;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+public class SimulationService {
+ @Autowired
+ IMqttSender mqttSender;
+
+ @Autowired
+ DeviceService deviceService;
+
+ @Autowired
+ DeviceFieldService deviceFieldService;
+
+ @Autowired
+ DeviceFieldGapService deviceFieldGapService;
+
+ public List getDeviceListByStationId(String projectId){
+ LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper();
+ lambdaQueryWrapper.eq(Device::getProjectId,projectId);
+ lambdaQueryWrapper.eq(Device::getIsWrite,"0");
+ List list = deviceService.list(lambdaQueryWrapper);
+ return list;
+ }
+
+ String getSid(String stationId){
+ return deviceService.getSid(stationId);
+ }
+
+ //模拟启停标识
+ private volatile boolean flag=true;
+
+ public void stopStart(){
+ flag = !flag;
+ }
+
+ @Async
+ public void simulationMultiple(String stationId, Long sleepTime) {
+
+ List list = getDeviceListByStationId(stationId);
+ //查询所有属性
+ List fieldList = deviceFieldService.list();
+ List gapList = deviceFieldGapService.list();
+
+ log.info("本站{}有{}个设备实例,每{}毫秒发送{}条数据", stationId, list.size(), sleepTime, list.size());
+ while (true) {
+ if (flag) {//启动或关闭模拟
+ for (Device device : list) {
+ Map map = simulation(stationId, device,fieldList,gapList);
+// log.info("map data: "+ JsonUtil.toJson(map));
+ if (map.get("yc") != null && map.get("yc").getChildren().size() > 0) {
+ log.info("模拟推送遥测,主题:topic_hzinfo_props:{}", JsonUtil.toJson(map.get("yc")));
+ mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_PROPS, JsonUtil.toJson(map.get("yc")));
+ }
+// if (map.get("dd") != null && map.get("dd").getChildren().size() > 0) {
+// mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_DD, JsonUtil.toJson(map.get("dd")));
+// }
+ if (map.get("yx") != null && map.get("yx").getChildren().size() > 0) {
+ mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_YX, JsonUtil.toJson(map.get("yx")));
+ }
+ }
+ //最小10毫秒
+ if (sleepTime == null || sleepTime == 0) {
+ sleepTime = 10L;
+ }
+ ThreadUtil.sleep(sleepTime);
+ }
+ }
+ }
+
+
+// @Async
+// public void simulationMultipleInFlow(){
+// List list=deviceService.selectStcd();
+// while (true) {
+// List