谐波畸变率任务配置
This commit is contained in:
@@ -16,7 +16,7 @@ public class DeviceAbnormalStatisticsJob {
|
||||
private final DeviceAbnormalFeignClient deviceAbnormalFeignClient;
|
||||
|
||||
@XxlJob("deviceAbnormalStatisticsJob")
|
||||
public void deviceAbnormalStatisticsJob (){
|
||||
public void deviceAbnormalStatisticsJob () {
|
||||
String time = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
log.info("执行日期deviceAbnormalStatisticsJob===============>"+time);
|
||||
DeviceAbnormaStatisticsParam param =new DeviceAbnormaStatisticsParam();
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.executor.handler;
|
||||
|
||||
import com.njcn.prepare.harmonic.api.line.DistortionRateFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class DistortionRateJob {
|
||||
private final DistortionRateFeignClient distortionRateFeignClient;
|
||||
|
||||
@XxlJob("DistortionRateJob")
|
||||
public void DistortionRateJob () {
|
||||
log.info("===================DistortionRateJob Start===================");
|
||||
LineParam lineParam = new LineParam();
|
||||
lineParam.setDataDate(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
log.info(lineParam.toString());
|
||||
distortionRateFeignClient.distortionRate(lineParam);
|
||||
log.info("===================DistortionRateJob End===================");
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
@FeignClient(
|
||||
value = ServerInfo.PREPARE_BOOT,
|
||||
path = "/distortion",
|
||||
fallbackFactory = DistortionRateFeignClientFallbackFactory.class
|
||||
)
|
||||
fallbackFactory = DistortionRateFeignClientFallbackFactory.class)
|
||||
public interface DistortionRateFeignClient {
|
||||
|
||||
@PostMapping("/distortionRate")
|
||||
|
||||
@@ -22,15 +22,12 @@ public class LineParam {
|
||||
private Integer lineType;
|
||||
|
||||
@ApiModelProperty(name = "type",value = "时间类型(1年,2季,3月,4周,5日)")
|
||||
@NotNull(message = "时间类型不可为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(name = "dataDate",value = "时间")
|
||||
@NotBlank(message = "时间不可为空")
|
||||
private String dataDate;
|
||||
|
||||
@ApiModelProperty(name = "dataSource",value = "数据源(0:oracle,1:influxdb 2:mysql)")
|
||||
@NotNull(message = "数据源不可为空")
|
||||
private Integer dataSource;
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class DeviceAbnormalController extends BaseController {
|
||||
@PostMapping("/statistics")
|
||||
@ApiOperation("终端异常统计")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<Boolean> dailyDeviceAbnormaStatistics(@RequestBody DeviceAbnormaStatisticsParam param) throws ParseException {
|
||||
public HttpResult<Boolean> dailyDeviceAbnormaStatistics(@RequestBody DeviceAbnormaStatisticsParam param) {
|
||||
String methodDescribe = getMethodDescribe("dailyDeviceAbnormaStatistics");
|
||||
boolean res = deviceAbnormaStatisticsService.dailyDeviceAbnormaStatistics(param);
|
||||
if(res){
|
||||
|
||||
@@ -37,8 +37,8 @@ public class DeviceAbnormaStatisticsServiceImpl implements DeviceAbnormalStatist
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
@Override
|
||||
public boolean dailyDeviceAbnormaStatistics(DeviceAbnormaStatisticsParam param) throws ParseException {
|
||||
Map<String, List<TopMsgPO>> comMap = new HashMap<>();Map<String, List<AlarmPO>> devLineMap = new HashMap<>();
|
||||
public boolean dailyDeviceAbnormaStatistics(DeviceAbnormaStatisticsParam param) {
|
||||
Map<String, List<TopMsgPO>> comMap = new HashMap<>();
|
||||
Map<String, List<AlarmPO>> deviceFlowAndOnlineRateMap = new HashMap<>();
|
||||
// 获取所有装置以及下属监测点
|
||||
List<AlarmPO> lines = deviceAbnormaStatisticsMapper.getLines();
|
||||
@@ -156,7 +156,7 @@ public class DeviceAbnormaStatisticsServiceImpl implements DeviceAbnormalStatist
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(instant.toEpochMilli());
|
||||
return format;
|
||||
}
|
||||
public List<TopMsgPO> getCommunicate(List<String> devs, String startTime, String endTime) throws ParseException {
|
||||
public List<TopMsgPO> getCommunicate(List<String> devs, String startTime, String endTime) {
|
||||
// startTime ="2023-04-02";
|
||||
// endTime = "2023-04-02";
|
||||
//组装sql语句
|
||||
|
||||
@@ -59,7 +59,7 @@ public class DistortionRateServiceImpl implements DistortionRateService {
|
||||
}
|
||||
LocalDateTime local = LocalDateTimeUtil.parse (lineParam.getDataDate ( ) + "T00:00:00");
|
||||
for (String lineId : lineIdOutList) {
|
||||
List<DataVPO> rateOut = getDistortionRateInfluxDb (lineId, lineParam.getDataDate ( ));
|
||||
List<DataVPO> rateOut = getDistortionRateInfluxDb (lineId, lineParam.getDataDate());
|
||||
if (rateOut.size ( ) > 0) {
|
||||
Map<String, Object> inMap = new HashMap<> ( );
|
||||
inMap.put ("lineId", lineId);
|
||||
|
||||
@@ -5,5 +5,6 @@ import com.njcn.prepare.harmonic.pojo.param.DeviceAbnormaStatisticsParam;
|
||||
import java.text.ParseException;
|
||||
|
||||
public interface DeviceAbnormalStatisticsService {
|
||||
boolean dailyDeviceAbnormaStatistics(DeviceAbnormaStatisticsParam param) throws ParseException;
|
||||
|
||||
boolean dailyDeviceAbnormaStatistics(DeviceAbnormaStatisticsParam param);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user