Переглянути джерело

平台对接获取传感器数据

huangxingxing 8 місяців тому
батько
коміт
1932832df7

+ 9 - 19
src/main/java/com/miniframe/bisiness/system/D00008Service.java

@@ -12,12 +12,14 @@ import com.miniframe.generate.comm.system.D_D10016_CHVALS_RECODE;
 import com.miniframe.generate.comm.system.D_D10016_COCODES_RECODE;
 import com.miniframe.model.system.*;
 import com.miniframe.model.system.dao.*;
+import com.miniframe.ptdj.PtdjServer;
 import com.miniframe.service.impl.FileServiceImpl;
 import com.miniframe.solverjob.DockerExe;
 import com.miniframe.template.TemplateGenerator;
 import com.miniframe.template.TemplateGenerator2;
 import com.miniframe.tools.XIDateTimeUtils;
 import com.miniframe.tools.XIFileUtils;
+import com.miniframe.tools.baidu.HttpUtil;
 import com.miniframe.websocket.WebsocketEndPoint;
 import lombok.SneakyThrows;
 import tk.mybatis.mapper.util.StringUtil;
@@ -186,7 +188,7 @@ public class D00008Service extends D00008BaseModel implements ExecProcessFlow {
 				cpFile("/home/disaster/gas/bin/reac_mod.fluent_CH4_Air_5x1"
 						,TemplateGenerator.BPATH + "/" + aid + "/" + jid + "/" + "/gas" + "/reac_mod.fluent_CH4_Air_5x1");
 				//执行文件
-				exeGass2(aid,jid);
+				exeGass(aid,jid);
 //			}
 
 		}
@@ -248,25 +250,13 @@ public class D00008Service extends D00008BaseModel implements ExecProcessFlow {
 	}
 
 	private void initDNodeVal(Integer aid) {
-		DNodeValMapper dnvm= UtilTools.getBean(DNodeValMapper.class);
-		DNodeValSQLBuilder sb =new DNodeValSQLBuilder();
-		DNodeValSQLBuilder.Criteria sc =sb.createCriteria();
-		sc.andAidEqualTo(aid);
-		dnvm.deleteByExample(sb);
-		DNodeMapper dnm = UtilTools.getBean(DNodeMapper.class);
-		List<DNode> nlist = dnm.selectAll();
-		for (DNode dn:nlist) {
-			DNodeVal nv = new DNodeVal();
-			nv.setAid(aid);
-			nv.setNid(dn.getId());
-			nv.setNname(dn.getName());
-			nv.setVal1(0.0f);
-			nv.setVal2(300.0f);
-			nv.setVal3(0.0f);
-			nv.setVal4(0.0f);
-			nv.setNtype(dn.getNtype());
-			dnvm.insertSelective(nv);
+		//TODO
+		try {
+			PtdjServer.getCgq();
+		}catch (Exception e){
+			e.printStackTrace();
 		}
+
 	}
 
 	public void cpFile(String file1Path,String file2Path) throws IOException {

+ 58 - 0
src/main/java/com/miniframe/ptdj/PtDjCgq.java

@@ -0,0 +1,58 @@
+package com.miniframe.ptdj;
+
+public class PtDjCgq {
+    private  PtDjResult result;
+    private String targetUrl;
+    private String success;
+    private String error;
+    private String unAuthorizedRequest;
+    private String __abp;
+
+    public PtDjResult getResult() {
+        return result;
+    }
+
+    public void setResult(PtDjResult result) {
+        this.result = result;
+    }
+
+    public String getTargetUrl() {
+        return targetUrl;
+    }
+
+    public void setTargetUrl(String targetUrl) {
+        this.targetUrl = targetUrl;
+    }
+
+    public String getSuccess() {
+        return success;
+    }
+
+    public void setSuccess(String success) {
+        this.success = success;
+    }
+
+    public String getError() {
+        return error;
+    }
+
+    public void setError(String error) {
+        this.error = error;
+    }
+
+    public String getUnAuthorizedRequest() {
+        return unAuthorizedRequest;
+    }
+
+    public void setUnAuthorizedRequest(String unAuthorizedRequest) {
+        this.unAuthorizedRequest = unAuthorizedRequest;
+    }
+
+    public String get__abp() {
+        return __abp;
+    }
+
+    public void set__abp(String __abp) {
+        this.__abp = __abp;
+    }
+}

+ 33 - 0
src/main/java/com/miniframe/ptdj/PtDjResult.java

@@ -0,0 +1,33 @@
+package com.miniframe.ptdj;
+
+import java.util.List;
+
+public class PtDjResult {
+    private String code;
+    private String msg;
+    private List<PtDjResultData>  data;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public List<PtDjResultData> getData() {
+        return data;
+    }
+
+    public void setData(List<PtDjResultData> data) {
+        this.data = data;
+    }
+}

+ 139 - 0
src/main/java/com/miniframe/ptdj/PtDjResultData.java

@@ -0,0 +1,139 @@
+package com.miniframe.ptdj;
+
+public class PtDjResultData {
+     private  String mine_code;
+    private  String point_code;
+    private  String data_time;
+    private  String sensor_type;
+    private  String sensor_type_name;
+    private  String point_location;
+    private  String point_value;
+    private  String point_status;
+    private  String value_unit;
+    private  String create_time;
+    private  String x_coordinate;
+    private  String y_coordinate;
+    private  String z_coordinate;
+    private  String pipes;
+    private  String site;
+
+    public String getMine_code() {
+        return mine_code;
+    }
+
+    public void setMine_code(String mine_code) {
+        this.mine_code = mine_code;
+    }
+
+    public String getPoint_code() {
+        return point_code;
+    }
+
+    public void setPoint_code(String point_code) {
+        this.point_code = point_code;
+    }
+
+    public String getData_time() {
+        return data_time;
+    }
+
+    public void setData_time(String data_time) {
+        this.data_time = data_time;
+    }
+
+    public String getSensor_type() {
+        return sensor_type;
+    }
+
+    public void setSensor_type(String sensor_type) {
+        this.sensor_type = sensor_type;
+    }
+
+    public String getSensor_type_name() {
+        return sensor_type_name;
+    }
+
+    public void setSensor_type_name(String sensor_type_name) {
+        this.sensor_type_name = sensor_type_name;
+    }
+
+    public String getPoint_location() {
+        return point_location;
+    }
+
+    public void setPoint_location(String point_location) {
+        this.point_location = point_location;
+    }
+
+    public String getPoint_value() {
+        return point_value;
+    }
+
+    public void setPoint_value(String point_value) {
+        this.point_value = point_value;
+    }
+
+    public String getPoint_status() {
+        return point_status;
+    }
+
+    public void setPoint_status(String point_status) {
+        this.point_status = point_status;
+    }
+
+    public String getValue_unit() {
+        return value_unit;
+    }
+
+    public void setValue_unit(String value_unit) {
+        this.value_unit = value_unit;
+    }
+
+    public String getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(String create_time) {
+        this.create_time = create_time;
+    }
+
+    public String getX_coordinate() {
+        return x_coordinate;
+    }
+
+    public void setX_coordinate(String x_coordinate) {
+        this.x_coordinate = x_coordinate;
+    }
+
+    public String getY_coordinate() {
+        return y_coordinate;
+    }
+
+    public void setY_coordinate(String y_coordinate) {
+        this.y_coordinate = y_coordinate;
+    }
+
+    public String getZ_coordinate() {
+        return z_coordinate;
+    }
+
+    public void setZ_coordinate(String z_coordinate) {
+        this.z_coordinate = z_coordinate;
+    }
+
+    public String getPipes() {
+        return pipes;
+    }
+
+    public void setPipes(String pipes) {
+        this.pipes = pipes;
+    }
+
+    public String getSite() {
+        return site;
+    }
+
+    public void setSite(String site) {
+        this.site = site;
+    }
+}

+ 13 - 0
src/main/java/com/miniframe/ptdj/PtdjServer.java

@@ -0,0 +1,13 @@
+package com.miniframe.ptdj;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.miniframe.tools.XiJsonUtil;
+import com.miniframe.tools.baidu.HttpUtil;
+
+public class PtdjServer {
+    public static PtDjCgq getCgq() throws Exception {
+        String b = HttpUtil.post("http://yj.xmbygy.com/api/BasicData/GetSensorInfo","","");
+        PtDjCgq back = XiJsonUtil.jsonToPojo(b,PtDjCgq.class);
+        return back;
+    }
+}

+ 9 - 4
src/test/java/com/miniframe/PtDj.java

@@ -4,6 +4,7 @@ package com.miniframe;
 
 import com.alibaba.nacos.shaded.com.google.gson.JsonArray;
 import com.miniframe.tools.XiJsonUtil;
+import com.miniframe.tools.baidu.HttpUtil;
 import org.json.JSONArray;
 import org.json.JSONException;
 
@@ -18,7 +19,14 @@ import java.util.List;
 
 
 public class PtDj {
-    public static void main(String[] args) throws IOException {
+    public static void main(String[] args) throws Exception {
+
+        String b =HttpUtil.post("http://yj.xmbygy.com/api/BasicData/GetSensorInfo","","");
+        PtDjCgq back = XiJsonUtil.jsonToPojo(b,PtDjCgq.class);
+        System.out.println(back.getResult().getData().get(30));
+
+    }
+    public  static  void readJson()throws IOException {
         File file = new File("D://ptp.json");
         String jsonstr =new String (Files.readAllBytes(Paths.get(file.getPath())));
 
@@ -34,9 +42,6 @@ public class PtDj {
             System.out.println(pipe.getPositionB().getX()+"\t"+pipe.getPositionB().getY()+"\t"+pipe.getPositionB().getZ());
             ps.add(pipe);
         }
-
-
-
     }
 }
 

+ 58 - 0
src/test/java/com/miniframe/PtDjCgq.java

@@ -0,0 +1,58 @@
+package com.miniframe;
+
+public class PtDjCgq {
+    private  PtDjResult result;
+    private String targetUrl;
+    private String success;
+    private String error;
+    private String unAuthorizedRequest;
+    private String __abp;
+
+    public PtDjResult getResult() {
+        return result;
+    }
+
+    public void setResult(PtDjResult result) {
+        this.result = result;
+    }
+
+    public String getTargetUrl() {
+        return targetUrl;
+    }
+
+    public void setTargetUrl(String targetUrl) {
+        this.targetUrl = targetUrl;
+    }
+
+    public String getSuccess() {
+        return success;
+    }
+
+    public void setSuccess(String success) {
+        this.success = success;
+    }
+
+    public String getError() {
+        return error;
+    }
+
+    public void setError(String error) {
+        this.error = error;
+    }
+
+    public String getUnAuthorizedRequest() {
+        return unAuthorizedRequest;
+    }
+
+    public void setUnAuthorizedRequest(String unAuthorizedRequest) {
+        this.unAuthorizedRequest = unAuthorizedRequest;
+    }
+
+    public String get__abp() {
+        return __abp;
+    }
+
+    public void set__abp(String __abp) {
+        this.__abp = __abp;
+    }
+}

+ 33 - 0
src/test/java/com/miniframe/PtDjResult.java

@@ -0,0 +1,33 @@
+package com.miniframe;
+
+import java.util.List;
+
+public class PtDjResult {
+    private String code;
+    private String msg;
+    private List<PtDjResultData>  data;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public List<PtDjResultData> getData() {
+        return data;
+    }
+
+    public void setData(List<PtDjResultData> data) {
+        this.data = data;
+    }
+}

+ 139 - 0
src/test/java/com/miniframe/PtDjResultData.java

@@ -0,0 +1,139 @@
+package com.miniframe;
+
+public class PtDjResultData {
+     private  String mine_code;
+    private  String point_code;
+    private  String data_time;
+    private  String sensor_type;
+    private  String sensor_type_name;
+    private  String point_location;
+    private  String point_value;
+    private  String point_status;
+    private  String value_unit;
+    private  String create_time;
+    private  String x_coordinate;
+    private  String y_coordinate;
+    private  String z_coordinate;
+    private  String pipes;
+    private  String site;
+
+    public String getMine_code() {
+        return mine_code;
+    }
+
+    public void setMine_code(String mine_code) {
+        this.mine_code = mine_code;
+    }
+
+    public String getPoint_code() {
+        return point_code;
+    }
+
+    public void setPoint_code(String point_code) {
+        this.point_code = point_code;
+    }
+
+    public String getData_time() {
+        return data_time;
+    }
+
+    public void setData_time(String data_time) {
+        this.data_time = data_time;
+    }
+
+    public String getSensor_type() {
+        return sensor_type;
+    }
+
+    public void setSensor_type(String sensor_type) {
+        this.sensor_type = sensor_type;
+    }
+
+    public String getSensor_type_name() {
+        return sensor_type_name;
+    }
+
+    public void setSensor_type_name(String sensor_type_name) {
+        this.sensor_type_name = sensor_type_name;
+    }
+
+    public String getPoint_location() {
+        return point_location;
+    }
+
+    public void setPoint_location(String point_location) {
+        this.point_location = point_location;
+    }
+
+    public String getPoint_value() {
+        return point_value;
+    }
+
+    public void setPoint_value(String point_value) {
+        this.point_value = point_value;
+    }
+
+    public String getPoint_status() {
+        return point_status;
+    }
+
+    public void setPoint_status(String point_status) {
+        this.point_status = point_status;
+    }
+
+    public String getValue_unit() {
+        return value_unit;
+    }
+
+    public void setValue_unit(String value_unit) {
+        this.value_unit = value_unit;
+    }
+
+    public String getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(String create_time) {
+        this.create_time = create_time;
+    }
+
+    public String getX_coordinate() {
+        return x_coordinate;
+    }
+
+    public void setX_coordinate(String x_coordinate) {
+        this.x_coordinate = x_coordinate;
+    }
+
+    public String getY_coordinate() {
+        return y_coordinate;
+    }
+
+    public void setY_coordinate(String y_coordinate) {
+        this.y_coordinate = y_coordinate;
+    }
+
+    public String getZ_coordinate() {
+        return z_coordinate;
+    }
+
+    public void setZ_coordinate(String z_coordinate) {
+        this.z_coordinate = z_coordinate;
+    }
+
+    public String getPipes() {
+        return pipes;
+    }
+
+    public void setPipes(String pipes) {
+        this.pipes = pipes;
+    }
+
+    public String getSite() {
+        return site;
+    }
+
+    public void setSite(String site) {
+        this.site = site;
+    }
+}