dengyj 3 سال پیش
والد
کامیت
880445b6f0

+ 12 - 6
src/main/java/com/steerinfo/meterwork/meterworkcaractual/service/impl/MeterWorkCarActualServiceImpl.java

@@ -2890,32 +2890,38 @@ public class MeterWorkCarActualServiceImpl extends BaseServiceImpl<MeterWorkCarA
                         && model.getBaseSpotName() != null
                         && model.getBaseSpotNo().equals(spot.getBaseSpotNo())
                         && model.getBaseSpotName().equals(spot.getBaseSpotName())
-                        && model.getOperationContent().endsWith("历史皮重")).count();
+                        && model.getOperationContent().startsWith("勾选")
+                        && model.getOperationContent().contains("历史皮重")).count();
                 countMonitorLogGrossTare = carMonitorLog.stream().filter(model -> model.getBaseSpotNo() != null
                         && model.getBaseSpotName() != null
                         && model.getBaseSpotNo().equals(spot.getBaseSpotNo())
                         && model.getBaseSpotName().equals(spot.getBaseSpotName())
-                        && model.getOperationContent().endsWith("毛皮超差")).count();
+                        && model.getOperationContent().startsWith("勾选")
+                        && model.getOperationContent().contains("毛皮超差")).count();
                 countMonitorLogActual = carMonitorLog.stream().filter(model -> model.getBaseSpotNo() != null
                         && model.getBaseSpotName() != null
                         && model.getBaseSpotNo().equals(spot.getBaseSpotNo())
                         && model.getBaseSpotName().equals(spot.getBaseSpotName())
-                        && model.getOperationContent().endsWith("异地计量")).count();
+                        && model.getOperationContent().startsWith("勾选")
+                        && model.getOperationContent().contains("异地计量")).count();
                 countMonitorLogInfraredContrast = carMonitorLog.stream().filter(model -> model.getBaseSpotNo() != null
                         && model.getBaseSpotName() != null
                         && model.getBaseSpotNo().equals(spot.getBaseSpotNo())
                         && model.getBaseSpotName().equals(spot.getBaseSpotName())
-                        && model.getOperationContent().endsWith("对射")).count();
+                        && model.getOperationContent().startsWith("勾选")
+                        && model.getOperationContent().contains("对射")).count();
                 countMonitorLogZero = carMonitorLog.stream().filter(model -> model.getBaseSpotNo() != null
                         && model.getBaseSpotName() != null
                         && model.getBaseSpotNo().equals(spot.getBaseSpotNo())
                         && model.getBaseSpotName().equals(spot.getBaseSpotName())
-                        && model.getOperationContent().endsWith("零点告警")).count();
+                        && model.getOperationContent().startsWith("勾选")
+                        && model.getOperationContent().contains("零点告警")).count();
                 countMonitorLogTime = carMonitorLog.stream().filter(model -> model.getBaseSpotNo() != null
                         && model.getBaseSpotName() != null
                         && model.getBaseSpotNo().equals(spot.getBaseSpotNo())
                         && model.getBaseSpotName().equals(spot.getBaseSpotName())
-                        && model.getOperationContent().endsWith("时间间隔")).count();
+                        && model.getOperationContent().startsWith("勾选")
+                        && model.getOperationContent().contains("时间间隔")).count();
             }
 
             long countResetCar = 0L;

+ 54 - 30
src/main/java/com/steerinfo/meterwork/meterworkmeasuringinstrument/service/impl/MeterWorkMeasuringInstrumentServiceImpl.java

@@ -16,10 +16,10 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.util.*;
 import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * MeterWorkMeasuringInstrument服务实现:
@@ -94,6 +94,7 @@ public class MeterWorkMeasuringInstrumentServiceImpl extends BaseServiceImpl<Met
         SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
         SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
         int count = 0;
+
         for(MeterWorkMeasuringInstrument model : models) {
             if (StringUtils.isEmpty(model.getRailwayNo())) {
                 rm.setMessage("车号不能为空");
@@ -127,36 +128,59 @@ public class MeterWorkMeasuringInstrumentServiceImpl extends BaseServiceImpl<Met
                 rm.setMessage("皮重不能为空");
                 return rm;
             }
-            if(model.getGrossTime() == null){
-                rm.setMessage("毛重时间不能为空");
-                return rm;
-            }
-            if(model.getTareTime() == null){
-                rm.setMessage("皮重时间不能为空");
-                return rm;
-            }
-            if(model.getNetTime() == null){
-                rm.setMessage("净重时间不能为空");
-                return rm;
-            }
         }
-        for (MeterWorkMeasuringInstrument model : models){
+        Random random = new Random();
+        for(int i = 0; i <= models.size()-1; i++) {
             String afl = sdf.format(new Date());
             String no = meterWorkMeasuringInstrumentMapper.getNewID(afl);
-            model.setActualNo(afl+ no);
-            model.setGrossWeight(model.getGrossWeight().multiply(new BigDecimal(1000)));
-            model.setTareWeight(model.getTareWeight().multiply(new BigDecimal(1000)));
-            model.setNetWeight(model.getNetWeight().multiply(new BigDecimal(1000)));
-            model.setGrossTime(new Date(sdfDate.format(model.getGrossTime())));
-            model.setTareTime(new Date(sdfDate.format(model.getTareTime())));
-            model.setNetTime(new Date(sdfDate.format(model.getNetTime())));
-            model.setUpdateManNo(userId);
-            model.setUpdateManName(userName);
-            model.setUpdateTime(new Date());
-            model.setCreateManName(userName);
-            model.setCreateTime(new Date());
-            model.setValueFlag("1");
-            meterWorkMeasuringInstrumentMapper.insertSelective(model);
+            models.get(i).setActualNo(afl+ no);
+            models.get(i).setGrossWeight(models.get(i).getGrossWeight().multiply(new BigDecimal(1000)));
+            models.get(i).setTareWeight(models.get(i).getTareWeight().multiply(new BigDecimal(1000)));
+            models.get(i).setNetWeight(models.get(i).getNetWeight().multiply(new BigDecimal(1000)));
+            if(i == 0) {
+                if(models.get(i).getGrossTime() == null){
+                    rm.setMessage("毛重时间不能为空");
+                    return rm;
+                }
+                if(models.get(i).getTareTime() == null){
+                    rm.setMessage("皮重时间不能为空");
+                    return rm;
+                }
+                if(models.get(i).getNetTime() == null){
+                    rm.setMessage("净重时间不能为空");
+                    return rm;
+                }
+                models.get(i).setGrossTime(new Date(sdfDate.format(models.get(i).getGrossTime())));
+                models.get(i).setTareTime(new Date(sdfDate.format(models.get(i).getTareTime())));
+                models.get(i).setNetTime(new Date(sdfDate.format(models.get(i).getNetTime())));
+            }else {
+                Calendar grossTime = Calendar.getInstance();
+                Calendar tareTime = Calendar.getInstance();
+                Calendar netTime = Calendar.getInstance();
+                grossTime.setTime(models.get(i-1).getGrossTime());
+                grossTime.add(Calendar.MINUTE, 2);
+                grossTime.add(Calendar.SECOND, random.nextInt(60));
+                tareTime.setTime(models.get(i-1).getTareTime());
+                tareTime.add(Calendar.MINUTE, 2);
+                tareTime.add(Calendar.SECOND, random.nextInt(60));
+                netTime.setTime(models.get(i-1).getNetTime());
+                netTime.add(Calendar.MINUTE, 2);
+                netTime.add(Calendar.SECOND, random.nextInt(60));
+                models.get(i).setGrossTime(new Date(sdfDate.format(grossTime.getTime())));
+                models.get(i).setTareTime(new Date(sdfDate.format(tareTime.getTime())));
+                if(models.get(i).getGrossTime().compareTo(models.get(i).getTareTime()) > 0) {
+                    models.get(i).setNetTime(models.get(i).getGrossTime());
+                }else {
+                    models.get(i).setNetTime(models.get(i).getTareTime());
+                }
+            }
+            models.get(i).setUpdateManNo(userId);
+            models.get(i).setUpdateManName(userName);
+            models.get(i).setUpdateTime(new Date());
+            models.get(i).setCreateManName(userName);
+            models.get(i).setCreateTime(new Date());
+            models.get(i).setValueFlag("1");
+            meterWorkMeasuringInstrumentMapper.insertSelective(models.get(i));
             count ++;
         }
         rm.setSucceed(true);

+ 1 - 0
src/main/java/com/steerinfo/meterwork/meterworkscheduledhelp/mapper/MeterWorkScheduledHelpMapper.xml

@@ -538,6 +538,7 @@
     <include refid="select"/>
     where 1 = 1
     and warm_type in ('1', '2', '3', '8')
+    and help_content != '正常数采识别'
     <if test="valueFlag != null and valueFlag != ''">
       and  value_flag like '%${valueFlag}%'
     </if>