2023-02-16 15:28:15 +08:00
|
|
|
package com.zhgd.xmgl.async;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.zhgd.xmgl.modules.ammeter.entity.AmmeterRecordDetail;
|
|
|
|
|
import com.zhgd.xmgl.modules.water.entity.WaterMeterRecordDetail;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author 邱平毅
|
|
|
|
|
* @ClassName AsyncDoubleCarbon
|
|
|
|
|
* @date 2023/1/6
|
|
|
|
|
* @Version 1.0
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Component
|
|
|
|
|
public class AsyncDoubleCarbon {
|
2023-06-28 17:12:24 +08:00
|
|
|
@Value("${double-carbon.water-data-url:}")
|
2023-02-16 15:28:15 +08:00
|
|
|
private String waterDataUrl;
|
|
|
|
|
|
2023-06-28 17:12:24 +08:00
|
|
|
@Value("${double-carbon.ammeter-data-url:}")
|
2023-02-16 15:28:15 +08:00
|
|
|
private String ammeterDataUrl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Async("doubleCarbonExecutor")
|
|
|
|
|
public void sendWaterData(WaterMeterRecordDetail waterMeterRecordDetail) {
|
|
|
|
|
HttpUtil.post(waterDataUrl + "/saveWaterMeterRecordDetail", JSONUtil.toJsonStr(waterMeterRecordDetail));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Async("doubleCarbonExecutor")
|
|
|
|
|
public void sendAmmeterData(AmmeterRecordDetail ammeterRecordDetail) {
|
|
|
|
|
HttpUtil.post(ammeterDataUrl + "/saveAmmeterRecordDetail", JSONUtil.toJsonStr(ammeterRecordDetail));
|
|
|
|
|
}
|
|
|
|
|
}
|