Browse Source

#定时任务抽离

zhongwei
yang_shj 1 year ago
parent
commit
c58e669590
  1. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java
  2. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java
  3. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java
  4. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java
  5. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java
  6. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java
  7. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java
  8. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java

@ -26,4 +26,6 @@ public class EcologyFlowStationEntity extends TenantEntity {
private Long isTimely;
private Long isComplete;
private String city;
}

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java

@ -28,4 +28,7 @@ public class AppHydropowerDeviceVo {
@ApiModelProperty(value = "负荷单位")
private String loadUnit;
@ApiModelProperty(value = "排序")
private Integer ord;
}

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java

@ -61,4 +61,7 @@ public class HydropowerUnitRealVo {
@ApiModelProperty(value = "电流单位")
private String currentUnit;
@ApiModelProperty(value = "排序")
private Integer ord;
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java

@ -54,8 +54,8 @@ public class EcologyController extends BladeController {
@PostMapping("/station_top")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "站点数据及达标率排行", notes = "站点数据及达标率排行")
public R station_top() {
return R.data(stationService.station_top());
public R station_top(@RequestParam String city) {
return R.data(stationService.station_top(city));
}
/**
@ -65,8 +65,8 @@ public class EcologyController extends BladeController {
@PostMapping("/trend_chart")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "指标趋势图", notes = "指标趋势图")
public R trend_chart(@RequestParam String type) {
return R.data(stationService.trend_chart(type));
public R trend_chart(@RequestParam String city,@RequestParam String type) {
return R.data(stationService.trend_chart(city,type));
}

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java

@ -14,12 +14,12 @@ import java.util.List;
*/
public interface EcologyFlowStationService extends BaseService<EcologyFlowStationEntity> {
EcologFlowStationVo station_top();
EcologFlowStationVo station_top(String city);
Boolean generate(Long mon,String year);
List<TrendChartVo> trend_chart(String type);
List<TrendChartVo> trend_chart(String city,String type);
List<StationVo> station();
}

20
hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java

@ -98,8 +98,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
* @return
*/
@Override
public EcologFlowStationVo station_top() {
List<EcologyFlowStationEntity> stations = this.list();
public EcologFlowStationVo station_top(String city) {
List<EcologyFlowStationEntity> stations = this.list(Wrappers.<EcologyFlowStationEntity>lambdaQuery()
.eq(EcologyFlowStationEntity::getCity,city));
if(CollectionUtil.isEmpty(stations)){
return new EcologFlowStationVo();
}
@ -110,8 +111,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
station.setTimely(BigDecimal.valueOf((int) stations.stream().filter(o -> o.getIsTimely().equals(1L)).count() / (double) stations.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
station.setCount(stations.size());
List<EcologyFlowDataEntity> datas = dataService.list(Wrappers.<EcologyFlowDataEntity>lambdaQuery().
like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy-MM")));
List<EcologyFlowDataEntity> datas = dataService.list(Wrappers.<EcologyFlowDataEntity>lambdaQuery()
.like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy-MM"))
.in(EcologyFlowDataEntity::getStationId,stations.stream().map(EcologyFlowStationEntity::getStationId).collect(Collectors.toList())));
if(CollectionUtil.isEmpty(datas)){
return station;
}
@ -132,8 +134,14 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
* @return
*/
@Override
public List<TrendChartVo> trend_chart(String type) {
public List<TrendChartVo> trend_chart(String city,String type) {
List<EcologyFlowStationEntity> stations = this.list(Wrappers.<EcologyFlowStationEntity>lambdaQuery()
.eq(EcologyFlowStationEntity::getCity,city));
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
}
LambdaQueryWrapper<EcologyFlowDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.in(EcologyFlowDataEntity::getStationId,stations.stream().map(EcologyFlowStationEntity::getStationId).collect(Collectors.toList()));
if("0".equals(type)){
wrapper.like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy"));
}
@ -179,7 +187,7 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
@Override
public List<StationVo> station() {
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.in(StationEntity::getCode,Arrays.asList("902400000054","902400052664")));
.in(StationEntity::getCode,Arrays.asList("902400000054","902400052664","902400056791")));
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
}

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java

@ -278,12 +278,9 @@ public class ScheduledCreateTask {
/**
* 水电站-机组实时加载
* @return ReturnT<String>
*/
//@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerUnitReal() throws Exception {
String param = "";
@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
public ReturnT<String> loadHydropowerReal(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -153,6 +153,7 @@ public class HydropowerServiceImpl implements HydropowerService {
HydropowerUnitRealVo real = new HydropowerUnitRealVo();
real.setDeptId(device.getCreateDept());
real.setDeviceCode(device.getEmCode());
real.setOrd(device.getOrd());
real.setDeptName(device.getName());
real.setDeviceName(device.getName());
// 装机容量
@ -1548,12 +1549,13 @@ public class HydropowerServiceImpl implements HydropowerService {
AppHydropowerDeviceVo device = new AppHydropowerDeviceVo();
device.setDeviceCode(real.getDeviceCode());
device.setDeviceName(real.getDeviceName());
device.setOrd(real.getOrd());
device.setState(real.getState());
device.setLoadUnit(Optional.ofNullable(real.getPowerUnit()).orElse("kW"));
device.setCapacity(real.getInstalledCapacity());
device.setLoad(real.getActivePower());
return device;
}).collect(Collectors.toList()));
}).sorted(Comparator.comparing(AppHydropowerDeviceVo::getOrd)).collect(Collectors.toList()));
hydropower.setLoadUnit(hydropower.getDevices().get(0).getLoadUnit());
}
return hydropower;

Loading…
Cancel
Save