Browse Source

#水电站运行月报

zhongwei
yang_shj 6 months ago
parent
commit
2f0e8716db
  1. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  2. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  3. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java
  4. 13
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/mapper/RunMonReportMapper.java
  5. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthReportService.java
  6. 19
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonReportServiceImpl.java
  7. 28
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java

2
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -175,5 +175,5 @@ public interface IEmInfoClient {
R<List<EmInfoEntity>> emInfoList(EmInfoEntity req);
@GetMapping(RIDE_DEVICES)
List<RideDeviceVo> rideDevices(List<Long> longs);
List<RideDeviceVo> rideDevices(@RequestParam("deptIds") List<Long> deptIds);
}

3
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -157,7 +157,8 @@ public class EmInfoClient implements IEmInfoClient {
}
@Override
public List<RideDeviceVo> rideDevices(List<Long> deptIds) {
@GetMapping(RIDE_DEVICES)
public List<RideDeviceVo> rideDevices(@RequestParam("deptIds") List<Long> deptIds) {
return service.rideDevices(deptIds);
}

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java

@ -19,5 +19,5 @@ public interface EmParamMapper extends UserDataScopeBaseMapper<EmParamEntity> {
List<EmParamEntity> selectRideCountGroupEmIdByDepts(@Param("list") List<Long> list);
List<EmParamEntity> rides(List<Long> deviceIds);
List<EmParamEntity> rides(@Param("deviceIds") List<Long> deviceIds);
}

13
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/mapper/RunMonReportMapper.java

@ -0,0 +1,13 @@
package com.hnac.hzims.operational.report.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.operational.report.entity.RunMonthEntity;
/**
* @author ysj
* @date 2023/04/10 11:22:14
* @version 4.0.0
*/
public interface RunMonReportMapper extends BaseMapper<RunMonthEntity> {
}

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthReportService.java

@ -0,0 +1,11 @@
package com.hnac.hzims.operational.report.service;
import com.hnac.hzims.operational.report.entity.RunMonthEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface RunMonthReportService extends BaseService<RunMonthEntity> {
}

19
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonReportServiceImpl.java

@ -0,0 +1,19 @@
package com.hnac.hzims.operational.report.service.impl;
import com.hnac.hzims.operational.report.entity.RunMonthEntity;
import com.hnac.hzims.operational.report.mapper.RunMonReportMapper;
import com.hnac.hzims.operational.report.service.RunMonthReportService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class RunMonReportServiceImpl extends BaseServiceImpl<RunMonReportMapper, RunMonthEntity> implements RunMonthReportService {
}

28
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java

@ -15,6 +15,7 @@ import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.IAnalyseDataService;
import com.hnac.hzims.operational.report.entity.RunMonthEntity;
import com.hnac.hzims.operational.report.mapper.RunMonthMapper;
import com.hnac.hzims.operational.report.service.RunMonthReportService;
import com.hnac.hzims.operational.report.service.RunMonthService;
import com.hnac.hzims.operational.report.vo.*;
import com.hnac.hzims.operational.station.entity.StationEntity;
@ -75,6 +76,8 @@ public class RunMonthServiceImpl extends BaseServiceImpl<RunMonthMapper, RunMont
private final IAnalyseDataService dataService;
private final RunMonthReportService runMonthReportService;
private final ISoeClient soeClient;
private final IEmInfoClient deivceClient;
@ -196,7 +199,7 @@ public class RunMonthServiceImpl extends BaseServiceImpl<RunMonthMapper, RunMont
run.setStationCode(station.getCode());
run.setStationName(station.getName());
Calendar calendar = Calendar.getInstance();
calendar.setTime(org.springblade.core.tool.utils.DateUtil.parse("2024-05-01 00:00:00", org.springblade.core.tool.utils.DateUtil.PATTERN_DATETIME));
calendar.setTime(DateUtil.parse("2024-05-01 00:00:00", org.springblade.core.tool.utils.DateUtil.PATTERN_DATETIME));
calendar.add(Calendar.DAY_OF_MONTH,-1);
run.setMonth(DateUtil.format(calendar.getTime(),"yyyy-MM"));
List<RideDeviceVo> stationDevices = devices.stream().filter(device->device.getDepartment().equals(station.getRefDept())).collect(Collectors.toList());
@ -208,9 +211,26 @@ public class RunMonthServiceImpl extends BaseServiceImpl<RunMonthMapper, RunMont
run.setCurveData(this.curveData(stationDevices));
// TODO 运行数据分析
// TODO 运行建议及其他
// TODO 保存生成月报数据
// runMonService.save(run);
return true;
// 先删除原先月报数据
this.deleteRunReport(mon,stationCode);
// 保存生成月报数据
return runMonthReportService.save(run);
}
/**
* 先删除原先月报数据
* @param mon
* @param stationCode
*/
private void deleteRunReport(String mon, String stationCode) {
List<RunMonthEntity> runs = runMonthReportService.list(Wrappers.<RunMonthEntity>lambdaQuery()
.eq(RunMonthEntity::getMonth,mon)
.eq(RunMonthEntity::getStationCode,stationCode)
);
if(CollectionUtil.isEmpty(runs)){
return;
}
this.runMonthReportService.deleteLogic(runs.stream().map(RunMonthEntity::getId).collect(Collectors.toList()));
}
/**

Loading…
Cancel
Save