|
@@ -11,6 +11,7 @@ import com.iamberry.rst.core.order.Product;
|
|
|
import com.iamberry.rst.core.order.ProductColor;
|
|
|
import com.iamberry.rst.core.page.PagedResult;
|
|
|
import com.iamberry.rst.faces.cm.CustomerService;
|
|
|
+import com.iamberry.rst.faces.order.EfastOrderService;
|
|
|
import com.iamberry.rst.service.address.mapper.AddressMapper;
|
|
|
import com.iamberry.rst.service.cm.mapper.*;
|
|
|
import com.iamberry.rst.service.order.EfastOrderServiceImpl;
|
|
@@ -68,6 +69,8 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
private ComplaintSignclosedProductInfoMapper complaintSignclosedProductInfoMapper;
|
|
|
@Autowired
|
|
|
private FittingsInfoMapper fittingsInfoMapper;
|
|
|
+ @Autowired
|
|
|
+ private EfastOrderService efastOrderService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -133,7 +136,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
Map<String,Object> map;
|
|
|
switch (customerInfo.getCustomerIsSolve()) { //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
|
|
|
case 3: //换新
|
|
|
- map = this.sendEfastOrder(customerCommon); //换新需要向Efast推送一条换新发货的订单
|
|
|
+ map = this.sendEfastOrder(customerCommon,salesOrder); //换新需要向Efast推送一条换新发货的订单
|
|
|
if(map.get("status") == 1){
|
|
|
customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId"))); //存放Efast订单编号
|
|
|
complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId"))); //仓储签收表添加 发货的Efast订单id
|
|
@@ -146,7 +149,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
this.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
break;
|
|
|
case 4: //维修
|
|
|
- map = this.sendEfastOrder(customerCommon); //维修需要向Efast推送一条维修发货的订单
|
|
|
+ map = this.sendEfastOrder(customerCommon,salesOrder); //维修需要向Efast推送一条维修发货的订单
|
|
|
if(map.get("status") == 1){
|
|
|
customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId"))); //存放Efast订单编号
|
|
|
complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId"))); //仓储签收表添加 发货的Efast订单id
|
|
@@ -159,7 +162,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
this.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
break;
|
|
|
case 5: //补发 不用创建仓储签收任务
|
|
|
- map = this.sendEfastOrder(customerCommon); //补发需要向Efast推送一条发货的订单
|
|
|
+ map = this.sendEfastOrder(customerCommon,salesOrder); //补发需要向Efast推送一条发货的订单
|
|
|
if(map.get("status") == 1){
|
|
|
customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId"))); //存放Efast订单编号
|
|
|
complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId"))); //仓储签收表添加 发货的Efast订单id
|
|
@@ -352,14 +355,16 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
* 向Efast推送订单 仅换新,维修 ,补发
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String,Object> sendEfastOrder(CustomerCommon customerCommon){
|
|
|
+ @Transactional
|
|
|
+ public Map<String,Object> sendEfastOrder(CustomerCommon customerCommon,SalesOrder salesOrder) throws Exception{
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
- EfastOrderServiceImpl efastOrderService = new EfastOrderServiceImpl();
|
|
|
List<EfastOrder> orderList = new ArrayList<EfastOrder>();
|
|
|
List<OrderItem> itemList = new ArrayList<OrderItem>();
|
|
|
|
|
|
Integer num = 0; //产品数量
|
|
|
Integer amout = 0; //商品总价
|
|
|
+ String orderProductBarCode = ""; //产品sku
|
|
|
+ String productName = ""; //产品名称
|
|
|
for(int i=0;i<customerCommon.getSendProdcues().size();i++){
|
|
|
SendProdcue sendProdcue = customerCommon.getSendProdcues().get(i);
|
|
|
OrderItem orderItem = new OrderItem();
|
|
@@ -368,6 +373,8 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
orderItem.setItemProductPrice(sendProdcue.getProductColor().getColorPrice());
|
|
|
orderItem.setItemColorBar(sendProdcue.getProductColor().getColorBar());
|
|
|
itemList.add(orderItem);
|
|
|
+ orderProductBarCode = sendProdcue.getProductColor().getColorBar();
|
|
|
+ productName = sendProdcue.getSendProduceName();
|
|
|
num += sendProdcue.getSendProdcueNumber();
|
|
|
amout += sendProdcue.getProductColor().getColorPrice();
|
|
|
}
|
|
@@ -375,7 +382,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
EfastOrder efastOrder = new EfastOrder();
|
|
|
efastOrder.setOrderAddressName(customerCommon.getRelationSendName());//收货人姓名
|
|
|
efastOrder.setOrderAddressTel(customerCommon.getRelationSendTel());//收货人电话
|
|
|
- efastOrder.setOrderOpenId("");//身份证
|
|
|
+ efastOrder.setOrderOpenId("1");//身份证
|
|
|
|
|
|
String[] address = customerCommon.getRelationSendMergeAddress().split("-");
|
|
|
efastOrder.setOrderProvince(address[0]);
|
|
@@ -388,31 +395,45 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
efastOrder.setOrderAmount(amout); //商品总价
|
|
|
efastOrder.setOrderPayMoney(amout); //已付款
|
|
|
|
|
|
- efastOrder.setOrderId(customerCommon.getTransactionNumber()); //外部交易号
|
|
|
+ //支付方式
|
|
|
+ switch (salesOrder.getSalesPayType()){
|
|
|
+ case 1: //微信支付
|
|
|
+ efastOrder.setOrderPayType(1);
|
|
|
+ break;
|
|
|
+ case 2: //现金支付
|
|
|
+ efastOrder.setOrderPayType(2);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ break;
|
|
|
+ case 4: //刷卡支付
|
|
|
+ efastOrder.setOrderPayType(4);
|
|
|
+ break;
|
|
|
+ case 5: //支付宝支付
|
|
|
+ efastOrder.setOrderPayType(5);
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- efastOrder.setOrderPayType(0); //支付方式
|
|
|
+ efastOrder.setOrderProductBarCode(orderProductBarCode); //产品sku
|
|
|
+ efastOrder.setOrderProductName(productName); //产品名称
|
|
|
+
|
|
|
+ efastOrder.setOrderId(customerCommon.getTransactionNumber()); //外部交易号
|
|
|
+ efastOrder.setOid(1);
|
|
|
|
|
|
orderList.add(efastOrder);
|
|
|
|
|
|
Integer status = 1;
|
|
|
+ Map<String,Object> orderMap = new HashMap<String,Object>();
|
|
|
try {
|
|
|
- efastOrderService.sendOrderInfoToEfast(orderList,itemList);
|
|
|
+ orderMap = efastOrderService.sendOrder(orderList,itemList);
|
|
|
} catch (Exception e) {
|
|
|
status = 0;
|
|
|
}
|
|
|
- if(status == 0){
|
|
|
- map.put("status",status);
|
|
|
- map.put("EfastOrderId","");
|
|
|
- return map;
|
|
|
- }
|
|
|
- EfastOrder efOrder = new EfastOrder();
|
|
|
- try {
|
|
|
- efOrder = efastOrderService.getOrderInfoFromEfast(customerCommon.getTransactionNumber());
|
|
|
- } catch (Exception e) {
|
|
|
+ List<EfastOrder> oList = (List<EfastOrder>) orderMap.get("efastOrderList");
|
|
|
+ if(oList == null || oList.size() < 1){
|
|
|
status = 0;
|
|
|
}
|
|
|
map.put("status",status);
|
|
|
- map.put("EfastOrderId",efOrder.getOid());
|
|
|
+ map.put("EfastOrderId",oList.get(0).getEfastOrderId());
|
|
|
return map;
|
|
|
}
|
|
|
|