Browse Source

去掉不用得接口

zhongwei
ty 5 months ago
parent
commit
b130f30b45
  1. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java
  2. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java
  3. 39
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java

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

@ -26,13 +26,7 @@ public class HzimsDataController {
private final HzimsDataService service;
@GetMapping("/saveArea")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "获取区域列表数据", notes = "无需传入参数")
public R saveArea() {
return R.data(service.saveArea());
}
@GetMapping("/stationNumber")
@ -42,7 +36,7 @@ public class HzimsDataController {
return R.data(service.stationNumber());
}
@GetMapping("/station")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "站点数据获取", notes = "传入站点code")

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

@ -15,11 +15,6 @@ import java.util.List;
*/
public interface HzimsDataService {
/**
* 获取区域列表数据
* @return
*/
boolean saveArea();
List<StationNumberVo> stationNumber();

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

@ -85,10 +85,7 @@ public class HzimsDataServiceImpl implements HzimsDataService {
private final RedisTemplate redisTemplate;
@Value("${hzims.operation.save.area.url}")
public String AREA_URL;
@Value("${hzims.operation.save.station.url}")
public String STATION_URL;
private final static String charge = "hzims:operation:key:charge";
@ -105,41 +102,7 @@ public class HzimsDataServiceImpl implements HzimsDataService {
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key";
@Override
public boolean saveArea() {
R<List<Dept>> result = sysClient.getDeptList();
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
throw new ServiceException("暂无区域数据!");
}
List<Integer> types = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.PUMPING, HomePageConstant.GATE);
Map<Dept, List<StationEntity>> map = areaService.getAuthArea(result.getData(), null, types, HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (MapUtils.isEmpty(map)) {
throw new ServiceException("暂无区域数据!");
}
List<EminfoAndEmParamVo> deviceList = emService.getEmInfoList();
// 获取区域列表数据
List<AreaVo> list = map.entrySet().stream().map(entry->{
AreaVo vo = new AreaVo();
vo.setDeptId(entry.getKey().getId());
vo.setDeptName(entry.getKey().getDeptName());
int hydropowerCount = (int) entry.getValue().stream().filter(o->HomePageConstant.HYDROPOWER.equals(o.getType())).count();
vo.setHydropowerStationCount(hydropowerCount);
int waterCount = entry.getValue().size() - hydropowerCount;
vo.setWaterStationCount(waterCount);
List<Long> value = entry.getValue().stream().filter(o->HomePageConstant.HYDROPOWER.equals(o.getType())).map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtil.isEmpty(value)){
vo.setInstalledCapacity(0.0);
}else{
double installedCapacity = deviceList.stream().filter(o-> null != o.getInstalledCapacity() && value.contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum();
vo.setInstalledCapacity(installedCapacity);
}
return vo;
}).collect(Collectors.toList());
// 调用Http请求
return this.sendMessage(JSONObject.toJSONBytes(list),AREA_URL);
}
/**

Loading…
Cancel
Save