Authored by TANLING

Merge branch 'hotfix_0407_skupnotexist2' into test6.9.24

@@ -2,8 +2,10 @@ package com.yohoufo.order.controller; @@ -2,8 +2,10 @@ package com.yohoufo.order.controller;
2 2
3 import com.yoho.error.ServiceError; 3 import com.yoho.error.ServiceError;
4 import com.yoho.error.exception.ServiceException; 4 import com.yoho.error.exception.ServiceException;
  5 +import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;
5 import com.yohobuy.ufo.model.order.bo.OrderInfo; 6 import com.yohobuy.ufo.model.order.bo.OrderInfo;
6 import com.yohobuy.ufo.model.order.common.OrderCodeType; 7 import com.yohobuy.ufo.model.order.common.OrderCodeType;
  8 +import com.yohobuy.ufo.model.order.common.OrderStatus;
7 import com.yohoufo.common.ApiResponse; 9 import com.yohoufo.common.ApiResponse;
8 import com.yohoufo.common.alarm.EventBusPublisher; 10 import com.yohoufo.common.alarm.EventBusPublisher;
9 import com.yohoufo.common.annotation.IgnoreSession; 11 import com.yohoufo.common.annotation.IgnoreSession;
@@ -18,6 +20,7 @@ import com.yohoufo.order.model.request.TransferMoneyRequest; @@ -18,6 +20,7 @@ import com.yohoufo.order.model.request.TransferMoneyRequest;
18 import com.yohoufo.order.model.response.PrepayResponse; 20 import com.yohoufo.order.model.response.PrepayResponse;
19 import com.yohoufo.order.service.IPaymentService; 21 import com.yohoufo.order.service.IPaymentService;
20 import com.yohoufo.order.service.IStoredSellerService; 22 import com.yohoufo.order.service.IStoredSellerService;
  23 +import com.yohoufo.order.service.impl.AppraiseService;
21 import com.yohoufo.order.service.impl.TransferService; 24 import com.yohoufo.order.service.impl.TransferService;
22 import com.yohoufo.order.service.pay.alipay.AlipayOuyinService; 25 import com.yohoufo.order.service.pay.alipay.AlipayOuyinService;
23 import lombok.Data; 26 import lombok.Data;
@@ -41,6 +44,10 @@ public class OrderHelpController { @@ -41,6 +44,10 @@ public class OrderHelpController {
41 @Autowired 44 @Autowired
42 private AlipayOuyinService alipayService; 45 private AlipayOuyinService alipayService;
43 46
  47 +
  48 + @Autowired
  49 + private AppraiseService appraiseService;
  50 +
44 @Data 51 @Data
45 public static class RefundEarnestMoneyRequest { 52 public static class RefundEarnestMoneyRequest {
46 private Integer uid; 53 private Integer uid;
@@ -68,6 +75,20 @@ public class OrderHelpController { @@ -68,6 +75,20 @@ public class OrderHelpController {
68 .build(); 75 .build();
69 } 76 }
70 77
  78 + @IgnoreSignature
  79 + @IgnoreSession
  80 + @RequestMapping(value = "/miniFaultRejectedHelp0407")
  81 + public ApiResponse miniFaultRejectedHelp0407(@RequestBody MiniFaultRejectedHelp0407Request data) {
  82 + return appraiseService.miniFaultRejectedHelp0407(data.orderCode, data.targetStatus, data.outTimeFlag);
  83 + }
  84 +
  85 + @Data
  86 + public static class MiniFaultRejectedHelp0407Request {
  87 + Long orderCode;
  88 + OrderStatus targetStatus;
  89 + boolean outTimeFlag;
  90 + }
  91 +
71 92
72 @Autowired 93 @Autowired
73 IStoredSellerService storedSellerService; 94 IStoredSellerService storedSellerService;
@@ -76,12 +97,13 @@ public class OrderHelpController { @@ -76,12 +97,13 @@ public class OrderHelpController {
76 /** 97 /**
77 * 6.9.23的版本,一次性接口 98 * 6.9.23的版本,一次性接口
78 * 将线上的超级卖家全部降级成为普通入驻 99 * 将线上的超级卖家全部降级成为普通入驻
  100 + *
79 * @param uids 101 * @param uids
80 */ 102 */
81 @IgnoreSignature 103 @IgnoreSignature
82 @IgnoreSession 104 @IgnoreSession
83 @RequestMapping(value = "/degrade") 105 @RequestMapping(value = "/degrade")
84 - public ApiResponse degrade(@RequestParam(value = "uids", required = false) List<Integer> uids){ 106 + public ApiResponse degrade(@RequestParam(value = "uids", required = false) List<Integer> uids) {
85 107
86 storedSellerService.degrade(uids); 108 storedSellerService.degrade(uids);
87 return new ApiResponse.ApiResponseBuilder() 109 return new ApiResponse.ApiResponseBuilder()
@@ -106,8 +128,6 @@ public class OrderHelpController { @@ -106,8 +128,6 @@ public class OrderHelpController {
106 } 128 }
107 129
108 130
109 -  
110 -  
111 @Autowired 131 @Autowired
112 private IPaymentService paymentService; 132 private IPaymentService paymentService;
113 133
@@ -118,9 +138,13 @@ public class OrderHelpController { @@ -118,9 +138,13 @@ public class OrderHelpController {
118 public ApiResponse refund(@RequestParam(name = "orderCode") long orderCode, 138 public ApiResponse refund(@RequestParam(name = "orderCode") long orderCode,
119 @RequestParam(name = "paidOrderCode", required = false) Long paidOrderCode, 139 @RequestParam(name = "paidOrderCode", required = false) Long paidOrderCode,
120 @RequestParam(name = "payLevel", defaultValue = "0") int payLevel, 140 @RequestParam(name = "payLevel", defaultValue = "0") int payLevel,
  141 + @RequestParam(name = "refundType", required = false) int refundType,
121 @RequestParam(name = "refundAmount") double refundAmount) { 142 @RequestParam(name = "refundAmount") double refundAmount) {
122 143
123 - PaymentRequest request = PaymentRequest.builder().orderCode(orderCode).paidOrderCode(paidOrderCode).payLevel(payLevel).refundAmount(refundAmount).build(); 144 + PaymentRequest request = PaymentRequest.builder().orderCode(orderCode).paidOrderCode(paidOrderCode).payLevel(payLevel)
  145 + .refundAmount(refundAmount)
  146 + .refundattch(MerchantOrderAttachInfo.builder().type(refundType).build())
  147 + .build();
124 PayRefundBo payRefundBo = paymentService.refund(request); 148 PayRefundBo payRefundBo = paymentService.refund(request);
125 149
126 if (payRefundBo.getRefundStatus() == RefundContant.PAYMENT_REFUND_RESULTCODE_SUCCESS) { 150 if (payRefundBo.getRefundStatus() == RefundContant.PAYMENT_REFUND_RESULTCODE_SUCCESS) {
@@ -147,7 +171,4 @@ public class OrderHelpController { @@ -147,7 +171,4 @@ public class OrderHelpController {
147 } 171 }
148 172
149 173
150 -  
151 -  
152 -  
153 } 174 }
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
3 -import com.alibaba.fastjson.JSON;  
4 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
  4 +import com.google.common.annotations.VisibleForTesting;
5 import com.google.common.collect.Lists; 5 import com.google.common.collect.Lists;
6 import com.google.common.collect.Sets; 6 import com.google.common.collect.Sets;
7 import com.yoho.core.rabbitmq.YhProducer; 7 import com.yoho.core.rabbitmq.YhProducer;
@@ -821,7 +821,7 @@ public class AppraiseService { @@ -821,7 +821,7 @@ public class AppraiseService {
821 public ApiResponse miniFaultReject(Long orderCode, OrderStatus targetStatus, boolean outTimeFlag) { 821 public ApiResponse miniFaultReject(Long orderCode, OrderStatus targetStatus, boolean outTimeFlag) {
822 LOGGER.info("miniFaultReject enter , orderCode {} ,targetStatus {},outTimeFlag {}", orderCode, targetStatus, outTimeFlag); 822 LOGGER.info("miniFaultReject enter , orderCode {} ,targetStatus {},outTimeFlag {}", orderCode, targetStatus, outTimeFlag);
823 OrderStatus expectStatus = OrderStatus.MINI_FAULT_WAITING; 823 OrderStatus expectStatus = OrderStatus.MINI_FAULT_WAITING;
824 - ApiResponse apiResponse = new ApiResponse(); 824 +
825 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); 825 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
826 826
827 if (buyerOrder == null) { 827 if (buyerOrder == null) {
@@ -841,99 +841,195 @@ public class AppraiseService { @@ -841,99 +841,195 @@ public class AppraiseService {
841 DateUtil.getCurrentTimeSecond()); 841 DateUtil.getCurrentTimeSecond());
842 842
843 if (rows > 0) { 843 if (rows > 0) {
844 - //refund coupons of buyer  
845 - BuyerRefundCouponEvent brce = BuyerRefundCouponEvent.builder().bizCase(BuyerRefundCouponEvent.BizCase.APPRAISE_FAIL)  
846 - .uid(buyerUid).orderCode(orderCode).build();  
847 - EventBusPublisher.publishEvent(brce);  
848 - //  
849 - int sellerUid = buyerOrder.getSellerUid();  
850 - BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(buyerUid, orderCode);  
851 - int skup = bog.getSkup(); 844 + return miniFaultRejected(orderCode, targetStatus, outTimeFlag, buyerOrder, buyerUid);
  845 + } else {
  846 + ApiResponse apiResponse = new ApiResponse();
  847 + LOGGER.warn("in miniFaultReject, buyer Order now status {}, expect expectStatus {}",
  848 + buyerOrder.getStatus(), expectStatus);
  849 + apiResponse.setCode(400);
  850 + apiResponse.setMessage("订单状态发生变化");
  851 + return apiResponse;
  852 + }
  853 + }
852 854
853 - SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup);  
854 - long sellerOrderCode = sellerOrder.getOrderCode(); 855 + private ApiResponse miniFaultRejected(Long orderCode, OrderStatus targetStatus, boolean outTimeFlag, BuyerOrder buyerOrder, int buyerUid) {
855 856
  857 + BuyerRefundCouponEvent brce = BuyerRefundCouponEvent.builder().bizCase(BuyerRefundCouponEvent.BizCase.APPRAISE_FAIL)
  858 + .uid(buyerUid).orderCode(orderCode).build();
  859 + EventBusPublisher.publishEvent(brce);
  860 + //
  861 + int sellerUid = buyerOrder.getSellerUid();
  862 + BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(buyerUid, orderCode);
  863 + int skup = bog.getSkup();
856 864
857 - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);  
858 - //async refund seller coupon  
859 - sellerOrderServiceDelegate.getSellerOrderService()  
860 - .asyncCancelWithCouponIfPresent(orderCode, targetStatus.getCode(), sellerOrderGoods); 865 + SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup);
  866 + long sellerOrderCode = sellerOrder.getOrderCode();
861 867
862 - final SellerOrderStatus expectSOStatus = SellerOrderStatus.HAS_PAYED;  
863 - final SellerOrderStatus targetSoStatus = SellerOrderStatus.MINI_FAULT_REJECT;  
864 868
865 - int ucnt = updateSellerOrderStatusAndCleanCache(sellerUid, sellerOrderCode, expectSOStatus, targetSoStatus,  
866 - skup, orderCode, buyerUid);  
867 - //将卖家的保证金扣掉10元后,剩余的钱退回给卖家  
868 - BigDecimal earnestMoney = sellerOrder.getEarnestMoney().subtract(new BigDecimal(miniFaultRejectPunishFee));  
869 - PaymentRequest refundReqOfSeller = refundEarnestMoney(SellerWalletDetail.Type.MINI_FAULT_REJECT, orderCode, sellerUid, sellerOrder, buyerUid, targetSoStatus, earnestMoney.doubleValue());  
870 - LOGGER.info("in miniFaultReject,refund ok, refundReqOfSeller {}", refundReqOfSeller);  
871 -  
872 - //退买家的钱  
873 - BigDecimal goodsMoney = buyerOrder.getAmount();  
874 - boolean refundGoodsMoneyFlag = new RefundGoodsMoneyHandler()  
875 - .loadPaymentRequest(buyerUid, orderCode, buyerOrder.getPayment(), goodsMoney)  
876 - .loadTargetOrderStatus(targetStatus)  
877 - .loadRefundAction(payRefundService::refund)  
878 - .loadLogger(LOGGER)  
879 - .loadSellerOrderGoods(sellerUid, skup)  
880 - .refund();  
881 - if (!refundGoodsMoneyFlag) {  
882 - apiResponse.setCode(400);  
883 - String content = "瑕疵不接受时,退用户" + sellerUid + "货款订单" + orderCode + "失败";  
884 - apiResponse.setMessage(content);  
885 - } 869 + SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
  870 + //async refund seller coupon
  871 + sellerOrderServiceDelegate.getSellerOrderService()
  872 + .asyncCancelWithCouponIfPresent(orderCode, targetStatus.getCode(), sellerOrderGoods);
886 873
887 - //记录订单的状态变更信息  
888 - LOGGER.info("in miniFaultReject record status change, orderCode {},uid {} ,sellerUid {}", orderCode, buyerUid, sellerUid);  
889 - try {  
890 - //记录订单状态流转  
891 - orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetStatus.getCode()); 874 + final SellerOrderStatus expectSOStatus = SellerOrderStatus.HAS_PAYED;
  875 + final SellerOrderStatus targetSoStatus = SellerOrderStatus.MINI_FAULT_REJECT;
892 876
893 - //瑕疵不接受(用户不接受和超时不接受),只给买家发消息  
894 - buyerNoticeFacade.miniFaultUnAccept(buyerOrder, sellerOrderGoods, outTimeFlag);  
895 - sellerNoticeFacade.sellerMiniFaultUnAccept(sellerOrderGoods, orderCode, outTimeFlag); 877 + int ucnt = updateSellerOrderStatusAndCleanCache(sellerUid, sellerOrderCode, expectSOStatus, targetSoStatus,
  878 + skup, orderCode, buyerUid);
  879 + //将卖家的保证金扣掉10元后,剩余的钱退回给卖家
  880 + BigDecimal earnestMoney = sellerOrder.getEarnestMoney().subtract(new BigDecimal(miniFaultRejectPunishFee));
  881 + PaymentRequest refundReqOfSeller = refundEarnestMoney(SellerWalletDetail.Type.MINI_FAULT_REJECT, orderCode, sellerUid, sellerOrder, buyerUid, targetSoStatus, earnestMoney.doubleValue());
  882 + LOGGER.info("in miniFaultReject,refund ok, refundReqOfSeller {}", refundReqOfSeller);
896 883
897 - } catch (Exception ex) {  
898 - LOGGER.warn("in miniFaultReject orderStatusFlowService or notice fail orderCode {}", orderCode, ex);  
899 - } finally {  
900 - /// 物流信息异步执行  
901 - executorService.execute(() -> { 884 + //退买家的钱
  885 + BigDecimal goodsMoney = buyerOrder.getAmount();
  886 + boolean refundGoodsMoneyFlag = new RefundGoodsMoneyHandler()
  887 + .loadPaymentRequest(buyerUid, orderCode, buyerOrder.getPayment(), goodsMoney)
  888 + .loadTargetOrderStatus(targetStatus)
  889 + .loadRefundAction(payRefundService::refund)
  890 + .loadLogger(LOGGER)
  891 + .loadSellerOrderGoods(sellerUid, skup)
  892 + .refund();
  893 + if (!refundGoodsMoneyFlag) {
  894 + ApiResponse apiResponse = new ApiResponse();
  895 + apiResponse.setCode(400);
  896 + String content = "瑕疵不接受时,退用户" + sellerUid + "货款订单" + orderCode + "失败";
  897 + apiResponse.setMessage(content);
  898 + return apiResponse;
  899 + }
902 900
903 - //记下订单的操作记录  
904 - if (outTimeFlag) {  
905 - //更新瑕疵确认结果  
906 - int updateNum = qualityCheckMapper.updateByOrderCode(orderCode, EnumQualityCheckStatus.REJECT_BY_OUTER_TIME.getCode(), DateUtil.getCurrentTimeSecond());  
907 - LOGGER.info("Buyer Order miniFaultReject by auto orderCode {} ,update quality check record status num {} ", orderCode, updateNum);  
908 - orderOperateRecordService.addRecord(orderCode, "系统操作", OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT_BY_OUT_TIME);  
909 - } else {  
910 - //更新瑕疵确认结果  
911 - int updateNum = qualityCheckMapper.updateByOrderCode(orderCode, EnumQualityCheckStatus.REJECT_BY_BUYER.getCode(), DateUtil.getCurrentTimeSecond());  
912 - LOGGER.info("Buyer Order miniFaultReject by buyer orderCode {} ,update quality check record status num {} ", orderCode, updateNum);  
913 - orderOperateRecordService.addRecord(orderCode, "买家操作", OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT);  
914 - } 901 + //记录订单的状态变更信息
  902 + LOGGER.info("in miniFaultReject record status change, orderCode {},uid {} ,sellerUid {}", orderCode, buyerUid, sellerUid);
  903 + try {
  904 + //记录订单状态流转
  905 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetStatus.getCode());
915 906
916 - //更新物流信息,写到最后  
917 - //先补加一条鉴定中物流  
918 - EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;  
919 - EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;  
920 - EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_reject;  
921 - expressInfoService.saveOperateTransferExpressInfo(sellerUid, orderCode, expressType.getCode(), expressDataType, operateTransferCode); 907 + //瑕疵不接受(用户不接受和超时不接受),只给买家发消息
  908 + buyerNoticeFacade.miniFaultUnAccept(buyerOrder, sellerOrderGoods, outTimeFlag);
  909 + sellerNoticeFacade.sellerMiniFaultUnAccept(sellerOrderGoods, orderCode, outTimeFlag);
922 910
923 - operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_not_pass;  
924 - expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;  
925 - expressDataType = EnumExpressDataType.operate_transfer;  
926 - expressInfoService.saveOperateTransferExpressInfo(sellerUid, orderCode, expressType.getCode(), expressDataType, operateTransferCode);  
927 - }); 911 + } catch (Exception ex) {
  912 + LOGGER.warn("in miniFaultReject orderStatusFlowService or notice fail orderCode {}", orderCode, ex);
  913 + } finally {
  914 + /// 物流信息异步执行
  915 + executorService.execute(() -> {
928 916
929 - } 917 + //记下订单的操作记录
  918 + if (outTimeFlag) {
  919 + //更新瑕疵确认结果
  920 + int updateNum = qualityCheckMapper.updateByOrderCode(orderCode, EnumQualityCheckStatus.REJECT_BY_OUTER_TIME.getCode(), DateUtil.getCurrentTimeSecond());
  921 + LOGGER.info("Buyer Order miniFaultReject by auto orderCode {} ,update quality check record status num {} ", orderCode, updateNum);
  922 + orderOperateRecordService.addRecord(orderCode, "系统操作", OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT_BY_OUT_TIME);
  923 + } else {
  924 + //更新瑕疵确认结果
  925 + int updateNum = qualityCheckMapper.updateByOrderCode(orderCode, EnumQualityCheckStatus.REJECT_BY_BUYER.getCode(), DateUtil.getCurrentTimeSecond());
  926 + LOGGER.info("Buyer Order miniFaultReject by buyer orderCode {} ,update quality check record status num {} ", orderCode, updateNum);
  927 + orderOperateRecordService.addRecord(orderCode, "买家操作", OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT);
  928 + }
930 929
931 - } else {  
932 - LOGGER.warn("in miniFaultReject, buyer Order now status {}, expect expectStatus {}",  
933 - buyerOrder.getStatus(), expectStatus); 930 + //更新物流信息,写到最后
  931 + //先补加一条鉴定中物流
  932 + EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  933 + EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
  934 + EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_reject;
  935 + expressInfoService.saveOperateTransferExpressInfo(sellerUid, orderCode, expressType.getCode(), expressDataType, operateTransferCode);
  936 +
  937 + operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_not_pass;
  938 + expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  939 + expressDataType = EnumExpressDataType.operate_transfer;
  940 + expressInfoService.saveOperateTransferExpressInfo(sellerUid, orderCode, expressType.getCode(), expressDataType, operateTransferCode);
  941 + });
  942 +
  943 + }
  944 + ApiResponse apiResponse = new ApiResponse();
  945 + return apiResponse;
  946 + }
  947 +
  948 +
  949 +
  950 +
  951 + @VisibleForTesting
  952 + public ApiResponse miniFaultRejectedHelp0407(Long orderCode, OrderStatus targetStatus, boolean outTimeFlag) {
  953 +
  954 + BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
  955 + Integer buyerUid = buyerOrder.getUid();
  956 + int sellerUid = buyerOrder.getSellerUid();
  957 + BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(buyerUid, orderCode);
  958 + int skup = bog.getSkup();
  959 +
  960 + SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup);
  961 +
  962 +
  963 + SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
  964 +
  965 + final SellerOrderStatus targetSoStatus = SellerOrderStatus.MINI_FAULT_REJECT;
  966 +
  967 + //将卖家的保证金扣掉10元后,剩余的钱退回给卖家
  968 + BigDecimal earnestMoney = sellerOrder.getEarnestMoney().subtract(new BigDecimal(miniFaultRejectPunishFee));
  969 + PaymentRequest refundReqOfSeller = refundEarnestMoney(SellerWalletDetail.Type.MINI_FAULT_REJECT, orderCode, sellerUid, sellerOrder, buyerUid, targetSoStatus, earnestMoney.doubleValue());
  970 + LOGGER.info("in miniFaultReject,refund ok, refundReqOfSeller {}", refundReqOfSeller);
  971 +
  972 + //退买家的钱
  973 + BigDecimal goodsMoney = buyerOrder.getAmount();
  974 + boolean refundGoodsMoneyFlag = new RefundGoodsMoneyHandler()
  975 + .loadPaymentRequest(buyerUid, orderCode, buyerOrder.getPayment(), goodsMoney)
  976 + .loadTargetOrderStatus(targetStatus)
  977 + .loadRefundAction(payRefundService::refund)
  978 + .loadLogger(LOGGER)
  979 + .loadSellerOrderGoods(sellerUid, skup)
  980 + .refund();
  981 + if (!refundGoodsMoneyFlag) {
  982 + ApiResponse apiResponse = new ApiResponse();
934 apiResponse.setCode(400); 983 apiResponse.setCode(400);
935 - apiResponse.setMessage("订单状态发生变化"); 984 + String content = "瑕疵不接受时,退用户" + sellerUid + "货款订单" + orderCode + "失败";
  985 + apiResponse.setMessage(content);
  986 + return apiResponse;
936 } 987 }
  988 +
  989 + //记录订单的状态变更信息
  990 + LOGGER.info("in miniFaultReject record status change, orderCode {},uid {} ,sellerUid {}", orderCode, buyerUid, sellerUid);
  991 + try {
  992 + //记录订单状态流转
  993 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetStatus.getCode());
  994 +
  995 + //瑕疵不接受(用户不接受和超时不接受),只给买家发消息
  996 + buyerNoticeFacade.miniFaultUnAccept(buyerOrder, sellerOrderGoods, outTimeFlag);
  997 + sellerNoticeFacade.sellerMiniFaultUnAccept(sellerOrderGoods, orderCode, outTimeFlag);
  998 +
  999 + } catch (Exception ex) {
  1000 + LOGGER.warn("in miniFaultReject orderStatusFlowService or notice fail orderCode {}", orderCode, ex);
  1001 + } finally {
  1002 + /// 物流信息异步执行
  1003 + executorService.execute(() -> {
  1004 +
  1005 + //记下订单的操作记录
  1006 + if (outTimeFlag) {
  1007 + //更新瑕疵确认结果
  1008 + int updateNum = qualityCheckMapper.updateByOrderCode(orderCode, EnumQualityCheckStatus.REJECT_BY_OUTER_TIME.getCode(), DateUtil.getCurrentTimeSecond());
  1009 + LOGGER.info("Buyer Order miniFaultReject by auto orderCode {} ,update quality check record status num {} ", orderCode, updateNum);
  1010 + orderOperateRecordService.addRecord(orderCode, "系统操作", OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT_BY_OUT_TIME);
  1011 + } else {
  1012 + //更新瑕疵确认结果
  1013 + int updateNum = qualityCheckMapper.updateByOrderCode(orderCode, EnumQualityCheckStatus.REJECT_BY_BUYER.getCode(), DateUtil.getCurrentTimeSecond());
  1014 + LOGGER.info("Buyer Order miniFaultReject by buyer orderCode {} ,update quality check record status num {} ", orderCode, updateNum);
  1015 + orderOperateRecordService.addRecord(orderCode, "买家操作", OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT);
  1016 + }
  1017 +
  1018 + //更新物流信息,写到最后
  1019 + //先补加一条鉴定中物流
  1020 + EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  1021 + EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
  1022 + EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_reject;
  1023 + expressInfoService.saveOperateTransferExpressInfo(sellerUid, orderCode, expressType.getCode(), expressDataType, operateTransferCode);
  1024 +
  1025 + operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_not_pass;
  1026 + expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  1027 + expressDataType = EnumExpressDataType.operate_transfer;
  1028 + expressInfoService.saveOperateTransferExpressInfo(sellerUid, orderCode, expressType.getCode(), expressDataType, operateTransferCode);
  1029 + });
  1030 +
  1031 + }
  1032 + ApiResponse apiResponse = new ApiResponse();
937 return apiResponse; 1033 return apiResponse;
938 } 1034 }
939 1035