sap推送接口修改
This commit is contained in:
		
							parent
							
								
									7c15c2ff1b
								
							
						
					
					
						commit
						aa2f977bf6
					
				|  | @ -36,7 +36,7 @@ public class CimIntBillBatchFormPlugin extends AbstractFormPlugin implements Plu | ||||||
|                         if (finsubscribe != null) { |                         if (finsubscribe != null) { | ||||||
|                             String cashManagementProducts = finsubscribe.getString("shjh_xjglcp"); |                             String cashManagementProducts = finsubscribe.getString("shjh_xjglcp"); | ||||||
|                             this.getModel().setValue("shjh_amountcontrl", cashManagementProducts, i); |                             this.getModel().setValue("shjh_amountcontrl", cashManagementProducts, i); | ||||||
|                             if ("1".equals(cashManagementProducts)) { |                             //if ("1".equals(cashManagementProducts)) { | ||||||
|                                 // 预提日期 |                                 // 预提日期 | ||||||
|                                 Date preintdate = (Date) this.getModel().getValue("preintdate"); |                                 Date preintdate = (Date) this.getModel().getValue("preintdate"); | ||||||
|                                 if (preintdate != null) { |                                 if (preintdate != null) { | ||||||
|  | @ -136,7 +136,7 @@ public class CimIntBillBatchFormPlugin extends AbstractFormPlugin implements Plu | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
|                         } |                         //} | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 this.getView().invokeOperation("save"); |                 this.getView().invokeOperation("save"); | ||||||
|  |  | ||||||
|  | @ -27,6 +27,7 @@ import shjh.jhzj7.fi.fi.utils.domin.ResponseData; | ||||||
| 
 | 
 | ||||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||||
|  | import java.util.Calendar; | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| 
 | 
 | ||||||
|  | @ -149,9 +150,9 @@ public class DepositpreintSapOperation extends AbstractOperationServicePlugIn im | ||||||
|         String shjh_pzh = prinfo.getString("shjh_sappzh"); |         String shjh_pzh = prinfo.getString("shjh_sappzh"); | ||||||
|         //添加会计凭证编号 |         //添加会计凭证编号 | ||||||
|         iteminfo.put("BELNR", shjh_pzh); |         iteminfo.put("BELNR", shjh_pzh); | ||||||
|         String shjh_year = prinfo.getString("shjh_sapyear"); | //        String shjh_year = prinfo.getString("shjh_sapyear"); | ||||||
|         //添加会计年度 | //        //添加会计年度 | ||||||
|         iteminfo.put("GJAHR", shjh_year); | //        iteminfo.put("GJAHR", shjh_year); | ||||||
|         //添加冲销原因-04-跨期冲销;默认04,冲销日期必传 |         //添加冲销原因-04-跨期冲销;默认04,冲销日期必传 | ||||||
|         iteminfo.put("STGRD", "04"); |         iteminfo.put("STGRD", "04"); | ||||||
|         //添加用户名-操作反清账按钮的用户(OA用户名) |         //添加用户名-操作反清账按钮的用户(OA用户名) | ||||||
|  | @ -163,15 +164,43 @@ public class DepositpreintSapOperation extends AbstractOperationServicePlugIn im | ||||||
|             iteminfo.put("UNAME",oauser);//用户名 |             iteminfo.put("UNAME",oauser);//用户名 | ||||||
|         } |         } | ||||||
|         //添加反清账日期 |         //添加反清账日期 | ||||||
|         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |         long batchnoid = prinfo.getLong("batchnoid"); | ||||||
|         String datestr = sdf.format(new Date()); |         if (batchnoid!=0L){ | ||||||
|         iteminfo.put("BUDAT", datestr); |             Date date = this.getSourceDate(batchnoid); | ||||||
|  |             if (date!=null){ | ||||||
|  |                 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||||||
|  |                 String datestr = sdf.format(date); | ||||||
|  |                 iteminfo.put("BUDAT", datestr); | ||||||
|  |                 SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy"); | ||||||
|  |                 String datestr2 = sdf2.format(date); | ||||||
|  |                 iteminfo.put("GJAHR", datestr2); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|         IT_LIST.add(iteminfo); |         IT_LIST.add(iteminfo); | ||||||
| 
 | 
 | ||||||
|         JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST,prinfo.getString("billno")); |         JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST,prinfo.getString("billno")); | ||||||
|         return sapReturnData; |         return sapReturnData; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     private Date getSourceDate(long batchnoid) { | ||||||
|  |         //联查蓝单 | ||||||
|  |         QFilter qFilter = new QFilter("batchnoid", QCP.equals, batchnoid);//批次id | ||||||
|  |         qFilter.and("operatetype",QCP.equals,"preint");//操作类别 | ||||||
|  |         DynamicObject depositprein = BusinessDataServiceHelper.loadSingle("cim_depositpreint", qFilter.toArray()); | ||||||
|  |         if (depositprein!=null){ | ||||||
|  |             Date bizDate=depositprein.getDate("businessdate"); | ||||||
|  |             if (bizDate != null) { | ||||||
|  |                 // 使用Calendar增加一个月 | ||||||
|  |                 Calendar calendar = Calendar.getInstance(); | ||||||
|  |                 calendar.setTime(bizDate); | ||||||
|  |                 calendar.add(Calendar.MONTH, 1); // 增加一个月 | ||||||
|  |                 return calendar.getTime(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return null; // 任意环节为空时返回null | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     private JSONObject sendBlueVoucher(DynamicObject prinfo, Map<String, String> sapMap){ |     private JSONObject sendBlueVoucher(DynamicObject prinfo, Map<String, String> sapMap){ | ||||||
|         //SAP定期预提收益凭证接口入参组装和调用 |         //SAP定期预提收益凭证接口入参组装和调用 | ||||||
|         JSONObject IS_HEADER = new JSONObject();//抬头 |         JSONObject IS_HEADER = new JSONObject();//抬头 | ||||||
|  | @ -179,8 +208,14 @@ public class DepositpreintSapOperation extends AbstractOperationServicePlugIn im | ||||||
|         String companyCode = prinfo.getDynamicObject("org").getString("number"); |         String companyCode = prinfo.getDynamicObject("org").getString("number"); | ||||||
|         IS_HEADER.put("BUKRS",companyCode);//公司代码 |         IS_HEADER.put("BUKRS",companyCode);//公司代码 | ||||||
|         IS_HEADER.put("BLART","SA");//凭证类型-总账类凭证 |         IS_HEADER.put("BLART","SA");//凭证类型-总账类凭证 | ||||||
|         IS_HEADER.put("BLDAT",sdf.format(prinfo.getDate("bizdate")));//凭证日期-业务日期 | 
 | ||||||
|         IS_HEADER.put("BUDAT",sdf.format(prinfo.getDate("bizdate")));//过账日期-业务日期 |         QFilter qFilter = new QFilter("sourcebill", QCP.equals, prinfo.getPkValue()); | ||||||
|  |         DynamicObject voucher = BusinessDataServiceHelper.loadSingle("gl_voucher", qFilter.toArray()); | ||||||
|  |         if (voucher != null) { | ||||||
|  |             IS_HEADER.put("BLDAT",sdf.format(voucher.getDate("bizdate")));//凭证日期-业务日期 | ||||||
|  |             IS_HEADER.put("BUDAT",sdf.format(voucher.getDate("bookeddate")));//过账日期-业务日期 | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         String isoCode = prinfo.getDynamicObject("currency").getString("number"); |         String isoCode = prinfo.getDynamicObject("currency").getString("number"); | ||||||
|         IS_HEADER.put("WAERS", JhzjUtils.getCurrencyCode(isoCode));//币种 |         IS_HEADER.put("WAERS", JhzjUtils.getCurrencyCode(isoCode));//币种 | ||||||
|         IS_HEADER.put("XBLNR",prinfo.getString("billno"));//参考凭证号-单据编号 固定长度16位 |         IS_HEADER.put("XBLNR",prinfo.getString("billno"));//参考凭证号-单据编号 固定长度16位 | ||||||
|  |  | ||||||
|  | @ -308,8 +308,16 @@ public class RecPushVoucherOperation extends AbstractOperationServicePlugIn impl | ||||||
|         IS_HEADER.put("BLDAT", bizDate != null ? format.format(bizDate) : ""); |         IS_HEADER.put("BLDAT", bizDate != null ? format.format(bizDate) : ""); | ||||||
| 
 | 
 | ||||||
|         // 过账日期 |         // 过账日期 | ||||||
|         Date payeeDate = recBill.getDate("payeedate"); | //        Date payeeDate = recBill.getDate("payeedate"); | ||||||
|         IS_HEADER.put("BUDAT", payeeDate != null ? format.format(payeeDate) : ""); | //        IS_HEADER.put("BUDAT", payeeDate != null ? format.format(payeeDate) : ""); | ||||||
|  | 
 | ||||||
|  |         QFilter voucherFilters = new QFilter("sourcebill", QCP.equals, recBill.getPkValue()); | ||||||
|  |         DynamicObject gl_voucher = BusinessDataServiceHelper.loadSingle("gl_voucher", voucherFilters.toArray()); | ||||||
|  |         if (gl_voucher != null) { | ||||||
|  |             Date payeeDate = gl_voucher.getDate("bizdate"); | ||||||
|  |             IS_HEADER.put("BUDAT", payeeDate != null ? format.format(payeeDate) : ""); | ||||||
|  | 
 | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         // 币种 |         // 币种 | ||||||
|         DynamicObject currency = recBill.getDynamicObject("currency"); |         DynamicObject currency = recBill.getDynamicObject("currency"); | ||||||
|  |  | ||||||
|  | @ -26,6 +26,7 @@ import shjh.jhzj7.fi.fi.utils.domin.ResponseData; | ||||||
| 
 | 
 | ||||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||||
|  | import java.util.Calendar; | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| 
 | 
 | ||||||
|  | @ -149,9 +150,9 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme | ||||||
|         String shjh_pzh = prinfo.getString("shjh_sappzh"); |         String shjh_pzh = prinfo.getString("shjh_sappzh"); | ||||||
|         //添加会计凭证编号 |         //添加会计凭证编号 | ||||||
|         iteminfo.put("BELNR", shjh_pzh); |         iteminfo.put("BELNR", shjh_pzh); | ||||||
|         String shjh_year = prinfo.getString("shjh_sapyear"); | //        String shjh_year = prinfo.getString("shjh_sapyear"); | ||||||
|         //添加会计年度 | //        //添加会计年度 | ||||||
|         iteminfo.put("GJAHR", shjh_year); | //        iteminfo.put("GJAHR", shjh_year); | ||||||
|         //添加冲销原因-04-跨期冲销;默认04,冲销日期必传 |         //添加冲销原因-04-跨期冲销;默认04,冲销日期必传 | ||||||
|         iteminfo.put("STGRD", "04"); |         iteminfo.put("STGRD", "04"); | ||||||
|         //添加用户名-操作反清账按钮的用户(OA用户名) |         //添加用户名-操作反清账按钮的用户(OA用户名) | ||||||
|  | @ -163,9 +164,19 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme | ||||||
|             iteminfo.put("UNAME",oauser);//用户名 |             iteminfo.put("UNAME",oauser);//用户名 | ||||||
|         } |         } | ||||||
|         //添加反清账日期 |         //添加反清账日期 | ||||||
|         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |         String writeoffbillno = prinfo.getString("billno");//单据号 | ||||||
|         String datestr = sdf.format(new Date()); |         if (writeoffbillno!=null){ | ||||||
|         iteminfo.put("BUDAT", datestr); |             Date date = this.getSourceDate(writeoffbillno); | ||||||
|  |             if (date!=null){ | ||||||
|  |                 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||||||
|  |                 String datestr = sdf.format(date); | ||||||
|  |                 iteminfo.put("BUDAT", datestr); | ||||||
|  |                 SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy"); | ||||||
|  |                 String datestr2 = sdf2.format(date); | ||||||
|  |                 iteminfo.put("BELNR", datestr2); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|         IT_LIST.add(iteminfo); |         IT_LIST.add(iteminfo); | ||||||
| 
 | 
 | ||||||
|         JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST,prinfo.getString("billno")); |         JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST,prinfo.getString("billno")); | ||||||
|  | @ -179,6 +190,23 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme | ||||||
|         return sapReturnData; |         return sapReturnData; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     private Date getSourceDate(String writeoffbillno) { | ||||||
|  |         //联查蓝单 | ||||||
|  |         QFilter qFilter = new QFilter("writeoffbillno", QCP.equals, writeoffbillno); | ||||||
|  |         DynamicObject intBillRevenue = BusinessDataServiceHelper.loadSingle("cim_intbill_revenue", qFilter.toArray()); | ||||||
|  |         if (intBillRevenue!=null){ | ||||||
|  |             Date bizDate=intBillRevenue.getDate("bizdate"); | ||||||
|  |                 if (bizDate != null) { | ||||||
|  |                     // 使用Calendar增加一个月 | ||||||
|  |                     Calendar calendar = Calendar.getInstance(); | ||||||
|  |                     calendar.setTime(bizDate); | ||||||
|  |                     calendar.add(Calendar.MONTH, 1); // 增加一个月 | ||||||
|  |                     return calendar.getTime(); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         return null; // 任意环节为空时返回null | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     private JSONObject sendBlueVoucher(DynamicObject prinfo, Map<String, String> sapMap){ |     private JSONObject sendBlueVoucher(DynamicObject prinfo, Map<String, String> sapMap){ | ||||||
|         //SAP预提收益凭证接口入参组装和调用 |         //SAP预提收益凭证接口入参组装和调用 | ||||||
|         JSONObject IS_HEADER = new JSONObject();//抬头 |         JSONObject IS_HEADER = new JSONObject();//抬头 | ||||||
|  | @ -186,8 +214,14 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme | ||||||
|         String companyCode = prinfo.getDynamicObject("org").getString("number"); |         String companyCode = prinfo.getDynamicObject("org").getString("number"); | ||||||
|         IS_HEADER.put("BUKRS",companyCode);//公司代码 |         IS_HEADER.put("BUKRS",companyCode);//公司代码 | ||||||
|         IS_HEADER.put("BLART","SA");//凭证类型-总账类凭证 |         IS_HEADER.put("BLART","SA");//凭证类型-总账类凭证 | ||||||
|         IS_HEADER.put("BLDAT",sdf.format(prinfo.getDate("bizdate")));//凭证日期-业务日期 | 
 | ||||||
|         IS_HEADER.put("BUDAT",sdf.format(prinfo.getDate("bizdate")));//过账日期-业务日期 |         QFilter qFilter = new QFilter("sourcebill", QCP.equals, prinfo.getPkValue()); | ||||||
|  |         DynamicObject voucher = BusinessDataServiceHelper.loadSingle("gl_voucher", qFilter.toArray()); | ||||||
|  |         if (voucher != null) { | ||||||
|  |             IS_HEADER.put("BLDAT",sdf.format(voucher.getDate("bizdate")));//凭证日期-业务日期 | ||||||
|  |             IS_HEADER.put("BUDAT",sdf.format(voucher.getDate("bookeddate")));//过账日期-业务日期 | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         String isoCode = prinfo.getDynamicObject("currency").getString("number"); |         String isoCode = prinfo.getDynamicObject("currency").getString("number"); | ||||||
|         IS_HEADER.put("WAERS", JhzjUtils.getCurrencyCode(isoCode));//币种 |         IS_HEADER.put("WAERS", JhzjUtils.getCurrencyCode(isoCode));//币种 | ||||||
|         IS_HEADER.put("XBLNR",prinfo.getString("billno"));//参考凭证号-单据编号 固定长度16位 |         IS_HEADER.put("XBLNR",prinfo.getString("billno"));//参考凭证号-单据编号 固定长度16位 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue