Authored by LUOXC

Merge branch 'test6.9.13' into gray

@@ -339,15 +339,16 @@ @@ -339,15 +339,16 @@
339 update seller_order_goods 339 update seller_order_goods
340 <set> 340 <set>
341 <if test="uid != null"> 341 <if test="uid != null">
342 - uid = #{uid,jdbcType=TINYINT}, 342 + uid = #{uid,jdbcType=INTEGER},
343 </if> 343 </if>
344 <if test="status != null"> 344 <if test="status != null">
345 status = #{status,jdbcType=TINYINT}, 345 status = #{status,jdbcType=TINYINT},
346 </if> 346 </if>
  347 + business_client = #{businessClient,jdbcType=INTEGER}
347 </set> 348 </set>
348 where id = #{id,jdbcType=INTEGER} 349 where id = #{id,jdbcType=INTEGER}
349 and status = #{exceptStatus,jdbcType=TINYINT} 350 and status = #{exceptStatus,jdbcType=TINYINT}
350 - and uid = #{exceptUid,jdbcType=TINYINT} 351 + and uid = #{exceptUid,jdbcType=INTEGER}
351 </update> 352 </update>
352 353
353 354
@@ -2,17 +2,33 @@ package com.yohoufo.order.config; @@ -2,17 +2,33 @@ package com.yohoufo.order.config;
2 2
3 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; 3 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
4 import com.yohobuy.ufo.model.order.common.OrderStatus; 4 import com.yohobuy.ufo.model.order.common.OrderStatus;
  5 +import org.springframework.beans.BeansException;
  6 +import org.springframework.beans.factory.BeanFactory;
  7 +import org.springframework.beans.factory.BeanFactoryAware;
5 import org.springframework.beans.factory.BeanNameAware; 8 import org.springframework.beans.factory.BeanNameAware;
  9 +import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
  10 +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
6 import org.springframework.stereotype.Component; 11 import org.springframework.stereotype.Component;
7 12
8 /** 13 /**
9 * 用于检查Bean定义 14 * 用于检查Bean定义
10 */ 15 */
11 @Component 16 @Component
12 -public class SingletonBizValCheck implements BeanNameAware { 17 +public class SingletonBizValCheck implements BeanFactoryPostProcessor, BeanFactoryAware, BeanNameAware {
13 @Override 18 @Override
14 public void setBeanName(String name) { 19 public void setBeanName(String name) {
  20 + System.out.println("in BeanNameAware.setBeanName :"+ name);
15 InboxBusinessTypeEnum tt = InboxBusinessTypeEnum.SYSTEM_NEWUSER; 21 InboxBusinessTypeEnum tt = InboxBusinessTypeEnum.SYSTEM_NEWUSER;
16 OrderStatus orderStatus = OrderStatus.WAITING_PAY; 22 OrderStatus orderStatus = OrderStatus.WAITING_PAY;
17 } 23 }
  24 +
  25 + @Override
  26 + public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
  27 + System.out.println("in BeanFactoryAware.setBeanFactory");
  28 + }
  29 +
  30 + @Override
  31 + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
  32 + System.out.println("in BeanFactoryPostProcessor.postProcessBeanFactory");
  33 + }
18 } 34 }
@@ -24,7 +24,7 @@ public interface SellerConfig { @@ -24,7 +24,7 @@ public interface SellerConfig {
24 "2.未按照《%s卖家商品质检标准》发货,%s有权取消订单并扣除保证金赔偿给买家"; 24 "2.未按照《%s卖家商品质检标准》发货,%s有权取消订单并扣除保证金赔偿给买家";
25 } 25 }
26 interface WarnTips { 26 interface WarnTips {
27 - String BUYER_ORDER = "未按标准发货,%s平台有权取消订单并扣除保证金赔偿给买家"; 27 + String BUYER_ORDER = "未按标准发货,%s有权取消订单并扣除保证金赔偿给买家";
28 } 28 }
29 29
30 } 30 }
@@ -59,10 +59,11 @@ public class SellerBidController { @@ -59,10 +59,11 @@ public class SellerBidController {
59 @ResponseBody 59 @ResponseBody
60 @BlackUserType(blackType = BlackTypeEnum.SELL) 60 @BlackUserType(blackType = BlackTypeEnum.SELL)
61 public ApiResponse publish(@RequestParam(name = "uid") int uid, 61 public ApiResponse publish(@RequestParam(name = "uid") int uid,
62 - @RequestParam(name = "price") BigDecimal price,  
63 - @RequestParam(name = "skup") int skup,  
64 - @RequestParam(name = "address_id") String address_id) throws GatewayException {  
65 - SellerBidPublishRequest request = SellerBidPublishRequest.builder().uid(uid).price(price).skup(skup).addressId(address_id).build(); 62 + @RequestParam(name = "price") BigDecimal price,
  63 + @RequestParam(name = "skup") int skup,
  64 + @RequestParam(name = "address_id") String address_id,
  65 + @RequestParam(name = "business_client", required = false) String businessClient) throws GatewayException {
  66 + SellerBidPublishRequest request = SellerBidPublishRequest.builder().uid(uid).price(price).skup(skup).addressId(address_id).businessClient(businessClient).build();
66 logger.info("in ufo.seller.bid.publish, request {}", request); 67 logger.info("in ufo.seller.bid.publish, request {}", request);
67 OrderSubmitResp resp = sellerBidPublishService.publish(request); 68 OrderSubmitResp resp = sellerBidPublishService.publish(request);
68 return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("ok").build(); 69 return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("ok").build();
@@ -23,6 +23,8 @@ public class SubmitSellerOrder { @@ -23,6 +23,8 @@ public class SubmitSellerOrder {
23 23
24 private boolean finishPay; 24 private boolean finishPay;
25 25
  26 + private Integer businessClient;
  27 +
26 //费用 28 //费用
27 private SellerOrderComputeResult sellerOrderComputeResult; 29 private SellerOrderComputeResult sellerOrderComputeResult;
28 //地址 30 //地址
@@ -18,6 +18,7 @@ public class SellerBidPublishRequest { @@ -18,6 +18,7 @@ public class SellerBidPublishRequest {
18 //卖家看见的求购价 18 //卖家看见的求购价
19 private BigDecimal price; 19 private BigDecimal price;
20 private String addressId; 20 private String addressId;
  21 + private String businessClient;
21 22
22 /** 23 /**
23 * 校验 24 * 校验
@@ -2,10 +2,7 @@ package com.yohoufo.order.service; @@ -2,10 +2,7 @@ package com.yohoufo.order.service;
2 2
3 import com.google.common.collect.Lists; 3 import com.google.common.collect.Lists;
4 import com.yohobuy.ufo.model.order.bo.OrderInfo; 4 import com.yohobuy.ufo.model.order.bo.OrderInfo;
5 -import com.yohobuy.ufo.model.order.common.OrderAttributes;  
6 -import com.yohobuy.ufo.model.order.common.OrderCodeType;  
7 -import com.yohobuy.ufo.model.order.common.PayChannelType;  
8 -import com.yohobuy.ufo.model.order.common.Payment; 5 +import com.yohobuy.ufo.model.order.common.*;
9 import com.yohobuy.ufo.model.order.constants.OrderConstant; 6 import com.yohobuy.ufo.model.order.constants.OrderConstant;
10 import com.yohoufo.dal.order.AppraiseOrderMapper; 7 import com.yohoufo.dal.order.AppraiseOrderMapper;
11 import com.yohoufo.dal.order.BuyerOrderGoodsMapper; 8 import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
@@ -85,8 +82,13 @@ public class PaymentSupportService { @@ -85,8 +82,13 @@ public class PaymentSupportService {
85 } 82 }
86 83
87 else if (codeMeta.getType() == OrderCodeType.BUYER_TYPE.getType()){ 84 else if (codeMeta.getType() == OrderCodeType.BUYER_TYPE.getType()){
  85 + BuyerOrder buyerOrder = findBuyerOrder(orderCode);
  86 + //定金禁止使用虚拟支付
  87 + if (isWaitingPayDepositStatus(buyerOrder)) {
  88 + return Lists.newArrayList(PayChannelType.REAL);
  89 + }
88 90
89 - Pair<Integer, Integer> attributes = getOrderAttributes(orderCode); 91 + Pair<Integer, Integer> attributes = getOrderAttributes(buyerOrder);
90 // 海外 92 // 海外
91 if (isHkOrder(attributes)){ 93 if (isHkOrder(attributes)){
92 return Lists.newArrayList(PayChannelType.CROSS_BORDER); 94 return Lists.newArrayList(PayChannelType.CROSS_BORDER);
@@ -143,19 +145,35 @@ public class PaymentSupportService { @@ -143,19 +145,35 @@ public class PaymentSupportService {
143 || attributes.getRight() == OrderAttributes.OVERSEAS_PRE_SALE.getCode()); 145 || attributes.getRight() == OrderAttributes.OVERSEAS_PRE_SALE.getCode());
144 } 146 }
145 147
146 - private Pair<Integer, Integer> getOrderAttributes(long orderCode){ 148 + private BuyerOrder findBuyerOrder(long orderCode) {
  149 + return buyerOrderMapper.selectByOrderCode(orderCode);
  150 + }
147 151
  152 + private Pair<Integer, Integer> getOrderAttributes(long orderCode) {
148 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); 153 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
149 - if (buyerOrder != null){  
150 - BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);  
151 - if (buyerOrderGoods != null){ 154 + return getOrderAttributes(buyerOrder);
  155 + }
  156 +
  157 + private Pair<Integer, Integer> getOrderAttributes(BuyerOrder buyerOrder) {
  158 + if (buyerOrder != null) {
  159 + BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(buyerOrder.getOrderCode());
  160 + if (buyerOrderGoods != null) {
152 SellerOrderGoods sellerOrder = sellerOrderGoodsMapper.selectByPrimaryKey(buyerOrderGoods.getSkup()); 161 SellerOrderGoods sellerOrder = sellerOrderGoodsMapper.selectByPrimaryKey(buyerOrderGoods.getSkup());
153 return Pair.of(buyerOrder.getAttributes(), sellerOrder.getAttributes()); 162 return Pair.of(buyerOrder.getAttributes(), sellerOrder.getAttributes());
154 } 163 }
155 } 164 }
156 -  
157 return Pair.of(null, null); 165 return Pair.of(null, null);
  166 + }
158 167
  168 + /**
  169 + * 待付定金状态
  170 + * @return
  171 + */
  172 + private boolean isWaitingPayDepositStatus(BuyerOrder buyerOrder) {
  173 + if (buyerOrder != null && buyerOrder.getStatus() != null && buyerOrder.getStatus() == OrderStatus.WAITING_PAY_DEPOSIT.getCode()) {
  174 + return true;
  175 + } else {
  176 + return false;
  177 + }
159 } 178 }
160 -  
161 } 179 }
@@ -10,6 +10,7 @@ import com.yohoufo.dal.order.SellerOrderGoodsMapper; @@ -10,6 +10,7 @@ import com.yohoufo.dal.order.SellerOrderGoodsMapper;
10 import com.yohoufo.dal.order.model.SellerGoodsStatusFlow; 10 import com.yohoufo.dal.order.model.SellerGoodsStatusFlow;
11 import com.yohoufo.dal.order.model.SellerOrderGoods; 11 import com.yohoufo.dal.order.model.SellerOrderGoods;
12 import com.yohoufo.order.convert.GoodsInfoConvertor; 12 import com.yohoufo.order.convert.GoodsInfoConvertor;
  13 +import com.yohoufo.order.model.bo.SubmitSellerOrder;
13 import com.yohoufo.order.utils.LoggerUtils; 14 import com.yohoufo.order.utils.LoggerUtils;
14 import org.slf4j.Logger; 15 import org.slf4j.Logger;
15 import org.springframework.beans.factory.annotation.Autowired; 16 import org.springframework.beans.factory.annotation.Autowired;
@@ -59,17 +60,21 @@ public class BidSkupService { @@ -59,17 +60,21 @@ public class BidSkupService {
59 */ 60 */
60 @Transactional(propagation = Propagation.REQUIRED) 61 @Transactional(propagation = Propagation.REQUIRED)
61 @Database(ForceMaster = true, DataSource = "ufo_order") 62 @Database(ForceMaster = true, DataSource = "ufo_order")
62 - public void bind(int uid, int skup, long orderCode, boolean finishPay) {  
63 - SkupStatus targetStatus = finishPay ? SkupStatus.SELL_OUT : SkupStatus.CAN_NOT_SELL; 63 + public void bind(SubmitSellerOrder submitSellerOrder) {
  64 + int uid = submitSellerOrder.getUid();
  65 + int skup = submitSellerOrder.getSkup();
  66 + long orderCode = submitSellerOrder.getOrderCode();
  67 + SkupStatus targetStatus = submitSellerOrder.isFinishPay() ? SkupStatus.SELL_OUT : SkupStatus.CAN_NOT_SELL;
64 SellerOrderGoods condition = new SellerOrderGoods(); 68 SellerOrderGoods condition = new SellerOrderGoods();
65 condition.setId(skup); 69 condition.setId(skup);
66 condition.setExceptUid(0); 70 condition.setExceptUid(0);
67 condition.setUid(uid); 71 condition.setUid(uid);
68 condition.setExceptStatus(SkupStatus.CAN_NOT_SELL.getCode()); 72 condition.setExceptStatus(SkupStatus.CAN_NOT_SELL.getCode());
69 condition.setStatus(targetStatus.getCode()); 73 condition.setStatus(targetStatus.getCode());
  74 + condition.setBusinessClient(submitSellerOrder.getBusinessClient());
70 boolean success = sellerOrderGoodsMapper.updateStatusAndUidBySkpu(condition) > 0; 75 boolean success = sellerOrderGoodsMapper.updateStatusAndUidBySkpu(condition) > 0;
71 if (!success) { 76 if (!success) {
72 - log.warn("[{}] is bind with seller order goods uid:{} fail", skup ,uid ); 77 + log.warn("[{}] is bind with seller order goods uid:{} fail", skup, uid);
73 throw new UfoServiceException(500, "操作失败"); 78 throw new UfoServiceException(500, "操作失败");
74 } 79 }
75 SellerGoodsStatusFlow sgsf = SellerGoodsStatusFlow.builder() 80 SellerGoodsStatusFlow sgsf = SellerGoodsStatusFlow.builder()
@@ -77,7 +82,7 @@ public class BidSkupService { @@ -77,7 +82,7 @@ public class BidSkupService {
77 .orderCode(orderCode) 82 .orderCode(orderCode)
78 .build(); 83 .build();
79 sellerGoodsStatusFlowMapper.insert(sgsf); 84 sellerGoodsStatusFlowMapper.insert(sgsf);
80 - log.info("[{}] is bind with seller order goods uid:{} success", skup ,uid ); 85 + log.info("[{}] is bind with seller order goods uid:{} success", skup, uid);
81 } 86 }
82 87
83 /** 88 /**
@@ -11,10 +11,7 @@ import com.yoho.error.ServiceError; @@ -11,10 +11,7 @@ import com.yoho.error.ServiceError;
11 import com.yoho.error.exception.ServiceException; 11 import com.yoho.error.exception.ServiceException;
12 import com.yohobuy.ufo.model.order.bo.SellerBo; 12 import com.yohobuy.ufo.model.order.bo.SellerBo;
13 import com.yohobuy.ufo.model.order.common.*; 13 import com.yohobuy.ufo.model.order.common.*;
14 -import com.yohobuy.ufo.model.order.constants.BusinessClientEnum;  
15 -import com.yohobuy.ufo.model.order.constants.DepotType;  
16 -import com.yohobuy.ufo.model.order.constants.SkupType;  
17 -import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum; 14 +import com.yohobuy.ufo.model.order.constants.*;
18 import com.yohobuy.ufo.model.order.req.DeliverToDepotReq; 15 import com.yohobuy.ufo.model.order.req.DeliverToDepotReq;
19 import com.yohobuy.ufo.model.order.req.SellerDeliverToDepotReq; 16 import com.yohobuy.ufo.model.order.req.SellerDeliverToDepotReq;
20 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail; 17 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
@@ -1486,7 +1483,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -1486,7 +1483,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
1486 final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient); 1483 final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
1487 String clientName = OrderAssist.matchClientName(bce); 1484 String clientName = OrderAssist.matchClientName(bce);
1488 Supplier<String> commonDeliverDescSupplier = () -> formatDeliverDesc(SellerConfig.DeliverDesc.COMMON, clientName); 1485 Supplier<String> commonDeliverDescSupplier = () -> formatDeliverDesc(SellerConfig.DeliverDesc.COMMON, clientName);
1489 - Supplier<String> warnTipsSupplier = () -> formatWarnTips(SellerConfig.WarnTips.BUYER_ORDER, clientName); 1486 + Supplier<String> warnTipsSupplier = () -> {
  1487 + String fcn = clientName.equals(OrderConstant.Client.UFO_NAME) ?
  1488 + new StringBuilder(clientName).append("平台").toString() : clientName;
  1489 + return formatWarnTips(SellerConfig.WarnTips.BUYER_ORDER, fcn);
  1490 + };
1490 AppraiseAddressResp resp = null; 1491 AppraiseAddressResp resp = null;
1491 if (OrderCodeType.GOODS_SERVICE.equals(orderCodeType)){ 1492 if (OrderCodeType.GOODS_SERVICE.equals(orderCodeType)){
1492 ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.isAppraiseOrder(orderCode); 1493 ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.isAppraiseOrder(orderCode);
@@ -105,7 +105,7 @@ public class SellerBidOrderBindService { @@ -105,7 +105,7 @@ public class SellerBidOrderBindService {
105 * 2.插入 seller_order_meta 105 * 2.插入 seller_order_meta
106 * 3.更新seller_order_goods uid,status 106 * 3.更新seller_order_goods uid,status
107 */ 107 */
108 - bidSkupService.bind(submitSellerOrder.getUid(), submitSellerOrder.getSkup(), submitSellerOrder.getOrderCode(), submitSellerOrder.isFinishPay()); 108 + bidSkupService.bind(submitSellerOrder);
109 insertOrder(submitSellerOrder); 109 insertOrder(submitSellerOrder);
110 insertOrderMeta(submitSellerOrder); 110 insertOrderMeta(submitSellerOrder);
111 bindSellerUidWithBuyerOrder(submitSellerOrder.getSkup(), submitSellerOrder.getUid()); 111 bindSellerUidWithBuyerOrder(submitSellerOrder.getSkup(), submitSellerOrder.getUid());
@@ -9,6 +9,7 @@ import com.yohobuy.ufo.model.order.common.CancelType; @@ -9,6 +9,7 @@ import com.yohobuy.ufo.model.order.common.CancelType;
9 import com.yohobuy.ufo.model.order.common.EntrySellerType; 9 import com.yohobuy.ufo.model.order.common.EntrySellerType;
10 import com.yohobuy.ufo.model.order.common.OrderCodeType; 10 import com.yohobuy.ufo.model.order.common.OrderCodeType;
11 import com.yohobuy.ufo.model.order.common.TabType; 11 import com.yohobuy.ufo.model.order.common.TabType;
  12 +import com.yohobuy.ufo.model.order.constants.BusinessClientEnum;
12 import com.yohobuy.ufo.model.order.constants.OrderConstant; 13 import com.yohobuy.ufo.model.order.constants.OrderConstant;
13 import com.yohobuy.ufo.model.order.constants.SkupType; 14 import com.yohobuy.ufo.model.order.constants.SkupType;
14 import com.yohobuy.ufo.model.order.vo.AddressInfo; 15 import com.yohobuy.ufo.model.order.vo.AddressInfo;
@@ -38,6 +39,7 @@ import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; @@ -38,6 +39,7 @@ import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
38 import com.yohoufo.order.utils.AddressHelper; 39 import com.yohoufo.order.utils.AddressHelper;
39 import com.yohoufo.order.utils.LoggerUtils; 40 import com.yohoufo.order.utils.LoggerUtils;
40 import com.yohoufo.order.utils.SellerHelper; 41 import com.yohoufo.order.utils.SellerHelper;
  42 +import org.apache.commons.lang3.StringUtils;
41 import org.apache.commons.lang3.tuple.Pair; 43 import org.apache.commons.lang3.tuple.Pair;
42 import org.slf4j.Logger; 44 import org.slf4j.Logger;
43 import org.springframework.beans.factory.annotation.Autowired; 45 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +47,7 @@ import org.springframework.stereotype.Service; @@ -45,6 +47,7 @@ import org.springframework.stereotype.Service;
45 47
46 import java.util.List; 48 import java.util.List;
47 import java.util.Map; 49 import java.util.Map;
  50 +import java.util.Optional;
48 import java.util.function.Supplier; 51 import java.util.function.Supplier;
49 52
50 /** 53 /**
@@ -172,8 +175,15 @@ public class SellerBidPublishService { @@ -172,8 +175,15 @@ public class SellerBidPublishService {
172 .finishPay(accountPayResult.isFinishPay()) 175 .finishPay(accountPayResult.isFinishPay())
173 .skup(skup) 176 .skup(skup)
174 .sellerOrderComputeResult(computeResult) 177 .sellerOrderComputeResult(computeResult)
175 - .addressInfoPair(addressInfoPair).build();  
176 - 178 + .addressInfoPair(addressInfoPair)
  179 + .businessClient(Optional.ofNullable(request.getBusinessClient()).map(businessClient -> {
  180 + if (OrderConstant.BusinessClient.TAOBAO_FLEAMARKET.equalsIgnoreCase(businessClient)) {
  181 + return BusinessClientEnum.TAOBAO_FLEAMARKET_CLIENT.getCode();
  182 + } else {
  183 + return null;
  184 + }
  185 + }).orElse(null))
  186 + .build();
177 //提交订单 187 //提交订单
178 sellerBidOrderBindService.bind(submitSellerOrder); 188 sellerBidOrderBindService.bind(submitSellerOrder);
179 189
@@ -151,6 +151,8 @@ public abstract class AbstractAlipayService extends AbstractPayService { @@ -151,6 +151,8 @@ public abstract class AbstractAlipayService extends AbstractPayService {
151 151
152 JSONObject rr = new JSONObject(); 152 JSONObject rr = new JSONObject();
153 rr.put("payParams", res.toString().substring(0, res.toString().length()-1)); 153 rr.put("payParams", res.toString().substring(0, res.toString().length()-1));
  154 +
  155 + logger.info("[{}] prepay request: {}", orderInfo.getOrderCode(), rr);
154 return rr; 156 return rr;
155 157
156 158