|
|
|
@ -1278,37 +1278,78 @@ public class InterfaceController extends AbstractController { |
|
|
|
|
"/po", JSONObject.toJSONString(fpdms),JSONObject.toJSONString(fphms), "transferOut"); |
|
|
|
|
transferOutRecord.setBzdh(JSONObject.toJSONString(bzdhs)); |
|
|
|
|
|
|
|
|
|
for(Map<String ,Object> map:list){ |
|
|
|
|
String invoiceCode =(String) map.get("ZFPDM"); |
|
|
|
|
String invoiceNo = (String)map.get("ZFPHM"); |
|
|
|
|
String uuid = invoiceCode+invoiceNo; |
|
|
|
|
String[] ids = uuid.split(","); |
|
|
|
|
DynamicContextHolder.push("business"+DbConstant.BUSINESS_READ); |
|
|
|
|
List<BaseTDxRecordInvoice> invoices = baseIReceiptInvoiceService.selectByUuids(ids); |
|
|
|
|
boolean fphmNotBlank = list.stream().allMatch(e -> StringUtils.isNotBlank((String)e.get("ZFPHM"))); |
|
|
|
|
boolean fpdmNotBlank = list.stream().allMatch(e -> StringUtils.isNotBlank((String)e.get("ZFPDM"))); |
|
|
|
|
if (!fpdmNotBlank || !fphmNotBlank){ |
|
|
|
|
OutPut outPut = new OutPut(); |
|
|
|
|
EsOutPutResp es = new EsOutPutResp(); |
|
|
|
|
es.setSAPKEY(erpInvoiceData.getIS_INPUT().getSAPKEY()); |
|
|
|
|
es.setBSKEY(erpInvoiceData.getIS_INPUT().getBSKEY()); |
|
|
|
|
es.setZTYPE("S"); |
|
|
|
|
es.setZMESSAGE("处理成功"); |
|
|
|
|
invoices = invoices.stream().filter(e->!"0".equals(e.getRzhYesorno())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(invoices)){ |
|
|
|
|
es.setZTYPE("E"); |
|
|
|
|
es.setZMESSAGE("底账数据不存在可转出发票"); |
|
|
|
|
outPut.setES_OUTPUT(es); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); |
|
|
|
|
requestRecordService.saveFailedRequestRecord(transferOutRecord, 0, JsonUtils.getInstance().toJsonString(outPut), |
|
|
|
|
es.getZMESSAGE()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("FI849接口记录保存失败,errormsg:{}",e); |
|
|
|
|
} |
|
|
|
|
es.setZTYPE("E"); |
|
|
|
|
es.setZMESSAGE("传入数据存在没有发票号码或发票代码问题"); |
|
|
|
|
outPut.setES_OUTPUT(es); |
|
|
|
|
return JsonUtils.getInstance().toJsonString(outPut); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return JsonUtils.getInstance().toJsonString(outPut); |
|
|
|
|
StringBuilder uuids = new StringBuilder(); |
|
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
|
String invoiceCode =(String) list.get(i).get("ZFPDM"); |
|
|
|
|
String invoiceNo = (String)list.get(i).get("ZFPHM"); |
|
|
|
|
uuids.append(invoiceCode).append(invoiceNo); |
|
|
|
|
if (i<list.size()-1){ |
|
|
|
|
uuids.append(","); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.info(uuids.toString()); |
|
|
|
|
String[] ids = uuids.toString().split(","); |
|
|
|
|
DynamicContextHolder.push("business"+DbConstant.BUSINESS_READ); |
|
|
|
|
List<BaseTDxRecordInvoice> invoices = baseIReceiptInvoiceService.selectByUuids(ids); |
|
|
|
|
log.info("849查询到发票信息{}",invoices); |
|
|
|
|
invoices = invoices.stream().filter(e->!"0".equals(e.getRzhYesorno())).collect(Collectors.toList()); |
|
|
|
|
log.info("过滤后发票信息{}",invoices); |
|
|
|
|
if (CollectionUtils.isEmpty(invoices)){ |
|
|
|
|
OutPut outPut = new OutPut(); |
|
|
|
|
EsOutPutResp es = new EsOutPutResp(); |
|
|
|
|
es.setSAPKEY(erpInvoiceData.getIS_INPUT().getSAPKEY()); |
|
|
|
|
es.setBSKEY(erpInvoiceData.getIS_INPUT().getBSKEY()); |
|
|
|
|
es.setZTYPE("E"); |
|
|
|
|
es.setZMESSAGE("底账数据不存在可转出发票"); |
|
|
|
|
outPut.setES_OUTPUT(es); |
|
|
|
|
return JsonUtils.getInstance().toJsonString(outPut); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// for(Map<String ,Object> map:list){
|
|
|
|
|
// String invoiceCode =(String) map.get("ZFPDM");
|
|
|
|
|
// String invoiceNo = (String)map.get("ZFPHM");
|
|
|
|
|
// String uuid = invoiceCode+invoiceNo;
|
|
|
|
|
// String[] ids = uuid.split(",");
|
|
|
|
|
// DynamicContextHolder.push("business"+DbConstant.BUSINESS_READ);
|
|
|
|
|
// List<BaseTDxRecordInvoice> invoices = baseIReceiptInvoiceService.selectByUuids(ids);
|
|
|
|
|
// OutPut outPut = new OutPut();
|
|
|
|
|
// EsOutPutResp es = new EsOutPutResp();
|
|
|
|
|
// es.setSAPKEY(erpInvoiceData.getIS_INPUT().getSAPKEY());
|
|
|
|
|
// es.setBSKEY(erpInvoiceData.getIS_INPUT().getBSKEY());
|
|
|
|
|
// es.setZTYPE("S");
|
|
|
|
|
// es.setZMESSAGE("处理成功");
|
|
|
|
|
//
|
|
|
|
|
// if(CollectionUtils.isEmpty(invoices)){
|
|
|
|
|
// es.setZTYPE("E");
|
|
|
|
|
// es.setZMESSAGE("底账数据不存在可转出发票");
|
|
|
|
|
// outPut.setES_OUTPUT(es);
|
|
|
|
|
//
|
|
|
|
|
// try {
|
|
|
|
|
// DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
|
|
|
|
|
// requestRecordService.saveFailedRequestRecord(transferOutRecord, 0, JsonUtils.getInstance().toJsonString(outPut),
|
|
|
|
|
// es.getZMESSAGE());
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// log.error("FI849接口记录保存失败,errormsg:{}",e);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return JsonUtils.getInstance().toJsonString(outPut);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
/** |
|
|
|
|