Authored by mali

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

... ... @@ -6,11 +6,12 @@ import com.yoho.message.sdk.service.ufo.IUFOSendService;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
import com.yohobuy.ufo.model.order.vo.GoodsVo;
import com.yohobuy.ufo.model.order.vo.ProductVo;
import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
import com.yohoufo.dal.order.AppraiseOrderStorageMapper;
import com.yohoufo.dal.order.SellerOrderMapper;
import com.yohoufo.dal.order.model.AppraiseOrder;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.SellerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.model.Product;
import com.yohoufo.inboxclient.model.InBoxResponse;
... ... @@ -30,7 +31,7 @@ import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Objects;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
... ... @@ -62,6 +63,12 @@ public class InBoxFacade extends BaseNoticeFacade{
private SellerOrderMapper sellerOrderMapper;
@Autowired
private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper;
@Autowired
private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
@Autowired
private IUFOSendService ufoSendService;
@Autowired
... ... @@ -1016,52 +1023,233 @@ public class InBoxFacade extends BaseNoticeFacade{
log.warn("notice user renew deposit goods fail, uid {}, sog {}", uid, sog, e);
}
}
GoodsVo buildProductInfo(long orderCode){
AppraiseOrderGoods paog = appraiseOrderGoodsMapper.selectOneByOrderCode(orderCode);
AppraiseOrderStorage paos = appraiseOrderStorageMapper.selectByOrderCode(orderCode);
return GoodsVo.builder()
.productName(paog.getProductName())
.productCode(paog.getProductCode())
.sizeName(Objects.nonNull(paos) ? paos.getSizeName() : null)
.build();
}
public void sellerDepositOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){
switch (targetStatus){
case WAITING_PAY:
break;
log.info("enter sellerDepositOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
try {
//
InboxBusinessTypeEnum inboxType = null;
InboxBusinessTypeEnum smsType = null;
Object[] inboxParams = null,
smsParams = null;
switch (targetStatus){
case WAITING_PAY:
//inbox
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_WAITING_PAY;
inboxParams = new Object[]{orderCode};
break;
case CANCEL_BEFORE_PAY:
case CANCEL_BEFORE_PAY:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_SELF_CANCEL;
inboxParams = new Object[]{orderCode};
break;
break;
case HAS_PAYED:
case HAS_PAYED:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_PAID;
inboxParams = new Object[]{orderCode};
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_PAID;
smsParams = new Object[]{orderCode};
break;
case CANCEL_BEFORE_DELIVER:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_CANCEL_BEFORE_DELIVER;
inboxParams = new Object[]{orderCode};
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_CANCEL_BEFORE_DELIVER;
smsParams = new Object[]{orderCode};
break;
case SEND_OUT_TIMEOUT:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_DELIVER_TIMEOUT;
inboxParams = new Object[]{orderCode};
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_DELIVER_TIMEOUT;
smsParams = new Object[]{orderCode};
break;
case PLATFORM_RECEIVE:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_PLATFORM_RECEIVE;
inboxParams = new Object[]{orderCode};
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_PLATFORM_RECEIVE;
smsParams = new Object[]{orderCode};
break;
case SHAM_SEND_OUT:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_MISS_GOODS;
// get product info 「商品名称」「尺码」「货号」
inboxParams = buildParams4SellerDepositOrder(orderCode);
break;
case QUALITY_CHECK_FAKE:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FIND_FLAW_OR_BIGGER;
//get product info 「商品名称」「尺码」「货号」
inboxParams = buildParams4SellerDepositOrder(orderCode);
break;
break;
case CANCEL_BEFORE_DELIVER:
case PLATFORM_APPRAISE_UNSURE:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_APPRAISE_UNSURE;
//get product info 「商品名称」「尺码」「货号」
inboxParams = buildParams4SellerDepositOrder(orderCode);
break;
case SEND_OUT_TIMEOUT:
break;
case JUDGE_PASS:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_APPRAISE_PASS;
//get product info 「商品名称」「尺码」「货号」
inboxParams = buildParams4SellerDepositOrder(orderCode);
break;
break;
case PLATFORM_RECEIVE:
case CHECKING_FAKE:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_APPRAISE_FAKE;
//get product info 「商品名称」「尺码」「货号」
inboxParams = buildParams4SellerDepositOrder(orderCode);
break;
break;
case SHAM_SEND_OUT:
case FINISH:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY;
inboxParams = new Object[]{orderCode};
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY;
smsParams = new Object[]{orderCode};
break;
}
break;
case QUALITY_CHECK_FAKE:
break;
Notice notice = newNotice(uid).withLogPrefix("seller Deposit Order Notice 4 " + targetStatus.name());
if (Objects.nonNull(inboxType)){
notice.withInBox(inboxType, inboxParams);
}
if (Objects.nonNull(smsType)) {
notice.withSms(smsType, smsParams);
}
notice.send();
} catch (Exception e) {
log.warn("notice seller deposit order fail, uid {}, orderCode {} status {}", uid, orderCode, targetStatus, e);
}
}
case PLATFORM_APPRAISE_UNSURE:
public void paidAppraiseOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){
log.info("enter paidAppraiseOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
try {
//
InboxBusinessTypeEnum inboxType = null;
InboxBusinessTypeEnum smsType = null;
break;
case JUDGE_PASS:
switch (targetStatus){
case HAS_PAYED:
inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_PAID;
break;
break;
case PLATFORM_RECEIVE:
inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_PLATFORM_RECEIVE;
break;
case SHAM_SEND_OUT:
break;
case QUALITY_CHECK_FAKE:
break;
case CHECKING_FAKE:
case PLATFORM_APPRAISE_UNSURE:
inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_APPRAISE_UNSURE;
//get product info 「商品名称」「尺码」「货号」
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_APPRAISE_UNSURE;
break;
case JUDGE_PASS:
inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_APPRAISE_PASS;
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_APPRAISE_PASS;
break;
break;
case CHECKING_FAKE:
inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_APPRAISE_FAKE;
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_APPRAISE_FAKE;
break;
case FINISH:
case FINISH:
break;
}
boolean smsRequired = Objects.nonNull(smsType);
Object[] inboxParams = buildParams4PaidAppraiseOrder(orderCode);
Object[] smsParams = smsRequired ? inboxParams : null;
break;
Notice notice = newNotice(uid).withLogPrefix("paid Appraise Order Notice 4 " + targetStatus.name());
if (Objects.nonNull(inboxType)){
notice.withInBox(inboxType, inboxParams);
}
if (smsRequired) {
notice.withSms(smsType, smsParams);
}
notice.send();
} catch (Exception e) {
log.warn("paidAppraiseOrderNotice fail, uid {}, orderCode {} status {}", uid, orderCode, targetStatus, e);
}
}
private Object[] buildParams4SellerDepositOrder(long orderCode){
GoodsVo goodsVo;
goodsVo = buildProductInfo(orderCode);
return new Object[]{orderCode, goodsVo.getProductName(), goodsVo.getSizeName(), goodsVo.getProductCode()};
}
private Object[] buildParams4PaidAppraiseOrder(long orderCode){
GoodsVo goodsVo;
goodsVo = buildProductInfo(orderCode);
//get product info 「商品名称」「货号」
return new Object[]{ goodsVo.getProductName(), goodsVo.getProductCode()};
}
public void paidAppraiseOrderDeliverBackNotice(int uid,long orderCode, String expressNumber, AppraiseOrderStatus targetStatus){
log.info("enter paidAppraiseOrderDeliverBackNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
try {
//
InboxBusinessTypeEnum inboxType = null;
InboxBusinessTypeEnum smsType = null;
switch (targetStatus){
case PLATFORM_APPRAISE_UNSURE:
inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_UNSURE;
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_UNSURE;
break;
case JUDGE_PASS:
inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_PASS;
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_PASS;
break;
case CHECKING_FAKE:
inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_FAKE;
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_FAKE;
break;
}
boolean smsRequired = Objects.nonNull(smsType);
Object[] inboxParams = buildParams4PaidAppraiseOrder(orderCode);
Object[] smsParams = smsRequired ? inboxParams : null;
Notice notice = newNotice(uid).withLogPrefix("paidAppraiseOrder Deliver Back Notice 4 " + targetStatus.name());
if (Objects.nonNull(inboxType)){
notice.withInBox(inboxType, inboxParams);
}
if (smsRequired) {
//set expressNumber
smsParams[2] = expressNumber;
notice.withSms(smsType, smsParams);
}
notice.send();
} catch (Exception e) {
log.warn("paidAppraiseOrder Deliver Back Notice fail, uid {}, orderCode {} status {}", uid, orderCode, targetStatus, e);
}
}
}
... ...