浏览代码

字节编码解析

quyueting 5 年之前
父节点
当前提交
42a4ffb07f

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

@@ -5,56 +5,14 @@
 	<classPathEntry location="${classPath}"/>
   <context id="context1" targetRuntime="MyBatis3">
   
-    <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://118.190.47.230:3306/kbt"
-     userId="root" password="p011430seya" >
-     
+    <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://118.190.47.230:3306/cloud_model"
+     userId="root" password="p011430seya10" >
     </jdbcConnection>
-<!--     <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/kbt"  -->
-<!--      userId="root" password="yj940923" > -->
-     
-<!--     </jdbcConnection> -->
-    <javaModelGenerator targetPackage="com.js.kbt.model" targetProject="JSKBT" />
-    <sqlMapGenerator targetPackage="com.js.kbt.mapper" targetProject="JSKBT" />
-    <javaClientGenerator targetPackage="com.js.kbt.mapper" targetProject="JSKBT" type="XMLMAPPER" />
-<!--     <table schema="JSKBT" tableName="vcustomer_query" > -->
-<!--     </table> -->
-<!--     <table schema="JSKBT" tableName="user" > -->
-<!--     </table> -->
-<!--     <table schema="JSKBT" tableName="vseller_sum" > -->
-<!--     </table> -->
-<!--     <table schema="JSKBT" tableName="chat_msg" > -->
-<!--     <generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-<!--     <table schema="kbt" tableName="user" > -->
-<!--     <generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-<!--     <table schema="kbt" tableName="sys_user" > -->
-<!--     <generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-    <table schema="kbt" tableName="user_num" >
-<!--     	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
+    <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" tableName="mould_history" >
+    	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/>
     </table>
-<!--     <table schema="kbt" tableName="park_order" > -->
-<!--     <generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-<!--     <table schema="kbt" tableName="order" > -->
-<!--     <table schema="kbt" tableName="order" > -->
-<!--     <generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-<!--     <table schema="kbt" tableName="vcoupon" > -->
-<!--     <generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-<!--     <table schema="kbt" tableName="order" > -->
-<!--     <generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-<!--      <table schema="kbt" tableName="coupon_type" > -->
-<!--     <generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-<!--     <table schema="kbt" tableName="message" > -->
-<!--     <generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-<!--     <table schema="kbt" tableName="order" > -->
-<!--     <generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
   </context>
 </generatorConfiguration>

+ 75 - 0
cloud-socket/src/com/js/kbt/mapper/MouldHistoryMapper.java

@@ -0,0 +1,75 @@
+package com.js.kbt.mapper;
+
+import com.js.kbt.model.MouldHistory;
+import com.js.kbt.model.MouldHistoryExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface MouldHistoryMapper {
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	long countByExample(MouldHistoryExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	int deleteByExample(MouldHistoryExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	int deleteByPrimaryKey(Long id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	int insert(MouldHistory record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	int insertSelective(MouldHistory record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	List<MouldHistory> selectByExample(MouldHistoryExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	MouldHistory selectByPrimaryKey(Long id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	int updateByExampleSelective(@Param("record") MouldHistory record, @Param("example") MouldHistoryExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	int updateByExample(@Param("record") MouldHistory record, @Param("example") MouldHistoryExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	int updateByPrimaryKeySelective(MouldHistory record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	int updateByPrimaryKey(MouldHistory record);
+}

+ 522 - 0
cloud-socket/src/com/js/kbt/mapper/MouldHistoryMapper.xml

@@ -0,0 +1,522 @@
+<?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.MouldHistoryMapper">
+  <resultMap id="BaseResultMap" type="com.js.kbt.model.MouldHistory">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 01 15:49:20 CST 2019.
+    -->
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="sim" jdbcType="VARCHAR" property="sim" />
+    <result column="model_no" jdbcType="VARCHAR" property="modelNo" />
+    <result column="version" jdbcType="VARCHAR" property="version" />
+    <result column="status" jdbcType="VARCHAR" property="status" />
+    <result column="lng" jdbcType="VARCHAR" property="lng" />
+    <result column="lat" jdbcType="VARCHAR" property="lat" />
+    <result column="gprs_lac" jdbcType="VARCHAR" property="gprsLac" />
+    <result column="gprs_ic" jdbcType="VARCHAR" property="gprsIc" />
+    <result column="wifi_bbsid" jdbcType="VARCHAR" property="wifiBbsid" />
+    <result column="temperature" jdbcType="INTEGER" property="temperature" />
+    <result column="battery" jdbcType="INTEGER" property="battery" />
+    <result column="sig_2g" jdbcType="INTEGER" property="sig2g" />
+    <result column="sig_nb" jdbcType="INTEGER" property="sigNb" />
+    <result column="sig_wifi" jdbcType="INTEGER" property="sigWifi" />
+    <result column="ext0" jdbcType="VARCHAR" property="ext0" />
+    <result column="alarm" jdbcType="INTEGER" property="alarm" />
+    <result column="run_cnt" jdbcType="INTEGER" property="runCnt" />
+    <result column="crc_code" jdbcType="VARCHAR" property="crcCode" />
+    <result column="indate" jdbcType="TIMESTAMP" property="indate" />
+  </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 Thu Aug 01 15:49:20 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 Thu Aug 01 15:49:20 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 Thu Aug 01 15:49:20 CST 2019.
+    -->
+    id, sim, model_no, version, status, lng, lat, gprs_lac, gprs_ic, wifi_bbsid, temperature, 
+    battery, sig_2g, sig_nb, sig_wifi, ext0, alarm, run_cnt, crc_code, indate
+  </sql>
+  <select id="selectByExample" parameterType="com.js.kbt.model.MouldHistoryExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 01 15:49:20 CST 2019.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from mould_history
+    <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.Long" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 01 15:49:20 CST 2019.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from mould_history
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 01 15:49:20 CST 2019.
+    -->
+    delete from mould_history
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.js.kbt.model.MouldHistoryExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 01 15:49:20 CST 2019.
+    -->
+    delete from mould_history
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.js.kbt.model.MouldHistory">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 01 15:49:20 CST 2019.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into mould_history (sim, model_no, version, 
+      status, lng, lat, gprs_lac, 
+      gprs_ic, wifi_bbsid, temperature, 
+      battery, sig_2g, sig_nb, 
+      sig_wifi, ext0, alarm, 
+      run_cnt, crc_code, indate
+      )
+    values (#{sim,jdbcType=VARCHAR}, #{modelNo,jdbcType=VARCHAR}, #{version,jdbcType=VARCHAR}, 
+      #{status,jdbcType=VARCHAR}, #{lng,jdbcType=VARCHAR}, #{lat,jdbcType=VARCHAR}, #{gprsLac,jdbcType=VARCHAR}, 
+      #{gprsIc,jdbcType=VARCHAR}, #{wifiBbsid,jdbcType=VARCHAR}, #{temperature,jdbcType=INTEGER}, 
+      #{battery,jdbcType=INTEGER}, #{sig2g,jdbcType=INTEGER}, #{sigNb,jdbcType=INTEGER}, 
+      #{sigWifi,jdbcType=INTEGER}, #{ext0,jdbcType=VARCHAR}, #{alarm,jdbcType=INTEGER}, 
+      #{runCnt,jdbcType=INTEGER}, #{crcCode,jdbcType=VARCHAR}, #{indate,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.js.kbt.model.MouldHistory">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 01 15:49:20 CST 2019.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into mould_history
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="sim != null">
+        sim,
+      </if>
+      <if test="modelNo != null">
+        model_no,
+      </if>
+      <if test="version != null">
+        version,
+      </if>
+      <if test="status != null">
+        status,
+      </if>
+      <if test="lng != null">
+        lng,
+      </if>
+      <if test="lat != null">
+        lat,
+      </if>
+      <if test="gprsLac != null">
+        gprs_lac,
+      </if>
+      <if test="gprsIc != null">
+        gprs_ic,
+      </if>
+      <if test="wifiBbsid != null">
+        wifi_bbsid,
+      </if>
+      <if test="temperature != null">
+        temperature,
+      </if>
+      <if test="battery != null">
+        battery,
+      </if>
+      <if test="sig2g != null">
+        sig_2g,
+      </if>
+      <if test="sigNb != null">
+        sig_nb,
+      </if>
+      <if test="sigWifi != null">
+        sig_wifi,
+      </if>
+      <if test="ext0 != null">
+        ext0,
+      </if>
+      <if test="alarm != null">
+        alarm,
+      </if>
+      <if test="runCnt != null">
+        run_cnt,
+      </if>
+      <if test="crcCode != null">
+        crc_code,
+      </if>
+      <if test="indate != null">
+        indate,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="sim != null">
+        #{sim,jdbcType=VARCHAR},
+      </if>
+      <if test="modelNo != null">
+        #{modelNo,jdbcType=VARCHAR},
+      </if>
+      <if test="version != null">
+        #{version,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=VARCHAR},
+      </if>
+      <if test="lng != null">
+        #{lng,jdbcType=VARCHAR},
+      </if>
+      <if test="lat != null">
+        #{lat,jdbcType=VARCHAR},
+      </if>
+      <if test="gprsLac != null">
+        #{gprsLac,jdbcType=VARCHAR},
+      </if>
+      <if test="gprsIc != null">
+        #{gprsIc,jdbcType=VARCHAR},
+      </if>
+      <if test="wifiBbsid != null">
+        #{wifiBbsid,jdbcType=VARCHAR},
+      </if>
+      <if test="temperature != null">
+        #{temperature,jdbcType=INTEGER},
+      </if>
+      <if test="battery != null">
+        #{battery,jdbcType=INTEGER},
+      </if>
+      <if test="sig2g != null">
+        #{sig2g,jdbcType=INTEGER},
+      </if>
+      <if test="sigNb != null">
+        #{sigNb,jdbcType=INTEGER},
+      </if>
+      <if test="sigWifi != null">
+        #{sigWifi,jdbcType=INTEGER},
+      </if>
+      <if test="ext0 != null">
+        #{ext0,jdbcType=VARCHAR},
+      </if>
+      <if test="alarm != null">
+        #{alarm,jdbcType=INTEGER},
+      </if>
+      <if test="runCnt != null">
+        #{runCnt,jdbcType=INTEGER},
+      </if>
+      <if test="crcCode != null">
+        #{crcCode,jdbcType=VARCHAR},
+      </if>
+      <if test="indate != null">
+        #{indate,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.js.kbt.model.MouldHistoryExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 01 15:49:20 CST 2019.
+    -->
+    select count(*) from mould_history
+    <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 Thu Aug 01 15:49:20 CST 2019.
+    -->
+    update mould_history
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=BIGINT},
+      </if>
+      <if test="record.sim != null">
+        sim = #{record.sim,jdbcType=VARCHAR},
+      </if>
+      <if test="record.modelNo != null">
+        model_no = #{record.modelNo,jdbcType=VARCHAR},
+      </if>
+      <if test="record.version != null">
+        version = #{record.version,jdbcType=VARCHAR},
+      </if>
+      <if test="record.status != null">
+        status = #{record.status,jdbcType=VARCHAR},
+      </if>
+      <if test="record.lng != null">
+        lng = #{record.lng,jdbcType=VARCHAR},
+      </if>
+      <if test="record.lat != null">
+        lat = #{record.lat,jdbcType=VARCHAR},
+      </if>
+      <if test="record.gprsLac != null">
+        gprs_lac = #{record.gprsLac,jdbcType=VARCHAR},
+      </if>
+      <if test="record.gprsIc != null">
+        gprs_ic = #{record.gprsIc,jdbcType=VARCHAR},
+      </if>
+      <if test="record.wifiBbsid != null">
+        wifi_bbsid = #{record.wifiBbsid,jdbcType=VARCHAR},
+      </if>
+      <if test="record.temperature != null">
+        temperature = #{record.temperature,jdbcType=INTEGER},
+      </if>
+      <if test="record.battery != null">
+        battery = #{record.battery,jdbcType=INTEGER},
+      </if>
+      <if test="record.sig2g != null">
+        sig_2g = #{record.sig2g,jdbcType=INTEGER},
+      </if>
+      <if test="record.sigNb != null">
+        sig_nb = #{record.sigNb,jdbcType=INTEGER},
+      </if>
+      <if test="record.sigWifi != null">
+        sig_wifi = #{record.sigWifi,jdbcType=INTEGER},
+      </if>
+      <if test="record.ext0 != null">
+        ext0 = #{record.ext0,jdbcType=VARCHAR},
+      </if>
+      <if test="record.alarm != null">
+        alarm = #{record.alarm,jdbcType=INTEGER},
+      </if>
+      <if test="record.runCnt != null">
+        run_cnt = #{record.runCnt,jdbcType=INTEGER},
+      </if>
+      <if test="record.crcCode != null">
+        crc_code = #{record.crcCode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.indate != null">
+        indate = #{record.indate,jdbcType=TIMESTAMP},
+      </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 Thu Aug 01 15:49:20 CST 2019.
+    -->
+    update mould_history
+    set id = #{record.id,jdbcType=BIGINT},
+      sim = #{record.sim,jdbcType=VARCHAR},
+      model_no = #{record.modelNo,jdbcType=VARCHAR},
+      version = #{record.version,jdbcType=VARCHAR},
+      status = #{record.status,jdbcType=VARCHAR},
+      lng = #{record.lng,jdbcType=VARCHAR},
+      lat = #{record.lat,jdbcType=VARCHAR},
+      gprs_lac = #{record.gprsLac,jdbcType=VARCHAR},
+      gprs_ic = #{record.gprsIc,jdbcType=VARCHAR},
+      wifi_bbsid = #{record.wifiBbsid,jdbcType=VARCHAR},
+      temperature = #{record.temperature,jdbcType=INTEGER},
+      battery = #{record.battery,jdbcType=INTEGER},
+      sig_2g = #{record.sig2g,jdbcType=INTEGER},
+      sig_nb = #{record.sigNb,jdbcType=INTEGER},
+      sig_wifi = #{record.sigWifi,jdbcType=INTEGER},
+      ext0 = #{record.ext0,jdbcType=VARCHAR},
+      alarm = #{record.alarm,jdbcType=INTEGER},
+      run_cnt = #{record.runCnt,jdbcType=INTEGER},
+      crc_code = #{record.crcCode,jdbcType=VARCHAR},
+      indate = #{record.indate,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.js.kbt.model.MouldHistory">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 01 15:49:20 CST 2019.
+    -->
+    update mould_history
+    <set>
+      <if test="sim != null">
+        sim = #{sim,jdbcType=VARCHAR},
+      </if>
+      <if test="modelNo != null">
+        model_no = #{modelNo,jdbcType=VARCHAR},
+      </if>
+      <if test="version != null">
+        version = #{version,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        status = #{status,jdbcType=VARCHAR},
+      </if>
+      <if test="lng != null">
+        lng = #{lng,jdbcType=VARCHAR},
+      </if>
+      <if test="lat != null">
+        lat = #{lat,jdbcType=VARCHAR},
+      </if>
+      <if test="gprsLac != null">
+        gprs_lac = #{gprsLac,jdbcType=VARCHAR},
+      </if>
+      <if test="gprsIc != null">
+        gprs_ic = #{gprsIc,jdbcType=VARCHAR},
+      </if>
+      <if test="wifiBbsid != null">
+        wifi_bbsid = #{wifiBbsid,jdbcType=VARCHAR},
+      </if>
+      <if test="temperature != null">
+        temperature = #{temperature,jdbcType=INTEGER},
+      </if>
+      <if test="battery != null">
+        battery = #{battery,jdbcType=INTEGER},
+      </if>
+      <if test="sig2g != null">
+        sig_2g = #{sig2g,jdbcType=INTEGER},
+      </if>
+      <if test="sigNb != null">
+        sig_nb = #{sigNb,jdbcType=INTEGER},
+      </if>
+      <if test="sigWifi != null">
+        sig_wifi = #{sigWifi,jdbcType=INTEGER},
+      </if>
+      <if test="ext0 != null">
+        ext0 = #{ext0,jdbcType=VARCHAR},
+      </if>
+      <if test="alarm != null">
+        alarm = #{alarm,jdbcType=INTEGER},
+      </if>
+      <if test="runCnt != null">
+        run_cnt = #{runCnt,jdbcType=INTEGER},
+      </if>
+      <if test="crcCode != null">
+        crc_code = #{crcCode,jdbcType=VARCHAR},
+      </if>
+      <if test="indate != null">
+        indate = #{indate,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.js.kbt.model.MouldHistory">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 01 15:49:20 CST 2019.
+    -->
+    update mould_history
+    set sim = #{sim,jdbcType=VARCHAR},
+      model_no = #{modelNo,jdbcType=VARCHAR},
+      version = #{version,jdbcType=VARCHAR},
+      status = #{status,jdbcType=VARCHAR},
+      lng = #{lng,jdbcType=VARCHAR},
+      lat = #{lat,jdbcType=VARCHAR},
+      gprs_lac = #{gprsLac,jdbcType=VARCHAR},
+      gprs_ic = #{gprsIc,jdbcType=VARCHAR},
+      wifi_bbsid = #{wifiBbsid,jdbcType=VARCHAR},
+      temperature = #{temperature,jdbcType=INTEGER},
+      battery = #{battery,jdbcType=INTEGER},
+      sig_2g = #{sig2g,jdbcType=INTEGER},
+      sig_nb = #{sigNb,jdbcType=INTEGER},
+      sig_wifi = #{sigWifi,jdbcType=INTEGER},
+      ext0 = #{ext0,jdbcType=VARCHAR},
+      alarm = #{alarm,jdbcType=INTEGER},
+      run_cnt = #{runCnt,jdbcType=INTEGER},
+      crc_code = #{crcCode,jdbcType=VARCHAR},
+      indate = #{indate,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>

+ 467 - 0
cloud-socket/src/com/js/kbt/model/MouldHistory.java

@@ -0,0 +1,467 @@
+package com.js.kbt.model;
+
+import java.util.Date;
+
+public class MouldHistory {
+
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.id
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private Long id;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.sim
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String sim;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.model_no
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String modelNo;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.version
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String version;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.status
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String status;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.lng
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String lng;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.lat
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String lat;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.gprs_lac
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String gprsLac;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.gprs_ic
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String gprsIc;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.wifi_bbsid
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String wifiBbsid;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.temperature
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private Integer temperature;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.battery
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private Integer battery;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.sig_2g
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private Integer sig2g;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.sig_nb
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private Integer sigNb;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.sig_wifi
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private Integer sigWifi;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.ext0
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String ext0;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.alarm
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private Integer alarm;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.run_cnt
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private Integer runCnt;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.crc_code
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private String crcCode;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history.indate
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	private Date indate;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.id
+	 * @return  the value of mould_history.id
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public Long getId() {
+		return id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.id
+	 * @param id  the value for mould_history.id
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.sim
+	 * @return  the value of mould_history.sim
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getSim() {
+		return sim;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.sim
+	 * @param sim  the value for mould_history.sim
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setSim(String sim) {
+		this.sim = sim;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.model_no
+	 * @return  the value of mould_history.model_no
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getModelNo() {
+		return modelNo;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.model_no
+	 * @param modelNo  the value for mould_history.model_no
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setModelNo(String modelNo) {
+		this.modelNo = modelNo;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.version
+	 * @return  the value of mould_history.version
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getVersion() {
+		return version;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.version
+	 * @param version  the value for mould_history.version
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setVersion(String version) {
+		this.version = version;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.status
+	 * @return  the value of mould_history.status
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getStatus() {
+		return status;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.status
+	 * @param status  the value for mould_history.status
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.lng
+	 * @return  the value of mould_history.lng
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getLng() {
+		return lng;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.lng
+	 * @param lng  the value for mould_history.lng
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setLng(String lng) {
+		this.lng = lng;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.lat
+	 * @return  the value of mould_history.lat
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getLat() {
+		return lat;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.lat
+	 * @param lat  the value for mould_history.lat
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setLat(String lat) {
+		this.lat = lat;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.gprs_lac
+	 * @return  the value of mould_history.gprs_lac
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getGprsLac() {
+		return gprsLac;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.gprs_lac
+	 * @param gprsLac  the value for mould_history.gprs_lac
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setGprsLac(String gprsLac) {
+		this.gprsLac = gprsLac;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.gprs_ic
+	 * @return  the value of mould_history.gprs_ic
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getGprsIc() {
+		return gprsIc;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.gprs_ic
+	 * @param gprsIc  the value for mould_history.gprs_ic
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setGprsIc(String gprsIc) {
+		this.gprsIc = gprsIc;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.wifi_bbsid
+	 * @return  the value of mould_history.wifi_bbsid
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getWifiBbsid() {
+		return wifiBbsid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.wifi_bbsid
+	 * @param wifiBbsid  the value for mould_history.wifi_bbsid
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setWifiBbsid(String wifiBbsid) {
+		this.wifiBbsid = wifiBbsid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.temperature
+	 * @return  the value of mould_history.temperature
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public Integer getTemperature() {
+		return temperature;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.temperature
+	 * @param temperature  the value for mould_history.temperature
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setTemperature(Integer temperature) {
+		this.temperature = temperature;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.battery
+	 * @return  the value of mould_history.battery
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public Integer getBattery() {
+		return battery;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.battery
+	 * @param battery  the value for mould_history.battery
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setBattery(Integer battery) {
+		this.battery = battery;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.sig_2g
+	 * @return  the value of mould_history.sig_2g
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public Integer getSig2g() {
+		return sig2g;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.sig_2g
+	 * @param sig2g  the value for mould_history.sig_2g
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setSig2g(Integer sig2g) {
+		this.sig2g = sig2g;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.sig_nb
+	 * @return  the value of mould_history.sig_nb
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public Integer getSigNb() {
+		return sigNb;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.sig_nb
+	 * @param sigNb  the value for mould_history.sig_nb
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setSigNb(Integer sigNb) {
+		this.sigNb = sigNb;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.sig_wifi
+	 * @return  the value of mould_history.sig_wifi
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public Integer getSigWifi() {
+		return sigWifi;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.sig_wifi
+	 * @param sigWifi  the value for mould_history.sig_wifi
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setSigWifi(Integer sigWifi) {
+		this.sigWifi = sigWifi;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.ext0
+	 * @return  the value of mould_history.ext0
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getExt0() {
+		return ext0;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.ext0
+	 * @param ext0  the value for mould_history.ext0
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setExt0(String ext0) {
+		this.ext0 = ext0;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.alarm
+	 * @return  the value of mould_history.alarm
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public Integer getAlarm() {
+		return alarm;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.alarm
+	 * @param alarm  the value for mould_history.alarm
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setAlarm(Integer alarm) {
+		this.alarm = alarm;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.run_cnt
+	 * @return  the value of mould_history.run_cnt
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public Integer getRunCnt() {
+		return runCnt;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.run_cnt
+	 * @param runCnt  the value for mould_history.run_cnt
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setRunCnt(Integer runCnt) {
+		this.runCnt = runCnt;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.crc_code
+	 * @return  the value of mould_history.crc_code
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public String getCrcCode() {
+		return crcCode;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.crc_code
+	 * @param crcCode  the value for mould_history.crc_code
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setCrcCode(String crcCode) {
+		this.crcCode = crcCode;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history.indate
+	 * @return  the value of mould_history.indate
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public Date getIndate() {
+		return indate;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history.indate
+	 * @param indate  the value for mould_history.indate
+	 * @mbg.generated  Thu Aug 01 15:49:20 CST 2019
+	 */
+	public void setIndate(Date indate) {
+		this.indate = indate;
+	}
+}

文件差异内容过多而无法显示
+ 1572 - 0
cloud-socket/src/com/js/kbt/model/MouldHistoryExample.java


+ 26 - 0
cloud-socket/src/com/js/kbt/socket/CustomDecoder.java

@@ -0,0 +1,26 @@
+package com.js.kbt.socket;
+
+import java.util.List;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.string.StringDecoder;
+
+public class CustomDecoder extends StringDecoder {
+	@Override
+	protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
+	    String HEXES = "0123456789ABCDEF";
+	    byte[] req = new byte[msg.readableBytes()];
+	    msg.readBytes(req);
+	    final StringBuilder hex = new StringBuilder(2 * req.length);
+
+	    for (int i = 0; i < req.length; i++) {
+	        byte b = req[i];
+	        hex.append(HEXES.charAt((b & 0xF0) >> 4))
+	                .append(HEXES.charAt((b & 0x0F)));
+	    }
+	    System.out.println("decode="+hex.toString());
+	    out.add(hex.toString());
+
+	}
+}

+ 53 - 0
cloud-socket/src/com/js/kbt/socket/CustomEncoder.java

@@ -0,0 +1,53 @@
+package com.js.kbt.socket;
+
+import java.util.List;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.string.StringEncoder;
+
+public class CustomEncoder extends StringEncoder {
+	
+	
+	@Override
+	protected void encode(ChannelHandlerContext ctx, CharSequence msg, List<Object> out) throws Exception {
+//		super.encode(ctx, msg, out);
+		System.out.println("=="+msg);
+		String str = String.valueOf(msg);
+		byte[] b = hexStrToBinaryStr(str);
+		String ret = new String(b, "utf-8");
+		System.out.println("ret=="+ret);
+		out.add(ret);
+	}
+	public static byte[] hexStrToBinaryStr(String hexString) {
+		if (hexString == null || "".contentEquals(hexString)) {
+			return null;
+		}
+		hexString = hexString.replaceAll(" ", "");
+		int len = hexString.length();
+		int index = 0;
+		byte[] bytes = new byte[len / 2];
+		while (index < len) {
+			String sub = hexString.substring(index, index + 2);
+			bytes[index/2] = (byte)Integer.parseInt(sub,16);
+			index += 2;
+		}
+		return bytes;
+	}
+//	@Override
+//	protected void encode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
+//	    String HEXES = "0123456789ABCDEF";
+//	    byte[] req = new byte[msg.readableBytes()];
+//	    msg.readBytes(req);
+//	    final StringBuilder hex = new StringBuilder(2 * req.length);
+//
+//	    for (int i = 0; i < req.length; i++) {
+//	        byte b = req[i];
+//	        hex.append(HEXES.charAt((b & 0xF0) >> 4))
+//	                .append(HEXES.charAt((b & 0x0F)));
+//	    }
+//	    System.out.println("decode="+hex.toString());
+//	    out.add(hex.toString());
+//
+//	}
+}

+ 3 - 3
cloud-socket/src/com/js/kbt/socket/HelloServerInitializer.java

@@ -40,15 +40,15 @@ public class HelloServerInitializer extends ChannelInitializer<SocketChannel> {
 //				WRITE_IDEL_TIME_OUT, ALL_IDEL_TIME_OUT, TimeUnit.SECONDS)); // 1
 //        channelPipeline.addLast(new HeartbeatServerHandler());
 //        ByteBuf delimiter = Unpooled.copiedBuffer("&_".getBytes());
-        channelPipeline.addLast("idleStateHandler", new IdleStateHandler(READ_IDEL_TIME_OUT, WRITE_IDEL_TIME_OUT,ALL_IDEL_TIME_OUT));
+//        channelPipeline.addLast("idleStateHandler", new IdleStateHandler(READ_IDEL_TIME_OUT, WRITE_IDEL_TIME_OUT,ALL_IDEL_TIME_OUT));
 //        channelPipeline.addLast( new DelimiterBasedFrameDecoder(2048, delimiter));
         //为通道添加功能
         //字符串解码  编码
 //        channelPipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4));
 //        channelPipeline.addLast("frameEncoder", new LengthFieldPrepender(4));
 		
-        channelPipeline.addLast("decoder",new StringDecoder(Charset.forName("UTF-8")));
-        channelPipeline.addLast("encoder", new StringEncoder(Charset.forName("UTF-8")));
+        channelPipeline.addLast("decoder",new CustomDecoder());
+        channelPipeline.addLast("encoder", new StringDecoder(Charset.forName("UTF-8")));
         userHandler = getProcessHandler();
         //添加自主逻辑   
         channelPipeline.addLast(userHandler);

+ 126 - 159
cloud-socket/src/com/js/kbt/socket/UserHandler.java

@@ -1,186 +1,116 @@
 package com.js.kbt.socket;
  
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.SimpleChannelInboundHandler;
-import io.netty.handler.timeout.IdleState;
-import io.netty.handler.timeout.IdleStateEvent;
-
-import java.nio.channels.SocketChannel;
 import java.util.Date;
-import java.util.List;
-import java.util.UUID;
 
 import javax.annotation.Resource;
 
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Service;
 
-import com.alibaba.fastjson.JSONObject;
-import com.aliyuncs.exceptions.ClientException;
-import com.aliyuncs.exceptions.ServerException;
-import com.js.kbt.controller.HttpRespMsg;
-import com.js.kbt.mapper.CouponMapper;
-import com.js.kbt.mapper.ParkOrderMapper;
-import com.js.kbt.mapper.ParkingPointMapper;
-import com.js.kbt.mapper.UserMapper;
-import com.js.kbt.model.Coupon;
-import com.js.kbt.model.CouponExample;
-import com.js.kbt.model.ParkOrder;
-import com.js.kbt.model.ParkOrderExample;
-import com.js.kbt.model.ParkingPoint;
-import com.js.kbt.model.ParkingPointExample;
-import com.js.kbt.model.User;
-import com.js.kbt.model.UserExample;
-import com.js.kbt.util.aliPush;
+import com.js.kbt.mapper.MouldHistoryMapper;
+import com.js.kbt.model.MouldHistory;
+import com.js.kbt.util.MathUtil;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.SimpleChannelInboundHandler;
+import io.netty.handler.timeout.IdleState;
+import io.netty.handler.timeout.IdleStateEvent;
 @Service("userHandler")
 public class UserHandler extends SimpleChannelInboundHandler<String> {
 
     private static final Logger logger = Logger.getLogger(UserHandler.class);
     
-	public int roomId;
-	//推送玩家id, wxOpenid
-	public String identity;
-	//玩家在麻将牌局中的位置逆时针,从庄家开始0,1,2,3
-	public int pos;
-	
 	private ChannelHandlerContext ctx;
 	
-	@Resource(name="parkingPointMapper")
-	private ParkingPointMapper parkingPointMapper;
-	@Resource(name="userMapper")
-	private UserMapper userMapper;
-	@Resource(name="parkOrderMapper")
-	private ParkOrderMapper parkOrderMapper;
-	@Resource(name="couponMapper")
-	private CouponMapper couponMapper;
+	@Resource
+	private MouldHistoryMapper mouldHistoryMapper;
+	
     @Override
     protected void channelRead0(ChannelHandlerContext arg0, String arg1)
             {
         System.out.println("收到==="+arg1+"\n");
         String ret = processMsg(arg1);
         sendMsg(ret);
-        
-        //结束标志,关闭通道
-        if ("END".equals(ret)) {
-        	ctx.close();
-        }
     }
     
     private String processMsg(String input) {
-    	if (input.contains("HEART")) {
-    		//去掉心跳包,防止沾粘
-    		input = input.replaceAll("HEART", "");
-    	}
-    	String ret = "OK";
+    	String ret = "FA AF 00 07 02 1e 78 1e 50 00 3C";
     	System.out.println(new Date().toLocaleString()+"=====接收到======"+input);
-//    	if (input.startsWith("GET NUMBER")) {
-//    	} else if (input.contains("LDWC") || input.contains("LDWN")) {
-//    		//车子停好了,开始生成停车订单
-//    	} else if (input.contains("LUP")) {
-//    		//车子走了,设备升起来了,结算订单
-//    		ret = "END";
-//    	} else if ("NUM_ER".equals(input)) {
-//    		ret = "SN";
-//    	} else if (input.startsWith("LOGIN")) {
-//    		//设备登陆
-//    		identity = input.substring("LOGIN".length());
-//    		synchronized (HelloServer.locker) {
-//    			if (HelloServer.closePendingList.contains(identity)) {
-//    				//在等待关闭的队列中,立即断开
-//    				sendMsg("CANCEL");
-//    				ctx.close();
-//    				HelloServer.closePendingList.remove(identity);
-//    			} else {
-//    				HelloServer.deviceMap.put(identity, this);
-//    			}
-//			}
-//    	} 
-//    	
-    	/**
-    	 * 
-			整个系统简化为4个命令, 1短信获取状态(短信MG)(OP保留,在这里不用)
-			2短信降锁 (依然为短信DW)
-			3短信升锁 (添加短信UP)
-			4重启设备 (添加短信RS)
-			设备收到命令,返回4个字节参数 +1位电量+IMEI
-			关于4字节参数
-			byte0 byte1 是命令字“MG”"UP""DW"
-			byte2是锁的状态
-			#define LOCK_STA_DOWN 'A' // 落锁到位
-			#define LOCK_STA_UP 'B' // 升锁到位
-			#define LOCK_STA_MID 'C' // 锁停到中间
-			#define LOCK_STA_OVER 'D' // 升锁过冲
-			byte3是执行命令是否超时 ,'0'是正常,‘1’是超时:卡住或者红外管失效
-			
-			举例:
-			命令1:返回"MGA0" 锁在低位
-			
-			命令2:
-			返回“DWA0” 完成命令 ,落锁到位
-			返回“DWC1” 完成命令 ,落锁失败,锁卡在中间,命令超时
-			返回“DWB1” 完成命令 ,落锁失败,锁卡在高位,命令超时
-			命令3: 返回“UPA0” 完成命令 ,升锁到位
-			返回“UPC1” 完成命令 ,落锁失败,锁卡在中间,命令超时
-			返回“DWB1” 完成命令 ,落锁失败,锁卡在高位,命令超时
-			命令4: 返回“RSA0” 准备重启 大概需要25秒
-			电量5-12v分为26档,5v为A, +0.2v=B,C,D...
-    	 */
-    	System.out.println("接收到硬件返回");
-    	//更新电量
-    	if (input.length() > 5) {
-    		String imei = input.substring(5);
-    		String status = input.substring(2,3);
-    		ParkingPointExample pExp = new ParkingPointExample();
-    		pExp.createCriteria().andIdentityEqualTo(imei);
-    		ParkingPoint p = new ParkingPoint();
-    		
-    		if (status.equals("A")) {
-    			p.setPointState(1);
-    		} else if (status.equals("B")) {
-    			p.setPointState(0);
-    		} else {
-    			//默认升起
-    			p.setPointState(0);
-    		}
-    		if (input.startsWith("ER")) {
-        		//异常
-    			p.setPointState(-1);
-    			UserExample userExample = new UserExample();
-    			userExample.createCriteria().andIdEqualTo(p.getUserId());
-    			User user = userMapper.selectByExample(userExample).get(0);
-    			aliPush.sendMsgToOne(1, "车位异常", "您位于"+p.getAddress()+"的车位出现异常", user.getDeviceId());
-        	} else {
-        		
-        	}
-    		String battery = input.substring(4, 5);
-    		char c = battery.charAt(0);
-    		int seg = c - 'A';
-    		int base = 5;
-    		float val = base + seg*0.2f;
-    		//存储到数据库
-    		
-    		System.out.println("imei=="+imei+", battery val="+val);
-    		p.setBattery(val);
-    		parkingPointMapper.updateByExampleSelective(p, pExp);
-    		if(val <= 5.2){
-    			UserExample userExample = new UserExample();
-    			userExample.createCriteria().andIdEqualTo(p.getUserId());
-    			User user = userMapper.selectByExample(userExample).get(0);
-    			aliPush.sendMsgToOne(1, "车位电量低", "您位于"+p.getAddress()+"的车位电量过低,请及时查看", user.getDeviceId());
-    		}
-    	}
+    	MouldHistory item = new MouldHistory();
     	
+    	//抽取手机号码
+    	String mobilePart = input.substring(4*2, 15*2);
+    	System.out.println("原始mobile="+mobilePart);
+    	String mobile = getStringFromHexStr(mobilePart);
+    	System.out.println("手机号码为"+mobile);
+    	item.setSim(mobile);
+    	//获取设备编码15-24
+    	String deviceNumPart = input.substring(15*2, 25*2);
+    	String deviceNum = getStringFromHexStr(deviceNumPart);
+    	System.out.println(deviceNum);
+    	item.setModelNo(deviceNum);
+    	//软件版本号25
+    	String version = input.substring(25*2, 26*2);
+    	System.out.println("软件版本号="+version);
+    	item.setVersion(version);
+    	String status = input.substring(26*2, 27*2);
+    	System.out.println("工作状态="+status);
+    	item.setStatus(status);
+    	//经度27-37
+    	String longitude = getStringFromHexStr(input.substring(27*2, 38*2));
+    	System.out.println("经度="+longitude);
+    	item.setLng(longitude);
+    	//38-47纬度以 N 开头
+    	String latitude = getStringFromHexStr(input.substring(38*2, 48*2));
+    	System.out.println("纬度="+latitude);
+    	item.setLat(latitude);
+    	item.setGprsLac(getStringFromHexStr(input.substring(48*2, 50*2)));
+    	item.setGprsIc(getStringFromHexStr(input.substring(50*2, 52*2)));
+    	item.setWifiBbsid(getStringFromHexStr(input.substring(52*2, 58*2)));
+    	String temp = "0x"+input.substring(58*2, 59*2);
+    	System.out.println(temp);
+    	int i = Integer.decode(temp);
+    	System.out.println(i);
+    	item.setTemperature(i);
+    	item.setBattery(Integer.decode("0x"+input.substring(59*2, 60*2)));
+    	item.setSig2g(Integer.decode("0x"+input.substring(60*2, 61*2)));
+    	item.setSigNb(Integer.decode("0x"+input.substring(61*2, 62*2)));
+    	item.setSigWifi(Integer.decode("0x"+input.substring(62*2, 63*2)));
+    	item.setExt0(getStringFromHexStr(input.substring(63*2, 64*2)));
+    	item.setAlarm(Integer.decode("0x"+input.substring(64*2, 65*2)));
+    	String str = input.substring(65*2, 69*2);
+    	item.setRunCnt(MathUtil.parseHexInt(str, true));
+    	//存入数据库
+    	mouldHistoryMapper.insertSelective(item);
+    	//模具开合记录
     	return ret;
     }
     
+    private String getStringFromHexStr(String hexStr) {
+    	StringBuilder sb = new StringBuilder();
+    	for (int i=0;i<hexStr.length()/2; i++) {
+    		String str = "0x"+hexStr.substring(i*2, i*2 + 2);
+    		int intVal = Integer.decode(str).intValue();
+    		char c = (char)intVal;
+    		sb.append(c);
+    	}
+    	return sb.toString();
+    }
+    
+    
     public void close() {
     	ctx.close();
     }
     
-    public void sendMsg(String str) {
-    	org.apache.log4j.Logger.getLogger(UserHandler.class).info("发送消息=="+str);
-    	System.out.println("发送消息=="+str);
-    	ctx.writeAndFlush(str);
+    public void sendMsg(String hexString) {
+    	System.out.println("发送消息=="+hexString);
+    	byte[] buffer = hexStrToBinaryStr(hexString);
+    	ByteBuf bf = Unpooled.buffer(hexString.length()/2);
+    	bf.writeBytes(buffer);
+    	
+    	ctx.writeAndFlush(bf);
 //    	ctx.close();
     }
     
@@ -192,28 +122,19 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
         // TODO Auto-generated method stub
         this.ctx = ctx; 
         System.out.println("==========Active========="+ctx.channel().localAddress().toString()+", connection num="+HelloServer.deviceMap.size());
-//        try {
-//            ctx.writeAndFlush("writeBack:"+InetAddress.getLocalHost().getHostName());
-            
-//        } catch (UnknownHostException e) {
-//            e.printStackTrace();
-//        }
     }
 
 	@Override
 	public void channelInactive(ChannelHandlerContext ctx) throws Exception {
 		super.channelInactive(ctx);
 		System.out.println("==========Inactive=========");
-		if (identity != null) {
-			HelloServer.deviceMap.remove(identity);
-		}
 	}
 	
 	@Override
 	public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
 		// TODO Auto-generated method stub
 		super.handlerRemoved(ctx);
-		System.out.println("[JSKBT]handlerRemoved=掉线了===");
+		System.out.println("[YunSu]handlerRemoved=掉线了===");
 	}
 
 	@Override
@@ -244,4 +165,50 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 //		super.userEventTriggered(ctx, evt);
     }
 	
+	/**
+	 * 将十六进制的字符串转换成字节数组
+	 *
+	 * @param hexString
+	 * @return
+	 */
+	public static byte[] hexStrToBinaryStr(String hexString) {
+		if (hexString == null || "".contentEquals(hexString)) {
+			return null;
+		}
+		hexString = hexString.replaceAll(" ", "");
+		int len = hexString.length();
+		int index = 0;
+		byte[] bytes = new byte[len / 2];
+		while (index < len) {
+			String sub = hexString.substring(index, index + 2);
+			bytes[index/2] = (byte)Integer.parseInt(sub,16);
+			index += 2;
+		}
+		return bytes;
+	}
+	
+	/**
+	 * 将字节数组转换成十六进制的字符串
+	 *
+	 * @return
+	 */
+	public static String BinaryToHexString(byte[] bytes) {
+	    String hexStr = "0123456789ABCDEF";
+	    String result = "";
+	    String hex = "";
+	    for (byte b : bytes) {
+	        hex = String.valueOf(hexStr.charAt((b & 0xF0) >> 4));
+	        hex += String.valueOf(hexStr.charAt(b & 0x0F));
+	        result += hex + " ";
+	    }
+	    return result;
+	}
+	
+	public static void main(String[] args) {
+		String str = "FAAF11223133393030323538383435303130313132333435361201453131372E3030323334354E33382E36393030343527BD11D20102030405063C50303030000000000001110B05142022110B051430229988";
+		String temp = "0x"+str.substring(68*2, 69*2);
+		System.out.println("FAAF11223133393030323538383435303130313132333435361201453131372E3030323334354E33382E3639303034354E33382E36393030343527BD11D2010203040506".length());
+    	System.out.println(temp);
+	}
+	
 }

+ 207 - 0
cloud-socket/src/com/js/kbt/util/ConvertCode.java

@@ -0,0 +1,207 @@
+package com.js.kbt.util;
+
+public class ConvertCode {
+	 /** 
+    * @Title:bytes2HexString 
+    * @Description:字节数组转16进制字符串 
+    * @param b 
+    *            字节数组 
+    * @return 16进制字符串 
+    * @throws 
+    */  
+   public static String bytes2HexString(byte[] b) {  
+       StringBuffer result = new StringBuffer();  
+       String hex;  
+       for (int i = 0; i < b.length; i++) {  
+           hex = Integer.toHexString(b[i] & 0xFF);  
+           if (hex.length() == 1) {  
+               hex = '0' + hex;  
+           }  
+           result.append(hex.toUpperCase());  
+       }  
+       return result.toString();  
+   }  
+   /** 
+    * @Title:hexString2Bytes 
+    * @Description:16进制字符串转字节数组 
+    * @param src  16进制字符串 
+    * @return 字节数组 
+    */  
+   public static byte[] hexString2Bytes(String src) {  
+       int l = src.length() / 2;  
+       byte[] ret = new byte[l];  
+       for (int i = 0; i < l; i++) {  
+           ret[i] = (byte) Integer  
+                   .valueOf(src.substring(i * 2, i * 2 + 2), 16).byteValue();  
+       }  
+       return ret;  
+   }
+   /** 
+    * @Title:string2HexString 
+    * @Description:字符串转16进制字符串 
+    * @param strPart  字符串 
+    * @return 16进制字符串 
+    */  
+   public static String string2HexString(String strPart) {  
+       StringBuffer hexString = new StringBuffer();  
+       for (int i = 0; i < strPart.length(); i++) {  
+           int ch = (int) strPart.charAt(i);  
+           String strHex = Integer.toHexString(ch);  
+           hexString.append(strHex);  
+       }  
+       return hexString.toString();  
+   }  
+   /** 
+    * @Title:hexString2String 
+    * @Description:16进制字符串转字符串 
+    * @param src 
+    *            16进制字符串 
+    * @return 字节数组 
+    * @throws 
+    */  
+   public static String hexString2String(String src) {  
+       String temp = "";  
+       for (int i = 0; i < src.length() / 2; i++) {
+       	//System.out.println(Integer.valueOf(src.substring(i * 2, i * 2 + 2),16).byteValue());
+           temp = temp+ (char)Integer.valueOf(src.substring(i * 2, i * 2 + 2),16).byteValue();  
+       }  
+       return temp;  
+   }  
+     
+   /** 
+    * @Title:char2Byte 
+    * @Description:字符转成字节数据char-->integer-->byte 
+    * @param src 
+    * @return 
+    * @throws 
+    */  
+   public static Byte char2Byte(Character src) {  
+       return Integer.valueOf((int)src).byteValue();  
+   }  
+     
+       /** 
+    * @Title:intToHexString 
+    * @Description:10进制数字转成16进制 
+    * @param a 转化数据 
+    * @param len 占用字节数 
+    * @return 
+    * @throws 
+    */  
+   public static String intToHexString(int a,int len){  
+       len<<=1;  
+       String hexString = Integer.toHexString(a);  
+       int b = len -hexString.length();  
+       if(b>0){  
+           for(int i=0;i<b;i++)  {  
+               hexString = "0" + hexString;  
+           }  
+       }  
+       return hexString;  
+   }  
+     
+   
+   /**
+    * 将16进制的2个字符串进行异或运算
+    * http://blog.csdn.net/acrambler/article/details/45743157	
+    * @param strHex_X
+    * @param strHex_Y
+    * 注意:此方法是针对一个十六进制字符串一字节之间的异或运算,如对十五字节的十六进制字符串异或运算:1312f70f900168d900007df57b4884
+		先进行拆分:13 12 f7 0f 90 01 68 d9 00 00 7d f5 7b 48 84
+		13 xor 12-->1
+		1 xor f7-->f6
+		f6 xor 0f-->f9
+		....
+		62 xor 84-->e6
+		即,得到的一字节校验码为:e6
+    * @return
+    */
+   public static String xor(String strHex_X,String strHex_Y){   
+       //将x、y转成二进制形式   
+       String anotherBinary=Integer.toBinaryString(Integer.valueOf(strHex_X,16));   
+       String thisBinary=Integer.toBinaryString(Integer.valueOf(strHex_Y,16));   
+       String result = "";   
+       //判断是否为8位二进制,否则左补零   
+       if(anotherBinary.length() != 8){   
+       	for (int i = anotherBinary.length(); i <8; i++) {   
+               anotherBinary = "0"+anotherBinary;   
+           }   
+       }   
+       if(thisBinary.length() != 8){   
+       	for (int i = thisBinary.length(); i <8; i++) {   
+               thisBinary = "0"+thisBinary;   
+           }   
+       }   
+       //异或运算   
+       for(int i=0;i<anotherBinary.length();i++){   
+       	//如果相同位置数相同,则补0,否则补1   
+           if(thisBinary.charAt(i)==anotherBinary.charAt(i))   
+               result+="0";   
+           else{   
+               result+="1";
+           }   
+       }  
+       return Integer.toHexString(Integer.parseInt(result, 2));   
+   }  
+   
+   
+   /**
+    *  Convert byte[] to hex string.这里我们可以将byte转换成int
+	 * @param src byte[] data   
+	 * @return hex string   
+	 */   
+   public static String bytes2Str(byte[] src){   
+       StringBuilder stringBuilder = new StringBuilder("");   
+       if (src == null || src.length <= 0) {   
+           return null;   
+       }   
+       for (int i = 0; i < src.length; i++) {   
+           int v = src[i] & 0xFF;   
+           String hv = Integer.toHexString(v);   
+           if (hv.length() < 2) {   
+               stringBuilder.append(0);   
+           }   
+           stringBuilder.append(hv);   
+       }   
+       return stringBuilder.toString();   
+   }
+   /**
+	 * @param msg
+	 * @return 接收字节数据并转为16进制字符串
+	 */
+	public static String receiveHexToString(byte[] by) {
+		try {
+			/*io.netty.buffer.WrappedByteBuf buf = (WrappedByteBuf)msg;
+			ByteBufInputStream is = new ByteBufInputStream(buf);
+			byte[] by = input2byte(is);*/
+			String str = bytes2Str(by);
+			str = str.toLowerCase();
+			return str;
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			System.out.println("接收字节数据并转为16进制字符串异常");
+		}
+		return null;
+	}
+	
+	/**
+	 * "7dd",4,'0'==>"07dd"
+	 * @param input 需要补位的字符串
+	 * @param size 补位后的最终长度
+	 * @param symbol 按symol补充 如'0'
+	 * @return
+	 * N_TimeCheck中用到了
+	 */
+	public static String fill(String input, int size, char symbol) {
+		while (input.length() < size) {
+			input = symbol + input;
+		}
+		return input;
+	}
+   public static void main(String args[]) {  
+   	String productNo = "3030303032383838";
+   	System.out.println(hexString2String(productNo));
+   	productNo = "04050103000001070302050304";
+   	System.out.println(hexString2String(productNo));
+   }  
+   //用Java语言实现对十六进制字符串异或运算http://blog.csdn.net/acrambler/article/details/45743157	
+}

+ 44 - 0
cloud-socket/src/com/js/kbt/util/MathUtil.java

@@ -0,0 +1,44 @@
+package com.js.kbt.util;
+
+public class MathUtil {
+
+	/**
+	 * 高位在前的16进制表达形式转10进制int
+	 * @param hexStr
+	 * @return
+	 */
+	public static int parseHexInt(String hexStr, boolean isBigEnd) {
+		System.out.println("解析"+hexStr);
+		int bitSize = hexStr.length()/2;//几个8位
+		//hexStr: 00000050 表示80
+		int data[] = new int[bitSize];
+		if (isBigEnd) {
+			//高位在前
+			for (int i=0;i<bitSize;i++) {
+				data[i] = Integer.valueOf(hexStr.substring(2*i,2*(i+1)), 16);
+			}
+		} else {
+			//低位在前
+			for (int i=0;i<bitSize;i++) {
+				data[bitSize - i] = Integer.valueOf(hexStr.substring(2*i,2*(i+1)), 16);
+			}
+		}
+		
+		System.out.println(data);
+		StringBuilder sb = new StringBuilder();
+		//每位数据转成二进制,各占8位,再拼接起来
+		for (int i=0;i<bitSize; i++) {
+			int p = Integer.valueOf(Integer.toBinaryString(data[i]));
+			String str = String.format("%08d", p);
+			//补齐8位
+			System.out.println(str);
+			sb.append(str);
+		}
+		System.out.println(sb.toString());
+		return Integer.valueOf(sb.toString(), 2);
+	}
+	
+	public static void main(String[] args) {
+		System.out.println(parseHexInt("0150", true));
+	}
+}