|
@@ -1,9 +1,13 @@
|
|
|
package com.jjt.biz.controller;
|
|
|
|
|
|
import com.jjt.biz.service.IApiAllService;
|
|
|
+import com.jjt.biz.vo.CurrYieldVO;
|
|
|
+import com.jjt.biz.vo.IndexData;
|
|
|
import com.jjt.biz.vo.TwinAllVO;
|
|
|
+import com.jjt.common.constant.CacheConstants;
|
|
|
import com.jjt.common.core.controller.BaseController;
|
|
|
import com.jjt.common.core.domain.R;
|
|
|
+import com.jjt.common.core.redis.RedisCache;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -13,6 +17,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
|
|
|
/**
|
|
|
* swagger 用户测试方法
|
|
@@ -25,6 +31,8 @@ import javax.annotation.Resource;
|
|
|
public class ApiAllController extends BaseController {
|
|
|
@Resource
|
|
|
private IApiAllService service;
|
|
|
+ @Resource
|
|
|
+ private RedisCache redisCache;
|
|
|
|
|
|
@ApiOperation("全厂数字孪生")
|
|
|
@GetMapping("/api/all/data")
|
|
@@ -34,9 +42,20 @@ public class ApiAllController extends BaseController {
|
|
|
TwinAllVO vo = new TwinAllVO();
|
|
|
vo.setStock(service.stock());
|
|
|
vo.setAvgMonth(service.avgMonth());
|
|
|
- vo.setCurrYield(service.currYield());
|
|
|
+ CurrYieldVO currYieldVO = service.currYield();
|
|
|
+ vo.setCurrYield(currYieldVO);
|
|
|
vo.setProdTrade(service.prodTrade());
|
|
|
vo.setEnergyTrade(service.energyTrade());
|
|
|
+
|
|
|
+ IndexData indexData = redisCache.getCacheObject(CacheConstants.INDEX_CALC);
|
|
|
+ currYieldVO.getJb().setOpenRatio(BigDecimal.valueOf(indexData.getDevice().getRunningRatio()).setScale(0, RoundingMode.HALF_UP));
|
|
|
+ IndexData indexData1 = redisCache.getCacheObject(CacheConstants.INDEX_ALARM);
|
|
|
+ currYieldVO.getJb().setYield(BigDecimal.valueOf(indexData.getEfficiency().getTotalLength()).setScale(0, RoundingMode.HALF_UP));
|
|
|
+ currYieldVO.getJb().setYieldMax(BigDecimal.valueOf(50000));
|
|
|
+ BigDecimal jdl = BigDecimal.valueOf(indexData.getEfficiency().getAEfficiency() + indexData.getEfficiency().getBEfficiency()).divide(BigDecimal.valueOf(2), 0, RoundingMode.HALF_UP);
|
|
|
+ currYieldVO.getJb().setJdl(jdl);
|
|
|
+ currYieldVO.getJb().setOpenNum(indexData1.getDevice().getOnline());
|
|
|
+ currYieldVO.getJb().setTotalNum(indexData1.getDevice().getTotal());
|
|
|
return R.ok(vo);
|
|
|
}
|
|
|
|