客商接口优化
This commit is contained in:
		
							parent
							
								
									29cc466912
								
							
						
					
					
						commit
						652ad1d00a
					
				|  | @ -137,6 +137,7 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem | |||
|                 //处理银行信息-分表 | ||||
|                 if(banksJson != null){ | ||||
|                     doc_bank = currentSup.getDynamicObjectCollection("entry_bank"); | ||||
|                     doc_bank.clear(); | ||||
|                     for (int j = 0; j < banksJson.size(); j++) { | ||||
|                         json_bank = banksJson.getJSONObject(j); | ||||
|                         if(!supnumber.equals(json_bank.getString("code"))){ | ||||
|  | @ -153,14 +154,12 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem | |||
|                             continue; | ||||
|                         } | ||||
|                         //供应商银行账户对象从现有集合中查找,查找不到,则新增 | ||||
|                         bankinfo = getBankInfo(doc_bank,json_bank.getString("banknumber")); | ||||
|                         if(bankinfo == null && "E".equals(json_bank.getString("bankstatus"))){ | ||||
| //                        bankinfo = getBankInfo(doc_bank,json_bank.getString("banknumber")); | ||||
|                         if("E".equals(json_bank.getString("bankstatus"))){ | ||||
|                             //如果本次入参银行账户未在系统生成,且sap是删除的,我方不接收 | ||||
|                             continue; | ||||
|                         } | ||||
|                         if(bankinfo == null){ | ||||
|                             bankinfo = doc_bank.addNew(); | ||||
|                         } | ||||
|                         bankinfo = doc_bank.addNew(); | ||||
|                         bankinfo.set("bankaccount",json_bank.getString("banknumber"));//银行账号 | ||||
|                         bankinfo.set("accountname",json_bank.getString("acctname"));//账户名称 | ||||
|                         bankinfo.set("bank",bebankinfo.getLong("id"));//开户银行-行名行号 根据入参查找 | ||||
|  |  | |||
|  | @ -1,16 +1,12 @@ | |||
| package shjh.jhzj7.fi.fi.utils; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.util.HttpClientUtils; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Objects; | ||||
| 
 | ||||
| /** | ||||
|  * 待办集成工具类-->泛微 | ||||
|  | @ -70,7 +66,7 @@ public class OAUtils { | |||
|         jsonObject.put("syscode", "jindie");//异构系统标识 | ||||
|         jsonObject.put("flowid", ""+(thirdPartyMap.get("flowid")));//流程任务ID,流程数据的标识,可自定义 | ||||
|         jsonObject.put("requestname", ""+(thirdPartyMap.get("requestname")));//标题 | ||||
|         jsonObject.put("workflowname", "流程类型测试用"); | ||||
|         jsonObject.put("workflowname", "资金系统流程"); | ||||
|         jsonObject.put("nodename", ""+(thirdPartyMap.get("nodename")));//步骤名称(节点名称) | ||||
|         jsonObject.put("pcurl", ""+(thirdPartyMap.get("pcurl")));//PC地址,第三方系统中流程处理界面的PC端地址 | ||||
|         jsonObject.put("appurl", ""+(thirdPartyMap.get("appurl")));//APP地址,第三方系统中流程处理界面的移动端地址 | ||||
|  |  | |||
|  | @ -68,7 +68,7 @@ public class CustomerControler { | |||
|         String cusname; | ||||
|         String taxno; | ||||
|         String type; | ||||
|         String bankcode; | ||||
| //        String bankcode; | ||||
|         DynamicObject currentCus; | ||||
|         DynamicObject custype; | ||||
|         JSONObject json_body; | ||||
|  | @ -87,7 +87,7 @@ public class CustomerControler { | |||
|                 log.error(String.format("客户接口入参为空异常:%s", json_body.toJSONString())); | ||||
|                 itemInfo = new JSONObject(); | ||||
|                 itemInfo.put("code",cusnumber); | ||||
|                 itemInfo.put("error","入参值为空"); | ||||
|                 itemInfo.put("error","code name type入参值为空"); | ||||
|                 itemsJson.add(itemInfo); | ||||
|                 continue; | ||||
|             } | ||||
|  | @ -185,20 +185,46 @@ public class CustomerControler { | |||
| //        doc_five.clear(); | ||||
|         JSONObject json_body; | ||||
|         DynamicObject fiveinfo; | ||||
|         String channelnum; | ||||
|         String companynum; | ||||
|         String fivecode; | ||||
|         for (int i = 0; i < customerfivesJson.size(); i++) { | ||||
|             json_body = customerfivesJson.getJSONObject(i); | ||||
|             if(cusnumber.equals(json_body.getString("code"))){ | ||||
|                 fiveinfo = doc_five.addNew(); | ||||
|                 fiveinfo.set("shjh_channelnum",json_body.getString("channelnum"));//渠道编号 | ||||
|                 channelnum = json_body.getString("channelnum"); | ||||
|                 companynum = json_body.getString("salecompanynum"); | ||||
|                 fivecode = json_body.getString("customerfivecode"); | ||||
|                 if(EsbUtils.isEmpty(channelnum) || EsbUtils.isEmpty(companynum) || EsbUtils.isEmpty(fivecode)){ | ||||
|                     //任意一个为空,则不处理 | ||||
|                     log.error(String.format("客户组5入参值为空:%s", json_body.toJSONString())); | ||||
|                     continue; | ||||
|                 } | ||||
|                 fiveinfo = getFiveInfo(doc_five,channelnum,companynum,fivecode); | ||||
|                 if(fiveinfo == null){ | ||||
|                     fiveinfo = doc_five.addNew(); | ||||
|                 } | ||||
|                 fiveinfo.set("shjh_channelnum",channelnum);//渠道编号 | ||||
|                 fiveinfo.set("shjh_channelname",json_body.getString("channelname"));//渠道名称 | ||||
|                 fiveinfo.set("shjh_salecompanynum",json_body.getString("salecompanynum"));//公司编号 | ||||
|                 fiveinfo.set("shjh_entryfive_number",json_body.getString("customerfivecode"));//编号 | ||||
|                 fiveinfo.set("shjh_salecompanynum",companynum);//公司编号 | ||||
|                 fiveinfo.set("shjh_entryfive_number",fivecode);//编号 | ||||
|                 fiveinfo.set("shjh_entryfive_name",json_body.getString("customerfivename"));//名称 | ||||
|                 fiveinfo.set("shjh_status",EsbUtils.getStatusForBoolean(json_body.getString("customerfivestatus")));//状态 | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private DynamicObject getFiveInfo(DynamicObjectCollection doc_five, String channelnum, String companynum, String fivecode){ | ||||
|         //从当前客户的渠道编号 公司编号 客户组5编号查找对应对象 | ||||
|         for (DynamicObject fiveinfo : doc_five) { | ||||
|             if(channelnum.equals(fiveinfo.getString("shjh_channelnum")) && | ||||
|                     companynum.equals(fiveinfo.getString("shjh_salecompanynum")) && | ||||
|                     fivecode.equals(fiveinfo.getString("shjh_entryfive_number"))){ | ||||
|                 return fiveinfo; | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|     private void handleBank(JSONArray banksJson,DynamicObjectCollection doc_bank,String cusnumber){ | ||||
|         if(banksJson == null){ | ||||
|             return; | ||||
|  |  | |||
|  | @ -246,6 +246,16 @@ public class SupplierControler { | |||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|     private DynamicObject getSAPInfo(DynamicObjectCollection doc_sap, String companynum){ | ||||
|         //从当前供应商的sap公司集合中获取对应的对象 | ||||
|         for (DynamicObject bankinfo : doc_sap) { | ||||
|             if(companynum.equals(bankinfo.getString("shjh_companynum"))){ | ||||
|                 return bankinfo; | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|     private void handleSAPCompany(JSONArray companysJson,DynamicObjectCollection doc_sap,String supnumber){ | ||||
|         if(companysJson == null){ | ||||
|             return; | ||||
|  | @ -255,8 +265,12 @@ public class SupplierControler { | |||
|         DynamicObject fiveinfo; | ||||
|         for (int i = 0; i < companysJson.size(); i++) { | ||||
|             json_body = companysJson.getJSONObject(i); | ||||
|             if(supnumber.equals(json_body.getString("code"))){ | ||||
|                 fiveinfo = doc_sap.addNew(); | ||||
|             if(supnumber.equals(json_body.getString("code")) && !EsbUtils.isEmpty(json_body.getString("companynum"))){ | ||||
|                 //仅处理当前供应商公司编号不为空的数据 | ||||
|                 fiveinfo = getSAPInfo(doc_sap,json_body.getString("companynum")); | ||||
|                 if(fiveinfo == null){ | ||||
|                     fiveinfo = doc_sap.addNew(); | ||||
|                 } | ||||
|                 fiveinfo.set("shjh_settlementmethod",json_body.getString("settlementmethod"));//结算方式编号 | ||||
|                 fiveinfo.set("shjh_accountnumber",json_body.getString("accountnumber"));//统驭科目编号 | ||||
|                 fiveinfo.set("shjh_companynum",json_body.getString("companynum"));//公司编号 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue