Procházet zdrojové kódy

Merge branch 'master' of https://git.steerinfo.com/JQGT-JLXT/jg_wzjl_api

wujian před 1 rokem
rodič
revize
8db2376c69
16 změnil soubory, kde provedl 388 přidání a 32 odebrání
  1. 1 0
      src/main/java/com/steerinfo/baseinfo/meterbasehistaredata/mapper/MeterBaseHisTareDataMapper.java
  2. 5 0
      src/main/java/com/steerinfo/baseinfo/meterbasehistaredetail/mapper/MeterBaseHisTareDetailMapper.java
  3. 10 1
      src/main/java/com/steerinfo/baseinfo/meterbasehistaredetail/mapper/MeterBaseHisTareDetailMapper.xml
  4. 2 0
      src/main/java/com/steerinfo/baseinfo/meterbaserailwayhistaredata/mapper/MeterBaseRailwayHisTareDataMapper.java
  5. 3 0
      src/main/java/com/steerinfo/baseinfo/meterbaserailwayhistaredetail/mapper/MeterBaseRailwayHisTareDetailMapper.java
  6. 9 0
      src/main/java/com/steerinfo/baseinfo/meterbaserailwayhistaredetail/mapper/MeterBaseRailwayHisTareDetailMapper.xml
  7. 1 1
      src/main/java/com/steerinfo/filter/SecurityFilter.java
  8. 44 2
      src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/service/impl/MeterWorkCarActualFirstServiceImpl.java
  9. 1 0
      src/main/java/com/steerinfo/meterwork/meterworkdatacount/controller/MeterWorkDataCountController.java
  10. 229 17
      src/main/java/com/steerinfo/meterwork/meterworkdatacount/mapper/MeterWorkDataCountMapper.xml
  11. 9 0
      src/main/java/com/steerinfo/meterwork/meterworkdatacount/model/TruckHisTareComparison.java
  12. 19 0
      src/main/java/com/steerinfo/meterwork/meterworkdatacount/service/impl/MeterWorkDataCountServiceImpl.java
  13. 1 0
      src/main/java/com/steerinfo/meterwork/meterworkhookactfirst/service/impl/MeterWorkHookActFirstServiceImpl.java
  14. 1 0
      src/main/java/com/steerinfo/meterwork/meterworkparammap/service/impl/MeterWorkParamMapService.java
  15. 47 5
      src/main/java/com/steerinfo/meterwork/meterworkrailwayactfirst/service/impl/MeterWorkRailwayActFirstServiceImpl.java
  16. 6 6
      src/main/java/com/steerinfo/meterwork/meterworkrailwayactfirstbak/service/impl/MeterWorkRailwayActFirstBakServiceImpl.java

+ 1 - 0
src/main/java/com/steerinfo/baseinfo/meterbasehistaredata/mapper/MeterBaseHisTareDataMapper.java

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface MeterBaseHisTareDataMapper extends IBaseMapper<MeterBaseHisTareData, String> {

+ 5 - 0
src/main/java/com/steerinfo/baseinfo/meterbasehistaredetail/mapper/MeterBaseHisTareDetailMapper.java

@@ -5,7 +5,12 @@ import com.steerinfo.baseinfo.meterbasehistaredetail.model.MeterBaseHisTareDetai
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+import java.util.Map;
+
 @Mapper
 public interface MeterBaseHisTareDetailMapper extends IBaseMapper<MeterBaseHisTareDetail, String> {
     String getNewID(@Param(value="afl")String afl);
+
+    List<MeterBaseHisTareDetail> selectByParametersTop(Map<String, Object> map1);
 }

+ 10 - 1
src/main/java/com/steerinfo/baseinfo/meterbasehistaredetail/mapper/MeterBaseHisTareDetailMapper.xml

@@ -342,5 +342,14 @@
     SELECT LPAD(NVL(MAX(TO_NUMBER(SUBSTR(DETAIL_NO, LENGTH(DETAIL_NO) - 3))),0) + 1,4,'0') DETAIL_NO
     FROM METER_BASE_HIS_TARE_DETAIL where instr(DETAIL_NO,#{afl,jdbcType=VARCHAR})>0
   </select>
-  
+    <select id="selectByParametersTop"
+            resultMap="BaseResultMap">
+      select * from (
+        select * from METER_BASE_HIS_TARE_DETAIL t
+        <include refid="where"></include>
+        order by t.meter_time desc
+        FETCH NEXT 7 ROWS ONLY
+      )
+    </select>
+
 </mapper>

+ 2 - 0
src/main/java/com/steerinfo/baseinfo/meterbaserailwayhistaredata/mapper/MeterBaseRailwayHisTareDataMapper.java

@@ -1,5 +1,6 @@
 package com.steerinfo.baseinfo.meterbaserailwayhistaredata.mapper;
 
+import com.steerinfo.baseinfo.meterbasehistaredetail.model.MeterBaseHisTareDetail;
 import com.steerinfo.baseinfo.meterbaserailwayhistaredata.model.MeterBaseRailwayHisTareData;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import org.apache.ibatis.annotations.Mapper;
@@ -7,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface MeterBaseRailwayHisTareDataMapper extends IBaseMapper<MeterBaseRailwayHisTareData, String> {

+ 3 - 0
src/main/java/com/steerinfo/baseinfo/meterbaserailwayhistaredetail/mapper/MeterBaseRailwayHisTareDetailMapper.java

@@ -1,5 +1,6 @@
 package com.steerinfo.baseinfo.meterbaserailwayhistaredetail.mapper;
 
+import com.steerinfo.baseinfo.meterbasehistaredetail.model.MeterBaseHisTareDetail;
 import com.steerinfo.baseinfo.meterbaserailwayhistaredetail.model.MeterBaseRailwayHisTareDetail;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import org.apache.ibatis.annotations.Mapper;
@@ -12,4 +13,6 @@ import java.util.Map;
 public interface MeterBaseRailwayHisTareDetailMapper extends IBaseMapper<MeterBaseRailwayHisTareDetail, String> {
     String getNewID(@Param(value="afl")String afl);
     List<MeterBaseRailwayHisTareDetail> selectByParameter(Map<String, Object> parameters);
+
+    List<MeterBaseRailwayHisTareDetail> selectByParametersTop(Map<String, Object> map1);
 }

+ 9 - 0
src/main/java/com/steerinfo/baseinfo/meterbaserailwayhistaredetail/mapper/MeterBaseRailwayHisTareDetailMapper.xml

@@ -348,4 +348,13 @@
     <include refid="where"/>
     order by meter_time desc
   </select>
+    <select id="selectByParametersTop"
+            resultMap="BaseResultMap">
+      select * from (
+        select * from METER_BASE_RAILWAY_HIS_TARE_DETAIL t
+        <include refid="where"></include>
+        order by t.meter_time desc
+        FETCH NEXT 3 ROWS ONLY
+      )
+    </select>
 </mapper>

+ 1 - 1
src/main/java/com/steerinfo/filter/SecurityFilter.java

@@ -66,7 +66,7 @@ public class SecurityFilter implements Filter {
         if(vCode == null || StringUtils.isEmpty(vCode)) {
             vCode = request.getHeader("verificationCode");
         }
-
+        //vCode = "8ac69f685b9f389fe7ad399a6ee725a0";
         //取出验证码
         if(vCode == null || StringUtils.isEmpty(vCode)) {
             response.setContentType("application/json;charset=UTF-8");

+ 44 - 2
src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/service/impl/MeterWorkCarActualFirstServiceImpl.java

@@ -1180,8 +1180,29 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             mbtd.setBaseSpotName(oci.getBaseSpotName());
             mbtd.setMeterWeight(Math.round(oci.getMeterWeight().doubleValue()));
             mbtd.setUpWeight(oci.getMeterWeight().longValue()); //上次皮重
+            //查询前几次皮重
+            double db = 0.0;
+            try {
+                MeterBaseHisTareDetail mbhtd = new MeterBaseHisTareDetail();
+                mbhtd.setCarNo(oci.getCarNo());
+                Map<String, Object> map1 = FieldsCollector.beanToMap(mbhtd);
+                List<MeterBaseHisTareDetail> lmd = meterBaseHisTareDetailMapper.selectByParametersTop(map1);
+                if(lmd!=null&&lmd.size()!=0){
+                    if(lmd.size()>2){//减去最大最小值
+                        lmd.remove(0);
+                        lmd.remove(lmd.size()-1);
+                    }
+                    double sum = 0.0;
+                    for (MeterBaseHisTareDetail meterBaseHisTareDetail : lmd) {
+                        sum+=meterBaseHisTareDetail.getMeterWeight();
+                    }
+                    db = sum / lmd.size();
+                }
+            } catch (Exception e) {
+                logger.error("计算平均皮重出错", e);
+            }
             //  (之前的重量*次数)/(次数+1)
-            double db = (lmOne.get(0).getAvgWeight() * lmOne.get(0).getMeterNum() + lmOne.get(0).getMeterWeight()) / (lmOne.get(0).getMeterNum() + 1);
+            //double db = (lmOne.get(0).getAvgWeight() * lmOne.get(0).getMeterNum() + lmOne.get(0).getMeterWeight()) / (lmOne.get(0).getMeterNum() + 1);
             mbtd.setAvgWeight(Math.round(db));//平均皮重
             mbtd.setMeterNum(lmOne.get(0).getMeterNum() + 1);
             mbtd.setCreateTime(new Date());
@@ -1238,8 +1259,29 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             mbtd.setBaseSpotName(oci.getBaseSpotName());
             mbtd.setMeterWeight(Math.round(oci.getMeterWeight().doubleValue()));
             mbtd.setUpWeight(oci.getMeterWeight().longValue()); //上次皮重
+            //查询前几次皮重
+            double db = 0.0;
+            try {
+                MeterBaseHisTareDetail mbhtd = new MeterBaseHisTareDetail();
+                mbhtd.setCarNo(oci.getCarNo());
+                Map<String, Object> map1 = FieldsCollector.beanToMap(mbhtd);
+                List<MeterBaseHisTareDetail> lmd = meterBaseHisTareDetailMapper.selectByParametersTop(map1);
+                if(lmd!=null&&lmd.size()!=0){
+                    if(lmd.size()>2){
+                        lmd.remove(0);
+                        lmd.remove(lmd.size()-1);
+                    }
+                    double sum = 0.0;
+                    for (MeterBaseHisTareDetail meterBaseHisTareDetail : lmd) {
+                        sum+=meterBaseHisTareDetail.getMeterWeight();
+                    }
+                    db = sum / lmd.size();
+                }
+            } catch (Exception e) {
+                logger.error("计算平均皮重出错", e);
+            }
             //  (之前的重量*次数)/(次数+1)
-            double db = (lmOne.get(0).getAvgWeight() * lmOne.get(0).getMeterNum() + lmOne.get(0).getMeterWeight()) / (lmOne.get(0).getMeterNum() + 1);
+            //double db = (lmOne.get(0).getAvgWeight() * lmOne.get(0).getMeterNum() + lmOne.get(0).getMeterWeight()) / (lmOne.get(0).getMeterNum() + 1);
             mbtd.setAvgWeight(Math.round(db));//平均皮重
             mbtd.setMeterNum(lmOne.get(0).getMeterNum() + 1);
             mbtd.setCreateTime(new Date());

+ 1 - 0
src/main/java/com/steerinfo/meterwork/meterworkdatacount/controller/MeterWorkDataCountController.java

@@ -1,5 +1,6 @@
 package com.steerinfo.meterwork.meterworkdatacount.controller;
 
+import com.steerinfo.baseinfo.combaseinfo.mapper.ComBaseInfoMapper;
 import com.steerinfo.framework.controller.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageList;

+ 229 - 17
src/main/java/com/steerinfo/meterwork/meterworkdatacount/mapper/MeterWorkDataCountMapper.xml

@@ -445,7 +445,7 @@
     select
     A.base_spot_name baseSpotName,
             A.car_no carNo,
-           case when abs(round((A.meter_weight - B.avg_weight)/1000, 2)) >= 0.5 then '皮重超过偏差'
+           case when abs(round((A.meter_weight - B.avg_weight)/1000, 2)) > (select to_number(BASE_NAME)/1000 from com_base_info where BASE_CODE = '001067001' ) then '皮重超过偏差'
                 else '正常皮重' end alarmType,
            round(A.meter_weight/1000, 2) meterWeight,
            round(B.avg_weight/1000, 2) avgWeight,
@@ -471,7 +471,13 @@
                 else null end meterTypeName,
            A.note
       from meter_work_car_actual_first A
-      left join meter_base_his_tare_data B
+      left join (SELECT *
+                FROM (
+                SELECT t.*,
+                ROW_NUMBER() OVER (PARTITION BY t.car_no ORDER BY t.create_time DESC) AS rn
+                FROM meter_base_his_tare_data t
+                )
+                WHERE rn = 1) B
         on A.car_no = B.Car_No
      where A.weight_type = '1'
         <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
@@ -480,10 +486,10 @@
         </if>
         <if test="alarmType != null and alarmType != ''">
             <if test="alarmType == 0">
-                and  abs(round((A.meter_weight - B.avg_weight)/1000, 2)) >= 0.5
+                and  abs(round((A.meter_weight - B.avg_weight)/1000, 2)) > (select to_number(BASE_NAME)/1000 from com_base_info where BASE_CODE = '001067001' )
             </if>
             <if test="alarmType == 1">
-                and  abs(round((A.meter_weight - B.avg_weight)/1000, 2)) &lt; 0.5
+                and  abs(round((A.meter_weight - B.avg_weight)/1000, 2)) &lt;= (select to_number(BASE_NAME)/1000 from com_base_info where BASE_CODE = '001067001' )
             </if>
         </if>
         <if test="carNo != null and carNo != ''">
@@ -551,8 +557,33 @@
             from meter_base_operation_log A
             left join meter_work_car_actual_first B
             on A.operation_id = B.actual_first_no
-            where 1 = 1
-            and A.operation_page like '%汽车衡一次数据维护%'
+            where A.operation_page like '%汽车衡一次数据维护%'
+            <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+                and a.create_Time
+                between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+            </if>
+            <if test="carNo != null and carNo != ''">
+                and A.operation_carn_no like '%${carNo}%'
+            </if>
+            <if test="operationFunction != null and operationFunction != ''">
+                and a.operation_function in
+                <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="operationPage != null and operationPage != ''">
+                and a.operation_page in
+                <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="createManName != null and createManName != ''">
+                and a.create_man_name in
+                <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         )
         union
         (
@@ -579,6 +610,32 @@
             left join meter_work_car_actual B
             on A.operation_id = B.actual_no
             where A.operation_page like '%汽车衡净重数据维护%'
+            <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+                and a.create_Time
+                between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+            </if>
+            <if test="carNo != null and carNo != ''">
+                and A.operation_carn_no like '%${carNo}%'
+            </if>
+            <if test="operationFunction != null and operationFunction != ''">
+                and a.operation_function in
+                <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="operationPage != null and operationPage != ''">
+                and a.operation_page in
+                <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="createManName != null and createManName != ''">
+                and a.create_man_name in
+                <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         )
         union
         (
@@ -604,8 +661,33 @@
         from meter_base_operation_log A
         left join meter_work_railway_act_first B
         on A.operation_id = B.actual_first_no
-        where 1 = 1
-        and A.operation_page like '%轨道衡一次数据维护%'
+        where A.operation_page like '%轨道衡一次数据维护%'
+        <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+            and a.create_Time
+            between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+            and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+        </if>
+        <if test="carNo != null and carNo != ''">
+            and A.operation_carn_no like '%${carNo}%'
+        </if>
+        <if test="operationFunction != null and operationFunction != ''">
+            and a.operation_function in
+            <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="operationPage != null and operationPage != ''">
+            and a.operation_page in
+            <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="createManName != null and createManName != ''">
+            and a.create_man_name in
+            <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         )
         union
         (
@@ -633,6 +715,32 @@
         on A.operation_id = B.actual_first_no
         where 1 = 1
         and A.operation_page like '%吊钩秤一次数据维护%'
+        <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+            and a.create_Time
+            between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+            and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+        </if>
+        <if test="carNo != null and carNo != ''">
+            and A.operation_carn_no like '%${carNo}%'
+        </if>
+        <if test="operationFunction != null and operationFunction != ''">
+            and a.operation_function in
+            <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="operationPage != null and operationPage != ''">
+            and a.operation_page in
+            <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="createManName != null and createManName != ''">
+            and a.create_man_name in
+            <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         )
         union
         (
@@ -659,6 +767,32 @@
         left join meter_work_railway_actual B
         on A.operation_id = B.actual_no
         where A.operation_page like '%轨道衡净重数据维护%'
+        <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+            and a.create_Time
+            between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+            and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+        </if>
+        <if test="carNo != null and carNo != ''">
+            and A.operation_carn_no like '%${carNo}%'
+        </if>
+        <if test="operationFunction != null and operationFunction != ''">
+            and a.operation_function in
+            <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="operationPage != null and operationPage != ''">
+            and a.operation_page in
+            <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="createManName != null and createManName != ''">
+            and a.create_man_name in
+            <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         )
         union
         (
@@ -685,6 +819,32 @@
         left join meter_work_railway_actual B
         on A.operation_id = B.actual_no
         where A.operation_page like '%吊钩秤净重数据维护%'
+        <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+            and a.create_Time
+            between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+            and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+        </if>
+        <if test="carNo != null and carNo != ''">
+            and A.operation_carn_no like '%${carNo}%'
+        </if>
+        <if test="operationFunction != null and operationFunction != ''">
+            and a.operation_function in
+            <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="operationPage != null and operationPage != ''">
+            and a.operation_page in
+            <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="createManName != null and createManName != ''">
+            and a.create_man_name in
+            <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         )
         union
         (
@@ -711,6 +871,32 @@
             left join meter_work_railway_actual B
             on A.operation_id = B.actual_no
             where A.operation_page like '%动轨净重数据维护%'
+            <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+                and a.create_Time
+                between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+            </if>
+            <if test="carNo != null and carNo != ''">
+                and A.operation_carn_no like '%${carNo}%'
+            </if>
+            <if test="operationFunction != null and operationFunction != ''">
+                and a.operation_function in
+                <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="operationPage != null and operationPage != ''">
+                and a.operation_page in
+                <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="createManName != null and createManName != ''">
+                and a.create_man_name in
+                <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         )
         union
         (
@@ -737,6 +923,32 @@
             left join Meter_Work_Railway_Received B
             on A.operation_id = B.actual_first_no
             where A.operation_page like '%轨道衡从表数据维护%'
+            <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
+                and a.create_Time
+                between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+            </if>
+            <if test="carNo != null and carNo != ''">
+                and A.operation_carn_no like '%${carNo}%'
+            </if>
+            <if test="operationFunction != null and operationFunction != ''">
+                and a.operation_function in
+                <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="operationPage != null and operationPage != ''">
+                and a.operation_page in
+                <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="createManName != null and createManName != ''">
+                and a.create_man_name in
+                <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         )
         union
         (
@@ -763,34 +975,34 @@
             left join Meter_Work_Railway_Received B
             on A.operation_id = B.actual_first_no
             where A.operation_page like '%动轨数据维护%'
-        )
-        )
-        where 1 = 1
             <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
-                and  createTime  >= TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
-                and createTime  &lt;=  TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and a.create_Time
+                between TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss')
+                and TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
             </if>
             <if test="carNo != null and carNo != ''">
-                and carNo like '%${carNo}%'
+                and a.operation_carn_no like '%${carNo}%'
             </if>
             <if test="operationFunction != null and operationFunction != ''">
-                and operationFunction in
+                and a.operation_function in
                 <foreach collection="operationFunctionList" item="item" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
             </if>
             <if test="operationPage != null and operationPage != ''">
-                and operationPage in
+                and a.operation_page in
                 <foreach collection="operationPageList" item="item" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
             </if>
             <if test="createManName != null and createManName != ''">
-                and createManName in
+                and a.create_man_name in
                 <foreach collection="createManNameList" item="item" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
             </if>
+        )
+        )
         order by createTime desc
     </select>
 

+ 9 - 0
src/main/java/com/steerinfo/meterwork/meterworkdatacount/model/TruckHisTareComparison.java

@@ -21,6 +21,7 @@ public class TruckHisTareComparison {
     private String meterMode;
     private String meterTypeName;
     private String note;
+    private double base;
 
     public String getBaseSpotName() {
         return baseSpotName;
@@ -157,4 +158,12 @@ public class TruckHisTareComparison {
     public void setNote(String note) {
         this.note = note;
     }
+
+    public double getBase() {
+        return base;
+    }
+
+    public void setBase(double base) {
+        this.base = base;
+    }
 }

+ 19 - 0
src/main/java/com/steerinfo/meterwork/meterworkdatacount/service/impl/MeterWorkDataCountServiceImpl.java

@@ -1,5 +1,7 @@
 package com.steerinfo.meterwork.meterworkdatacount.service.impl;
 
+import com.steerinfo.baseinfo.combaseinfo.mapper.ComBaseInfoMapper;
+import com.steerinfo.baseinfo.combaseinfo.model.ComBaseInfo;
 import com.steerinfo.baseinfo.meterbaseoperationlog.mapper.MeterBaseOperationLogMapper;
 import com.steerinfo.baseinfo.meterbasespotinfo.mapper.MeterBaseSpotInfoMapper;
 import com.steerinfo.baseinfo.meterbasespotinfo.model.MeterBaseSpotInfo;
@@ -19,6 +21,8 @@ import com.steerinfo.meterwork.meterworkrailwayactual.model.MeterWorkRailwayActu
 import com.steerinfo.util.StringUtils;
 import org.apache.poi.hssf.record.ArrayRecord;
 import org.apache.shiro.crypto.hash.Hash;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
@@ -34,6 +38,7 @@ import static java.lang.Math.abs;
 @Service
 public class MeterWorkDataCountServiceImpl implements IMeterWorkDataCountService {
 
+    private static final Logger log = LoggerFactory.getLogger(MeterWorkDataCountServiceImpl.class);
     @Resource
     private MeterWorkDataCountMapper meterWorkDataCountMapper;
 
@@ -54,6 +59,9 @@ public class MeterWorkDataCountServiceImpl implements IMeterWorkDataCountService
     @Resource
     private MeterWorkRailwayActFirstMapper meterWorkRailwayActFirstMapper;
 
+    @Resource
+    ComBaseInfoMapper comBaseInfoMapper;
+
     @Override
     public List<HashMap> countFirstAndActual(HashMap<String, Object> params) {
         List<HashMap> models = meterWorkDataCountMapper.countFirstAndActual(params);
@@ -703,8 +711,19 @@ public class MeterWorkDataCountServiceImpl implements IMeterWorkDataCountService
 
     @Override
     public PageList<TruckHisTareComparison> truckHisTareComparison(HashMap<String, Object> params) {
+        ComBaseInfo comBaseInfo = comBaseInfoMapper.selectByPrimaryKey("001067001");
+        Double base = 0.0;
+        try {
+            base = Double.parseDouble(comBaseInfo.getBaseName());
+        }catch (Exception e){
+            e.printStackTrace();
+            log.error("数据类型不符",e);
+        }
         PageHelper.startPage(Integer.parseInt(params.get("pageNum").toString()), Integer.parseInt(params.get("pageSize").toString()));
         List<TruckHisTareComparison> models = meterWorkDataCountMapper.truckHisTareComparison(params);
+        for (TruckHisTareComparison model : models) {
+            model.setBase(base);
+        }
         PageList<TruckHisTareComparison> rows = new PageList<>(models);
         return rows;
     }

+ 1 - 0
src/main/java/com/steerinfo/meterwork/meterworkhookactfirst/service/impl/MeterWorkHookActFirstServiceImpl.java

@@ -686,6 +686,7 @@ public class MeterWorkHookActFirstServiceImpl extends BaseServiceImpl<MeterWorkH
     }
 
     @Override
+    @Transactional
     public RESTfulResult doAddWfStaticTwo(PreHookScale scale, MeterWorkHookActFirst grossModel, MeterWorkHookActFirst tareModel) {
         RESTfulResult rm = new RESTfulResult();
         rm.setFailed();

+ 1 - 0
src/main/java/com/steerinfo/meterwork/meterworkparammap/service/impl/MeterWorkParamMapService.java

@@ -17,6 +17,7 @@ import io.micrometer.core.instrument.Meter;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 

+ 47 - 5
src/main/java/com/steerinfo/meterwork/meterworkrailwayactfirst/service/impl/MeterWorkRailwayActFirstServiceImpl.java

@@ -1,6 +1,7 @@
 package com.steerinfo.meterwork.meterworkrailwayactfirst.service.impl;
 
 import com.steerinfo.baseinfo.combaseinfo.mapper.ComBaseInfoMapper;
+import com.steerinfo.baseinfo.meterbasehistaredetail.model.MeterBaseHisTareDetail;
 import com.steerinfo.baseinfo.meterbasematterunitmixedloadunloadtime.mapper.MeterBaseMatterUnitMixedLoadUnloadTimeMapper;
 import com.steerinfo.baseinfo.meterbasematterunitmixedloadunloadtime.model.MeterBaseMatterUnitMixedLoadUnloadTime;
 import com.steerinfo.baseinfo.meterbaseoperationlog.mapper.MeterBaseOperationLogMapper;
@@ -30,6 +31,7 @@ import com.steerinfo.meterwork.dto.CommonCombination;
 import com.steerinfo.meterwork.dto.StaffPerformanceAnalysis;
 import com.steerinfo.meterwork.except.MarkerMetException;
 import com.steerinfo.meterwork.meterworkcaractualfirst.model.MeterWorkCarActualFirst;
+import com.steerinfo.meterwork.meterworkcaractualfirst.service.impl.MeterWorkCarActualFirstServiceImpl;
 import com.steerinfo.meterwork.meterworkimage.mapper.MeterWorkImageMapper;
 import com.steerinfo.meterwork.meterworkimage.model.MeterWorkImage;
 import com.steerinfo.meterwork.meterworkrailwayactfirst.mapper.MeterWorkRailwayActFirstMapper;
@@ -50,6 +52,8 @@ import com.steerinfo.pretrack.prerailwayscale.model.PreRailwayScale;
 import com.steerinfo.util.FieldsCollector;
 import com.steerinfo.util.PublicMethod;
 import com.steerinfo.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -134,6 +138,9 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
     @Resource
     private MeterBaseRailwayHisTareDetailMapper meterBaseRailwayHisTareDetailMapper;
 
+    private static Logger logger	= LoggerFactory.getLogger( MeterWorkRailwayActFirstServiceImpl.class );
+
+
     @Override
     protected IBaseMapper<MeterWorkRailwayActFirst, String> getMapper() {
         return meterWorkRailwayActFirstMapper;
@@ -4876,7 +4883,7 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
     }
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public RESTfulResult doAddWfStaticTwo(PreRailwayScale scale, MeterWorkRailwayActFirst
             grossModel, MeterWorkRailwayActFirst tareModel, boolean needUpload) {
         RESTfulResult rm = new RESTfulResult();
@@ -4915,6 +4922,7 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
 
             if(scale == null) {
                 if (!grossModel.getRailwayNo().equals(tareModel.getRailwayNo())) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     rm.setMessage("两条一次计量数据车号不一致,请确认!!");
                     return rm;
                 }
@@ -5153,9 +5161,26 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
             hisTareData.setUpdateManName(model.getCreateManName());
             hisTareData.setUpdateManNo(model.getCreateManNo());
             hisTareData.setUpdateTime(model.getCreateTime());
-            hisTareData.setTareType("1");
+            //hisTareData.setTareType("1");
+            //查询前几次皮重
+            double meterWeight = 0.0;
+            try {
+                MeterBaseRailwayHisTareDetail mbhtd = new MeterBaseRailwayHisTareDetail();
+                mbhtd.setCarNo(model.getRailwayNo());
+                Map<String, Object> map1 = FieldsCollector.beanToMap(mbhtd);
+                List<MeterBaseRailwayHisTareDetail> lmd = meterBaseRailwayHisTareDetailMapper.selectByParametersTop(map1);
+                if(lmd!=null&&lmd.size()!=0){
+                    double sum = 0.0;
+                    for (MeterBaseRailwayHisTareDetail meterBaseRailwayHisTareDetail : lmd) {
+                        sum+=meterBaseRailwayHisTareDetail.getMeterWeight();
+                    }
+                    meterWeight = sum / lmd.size();
+                }
+            } catch (Exception e) {
+                logger.error("计算平均皮重出错", e);
+            }
             //  (之前的重量*次数)/(次数+1)
-            double meterWeight = (tareOne.get(0).getAvgWeight() * tareOne.get(0).getMeterNum() + model.getMeterWeight().longValue()) / (tareOne.get(0).getMeterNum() + 1);
+            //double meterWeight = (tareOne.get(0).getAvgWeight() * tareOne.get(0).getMeterNum() + model.getMeterWeight().longValue()) / (tareOne.get(0).getMeterNum() + 1);
             hisTareData.setAvgWeight(Math.round(meterWeight));//平均皮重
             hisTareData.setMeterNum(tareOne.get(0).getMeterNum() + 1);
             meterBaseRailwayHisTareDataMapper.updateByPrimaryKeySelective(hisTareData);
@@ -5205,7 +5230,7 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
         hisTareData.setValueFlag("0");
         hisTareData.setTareType(tareType);
         Map<String, Object> map = FieldsCollector.beanToMap(hisTareData);
-        List<MeterBaseRailwayHisTareData> tareOne = meterBaseRailwayHisTareDataMapper.selectByParameters(map);
+        List<MeterBaseRailwayHisTareData> tareOne = meterBaseRailwayHisTareDataMapper   .selectByParameters(map);
         if (tareOne.size() >= 1) {   //已有历史皮重
             hisTareData.setDataNo(tareOne.get(0).getDataNo());
             hisTareData.setBaseSpotNo(model.getBaseSpotNo());
@@ -5217,8 +5242,25 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
             hisTareData.setUpdateManName(model.getCreateManName());
             hisTareData.setUpdateManNo(model.getCreateManNo());
             hisTareData.setUpdateTime(model.getCreateTime());
+            //查询前几次皮重
+            double meterWeight = 0.0;
+            try {
+                MeterBaseRailwayHisTareDetail mbhtd = new MeterBaseRailwayHisTareDetail();
+                mbhtd.setCarNo(model.getRailwayNo());
+                Map<String, Object> map1 = FieldsCollector.beanToMap(mbhtd);
+                List<MeterBaseRailwayHisTareDetail> lmd = meterBaseRailwayHisTareDetailMapper.selectByParametersTop(map1);
+                if(lmd!=null&&lmd.size()!=0){
+                    double sum = 0.0;
+                    for (MeterBaseRailwayHisTareDetail meterBaseRailwayHisTareDetail : lmd) {
+                        sum+=meterBaseRailwayHisTareDetail.getMeterWeight();
+                    }
+                    meterWeight = sum / lmd.size();
+                }
+            } catch (Exception e) {
+                logger.error("计算平均皮重出错", e);
+            }
             //  (之前的重量*次数)/(次数+1)
-            double meterWeight = (tareOne.get(0).getAvgWeight() * tareOne.get(0).getMeterNum() + model.getMeterWeight().longValue()) / (tareOne.get(0).getMeterNum() + 1);
+            //double meterWeight = (tareOne.get(0).getAvgWeight() * tareOne.get(0).getMeterNum() + model.getMeterWeight().longValue()) / (tareOne.get(0).getMeterNum() + 1);
             hisTareData.setAvgWeight(Math.round(meterWeight));//平均皮重
             hisTareData.setMeterNum(tareOne.get(0).getMeterNum() + 1);
             hisTareData.setTareType(tareType);

+ 6 - 6
src/main/java/com/steerinfo/meterwork/meterworkrailwayactfirstbak/service/impl/MeterWorkRailwayActFirstBakServiceImpl.java

@@ -7624,12 +7624,12 @@ public class MeterWorkRailwayActFirstBakServiceImpl extends BaseServiceImpl<Mete
         }
         //内倒车毛重必须有委托
         //毛重 -> 0
-        if ("0".equals(model.getWeightType()) ){
-            //委托不能为空
-            if(model.getPredictionNo() == null){
-                return "委托不能为空";
-            }
-        }
+        //if ("0".equals(model.getWeightType()) ){
+        //    //委托不能为空
+        //    if(model.getPredictionNo() == null){
+        //        return "委托不能为空";
+        //    }
+        //}
         return "1";
     }