huangxingxing пре 1 година
родитељ
комит
ffb2232ff5

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

@@ -32,3 +32,4 @@ INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D0
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D00006', '基础系统','灾情源检测数据添加',true);
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D00007', '基础系统','灾情源检测数据查询',true);
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D00008', '基础系统','灾情演练',true);
+INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D00009', '基础系统','灾情文件获取',true);

+ 112 - 0
generated/com/miniframe/generate/business/system/model/D00009BaseModel.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_D00009;
+import com.miniframe.generate.comm.system.D_D00009;
+
+/**
+ * 系统服务,“灾情结果文件获取”模型类(不要维护,重新生成将覆盖)。
+ */
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class D00009BaseModel extends BaseMapModel {
+
+	private static final long serialVersionUID = -1326184831746814093L;
+
+	A_SYSTEMHEAD a_systemhead;//上行头
+	D_SYSTEMHEAD d_systemhead;//下行头
+	A_D00009 a_d00009;//上行体
+	D_D00009 d_d00009;//下行体
+
+	public D00009BaseModel(){
+		a_systemhead=new A_SYSTEMHEAD();
+		d_systemhead=new D_SYSTEMHEAD();
+		a_d00009=new A_D00009();
+		d_d00009=new D_D00009();
+	}
+
+	public void validater() throws Exception {
+		this.a_systemhead.validater();
+		this.a_d00009.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_D00009.class);
+		this.a_d00009 = UtilTools.map2Obj(bodyMap, A_D00009.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_d00009));
+
+		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_D00009 getA_d00009() {
+		return a_d00009;
+	}
+
+	public void setA_d00009(A_D00009 a_d00009) {
+		this.a_d00009=a_d00009;
+	}
+
+	public D_D00009 getD_d00009() {
+		return this.d_d00009;
+	}
+
+	public void setD_d00009(D_D00009 d_d00009) {
+		this.d_d00009=d_d00009;
+	}
+
+	@Override
+	public String toString() {
+		try {
+			return UtilTools.obj2Json(this,true);
+		} catch (IOException e) {
+			return "";
+		}
+	}
+}

+ 99 - 0
generated/com/miniframe/generate/comm/httpclientapater/D00009Client.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_D00009;
+import com.miniframe.generate.comm.system.D_SYSTEMHEAD;
+
+import com.miniframe.generate.business.system.model.D00009BaseModel;
+
+public class D00009Client {
+
+	private static final Logger logger = LoggerFactory.getLogger(D00009Client.class);
+	private MFHttpRespInfo respInfo;
+
+	public MFHttpRespInfo getRespInfo(){
+		return respInfo;
+	}
+
+	/**
+	 * 调用 [系统服务->灾情结果文件获取((D00009)]的通讯接口
+	 * @param model 接口模型
+	 * @param extMap 扩展输入
+	 * @param url 请求地址
+	 * @return model 接口模型
+	 * @throws Exception
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public D00009BaseModel execute(D00009BaseModel model,final Map extMap,final String url) throws Exception {
+		this.executeToRespInfo(model,extMap,url);
+		return model;
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public D00009BaseModel execute(D00009BaseModel model,final Map extMap) throws Exception {
+		this.executeToRespInfo(model,extMap,null);
+		return model;
+	}
+
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public MFHttpRespInfo executeToRespInfo(D00009BaseModel model,final Map extMap,final String url) throws Exception {
+		if (logger.isDebugEnabled()) {
+			logger.debug("execute(D00009BaseModel) - start");
+		}
+
+		if(UtilTools.isNullOrBlank(model.getA_systemhead().getTransCode())){
+			model.getA_systemhead().setTransCode("D00009");
+		}
+
+		Map inMap = new LinkedHashMap();
+		inMap.putAll(UtilTools.obj2Map(model.getA_systemhead()));
+		inMap.putAll(UtilTools.obj2Map(model.getA_d00009()));
+		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_D00009 d_d00009 =  UtilTools.map2Obj(outMap, D_D00009.class);
+			model.setD_systemhead(d_systemhead);
+			model.setD_d00009(d_d00009);
+
+
+		}
+
+		if (logger.isDebugEnabled()) {
+			logger.debug("execute(D00009BaseModel) - end");
+		}
+
+        this.respInfo=respInfo;
+
+		return respInfo;
+	}
+
+
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public D00009BaseModel execute(D00009BaseModel model) throws Exception {
+		return this.execute(model,null,null);
+	}
+
+
+}

+ 51 - 0
generated/com/miniframe/generate/comm/system/A_D00009.java

@@ -0,0 +1,51 @@
+/**
+ * 系统服务
+ */
+package com.miniframe.generate.comm.system;
+import com.miniframe.core.BaseMapModel;
+import java.io.Serializable;
+/**
+ * 灾情结果文件获取
+ */
+public class A_D00009 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;
+	}
+	String stype;//灾情类型
+	/**
+	 *灾情类型
+	 */
+	public void setStype(String stype) {
+		this.stype=stype;
+	}
+	/**
+	 *灾情类型
+	 */
+	public String getStype() {
+		return this.stype;
+	}
+	int step;//文件步数
+	/**
+	 *文件步数
+	 */
+	public void setStep(int step) {
+		this.step=step;
+	}
+	/**
+	 *文件步数
+	 */
+	public int getStep() {
+		return this.step;
+	}
+}

+ 25 - 0
generated/com/miniframe/generate/comm/system/D_D00009.java

@@ -0,0 +1,25 @@
+/**
+ * 系统服务
+ */
+package com.miniframe.generate.comm.system;
+import com.miniframe.core.BaseMapModel;
+import java.io.Serializable;
+/**
+ * 灾情结果文件获取
+ */
+public class D_D00009 extends BaseMapModel implements Serializable {
+	private static final long serialVersionUID = -1463838678425832212L;
+	String id;//文件id
+	/**
+	 *文件id
+	 */
+	public void setId(String id) {
+		this.id=id;
+	}
+	/**
+	 *文件id
+	 */
+	public String getId() {
+		return this.id;
+	}
+}

+ 18 - 0
generated/validateform/a_d00009Form.xml

@@ -0,0 +1,18 @@
+<?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_d00009Form">
+<field property="aid" depends="required">
+    <arg0 key="a_d00009.aid"/>
+</field>
+<field property="stype" depends="required">
+    <arg0 key="a_d00009.stype"/>
+</field>
+<field property="step" depends="required">
+    <arg0 key="a_d00009.step"/>
+</field>
+</form>
+</formset>
+</form-validation>

+ 22 - 0
generated/validateform/d_d00009Form.xml

@@ -0,0 +1,22 @@
+<?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="d_d00009Form">
+<field property="id" depends="required,minlength,maxlength">
+    <arg0 key="d_d00009.id"/>
+    <arg1 name="minlength" key="${var:minlength}"/>
+    <var>
+      <var-name>minlength</var-name>
+      <var-value>1</var-value>
+    </var>
+    <arg1 name="maxlength" key="${var:maxlength}"/>
+    <var>
+      <var-name>maxlength</var-name>
+      <var-value>256</var-value>
+    </var>
+</field>
+</form>
+</formset>
+</form-validation>

+ 4 - 0
generated/validator/resources_a_d00009Form_validator.properties

@@ -0,0 +1,4 @@
+a_d00009.aid = \u4E8B\u6545ID
+a_d00009.stype = \u707E\u60C5\u7C7B\u578B
+a_d00009.step = \u6587\u4EF6\u6B65\u6570
+a_d00009Form = true

+ 4 - 0
generated/validator/resources_a_d00009Form_validator_zh_CN.properties

@@ -0,0 +1,4 @@
+a_d00009.aid = \u4E8B\u6545ID
+a_d00009.stype = \u707E\u60C5\u7C7B\u578B
+a_d00009.step = \u6587\u4EF6\u6B65\u6570
+a_d00009Form = true

+ 2 - 0
generated/validator/resources_d_d00009Form_validator.properties

@@ -0,0 +1,2 @@
+d_d00009.id = \u6587\u4EF6id
+d_d00009Form = true

+ 2 - 0
generated/validator/resources_d_d00009Form_validator_zh_CN.properties

@@ -0,0 +1,2 @@
+d_d00009.id = \u6587\u4EF6id
+d_d00009Form = true

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

@@ -0,0 +1,75 @@
+package com.miniframe.bisiness.system;
+
+import java.nio.file.Path;
+import java.util.Map;
+import com.miniframe.core.ExecProcessFlow;
+import com.miniframe.core.exception.BusinessException;
+import com.miniframe.core.ext.UtilTools;
+import com.miniframe.generate.business.system.model.D00009BaseModel;
+import com.miniframe.httpserver.HttpServerTransFile;
+import com.miniframe.model.system.SysFile;
+import com.miniframe.model.system.dao.SysFileMapper;
+import com.miniframe.template.TemplateGenerator;
+import com.miniframe.tools.XIFileUtils;
+import com.miniframe.utils.MFMimeTypeUtils;
+
+/**
+ * 基础系统,“灾情文件获取”逻辑处理(重新生成不覆盖)。
+ */
+public class D00009Service extends D00009BaseModel implements ExecProcessFlow {
+	
+	private static final long serialVersionUID = -7051358269847459502L;
+		
+	/**
+	 * 基础系统,“灾情文件获取”业务核心处理
+ 	 */
+	public void transExecute() throws Exception {
+		Integer aid= getA_d00009().getAid();
+		Integer step =getA_d00009().getStep();
+		String  stype =getA_d00009().getStype();
+
+//		String id = getA_b00022().getId();
+		String outPath="";
+		String fileName ="";
+		if(stype.endsWith("Fire")){
+			outPath=TemplateGenerator.BPATH+"/"+aid+"/fire/out";
+			fileName ="POST"+step+"/.vtk";
+		}
+		if(stype.endsWith("Warter")){
+			outPath=TemplateGenerator.BPATH+"/"+aid+"/warter/out";
+			fileName ="Post"+step+"/.vtk";
+		}
+		Path path = XIFileUtils.getAbsolutePath(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();
+	}
+
+}

+ 2 - 2
src/main/java/com/miniframe/template/TemplateGenerator.java

@@ -121,7 +121,7 @@ public class TemplateGenerator {
         StringWriter writer = new StringWriter();
         template.process(dataModel, writer);
         // 输出结果到控制台或保存为文件
-        System.out.println(writer.toString());
+//        System.out.println(writer.toString());
 
         FileWriter fileWriter =new FileWriter(BPATH+"/"+aid+"/water"+"/"+"water.init");
         fileWriter.write(writer.toString());
@@ -236,7 +236,7 @@ public class TemplateGenerator {
         StringWriter writer = new StringWriter();
         template.process(dataModel, writer);
         // 输出结果到控制台或保存为文件
-        System.out.println(writer.toString());
+//        System.out.println(writer.toString());
 
         FileWriter fileWriter =new FileWriter(BPATH+"/"+aid+"/fire"+"/"+"Fire.init");
         fileWriter.write(writer.toString());

+ 44 - 0
src/test/java/com/miniframe/comm/httpclientapater/D00009Test.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_D00009;
+import com.miniframe.generate.comm.httpclientapater.D00009Client;
+import com.miniframe.generate.business.system.model.D00009BaseModel;
+
+public class D00009Test {
+
+	private static final Logger logger = LoggerFactory.getLogger(D00009Test.class);
+
+	/**
+	 * 灾情结果文件获取,获取报文体
+	 * @return
+	 */
+	public static A_D00009 getA_d00009() {
+		A_D00009 a_d00009 = new A_D00009();
+
+		// ----------以下增加【灾情结果文件获取】上行体赋值-------------
+
+
+
+		// ---------------------------------------------------
+		return a_d00009;
+	}
+	
+	/**
+	 * 运行客户端测试,灾情结果文件获取
+	 * 
+	 * @param args
+	 * @throws Exception
+	 */
+	public static void main(String[] args) throws Exception {
+		D00009BaseModel model = new D00009BaseModel();
+		model.setA_systemhead(HttpclientapaterUtil.getA_systemhead("D00009"));
+		model.setA_d00009(D00009Test.getA_d00009());
+		D00009Client client = new D00009Client();
+		logger.error("客户端发送前总线:\r\n"+model);
+		model = client.execute(model);
+		logger.error("客户端发送后总线:\r\n"+model);
+	}
+}

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

@@ -30,4 +30,5 @@
 300006,D00006,灾情源检测数据添加,service,,
 300007,D00007,灾情源检测数据查询,service,,
 
-300008,D00008,灾情演练,service,,
+300008,D00008,灾情演练,service,,
+300008,D00009,灾情文件获取,service,,

+ 4 - 0
系统设计/通信设计/通讯报文/system(系统服务)/报文体/D00009_A(灾情结果文件获取).csv

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

+ 2 - 0
系统设计/通信设计/通讯报文/system(系统服务)/报文体/D00009_D(灾情结果文件获取).csv

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