提交内容:收开票登记API代码/销户申请移动端代码/查询星空收付款单代码/推送星空付款单电子回单附件代码
时间:2025-05-10 16:54 提交人:邹江涛
This commit is contained in:
		
							parent
							
								
									a2b143c8ff
								
							
						
					
					
						commit
						d6bda87337
					
				|  | @ -582,6 +582,7 @@ public class PayBillApiSavePlugin implements ApiSavePlugin { | |||
|                     } | ||||
|                 } | ||||
|                 else if ("cas_paybill_syn_BT_S".equals(billtype_number) && "XK".equals(shkd_businessname)) {// 星空传的同名转账 | ||||
|                     logger.info("同名转账"); | ||||
|                     // 收款人ID | ||||
|                     fieldName1 = "payee"; | ||||
|                     // 付款银行编码 | ||||
|  | @ -614,7 +615,6 @@ public class PayBillApiSavePlugin implements ApiSavePlugin { | |||
|                         } else { | ||||
|                             map.put("paymentchannel", "counter"); | ||||
|                         } | ||||
| 
 | ||||
|                     } | ||||
|                     logger.info("付款银行:{}", payerbank); | ||||
|                     map.put(fieldName2, payerbank); | ||||
|  | @ -623,13 +623,11 @@ public class PayBillApiSavePlugin implements ApiSavePlugin { | |||
|                     number.put("number", map.get("payeenumber").toString()); | ||||
|                     map.put("shkd_org", number); | ||||
| 
 | ||||
|                     DynamicObject[] objects = BusinessDataServiceHelper.load(payeetype.toString(), "id,number,name,", new QFilter("number", QCP.equals, map.get("payeenumber").toString()).toArray()); | ||||
|                     DynamicObject[] objects = BusinessDataServiceHelper.load("bos_org", "id,number,name,", new QFilter("number", QCP.equals, map.get("payeenumber").toString()).toArray()); | ||||
|                     if (objects.length > 0) { | ||||
|                         // 收款人编码 | ||||
|                         map.put("payeenumber", objects[0].getString("number")); | ||||
|                         logger.info("收款人查询长度 → " + objects.length); | ||||
|                         // 收款人ID | ||||
|                         map.put(fieldName1, objects[0].getPkValue()); | ||||
|                         //收款人编码 | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  |  | |||
|  | @ -0,0 +1,77 @@ | |||
| package shkd.sys.sys.plugin.api; | ||||
| 
 | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.openapi.api.plugin.ApiSavePlugin; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| 
 | ||||
| import java.io.Serializable; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * @Description | ||||
|  * @Author Tao | ||||
|  * @Date 2025/5/7 | ||||
|  */ | ||||
| public class TicketRegistration implements Serializable, ApiSavePlugin { | ||||
|     private static final Log logger = LogFactory.getLog(TicketRegistration.class); | ||||
|     private static final long serialVersionUID = -8914131887559511342L; | ||||
| 
 | ||||
|     @Override | ||||
|     public List<Map<String, Object>> preHandleRequestData(List<Map<String, Object>> reqData) { | ||||
|         for (Map<String, Object> map : reqData) { | ||||
|             String payeetype = map.get("payeetype").toString(); | ||||
|             /** | ||||
|              * bos_org | ||||
|              * bd_supplier | ||||
|              * bd_customer | ||||
|              * bos_user | ||||
|              * other | ||||
|              */ | ||||
|             if ("bd_supplier".equals(payeetype) || "bd_customer".equals(payeetype)) { | ||||
|                 if (map.get("deliver") != null) { | ||||
|                     logger.info("进入收票登记"); | ||||
|                     Map<String, Object> deliver = (Map<String, Object>) map.get("deliver"); | ||||
|                     String deliver_number = deliver.get("number").toString(); | ||||
|                     DynamicObject[] objects = BusinessDataServiceHelper.load(payeetype, "id,number," + | ||||
|                                     "name,societycreditcode,entry_bank,entry_bank.bankaccount,entry_bank.accountname,entry_bank.bank", | ||||
|                             new QFilter("societycreditcode", QCP.equals, deliver_number).toArray()); | ||||
|                     if (objects.length > 0) { | ||||
|                         logger.info("进入收票登记→objects.length > 0"); | ||||
|                         Map<String, Object> societycreditcode = new HashMap<>(); | ||||
|                         societycreditcode.put("number", objects[0].getString("number")); | ||||
|                         map.put("deliver", societycreditcode); | ||||
|                     } | ||||
|                 } | ||||
| 
 | ||||
|                 if (map.get("receiver") != null) {//receiver_number | ||||
|                     logger.info("进入开票登记"); | ||||
|                     Map<String, Object> deliver = (Map<String, Object>) map.get("receiver"); | ||||
|                     String receiver_number = deliver.get("number").toString(); | ||||
|                     DynamicObject[] objects = BusinessDataServiceHelper.load(payeetype, "id,number," + | ||||
|                                     "name,societycreditcode,entry_bank,entry_bank.bankaccount,entry_bank.accountname,entry_bank.bank", | ||||
|                             new QFilter("societycreditcode", QCP.equals, receiver_number).toArray()); | ||||
|                     if (objects.length > 0) { | ||||
|                         logger.info("进入开票登记→objects.length > 0"); | ||||
|                         Map<String, Object> societycreditcode = new HashMap<>(); | ||||
|                         societycreditcode.put("number", objects[0].getString("number")); | ||||
|                         map.put("receiver", societycreditcode); | ||||
|                     } | ||||
|                 } | ||||
|             } else if ("bos_org".equals(payeetype)) { | ||||
| 
 | ||||
|             } else if ("bos_user".equals(payeetype)) { | ||||
| 
 | ||||
|             } else if ("other".equals(payeetype)) { | ||||
| 
 | ||||
|             } | ||||
|         } | ||||
|         return reqData; | ||||
|     } | ||||
| } | ||||
|  | @ -3,6 +3,8 @@ package shkd.sys.sys.plugin.form; | |||
| import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import com.kingdee.bos.webapi.entity.IdentifyInfo; | ||||
| import com.kingdee.bos.webapi.sdk.K3CloudApi; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.entity.datamodel.events.PropertyChangedArgs; | ||||
|  | @ -109,6 +111,50 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { | |||
|             String token = ApiService.getBIPToken(domainName, appKey, appSecret); | ||||
|             this.getModel().setValue("shkd_token", token); | ||||
|         } | ||||
| 
 | ||||
|         // 查询星空单据 | ||||
|         if ("shkd_queryxk".equals(itemKey)) { | ||||
|             // 获取想要推送单据编码 | ||||
|             String billNumber = dataEntity.getString("shkd_sourcenumber"); | ||||
|             logger.info("获取推送单据编码 → billNumber:{}", billNumber); | ||||
|             // 获取想要推送单据类型 | ||||
|             String billMark = dataEntity.getDynamicObject("shkd_sourcebill").getString("number"); | ||||
|             logger.info("获取推送单据类型 → billMark:{}", billMark); | ||||
|             String xkBillType = null; | ||||
|             if ("cas_paybill".equals(billMark)) { | ||||
|                 xkBillType = "AP_PAYBILL"; | ||||
|             } else if ("cas_recbill".equals(billMark)) { | ||||
|                 xkBillType = "AR_RECEIVEBILL"; | ||||
|             } | ||||
|             IdentifyInfo iden = new IdentifyInfo(); | ||||
|             iden.setUserName(dataEntity.getString("shkd_xkusername"));// properties.getProperty("X-KDApi-UserName") | ||||
|             iden.setAppId(dataEntity.getString("shkd_xkappid"));// properties.getProperty("X-KDApi-AppID") | ||||
|             iden.setdCID(dataEntity.getString("shkd_xkacctid"));// properties.getProperty("X-KDApi-AcctID") | ||||
|             iden.setAppSecret(dataEntity.getString("shkd_xkappsec"));// properties.getProperty("X-KDApi-AppSec") | ||||
|             iden.setlCID(2052); | ||||
|             iden.setServerUrl(dataEntity.getString("shkd_xkserverurl"));// properties.getProperty("X-KDApi-ServerUrl") | ||||
|             K3CloudApi k3CloudApi = new K3CloudApi(iden); | ||||
|             JSONObject jsonObject = new JSONObject(); | ||||
|             jsonObject.put("OrderString", ""); | ||||
|             jsonObject.put("TopRowCount", 0); | ||||
|             jsonObject.put("SubSystemId", ""); | ||||
|             jsonObject.put("FieldKeys", "FBillNo,FID"); | ||||
|             jsonObject.put("FormId", xkBillType); | ||||
|             jsonObject.put("Limit", 2000); | ||||
|             jsonObject.put("FilterString", "F_keed_SKDJBH='" + billNumber + "'"); | ||||
|             jsonObject.put("StartRow", 0); | ||||
|             try { | ||||
|                 List<List<Object>> lists = k3CloudApi.executeBillQuery(jsonObject.toString()); | ||||
|                 if (lists.isEmpty()) { | ||||
|                     this.getView().showTipNotification("未查找到单据"); | ||||
|                 } else { | ||||
|                     List<Object> objects = lists.get(0); | ||||
|                     this.getView().showSuccessNotification("查找到单据 → 星空单据编码:" + objects.get(0) + ",星空单据ID:" + objects.get(1)); | ||||
|                 } | ||||
|             } catch (Exception e) { | ||||
|                 throw new RuntimeException(e); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void parseJson(Object obj, int level, String parentKey) { | ||||
|  |  | |||
|  | @ -0,0 +1,37 @@ | |||
| package shkd.sys.sys.plugin.mob; | ||||
| 
 | ||||
| import kd.bos.bill.AbstractMobBillPlugIn; | ||||
| import kd.bos.form.events.AfterDoOperationEventArgs; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| 
 | ||||
| /** | ||||
|  * 单据界面插件(移动端) | ||||
|  * 销户申请返回列表 | ||||
|  */ | ||||
| public class AccountClosureMobBillPlugin extends AbstractMobBillPlugIn implements Plugin { | ||||
|     private static final Log logger = LogFactory.getLog(AccountClosureMobBillPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { | ||||
|         super.afterDoOperation(afterDoOperationEventArgs); | ||||
|         logger.info("进入afterDoOperation方法"); | ||||
|         if (afterDoOperationEventArgs.getOperateKey().equals("donothing")) { | ||||
|             boolean success = afterDoOperationEventArgs.getOperationResult().isSuccess();//是否成功 | ||||
|             if (success) { | ||||
|                 logger.info("进入donothing"); | ||||
|                 // 插件代码 | ||||
|                 HashMap<String, Object> map = new HashMap<>(); | ||||
|                 map.put("method", "setLocalStorage"); | ||||
|                 HashMap<String, Object> args = new HashMap<>(); | ||||
|                 args.put("key", "123"); | ||||
|                 args.put("value", "456"); | ||||
|                 map.put("args", args); | ||||
|                 this.getView().executeClientCommand("callAPPApi", map); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -16,6 +16,7 @@ import java.util.HashMap; | |||
| 
 | ||||
| /** | ||||
|  * 单据界面插件(移动端) | ||||
|  * 新版审批流界面返回列表 | ||||
|  */ | ||||
| public class ApprovalMobBillPlugin extends AbstractMobBillPlugIn implements Plugin { | ||||
|     private static final Log logger = LogFactory.getLog(ApprovalMobBillPlugin.class); | ||||
|  |  | |||
|  | @ -221,6 +221,7 @@ public class PushTaskPlugin extends AbstractTask implements Plugin { | |||
|                                      * 1、第一步 通过查询到的符合条件的收款或者付款单单据编号查到对应星空的对应单据的单据ID和单据编码 | ||||
|                                      * 2、推送电子回单至星空对应单据 | ||||
|                                      */ | ||||
| 
 | ||||
|                                     DynamicObject[] dynamicObjects1 = BusinessDataServiceHelper.load("t_bei_elecreceipt", "id,receiptno", new QFilter("receiptno", QCP.equals, details.get(0).getString("receiptno")).toArray()); | ||||
|                                     DynamicObject dynamicObjectObj = BusinessDataServiceHelper.loadSingle(dynamicObjects1[0].getPkValue(), dynamicObjects1[0].getDynamicObjectType().getName()); | ||||
|                                     IFormView viewByDynamicObj = createViewByDynamicObj(dynamicObjectObj); | ||||
|  | @ -235,7 +236,7 @@ public class PushTaskPlugin extends AbstractTask implements Plugin { | |||
| 
 | ||||
|                                     JSONObject jsonObject = new JSONObject(); | ||||
|                                     jsonObject.put("FileName", upfileName);// 文件名 | ||||
|                                     jsonObject.put("FormId", "表单id");// 表单id | ||||
|                                     jsonObject.put("FormId", "AP_PAYBILL");// 表单id(付款单:AP_PAYBILL) | ||||
|                                     jsonObject.put("IsLast", true);// 是否最后一次上传 | ||||
|                                     jsonObject.put("InterId", "单据内码");// 单据内码 | ||||
|                                     jsonObject.put("BillNO", dynamicObject.getString("billno"));// 单据编码 | ||||
|  | @ -291,7 +292,7 @@ public class PushTaskPlugin extends AbstractTask implements Plugin { | |||
| 
 | ||||
|                                     JSONObject jsonObject = new JSONObject(); | ||||
|                                     jsonObject.put("FileName", upfileName);// 文件名 | ||||
|                                     jsonObject.put("FormId", "表单id");// 表单id | ||||
|                                     jsonObject.put("FormId", "AP_PAYBILL");// 表单id(收款单:) | ||||
|                                     jsonObject.put("IsLast", true);// 是否最后一次上传 | ||||
|                                     jsonObject.put("InterId", "单据内码");// 单据内码 | ||||
|                                     jsonObject.put("BillNO", dynamicObject.getString("billno"));// 单据编码 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue