|
@@ -1,16 +1,15 @@
|
|
|
package com.jjt.biz.service.impl;
|
|
|
|
|
|
import com.jjt.biz.service.IApiAllService;
|
|
|
-import com.jjt.biz.vo.AvgMonthVO;
|
|
|
-import com.jjt.biz.vo.CurrYieldVO;
|
|
|
-import com.jjt.biz.vo.EnergyTradeVO;
|
|
|
-import com.jjt.biz.vo.ProdTradeVO;
|
|
|
+import com.jjt.biz.vo.*;
|
|
|
import com.jjt.common.constant.CacheConstants;
|
|
|
import com.jjt.common.core.redis.RedisCache;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.time.LocalDate;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -60,6 +59,15 @@ public class ApiAllServiceImpl implements IApiAllService {
|
|
|
public CurrYieldVO currYield() {
|
|
|
CurrYieldVO vo = new CurrYieldVO();
|
|
|
vo.mock();
|
|
|
+ IndexData indexData = redisCache.getCacheObject(CacheConstants.INDEX_CALC);
|
|
|
+ vo.getJb().setOpenRatio(BigDecimal.valueOf(indexData.getDevice().getRunningRatio()).setScale(0, RoundingMode.HALF_UP));
|
|
|
+ IndexData indexData1 = redisCache.getCacheObject(CacheConstants.INDEX_ALARM);
|
|
|
+ vo.getJb().setYield(BigDecimal.valueOf(indexData.getEfficiency().getTotalLength()).setScale(0, RoundingMode.HALF_UP));
|
|
|
+ vo.getJb().setYieldMax(BigDecimal.valueOf(50000));
|
|
|
+ BigDecimal jdl = BigDecimal.valueOf(indexData.getEfficiency().getAEfficiency() + indexData.getEfficiency().getBEfficiency()).divide(BigDecimal.valueOf(2), 0, RoundingMode.HALF_UP);
|
|
|
+ vo.getJb().setJdl(jdl);
|
|
|
+ vo.getJb().setOpenNum(indexData1.getDevice().getOnline());
|
|
|
+ vo.getJb().setTotalNum(indexData1.getDevice().getTotal());
|
|
|
redisCache.setCacheObject(CacheConstants.CURR_YIELD, vo);
|
|
|
return redisCache.getCacheObject(CacheConstants.CURR_YIELD);
|
|
|
}
|
|
@@ -71,8 +79,21 @@ public class ApiAllServiceImpl implements IApiAllService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<ProdTradeVO> prodTrade() {
|
|
|
- redisCache.setCacheObject(CacheConstants.PROD_TRADE, mockProd());
|
|
|
- return redisCache.getCacheObject(CacheConstants.PROD_TRADE);
|
|
|
+ List<ProdTradeVO> list = new ArrayList<>();
|
|
|
+ IndexData id = redisCache.getCacheObject(CacheConstants.INDEX_CALC);
|
|
|
+ List<WeekData> weekDataList = id.getWeekData();
|
|
|
+ for (WeekData wd : weekDataList) {
|
|
|
+ ProdTradeVO vo = new ProdTradeVO();
|
|
|
+ vo.mock();
|
|
|
+ vo.setJbLength(wd.getLength());
|
|
|
+ vo.setJbWeight(wd.getWeight());
|
|
|
+ LocalDate localDate = LocalDate.parse(wd.getTime());
|
|
|
+ vo.setDate(week(localDate));
|
|
|
+ vo.setTips(localDate.toString());
|
|
|
+ list.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
/**
|