From f407f5f021533f1dd7fe4df811b26d5469fb0b88 Mon Sep 17 00:00:00 2001
From: caoyan <caoyssm@gmail.com>
Date: Thu, 20 Jun 2019 15:36:21 +0800
Subject: [PATCH] 增加香港现货

---
 dal/src/main/java/com/yoho/order/model/BuyerOrderReq.java                      |  4 +++-
 dal/src/main/java/com/yoho/order/model/SellerOrderGoods.java                   | 10 ++++++++++
 dal/src/main/resources/META-INF/mybatis/BuyerOrderMapper.xml                   |  7 +++++--
 dal/src/main/resources/META-INF/mybatis/SellerOrderGoodsMapper.xml             |  3 ++-
 order/src/main/java/com/yoho/ufo/order/service/impl/BuyerOrderServiceImpl.java | 32 ++++++++++++++++++++++----------
 web/src/main/webapp/html/orderManage/detail.html                               |  2 ++
 web/src/main/webapp/html/orderManage/list.html                                 |  1 +
 7 files changed, 45 insertions(+), 14 deletions(-)

diff --git a/dal/src/main/java/com/yoho/order/model/BuyerOrderReq.java b/dal/src/main/java/com/yoho/order/model/BuyerOrderReq.java
index 35a4e6a..9670d47 100644
--- a/dal/src/main/java/com/yoho/order/model/BuyerOrderReq.java
+++ b/dal/src/main/java/com/yoho/order/model/BuyerOrderReq.java
@@ -3,10 +3,10 @@ package com.yoho.order.model;
 import java.util.List;
 
 import com.yoho.ufo.service.model.PageRequestBO;
+
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
-import lombok.ToString;
 import lombok.experimental.Builder;
 
 /**
@@ -132,4 +132,6 @@ public class BuyerOrderReq extends PageRequestBO{
 	private String phoneUid;
 	
 	private String sortRule;
+	
+	private Integer region;//0:大陆 1:香港
 }
diff --git a/dal/src/main/java/com/yoho/order/model/SellerOrderGoods.java b/dal/src/main/java/com/yoho/order/model/SellerOrderGoods.java
index 16befde..6a0ee13 100644
--- a/dal/src/main/java/com/yoho/order/model/SellerOrderGoods.java
+++ b/dal/src/main/java/com/yoho/order/model/SellerOrderGoods.java
@@ -12,6 +12,8 @@ public class SellerOrderGoods implements Serializable {
 	
 	private Integer id;
 	
+	private Integer region;
+	
 	private Integer uid;
 	
 	private Integer productId;
@@ -46,6 +48,14 @@ public class SellerOrderGoods implements Serializable {
 		this.id = id;
 	}
 
+	public Integer getRegion() {
+		return region;
+	}
+
+	public void setRegion(Integer region) {
+		this.region = region;
+	}
+
 	public Integer getUid() {
 		return uid;
 	}
diff --git a/dal/src/main/resources/META-INF/mybatis/BuyerOrderMapper.xml b/dal/src/main/resources/META-INF/mybatis/BuyerOrderMapper.xml
index fe139ec..705bb69 100644
--- a/dal/src/main/resources/META-INF/mybatis/BuyerOrderMapper.xml
+++ b/dal/src/main/resources/META-INF/mybatis/BuyerOrderMapper.xml
@@ -205,12 +205,15 @@
              and a.platform_delivery_status in (1,2)
          </if>
      </if>
+     <if test="buyerOrderReq.region != null and buyerOrderReq.region != '' ">
+         and c.region = #{buyerOrderReq.region} 
+     </if>
   </sql>
     
     <select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.BuyerOrderReq">
         select count(a.id)   
         from buyer_order a 
-        <if test="(buyerOrderReq.depotNo != null) or (buyerOrderReq.productId != null) or (buyerOrderReq.skup != null) or (buyerOrderReq.storageId != null)">
+        <if test="(buyerOrderReq.depotNo != null) or (buyerOrderReq.productId != null) or (buyerOrderReq.skup != null) or (buyerOrderReq.storageId != null) or (buyerOrderReq.region != null)">
         LEFT JOIN buyer_order_goods b
         ON( b.order_code=a.order_code) 
         LEFT JOIN seller_order_goods c
@@ -231,7 +234,7 @@
     <select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.order.model.BuyerOrderReq">
         select a.*
         from buyer_order a 
-        <if test="(buyerOrderReq.depotNo != null) or (buyerOrderReq.productId != null) or (buyerOrderReq.skup != null) or (buyerOrderReq.storageId != null)">
+        <if test="(buyerOrderReq.depotNo != null) or (buyerOrderReq.productId != null) or (buyerOrderReq.skup != null) or (buyerOrderReq.storageId != null) or (buyerOrderReq.region != null)">
         LEFT JOIN buyer_order_goods b
         ON( b.order_code=a.order_code) 
         LEFT JOIN seller_order_goods c
diff --git a/dal/src/main/resources/META-INF/mybatis/SellerOrderGoodsMapper.xml b/dal/src/main/resources/META-INF/mybatis/SellerOrderGoodsMapper.xml
index ff69802..0172144 100644
--- a/dal/src/main/resources/META-INF/mybatis/SellerOrderGoodsMapper.xml
+++ b/dal/src/main/resources/META-INF/mybatis/SellerOrderGoodsMapper.xml
@@ -3,6 +3,7 @@
 <mapper namespace="com.yoho.order.dal.SellerOrderGoodsMapper">
     <resultMap id="BaseResultMap" type="com.yoho.order.model.SellerOrderGoods">
       <result column="id" property="id" jdbcType="INTEGER" />
+      <result column="region" property="region" jdbcType="INTEGER" />
       <result column="uid" property="uid" jdbcType="INTEGER" />
       <result column="product_id" property="productId" jdbcType="INTEGER" />
       <result column="product_name" property="productName" jdbcType="VARCHAR" />
@@ -19,7 +20,7 @@
     </resultMap>
 
     <sql id="Base_Column_List">
-        id, uid, product_id, product_name, storage_id, depot_no, size_id, size_name, color_id, 
+        id, region, uid, product_id, product_name, storage_id, depot_no, size_id, size_name, color_id, 
         color_name, goods_price, status, image_id, image_url
     </sql>
 
diff --git a/order/src/main/java/com/yoho/ufo/order/service/impl/BuyerOrderServiceImpl.java b/order/src/main/java/com/yoho/ufo/order/service/impl/BuyerOrderServiceImpl.java
index 34cc974..8093ddb 100644
--- a/order/src/main/java/com/yoho/ufo/order/service/impl/BuyerOrderServiceImpl.java
+++ b/order/src/main/java/com/yoho/ufo/order/service/impl/BuyerOrderServiceImpl.java
@@ -111,6 +111,7 @@ import com.yohobuy.ufo.model.order.common.EnumQualityCheckType;
 import com.yohobuy.ufo.model.order.common.OperateTypeEnum;
 import com.yohobuy.ufo.model.order.common.OrderAttributes;
 import com.yohobuy.ufo.model.order.common.OrderStatus;
+import com.yohobuy.ufo.model.order.constants.SkupType;
 import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq;
 import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
 import com.yohobuy.ufo.model.order.resp.ExpressInfoResp;
@@ -255,17 +256,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
     @Autowired
     private SignForPackageMapper signForPackageMapper;
     
-    //南京月结账号
-//	private static final String NANJING_CUSTID = "0255045253";
-//    private static final String NANJING_CUSTID = "9999999999";
-    
-    //北京月结账号
-//	private static final String BEIJING_CUSTID = "0100026158";
-//    private static final String BEIJING_CUSTID = "9999999999";
-	
 	private static final Integer PAY_METHOD_MONTHLY = 1;//寄付月结
 	
 	private static final Integer PAY_METHOD_FREIGHT_COLLECT = 2;//到付
+	
+	private static final Integer REGION_MAINLAND = 0;//大陆
+	
+	private static final Integer REGION_HONGKONG = 1;//香港
     
     //已收货
     private static final Byte QC_STATUS_RECEIVED = 0;
@@ -1673,6 +1670,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
     	SellerOrderGoods sellerGoods = sellerGoodsList.get(0);
     	
     	resp.setDepotNo(sellerGoods.getDepotNo());
+    	resp.setRegion(sellerGoods.getRegion());
     	
     	//商品信息
     	resp.setProductImage(ImagesHelper.getImageAbsoluteUrl(sellerGoods.getImageUrl(), ImagesConstant.BUCKET_GOODS_IMG));
@@ -2556,7 +2554,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
     		resp.setStatusStr(Constant.convertOrderStatusStr(item.getStatus()));
     		resp.setChannel(Objects.equals(item.getAttributes(), 2) ? 2 : 1);	//1,线上订单; 2,门店订单
     		resp.setProductNum(1);//目前固定为1
-			resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(item.getAttributes()));
 			resp.setActivityType(item.getActivityType());
 			if(null==sellerGoodsMap.get(skup)){
 				LOGGER.warn("convertToResp not correct data,sellerGoodsMap get sku p {} is empty ,buyer order {}",skup,item);
@@ -2566,6 +2563,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
 				resp.setProductName(sellerGoodsMap.get(skup).getProductName());
 				resp.setColorName(sellerGoodsMap.get(skup).getColorName());
 				resp.setSizeName(sellerGoodsMap.get(skup).getSizeName());
+				resp.setAttributesStr(getAttributesStr(sellerGoodsMap.get(skup).getRegion(), item.getAttributes()));
 			}
 
 			resp.setSkup(skup);
@@ -2634,6 +2632,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
     	
     	return respList;
     }
+    
+    private String getAttributesStr(Integer region, Integer attributes) {
+    	String result = OrderConfigConstant.getOrderAttributeStr(attributes);
+    	if(REGION_HONGKONG.equals(region) && attributes.equals(OrderAttributes.COMMON_IN_STOCK.getCode())) {
+    		result = "香港直邮";
+    	}
+    	
+    	return result;
+    }
 
     private List<BuyerOrderResp> convertToRespForQuery(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap,
     		Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressRecord> expressInfoMap,
@@ -2775,7 +2782,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
 			}
 		}
 
-		if(null != req.getAttributes() && 0 != req.getAttributes()){
+		if(null != req.getAttributes() && 0 != req.getAttributes() && 11 != req.getAttributes()){
 			req.setAttributesList(Arrays.asList(req.getAttributes()));
 		}
 
@@ -2813,6 +2820,11 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
 		}else if(StringUtils.isNotEmpty(req.getBuyerEndTime())){
 			req.setBuyerEndTime(req.getBuyerEndTime().substring(0, 10));
 		}
+		
+		if(null != req.getAttributes() && req.getAttributes().intValue() == 11) {//香港直邮
+			req.setRegion(REGION_HONGKONG);
+			req.setAttributes(OrderAttributes.COMMON_IN_STOCK.getCode());
+		}
     	
     }
     
diff --git a/web/src/main/webapp/html/orderManage/detail.html b/web/src/main/webapp/html/orderManage/detail.html
index 85a51a4..abdb778 100644
--- a/web/src/main/webapp/html/orderManage/detail.html
+++ b/web/src/main/webapp/html/orderManage/detail.html
@@ -461,6 +461,8 @@ function getOrderInfo(orderCode){
                      attributesStr = '全新瑕疵';
                  }else if("6" == attributes){
                      attributesStr = '二手';
+                 }else if("1" == attributes && "1" == result.data.region){
+                	 attributesStr = '香港直邮';
                  }
             	 $("#preSellOrNormal").html(attributesStr);
                  if (result.data.activityType == 18) {
diff --git a/web/src/main/webapp/html/orderManage/list.html b/web/src/main/webapp/html/orderManage/list.html
index 479e6e1..a71a67f 100644
--- a/web/src/main/webapp/html/orderManage/list.html
+++ b/web/src/main/webapp/html/orderManage/list.html
@@ -134,6 +134,7 @@
                     <option value="4">预售</option>
                     <option value="5">全新瑕疵</option>
                     <option value="6">二手</option>
+                    <option value="11">香港直邮</option>
                 </select>
                 <label>买家下单时间:</label>
                 <input id="buyerStartTime" type="text">
--
libgit2 0.24.0