Authored by chenchao

fix list or detail view

... ... @@ -26,7 +26,9 @@ public class ActionStatusHold {
static {
sellerCanRefundStatus = Arrays.asList(SellerOrderStatus.YOHO_CANCEL_SELL.getCode(),
SellerOrderStatus.FINISH.getCode(),
SellerOrderStatus.PLAY_SELF.getCode());
SellerOrderStatus.PLAY_SELF.getCode(),
SellerOrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.getCode(),
SellerOrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode());
}
public static List<Integer> getSellerCanRefundEarnestMoneyStatus(){
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.TabType;
... ... @@ -255,6 +256,7 @@ public class SellerOrderPaymentService extends AbstractOrderPaymentService {
* @param orderCode
* @return
*/
@Database(ForceMaster = true)
public OrderInfo getOrderInfo(long orderCode) {
SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderCode);
... ...
... ... @@ -145,7 +145,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
orderDetailInfo.setUid(buyerUid = buyerOrder.getUid());
orderDetailInfo.setOrderCode(orderCode = buyerOrder.getOrderCode());
orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
orderDetailInfo.setButtons(orderStatus.getDetailButtons(tabType));
orderDetailInfo.setButtons(formatButtons(orderStatus, orderStatus.getDetailButtons(tabType)));
OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus, tabType);
orderDetailInfo.setStatusDetail(statusDetail);
//good info
... ...
... ... @@ -130,7 +130,7 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements
orderListInfo.setStatuStr(orderStatus.getStatusStr(tabType));
// 按钮显示
orderListInfo.setButtons(orderStatus.getListButtons(tabType));
orderListInfo.setButtons(formatButtons(orderStatus, orderStatus.getListButtons(tabType)));
// 当订单状态是待付款, 显示leftTime
Integer leftTime = getLeftTime(tabType, buyerUid, orderCode, buyerOrder.getStatus(), buyerOrder.getCreateTime());
... ...
package com.yohoufo.order.service.impl;
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohoufo.common.utils.DateUtil;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* Created by chao.chen on 2018/11/26.
*/
... ... @@ -15,6 +20,56 @@ public abstract class AbsOrderViewService {
@Autowired
private OrdersPayService ordersPayService;
@Autowired
OrderDynamicConfig orderDynamicConfig;
List<ButtonShowBo> formatButtons(OrderStatus orderStatus, List<ButtonShowBo> buttons){
if (CollectionUtils.isEmpty(buttons)){
return buttons;
}
for(ButtonShowBo buttonShowBo : buttons){
buttonShowBo.setConfirmTips(formatconfirmTips(orderStatus.getCode(), buttonShowBo.getConfirmTips()));
}
return buttons;
}
String formatconfirmTips(int orderStatusCode, String temp){
Object[] formatParms = new Object[1];
String confirmTips = temp;
if(orderStatusCode == OrderStatus.HAS_PAYED.getCode()){
OrderDynamicConfig.BuyerCancelCompensateNode bccn = orderDynamicConfig.getBeforeSellerDeliverBCCN();
formatParms[0] = bccn.getBuyerCompensateMoney();
confirmTips = MessageFormatter.arrayFormat(temp, formatParms).getMessage();
}
if(orderStatusCode == OrderStatus.SELLER_SEND_OUT.getCode()){
OrderDynamicConfig.BuyerCancelCompensateNode bccn = orderDynamicConfig.getBeforeDepotReceiveBCCN();
formatParms[0] = bccn.getBuyerCompensateMoney();
confirmTips = MessageFormatter.arrayFormat(temp, formatParms).getMessage();
}
return confirmTips;
}
String formatDetailDesc(OrderStatus orderStatus, String temp){
Object[] formatParms = new Object[1];
String detailDesc = temp;
if(orderStatus.getCode() == OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()){
OrderDynamicConfig.BuyerCancelCompensateNode bccn = orderDynamicConfig.getBeforeDepotReceiveBCCN();
formatParms[0] = bccn.getBuyerCompensateMoney();
detailDesc = MessageFormatter.arrayFormat(temp, formatParms).getMessage();
}
if(orderStatus.getCode() == OrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.getCode()){
OrderDynamicConfig.BuyerCancelCompensateNode bccn = orderDynamicConfig.getBeforeSellerDeliverBCCN();
formatParms[0] = bccn.getBuyerCompensateMoney();
detailDesc = MessageFormatter.arrayFormat(temp, formatParms).getMessage();
}
return detailDesc;
}
Integer getLeftTime(TabType actor, Integer uid, Long orderCode, Integer orderStatus, Integer createTime){
Integer leftTime =null;
Integer payLeftTime = getPayLeftTime(actor, orderStatus,
... ...
package com.yohoufo.order.service.impl;
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.SellerType;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import java.util.List;
/**
* Created by chao.chen on 2018/11/26.
*/
public interface AbsSellerOrderViewService {
default List<ButtonShowBo> getButtons(Integer storageNum, SellerType st, Integer payment, SkupStatus skupStatus){
//异常扯淡,兼容老数据,
boolean isEntry = (st == SellerType.ENTRY
&& payment != null
&& OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType() == payment) ;
SellerType lst = isEntry ? SellerType.ENTRY : SellerType.COMMON;
if (storageNum == 1 && isEntry){
lst = SellerType.ONE_PRD_ENTRY;
}
// 按钮显示
List<ButtonShowBo> buttons;
buttons = skupStatus.getListButtons(lst);
return buttons;
}
}
... ...
package com.yohoufo.order.service.impl;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.SellerOrderStatus;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohoufo.common.utils.DateUtil;
... ... @@ -94,6 +95,10 @@ public class BuyerOrderCancelService {
targetGoods.setExceptStatus(SkupStatus.SELL_OUT.getCode());
sellerOrderGoodsMapper.updateStatusBySkpu(targetGoods);
SellerOrder soc = new SellerOrder();
soc.setStatus(SellerOrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.getCode());
soc.setUpdateTime(DateUtil.getCurrentTimeSecond());
sellerOrderMapper.updateBySkups(soc, Arrays.asList(skup));
//TODO 整个过程异步去执行(考虑退费依赖订单状态)
//(退费)退保证金给卖家
//(转账)瓜分指定赔偿款给卖家和平台
... ... @@ -136,6 +141,11 @@ public class BuyerOrderCancelService {
targetGoods.setExceptStatus(SkupStatus.SELL_OUT.getCode());
sellerOrderGoodsMapper.updateStatusBySkpu(targetGoods);
SellerOrder soc = new SellerOrder();
soc.setStatus(SellerOrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode());
soc.setUpdateTime(DateUtil.getCurrentTimeSecond());
sellerOrderMapper.updateBySkups(soc, Arrays.asList(skup));
//整个过程异步去执行(考虑退费依赖订单状态)
//(退费)退保证金给卖家
//(转账)瓜分指定赔偿款给卖家和平台
... ...
... ... @@ -23,6 +23,7 @@ import com.yohoufo.order.service.IOrderDetailService;
import com.yohoufo.order.service.handler.BuyerConfirmHandler;
import com.yohoufo.order.utils.OrderDetailDescHelper;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -125,9 +126,10 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
OrderDetailInfo.StatusDetail statusDetail = OrderDetailInfo.StatusDetail.builder()
.status(orderStatus.getCode())
.statuStr(orderStatus.getStatusStr(tabType))
.detailDesc(orderStatus.getDetailDesc(tabType))
.build();
.build();
String detailDesc = formatDetailDesc(orderStatus, orderStatus.getDetailDesc(tabType));
statusDetail.setDetailDesc(detailDesc);
// 待付款时,剩余时间
Integer leftTime = getLeftTime(tabType,buyerOrder.getUid(), buyerOrder.getOrderCode(), orderStatus.getCode(), buyerOrder.getCreateTime());
statusDetail.setLeftTime(leftTime);
... ...
... ... @@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;
import com.yohobuy.ufo.model.order.common.*;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.alarm.SmsAlarmEvent;
... ... @@ -10,14 +11,8 @@ import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
import com.yohoufo.dal.order.BuyerOrderMapper;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.SellerOrderMapper;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
import com.yohoufo.dal.order.model.SellerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.order.common.ActionStatusHold;
import com.yohoufo.order.common.BillTradeStatus;
import com.yohoufo.order.common.RefundCase;
import com.yohoufo.order.common.TransferCase;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.*;
import com.yohoufo.order.constants.AlarmConfig;
import com.yohoufo.order.event.BillLogEvent;
import com.yohoufo.order.event.ErpCancelSellerOrderEvent;
... ... @@ -502,9 +497,18 @@ public class SellerOrderCancelService {
cacheCleaner.cleanList(sellerUid, TabType.SELL.getValue());
cacheCleaner.cleanSellerDetail(psog);
double earnestMoney = sellerOrder.getEarnestMoney().doubleValue();
PaymentRequest refundReq = PaymentRequest.builder().uid(sellerOrder.getUid())
PaymentRequest refundReq = PaymentRequest.builder().uid(sellerUid)
.orderCode(orderCode)
.refundAmount(earnestMoney).build();
Integer payment = sellerOrder.getPayment();
if(Objects.nonNull(payment) && payment == Payment.WALLET.getCode() ){
MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(sellerUid)
.orderCode(orderCode).skup(skup).earnestMoney(sellerOrder.getEarnestMoney())
.type(SellerWalletDetail.Type.SYSTEM_OFF.getValue()).build();
refundReq.setRefundattch(moai);
}
BillLogEvent.BillLogEventBuilder bleb = BillLogEvent.builder()
.sellerUid(sellerUid).orderCode(orderCode)
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
... ... @@ -46,7 +47,7 @@ import java.util.Objects;
* Created by chenchao on 2018/9/20.
*/
@Service
public class SellerOrderDetailService extends AbsOrderDetailService implements IOrderDetailService {
public class SellerOrderDetailService extends AbsOrderDetailService implements IOrderDetailService,AbsSellerOrderViewService {
final Logger logger = LoggerFactory.getLogger(getClass());
... ... @@ -328,7 +329,9 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
OrderDetailInfo orderDetailInfo = new OrderDetailInfo();
orderDetailInfo.setUid(order.getUid());
orderDetailInfo.setOrderCode(getOrderCode(skupStatus, order));
orderDetailInfo.setButtons(skupStatus.getDetailButtons(sellerType));
Integer storageNum = sellerOrderGoods.getNum();
List<ButtonShowBo> buttons = getButtons(storageNum, sellerType, order.getPayment(), skupStatus);
orderDetailInfo.setButtons(buttons);
orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
orderDetailInfo.setUserAddress(addressInfo);
//卖家
... ...
... ... @@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
... ... @@ -39,7 +40,7 @@ import java.util.stream.Collectors;
*/
@Service
@Slf4j
public class SellerOrderListService extends AbsOrderListService implements IOrderListService {
public class SellerOrderListService extends AbsOrderListService implements IOrderListService,AbsSellerOrderViewService {
@Autowired
private SellerOrderMapper sellerOrderMapper;
... ... @@ -187,6 +188,10 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
return map;
}
OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods,
SellerOrder sellerOrder, SellerType st, Map<Integer,String> overPriceTipsMap) {
... ... @@ -205,20 +210,19 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
// 订单中状态显示
orderListInfo.setStatus(skupStatus.getCode());
orderListInfo.setStatuStr(skupStatus.getDesc());
//异常扯淡,兼容老数据,
final SellerType lst = (st == SellerType.ENTRY
&& sellerOrder.getPayment()!=null
&& OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType() == sellerOrder.getPayment()) ?
SellerType.ENTRY : SellerType.COMMON;
// 按钮显示
orderListInfo.setButtons(skupStatus.getListButtons(lst));
Integer storageNum = sellerOrderGoods.getNum();
// 按钮显示
List<ButtonShowBo> buttons;
buttons = getButtons(storageNum, st, sellerOrder.getPayment(), skupStatus);
orderListInfo.setButtons(buttons);
// 当订单状态是待付款, 显示leftTime
if (sellerOrderGoods.getStatus() == SkupStatus.CAN_NOT_SELL.getCode()){
orderListInfo.setLeftTime(calLeftTime(sellerOrder.getCreateTime()));
}
orderListInfo.setSkup(sellerOrderGoods.getId());
orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney());
//
GoodsInfo goodsInfo = new GoodsInfo();
goodsInfo.setColorName(sellerOrderGoods.getColorName());
... ... @@ -229,7 +233,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
goodsInfo.setGoodPrice(sellerOrderGoods.getGoodsPrice().toPlainString());
goodsInfo.setStorageId(sellerOrderGoods.getStorageId());
goodsInfo.setBatchNo(sellerOrderGoods.getBatchNo());
goodsInfo.setStorageNum(sellerOrderGoods.getNum());
goodsInfo.setStorageNum(storageNum);
goodsInfo.setSkupList(sellerOrderGoods.getSkupList());
orderListInfo.setGoodsInfo(goodsInfo);
orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime());
... ...