Commit 21bcda80 authored by chenzhao's avatar chenzhao

修改代码

parent d9577110
...@@ -976,7 +976,6 @@ public class MonitorFanIdxController extends BaseController { ...@@ -976,7 +976,6 @@ public class MonitorFanIdxController extends BaseController {
DecimalFormat format2 = new DecimalFormat("#.0000"); DecimalFormat format2 = new DecimalFormat("#.0000");
Double num = 0.00; Double num = 0.00;
if (map.containsKey("gateWayId")&&map.get("gateWayId").size() > 0){
for (Terms.Bucket bucket : lidate) { for (Terms.Bucket bucket : lidate) {
Aggregations aggregation= bucket.getAggregations(); Aggregations aggregation= bucket.getAggregations();
List<Aggregation> listdata= Objects.nonNull(aggregation)?aggregation.asList():null; List<Aggregation> listdata= Objects.nonNull(aggregation)?aggregation.asList():null;
...@@ -985,7 +984,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -985,7 +984,7 @@ public class MonitorFanIdxController extends BaseController {
num = Double.valueOf(format2.format(parsedSum.getValue())); num = Double.valueOf(format2.format(parsedSum.getValue()));
} }
} }
}
return ResponseHelper.buildResponse(commonServiceImpl.getSocialContributionDtoList(num)); return ResponseHelper.buildResponse(commonServiceImpl.getSocialContributionDtoList(num));
} }
...@@ -1160,7 +1159,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -1160,7 +1159,7 @@ public class MonitorFanIdxController extends BaseController {
map.put("total",list.size()); map.put("total",list.size());
map.put("num",sum); map.put("num",sum);
try { try {
emqKeeper.getMqttClient().publish("/accessSituation/topic/"+"s",JSON.toJSONString(map).getBytes(),0,false); emqKeeper.getMqttClient().publish("/accessSituation/topic/"+s,JSON.toJSONString(map).getBytes(),0,false);
} catch (MqttException e) { } catch (MqttException e) {
} }
......
...@@ -11,7 +11,7 @@ import java.util.Map; ...@@ -11,7 +11,7 @@ import java.util.Map;
public interface TemporaryDataMapper extends BaseMapper<TemporaryData> { public interface TemporaryDataMapper extends BaseMapper<TemporaryData> {
List<Map<String, String>> timingTemporarysSorageData (@RequestParam(value ="gatewayId" ) String gatewayId); List<Map<String, Object>> timingTemporarysSorageData (@RequestParam(value ="gatewayId" ) String gatewayId);
Map<String, Object> getStatisticsInfo (@RequestParam(value ="gatewayId" ) String gatewayId, Map<String, Object> getStatisticsInfo (@RequestParam(value ="gatewayId" ) String gatewayId,
......
...@@ -526,21 +526,40 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -526,21 +526,40 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public Map<String,Object> getDetailsWindSpeedAll(String gatewayId){ public Map<String,Object> getDetailsWindSpeedAll(String gatewayId){
List<Map<String, String>> list = temporaryDataMapper.timingTemporarysSorageData(gatewayId); List<Map<String, Object>> list = temporaryDataMapper.timingTemporarysSorageData(gatewayId);
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
List<String> values = new ArrayList<>(); List<String> values = new ArrayList<>();
List<String> valueList = new ArrayList<>(); List<String> valueList = new ArrayList<>();
Set<String> time = new TreeSet<>(); Set<String> time = new TreeSet<>();
String v = list.get(0).get("value").toString();
for (Map<String, String> stringStringMap : list) { double min = Double.parseDouble(v);
double max = Double.parseDouble(v);
double mean = 0.0;
String minTime =list.get(0).get("createdTime").toString();
String maxTime =list.get(0).get("createdTime").toString();
for (Map<String, Object> stringStringMap : list) {
if (stringStringMap.get("equipmentIndexName").equals("有功功率")){ if (stringStringMap.get("equipmentIndexName").equals("有功功率")){
values.add(stringStringMap.get("value")); double value = Double.parseDouble(stringStringMap.get("value").toString());
values.add( String.format("%.2f",value));
if (value < min){
min = value;
minTime = stringStringMap.get("createdTime").toString();
}else if (value > max){
max = value;
maxTime = stringStringMap.get("createdTime").toString();
}
time.add(stringStringMap.get("createdTime").toString());
}else { }else {
valueList.add(stringStringMap.get("value")); valueList.add(stringStringMap.get("value").toString());
time.add(stringStringMap.get("createdTime"));
} }
} }
for (String value : values) {
mean += Double.parseDouble(value);
}
mean = Double.parseDouble(String.format("%.2f",mean/values.size()));
List<Map<String,Object>> seriesData = new ArrayList<>(); List<Map<String,Object>> seriesData = new ArrayList<>();
Map<String,Object> map3 = new HashMap<>(); Map<String,Object> map3 = new HashMap<>();
Map<String,Object> map1 = new HashMap<>(); Map<String,Object> map1 = new HashMap<>();
...@@ -553,6 +572,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -553,6 +572,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
seriesData.add(map1); seriesData.add(map1);
map.put("seriesData", seriesData); map.put("seriesData", seriesData);
map.put("axisData",time); map.put("axisData",time);
map.put("mean",mean);
map.put("max",max);
map.put("min",min);
map.put("maxTime",maxTime);
map.put("minTime",minTime);
return map; return map;
} }
...@@ -630,12 +654,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -630,12 +654,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete,false); wrapper.eq(BaseEntity::getIsDelete,false);
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper); List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
long timeInMillis = new Date().getTime();
for (StationBasic stationBasic : stationBasics) { for (StationBasic stationBasic : stationBasics) {
if (stationBasic.getStationType().equals("FDZ")){ if (stationBasic.getStationType().equals("FDZ")){
timingTemporarysSorageData(stationBasic.getFanGatewayId()); timingTemporarysSorageData(stationBasic.getFanGatewayId(),timeInMillis);
} }
if (stationBasic.getStationType().equals("JZSGFDZ")){ if (stationBasic.getStationType().equals("JZSGFDZ")){
schedSolarPower(stationBasic.getBoosterGatewayId()); schedSolarPower(stationBasic.getBoosterGatewayId(),timeInMillis);
} }
} }
} }
...@@ -723,7 +748,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -723,7 +748,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public void timingTemporarysSorageData(String gatewayId){ public void timingTemporarysSorageData(String gatewayId,long timeInMillis){
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName = '瞬时风速' "; String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName = '瞬时风速' ";
String sql1 = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName = '有功功率'"; String sql1 = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName = '有功功率'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql,IndicatorsDto.class); List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql,IndicatorsDto.class);
...@@ -736,7 +761,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -736,7 +761,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
long timeInMillis = new Date().getTime(); // long timeInMillis = new Date().getTime();
for (IndicatorsDto indicatorsDto : indicatorsDtoList) { for (IndicatorsDto indicatorsDto : indicatorsDtoList) {
try { try {
TemporaryData temporaryData = new TemporaryData(); TemporaryData temporaryData = new TemporaryData();
...@@ -769,7 +794,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -769,7 +794,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryDataService.saveBatch(temporaryDatass); temporaryDataService.saveBatch(temporaryDatass);
} }
public void schedSolarPower(String gatewayId){ public void schedSolarPower(String gatewayId,long timeInMillis){
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE displayName = '总辐射累计' "; String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE displayName = '总辐射累计' ";
String sql1 = "SELECT * FROM indicators_"+gatewayId+" WHERE displayName = '有功功率'"; String sql1 = "SELECT * FROM indicators_"+gatewayId+" WHERE displayName = '有功功率'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql,IndicatorsDto.class); List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql,IndicatorsDto.class);
...@@ -782,7 +807,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -782,7 +807,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
long timeInMillis = new Date().getTime(); // long timeInMillis = new Date().getTime();
for (IndicatorsDto indicatorsDto : indicatorsDtoList) { for (IndicatorsDto indicatorsDto : indicatorsDtoList) {
try { try {
TemporaryData temporaryData = new TemporaryData(); TemporaryData temporaryData = new TemporaryData();
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
<select id="timingTemporarysSorageData" resultType="map"> <select id="timingTemporarysSorageData" resultType="map">
SELECT avg(value) as value , SELECT
avg(value) as value ,
created_time as createdTime , created_time as createdTime ,
equipmentIndexName equipmentIndexName
FROM FROM
...@@ -17,8 +18,9 @@ ...@@ -17,8 +18,9 @@
<if test="gatewayId == null or gatewayId == ''"> <if test="gatewayId == null or gatewayId == ''">
equipmentNumber is not null and equipmentIndexName is not null equipmentNumber is not null and equipmentIndexName is not null
</if> </if>
AND equipmentIndexName='有功功率'
</where> </where>
GROUP BY batch_no ,equipmentIndexName; GROUP BY created_time ,equipmentIndexName;
</select> </select>
......
...@@ -644,12 +644,14 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -644,12 +644,14 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete, false); wrapper.eq(BaseEntity::getIsDelete, false);
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper); List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
long timeInMillis = new Date().getTime();
for (StationBasic stationBasic : stationBasics) { for (StationBasic stationBasic : stationBasics) {
if (stationBasic.getStationType().equals("FDZ")) { if (stationBasic.getStationType().equals("FDZ")) {
timingTemporarysSorageData(stationBasic.getFanGatewayId()); timingTemporarysSorageData(stationBasic.getFanGatewayId(),timeInMillis);
} }
if (stationBasic.getStationType().equals("JZSGFDZ")) { if (stationBasic.getStationType().equals("JZSGFDZ")) {
schedSolarPower(stationBasic.getBoosterGatewayId()); schedSolarPower(stationBasic.getBoosterGatewayId(),timeInMillis);
} }
} }
} }
...@@ -734,7 +736,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -734,7 +736,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} }
public void timingTemporarysSorageData(String gatewayId) { public void timingTemporarysSorageData(String gatewayId, long timeInMillis) {
String sql = "SELECT * FROM indicators_" + gatewayId + " WHERE equipmentIndexName = '瞬时风速' "; String sql = "SELECT * FROM indicators_" + gatewayId + " WHERE equipmentIndexName = '瞬时风速' ";
String sql1 = "SELECT * FROM indicators_" + gatewayId + " WHERE equipmentIndexName = '有功功率'"; String sql1 = "SELECT * FROM indicators_" + gatewayId + " WHERE equipmentIndexName = '有功功率'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql, IndicatorsDto.class); List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql, IndicatorsDto.class);
...@@ -747,7 +749,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -747,7 +749,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
long timeInMillis = new Date().getTime(); // long timeInMillis = new Date().getTime();
for (IndicatorsDto indicatorsDto : indicatorsDtoList) { for (IndicatorsDto indicatorsDto : indicatorsDtoList) {
try { try {
TemporaryData temporaryData = new TemporaryData(); TemporaryData temporaryData = new TemporaryData();
...@@ -780,7 +782,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -780,7 +782,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryDataService.saveBatch(temporaryDatass); temporaryDataService.saveBatch(temporaryDatass);
} }
public void schedSolarPower(String gatewayId) { public void schedSolarPower(String gatewayId,long timeInMillis) {
String sql = "SELECT * FROM indicators_" + gatewayId + " WHERE displayName = '总辐射累计' "; String sql = "SELECT * FROM indicators_" + gatewayId + " WHERE displayName = '总辐射累计' ";
String sql1 = "SELECT * FROM indicators_" + gatewayId + " WHERE displayName = '有功功率'"; String sql1 = "SELECT * FROM indicators_" + gatewayId + " WHERE displayName = '有功功率'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql, IndicatorsDto.class); List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql, IndicatorsDto.class);
...@@ -793,7 +795,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -793,7 +795,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
long timeInMillis = new Date().getTime(); // long timeInMillis = new Date().getTime();
for (IndicatorsDto indicatorsDto : indicatorsDtoList) { for (IndicatorsDto indicatorsDto : indicatorsDtoList) {
try { try {
TemporaryData temporaryData = new TemporaryData(); TemporaryData temporaryData = new TemporaryData();
......
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