Pārlūkot izejas kodu

下发阈值数据包

5 gadi atpakaļ
vecāks
revīzija
8971369bd2

+ 21 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldDownPacketController.java

@@ -0,0 +1,21 @@
+package com.hssx.cloudmodel.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-10-29
+ */
+@RestController
+@RequestMapping("/mould-down-packet")
+public class MouldDownPacketController {
+
+}
+

+ 14 - 14
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldEquipmentController.java

@@ -77,7 +77,7 @@ public class MouldEquipmentController {
      * hotAlarmLimit 热报警限值:(1 字节,十六进制)如:50=80
      * isUse:0-停止,1-启动
      * equipmentNo 设备编号(可能是多个或者一个)多个以“,”隔开传  如:"123456"(单个),"123456,456878,123589"(多个)
-     * workInterval 工作状态时间间隔,freeInterval 空闲状态的时间间隔
+     * workInterval 工作状态时间间隔,freeInterval 空闲状态的时间间隔,threshold 阈值
      */
     @ApiOperation("启用设备")
     @RequestMapping("/use")
@@ -148,18 +148,18 @@ public class MouldEquipmentController {
         return msg;
     }
 
-    /**
-     * 设置传感器阈值20~200
-     * 参数 threshold 传感器阈值(范围20~200)
-     * @return
-     */
-    @ApiOperation("设置传感器阈值20~200")
-    @RequestMapping("/setThreshold")
-    @ResponseBody
-    public synchronized HttpRespMsg  setThreshold(SensorThreshold sensorThreshold){
-        HttpRespMsg msg = new HttpRespMsg();
-        msg = mouldEquipmentService.setThreshold(sensorThreshold);
-        return msg;
-    }
+//    /**
+//     * 设置传感器阈值20~200
+//     * 参数 threshold 传感器阈值(范围20~200)
+//     * @return
+//     */
+//    @ApiOperation("设置传感器阈值20~200")
+//    @RequestMapping("/setThreshold")
+//    @ResponseBody
+//    public synchronized HttpRespMsg  setThreshold(SensorThreshold sensorThreshold){
+//        HttpRespMsg msg = new HttpRespMsg();
+//        msg = mouldEquipmentService.setThreshold(sensorThreshold);
+//        return msg;
+//    }
 }
 

+ 15 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/MouldDownPacket.java

@@ -49,6 +49,12 @@ public class MouldDownPacket extends Model<MouldDownPacket> {
     @TableField("is_use")
     private Integer isUse;
 
+    /**
+     * 阈值
+     */
+    @TableField("threshold")
+    private String threshold;
+
 
     public Integer getId() {
         return id;
@@ -90,6 +96,14 @@ public class MouldDownPacket extends Model<MouldDownPacket> {
         this.isUse = isUse;
     }
 
+    public String getThreshold() {
+        return threshold;
+    }
+
+    public void setThreshold(String threshold) {
+        this.threshold = threshold;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.id;
@@ -103,6 +117,7 @@ public class MouldDownPacket extends Model<MouldDownPacket> {
         ", packetStr=" + packetStr +
         ", indate=" + indate +
         ", isUse=" + isUse +
+        ", threshold=" + threshold +
         "}";
     }
 }

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/entity/vo/MouldEquipmentVO.java

@@ -25,7 +25,7 @@ public class MouldEquipmentVO extends MouldEquipment {
     private Integer hotAlarmLimit;//最高温度
     private Integer workInterval=30;//工作状态上报间隔 30 分钟
     private Integer freeInterval=120;//空闲状态上报间隔 120分钟
-    private Integer threshold=30;//传感器阈值20~200
+    private String threshold;//传感器阈值20~200
     /**
      * 模具编号
      */

+ 0 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/service/MouldEquipmentService.java

@@ -34,5 +34,4 @@ public interface MouldEquipmentService extends IService<MouldEquipment> {
 
     HttpRespMsg getEquipmentListByOldMouldAndUser(UserVO userVO);
 
-    HttpRespMsg setThreshold(SensorThreshold sensorThreshold);
 }

+ 15 - 25
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldEquipmentServiceImpl.java

@@ -104,19 +104,23 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
         if (lowPowerLimitStr.length() == 1) {
             lowPowerLimitStr = "0" + lowPowerLimitStr;
         }
-        String freeInterval = Integer.toHexString(mouldEquipment.getFreeInterval());
-        if (freeInterval.length() == 1) {
-            freeInterval = "0" + freeInterval;
-        }
         String workInterval = Integer.toHexString(mouldEquipment.getWorkInterval());
-        if (workInterval.length() == 1) {
-            workInterval = "0" + workInterval;
-        }
+            if (workInterval.length() == 1) {
+                workInterval = "0" + workInterval;
+            }
+            String freeInterval = Integer.toHexString(mouldEquipment.getFreeInterval());
+            if (freeInterval.length() == 1) {
+                freeInterval = "0" + freeInterval;
+            }
         String hotAlarmLimitStr = Integer.toHexString(mouldEquipment.getHotAlarmLimit());
         if (hotAlarmLimitStr.length() == 1) {
             hotAlarmLimitStr = "0" + hotAlarmLimitStr;
         }
         String isUseStr = "0" + Integer.toHexString(mouldEquipment.getIsUse());
+        String threshold="";
+        if(null != mouldEquipment.getThreshold()) {
+            threshold = String.format("%04d", Integer.parseInt(mouldEquipment.getThreshold()));
+        }
         //判断是不是超级管理员,是才可操作
         if (user.getParentId() == 0) {
             //修改设备
@@ -137,9 +141,12 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
                 equipment.setHillNumber(mouldEquipment.getLowPowerLimit() + "");
                 equipment.setTemperature(mouldEquipment.getHotAlarmLimit());
                 mouldEquipmentMapper.update(equipment, new QueryWrapper<MouldEquipment>().eq("equipment_no", str));
+                MouldDownPacket mouldDownPacket = new MouldDownPacket();
+                if(!threshold.equals("")) {
+                    mouldDownPacket.setThreshold(threshold);
+                }
                 if (packet != null) {
                     //已经存在更新下发数据包
-                    MouldDownPacket mouldDownPacket = new MouldDownPacket();
                     mouldDownPacket.setId(packet.getId());
                     setPacketMessage = downProcessMsg(lowPowerLimitStr, hotAlarmLimitStr, isUseStr, freeInterval, workInterval);
                     mouldDownPacket.setPacketStr(setPacketMessage);
@@ -147,7 +154,6 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
                     mouldDownPacket.setEquipmentNo(str);
                     mouldDownPacketMapper.updateById(mouldDownPacket);
                 } else {
-                    MouldDownPacket mouldDownPacket = new MouldDownPacket();
                     setPacketMessage = downProcessMsg(lowPowerLimitStr, hotAlarmLimitStr, isUseStr, freeInterval, workInterval);
                     mouldDownPacket.setPacketStr(setPacketMessage);
                     mouldDownPacket.setIsUse(mouldEquipment.getIsUse());
@@ -426,21 +432,6 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
         return msg;
     }
 
-    @Override
-    public HttpRespMsg setThreshold(SensorThreshold sensorThreshold) {
-        HttpRespMsg msg = new HttpRespMsg();
-        List<SensorThreshold> sensorThresholds = sensorThresholdMapper.selectList(new QueryWrapper<SensorThreshold>().last("limit 1"));
-        if(sensorThresholds.size() == 0){
-            sensorThreshold.setThreshold(String.format("%04d", Integer.parseInt(sensorThreshold.getThreshold())));
-            sensorThresholdMapper.insert(sensorThreshold);
-        }else{
-            SensorThreshold sensor = sensorThresholds.get(0);
-            sensor.setThreshold(String.format("%04d", Integer.parseInt(sensorThreshold.getThreshold())));
-            sensorThresholdMapper.updateById(sensor);
-        }
-        return msg;
-    }
-
     /**
      * 输入流转file
      *
@@ -495,5 +486,4 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
         System.out.println("lastPart===>" + lastPart);
         return lastPart;
     }
-
 }

+ 3 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldHistoryServiceImpl.java

@@ -9,6 +9,7 @@ import com.hssx.cloudmodel.entity.vo.MouldHistoryVO;
 import com.hssx.cloudmodel.mapper.MouldCycleRuntimeMapper;
 import com.hssx.cloudmodel.mapper.MouldHistoryMapper;
 import com.hssx.cloudmodel.mapper.MouldHistoryTimeMapper;
+import com.hssx.cloudmodel.mapper.MouldMapper;
 import com.hssx.cloudmodel.service.MouldHistoryService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.cloudmodel.util.HttpRespMsg;
@@ -35,6 +36,8 @@ public class MouldHistoryServiceImpl extends ServiceImpl<MouldHistoryMapper, Mou
     private MouldHistoryTimeMapper mouldHistoryTimeMapper;
     @Resource
     private MouldCycleRuntimeMapper mouldCycleRuntimeMapper;
+    @Resource
+    private MouldMapper mouldMapper;
     @Override
     public HttpRespMsg getOpeningAndClosingTimesChart(String equipmentNo, String time) {
         HttpRespMsg msg = new HttpRespMsg();

+ 2 - 1
cloud-model/src/main/resources/mapper/MouldDownPacketMapper.xml

@@ -9,11 +9,12 @@
         <result column="packet_str" property="packetStr" />
         <result column="indate" property="indate" />
         <result column="is_use" property="isUse" />
+        <result column="threshold" property="threshold" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, equipment_no, packet_str, indate, is_use
+        id, equipment_no, packet_str, indate, is_use, threshold
     </sql>
 
 </mapper>

+ 11 - 11
cloud-socket/src/com/js/kbt/mapper/MouldDownPacketMapper.java

@@ -9,68 +9,68 @@ public interface MouldDownPacketMapper {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	long countByExample(MouldDownPacketExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	int deleteByExample(MouldDownPacketExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	int deleteByPrimaryKey(Integer id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	int insert(MouldDownPacket record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	int insertSelective(MouldDownPacket record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	List<MouldDownPacket> selectByExample(MouldDownPacketExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	MouldDownPacket selectByPrimaryKey(Integer id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	int updateByExampleSelective(@Param("record") MouldDownPacket record,
 			@Param("example") MouldDownPacketExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	int updateByExample(@Param("record") MouldDownPacket record, @Param("example") MouldDownPacketExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	int updateByPrimaryKeySelective(MouldDownPacket record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	int updateByPrimaryKey(MouldDownPacket record);
 }

+ 35 - 20
cloud-socket/src/com/js/kbt/mapper/MouldDownPacketMapper.xml

@@ -5,19 +5,20 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="equipment_no" jdbcType="VARCHAR" property="equipmentNo" />
     <result column="packet_str" jdbcType="VARCHAR" property="packetStr" />
     <result column="indate" jdbcType="TIMESTAMP" property="indate" />
     <result column="is_use" jdbcType="INTEGER" property="isUse" />
+    <result column="threshold" jdbcType="VARCHAR" property="threshold" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     <where>
       <foreach collection="oredCriteria" item="criteria" separator="or">
@@ -51,7 +52,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     <where>
       <foreach collection="example.oredCriteria" item="criteria" separator="or">
@@ -85,15 +86,15 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
-    id, equipment_no, packet_str, indate, is_use
+    id, equipment_no, packet_str, indate, is_use, threshold
   </sql>
   <select id="selectByExample" parameterType="com.js.kbt.model.MouldDownPacketExample" resultMap="BaseResultMap">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     select
     <if test="distinct">
@@ -112,7 +113,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     select 
     <include refid="Base_Column_List" />
@@ -123,7 +124,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     delete from mould_down_packet
     where id = #{id,jdbcType=INTEGER}
@@ -132,7 +133,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     delete from mould_down_packet
     <if test="_parameter != null">
@@ -143,21 +144,21 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
       SELECT LAST_INSERT_ID()
     </selectKey>
     insert into mould_down_packet (equipment_no, packet_str, indate, 
-      is_use)
+      is_use, threshold)
     values (#{equipmentNo,jdbcType=VARCHAR}, #{packetStr,jdbcType=VARCHAR}, #{indate,jdbcType=TIMESTAMP}, 
-      #{isUse,jdbcType=INTEGER})
+      #{isUse,jdbcType=INTEGER}, #{threshold,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.js.kbt.model.MouldDownPacket">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
       SELECT LAST_INSERT_ID()
@@ -176,6 +177,9 @@
       <if test="isUse != null">
         is_use,
       </if>
+      <if test="threshold != null">
+        threshold,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="equipmentNo != null">
@@ -190,13 +194,16 @@
       <if test="isUse != null">
         #{isUse,jdbcType=INTEGER},
       </if>
+      <if test="threshold != null">
+        #{threshold,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.js.kbt.model.MouldDownPacketExample" resultType="java.lang.Long">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     select count(*) from mould_down_packet
     <if test="_parameter != null">
@@ -207,7 +214,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     update mould_down_packet
     <set>
@@ -226,6 +233,9 @@
       <if test="record.isUse != null">
         is_use = #{record.isUse,jdbcType=INTEGER},
       </if>
+      <if test="record.threshold != null">
+        threshold = #{record.threshold,jdbcType=VARCHAR},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -235,14 +245,15 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     update mould_down_packet
     set id = #{record.id,jdbcType=INTEGER},
       equipment_no = #{record.equipmentNo,jdbcType=VARCHAR},
       packet_str = #{record.packetStr,jdbcType=VARCHAR},
       indate = #{record.indate,jdbcType=TIMESTAMP},
-      is_use = #{record.isUse,jdbcType=INTEGER}
+      is_use = #{record.isUse,jdbcType=INTEGER},
+      threshold = #{record.threshold,jdbcType=VARCHAR}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -251,7 +262,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     update mould_down_packet
     <set>
@@ -267,6 +278,9 @@
       <if test="isUse != null">
         is_use = #{isUse,jdbcType=INTEGER},
       </if>
+      <if test="threshold != null">
+        threshold = #{threshold,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -274,13 +288,14 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 29 16:02:41 CST 2019.
+      This element was generated on Tue Oct 29 17:39:24 CST 2019.
     -->
     update mould_down_packet
     set equipment_no = #{equipmentNo,jdbcType=VARCHAR},
       packet_str = #{packetStr,jdbcType=VARCHAR},
       indate = #{indate,jdbcType=TIMESTAMP},
-      is_use = #{isUse,jdbcType=INTEGER}
+      is_use = #{isUse,jdbcType=INTEGER},
+      threshold = #{threshold,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}
   </update>
 </mapper>

+ 38 - 15
cloud-socket/src/com/js/kbt/model/MouldDownPacket.java

@@ -6,34 +6,39 @@ public class MouldDownPacket {
 
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_down_packet.id
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	private Integer id;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_down_packet.equipment_no
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	private String equipmentNo;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_down_packet.packet_str
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	private String packetStr;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_down_packet.indate
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	private Date indate;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_down_packet.is_use
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	private Integer isUse;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_down_packet.threshold
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
+	 */
+	private String threshold;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_down_packet.id
 	 * @return  the value of mould_down_packet.id
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public Integer getId() {
 		return id;
@@ -42,7 +47,7 @@ public class MouldDownPacket {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_down_packet.id
 	 * @param id  the value for mould_down_packet.id
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public void setId(Integer id) {
 		this.id = id;
@@ -51,7 +56,7 @@ public class MouldDownPacket {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_down_packet.equipment_no
 	 * @return  the value of mould_down_packet.equipment_no
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public String getEquipmentNo() {
 		return equipmentNo;
@@ -60,7 +65,7 @@ public class MouldDownPacket {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_down_packet.equipment_no
 	 * @param equipmentNo  the value for mould_down_packet.equipment_no
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public void setEquipmentNo(String equipmentNo) {
 		this.equipmentNo = equipmentNo;
@@ -69,7 +74,7 @@ public class MouldDownPacket {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_down_packet.packet_str
 	 * @return  the value of mould_down_packet.packet_str
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public String getPacketStr() {
 		return packetStr;
@@ -78,7 +83,7 @@ public class MouldDownPacket {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_down_packet.packet_str
 	 * @param packetStr  the value for mould_down_packet.packet_str
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public void setPacketStr(String packetStr) {
 		this.packetStr = packetStr;
@@ -87,7 +92,7 @@ public class MouldDownPacket {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_down_packet.indate
 	 * @return  the value of mould_down_packet.indate
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public Date getIndate() {
 		return indate;
@@ -96,7 +101,7 @@ public class MouldDownPacket {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_down_packet.indate
 	 * @param indate  the value for mould_down_packet.indate
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public void setIndate(Date indate) {
 		this.indate = indate;
@@ -105,7 +110,7 @@ public class MouldDownPacket {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_down_packet.is_use
 	 * @return  the value of mould_down_packet.is_use
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public Integer getIsUse() {
 		return isUse;
@@ -114,9 +119,27 @@ public class MouldDownPacket {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_down_packet.is_use
 	 * @param isUse  the value for mould_down_packet.is_use
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public void setIsUse(Integer isUse) {
 		this.isUse = isUse;
 	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_down_packet.threshold
+	 * @return  the value of mould_down_packet.threshold
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
+	 */
+	public String getThreshold() {
+		return threshold;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_down_packet.threshold
+	 * @param threshold  the value for mould_down_packet.threshold
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
+	 */
+	public void setThreshold(String threshold) {
+		this.threshold = threshold;
+	}
 }

+ 86 - 16
cloud-socket/src/com/js/kbt/model/MouldDownPacketExample.java

@@ -7,23 +7,23 @@ import java.util.List;
 public class MouldDownPacketExample {
     /**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	protected String orderByClause;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	protected boolean distinct;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	protected List<Criteria> oredCriteria;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public MouldDownPacketExample() {
 		oredCriteria = new ArrayList<Criteria>();
@@ -31,7 +31,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public void setOrderByClause(String orderByClause) {
 		this.orderByClause = orderByClause;
@@ -39,7 +39,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public String getOrderByClause() {
 		return orderByClause;
@@ -47,7 +47,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public void setDistinct(boolean distinct) {
 		this.distinct = distinct;
@@ -55,7 +55,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public boolean isDistinct() {
 		return distinct;
@@ -63,7 +63,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public List<Criteria> getOredCriteria() {
 		return oredCriteria;
@@ -71,7 +71,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public void or(Criteria criteria) {
 		oredCriteria.add(criteria);
@@ -79,7 +79,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public Criteria or() {
 		Criteria criteria = createCriteriaInternal();
@@ -89,7 +89,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public Criteria createCriteria() {
 		Criteria criteria = createCriteriaInternal();
@@ -101,7 +101,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	protected Criteria createCriteriaInternal() {
 		Criteria criteria = new Criteria();
@@ -110,7 +110,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public void clear() {
 		oredCriteria.clear();
@@ -120,7 +120,7 @@ public class MouldDownPacketExample {
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	protected abstract static class GeneratedCriteria {
 		protected List<Criterion> criteria;
@@ -482,11 +482,81 @@ public class MouldDownPacketExample {
 			addCriterion("is_use not between", value1, value2, "isUse");
 			return (Criteria) this;
 		}
+
+		public Criteria andThresholdIsNull() {
+			addCriterion("threshold is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdIsNotNull() {
+			addCriterion("threshold is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdEqualTo(String value) {
+			addCriterion("threshold =", value, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdNotEqualTo(String value) {
+			addCriterion("threshold <>", value, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdGreaterThan(String value) {
+			addCriterion("threshold >", value, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdGreaterThanOrEqualTo(String value) {
+			addCriterion("threshold >=", value, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdLessThan(String value) {
+			addCriterion("threshold <", value, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdLessThanOrEqualTo(String value) {
+			addCriterion("threshold <=", value, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdLike(String value) {
+			addCriterion("threshold like", value, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdNotLike(String value) {
+			addCriterion("threshold not like", value, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdIn(List<String> values) {
+			addCriterion("threshold in", values, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdNotIn(List<String> values) {
+			addCriterion("threshold not in", values, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdBetween(String value1, String value2) {
+			addCriterion("threshold between", value1, value2, "threshold");
+			return (Criteria) this;
+		}
+
+		public Criteria andThresholdNotBetween(String value1, String value2) {
+			addCriterion("threshold not between", value1, value2, "threshold");
+			return (Criteria) this;
+		}
 	}
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table mould_down_packet
-	 * @mbg.generated  Tue Oct 29 16:02:41 CST 2019
+	 * @mbg.generated  Tue Oct 29 17:39:24 CST 2019
 	 */
 	public static class Criterion {
 		private String condition;

+ 4 - 2
cloud-socket/src/com/js/kbt/socket/UserHandler.java

@@ -260,8 +260,6 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 			sendMsg(strHexStr16);
 			return deviceNum;
 		}
-		//下发传感器阈值20~200
-		sendThreshold();
 		// 返回设备编号
 		return deviceNum;
 	}
@@ -294,6 +292,10 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 			// 下发数据包,下发完后修改状态
 			logger.info("开始下发数据包==>" + packet.getPacketStr());
 			sendMsg(packet.getPacketStr());
+			if(null != packet.getThreshold()){
+				//下发阈值命令
+				sendMsg("#LIMIT VALUE="+packet.getThreshold());
+			}
 			if (count > 0) {
 				TbMouldEquipment me = tbMouldEquipmentMapper.selectByExample(meqExp).get(0);
 				me.setIsUse(packet.getIsUse());