Forráskód Böngészése

接收异常钢坯实绩02

qiangxuan 2 hete
szülő
commit
e0d946abcf

+ 1 - 2
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/billetActual/service/IBilletBasicInfoExceptionService.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.billetActual.service;
 import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.billetActual.entity.BilletBasicInfo;
 import org.jeecg.modules.billetActual.entity.BilletBasicInfoException;
 
 /**
@@ -11,5 +10,5 @@ import org.jeecg.modules.billetActual.entity.BilletBasicInfoException;
  */
 public interface IBilletBasicInfoExceptionService extends IService<BilletBasicInfoException> {
 
-    void addBilletBasicInfoException(BilletBasicInfo billetBasicInfo);
+    void addBilletBasicInfoException(BilletBasicInfoException billetBasicInfoException);
 }

+ 8 - 17
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/billetActual/service/impl/BilletBasicInfoExceptionServiceImpl.java

@@ -7,12 +7,8 @@ import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.billetActual.entity.*;
 import org.jeecg.modules.billetActual.mapper.BilletBasicInfoExceptionMapper;
 import org.jeecg.modules.billetActual.mapper.BilletBasicInfoMapper;
-import org.jeecg.modules.billetActual.mapper.BilletHotsendMapper;
 import org.jeecg.modules.billetActual.mapper.BilletRulerConfigMapper;
 import org.jeecg.modules.billetActual.service.IBilletBasicInfoExceptionService;
-import org.jeecg.modules.billetActual.service.IBilletBasicInfoService;
-import org.jeecg.modules.heatsActuals.entity.HeatsActuals;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
@@ -41,12 +37,9 @@ public class BilletBasicInfoExceptionServiceImpl extends ServiceImpl<BilletBasic
     BilletRulerConfigMapper billetRulerConfigMapper;
 
     @Override
-    public void addBilletBasicInfoException(BilletBasicInfo billetBasicInfo) {
+    public void addBilletBasicInfoException(BilletBasicInfoException billetBasicInfoException) {
         try {
             log.info("{}{}", "start接收到mqtt钢坯基础<异常>消息,开始保存异常数据:", DateUtils.date2Str(new Date(), DateUtils.datetimeFormat.get()));
-            BilletBasicInfoException billetBasicInfoException = new BilletBasicInfoException();
-            BeanUtils.copyProperties(billetBasicInfo, billetBasicInfoException);
-
             String classShiftGroup = String.format("class:shift:group:%s", billetBasicInfoException.getCcmNo()); // 班组
             String classShift = String.format("class:shift:%s", billetBasicInfoException.getCcmNo()); // 班别
             String brandNum = String.format("billet:basic:info:brand:num:%s", billetBasicInfoException.getCcmNo()); // 牌号
@@ -77,20 +70,18 @@ public class BilletBasicInfoExceptionServiceImpl extends ServiceImpl<BilletBasic
             } else {
                 // 查询定尺规则
                 LambdaQueryWrapper<BilletRulerConfig> queryWrapperbilletRulerConfig = new LambdaQueryWrapper<BilletRulerConfig>()
-                        .eq(BilletRulerConfig::getLength, billetBasicInfo.getLength());
+                        .eq(BilletRulerConfig::getLength, billetBasicInfoException.getLength());
                 BilletRulerConfig billetRulerConfig = billetRulerConfigMapper.selectOne(queryWrapperbilletRulerConfig);
                 Double weight = 0.0;
-                if (oConvertUtils.isEmpty(billetRulerConfig)) {
-                    weight = billetBasicInfo.getWeight();
-                } else {
+                if (oConvertUtils.isNotEmpty(billetRulerConfig)) {
                     weight = billetRulerConfig.getWeight();
                 }
                 // 新增数据
-                billetBasicInfo.setBilletWeight(weight);
-                billetBasicInfo.setShift(classShiftStr);
-                billetBasicInfo.setBrandNum(brandNumStr);
-                billetBasicInfo.setShiftGroup(classShiftGroupStr);
-                log.info("{}{}", "新增钢坯实绩异常数据:", billetBasicInfo.getShiftGroup() + " " + billetBasicInfo.getShift());
+                billetBasicInfoException.setBilletWeight(weight);
+                billetBasicInfoException.setShift(classShiftStr);
+                billetBasicInfoException.setBrandNum(brandNumStr);
+                billetBasicInfoException.setShiftGroup(classShiftGroupStr);
+                log.info("{}{}", "新增钢坯实绩异常数据:", billetBasicInfoException.getShiftGroup() + " " + billetBasicInfoException.getShift());
                 baseMapper.insert(billetBasicInfoException);
             }
             log.info("{}{}", "end钢坯实绩<异常>数据逻辑处理结束:", DateUtils.date2Str(new Date(), DateUtils.datetimeFormat.get()));

+ 5 - 1
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/push/utils/MqttClientCallback.java

@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.eclipse.paho.client.mqttv3.*;
 import org.jeecg.common.util.SpringContextHolder;
 import org.jeecg.modules.billetActual.entity.BilletBasicInfo;
+import org.jeecg.modules.billetActual.entity.BilletBasicInfoException;
 import org.jeecg.modules.billetActual.service.IBilletBasicInfoExceptionService;
 import org.jeecg.modules.billetActual.service.IBilletBasicInfoService;
 import org.jeecg.modules.billetActual.service.IBilletHotsendBaseService;
@@ -19,6 +20,7 @@ import org.jeecg.modules.heatsActuals.entity.HeatsActuals;
 import org.jeecg.modules.heatsActuals.service.IHeatsActualsService;
 import org.jeecg.modules.stackingAndLoadingVehicles.service.IStackingAndLoadingVehiclesService;
 import org.jeecg.modules.storageBill.service.IStorageBillService;
+import org.springframework.beans.BeanUtils;
 
 import java.util.Date;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -235,7 +237,9 @@ public class MqttClientCallback implements MqttCallback, MqttCallbackExtended {
             // sign:"1",正常数据;sign:"2",异常数据
             if (sign.equals("2")) {
                 BilletBasicInfo billetBasicInfo = JSON.parseObject(payload, BilletBasicInfo.class);
-                billetBasicInfoExceptionService.addBilletBasicInfoException(billetBasicInfo);
+                BilletBasicInfoException billetBasicInfoException = new BilletBasicInfoException();
+                BeanUtils.copyProperties(billetBasicInfo, billetBasicInfoException);
+                billetBasicInfoExceptionService.addBilletBasicInfoException(billetBasicInfoException);
             }else{
                 BilletBasicInfo billetBasicInfo = JSON.parseObject(payload, BilletBasicInfo.class);
                 billetBasicInfoService.addC(billetBasicInfo);