Merge branch 'test6.9.5' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.5
Showing
13 changed files
with
90 additions
and
118 deletions
@@ -26,8 +26,6 @@ public interface SellerWalletMapper { | @@ -26,8 +26,6 @@ public interface SellerWalletMapper { | ||
26 | 26 | ||
27 | SellerWallet selectByUidNType(SellerWallet condition); | 27 | SellerWallet selectByUidNType(SellerWallet condition); |
28 | 28 | ||
29 | - void updateMoneyForTest(); | ||
30 | - | ||
31 | int changeAllMoneyToAvail(@Param("uid") Integer uid, @Param("updateTime") Integer updateTime); | 29 | int changeAllMoneyToAvail(@Param("uid") Integer uid, @Param("updateTime") Integer updateTime); |
32 | 30 | ||
33 | int rejoin(@Param("uid") Integer uid, @Param("amount") BigDecimal amount | 31 | int rejoin(@Param("uid") Integer uid, @Param("amount") BigDecimal amount |
@@ -180,8 +180,4 @@ | @@ -180,8 +180,4 @@ | ||
180 | update seller_wallet set amount = amount + lock_amount ,lock_amount = 0,update_time = #{updateTime,jdbcType=INTEGER} where uid = #{uid} | 180 | update seller_wallet set amount = amount + lock_amount ,lock_amount = 0,update_time = #{updateTime,jdbcType=INTEGER} where uid = #{uid} |
181 | </update> | 181 | </update> |
182 | 182 | ||
183 | - <update id="updateMoneyForTest"> | ||
184 | - update seller_wallet set amount = amount + 10 where id = 3 | ||
185 | - </update> | ||
186 | - | ||
187 | </mapper> | 183 | </mapper> |
1 | package com.yohoufo.order.common; | 1 | package com.yohoufo.order.common; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | + * 100:成功;200:失败,201:没有支付宝账号;202:金额不合法;299:转账失败 | ||
4 | * Created by chao.chen on 2018/10/24. | 5 | * Created by chao.chen on 2018/10/24. |
5 | */ | 6 | */ |
6 | public enum BillTradeStatus { | 7 | public enum BillTradeStatus { |
7 | - | ||
8 | - SUCCESS(100),FAIL(200); | 8 | + TRANSFER_WAITING(90), |
9 | + SUCCESS(100), | ||
10 | + FAIL(200), | ||
11 | + NOT_EXIST_ALI_ACCOUNT(201), | ||
12 | + AMOUNT_IS_ILLEGAL(202), | ||
13 | + TRANSFER_FAIL(299); | ||
9 | 14 | ||
10 | int code; | 15 | int code; |
11 | 16 |
@@ -8,6 +8,7 @@ import com.yohoufo.dal.order.TradeBillsMapper; | @@ -8,6 +8,7 @@ import com.yohoufo.dal.order.TradeBillsMapper; | ||
8 | import com.yohoufo.dal.order.model.BuyerOrderGoods; | 8 | import com.yohoufo.dal.order.model.BuyerOrderGoods; |
9 | import com.yohoufo.dal.order.model.SellerOrderGoods; | 9 | import com.yohoufo.dal.order.model.SellerOrderGoods; |
10 | import com.yohoufo.dal.order.model.TradeBills; | 10 | import com.yohoufo.dal.order.model.TradeBills; |
11 | +import com.yohoufo.order.common.BillTradeStatus; | ||
11 | import com.yohoufo.order.common.TradeType; | 12 | import com.yohoufo.order.common.TradeType; |
12 | import com.yohoufo.order.model.bo.TradeBillsBo; | 13 | import com.yohoufo.order.model.bo.TradeBillsBo; |
13 | import com.yohoufo.order.model.bo.TradeBillsSummaryBo; | 14 | import com.yohoufo.order.model.bo.TradeBillsSummaryBo; |
@@ -109,7 +110,7 @@ public class AssetsService { | @@ -109,7 +110,7 @@ public class AssetsService { | ||
109 | bo.setTradeTypeDesc(TradeType.getTradeTypeByCode(bills.getTradeType()).getDesc()); | 110 | bo.setTradeTypeDesc(TradeType.getTradeTypeByCode(bills.getTradeType()).getDesc()); |
110 | 111 | ||
111 | bo.setTradeStatus(bills.getTradeStatus()); | 112 | bo.setTradeStatus(bills.getTradeStatus()); |
112 | - if(bills.getTradeStatus()!=null&&100==bills.getTradeStatus().intValue()){ | 113 | + if(bills.getTradeStatus()!=null&&BillTradeStatus.SUCCESS.getCode() == bills.getTradeStatus().intValue()){ |
113 | bo.setNormalFlag(true); | 114 | bo.setNormalFlag(true); |
114 | }else{ | 115 | }else{ |
115 | bo.setNormalFlag(false); | 116 | bo.setNormalFlag(false); |
@@ -19,6 +19,7 @@ import com.yohoufo.common.utils.TimeUtils; | @@ -19,6 +19,7 @@ import com.yohoufo.common.utils.TimeUtils; | ||
19 | import com.yohoufo.dal.order.*; | 19 | import com.yohoufo.dal.order.*; |
20 | import com.yohoufo.dal.order.model.*; | 20 | import com.yohoufo.dal.order.model.*; |
21 | import com.yohobuy.ufo.model.order.common.Payment; | 21 | import com.yohobuy.ufo.model.order.common.Payment; |
22 | +import com.yohoufo.order.common.BillTradeStatus; | ||
22 | import com.yohoufo.order.common.HbfqEnum; | 23 | import com.yohoufo.order.common.HbfqEnum; |
23 | import com.yohoufo.order.common.TransferCase; | 24 | import com.yohoufo.order.common.TransferCase; |
24 | import com.yohoufo.order.constants.RefundContant; | 25 | import com.yohoufo.order.constants.RefundContant; |
@@ -356,7 +357,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -356,7 +357,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
356 | if (tradeBills == null) { | 357 | if (tradeBills == null) { |
357 | throw new ServiceException(400, "transferSuccess:流水不存在"); | 358 | throw new ServiceException(400, "transferSuccess:流水不存在"); |
358 | } | 359 | } |
359 | - if (tradeBills.getTradeStatus() != TradeBills.Status.TRANSFER_WAITING.getCode()) { | 360 | + if (tradeBills.getTradeStatus() != BillTradeStatus.TRANSFER_WAITING.getCode()) { |
360 | throw new ServiceException(400, "transferSuccess:该流水不是异步转账的"); | 361 | throw new ServiceException(400, "transferSuccess:该流水不是异步转账的"); |
361 | } | 362 | } |
362 | OrdersPayTransfer transfer = ordersPayTransferMapper.selectByPrimaryKey(transferId); | 363 | OrdersPayTransfer transfer = ordersPayTransferMapper.selectByPrimaryKey(transferId); |
@@ -382,7 +383,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -382,7 +383,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
382 | // 加新流水 | 383 | // 加新流水 |
383 | tradeBills.setDealRelateId(tradeBills.getId()); | 384 | tradeBills.setDealRelateId(tradeBills.getId()); |
384 | tradeBills.setId(null); | 385 | tradeBills.setId(null); |
385 | - tradeBills.setTradeStatus(100); | 386 | + tradeBills.setTradeStatus(BillTradeStatus.SUCCESS.getCode()); |
386 | tradeBills.setCreateTime(now); | 387 | tradeBills.setCreateTime(now); |
387 | addTradeBills(tradeBills); | 388 | addTradeBills(tradeBills); |
388 | 389 | ||
@@ -399,7 +400,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -399,7 +400,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
399 | TradeBills fail = new TradeBills(); | 400 | TradeBills fail = new TradeBills(); |
400 | fail.setId(tradeBills.getId()); | 401 | fail.setId(tradeBills.getId()); |
401 | fail.setDealStatus(0); | 402 | fail.setDealStatus(0); |
402 | - fail.setTradeStatus(299); | 403 | + fail.setTradeStatus(BillTradeStatus.TRANSFER_FAIL.getCode()); |
403 | tradeBillsMapper.updateSelectiveByPrimaryKey(fail); | 404 | tradeBillsMapper.updateSelectiveByPrimaryKey(fail); |
404 | logger.info("transferSuccess 旧流水(失败)更新成功,准备改转账表 tradeBillsId={}, tradeBillsId={}, orderCode={}", tradeBillsId, tradeBillsId, orderCode); | 405 | logger.info("transferSuccess 旧流水(失败)更新成功,准备改转账表 tradeBillsId={}, tradeBillsId={}, orderCode={}", tradeBillsId, tradeBillsId, orderCode); |
405 | 406 | ||
@@ -663,7 +664,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -663,7 +664,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
663 | if (transferAmount == null) { | 664 | if (transferAmount == null) { |
664 | logger.warn("transferMonErr transferMon计算费用结果为 null, 不合法的金额"); | 665 | logger.warn("transferMonErr transferMon计算费用结果为 null, 不合法的金额"); |
665 | alarm("转账金额不合法", "ufo.order.transferMon", "订单号:" + buyerOrderCode + "操作类型(" + transferCase.getCode() + ")计算金额结果为null"); | 666 | alarm("转账金额不合法", "ufo.order.transferMon", "订单号:" + buyerOrderCode + "操作类型(" + transferCase.getCode() + ")计算金额结果为null"); |
666 | - record.setTradeStatus(202); | 667 | + record.setTradeStatus(BillTradeStatus.AMOUNT_IS_ILLEGAL.getCode()); |
667 | addTradeBills(record); | 668 | addTradeBills(record); |
668 | throw new ServiceException(400, "计算金额错误!:"); | 669 | throw new ServiceException(400, "计算金额错误!:"); |
669 | } | 670 | } |
@@ -674,7 +675,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -674,7 +675,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
674 | if (transferAmount.compareTo(new BigDecimal("0.1")) < 0) { | 675 | if (transferAmount.compareTo(new BigDecimal("0.1")) < 0) { |
675 | logger.warn("transferMonErr transferMon计算费用结果为 {}, 小于0.1", transferAmount); | 676 | logger.warn("transferMonErr transferMon计算费用结果为 {}, 小于0.1", transferAmount); |
676 | alarm("转账金额小于0.1", "ufo.order.transferMon", "订单号:" + buyerOrderCode + "操作类型(" + transferCase.getCode() + ")计算金额结果为" + transferAmount); | 677 | alarm("转账金额小于0.1", "ufo.order.transferMon", "订单号:" + buyerOrderCode + "操作类型(" + transferCase.getCode() + ")计算金额结果为" + transferAmount); |
677 | - record.setTradeStatus(202); | 678 | + record.setTradeStatus(BillTradeStatus.AMOUNT_IS_ILLEGAL.getCode()); |
678 | addTradeBills(record); | 679 | addTradeBills(record); |
679 | throw new ServiceException(400, "不合法的金额:" + transferAmount); | 680 | throw new ServiceException(400, "不合法的金额:" + transferAmount); |
680 | } | 681 | } |
@@ -683,7 +684,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -683,7 +684,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
683 | if (account == null || | 684 | if (account == null || |
684 | (StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))) { | 685 | (StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))) { |
685 | logger.warn("transferMonErr uid {} 没有获取到有效的支付宝账号", targetUid); | 686 | logger.warn("transferMonErr uid {} 没有获取到有效的支付宝账号", targetUid); |
686 | - record.setTradeStatus(201); | 687 | + record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALI_ACCOUNT.getCode()); |
687 | addTradeBills(record); | 688 | addTradeBills(record); |
688 | throw new ServiceException(400, "uid[" + targetUid + "]没有获取到有效的支付宝账号"); | 689 | throw new ServiceException(400, "uid[" + targetUid + "]没有获取到有效的支付宝账号"); |
689 | } | 690 | } |
@@ -775,8 +776,9 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -775,8 +776,9 @@ public class PaymentServiceImpl implements IPaymentService { | ||
775 | logger.info("transferMon最后更新状态 status= {}", transfer.getStatus()); | 776 | logger.info("transferMon最后更新状态 status= {}", transfer.getStatus()); |
776 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); | 777 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); |
777 | // 100:成功;201:没有支付宝账号;202:金额不合法;299:转账失败 | 778 | // 100:成功;201:没有支付宝账号;202:金额不合法;299:转账失败 |
778 | - record.setTradeStatus(transfer.getStatus() == 1 ? 100 : 299); | ||
779 | - tradeBillsMapper.updateSelectiveByPrimaryKey(record); | 779 | + BillTradeStatus bts = transfer.getStatus() == 1 ? BillTradeStatus.SUCCESS : BillTradeStatus.TRANSFER_FAIL; |
780 | + record.setTradeStatus(bts.getCode()); | ||
781 | + tradeBillsMapper.updateSelectiveByPrimaryKey(record); | ||
780 | logger.info("transferMon最后更新状态完成,转账结束, buyerOrderCode is {}!", buyerOrderCode); | 782 | logger.info("transferMon最后更新状态完成,转账结束, buyerOrderCode is {}!", buyerOrderCode); |
781 | } | 783 | } |
782 | } | 784 | } |
@@ -813,14 +815,14 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -813,14 +815,14 @@ public class PaymentServiceImpl implements IPaymentService { | ||
813 | if (amount == null || amount.compareTo(new BigDecimal("0.1")) < 0) { | 815 | if (amount == null || amount.compareTo(new BigDecimal("0.1")) < 0) { |
814 | logger.warn("transAllEarnestErr transferMon计算费用结果为 {}, 小于0.1或为null", amount); | 816 | logger.warn("transAllEarnestErr transferMon计算费用结果为 {}, 小于0.1或为null", amount); |
815 | alarm("转账金额小于0.1或为null", "ufo.order.transAllEarnest", "退还商家入驻所有金额,订单号:" + orderCode + "操作类型(" + 6 + ")计算金额结果为" + amount); | 817 | alarm("转账金额小于0.1或为null", "ufo.order.transAllEarnest", "退还商家入驻所有金额,订单号:" + orderCode + "操作类型(" + 6 + ")计算金额结果为" + amount); |
816 | - record.setTradeStatus(202); | 818 | + record.setTradeStatus(BillTradeStatus.AMOUNT_IS_ILLEGAL.getCode()); |
817 | addTradeBills(record); | 819 | addTradeBills(record); |
818 | throw new ServiceException(400, "不合法的金额:" + amount); | 820 | throw new ServiceException(400, "不合法的金额:" + amount); |
819 | } | 821 | } |
820 | 822 | ||
821 | if (StringUtils.isBlank(aliPayAccount.getAlipayAccount()) && StringUtils.isBlank(aliPayAccount.getAlipayId()) ) { | 823 | if (StringUtils.isBlank(aliPayAccount.getAlipayAccount()) && StringUtils.isBlank(aliPayAccount.getAlipayId()) ) { |
822 | logger.warn("transAllEarnestErr uid {} 支付宝账号不合法", account); | 824 | logger.warn("transAllEarnestErr uid {} 支付宝账号不合法", account); |
823 | - record.setTradeStatus(201); | 825 | + record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALI_ACCOUNT.getCode()); |
824 | addTradeBills(record); | 826 | addTradeBills(record); |
825 | throw new ServiceException(400, "uid[" + uid + "]支付宝账号不合法"); | 827 | throw new ServiceException(400, "uid[" + uid + "]支付宝账号不合法"); |
826 | } | 828 | } |
@@ -907,7 +909,8 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -907,7 +909,8 @@ public class PaymentServiceImpl implements IPaymentService { | ||
907 | transfer.setUpdateTime(now); | 909 | transfer.setUpdateTime(now); |
908 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); | 910 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); |
909 | // 100:成功;201:没有支付宝账号;202:金额不合法;299:转账失败 | 911 | // 100:成功;201:没有支付宝账号;202:金额不合法;299:转账失败 |
910 | - record.setTradeStatus(transfer.getStatus() == 1 ? 100 : 299); | 912 | + BillTradeStatus bts = transfer.getStatus() == 1 ? BillTradeStatus.SUCCESS : BillTradeStatus.TRANSFER_FAIL; |
913 | + record.setTradeStatus( bts.getCode() ); | ||
911 | tradeBillsMapper.updateSelectiveByPrimaryKey(record); | 914 | tradeBillsMapper.updateSelectiveByPrimaryKey(record); |
912 | logger.info("transAllEarnest最后更新状态完成,转账结束, orderCode is {}!", orderCode); | 915 | logger.info("transAllEarnest最后更新状态完成,转账结束, orderCode is {}!", orderCode); |
913 | } | 916 | } |
@@ -989,7 +992,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -989,7 +992,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
989 | if (tradeBills == null) { | 992 | if (tradeBills == null) { |
990 | throw new ServiceException(400, "manualDeal:流水不存在"); | 993 | throw new ServiceException(400, "manualDeal:流水不存在"); |
991 | } | 994 | } |
992 | - if (tradeBills.getTradeStatus() == 100) { | 995 | + if (tradeBills.getTradeStatus() == BillTradeStatus.SUCCESS.getCode()) { |
993 | throw new ServiceException(400, "manualDeal:该流水不是失败的"); | 996 | throw new ServiceException(400, "manualDeal:该流水不是失败的"); |
994 | } | 997 | } |
995 | if (tradeBills.getIncomeOutcome()==null || tradeBills.getIncomeOutcome()!=1) { | 998 | if (tradeBills.getIncomeOutcome()==null || tradeBills.getIncomeOutcome()!=1) { |
@@ -1072,7 +1075,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1072,7 +1075,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1072 | // 加新流水 | 1075 | // 加新流水 |
1073 | tradeBills.setDealRelateId(tradeBills.getId()); | 1076 | tradeBills.setDealRelateId(tradeBills.getId()); |
1074 | tradeBills.setId(null); | 1077 | tradeBills.setId(null); |
1075 | - tradeBills.setTradeStatus(100); | 1078 | + tradeBills.setTradeStatus(BillTradeStatus.SUCCESS.getCode()); |
1076 | tradeBills.setCreateTime(now); | 1079 | tradeBills.setCreateTime(now); |
1077 | addTradeBills(tradeBills); | 1080 | addTradeBills(tradeBills); |
1078 | return; | 1081 | return; |
@@ -1133,7 +1136,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1133,7 +1136,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1133 | // 加新流水 | 1136 | // 加新流水 |
1134 | tradeBills.setDealRelateId(tradeBills.getId()); | 1137 | tradeBills.setDealRelateId(tradeBills.getId()); |
1135 | tradeBills.setId(null); | 1138 | tradeBills.setId(null); |
1136 | - tradeBills.setTradeStatus(100); | 1139 | + tradeBills.setTradeStatus(BillTradeStatus.SUCCESS.getCode()); |
1137 | tradeBills.setCreateTime(now); | 1140 | tradeBills.setCreateTime(now); |
1138 | addTradeBills(tradeBills); | 1141 | addTradeBills(tradeBills); |
1139 | 1142 | ||
@@ -1181,7 +1184,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1181,7 +1184,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1181 | // success to wait | 1184 | // success to wait |
1182 | if (StringUtils.equals("T", mapResult.get("is_success"))) { | 1185 | if (StringUtils.equals("T", mapResult.get("is_success"))) { |
1183 | tradeBills.setDealStatus(0); | 1186 | tradeBills.setDealStatus(0); |
1184 | - tradeBills.setTradeStatus(TradeBills.Status.TRANSFER_WAITING.getCode()); | 1187 | + tradeBills.setTradeStatus(BillTradeStatus.TRANSFER_WAITING.getCode()); |
1185 | // wait | 1188 | // wait |
1186 | tradeBillsMapper.updateSelectiveByPrimaryKey(tradeBills); | 1189 | tradeBillsMapper.updateSelectiveByPrimaryKey(tradeBills); |
1187 | } | 1190 | } |
@@ -1338,7 +1341,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1338,7 +1341,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1338 | return; | 1341 | return; |
1339 | } | 1342 | } |
1340 | record.setSystemAmount(amount);// 有货收入 | 1343 | record.setSystemAmount(amount);// 有货收入 |
1341 | - record.setTradeStatus(100); | 1344 | + record.setTradeStatus(BillTradeStatus.SUCCESS.getCode()); |
1342 | record.setCreateTime((int) (System.currentTimeMillis() / 1000)); | 1345 | record.setCreateTime((int) (System.currentTimeMillis() / 1000)); |
1343 | addTradeBills(record); | 1346 | addTradeBills(record); |
1344 | } | 1347 | } |
@@ -1354,7 +1357,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1354,7 +1357,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1354 | record.setIncomeOutcome(2);// 1:用户收入; 2:用户支出 | 1357 | record.setIncomeOutcome(2);// 1:用户收入; 2:用户支出 |
1355 | record.setAmount(amount); | 1358 | record.setAmount(amount); |
1356 | record.setSystemAmount(amount);// 有货收入 | 1359 | record.setSystemAmount(amount);// 有货收入 |
1357 | - record.setTradeStatus(100); | 1360 | + record.setTradeStatus(BillTradeStatus.SUCCESS.getCode()); |
1358 | record.setCreateTime((int) (System.currentTimeMillis() / 1000)); | 1361 | record.setCreateTime((int) (System.currentTimeMillis() / 1000)); |
1359 | addTradeBills(record); | 1362 | addTradeBills(record); |
1360 | } | 1363 | } |
@@ -1385,7 +1388,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1385,7 +1388,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1385 | } | 1388 | } |
1386 | 1389 | ||
1387 | record.setSystemAmount(amount);// 有货收入 | 1390 | record.setSystemAmount(amount);// 有货收入 |
1388 | - record.setTradeStatus(100); | 1391 | + record.setTradeStatus(BillTradeStatus.SUCCESS.getCode()); |
1389 | record.setCreateTime((int) (System.currentTimeMillis() / 1000)); | 1392 | record.setCreateTime((int) (System.currentTimeMillis() / 1000)); |
1390 | addTradeBills(record); | 1393 | addTradeBills(record); |
1391 | } | 1394 | } |
@@ -372,7 +372,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I | @@ -372,7 +372,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I | ||
372 | && leastPrice.compareTo(BigDecimal.ZERO)>0){ | 372 | && leastPrice.compareTo(BigDecimal.ZERO)>0){ |
373 | goodsInfo.setLeastPrice(leastPrice); | 373 | goodsInfo.setLeastPrice(leastPrice); |
374 | goodsInfo.setSuggestMaxPrice(prdPrice.getSuggestMaxPrice()); | 374 | goodsInfo.setSuggestMaxPrice(prdPrice.getSuggestMaxPrice()); |
375 | - goodsInfo.setLeastPriceOfSkuTips(sellerOrderViewService.buildLeastPriceTips(leastPrice)); | 375 | + goodsInfo.setLeastPriceOfSkuTips(sellerOrderViewService.buildLeastPriceTips(leastPrice, skupType)); |
376 | } | 376 | } |
377 | logger.info("in resetPriceOfProduct after reset, leastPrice {},new goodsInfo {}", | 377 | logger.info("in resetPriceOfProduct after reset, leastPrice {},new goodsInfo {}", |
378 | leastPrice, JSON.toJSONString(goodsInfo)); | 378 | leastPrice, JSON.toJSONString(goodsInfo)); |
@@ -3,10 +3,7 @@ package com.yohoufo.order.service.impl; | @@ -3,10 +3,7 @@ package com.yohoufo.order.service.impl; | ||
3 | import com.google.common.collect.Maps; | 3 | import com.google.common.collect.Maps; |
4 | import com.yoho.error.ServiceError; | 4 | import com.yoho.error.ServiceError; |
5 | import com.yoho.error.exception.ServiceException; | 5 | import com.yoho.error.exception.ServiceException; |
6 | -import com.yohobuy.ufo.model.order.bo.ButtonShowBo; | ||
7 | -import com.yohobuy.ufo.model.order.bo.GoodsInfo; | ||
8 | -import com.yohobuy.ufo.model.order.bo.OrderInfo; | ||
9 | -import com.yohobuy.ufo.model.order.bo.TimeoutBo; | 6 | +import com.yohobuy.ufo.model.order.bo.*; |
10 | import com.yohobuy.ufo.model.order.common.*; | 7 | import com.yohobuy.ufo.model.order.common.*; |
11 | import com.yohobuy.ufo.model.order.constants.SkupType; | 8 | import com.yohobuy.ufo.model.order.constants.SkupType; |
12 | import com.yohobuy.ufo.model.order.resp.OrderListInfo; | 9 | import com.yohobuy.ufo.model.order.resp.OrderListInfo; |
@@ -105,15 +102,21 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -105,15 +102,21 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
105 | 102 | ||
106 | 103 | ||
107 | public List<OrderListInfo> buildOrderList(List<SellerOrderGoods> sogList, SellerType sellerType){ | 104 | public List<OrderListInfo> buildOrderList(List<SellerOrderGoods> sogList, SellerType sellerType){ |
108 | - Map<String, String> overPriceTipsMap = buildOverPriceTipsMap(sogList); | 105 | + Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId) |
106 | + .collect(Collectors.toSet()); | ||
107 | + Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds); | ||
108 | + Map<String, String> overPriceTipsMap = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap); | ||
109 | Map<Integer, SellerOrderGoods> skupSellerOrderGoodsMap = sogList.parallelStream() | 109 | Map<Integer, SellerOrderGoods> skupSellerOrderGoodsMap = sogList.parallelStream() |
110 | .collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity())); | 110 | .collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity())); |
111 | List<Integer> skupList = sogList.parallelStream().map(SellerOrderGoods::getId).collect(Collectors.toList()); | 111 | List<Integer> skupList = sogList.parallelStream().map(SellerOrderGoods::getId).collect(Collectors.toList()); |
112 | List<SellerOrder> sellerOrders = sellerOrderMapper.selectBySkups(skupList); | 112 | List<SellerOrder> sellerOrders = sellerOrderMapper.selectBySkups(skupList); |
113 | List<OrderListInfo> data ; | 113 | List<OrderListInfo> data ; |
114 | data = sellerOrders.parallelStream() | 114 | data = sellerOrders.parallelStream() |
115 | - .map(sellerOrder -> buildOrderListInfo(skupSellerOrderGoodsMap.get(sellerOrder.getSkup()), | ||
116 | - sellerOrder, sellerType, overPriceTipsMap)) | 115 | + .map(sellerOrder -> { |
116 | + SellerOrderGoods psog = skupSellerOrderGoodsMap.get(sellerOrder.getSkup()); | ||
117 | + StorageInfoResp storageInfoResp = getStorageDataMap.get(psog.getStorageId()); | ||
118 | + return buildOrderListInfo(psog, storageInfoResp, sellerOrder, sellerType, overPriceTipsMap); | ||
119 | + }) | ||
117 | .filter(oli -> Objects.nonNull(oli)) | 120 | .filter(oli -> Objects.nonNull(oli)) |
118 | .collect(Collectors.toList()); | 121 | .collect(Collectors.toList()); |
119 | return data; | 122 | return data; |
@@ -219,6 +222,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -219,6 +222,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
219 | oli.setLeftTime(timeoutBo.getLeftTime()); | 222 | oli.setLeftTime(timeoutBo.getLeftTime()); |
220 | oli.setTimeLimit(timeoutBo.getTimelimit()); | 223 | oli.setTimeLimit(timeoutBo.getTimelimit()); |
221 | } | 224 | } |
225 | + | ||
222 | } | 226 | } |
223 | } | 227 | } |
224 | }); | 228 | }); |
@@ -227,22 +231,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -227,22 +231,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
227 | 231 | ||
228 | 232 | ||
229 | 233 | ||
230 | - /** | ||
231 | - * 需要商品提供批量接口,减少db net IO, 目前的工期太短,后期再优化 | ||
232 | - * @param sogList | ||
233 | - * @return | ||
234 | - */ | ||
235 | - public Map<String,String> buildOverPriceTipsMap(List<SellerOrderGoods> sogList){ | ||
236 | - Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId) | ||
237 | - .collect(Collectors.toSet()); | ||
238 | - Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds); | ||
239 | - Map<String,String> map = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap); | ||
240 | - return map; | ||
241 | - } | ||
242 | 234 | ||
243 | 235 | ||
244 | - OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods, | ||
245 | - SellerOrder sellerOrder, SellerType st, | 236 | + |
237 | + private OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods, | ||
238 | + StorageInfoResp storageInfoResp, | ||
239 | + SellerOrder sellerOrder, | ||
240 | + SellerType st, | ||
246 | Map<String,String> overPriceTipsMap) { | 241 | Map<String,String> overPriceTipsMap) { |
247 | OrderListInfo orderListInfo = new OrderListInfo(); | 242 | OrderListInfo orderListInfo = new OrderListInfo(); |
248 | Long orderCode; | 243 | Long orderCode; |
@@ -282,6 +277,16 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -282,6 +277,16 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
282 | orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney()); | 277 | orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney()); |
283 | 278 | ||
284 | // | 279 | // |
280 | + String leastPriceOfSkuTips = null; | ||
281 | + if (skupType == SkupType.ADVANCE || skupType == SkupType.IN_STOCK){ | ||
282 | + if (storageInfoResp != null) { | ||
283 | + PrdPrice prdPrice = PrdPrice.builder() | ||
284 | + .leastPrice(storageInfoResp.getLeastPrice()) | ||
285 | + .preSaleLeastPrice(storageInfoResp.getPreSaleLeastPrice()) | ||
286 | + .build(); | ||
287 | + leastPriceOfSkuTips = sellerOrderViewService.buildLeastPriceTips(prdPrice, skupType); | ||
288 | + } | ||
289 | + } | ||
285 | 290 | ||
286 | GoodsInfo goodsInfo = new GoodsInfo(); | 291 | GoodsInfo goodsInfo = new GoodsInfo(); |
287 | goodsInfo.setColorName(sellerOrderGoods.getColorName()); | 292 | goodsInfo.setColorName(sellerOrderGoods.getColorName()); |
@@ -294,7 +299,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -294,7 +299,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
294 | goodsInfo.setBatchNo(sellerOrderGoods.getBatchNo()); | 299 | goodsInfo.setBatchNo(sellerOrderGoods.getBatchNo()); |
295 | goodsInfo.setStorageNum(storageNum); | 300 | goodsInfo.setStorageNum(storageNum); |
296 | goodsInfo.setSkupList(sellerOrderGoods.getSkupList()); | 301 | goodsInfo.setSkupList(sellerOrderGoods.getSkupList()); |
297 | - | 302 | + goodsInfo.setLeastPriceOfSkuTips(leastPriceOfSkuTips); |
298 | 303 | ||
299 | orderListInfo.setGoodsInfo(goodsInfo); | 304 | orderListInfo.setGoodsInfo(goodsInfo); |
300 | orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime()); | 305 | orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime()); |
@@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.ButtonShow; | @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.ButtonShow; | ||
6 | import com.yohobuy.ufo.model.order.common.SellerOrderListType; | 6 | import com.yohobuy.ufo.model.order.common.SellerOrderListType; |
7 | import com.yohobuy.ufo.model.order.common.SkupStatus; | 7 | import com.yohobuy.ufo.model.order.common.SkupStatus; |
8 | import com.yohobuy.ufo.model.order.common.TabType; | 8 | import com.yohobuy.ufo.model.order.common.TabType; |
9 | +import com.yohobuy.ufo.model.order.constants.SkupType; | ||
9 | import com.yohobuy.ufo.model.order.resp.OrderCntResp; | 10 | import com.yohobuy.ufo.model.order.resp.OrderCntResp; |
10 | import com.yohobuy.ufo.model.response.StorageDataResp; | 11 | import com.yohobuy.ufo.model.response.StorageDataResp; |
11 | import com.yohoufo.common.utils.BigDecimalHelper; | 12 | import com.yohoufo.common.utils.BigDecimalHelper; |
@@ -144,8 +145,30 @@ public class SellerOrderViewService { | @@ -144,8 +145,30 @@ public class SellerOrderViewService { | ||
144 | .actor(orderRequest.getTabType()).build(); | 145 | .actor(orderRequest.getTabType()).build(); |
145 | } | 146 | } |
146 | 147 | ||
147 | - String buildLeastPriceTips(BigDecimal leastPrice){ | ||
148 | - return "该尺码最低售价¥" + BigDecimalHelper.formatNumber(leastPrice, BigDecimalHelper.FORMAT_NOPOINT); | 148 | + String buildLeastPriceTips(BigDecimal leastPrice, SkupType skupType){ |
149 | + String prefix = buildLeastPriceTipsPrefix(skupType); | ||
150 | + return prefix==null ? null : prefix + "¥" + BigDecimalHelper.formatNumber(leastPrice, BigDecimalHelper.FORMAT_NOPOINT); | ||
151 | + } | ||
152 | + | ||
153 | + private String buildLeastPriceTipsPrefix(SkupType skupType){ | ||
154 | + String prefix = null; | ||
155 | + switch (skupType){ | ||
156 | + case IN_STOCK: | ||
157 | + prefix = "最低现货价"; | ||
158 | + break; | ||
159 | + case ADVANCE: | ||
160 | + prefix = "最低预售价"; | ||
161 | + break; | ||
162 | + | ||
163 | + } | ||
164 | + return prefix; | ||
165 | + } | ||
166 | + | ||
167 | + String buildLeastPriceTips(PrdPrice prdPrice, SkupType skupType){ | ||
168 | + | ||
169 | + BigDecimal leastPrice = prdPrice.getLeastPrice(skupType); | ||
170 | + | ||
171 | + return buildLeastPriceTips(leastPrice, skupType); | ||
149 | } | 172 | } |
150 | 173 | ||
151 | String buildOtherLowerPriceTips(BigDecimal leastPrice){ | 174 | String buildOtherLowerPriceTips(BigDecimal leastPrice){ |
@@ -349,6 +349,7 @@ public class SkupListService { | @@ -349,6 +349,7 @@ public class SkupListService { | ||
349 | return popDTO; | 349 | return popDTO; |
350 | } | 350 | } |
351 | 351 | ||
352 | + | ||
352 | private Integer findPrdOverPriceDTO(List<SellerOrderGoods> sogList, Map<Integer, StorageInfoResp> storageDataMap ){ | 353 | private Integer findPrdOverPriceDTO(List<SellerOrderGoods> sogList, Map<Integer, StorageInfoResp> storageDataMap ){ |
353 | int total = 0; | 354 | int total = 0; |
354 | if (MapUtils.isEmpty(storageDataMap)){ | 355 | if (MapUtils.isEmpty(storageDataMap)){ |
@@ -18,16 +18,16 @@ public class BuyOrderChangeListener implements IOrderChangeListener<BuyerOrderCh | @@ -18,16 +18,16 @@ public class BuyOrderChangeListener implements IOrderChangeListener<BuyerOrderCh | ||
18 | BuyerOrderChangeEvent.BizCase bizCase = changeEvent.getBizCase(); | 18 | BuyerOrderChangeEvent.BizCase bizCase = changeEvent.getBizCase(); |
19 | switch (bizCase) { | 19 | switch (bizCase) { |
20 | case CREATE: | 20 | case CREATE: |
21 | - businessPostProcessor.create(changeEvent.getBuyerOrder(), changeEvent.getBizCase(), changeEvent.getTargetStatus()); | 21 | + businessPostProcessor.fireCreate(changeEvent.getBuyerOrder(), changeEvent.getBizCase(), changeEvent.getTargetStatus()); |
22 | break; | 22 | break; |
23 | case CANCEL_BYSYSAUTO: | 23 | case CANCEL_BYSYSAUTO: |
24 | case CANCEL_BYBUYER: | 24 | case CANCEL_BYBUYER: |
25 | case CANCEL_BYCS: | 25 | case CANCEL_BYCS: |
26 | case CANCEL_BYSELLER: | 26 | case CANCEL_BYSELLER: |
27 | - businessPostProcessor.cancel(changeEvent.getBuyerOrder(), changeEvent.getBizCase(), changeEvent.getTargetStatus()); | 27 | + businessPostProcessor.fireCancel(changeEvent.getBuyerOrder(), changeEvent.getBizCase(), changeEvent.getTargetStatus()); |
28 | break; | 28 | break; |
29 | case PAY_SUCCESS: | 29 | case PAY_SUCCESS: |
30 | - businessPostProcessor.paySuccess(changeEvent.getBuyerOrder(), changeEvent.getBizCase(), changeEvent.getTargetStatus()); | 30 | + businessPostProcessor.firePaySuccess(changeEvent.getBuyerOrder(), changeEvent.getBizCase(), changeEvent.getTargetStatus()); |
31 | break; | 31 | break; |
32 | default: | 32 | default: |
33 | throw new IllegalStateException("unknown bizCase" + bizCase); | 33 | throw new IllegalStateException("unknown bizCase" + bizCase); |
@@ -50,7 +50,7 @@ public class BuyerOrderChangeBusinessPostProcessor { | @@ -50,7 +50,7 @@ public class BuyerOrderChangeBusinessPostProcessor { | ||
50 | * @param bizCase | 50 | * @param bizCase |
51 | * @param targetStatus | 51 | * @param targetStatus |
52 | */ | 52 | */ |
53 | - public void create(BuyerOrder buyerOrder, BuyerOrderChangeEvent.BizCase bizCase, OrderStatus targetStatus) { | 53 | + public void fireCreate(BuyerOrder buyerOrder, BuyerOrderChangeEvent.BizCase bizCase, OrderStatus targetStatus) { |
54 | BusinessProcessorContext context = buildBusinessProcessorContext(buyerOrder, bizCase, targetStatus); | 54 | BusinessProcessorContext context = buildBusinessProcessorContext(buyerOrder, bizCase, targetStatus); |
55 | for (BusinessProcessor processor : processors) { | 55 | for (BusinessProcessor processor : processors) { |
56 | try { | 56 | try { |
@@ -73,7 +73,7 @@ public class BuyerOrderChangeBusinessPostProcessor { | @@ -73,7 +73,7 @@ public class BuyerOrderChangeBusinessPostProcessor { | ||
73 | * @param bizCase | 73 | * @param bizCase |
74 | * @param targetStatus | 74 | * @param targetStatus |
75 | */ | 75 | */ |
76 | - public void cancel(BuyerOrder buyerOrder, BuyerOrderChangeEvent.BizCase bizCase, OrderStatus targetStatus) { | 76 | + public void fireCancel(BuyerOrder buyerOrder, BuyerOrderChangeEvent.BizCase bizCase, OrderStatus targetStatus) { |
77 | BusinessProcessorContext context = buildBusinessProcessorContext(buyerOrder, bizCase, targetStatus); | 77 | BusinessProcessorContext context = buildBusinessProcessorContext(buyerOrder, bizCase, targetStatus); |
78 | for (BusinessProcessor processor : processors) { | 78 | for (BusinessProcessor processor : processors) { |
79 | try { | 79 | try { |
@@ -97,7 +97,7 @@ public class BuyerOrderChangeBusinessPostProcessor { | @@ -97,7 +97,7 @@ public class BuyerOrderChangeBusinessPostProcessor { | ||
97 | * @param bizCase | 97 | * @param bizCase |
98 | * @param targetStatus | 98 | * @param targetStatus |
99 | */ | 99 | */ |
100 | - public void paySuccess(BuyerOrder buyerOrder, BuyerOrderChangeEvent.BizCase bizCase, OrderStatus targetStatus) { | 100 | + public void firePaySuccess(BuyerOrder buyerOrder, BuyerOrderChangeEvent.BizCase bizCase, OrderStatus targetStatus) { |
101 | BusinessProcessorContext context = buildBusinessProcessorContext(buyerOrder, bizCase, targetStatus); | 101 | BusinessProcessorContext context = buildBusinessProcessorContext(buyerOrder, bizCase, targetStatus); |
102 | for (BusinessProcessor processor : processors) { | 102 | for (BusinessProcessor processor : processors) { |
103 | try { | 103 | try { |
product/src/main/java/com/yohoufo/product/controller/test/ExampleResultFactory.java
deleted
100644 → 0
1 | -package com.yohoufo.product.controller.test; | ||
2 | - | ||
3 | -public class ExampleResultFactory { | ||
4 | - | ||
5 | - public static Object createData() { | ||
6 | - String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); | ||
7 | - switch (methodName) { | ||
8 | - case "queryProductDetailBySKN": | ||
9 | - return 1; | ||
10 | - default: | ||
11 | - return null; | ||
12 | - } | ||
13 | - } | ||
14 | - | ||
15 | -} |
product/src/main/java/com/yohoufo/product/controller/test/TestSynDbController.java
deleted
100644 → 0
1 | -package com.yohoufo.product.controller.test; | ||
2 | - | ||
3 | -import com.yoho.tools.docs.ApiOperation; | ||
4 | -import com.yohoufo.common.ApiResponse; | ||
5 | -import com.yohoufo.common.annotation.IgnoreSession; | ||
6 | -import com.yohoufo.common.annotation.IgnoreSignature; | ||
7 | -import com.yohoufo.dal.order.SellerWalletMapper; | ||
8 | -import org.slf4j.Logger; | ||
9 | -import org.slf4j.LoggerFactory; | ||
10 | -import org.springframework.beans.factory.annotation.Autowired; | ||
11 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
12 | -import org.springframework.web.bind.annotation.RestController; | ||
13 | - | ||
14 | -import java.util.concurrent.atomic.AtomicInteger; | ||
15 | - | ||
16 | -/** | ||
17 | - * Created by li.ma on 2018/11/21. | ||
18 | - */ | ||
19 | -@RestController | ||
20 | -public class TestSynDbController { | ||
21 | - | ||
22 | - private final Logger LOG = LoggerFactory.getLogger(TestSynDbController.class); | ||
23 | - | ||
24 | - @Autowired | ||
25 | - private SellerWalletMapper sellerWalletMapperl; | ||
26 | - | ||
27 | - private AtomicInteger count = new AtomicInteger(0); | ||
28 | - | ||
29 | - @ApiOperation(name = "ufo.product.testSynDb", desc="测试") | ||
30 | - @IgnoreSignature | ||
31 | - @IgnoreSession | ||
32 | - @RequestMapping(params = "method=ufo.product.testSynDb") | ||
33 | - public ApiResponse testSynDb() { | ||
34 | - | ||
35 | - try { | ||
36 | - sellerWalletMapperl.updateMoneyForTest(); | ||
37 | - count.addAndGet(1); | ||
38 | - }catch (Throwable e) { | ||
39 | - LOG.error("1999922222222344"); | ||
40 | - } | ||
41 | - | ||
42 | - LOG.info("testSynDb count is {}", count.get()); | ||
43 | - return new ApiResponse.ApiResponseBuilder().code(200).message("热搜词列表").build(); | ||
44 | - } | ||
45 | -} |
-
Please register or login to post a comment