|
@@ -3,6 +3,7 @@ package org.jeecg.modules.fpgJob;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
+import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.device.entity.DeviceInformation;
|
|
|
import org.jeecg.modules.device.service.IDeviceInformationService;
|
|
|
import org.jeecg.modules.devicePoint.entity.DevicePoint;
|
|
@@ -19,7 +20,6 @@ import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
import org.springframework.data.mongodb.core.query.Query;
|
|
|
import org.springframework.data.mongodb.core.query.Update;
|
|
|
import org.springframework.data.mongodb.core.query.UpdateDefinition;
|
|
|
-import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
@@ -59,37 +59,53 @@ public class LeanModelStatistics {
|
|
|
@Autowired
|
|
|
MongoTemplate mongoTemplate;
|
|
|
|
|
|
- @Autowired
|
|
|
- RedisTemplate redisTemplate;
|
|
|
|
|
|
- // 每日3点执行 测试期间1ms一次
|
|
|
+ /**
|
|
|
+ * 精益模型统计数据
|
|
|
+ * 执行完后,间隔1秒继续执行
|
|
|
+ */
|
|
|
+ @Scheduled(fixedDelay = 1000)
|
|
|
+ public void t1(){
|
|
|
+ leanModel();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 变更占比
|
|
|
+ * 0 0 03 * * * 每日3点执行 测试期间1ms一次
|
|
|
+ */
|
|
|
@Scheduled(cron = "0 0 03 * * *")
|
|
|
// @Scheduled(fixedDelay = 1000)
|
|
|
public void t2(){
|
|
|
changeProportion();
|
|
|
- } // 1ms
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备启停统计数据
|
|
|
+ */
|
|
|
+ @Scheduled(fixedDelay = 500)
|
|
|
+ public void t3(){
|
|
|
+ deviceStatistics();
|
|
|
+ }
|
|
|
+
|
|
|
public void changeProportion(){
|
|
|
log.info("变更占比");
|
|
|
// 峰平谷精益模型配置获取
|
|
|
LambdaQueryWrapper<FpgLeanModel> leanmodelQuery = new LambdaQueryWrapper<FpgLeanModel>().eq(FpgLeanModel::getStatus, "1");
|
|
|
List<FpgLeanModel> fpgLeanModellist = fpgLeanModelService.list(leanmodelQuery);
|
|
|
- LocalDate today = LocalDate.now(); // 获取今天的日期
|
|
|
- LocalDate yesterday = today.minusDays(1); // 减去一天,得到昨天的日期
|
|
|
- /* Criteria criteria = new Criteria();
|
|
|
- criteria.orOperator(Criteria.where("status").is(0),
|
|
|
- Criteria.where("status").is(1));*/
|
|
|
+ LocalDate yesterday = LocalDate.now().minusDays(1); // 获取今天的日期 减去一天,得到昨天的日期
|
|
|
// 处理数据业务逻辑
|
|
|
- fpgLeanModellist.stream().filter(fpgLeanModeInfo -> fpgLeanModeInfo.getProportion() != null && fpgLeanModeInfo.getProportion() == 1).forEach(fpgLeanModeInfo -> {
|
|
|
+ fpgLeanModellist.forEach(fpgLeanModeInfo -> {
|
|
|
Query query = new Query();
|
|
|
- query.addCriteria(Criteria.where("proportion").is(1)).addCriteria(Criteria.where("dates").is(String.valueOf(yesterday)));
|
|
|
+ query.addCriteria(Criteria.where("proportion").is(1))
|
|
|
+ .addCriteria(Criteria.where("dates").is(yesterday.toString()));
|
|
|
List<FpgStatiscsModelMongodb> fpgStatiscsModelMongoList = mongoTemplate.find(query, FpgStatiscsModelMongodb.class, "leanmodel_" + fpgLeanModeInfo.getLeanModelCode());
|
|
|
BigDecimal zb = new BigDecimal("100");
|
|
|
fpgStatiscsModelMongoList.forEach(fpgStatiscsModelMongoInfo -> { // 循环处理采集数据处理
|
|
|
BigDecimal proportion = fpgStatiscsModelMongoInfo.getPower();
|
|
|
- BigDecimal topsProportion = fpgStatiscsModelMongoInfo.getTopsPower();
|
|
|
- BigDecimal peaksProportion = fpgStatiscsModelMongoInfo.getPeaksPower();
|
|
|
- BigDecimal flatProportion = fpgStatiscsModelMongoInfo.getFlatPower();
|
|
|
- BigDecimal valleysProportion = fpgStatiscsModelMongoInfo.getValleysPower();
|
|
|
+ BigDecimal topsProportion = fpgStatiscsModelMongoInfo.getTopsPower() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongoInfo.getTopsPower();
|
|
|
+ BigDecimal peaksProportion = fpgStatiscsModelMongoInfo.getPeaksPower() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongoInfo.getPeaksPower();
|
|
|
+ BigDecimal flatProportion = fpgStatiscsModelMongoInfo.getFlatPower() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongoInfo.getPeaksPower();
|
|
|
+ BigDecimal valleysProportion = fpgStatiscsModelMongoInfo.getValleysPower() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongoInfo.getPeaksPower();
|
|
|
// 核算占比
|
|
|
UpdateDefinition update = new Update();
|
|
|
((Update) update).set("proportion", 2);
|
|
@@ -111,15 +127,14 @@ public class LeanModelStatistics {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- @Scheduled(fixedDelay = 500)
|
|
|
- public void t3(){
|
|
|
- deviceStatistics("500");
|
|
|
- } // 1ms
|
|
|
+
|
|
|
+
|
|
|
// 设备启停统计数据
|
|
|
- public void deviceStatistics(String freq) {
|
|
|
+ public void deviceStatistics() {
|
|
|
log.info("设备日常统计");
|
|
|
// 获取当前时间
|
|
|
- Date curentDate = new Date(new Date().getTime() + 8 * 60 * 60 * 1000);
|
|
|
+ LocalDateTime newTime = LocalDateTime.now().plusHours(8);
|
|
|
+ Date curentDate = Date.from(newTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
// 峰平谷精益模型配置获取
|
|
|
List<DeviceInformation> deviceInformationllist = deviceInformationService.list();
|
|
|
// 尖峰平谷时段配置
|
|
@@ -130,7 +145,7 @@ public class LeanModelStatistics {
|
|
|
// 查询采集点
|
|
|
LambdaQueryWrapper<DevicePoint> devicePointQuery = new LambdaQueryWrapper<DevicePoint>().eq(DevicePoint::getDeviceId, deviceInformationlinfo.getId());
|
|
|
List<DevicePoint> devicePointList = devicePointService.list(devicePointQuery);
|
|
|
- if(devicePointList == null){
|
|
|
+ if(oConvertUtils.listIsEmpty(devicePointList)){
|
|
|
return;
|
|
|
}
|
|
|
// 采集点组合
|
|
@@ -160,7 +175,6 @@ public class LeanModelStatistics {
|
|
|
peaksAndValleysTimeConfiglist.forEach(peaksAndValleysTimeConfig -> {
|
|
|
if (containsCreateTime(localDateTime, dayDate + " " + peaksAndValleysTimeConfig.getStartTime(), dayDate + " " + peaksAndValleysTimeConfig.getEndTime())) {
|
|
|
jfpgStr.set(peaksAndValleysTimeConfig.getType());
|
|
|
- return;
|
|
|
}
|
|
|
});
|
|
|
// 功率
|
|
@@ -174,7 +188,8 @@ public class LeanModelStatistics {
|
|
|
DeviceStatiscsModelData startStopStatiscsData = new DeviceStatiscsModelData(fpgGatherData, startStopMonKey, dayDate, classs, curentDate, curentDate);
|
|
|
// 组合mongodb条件
|
|
|
Query queryStartStop = new Query()
|
|
|
- .addCriteria(Criteria.where("deviceRegionId").is(fpgGatherData.getDeviceRegionId())).addCriteria(Criteria.where("deviceInformationId").is(fpgGatherData.getDeviceInformationId()));
|
|
|
+ .addCriteria(Criteria.where("deviceRegionId").is(fpgGatherData.getDeviceRegionId()))
|
|
|
+ .addCriteria(Criteria.where("deviceInformationId").is(fpgGatherData.getDeviceInformationId()));
|
|
|
// 设备停止
|
|
|
if(fpgGatherData.getRunCurrent().compareTo(new BigDecimal("5")) < 0){ // 设备停止运行 直接更新停止时间结束不用统计任何东西
|
|
|
// queryStartStop.addCriteria(Criteria.where("deviceStopTime").is(null));
|
|
@@ -282,26 +297,22 @@ public class LeanModelStatistics {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- @Scheduled(fixedDelay = 1000)
|
|
|
- public void t1(){
|
|
|
- leanModel("1000");
|
|
|
- } // 1ms
|
|
|
-
|
|
|
// 精益模型统计数据
|
|
|
- public void leanModel(String freq){
|
|
|
+ public void leanModel(){
|
|
|
log.info("峰平谷模型");
|
|
|
// 峰平谷精益模型配置获取
|
|
|
LambdaQueryWrapper<FpgLeanModel> leanmodelQuery = new LambdaQueryWrapper<FpgLeanModel>().eq(FpgLeanModel::getStatus, "1");
|
|
|
List<FpgLeanModel> fpgLeanModellist = fpgLeanModelService.list(leanmodelQuery);
|
|
|
// 获取当前时间
|
|
|
- Date curentDate = new Date(new Date().getTime() + 8 * 60 * 60 * 1000);
|
|
|
+ LocalDateTime newTime = LocalDateTime.now().plusHours(8);
|
|
|
+ Date curentDate = Date.from(newTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
// 尖峰平谷时段配置
|
|
|
List<PeaksAndValleysTimeConfig> peaksAndValleysTimeConfiglist = peaksAndValleysTimeConfigService.list();
|
|
|
//遍历设备集合
|
|
|
fpgLeanModellist.forEach(fpgLeanModeInfo -> {
|
|
|
LambdaQueryWrapper<FpgGatherData> fpgGatherQuery = new LambdaQueryWrapper<FpgGatherData>().eq(FpgGatherData::getFpgModelState, "0");
|
|
|
// 检测是否配置设备特殊条件
|
|
|
- if(fpgLeanModeInfo.getDeviceInformationIds() != null && !fpgLeanModeInfo.getDeviceInformationIds().isEmpty()){
|
|
|
+ if(oConvertUtils.isNotEmpty(fpgLeanModeInfo.getDeviceInformationIds()) && oConvertUtils.isNotEmpty(fpgLeanModeInfo.getDeviceInformationIds())){
|
|
|
fpgGatherQuery.in(FpgGatherData::getDeviceInformationId, Arrays.asList(fpgLeanModeInfo.getDeviceInformationIds().split(",")));
|
|
|
}
|
|
|
List<FpgGatherData> fpgGatherList = fpgGatherDataService.list(fpgGatherQuery);
|
|
@@ -312,16 +323,16 @@ public class LeanModelStatistics {
|
|
|
// fpgGatherDataService.updateById(fpgGatherData);
|
|
|
String finalDatestr = "";
|
|
|
// 统计单位
|
|
|
- if("minute". equals(fpgLeanModeInfo.getTotalUnit())){ // 分钟
|
|
|
+ if("minute".equals(fpgLeanModeInfo.getTotalUnit())){ // 分钟
|
|
|
finalDatestr = new SimpleDateFormat("HH:mm").format(fpgGatherData.getCreateTime());
|
|
|
- } else if("hour". equals(fpgLeanModeInfo.getTotalUnit())){ // 小时
|
|
|
+ } else if("hour".equals(fpgLeanModeInfo.getTotalUnit())){ // 小时
|
|
|
finalDatestr = new SimpleDateFormat("HH:00").format(fpgGatherData.getCreateTime());
|
|
|
- } else if("day". equals(fpgLeanModeInfo.getTotalUnit())){ //
|
|
|
+ } else if("day".equals(fpgLeanModeInfo.getTotalUnit())){ //
|
|
|
finalDatestr = new SimpleDateFormat("yyyy-MM-dd").format(fpgGatherData.getCreateTime());
|
|
|
- } else if("week". equals(fpgLeanModeInfo.getTotalUnit())){ //
|
|
|
+ } else if("week".equals(fpgLeanModeInfo.getTotalUnit())){ //
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
finalDatestr = String.valueOf(calendar.get(Calendar.WEEK_OF_MONTH));
|
|
|
- } else if("month". equals(fpgLeanModeInfo.getTotalUnit())){ //
|
|
|
+ } else if("month".equals(fpgLeanModeInfo.getTotalUnit())){ //
|
|
|
finalDatestr = new SimpleDateFormat("yyyy-MM").format(fpgGatherData.getCreateTime());
|
|
|
}
|
|
|
String dayDate = new SimpleDateFormat("yyyy-MM-dd").format(fpgGatherData.getCreateTime());
|
|
@@ -345,14 +356,15 @@ public class LeanModelStatistics {
|
|
|
peaksAndValleysTimeConfiglist.forEach(peaksAndValleysTimeConfig -> {
|
|
|
if (containsCreateTime(localDateTime, dayDate + " " + peaksAndValleysTimeConfig.getStartTime(), dayDate + " " + peaksAndValleysTimeConfig.getEndTime())) {
|
|
|
jfpgStr.set(peaksAndValleysTimeConfig.getType());
|
|
|
- return;
|
|
|
}
|
|
|
});
|
|
|
// 重组对象
|
|
|
FpgStatiscsModelData fpgStatiscsModelData = new FpgStatiscsModelData(fpgGatherData, fpgLeanModeInfo, finalDatestr, dayDate, classs, curentDate, curentDate);
|
|
|
// 组合mongodb条件
|
|
|
Query query = new Query();
|
|
|
- query.addCriteria(Criteria.where("devicePointId").is(fpgGatherData.getDevicePointId())).addCriteria(Criteria.where("dates").is(dayDate)).addCriteria(Criteria.where("datestr").is(finalDatestr));
|
|
|
+ query.addCriteria(Criteria.where("devicePointId").is(fpgGatherData.getDevicePointId()))
|
|
|
+ .addCriteria(Criteria.where("dates").is(dayDate))
|
|
|
+ .addCriteria(Criteria.where("datestr").is(finalDatestr));
|
|
|
if(fpgGatherData.getDeviceRegionId() != null && !fpgGatherData.getDeviceRegionId().isEmpty()){ // 区域特殊处理
|
|
|
query.addCriteria(Criteria.where("deviceRegionId").is(fpgGatherData.getDeviceRegionId()));
|
|
|
}
|
|
@@ -362,8 +374,8 @@ public class LeanModelStatistics {
|
|
|
if(!classs.isEmpty()){ // 增加班次条件
|
|
|
query.addCriteria(Criteria.where("classs").is(classs));
|
|
|
}
|
|
|
- FpgStatiscsModelMongodb FpgStatiscsModelMongo = mongoTemplate.findOne(query, FpgStatiscsModelMongodb.class, "leanmodel_" + fpgLeanModeInfo.getLeanModelCode());
|
|
|
- if(FpgStatiscsModelMongo != null){ // 不为空处理
|
|
|
+ FpgStatiscsModelMongodb fpgStatiscsModelMongo = mongoTemplate.findOne(query, FpgStatiscsModelMongodb.class, "leanmodel_" + fpgLeanModeInfo.getLeanModelCode());
|
|
|
+ if(fpgStatiscsModelMongo != null){ // 不为空处理
|
|
|
// 基础数据变更不受条件影响
|
|
|
UpdateDefinition update = new Update();
|
|
|
((Update) update).set("updateTime", curentDate);
|
|
@@ -372,8 +384,8 @@ public class LeanModelStatistics {
|
|
|
// 电流
|
|
|
BigDecimal selectricCurrent = fpgGatherData.getRunCurrent() == null ? new BigDecimal("0.00") : fpgGatherData.getRunCurrent();
|
|
|
BigDecimal runTime = new BigDecimal("1");
|
|
|
- BigDecimal oldPower = FpgStatiscsModelMongo.getPower() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getPower();
|
|
|
- BigDecimal oldingTime = FpgStatiscsModelMongo.getIngTime() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getIngTime();
|
|
|
+ BigDecimal oldPower = fpgStatiscsModelMongo.getPower() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getPower();
|
|
|
+ BigDecimal oldingTime = fpgStatiscsModelMongo.getIngTime() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getIngTime();
|
|
|
// 总运行时间处理
|
|
|
if(fpgLeanModeInfo.getRunTime() != null && fpgLeanModeInfo.getRunTime() == 1) { // 运行时长统计
|
|
|
((Update) update).set("ingTime", oldingTime.add(runTime));
|
|
@@ -381,16 +393,16 @@ public class LeanModelStatistics {
|
|
|
// 电流处理
|
|
|
if(fpgLeanModeInfo.getElectricCurrent() != null && fpgLeanModeInfo.getElectricCurrent() == 1){
|
|
|
if("tops".equals(jfpgStr.get())) { // 尖
|
|
|
- BigDecimal oldtopsSelectricCurrent = FpgStatiscsModelMongo.getTopsSelectricCurrent() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getTopsSelectricCurrent();
|
|
|
+ BigDecimal oldtopsSelectricCurrent = fpgStatiscsModelMongo.getTopsSelectricCurrent() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getTopsSelectricCurrent();
|
|
|
((Update) update).set("topSelectricCurrent", oldtopsSelectricCurrent.add(selectricCurrent));
|
|
|
} else if("peaks".equals(jfpgStr.get())){ // 峰
|
|
|
- BigDecimal oldpeaksSelectricCurrent = FpgStatiscsModelMongo.getPeaksSelectricCurrent() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getPeaksSelectricCurrent();
|
|
|
+ BigDecimal oldpeaksSelectricCurrent = fpgStatiscsModelMongo.getPeaksSelectricCurrent() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getPeaksSelectricCurrent();
|
|
|
((Update) update).set("peaksSelectricCurrent", oldpeaksSelectricCurrent.add(selectricCurrent));
|
|
|
} else if("flat".equals(jfpgStr.get())) { // 平
|
|
|
- BigDecimal oldtflatSelectricCurrent = FpgStatiscsModelMongo.getFlatSelectricCurrent() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getFlatSelectricCurrent();
|
|
|
+ BigDecimal oldtflatSelectricCurrent = fpgStatiscsModelMongo.getFlatSelectricCurrent() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getFlatSelectricCurrent();
|
|
|
((Update) update).set("flatSelectricCurrent", oldtflatSelectricCurrent.add(selectricCurrent));
|
|
|
} else if("valleys".equals(jfpgStr.get())) { // 谷
|
|
|
- BigDecimal oldvalleysSelectricCurrent = FpgStatiscsModelMongo.getValleysSelectricCurrent() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getValleysSelectricCurrent();
|
|
|
+ BigDecimal oldvalleysSelectricCurrent = fpgStatiscsModelMongo.getValleysSelectricCurrent() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getValleysSelectricCurrent();
|
|
|
((Update) update).set("valleysSelectricCurrent", oldvalleysSelectricCurrent.add(selectricCurrent));
|
|
|
}
|
|
|
}
|
|
@@ -399,65 +411,65 @@ public class LeanModelStatistics {
|
|
|
// 尖峰平谷判定
|
|
|
if("tops".equals(jfpgStr.get())){ // 尖
|
|
|
// 功率处理
|
|
|
- BigDecimal oldtopsPower = FpgStatiscsModelMongo.getTopsPower() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getTopsPower();
|
|
|
+ BigDecimal oldtopsPower = fpgStatiscsModelMongo.getTopsPower() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getTopsPower();
|
|
|
((Update) update).set("topsPower", oldtopsPower.add(activePower));
|
|
|
// 运行时常处理
|
|
|
if(fpgLeanModeInfo.getRunTime() != null && fpgLeanModeInfo.getRunTime() == 1){ // 运行时长统计
|
|
|
- BigDecimal oldtopsIngTime = FpgStatiscsModelMongo.getTopsIngTime() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getTopsIngTime();
|
|
|
+ BigDecimal oldtopsIngTime = fpgStatiscsModelMongo.getTopsIngTime() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getTopsIngTime();
|
|
|
((Update) update).set("topsIngTime", oldtopsIngTime.add(runTime));
|
|
|
}
|
|
|
// 金额处理
|
|
|
if(fpgLeanModeInfo.getTopsPrice() != null && fpgLeanModeInfo.getTopsPrice().compareTo(new BigDecimal("0.00")) > 0) {
|
|
|
// 总金额
|
|
|
- BigDecimal totalAmount = FpgStatiscsModelMongo.getAmount() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getAmount();
|
|
|
+ BigDecimal totalAmount = fpgStatiscsModelMongo.getAmount() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getAmount();
|
|
|
((Update) update).set("amount", activePower.multiply(fpgLeanModeInfo.getTopsPrice()).add(totalAmount));
|
|
|
((Update) update).set("topsAmount", oldtopsPower.add(activePower).multiply(fpgLeanModeInfo.getTopsPrice()));
|
|
|
}
|
|
|
} else if("peaks".equals(jfpgStr.get())){ // 峰
|
|
|
// 功率处理
|
|
|
- BigDecimal oldpeaksPower = FpgStatiscsModelMongo.getPeaksPower() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getPeaksPower();
|
|
|
+ BigDecimal oldpeaksPower = fpgStatiscsModelMongo.getPeaksPower() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getPeaksPower();
|
|
|
((Update) update).set("peaksPower", oldpeaksPower.add(activePower));
|
|
|
// 运行时常处理
|
|
|
if(fpgLeanModeInfo.getRunTime() != null && fpgLeanModeInfo.getRunTime() == 1){ // 运行时长统计
|
|
|
- BigDecimal oldpeaksIngTime = FpgStatiscsModelMongo.getPeaksIngTime() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getPeaksIngTime();
|
|
|
+ BigDecimal oldpeaksIngTime = fpgStatiscsModelMongo.getPeaksIngTime() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getPeaksIngTime();
|
|
|
((Update) update).set("peaksIngTime", oldpeaksIngTime.add(runTime));
|
|
|
}
|
|
|
// 金额处理
|
|
|
if(fpgLeanModeInfo.getPeaksPrice() != null && fpgLeanModeInfo.getPeaksPrice().compareTo(new BigDecimal("0.00")) > 0) {
|
|
|
// 总金额
|
|
|
- BigDecimal totalAmount = FpgStatiscsModelMongo.getAmount() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getAmount();
|
|
|
+ BigDecimal totalAmount = fpgStatiscsModelMongo.getAmount() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getAmount();
|
|
|
((Update) update).set("amount", activePower.multiply(fpgLeanModeInfo.getPeaksPrice()).add(totalAmount));
|
|
|
((Update) update).set("topsAmount", oldpeaksPower.add(activePower).multiply(fpgLeanModeInfo.getPeaksPrice()));
|
|
|
}
|
|
|
} else if("flat".equals(jfpgStr.get())){ // 平
|
|
|
// 功率处理
|
|
|
- BigDecimal oldflatPower = FpgStatiscsModelMongo.getFlatPower() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getFlatPower();
|
|
|
+ BigDecimal oldflatPower = fpgStatiscsModelMongo.getFlatPower() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getFlatPower();
|
|
|
((Update) update).set("flatPower", oldflatPower.add(activePower));
|
|
|
// 运行时常处理
|
|
|
if(fpgLeanModeInfo.getRunTime() != null && fpgLeanModeInfo.getRunTime() == 1){
|
|
|
- BigDecimal oldflatIngTime = FpgStatiscsModelMongo.getFlatIngTime() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getFlatIngTime();
|
|
|
+ BigDecimal oldflatIngTime = fpgStatiscsModelMongo.getFlatIngTime() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getFlatIngTime();
|
|
|
((Update) update).set("topsIngTime", oldflatIngTime.add(runTime));
|
|
|
}
|
|
|
// 金额处理
|
|
|
if(fpgLeanModeInfo.getFlatPrice() != null && fpgLeanModeInfo.getFlatPrice().compareTo(new BigDecimal("0.00")) > 0) {
|
|
|
// 总金额
|
|
|
- BigDecimal totalAmount = FpgStatiscsModelMongo.getAmount() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getAmount();
|
|
|
+ BigDecimal totalAmount = fpgStatiscsModelMongo.getAmount() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getAmount();
|
|
|
((Update) update).set("amount", activePower.multiply(fpgLeanModeInfo.getFlatPrice()).add(totalAmount));
|
|
|
((Update) update).set("flatAmount", oldflatPower.add(activePower).multiply(fpgLeanModeInfo.getFlatPrice()));
|
|
|
}
|
|
|
} else if("valleys".equals(jfpgStr.get())){ // 谷
|
|
|
// 功率处理
|
|
|
- BigDecimal oldvalleysPower = FpgStatiscsModelMongo.getValleysPower() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getValleysPower();
|
|
|
+ BigDecimal oldvalleysPower = fpgStatiscsModelMongo.getValleysPower() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getValleysPower();
|
|
|
((Update) update).set("valleysPower", oldvalleysPower.add(activePower));
|
|
|
// 运行时常处理
|
|
|
if(fpgLeanModeInfo.getRunTime() != null && fpgLeanModeInfo.getRunTime() == 1){
|
|
|
- BigDecimal oldvalleysIngTime = FpgStatiscsModelMongo.getValleysIngTime() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getValleysIngTime();
|
|
|
+ BigDecimal oldvalleysIngTime = fpgStatiscsModelMongo.getValleysIngTime() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getValleysIngTime();
|
|
|
((Update) update).set("valleysIngTime", oldvalleysIngTime.add(runTime));
|
|
|
}
|
|
|
// 金额处理
|
|
|
if(fpgLeanModeInfo.getValleysPrice() != null && fpgLeanModeInfo.getValleysPrice().compareTo(new BigDecimal("0.00")) > 0) {
|
|
|
// 总金额
|
|
|
- BigDecimal totalAmount = FpgStatiscsModelMongo.getAmount() == null ? new BigDecimal("0.00") : FpgStatiscsModelMongo.getAmount();
|
|
|
+ BigDecimal totalAmount = fpgStatiscsModelMongo.getAmount() == null ? new BigDecimal("0.00") : fpgStatiscsModelMongo.getAmount();
|
|
|
((Update) update).set("amount", activePower.multiply(fpgLeanModeInfo.getValleysPrice()).add(totalAmount));
|
|
|
((Update) update).set("valleysAmount", oldvalleysPower.add(activePower).multiply(fpgLeanModeInfo.getValleysPrice()));
|
|
|
}
|