Authored by LUOXC

Merge branch 'test6.9.13' into gray

... ... @@ -339,15 +339,16 @@
update seller_order_goods
<set>
<if test="uid != null">
uid = #{uid,jdbcType=TINYINT},
uid = #{uid,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=TINYINT},
</if>
business_client = #{businessClient,jdbcType=INTEGER}
</set>
where id = #{id,jdbcType=INTEGER}
and status = #{exceptStatus,jdbcType=TINYINT}
and uid = #{exceptUid,jdbcType=TINYINT}
and uid = #{exceptUid,jdbcType=INTEGER}
</update>
... ...
... ... @@ -2,17 +2,33 @@ package com.yohoufo.order.config;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;
/**
* 用于检查Bean定义
*/
@Component
public class SingletonBizValCheck implements BeanNameAware {
public class SingletonBizValCheck implements BeanFactoryPostProcessor, BeanFactoryAware, BeanNameAware {
@Override
public void setBeanName(String name) {
System.out.println("in BeanNameAware.setBeanName :"+ name);
InboxBusinessTypeEnum tt = InboxBusinessTypeEnum.SYSTEM_NEWUSER;
OrderStatus orderStatus = OrderStatus.WAITING_PAY;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
System.out.println("in BeanFactoryAware.setBeanFactory");
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
System.out.println("in BeanFactoryPostProcessor.postProcessBeanFactory");
}
}
... ...
... ... @@ -24,7 +24,7 @@ public interface SellerConfig {
"2.未按照《%s卖家商品质检标准》发货,%s有权取消订单并扣除保证金赔偿给买家";
}
interface WarnTips {
String BUYER_ORDER = "未按标准发货,%s平台有权取消订单并扣除保证金赔偿给买家";
String BUYER_ORDER = "未按标准发货,%s有权取消订单并扣除保证金赔偿给买家";
}
}
... ...
... ... @@ -59,10 +59,11 @@ public class SellerBidController {
@ResponseBody
@BlackUserType(blackType = BlackTypeEnum.SELL)
public ApiResponse publish(@RequestParam(name = "uid") int uid,
@RequestParam(name = "price") BigDecimal price,
@RequestParam(name = "skup") int skup,
@RequestParam(name = "address_id") String address_id) throws GatewayException {
SellerBidPublishRequest request = SellerBidPublishRequest.builder().uid(uid).price(price).skup(skup).addressId(address_id).build();
@RequestParam(name = "price") BigDecimal price,
@RequestParam(name = "skup") int skup,
@RequestParam(name = "address_id") String address_id,
@RequestParam(name = "business_client", required = false) String businessClient) throws GatewayException {
SellerBidPublishRequest request = SellerBidPublishRequest.builder().uid(uid).price(price).skup(skup).addressId(address_id).businessClient(businessClient).build();
logger.info("in ufo.seller.bid.publish, request {}", request);
OrderSubmitResp resp = sellerBidPublishService.publish(request);
return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("ok").build();
... ...
... ... @@ -23,6 +23,8 @@ public class SubmitSellerOrder {
private boolean finishPay;
private Integer businessClient;
//费用
private SellerOrderComputeResult sellerOrderComputeResult;
//地址
... ...
... ... @@ -18,6 +18,7 @@ public class SellerBidPublishRequest {
//卖家看见的求购价
private BigDecimal price;
private String addressId;
private String businessClient;
/**
* 校验
... ...
... ... @@ -2,10 +2,7 @@ package com.yohoufo.order.service;
import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.PayChannelType;
import com.yohobuy.ufo.model.order.common.Payment;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohoufo.dal.order.AppraiseOrderMapper;
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
... ... @@ -85,8 +82,13 @@ public class PaymentSupportService {
}
else if (codeMeta.getType() == OrderCodeType.BUYER_TYPE.getType()){
BuyerOrder buyerOrder = findBuyerOrder(orderCode);
//定金禁止使用虚拟支付
if (isWaitingPayDepositStatus(buyerOrder)) {
return Lists.newArrayList(PayChannelType.REAL);
}
Pair<Integer, Integer> attributes = getOrderAttributes(orderCode);
Pair<Integer, Integer> attributes = getOrderAttributes(buyerOrder);
// 海外
if (isHkOrder(attributes)){
return Lists.newArrayList(PayChannelType.CROSS_BORDER);
... ... @@ -143,19 +145,35 @@ public class PaymentSupportService {
|| attributes.getRight() == OrderAttributes.OVERSEAS_PRE_SALE.getCode());
}
private Pair<Integer, Integer> getOrderAttributes(long orderCode){
private BuyerOrder findBuyerOrder(long orderCode) {
return buyerOrderMapper.selectByOrderCode(orderCode);
}
private Pair<Integer, Integer> getOrderAttributes(long orderCode) {
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
if (buyerOrder != null){
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
if (buyerOrderGoods != null){
return getOrderAttributes(buyerOrder);
}
private Pair<Integer, Integer> getOrderAttributes(BuyerOrder buyerOrder) {
if (buyerOrder != null) {
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(buyerOrder.getOrderCode());
if (buyerOrderGoods != null) {
SellerOrderGoods sellerOrder = sellerOrderGoodsMapper.selectByPrimaryKey(buyerOrderGoods.getSkup());
return Pair.of(buyerOrder.getAttributes(), sellerOrder.getAttributes());
}
}
return Pair.of(null, null);
}
/**
* 待付定金状态
* @return
*/
private boolean isWaitingPayDepositStatus(BuyerOrder buyerOrder) {
if (buyerOrder != null && buyerOrder.getStatus() != null && buyerOrder.getStatus() == OrderStatus.WAITING_PAY_DEPOSIT.getCode()) {
return true;
} else {
return false;
}
}
}
... ...
... ... @@ -10,6 +10,7 @@ import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.model.SellerGoodsStatusFlow;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.order.convert.GoodsInfoConvertor;
import com.yohoufo.order.model.bo.SubmitSellerOrder;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -59,17 +60,21 @@ public class BidSkupService {
*/
@Transactional(propagation = Propagation.REQUIRED)
@Database(ForceMaster = true, DataSource = "ufo_order")
public void bind(int uid, int skup, long orderCode, boolean finishPay) {
SkupStatus targetStatus = finishPay ? SkupStatus.SELL_OUT : SkupStatus.CAN_NOT_SELL;
public void bind(SubmitSellerOrder submitSellerOrder) {
int uid = submitSellerOrder.getUid();
int skup = submitSellerOrder.getSkup();
long orderCode = submitSellerOrder.getOrderCode();
SkupStatus targetStatus = submitSellerOrder.isFinishPay() ? SkupStatus.SELL_OUT : SkupStatus.CAN_NOT_SELL;
SellerOrderGoods condition = new SellerOrderGoods();
condition.setId(skup);
condition.setExceptUid(0);
condition.setUid(uid);
condition.setExceptStatus(SkupStatus.CAN_NOT_SELL.getCode());
condition.setStatus(targetStatus.getCode());
condition.setBusinessClient(submitSellerOrder.getBusinessClient());
boolean success = sellerOrderGoodsMapper.updateStatusAndUidBySkpu(condition) > 0;
if (!success) {
log.warn("[{}] is bind with seller order goods uid:{} fail", skup ,uid );
log.warn("[{}] is bind with seller order goods uid:{} fail", skup, uid);
throw new UfoServiceException(500, "操作失败");
}
SellerGoodsStatusFlow sgsf = SellerGoodsStatusFlow.builder()
... ... @@ -77,7 +82,7 @@ public class BidSkupService {
.orderCode(orderCode)
.build();
sellerGoodsStatusFlowMapper.insert(sgsf);
log.info("[{}] is bind with seller order goods uid:{} success", skup ,uid );
log.info("[{}] is bind with seller order goods uid:{} success", skup, uid);
}
/**
... ...
... ... @@ -11,10 +11,7 @@ import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.SellerBo;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.constants.BusinessClientEnum;
import com.yohobuy.ufo.model.order.constants.DepotType;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
import com.yohobuy.ufo.model.order.constants.*;
import com.yohobuy.ufo.model.order.req.DeliverToDepotReq;
import com.yohobuy.ufo.model.order.req.SellerDeliverToDepotReq;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
... ... @@ -1486,7 +1483,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
String clientName = OrderAssist.matchClientName(bce);
Supplier<String> commonDeliverDescSupplier = () -> formatDeliverDesc(SellerConfig.DeliverDesc.COMMON, clientName);
Supplier<String> warnTipsSupplier = () -> formatWarnTips(SellerConfig.WarnTips.BUYER_ORDER, clientName);
Supplier<String> warnTipsSupplier = () -> {
String fcn = clientName.equals(OrderConstant.Client.UFO_NAME) ?
new StringBuilder(clientName).append("平台").toString() : clientName;
return formatWarnTips(SellerConfig.WarnTips.BUYER_ORDER, fcn);
};
AppraiseAddressResp resp = null;
if (OrderCodeType.GOODS_SERVICE.equals(orderCodeType)){
ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.isAppraiseOrder(orderCode);
... ...
... ... @@ -105,7 +105,7 @@ public class SellerBidOrderBindService {
* 2.插入 seller_order_meta
* 3.更新seller_order_goods uid,status
*/
bidSkupService.bind(submitSellerOrder.getUid(), submitSellerOrder.getSkup(), submitSellerOrder.getOrderCode(), submitSellerOrder.isFinishPay());
bidSkupService.bind(submitSellerOrder);
insertOrder(submitSellerOrder);
insertOrderMeta(submitSellerOrder);
bindSellerUidWithBuyerOrder(submitSellerOrder.getSkup(), submitSellerOrder.getUid());
... ...
... ... @@ -9,6 +9,7 @@ import com.yohobuy.ufo.model.order.common.CancelType;
import com.yohobuy.ufo.model.order.common.EntrySellerType;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.constants.BusinessClientEnum;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
... ... @@ -38,6 +39,7 @@ import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import com.yohoufo.order.utils.AddressHelper;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.SellerHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -45,6 +47,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
/**
... ... @@ -172,8 +175,15 @@ public class SellerBidPublishService {
.finishPay(accountPayResult.isFinishPay())
.skup(skup)
.sellerOrderComputeResult(computeResult)
.addressInfoPair(addressInfoPair).build();
.addressInfoPair(addressInfoPair)
.businessClient(Optional.ofNullable(request.getBusinessClient()).map(businessClient -> {
if (OrderConstant.BusinessClient.TAOBAO_FLEAMARKET.equalsIgnoreCase(businessClient)) {
return BusinessClientEnum.TAOBAO_FLEAMARKET_CLIENT.getCode();
} else {
return null;
}
}).orElse(null))
.build();
//提交订单
sellerBidOrderBindService.bind(submitSellerOrder);
... ...
... ... @@ -151,6 +151,8 @@ public abstract class AbstractAlipayService extends AbstractPayService {
JSONObject rr = new JSONObject();
rr.put("payParams", res.toString().substring(0, res.toString().length()-1));
logger.info("[{}] prepay request: {}", orderInfo.getOrderCode(), rr);
return rr;
... ...