Browse Source

#演示平台接口、30天发电量修改

zhongwei
yang_shj 9 months ago
parent
commit
54f4184f2b
  1. 19
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/StationNumberVo.java
  2. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java
  3. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java
  4. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java

19
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/StationNumberVo.java

@ -0,0 +1,19 @@
package com.hnac.hzims.operational.data.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "水利站点首页对象")
public class StationNumberVo {
@ApiModelProperty(value = "站点类型")
private Integer type;
@ApiModelProperty(value = "站点数量")
private Integer count;
}

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java

@ -35,11 +35,11 @@ public class HzimsDataController {
}
@ApiLog
@GetMapping("/saveStation")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "获取站点统计数据", notes = "无需传入参数")
public R saveStation() {
return R.data(service.saveStation());
@GetMapping("/stationNumber")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "站点数量", notes = "无需传入参数")
public R stationNumber() {
return R.data(service.stationNumber());
}
@ApiLog

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java

@ -1,12 +1,14 @@
package com.hnac.hzims.operational.data.service;
import com.hnac.hzims.operational.data.vo.PowerConvertVo;
import com.hnac.hzims.operational.data.vo.StationNumberVo;
import com.hnac.hzims.operational.data.vo.WeatherWaterVo;
import com.hnac.hzims.operational.main.vo.HydropowerStationVo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @author ysj
@ -19,7 +21,7 @@ public interface HzimsDataService {
*/
boolean saveArea();
boolean saveStation();
List<StationNumberVo> stationNumber();
HydropowerStationVo station(String stationCode);

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java

@ -20,7 +20,6 @@ import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IHzimsAnalyzeModelStationService;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.HzimsStationCountVo;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import lombok.RequiredArgsConstructor;
@ -88,8 +87,11 @@ public class HzimsDataServiceImpl implements HzimsDataService {
@Value("${hzims.operation.save.station.url}")
public String STATION_URL;
private final static String charge = "hzims:operation:key:charge";
private final static String conver_power_key = "hzims:operation:conver:power:";
private final static String conver_weather_key = "hzims:operation:conver:weather:";
private final static String recent_year_power_data = "hzims:operation:key:power:data";
@ -136,17 +138,33 @@ public class HzimsDataServiceImpl implements HzimsDataService {
return this.sendMessage(JSONObject.toJSONBytes(list),AREA_URL);
}
/**
* 获取站点统计数据
* 站点数量统计
* @return
*/
@Override
public boolean saveStation() {
List<HzimsStationCountVo> list = this.stationService.getStationCount();
if(CollectionUtil.isEmpty(list)){
return false;
public List<StationNumberVo> stationNumber() {
List<StationNumberVo> numbers = new ArrayList<>();
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery().
in(StationEntity::getType,Arrays.asList(0,1,5,8))
);
if(!CollectionUtil.isEmpty(stations)){
stations.stream().collect(Collectors.groupingBy(StationEntity::getType)).forEach((key, value) -> {
StationNumberVo number = new StationNumberVo();
number.setType(key);
number.setCount(value.size());
numbers.add(number);
});
}
TargetVo target = (TargetVo) redisTemplate.opsForValue().get(charge);
if(!ObjectUtil.isEmpty(target)){
StationNumberVo number = new StationNumberVo();
number.setType(7);
number.setCount(target.getCharge());
numbers.add(number);
}
return this.sendMessage(JSONObject.toJSONBytes(list),STATION_URL);
return numbers;
}

Loading…
Cancel
Save