问题修改
This commit is contained in:
+84
-93
@@ -478,102 +478,93 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
|||||||
item.setDef75("T10");
|
item.setDef75("T10");
|
||||||
item.setInvoiceno("");
|
item.setInvoiceno("");
|
||||||
ysitemList.add(item);
|
ysitemList.add(item);
|
||||||
/* AjaxResult ajaxResult=userServiceFeign.getShipperSummaryData(Long.valueOf(reconciliation.getSettlementPartyId()));
|
}
|
||||||
if(ajaxResult.get("code").toString().equals("200")){
|
Ysbodys bodys=new Ysbodys();
|
||||||
Object userShipperPo= ajaxResult.get("data");
|
bodys.setItem(ysitemList);
|
||||||
JSONObject jsonObject = new JSONObject((Map) userShipperPo);
|
Ysbillhead billhead=new Ysbillhead();
|
||||||
if(org.apache.commons.lang.StringUtils.isBlank(jsonObject.get("customerNcCode").toString())){
|
billhead.setPk_group("CNK");
|
||||||
throw new ServiceException("请先维护客户编码");
|
billhead.setPk_org("NG0401");
|
||||||
}
|
billhead.setSett_org("NG0401");
|
||||||
|
billhead.setCreationtime(dateString);
|
||||||
}*/
|
billhead.setCreator(makerCodeNc);
|
||||||
|
billhead.setPk_billtype("F0");
|
||||||
|
billhead.setPk_tradetype("D0");
|
||||||
|
billhead.setBillclass("ys");
|
||||||
|
billhead.setIsinit("N");
|
||||||
|
date=reconciliation.getCreateTime();
|
||||||
|
dateString = sdf.format(date);
|
||||||
|
billhead.setBilldate(dateString);
|
||||||
|
billhead.setSyscode("0");
|
||||||
|
billhead.setBillno("");
|
||||||
|
billhead.setDef59("");
|
||||||
|
billhead.setSrc_syscode("0");
|
||||||
|
billhead.setBillstatus("0");
|
||||||
|
billhead.setBillmaker(makerCodeNc);
|
||||||
|
billhead.setPk_busitype("");
|
||||||
|
billhead.setBillyear(sdf1.format(date));
|
||||||
|
billhead.setBillperiod(sdf2.format(date));
|
||||||
|
billhead.setEffectstatus("0");
|
||||||
|
billhead.setDef28("nqyw");
|
||||||
|
billhead.setDef29(reconciliation.getInnerNumber());
|
||||||
|
billhead.setBodys(bodys);
|
||||||
|
Ysbill bill=new Ysbill();
|
||||||
|
bill.setId("ys"+String.valueOf(reconciliation.getReconciliationId()));
|
||||||
|
bill.setBillhead(billhead);
|
||||||
|
Ysufinterface ufinterface=new Ysufinterface();
|
||||||
|
ufinterface.setAccount("NKNC");
|
||||||
|
ufinterface.setBilltype("F0");
|
||||||
|
ufinterface.setBusinessunitcode("");
|
||||||
|
ufinterface.setFilename("");
|
||||||
|
ufinterface.setIsexchange("Y");
|
||||||
|
ufinterface.setOrgcode("NG0401");
|
||||||
|
ufinterface.setReceiver("NG0401");
|
||||||
|
ufinterface.setReplace("Y");
|
||||||
|
ufinterface.setRoottag("");
|
||||||
|
ufinterface.setSender("nqyw");
|
||||||
|
ufinterface.setBill(bill);
|
||||||
|
JAXBContext jaxbContext = JAXBContext.newInstance(Ysufinterface.class);
|
||||||
|
Marshaller marshaller = jaxbContext.createMarshaller();
|
||||||
|
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
|
||||||
|
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出,可选
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
marshaller.marshal(ufinterface, sw);
|
||||||
|
String xmlString = sw.toString(); // 这是要发送的XML字符串
|
||||||
|
System.out.println(xmlString);
|
||||||
|
NcLog ncLog=new NcLog();
|
||||||
|
ncLog.setOrderId(reconciliation.getReconciliationId());
|
||||||
|
ncLog.setRequestBody(xmlString);
|
||||||
|
ncLog.setResponeBody("");
|
||||||
|
ncLog.setType(0L);
|
||||||
|
ncLog.setOrganizationId(reconciliation.getOrganizationId());
|
||||||
|
ncLog.setOrganizationName(reconciliation.getOrganizationName());
|
||||||
|
ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId());
|
||||||
|
ncLogMapper.insert(ncLog);
|
||||||
|
reconciliation.setSynchronousStatus(1);
|
||||||
|
reconciliation.setSynchronousTime(new Date());
|
||||||
|
reconciliation.setNcId("ys"+String.valueOf(reconciliation.getReconciliationId()));
|
||||||
|
reconciliationMapper.updateById(reconciliation);
|
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||||
|
HttpPost httpPost = new HttpPost(url);
|
||||||
|
StringEntity postingString = new StringEntity(xmlString, "UTF-8");
|
||||||
|
httpPost.setEntity(postingString);
|
||||||
|
httpPost.setHeader("Content-type", "application/xml");
|
||||||
|
try {
|
||||||
|
CloseableHttpResponse response = httpClient.execute(httpPost);
|
||||||
|
String responseString = EntityUtils.toString(response.getEntity());
|
||||||
|
System.out.println(responseString);
|
||||||
|
response.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
httpClient.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ysbodys bodys=new Ysbodys();
|
|
||||||
bodys.setItem(ysitemList);
|
|
||||||
Ysbillhead billhead=new Ysbillhead();
|
|
||||||
billhead.setPk_group("CNK");
|
|
||||||
billhead.setPk_org("NG0401");
|
|
||||||
billhead.setSett_org("NG0401");
|
|
||||||
billhead.setCreationtime(dateString);
|
|
||||||
billhead.setCreator(makerCodeNc);
|
|
||||||
billhead.setPk_billtype("F0");
|
|
||||||
billhead.setPk_tradetype("D0");
|
|
||||||
billhead.setBillclass("ys");
|
|
||||||
billhead.setIsinit("N");
|
|
||||||
date=reconciliation.getCreateTime();
|
|
||||||
dateString = sdf.format(date);
|
|
||||||
billhead.setBilldate(dateString);
|
|
||||||
billhead.setSyscode("0");
|
|
||||||
billhead.setBillno("");
|
|
||||||
billhead.setDef59("");
|
|
||||||
billhead.setSrc_syscode("0");
|
|
||||||
billhead.setBillstatus("0");
|
|
||||||
billhead.setBillmaker(makerCodeNc);
|
|
||||||
billhead.setPk_busitype("");
|
|
||||||
billhead.setBillyear(sdf1.format(date));
|
|
||||||
billhead.setBillperiod(sdf2.format(date));
|
|
||||||
billhead.setEffectstatus("0");
|
|
||||||
billhead.setDef28("nqyw");
|
|
||||||
billhead.setDef29(reconciliation.getInnerNumber());
|
|
||||||
billhead.setBodys(bodys);
|
|
||||||
Ysbill bill=new Ysbill();
|
|
||||||
bill.setId("ys"+String.valueOf(reconciliation.getReconciliationId()));
|
|
||||||
bill.setBillhead(billhead);
|
|
||||||
Ysufinterface ufinterface=new Ysufinterface();
|
|
||||||
ufinterface.setAccount("NKNC");
|
|
||||||
ufinterface.setBilltype("F0");
|
|
||||||
ufinterface.setBusinessunitcode("");
|
|
||||||
ufinterface.setFilename("");
|
|
||||||
ufinterface.setIsexchange("Y");
|
|
||||||
ufinterface.setOrgcode("NG0401");
|
|
||||||
ufinterface.setReceiver("NG0401");
|
|
||||||
ufinterface.setReplace("Y");
|
|
||||||
ufinterface.setRoottag("");
|
|
||||||
ufinterface.setSender("nqyw");
|
|
||||||
ufinterface.setBill(bill);
|
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(Ysufinterface.class);
|
|
||||||
Marshaller marshaller = jaxbContext.createMarshaller();
|
|
||||||
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
|
|
||||||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出,可选
|
|
||||||
StringWriter sw = new StringWriter();
|
|
||||||
marshaller.marshal(ufinterface, sw);
|
|
||||||
String xmlString = sw.toString(); // 这是要发送的XML字符串
|
|
||||||
System.out.println(xmlString);
|
|
||||||
NcLog ncLog=new NcLog();
|
|
||||||
ncLog.setOrderId(reconciliation.getReconciliationId());
|
|
||||||
ncLog.setRequestBody(xmlString);
|
|
||||||
ncLog.setResponeBody("");
|
|
||||||
ncLog.setType(0L);
|
|
||||||
ncLog.setOrganizationId(reconciliation.getOrganizationId());
|
|
||||||
ncLog.setOrganizationName(reconciliation.getOrganizationName());
|
|
||||||
ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId());
|
|
||||||
ncLogMapper.insert(ncLog);
|
|
||||||
reconciliation.setSynchronousStatus(1);
|
|
||||||
reconciliation.setSynchronousTime(new Date());
|
|
||||||
reconciliation.setNcId("ys"+String.valueOf(reconciliation.getReconciliationId()));
|
|
||||||
reconciliationMapper.updateById(reconciliation);
|
|
||||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
||||||
HttpPost httpPost = new HttpPost(url);
|
|
||||||
StringEntity postingString = new StringEntity(xmlString, "UTF-8");
|
|
||||||
httpPost.setEntity(postingString);
|
|
||||||
httpPost.setHeader("Content-type", "application/xml");
|
|
||||||
try {
|
|
||||||
CloseableHttpResponse response = httpClient.execute(httpPost);
|
|
||||||
String responseString = EntityUtils.toString(response.getEntity());
|
|
||||||
System.out.println(responseString);
|
|
||||||
response.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
httpClient.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user