瀏覽代碼

后处理消息

huangxingxing 2 年之前
父節點
當前提交
4f8e40aad0

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

@@ -34,3 +34,4 @@ INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('C0
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D00001', '基础系统','HCFDUgrid绑定',true);
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('D00002', '基础系统','HCFDMapbc绑定',true);
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('AFT001', '基础系统','后处理消息发送',true);
+INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('AFT002', '基础系统','获取步数',true);

+ 112 - 0
generated/com/miniframe/generate/business/system/model/AFT002BaseModel.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_AFT002;
+import com.miniframe.generate.comm.system.D_AFT002;
+
+/**
+ * 系统服务,“求解步数”模型类(不要维护,重新生成将覆盖)。
+ */
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class AFT002BaseModel extends BaseMapModel {
+
+	private static final long serialVersionUID = -1326184831746814093L;
+
+	A_SYSTEMHEAD a_systemhead;//上行头
+	D_SYSTEMHEAD d_systemhead;//下行头
+	A_AFT002 a_aft002;//上行体
+	D_AFT002 d_aft002;//下行体
+
+	public AFT002BaseModel(){
+		a_systemhead=new A_SYSTEMHEAD();
+		d_systemhead=new D_SYSTEMHEAD();
+		a_aft002=new A_AFT002();
+		d_aft002=new D_AFT002();
+	}
+
+	public void validater() throws Exception {
+		this.a_systemhead.validater();
+		this.a_aft002.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_AFT002.class);
+		this.a_aft002 = UtilTools.map2Obj(bodyMap, A_AFT002.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_aft002));
+
+		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_AFT002 getA_aft002() {
+		return a_aft002;
+	}
+
+	public void setA_aft002(A_AFT002 a_aft002) {
+		this.a_aft002=a_aft002;
+	}
+
+	public D_AFT002 getD_aft002() {
+		return this.d_aft002;
+	}
+
+	public void setD_aft002(D_AFT002 d_aft002) {
+		this.d_aft002=d_aft002;
+	}
+
+	@Override
+	public String toString() {
+		try {
+			return UtilTools.obj2Json(this,true);
+		} catch (IOException e) {
+			return "";
+		}
+	}
+}

+ 99 - 0
generated/com/miniframe/generate/comm/httpclientapater/AFT002Client.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_AFT002;
+import com.miniframe.generate.comm.system.D_SYSTEMHEAD;
+
+import com.miniframe.generate.business.system.model.AFT002BaseModel;
+
+public class AFT002Client {
+
+	private static final Logger logger = LoggerFactory.getLogger(AFT002Client.class);
+	private MFHttpRespInfo respInfo;
+
+	public MFHttpRespInfo getRespInfo(){
+		return respInfo;
+	}
+
+	/**
+	 * 调用 [系统服务->求解步数((AFT002)]的通讯接口
+	 * @param model 接口模型
+	 * @param extMap 扩展输入
+	 * @param url 请求地址
+	 * @return model 接口模型
+	 * @throws Exception
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public AFT002BaseModel execute(AFT002BaseModel model,final Map extMap,final String url) throws Exception {
+		this.executeToRespInfo(model,extMap,url);
+		return model;
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public AFT002BaseModel execute(AFT002BaseModel model,final Map extMap) throws Exception {
+		this.executeToRespInfo(model,extMap,null);
+		return model;
+	}
+
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public MFHttpRespInfo executeToRespInfo(AFT002BaseModel model,final Map extMap,final String url) throws Exception {
+		if (logger.isDebugEnabled()) {
+			logger.debug("execute(AFT002BaseModel) - start");
+		}
+
+		if(UtilTools.isNullOrBlank(model.getA_systemhead().getTransCode())){
+			model.getA_systemhead().setTransCode("AFT002");
+		}
+
+		Map inMap = new LinkedHashMap();
+		inMap.putAll(UtilTools.obj2Map(model.getA_systemhead()));
+		inMap.putAll(UtilTools.obj2Map(model.getA_aft002()));
+		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_AFT002 d_aft002 =  UtilTools.map2Obj(outMap, D_AFT002.class);
+			model.setD_systemhead(d_systemhead);
+			model.setD_aft002(d_aft002);
+
+
+		}
+
+		if (logger.isDebugEnabled()) {
+			logger.debug("execute(AFT002BaseModel) - end");
+		}
+
+        this.respInfo=respInfo;
+
+		return respInfo;
+	}
+
+
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public AFT002BaseModel execute(AFT002BaseModel model) throws Exception {
+		return this.execute(model,null,null);
+	}
+
+
+}

+ 64 - 0
generated/com/miniframe/generate/comm/system/A_AFT002.java

@@ -0,0 +1,64 @@
+/**
+ * 系统服务
+ */
+package com.miniframe.generate.comm.system;
+import com.miniframe.core.BaseMapModel;
+import java.io.Serializable;
+/**
+ * 求解步数
+ */
+public class A_AFT002 extends BaseMapModel implements Serializable {
+	private static final long serialVersionUID = -1463838678425832212L;
+	String pid;//项目ID
+	/**
+	 *项目ID
+	 */
+	public void setPid(String pid) {
+		this.pid=pid;
+	}
+	/**
+	 *项目ID
+	 */
+	public String getPid() {
+		return this.pid;
+	}
+	String solverConfigId;//求解配置Id
+	/**
+	 *求解配置Id
+	 */
+	public void setSolverConfigId(String solverConfigId) {
+		this.solverConfigId=solverConfigId;
+	}
+	/**
+	 *求解配置Id
+	 */
+	public String getSolverConfigId() {
+		return this.solverConfigId;
+	}
+	String action;//操作
+	/**
+	 *操作
+	 */
+	public void setAction(String action) {
+		this.action=action;
+	}
+	/**
+	 *操作
+	 */
+	public String getAction() {
+		return this.action;
+	}
+	String paramJson;//操作参数
+	/**
+	 *操作参数
+	 */
+	public void setParamJson(String paramJson) {
+		this.paramJson=paramJson;
+	}
+	/**
+	 *操作参数
+	 */
+	public String getParamJson() {
+		return this.paramJson;
+	}
+}

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

@@ -0,0 +1,25 @@
+/**
+ * 系统服务
+ */
+package com.miniframe.generate.comm.system;
+import com.miniframe.core.BaseMapModel;
+import java.io.Serializable;
+/**
+ * 求解步数
+ */
+public class D_AFT002 extends BaseMapModel implements Serializable {
+	private static final long serialVersionUID = -1463838678425832212L;
+	String steps;//求解步数
+	/**
+	 *求解步数
+	 */
+	public void setSteps(String steps) {
+		this.steps=steps;
+	}
+	/**
+	 *求解步数
+	 */
+	public String getSteps() {
+		return this.steps;
+	}
+}

+ 48 - 0
generated/validateform/a_aft002Form.xml

@@ -0,0 +1,48 @@
+<?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_aft002Form">
+<field property="pid" depends="minlength,maxlength">
+    <arg0 key="a_aft002.pid"/>
+    <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>1024</var-value>
+    </var>
+</field>
+<field property="action" depends="minlength,maxlength">
+    <arg0 key="a_aft002.action"/>
+    <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>2048</var-value>
+    </var>
+</field>
+<field property="paramJson" depends="minlength,maxlength">
+    <arg0 key="a_aft002.paramJson"/>
+    <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>128</var-value>
+    </var>
+</field>
+</form>
+</formset>
+</form-validation>

+ 22 - 0
generated/validateform/d_aft002Form.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_aft002Form">
+<field property="steps" depends="minlength,maxlength">
+    <arg0 key="d_aft002.steps"/>
+    <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>1024</var-value>
+    </var>
+</field>
+</form>
+</formset>
+</form-validation>

+ 5 - 0
generated/validator/resources_a_aft002Form_validator.properties

@@ -0,0 +1,5 @@
+a_aft002.pid = \u9879\u76EEID
+a_aft002.solverConfigId = \u6C42\u89E3\u914D\u7F6EId
+a_aft002.action = \u64CD\u4F5C
+a_aft002.paramJson = \u64CD\u4F5C\u53C2\u6570
+a_aft002Form = true

+ 5 - 0
generated/validator/resources_a_aft002Form_validator_zh_CN.properties

@@ -0,0 +1,5 @@
+a_aft002.pid = \u9879\u76EEID
+a_aft002.solverConfigId = \u6C42\u89E3\u914D\u7F6EId
+a_aft002.action = \u64CD\u4F5C
+a_aft002.paramJson = \u64CD\u4F5C\u53C2\u6570
+a_aft002Form = true

+ 2 - 0
generated/validator/resources_d_aft002Form_validator.properties

@@ -0,0 +1,2 @@
+d_aft002.steps = \u6C42\u89E3\u6B65\u6570
+d_aft002Form = true

+ 2 - 0
generated/validator/resources_d_aft002Form_validator_zh_CN.properties

@@ -0,0 +1,2 @@
+d_aft002.steps = \u6C42\u89E3\u6B65\u6570
+d_aft002Form = true

+ 53 - 0
src/main/java/com/miniframe/bisiness/system/AFT002Service.java

@@ -0,0 +1,53 @@
+package com.miniframe.bisiness.system;
+
+import java.util.Map;
+import com.miniframe.core.ExecProcessFlow;
+import com.miniframe.generate.business.system.model.AFT002BaseModel;
+
+/**
+ * 基础系统,“获取步数”逻辑处理(重新生成不覆盖)。
+ */
+public class AFT002Service extends AFT002BaseModel implements ExecProcessFlow {
+	
+	private static final long serialVersionUID = -7051358269847459502L;
+		
+	/**
+	 * 基础系统,“获取步数”业务核心处理
+	 *
+ 	 */
+	public void transExecute() throws Exception {
+		String usrId =this.getA_systemhead().getUserId();
+		String solverConfigId =getA_aft002().getSolverConfigId();
+		String proId =getA_aft002().getPid();
+		String steps ="10,20,30,40";
+		this.getD_aft002().setSteps(steps);
+	}
+	
+	/**
+	 * 基础系统,“获取步数”业务前处理
+ 	 */
+	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/AFT002Test.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_AFT002;
+import com.miniframe.generate.comm.httpclientapater.AFT002Client;
+import com.miniframe.generate.business.system.model.AFT002BaseModel;
+
+public class AFT002Test {
+
+	private static final Logger logger = LoggerFactory.getLogger(AFT002Test.class);
+
+	/**
+	 * 求解步数,获取报文体
+	 * @return
+	 */
+	public static A_AFT002 getA_aft002() {
+		A_AFT002 a_aft002 = new A_AFT002();
+
+		// ----------以下增加【求解步数】上行体赋值-------------
+
+
+
+		// ---------------------------------------------------
+		return a_aft002;
+	}
+	
+	/**
+	 * 运行客户端测试,求解步数
+	 * 
+	 * @param args
+	 * @throws Exception
+	 */
+	public static void main(String[] args) throws Exception {
+		AFT002BaseModel model = new AFT002BaseModel();
+		model.setA_systemhead(HttpclientapaterUtil.getA_systemhead("AFT002"));
+		model.setA_aft002(AFT002Test.getA_aft002());
+		AFT002Client client = new AFT002Client();
+		logger.error("客户端发送前总线:\r\n"+model);
+		model = client.execute(model);
+		logger.error("客户端发送后总线:\r\n"+model);
+	}
+}

+ 5 - 0
系统设计/通信设计/通讯报文/system(系统服务)/报文体/AFT002_A(求解步数).csv

@@ -0,0 +1,5 @@
+序号,英文名称,中文名称,数据类型,默认值,格式化,非空/引用,最小(长度/值),最大(长度/值),验证规则,标准数据ID,XML样式,TAG标签,映射/子标签,CDATA
+1,pid,项目ID,string,,,,1,1024,,,,,,
+2,solverConfigId,求解配置Id,string,,,,,,,,,,,
+3,action,操作,string,,,,1,2048,,,,,,
+4,paramJson,操作参数,string,,,,1,128,,,,,,

+ 3 - 0
系统设计/通信设计/通讯报文/system(系统服务)/报文体/AFT002_D(求解步数).csv

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