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.ac.D_AC00005; import com.miniframe.generate.comm.ac.D_ACHEAD; import com.miniframe.generate.business.ac.model.AC00005BaseModel; public class AC00005Client { private static final Logger logger = LoggerFactory.getLogger(AC00005Client.class); private MFHttpRespInfo respInfo; public MFHttpRespInfo getRespInfo(){ return respInfo; } /** * 调用 [气动设计->项目属性添加修改((AC00005)]的通讯接口 * @param model 接口模型 * @param extMap 扩展输入 * @param url 请求地址 * @return model 接口模型 * @throws Exception */ @SuppressWarnings({ "rawtypes", "unchecked" }) public AC00005BaseModel execute(AC00005BaseModel model,final Map extMap,final String url) throws Exception { this.executeToRespInfo(model,extMap,url); return model; } @SuppressWarnings({ "rawtypes", "unchecked" }) public AC00005BaseModel execute(AC00005BaseModel model,final Map extMap) throws Exception { this.executeToRespInfo(model,extMap,null); return model; } @SuppressWarnings({ "rawtypes", "unchecked" }) public MFHttpRespInfo executeToRespInfo(AC00005BaseModel model,final Map extMap,final String url) throws Exception { if (logger.isDebugEnabled()) { logger.debug("execute(AC00005BaseModel) - start"); } if(UtilTools.isNullOrBlank(model.getA_achead().getTransCode())){ model.getA_achead().setTransCode("AC00005"); } Map inMap = new LinkedHashMap(); inMap.putAll(UtilTools.obj2Map(model.getA_achead())); inMap.putAll(UtilTools.obj2Map(model.getA_ac00005())); 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_ACHEAD d_achead = UtilTools.map2Obj(outMap, D_ACHEAD.class); D_AC00005 d_ac00005 = UtilTools.map2Obj(outMap, D_AC00005.class); model.setD_achead(d_achead); model.setD_ac00005(d_ac00005); } if (logger.isDebugEnabled()) { logger.debug("execute(AC00005BaseModel) - end"); } this.respInfo=respInfo; return respInfo; } @SuppressWarnings({ "rawtypes", "unchecked" }) public AC00005BaseModel execute(AC00005BaseModel model) throws Exception { return this.execute(model,null,null); } }