Răsfoiți Sursa

添加每小时的毛高数据

wukai 6 zile în urmă
părinte
comite
4a7dafabf8

+ 4 - 0
jjt-biz/src/main/java/com/jjt/calc/domain/TwinCalcHour.java

@@ -58,6 +58,10 @@ public class TwinCalcHour extends BaseEntity {
     @Excel(name = "电量")
     private BigDecimal kwh;
 
+    @ApiModelProperty("毛高")
+    @Excel(name = "毛高")
+    private BigDecimal height;
+
     /**
      * 重量
      */

+ 7 - 5
jjt-biz/src/main/java/com/jjt/utils/AsyncService.java

@@ -105,13 +105,16 @@ public class AsyncService {
         hour.setHour(period);
         Map<String, Object> map = calc(twinDevice, start, end);
 
-        //0.已织造米数  1.总能耗 2.总重量 3.开机时间 4.关机时间
+        //0.已织造米数  1.总能耗 2.总重量 3.开机时间 4.关机时间 5.毛高
         float[] total = (float[]) map.get("total");
         hour.setLength(BigDecimal.valueOf(total[0]));
         hour.setWeight(BigDecimal.valueOf(total[2]));
         hour.setKwh(BigDecimal.valueOf(total[1]));
         hour.setOpenTime((long) total[3]);
         hour.setCloseTime((long) total[4]);
+        if (total[5] != 0f) {
+            hour.setHeight(BigDecimal.valueOf(total[5]));
+        }
         calcHours.add(hour);
 
         List<TwinCalcHourSpec> specs = (List<TwinCalcHourSpec>) map.get("specList");
@@ -222,8 +225,8 @@ public class AsyncService {
         float[] first = new float[3];
         //上一个时间点数据
         float[] last = new float[3];
-        //统计数据,后面2个分别代表0.织造米长,1.电量 2.重量,3.开机时间,4.停机时间
-        float[] total = new float[5];
+        //统计数据,后面2个分别代表0.织造米长,1.电量 2.重量,3.开机时间,4.停机时间 5.毛高
+        float[] total = new float[6];
         //米克重
         int lastMkz = 0;
         //毛高
@@ -288,10 +291,9 @@ public class AsyncService {
         }
         //还是只计算米长
         calcTotal(0, last, first, total, lastMkz);
-
         calcSpec(total[0], lastSpecLength, last[2], lastMkz, lastHeight, specList);
         total[3] = 3600 - total[4];
-
+        total[5] = lastHeight;
         Map<String, Object> result = new HashMap<>(16);
         result.put("total", total);
         result.put("stopRecord", stopRecord);

+ 6 - 4
jjt-biz/src/main/resources/mapper/calc/TwinCalcHourMapper.xml

@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deviceId"    column="DEVICE_ID"    />
         <result property="kwh"    column="KWH"    />
         <result property="weight"    column="WEIGHT"    />
+        <result property="height"    column="HEIGHT"    />
         <result property="length"    column="LENGTH"    />
         <result property="openTime"    column="OPEN_TIME"    />
         <result property="closeTime"    column="CLOSE_TIME"    />
@@ -22,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTwinCalcHourVo">
-        select ID, DATA_DATE, HOUR, DEVICE_ID, KWH, WEIGHT, LENGTH, OPEN_TIME, CLOSE_TIME, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK from TWIN_CALC_HOUR
+        select ID, DATA_DATE, HOUR, DEVICE_ID, KWH, WEIGHT, HEIGHT,LENGTH, OPEN_TIME, CLOSE_TIME, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK from TWIN_CALC_HOUR
     </sql>
 
     <select id="selectTwinCalcHourList" parameterType="TwinCalcHour" resultMap="TwinCalcHourResult">
@@ -33,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deviceId != null "> and DEVICE_ID = #{deviceId}</if>
             <if test="kwh != null "> and KWH = #{kwh}</if>
             <if test="weight != null "> and WEIGHT = #{weight}</if>
+            <if test="height != null "> and HEIGHT = #{height}</if>
             <if test="length != null "> and LENGTH = #{length}</if>
             <if test="openTime != null "> and OPEN_TIME = #{openTime}</if>
             <if test="closeTime != null "> and CLOSE_TIME = #{closeTime}</if>
@@ -60,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deviceId != null">DEVICE_ID,</if>
             <if test="kwh != null">KWH,</if>
             <if test="weight != null">WEIGHT,</if>
+            <if test="height != null">HEIGHT,</if>
             <if test="length != null">LENGTH,</if>
             <if test="openTime != null">OPEN_TIME,</if>
             <if test="closeTime != null">CLOSE_TIME,</if>
@@ -75,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deviceId != null">#{deviceId},</if>
             <if test="kwh != null">#{kwh},</if>
             <if test="weight != null">#{weight},</if>
+            <if test="height != null">#{height},</if>
             <if test="length != null">#{length},</if>
             <if test="openTime != null">#{openTime},</if>
             <if test="closeTime != null">#{closeTime},</if>
@@ -94,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deviceId != null">DEVICE_ID = #{deviceId},</if>
             <if test="kwh != null">KWH = #{kwh},</if>
             <if test="weight != null">WEIGHT = #{weight},</if>
+            <if test="height != null">HEIGHT = #{height},</if>
             <if test="length != null">LENGTH = #{length},</if>
             <if test="openTime != null">OPEN_TIME = #{openTime},</if>
             <if test="closeTime != null">CLOSE_TIME = #{closeTime},</if>
@@ -102,9 +107,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updatedBy != null">UPDATED_BY = #{updatedBy},</if>
             <if test="updatedTime != null">UPDATED_TIME = #{updatedTime},</if>
             <if test="remark != null">REMARK = #{remark},</if>
-            <if test="params.sTime != null and params.eTime != null">
-                and DATEADD(hour, HOUR, DATA_DATE) between #{params.sTime} and #{params.eTime}
-            </if>
         </trim>
         where ID = #{id}
     </update>