|
|
|
@ -140,7 +140,7 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
// throw new JianshuiParamErrorException(ErrorCode.IDENTITY_NOT_MATCH,"invoice);
|
|
|
|
|
// }
|
|
|
|
|
// 红字查询
|
|
|
|
|
if (StringUtils.equals(serviceKey,"find_redinfo")){ |
|
|
|
|
if (StringUtils.equals(serviceKey, "find_redinfo")) { |
|
|
|
|
return json; |
|
|
|
|
} |
|
|
|
|
// 如果是开票或者查询
|
|
|
|
@ -149,17 +149,27 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
HxBillInfoDTO hxBillInfo = json.toJavaObject(HxBillInfoDTO.class); |
|
|
|
|
BillInfo billInfo = new BillInfo(); |
|
|
|
|
BeanUtils.copyProperties(hxBillInfo, billInfo); |
|
|
|
|
if(StringUtils.isNotEmpty(hxBillInfo.getEmail())){ |
|
|
|
|
if (StringUtils.isNotEmpty(hxBillInfo.getEmail())) { |
|
|
|
|
billInfo.setBuyerEmail(hxBillInfo.getEmail()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
|
|
|
|
|
// TODO: 2023/11/24 银行处理
|
|
|
|
|
/*if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount()); |
|
|
|
|
if (StringUtils.isNotEmpty(bankNo)) { |
|
|
|
|
String raw = billInfo.getBuyerAccount(); |
|
|
|
|
billInfo.setBuyerAccount(bankNo); |
|
|
|
|
billInfo.setBuyerBank(raw.replace(bankNo, "")); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
// 银行处理
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
Map<String, String> bank = IdcardUtils.getBankNoAndName(billInfo.getBuyerAccount()); |
|
|
|
|
billInfo.setBuyerAccount(bank.getOrDefault("bankNo", "")); |
|
|
|
|
billInfo.setBuyerBank(bank.getOrDefault("bankName", "")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 处理detail
|
|
|
|
|
List<HxBillDetailDTO> hxBillDetailList = hxBillInfo.getDetail(); |
|
|
|
|
List<BillDetail> detailList = new ArrayList<>(); |
|
|
|
@ -172,13 +182,19 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
billInfo.setBillDetailList(detailList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
/*if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount()); |
|
|
|
|
if (StringUtils.isNotEmpty(bankNo)) { |
|
|
|
|
String raw = billInfo.getBuyerAccount(); |
|
|
|
|
billInfo.setBuyerAccount(bankNo); |
|
|
|
|
billInfo.setBuyerBank(raw.replace(bankNo, "")); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
// 银行处理
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
Map<String, String> bank = IdcardUtils.getBankNoAndName(billInfo.getBuyerAccount()); |
|
|
|
|
billInfo.setBuyerAccount(bank.getOrDefault("bankNo", "")); |
|
|
|
|
billInfo.setBuyerBank(bank.getOrDefault("bankName", "")); |
|
|
|
|
} |
|
|
|
|
// 处理销方信息
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getSellerBank()) && StringUtils.isNotEmpty(billInfo.getSellerAccount())) { |
|
|
|
@ -193,7 +209,7 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
json = (JSONObject) JSONObject.toJSON(billInfo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.equals(serviceKey, "addBatch") ) { |
|
|
|
|
if (StringUtils.equals(serviceKey, "addBatch")) { |
|
|
|
|
JSONArray billInfoList = JSONUtil.parseArray(json.get("billInfo")); |
|
|
|
|
JSONArray billInfoResult = new JSONArray(); |
|
|
|
|
for (Object billInfoTemp : billInfoList) { |
|
|
|
@ -203,16 +219,22 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
HxBillInfoDTO hxBillInfo = orderJsonTemp.toJavaObject(HxBillInfoDTO.class); |
|
|
|
|
BillInfo billInfo = new BillInfo(); |
|
|
|
|
BeanUtils.copyProperties(hxBillInfo, billInfo); |
|
|
|
|
if(StringUtils.isNotEmpty(hxBillInfo.getEmail())){ |
|
|
|
|
if (StringUtils.isNotEmpty(hxBillInfo.getEmail())) { |
|
|
|
|
billInfo.setBuyerEmail(hxBillInfo.getEmail()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
/*if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount()); |
|
|
|
|
if (StringUtils.isNotEmpty(bankNo)) { |
|
|
|
|
String raw = billInfo.getBuyerAccount(); |
|
|
|
|
billInfo.setBuyerAccount(bankNo); |
|
|
|
|
billInfo.setBuyerBank(raw.replace(bankNo, "")); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
// 银行处理
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
Map<String, String> bank = IdcardUtils.getBankNoAndName(billInfo.getBuyerAccount()); |
|
|
|
|
billInfo.setBuyerAccount(bank.getOrDefault("bankNo", "")); |
|
|
|
|
billInfo.setBuyerBank(bank.getOrDefault("bankName", "")); |
|
|
|
|
} |
|
|
|
|
// 处理detail
|
|
|
|
|
List<HxBillDetailDTO> hxBillDetailList = hxBillInfo.getDetail(); |
|
|
|
@ -226,13 +248,19 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
billInfo.setBillDetailList(detailList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
/*if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount()); |
|
|
|
|
if (StringUtils.isNotEmpty(bankNo)) { |
|
|
|
|
String raw = billInfo.getBuyerAccount(); |
|
|
|
|
billInfo.setBuyerAccount(bankNo); |
|
|
|
|
billInfo.setBuyerBank(raw.replace(bankNo, "")); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
// 银行处理
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
Map<String, String> bank = IdcardUtils.getBankNoAndName(billInfo.getBuyerAccount()); |
|
|
|
|
billInfo.setBuyerAccount(bank.getOrDefault("bankNo", "")); |
|
|
|
|
billInfo.setBuyerBank(bank.getOrDefault("bankName", "")); |
|
|
|
|
} |
|
|
|
|
// 处理销方信息
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getSellerBank()) && StringUtils.isNotEmpty(billInfo.getSellerAccount())) { |
|
|
|
@ -249,7 +277,7 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
} |
|
|
|
|
// 清除数据,重新组装
|
|
|
|
|
json.clear(); |
|
|
|
|
json.put("billInfo",billInfoResult); |
|
|
|
|
json.put("billInfo", billInfoResult); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -265,7 +293,7 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
List<HxRedInfoDetailsDTO> hxBillDetailList = hxBillInfo.getRedinfodetailList(); |
|
|
|
|
List<Redinfodetail> detailList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(hxBillDetailList)){ |
|
|
|
|
if (CollectionUtil.isNotEmpty(hxBillDetailList)) { |
|
|
|
|
for (int i = 0; i < hxBillDetailList.size(); i++) { |
|
|
|
|
HxRedInfoDetailsDTO detial = hxBillDetailList.get(i); |
|
|
|
|
Redinfodetail temp = new Redinfodetail(); |
|
|
|
@ -313,10 +341,10 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public JSONObject decryptZq(String identity,String order, Companyservice companyservice, String serviceKey) { |
|
|
|
|
public JSONObject decryptZq(String identity, String order, Companyservice companyservice, String serviceKey) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info("【航信转invoice请求适配器】客户请求报文原始数据:{},销方id:{},serviceKey:{},identity={}", order, companyservice.getCompanyid(), serviceKey,identity); |
|
|
|
|
log.info("【航信转invoice请求适配器】客户请求报文原始数据:{},销方id:{},serviceKey:{},identity={}", order, companyservice.getCompanyid(), serviceKey, identity); |
|
|
|
|
|
|
|
|
|
// 开始解析报文
|
|
|
|
|
if (order == null || "".equals(order.trim())) { |
|
|
|
@ -356,7 +384,7 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
|
|
|
|
|
json = orderJson; |
|
|
|
|
// 红字查询
|
|
|
|
|
if (StringUtils.equals(serviceKey,"find_redinfo")){ |
|
|
|
|
if (StringUtils.equals(serviceKey, "find_redinfo")) { |
|
|
|
|
return json; |
|
|
|
|
} |
|
|
|
|
// 如果是开票或者查询
|
|
|
|
@ -365,16 +393,22 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
HxBillInfoDTO hxBillInfo = json.toJavaObject(HxBillInfoDTO.class); |
|
|
|
|
BillInfo billInfo = new BillInfo(); |
|
|
|
|
BeanUtils.copyProperties(hxBillInfo, billInfo); |
|
|
|
|
if(StringUtils.isNotEmpty(hxBillInfo.getEmail())){ |
|
|
|
|
if (StringUtils.isNotEmpty(hxBillInfo.getEmail())) { |
|
|
|
|
billInfo.setBuyerEmail(hxBillInfo.getEmail()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
/*if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount()); |
|
|
|
|
if (StringUtils.isNotEmpty(bankNo)) { |
|
|
|
|
String raw = billInfo.getBuyerAccount(); |
|
|
|
|
billInfo.setBuyerAccount(bankNo); |
|
|
|
|
billInfo.setBuyerBank(raw.replace(bankNo, "")); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
// 银行处理
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
Map<String, String> bank = IdcardUtils.getBankNoAndName(billInfo.getBuyerAccount()); |
|
|
|
|
billInfo.setBuyerAccount(bank.getOrDefault("bankNo", "")); |
|
|
|
|
billInfo.setBuyerBank(bank.getOrDefault("bankName", "")); |
|
|
|
|
} |
|
|
|
|
// 处理detail
|
|
|
|
|
List<HxBillDetailDTO> hxBillDetailList = hxBillInfo.getDetail(); |
|
|
|
@ -388,13 +422,19 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
billInfo.setBillDetailList(detailList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
/*if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount()); |
|
|
|
|
if (StringUtils.isNotEmpty(bankNo)) { |
|
|
|
|
String raw = billInfo.getBuyerAccount(); |
|
|
|
|
billInfo.setBuyerAccount(bankNo); |
|
|
|
|
billInfo.setBuyerBank(raw.replace(bankNo, "")); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
// 银行处理
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
Map<String, String> bank = IdcardUtils.getBankNoAndName(billInfo.getBuyerAccount()); |
|
|
|
|
billInfo.setBuyerAccount(bank.getOrDefault("bankNo", "")); |
|
|
|
|
billInfo.setBuyerBank(bank.getOrDefault("bankName", "")); |
|
|
|
|
} |
|
|
|
|
// 处理销方信息
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getSellerBank()) && StringUtils.isNotEmpty(billInfo.getSellerAccount())) { |
|
|
|
@ -409,7 +449,7 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
json = (JSONObject) JSONObject.toJSON(billInfo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.equals(serviceKey, "addBatch") ) { |
|
|
|
|
if (StringUtils.equals(serviceKey, "addBatch")) { |
|
|
|
|
JSONArray billInfoList = JSONUtil.parseArray(json.get("billInfo")); |
|
|
|
|
|
|
|
|
|
//开票条数限制
|
|
|
|
@ -425,16 +465,22 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
HxBillInfoDTO hxBillInfo = orderJsonTemp.toJavaObject(HxBillInfoDTO.class); |
|
|
|
|
BillInfo billInfo = new BillInfo(); |
|
|
|
|
BeanUtils.copyProperties(hxBillInfo, billInfo); |
|
|
|
|
if(StringUtils.isNotEmpty(hxBillInfo.getEmail())){ |
|
|
|
|
if (StringUtils.isNotEmpty(hxBillInfo.getEmail())) { |
|
|
|
|
billInfo.setBuyerEmail(hxBillInfo.getEmail()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
/*if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount()); |
|
|
|
|
if (StringUtils.isNotEmpty(bankNo)) { |
|
|
|
|
String raw = billInfo.getBuyerAccount(); |
|
|
|
|
billInfo.setBuyerAccount(bankNo); |
|
|
|
|
billInfo.setBuyerBank(raw.replace(bankNo, "")); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
// 银行处理
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
Map<String, String> bank = IdcardUtils.getBankNoAndName(billInfo.getBuyerAccount()); |
|
|
|
|
billInfo.setBuyerAccount(bank.getOrDefault("bankNo", "")); |
|
|
|
|
billInfo.setBuyerBank(bank.getOrDefault("bankName", "")); |
|
|
|
|
} |
|
|
|
|
// 处理detail
|
|
|
|
|
List<HxBillDetailDTO> hxBillDetailList = hxBillInfo.getDetail(); |
|
|
|
@ -448,13 +494,19 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
billInfo.setBillDetailList(detailList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
/*if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount()); |
|
|
|
|
if (StringUtils.isNotEmpty(bankNo)) { |
|
|
|
|
String raw = billInfo.getBuyerAccount(); |
|
|
|
|
billInfo.setBuyerAccount(bankNo); |
|
|
|
|
billInfo.setBuyerBank(raw.replace(bankNo, "")); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
// 银行处理
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
|
|
|
|
Map<String, String> bank = IdcardUtils.getBankNoAndName(billInfo.getBuyerAccount()); |
|
|
|
|
billInfo.setBuyerAccount(bank.getOrDefault("bankNo", "")); |
|
|
|
|
billInfo.setBuyerBank(bank.getOrDefault("bankName", "")); |
|
|
|
|
} |
|
|
|
|
// 处理销方信息
|
|
|
|
|
if (StringUtils.isEmpty(billInfo.getSellerBank()) && StringUtils.isNotEmpty(billInfo.getSellerAccount())) { |
|
|
|
@ -471,7 +523,7 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
} |
|
|
|
|
// 清除数据,重新组装
|
|
|
|
|
json.clear(); |
|
|
|
|
json.put("billInfo",billInfoResult); |
|
|
|
|
json.put("billInfo", billInfoResult); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -487,7 +539,7 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
List<HxRedInfoDetailsDTO> hxBillDetailList = hxBillInfo.getRedinfodetailList(); |
|
|
|
|
List<Redinfodetail> detailList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(hxBillDetailList)){ |
|
|
|
|
if (CollectionUtil.isNotEmpty(hxBillDetailList)) { |
|
|
|
|
for (int i = 0; i < hxBillDetailList.size(); i++) { |
|
|
|
|
HxRedInfoDetailsDTO detial = hxBillDetailList.get(i); |
|
|
|
|
Redinfodetail temp = new Redinfodetail(); |
|
|
|
@ -535,7 +587,6 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String covertMethodName(String method) { |
|
|
|
|
return null; |
|
|
|
|