Forráskód Böngészése

项目组件属性值处理

huangxingxing 3 hónapja
szülő
commit
7d89be6b38

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

@@ -13,6 +13,7 @@ INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('ES
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('ES0009', '无锡发动机','项目组件属性查询',true);
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('ES0010', '无锡发动机','项目组件属性值数据查询',true);
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('ES0011', '无锡发动机','项目组件属性值数据添加修改',true);
+INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('ES0012', '无锡发动机','项目模拟数据组件属性查询',true);
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('ES1001', '无锡发动机','组件查询',true);
 -- 基础系统
 INSERT INTO SYS_FUNCTION(FUNCTIONID, CLASSNAME, FUNCTIONNAME ,ENABLE)VALUES ('A00000', '基础系统','获取图片验证码',true);

+ 112 - 0
generated/com/miniframe/generate/business/es/model/ES0012BaseModel.java

@@ -0,0 +1,112 @@
+package com.miniframe.generate.business.es.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.es.A_ESHEAD;
+import com.miniframe.generate.comm.es.D_ESHEAD;
+import com.miniframe.generate.comm.es.A_ES0012;
+import com.miniframe.generate.comm.es.D_ES0012;
+
+/**
+ * 无锡发动机,“项目模拟数据组件属性查询”模型类(不要维护,重新生成将覆盖)。
+ */
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class ES0012BaseModel extends BaseMapModel {
+
+	private static final long serialVersionUID = -1326184831746814093L;
+
+	A_ESHEAD a_eshead;//上行头
+	D_ESHEAD d_eshead;//下行头
+	A_ES0012 a_es0012;//上行体
+	D_ES0012 d_es0012;//下行体
+
+	public ES0012BaseModel(){
+		a_eshead=new A_ESHEAD();
+		d_eshead=new D_ESHEAD();
+		a_es0012=new A_ES0012();
+		d_es0012=new D_ES0012();
+	}
+
+	public void validater() throws Exception {
+		this.a_eshead.validater();
+		this.a_es0012.validater();
+	}
+
+	public void setTransMap(Map map) throws Exception {
+		Map headMap = HttpMapFormater.format(map, A_ESHEAD.class);
+		this.a_eshead = UtilTools.map2Obj(headMap, A_ESHEAD.class);
+		Map bodyMap = HttpMapFormater.format(map, A_ES0012.class);
+		this.a_es0012 = UtilTools.map2Obj(bodyMap, A_ES0012.class);
+	}
+
+	public Map getTransMap() throws Exception {
+		Map reMap = new LinkedHashMap();
+
+		if(UtilTools.isNullOrBlank((this.d_eshead).getTransCode())){
+			(this.d_eshead).setTransCode((this.a_eshead).getTransCode());
+		}
+		if(UtilTools.isNullOrBlank((this.d_eshead).getChannelNo())){
+			(this.d_eshead).setChannelNo((this.a_eshead).getChannelNo());
+		}
+		if(UtilTools.isNullOrBlank((this.d_eshead).getUserId())){
+			(this.d_eshead).setUserId((this.a_eshead).getUserId());
+		}
+        if(UtilTools.isNullOrBlank((this.d_eshead).getTransTime())){
+            (this.d_eshead).setTransTime(DateTimeFormatter.ofPattern(AppGlobalVariableSysconfig.DATETIMEFORMAT).format(ZonedDateTime.now()));
+        }
+
+		reMap.putAll(UtilTools.obj2Map(this.d_eshead));
+		reMap.putAll(UtilTools.obj2Map(this.d_es0012));
+
+		return reMap;
+	}
+
+	public A_ESHEAD getA_eshead() {
+		return this.a_eshead;
+	}
+
+	public void setA_eshead(A_ESHEAD a_eshead) {
+		this.a_eshead=a_eshead;
+	}
+
+	public D_ESHEAD getD_eshead() {
+		return d_eshead;
+	}
+
+	public void setD_eshead(D_ESHEAD d_eshead) {
+		this.d_eshead=d_eshead;
+	}
+
+	public A_ES0012 getA_es0012() {
+		return a_es0012;
+	}
+
+	public void setA_es0012(A_ES0012 a_es0012) {
+		this.a_es0012=a_es0012;
+	}
+
+	public D_ES0012 getD_es0012() {
+		return this.d_es0012;
+	}
+
+	public void setD_es0012(D_ES0012 d_es0012) {
+		this.d_es0012=d_es0012;
+	}
+
+	@Override
+	public String toString() {
+		try {
+			return UtilTools.obj2Json(this,true);
+		} catch (IOException e) {
+			return "";
+		}
+	}
+}

+ 25 - 0
generated/com/miniframe/generate/comm/es/A_ES0012.java

@@ -0,0 +1,25 @@
+/**
+ * 无锡发动机
+ */
+package com.miniframe.generate.comm.es;
+import com.miniframe.core.BaseMapModel;
+import java.io.Serializable;
+/**
+ * 项目模拟数据组件属性查询
+ */
+public class A_ES0012 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;
+	}
+}

+ 26 - 0
generated/com/miniframe/generate/comm/es/D_ES0012.java

@@ -0,0 +1,26 @@
+/**
+ * 无锡发动机
+ */
+package com.miniframe.generate.comm.es;
+import com.miniframe.core.BaseMapModel;
+import java.io.Serializable;
+import java.util.*;
+/**
+ * 项目模拟数据组件属性查询
+ */
+public class D_ES0012 extends BaseMapModel implements Serializable {
+	private static final long serialVersionUID = -1463838678425832212L;
+	List <D_ES0012_ROWS_RECODE> rows;//数据
+	/**
+	 *数据
+	 */
+	public void setRows(List <D_ES0012_ROWS_RECODE> rows) {
+		this.rows=rows;
+	}
+	/**
+	 *数据
+	 */
+	public List <D_ES0012_ROWS_RECODE> getRows() {
+		return this.rows;
+	}
+}

+ 129 - 0
generated/com/miniframe/generate/comm/es/D_ES0012_ROWS_RECODE.java

@@ -0,0 +1,129 @@
+/**
+ * 无锡发动机
+ */
+package com.miniframe.generate.comm.es;
+import com.miniframe.core.BaseMapModel;
+import java.io.Serializable;
+/**
+ * 项目模拟数据组件属性查询->数据
+ */
+public class D_ES0012_ROWS_RECODE extends BaseMapModel implements Serializable {
+	private static final long serialVersionUID = -1463838678425832212L;
+	String pcaId;//项目组件属性ID
+	/**
+	 *项目组件属性ID
+	 */
+	public void setPcaId(String pcaId) {
+		this.pcaId=pcaId;
+	}
+	/**
+	 *项目组件属性ID
+	 */
+	public String getPcaId() {
+		return this.pcaId;
+	}
+	String value;//数值
+	/**
+	 *数值
+	 */
+	public void setValue(String value) {
+		this.value=value;
+	}
+	/**
+	 *数值
+	 */
+	public String getValue() {
+		return this.value;
+	}
+	String unit;//单位
+	/**
+	 *单位
+	 */
+	public void setUnit(String unit) {
+		this.unit=unit;
+	}
+	/**
+	 *单位
+	 */
+	public String getUnit() {
+		return this.unit;
+	}
+	String unitType;//单位类型
+	/**
+	 *单位类型
+	 */
+	public void setUnitType(String unitType) {
+		this.unitType=unitType;
+	}
+	/**
+	 *单位类型
+	 */
+	public String getUnitType() {
+		return this.unitType;
+	}
+	String name;//属性名称
+	/**
+	 *属性名称
+	 */
+	public void setName(String name) {
+		this.name=name;
+	}
+	/**
+	 *属性名称
+	 */
+	public String getName() {
+		return this.name;
+	}
+	String code;//属性编码
+	/**
+	 *属性编码
+	 */
+	public void setCode(String code) {
+		this.code=code;
+	}
+	/**
+	 *属性编码
+	 */
+	public String getCode() {
+		return this.code;
+	}
+	int valueType;//值类型
+	/**
+	 *值类型
+	 */
+	public void setValueType(int valueType) {
+		this.valueType=valueType;
+	}
+	/**
+	 *值类型
+	 */
+	public int getValueType() {
+		return this.valueType;
+	}
+	String valueDef;//默认值
+	/**
+	 *默认值
+	 */
+	public void setValueDef(String valueDef) {
+		this.valueDef=valueDef;
+	}
+	/**
+	 *默认值
+	 */
+	public String getValueDef() {
+		return this.valueDef;
+	}
+	int dataType;//值数据类型
+	/**
+	 *值数据类型
+	 */
+	public void setDataType(int dataType) {
+		this.dataType=dataType;
+	}
+	/**
+	 *值数据类型
+	 */
+	public int getDataType() {
+		return this.dataType;
+	}
+}

+ 99 - 0
generated/com/miniframe/generate/comm/httpesapater/ES0012Client.java

@@ -0,0 +1,99 @@
+package com.miniframe.generate.comm.httpesapater;
+
+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.es.D_ES0012;
+import com.miniframe.generate.comm.es.D_ESHEAD;
+
+import com.miniframe.generate.business.es.model.ES0012BaseModel;
+
+public class ES0012Client {
+
+	private static final Logger logger = LoggerFactory.getLogger(ES0012Client.class);
+	private MFHttpRespInfo respInfo;
+
+	public MFHttpRespInfo getRespInfo(){
+		return respInfo;
+	}
+
+	/**
+	 * 调用 [无锡发动机->项目模拟数据组件属性查询((ES0012)]的通讯接口
+	 * @param model 接口模型
+	 * @param extMap 扩展输入
+	 * @param url 请求地址
+	 * @return model 接口模型
+	 * @throws Exception
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public ES0012BaseModel execute(ES0012BaseModel model,final Map extMap,final String url) throws Exception {
+		this.executeToRespInfo(model,extMap,url);
+		return model;
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public ES0012BaseModel execute(ES0012BaseModel model,final Map extMap) throws Exception {
+		this.executeToRespInfo(model,extMap,null);
+		return model;
+	}
+
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public MFHttpRespInfo executeToRespInfo(ES0012BaseModel model,final Map extMap,final String url) throws Exception {
+		if (logger.isDebugEnabled()) {
+			logger.debug("execute(ES0012BaseModel) - start");
+		}
+
+		if(UtilTools.isNullOrBlank(model.getA_eshead().getTransCode())){
+			model.getA_eshead().setTransCode("ES0012");
+		}
+
+		Map inMap = new LinkedHashMap();
+		inMap.putAll(UtilTools.obj2Map(model.getA_eshead()));
+		inMap.putAll(UtilTools.obj2Map(model.getA_es0012()));
+		if(extMap!=null && extMap.size()>0){
+			inMap.putAll(extMap);
+		}
+
+		Transmitter httpesApater = (Transmitter) UtilTools.getBean("httpesApater");
+		MFHttpRespInfo respInfo;
+		if(UtilTools.isNotNullAndBlank(url)){
+			respInfo = httpesApater.doPostDataToRespInfo(inMap,url);
+		}else{
+			respInfo = httpesApater.doPostDataToRespInfo(inMap);
+		}
+
+		if(respInfo!=null) {
+			Map outMap=respInfo.getParamMap();
+			D_ESHEAD d_eshead =  UtilTools.map2Obj(outMap, D_ESHEAD.class);
+			D_ES0012 d_es0012 =  UtilTools.map2Obj(outMap, D_ES0012.class);
+			model.setD_eshead(d_eshead);
+			model.setD_es0012(d_es0012);
+
+
+		}
+
+		if (logger.isDebugEnabled()) {
+			logger.debug("execute(ES0012BaseModel) - end");
+		}
+
+        this.respInfo=respInfo;
+
+		return respInfo;
+	}
+
+
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public ES0012BaseModel execute(ES0012BaseModel model) throws Exception {
+		return this.execute(model,null,null);
+	}
+
+
+}

+ 12 - 0
generated/validateform/a_es0012Form.xml

@@ -0,0 +1,12 @@
+<?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_es0012Form">
+<field property="pid" depends="required">
+    <arg0 key="a_es0012.pid"/>
+</field>
+</form>
+</formset>
+</form-validation>

+ 2 - 0
generated/validator/resources_a_es0012Form_validator.properties

@@ -0,0 +1,2 @@
+a_es0012.pid = \u9879\u76EEId
+a_es0012Form = true

+ 2 - 0
generated/validator/resources_a_es0012Form_validator_zh_CN.properties

@@ -0,0 +1,2 @@
+a_es0012.pid = \u9879\u76EEId
+a_es0012Form = true

+ 1 - 0
generated/validator/resources_d_es0012Form_validator.properties

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

+ 1 - 0
generated/validator/resources_d_es0012Form_validator_zh_CN.properties

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

+ 10 - 0
generated/validator/resources_d_es0012_rows_recodeForm_validator.properties

@@ -0,0 +1,10 @@
+d_es0012_rows_recode.pcaId = \u9879\u76EE\u7EC4\u4EF6\u5C5E\u6027ID
+d_es0012_rows_recode.value = \u6570\u503C
+d_es0012_rows_recode.unit = \u5355\u4F4D
+d_es0012_rows_recode.unitType = \u5355\u4F4D\u7C7B\u578B
+d_es0012_rows_recode.name = \u5C5E\u6027\u540D\u79F0
+d_es0012_rows_recode.code = \u5C5E\u6027\u7F16\u7801
+d_es0012_rows_recode.valueType = \u503C\u7C7B\u578B
+d_es0012_rows_recode.valueDef = \u9ED8\u8BA4\u503C
+d_es0012_rows_recode.dataType = \u503C\u6570\u636E\u7C7B\u578B
+d_es0012_rows_recodeForm = true

+ 10 - 0
generated/validator/resources_d_es0012_rows_recodeForm_validator_zh_CN.properties

@@ -0,0 +1,10 @@
+d_es0012_rows_recode.pcaId = \u9879\u76EE\u7EC4\u4EF6\u5C5E\u6027ID
+d_es0012_rows_recode.value = \u6570\u503C
+d_es0012_rows_recode.unit = \u5355\u4F4D
+d_es0012_rows_recode.unitType = \u5355\u4F4D\u7C7B\u578B
+d_es0012_rows_recode.name = \u5C5E\u6027\u540D\u79F0
+d_es0012_rows_recode.code = \u5C5E\u6027\u7F16\u7801
+d_es0012_rows_recode.valueType = \u503C\u7C7B\u578B
+d_es0012_rows_recode.valueDef = \u9ED8\u8BA4\u503C
+d_es0012_rows_recode.dataType = \u503C\u6570\u636E\u7C7B\u578B
+d_es0012_rows_recodeForm = true

+ 84 - 0
src/main/java/com/miniframe/bisiness/es/ES0012Service.java

@@ -0,0 +1,84 @@
+package com.miniframe.bisiness.es;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import com.miniframe.core.ExecProcessFlow;
+import com.miniframe.core.ext.UtilTools;
+import com.miniframe.generate.business.es.model.ES0012BaseModel;
+import com.miniframe.generate.comm.es.D_ES0009_ROWS_RECODE;
+import com.miniframe.generate.comm.es.D_ES0012_ROWS_RECODE;
+import com.miniframe.mappers.es.dao.EsMapper;
+import com.miniframe.mappers.es.model.ProComAttDto;
+import com.miniframe.model.es.EsProCom;
+import com.miniframe.model.es.EsProComSQLBuilder;
+import com.miniframe.model.es.dao.EsProComMapper;
+
+/**
+ * 无锡发动机,“项目模拟数据组件属性查询”逻辑处理(重新生成不覆盖)。
+ */
+public class ES0012Service extends ES0012BaseModel implements ExecProcessFlow {
+	
+	private static final long serialVersionUID = -7051358269847459502L;
+		
+	/**
+	 * 无锡发动机,“项目模拟数据组件属性查询”业务核心处理
+ 	 */
+	public void transExecute() throws Exception {
+		String pid = this.getA_es0012().getPid();
+		EsProComMapper pcdao = UtilTools.getBean(EsProComMapper.class);
+		EsProComSQLBuilder pcsb = new EsProComSQLBuilder();
+		EsProComSQLBuilder.Criteria pcsc = pcsb.createCriteria();
+		pcsc.andPidEqualTo(pid);
+		pcsc.andComIdEqualTo("-1");//模拟数据
+		List<EsProCom> proComs = pcdao.selectByExample(pcsb);
+		if(proComs!=null&&!proComs.isEmpty()){
+			EsProCom pc= proComs.get(0);
+			EsMapper esdao = UtilTools.getBean(EsMapper.class);
+			List<ProComAttDto> dtos = esdao.selectPrComAttList(pc.getPcId());
+			List<D_ES0012_ROWS_RECODE> rows = new ArrayList<>();
+			for (ProComAttDto dto:dtos) {
+				D_ES0012_ROWS_RECODE row = new D_ES0012_ROWS_RECODE();
+				row.setPcaId(dto.getPcaId());
+				row.setValue(dto.getValue());
+				row.setUnit(dto.getUnit());
+				row.setUnitType(dto.getUnitType());
+				row.setName(dto.getName());
+				row.setCode(dto.getCode());
+				row.setValueType(dto.getValueType());
+				row.setValueDef(dto.getValueDef());
+				row.setDataType(dto.getDataType()==null?-1: dto.getDataType());
+				rows.add(row);
+			}
+			this.getD_es0012().setRows(rows);
+		}
+	}
+	
+	/**
+	 * 无锡发动机,“项目模拟数据组件属性查询”业务前处理
+ 	 */
+	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/httpesapater/ES0012Test.java

@@ -0,0 +1,44 @@
+package com.miniframe.comm.httpesapater;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.miniframe.comm.httpesapater.HttpesapaterUtil;
+import com.miniframe.generate.comm.es.A_ES0012;
+import com.miniframe.generate.comm.httpesapater.ES0012Client;
+import com.miniframe.generate.business.es.model.ES0012BaseModel;
+
+public class ES0012Test {
+
+	private static final Logger logger = LoggerFactory.getLogger(ES0012Test.class);
+
+	/**
+	 * 项目模拟数据组件属性查询,获取报文体
+	 * @return
+	 */
+	public static A_ES0012 getA_es0012() {
+		A_ES0012 a_es0012 = new A_ES0012();
+
+		// ----------以下增加【项目模拟数据组件属性查询】上行体赋值-------------
+
+
+
+		// ---------------------------------------------------
+		return a_es0012;
+	}
+	
+	/**
+	 * 运行客户端测试,项目模拟数据组件属性查询
+	 * 
+	 * @param args
+	 * @throws Exception
+	 */
+	public static void main(String[] args) throws Exception {
+		ES0012BaseModel model = new ES0012BaseModel();
+		model.setA_eshead(HttpesapaterUtil.getA_eshead("ES0012"));
+		model.setA_es0012(ES0012Test.getA_es0012());
+		ES0012Client client = new ES0012Client();
+		logger.error("客户端发送前总线:\r\n"+model);
+		model = client.execute(model);
+		logger.error("客户端发送后总线:\r\n"+model);
+	}
+}

+ 1 - 0
系统设计/系统模块/ES(无锡发动机).csv

@@ -10,4 +10,5 @@
 100008,ES0009,项目组件属性查询,service,
 100010,ES0010,项目组件属性值数据查询,service,
 100011,ES0011,项目组件属性值数据添加修改,service,
+100011,ES0012,项目模拟数据组件属性查询,service,
 110001,ES1001,组件查询,service,

+ 2 - 0
系统设计/通信设计/通讯报文/es(无锡发动机)/报文体/ES0012_A(项目模拟数据组件属性查询).csv

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

+ 11 - 0
系统设计/通信设计/通讯报文/es(无锡发动机)/报文体/ES0012_D(项目模拟数据组件属性查询).csv

@@ -0,0 +1,11 @@
+"序号","英文名称","中文名称","数据类型","默认值","格式化","非空/引用","最小(长度/值)","最大(长度/值)","验证规则","标准数据ID","XML样式","TAG标签","映射/子标签","CDATA"
+1,rows,数据,list,,,,0,,,,,,,
+1.1,pcaId,项目组件属性ID,string,,,,,,,,,,,
+1.2,value,数值,string,,,,,,,,,,,
+1.3,unit,单位,string,,,,,,,,,,,
+1.4,unitType,单位类型,string,,,,,,,,,,,
+1.5,name,属性名称,string,,,,,,,,,,,
+1.6,code,属性编码,string,,,,,,,,,,,
+1.7,valueType,值类型,int,,,,,,,,,,,
+1.8,valueDef,默认值,string,,,,,,,,,,,
+1.9,dataType,值数据类型,int,,,,,,,,,,,