Ver Fonte

凭证接口

pancy há 1 ano atrás
pai
commit
c1d3c09073

+ 4 - 0
gl/installpatch.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<installpatch>
+<copy><from>/replacement/modules/</from><to>/modules/</to></copy>
+</installpatch>

+ 23 - 0
gl/packmetadata.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<packmetadata>
+	<canAppliedMiddleware>Weblogic,Websphere 7.0,Yonyou Middleware V5,Yonyou Middleware V6</canAppliedMiddleware>
+	<canAppliedDB>DB2 V9.7,SQL Server 2008 R2,Oracle 10,Oracle 11</canAppliedDB>
+	<patchType>BUG修复补丁</patchType>
+	<modifiedJavaClasses>nc.bs.gl.impl.VoucherInsertImpl,nc.bs.servlet.service.BaseServlet</modifiedJavaClasses>
+	<description/>
+	<modifiedModules/>
+	<needRecreatedLoginJar>false</needRecreatedLoginJar>
+	<applyVersion>5.0,5.01,5.011,5.02,5.3,5.5,5.6,5.7,5.75,6.0,6.1,6.3</applyVersion>
+	<patchName>1</patchName>
+	<bugs/>
+	<provider>1</provider>
+	<patchPriority>高危补丁</patchPriority>
+	<patchVersion/>
+	<dependInfo/>
+	<canAppliedOS>Linux,Windows,AIX,Solaris</canAppliedOS>
+	<id>8324693f-30eb-424e-91d7-b53c8f29f120</id>
+	<time>2022-12-01 16:52:41</time>
+	<department>1</department>
+	<needDeploy>false</needDeploy>
+	<searchKeys/>
+</packmetadata>

+ 49 - 0
gl/readme.txt

@@ -0,0 +1,49 @@
+
+==============================================================================
+1)补丁基本信息
+==============================================================================
+
+	补丁名称 - 1
+	补丁编号 - 8324693f-30eb-424e-91d7-b53c8f29f120
+	产品版本 - 
+	补丁修改模块 - 
+	补丁依赖信息 - 
+	适用的中间件平台 - Weblogic,Websphere 7.0,Yonyou Middleware V5,Yonyou Middleware V6
+	适用的操作系统平台 - Linux,Windows,AIX,Solaris
+	适用的数据库平台 - DB2 V9.7,SQL Server 2008 R2,Oracle 10,Oracle 11
+	补丁创建时间 - 2022-12-01 16:52:41
+	是否需要部署 - false
+	是否需要重新生成客户端Applet Jar包 - false
+
+==============================================================================
+2)补丁安装步骤说明
+==============================================================================
+
+
+	补丁安装前置准备工作(比如数据备份)
+	======================================================================
+	
+
+
+	补丁安装
+	======================================================================
+	
+
+
+	补丁安装后置工作
+	======================================================================
+	
+
+
+	补丁安装成功的验证工作
+	======================================================================
+	
+
+
+	其它信息
+	======================================================================
+	
+
+==============================================================================
+3)补丁修复bug列表说明
+==============================================================================

BIN
gl/replacement/modules/gl/META-INF/classes/nc/bs/gl/impl/VoucherInsertImpl.class


+ 63 - 0
gl/replacement/modules/gl/META-INF/classes/nc/bs/gl/impl/VoucherInsertImpl.java

@@ -0,0 +1,63 @@
+package nc.bs.gl.impl;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.alibaba.fastjson.JSONObject;
+
+import nc.bs.framework.adaptor.IHttpServletAdaptor;
+import nc.bs.servlet.service.BaseServlet;
+import nccloud.open.api.auto.token.cur.utils.APICurUtils;
+import nccloud.open.api.auto.token.itf.IAPIUtils;
+
+
+
+public class VoucherInsertImpl extends BaseServlet implements IHttpServletAdaptor{
+
+	@Override
+	public void doAction(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		// TODO Auto-generated method stub
+		IAPIUtils util = null;
+		util = new APICurUtils();//2021.05版本及以后版本
+		// 服务地址ip
+		String ip = "47.103.81.172";
+		// 服务地址端口号
+		String port = "90";
+		// 账套编码,开发环境使用develop,生产环境需要使用用root账号登录,在“系统管理”节点查看账套编码
+		String busi_center = "YHSY";
+		// 第三方应用编码
+		String app_id = "ZP";
+		// app_secret,用于请求加签
+		String app_secret = "032052289c19415fadae";
+		// 公钥,加解密使用
+		String public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmnbnRUWNljcSBI1cWYQ5ciISEuNzmyVn5x7y6gov4dYVtDJDmNExWlIJBNkeC2tyHu058rt9hKYmsYv71/o+lyMRQ/GlCzrdgo2wdujph+hf+WsRFvq4HT900wuXT8237naGyvPsvU6XiRBvprBEvE6HR/psZrzic0E6a9BR1dy+5MjtzpTsDJaxlKURvpWhLNN2MEuURdwTZALgg/oEGtyj7mGBsODErHsxkNKhHB6S3n4kwBIHbsUME8xG/szAXbUHBvtkMdaN0Q9+4gKir2+UhLHmg1RQJTWjxrw/rIeee8CW+kDRFIo11GxdksqJqCxEoeZINDgaHkrNbFiEGwIDAQAB";
+		// ncc用户名
+		String ncc_user = "";
+		// ncc用户密码
+		String password = "";
+		
+		util.init(ip, port, busi_center, app_id, app_secret, public_key, ncc_user, password);
+		// 获取token
+		try {
+			String token = util.getToken();
+			// 请求的OpenAPI接口地址,注意nccloud前面没有"/"
+			String apiuri = "nccloud/api/gl/voucher/insert";
+			util.setApiUrl(apiuri);
+			String createStr = buildJson(req, resp, this.getClass().getName());
+			// 进行接口测试
+			String result = util.getAPIRetrun(token, createStr);
+			resp.getWriter().write(result);
+			
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			StringWriter stringWriter = new StringWriter();
+			e.printStackTrace(new PrintWriter(stringWriter));
+		}
+	}
+
+}

BIN
gl/replacement/modules/gl/META-INF/classes/nc/bs/servlet/service/BaseServlet.class


+ 85 - 0
gl/replacement/modules/gl/META-INF/classes/nc/bs/servlet/service/BaseServlet.java

@@ -0,0 +1,85 @@
+package nc.bs.servlet.service;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+
+import org.codehaus.jettison.json.JSONException;
+
+import uap.json.JSONObject;
+
+/**
+ * 提供一些公共方法
+ * 具体业务请在实际服务类实现
+ */
+public class BaseServlet {
+
+	public static String STATUS_SUCCESS ="success";
+	public static String STATUS_FAILURE ="fail";
+
+	/**
+	 * 格式化传入的数据,JSON化在具体服务类实现
+	 * @param req
+	 * @param resp
+	 * @param 类名
+	 * @return
+	 * @throws ServletException
+	 * @throws IOException
+	 */
+	protected String buildJson(HttpServletRequest req,
+							   HttpServletResponse resp, String classname)
+			throws ServletException, IOException {
+		req.setCharacterEncoding("UTF-8");
+		/* 设置格式为text/json */
+		resp.setContentType("text/json");
+		/* 设置字符集为'UTF-8' */
+		resp.setCharacterEncoding("UTF-8");
+		String reqJsonData = null;
+		// 接收流
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				req.getInputStream(), "UTF-8"));
+		StringBuffer jsonStr = new StringBuffer();
+		try {
+			String line = "";
+			while ((line = reader.readLine()) != null) {
+				jsonStr.append(line);
+			}
+			if (jsonStr != null && !"".equals(jsonStr.toString())) {
+				reqJsonData = jsonStr.toString();
+//				PrLogger.error(new UFDateTime(System.currentTimeMillis()).toString()
+//						+ "客户端传入:" + classname + "~~" + reqJsonData);
+			} else {
+				throw new ServletException("传入的数据不合法!");
+			}
+		} catch (IOException e) {
+			throw new IOException("数据读取失败" + e.getMessage());
+		} finally {
+			reader.close();
+		}
+		return reqJsonData;
+	}
+
+
+
+	/**
+	 * 格式返回json数据
+	 *
+	 * @return
+	 * @throws JSONException
+	 * @throws Exception
+	 */
+	public static JSONObject formatRSJsonData(String status,String error,String message){
+		JSONObject rs = new JSONObject();
+		rs.put("status", status);
+		rs.put("message", message);
+		rs.put("error", error);
+		return rs;
+	}
+	
+}

+ 8 - 0
gl/replacement/modules/gl/META-INF/openapi.upm

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding='gb2312'?>
+<module name="gl">
+    <public>
+ 	   <component name="voucherinsert" accessProtected="false"  remote="true" singleton="true" tx="NONE" supportAlias="true">
+       <implementation>nc.bs.gl.impl.VoucherInsertImpl</implementation>
+ 	   </component>
+    </public>	
+</module>