删除后同步修改BIP的开票申请存的NCC信息-调整接口地址
This commit is contained in:
parent
5e9839b804
commit
c7eb7aa8b6
|
@ -3,9 +3,12 @@ package nc.bs.so.m32.maintain.rule.delete;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.yonyou.cloud.utils.StringUtils;
|
import com.yonyou.cloud.utils.StringUtils;
|
||||||
|
import nc.bs.dao.DAOException;
|
||||||
import nc.bs.logging.Logger;
|
import nc.bs.logging.Logger;
|
||||||
|
import nc.bs.trade.business.HYSuperDMO;
|
||||||
import nc.bs.uapbd.util.IgnoreSslUtil;
|
import nc.bs.uapbd.util.IgnoreSslUtil;
|
||||||
import nc.impl.pubapp.pattern.rule.IRule;
|
import nc.impl.pubapp.pattern.rule.IRule;
|
||||||
|
import nc.vo.bd.defdoc.DefdocVO;
|
||||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
import nc.vo.so.m32.entity.SaleInvoiceBVO;
|
import nc.vo.so.m32.entity.SaleInvoiceBVO;
|
||||||
import nc.vo.so.m32.entity.SaleInvoiceHVO;
|
import nc.vo.so.m32.entity.SaleInvoiceHVO;
|
||||||
|
@ -31,11 +34,12 @@ import java.util.*;
|
||||||
* @date 2025/3/20
|
* @date 2025/3/20
|
||||||
*/
|
*/
|
||||||
public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> {
|
public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> {
|
||||||
|
private HYSuperDMO superDMO = null;
|
||||||
private static String appKey = "a3c57e0d871240e9b9bf56b35001a324";
|
private static String appKey = "a3c57e0d871240e9b9bf56b35001a324";
|
||||||
private static String appSecret = "a959f7786db8dbb9a2c0493b5855a46bea68ad75";
|
private static String appSecret = "a959f7786db8dbb9a2c0493b5855a46bea68ad75";
|
||||||
private static String tokenUrl = "https://www.tkkfbip.com/iuap-api-auth/open-auth/selfAppAuth/getAccessToken";
|
private String baseUrl = "https://www.tkkfbip.com";
|
||||||
private static String toBipUrl = "https://www.tkkfbip.com/iuap-api-gateway/oxp4h3x6/current_yonbip_default_sys/KKAPI/invoiceApplication/updateInvoice?access_token=";
|
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
|
@Override
|
||||||
public void process(SaleInvoiceVO[] vos) {
|
public void process(SaleInvoiceVO[] vos) {
|
||||||
|
@ -47,6 +51,16 @@ public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> {
|
||||||
if (!hasVdef38) {
|
if (!hasVdef38) {
|
||||||
return;
|
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();
|
String access_token = getAccessToken();
|
||||||
for (SaleInvoiceVO invoiceVO : vos) {
|
for (SaleInvoiceVO invoiceVO : vos) {
|
||||||
SaleInvoiceHVO hvo = invoiceVO.getParentVO();
|
SaleInvoiceHVO hvo = invoiceVO.getParentVO();
|
||||||
|
@ -72,7 +86,7 @@ public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> {
|
||||||
updateJson.put("id", vdef38);
|
updateJson.put("id", vdef38);
|
||||||
updateJson.put("saleInvoiceId", "");
|
updateJson.put("saleInvoiceId", "");
|
||||||
updateJson.put("contractInvoiceApplicationDetailList", childrenList);
|
updateJson.put("contractInvoiceApplicationDetailList", childrenList);
|
||||||
String bipRes = doPost(toBipUrl + access_token, updateJson);
|
String bipRes = doPost(baseUrl + toBipUrl + access_token, updateJson);
|
||||||
NCCForUAPLogger.debug("SyncBipBillRuleForDelete-bipRes = " + bipRes);
|
NCCForUAPLogger.debug("SyncBipBillRuleForDelete-bipRes = " + bipRes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +95,13 @@ public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HYSuperDMO getSuperDMO() {
|
||||||
|
if (superDMO == null) {
|
||||||
|
superDMO = new HYSuperDMO();
|
||||||
|
}
|
||||||
|
return superDMO;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取旗舰版的token
|
* 获取旗舰版的token
|
||||||
*
|
*
|
||||||
|
@ -107,7 +128,7 @@ public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> {
|
||||||
String base64String = Base64.getEncoder().encodeToString(signData);
|
String base64String = Base64.getEncoder().encodeToString(signData);
|
||||||
String signature = URLEncoder.encode(base64String, "UTF-8");
|
String signature = URLEncoder.encode(base64String, "UTF-8");
|
||||||
params.put("signature", signature);
|
params.put("signature", signature);
|
||||||
String responseString = doGet(tokenUrl, params);
|
String responseString = doGet(baseUrl + tokenUrl, params);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Map result = gson.fromJson(responseString, Map.class);
|
Map result = gson.fromJson(responseString, Map.class);
|
||||||
String access_token = "";
|
String access_token = "";
|
||||||
|
@ -200,4 +221,24 @@ public class SyncBipBillRuleForDelete implements IRule<SaleInvoiceVO> {
|
||||||
return null;
|
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