Merge branch 'test6.9.10' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.10
Showing
12 changed files
with
187 additions
and
70 deletions
@@ -16,5 +16,5 @@ public interface OrdersPayRefundMapper { | @@ -16,5 +16,5 @@ public interface OrdersPayRefundMapper { | ||
16 | //查看部分退款记录是否存在 -- (新) | 16 | //查看部分退款记录是否存在 -- (新) |
17 | OrdersPayRefund selectByRefundCode(@Param("refundCode") String refundCode); | 17 | OrdersPayRefund selectByRefundCode(@Param("refundCode") String refundCode); |
18 | 18 | ||
19 | - List<OrdersPayRefund> selectByRefundCodes(@Param("refundCodes") Collection<String> refundCode); | 19 | + List<OrdersPayRefund> selectByRefundCodes(@Param("refundOrderCodes") Collection<String> refundCode); |
20 | } | 20 | } |
@@ -42,8 +42,8 @@ | @@ -42,8 +42,8 @@ | ||
42 | select | 42 | select |
43 | <include refid="Base_Column_List" /> | 43 | <include refid="Base_Column_List" /> |
44 | from orders_pay_refund | 44 | from orders_pay_refund |
45 | - where refund_order_code in | ||
46 | - <foreach collection="refundOrderCodes" open="(" close=")" separator="," item="refundOrderCode"> | 45 | + where refund_code in |
46 | + <foreach collection="refundOrderCodes" open="(" close=")" separator="," item="refundCode"> | ||
47 | #{refundCode,jdbcType=VARCHAR} | 47 | #{refundCode,jdbcType=VARCHAR} |
48 | </foreach> | 48 | </foreach> |
49 | </select> | 49 | </select> |
1 | package com.yohoufo.order.controller; | 1 | package com.yohoufo.order.controller; |
2 | 2 | ||
3 | import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; | 3 | import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; |
4 | +import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; | ||
4 | import com.yohoufo.common.ApiResponse; | 5 | import com.yohoufo.common.ApiResponse; |
5 | import com.yohoufo.common.annotation.IgnoreSession; | 6 | import com.yohoufo.common.annotation.IgnoreSession; |
6 | import com.yohoufo.common.annotation.IgnoreSignature; | 7 | import com.yohoufo.common.annotation.IgnoreSignature; |
@@ -9,8 +10,11 @@ import com.yohoufo.common.lock.RedisLock; | @@ -9,8 +10,11 @@ import com.yohoufo.common.lock.RedisLock; | ||
9 | import com.yohoufo.common.lock.RedisLockFactory; | 10 | import com.yohoufo.common.lock.RedisLockFactory; |
10 | import com.yohoufo.common.utils.ExecutorServiceUtils; | 11 | import com.yohoufo.common.utils.ExecutorServiceUtils; |
11 | import com.yohoufo.order.model.request.TransferMoneyRequest; | 12 | import com.yohoufo.order.model.request.TransferMoneyRequest; |
13 | +import com.yohoufo.order.service.IPaymentService; | ||
14 | +import com.yohoufo.order.service.impl.PaymentServiceImpl; | ||
12 | import com.yohoufo.order.service.impl.TransferService; | 15 | import com.yohoufo.order.service.impl.TransferService; |
13 | import com.yohoufo.order.utils.NamedThreadFactory; | 16 | import com.yohoufo.order.utils.NamedThreadFactory; |
17 | +import lombok.Data; | ||
14 | import lombok.extern.slf4j.Slf4j; | 18 | import lombok.extern.slf4j.Slf4j; |
15 | import org.apache.commons.lang3.RandomUtils; | 19 | import org.apache.commons.lang3.RandomUtils; |
16 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
19 | import org.springframework.web.bind.annotation.RequestParam; | 23 | import org.springframework.web.bind.annotation.RequestParam; |
20 | import org.springframework.web.bind.annotation.RestController; | 24 | import org.springframework.web.bind.annotation.RestController; |
21 | 25 | ||
26 | +import java.math.BigDecimal; | ||
22 | import java.util.UUID; | 27 | import java.util.UUID; |
23 | import java.util.concurrent.ArrayBlockingQueue; | 28 | import java.util.concurrent.ArrayBlockingQueue; |
24 | import java.util.concurrent.ExecutorService; | 29 | import java.util.concurrent.ExecutorService; |
@@ -35,6 +40,9 @@ public class OrderHelpController { | @@ -35,6 +40,9 @@ public class OrderHelpController { | ||
35 | private TransferService transferService; | 40 | private TransferService transferService; |
36 | 41 | ||
37 | @Autowired | 42 | @Autowired |
43 | + private PaymentServiceImpl paymentService; | ||
44 | + | ||
45 | + @Autowired | ||
38 | private RedisLockFactory redisLockFactory; | 46 | private RedisLockFactory redisLockFactory; |
39 | 47 | ||
40 | /** | 48 | /** |
@@ -57,6 +65,28 @@ public class OrderHelpController { | @@ -57,6 +65,28 @@ public class OrderHelpController { | ||
57 | @IgnoreSession | 65 | @IgnoreSession |
58 | @IgnoreSignature | 66 | @IgnoreSignature |
59 | @InnerApi | 67 | @InnerApi |
68 | + @RequestMapping(value = "/transAllEarnest") | ||
69 | + public ApiResponse transAllEarnest(@RequestBody TransferAllEarnestRequest req) { | ||
70 | + return new ApiResponse.ApiResponseBuilder() | ||
71 | + .code(200) | ||
72 | + .message(paymentService.transAllEarnest(req.getOrderCode(), req.getUid(), req.getAmount(), req.getAliPayAccount()) ? "ok" : "ko") | ||
73 | + .build(); | ||
74 | + } | ||
75 | + | ||
76 | + @Data | ||
77 | + public static class TransferAllEarnestRequest { | ||
78 | + long orderCode; | ||
79 | + Integer uid; | ||
80 | + BigDecimal amount; | ||
81 | + AuthorizeResultRespVO aliPayAccount; | ||
82 | + } | ||
83 | + | ||
84 | + /** | ||
85 | + * 转账 | ||
86 | + */ | ||
87 | + @IgnoreSession | ||
88 | + @IgnoreSignature | ||
89 | + @InnerApi | ||
60 | @RequestMapping(value = "/lock") | 90 | @RequestMapping(value = "/lock") |
61 | public ApiResponse lock(String key, @RequestParam(required = false, defaultValue = "100") int taskNum) { | 91 | public ApiResponse lock(String key, @RequestParam(required = false, defaultValue = "100") int taskNum) { |
62 | ExecutorService executorService = new ThreadPoolExecutor(5, 10, | 92 | ExecutorService executorService = new ThreadPoolExecutor(5, 10, |
1 | package com.yohoufo.order.service; | 1 | package com.yohoufo.order.service; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | +import com.google.common.collect.Lists; | ||
4 | import com.yoho.error.ServiceError; | 5 | import com.yoho.error.ServiceError; |
5 | import com.yoho.error.exception.ServiceException; | 6 | import com.yoho.error.exception.ServiceException; |
6 | import com.yohobuy.ufo.model.order.bo.OrderInfo; | 7 | import com.yohobuy.ufo.model.order.bo.OrderInfo; |
@@ -137,18 +138,30 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { | @@ -137,18 +138,30 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { | ||
137 | } | 138 | } |
138 | return false; | 139 | return false; |
139 | } | 140 | } |
141 | + private static final List<Integer> canRefundStatusListOfPaidAppraiseOrder = Lists.newArrayList( | ||
142 | + AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode() | ||
143 | + ); | ||
140 | 144 | ||
141 | - final static List<Integer> canRefundStatusList = Arrays.asList(AppraiseOrderStatus.WAITING_PAY.getCode(), | ||
142 | - AppraiseOrderStatus.HAS_PAYED.getCode()); | 145 | + |
146 | + private static final List<Integer> canRefundStatusListOfDepositOrder = Lists.newArrayList( | ||
147 | + AppraiseOrderStatus.HAS_PAYED.getCode(), | ||
148 | + AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode(), | ||
149 | + AppraiseOrderStatus.JUDGE_PASS_WAIT_WAREHOUSE.getCode(), | ||
150 | + AppraiseOrderStatus.SHAM_SEND_OUT.getCode(), | ||
151 | + AppraiseOrderStatus.SEND_OUT_TIMEOUT.getCode() | ||
152 | + ); | ||
143 | 153 | ||
144 | @Override | 154 | @Override |
145 | public boolean canRefund(OrderInfo orderInfo) { | 155 | public boolean canRefund(OrderInfo orderInfo) { |
146 | OrderAttributes oa = OrderAttributes.getOrderAttributes(orderInfo.getAttributes()); | 156 | OrderAttributes oa = OrderAttributes.getOrderAttributes(orderInfo.getAttributes()); |
147 | switch (oa){ | 157 | switch (oa){ |
148 | case APPRAISE: | 158 | case APPRAISE: |
159 | + if (canRefundStatusListOfPaidAppraiseOrder.contains(orderInfo.getStatus())){ | ||
160 | + return true; | ||
161 | + } | ||
149 | throw new UfoServiceException(400, "鉴定订单暂不支持退款"); | 162 | throw new UfoServiceException(400, "鉴定订单暂不支持退款"); |
150 | case DEPOSITE: | 163 | case DEPOSITE: |
151 | - if (orderInfo.getStatus() != null && canRefundStatusList.contains(orderInfo.getStatus().intValue())){ | 164 | + if (orderInfo.getStatus() != null && canRefundStatusListOfDepositOrder.contains(orderInfo.getStatus().intValue())){ |
152 | return true; | 165 | return true; |
153 | } | 166 | } |
154 | break; | 167 | break; |
@@ -122,7 +122,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { | @@ -122,7 +122,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { | ||
122 | expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; | 122 | expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; |
123 | 123 | ||
124 | int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); | 124 | int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); |
125 | - logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows); | 125 | + logger.info("appraise order unsure update status, orderCode {} rows {}", orderCode, rows); |
126 | return rows; | 126 | return rows; |
127 | } | 127 | } |
128 | 128 | ||
@@ -133,7 +133,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { | @@ -133,7 +133,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { | ||
133 | expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT; | 133 | expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT; |
134 | 134 | ||
135 | int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); | 135 | int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); |
136 | - logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows); | 136 | + logger.info("appraise order shamDeliver update status, orderCode {} rows {}", orderCode, rows); |
137 | return rows; | 137 | return rows; |
138 | } | 138 | } |
139 | 139 | ||
@@ -144,7 +144,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { | @@ -144,7 +144,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { | ||
144 | expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; | 144 | expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; |
145 | 145 | ||
146 | int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); | 146 | int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); |
147 | - logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows); | 147 | + logger.info("appraise order findFlaw update status, orderCode {} rows {}", orderCode, rows); |
148 | return rows; | 148 | return rows; |
149 | } | 149 | } |
150 | } | 150 | } |
@@ -19,10 +19,7 @@ import com.yohoufo.common.utils.DateUtil; | @@ -19,10 +19,7 @@ import com.yohoufo.common.utils.DateUtil; | ||
19 | import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; | 19 | import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; |
20 | import com.yohoufo.dal.order.AppraiseOrderMapper; | 20 | import com.yohoufo.dal.order.AppraiseOrderMapper; |
21 | import com.yohoufo.dal.order.AppraiseOrderMetaMapper; | 21 | import com.yohoufo.dal.order.AppraiseOrderMetaMapper; |
22 | -import com.yohoufo.dal.order.model.AppraiseOrder; | ||
23 | -import com.yohoufo.dal.order.model.AppraiseOrderGoods; | ||
24 | -import com.yohoufo.dal.order.model.AppraiseOrderMeta; | ||
25 | -import com.yohoufo.dal.order.model.QiniuLiveRecord; | 22 | +import com.yohoufo.dal.order.model.*; |
26 | import com.yohoufo.order.common.ClientType; | 23 | import com.yohoufo.order.common.ClientType; |
27 | import com.yohoufo.order.constants.MetaKey; | 24 | import com.yohoufo.order.constants.MetaKey; |
28 | import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor; | 25 | import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor; |
@@ -30,6 +27,7 @@ import com.yohoufo.order.convert.SellerOrderConvertor; | @@ -30,6 +27,7 @@ import com.yohoufo.order.convert.SellerOrderConvertor; | ||
30 | import com.yohoufo.order.model.dto.AppraiseOrderContext; | 27 | import com.yohoufo.order.model.dto.AppraiseOrderContext; |
31 | import com.yohoufo.order.service.IExpressInfoService; | 28 | import com.yohoufo.order.service.IExpressInfoService; |
32 | import com.yohoufo.order.service.IGoodsService; | 29 | import com.yohoufo.order.service.IGoodsService; |
30 | +import com.yohoufo.order.service.handler.GoodsServiceRefundHandler; | ||
33 | import com.yohoufo.order.service.proxy.InBoxFacade; | 31 | import com.yohoufo.order.service.proxy.InBoxFacade; |
34 | import com.yohoufo.order.service.proxy.ProductProxyService; | 32 | import com.yohoufo.order.service.proxy.ProductProxyService; |
35 | import com.yohoufo.order.service.proxy.UserProxyService; | 33 | import com.yohoufo.order.service.proxy.UserProxyService; |
@@ -86,6 +84,9 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | @@ -86,6 +84,9 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | ||
86 | @Autowired | 84 | @Autowired |
87 | private InBoxFacade inBoxFacade; | 85 | private InBoxFacade inBoxFacade; |
88 | 86 | ||
87 | + @Autowired | ||
88 | + private PayRefundService payRefundService; | ||
89 | + | ||
89 | 90 | ||
90 | public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ | 91 | public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ |
91 | logger.info("in AppraiseOrderService.compute req {}", req); | 92 | logger.info("in AppraiseOrderService.compute req {}", req); |
@@ -410,6 +411,7 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | @@ -410,6 +411,7 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | ||
410 | return rows; | 411 | return rows; |
411 | } | 412 | } |
412 | 413 | ||
414 | + | ||
413 | /** | 415 | /** |
414 | * 无法鉴别 | 416 | * 无法鉴别 |
415 | * @param appraiseOrder | 417 | * @param appraiseOrder |
@@ -418,8 +420,20 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | @@ -418,8 +420,20 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | ||
418 | public int unsure(AppraiseOrder appraiseOrder){ | 420 | public int unsure(AppraiseOrder appraiseOrder){ |
419 | int rows; | 421 | int rows; |
420 | if ((rows=super.unsure(appraiseOrder))>0){ | 422 | if ((rows=super.unsure(appraiseOrder))>0){ |
423 | + Integer uid = appraiseOrder.getUid(); | ||
424 | + Long orderCode = appraiseOrder.getOrderCode(); | ||
425 | + | ||
426 | + new GoodsServiceRefundHandler() | ||
427 | + .loadLogger(logger) | ||
428 | + .loadUser(uid) | ||
429 | + .loadActionCase(SellerWalletDetail.Type.APPRAISE_UNSURE) | ||
430 | + .loadRefundAction(payRefundService::refund) | ||
431 | + .loadOrder(orderCode, orderCode, appraiseOrder.getPayment(), appraiseOrder.getAmount()) | ||
432 | + .refund(); | ||
433 | + | ||
434 | + | ||
421 | AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE; | 435 | AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE; |
422 | - inBoxFacade.paidAppraiseOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetStatus); | 436 | + inBoxFacade.paidAppraiseOrderNotice(uid, orderCode, targetStatus); |
423 | } | 437 | } |
424 | return rows; | 438 | return rows; |
425 | } | 439 | } |
@@ -1754,13 +1754,14 @@ public class AppraiseService { | @@ -1754,13 +1754,14 @@ public class AppraiseService { | ||
1754 | List<Integer> skupList = buyerOrderGoodses.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList()); | 1754 | List<Integer> skupList = buyerOrderGoodses.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList()); |
1755 | 1755 | ||
1756 | sellerOrderGoodsMapper.updateDeptNoBySkups(skupList, appraiseExpressInfoBo.getDepotNum()); | 1756 | sellerOrderGoodsMapper.updateDeptNoBySkups(skupList, appraiseExpressInfoBo.getDepotNum()); |
1757 | - expressRecordMapper.updateDeptNoByOrder(orderCodeList, EnumExpressType.EXPRESS_TYPE_1.getCode(), appraiseExpressInfoBo.getDepotNum()); | ||
1758 | 1757 | ||
1759 | productProxyService.setBatchDepotNum(skupList, appraiseExpressInfoBo.getDepotNum()); | 1758 | productProxyService.setBatchDepotNum(skupList, appraiseExpressInfoBo.getDepotNum()); |
1760 | } | 1759 | } |
1761 | 1760 | ||
1762 | // 更新鉴定订单的鉴定室 | 1761 | // 更新鉴定订单的鉴定室 |
1763 | appraiseOrderGoodsMapper.updateBatchDepotNo(orderCodeList, appraiseExpressInfoBo.getDepotNum()); | 1762 | appraiseOrderGoodsMapper.updateBatchDepotNo(orderCodeList, appraiseExpressInfoBo.getDepotNum()); |
1763 | + | ||
1764 | + expressRecordMapper.updateDeptNoByOrder(orderCodeList, EnumExpressType.EXPRESS_TYPE_1.getCode(), appraiseExpressInfoBo.getDepotNum()); | ||
1764 | } | 1765 | } |
1765 | } | 1766 | } |
1766 | 1767 |
@@ -546,7 +546,9 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -546,7 +546,9 @@ public class PaymentServiceImpl implements IPaymentService { | ||
546 | @Database(ForceMaster = true) | 546 | @Database(ForceMaster = true) |
547 | public boolean transAllEarnest(long orderCode, Integer uid, BigDecimal amount, | 547 | public boolean transAllEarnest(long orderCode, Integer uid, BigDecimal amount, |
548 | AuthorizeResultRespVO aliPayAccount) { | 548 | AuthorizeResultRespVO aliPayAccount) { |
549 | - logger.info("退还商家所有保证金,转账开始,orderCode = {}, uid={}, amount={}, alipayAccount={}", orderCode, uid, amount, aliPayAccount); | 549 | + |
550 | + String logTag = String.format("transfer all earnest {}-{}", orderCode, uid); | ||
551 | + logger.info("{}, amount is {} and alipay account is {}", logTag, amount, aliPayAccount); | ||
550 | 552 | ||
551 | int now = (int) (System.currentTimeMillis() / 1000); | 553 | int now = (int) (System.currentTimeMillis() / 1000); |
552 | // 查看是否已经有转账记录 | 554 | // 查看是否已经有转账记录 |
@@ -563,6 +565,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -563,6 +565,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
563 | TradeBills record = new TradeBills(); | 565 | TradeBills record = new TradeBills(); |
564 | record.setUid(uid); | 566 | record.setUid(uid); |
565 | record.setOrderCode(orderCode); | 567 | record.setOrderCode(orderCode); |
568 | + record.setPaidOrderCode(0L); | ||
566 | record.setUserType(2); | 569 | record.setUserType(2); |
567 | record.setPayType(1); | 570 | record.setPayType(1); |
568 | record.setTradeType(1); | 571 | record.setTradeType(1); |
@@ -574,7 +577,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -574,7 +577,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
574 | 577 | ||
575 | 578 | ||
576 | if (amount == null || amount.compareTo(new BigDecimal("0.1")) < 0) { | 579 | if (amount == null || amount.compareTo(new BigDecimal("0.1")) < 0) { |
577 | - logger.warn("transAllEarnestErr transferMon计算费用结果为 {}, 小于0.1或为null", amount); | 580 | + logger.warn("{}, amount {} less 0.1 or null", logTag, amount); |
578 | alarm("转账金额小于0.1或为null", "ufo.order.transAllEarnest", "退还商家入驻所有金额,订单号:" + orderCode + "操作类型(" + 6 + ")计算金额结果为" + amount); | 581 | alarm("转账金额小于0.1或为null", "ufo.order.transAllEarnest", "退还商家入驻所有金额,订单号:" + orderCode + "操作类型(" + 6 + ")计算金额结果为" + amount); |
579 | record.setTradeStatus(BillTradeStatus.AMOUNT_IS_ILLEGAL.getCode()); | 582 | record.setTradeStatus(BillTradeStatus.AMOUNT_IS_ILLEGAL.getCode()); |
580 | addTradeBills(record); | 583 | addTradeBills(record); |
@@ -582,20 +585,20 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -582,20 +585,20 @@ public class PaymentServiceImpl implements IPaymentService { | ||
582 | } | 585 | } |
583 | 586 | ||
584 | if (StringUtils.isBlank(aliPayAccount.getAlipayAccount()) && StringUtils.isBlank(aliPayAccount.getAlipayId())) { | 587 | if (StringUtils.isBlank(aliPayAccount.getAlipayAccount()) && StringUtils.isBlank(aliPayAccount.getAlipayId())) { |
585 | - logger.warn("transAllEarnestErr uid {} 支付宝账号不合法", account); | 588 | + logger.warn("{}, alipay account is not exist", logTag); |
586 | record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALIPAY_ACCOUNT.getCode()); | 589 | record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALIPAY_ACCOUNT.getCode()); |
587 | addTradeBills(record); | 590 | addTradeBills(record); |
588 | throw new ServiceException(400, "uid[" + uid + "]支付宝账号不合法"); | 591 | throw new ServiceException(400, "uid[" + uid + "]支付宝账号不合法"); |
589 | } | 592 | } |
590 | 593 | ||
591 | - logger.info("transAllEarnest参数检查成功!"); | 594 | + logger.info("{}, data check ok.", logTag); |
592 | tradeBillsMapper.insert(record); | 595 | tradeBillsMapper.insert(record); |
593 | // 转账 | 596 | // 转账 |
594 | JSONObject jsonObject = null; | 597 | JSONObject jsonObject = null; |
595 | boolean exceedMillionAndSuccess = false; | 598 | boolean exceedMillionAndSuccess = false; |
596 | transfer.setUpdateTime(now); | 599 | transfer.setUpdateTime(now); |
597 | try { | 600 | try { |
598 | - logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount); | 601 | + logger.info("{}, transfer start", logTag); |
599 | shoppingRiskWatchDog.checkAlipayBlackUser(aliPayAccount.getUid(), aliPayAccount); | 602 | shoppingRiskWatchDog.checkAlipayBlackUser(aliPayAccount.getUid(), aliPayAccount); |
600 | if (alipayTransferChancelSelector.isTransferWithAlipayExceedMillionTransfer()) { | 603 | if (alipayTransferChancelSelector.isTransferWithAlipayExceedMillionTransfer()) { |
601 | transfer.setInterfaceType(2); | 604 | transfer.setInterfaceType(2); |
@@ -615,7 +618,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -615,7 +618,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
615 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); | 618 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); |
616 | jsonObject = alipayService.transferMoney(Long.toString(orderCode), aliPayAccount.getAlipayId(), aliPayAccount.getAlipayAccount(), amount); | 619 | jsonObject = alipayService.transferMoney(Long.toString(orderCode), aliPayAccount.getAlipayId(), aliPayAccount.getAlipayAccount(), amount); |
617 | if (jsonObject == null) { | 620 | if (jsonObject == null) { |
618 | - logger.warn("transAllEarnestErr 转账失败 , orderCode is {}", orderCode); | 621 | + logger.warn("{}, transfer fail.", logTag); |
619 | transfer.setStatus(3); | 622 | transfer.setStatus(3); |
620 | throw new ServiceException(500, "转账失败:阿里接口返回null"); | 623 | throw new ServiceException(500, "转账失败:阿里接口返回null"); |
621 | } | 624 | } |
@@ -627,7 +630,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -627,7 +630,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
627 | && (code = jsonObject.getInteger("code")) == 10000 | 630 | && (code = jsonObject.getInteger("code")) == 10000 |
628 | && jsonObject.containsKey("order_id") | 631 | && jsonObject.containsKey("order_id") |
629 | && StringUtils.isNotBlank(orderId = jsonObject.getString("order_id"))) { | 632 | && StringUtils.isNotBlank(orderId = jsonObject.getString("order_id"))) { |
630 | - logger.info("转账成功,targeAccount is {}, amount is {}", account, amount); | 633 | + logger.info("{}, transfer success, account is {}, amount is {}", logTag, account, amount); |
631 | transfer.setAlipayTradeId(orderId); | 634 | transfer.setAlipayTradeId(orderId); |
632 | transfer.setStatus(1); | 635 | transfer.setStatus(1); |
633 | return true; | 636 | return true; |
@@ -644,16 +647,15 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -644,16 +647,15 @@ public class PaymentServiceImpl implements IPaymentService { | ||
644 | return true; | 647 | return true; |
645 | } | 648 | } |
646 | } else { | 649 | } else { |
647 | - logger.warn("transAllEarnestErr 返回code或者order_id不是成功状态,code={}, orderId={}", code, orderId); | 650 | + logger.warn("{}, transfer fail, return_code is {} and return_order_id is {}", logTag, code, orderId); |
648 | throw new ServiceException(500, "转账失败:code或者order_id不是成功状态"); | 651 | throw new ServiceException(500, "转账失败:code或者order_id不是成功状态"); |
649 | } | 652 | } |
650 | } catch (Exception e) { | 653 | } catch (Exception e) { |
651 | - logger.warn("transAllEarnestErr 转账失败 , orderCode is {}, msg is {}", orderCode, e.getMessage()); | 654 | + logger.warn("{}, transfer fail", logTag, e); |
652 | String alarmMsg = "订单号:" + orderCode + ",操作类型(商家退出入驻退保证金),msg=" + e.getMessage(); | 655 | String alarmMsg = "订单号:" + orderCode + ",操作类型(商家退出入驻退保证金),msg=" + e.getMessage(); |
653 | if (jsonObject != null) { | 656 | if (jsonObject != null) { |
654 | alarmMsg += ",阿里返回DETAIL=" + jsonObject.toJSONString(); | 657 | alarmMsg += ",阿里返回DETAIL=" + jsonObject.toJSONString(); |
655 | } | 658 | } |
656 | - logger.info("transAllEarnestErr 转账失败 , alarmMsg is {}", alarmMsg); | ||
657 | alarm("转账失败", "ufo.order.transAllEarnest", alarmMsg); | 659 | alarm("转账失败", "ufo.order.transAllEarnest", alarmMsg); |
658 | transfer.setStatus(3); | 660 | transfer.setStatus(3); |
659 | if (e instanceof ServiceException) { | 661 | if (e instanceof ServiceException) { |
@@ -663,17 +665,17 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -663,17 +665,17 @@ public class PaymentServiceImpl implements IPaymentService { | ||
663 | } | 665 | } |
664 | } finally { | 666 | } finally { |
665 | if (exceedMillionAndSuccess) { | 667 | if (exceedMillionAndSuccess) { |
666 | - logger.info("transferMon exceedMillion,转账结束,等待回调 orderCode is {}!", orderCode); | 668 | + logger.info("{}, transfer exceed million waiting...", logTag); |
667 | return true; | 669 | return true; |
668 | } | 670 | } |
669 | - logger.info("transAllEarnest最后更新状态 status= {}", transfer.getStatus()); | 671 | + logger.info("{}, transfer end update status to {}", logTag, transfer.getStatus()); |
670 | transfer.setUpdateTime(now); | 672 | transfer.setUpdateTime(now); |
671 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); | 673 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); |
672 | // 100:成功;201:没有支付宝账号;202:金额不合法;299:转账失败 | 674 | // 100:成功;201:没有支付宝账号;202:金额不合法;299:转账失败 |
673 | BillTradeStatus bts = transfer.getStatus() == 1 ? BillTradeStatus.SUCCESS : BillTradeStatus.TRANSFER_FAIL; | 675 | BillTradeStatus bts = transfer.getStatus() == 1 ? BillTradeStatus.SUCCESS : BillTradeStatus.TRANSFER_FAIL; |
674 | record.setTradeStatus(bts.getCode()); | 676 | record.setTradeStatus(bts.getCode()); |
675 | tradeBillsMapper.updateSelectiveByPrimaryKey(record); | 677 | tradeBillsMapper.updateSelectiveByPrimaryKey(record); |
676 | - logger.info("transAllEarnest最后更新状态完成,转账结束, orderCode is {}!", orderCode); | 678 | + logger.info("{}, transfer end update status to {} ok", logTag, transfer.getStatus()); |
677 | } | 679 | } |
678 | } | 680 | } |
679 | 681 | ||
@@ -1364,6 +1366,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1364,6 +1366,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1364 | TradeBills record = new TradeBills(); | 1366 | TradeBills record = new TradeBills(); |
1365 | record.setUid(targetUid); | 1367 | record.setUid(targetUid); |
1366 | record.setOrderCode(buyerOrderCode); | 1368 | record.setOrderCode(buyerOrderCode); |
1369 | + record.setPaidOrderCode(0L); | ||
1367 | record.setUserType(targetUserType.getCode()); | 1370 | record.setUserType(targetUserType.getCode()); |
1368 | record.setPayType(1); | 1371 | record.setPayType(1); |
1369 | // 如果[全部货款->卖家],否则[补偿款->卖家或买家] 2:货款;3:补偿款 | 1372 | // 如果[全部货款->卖家],否则[补偿款->卖家或买家] 2:货款;3:补偿款 |
@@ -3,13 +3,18 @@ package com.yohoufo.order.service.impl; | @@ -3,13 +3,18 @@ package com.yohoufo.order.service.impl; | ||
3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
5 | import com.yohoufo.common.alarm.CommonAlarmEventPublisher; | 5 | import com.yohoufo.common.alarm.CommonAlarmEventPublisher; |
6 | +import com.yohoufo.common.utils.BigDecimalHelper; | ||
7 | +import com.yohoufo.dal.order.AppraiseOrderMetaMapper; | ||
6 | import com.yohoufo.dal.order.SellerOrderMetaMapper; | 8 | import com.yohoufo.dal.order.SellerOrderMetaMapper; |
7 | import com.yohoufo.dal.order.TradeBillsMapper; | 9 | import com.yohoufo.dal.order.TradeBillsMapper; |
10 | +import com.yohoufo.dal.order.model.AppraiseOrderMeta; | ||
8 | import com.yohoufo.dal.order.model.SellerOrder; | 11 | import com.yohoufo.dal.order.model.SellerOrder; |
9 | import com.yohoufo.dal.order.model.SellerOrderMeta; | 12 | import com.yohoufo.dal.order.model.SellerOrderMeta; |
10 | import com.yohoufo.dal.order.model.TradeBills; | 13 | import com.yohoufo.dal.order.model.TradeBills; |
11 | import com.yohobuy.ufo.model.order.common.Payment; | 14 | import com.yohobuy.ufo.model.order.common.Payment; |
12 | import com.yohoufo.order.common.BillTradeStatus; | 15 | import com.yohoufo.order.common.BillTradeStatus; |
16 | +import com.yohoufo.order.constants.MetaKey; | ||
17 | +import com.yohoufo.order.model.dto.SellerOrderComputeResult; | ||
13 | import org.slf4j.Logger; | 18 | import org.slf4j.Logger; |
14 | import org.slf4j.LoggerFactory; | 19 | import org.slf4j.LoggerFactory; |
15 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -33,6 +38,12 @@ public class TradeBillsService { | @@ -33,6 +38,12 @@ public class TradeBillsService { | ||
33 | @Autowired | 38 | @Autowired |
34 | TradeBillsMapper tradeBillsMapper; | 39 | TradeBillsMapper tradeBillsMapper; |
35 | 40 | ||
41 | + @Autowired | ||
42 | + private ServiceOrderProcessor serviceOrderProcessor; | ||
43 | + | ||
44 | + @Autowired | ||
45 | + private AppraiseOrderMetaMapper appraiseOrderMetaMapper; | ||
46 | + | ||
36 | /** | 47 | /** |
37 | * 退保证金流水记录 | 48 | * 退保证金流水记录 |
38 | * | 49 | * |
@@ -42,54 +53,88 @@ public class TradeBillsService { | @@ -42,54 +53,88 @@ public class TradeBillsService { | ||
42 | * @param payType | 53 | * @param payType |
43 | * @param tradeStatus | 54 | * @param tradeStatus |
44 | */ | 55 | */ |
45 | - public void backPayEnsureRecord(Integer uid, Integer skup, Long orderCode, Integer payType, Integer tradeStatus) { | ||
46 | - backPayEnsureRecord(uid, skup, orderCode, payType, tradeStatus, null, null); | ||
47 | - } | 56 | + public void backPayEnsureRecord(Integer uid, |
57 | + Integer skup, | ||
58 | + Long orderCode, | ||
59 | + Integer payType, | ||
60 | + Integer tradeStatus) { | ||
48 | 61 | ||
49 | - public void backPayEnsureRecord(SellerOrder sellerOrder, Integer tradeStatus, BigDecimal backEarnestMoney, SellerOrderMeta meta) { | ||
50 | - backPayEnsureRecord(sellerOrder.getUid(), sellerOrder.getSkup(), sellerOrder.getOrderCode(), sellerOrder.getPayment(), tradeStatus, backEarnestMoney, meta); | ||
51 | - } | ||
52 | 62 | ||
53 | - private void backPayEnsureRecord(Integer uid, Integer skup, Long orderCode, Integer payType, | ||
54 | - Integer tradeStatus, | ||
55 | - BigDecimal backEarnestMoney, SellerOrderMeta meta) { | ||
56 | - if (payType != null && Payment.WALLET.getCode() == payType) { | 63 | + String computeResultVal = null; |
64 | + | ||
65 | + if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){ | ||
66 | + AppraiseOrderMeta feeCondition = new AppraiseOrderMeta(); | ||
67 | + feeCondition.setOrderCode(orderCode); | ||
68 | + feeCondition.setMetaKey(MetaKey.SELLER_FEE); | ||
69 | + AppraiseOrderMeta feeMeta = appraiseOrderMetaMapper.selectByOrderCode(feeCondition); | ||
70 | + computeResultVal = Objects.nonNull(feeMeta) ? feeMeta.getMetaValue() : null; | ||
71 | + logger.info("in backPayEnsureRecord isGoodsServiceOrder orderCode {} computeResultVal {}", orderCode, computeResultVal); | ||
72 | + }else { | ||
73 | + SellerOrderMeta meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, MetaKey.SELLER_FEE); | ||
74 | + computeResultVal = Objects.nonNull(meta) ? meta.getMetaValue() : null; | ||
75 | + logger.info("in backPayEnsureRecord buyerorder orderCode {} computeResultVal {}", orderCode, computeResultVal); | ||
76 | + } | ||
77 | + | ||
78 | + if (Objects.isNull(computeResultVal)) { | ||
79 | + logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, skup={}", uid, skup); | ||
57 | return; | 80 | return; |
58 | } | 81 | } |
59 | - if (Objects.isNull(meta)) { | ||
60 | - meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, "fee"); | 82 | + try{ |
83 | + SellerOrderComputeResult socr = JSONObject.parseObject(computeResultVal, SellerOrderComputeResult.class); | ||
84 | + BigDecimal earnestMoney = socr.getEarnestMoney().getEarnestMoney(); | ||
85 | + BigDecimal systemAmount = calSystemAmountByComputeResult(socr); | ||
86 | + backPayEnsureRecord0(uid, orderCode, payType, tradeStatus, earnestMoney, systemAmount); | ||
87 | + | ||
88 | + }catch (Exception ex){ | ||
89 | + logger.error("backPayEnsureRecord error, uid {},orderCode {} computeResultVal {}", | ||
90 | + uid, orderCode, computeResultVal, ex); | ||
61 | } | 91 | } |
62 | - if (Objects.isNull(meta)) { | ||
63 | - logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, skup={}", uid, skup); | 92 | + |
93 | + | ||
94 | + } | ||
95 | + | ||
96 | + | ||
97 | + private void backPayEnsureRecord0(Integer uid, | ||
98 | + Long orderCode, | ||
99 | + Integer payType, | ||
100 | + Integer tradeStatus, | ||
101 | + BigDecimal earnestMoney, | ||
102 | + BigDecimal systemAmount | ||
103 | + ) { | ||
104 | + if (payType != null && Payment.WALLET.getCode() == payType) { | ||
64 | return; | 105 | return; |
65 | } | 106 | } |
107 | + | ||
108 | + | ||
66 | // 增加流水记录 | 109 | // 增加流水记录 |
67 | TradeBills record = new TradeBills(); | 110 | TradeBills record = new TradeBills(); |
68 | record.setUid(uid); | 111 | record.setUid(uid); |
69 | record.setOrderCode(orderCode); | 112 | record.setOrderCode(orderCode); |
113 | + record.setPaidOrderCode(0L); | ||
70 | record.setUserType(2);// 1:买家uid; 2:卖家uid | 114 | record.setUserType(2);// 1:买家uid; 2:卖家uid |
71 | record.setPayType(payType);// 1:支付宝; 2:微信 | 115 | record.setPayType(payType);// 1:支付宝; 2:微信 |
72 | record.setTradeType(1);//1:保证金;2:货款;3:补偿款 | 116 | record.setTradeType(1);//1:保证金;2:货款;3:补偿款 |
73 | record.setIncomeOutcome(1);// 1:用户收入; 2:用户支出 | 117 | record.setIncomeOutcome(1);// 1:用户收入; 2:用户支出 |
74 | - BigDecimal earnestMoney = backEarnestMoney; | ||
75 | - BigDecimal amount = BigDecimal.ZERO; | ||
76 | - try { | ||
77 | - JSONObject metavalue = JSON.parseObject(meta.getMetaValue()); | ||
78 | - BigDecimal rate = metavalue.getJSONObject("serviceFeeRate").getBigDecimal("payChannelRate"); | ||
79 | - if (Objects.isNull(earnestMoney)) { | ||
80 | - earnestMoney = metavalue.getJSONObject("earnestMoney").getBigDecimal("earnestMoney"); | ||
81 | - } | ||
82 | - amount = earnestMoney.multiply(BigDecimal.ONE.subtract(rate)).multiply(new BigDecimal("-1")).setScale(2, BigDecimal.ROUND_HALF_UP); | ||
83 | - } catch (Exception e) { | ||
84 | - logger.error("PayRecordErr计费信息不完整, uid is {}, skup is {}, err is {}", uid, skup, e.getMessage()); | ||
85 | - } | ||
86 | record.setAmount(earnestMoney); | 118 | record.setAmount(earnestMoney); |
87 | - record.setSystemAmount(amount);// 有货收入 | 119 | + record.setSystemAmount(systemAmount);// 有货收入 |
88 | record.setTradeStatus(tradeStatus);//0:订单未完结;1:订单完结 | 120 | record.setTradeStatus(tradeStatus);//0:订单未完结;1:订单完结 |
89 | record.setCreateTime((int) (System.currentTimeMillis() / 1000)); | 121 | record.setCreateTime((int) (System.currentTimeMillis() / 1000)); |
90 | addTradeBills(record); | 122 | addTradeBills(record); |
91 | } | 123 | } |
92 | 124 | ||
125 | + | ||
126 | + BigDecimal calSystemAmountByComputeResult(SellerOrderComputeResult socr){ | ||
127 | + BigDecimal amount = BigDecimal.ZERO; | ||
128 | + try { | ||
129 | + BigDecimal rate = socr.getServiceFeeRate().getPayChannelRate(); | ||
130 | + BigDecimal earnestMoney = socr.getEarnestMoney().getEarnestMoney(); | ||
131 | + amount = BigDecimalHelper.halfUp(earnestMoney.multiply(BigDecimal.ONE.subtract(rate)).negate()); | ||
132 | + } catch (Exception e) { | ||
133 | + logger.warn("calSystemAmountByComputeResult fail SellerOrderComputeResult {}", socr); | ||
134 | + } | ||
135 | + return amount; | ||
136 | + } | ||
137 | + | ||
93 | /** | 138 | /** |
94 | * 退付货款流水记录 | 139 | * 退付货款流水记录 |
95 | * | 140 | * |
@@ -118,6 +163,7 @@ public class TradeBillsService { | @@ -118,6 +163,7 @@ public class TradeBillsService { | ||
118 | TradeBills record = new TradeBills(); | 163 | TradeBills record = new TradeBills(); |
119 | record.setUid(uid); | 164 | record.setUid(uid); |
120 | record.setOrderCode(orderCode); | 165 | record.setOrderCode(orderCode); |
166 | + record.setPaidOrderCode(0L); | ||
121 | record.setUserType(1);// 1:买家uid; 2:卖家uid | 167 | record.setUserType(1);// 1:买家uid; 2:卖家uid |
122 | record.setPayType(payType);// 1:支付宝; 2:微信 | 168 | record.setPayType(payType);// 1:支付宝; 2:微信 |
123 | record.setTradeType(2);//1:保证金;2:货款;3:补偿款 | 169 | record.setTradeType(2);//1:保证金;2:货款;3:补偿款 |
@@ -200,6 +246,7 @@ public class TradeBillsService { | @@ -200,6 +246,7 @@ public class TradeBillsService { | ||
200 | TradeBills record = new TradeBills(); | 246 | TradeBills record = new TradeBills(); |
201 | record.setUid(uid); | 247 | record.setUid(uid); |
202 | record.setOrderCode(orderCode); | 248 | record.setOrderCode(orderCode); |
249 | + record.setPaidOrderCode(0L); | ||
203 | record.setUserType(1);// 1:买家uid; 2:卖家uid | 250 | record.setUserType(1);// 1:买家uid; 2:卖家uid |
204 | record.setPayType(payType);// 1:支付宝; 2:微信 | 251 | record.setPayType(payType);// 1:支付宝; 2:微信 |
205 | record.setTradeType(2);//1:保证金;2:货款;3:补偿款 | 252 | record.setTradeType(2);//1:保证金;2:货款;3:补偿款 |
@@ -239,6 +286,7 @@ public class TradeBillsService { | @@ -239,6 +286,7 @@ public class TradeBillsService { | ||
239 | TradeBills record = new TradeBills(); | 286 | TradeBills record = new TradeBills(); |
240 | record.setUid(uid); | 287 | record.setUid(uid); |
241 | record.setOrderCode(orderCode); | 288 | record.setOrderCode(orderCode); |
289 | + record.setPaidOrderCode(0L); | ||
242 | record.setUserType(2);// 1:买家uid; 2:卖家uid | 290 | record.setUserType(2);// 1:买家uid; 2:卖家uid |
243 | record.setPayType(payType);// 1:支付宝; 2:微信 | 291 | record.setPayType(payType);// 1:支付宝; 2:微信 |
244 | record.setTradeType(1);//1:保证金;2:货款;3:补偿款 | 292 | record.setTradeType(1);//1:保证金;2:货款;3:补偿款 |
@@ -265,6 +313,7 @@ public class TradeBillsService { | @@ -265,6 +313,7 @@ public class TradeBillsService { | ||
265 | TradeBills record = new TradeBills(); | 313 | TradeBills record = new TradeBills(); |
266 | record.setUid(uid); | 314 | record.setUid(uid); |
267 | record.setOrderCode(orderCode); | 315 | record.setOrderCode(orderCode); |
316 | + record.setPaidOrderCode(0L); | ||
268 | record.setUserType(2);// 1:买家uid; 2:卖家uid | 317 | record.setUserType(2);// 1:买家uid; 2:卖家uid |
269 | record.setPayType(payType);// 1:支付宝; 2:微信 | 318 | record.setPayType(payType);// 1:支付宝; 2:微信 |
270 | record.setTradeType(1);//1:保证金;2:货款;3:补偿款 | 319 | record.setTradeType(1);//1:保证金;2:货款;3:补偿款 |
@@ -16,6 +16,7 @@ import com.yohobuy.ufo.model.order.vo.GoodsVo; | @@ -16,6 +16,7 @@ import com.yohobuy.ufo.model.order.vo.GoodsVo; | ||
16 | import com.yohobuy.ufo.model.order.vo.ProductVo; | 16 | import com.yohobuy.ufo.model.order.vo.ProductVo; |
17 | import com.yohoufo.common.helper.ImageUrlAssist; | 17 | import com.yohoufo.common.helper.ImageUrlAssist; |
18 | import com.yohoufo.common.utils.BigDecimalHelper; | 18 | import com.yohoufo.common.utils.BigDecimalHelper; |
19 | +import com.yohoufo.common.utils.DateUtil; | ||
19 | import com.yohoufo.dal.order.*; | 20 | import com.yohoufo.dal.order.*; |
20 | import com.yohoufo.dal.order.model.*; | 21 | import com.yohoufo.dal.order.model.*; |
21 | import com.yohoufo.order.constants.MetaKey; | 22 | import com.yohoufo.order.constants.MetaKey; |
@@ -200,6 +201,8 @@ public class SellerDepositOrderListService extends AbsOrderViewService { | @@ -200,6 +201,8 @@ public class SellerDepositOrderListService extends AbsOrderViewService { | ||
200 | .orderCode(pao.getOrderCode()) | 201 | .orderCode(pao.getOrderCode()) |
201 | .status(pao.getStatus()) | 202 | .status(pao.getStatus()) |
202 | .statuStr(appraiseOrderStatus.statusStr(oa)) | 203 | .statuStr(appraiseOrderStatus.statusStr(oa)) |
204 | + .payTime(DateUtil.formatYYMMddHHmmssPoint(pao.getCreateTime())) | ||
205 | + .payTime(DateUtil.formatYYMMddHHmmssPoint(ordersPayRefund.getCreateTime())) | ||
203 | .build(); | 206 | .build(); |
204 | 207 | ||
205 | return resp; | 208 | return resp; |
@@ -260,17 +260,19 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | @@ -260,17 +260,19 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | ||
260 | switch (appraiseOrderStatus){ | 260 | switch (appraiseOrderStatus){ |
261 | case WAITING_PAY: | 261 | case WAITING_PAY: |
262 | Payment payment = Payment.getPayment(pao.getPayment()); | 262 | Payment payment = Payment.getPayment(pao.getPayment()); |
263 | - AbstractPayService payService = paymentService.getPayService(payment.getCode()); | ||
264 | - PayQueryBo payQueryBo = payService.payQuery(String.valueOf(orderCode), pao.getCreateTime()); | ||
265 | - | ||
266 | - if (payQueryBo != null && payQueryBo.isPayStatus()){ | ||
267 | - logger.info("seller deposit order auto cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode); | ||
268 | - PayConfirmEvent event = new PayConfirmEvent(uid, orderCode, pao.getPayment()); | ||
269 | - EventBusPublisher.publishEvent(event); | ||
270 | - } | ||
271 | - // 如果近1分钟有预支付记录,则发送 自动取消延迟消息 | ||
272 | - if ( !orderCancelEvent.isFinalRetry()){ | ||
273 | - paymentService.checkPrePay(uid, orderCode); | 263 | + if (Objects.nonNull(payment)) { |
264 | + AbstractPayService payService = paymentService.getPayService(payment.getCode()); | ||
265 | + PayQueryBo payQueryBo = payService.payQuery(String.valueOf(orderCode), pao.getCreateTime()); | ||
266 | + | ||
267 | + if (payQueryBo != null && payQueryBo.isPayStatus()) { | ||
268 | + logger.info("seller deposit order auto cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode); | ||
269 | + PayConfirmEvent event = new PayConfirmEvent(uid, orderCode, pao.getPayment()); | ||
270 | + EventBusPublisher.publishEvent(event); | ||
271 | + } | ||
272 | + // 如果近1分钟有预支付记录,则发送 自动取消延迟消息 | ||
273 | + if (!orderCancelEvent.isFinalRetry()) { | ||
274 | + paymentService.checkPrePay(uid, orderCode); | ||
275 | + } | ||
274 | } | 276 | } |
275 | rows = super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_TIMEOUT, appraiseOrderStatus); | 277 | rows = super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_TIMEOUT, appraiseOrderStatus); |
276 | break; | 278 | break; |
@@ -768,6 +770,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | @@ -768,6 +770,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | ||
768 | } | 770 | } |
769 | 771 | ||
770 | public void triggerStatusConsistencyCheck(long orderCode){ | 772 | public void triggerStatusConsistencyCheck(long orderCode){ |
773 | + logger.info("triggerStatusConsistencyCheck orderCode {}", orderCode); | ||
771 | SellerDepositOrderStatusConsistencyAsyncEvent asyncEvent | 774 | SellerDepositOrderStatusConsistencyAsyncEvent asyncEvent |
772 | = new SellerDepositOrderStatusConsistencyAsyncEvent(this::detectAppraiseFinish); | 775 | = new SellerDepositOrderStatusConsistencyAsyncEvent(this::detectAppraiseFinish); |
773 | asyncEvent.setOrderCode(orderCode); | 776 | asyncEvent.setOrderCode(orderCode); |
@@ -8,7 +8,7 @@ import java.util.stream.Collectors; | @@ -8,7 +8,7 @@ import java.util.stream.Collectors; | ||
8 | import javax.annotation.Resource; | 8 | import javax.annotation.Resource; |
9 | 9 | ||
10 | import com.sun.org.apache.xpath.internal.operations.Bool; | 10 | import com.sun.org.apache.xpath.internal.operations.Bool; |
11 | -import com.yoho.tools.common.beans.ApiResponse; | 11 | +import com.yohoufo.common.ApiResponse; |
12 | import com.yohobuy.ufo.model.order.common.OrderCodeType; | 12 | import com.yohobuy.ufo.model.order.common.OrderCodeType; |
13 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; | 13 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; |
14 | import com.yohoufo.common.caller.UfoServiceCaller; | 14 | import com.yohoufo.common.caller.UfoServiceCaller; |
@@ -822,14 +822,15 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -822,14 +822,15 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
822 | Map<String, Object> resultMap = new HashMap<>(); | 822 | Map<String, Object> resultMap = new HashMap<>(); |
823 | if (isServiceOrder(orderCode)) { | 823 | if (isServiceOrder(orderCode)) { |
824 | AppraiseOrder order = appraiseOrderMapper.selectByOrderCode(orderCode); | 824 | AppraiseOrder order = appraiseOrderMapper.selectByOrderCode(orderCode); |
825 | + resultMap.put("status", order.getStatus()); | ||
825 | AppraiseOrderGoods goods = appraiseOrderGoodsMapper.selectOneByOrderCode(orderCode); | 826 | AppraiseOrderGoods goods = appraiseOrderGoodsMapper.selectOneByOrderCode(orderCode); |
826 | AppraiseOrderStorage storage = appraiseOrderStorageMapper.selectByOrderCode(orderCode); | 827 | AppraiseOrderStorage storage = appraiseOrderStorageMapper.selectByOrderCode(orderCode); |
827 | resultMap.put("image", goods == null ? "" : ImageUrlAssist.getAllProductPicUrl(goods.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); | 828 | resultMap.put("image", goods == null ? "" : ImageUrlAssist.getAllProductPicUrl(goods.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); |
828 | resultMap.put("productId", goods == null ? "" : goods.getProductId()); | 829 | resultMap.put("productId", goods == null ? "" : goods.getProductId()); |
829 | resultMap.put("productName", goods == null ? "" : goods.getProductName()); | 830 | resultMap.put("productName", goods == null ? "" : goods.getProductName()); |
830 | resultMap.put("productCode", goods == null ? "" : goods.getProductCode()); | 831 | resultMap.put("productCode", goods == null ? "" : goods.getProductCode()); |
831 | - resultMap.put("size", storage == null ? "" : storage.getSizeName()); | ||
832 | - resultMap.put("color", storage == null ? "" : storage.getColorName()); | 832 | + resultMap.put("size", storage == null ? "-" : storage.getSizeName()); |
833 | + resultMap.put("color", storage == null ? "-" : storage.getColorName()); | ||
833 | resultMap.put("uid", order == null ? "" : order.getUid()); | 834 | resultMap.put("uid", order == null ? "" : order.getUid()); |
834 | } else { | 835 | } else { |
835 | BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); | 836 | BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); |
@@ -860,7 +861,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -860,7 +861,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
860 | } | 861 | } |
861 | 862 | ||
862 | private boolean isServiceOrder(long orderCode) { | 863 | private boolean isServiceOrder(long orderCode) { |
863 | - ApiResponse<Boolean> resp = ufoServiceCaller.call("ufo.order.isServiceOrder", ApiResponse.class, orderCode); | 864 | + ApiResponse resp = ufoServiceCaller.call("ufo.order.isServiceOrder", ApiResponse.class, orderCode); |
864 | if (resp != null) { | 865 | if (resp != null) { |
865 | return (Boolean) resp.getData(); | 866 | return (Boolean) resp.getData(); |
866 | } | 867 | } |
-
Please register or login to post a comment