Pārlūkot izejas kodu

切换服务器ip

5 gadi atpakaļ
vecāks
revīzija
fb83f3a969

+ 1 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/constant/Constant.java

@@ -25,6 +25,7 @@ import java.util.Map;
  */
 public class Constant {
     public static final String DEFAULT_PWD = "000000";//默认密码
+    public static final String IP_MATCH_REGULAR = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\n";//服务器ip匹配正则
     public static final Integer ASSETS_COMPANY = 0;//资产方编号
     public static final Integer PRODUCER_COMPANY = 1;//生产方编号
     public static final Integer SYS_PARENT_ID = 0;//系统管理员的上级id

+ 5 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldEquipmentServiceImpl.java

@@ -437,6 +437,11 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
     @Override
     public HttpRespMsg changeIp(ChangeIpCommand changeIpCommand) {
         HttpRespMsg msg = new HttpRespMsg();
+        //验证服务器ip是否满足正则表达式
+        if(!changeIpCommand.getIp().matches(Constant.IP_MATCH_REGULAR)){
+            msg.setError("服务器ip不合法");
+            return msg;
+        }
         changeIpCommandMapper.insert(changeIpCommand);
         return msg;
     }

+ 1 - 1
cloud-socket/src/com/js/kbt/UserTempGenConfig.xml

@@ -11,7 +11,7 @@
     <javaModelGenerator targetPackage="com.js.kbt.model" targetProject="cloud-socket" />
     <sqlMapGenerator targetPackage="com.js.kbt.mapper" targetProject="cloud-socket" />
     <javaClientGenerator targetPackage="com.js.kbt.mapper" targetProject="cloud-socket" type="XMLMAPPER" />
-    <table schema="cloud_model_test" tableName="rec_data_log" >
+    <table schema="cloud_model_test" tableName="change_ip_command" >
     	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/>
     </table>
 <!--     <table schema="cloud_model" tableName="tb_mould_equipment" > -->

+ 96 - 0
cloud-socket/src/com/js/kbt/mapper/ChangeIpCommandMapper.java

@@ -0,0 +1,96 @@
+package com.js.kbt.mapper;
+
+import com.js.kbt.model.ChangeIpCommand;
+import com.js.kbt.model.ChangeIpCommandExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface ChangeIpCommandMapper {
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    long countByExample(ChangeIpCommandExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    int deleteByExample(ChangeIpCommandExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    int deleteByPrimaryKey(Integer id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    int insert(ChangeIpCommand record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    int insertSelective(ChangeIpCommand record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    List<ChangeIpCommand> selectByExample(ChangeIpCommandExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    ChangeIpCommand selectByPrimaryKey(Integer id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    int updateByExampleSelective(@Param("record") ChangeIpCommand record, @Param("example") ChangeIpCommandExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    int updateByExample(@Param("record") ChangeIpCommand record, @Param("example") ChangeIpCommandExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    int updateByPrimaryKeySelective(ChangeIpCommand record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    int updateByPrimaryKey(ChangeIpCommand record);
+}

+ 286 - 0
cloud-socket/src/com/js/kbt/mapper/ChangeIpCommandMapper.xml

@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.js.kbt.mapper.ChangeIpCommandMapper">
+  <resultMap id="BaseResultMap" type="com.js.kbt.model.ChangeIpCommand">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="ip" jdbcType="VARCHAR" property="ip" />
+    <result column="port" jdbcType="VARCHAR" property="port" />
+    <result column="indate" jdbcType="TIMESTAMP" property="indate" />
+    <result column="is_send" jdbcType="INTEGER" property="isSend" />
+  </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 Fri Nov 01 09:40:44 CST 2019.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    id, ip, port, indate, is_send
+  </sql>
+  <select id="selectByExample" parameterType="com.js.kbt.model.ChangeIpCommandExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from change_ip_command
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from change_ip_command
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    delete from change_ip_command
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.js.kbt.model.ChangeIpCommandExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    delete from change_ip_command
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.js.kbt.model.ChangeIpCommand">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into change_ip_command (ip, port, indate, 
+      is_send)
+    values (#{ip,jdbcType=VARCHAR}, #{port,jdbcType=VARCHAR}, #{indate,jdbcType=TIMESTAMP}, 
+      #{isSend,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" parameterType="com.js.kbt.model.ChangeIpCommand">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into change_ip_command
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="ip != null">
+        ip,
+      </if>
+      <if test="port != null">
+        port,
+      </if>
+      <if test="indate != null">
+        indate,
+      </if>
+      <if test="isSend != null">
+        is_send,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="ip != null">
+        #{ip,jdbcType=VARCHAR},
+      </if>
+      <if test="port != null">
+        #{port,jdbcType=VARCHAR},
+      </if>
+      <if test="indate != null">
+        #{indate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="isSend != null">
+        #{isSend,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.js.kbt.model.ChangeIpCommandExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    select count(*) from change_ip_command
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    update change_ip_command
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=INTEGER},
+      </if>
+      <if test="record.ip != null">
+        ip = #{record.ip,jdbcType=VARCHAR},
+      </if>
+      <if test="record.port != null">
+        port = #{record.port,jdbcType=VARCHAR},
+      </if>
+      <if test="record.indate != null">
+        indate = #{record.indate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.isSend != null">
+        is_send = #{record.isSend,jdbcType=INTEGER},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    update change_ip_command
+    set id = #{record.id,jdbcType=INTEGER},
+      ip = #{record.ip,jdbcType=VARCHAR},
+      port = #{record.port,jdbcType=VARCHAR},
+      indate = #{record.indate,jdbcType=TIMESTAMP},
+      is_send = #{record.isSend,jdbcType=INTEGER}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.js.kbt.model.ChangeIpCommand">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    update change_ip_command
+    <set>
+      <if test="ip != null">
+        ip = #{ip,jdbcType=VARCHAR},
+      </if>
+      <if test="port != null">
+        port = #{port,jdbcType=VARCHAR},
+      </if>
+      <if test="indate != null">
+        indate = #{indate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="isSend != null">
+        is_send = #{isSend,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.js.kbt.model.ChangeIpCommand">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 01 09:40:44 CST 2019.
+    -->
+    update change_ip_command
+    set ip = #{ip,jdbcType=VARCHAR},
+      port = #{port,jdbcType=VARCHAR},
+      indate = #{indate,jdbcType=TIMESTAMP},
+      is_send = #{isSend,jdbcType=INTEGER}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 170 - 0
cloud-socket/src/com/js/kbt/model/ChangeIpCommand.java

@@ -0,0 +1,170 @@
+package com.js.kbt.model;
+
+import java.util.Date;
+
+public class ChangeIpCommand {
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column change_ip_command.id
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    private Integer id;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column change_ip_command.ip
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    private String ip;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column change_ip_command.port
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    private String port;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column change_ip_command.indate
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    private Date indate;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column change_ip_command.is_send
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    private Integer isSend;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column change_ip_command.id
+     *
+     * @return the value of change_ip_command.id
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column change_ip_command.id
+     *
+     * @param id the value for change_ip_command.id
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column change_ip_command.ip
+     *
+     * @return the value of change_ip_command.ip
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public String getIp() {
+        return ip;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column change_ip_command.ip
+     *
+     * @param ip the value for change_ip_command.ip
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column change_ip_command.port
+     *
+     * @return the value of change_ip_command.port
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public String getPort() {
+        return port;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column change_ip_command.port
+     *
+     * @param port the value for change_ip_command.port
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public void setPort(String port) {
+        this.port = port;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column change_ip_command.indate
+     *
+     * @return the value of change_ip_command.indate
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public Date getIndate() {
+        return indate;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column change_ip_command.indate
+     *
+     * @param indate the value for change_ip_command.indate
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public void setIndate(Date indate) {
+        this.indate = indate;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column change_ip_command.is_send
+     *
+     * @return the value of change_ip_command.is_send
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public Integer getIsSend() {
+        return isSend;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column change_ip_command.is_send
+     *
+     * @param isSend the value for change_ip_command.is_send
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public void setIsSend(Integer isSend) {
+        this.isSend = isSend;
+    }
+}

+ 623 - 0
cloud-socket/src/com/js/kbt/model/ChangeIpCommandExample.java

@@ -0,0 +1,623 @@
+package com.js.kbt.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class ChangeIpCommandExample {
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    protected String orderByClause;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    protected boolean distinct;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    protected List<Criteria> oredCriteria;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public ChangeIpCommandExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Integer value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Integer value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Integer value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Integer value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Integer value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Integer value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Integer> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Integer> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Integer value1, Integer value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Integer value1, Integer value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpIsNull() {
+            addCriterion("ip is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpIsNotNull() {
+            addCriterion("ip is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpEqualTo(String value) {
+            addCriterion("ip =", value, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpNotEqualTo(String value) {
+            addCriterion("ip <>", value, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpGreaterThan(String value) {
+            addCriterion("ip >", value, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpGreaterThanOrEqualTo(String value) {
+            addCriterion("ip >=", value, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpLessThan(String value) {
+            addCriterion("ip <", value, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpLessThanOrEqualTo(String value) {
+            addCriterion("ip <=", value, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpLike(String value) {
+            addCriterion("ip like", value, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpNotLike(String value) {
+            addCriterion("ip not like", value, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpIn(List<String> values) {
+            addCriterion("ip in", values, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpNotIn(List<String> values) {
+            addCriterion("ip not in", values, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpBetween(String value1, String value2) {
+            addCriterion("ip between", value1, value2, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andIpNotBetween(String value1, String value2) {
+            addCriterion("ip not between", value1, value2, "ip");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortIsNull() {
+            addCriterion("port is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortIsNotNull() {
+            addCriterion("port is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortEqualTo(String value) {
+            addCriterion("port =", value, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortNotEqualTo(String value) {
+            addCriterion("port <>", value, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortGreaterThan(String value) {
+            addCriterion("port >", value, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortGreaterThanOrEqualTo(String value) {
+            addCriterion("port >=", value, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortLessThan(String value) {
+            addCriterion("port <", value, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortLessThanOrEqualTo(String value) {
+            addCriterion("port <=", value, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortLike(String value) {
+            addCriterion("port like", value, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortNotLike(String value) {
+            addCriterion("port not like", value, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortIn(List<String> values) {
+            addCriterion("port in", values, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortNotIn(List<String> values) {
+            addCriterion("port not in", values, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortBetween(String value1, String value2) {
+            addCriterion("port between", value1, value2, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andPortNotBetween(String value1, String value2) {
+            addCriterion("port not between", value1, value2, "port");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateIsNull() {
+            addCriterion("indate is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateIsNotNull() {
+            addCriterion("indate is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateEqualTo(Date value) {
+            addCriterion("indate =", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateNotEqualTo(Date value) {
+            addCriterion("indate <>", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateGreaterThan(Date value) {
+            addCriterion("indate >", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateGreaterThanOrEqualTo(Date value) {
+            addCriterion("indate >=", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateLessThan(Date value) {
+            addCriterion("indate <", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateLessThanOrEqualTo(Date value) {
+            addCriterion("indate <=", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateIn(List<Date> values) {
+            addCriterion("indate in", values, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateNotIn(List<Date> values) {
+            addCriterion("indate not in", values, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateBetween(Date value1, Date value2) {
+            addCriterion("indate between", value1, value2, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateNotBetween(Date value1, Date value2) {
+            addCriterion("indate not between", value1, value2, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendIsNull() {
+            addCriterion("is_send is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendIsNotNull() {
+            addCriterion("is_send is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendEqualTo(Integer value) {
+            addCriterion("is_send =", value, "isSend");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendNotEqualTo(Integer value) {
+            addCriterion("is_send <>", value, "isSend");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendGreaterThan(Integer value) {
+            addCriterion("is_send >", value, "isSend");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendGreaterThanOrEqualTo(Integer value) {
+            addCriterion("is_send >=", value, "isSend");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendLessThan(Integer value) {
+            addCriterion("is_send <", value, "isSend");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendLessThanOrEqualTo(Integer value) {
+            addCriterion("is_send <=", value, "isSend");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendIn(List<Integer> values) {
+            addCriterion("is_send in", values, "isSend");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendNotIn(List<Integer> values) {
+            addCriterion("is_send not in", values, "isSend");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendBetween(Integer value1, Integer value2) {
+            addCriterion("is_send between", value1, value2, "isSend");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsSendNotBetween(Integer value1, Integer value2) {
+            addCriterion("is_send not between", value1, value2, "isSend");
+            return (Criteria) this;
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table change_ip_command
+     *
+     * @mbg.generated do_not_delete_during_merge Fri Nov 01 09:40:44 CST 2019
+     */
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table change_ip_command
+     *
+     * @mbg.generated Fri Nov 01 09:40:44 CST 2019
+     */
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 28 - 0
cloud-socket/src/com/js/kbt/socket/UserHandler.java

@@ -11,8 +11,10 @@ import javax.annotation.Resource;
 
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 import com.alibaba.fastjson.JSONObject;
+import com.js.kbt.mapper.ChangeIpCommandMapper;
 import com.js.kbt.mapper.LonLatRecordMapper;
 import com.js.kbt.mapper.MouldCycleRuntimeMapper;
 import com.js.kbt.mapper.MouldDownPacketMapper;
@@ -25,6 +27,8 @@ import com.js.kbt.mapper.TbFactoryMapper;
 import com.js.kbt.mapper.TbMouldEquipmentMapper;
 import com.js.kbt.mapper.TbMouldMapper;
 import com.js.kbt.mapper.TimeCalibrationRecordMapper;
+import com.js.kbt.model.ChangeIpCommand;
+import com.js.kbt.model.ChangeIpCommandExample;
 import com.js.kbt.model.LonLatRecord;
 import com.js.kbt.model.LonLatRecordExample;
 import com.js.kbt.model.MouldCycleRuntime;
@@ -82,6 +86,8 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 	private RecDataLogMapper recDataLogMapper;
 	@Resource
 	private LonLatRecordMapper lonLatRecordMapper;
+	@Resource
+	private ChangeIpCommandMapper changeIpCommandMapper;
 	
 
 	@Override
@@ -298,6 +304,28 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 		return deviceNum;
 	}
 	
+	//下发切换服务器ip命令
+	public void sendChangeIp(){
+		ChangeIpCommandExample example = new ChangeIpCommandExample();
+		example.createCriteria().andIsSendEqualTo(0);
+		List<ChangeIpCommand> list = changeIpCommandMapper.selectByExample(example);
+		if(!CollectionUtils.isEmpty(list)){
+			ChangeIpCommand changeIpCommand = list.get(0);
+			//#IPADDS=58.213.104.114:9090;
+			//下发切换服务器命令
+			StringBuffer sb = new StringBuffer();
+			sb.append("#IPADDS=").append(changeIpCommand.getIp()).append(":").append(changeIpCommand.getPort()).append(";");
+			logger.info("开始下发切换服务器命令字符串为;==>" + sb.toString());
+			String strHexStr16 = strHexStr16(sb.toString());
+			logger.info("下发切换服务器ip转换后的16进制为;==>" + strHexStr16);
+			sendMsg(strHexStr16);
+			//下发完修改状态为已下发
+			changeIpCommand.setIsSend(1);
+			changeIpCommandMapper.updateByPrimaryKeySelective(changeIpCommand);
+		}
+	}
+	
+	
 	public void sendPackage(String equipmentNo) {
 		if (equipmentNo.indexOf("FAAF") != -1) {
 			logger.info("非法云模盒编号,不作下发处理");

+ 2 - 2
cloud-socket/src/jdbc.properties

@@ -1,5 +1,5 @@
-#classPath=D:/model/cloud-socket/WebContent/WEB-INF/lib/mysql-connector-java-5.1.31-bin.jar
-classPath=D:/workspace/yunsu/cloud-socket/WebContent/WEB-INF/lib/mysql-connector-java-5.1.31-bin.jar
+classPath=D:/model/cloud-socket/WebContent/WEB-INF/lib/mysql-connector-java-5.1.31-bin.jar
+#classPath=D:/workspace/yunsu/cloud-socket/WebContent/WEB-INF/lib/mysql-connector-java-5.1.31-bin.jar
 driver=com.mysql.jdbc.Driver
 url=jdbc:mysql://118.190.47.230:3306/cloud_model?autoReconnect=true&rewriteBatchedStatements=TRUE&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8
 username=root