فهرست منبع

feature 乘电表变比

xiahan 9 ماه پیش
والد
کامیت
80f411c6a1

+ 10 - 6
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquGdyRecordServiceImpl.java

@@ -75,29 +75,32 @@ public class EquGdyRecordServiceImpl extends ServiceImpl<EquGdyRecordDao, EquGdy
         if (StringUtils.isBlank(currentData.getId())) {
             return R.error("数据异常");
         }
+        // 获取表具信息
+        EquGdyMeterDo gdyMeterDo = this.equGdyMeterService.getById(currentData.getMeterid());
+
         //计算 夜班用量= 当前的夜班抄表-前一天的中班抄表
         if (currentData.getValuenight() != null) {
             // 获取上一天的数据
             EquGdyRecordDo previousData = dataFromTheDayBefore(currentData, -1);
             if (previousData != null && previousData.getValuemiddle() != null) {
                 //当前数据-前一天的中班用量
-                currentData.setValuenightuse(currentData.getValuenight().subtract(previousData.getValuemiddle()));
+                currentData.setValuenightuse((currentData.getValuenight().subtract(previousData.getValuemiddle())).multiply(gdyMeterDo.getDbbb()));
             }
         }
         // 计算 早班用量 =当前的早班抄表-当前的夜班抄表
         if (currentData.getValuemorning() != null && currentData.getValuenight() != null) {
-            currentData.setValuemorninguse(currentData.getValuemorning().subtract(currentData.getValuenight()));
+            currentData.setValuemorninguse((currentData.getValuemorning().subtract(currentData.getValuenight())).multiply(gdyMeterDo.getDbbb()));
         }
         // 计算 中班用量 = 当前的中班抄表-当前的早班抄表
         if (currentData.getValuemiddle() != null) {
             // 中班用量 = 当前的中班抄表-当前的早班抄表
             if (currentData.getValuemorning() != null) {
-                currentData.setValuemiddleuse(currentData.getValuemiddle().subtract(currentData.getValuemorning()));
+                currentData.setValuemiddleuse((currentData.getValuemiddle().subtract(currentData.getValuemorning())).multiply(gdyMeterDo.getDbbb()));
             }
             // 更新下一天的夜班用量 = 下一天的夜班抄表-当前的中班抄表
             EquGdyRecordDo nextData = dataFromTheDayBefore(currentData, 1);
             if (nextData != null && nextData.getValuenight() != null) {
-                nextData.setValuenightuse(nextData.getValuenight().subtract(currentData.getValuemiddle()));
+                nextData.setValuenightuse((nextData.getValuenight().subtract(currentData.getValuemiddle()).multiply(gdyMeterDo.getDbbb())));
                 this.updateById(nextData);
             }
         }
@@ -115,10 +118,11 @@ public class EquGdyRecordServiceImpl extends ServiceImpl<EquGdyRecordDao, EquGdy
         instance.setTime(cbdate);
         instance.add(Calendar.DATE, changeDay);
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        return this.baseMapper.selectOne(new LambdaQueryWrapper<EquGdyRecordDo>()
+
+        return  this.getOne(new LambdaQueryWrapper<EquGdyRecordDo>()
                 .eq(BaseDo::getDeleted, "0")
                 .eq(EquGdyRecordDo::getCbdate, dateFormat.format(instance.getTime()))
-                .eq(EquGdyRecordDo::getMeterid, equGdyRecordDo.getMeterid()));
+                .eq(EquGdyRecordDo::getMeterid, equGdyRecordDo.getMeterid()),false);
     }
 }