|
@@ -1,11 +1,23 @@
|
|
|
package com.gyee.runeconomy.service.auto.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.gyee.common.model.StringUtils;
|
|
|
+import com.gyee.common.util.DateUtils;
|
|
|
+import com.gyee.common.vo.healthmanager.CompareVo;
|
|
|
+import com.gyee.runeconomy.init.CacheContext;
|
|
|
+import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
|
|
|
import com.gyee.runeconomy.model.auto.ProEconEquipmentInfoDayTop;
|
|
|
import com.gyee.runeconomy.mapper.auto.ProEconEquipmentInfoDayTopMapper;
|
|
|
import com.gyee.runeconomy.service.auto.IProEconEquipmentInfoDayTopService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 风机日信息表排行 服务实现类
|
|
@@ -17,4 +29,138 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class ProEconEquipmentInfoDayTopServiceImpl extends ServiceImpl<ProEconEquipmentInfoDayTopMapper, ProEconEquipmentInfoDayTop> implements IProEconEquipmentInfoDayTopService {
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<ProEconEquipmentInfoDayTop> getEquipmentInfoDayTopList(String companyId, String windpowerstationId, Integer types, String staType, String date) {
|
|
|
+
|
|
|
+ QueryWrapper<ProEconEquipmentInfoDayTop> qw = new QueryWrapper<>();
|
|
|
+
|
|
|
+
|
|
|
+ List<String> wpids = new ArrayList<>();
|
|
|
+ List<ProBasicPowerstation> wplist = CacheContext.wpls;
|
|
|
+ //场站模糊查询
|
|
|
+ if (StringUtils.isNotEmpty(companyId)) {
|
|
|
+ wplist = CacheContext.wpls.stream().filter(wp -> wp.getRegionId().equals(companyId) || wp.getCompanyId().equals(companyId)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(staType) && !staType.equals("0")) {
|
|
|
+ String finalType = staType.equals("-1") ? "_FDC" : "_GDC";
|
|
|
+ wplist = wplist.stream().filter(wp -> wp.getId().indexOf(finalType) >= 0).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ wpids = wplist.stream().map(ProBasicPowerstation::getId).collect(Collectors.toList());
|
|
|
+ if (StringUtils.isNotEmpty(windpowerstationId)) {
|
|
|
+ wpids.add(windpowerstationId);
|
|
|
+ }
|
|
|
+
|
|
|
+ //匹配场站条件
|
|
|
+ if (wpids.size() > 0) {
|
|
|
+ qw.lambda().in(ProEconEquipmentInfoDayTop::getWindpowerstationId, wpids);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(date)) {
|
|
|
+ qw.lambda().eq(ProEconEquipmentInfoDayTop::getRecordDate, DateUtils.parseDate(date));
|
|
|
+ }
|
|
|
+ if (null != types) {
|
|
|
+ qw.lambda().eq(ProEconEquipmentInfoDayTop::getTypes, types);
|
|
|
+ }
|
|
|
+
|
|
|
+ qw.lambda().orderByAsc(ProEconEquipmentInfoDayTop::getWindturbineId);
|
|
|
+ List<ProEconEquipmentInfoDayTop> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProEconEquipmentInfoDayTop> getEquipmentInfoDayTopHistoryList(String windturbineId, Integer types, String beginDate, String endDate) {
|
|
|
+
|
|
|
+ QueryWrapper<ProEconEquipmentInfoDayTop> qw = new QueryWrapper<>();
|
|
|
+
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(windturbineId)) {
|
|
|
+ qw.lambda().eq(ProEconEquipmentInfoDayTop::getWindturbineId, windturbineId);
|
|
|
+ }
|
|
|
+ if (null != types) {
|
|
|
+ qw.lambda().eq(ProEconEquipmentInfoDayTop::getTypes, types);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(beginDate) && StringUtils.isNotEmpty(endDate))
|
|
|
+ qw.lambda().ge(ProEconEquipmentInfoDayTop::getRecordDate, DateUtils.parseDate(beginDate)).
|
|
|
+ le(ProEconEquipmentInfoDayTop::getRecordDate, DateUtils.parseDate(endDate));
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconEquipmentInfoDayTop> list = baseMapper.selectList(qw);
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getEquipmentInfoDayTopCompareList(List<Long> ids, Integer types) {
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+ QueryWrapper<ProEconEquipmentInfoDayTop> qw = new QueryWrapper<>();
|
|
|
+
|
|
|
+
|
|
|
+ if (null != ids && ids.size() > 0) {
|
|
|
+ qw.lambda().in(ProEconEquipmentInfoDayTop::getId, ids);
|
|
|
+ }
|
|
|
+ List<ProEconEquipmentInfoDayTop> list = baseMapper.selectList(qw);
|
|
|
+ resultMap.put("compare", list);
|
|
|
+
|
|
|
+ List<CompareVo> compareList = new ArrayList<>();
|
|
|
+ list.stream().forEach(wtd -> {
|
|
|
+
|
|
|
+ for (int i = 0; i < 10; i++) {
|
|
|
+ CompareVo vo = new CompareVo();
|
|
|
+
|
|
|
+ switch (i) {
|
|
|
+ case 0:
|
|
|
+ vo.setTarget("平均切入风速");
|
|
|
+ vo.setData(wtd.getYearxfqr());
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ vo.setTarget("性能损失电量");
|
|
|
+ vo.setData(wtd.getYearxnssdl());
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ vo.setTarget("拟合优度");
|
|
|
+ vo.setData(wtd.getYearnhyd());
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ vo.setTarget("功率一致性系数");
|
|
|
+ vo.setData(wtd.getYearglyzxxs());
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ vo.setTarget("利用小时");
|
|
|
+ vo.setData(wtd.getYearlyxs());
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ vo.setTarget("设备可利用率");
|
|
|
+ vo.setData(wtd.getYearsbklyl());
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ vo.setTarget("等效可利用系数");
|
|
|
+ vo.setData(wtd.getYeardxkyxs());
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ vo.setTarget("有效风时数");
|
|
|
+ vo.setData(wtd.getYearyxfss());
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ vo.setTarget("平均风速");
|
|
|
+ vo.setData(wtd.getYearfs());
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ vo.setTarget("静风频率");
|
|
|
+ vo.setData(wtd.getYearjfpl());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ compareList.add(vo);
|
|
|
+ }
|
|
|
+ resultMap.put("charts", compareList);
|
|
|
+ });
|
|
|
+
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|