恢复实体类字段类型
This commit is contained in:
parent
ceac0d6996
commit
563edf466b
|
|
@ -100,22 +100,22 @@ public class Heatanalysis extends JeecgEntity {
|
||||||
private Integer reportType;//数据采集类型 1设备自动上报 2定时模拟
|
private Integer reportType;//数据采集类型 1设备自动上报 2定时模拟
|
||||||
private String fromFlow; // 温度是否从流量取 0否 1是
|
private String fromFlow; // 温度是否从流量取 0否 1是
|
||||||
private String view031; // 流量设备SN,view031到view047全是从流量表上获取的数据
|
private String view031; // 流量设备SN,view031到view047全是从流量表上获取的数据
|
||||||
private Date view032; // 流量数据上报时间
|
private String view032; // 流量数据上报时间
|
||||||
private String view033; // 仪表ID
|
private String view033; // 仪表ID
|
||||||
private int view034; // 数据有效标识 0无效 1有效
|
private String view034; // 数据有效标识 0无效 1有效
|
||||||
private Double view035; // 供水温度
|
private String view035; // 供水温度
|
||||||
private Double view036; // 回水温度
|
private String view036; // 回水温度
|
||||||
private Double view037; // 瞬时流量
|
private String view037; // 瞬时流量
|
||||||
private Double view038; // 正累积流量
|
private String view038; // 正累积流量
|
||||||
private Double view039; // 负累积流量
|
private String view039; // 负累积流量
|
||||||
private Double view040; // 净累积流量
|
private String view040; // 净累积流量
|
||||||
private Double view041; // 瞬时热量
|
private String view041; // 瞬时热量
|
||||||
private Double view042; // 正累积热量
|
private String view042; // 正累积热量
|
||||||
private Double view043; // 负累积热量
|
private String view043; // 负累积热量
|
||||||
private Double view044; // 净累积热量
|
private String view044; // 净累积热量
|
||||||
private Double view045; // 流体速度
|
private String view045; // 流体速度
|
||||||
private Double view046; // 流量因子
|
private String view046; // 流量因子
|
||||||
private Double view047; // 热量因子
|
private String view047; // 热量因子
|
||||||
private Integer isExtract;//是否抽取 0否 1是
|
private Integer isExtract;//是否抽取 0否 1是
|
||||||
/**地区类型*/
|
/**地区类型*/
|
||||||
@Excel(name = "地区类型", width = 15)
|
@Excel(name = "地区类型", width = 15)
|
||||||
|
|
|
||||||
|
|
@ -32,162 +32,161 @@ import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送消息任务
|
* 发送消息任务
|
||||||
*
|
|
||||||
* @author: jeecg-boot
|
* @author: jeecg-boot
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class FlowanalysisJob implements Job {
|
public class FlowanalysisJob implements Job {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HeatanalysisService heatanalysisService;
|
private HeatanalysisService heatanalysisService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBlWaterFlowConfigService WaterFlowConfigService;
|
private IBlWaterFlowConfigService WaterFlowConfigService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
|
|
||||||
log.info(String.format("获取热量水流量数据 ! 时间:" + DateUtils.getTimestamp()));
|
log.info(String.format("获取热量水流量数据 ! 时间:" + DateUtils.getTimestamp()));
|
||||||
QueryWrapper<BlWaterFlowConfig> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<BlWaterFlowConfig> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("del_flag", "0");
|
queryWrapper.eq("del_flag","0");
|
||||||
List<BlWaterFlowConfig> list = WaterFlowConfigService.list(queryWrapper);
|
List<BlWaterFlowConfig> list = WaterFlowConfigService.list(queryWrapper);
|
||||||
for (BlWaterFlowConfig config : list) {
|
for(BlWaterFlowConfig config : list){
|
||||||
try {
|
try{
|
||||||
String sn = config.getSn();
|
String sn = config.getSn();
|
||||||
String json = getWebInfo(sn);
|
String json = getWebInfo(sn);
|
||||||
if (StringUtils.equals(json, "false")) continue;
|
if(StringUtils.equals(json,"false")) continue;
|
||||||
JSONObject jsonObject = new JSONObject(json);
|
JSONObject jsonObject = new JSONObject(json);
|
||||||
log.info("jsonObject:" + jsonObject);
|
log.info("jsonObject:"+jsonObject);
|
||||||
String success = jsonObject.getStr("success");
|
String success = jsonObject.getStr("success");
|
||||||
if (StringUtils.equals(success, "true")) {
|
if(StringUtils.equals(success,"true")){
|
||||||
QueryWrapper<Heatanalysis> heatanalysisQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<Heatanalysis> heatanalysisQueryWrapper = new QueryWrapper<>();
|
||||||
heatanalysisQueryWrapper.eq("view031", sn);
|
heatanalysisQueryWrapper.eq("view031",sn);
|
||||||
heatanalysisQueryWrapper.last("limit 1");
|
heatanalysisQueryWrapper.last("limit 1");
|
||||||
Heatanalysis heatanalysis = heatanalysisService.getOne(heatanalysisQueryWrapper);
|
Heatanalysis heatanalysis = heatanalysisService.getOne(heatanalysisQueryWrapper);
|
||||||
if (heatanalysis != null) {
|
if(heatanalysis != null){
|
||||||
Date view032_old = heatanalysis.getView032();
|
String view032_old = heatanalysis.getView032();
|
||||||
String data = jsonObject.getStr("data");
|
String data = jsonObject.getStr("data");
|
||||||
JSONObject dataObject = new JSONObject(data);
|
JSONObject dataObject = new JSONObject(data);
|
||||||
String view032 = dataObject.getStr("logat");
|
String view032 = dataObject.getStr("logat");
|
||||||
if (StringUtils.equals(view032, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(view032_old))) {
|
if(StringUtils.equals(view032,view032_old)){
|
||||||
log.info("--------数据重复---------");
|
log.info("--------数据重复---------");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String view033 = dataObject.getStr("ID");
|
String view033 = dataObject.getStr("ID");
|
||||||
String view034 = dataObject.getStr("valid");
|
String view034 = dataObject.getStr("valid");
|
||||||
String view035 = dataObject.getStr("gswd");
|
String view035 = dataObject.getStr("gswd");
|
||||||
String view036 = dataObject.getStr("hswd");
|
String view036 = dataObject.getStr("hswd");
|
||||||
String view037 = dataObject.getStr("flowRate");
|
String view037 = dataObject.getStr("flowRate");
|
||||||
String view037_2 = dataObject.getStr("ssll");
|
String view037_2 = dataObject.getStr("ssll");
|
||||||
String view038 = dataObject.getStr("pflowAccumulator");
|
String view038 = dataObject.getStr("pflowAccumulator");
|
||||||
String view038_2 = dataObject.getStr("zljll");
|
String view038_2 = dataObject.getStr("zljll");
|
||||||
String view039 = dataObject.getStr("nflowAccumulator");
|
String view039 = dataObject.getStr("nflowAccumulator");
|
||||||
String view039_2 = dataObject.getStr("fljll");
|
String view039_2 = dataObject.getStr("fljll");
|
||||||
String view040 = dataObject.getStr("netflowAccumulator");
|
String view040 = dataObject.getStr("netflowAccumulator");
|
||||||
String view040_2 = dataObject.getStr("jljll");
|
String view040_2 = dataObject.getStr("jljll");
|
||||||
String view041 = dataObject.getStr("ssrl");
|
String view041 = dataObject.getStr("ssrl");
|
||||||
String view042 = dataObject.getStr("zljrl");
|
String view042 = dataObject.getStr("zljrl");
|
||||||
String view043 = dataObject.getStr("fljrl");
|
String view043 = dataObject.getStr("fljrl");
|
||||||
String view044 = dataObject.getStr("jljrl");
|
String view044 = dataObject.getStr("jljrl");
|
||||||
String view045 = dataObject.getStr("ltsd");
|
String view045 = dataObject.getStr("ltsd");
|
||||||
String view046 = dataObject.getStr("n");
|
String view046 = dataObject.getStr("n");
|
||||||
String view047 = dataObject.getStr("m");
|
String view047 = dataObject.getStr("m");
|
||||||
heatanalysis.setView031(sn);
|
heatanalysis.setView031(sn);
|
||||||
heatanalysis.setView032(new Date(view032));
|
heatanalysis.setView032(view032);
|
||||||
heatanalysis.setView033(view033);
|
heatanalysis.setView033(view033);
|
||||||
heatanalysis.setView034(Integer.parseInt(view034));
|
heatanalysis.setView034(view034);
|
||||||
heatanalysis.setView035(Double.parseDouble(view035));
|
heatanalysis.setView035(view035);
|
||||||
heatanalysis.setView036(Double.parseDouble(view036));
|
heatanalysis.setView036(view036);
|
||||||
if (StringUtils.isEmpty(view037)) {
|
if (StringUtils.isEmpty(view037)){
|
||||||
heatanalysis.setView037(Double.parseDouble(view037_2));
|
heatanalysis.setView037(view037_2);
|
||||||
} else {
|
}else{
|
||||||
heatanalysis.setView037(Double.parseDouble(view037));
|
heatanalysis.setView037(view037);
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(view038)) {
|
if (StringUtils.isEmpty(view038)){
|
||||||
heatanalysis.setView038(Double.parseDouble(view038_2));
|
heatanalysis.setView038(view038_2);
|
||||||
} else {
|
}else{
|
||||||
heatanalysis.setView038(Double.parseDouble(view038));
|
heatanalysis.setView038(view038);
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(view039)) {
|
if (StringUtils.isEmpty(view039)){
|
||||||
heatanalysis.setView039(Double.parseDouble(view039_2));
|
heatanalysis.setView039(view039_2);
|
||||||
} else {
|
}else{
|
||||||
heatanalysis.setView039(Double.parseDouble(view039));
|
heatanalysis.setView039(view039);
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(view040)) {
|
if (StringUtils.isEmpty(view040)){
|
||||||
heatanalysis.setView040(Double.parseDouble(view040_2));
|
heatanalysis.setView040(view040_2);
|
||||||
} else {
|
}else{
|
||||||
heatanalysis.setView040(Double.parseDouble(view040));
|
heatanalysis.setView040(view040);
|
||||||
}
|
}
|
||||||
heatanalysis.setView041(Double.parseDouble(view041));
|
heatanalysis.setView041(view041);
|
||||||
heatanalysis.setView042(Double.parseDouble(view042));
|
heatanalysis.setView042(view042);
|
||||||
heatanalysis.setView043(Double.parseDouble(view043));
|
heatanalysis.setView043(view043);
|
||||||
heatanalysis.setView044(Double.parseDouble(view044));
|
heatanalysis.setView044(view044);
|
||||||
heatanalysis.setView045(Double.parseDouble(view045));
|
heatanalysis.setView045(view045);
|
||||||
heatanalysis.setView046(Double.parseDouble(view046));
|
heatanalysis.setView046(view046);
|
||||||
heatanalysis.setView047(Double.parseDouble(view047));
|
heatanalysis.setView047(view047);
|
||||||
heatanalysisService.exeWater(heatanalysis);
|
heatanalysisService.exeWater(heatanalysis);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getWebInfo(String sn) {
|
|
||||||
String result = "false";
|
|
||||||
try {
|
|
||||||
// 1. 创建URL对象
|
|
||||||
URL url = new URL("http://49.235.190.102:8068/api/v1/feeding/snap/b501a6e0-d23f-4282-8fab-78661bf999e7/" + sn);
|
|
||||||
|
|
||||||
// 2. 打开连接,转换为HttpURLConnection
|
public static String getWebInfo(String sn) {
|
||||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
String result = "false";
|
||||||
|
try {
|
||||||
|
// 1. 创建URL对象
|
||||||
|
URL url = new URL("http://49.235.190.102:8068/api/v1/feeding/snap/b501a6e0-d23f-4282-8fab-78661bf999e7/"+sn);
|
||||||
|
|
||||||
// 3. 设置请求方法为GET
|
// 2. 打开连接,转换为HttpURLConnection
|
||||||
connection.setRequestMethod("GET");
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
|
|
||||||
// 4. 可选:设置请求头(例如,指定期望的响应内容类型)
|
// 3. 设置请求方法为GET
|
||||||
connection.setRequestProperty("Accept", "application/json");
|
connection.setRequestMethod("GET");
|
||||||
|
|
||||||
// 5. 获取响应代码
|
// 4. 可选:设置请求头(例如,指定期望的响应内容类型)
|
||||||
int responseCode = connection.getResponseCode();
|
connection.setRequestProperty("Accept", "application/json");
|
||||||
System.out.println("Response Code: " + responseCode);
|
|
||||||
|
|
||||||
// 6. 如果响应成功(200 OK),读取响应体
|
// 5. 获取响应代码
|
||||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
int responseCode = connection.getResponseCode();
|
||||||
// 使用BufferedReader读取输入流
|
System.out.println("Response Code: " + responseCode);
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
|
||||||
String inputLine;
|
|
||||||
StringBuilder response = new StringBuilder();
|
|
||||||
|
|
||||||
while ((inputLine = in.readLine()) != null) {
|
// 6. 如果响应成功(200 OK),读取响应体
|
||||||
response.append(inputLine);
|
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||||
}
|
// 使用BufferedReader读取输入流
|
||||||
in.close(); // 关闭流
|
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||||
|
String inputLine;
|
||||||
|
StringBuilder response = new StringBuilder();
|
||||||
|
|
||||||
// 打印响应结果
|
while ((inputLine = in.readLine()) != null) {
|
||||||
log.info(String.format("获取热量水流量数据 - Response Body:" + response.toString()));
|
response.append(inputLine);
|
||||||
result = response.toString();
|
}
|
||||||
} else {
|
in.close(); // 关闭流
|
||||||
log.error(String.format("获取热量水流量数据 - GET request failed."));
|
|
||||||
result = "false";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 7. 断开连接
|
// 打印响应结果
|
||||||
connection.disconnect();
|
log.info(String.format("获取热量水流量数据 - Response Body:" + response.toString()));
|
||||||
|
result = response.toString();
|
||||||
|
} else {
|
||||||
|
log.error(String.format("获取热量水流量数据 - GET request failed."));
|
||||||
|
result = "false";
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
// 7. 断开连接
|
||||||
e.printStackTrace();
|
connection.disconnect();
|
||||||
result = "false";
|
|
||||||
}
|
} catch (IOException e) {
|
||||||
return result;
|
e.printStackTrace();
|
||||||
}
|
result = "false";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue