Commit de78db6b authored by 朱晨阳's avatar 朱晨阳

修改逆变器报表查询数据错误

parent fc27a9b4
......@@ -26,6 +26,9 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
......@@ -94,7 +97,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
return this.getBaseMapper().selectPageDataTotal(jpInverterDto);
}
public Map<String,Object> selectDayTrend(List<JSONObject>treeParams, String time, String time2, String snCode, String thirdStationId) {
public Map<String,Object> selectDayTrend(List<JSONObject>treeParams, String time, String time2, String snCode, String thirdStationId) {
List<String> key = new ArrayList<>();
treeParams.forEach(a->{
if (a.get("key").toString().startsWith("acc")||a.get("key").toString().startsWith("acv")||a.get("key").toString().startsWith("pv")){
......@@ -103,40 +106,49 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
key.add(a.get("key").toString());
}
});
List<Map<String,Object>> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectDayTrend(key, time,time2, snCode, thirdStationId);
List<Map<String,Object>> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectDayTrend(key, time,time2, snCode, thirdStationId);
List<String> zData = new ArrayList<>();
tdHYGFInverterDayGenerates.forEach(e-> {
if(e.get("workstatus") != null) {
zData.add(e.get("workstatus").toString());
}
} );
Set<String> xData = new TreeSet<>();
for (JSONObject treeParam : treeParams) {
List<String> value = new ArrayList<>();
for (Map<String, Object> obj : tdHYGFInverterDayGenerates) {
xData.add(obj.get("time").toString().substring(0,obj.get("time").toString().length()-4));
Set<String> xData = new TreeSet<>();
for (JSONObject treeParam : treeParams) {
List<String> value = new ArrayList<>();
for (Map<String, Object> obj : tdHYGFInverterDayGenerates) {
xData.add(obj.get("time").toString().substring(0,obj.get("time").toString().length()-4));
String key1 = treeParam.get("key").toString();
if (treeParam.get("key").toString().startsWith("acc")||treeParam.get("key").toString().startsWith("acv")||treeParam.get("key").toString().startsWith("pv")){
key1 =treeParam.get("key").toString().replace("_","");
} value.add(obj.get(key1).toString());
}
treeParam.put("data",value);
}
Map<String,Object> map = new HashMap<>();
map.put("xData",xData);
map.put("yData",treeParams);
map.put("zData",zData);
return map;
}
@UserLimits
public Page<TdHYGFInverterDayGenerate> jpInverterDayReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
}
value.add(obj.get(key1).toString());
}
treeParam.put("data",value);
}
Map<String,Object> map = new HashMap<>();
map.put("xData",xData);
map.put("yData",treeParams);
map.put("zData",zData);
return map;
}
@UserLimits
public Page<TdHYGFInverterDayGenerate> jpInverterDayReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
Page<TdHYGFInverterDayGenerate> tdHYGFInverterDayGeneratePage = new Page<>();
Date date = DateUtil.parse(time, "yyyy-MM-dd");
Date timeStart = DateUtils.dateAddHours(date, -8);
Date tiemEnd = DateUtils.dateAddHours(date, 16);
String startTime = DateUtil.format(timeStart, "yyyy-MM-dd HH:mm:ss");
String endTime = DateUtil.format(tiemEnd, "yyyy-MM-dd HH:mm:ss");
// Date date = DateUtil.parse(time, "yyyy-MM-dd");
// Date timeStart = DateUtils.dateAddHours(date, -8);
// Date tiemEnd = DateUtils.dateAddHours(date, 16);
// String startTime = DateUtil.format(timeStart, "yyyy-MM-dd HH:mm:ss");
// String endTime = DateUtil.format(tiemEnd, "yyyy-MM-dd HH:mm:ss");
CharSequence time1 = time + " 00:00:00";
CharSequence time2 = time + " 23:59:59";
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String startTime = DateUtil.format(LocalDateTime.parse(time1,df), "yyyy-MM-dd HH:mm:ss");
String endTime = DateUtil.format(LocalDateTime.parse(time2,df), "yyyy-MM-dd HH:mm:ss");
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>()
.ge("created_time", startTime)
.le("created_time", endTime);
......
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