浏览代码

凭证接口初始化

yaoyu 1 年之前
父节点
当前提交
d04b99c703

+ 19 - 0
mc/.classpath

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="mc/classes" path="mc/src/public"/>
+	<classpathentry kind="src" output="mc/classes" path="mc/src/client"/>
+	<classpathentry kind="src" output="mc/classes" path="mc/src/private"/>
+	<classpathentry kind="src" output="mc/classes" path="mc/resources"/>
+	<classpathentry kind="src" output="mc/classes" path="mc/src/test"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="nc.uap.mde.library.container/Ant_Library"/>
+	<classpathentry kind="con" path="nc.uap.mde.library.container/Product_Common_Library"/>
+	<classpathentry kind="con" path="nc.uap.mde.library.container/Middleware_Library"/>
+	<classpathentry kind="con" path="nc.uap.mde.library.container/Framework_Library"/>
+	<classpathentry kind="con" path="nc.uap.mde.library.container/Module_Public_Library"/>
+	<classpathentry kind="con" path="nc.uap.mde.library.container/Module_Client_Library"/>
+	<classpathentry kind="con" path="nc.uap.mde.library.container/Module_Private_Library"/>
+	<classpathentry kind="con" path="nc.uap.mde.library.container/Module_Lang_Library"/>
+	<classpathentry kind="con" path="nc.uap.mde.library.container/Generated_EJB"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

+ 5 - 0
mc/.module_prj

@@ -0,0 +1,5 @@
+#
+#Fri Jan 26 09:19:42 CST 2024
+module.name=mc
+bcp.manifest.ts=1706231952582
+module.defConfig=module.xml

+ 24 - 0
mc/.project

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>mc</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>nc.uap.mde.ModuleBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>nc.uap.mde.ModuleProjectNature</nature>
+		<nature>nc.uap.mde.BizCompProjectNature</nature>
+	</natures>
+</projectDescription>

+ 10 - 0
mc/META-INF/eteams.upm

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="gbk"?>
+<module name="mc">
+	<public>
+		    <!-- ½Ó¿Ú -->
+		    <component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
+	      <interface>nc.itf.mc.IEteamsService</interface>
+	      <implementation>nc.impl.mc.EteamsServiceImpl</implementation>
+	    </component>
+	</public>
+</module>

+ 7 - 0
mc/META-INF/module.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="gb2312"?>
+<module name="mc">
+    <public>
+    </public>
+    <private>
+    </private>
+</module>

+ 2 - 0
mc/bin/.module_prj

@@ -0,0 +1,2 @@
+module.name=mc
+module.defConfig=module.xml

+ 24 - 0
mc/bin/.project

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>mc</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>nc.uap.mde.ModuleBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>nc.uap.mde.ModuleProjectNature</nature>
+		<nature>nc.uap.mde.BizCompProjectNature</nature>
+	</natures>
+</projectDescription>

+ 7 - 0
mc/bin/META-INF/module.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="gb2312"?>
+<module name="mc">
+    <public>
+    </public>
+    <private>
+    </private>
+</module>

+ 21 - 0
mc/bin/manifest.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Manifest>
+  <BusinessComponet name="mc" dispname="">
+    <public>
+      <src name="src/public"/>
+    </public>
+    <client>
+      <src name="src/client"/>
+    </client>
+    <private>
+      <src name="src/private"/>
+    </private>
+    <test>
+      <src name="src/test"/>
+    </test>
+    <resource>
+      <src name="resources"/>
+    </resource>
+    <funnodes/>
+  </BusinessComponet>
+</Manifest>

+ 21 - 0
mc/manifest.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Manifest>
+  <BusinessComponet name="mc" dispname="">
+    <public>
+      <src name="src/public"/>
+    </public>
+    <client>
+      <src name="src/client"/>
+    </client>
+    <private>
+      <src name="src/private"/>
+    </private>
+    <test>
+      <src name="src/test"/>
+    </test>
+    <resource>
+      <src name="resources"/>
+    </resource>
+    <funnodes/>
+  </BusinessComponet>
+</Manifest>

二进制
mc/mc/classes/nc/impl/mc/EteamsServiceImpl.class


二进制
mc/mc/classes/nc/itf/mc/IEteamsService.class


二进制
mc/mc/classes/nc/mc/br/plugin/DyPaymentApprovePlugin.class


二进制
mc/mc/classes/nc/mc/br/plugin/FinancePaymentApprovePlugin.class


二进制
mc/mc/classes/org/jeecg/common/util/GetDataUtil.class


二进制
mc/mc/classes/org/jeecg/common/util/HttpHelper.class


+ 340 - 0
mc/mc/src/client/nc/mc/br/plugin/DyPaymentApprovePlugin.java

@@ -0,0 +1,340 @@
+package nc.mc.br.plugin;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.jeecg.common.util.GetDataUtil;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import nc.bs.framework.common.NCLocator;
+import nc.bs.pub.taskcenter.BgWorkingContext;
+import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
+import nc.itf.gl.pub.IFreevaluePub;
+import nc.itf.mc.IEteamsService;
+import nc.vo.bd.b04.DeptdocVO;
+import nc.vo.gl.pubvoucher.DetailVO;
+import nc.vo.gl.pubvoucher.VoucherVO;
+import nc.vo.glcom.ass.AssVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.VOStatus;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDouble;
+import u8c.log.NcLog;
+
+/**
+ * 付款审批单(公对公)
+ * @author YaoYu
+ *
+ */
+public class DyPaymentApprovePlugin implements IBackgroundWorkPlugin{
+	
+	public String id = "&id=927885572326686753";
+	private IEteamsService service = NCLocator.getInstance().lookup(IEteamsService.class);
+	
+	private IFreevaluePub freepub = NCLocator.getInstance().lookup(IFreevaluePub.class);
+	@Override
+	public String executeTask(BgWorkingContext context) throws BusinessException {
+		try {
+			String code = service.getCode();
+			String token = service.getToken(code);
+			JSONArray alldata = service.getAllId(id,token);
+			List<String> ids = new ArrayList<String>();
+			List<String> serNums = new ArrayList<String>();
+			for (int i = 0; i < alldata.size(); i++) {
+				JSONObject json = JSONObject.parseObject(alldata.getString(i));
+				ids.add("&id="+json.getString("id"));
+				serNums.add(json.getString("serNum"));
+			}
+			String serNum = null;
+			Map<String,String> map = GetDataUtil.getVoucher(serNums);
+			for (int i = 0; i < ids.size(); i++) {
+				try {
+					JSONObject json = service.getInfoByID(token, ids.get(i));
+					//如果有匹配值表示在NC存在该凭证,跳过这条数据的保存
+					serNum = json.getJSONObject("flowRequest").getString("serNum");
+					String currentNode = json.getJSONObject("flowRequest").getString("currentNode");
+					if(map.get(serNum) != null || !"结束节点".equals(currentNode)) {
+						continue;
+					}
+					saveVoucher(json);
+				} catch (Exception e) {
+					StringWriter stringWriter = new StringWriter();
+					e.printStackTrace(new PrintWriter(stringWriter));
+					// 获取详细信息
+					String msg = stringWriter.getBuffer().toString();	
+					NcLog.info("付款审批单(公对公)生成凭证失败,单号:"+serNum+"\n"+msg);
+					e.printStackTrace();
+				}
+
+			}
+		} catch (Exception e) {
+			StringWriter stringWriter = new StringWriter();
+			e.printStackTrace(new PrintWriter(stringWriter));
+			// 获取详细信息
+			String msg = stringWriter.getBuffer().toString();
+			NcLog.info("付款审批单(公对公)生成凭证失败"+"\n"+msg);
+		}
+		return null;
+	}
+	
+	/**
+	 * 凭证保存方法
+	 * @param createStrJs 
+	 * @throws Exception 
+	 */
+	private void saveVoucher(JSONObject createStrJs) throws Exception{
+		VoucherVO newvo = interfaceService(createStrJs);			
+		service.saveVoucher_RequiresNew(newvo);
+	}
+	
+	/**
+	 * 拼装凭证vo
+	 * @param map
+	 * @return
+	 * @throws Exception
+	 */
+	public VoucherVO interfaceService(JSONObject map) throws Exception {	
+		//组装凭证VO
+		VoucherVO voucher = new  VoucherVO();
+		//主表凭证
+		setVoucher(map,voucher);
+		//凭证分录VOs
+		setDetail(map,voucher);
+		//回写表头金额
+		sumAmount(voucher);
+		voucher.setExplanation(voucher.getDetails()[0].getExplanation());
+		return voucher;
+	}
+	
+	
+	/**
+	 * 凭证主表
+	 * @param map 
+	 * @param obj
+	 * @param voucher
+	 * @throws BusinessException 
+	 */
+	private void setVoucher(JSONObject json,VoucherVO voucher) throws Exception {		
+		JSONObject formData = json.getJSONObject("formData");
+		JSONObject dataDetails = formData.getJSONObject("dataDetails");
+		//制单人
+		voucher.setPk_prepared(GetDataUtil.getUserid("15800802186"));
+		//凭证类别
+		voucher.setPk_vouchertype(GetDataUtil.getVoucherType("付款凭证"));
+		//公司
+		voucher.setPk_corp(GetDataUtil.getCorpPK("1001"));
+		
+		UFDate createTime = new UFDate(formData.getDate("createTime"));
+		//会计年度
+		voucher.setYear(String.valueOf(createTime.getYear()));
+		//会计期间
+		voucher.setPeriod(String.valueOf(createTime).substring(5,7));
+		//制单日期
+		voucher.setPrepareddate(createTime);
+		//记账人
+		voucher.setPk_manager("N/A");
+		//签字标识
+		voucher.setSignflag(UFBoolean.TRUE);
+		//分录增删标志
+		voucher.setDetailmodflag(UFBoolean.TRUE);
+		//作废标识
+		voucher.setDiscardflag(UFBoolean.FALSE);
+		//制单系统
+		voucher.setPk_system("GL");
+		//凭证类型
+		voucher.setVoucherkind(0);
+		//借方合计
+		voucher.setTotaldebit(new UFDouble(dataDetails.getString("总金额")));
+		//贷方合计
+		voucher.setTotalcredit(new UFDouble(dataDetails.getString("总金额")));
+		//泛微唯一标识
+		voucher.setFree2(dataDetails.getString("自动编号"));
+		String pk_glorg = GetDataUtil.getGlorg("1001");
+		//主体 
+		voucher.setPk_glorg(pk_glorg);
+		// 主体帐簿
+		voucher.setPk_glorgbook(GetDataUtil.getGlorgbook(pk_glorg));
+		voucher.setIsdifflag(UFBoolean.FALSE);	
+		voucher.setStatus(VOStatus.NEW);
+	}
+	
+
+	
+	
+
+	
+	
+	/**
+	 * 凭证分录
+	 * @param map 
+	 * @param obj
+	 * @param voucher
+	 * @throws BusinessException 
+	 * @throws SQLException 
+	 */
+	private void setDetail(JSONObject map, VoucherVO voucher) throws Exception {
+		JSONObject formData = map.getJSONObject("formData");
+		JSONObject dataDetails = formData.getJSONObject("dataDetails");
+		JSONObject money = dataDetails.getJSONObject("实付金额_*");
+		//JSONObject costName = dataDetails.getJSONObject("费用名称_*");
+		JSONArray datas = new JSONArray();
+		String pk_accsubj = GetDataUtil.getAccSubject("560201",voucher.getPk_glorgbook());//科目主键
+		String pk_currtype = GetDataUtil.getCurrType("CNY");
+		String deptName = dataDetails.getString("部门");
+		DeptdocVO deptdocVO = GetDataUtil.getDept(deptName, voucher.getPk_corp());
+		AssVO jobAssVO = getPubAssid("部门档案",deptdocVO,voucher.getPk_corp());
+		 // 将formData中的每个键值对转换为JSONArray的元素
+        for (String key : money.keySet()) {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("money", money.get(key));
+            jsonObject.put("costName", "付款审批单(公对公)生成凭证");
+            jsonObject.put("pk_accsubj", pk_accsubj);
+            jsonObject.put("pk_currtype", pk_currtype);
+            datas.add(jsonObject);
+        }
+
+		List<DetailVO> details = new ArrayList<DetailVO>();
+		for (int i = 0; i < datas.size(); i++) {
+			JSONObject data = datas.getJSONObject(i);
+			//一条数据生成一借一贷
+			//借方分录
+			setDebitVO(details, voucher,data,map,jobAssVO);
+			//贷方分录
+			setCreditVO(details, voucher, data,map,jobAssVO);
+		}
+		DetailVO[] detailVOs = new DetailVO[details.size()]; 
+		details.toArray(detailVOs);
+		voucher.setDetails(detailVOs);
+	}
+	
+	
+	/**
+	 * 凭证分录借方
+	 * @param details
+	 * @param voucher
+	 * @param data
+	 * @param map 
+	 * @throws BusinessException
+	 * @throws SQLException 
+	 */
+	private void setDebitVO(List<DetailVO> details, VoucherVO voucher, JSONObject data, JSONObject map ,AssVO jobAssVO) throws Exception {
+		DetailVO vo = new DetailVO();	
+		List<AssVO> listAss = new ArrayList<AssVO>();
+		
+		listAss.add(jobAssVO);
+		AssVO[] assVOs = new AssVO[listAss.size()];
+		listAss.toArray(assVOs);
+		vo.setAssid(freepub.getAssID(assVOs, true));
+		vo.setPk_accsubj(data.getString("pk_accsubj"));//会计科目
+		vo.setCreditamount(UFDouble.ZERO_DBL);//贷方
+		vo.setCreditquantity(UFDouble.ZERO_DBL);
+		vo.setDebitamount(new UFDouble(data.getString("money")));//借方
+		vo.setDirection("D");//方向
+		vo.setDiscardflag(UFBoolean.FALSE);
+		vo.setExcrate1(UFDouble.ZERO_DBL);
+		vo.setExcrate2(UFDouble.ONE_DBL);
+		vo.setExplanation(data.getString("costName"));//摘要
+		vo.setFraccreditamount(UFDouble.ZERO_DBL);
+		vo.setFracdebitamount(UFDouble.ZERO_DBL);
+		vo.setLocalcreditamount(UFDouble.ZERO_DBL);//全局贷方
+		vo.setLocaldebitamount(new UFDouble(data.getString("money")));//借方
+		vo.setPeriod(voucher.getPeriod());//会计期间
+		vo.setPk_corp(voucher.getPk_corp());
+		vo.setPk_currtype(data.getString("pk_currtype"));//币种
+		vo.setPk_glbook(voucher.getPk_glbook());
+		vo.setPk_glorg(voucher.getPk_glorg());
+		vo.setPk_glorgbook(voucher.getPk_glorgbook());
+		vo.setPk_manager(voucher.getPk_manager());
+		vo.setPk_system(voucher.getPk_system());
+		vo.setPk_vouchertype(voucher.getPk_vouchertype());//凭证类型
+		vo.setPrepareddate(voucher.getPrepareddate());
+		vo.setYear(voucher.getYear());
+		details.add(vo);		
+	}
+	
+	
+	/**
+	 * 凭证分录贷方
+	 * @param details
+	 * @param voucher
+	 * @param data
+	 * @param map 
+	 * @throws BusinessException
+	 */
+	private void setCreditVO( List<DetailVO> details,VoucherVO voucher, JSONObject data, JSONObject map, AssVO jobAssVO) throws Exception {
+		DetailVO vo = new DetailVO();
+		List<AssVO> listAss = new ArrayList<AssVO>();
+		listAss.add(jobAssVO);
+		AssVO[] assVOs = new AssVO[listAss.size()];
+		listAss.toArray(assVOs);
+		vo.setAssid(freepub.getAssID(assVOs, true));
+		vo.setPk_accsubj(data.getString("pk_accsubj"));//会计科目 
+		vo.setCreditamount(new UFDouble(data.getString("money")));//贷方
+		vo.setDebitamount(UFDouble.ZERO_DBL);//借方
+		vo.setDirection("C");//方向
+		vo.setDiscardflag(UFBoolean.FALSE);
+		vo.setExcrate1(UFDouble.ZERO_DBL);
+		vo.setExcrate2(UFDouble.ONE_DBL);
+		vo.setExplanation(data.getString("costName"));//摘要
+		vo.setFraccreditamount(UFDouble.ZERO_DBL);
+		vo.setFracdebitamount(UFDouble.ZERO_DBL);
+		vo.setLocalcreditamount(new UFDouble(data.getString("money")));//全局贷方
+		vo.setLocaldebitamount(UFDouble.ZERO_DBL);//借方
+		vo.setPeriod(voucher.getPeriod());//会计期间
+		vo.setPk_corp(voucher.getPk_corp());
+		vo.setPk_currtype(data.getString("pk_currtype"));//币种
+		vo.setPk_glbook(voucher.getPk_glbook());
+		vo.setPk_glorg(voucher.getPk_glorg());
+		vo.setPk_glorgbook(voucher.getPk_glorgbook());
+		vo.setPk_manager(voucher.getPk_manager());
+		vo.setPk_system(voucher.getPk_system());
+		vo.setPk_vouchertype(voucher.getPk_vouchertype());//凭证类型
+		vo.setPrepareddate(voucher.getPrepareddate());
+		vo.setYear(voucher.getYear());
+		details.add(vo);
+	}
+	
+	/**
+	 * 凭证分录生成后需要把原币金额回写到表头金额
+	 * @param voucher
+	 */
+	private void sumAmount(VoucherVO voucher) {
+		UFDouble amount1 = new UFDouble(0);
+		UFDouble amount2 = new UFDouble(0);
+		DetailVO[] vos = voucher.getDetails();
+		for(DetailVO vo : vos){
+			amount1 = amount1.add(vo.getCreditamount());
+			amount2 = amount2.add(vo.getDebitamount());
+		}
+		voucher.setTotalcredit(amount1);// 贷方合计
+		voucher.setTotaldebit(amount2);// 借方合计
+	}
+	
+	/**
+	 * 通用辅助核算
+	 * @param pk_bdinfo 
+	 * @throws SQLException 
+	 */
+	private AssVO getPubAssid(String checktype,DeptdocVO deptdocVO,String pk_corp) throws Exception {
+		List<AssVO> list = new ArrayList<AssVO>();
+		AssVO vo = new AssVO();	
+		vo.setChecktypecode(deptdocVO.getDeptcode());
+		vo.setChecktypename(checktype);
+		vo.setPk_Checktype(GetDataUtil.getBdpkByBdInfo(checktype));	
+		vo.setPk_Checkvalue(deptdocVO.getPrimaryKey());		
+		vo.setCheckvaluecode(deptdocVO.getDeptcode());
+		vo.setCheckvaluename(deptdocVO.getDeptname());
+		vo.setUserData(true);		
+		list.add(vo);		
+		AssVO[] assVOs = new AssVO[list.size()];
+		list.toArray(assVOs);
+		return vo;
+	}
+
+}

+ 339 - 0
mc/mc/src/client/nc/mc/br/plugin/FinancePaymentApprovePlugin.java

@@ -0,0 +1,339 @@
+package nc.mc.br.plugin;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.jeecg.common.util.GetDataUtil;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import nc.bs.framework.common.NCLocator;
+import nc.bs.pub.taskcenter.BgWorkingContext;
+import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
+import nc.itf.gl.pub.IFreevaluePub;
+import nc.itf.mc.IEteamsService;
+import nc.vo.bd.b04.DeptdocVO;
+import nc.vo.gl.pubvoucher.DetailVO;
+import nc.vo.gl.pubvoucher.VoucherVO;
+import nc.vo.glcom.ass.AssVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.VOStatus;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDouble;
+import u8c.log.NcLog;
+
+/**
+ * 付款审批单(财务)
+ * @author YaoYu
+ *
+ */
+public class FinancePaymentApprovePlugin implements IBackgroundWorkPlugin{
+	
+	public String id = "&id=925700529016692737";
+	private IEteamsService service = NCLocator.getInstance().lookup(IEteamsService.class);
+	
+	private IFreevaluePub freepub = NCLocator.getInstance().lookup(IFreevaluePub.class);
+	@Override
+	public String executeTask(BgWorkingContext context) throws BusinessException {
+		try {
+			String code = service.getCode();
+			String token = service.getToken(code);
+			JSONArray alldata = service.getAllId(id,token);
+			List<String> ids = new ArrayList<String>();
+			List<String> serNums = new ArrayList<String>();
+			for (int i = 0; i < alldata.size(); i++) {
+				JSONObject json = JSONObject.parseObject(alldata.getString(i));
+				ids.add("&id="+json.getString("id"));
+				serNums.add(json.getString("serNum"));
+			}
+			String serNum = null;
+			Map<String,String> map = GetDataUtil.getVoucher(serNums);
+			for (int i = 0; i < ids.size(); i++) {
+				try {
+					JSONObject json = service.getInfoByID(token, ids.get(i));
+					//如果有匹配值表示在NC存在该凭证,跳过这条数据的保存
+					serNum = json.getJSONObject("flowRequest").getString("serNum");
+					String currentNode = json.getJSONObject("flowRequest").getString("currentNode");
+					if(map.get(serNum) != null || !"结束节点".equals(currentNode)) {
+						continue;
+					}
+					saveVoucher(json);
+				} catch (Exception e) {
+					StringWriter stringWriter = new StringWriter();
+					e.printStackTrace(new PrintWriter(stringWriter));
+					// 获取详细信息
+					String msg = stringWriter.getBuffer().toString();	
+					NcLog.info("付款审批单(财务)生成凭证失败,单号:"+serNum+"\n"+msg);
+				}
+
+			}
+		} catch (Exception e) {
+			StringWriter stringWriter = new StringWriter();
+			e.printStackTrace(new PrintWriter(stringWriter));
+			// 获取详细信息
+			String msg = stringWriter.getBuffer().toString();
+			NcLog.info("付款审批单(财务)生成凭证失败"+"\n"+msg);
+		}
+		return null;
+	}
+	
+	/**
+	 * 凭证保存方法
+	 * @param createStrJs 
+	 * @throws Exception 
+	 */
+	private void saveVoucher(JSONObject createStrJs) throws Exception{
+		VoucherVO newvo = interfaceService(createStrJs);			
+		service.saveVoucher_RequiresNew(newvo);
+	}
+	
+	/**
+	 * 拼装凭证vo
+	 * @param map
+	 * @return
+	 * @throws Exception
+	 */
+	public VoucherVO interfaceService(JSONObject map) throws Exception {	
+		//组装凭证VO
+		VoucherVO voucher = new  VoucherVO();
+		//主表凭证
+		setVoucher(map,voucher);
+		//凭证分录VOs
+		setDetail(map,voucher);
+		//回写表头金额
+		sumAmount(voucher);
+		voucher.setExplanation(voucher.getDetails()[0].getExplanation());
+		return voucher;
+	}
+	
+	
+	/**
+	 * 凭证主表
+	 * @param map 
+	 * @param obj
+	 * @param voucher
+	 * @throws BusinessException 
+	 */
+	private void setVoucher(JSONObject json,VoucherVO voucher) throws Exception {		
+		JSONObject formData = json.getJSONObject("formData");
+		JSONObject dataDetails = formData.getJSONObject("dataDetails");
+		//制单人
+		voucher.setPk_prepared(GetDataUtil.getUserid("15800802186"));
+		//凭证类别
+		voucher.setPk_vouchertype(GetDataUtil.getVoucherType("付款凭证"));
+		//公司
+		voucher.setPk_corp(GetDataUtil.getCorpPK("1001"));
+		
+		UFDate createTime = new UFDate(formData.getDate("createTime"));
+		//会计年度
+		voucher.setYear(String.valueOf(createTime.getYear()));
+		//会计期间
+		voucher.setPeriod(String.valueOf(createTime).substring(5,7));
+		//制单日期
+		voucher.setPrepareddate(createTime);
+		//记账人
+		voucher.setPk_manager("N/A");
+		//签字标识
+		voucher.setSignflag(UFBoolean.TRUE);
+		//分录增删标志
+		voucher.setDetailmodflag(UFBoolean.TRUE);
+		//作废标识
+		voucher.setDiscardflag(UFBoolean.FALSE);
+		//制单系统
+		voucher.setPk_system("GL");
+		//凭证类型
+		voucher.setVoucherkind(0);
+		//借方合计
+		voucher.setTotaldebit(new UFDouble(dataDetails.getString("总金额")));
+		//贷方合计
+		voucher.setTotalcredit(new UFDouble(dataDetails.getString("总金额")));
+		//泛微唯一标识
+		voucher.setFree2(dataDetails.getString("自动编号"));
+		String pk_glorg = GetDataUtil.getGlorg("1001");
+		//主体 
+		voucher.setPk_glorg(pk_glorg);
+		// 主体帐簿
+		voucher.setPk_glorgbook(GetDataUtil.getGlorgbook(pk_glorg));
+		voucher.setIsdifflag(UFBoolean.FALSE);	
+		voucher.setStatus(VOStatus.NEW);
+	}
+	
+
+	
+	
+
+	
+	
+	/**
+	 * 凭证分录
+	 * @param map 
+	 * @param obj
+	 * @param voucher
+	 * @throws BusinessException 
+	 * @throws SQLException 
+	 */
+	private void setDetail(JSONObject map, VoucherVO voucher) throws Exception {
+		JSONObject formData = map.getJSONObject("formData");
+		JSONObject dataDetails = formData.getJSONObject("dataDetails");
+		JSONObject money = dataDetails.getJSONObject("金额_*");
+		JSONObject costName = dataDetails.getJSONObject("费用名称_*");
+		JSONArray datas = new JSONArray();
+		String pk_accsubj = GetDataUtil.getAccSubject("560201",voucher.getPk_glorgbook());//科目主键
+		String pk_currtype = GetDataUtil.getCurrType("CNY");
+		String deptName = dataDetails.getString("部门");
+		DeptdocVO deptdocVO = GetDataUtil.getDept(deptName, voucher.getPk_corp());
+		AssVO jobAssVO = getPubAssid("部门档案",deptdocVO,voucher.getPk_corp());
+		 // 将formData中的每个键值对转换为JSONArray的元素
+        for (String key : money.keySet()) {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("money", money.get(key));
+            jsonObject.put("costName", "付款审批单(财务)生成凭证");
+            jsonObject.put("pk_accsubj", pk_accsubj);
+            jsonObject.put("pk_currtype", pk_currtype);
+            datas.add(jsonObject);
+        }
+
+		List<DetailVO> details = new ArrayList<DetailVO>();
+		for (int i = 0; i < datas.size(); i++) {
+			JSONObject data = datas.getJSONObject(i);
+			//一条数据生成一借一贷
+			//借方分录
+			setDebitVO(details, voucher,data,map,jobAssVO);
+			//贷方分录
+			setCreditVO(details, voucher, data,map,jobAssVO);
+		}
+		DetailVO[] detailVOs = new DetailVO[details.size()]; 
+		details.toArray(detailVOs);
+		voucher.setDetails(detailVOs);
+	}
+	
+	
+	/**
+	 * 凭证分录借方
+	 * @param details
+	 * @param voucher
+	 * @param data
+	 * @param map 
+	 * @throws BusinessException
+	 * @throws SQLException 
+	 */
+	private void setDebitVO(List<DetailVO> details, VoucherVO voucher, JSONObject data, JSONObject map ,AssVO jobAssVO) throws Exception {
+		DetailVO vo = new DetailVO();	
+		List<AssVO> listAss = new ArrayList<AssVO>();
+		
+		listAss.add(jobAssVO);
+		AssVO[] assVOs = new AssVO[listAss.size()];
+		listAss.toArray(assVOs);
+		vo.setAssid(freepub.getAssID(assVOs, true));
+		vo.setPk_accsubj(data.getString("pk_accsubj"));//会计科目
+		vo.setCreditamount(UFDouble.ZERO_DBL);//贷方
+		vo.setCreditquantity(UFDouble.ZERO_DBL);
+		vo.setDebitamount(new UFDouble(data.getString("money")));//借方
+		vo.setDirection("D");//方向
+		vo.setDiscardflag(UFBoolean.FALSE);
+		vo.setExcrate1(UFDouble.ZERO_DBL);
+		vo.setExcrate2(UFDouble.ONE_DBL);
+		vo.setExplanation(data.getString("costName"));//摘要
+		vo.setFraccreditamount(UFDouble.ZERO_DBL);
+		vo.setFracdebitamount(UFDouble.ZERO_DBL);
+		vo.setLocalcreditamount(UFDouble.ZERO_DBL);//全局贷方
+		vo.setLocaldebitamount(new UFDouble(data.getString("money")));//借方
+		vo.setPeriod(voucher.getPeriod());//会计期间
+		vo.setPk_corp(voucher.getPk_corp());
+		vo.setPk_currtype(data.getString("pk_currtype"));//币种
+		vo.setPk_glbook(voucher.getPk_glbook());
+		vo.setPk_glorg(voucher.getPk_glorg());
+		vo.setPk_glorgbook(voucher.getPk_glorgbook());
+		vo.setPk_manager(voucher.getPk_manager());
+		vo.setPk_system(voucher.getPk_system());
+		vo.setPk_vouchertype(voucher.getPk_vouchertype());//凭证类型
+		vo.setPrepareddate(voucher.getPrepareddate());
+		vo.setYear(voucher.getYear());
+		details.add(vo);		
+	}
+	
+	
+	/**
+	 * 凭证分录贷方
+	 * @param details
+	 * @param voucher
+	 * @param data
+	 * @param map 
+	 * @throws BusinessException
+	 */
+	private void setCreditVO( List<DetailVO> details,VoucherVO voucher, JSONObject data, JSONObject map, AssVO jobAssVO) throws Exception {
+		DetailVO vo = new DetailVO();
+		List<AssVO> listAss = new ArrayList<AssVO>();
+		listAss.add(jobAssVO);
+		AssVO[] assVOs = new AssVO[listAss.size()];
+		listAss.toArray(assVOs);
+		vo.setAssid(freepub.getAssID(assVOs, true));
+		vo.setPk_accsubj(data.getString("pk_accsubj"));//会计科目 
+		vo.setCreditamount(new UFDouble(data.getString("money")));//贷方
+		vo.setDebitamount(UFDouble.ZERO_DBL);//借方
+		vo.setDirection("C");//方向
+		vo.setDiscardflag(UFBoolean.FALSE);
+		vo.setExcrate1(UFDouble.ZERO_DBL);
+		vo.setExcrate2(UFDouble.ONE_DBL);
+		vo.setExplanation(data.getString("costName"));//摘要
+		vo.setFraccreditamount(UFDouble.ZERO_DBL);
+		vo.setFracdebitamount(UFDouble.ZERO_DBL);
+		vo.setLocalcreditamount(new UFDouble(data.getString("money")));//全局贷方
+		vo.setLocaldebitamount(UFDouble.ZERO_DBL);//借方
+		vo.setPeriod(voucher.getPeriod());//会计期间
+		vo.setPk_corp(voucher.getPk_corp());
+		vo.setPk_currtype(data.getString("pk_currtype"));//币种
+		vo.setPk_glbook(voucher.getPk_glbook());
+		vo.setPk_glorg(voucher.getPk_glorg());
+		vo.setPk_glorgbook(voucher.getPk_glorgbook());
+		vo.setPk_manager(voucher.getPk_manager());
+		vo.setPk_system(voucher.getPk_system());
+		vo.setPk_vouchertype(voucher.getPk_vouchertype());//凭证类型
+		vo.setPrepareddate(voucher.getPrepareddate());
+		vo.setYear(voucher.getYear());
+		details.add(vo);
+	}
+	
+	/**
+	 * 凭证分录生成后需要把原币金额回写到表头金额
+	 * @param voucher
+	 */
+	private void sumAmount(VoucherVO voucher) {
+		UFDouble amount1 = new UFDouble(0);
+		UFDouble amount2 = new UFDouble(0);
+		DetailVO[] vos = voucher.getDetails();
+		for(DetailVO vo : vos){
+			amount1 = amount1.add(vo.getCreditamount());
+			amount2 = amount2.add(vo.getDebitamount());
+		}
+		voucher.setTotalcredit(amount1);// 贷方合计
+		voucher.setTotaldebit(amount2);// 借方合计
+	}
+	
+	/**
+	 * 通用辅助核算
+	 * @param pk_bdinfo 
+	 * @throws SQLException 
+	 */
+	private AssVO getPubAssid(String checktype,DeptdocVO deptdocVO,String pk_corp) throws Exception {
+		List<AssVO> list = new ArrayList<AssVO>();
+		AssVO vo = new AssVO();	
+		vo.setChecktypecode(deptdocVO.getDeptcode());
+		vo.setChecktypename(checktype);
+		vo.setPk_Checktype(GetDataUtil.getBdpkByBdInfo(checktype));	
+		vo.setPk_Checkvalue(deptdocVO.getPrimaryKey());		
+		vo.setCheckvaluecode(deptdocVO.getDeptcode());
+		vo.setCheckvaluename(deptdocVO.getDeptname());
+		vo.setUserData(true);		
+		list.add(vo);
+		AssVO[] assVOs = new AssVO[list.size()];
+		list.toArray(assVOs);
+		return vo;
+	}
+
+}

+ 89 - 0
mc/mc/src/private/nc/impl/mc/EteamsServiceImpl.java

@@ -0,0 +1,89 @@
+package nc.impl.mc;
+
+import org.jeecg.common.util.HttpHelper;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import nc.bs.framework.common.NCLocator;
+import nc.itf.gl.voucher.IVoucher;
+import nc.itf.mc.IEteamsService;
+import nc.vo.gl.pubvoucher.VoucherVO;
+import u8c.log.NcLog;
+
+public class EteamsServiceImpl implements IEteamsService{
+	private IVoucher cher = NCLocator.getInstance().lookup(IVoucher.class); 
+	//获取code信息url
+	private static String codeurl = "https://api.eteams.cn/oauth2/authorize";
+	private static String corpid = "?corpid=b716cad73e783c17217426cb944fb33e";
+	private static String response_type = "&response_type=code";
+	private static String state = "&state=As";
+	//获取accessToken信息url
+	private static String tokenurl = "https://api.eteams.cn/oauth2/access_token";
+	private static String app_key = "?app_key=577aff82e4ca29a51441e26ac8fa7352";
+	private static String app_secret = "&app_secret=e977f407cc82fe7b6623285b72792fc7";
+	private static String grant_type = "&grant_type=authorization_code";
+	//根据流程表单ID获取流程左侧菜单全部数据下的所有相关数据
+	private static String allidurl = "https://api.eteams.cn/workflow/v2/getAllById";
+	//用户id
+	private static String userid = "&userid=2150608061134965656";
+	
+	//根据审批数据ID查询审批数据
+	private static String infourl ="https://api.eteams.cn/workflow/v2/getInfoByID";
+	
+	@Override
+	public String getCode() throws Exception {
+		//获取code
+		JSONObject data = JSONObject.parseObject(HttpHelper.doGet(codeurl+corpid+response_type+state, null));
+		NcLog.info("Code返回JOSN:"+data);
+		if("0".equals(data.getString("errcode"))) {
+			return data.getString("code");
+		}else {
+			throw new Exception("Code获取失败:"+data.getString("errmsg"));
+		}
+	}
+
+
+	@Override
+	public String getToken(String code) throws Exception {
+		//获取token
+		JSONObject data = JSONObject.parseObject(HttpHelper.doPost(tokenurl+app_key+app_secret+grant_type+"&code="+code, null));
+		NcLog.info("Token返回JOSN:"+data);
+		if("0".equals(data.getString("errcode"))) {
+			return "?access_token="+data.getString("acessToken");
+		}else {
+			throw new Exception("Token获取失败:"+data.getString("errmsg"));
+		}
+	}
+
+
+	@Override
+	public JSONArray getAllId(String id,String token) throws Exception {
+		JSONObject data = JSONObject.parseObject(HttpHelper.doGet(allidurl+token+userid+id, null));
+		NcLog.info("审批数据返回JOSN:"+data);
+		if("0".equals(data.getJSONObject("message").getString("errcode"))) {
+			return JSONArray.parseArray(data.getString("requests"));
+		}else {
+			throw new Exception("审批数据获取失败"+data.getJSONObject("message").getString("errmsg"));
+		}
+	}
+
+
+	@Override
+	public JSONObject getInfoByID(String token, String id) throws Exception {
+		JSONObject data = JSONObject.parseObject(HttpHelper.doGet(infourl+token+userid+id, null));
+		NcLog.info("审批数据详情返回JOSN:"+data);
+		if("0".equals(data.getJSONObject("message").getString("errcode"))) {
+			return data;
+		}else {
+			throw new Exception("审批数据详情获取失败"+data.getJSONObject("message").getString("errmsg"));
+		}
+	}
+
+
+	@Override
+	public void saveVoucher_RequiresNew(VoucherVO newvo) throws Exception {
+		cher.save(newvo, true);	
+	}
+
+}

+ 24 - 0
mc/mc/src/public/nc/itf/mc/IEteamsService.java

@@ -0,0 +1,24 @@
+package nc.itf.mc;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import nc.vo.gl.pubvoucher.VoucherVO;
+
+public interface IEteamsService {
+	
+	//获取code
+	public String getCode()throws Exception;
+	
+	//获取token
+	public String getToken(String code)throws Exception;
+	
+	//根据流程表单ID获取流程左侧菜单全部数据下的所有相关数据
+	public JSONArray getAllId(String id, String token)throws Exception;
+	
+	//根据审批数据ID查询审批数据
+	public JSONObject getInfoByID(String token, String id)throws Exception;
+	
+	//凭证保存
+	public void saveVoucher_RequiresNew(VoucherVO newvo)throws Exception;
+}

+ 127 - 0
mc/mc/src/public/org/jeecg/common/util/GetDataUtil.java

@@ -0,0 +1,127 @@
+package org.jeecg.common.util;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import nc.bs.framework.common.NCLocator;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.processor.BeanProcessor;
+import nc.jdbc.framework.processor.ColumnListProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.jdbc.framework.processor.MapListProcessor;
+import nc.jdbc.framework.processor.MapProcessor;
+import nc.vo.bd.b04.DeptdocVO;
+
+public class GetDataUtil {
+
+	private static IUAPQueryBS iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);
+	
+	public static String getVoucherType(String vouchtypename) throws Exception {
+		String sql = "select pk_vouchertype from bd_vouchertype where vouchtypename = '"+vouchtypename+"' and sealflag is null";
+		String pk_vouchertype = (String) iuap.executeQuery(sql, new ColumnProcessor());
+		if(pk_vouchertype == null) {
+			throw new Exception("凭证分类"+vouchtypename+"未查到,请检查");
+		}
+		return pk_vouchertype;
+	}
+	
+	
+    //公司
+    public static String getCorpPK(String code) throws Exception {
+    	String sql = "select pk_corp from bd_corp where unitcode = '"+code+"' and dr = 0";
+    	String pk_corp = (String) iuap.executeQuery(sql, new ColumnProcessor());
+    	if (pk_corp == null) {
+    		throw new Exception("公司"+code+"未查到,请检查");
+        }
+        return pk_corp;
+    }
+    //科目
+    public static String getAccSubject(String code,String pk_glorgbook)throws Exception {
+    	String sql = "select pk_accsubj from bd_accsubj where  subjcode = '"+code+"' and (dr is null or dr = 0) and pk_glorgbook='"+pk_glorgbook+"'";
+    	String pk_accsubj = (String) iuap.executeQuery(sql, new ColumnProcessor());
+    	if (pk_accsubj == null) {
+    		throw new Exception("科目"+code+"未查到,请检查");
+        }
+        return pk_accsubj;
+    }
+    
+    //查询部门
+    public static DeptdocVO getDept(String name,String pk_corp)throws Exception {
+    	String sql = "select pk_deptdoc,deptname from bd_deptdoc where deptname = '"+name+"' and pk_corp = '"+pk_corp+"' and dr = 0";
+    	DeptdocVO deptdocVO = (DeptdocVO) iuap.executeQuery(sql, new BeanProcessor(DeptdocVO.class));
+    	if (deptdocVO == null) {
+    		throw new Exception("部门"+name+"未查到,请检查");
+        }
+        return deptdocVO;
+    }
+    
+    //查询辅助核算的核算内容
+    public static String getBdpkByBdInfo(String name)throws Exception {
+    	String sql = "select pk_bdinfo from bd_bdinfo where bdname = '"+name+"' and dr = 0";
+    	String pk_bdinfo = (String) iuap.executeQuery(sql, new ColumnProcessor());
+    	if (pk_bdinfo == null) {
+    		throw new Exception("辅助核算的核算内容"+name+"未查到,请检查");
+        }
+        return pk_bdinfo;
+    }
+    
+    //查询币种
+    public static String getCurrType(String code)throws Exception {
+    	String sql = "select pk_currtype from bd_currtype where currtypecode = '"+code+"' and dr = 0";
+    	String pk_currtype = (String) iuap.executeQuery(sql, new ColumnProcessor());
+    	if (pk_currtype == null) {
+    		throw new Exception("币种"+code+"未查到,请检查");
+        }
+        return pk_currtype;
+    }
+	// 用户主键
+    public static String getUserid(String usercode) throws Exception {
+        String sql = "select cuserid from sm_user where user_code ='"+usercode+"' and isnull(dr,0) = 0";
+        String cuserid = (String) iuap.executeQuery(sql, new ColumnProcessor());
+        if (cuserid == null) {
+        	throw new Exception("用户"+usercode+"未查到,请检查");
+        }
+        return cuserid;
+    }
+    
+    //查询会计主体
+    public static String getGlorg(String code)throws Exception {
+    	String sql = "select pk_glorg from bd_glorg where glorgcode ='"+code+"' and dr = 0";
+    	String pk_glorg = (String) iuap.executeQuery(sql, new ColumnProcessor());
+    	if (pk_glorg == null) {
+    		throw new Exception("会计主体"+code+"未查到,请检查");
+        }
+        return pk_glorg;
+    }
+    
+    //查询会计主体账薄
+    public static String getGlorgbook(String pk_glorg)throws Exception {
+    	String sql = "select pk_glorgbook from bd_glorgbook where pk_glorg = '"+pk_glorg+"' and dr = 0";
+    	String pk_glorgbook = (String) iuap.executeQuery(sql, new ColumnProcessor());
+    	if (pk_glorgbook == null) {
+    		throw new Exception("会计主体账薄"+pk_glorg+"未查到,请检查");
+        }
+        return pk_glorgbook;
+    }
+    //查询凭证
+    public static Map<String,String> getVoucher(List<String> serNums)throws Exception {
+    	StringBuffer sql = new StringBuffer();
+    	sql.append("select Free2 from gl_voucher where Free2 in (");
+    	for (int i = 0; i < serNums.size(); i++) {
+    		sql.append("'"+serNums.get(i)+"',");
+		}
+    	//删除最后一个逗号
+    	sql.deleteCharAt(sql.length() - 1);
+    	sql.append(")");
+    	List<String> list = (List<String>) iuap.executeQuery(sql.toString(), new ColumnListProcessor());
+    	Map<String,String> map = new HashMap<String,String>();
+    	for (int i = 0; i < list.size(); i++) {
+    		String vaule = list.get(i);
+    		map.put(vaule, vaule);
+		}
+		return map;
+    	
+    }
+    
+}

+ 145 - 0
mc/mc/src/public/org/jeecg/common/util/HttpHelper.java

@@ -0,0 +1,145 @@
+package org.jeecg.common.util;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+
+/**
+ * @author fenghaifu
+ * @version V1.0
+ * @Copyright: 上海萃颠信息科技有限公司. All rights reserved.
+ * @Title:HttpHelper
+ * @projectName data-exchange-platform
+ * @Description:通用http请求
+ * @date: 2020/1/11 15:16
+ * @updatehistory: 2020/1/11 15:16 新增
+ */
+public class HttpHelper {	
+	
+	 /**
+     * Http post请求
+     * @param httpUrl 连接
+     * @param param 参数
+     * @return
+	 * @throws Exception 
+     */
+    public static String doPost(String httpUrl,  String param) throws Exception {
+        StringBuffer result = new StringBuffer();
+        //连接
+        HttpURLConnection connection = null;
+        OutputStream os = null;
+        InputStream is = null;
+        BufferedReader br = null;
+      //创建连接对象
+        URL url = new URL(httpUrl);
+        //创建连接
+        connection = (HttpURLConnection) url.openConnection();
+        //设置请求方法
+        connection.setRequestMethod("POST");
+        //设置连接超时时间
+        connection.setConnectTimeout(10000);
+        //设置读取超时时间
+        connection.setReadTimeout(10000);
+        //DoOutput设置是否向httpUrlConnection输出,DoInput设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个
+        //设置是否可读取
+        connection.setDoOutput(true);
+        connection.setDoInput(true);
+        //设置通用的请求属性
+        connection.setRequestProperty("accept", "*/*");
+        connection.setRequestProperty("connection", "Keep-Alive");
+        connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
+       /// connection.setRequestProperty("Content-Type", "application/json;charset=utf-8");
+        connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+        //拼装参数
+        if (null != param && !param.equals("")) {
+            //设置参数
+            os = connection.getOutputStream();
+            //拼装参数
+            os.write(param.getBytes("UTF-8"));
+        }
+        //设置权限
+        //设置请求头等
+        //开启连接
+        //connection.connect();
+        //读取响应
+        if (connection.getResponseCode() == 200) {
+            is = connection.getInputStream();
+            if (null != is) {
+                br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+                String temp = null;
+                while (null != (temp = br.readLine())) {
+                    result.append(temp);
+                    result.append("\r\n");
+                }
+            }
+        }
+        //关闭连接
+        connection.disconnect();
+        return result.toString();
+    }
+    
+    /**
+     * Http get请求
+     * @param httpUrl 连接
+     * @param param 参数
+     * @return
+	 * @throws Exception 
+     */
+    public static String doGet(String httpUrl,  String param) throws Exception {
+        StringBuffer result = new StringBuffer();
+        //连接
+        HttpURLConnection connection = null;
+        OutputStream os = null;
+        InputStream is = null;
+        BufferedReader br = null;
+      //创建连接对象
+        URL url = new URL(httpUrl);
+        //创建连接
+        connection = (HttpURLConnection) url.openConnection();
+        //设置请求方法
+        connection.setRequestMethod("GET");
+        //设置连接超时时间
+        connection.setConnectTimeout(10000);
+        //设置读取超时时间
+        connection.setReadTimeout(10000);
+        //DoOutput设置是否向httpUrlConnection输出,DoInput设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个
+        //设置是否可读取
+        connection.setDoOutput(true);
+        connection.setDoInput(true);
+        //设置通用的请求属性
+        connection.setRequestProperty("accept", "*/*");
+        connection.setRequestProperty("connection", "Keep-Alive");
+        connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
+        connection.setRequestProperty("Content-Type", "application/json;charset=utf-8");
+        //拼装参数
+        if (null != param && !param.equals("")) {
+            //设置参数
+            os = connection.getOutputStream();
+            //拼装参数
+            os.write(param.getBytes("UTF-8"));
+        }
+        //设置权限
+        //设置请求头等
+        //开启连接
+        //connection.connect();
+        //读取响应
+        if (connection.getResponseCode() == 200) {
+            is = connection.getInputStream();
+            if (null != is) {
+                br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+                String temp = null;
+                while (null != (temp = br.readLine())) {
+                    result.append(temp);
+                    result.append("\r\n");
+                }
+            }
+        }
+        //关闭连接
+        connection.disconnect();
+        return result.toString();
+    }
+}