Ver código fonte

监测点结果获取

huangxingxing 1 ano atrás
pai
commit
da116723a3

+ 1 - 0
dbscript/init/generate/03-functionInit.sql

@@ -56,3 +56,4 @@ INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D1
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D10013', '基础系统','物理属性查询',true);
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D10014', '基础系统','物理属性添加修改',true);
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D10015', '基础系统','物理属性据删除',true);
+INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D10016', '基础系统','监测点结果获取',true);

+ 112 - 0
generated/com/miniframe/generate/business/system/model/D10016BaseModel.java

@@ -0,0 +1,112 @@
+package com.miniframe.generate.business.system.model;
+
+import java.util.Map;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import com.miniframe.core.BaseMapModel;
+import com.miniframe.core.ext.UtilTools;
+import com.miniframe.core.ext.HttpMapFormater;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import com.miniframe.generate.global.AppGlobalVariableSysconfig;
+
+import com.miniframe.generate.comm.system.A_SYSTEMHEAD;
+import com.miniframe.generate.comm.system.D_SYSTEMHEAD;
+import com.miniframe.generate.comm.system.A_D10016;
+import com.miniframe.generate.comm.system.D_D10016;
+
+/**
+ * 系统服务,“监测点结果文件获取”模型类(不要维护,重新生成将覆盖)。
+ */
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class D10016BaseModel extends BaseMapModel {
+
+	private static final long serialVersionUID = -1326184831746814093L;
+
+	A_SYSTEMHEAD a_systemhead;//上行头
+	D_SYSTEMHEAD d_systemhead;//下行头
+	A_D10016 a_d10016;//上行体
+	D_D10016 d_d10016;//下行体
+
+	public D10016BaseModel(){
+		a_systemhead=new A_SYSTEMHEAD();
+		d_systemhead=new D_SYSTEMHEAD();
+		a_d10016=new A_D10016();
+		d_d10016=new D_D10016();
+	}
+
+	public void validater() throws Exception {
+		this.a_systemhead.validater();
+		this.a_d10016.validater();
+	}
+
+	public void setTransMap(Map map) throws Exception {
+		Map headMap = HttpMapFormater.format(map, A_SYSTEMHEAD.class);
+		this.a_systemhead = UtilTools.map2Obj(headMap, A_SYSTEMHEAD.class);
+		Map bodyMap = HttpMapFormater.format(map, A_D10016.class);
+		this.a_d10016 = UtilTools.map2Obj(bodyMap, A_D10016.class);
+	}
+
+	public Map getTransMap() throws Exception {
+		Map reMap = new LinkedHashMap();
+
+		if(UtilTools.isNullOrBlank((this.d_systemhead).getTransCode())){
+			(this.d_systemhead).setTransCode((this.a_systemhead).getTransCode());
+		}
+		if(UtilTools.isNullOrBlank((this.d_systemhead).getChannelNo())){
+			(this.d_systemhead).setChannelNo((this.a_systemhead).getChannelNo());
+		}
+		if(UtilTools.isNullOrBlank((this.d_systemhead).getUserId())){
+			(this.d_systemhead).setUserId((this.a_systemhead).getUserId());
+		}
+        if(UtilTools.isNullOrBlank((this.d_systemhead).getTransTime())){
+            (this.d_systemhead).setTransTime(DateTimeFormatter.ofPattern(AppGlobalVariableSysconfig.DATETIMEFORMAT).format(ZonedDateTime.now()));
+        }
+
+		reMap.putAll(UtilTools.obj2Map(this.d_systemhead));
+		reMap.putAll(UtilTools.obj2Map(this.d_d10016));
+
+		return reMap;
+	}
+
+	public A_SYSTEMHEAD getA_systemhead() {
+		return this.a_systemhead;
+	}
+
+	public void setA_systemhead(A_SYSTEMHEAD a_systemhead) {
+		this.a_systemhead=a_systemhead;
+	}
+
+	public D_SYSTEMHEAD getD_systemhead() {
+		return d_systemhead;
+	}
+
+	public void setD_systemhead(D_SYSTEMHEAD d_systemhead) {
+		this.d_systemhead=d_systemhead;
+	}
+
+	public A_D10016 getA_d10016() {
+		return a_d10016;
+	}
+
+	public void setA_d10016(A_D10016 a_d10016) {
+		this.a_d10016=a_d10016;
+	}
+
+	public D_D10016 getD_d10016() {
+		return this.d_d10016;
+	}
+
+	public void setD_d10016(D_D10016 d_d10016) {
+		this.d_d10016=d_d10016;
+	}
+
+	@Override
+	public String toString() {
+		try {
+			return UtilTools.obj2Json(this,true);
+		} catch (IOException e) {
+			return "";
+		}
+	}
+}

+ 99 - 0
generated/com/miniframe/generate/comm/httpclientapater/D10016Client.java

@@ -0,0 +1,99 @@
+package com.miniframe.generate.comm.httpclientapater;
+
+import com.miniframe.spring.httpclient.MFHttpRespInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import com.miniframe.core.Transmitter;
+import com.miniframe.core.ext.UtilTools;
+import com.miniframe.generate.comm.system.D_D10016;
+import com.miniframe.generate.comm.system.D_SYSTEMHEAD;
+
+import com.miniframe.generate.business.system.model.D10016BaseModel;
+
+public class D10016Client {
+
+	private static final Logger logger = LoggerFactory.getLogger(D10016Client.class);
+	private MFHttpRespInfo respInfo;
+
+	public MFHttpRespInfo getRespInfo(){
+		return respInfo;
+	}
+
+	/**
+	 * 调用 [系统服务->监测点结果文件获取((D10016)]的通讯接口
+	 * @param model 接口模型
+	 * @param extMap 扩展输入
+	 * @param url 请求地址
+	 * @return model 接口模型
+	 * @throws Exception
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public D10016BaseModel execute(D10016BaseModel model,final Map extMap,final String url) throws Exception {
+		this.executeToRespInfo(model,extMap,url);
+		return model;
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public D10016BaseModel execute(D10016BaseModel model,final Map extMap) throws Exception {
+		this.executeToRespInfo(model,extMap,null);
+		return model;
+	}
+
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public MFHttpRespInfo executeToRespInfo(D10016BaseModel model,final Map extMap,final String url) throws Exception {
+		if (logger.isDebugEnabled()) {
+			logger.debug("execute(D10016BaseModel) - start");
+		}
+
+		if(UtilTools.isNullOrBlank(model.getA_systemhead().getTransCode())){
+			model.getA_systemhead().setTransCode("D10016");
+		}
+
+		Map inMap = new LinkedHashMap();
+		inMap.putAll(UtilTools.obj2Map(model.getA_systemhead()));
+		inMap.putAll(UtilTools.obj2Map(model.getA_d10016()));
+		if(extMap!=null && extMap.size()>0){
+			inMap.putAll(extMap);
+		}
+
+		Transmitter httpclientApater = (Transmitter) UtilTools.getBean("httpclientApater");
+		MFHttpRespInfo respInfo;
+		if(UtilTools.isNotNullAndBlank(url)){
+			respInfo = httpclientApater.doPostDataToRespInfo(inMap,url);
+		}else{
+			respInfo = httpclientApater.doPostDataToRespInfo(inMap);
+		}
+
+		if(respInfo!=null) {
+			Map outMap=respInfo.getParamMap();
+			D_SYSTEMHEAD d_systemhead =  UtilTools.map2Obj(outMap, D_SYSTEMHEAD.class);
+			D_D10016 d_d10016 =  UtilTools.map2Obj(outMap, D_D10016.class);
+			model.setD_systemhead(d_systemhead);
+			model.setD_d10016(d_d10016);
+
+
+		}
+
+		if (logger.isDebugEnabled()) {
+			logger.debug("execute(D10016BaseModel) - end");
+		}
+
+        this.respInfo=respInfo;
+
+		return respInfo;
+	}
+
+
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public D10016BaseModel execute(D10016BaseModel model) throws Exception {
+		return this.execute(model,null,null);
+	}
+
+
+}

+ 38 - 0
generated/com/miniframe/generate/comm/system/A_D10016.java

@@ -0,0 +1,38 @@
+/**
+ * 系统服务
+ */
+package com.miniframe.generate.comm.system;
+import com.miniframe.core.BaseMapModel;
+import java.io.Serializable;
+/**
+ * 监测点结果文件获取
+ */
+public class A_D10016 extends BaseMapModel implements Serializable {
+	private static final long serialVersionUID = -1463838678425832212L;
+	int aid;//事故ID
+	/**
+	 *事故ID
+	 */
+	public void setAid(int aid) {
+		this.aid=aid;
+	}
+	/**
+	 *事故ID
+	 */
+	public int getAid() {
+		return this.aid;
+	}
+	int step;//文件步数
+	/**
+	 *文件步数
+	 */
+	public void setStep(int step) {
+		this.step=step;
+	}
+	/**
+	 *文件步数
+	 */
+	public int getStep() {
+		return this.step;
+	}
+}

+ 12 - 0
generated/com/miniframe/generate/comm/system/D_D10016.java

@@ -0,0 +1,12 @@
+/**
+ * 系统服务
+ */
+package com.miniframe.generate.comm.system;
+import com.miniframe.core.BaseMapModel;
+import java.io.Serializable;
+/**
+ * 监测点结果文件获取
+ */
+public class D_D10016 extends BaseMapModel implements Serializable {
+	private static final long serialVersionUID = -1463838678425832212L;
+}

+ 15 - 0
generated/validateform/a_d10016Form.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN" "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+<!-- 监测点结果文件获取Form配置文件系统生成请勿修改,否则重新生成将覆盖 -->
+<form-validation>
+<formset>
+<form name="a_d10016Form">
+<field property="aid" depends="required">
+    <arg0 key="a_d10016.aid"/>
+</field>
+<field property="step" depends="required">
+    <arg0 key="a_d10016.step"/>
+</field>
+</form>
+</formset>
+</form-validation>

+ 3 - 0
generated/validator/resources_a_d10016Form_validator.properties

@@ -0,0 +1,3 @@
+a_d10016.aid = \u4E8B\u6545ID
+a_d10016.step = \u6587\u4EF6\u6B65\u6570
+a_d10016Form = true

+ 3 - 0
generated/validator/resources_a_d10016Form_validator_zh_CN.properties

@@ -0,0 +1,3 @@
+a_d10016.aid = \u4E8B\u6545ID
+a_d10016.step = \u6587\u4EF6\u6B65\u6570
+a_d10016Form = true

+ 1 - 0
generated/validator/resources_d_d10016Form_validator.properties

@@ -0,0 +1 @@
+d_d10016Form = false

+ 1 - 0
generated/validator/resources_d_d10016Form_validator_zh_CN.properties

@@ -0,0 +1 @@
+d_d10016Form = false

+ 1 - 1
modelsrc/com/miniframe/model/system/dbconfig/MapperConfig-system.xml

@@ -5,7 +5,7 @@
     This file is generated by MyBatis Generator.
     This file is the shell of a Mapper Config file - in many cases you will need to add
       to this file before it is usable by MyBatis.
-    This file was generated on Thu Feb 29 16:09:15 CST 2024.
+    This file was generated on Fri Mar 01 14:55:10 CST 2024.
   -->
   <mappers>
     <mapper resource="com/miniframe/model/system/xml/SysAppcodeMapper.xml" />

+ 2 - 2
src/main/java/com/miniframe/bisiness/system/D000014Service.java

@@ -30,11 +30,11 @@ public class D000014Service extends D000014BaseModel implements ExecProcessFlow
 		String outPath="";
 		String fileName ="";
 		if(accident.getStype().endsWith("Fire")){
-			outPath= TemplateGenerator.BPATH+"/"+aid+"/"+accident.getSid()+"/fire/out";
+			outPath= TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/"+accident.getSid()+"/fire/out";
 			fileName ="FireGrid.vtk";
 		}
 		if(accident.getStype().endsWith("Water")){
-			outPath=TemplateGenerator.BPATH+"/"+aid+"/"+accident.getSid()+"/water/out";
+			outPath=TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/"+accident.getSid()+"/water/out";
 			fileName ="WaterGrid.vtk";
 		}
 		Path path = Paths.get(outPath+"/"+fileName);

+ 75 - 0
src/main/java/com/miniframe/bisiness/system/D10016Service.java

@@ -0,0 +1,75 @@
+package com.miniframe.bisiness.system;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+import com.miniframe.core.ExecProcessFlow;
+import com.miniframe.core.ext.UtilTools;
+import com.miniframe.generate.business.system.model.D10016BaseModel;
+import com.miniframe.httpserver.HttpServerTransFile;
+import com.miniframe.model.system.DAccident;
+import com.miniframe.model.system.dao.DAccidentMapper;
+import com.miniframe.template.TemplateGenerator;
+import com.miniframe.utils.MFMimeTypeUtils;
+
+/**
+ * 基础系统,“监测点结果获取”逻辑处理(重新生成不覆盖)。
+ */
+public class D10016Service extends D10016BaseModel implements ExecProcessFlow {
+	
+	private static final long serialVersionUID = -7051358269847459502L;
+		
+	/**
+	 * 基础系统,“监测点结果获取”业务核心处理
+ 	 */
+	public void transExecute() throws Exception {
+		Integer aid= getA_d10016().getAid();
+		Integer step =getA_d10016().getStep();
+		DAccidentMapper accidentDao  = UtilTools.getBean(DAccidentMapper.class);
+		DAccident accident= accidentDao.selectByPrimaryKey(aid);
+
+//		String id = getA_b00022().getId();
+		String outPath="";
+		String fileName ="";
+		if(accident.getStype().endsWith("Fire")){
+			outPath= TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/fire/out";
+			fileName ="monitorValue"+step;
+		}
+		if(accident.getStype().endsWith("Water")){
+			outPath=TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/water/out";
+			fileName ="monitorValue"+step;
+		}
+		Path path = Paths.get(outPath+"/"+fileName);
+		String mimeType = MFMimeTypeUtils.getMimeType(path);
+		HttpServerTransFile transFile = new HttpServerTransFile(fileName, mimeType, path);
+		UtilTools.setHttpServerTransFile(transFile);
+	}
+	
+	/**
+	 * 基础系统,“监测点结果获取”业务前处理
+ 	 */
+	public void preTransFlow() throws Exception {
+		this.validater();
+	}
+	
+	/**
+	 * 基础系统,“监测点结果获取”业务后处理
+ 	 */
+	public void afterTransFlow() throws Exception {
+	
+	}
+	
+	/**
+	 * 基础系统,“监测点结果获取”逻辑入口处理方法
+ 	 */
+ 	@SuppressWarnings("rawtypes")
+	@Override
+	public Map execute(Map vars) throws Exception {
+		this.setTransMap(vars);
+		preTransFlow();// 执行业务开始的规则检查和校验
+		transExecute();// 执行核心业务段
+		afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
+		return this.getTransMap();
+	}
+
+}

+ 44 - 0
src/test/java/com/miniframe/comm/httpclientapater/D10016Test.java

@@ -0,0 +1,44 @@
+package com.miniframe.comm.httpclientapater;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.miniframe.comm.httpclientapater.HttpclientapaterUtil;
+import com.miniframe.generate.comm.system.A_D10016;
+import com.miniframe.generate.comm.httpclientapater.D10016Client;
+import com.miniframe.generate.business.system.model.D10016BaseModel;
+
+public class D10016Test {
+
+	private static final Logger logger = LoggerFactory.getLogger(D10016Test.class);
+
+	/**
+	 * 监测点结果文件获取,获取报文体
+	 * @return
+	 */
+	public static A_D10016 getA_d10016() {
+		A_D10016 a_d10016 = new A_D10016();
+
+		// ----------以下增加【监测点结果文件获取】上行体赋值-------------
+
+
+
+		// ---------------------------------------------------
+		return a_d10016;
+	}
+	
+	/**
+	 * 运行客户端测试,监测点结果文件获取
+	 * 
+	 * @param args
+	 * @throws Exception
+	 */
+	public static void main(String[] args) throws Exception {
+		D10016BaseModel model = new D10016BaseModel();
+		model.setA_systemhead(HttpclientapaterUtil.getA_systemhead("D10016"));
+		model.setA_d10016(D10016Test.getA_d10016());
+		D10016Client client = new D10016Client();
+		logger.error("客户端发送前总线:\r\n"+model);
+		model = client.execute(model);
+		logger.error("客户端发送后总线:\r\n"+model);
+	}
+}

+ 4 - 1
系统设计/系统模块/SYSTEM(基础系统).csv

@@ -64,4 +64,7 @@
 
 310013,D10013,物理属性查询,service,,
 310014,D10014,物理属性添加修改,service,,
-310015,D10015,物理属性据删除,service,,
+310015,D10015,物理属性据删除,service,,
+
+
+D10016,D10016,监测点结果获取,service,

+ 3 - 0
系统设计/通信设计/通讯报文/system(系统服务)/报文体/D10016_A(监测点结果文件获取).csv

@@ -0,0 +1,3 @@
+序号,英文名称,中文名称,数据类型,默认值,格式化,非空/引用,最小(长度/值),最大(长度/值),验证规则,标准数据ID,XML样式,TAG标签,映射/子标签,CDATA
+1,aid,事故ID,int,,,是,,,,,,,,
+2,step,文件步数,int,,,是,,,,,,,,

+ 1 - 0
系统设计/通信设计/通讯报文/system(系统服务)/报文体/D10016_D(监测点结果文件获取).csv

@@ -0,0 +1 @@
+序号,英文名称,中文名称,数据类型,默认值,格式化,非空/引用,最小(长度/值),最大(长度/值),验证规则,标准数据ID,XML样式,TAG标签,映射/子标签,CDATA