AC00010Client.java 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. package com.miniframe.generate.comm.httpesapater;
  2. import com.miniframe.spring.httpclient.MFHttpRespInfo;
  3. import org.slf4j.Logger;
  4. import org.slf4j.LoggerFactory;
  5. import java.util.LinkedHashMap;
  6. import java.util.Map;
  7. import com.miniframe.core.Transmitter;
  8. import com.miniframe.core.ext.UtilTools;
  9. import com.miniframe.generate.comm.ac.D_AC00010;
  10. import com.miniframe.generate.comm.ac.D_ACHEAD;
  11. import com.miniframe.generate.business.ac.model.AC00010BaseModel;
  12. public class AC00010Client {
  13. private static final Logger logger = LoggerFactory.getLogger(AC00010Client.class);
  14. private MFHttpRespInfo respInfo;
  15. public MFHttpRespInfo getRespInfo(){
  16. return respInfo;
  17. }
  18. /**
  19. * 调用 [气动设计->结果曲线查询((AC00010)]的通讯接口
  20. * @param model 接口模型
  21. * @param extMap 扩展输入
  22. * @param url 请求地址
  23. * @return model 接口模型
  24. * @throws Exception
  25. */
  26. @SuppressWarnings({ "rawtypes", "unchecked" })
  27. public AC00010BaseModel execute(AC00010BaseModel model,final Map extMap,final String url) throws Exception {
  28. this.executeToRespInfo(model,extMap,url);
  29. return model;
  30. }
  31. @SuppressWarnings({ "rawtypes", "unchecked" })
  32. public AC00010BaseModel execute(AC00010BaseModel model,final Map extMap) throws Exception {
  33. this.executeToRespInfo(model,extMap,null);
  34. return model;
  35. }
  36. @SuppressWarnings({ "rawtypes", "unchecked" })
  37. public MFHttpRespInfo executeToRespInfo(AC00010BaseModel model,final Map extMap,final String url) throws Exception {
  38. if (logger.isDebugEnabled()) {
  39. logger.debug("execute(AC00010BaseModel) - start");
  40. }
  41. if(UtilTools.isNullOrBlank(model.getA_achead().getTransCode())){
  42. model.getA_achead().setTransCode("AC00010");
  43. }
  44. Map inMap = new LinkedHashMap();
  45. inMap.putAll(UtilTools.obj2Map(model.getA_achead()));
  46. inMap.putAll(UtilTools.obj2Map(model.getA_ac00010()));
  47. if(extMap!=null && extMap.size()>0){
  48. inMap.putAll(extMap);
  49. }
  50. Transmitter httpesApater = (Transmitter) UtilTools.getBean("httpesApater");
  51. MFHttpRespInfo respInfo;
  52. if(UtilTools.isNotNullAndBlank(url)){
  53. respInfo = httpesApater.doPostDataToRespInfo(inMap,url);
  54. }else{
  55. respInfo = httpesApater.doPostDataToRespInfo(inMap);
  56. }
  57. if(respInfo!=null) {
  58. Map outMap=respInfo.getParamMap();
  59. D_ACHEAD d_achead = UtilTools.map2Obj(outMap, D_ACHEAD.class);
  60. D_AC00010 d_ac00010 = UtilTools.map2Obj(outMap, D_AC00010.class);
  61. model.setD_achead(d_achead);
  62. model.setD_ac00010(d_ac00010);
  63. }
  64. if (logger.isDebugEnabled()) {
  65. logger.debug("execute(AC00010BaseModel) - end");
  66. }
  67. this.respInfo=respInfo;
  68. return respInfo;
  69. }
  70. @SuppressWarnings({ "rawtypes", "unchecked" })
  71. public AC00010BaseModel execute(AC00010BaseModel model) throws Exception {
  72. return this.execute(model,null,null);
  73. }
  74. }