15928045575 2 ani în urmă
părinte
comite
51165657aa
14 a modificat fișierele cu 127 adăugiri și 41 ștergeri
  1. 1 1
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/DeviceModelController.java
  2. 5 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsIntegration.java
  3. 7 1
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceAdd.java
  4. 2 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceModelQuery.java
  5. 1 1
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/DeviceIntegrationVo.java
  6. 5 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/IntegrationVo.java
  7. 1 1
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/BackTrackService.java
  8. 7 4
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceModelService.java
  9. 8 4
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceService.java
  10. 78 26
      slope-modules/slope-detection/src/main/resources/bootstrap-dev.yml
  11. 1 1
      slope-modules/slope-detection/src/main/resources/bootstrap.yml
  12. 6 0
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceMapper.xml
  13. 1 0
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceModelMapper.xml
  14. 4 2
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsIntegrationMapper.xml

+ 1 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/DeviceModelController.java

@@ -44,7 +44,7 @@ public class DeviceModelController {
     @Log(description = "设备型号查询-分页")
     //@RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
     @RequestMapping(name = "设备型号查询-分页", value = "/select", method = RequestMethod.POST)
-    public HttpResult select(@Valid @RequestBody DeviceModelQuery deviceModelQuery, HttpResponse response) {
+    public HttpResult select(@Valid @RequestBody DeviceModelQuery deviceModelQuery, HttpServletRequest response) {
         log.info("设备型号查询 select param:{}", JSONObject.toJSONString(deviceModelQuery));
         return HttpResult.ok(deviceModelService.select(deviceModelQuery, response));
     }

+ 5 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsIntegration.java

@@ -44,6 +44,11 @@ public class KwsIntegration implements Serializable {
      */
     private String remark;
 
+    /**
+     * 要素ids组合,回显需要
+     */
+    private String ids;
+
     /**
      * 状态
      */

+ 7 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceAdd.java

@@ -46,9 +46,14 @@ public class DeviceAdd {
     /**
      * SN码
      */
-    @NotBlank(message = "SN码不能为空")
     private String snCode;
 
+    /**
+     * SN码
+     */
+    @NotBlank(message = "SN码不能为空")
+    private String snCodeFullname;
+
     /**
      * 产品类型
      */
@@ -86,6 +91,7 @@ public class DeviceAdd {
     /**
      * 集成ID
      */
+    @NotNull(message = "要素不能为空")
     private String integrationId;
 
 }

+ 2 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceModelQuery.java

@@ -19,6 +19,8 @@ public class DeviceModelQuery {
 
     private int pageSize;
 
+    private String mountainId;
+
     private Integer Status;
 
     private Integer attribute;

+ 1 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/DeviceIntegrationVo.java

@@ -27,7 +27,7 @@ public class DeviceIntegrationVo implements Serializable {
     /**
      * 单位
      */
-    private Long unit;
+    private String unit;
 
     /**
      * 企业id

+ 5 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/IntegrationVo.java

@@ -60,6 +60,11 @@ public class IntegrationVo implements Serializable {
      */
     private Byte status;
 
+    /**
+     *要素ids组合,回显需要
+     */
+    private String ids;
+
     /**
      * 创建人
      */

+ 1 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/BackTrackService.java

@@ -335,7 +335,7 @@ public class BackTrackService {
         integrationMapper.updateById(integration);
         Map<String, Object> logMap = new HashMap<>(NumberConstant.SIXTEEN);
         logMap.put("name", integration.getIntegrationName());
-        logMap.put("type", IntegrationStatusEnum.getDestination(Byte.toUnsignedInt(integration.getStatus())));
+        logMap.put("type", IntegrationStatusEnum.getDestination(Byte.toUnsignedInt(has.getStatus())));
         commonService.insertLog(MessageLogEnum.INTEGRATION_ADD, headerData, logMap, headerData.getUpdateBy() == null ? null : Long.parseLong(headerData.getUpdateBy()));
         return HttpResult.ok();
     }

+ 7 - 4
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceModelService.java

@@ -68,8 +68,10 @@ public class DeviceModelService {
      * @param response        http流
      * @return 返回值
      */
-    public PageRes select(DeviceModelQuery deviceModelQuery, HttpResponse response) {
+    public PageRes select(DeviceModelQuery deviceModelQuery, HttpServletRequest response) {
         PageHelper.startPage(deviceModelQuery.getPage(), deviceModelQuery.getPageSize());
+        HeaderData headerData = commonService.getHeaderData(response);
+        deviceModelQuery.setMountainId(headerData.getMountainId());
         List<DeviceModelVo> list = kwsDeviceModelMapper.selectListAll(deviceModelQuery);
         PageInfo<DeviceModelVo> pageInfo = new PageInfo<>(list);
         if (CollectionUtils.isEmpty(list)) {
@@ -111,7 +113,7 @@ public class DeviceModelService {
         deviceModel.setUpdateBy(Long.parseLong(headerData.getUpdateBy()));
         deviceModel.setUpdateTime(now);
         deviceModel.setDelFlag(NumberConstant.ZERO);
-        deviceModel.setMountainId(headerData.getCompanyId());
+        deviceModel.setMountainId(headerData.getMountainId());
         kwsDeviceModelMapper.insert(deviceModel);
         //新增log
         Map<String, Object> logMap = new HashMap<>(NumberConstant.SIXTEEN);
@@ -204,16 +206,17 @@ public class DeviceModelService {
         if (Objects.isNull(has)) {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.MODEL_NOT_EXISTS);
         }
-
+        HeaderData headerData = commonService.getHeaderData(response);
         //List<Long> list = StringUtils.splitStrToList(ids, Long.class);
         int update = kwsDeviceModelMapper.update(null, new LambdaUpdateWrapper<KwsDeviceModel>()
                 .eq(KwsDeviceModel::getId, ids)
+                .eq(KwsDeviceModel::getMountainId, headerData.getMountainId())
                 .set(KwsDeviceModel::getDelFlag, NumberConstant.ONE));
         if (update < 1) {
             throw new BusinessException("删除型号异常");
         }
         //新增log
-        HeaderData headerData = commonService.getHeaderData(response);
+
         Map<String, Object> logMap = new HashMap<>(NumberConstant.SIXTEEN);
         logMap.put("name", has.getName());
         commonService.insertLog(MessageLogEnum.MODEL_DELETE, headerData, logMap, Long.parseLong(headerData.getUpdateBy()));

+ 8 - 4
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceService.java

@@ -100,15 +100,17 @@ public class DeviceService {
         if (Objects.isNull(device)) {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.DEVICE_NOT_EXISTS);
         }
+        HeaderData headerData = commonService.getHeaderData(response);
         //List<Long> list = StringUtils.splitStrToList(ids, Long.class);
         int update = deviceMapper.update(null, new LambdaUpdateWrapper<KwsDevice>()
                 .in(KwsDevice::getId, ids)
+                .eq(KwsDevice::getMountainId, headerData.getMountainId())
                 .set(KwsDevice::getDelFlag, NumberConstant.ONE));
         if (update < 1) {
             throw new BusinessException("删除设备异常");
         }
         //获取新增设备的型号
-        HeaderData headerData = commonService.getHeaderData(response);
+
         KwsDeviceModel model = deviceModelMapper.selectOne(new LambdaQueryWrapper<KwsDeviceModel>()
                 .eq(KwsDeviceModel::getId, device.getModelId()));
         Map<String, Object> logMap = new HashMap<>(NumberConstant.SIXTEEN);
@@ -134,7 +136,7 @@ public class DeviceService {
     public PageRes select(DeviceQuery deviceQuery, HttpServletRequest response) {
         PageHelper.startPage(deviceQuery.getPage(), deviceQuery.getPageSize());
         HeaderData headerData = commonService.getHeaderData(response);
-        deviceQuery.setMountainId(headerData.getCompanyId());
+        deviceQuery.setMountainId(headerData.getMountainId());
         List<DeviceVo> list = deviceMapper.selectByDeviceParam(deviceQuery);
         PageInfo<DeviceVo> pageInfo = new PageInfo<>(list);
         if (CollectionUtils.isEmpty(list)) {
@@ -208,13 +210,15 @@ public class DeviceService {
         LocalDateTime now = LocalDateTime.now();
         long id = new IdWorker(NumberConstant.ONE).nextId();
         device.setId(id);
+        String newStr = deviceAdd.getSnCodeFullname().replace("-", "").toLowerCase();
+        device.setSnCode(newStr);
         device.setCreateBy(Long.parseLong(headerData.getCreateBy()));
         device.setCreateTime(now);
         device.setStatus(DeviceEnum.IDENTIFYING.getCode());
         device.setOnline(NumberConstant.ZERO);
         device.setUpdateBy(Long.parseLong(headerData.getUpdateBy()));
         device.setUpdateTime(now);
-        device.setMountainId(headerData.getCompanyId());
+        device.setMountainId(headerData.getMountainId());
         deviceMapper.insert(device);
         //新增到数据表kws_device_Integration
         KwsDeviceIntegration deIntergration = new KwsDeviceIntegration();
@@ -224,7 +228,7 @@ public class DeviceService {
             long interId = new IdWorker(NumberConstant.ONE).nextId();
             deIntergration.setId(interId);
             deIntergration.setDeviceId(id);
-            deIntergration.setMountainId(headerData.getCompanyId());
+            deIntergration.setMountainId(headerData.getMountainId());
             deIntergration.setIntegrationId(Long.parseLong(temp[i]));
             deIntergration.setCreateBy(Long.parseLong(headerData.getCreateBy()));
             deIntergration.setCreateTime(now);

+ 78 - 26
slope-modules/slope-detection/src/main/resources/bootstrap-dev.yml

@@ -1,6 +1,21 @@
 spring:
-  application:
-    name: slope-detection
+  datasource:
+    dynamic:
+      # seata: true
+      primary: master #设置默认的数据源或者数据源组,默认值即为master
+      strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
+      datasource:
+        master:
+          url: jdbc:mysql://10.10.10.230:3306/sckw_slope?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
+          username: sckw_dev
+          password: Yy123...
+          driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
+        td:
+          url: jdbc:TAOS-RS://10.10.10.221:6041/devicesV2?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8
+          username: root
+          password: taosdata
+          driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
+          pool-name: Data_trans_HikariCP
   cloud:
     nacos:
       discovery:
@@ -25,27 +40,64 @@ spring:
             group: slope-manage-service
             refresh: true
 ## MQTT##
-mqtt:
-  send:
-    #完成超时时间
-    completionTimeout: 3000
-    #通过mqtt发送消息验证所需用户名
-    username: test
-    #通过mqtt发送消息验证所需密码
-    password: test
-    #连接的mqtt地址
-    url: tcp://10.10.10.225:1883
-    #客户端id
-    clientId: mqttx_12411c5cec
-    #推送主题  后面跟着#是监控下面所有的话题
-    topic: slope
-    #topic: my-test
-    # 会话心跳时间
-    keepAliveInterval: 20
-    # 设置连接超时时间
-    connectionTimeout: 3000
-    timeout: 10
-    keepalive: 20
-  # 要消费的topic配置
-  receive:
-    topic: slopePush/slopePull/test/out,test,slope,sharjeck/ai/test/out
+#mqtt:
+#  send:
+#    #完成超时时间
+#    completionTimeout: 3000
+#    #通过mqtt发送消息验证所需用户名
+#    username: test
+#    #通过mqtt发送消息验证所需密码
+#    password: test
+#    #连接的mqtt地址
+#    url: tcp://10.10.10.225
+#    #客户端id
+#    clientId: mqttx_12411c5c1ec1
+#    #推送主题  后面跟着#是监控下面所有的话题
+#    topic: slope#
+#    #topic: my-test
+#    # 会话心跳时间
+#    keepAliveInterval: 20
+#    # 设置连接超时时间
+#    connectionTimeout: 3000
+#    timeout: 10
+#    keepalive: 20
+#  # 要消费的topic配置
+#  receive:
+#    topic: slopePush/slopePull/test/out,test,slope,sharjeck/ai/test/out
+#mqtt:
+#  send:
+#    #完成超时时间
+#    completionTimeout: 3000
+#    #通过mqtt发送消息验证所需用户名
+#    username: sckw
+#    #通过mqtt发送消息验证所需密码
+#    password: sckw123456
+#    #连接的mqtt地址
+#    url: tcp://47.108.205.7:1883
+#    #客户端id
+#    clientId: mqttx_12411c5cec1
+#    #推送主题  后面跟着#是监控下面所有的话题
+#    topic: slope#
+#    #topic: my-test
+#    # 会话心跳时间
+#    keepAliveInterval: 20
+#    # 设置连接超时时间
+#    connectionTimeout: 3000
+#    timeout: 10
+#    keepalive: 20
+#  # 要消费的topic配置
+#  receive:
+#    topic: slopePush/slopePull/test/out,test,slope,sharjeck/ai/test/out
+OkHttpClit:
+  url: http://10.10.10.220:9501
+sms:
+  url: http://10.10.10.223:8830/msg_api/push
+
+
+#oss上传
+aliyun:
+  oss:
+    endpoint: oss-cn-chengdu.aliyuncs.com
+    accessKeyId: LTAI5tPEbubCGq5Rdwygbz4Q
+    secret: 7mQLWMaBJeZPRV1SRGogctYGXwppjQ
+    bucket: kaiwu-saas

+ 1 - 1
slope-modules/slope-detection/src/main/resources/bootstrap.yml

@@ -1,5 +1,5 @@
 server:
-  port: 18880
+  port: 18881
 
 spring:
   application:

+ 6 - 0
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceMapper.xml

@@ -56,10 +56,16 @@
                left join kws_project as p on pd.project_id = p.id
       WHERE d.del_flag = 0
         and m.del_flag = 0
+        and d.mountain_id = #{deviceQuery.mountainId}
+
           <if test="deviceQuery.deviceName != null and deviceQuery.deviceName != ''">
               and d.name like concat('%', #{deviceQuery.deviceName}
                    , '%')
           </if>
+      <if test="deviceQuery.projectName != null and deviceQuery.projectName != ''">
+          and p.name like concat('%', #{deviceQuery.projectName}
+          , '%')
+      </if>
           <if test="deviceQuery.id != null and deviceQuery.id != ''">
               and id = #{deviceQuery.id,jdbcType=BIGINT}
           </if>

+ 1 - 0
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceModelMapper.xml

@@ -43,6 +43,7 @@
         <include refid="Base_Column_List"/>
         from kws_device_model
         where del_flag = 0
+          and mountain_id = #{deviceModelQuery.mountainId}
         <if test="deviceModelQuery.name != null and deviceModelQuery.name != ''">
             and name like concat('%', #{deviceModelQuery.name}, '%')
         </if>

+ 4 - 2
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsIntegrationMapper.xml

@@ -43,9 +43,11 @@
       <include refid="Base_Column_List" />
       from kws_integration
       where del_flag=0
+        and mountain_id = #{integrationQuery.mountainId}
       <if test="integrationQuery.integrationName != null and integrationQuery.integrationName != ''">
         and integration_name like concat('%', #{integrationQuery.integrationName}, '%')
       </if>
+      order by create_time desc
     </select>
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     <!--@mbg.generated-->
@@ -57,12 +59,12 @@
     insert into kws_integration (id, integration_name, part_names, 
       unit, formula, remark, 
       `status`, create_by, create_time, 
-      update_by, update_time, del_flag,mountain_id
+      update_by, update_time, del_flag,mountain_id,ids
       )
     values (#{id,jdbcType=BIGINT}, #{integrationName,jdbcType=VARCHAR}, #{partNames,jdbcType=VARCHAR}, 
       #{unit,jdbcType=VARCHAR}, #{formula,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, 
       #{status,jdbcType=TINYINT}, #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, 
-      #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}, #{mountainId,jdbcType=BIGINT}
+      #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}, #{mountainId,jdbcType=BIGINT}, #{ids,jdbcType=VARCHAR}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">