5 changed files with 491 additions and 0 deletions
@ -0,0 +1,37 @@ |
|||||||
|
package com.mh.web.controller.energy; |
||||||
|
|
||||||
|
import com.mh.common.core.controller.BaseController; |
||||||
|
import com.mh.common.core.domain.AjaxResult; |
||||||
|
import com.mh.common.core.domain.vo.EnergyQueryVO; |
||||||
|
import com.mh.system.service.energy.IEnergyQueryService; |
||||||
|
import com.mh.system.service.energy.IFdgScrEnergyQueryService; |
||||||
|
import jakarta.annotation.Resource; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LJF |
||||||
|
* @version 1.0 |
||||||
|
* @project EEMCS |
||||||
|
* @description 脱硫脱硝系统能效分析controller |
||||||
|
* @date 2026-04-29 14:43:45 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/fgdScr/energy") |
||||||
|
public class FgdScrEnergyAnalyzeController extends BaseController { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private IFdgScrEnergyQueryService fdgScrEnergyQueryService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 整体脱硫系统图形,表格数据查询(公用一个接口) |
||||||
|
* @param page |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@PostMapping("/sys/query") |
||||||
|
public AjaxResult sysQuery(@RequestBody EnergyQueryVO page) { |
||||||
|
return fdgScrEnergyQueryService.sysQuery(page); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,209 @@ |
|||||||
|
package com.mh.system.mapper.energy; |
||||||
|
|
||||||
|
import com.mh.common.core.domain.entity.ConsumptionAnalyze; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
import org.apache.ibatis.annotations.Select; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LJF |
||||||
|
* @version 1.0 |
||||||
|
* @project EEMCS |
||||||
|
* @description 脱硫脱硝能耗查询 |
||||||
|
* @date 2026-04-29 15:10:09 |
||||||
|
*/ |
||||||
|
public interface FgdScrEnergyQueryMapper { |
||||||
|
@Select("<script>" + |
||||||
|
"select " + |
||||||
|
" sum(dm.calc_value) as curValue, " + |
||||||
|
" CASE dm.device_num " + |
||||||
|
" WHEN 'VD16' THEN 'so1' " + |
||||||
|
" WHEN 'VD36' THEN 'so2' " + |
||||||
|
" WHEN 'VD56' THEN 'loadCell' " + |
||||||
|
" ELSE 'Unknown' " + |
||||||
|
" END as deviceType," + |
||||||
|
" TO_CHAR(dm.cur_time, " + |
||||||
|
" <choose>" + |
||||||
|
" <when test='len == 4'>'YYYY'</when>" + |
||||||
|
" <when test='len == 7'>'YYYY-MM'</when>" + |
||||||
|
" <when test='len == 10'>'YYYY-MM-DD'</when>" + |
||||||
|
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" + |
||||||
|
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" + |
||||||
|
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" + |
||||||
|
" </choose>" + |
||||||
|
" ) AS timeStr " + |
||||||
|
"from " + |
||||||
|
" ${lastTableName} dm " + |
||||||
|
"where " + |
||||||
|
" dm.cur_time >= #{startTime}::timestamp " + |
||||||
|
" AND dm.cur_time <= #{endTime}::timestamp " + |
||||||
|
" and dm.device_num in ( " + |
||||||
|
" select " + |
||||||
|
" cpm.mt_num " + |
||||||
|
" from " + |
||||||
|
" collection_params_manage cpm " + |
||||||
|
" join device_ledger dl " + |
||||||
|
"on " + |
||||||
|
" cpm.device_ledger_id = dl.id " + |
||||||
|
"<if test='haveSO2 == true'> " + |
||||||
|
" and dl.device_type in ('31', '32') " + |
||||||
|
"</if>" + |
||||||
|
"<if test='haveSO2 == false'> " + |
||||||
|
" and dl.device_type = '32' " + |
||||||
|
"</if>" + |
||||||
|
"<if test='systemType != null and systemType != \"\"'> " + |
||||||
|
" and cpm.system_type = #{systemType} " + |
||||||
|
"</if>" + |
||||||
|
"<if test='paramType != null and paramType != \"\"'>" + |
||||||
|
" and cpm.param_type = #{paramType} " + |
||||||
|
"</if>" + |
||||||
|
") " + |
||||||
|
"group by " + |
||||||
|
" device_num, " + |
||||||
|
" TO_CHAR(dm.cur_time, " + |
||||||
|
" <choose>" + |
||||||
|
" <when test='len == 4'>'YYYY'</when>" + |
||||||
|
" <when test='len == 7'>'YYYY-MM'</when>" + |
||||||
|
" <when test='len == 10'>'YYYY-MM-DD'</when>" + |
||||||
|
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" + |
||||||
|
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" + |
||||||
|
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" + |
||||||
|
" </choose>" + |
||||||
|
" ) " + |
||||||
|
"order by " + |
||||||
|
" timeStr " + |
||||||
|
"</script>") |
||||||
|
List<ConsumptionAnalyze> queryOneTable(@Param("startTime") String startTime, |
||||||
|
@Param("endTime") String endTime, |
||||||
|
@Param("lastTableName") String lastTableName, |
||||||
|
@Param("curTableName") String curTableName, |
||||||
|
@Param("len") String dateLen, |
||||||
|
@Param("paramType") String paramType, |
||||||
|
@Param("haveLoadCell") boolean haveLoadCell, |
||||||
|
@Param("haveSO2") boolean haveSO2, |
||||||
|
@Param("systemType") String systemType); |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 跨表查询操作 |
||||||
|
* @param startTime 开始时间 |
||||||
|
* @param endTime 结束时间 |
||||||
|
* @param lastTableName 上一个表名 |
||||||
|
* @param curTableName 当前表名 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@Select("<script>" + |
||||||
|
"select " + |
||||||
|
" sum(dm.calc_value) as curValue, " + |
||||||
|
" CASE dm.device_type " + |
||||||
|
" WHEN '5' THEN 'meter' " + |
||||||
|
" WHEN '2' THEN 'cloud' " + |
||||||
|
" ELSE 'Unknown' " + |
||||||
|
" END as deviceType," + |
||||||
|
" TO_CHAR(dm.cur_time, " + |
||||||
|
" <choose>" + |
||||||
|
" <when test='len == 4'>'YYYY'</when>" + |
||||||
|
" <when test='len == 7'>'YYYY-MM'</when>" + |
||||||
|
" <when test='len == 10'>'YYYY-MM-DD'</when>" + |
||||||
|
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" + |
||||||
|
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" + |
||||||
|
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" + |
||||||
|
" </choose>" + |
||||||
|
" ) AS timeStr " + |
||||||
|
"from " + |
||||||
|
" ${lastTableName} dm " + |
||||||
|
"where " + |
||||||
|
" dm.cur_time >= #{startTime}::timestamp " + |
||||||
|
" AND dm.cur_time <= #{endTime}::timestamp " + |
||||||
|
" and dh.device_num in ( " + |
||||||
|
" select " + |
||||||
|
" cpm.mt_num " + |
||||||
|
" from " + |
||||||
|
" collection_params_manage cpm " + |
||||||
|
" join device_ledger dl " + |
||||||
|
"on " + |
||||||
|
" cpm.device_ledger_id = dl.id " + |
||||||
|
" and dl.device_type in ('5', '6') " + |
||||||
|
"<if test='systemType != null and systemType != \"\"'> " + |
||||||
|
" and cpm.system_type = #{systemType} " + |
||||||
|
"</if>" + |
||||||
|
"<if test='paramType != null and paramType != \"\"'>" + |
||||||
|
" and cpm.param_type = #{paramType} " + |
||||||
|
"</if>" + |
||||||
|
") " + |
||||||
|
"group by " + |
||||||
|
" device_type, " + |
||||||
|
" TO_CHAR(dm.cur_time, " + |
||||||
|
" <choose>" + |
||||||
|
" <when test='len == 4'>'YYYY'</when>" + |
||||||
|
" <when test='len == 7'>'YYYY-MM'</when>" + |
||||||
|
" <when test='len == 10'>'YYYY-MM-DD'</when>" + |
||||||
|
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" + |
||||||
|
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" + |
||||||
|
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" + |
||||||
|
" </choose>" + |
||||||
|
" ) " + |
||||||
|
"union all " + |
||||||
|
"select " + |
||||||
|
" sum(dm.calc_value) as curValue, " + |
||||||
|
" CASE dm.device_type " + |
||||||
|
" WHEN '5' THEN 'meter' " + |
||||||
|
" WHEN '2' THEN 'cloud' " + |
||||||
|
" ELSE 'Unknown' " + |
||||||
|
" END as deviceType," + |
||||||
|
" TO_CHAR(dm.cur_time, " + |
||||||
|
" <choose>" + |
||||||
|
" <when test='len == 4'>'YYYY'</when>" + |
||||||
|
" <when test='len == 7'>'YYYY-MM'</when>" + |
||||||
|
" <when test='len == 10'>'YYYY-MM-DD'</when>" + |
||||||
|
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" + |
||||||
|
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" + |
||||||
|
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" + |
||||||
|
" </choose>" + |
||||||
|
" ) AS timeStr " + |
||||||
|
"from " + |
||||||
|
" ${curTableName} dm " + |
||||||
|
"where " + |
||||||
|
" dm.cur_time >= #{startTime}::timestamp " + |
||||||
|
" AND dm.cur_time <= #{endTime}::timestamp " + |
||||||
|
" and dm.device_num in ( " + |
||||||
|
" select " + |
||||||
|
" cpm.mt_num " + |
||||||
|
" from " + |
||||||
|
" collection_params_manage cpm " + |
||||||
|
" join device_ledger dl " + |
||||||
|
"on " + |
||||||
|
" cpm.device_ledger_id = dl.id " + |
||||||
|
" and dl.device_type in ('5', '6') " + |
||||||
|
"<if test='systemType != null and systemType != \"\"'> " + |
||||||
|
" and cpm.system_type = #{systemType} " + |
||||||
|
"</if>" + |
||||||
|
"<if test='paramType != null and paramType != \"\"'>" + |
||||||
|
" and cpm.param_type = #{paramType} " + |
||||||
|
"</if>" + |
||||||
|
") " + |
||||||
|
"group by " + |
||||||
|
" device_type, " + |
||||||
|
" TO_CHAR(dm.cur_time, " + |
||||||
|
" <choose>" + |
||||||
|
" <when test='len == 4'>'YYYY'</when>" + |
||||||
|
" <when test='len == 7'>'YYYY-MM'</when>" + |
||||||
|
" <when test='len == 10'>'YYYY-MM-DD'</when>" + |
||||||
|
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" + |
||||||
|
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" + |
||||||
|
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" + |
||||||
|
" </choose>" + |
||||||
|
" ) " + |
||||||
|
"</script>") |
||||||
|
List<ConsumptionAnalyze> queryManyTable(@Param("startTime") String startTime, |
||||||
|
@Param("endTime") String endTime, |
||||||
|
@Param("lastTableName") String lastTableName, |
||||||
|
@Param("curTableName") String curTableName, |
||||||
|
@Param("len") String dateLen, |
||||||
|
@Param("paramType") String paramType, |
||||||
|
@Param("haveMeter") boolean haveMeter, |
||||||
|
@Param("haveCloud") boolean haveCloud, |
||||||
|
@Param("systemType") String systemType); |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
package com.mh.system.service.energy; |
||||||
|
|
||||||
|
import com.mh.common.core.domain.AjaxResult; |
||||||
|
import com.mh.common.core.domain.vo.EnergyQueryVO; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LJF |
||||||
|
* @version 1.0 |
||||||
|
* @project EEMCS |
||||||
|
* @description 脱硫脱硝系统能效查询 |
||||||
|
* @date 2026-04-29 15:06:15 |
||||||
|
*/ |
||||||
|
public interface IFdgScrEnergyQueryService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 能源查询 |
||||||
|
* @param page |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
AjaxResult sysQuery(EnergyQueryVO page); |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,198 @@ |
|||||||
|
package com.mh.system.service.energy.impl; |
||||||
|
|
||||||
|
import com.mh.common.core.domain.AjaxResult; |
||||||
|
import com.mh.common.core.domain.entity.ConsumptionAnalyze; |
||||||
|
import com.mh.common.core.domain.vo.EnergyQueryVO; |
||||||
|
import com.mh.common.utils.DateUtils; |
||||||
|
import com.mh.system.mapper.device.CollectionParamsManageMapper; |
||||||
|
import com.mh.system.mapper.energy.FgdScrEnergyQueryMapper; |
||||||
|
import com.mh.system.service.energy.IFdgScrEnergyQueryService; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.*; |
||||||
|
import java.util.concurrent.atomic.AtomicReference; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LJF |
||||||
|
* @version 1.0 |
||||||
|
* @project EEMCS |
||||||
|
* @description 脱硫脱硝能效查询 |
||||||
|
* @date 2026-04-29 15:07:42 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
public class FdgScrEnergyQueryServiceImpl implements IFdgScrEnergyQueryService { |
||||||
|
|
||||||
|
private final CollectionParamsManageMapper collectionParamsManageMapper; |
||||||
|
|
||||||
|
private final FgdScrEnergyQueryMapper fgdScrEnergyQueryMapper; |
||||||
|
|
||||||
|
public FdgScrEnergyQueryServiceImpl(CollectionParamsManageMapper collectionParamsManageMapper, FgdScrEnergyQueryMapper fgdScrEnergyQueryMapper) { |
||||||
|
this.collectionParamsManageMapper = collectionParamsManageMapper; |
||||||
|
this.fgdScrEnergyQueryMapper = fgdScrEnergyQueryMapper; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public AjaxResult sysQuery(EnergyQueryVO vo) { |
||||||
|
DateUtils.sysEnergyDateChange(vo); |
||||||
|
// 获取参数
|
||||||
|
AtomicReference<String> lastTableName = new AtomicReference<>("data_" + vo.getTimeType()); |
||||||
|
AtomicReference<String> curTableName = new AtomicReference<>("data_" + vo.getTimeType()); |
||||||
|
String timeType = vo.getTimeType(); |
||||||
|
// 判断是否有总表
|
||||||
|
boolean haveLoadCell = collectionParamsManageMapper.selectSummary(40, "32") != 0; |
||||||
|
boolean haveSO2 = false; |
||||||
|
if ("min".equals(timeType)) { |
||||||
|
haveSO2 = true; |
||||||
|
} |
||||||
|
List<ConsumptionAnalyze> consumptionAnalyzeEntities = null; |
||||||
|
// 表格数据
|
||||||
|
if ("month".equalsIgnoreCase(timeType) || "year".equalsIgnoreCase(timeType)) { |
||||||
|
// 单表
|
||||||
|
consumptionAnalyzeEntities = fgdScrEnergyQueryMapper.queryOneTable(vo.getStartTime(), |
||||||
|
vo.getEndTime(), |
||||||
|
lastTableName.get(), |
||||||
|
curTableName.get(), |
||||||
|
DateUtils.getTimeLen(vo.getTimeType()), |
||||||
|
null, |
||||||
|
haveLoadCell, |
||||||
|
haveSO2, |
||||||
|
vo.getSystemType()); |
||||||
|
} else { |
||||||
|
lastTableName.set(lastTableName + vo.getStartTime().substring(0, 4)); |
||||||
|
curTableName.set(curTableName + vo.getEndTime().substring(0, 4)); |
||||||
|
if (lastTableName.get().equalsIgnoreCase(curTableName.get())) { |
||||||
|
// 单表
|
||||||
|
consumptionAnalyzeEntities = fgdScrEnergyQueryMapper.queryOneTable(vo.getStartTime(), |
||||||
|
vo.getEndTime(), |
||||||
|
lastTableName.get(), |
||||||
|
curTableName.get(), |
||||||
|
DateUtils.getTimeLen(vo.getTimeType()), |
||||||
|
null, |
||||||
|
haveLoadCell, |
||||||
|
haveSO2, |
||||||
|
vo.getSystemType()); |
||||||
|
} else { |
||||||
|
// 多表
|
||||||
|
consumptionAnalyzeEntities = fgdScrEnergyQueryMapper.queryManyTable(vo.getStartTime(), |
||||||
|
vo.getEndTime(), |
||||||
|
lastTableName.get(), |
||||||
|
curTableName.get(), |
||||||
|
DateUtils.getTimeLen(vo.getTimeType()), |
||||||
|
null, |
||||||
|
haveLoadCell, |
||||||
|
haveSO2, |
||||||
|
vo.getSystemType()); |
||||||
|
} |
||||||
|
} |
||||||
|
if (null == consumptionAnalyzeEntities || consumptionAnalyzeEntities.isEmpty()) { |
||||||
|
return AjaxResult.success(); |
||||||
|
} |
||||||
|
// 分组并按时间排序操作,拿到冷量记和电表数据
|
||||||
|
Map<String, List<ConsumptionAnalyze>> collect = consumptionAnalyzeEntities.stream() |
||||||
|
.parallel() |
||||||
|
.collect(Collectors.groupingBy(ConsumptionAnalyze::getDeviceType, HashMap::new, Collectors |
||||||
|
.collectingAndThen(Collectors.toList(), |
||||||
|
list -> list.stream().sorted(Comparator.comparing(ConsumptionAnalyze::getTimeStr)).collect(Collectors.toList())))); |
||||||
|
List<ConsumptionAnalyze> so1Data = new ArrayList<>(); |
||||||
|
List<ConsumptionAnalyze> so2Data = new ArrayList<>(); |
||||||
|
List<ConsumptionAnalyze> loadCellData = new ArrayList<>(); |
||||||
|
for (Map.Entry<String, List<ConsumptionAnalyze>> nmap : collect.entrySet()) { |
||||||
|
// 获取二氧化硫传感器的值
|
||||||
|
if (haveSO2) { |
||||||
|
if (nmap.getKey().equalsIgnoreCase("so1")) { |
||||||
|
so1Data = nmap.getValue(); |
||||||
|
} |
||||||
|
if (nmap.getKey().equalsIgnoreCase("so2")) { |
||||||
|
so2Data = nmap.getValue(); |
||||||
|
} |
||||||
|
} |
||||||
|
// 获取称重传感器的值
|
||||||
|
if (nmap.getKey().equalsIgnoreCase("loadCell")) { |
||||||
|
loadCellData = nmap.getValue(); |
||||||
|
} |
||||||
|
} |
||||||
|
String[] loadCellDataArr = loadCellData.stream() |
||||||
|
.map(ConsumptionAnalyze::getCurValue) |
||||||
|
.toArray(String[]::new); |
||||||
|
String[] timeStrArr = loadCellData.stream() |
||||||
|
.map(ConsumptionAnalyze::getTimeStr) |
||||||
|
.toArray(String[]::new); |
||||||
|
String[] so1Arr = so1Data.stream() |
||||||
|
.map(ConsumptionAnalyze::getCurValue) |
||||||
|
.toArray(String[]::new); |
||||||
|
String[] so2Arr = so2Data.stream() |
||||||
|
.map(ConsumptionAnalyze::getCurValue) |
||||||
|
.toArray(String[]::new); |
||||||
|
// 表格数据
|
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
int pageNum = vo.getPageNum(); |
||||||
|
int pageSize = vo.getPageSize(); |
||||||
|
if (pageNum == 0) { |
||||||
|
map.put("loadCellDataArr", loadCellDataArr); |
||||||
|
if (haveSO2) { |
||||||
|
map.put("so1Arr", so1Arr); |
||||||
|
map.put("so2Arr", so2Arr); |
||||||
|
} |
||||||
|
map.put("timeStrArr", timeStrArr); |
||||||
|
} else { |
||||||
|
int startIndex = (pageNum - 1) * pageSize; |
||||||
|
int endIndex = Math.min(pageNum * pageSize, loadCellDataArr.length); |
||||||
|
if (startIndex > endIndex) { |
||||||
|
return AjaxResult.success(); |
||||||
|
} |
||||||
|
map.put("loadCellDataArr", Arrays.copyOfRange(loadCellDataArr, startIndex, endIndex)); |
||||||
|
if (haveSO2) { |
||||||
|
map.put("so1Arr", Arrays.copyOfRange(so1Arr, startIndex, endIndex)); |
||||||
|
map.put("so2Arr", Arrays.copyOfRange(so2Arr, startIndex, endIndex)); |
||||||
|
} |
||||||
|
map.put("timeStrArr", Arrays.copyOfRange(timeStrArr, startIndex, endIndex)); |
||||||
|
} |
||||||
|
map.put("total", timeStrArr.length); |
||||||
|
|
||||||
|
// 组装赋值
|
||||||
|
List<Map<String, Object>> listData = new ArrayList<>(); |
||||||
|
if (haveSO2) { |
||||||
|
Map<String, Object> so1 = new HashMap<>(); |
||||||
|
so1.put("so1", map.get("so1Arr")); |
||||||
|
listData.add(so1); |
||||||
|
Map<String, Object> so2 = new HashMap<>(); |
||||||
|
so2.put("so2", map.get("so2Arr")); |
||||||
|
listData.add(so2); |
||||||
|
} |
||||||
|
Map<String, Object> loadCell = new HashMap<>(); |
||||||
|
loadCell.put("loadCell", map.get("loadCellDataArr")); |
||||||
|
listData.add(loadCell); |
||||||
|
String[] titleArr = new String[]{"loadCell"}; |
||||||
|
if (haveSO2) { |
||||||
|
titleArr = new String[]{"so1", "so2", "loadCell"}; |
||||||
|
} |
||||||
|
Map<String, Object> titles = new HashMap<>(); |
||||||
|
titles.put("titleArr", titleArr); |
||||||
|
listData.add(titles); |
||||||
|
Map<String, Object> timeStr = new HashMap<>(); |
||||||
|
timeStr.put("timeStrArr", map.get("timeStrArr")); |
||||||
|
listData.add(timeStr); |
||||||
|
Map<String, Object> total = new HashMap<>(); |
||||||
|
total.put("total", map.get("total")); |
||||||
|
listData.add(total); |
||||||
|
return AjaxResult.success(listData); |
||||||
|
} |
||||||
|
|
||||||
|
private static String[] getArr(List<ConsumptionAnalyze> copLineData, String[] lineTimeStrArr) { |
||||||
|
String[] lineCopArr = new String[lineTimeStrArr.length]; |
||||||
|
for (int i = 0; i < lineTimeStrArr.length; i++) { |
||||||
|
int j = i; |
||||||
|
Optional<ConsumptionAnalyze> first = copLineData.stream().filter(s -> lineTimeStrArr[j].equalsIgnoreCase(s.getTimeStr())).findFirst(); |
||||||
|
if (first.isPresent()) { |
||||||
|
lineCopArr[i] = first.get().getCurValue(); |
||||||
|
} else { |
||||||
|
lineCopArr[i] = "0.00"; |
||||||
|
} |
||||||
|
} |
||||||
|
return lineCopArr; |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue