Authored by mali

Merge branch 'test6.8.6' into gray

... ... @@ -37,6 +37,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
... ... @@ -90,9 +91,6 @@ public class BuyerOrderCancelService {
private OrderStatusFlowService orderStatusFlowService;
public void cancel(BeforeSellerDeliverEvent bsdEvent){
int buyerUid = bsdEvent.getBuyerUid();
int sellerUid = bsdEvent.getSellerUid();
... ... @@ -114,6 +112,8 @@ public class BuyerOrderCancelService {
int currentTime = DateUtil.getCurrentTimeSecond();
int rows = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid, expected.getCode(), targetOrderStatus.getCode(), currentTime);
if (rows>0) {
boolean noResponsibility = Objects.isNull(bpcr.getPenaltyAmount())
|| BigDecimal.ZERO.compareTo(bpcr.getPenaltyAmount()) == 0;
//退还优惠券
refundCouponIfNeed(buyerUid, orderCode);
int skup = bsdEvent.getSkup();
... ... @@ -128,8 +128,12 @@ public class BuyerOrderCancelService {
soc.setUpdateTime(DateUtil.getCurrentTimeSecond());
sellerOrderMapper.updateBySkups(soc, Arrays.asList(skup));
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
if (noResponsibility){
inBoxFacade.noticeSellerWhenBuyerCancelNoResponsibility(psog, orderCode);
}else {
inBoxFacade.buyerCancelBeforeSellerDeliver(buyerUid, orderCode,
bpcr.getPenaltyAmount().toPlainString(), psog);
}
//TODO 整个过程异步去执行(考虑退费依赖订单状态)
//(退费)退保证金给卖家
//(转账)瓜分指定赔偿款给卖家和平台
... ... @@ -217,10 +221,11 @@ public class BuyerOrderCancelService {
}
OrderStatus expected = bdrEvent.getExpected();
int currentTime = DateUtil.getCurrentTimeSecond();
int rows = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid, expected.getCode(), targetOrderStatus.getCode(), currentTime);
if (rows>0) {
boolean noResponsibility = Objects.isNull(bpcr.getPenaltyAmount())
|| BigDecimal.ZERO.compareTo(bpcr.getPenaltyAmount()) == 0;
//退还优惠券
refundCouponIfNeed(buyerUid, orderCode);
... ... @@ -236,8 +241,12 @@ public class BuyerOrderCancelService {
soc.setUpdateTime(DateUtil.getCurrentTimeSecond());
sellerOrderMapper.updateBySkups(soc, Arrays.asList(skup));
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
if (noResponsibility){
inBoxFacade.noticeSellerWhenBuyerCancelNoResponsibility(psog, orderCode);
}else {
inBoxFacade.buyerCancelBeforeDepotReceive(buyerUid, orderCode,
bpcr.getPenaltyAmount().toPlainString(), psog);
}
//整个过程异步去执行(考虑退费依赖订单状态)
//(退费)退保证金给卖家
//(转账)瓜分指定赔偿款给卖家和平台
... ...
... ... @@ -9,6 +9,7 @@ import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.utils.BigDecimalHelper;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
... ... @@ -18,6 +19,7 @@ import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.constants.ViewType;
import com.yohoufo.order.convert.GoodsInfoConvertor;
import com.yohoufo.order.convert.SellerOrderConvertor;
import com.yohoufo.order.model.dto.BuyerPenaltyCalResult;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.OrderDetailInfo;
... ... @@ -25,6 +27,7 @@ import com.yohoufo.order.mq.DelayTime;
import com.yohoufo.order.service.AbsSellerOrderViewService;
import com.yohoufo.order.service.IOrderDetailService;
import com.yohoufo.order.service.cache.OrderCacheService;
import com.yohoufo.order.service.handler.BuyerCancelCompensateComputeHandler;
import com.yohoufo.order.service.impl.processor.SellerOrderPrepareProcessor;
import com.yohoufo.order.service.proxy.DeliveryMinutesService;
import com.yohoufo.order.service.proxy.ProductProxyService;
... ... @@ -87,10 +90,12 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
@Autowired
private SellerOrderPrepareProcessor sellerOrderPrepareProcessor;
@Autowired
private OrderOverTimeService orderOverTimeService;
@Autowired
private BuyerCancelCompensateComputeHandler buyerCancelCompensateComputeHandler;
private static List<SkupStatus> noNeedShowOrderCode = Arrays.asList(SkupStatus.CAN_NOT_SELL,SkupStatus.CAN_SELL,
SkupStatus.SELF_CANCEL_PAY, SkupStatus.TIMEOUT_CANCEL,
SkupStatus.SELLER_CANCEL_SELL, SkupStatus.YOHO_CANCEL_SELL);
... ... @@ -386,11 +391,9 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
OrderDetailInfo.StatusDetail statusDetail = OrderDetailInfo.StatusDetail.builder()
.status(orderStatus.getCode())
.statuStr(orderStatus.getStatusStr(tabType))
.detailDesc(orderStatus.getDetailDesc(tabType))
.build();
if(orderStatus.getCode() == OrderStatus.HAS_PAYED.getCode() || orderStatus.getCode() == OrderStatus.SEND_OUT_TIMEOUT.getCode()){
//TimeoutBo timeoutBo = ordersPayService.getDeliverLeftTime(buyerOrder.getUid(), buyerOrder.getOrderCode());
//orderOverTimeService
OrderOverTime orderOverTime = Optional.ofNullable(buyerOrder.getOrderCode()).map(orderOverTimeService::selectByOrderCode).orElse(null);
... ... @@ -405,20 +408,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
}
}
OrderAttributes oa = OrderAttributes.getOrderAttributes(buyerOrder.getAttributes());
/*
if(orderStatus == OrderStatus.HAS_PAYED){
Integer deliverLeftTime = getDeliverLeftTime(buyerOrder.getUid(), buyerOrder.getOrderCode(), buyerOrder.getStatus(), oa);
if (deliverLeftTime != null){
statusDetail.setLeftTime(deliverLeftTime);
}
}
if(orderStatus == OrderStatus.WAITING_PAY){
Integer leftTime = getLeftTime(tabType,buyerOrder.getUid(), buyerOrder.getOrderCode(),
orderStatus.getCode(), buyerOrder.getCreateTime(), oa);
if (Objects.nonNull(leftTime)){
statusDetail.setLeftTime(leftTime);
}
}*/
Integer buyerUid = buyerOrder.getUid();
Long orderCode = buyerOrder.getOrderCode();
int orderStatusCode = orderStatus.getCode();
... ... @@ -430,9 +420,26 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
if(ActionStatusHold.getSellerShowExpressStatusList().contains(orderStatus.getCode())){
statusDetail.setExpressShow(true);
}
//.detailDesc(orderStatus.getDetailDesc(tabType))
String detailDesc = formatDetailDesc(buyerOrder, orderStatus, tabType);
statusDetail.setDetailDesc(detailDesc);
return statusDetail;
}
private String formatDetailDesc(BuyerOrder buyerOrder,OrderStatus orderStatus, TabType tabType){
String detailDesc = orderStatus.getDetailDesc(tabType);
if (Objects.nonNull(orderStatus)
&& (OrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.equals(orderStatus)
|| OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.equals(orderStatus))){
BuyerPenaltyCalResult bpcr ;
final OrderStatus targetStatus = orderStatus;
bpcr = buyerCancelCompensateComputeHandler.calBuyerPenaltyCalResult(buyerOrder, targetStatus);
detailDesc = String.format(detailDesc, BigDecimalHelper.halfUp(bpcr.getPenaltyAmount()).doubleValue());
}
return detailDesc;
}
@Override
protected void resetDynamicProporties(OrderDetailInfo orderDetailInfo) {
Long orderCode = orderDetailInfo.getOrderCode();
... ...
... ... @@ -188,6 +188,9 @@ public class InBoxFacade {
});
}
private String replaceSMSContent(InboxBusinessTypeEnum ibte, Object... params){
return getReplacedContent(ibte.getContent(), params);
}
private String getReplacedContent(String content ,Object... params) {
return MessageFormatter.arrayFormat(content, params).getMessage();
... ... @@ -1075,6 +1078,45 @@ public class InBoxFacade {
}
}
/**
* 买家在24小时内取消预售
* 站内:您的商品「商品名称」「尺码」,已被买家取消,您出售的商品已下架,保证金将于1个工作日内退回您的账户。
* 短信:买家已取消订单,订单编号{}。您的商品「商品名称」已下架,更多信息请查看Yoho!Buy有货APP [我的-球鞋交易-出售]。
*/
public void noticeSellerWhenBuyerCancelNoResponsibility(SellerOrderGoods sog, long orderCode){
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(()->{
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_BUYER_CANCEL_NO_RESPONSIBILITY;
String params = buildParams(prdName, sizeName, orderCode);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record noticeSellerWhenBuyerCancelNoResponsibility to seller inbox msg, sellerUid {}, orderCode {},prdName {} resp {}",
sellerUid, orderCode,prdName, resp);
//短信
String phone = userProxyService.getMobile(sellerUid);
if (StringUtils.isBlank(phone)){
logger.warn("in noticeSellerWhenBuyerCancelNoResponsibility sms fail, sellerUid {} orderCode {} prdName {}", sellerUid, orderCode,prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = replaceSMSContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_BUYER_CANCEL_NO_RESPONSIBILITY, orderCode, prdName);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record noticeSellerWhenBuyerCancelNoResponsibility inbox sms msg, sellerUid {}, orderCode {},prdName {}",
sellerUid, orderCode, prdName);
});
} catch (Exception e) {
logger.warn("InBoxFacade noticeSellerWhenBuyerCancelNoResponsibility error inbox msg, sellerUid {}, orderCode {} ,prdName {}",
sellerUid, orderCode, prdName, e);
}
}
public void buyerCancelBeforeSellerDeliver(int buyerUid, long orderCode,String compesant, SellerOrderGoods sog) {
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
... ... @@ -1103,8 +1145,6 @@ public class InBoxFacade {
return;
}
List<String> mobileList = Arrays.asList(phone);
//SmsContentEnum smsIbt=SmsContentEnum.SMS_CLOSED_PLATFORM;
//String content=smsIbt.getReplacedContent(prdName);
String content= getReplacedContent(InboxBusinessTypeEnum.SMS_CANCELED_BY_BUYER_AFTER_PAID.getContent(),orderCode,prdName);
sendSmsService.smsSendByMobile(content,mobileList);
... ...
... ... @@ -599,7 +599,8 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
String headIcon = profileInfo.getHead_ico();
if(DEFAULT_HEAD_IMG.equals(headIcon) || StringUtils.isBlank(headIcon)){//有货的默认头像
//ufo 用户的默认头像
headIcon = configReader.getString("ufo.product.defaultUserHeadIcon", "http://img11.static.yhbimg.com/goodsimg/2019/02/26/16/01f05294027c419a10bb4a941cae257692.png?imageView2/{mode}/w/{width}/h/{height}");
// headIcon = configReader.getString("ufo.product.defaultUserHeadIcon", "http://img12.static.yhbimg.com/article/2019/02/26/16/02456ade977d8dfdbc4ca548b196c1d62b.png?imageView2/{mode}/w/{width}/h/{height}");
headIcon = "http://img12.static.yhbimg.com/article/2019/02/26/16/02456ade977d8dfdbc4ca548b196c1d62b.png?imageView2/{mode}/w/{width}/h/{height}";
}
track.setHeadIcon(headIcon);
... ... @@ -631,7 +632,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
int authTime = identifyRecord.getAuthTime();
identifyTrack.setTime(authTime);
identifyTrack.setTimeStr(formatDate(authTime, "yyyy.MM.dd HH:mm:ss"));
identifyTrack.setContent(authGroup + "鉴定结果为\"真\"");
identifyTrack.setContent(authGroup.substring(0, 7) + "鉴定结果为\"真\"");
identifyTrack.setType(MESSAGE_TYPE_JUDGE_INFO);
//鉴定中心,默认的展示头像
String authIco = configReader.getString("ufo.product.defaultAuthHeadIcon", "http://head.static.yhbimg.com/yhb-head/2018/12/28/14/01384244a3ca86fa5345df87c59317b81f.png?imageView2/{mode}/w/{width}/h/{height}");
... ... @@ -660,7 +661,8 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
String headIcon = profileMap.get(toUid).getHead_ico();
if(DEFAULT_HEAD_IMG.equals(headIcon) || StringUtils.isBlank(headIcon)){//有货的默认头像
//ufo 用户的默认头像
headIcon = configReader.getString("ufo.product.defaultUserHeadIcon", "http://img11.static.yhbimg.com/goodsimg/2019/02/26/16/01f05294027c419a10bb4a941cae257692.png?imageView2/{mode}/w/{width}/h/{height}");
// headIcon = configReader.getString("ufo.product.defaultUserHeadIcon", "http://img12.static.yhbimg.com/article/2019/02/26/16/02456ade977d8dfdbc4ca548b196c1d62b.png?imageView2/{mode}/w/{width}/h/{height}");
headIcon = "http://img12.static.yhbimg.com/article/2019/02/26/16/02456ade977d8dfdbc4ca548b196c1d62b.png?imageView2/{mode}/w/{width}/h/{height}";
}
item.setHeadIcon(headIcon);
item.setType(MESSAGE_TYPE_EX_OWNER);
... ...