删除后同步修改BIP的开票申请存的NCC信息-请求接口地址调整
This commit is contained in:
		
							parent
							
								
									afc8bff1c4
								
							
						
					
					
						commit
						12df83d8b3
					
				|  | @ -3,9 +3,12 @@ package nc.bs.so.m32.maintain.rule.delete; | |||
| import com.alibaba.fastjson.JSONObject; | ||||
| import com.google.gson.Gson; | ||||
| import com.yonyou.cloud.utils.StringUtils; | ||||
| import nc.bs.dao.DAOException; | ||||
| import nc.bs.logging.Logger; | ||||
| import nc.bs.trade.business.HYSuperDMO; | ||||
| import nc.bs.uapbd.util.IgnoreSslUtil; | ||||
| import nc.impl.pubapp.pattern.rule.IRule; | ||||
| import nc.vo.bd.defdoc.DefdocVO; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| import nc.vo.so.m32.entity.SaleInvoiceBVO; | ||||
| import nc.vo.so.m32.entity.SaleInvoiceHVO; | ||||
|  | @ -30,11 +33,12 @@ import java.util.*; | |||
|  * @date 2025/3/20 | ||||
|  */ | ||||
| public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> { | ||||
| 
 | ||||
|     private HYSuperDMO superDMO = null; | ||||
|     private static String appKey = "a3c57e0d871240e9b9bf56b35001a324"; | ||||
|     private static String appSecret = "a959f7786db8dbb9a2c0493b5855a46bea68ad75"; | ||||
|     private static String tokenUrl = "https://www.tkkfbip.com/iuap-api-auth/open-auth/selfAppAuth/getAccessToken"; | ||||
|     private static String toBipUrl = "https://www.tkkfbip.com/iuap-api-gateway/oxp4h3x6/current_yonbip_default_sys/KKAPI/invoiceApplication/updateInvoice?access_token="; | ||||
|     private String baseUrl = "https://www.tkkfbip.com"; | ||||
|     private static String tokenUrl = "/iuap-api-auth/open-auth/selfAppAuth/getAccessToken"; | ||||
|     private static String toBipUrl = "/iuap-api-gateway/oxp4h3x6/current_yonbip_default_sys/KKAPI/invoiceApplication/updateInvoice?access_token="; | ||||
| 
 | ||||
|     @Override | ||||
|     public void process(SaleInvoiceVO[] vos) { | ||||
|  | @ -46,6 +50,16 @@ public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> { | |||
|             if (!hasVdef38) { | ||||
|                 return; | ||||
|             } | ||||
|             // 从自定义档案中获取 | ||||
|             Map<String, String> bipParamMap = checkBipParam(); | ||||
|             if (bipParamMap.isEmpty()) { | ||||
|                 return; | ||||
|             } | ||||
|             baseUrl = bipParamMap.get("baseUrl"); | ||||
|             appKey = bipParamMap.get("appKey"); | ||||
|             appSecret = bipParamMap.get("appSecret"); | ||||
|             NCCForUAPLogger.debug(String.format("SyncBipBillRuleForDelete-baseUrl = [%s],appKey1 = [%s],appSecret = [%s],", | ||||
|                     baseUrl, appKey, appSecret)); | ||||
|             String access_token = getAccessToken(); | ||||
|             for (SaleInvoiceVO invoiceVO : vos) { | ||||
|                 SaleInvoiceHVO hvo = invoiceVO.getParentVO(); | ||||
|  | @ -71,7 +85,7 @@ public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> { | |||
|                     updateJson.put("id", vdef38); | ||||
|                     updateJson.put("saleInvoiceId", ""); | ||||
|                     updateJson.put("contractInvoiceApplicationDetailList", childrenList); | ||||
|                     String bipRes = doPost(toBipUrl + access_token, updateJson); | ||||
|                     String bipRes = doPost(baseUrl + toBipUrl + access_token, updateJson); | ||||
|                     NCCForUAPLogger.debug("SyncBipBillRuleForDelete-bipRes = " + bipRes); | ||||
|                 } | ||||
|             } | ||||
|  | @ -80,6 +94,13 @@ public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public HYSuperDMO getSuperDMO() { | ||||
|         if (superDMO == null) { | ||||
|             superDMO = new HYSuperDMO(); | ||||
|         } | ||||
|         return superDMO; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * »ñÈ¡Æì½¢°æµÄtoken | ||||
|      * | ||||
|  | @ -106,7 +127,7 @@ public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> { | |||
|         String base64String = Base64.getEncoder().encodeToString(signData); | ||||
|         String signature = URLEncoder.encode(base64String, "UTF-8"); | ||||
|         params.put("signature", signature); | ||||
|         String responseString = doGet(tokenUrl, params); | ||||
|         String responseString = doGet(baseUrl + tokenUrl, params); | ||||
|         Gson gson = new Gson(); | ||||
|         Map result = gson.fromJson(responseString, Map.class); | ||||
|         String access_token = ""; | ||||
|  | @ -198,4 +219,25 @@ public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> { | |||
|         } | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 检查bip参数是否完整 | ||||
|      */ | ||||
|     private Map<String, String> checkBipParam() { | ||||
|         Map<String, String> map = new HashMap<String, String>(); | ||||
|         String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='BIP-sq' and dr=0 ) and dr=0"; | ||||
|         try { | ||||
|             DefdocVO[] defdocVOs = (DefdocVO[]) getSuperDMO().queryByWhereClause(DefdocVO.class, strWhere); | ||||
|             if (defdocVOs != null && defdocVOs.length > 0) { | ||||
|                 for (DefdocVO defdocVO : defdocVOs) { | ||||
|                     map.put(defdocVO.getCode().trim(), defdocVO.getName()); | ||||
|                 } | ||||
|             } | ||||
|         } catch (DAOException e) { | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
|         return map; | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue