|
@@ -1,6 +1,7 @@
|
|
|
package com.sky.ioc.service.carbon.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.sky.ioc.entity.Indeicator;
|
|
|
import com.sky.ioc.entity.Label;
|
|
|
import com.sky.ioc.entity.Cake;
|
|
@@ -351,18 +352,40 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
|
|
|
@Override
|
|
|
public ReturnMsg getCarbonQuotaComposition(IocParam iocParam) {
|
|
|
+ String year = iocParam.getTimeRange().getStartDate().substring(0,4);
|
|
|
String[] param = {"stock","consume"};
|
|
|
String[] labKey = {"中旬","规划院","成分","上分","广分","郑分"};
|
|
|
- List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
|
|
|
- return ReturnMsg.ok(labels1);
|
|
|
+ List<String> lists = carbonQuotaMapper.getCompanys(year);
|
|
|
+ labKey = lists.toArray(new String[0]);
|
|
|
+ List<Label> list = new ArrayList<>();
|
|
|
+ for (int i = 0; i < labKey.length; i++) {
|
|
|
+ Integer quota = carbonQuotaMapper.getQuotaByCompany(labKey[i],year);
|
|
|
+ Integer expend = carbonQuotaMapper.getExpendByCompany(labKey[i],year);
|
|
|
+ Label label = new Label();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put(param[0],quota-expend);
|
|
|
+ jsonObject.put(param[1],expend);
|
|
|
+ label.setJsonObject(jsonObject);
|
|
|
+ label.setLabel(labKey[i]);
|
|
|
+ list.add(label);
|
|
|
+ }
|
|
|
+ return ReturnMsg.ok(list);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ReturnMsg getCarbonNews(IocParam iocParam) {
|
|
|
List<News> newsList = new ArrayList<>();
|
|
|
- newsList.add(new News());
|
|
|
- newsList.add(new News());
|
|
|
- newsList.add(new News());
|
|
|
+ List<CarbonNotice> lists = carbonNoticeMapper.selectList(new LambdaQueryWrapper<CarbonNotice>()
|
|
|
+ .gt(CarbonNotice::getCreateTime,iocParam.getTimeRange().getStartDate())
|
|
|
+ .le(CarbonNotice::getCreateTime,iocParam.getTimeRange().getEndDate()));
|
|
|
+ for (CarbonNotice carbonNotice : lists) {
|
|
|
+ News news = new News();
|
|
|
+ news.setContent(carbonNotice.getContent());
|
|
|
+ news.setTital(carbonNotice.getTitle());
|
|
|
+ news.setWriter(carbonNotice.getCreateByName());
|
|
|
+ news.setDate(carbonNotice.getCreateTime());
|
|
|
+ newsList.add(news);
|
|
|
+ }
|
|
|
return ReturnMsg.ok(newsList);
|
|
|
}
|
|
|
|