Authored by mali

Merge branch 'test6.9.8' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.8

@@ -23,19 +23,4 @@ public class ExpressInfoConstant { @@ -23,19 +23,4 @@ public class ExpressInfoConstant {
23 */ 23 */
24 public static final Integer EXPRESS_STATUS_UNSEND = 2; 24 public static final Integer EXPRESS_STATUS_UNSEND = 2;
25 25
26 - /**  
27 - * 清关成功  
28 - */  
29 - public static final Integer EXPRESS_CLEAR_SUCCESS = 100;  
30 -  
31 - /**  
32 - * 清关失败(平台原因)  
33 - */  
34 - public static final Integer EXPRESS_CLEAR_FAIL_CAUSE_PLATFORM = 101;  
35 -  
36 - /**  
37 - * 清关失败(买家原因)  
38 - */  
39 - public static final Integer EXPRESS_CLEAR_FAIL_CAUSE_BUYER= 102;  
40 -  
41 } 26 }
@@ -8,5 +8,6 @@ public class StorageDepositCount { @@ -8,5 +8,6 @@ public class StorageDepositCount {
8 private Integer productId; 8 private Integer productId;
9 private Integer storageIdCount; 9 private Integer storageIdCount;
10 private Integer storageCount; 10 private Integer storageCount;
  11 + private Integer skup;
11 private Integer unShelfStorageCount; 12 private Integer unShelfStorageCount;
12 } 13 }
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
25 <resultMap id="CountResultMap" type="com.yohoufo.dal.order.model.StorageDepositCount" > 25 <resultMap id="CountResultMap" type="com.yohoufo.dal.order.model.StorageDepositCount" >
26 <result column="product_id" property="productId" jdbcType="INTEGER" /> 26 <result column="product_id" property="productId" jdbcType="INTEGER" />
27 <result column="storage_id_count" property="storageIdCount" jdbcType="INTEGER" /> 27 <result column="storage_id_count" property="storageIdCount" jdbcType="INTEGER" />
  28 + <result column="skup" property="skup" jdbcType="BIGINT" />
28 <result column="storage_count" property="storageCount" jdbcType="INTEGER" /> 29 <result column="storage_count" property="storageCount" jdbcType="INTEGER" />
29 <result column="un_shelf_storage_count" property="unShelfStorageCount" jdbcType="INTEGER" /> 30 <result column="un_shelf_storage_count" property="unShelfStorageCount" jdbcType="INTEGER" />
30 </resultMap> 31 </resultMap>
@@ -263,7 +264,7 @@ @@ -263,7 +264,7 @@
263 </select> 264 </select>
264 265
265 <select id="queryUserDepositProduct" resultMap="CountResultMap"> 266 <select id="queryUserDepositProduct" resultMap="CountResultMap">
266 - select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count from storage_deposit 267 + select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count,max(skup) as skup from storage_deposit
267 where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count} 268 where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count}
268 and product_id in 269 and product_id in
269 <foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")"> 270 <foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")">
  1 +package com.yohoufo.order.common;
  2 +
  3 +import java.util.Objects;
  4 +
  5 +public class LogisticsTypes {
  6 +
  7 + /**
  8 + * 判断是否是中通国际快递公司
  9 + *
  10 + * @param logisticsType
  11 + * @return
  12 + */
  13 + public static boolean isZtoInternational(Integer logisticsType) {
  14 + return Objects.isNull(logisticsType) ? false : logisticsType.intValue() == 76;
  15 + }
  16 +
  17 +}
@@ -14,6 +14,7 @@ import com.yohoufo.dal.order.ExpressRecordMapper; @@ -14,6 +14,7 @@ import com.yohoufo.dal.order.ExpressRecordMapper;
14 import com.yohoufo.dal.order.model.BuyerOrder; 14 import com.yohoufo.dal.order.model.BuyerOrder;
15 import com.yohoufo.dal.order.model.ExpressInfo; 15 import com.yohoufo.dal.order.model.ExpressInfo;
16 import com.yohoufo.dal.order.model.ExpressRecord; 16 import com.yohoufo.dal.order.model.ExpressRecord;
  17 +import com.yohoufo.order.common.LogisticsTypes;
17 import com.yohoufo.order.model.bo.ErpExpressBo; 18 import com.yohoufo.order.model.bo.ErpExpressBo;
18 import com.yohoufo.order.mq.publisher.ConsumerExceptionPublisher; 19 import com.yohoufo.order.mq.publisher.ConsumerExceptionPublisher;
19 import com.yohoufo.order.service.IBuyerOrderService; 20 import com.yohoufo.order.service.IBuyerOrderService;
@@ -156,30 +157,9 @@ private static final Logger LOGGER = LoggerUtils.getMqConsumerLogger(); @@ -156,30 +157,9 @@ private static final Logger LOGGER = LoggerUtils.getMqConsumerLogger();
156 expressInfo.setExpressType(initExpressType); 157 expressInfo.setExpressType(initExpressType);
157 expressInfo.setState(state); 158 expressInfo.setState(state);
158 159
159 - //清关失败和清关成功的物流信息,需要在OperateTransferCode记录下相应的code ,以便自动确认查询  
160 - if(ExpressInfoConstant.EXPRESS_CLEAR_SUCCESS.equals(state)){  
161 - //清关成功的纪录 160 + // 中通国际快递公司,存在物流则表示清关成功
  161 + if (LogisticsTypes.isZtoInternational(logisticsType)) {
162 expressInfo.setOperateTransferCode(EnumExpressDataOperateTransferCode.express_clear_success.getCode()); 162 expressInfo.setOperateTransferCode(EnumExpressDataOperateTransferCode.express_clear_success.getCode());
163 - }else if(ExpressInfoConstant.EXPRESS_CLEAR_FAIL_CAUSE_PLATFORM.equals(state)){  
164 - //TODO 平台原因清关失败的信息记录下来,需要告诉order,退费  
165 - expressInfo.setOperateTransferCode(EnumExpressDataOperateTransferCode.express_clear_fail_cause_platform.getCode());  
166 - /*暂时注释掉,等香港仓上线,中通物流返回信息未定  
167 - final CutomsClearanceFailType failType=CutomsClearanceFailType.PLATFORM;  
168 - LOGGER.info("call order clear fail interface,orderCode {},uid {},waybillCode {},state {} ,failType {}", orderCode,uid,waybillCode,state,failType);  
169 - executorService.execute(() -> {  
170 - buyerOrderCancelService.cancelOverseasOrder(orderCode, failType);  
171 - LOGGER.info("call order clear fail interface end,orderCode {},uid {},waybillCode {},state {},failType {} ", orderCode,uid,waybillCode,state,failType);  
172 - });*/  
173 - }else if(ExpressInfoConstant.EXPRESS_CLEAR_FAIL_CAUSE_BUYER.equals(state)){  
174 - //TODO 买家原因清关失败的信息记录下来,需要告诉order,退费  
175 - expressInfo.setOperateTransferCode(EnumExpressDataOperateTransferCode.express_clear_fail_cause_buyer.getCode());  
176 - /*暂时注释掉,等香港仓上线,中通物流返回信息未定  
177 - final CutomsClearanceFailType failType=CutomsClearanceFailType.BUYER;  
178 - LOGGER.info("call order clear fail interface,orderCode {},uid {},waybillCode {},state {} ,failType {}", orderCode,uid,waybillCode,state,failType);  
179 - executorService.execute(() -> {  
180 - buyerOrderCancelService.cancelOverseasOrder(orderCode, failType);  
181 - LOGGER.info("call order clear fail interface end,orderCode {},uid {},waybillCode {},state {},failType {} ", orderCode,uid,waybillCode,state,failType);  
182 - });*/  
183 } 163 }
184 expressInfoMapper.insert(expressInfo); 164 expressInfoMapper.insert(expressInfo);
185 165
@@ -44,6 +44,7 @@ import com.yohoufo.order.service.proxy.OrderOperateRecordService; @@ -44,6 +44,7 @@ import com.yohoufo.order.service.proxy.OrderOperateRecordService;
44 import com.yohoufo.order.service.proxy.OrderStatusFlowService; 44 import com.yohoufo.order.service.proxy.OrderStatusFlowService;
45 import com.yohoufo.order.service.proxy.ProductProxyService; 45 import com.yohoufo.order.service.proxy.ProductProxyService;
46 import com.yohoufo.order.service.seller.setting.SellerService; 46 import com.yohoufo.order.service.seller.setting.SellerService;
  47 +import com.yohoufo.order.utils.BuyerOrderUtils;
47 import com.yohoufo.order.utils.PaymentHelper; 48 import com.yohoufo.order.utils.PaymentHelper;
48 import com.yohoufo.order.utils.PubThreadFactory; 49 import com.yohoufo.order.utils.PubThreadFactory;
49 import lombok.Data; 50 import lombok.Data;
@@ -195,18 +196,43 @@ public class AppraiseService { @@ -195,18 +196,43 @@ public class AppraiseService {
195 * 正常发货 196 * 正常发货
196 * 鉴定通过 -- 待收货 197 * 鉴定通过 -- 待收货
197 * 瑕疵接收 -- 待收货 198 * 瑕疵接收 -- 待收货
  199 + * 寄存完成 -- 待收货
198 */ 200 */
199 public void deliveryGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo) { 201 public void deliveryGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo) {
200 LOGGER.info("deliveryGoodsToBuyer enter req {}", appraiseExpressInfoBo); 202 LOGGER.info("deliveryGoodsToBuyer enter req {}", appraiseExpressInfoBo);
201 - final OrderStatus expectOrderStatus;  
202 - final OrderStatus targetOrderStatus = OrderStatus.WAITING_RECEIVE;  
203 Long orderCode = appraiseExpressInfoBo.getOrderCode(); 203 Long orderCode = appraiseExpressInfoBo.getOrderCode();
204 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); 204 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
205 -  
206 if (buyerOrder == null) { 205 if (buyerOrder == null) {
207 LOGGER.warn("deliveryGoodsToBuyer getOrderInfo order not exist, orderCode is {}", orderCode); 206 LOGGER.warn("deliveryGoodsToBuyer getOrderInfo order not exist, orderCode is {}", orderCode);
208 throw new ServiceException(ServiceError.ORDER_NULL); 207 throw new ServiceException(ServiceError.ORDER_NULL);
209 } 208 }
  209 + // 寄存订单
  210 + if(BuyerOrderUtils.isDeposit(buyerOrder.getAttributes())){
  211 + deliveryDepositGoodsToBuyer(appraiseExpressInfoBo, buyerOrder);
  212 + } else {
  213 + deliveryNonDepositGoodsToBuyer(appraiseExpressInfoBo, buyerOrder);
  214 + }
  215 +
  216 + }
  217 +
  218 + private void deliveryDepositGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder) {
  219 + if(buyerOrder.getStatus() == OrderStatus.DONE.getCode()){
  220 + expressInfoService.deliverGoods(buyerOrder.getUid(),
  221 + appraiseExpressInfoBo.getExpressCompanyId(),
  222 + buyerOrder.getOrderCode(),
  223 + appraiseExpressInfoBo.getWayBillCode(),
  224 + appraiseExpressInfoBo.getDepotNum(),
  225 + appraiseExpressInfoBo.getMobile());
  226 + }else {
  227 + LOGGER.warn("in deliveryGoodsToBuyer, buyer Deposit Order orderCode {}", buyerOrder.getOrderCode());
  228 + throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
  229 + }
  230 + }
  231 +
  232 + private void deliveryNonDepositGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder) {
  233 + final Long orderCode = buyerOrder.getOrderCode();
  234 + final OrderStatus expectOrderStatus;
  235 + final OrderStatus targetOrderStatus = OrderStatus.WAITING_RECEIVE;
210 if (buyerOrder.getStatus() == OrderStatus.JUDGE_PASS.getCode()) { 236 if (buyerOrder.getStatus() == OrderStatus.JUDGE_PASS.getCode()) {
211 expectOrderStatus = OrderStatus.JUDGE_PASS; 237 expectOrderStatus = OrderStatus.JUDGE_PASS;
212 } else if (buyerOrder.getStatus() == OrderStatus.MINI_FAULT_ACCEPT.getCode()) { 238 } else if (buyerOrder.getStatus() == OrderStatus.MINI_FAULT_ACCEPT.getCode()) {
@@ -49,32 +49,20 @@ public class DepositServiceImpl implements DepositService { @@ -49,32 +49,20 @@ public class DepositServiceImpl implements DepositService {
49 } 49 }
50 List<Integer> productIdList = storageDepositMapper.queryUserDepositProductId(uid, (page - 1) * limit, limit); 50 List<Integer> productIdList = storageDepositMapper.queryUserDepositProductId(uid, (page - 1) * limit, limit);
51 List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, productIdList); 51 List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, productIdList);
52 - /*// 商品名称  
53 - List<Product> productList = productMapper.selectByIds(productIdList);  
54 - // 颜色  
55 - List<Goods> goodsList = goodsMapper.selectByProductIds(productIdList);  
56 - // 图片  
57 - List<GoodsImages> goodsImagesList = goodsImagesMapper.selectByGoodsIdList(goodsList.stream().map(Goods::getId).collect(Collectors.toList())); 52 + List<Integer> skupList = countInfoList.stream().map(StorageDepositCount::getSkup).collect(Collectors.toList());
  53 + List<SellerOrderGoods> goodsList = sellerOrderGoodsMapper.selectBySkups(skupList);
58 Map<Integer, StorageDepositCount> countInfoMap = countInfoList.stream().map(Function.identity()).collect(Collectors.toMap(StorageDepositCount::getProductId, Function.identity())); 54 Map<Integer, StorageDepositCount> countInfoMap = countInfoList.stream().map(Function.identity()).collect(Collectors.toMap(StorageDepositCount::getProductId, Function.identity()));
59 - Map<Integer, Product> productMap = productList.stream().map(Function.identity()).collect(Collectors.toMap(Product::getId, Function.identity()));  
60 - Map<Integer, Goods> goodsMap = goodsList.stream().map(Function.identity()).collect(Collectors.toMap(Goods::getProductId, Function.identity()));  
61 - Map<Integer, GoodsImages> goodsImagesMap = goodsImagesList.stream().map(Function.identity()).collect(Collectors.toMap(GoodsImages::getProductId, Function.identity())); 55 + Map<Integer, SellerOrderGoods> goodsMap = goodsList.stream().map(Function.identity()).collect(Collectors.toMap(SellerOrderGoods::getProductId, Function.identity()));
62 56
63 List<DepositProductBo> result = new ArrayList<>(); 57 List<DepositProductBo> result = new ArrayList<>();
64 for (Integer productId : productIdList) { 58 for (Integer productId : productIdList) {
65 DepositProductBo bo = new DepositProductBo(); 59 DepositProductBo bo = new DepositProductBo();
66 bo.setProductId(productId); 60 bo.setProductId(productId);
67 - Product p = productMap.get(productId);  
68 - if (p != null) {  
69 - bo.setProductName(p.getProductName());  
70 - }  
71 - Goods g = goodsMap.get(productId);  
72 - if (g != null) {  
73 - bo.setColorName(StringUtils.isBlank(g.getGoodsName()) ? g.getColorName() : g.getGoodsName());  
74 - }  
75 - GoodsImages gi = goodsImagesMap.get(productId);  
76 - if (gi != null) {  
77 - bo.setPic(ImageUrlAssist.getAllProductPicUrl(gi.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); 61 + SellerOrderGoods goods = goodsMap.get(productId);
  62 + if (goods != null) {
  63 + bo.setProductName(goods.getProductName());
  64 + bo.setColorName(goods.getColorName());
  65 + bo.setPic(goods.getImageUrl());
78 } 66 }
79 StorageDepositCount countInfo = countInfoMap.get(productId); 67 StorageDepositCount countInfo = countInfoMap.get(productId);
80 if (countInfo != null) { 68 if (countInfo != null) {
@@ -83,7 +71,7 @@ public class DepositServiceImpl implements DepositService { @@ -83,7 +71,7 @@ public class DepositServiceImpl implements DepositService {
83 bo.setShelfStatus(countInfo.getStorageIdCount() == 0 ? "全部已上架" : ("有" + countInfo.getStorageIdCount() + "件未上架")); 71 bo.setShelfStatus(countInfo.getStorageIdCount() == 0 ? "全部已上架" : ("有" + countInfo.getStorageIdCount() + "件未上架"));
84 } 72 }
85 result.add(bo); 73 result.add(bo);
86 - }*/ 74 + }
87 return null; 75 return null;
88 } 76 }
89 77
@@ -143,8 +143,8 @@ public class OrdersPayService { @@ -143,8 +143,8 @@ public class OrdersPayService {
143 cmsPayVO.setStartVersion(e.getStartVersion()); 143 cmsPayVO.setStartVersion(e.getStartVersion());
144 cmsPayVO.setEndVersion(e.getEndVersion()); 144 cmsPayVO.setEndVersion(e.getEndVersion());
145 cmsPayVO.setIsRecommend(e.getIsRecommend()); 145 cmsPayVO.setIsRecommend(e.getIsRecommend());
146 - cmsPayVO.setRecommendText1(cmsPayVO.getRecommendText1());  
147 - cmsPayVO.setRecommendText1Logo(cmsPayVO.getRecommendText1Logo()); 146 + cmsPayVO.setRecommendText1(e.getRecommendText1());
  147 + cmsPayVO.setRecommendText1Logo(e.getRecommendText1Logo());
148 return cmsPayVO; 148 return cmsPayVO;
149 } 149 }
150 150
@@ -42,4 +42,11 @@ public class BuyerOrderUtils { @@ -42,4 +42,11 @@ public class BuyerOrderUtils {
42 42
43 return isOffline(orderInfo.getAttributes()); 43 return isOffline(orderInfo.getAttributes());
44 } 44 }
  45 +
  46 + /**
  47 + * 是否寄存订单
  48 + */
  49 + public static boolean isDeposit(Integer attributes) {
  50 + return OrderAttributes.getOrderAttributes(attributes) == OrderAttributes.DEPOSITE;
  51 + }
45 } 52 }