南歧nc65对接修改
This commit is contained in:
+106
-14
@@ -388,14 +388,39 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
||||
LoginUser loginUser= SecurityUtils.getLoginUser();
|
||||
UserPo userPo=loginUser.getUserPo();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
AjaxResult ajaxResult5=userServiceFeign.getInfo(loginUser.getUserid());
|
||||
if(ajaxResult5.get("code").toString().equals("200")){
|
||||
Object userShipperPo= ajaxResult5.get("data");
|
||||
JSONObject jsonObject = new JSONObject((Map) userShipperPo);
|
||||
|
||||
try {
|
||||
String jsonString = mapper.writeValueAsString(jsonObject);
|
||||
userPo = mapper.readValue(jsonString, UserPo.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}else{
|
||||
throw new ServiceException("查询当前登录人用户信息失败");
|
||||
}
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(userPo.getSalespersonNcCode())) {
|
||||
throw new ServiceException("请先维护业务员编码");
|
||||
}
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(userPo.getDocumentPreparerNcCode())) {
|
||||
throw new ServiceException("请先维护制单员编码");
|
||||
}
|
||||
for (String businessDocumentDetaliId:businessDocumentDetaliIdArray){
|
||||
Reconciliation reconciliation=reconciliationMapper.selectById(businessDocumentDetaliId);
|
||||
if(reconciliation.getSynchronousStatus()==1){
|
||||
throw new ServiceException("该记录已同步,不需要再次同步");
|
||||
}
|
||||
if(reconciliation.getIsInvoice()!=2){
|
||||
|
||||
|
||||
/* if(reconciliation.getIsInvoice()!=2){
|
||||
throw new ServiceException("该记录还未开票,不允许同步");
|
||||
}
|
||||
}*/
|
||||
|
||||
try {
|
||||
Date date = reconciliation.getCreateTime();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -413,20 +438,31 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
R<TmsTransportNote> ajaxResult1=wlhyServiceFeign.selectByOrderNum(tmsOrder.getGoodsNumber());
|
||||
if(ajaxResult1.getCode()==200){
|
||||
TmsTransportNote tmsTransportNote= ajaxResult1.getData();
|
||||
date=tmsTransportNote.getPaperReceiptTime();
|
||||
dateString = sdf.format(date);
|
||||
if(ObjectUtil.isNotNull(tmsTransportNote.getIsPaper())){
|
||||
date=tmsTransportNote.getConfirmReceiptTime();
|
||||
dateString = sdf.format(date);
|
||||
}else{
|
||||
throw new ServiceException("运单还没签收, 先签收");
|
||||
}
|
||||
}
|
||||
if(null==reconciliation.getSettlementPartyId()){
|
||||
throw new ServiceException("没有结算方,请核对");
|
||||
}
|
||||
AjaxResult ajaxResult=userServiceFeign.getShipperSummaryData(Long.valueOf(reconciliation.getSettlementPartyId()));
|
||||
if(ajaxResult.get("code").equals("200")){
|
||||
UserShipperPo userShipperPo= (UserShipperPo) ajaxResult.get("data");
|
||||
if(ajaxResult.get("code").toString().equals("200")){
|
||||
Object userShipperPo= ajaxResult.get("data");
|
||||
JSONObject jsonObject = new JSONObject((Map) userShipperPo);
|
||||
if(org.apache.commons.lang.StringUtils.isBlank(jsonObject.get("customerNcCode").toString())){
|
||||
throw new ServiceException("请先维护客户编码");
|
||||
}
|
||||
Ysitem item=new Ysitem();
|
||||
item.setSo_deptid("NG040104");
|
||||
item.setPk_deptid("NG040104");
|
||||
item.setPk_psndoc(userPo.getSalespersonNcCode());
|
||||
item.setCustomer(userShipperPo.getCustomerNcCode());
|
||||
item.setCustomer(jsonObject.get("customerNcCode").toString());
|
||||
item.setObjtype("0");
|
||||
item.setDirection("1");
|
||||
item.setScomment(userShipperPo.getShipperEnterpriseName());
|
||||
item.setScomment(jsonObject.get("shipperEnterpriseName").toString());
|
||||
item.setPk_currtype("CNY");
|
||||
item.setPurchaseorder(tmsOrder.getGoodsNumber());
|
||||
item.setTaxrate("0");
|
||||
@@ -458,6 +494,8 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
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("");
|
||||
@@ -540,17 +578,45 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
||||
LoginUser loginUser= SecurityUtils.getLoginUser();
|
||||
UserPo userPo=loginUser.getUserPo();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
AjaxResult ajaxResult5=userServiceFeign.getInfo(loginUser.getUserid());
|
||||
if(ajaxResult5.get("code").toString().equals("200")){
|
||||
Object userShipperPo= ajaxResult5.get("data");
|
||||
JSONObject jsonObject = new JSONObject((Map) userShipperPo);
|
||||
|
||||
try {
|
||||
String jsonString = mapper.writeValueAsString(jsonObject);
|
||||
userPo = mapper.readValue(jsonString, UserPo.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}else{
|
||||
throw new ServiceException("查询当前登录人用户信息失败");
|
||||
}
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(userPo.getSalespersonNcCode())) {
|
||||
throw new ServiceException("请先维护业务员编码");
|
||||
}
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(userPo.getDocumentPreparerNcCode())) {
|
||||
throw new ServiceException("请先维护制单员编码");
|
||||
}
|
||||
for (String businessDocumentDetaliId:businessDocumentDetaliIdArray){
|
||||
Reconciliation reconciliation=reconciliationMapper.selectById(businessDocumentDetaliId);
|
||||
if(reconciliation.getSkSynchronousStatus()==1){
|
||||
throw new ServiceException("该记录已同步,不需要再次同步");
|
||||
}
|
||||
if(reconciliation.getIsInvoice()!=2){
|
||||
/* if(reconciliation.getIsInvoice()!=2){
|
||||
throw new ServiceException("该记录还未开票,不允许同步");
|
||||
}
|
||||
}*/
|
||||
if(reconciliation.getCollectionState()!=2){
|
||||
throw new ServiceException("该记录还未结算完成,不允许同步");
|
||||
}
|
||||
/* if(org.apache.commons.lang.StringUtils.isBlank(userPo.getSalespersonNcCode())){
|
||||
throw new ServiceException("请先维护业务员编码");
|
||||
}
|
||||
if(org.apache.commons.lang.StringUtils.isBlank(userPo.getDocumentPreparerNcCode())){
|
||||
throw new ServiceException("请先维护制单员编码");
|
||||
}*/
|
||||
try {
|
||||
Date date = reconciliation.getCreateTime();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -565,19 +631,26 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
List<TmsOrder> list=result.getData();
|
||||
if(ObjectUtil.isNotNull(list)){
|
||||
for(TmsOrder tmsOrder:list){
|
||||
if(null==reconciliation.getSettlementPartyId()){
|
||||
throw new ServiceException("没有结算方,请核对");
|
||||
}
|
||||
AjaxResult ajaxResult=userServiceFeign.getShipperSummaryData(Long.valueOf(reconciliation.getSettlementPartyId()));
|
||||
if(ajaxResult.get("code").equals("200")){
|
||||
UserShipperPo userShipperPo= (UserShipperPo) ajaxResult.get("data");
|
||||
if(ajaxResult.get("code").toString().equals("200")){
|
||||
Object userShipperPo= ajaxResult.get("data");
|
||||
JSONObject jsonObject = new JSONObject((Map) userShipperPo);
|
||||
if(org.apache.commons.lang.StringUtils.isBlank(jsonObject.get("customerNcCode").toString())){
|
||||
throw new ServiceException("请先维护客户编码");
|
||||
}
|
||||
SKitem item=new SKitem();
|
||||
item.setSo_deptid("NG040104");
|
||||
item.setPk_deptid("NG040104");
|
||||
item.setCheckdirection("ar");
|
||||
item.setPk_psndoc(userPo.getSalespersonNcCode());
|
||||
item.setCustomer(userShipperPo.getCustomerNcCode());
|
||||
item.setCustomer(jsonObject.get("customerNcCode").toString());
|
||||
item.setPurchaseorder(tmsOrder.getGoodsNumber());
|
||||
item.setObjtype("0");
|
||||
item.setDirection("1");
|
||||
item.setScomment(userShipperPo.getShipperEnterpriseName());
|
||||
item.setScomment(jsonObject.get("shipperEnterpriseName").toString());
|
||||
item.setPk_currtype("CNY");
|
||||
item.setMoney_cr(String.valueOf(tmsOrder.getCollectedFreight()));
|
||||
item.setMoney_bal(String.valueOf(tmsOrder.getCollectedFreight()));
|
||||
@@ -650,6 +723,25 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
reconciliation.setSkSynchronousTime(new Date());
|
||||
reconciliation.setSkNcId("sk"+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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user