Commit afe8e5ba authored by chenzhao's avatar chenzhao

修改分析适配

parent d1eac0ba
......@@ -671,6 +671,9 @@ public class DateUtils {
// System.out.println(getWeekBeginDate(dateParse("2021-10-11", null)));
// System.out.println(getWeekEndDate(dateParse("2021-10-11", null)));
System.out.println(secondsToTimeStr(3600));
List<String> beforeCurrentMonth = getBeforeCurrentMonth(3, true);
System.out.println(beforeCurrentMonth);
}
/**
......@@ -1073,4 +1076,26 @@ public class DateUtils {
final LocalDateTime end = LocalDateTime.parse(sdf.format(endTime), DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).toDays();
}
public static List<String> getBeforeCurrentMonth(int num,Boolean bool ){
int n = 0;
if (!bool){
n = n+1;
}
List<String> objects = new ArrayList<>();
for (int i = n; shouldContinue(i,num,bool); i++) {
Date date1 = dateAddMonths(new Date(),num>0?i:-i);
String s = convertDateToString(date1, MONTH_PATTERN);
objects.add(s);
}
return objects;
}
private static boolean shouldContinue(int i, int num, Boolean bool) {
return bool ? i < Math.abs(num) : i <=Math.abs(num) ;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapBuilder;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESMoonPowerGeneration;
......@@ -33,8 +35,16 @@ public class EarningsForecastImpl {
private StationBasicMapper stationBasicMapper;
//收益 时间曲线图数据组装
public Object earningsForecastSJQXT (Long stationId, String type){
List<Map<String, String>> list = commonMapper.selectAgo10Month();
List<Map<String, String>> lastThreeMonth = commonMapper.selectLast3Month();
List<String> beforeMonth = DateUtils.getBeforeCurrentMonth(-10, false);
List<String> afterMonth = DateUtils.getBeforeCurrentMonth(3, true);
List<Map<String, String>> list = beforeMonth.stream()
.map(month -> MapBuilder.<String,String>create().put ("MonthYear", month).build())
.collect(Collectors.toList());
List<Map<String, String>> lastThreeMonth = afterMonth.stream()
.map(month -> MapBuilder.<String,String>create().put ("MonthYear", month).build())
.collect(Collectors.toList());
Map<String, List<String>> queryCondtion1 = new HashMap<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
......@@ -124,10 +134,14 @@ public class EarningsForecastImpl {
//收益 折线图数据组装
public Object earningsForecastZXT (Long stationId, String type){
List<Map<String, String>> list = commonMapper.selectAgo10Month();
List<Map<String, String>> lastThreeMonth = commonMapper.selectLast3Month();
List<String> beforeMonth = DateUtils.getBeforeCurrentMonth(-10, false);
List<String> afterMonth = DateUtils.getBeforeCurrentMonth(3, true);
List<Map<String, String>> list = beforeMonth.stream()
.map(month -> MapBuilder.<String,String>create().put ("MonthYear", month).build())
.collect(Collectors.toList());
List<Map<String, String>> lastThreeMonth = afterMonth.stream()
.map(month -> MapBuilder.<String,String>create().put ("MonthYear", month).build())
.collect(Collectors.toList());
Map<String, List<String>> queryCondtion1 = new HashMap<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
if (type.equals("FDZ")){
......
......@@ -24,6 +24,9 @@ public interface SjglZsjZsbtzMapper extends BaseMapper<SjglZsjZsbtz> {
List<Map<String,Object>> getStationInfoMapByStationWerks(String WERKS, String DATAID);
List<Map<String,Object>> getStationInfoMapByStationWerksNew(String WERKS, String DATAID);
List<Map<String,Object>> getStationInfoMapByStationGFWerks(String WERKS,String DATAID);
List<Map<String, Object>> getStationInfoMapByStationGFWerksNew(String WERKS,String DATAID);
}
......@@ -1227,8 +1227,26 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
.filter(esEquipments -> esEquipments.getEquipmentIndexName().equals("有功功率"))
.collect(Collectors.toMap(ESEquipments::getEquipmentNumber, ESEquipments::getValueF));
TpriDmpDatabook tpriDmpDatabook = tpriDmpDatabookServiceImpl.getTpriDmpDatabookByDataName("风机");
List<Map<String, Object>> dataMaps = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper
.getStationInfoMapByStationWerks(werks, tpriDmpDatabook.getDataid().toString());
// List<Map<String, Object>> dataMaps = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper
// .getStationInfoMapByStationWerks(werks, tpriDmpDatabook.getDataid().toString());
List<Map<String, Object>> dataMapss = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper
.getStationInfoMapByStationWerksNew(werks, tpriDmpDatabook.getDataid().toString());
Map<String, List<Map<String, Object>>> dataResult = dataMapss.stream().collect(Collectors.groupingBy(map -> (String) map.get("name")));
List<Map<String, Object>> dataMaps = new ArrayList<>();
dataResult.keySet().forEach(m->{
String equipNum = dataResult.get(m).stream()
.map(map ->map.get("equipNum").toString().replace(m+"#",""))
.reduce((a, b) -> a + "," + b)
.orElse("");
Map<String, Object> hashMap = new HashMap<>();
hashMap.put("name",m.replace("#",""));
hashMap.put("equipNum",equipNum);
dataMaps.add(hashMap);
});
// 获取风机列表
List<ESEquipmentsDTO> fanStatusList = getFanStatusList(stationId);
fanStatusList.forEach(equipments -> {
......@@ -2360,8 +2378,28 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
map.put("state" + number, equipStatesMap.get(esEquipments.getEquipmentNumber()));
maps.add(map);
}
List<Map<String, Object>> dataMaps = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper
.getStationInfoMapByStationGFWerks(werks, "集电线");
// List<Map<String, Object>> dataMaps = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper
// .getStationInfoMapByStationGFWerks(werks, "集电线");
List<Map<String, Object>> dataMapss = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper
.getStationInfoMapByStationGFWerksNew(werks,"集电线");
Map<String, List<Map<String, Object>>> dataResult = dataMapss.stream().collect(Collectors.groupingBy(map -> (String) map.get("name")));
List<Map<String, Object>> dataMaps = new ArrayList<>();
dataResult.keySet().forEach(m->{
String equipNum = dataResult.get(m).stream()
.map(map ->map.get("equipNum").toString().replace(m,""))
.reduce((a, b) -> a + "," + b)
.orElse("");
Map<String, Object> hashMap = new HashMap<>();
hashMap.put("name",m.replace("#",""));
hashMap.put("equipNum",equipNum);
dataMaps.add(hashMap);
});
int i = 0;
// 逆变器需要根据所属集电线分类组装 下面循环是将同一子阵下的不同逆变器组装为消息数据
for (Map<String, Object> dataMap : dataMaps) {
......
......@@ -18,7 +18,31 @@
FSB
</select>
<select id="getStationInfoMapByStationWerksNew" resultType="map">
SELECT
SUBSTRING(sjgl_zsj_zsbtz.SBMC, 1, 4) AS name,
REPLACE(sjgl_zsj_zsbtz.SBMC, '风机系统', '') as equipNum
FROM
sjgl_zsj_zsbtz
WHERE
FSB IN (
SELECT
DBID
FROM
sjgl_zsj_zsbtz
WHERE
MACHGENRE = (
SELECT
DATAID
FROM
tpri_dmp_databook
WHERE
MACHGENRE = #{DATAID} and WERKS = #{WERKS}
)
)
</select>
<select id="getStationInfoMapByStationGFWerks" resultType="map">
SELECT LEFT
......@@ -37,6 +61,17 @@
B.FSB
</select>
<select id="getStationInfoMapByStationGFWerksNew" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz">
SELECT
REPLACE(sjgl_zsj_zsbtz.SBMC, '光伏阵区系统', '') as equipNum,
SUBSTRING(sjgl_zsj_zsbtz.SBMC, 1, LOCATE('#', sjgl_zsj_zsbtz.SBMC)) AS name
FROM
sjgl_zsj_zsbtz
WHERE
FSB IN ( SELECT DBID FROM sjgl_zsj_zsbtz WHERE MACHGENRE = ( SELECT DATAID FROM tpri_dmp_databook WHERE DATANAME = #{DATAID} ) AND WERKS = #{WERKS} )
</select>
<select id="getEquipQrcodeInfo" resultType="com.yeejoin.amos.boot.module.jxiop.api.entity.StationQrCodeStatistics">
SELECT
WERKS AS code,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment