Authored by wujiexiang

需求:检测不通过

@@ -2,8 +2,11 @@ package com.yohoufo.dal.order; @@ -2,8 +2,11 @@ package com.yohoufo.dal.order;
2 2
3 3
4 import com.yohoufo.dal.order.model.BuyerOrderStatusFlow; 4 import com.yohoufo.dal.order.model.BuyerOrderStatusFlow;
  5 +import org.apache.ibatis.annotations.Param;
5 6
6 public interface BuyerOrderStatusFlowMapper { 7 public interface BuyerOrderStatusFlowMapper {
7 int insert(BuyerOrderStatusFlow record); 8 int insert(BuyerOrderStatusFlow record);
8 9
  10 + BuyerOrderStatusFlow selectByStatus(@Param("orderCode") long orderCode, @Param("status") int status);
  11 +
9 } 12 }
@@ -17,4 +17,13 @@ public class BuyerOrderStatusFlow { @@ -17,4 +17,13 @@ public class BuyerOrderStatusFlow {
17 17
18 private Integer createTime; 18 private Integer createTime;
19 19
  20 + private String remark;
  21 +
  22 + public static String formatRemarkWithPrefixAndSuffix(BuyerOrderStatusFlow bosf) {
  23 + if (bosf == null || bosf.getRemark() == null) {
  24 + return "";
  25 + } else {
  26 + return new StringBuilder().append("因").append(bosf.getRemark()).append("原因").toString();
  27 + }
  28 + }
20 } 29 }
@@ -54,6 +54,7 @@ public class SellerWalletDetail { @@ -54,6 +54,7 @@ public class SellerWalletDetail {
54 BUYER_CANCEL_DELIVERY("买家取消(有物流)", 42), 54 BUYER_CANCEL_DELIVERY("买家取消(有物流)", 42),
55 APPRAISE_OK("鉴定通过", 51), 55 APPRAISE_OK("鉴定通过", 51),
56 APPRAISE_UNSURE("商品无法鉴定", 52), 56 APPRAISE_UNSURE("商品无法鉴定", 52),
  57 + DETECTION_NOT_PASS("商品检测不通过", 53),
57 MERCHANT_EXIT("商家退出入驻", 61), 58 MERCHANT_EXIT("商家退出入驻", 61),
58 CANCEL_DELIVER("不寄了", 71), 59 CANCEL_DELIVER("不寄了", 71),
59 FLAW("瑕疵品",72); 60 FLAW("瑕疵品",72);
@@ -6,16 +6,24 @@ @@ -6,16 +6,24 @@
6 <result column="order_code" jdbcType="BIGINT" property="orderCode" /> 6 <result column="order_code" jdbcType="BIGINT" property="orderCode" />
7 <result column="status" jdbcType="TINYINT" property="status" /> 7 <result column="status" jdbcType="TINYINT" property="status" />
8 <result column="create_time" jdbcType="INTEGER" property="createTime" /> 8 <result column="create_time" jdbcType="INTEGER" property="createTime" />
  9 + <result column="remark" jdbcType="VARCHAR" property="remark" />
9 </resultMap> 10 </resultMap>
10 <sql id="Base_Column_List"> 11 <sql id="Base_Column_List">
11 - id, order_code, status, create_time 12 + id, order_code, status, create_time, remark
12 </sql> 13 </sql>
13 14
14 <insert id="insert" parameterType="com.yohoufo.dal.order.model.BuyerOrderStatusFlow"> 15 <insert id="insert" parameterType="com.yohoufo.dal.order.model.BuyerOrderStatusFlow">
15 - insert into buyer_order_status_flow ( order_code, status,  
16 - create_time)  
17 - values ( #{orderCode,jdbcType=BIGINT}, #{status,jdbcType=TINYINT},  
18 - #{createTime,jdbcType=INTEGER}) 16 + insert into buyer_order_status_flow ( order_code, status,create_time, remark)
  17 + values ( #{orderCode,jdbcType=BIGINT}, #{status,jdbcType=TINYINT},#{createTime,jdbcType=INTEGER},#{remark,jdbcType=VARCHAR})
19 </insert> 18 </insert>
20 19
  20 + <select id="selectByStatus">
  21 + select
  22 + <include refid="Base_Column_List" />
  23 + from buyer_order_status_flow
  24 + where order_code = #{orderCode,jdbcType=BIGINT}
  25 + and status = #{status,jdbcType=TINYINT}
  26 + limit 1
  27 + </select>
  28 +
21 </mapper> 29 </mapper>
@@ -19,6 +19,10 @@ public enum AlarmConfig { @@ -19,6 +19,10 @@ public enum AlarmConfig {
19 "buyerOrder.transferEarnestMoney", 19 "buyerOrder.transferEarnestMoney",
20 "buyerOrder.refundGoodsMoney"), 20 "buyerOrder.refundGoodsMoney"),
21 21
  22 + DETECTION_NOT_PASS("商品检测不通过",
  23 + "buyerOrder.transferEarnestMoney",
  24 + "buyerOrder.refundGoodsMoney"),
  25 +
22 SELLER_PLAY_BUYER("卖家取消", 26 SELLER_PLAY_BUYER("卖家取消",
23 "buyerOrder.transferEarnestMoney", 27 "buyerOrder.transferEarnestMoney",
24 "buyerOrder.refundGoodsMoney"), 28 "buyerOrder.refundGoodsMoney"),
@@ -152,6 +152,24 @@ public class AppraiseController { @@ -152,6 +152,24 @@ public class AppraiseController {
152 } 152 }
153 153
154 154
  155 + /**
  156 + * 已取消:商品检测不通过
  157 + *
  158 + * @return
  159 + */
  160 + @RequestMapping(value = "/detectNotPass")
  161 + @IgnoreSession
  162 + @IgnoreSignature
  163 + public ApiResponse detectNotPass(@RequestBody BuyerOrderCancelReq req) {
  164 + logger.info("in detectNotPass, req {}", req);
  165 + if (req.getUid() <= 0 || req.getOrderCode() <= 0) {
  166 + return new ApiResponse.ApiResponseBuilder().code(400).message("参数校验不通过").build();
  167 + }
  168 + appraiseService.detectNotPass(req.getUid(), req.getOrderCode(), req.getCancelReason());
  169 + return new ApiResponse.ApiResponseBuilder().code(200).build();
  170 + }
  171 +
  172 +
155 173
156 /** 174 /**
157 * 175 *
@@ -18,6 +18,7 @@ public class BuyerRefundCouponEvent extends Event { @@ -18,6 +18,7 @@ public class BuyerRefundCouponEvent extends Event {
18 PAY_TIME_OUT, 18 PAY_TIME_OUT,
19 APPRAISE_FAIL, 19 APPRAISE_FAIL,
20 APPRAISE_UNSURE, 20 APPRAISE_UNSURE,
  21 + DETECTION_NOT_PASS,
21 SELLER_DELIVER_TIMEOUT, 22 SELLER_DELIVER_TIMEOUT,
22 SELLER_PLAY_BUYER, 23 SELLER_PLAY_BUYER,
23 /** 24 /**
@@ -16,6 +16,7 @@ import com.yohobuy.ufo.model.order.constants.SkupType; @@ -16,6 +16,7 @@ import com.yohobuy.ufo.model.order.constants.SkupType;
16 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail; 16 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
17 import com.yohobuy.ufo.model.order.vo.AddressInfo; 17 import com.yohobuy.ufo.model.order.vo.AddressInfo;
18 import com.yohoufo.common.utils.DateUtil; 18 import com.yohoufo.common.utils.DateUtil;
  19 +import com.yohoufo.dal.order.BuyerOrderStatusFlowMapper;
19 import com.yohoufo.dal.order.model.BuyerOrder; 20 import com.yohoufo.dal.order.model.BuyerOrder;
20 import com.yohoufo.dal.order.model.BuyerOrderGoods; 21 import com.yohoufo.dal.order.model.BuyerOrderGoods;
21 import com.yohoufo.dal.order.model.BuyerOrderMeta; 22 import com.yohoufo.dal.order.model.BuyerOrderMeta;
@@ -54,6 +55,9 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -54,6 +55,9 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
54 @Autowired 55 @Autowired
55 protected IBuyerOrderMetaService buyerOrderMetaService; 56 protected IBuyerOrderMetaService buyerOrderMetaService;
56 57
  58 + @Autowired
  59 + protected BuyerOrderStatusFlowMapper buyerOrderStatusFlowMapper;
  60 +
57 abstract BuyerOrder getBuyerOrder(int uid, long orderCode); 61 abstract BuyerOrder getBuyerOrder(int uid, long orderCode);
58 62
59 63
@@ -1691,6 +1691,46 @@ public class AppraiseService { @@ -1691,6 +1691,46 @@ public class AppraiseService {
1691 } 1691 }
1692 1692
1693 /** 1693 /**
  1694 + * 鉴定中心 检测不通过
  1695 + *
  1696 + * @param uid
  1697 + * @param orderCode
  1698 + */
  1699 + public void detectNotPass(Integer uid, Long orderCode, String remark) {
  1700 + if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)) {
  1701 + LOGGER.warn("[{}] not support detect not pass operation for goods service order", orderCode);
  1702 + //暂不支持
  1703 + return;
  1704 + }
  1705 + new BuyerOrderCancelHandler(uid, orderCode)
  1706 + .withBuyerOrderSupplier(buyerOrderMapper, buyerOrderGoodsMapper)
  1707 + .withSellerOrderSupplier(sellerOrderGoodsMapper, sellerOrderMetaMapper)
  1708 + // 平台已收货 -> 已取消:商品检测不通过
  1709 + .withStateTransition(OrderStatus.PLATFORM_RECEIVE, OrderStatus.PLATFORM_DETECTION_NOT_PASS, orderStatusFlowService)
  1710 + // 退保证金给卖家
  1711 + .withRefundEarnestMoney(payRefundService::refund, sellerOrderMapper::selectBySkup)
  1712 + .refundCase(RefundCase.SELLER_EARNEST_MONEY)
  1713 + .sellerWalletDetailType(SellerWalletDetail.Type.DETECTION_NOT_PASS)
  1714 + .and()
  1715 + // 退买家货款
  1716 + .withRefundGoodsMoney(payRefundService::refund)
  1717 + .refundCase(RefundCase.BUYER_GOODS_MONEY)
  1718 + .and()
  1719 + // 通知卖家商品检测不通过
  1720 + .withNoticeSeller((soa, code) -> sellerNoticeFacade.detectNotPass(soa, code)).and()
  1721 + // 通知买家商品检测不通过
  1722 + .withNoticeBuyer(this::noticeBuyerDetectNotPass).and()
  1723 + // 记录一条补充物流
  1724 + .withRecordSuppleExpress(this::addSuppleExpressForDetectionNotPass).and()
  1725 + // 退优惠券
  1726 + .withRefundCoupon(BuyerRefundCouponEvent.BizCase.DETECTION_NOT_PASS)
  1727 + .withCacheCleaner(cacheCleaner::delete)
  1728 + .withFailAlarm(AlarmConfig.DETECTION_NOT_PASS)
  1729 + .withOrderChangeListenerContainer(orderChangeListenerContainer)
  1730 + .cancel(remark);
  1731 + }
  1732 +
  1733 + /**
1694 * 无法鉴定时,记录一条补充物流 1734 * 无法鉴定时,记录一条补充物流
1695 */ 1735 */
1696 private void addSuppleExpressForUnsure(Integer uid, long orderCode) { 1736 private void addSuppleExpressForUnsure(Integer uid, long orderCode) {
@@ -1707,6 +1747,22 @@ public class AppraiseService { @@ -1707,6 +1747,22 @@ public class AppraiseService {
1707 } 1747 }
1708 1748
1709 /** 1749 /**
  1750 + * 商品检测不通过,记录一条补充物流
  1751 + */
  1752 + private void addSuppleExpressForDetectionNotPass(Integer uid, long orderCode) {
  1753 + try {
  1754 + LOGGER.info("addSuppleExpressWhenDetectionNotPass uid={}, orderCode= {}", uid, orderCode);
  1755 + //记录调拨信息
  1756 + EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  1757 + EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
  1758 + EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.detection_not_pass;
  1759 + expressInfoService.saveOperateTransferExpressInfo(uid, orderCode, expressType.getCode(), expressDataType, operateTransferCode);
  1760 + } catch (Exception e) {
  1761 + LOGGER.error("addSuppleExpressWhenDetectionNotPass error ,uid={}, orderCode= {},error {}", uid, orderCode, e);
  1762 + }
  1763 + }
  1764 +
  1765 + /**
1710 * 通知买家商品无法鉴定(并发券) 1766 * 通知买家商品无法鉴定(并发券)
1711 * 1767 *
1712 * @param request 1768 * @param request
@@ -1735,6 +1791,15 @@ public class AppraiseService { @@ -1735,6 +1791,15 @@ public class AppraiseService {
1735 } 1791 }
1736 1792
1737 /** 1793 /**
  1794 + * 通知买家商品检测不通过
  1795 + *
  1796 + * @param request
  1797 + */
  1798 + private void noticeBuyerDetectNotPass(BuyerNoticeSender.Request request) {
  1799 + inBoxFacade.noticeBuyerDetectNotPass(request);
  1800 + }
  1801 +
  1802 + /**
1738 * 根据物流单号修改鉴定室 1803 * 根据物流单号修改鉴定室
1739 * @param appraiseExpressInfoBo 1804 * @param appraiseExpressInfoBo
1740 */ 1805 */
@@ -170,6 +170,10 @@ class BuyerOrderCancelHandler { @@ -170,6 +170,10 @@ class BuyerOrderCancelHandler {
170 } 170 }
171 171
172 public void cancel() { 172 public void cancel() {
  173 + this.cancel(null);
  174 + }
  175 +
  176 + public void cancel(String remark) {
173 log.info("cancel order {} from {} to {}", orderCode, expectStatus, targetStatus); 177 log.info("cancel order {} from {} to {}", orderCode, expectStatus, targetStatus);
174 verify(); 178 verify();
175 // 获取买家订单 179 // 获取买家订单
@@ -195,7 +199,7 @@ class BuyerOrderCancelHandler { @@ -195,7 +199,7 @@ class BuyerOrderCancelHandler {
195 throwServiceException("卖家商品不存在"); 199 throwServiceException("卖家商品不存在");
196 } 200 }
197 // 更新订单状态成功 201 // 更新订单状态成功
198 - if (updateBuyerOrderStatus()) { 202 + if (updateBuyerOrderStatus(remark)) {
199 log.info("cancel order {} from {} to {} success", orderCode, expectStatus, targetStatus); 203 log.info("cancel order {} from {} to {} success", orderCode, expectStatus, targetStatus);
200 addSuppleExpress(sellerUid); 204 addSuppleExpress(sellerUid);
201 refundCoupon(); 205 refundCoupon();
@@ -222,7 +226,7 @@ class BuyerOrderCancelHandler { @@ -222,7 +226,7 @@ class BuyerOrderCancelHandler {
222 Verify.verifyNotNull(buyerOrderMapper, "buyerOrderMapper is null"); 226 Verify.verifyNotNull(buyerOrderMapper, "buyerOrderMapper is null");
223 } 227 }
224 228
225 - private boolean updateBuyerOrderStatus() { 229 + private boolean updateBuyerOrderStatus(String remark) {
226 int rows = buyerOrderMapper.updateStatusByOrderCode( 230 int rows = buyerOrderMapper.updateStatusByOrderCode(
227 orderCode, 231 orderCode,
228 uid, 232 uid,
@@ -232,7 +236,7 @@ class BuyerOrderCancelHandler { @@ -232,7 +236,7 @@ class BuyerOrderCancelHandler {
232 ); 236 );
233 boolean success = rows > 0; 237 boolean success = rows > 0;
234 if (success && Objects.nonNull(orderStatusFlowService)) { 238 if (success && Objects.nonNull(orderStatusFlowService)) {
235 - orderStatusFlowService.addAsy(orderCode, targetStatus.getCode()); 239 + orderStatusFlowService.addAsy(orderCode, targetStatus.getCode(), remark);
236 } 240 }
237 return success; 241 return success;
238 } 242 }
@@ -13,10 +13,7 @@ import com.yohoufo.dal.order.BuyerOrderGoodsMapper; @@ -13,10 +13,7 @@ import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
13 import com.yohoufo.dal.order.BuyerOrderMapper; 13 import com.yohoufo.dal.order.BuyerOrderMapper;
14 import com.yohoufo.dal.order.BuyerOrderMetaMapper; 14 import com.yohoufo.dal.order.BuyerOrderMetaMapper;
15 import com.yohoufo.dal.order.SellerOrderGoodsMapper; 15 import com.yohoufo.dal.order.SellerOrderGoodsMapper;
16 -import com.yohoufo.dal.order.model.BuyerOrder;  
17 -import com.yohoufo.dal.order.model.BuyerOrderGoods;  
18 -import com.yohoufo.dal.order.model.BuyerOrderMeta;  
19 -import com.yohoufo.dal.order.model.SellerOrderGoods; 16 +import com.yohoufo.dal.order.model.*;
20 import com.yohoufo.order.common.ActionStatusHold; 17 import com.yohoufo.order.common.ActionStatusHold;
21 import com.yohoufo.order.model.request.OrderRequest; 18 import com.yohoufo.order.model.request.OrderRequest;
22 import com.yohobuy.ufo.model.order.resp.OrderDetailInfo; 19 import com.yohobuy.ufo.model.order.resp.OrderDetailInfo;
@@ -172,6 +169,11 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO @@ -172,6 +169,11 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
172 } 169 }
173 } 170 }
174 171
  172 + //检测不通过,需要查询原因
  173 + if (orderStatus == OrderStatus.PLATFORM_DETECTION_NOT_PASS.getCode()) {
  174 + BuyerOrderStatusFlow statusFlow = buyerOrderStatusFlowMapper.selectByStatus(buyerOrder.getOrderCode(), orderStatus);
  175 + detailDesc = String.format(temp, BuyerOrderStatusFlow.formatRemarkWithPrefixAndSuffix(statusFlow));
  176 + }
175 177
176 }catch (Exception ex){ 178 }catch (Exception ex){
177 getLogger().warn("in formatDetailDesc error buyerOrder {} temp {}", buyerOrder, temp, ex); 179 getLogger().warn("in formatDetailDesc error buyerOrder {} temp {}", buyerOrder, temp, ex);
@@ -839,6 +839,41 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -839,6 +839,41 @@ public class InBoxFacade extends BaseNoticeFacade{
839 } 839 }
840 } 840 }
841 841
  842 +
  843 + /**
  844 + * 通知买家商品无法鉴定
  845 + * @param request
  846 + */
  847 + public void noticeBuyerDetectNotPass(@NonNull BuyerNoticeSender.Request request){
  848 + Integer uid = request.getUid();
  849 + Long orderCode = request.getOrderCode();
  850 + String params = buildParams(orderCode);
  851 + InboxReqVO inboxMessage = buildInboxReqVO(uid, params, InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_DETECTION_NOT_PASS);
  852 + String smsContent = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_DETECTION_NOT_PASS.getContent(), orderCode);
  853 + try {
  854 + log.info("noticeBuyerDetectNotPass,uid {} request is {}", uid, request);
  855 + executorService.execute(() -> {
  856 + InBoxResponse inBoxResponse = inBoxSDK.addInbox(inboxMessage);
  857 + log.info("noticeBuyerDetectNotPass inbox send success, message is {} res is {}", inboxMessage, inBoxResponse);
  858 +
  859 + //发push todo
  860 + SendMessageRspBo bo = ufoSendService.identifyFail(String.valueOf(uid),String.valueOf(orderCode));
  861 + log.info("noticeBuyerDetectNotPass push buyer uid is {}, orderCode is {}, result is {}", uid, orderCode, JSON.toJSONString(bo));
  862 +
  863 + //sms
  864 + String phone = userProxyService.getMobile(uid);
  865 + if (StringUtils.isBlank(phone)) {
  866 + log.warn("noticeBuyerDetectNotPass sms send fail,uid {} can not find phone", uid);
  867 + return;
  868 + }
  869 + sendSmsService.smsSendByMobile(smsContent, Arrays.asList(phone));
  870 + log.info("noticeBuyerDetectNotPass sms send success,uid {}", uid);
  871 + });
  872 + } catch (Exception e) {
  873 + log.warn("noticeBuyerDetectNotPass fail,uid {}", uid, e);
  874 + }
  875 + }
  876 +
842 public void buyerCancelBeforeDepotReceive(@NonNull BuyerOrder buyerOrder, String compesant, SellerOrderGoods sog) { 877 public void buyerCancelBeforeDepotReceive(@NonNull BuyerOrder buyerOrder, String compesant, SellerOrderGoods sog) {
843 buyerNoticeFacade.buyerCancelBeforeDepotReceive(buyerOrder, compesant, sog); 878 buyerNoticeFacade.buyerCancelBeforeDepotReceive(buyerOrder, compesant, sog);
844 sellerNoticeFacade.buyerCancelBeforeDepotReceive(buyerOrder, sog); 879 sellerNoticeFacade.buyerCancelBeforeDepotReceive(buyerOrder, sog);
@@ -37,8 +37,11 @@ public class OrderStatusFlowService { @@ -37,8 +37,11 @@ public class OrderStatusFlowService {
37 @Autowired 37 @Autowired
38 private OrderCodeGenerator orderCodeGenerator; 38 private OrderCodeGenerator orderCodeGenerator;
39 39
40 -  
41 public void addAsy(Long orderCode, Integer status) { 40 public void addAsy(Long orderCode, Integer status) {
  41 + addAsy(orderCode, status, null);
  42 + }
  43 +
  44 + public void addAsy(Long orderCode, Integer status, String remark) {
42 try { 45 try {
43 CodeMeta codeMeta = orderCodeGenerator.expId(orderCode); 46 CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
44 boolean isBuyerOrderCode = OrderCodeType.BUYER_TYPE.getType() == codeMeta.getType(); 47 boolean isBuyerOrderCode = OrderCodeType.BUYER_TYPE.getType() == codeMeta.getType();
@@ -48,6 +51,7 @@ public class OrderStatusFlowService { @@ -48,6 +51,7 @@ public class OrderStatusFlowService {
48 buyerOrderStatusFlow.setOrderCode(orderCode); 51 buyerOrderStatusFlow.setOrderCode(orderCode);
49 buyerOrderStatusFlow.setStatus(status); 52 buyerOrderStatusFlow.setStatus(status);
50 buyerOrderStatusFlow.setCreateTime(DateUtil.getCurrentTimeSecond()); 53 buyerOrderStatusFlow.setCreateTime(DateUtil.getCurrentTimeSecond());
  54 + buyerOrderStatusFlow.setRemark(remark);
51 logger.info("OrderStatusFlowService add execute , buyerOrderStatusFlow {} ", buyerOrderStatusFlow); 55 logger.info("OrderStatusFlowService add execute , buyerOrderStatusFlow {} ", buyerOrderStatusFlow);
52 buyerOrderStatusFlowMapper.insert(buyerOrderStatusFlow); 56 buyerOrderStatusFlowMapper.insert(buyerOrderStatusFlow);
53 }); 57 });
@@ -57,7 +61,5 @@ public class OrderStatusFlowService { @@ -57,7 +61,5 @@ public class OrderStatusFlowService {
57 } catch (Exception e) { 61 } catch (Exception e) {
58 logger.warn("OrderStatusFlowService add error , status {}, orderCode {} ", status, orderCode, e); 62 logger.warn("OrderStatusFlowService add error , status {}, orderCode {} ", status, orderCode, e);
59 } 63 }
60 -  
61 -  
62 } 64 }
63 } 65 }
@@ -2,8 +2,11 @@ package com.yohoufo.order.service.proxy; @@ -2,8 +2,11 @@ package com.yohoufo.order.service.proxy;
2 2
3 import com.yoho.message.sdk.service.ufo.IUFOSendService; 3 import com.yoho.message.sdk.service.ufo.IUFOSendService;
4 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; 4 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
  5 +import com.yohobuy.ufo.model.order.common.OrderStatus;
5 import com.yohobuy.ufo.model.order.constants.SkupType; 6 import com.yohobuy.ufo.model.order.constants.SkupType;
  7 +import com.yohoufo.dal.order.BuyerOrderStatusFlowMapper;
6 import com.yohoufo.dal.order.model.BuyerOrder; 8 import com.yohoufo.dal.order.model.BuyerOrder;
  9 +import com.yohoufo.dal.order.model.BuyerOrderStatusFlow;
7 import com.yohoufo.dal.order.model.SellerOrderGoods; 10 import com.yohoufo.dal.order.model.SellerOrderGoods;
8 import com.yohoufo.dal.product.ProductMapper; 11 import com.yohoufo.dal.product.ProductMapper;
9 import com.yohoufo.dal.product.model.Product; 12 import com.yohoufo.dal.product.model.Product;
@@ -14,6 +17,7 @@ import org.slf4j.Logger; @@ -14,6 +17,7 @@ import org.slf4j.Logger;
14 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Service; 18 import org.springframework.stereotype.Service;
16 19
  20 +import java.util.Objects;
17 import java.util.Optional; 21 import java.util.Optional;
18 import java.util.function.Supplier; 22 import java.util.function.Supplier;
19 23
@@ -27,6 +31,9 @@ public class SellerNoticeFacade extends BaseNoticeFacade { @@ -27,6 +31,9 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
27 @Autowired 31 @Autowired
28 private ProductMapper productMapper; 32 private ProductMapper productMapper;
29 33
  34 + @Autowired
  35 + private BuyerOrderStatusFlowMapper buyerOrderStatusFlowMapper;
  36 +
30 @Override 37 @Override
31 public Logger getLogger() { 38 public Logger getLogger() {
32 return log; 39 return log;
@@ -247,6 +254,33 @@ public class SellerNoticeFacade extends BaseNoticeFacade { @@ -247,6 +254,33 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
247 } 254 }
248 } 255 }
249 256
  257 + /**
  258 + * 鉴定中心 检测不通过
  259 + *
  260 + * @param sog
  261 + * @param orderCode 买家订单号
  262 + */
  263 + public void detectNotPass(SellerOrderGoods sog, long orderCode) {
  264 + String logPrefix = "notice seller detect not pass";
  265 + Integer sellerUid = sog.getUid();
  266 + String prdName = sog.getProductName();
  267 + String sizeName = sog.getSizeName();
  268 + String goodsTypeTag = buildGoodsTypeTagForSeller(sog);
  269 + try {
  270 + BuyerOrderStatusFlow statusFlow = buyerOrderStatusFlowMapper.selectByStatus(orderCode, OrderStatus.PLATFORM_DETECTION_NOT_PASS.getCode());
  271 + String remark = BuyerOrderStatusFlow.formatRemarkWithPrefixAndSuffix(statusFlow);
  272 + Product product = productMapper.selectByPrimaryKey(sog.getProductId());
  273 + String productCode = product.getProductCode();
  274 + newNotice(sellerUid)
  275 + .withLogPrefix(logPrefix)
  276 + .withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_DETECTION_NOT_PASS, goodsTypeTag, prdName, sizeName, productCode, remark)
  277 + .withSms(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_DETECTION_NOT_PASS, goodsTypeTag, prdName, sizeName, productCode, remark, orderCode)
  278 + .send();
  279 + } catch (Exception e) {
  280 + log.warn("{} fail, sellerUid {}, prdName {} ", logPrefix, sellerUid, prdName, e);
  281 + }
  282 + }
  283 +
250 public void sellerDeliverWithTimes(SellerOrderGoods sog, long orderCode, int times, int leftTime, String timeUnit) { 284 public void sellerDeliverWithTimes(SellerOrderGoods sog, long orderCode, int times, int leftTime, String timeUnit) {
251 String logPrefix = "notice seller seller deliver"; 285 String logPrefix = "notice seller seller deliver";
252 Integer sellerUid = sog.getUid(); 286 Integer sellerUid = sog.getUid();