|
|
@@ -1,5 +1,6 @@
|
|
|
package com.uas.platform.b2c.logistics.service.impl;
|
|
|
|
|
|
+import com.uas.platform.b2c.core.config.SysConf;
|
|
|
import com.uas.platform.b2c.logistics.model.Logistics;
|
|
|
import com.uas.platform.b2c.logistics.model.LogisticsCompanyCode;
|
|
|
import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
@@ -11,6 +12,10 @@ import com.uas.platform.b2c.trade.deprecated.model.ConstantTrade;
|
|
|
import com.uas.platform.b2c.logistics.model.InvoiceFPurchase;
|
|
|
import com.uas.platform.b2c.trade.deprecated.model.ResponseLogistics;
|
|
|
import com.uas.platform.b2c.logistics.service.LogisticsOldService;
|
|
|
+import com.uas.platform.b2c.trade.order.dao.OrderDao;
|
|
|
+import com.uas.platform.b2c.trade.order.dao.PurchaseDao;
|
|
|
+import com.uas.platform.b2c.trade.order.model.Order;
|
|
|
+import com.uas.platform.b2c.trade.order.model.Purchase;
|
|
|
import com.uas.platform.b2c.trade.support.CodeType;
|
|
|
import com.uas.platform.b2c.trade.support.ResultMap;
|
|
|
import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
@@ -32,6 +37,15 @@ public class LogisticsOldServiceImpl implements LogisticsOldService {
|
|
|
@Autowired
|
|
|
private InvoiceFPurchaseDao invoiceFPurchaseDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PurchaseDao purchaseDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OrderDao orderDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysConf sysConf;
|
|
|
+
|
|
|
/*
|
|
|
* @Override public List<LogisticsCompanyCode> getAllCodes() { return
|
|
|
* logisticsCompanyCodeDao.findAll(); } public List<String> getAllName(){
|
|
|
@@ -88,6 +102,56 @@ public class LogisticsOldServiceImpl implements LogisticsOldService {
|
|
|
return logisticsDao.findOne(id);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 新增物流信息
|
|
|
+ * @param inid
|
|
|
+ * @param logistics
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResultMap addLogistics(String inid, Logistics logistics) {
|
|
|
+ if(StringUtils.isEmpty(inid)) {
|
|
|
+ return new ResultMap(CodeType.NO_INFO, "您需要更新的出货单号为空,请重新操作");
|
|
|
+ }
|
|
|
+ InvoiceFPurchase fPurchase = invoiceFPurchaseDao.findByInvoiceid(inid);
|
|
|
+ if(fPurchase == null) {
|
|
|
+ return new ResultMap(CodeType.NOT_EXiST, "找不到对应的出货单号为空,请重新操作");
|
|
|
+ }
|
|
|
+ if(SystemSession.getUser().getEnterprise().getUu().longValue() != fPurchase.getSellerenuu().longValue()) {
|
|
|
+ return new ResultMap(CodeType.NOT_PERMIT, "当前登录的公司不能操作此订单");
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(logistics.getCompanyName())) {
|
|
|
+ return new ResultMap(CodeType.NO_INFO, "物流公司信息为空,请重新操作");
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(logistics.getNumber())) {
|
|
|
+ return new ResultMap(CodeType.NO_INFO, "物流单号信息为空,请重新操作");
|
|
|
+ }
|
|
|
+ if (logistics != null){
|
|
|
+ LogisticsCompanyCode logisticsCompanyCode = logisticsCompanyCodeDao.findByName(logistics.getCompanyName());
|
|
|
+ if (logisticsCompanyCode != null) {
|
|
|
+ logistics.setCompanyId(logisticsCompanyCode.getId());
|
|
|
+ logistics.setCompanyCode(logisticsCompanyCode.getCode());
|
|
|
+ }
|
|
|
+ Logistics logistics1 = logisticsDao.save(logistics);
|
|
|
+ fPurchase.setLogistics(logistics1);
|
|
|
+ }
|
|
|
+ Purchase purchase = purchaseDao.findOne(fPurchase.getPuid());
|
|
|
+ if (fPurchase.getLogistics() != null){
|
|
|
+ purchase.setLgtId(fPurchase.getLogistics().getId());
|
|
|
+ purchaseDao.save(purchase);
|
|
|
+ }
|
|
|
+ if(!purchase.getStoreid().equals(sysConf.getStoreid())) {
|
|
|
+ Order order = orderDao.findByOrderid(purchase.getOrderid());
|
|
|
+ if (order == null) {
|
|
|
+ return new ResultMap(CodeType.NOT_PERMIT, "您订单的信息有误,请重新提交");
|
|
|
+ }
|
|
|
+ if (fPurchase.getLogistics() != null) {
|
|
|
+ order.setLgtId(fPurchase.getLogistics().getId());
|
|
|
+ }
|
|
|
+ orderDao.save(order);
|
|
|
+ }
|
|
|
+ return ResultMap.success(null);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 更新物流信息
|