Merge branch 'test6.9.8' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.8
Showing
16 changed files
with
126 additions
and
58 deletions
@@ -319,7 +319,7 @@ public class SellerOrderController { | @@ -319,7 +319,7 @@ public class SellerOrderController { | ||
319 | @RequestParam(name = "product_id") int product_id, | 319 | @RequestParam(name = "product_id") int product_id, |
320 | @RequestParam(name = "num") int num, | 320 | @RequestParam(name = "num") int num, |
321 | @RequestParam(name="skupType", defaultValue = DEFAULT_SKUP_TYPE, required = false) Integer skupType | 321 | @RequestParam(name="skupType", defaultValue = DEFAULT_SKUP_TYPE, required = false) Integer skupType |
322 | - ) throws GatewayException { | 322 | + ) { |
323 | SellerBatchChangeReq req = new SellerBatchChangeReq(); | 323 | SellerBatchChangeReq req = new SellerBatchChangeReq(); |
324 | req.setStorageId(storage_id); | 324 | req.setStorageId(storage_id); |
325 | req.setUid(uid); | 325 | req.setUid(uid); |
@@ -395,7 +395,7 @@ public class SellerOrderController { | @@ -395,7 +395,7 @@ public class SellerOrderController { | ||
395 | @RequestParam(name = "old_price") BigDecimal old_price, | 395 | @RequestParam(name = "old_price") BigDecimal old_price, |
396 | @RequestParam(name = "num") int num, | 396 | @RequestParam(name = "num") int num, |
397 | @RequestParam(name="skupType", defaultValue = DEFAULT_SKUP_TYPE, required = false) Integer skupType | 397 | @RequestParam(name="skupType", defaultValue = DEFAULT_SKUP_TYPE, required = false) Integer skupType |
398 | - ) throws GatewayException { | 398 | + ) { |
399 | SellerBatchChangeReq req = new SellerBatchChangeReq(); | 399 | SellerBatchChangeReq req = new SellerBatchChangeReq(); |
400 | req.setStorageId(storage_id); | 400 | req.setStorageId(storage_id); |
401 | req.setUid(uid); | 401 | req.setUid(uid); |
1 | +package com.yohoufo.order.model.dto; | ||
2 | + | ||
3 | +import com.yohobuy.ufo.model.order.constants.SkupType; | ||
4 | +import lombok.AllArgsConstructor; | ||
5 | +import lombok.Builder; | ||
6 | +import lombok.Data; | ||
7 | +import lombok.NoArgsConstructor; | ||
8 | + | ||
9 | +import java.util.Map; | ||
10 | + | ||
11 | +@Data | ||
12 | +@Builder | ||
13 | +@AllArgsConstructor | ||
14 | +@NoArgsConstructor | ||
15 | +public class SkupDownShelfPrepareDto { | ||
16 | + | ||
17 | + private Map<Integer, SkupDto> idSkupMap; | ||
18 | + | ||
19 | + private SkupType skupType; | ||
20 | + | ||
21 | + | ||
22 | +} |
@@ -3,11 +3,13 @@ package com.yohoufo.order.service.handler; | @@ -3,11 +3,13 @@ package com.yohoufo.order.service.handler; | ||
3 | import com.google.common.collect.Lists; | 3 | import com.google.common.collect.Lists; |
4 | import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; | 4 | import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; |
5 | import com.yohobuy.ufo.model.order.bo.OrderInfo; | 5 | import com.yohobuy.ufo.model.order.bo.OrderInfo; |
6 | +import com.yohobuy.ufo.model.order.constants.SkupType; | ||
6 | import com.yohoufo.dal.order.model.SellerOrder; | 7 | import com.yohoufo.dal.order.model.SellerOrder; |
7 | import com.yohoufo.dal.order.model.SellerOrderGoods; | 8 | import com.yohoufo.dal.order.model.SellerOrderGoods; |
8 | import com.yohoufo.dal.order.model.SellerWallet; | 9 | import com.yohoufo.dal.order.model.SellerWallet; |
9 | import com.yohoufo.dal.order.model.SellerWalletDetail; | 10 | import com.yohoufo.dal.order.model.SellerWalletDetail; |
10 | import com.yohoufo.order.model.dto.*; | 11 | import com.yohoufo.order.model.dto.*; |
12 | +import com.yohoufo.order.utils.SellerGoodsHelper; | ||
11 | import org.springframework.stereotype.Component; | 13 | import org.springframework.stereotype.Component; |
12 | 14 | ||
13 | import java.math.BigDecimal; | 15 | import java.math.BigDecimal; |
@@ -62,7 +64,9 @@ public class SellerDecrPriceTaskHandler extends AbstractSellerAdjustPriceTaskHan | @@ -62,7 +64,9 @@ public class SellerDecrPriceTaskHandler extends AbstractSellerAdjustPriceTaskHan | ||
62 | 64 | ||
63 | private void changeEarnest(int uid, long taskId, SellerTaskResult result, List<SellerOrder> successOrders,ChangePricePrepareDTO cppDto) { | 65 | private void changeEarnest(int uid, long taskId, SellerTaskResult result, List<SellerOrder> successOrders,ChangePricePrepareDTO cppDto) { |
64 | try { | 66 | try { |
65 | - if (!cppDto.getSellerBo().isSuper()) { | 67 | + final SkupType skupType ; |
68 | + boolean noChangeMoney = (SellerGoodsHelper.isQuickDeliver(skupType=cppDto.getSkupType()) || cppDto.getSellerBo().isSuper()); | ||
69 | + if (!noChangeMoney) { | ||
66 | BigDecimal preSalePrice = cppDto.getPreSalePrice(), | 70 | BigDecimal preSalePrice = cppDto.getPreSalePrice(), |
67 | salePrice = cppDto.getSalePrice(); | 71 | salePrice = cppDto.getSalePrice(); |
68 | SellerOrderComputeResult computeResult = cppDto.getComputeResult(); | 72 | SellerOrderComputeResult computeResult = cppDto.getComputeResult(); |
@@ -78,7 +82,8 @@ public class SellerDecrPriceTaskHandler extends AbstractSellerAdjustPriceTaskHan | @@ -78,7 +82,8 @@ public class SellerDecrPriceTaskHandler extends AbstractSellerAdjustPriceTaskHan | ||
78 | .seriNo(String.valueOf(taskId)) | 82 | .seriNo(String.valueOf(taskId)) |
79 | .type(SellerWalletDetail.Type.SUBTRACT_PRICE.getValue()).build(); | 83 | .type(SellerWalletDetail.Type.SUBTRACT_PRICE.getValue()).build(); |
80 | 84 | ||
81 | - log.info("[{}-{}] post use total earnest:{},diff earnest:{},num:{}", uid, taskId, totalDiffMoney, diffEarnestMoney, result.successCnt); | 85 | + log.info("[{}-{}] post use total earnest:{},diff earnest:{},num:{}", |
86 | + uid, taskId, totalDiffMoney, diffEarnestMoney, result.successCnt); | ||
82 | SellerWallet sellerWallet = merchantOrderPaymentService.changePriceUseEarnest(uid, totalDiffMoney, moai); | 87 | SellerWallet sellerWallet = merchantOrderPaymentService.changePriceUseEarnest(uid, totalDiffMoney, moai); |
83 | 88 | ||
84 | log.info("[{}-{}] post use total earnest result:{}", uid, taskId, sellerWallet); | 89 | log.info("[{}-{}] post use total earnest result:{}", uid, taskId, sellerWallet); |
@@ -15,12 +15,14 @@ import com.yohoufo.dal.order.SellerTaskDetailMapper; | @@ -15,12 +15,14 @@ import com.yohoufo.dal.order.SellerTaskDetailMapper; | ||
15 | import com.yohoufo.dal.order.model.*; | 15 | import com.yohoufo.dal.order.model.*; |
16 | import com.yohoufo.order.model.dto.SellerTaskDTO; | 16 | import com.yohoufo.order.model.dto.SellerTaskDTO; |
17 | import com.yohoufo.order.model.dto.SellerTaskResult; | 17 | import com.yohoufo.order.model.dto.SellerTaskResult; |
18 | +import com.yohoufo.order.model.dto.SkupDownShelfPrepareDto; | ||
18 | import com.yohoufo.order.model.dto.SkupDto; | 19 | import com.yohoufo.order.model.dto.SkupDto; |
19 | import com.yohoufo.order.service.MerchantOrderPaymentService; | 20 | import com.yohoufo.order.service.MerchantOrderPaymentService; |
20 | import com.yohoufo.order.service.cache.CacheKeyBuilder; | 21 | import com.yohoufo.order.service.cache.CacheKeyBuilder; |
21 | import com.yohoufo.order.service.seller.setting.SellerService; | 22 | import com.yohoufo.order.service.seller.setting.SellerService; |
22 | import com.yohoufo.order.service.proxy.ProductProxyService; | 23 | import com.yohoufo.order.service.proxy.ProductProxyService; |
23 | import com.yohoufo.order.service.seller.SellerGoodsStatusFlowService; | 24 | import com.yohoufo.order.service.seller.SellerGoodsStatusFlowService; |
25 | +import com.yohoufo.order.utils.SellerGoodsHelper; | ||
24 | import org.apache.commons.collections.CollectionUtils; | 26 | import org.apache.commons.collections.CollectionUtils; |
25 | import org.springframework.beans.factory.annotation.Autowired; | 27 | import org.springframework.beans.factory.annotation.Autowired; |
26 | import org.springframework.stereotype.Component; | 28 | import org.springframework.stereotype.Component; |
@@ -36,7 +38,7 @@ import java.util.stream.Collectors; | @@ -36,7 +38,7 @@ import java.util.stream.Collectors; | ||
36 | * Created by jiexiang.wu on 2018/12/21. | 38 | * Created by jiexiang.wu on 2018/12/21. |
37 | */ | 39 | */ |
38 | @Component | 40 | @Component |
39 | -public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<Integer, SkupDto>> { | 41 | +public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<SkupDownShelfPrepareDto> { |
40 | 42 | ||
41 | @Autowired | 43 | @Autowired |
42 | private SellerOrderMapper sellerOrderMapper; | 44 | private SellerOrderMapper sellerOrderMapper; |
@@ -54,8 +56,9 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In | @@ -54,8 +56,9 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In | ||
54 | private MerchantOrderPaymentService merchantOrderPaymentService; | 56 | private MerchantOrderPaymentService merchantOrderPaymentService; |
55 | 57 | ||
56 | @Override | 58 | @Override |
57 | - protected boolean preHandle(SellerTaskResult result, SellerTaskDTO<Map<Integer, SkupDto>> taskDto) { | ||
58 | - Map<Integer, SkupDto> skupDtoMap = taskDto.getProcessData(); | 59 | + protected boolean preHandle(SellerTaskResult result, SellerTaskDTO<SkupDownShelfPrepareDto> taskDto) { |
60 | + SkupDownShelfPrepareDto sdspDto = taskDto.getProcessData(); | ||
61 | + Map<Integer, SkupDto> skupDtoMap = sdspDto.getIdSkupMap(); | ||
59 | Set<Integer> skupSets = skupDtoMap.keySet(); | 62 | Set<Integer> skupSets = skupDtoMap.keySet(); |
60 | List<SellerOrder> soList = sellerOrderMapper.selectBySkups(skupSets); | 63 | List<SellerOrder> soList = sellerOrderMapper.selectBySkups(skupSets); |
61 | for (SellerOrder so : soList) { | 64 | for (SellerOrder so : soList) { |
@@ -69,8 +72,9 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In | @@ -69,8 +72,9 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In | ||
69 | } | 72 | } |
70 | 73 | ||
71 | @Override | 74 | @Override |
72 | - protected List<FutureTask> getFutureTasks(SellerTaskResult result, SellerTaskDTO<Map<Integer, SkupDto>> taskDto) { | ||
73 | - Map<Integer, SkupDto> skupDtoMap = taskDto.getProcessData(); | 75 | + protected List<FutureTask> getFutureTasks(SellerTaskResult result, SellerTaskDTO<SkupDownShelfPrepareDto> taskDto) { |
76 | + SkupDownShelfPrepareDto sdspDto = taskDto.getProcessData(); | ||
77 | + Map<Integer, SkupDto> skupDtoMap = sdspDto.getIdSkupMap(); | ||
74 | List<FutureTask> futureTasks = Lists.newArrayList(); | 78 | List<FutureTask> futureTasks = Lists.newArrayList(); |
75 | for (Map.Entry<Integer, SkupDto> entry : skupDtoMap.entrySet()) { | 79 | for (Map.Entry<Integer, SkupDto> entry : skupDtoMap.entrySet()) { |
76 | FutureTask<Integer> futureTask = new FutureTask<>(new DownShelfTask(taskDto.getUid(), taskDto.getTaskId(), entry.getValue())); | 80 | FutureTask<Integer> futureTask = new FutureTask<>(new DownShelfTask(taskDto.getUid(), taskDto.getTaskId(), entry.getValue())); |
@@ -80,11 +84,12 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In | @@ -80,11 +84,12 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In | ||
80 | } | 84 | } |
81 | 85 | ||
82 | @Override | 86 | @Override |
83 | - public void postHandle(SellerTaskResult result, SellerTaskDTO<Map<Integer, SkupDto>> taskDto) { | 87 | + public void postHandle(SellerTaskResult result, SellerTaskDTO<SkupDownShelfPrepareDto> taskDto) { |
84 | if (result.successCnt > 0) { | 88 | if (result.successCnt > 0) { |
89 | + SkupDownShelfPrepareDto sdspDto = taskDto.getProcessData(); | ||
90 | + Map<Integer, SkupDto> skupDtoMap = sdspDto.getIdSkupMap(); | ||
85 | int uid = taskDto.getUid(); | 91 | int uid = taskDto.getUid(); |
86 | long taskId = taskDto.getTaskId(); | 92 | long taskId = taskDto.getTaskId(); |
87 | - Map<Integer, SkupDto> skupDtoMap = taskDto.getProcessData(); | ||
88 | //下架成功的订单 | 93 | //下架成功的订单 |
89 | List<SellerOrder> successOrders = Lists.newArrayList(); | 94 | List<SellerOrder> successOrders = Lists.newArrayList(); |
90 | for (Integer skup : result.successSkups) { | 95 | for (Integer skup : result.successSkups) { |
@@ -92,10 +97,13 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In | @@ -92,10 +97,13 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In | ||
92 | } | 97 | } |
93 | try { | 98 | try { |
94 | boolean isSuper = sellerService.isSuperEntrySeller(uid); | 99 | boolean isSuper = sellerService.isSuperEntrySeller(uid); |
95 | - //退保证金 | ||
96 | - SellerWallet sellerWallet = postRefundEarnest(uid, taskId, isSuper, result, successOrders); | ||
97 | - //明细 | ||
98 | - addWalletDetail(uid, taskId, isSuper, sellerWallet, successOrders); | 100 | + boolean isQuickDeliver = SellerGoodsHelper.isQuickDeliver(sdspDto.getSkupType()); |
101 | + if (!isQuickDeliver) { | ||
102 | + //退保证金 | ||
103 | + SellerWallet sellerWallet = postRefundEarnest(uid, taskId, isSuper, result, successOrders); | ||
104 | + //明细 | ||
105 | + addWalletDetail(uid, taskId, isSuper, sellerWallet, successOrders); | ||
106 | + } | ||
99 | //消息盒子 | 107 | //消息盒子 |
100 | inboxNotify(uid, skupDtoMap); | 108 | inboxNotify(uid, skupDtoMap); |
101 | 109 |
@@ -3,11 +3,13 @@ package com.yohoufo.order.service.handler; | @@ -3,11 +3,13 @@ package com.yohoufo.order.service.handler; | ||
3 | import com.google.common.collect.Lists; | 3 | import com.google.common.collect.Lists; |
4 | import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; | 4 | import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; |
5 | import com.yohobuy.ufo.model.order.bo.OrderInfo; | 5 | import com.yohobuy.ufo.model.order.bo.OrderInfo; |
6 | +import com.yohobuy.ufo.model.order.constants.SkupType; | ||
6 | import com.yohoufo.dal.order.model.SellerOrder; | 7 | import com.yohoufo.dal.order.model.SellerOrder; |
7 | import com.yohoufo.dal.order.model.SellerOrderGoods; | 8 | import com.yohoufo.dal.order.model.SellerOrderGoods; |
8 | import com.yohoufo.dal.order.model.SellerWallet; | 9 | import com.yohoufo.dal.order.model.SellerWallet; |
9 | import com.yohoufo.dal.order.model.SellerWalletDetail; | 10 | import com.yohoufo.dal.order.model.SellerWalletDetail; |
10 | import com.yohoufo.order.model.dto.*; | 11 | import com.yohoufo.order.model.dto.*; |
12 | +import com.yohoufo.order.utils.SellerGoodsHelper; | ||
11 | import org.springframework.stereotype.Component; | 13 | import org.springframework.stereotype.Component; |
12 | 14 | ||
13 | import java.math.BigDecimal; | 15 | import java.math.BigDecimal; |
@@ -50,9 +52,12 @@ public class SellerIncrPriceTaskHandler extends AbstractSellerAdjustPriceTaskHan | @@ -50,9 +52,12 @@ public class SellerIncrPriceTaskHandler extends AbstractSellerAdjustPriceTaskHan | ||
50 | .earnestMoney(totalDiffMoney).productCount(skupDtoMap.size()) | 52 | .earnestMoney(totalDiffMoney).productCount(skupDtoMap.size()) |
51 | .seriNo(String.valueOf(taskId)) | 53 | .seriNo(String.valueOf(taskId)) |
52 | .type(swdType.getValue()).build(); | 54 | .type(swdType.getValue()).build(); |
53 | - | ||
54 | - log.info("[{}-{}] pre use total earnest:{},diff earnest:{},num:{},super:{}", uid, taskId, totalDiffMoney, diffEarnestMoney, skupDtoMap.size(), cppDto.getSellerBo().isSuper()); | ||
55 | - SellerWallet sellerWallet = cppDto.getSellerBo().isSuper() ? new SellerWallet() : merchantOrderPaymentService.changePriceUseEarnest(uid, totalDiffMoney, moai); | 55 | + final SkupType skupType = cppDto.getSkupType(); |
56 | + final boolean isSuper = cppDto.getSellerBo().isSuper(); | ||
57 | + log.info("[{}-{}] pre use total earnest:{},diff earnest:{},num:{},super:{} skupType {}", | ||
58 | + uid, taskId, totalDiffMoney, diffEarnestMoney, skupDtoMap.size(), isSuper, skupType); | ||
59 | + boolean noChangeMoney = SellerGoodsHelper.isQuickDeliver(skupType) || isSuper; | ||
60 | + SellerWallet sellerWallet = noChangeMoney ? new SellerWallet() : merchantOrderPaymentService.changePriceUseEarnest(uid, totalDiffMoney, moai); | ||
56 | result.sellerWallet = sellerWallet; | 61 | result.sellerWallet = sellerWallet; |
57 | log.info("[{}-{}] pre use total earnest result:{}", uid, taskId, sellerWallet); | 62 | log.info("[{}-{}] pre use total earnest result:{}", uid, taskId, sellerWallet); |
58 | return Objects.nonNull(sellerWallet); | 63 | return Objects.nonNull(sellerWallet); |
@@ -63,7 +68,9 @@ public class SellerIncrPriceTaskHandler extends AbstractSellerAdjustPriceTaskHan | @@ -63,7 +68,9 @@ public class SellerIncrPriceTaskHandler extends AbstractSellerAdjustPriceTaskHan | ||
63 | ChangePricePrepareDTO cppDto = taskDto.getProcessData(); | 68 | ChangePricePrepareDTO cppDto = taskDto.getProcessData(); |
64 | int uid = taskDto.getUid(); | 69 | int uid = taskDto.getUid(); |
65 | long taskId = taskDto.getTaskId(); | 70 | long taskId = taskDto.getTaskId(); |
66 | - if (result.failCnt > 0 && !cppDto.getSellerBo().isSuper()) { | 71 | + final boolean isSuper = cppDto.getSellerBo().isSuper(); |
72 | + final boolean isQuickDeliver = SellerGoodsHelper.isQuickDeliver(cppDto.getSkupType()); | ||
73 | + if (!isQuickDeliver && result.failCnt > 0 && !isSuper) { | ||
67 | BigDecimal totalDiffMoney = cppDto.getDiffEarnestMoney().multiply(BigDecimal.valueOf(-1 * result.failCnt)); | 74 | BigDecimal totalDiffMoney = cppDto.getDiffEarnestMoney().multiply(BigDecimal.valueOf(-1 * result.failCnt)); |
68 | MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid) | 75 | MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid) |
69 | .afterProductPrice(cppDto.getSalePrice()) | 76 | .afterProductPrice(cppDto.getSalePrice()) |
@@ -94,7 +101,7 @@ public class SellerIncrPriceTaskHandler extends AbstractSellerAdjustPriceTaskHan | @@ -94,7 +101,7 @@ public class SellerIncrPriceTaskHandler extends AbstractSellerAdjustPriceTaskHan | ||
94 | 101 | ||
95 | log.info("[{}-{}] has {} skup success,need to add wallet detail", uid, taskId, result.successCnt); | 102 | log.info("[{}-{}] has {} skup success,need to add wallet detail", uid, taskId, result.successCnt); |
96 | try { | 103 | try { |
97 | - if (!cppDto.getSellerBo().isSuper()) { | 104 | + if (!isQuickDeliver && !isSuper) { |
98 | //4 划账记录 | 105 | //4 划账记录 |
99 | List<OrderInfo> orderList = successOrders.parallelStream().map( | 106 | List<OrderInfo> orderList = successOrders.parallelStream().map( |
100 | so -> OrderInfo.builder().orderCode(so.getOrderCode()).amount(cppDto.getDiffEarnestMoney()).build()) | 107 | so -> OrderInfo.builder().orderCode(so.getOrderCode()).amount(cppDto.getDiffEarnestMoney()).build()) |
@@ -329,12 +329,12 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic | @@ -329,12 +329,12 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic | ||
329 | //扣减保证金 | 329 | //扣减保证金 |
330 | final int num = req.getNum(); | 330 | final int num = req.getNum(); |
331 | int uid = req.getUid(); | 331 | int uid = req.getUid(); |
332 | - SellerBo sellerBo = sellerAuthCheckService.checkAuth(uid, SellerFuncEnum.BATCH_PUBLISH); | 332 | + SellerBo sellerBo = sellerAuthCheckService.checkAuth(uid, ctx.getSkupType(), SellerFuncEnum.BATCH_PUBLISH); |
333 | Boolean isSuper = sellerBo.isSuper(); | 333 | Boolean isSuper = sellerBo.isSuper(); |
334 | SellerOrderComputeResult socr = ctx.getSellerOrderComputeResult(); | 334 | SellerOrderComputeResult socr = ctx.getSellerOrderComputeResult(); |
335 | BigDecimal singleEarestMoney = socr.getEarnestMoney().getEarnestMoney(); | 335 | BigDecimal singleEarestMoney = socr.getEarnestMoney().getEarnestMoney(); |
336 | BigDecimal mEarestMoney = priceComputePrepareProcessor.checkNGetMergeEarnestMoney(uid, singleEarestMoney, | 336 | BigDecimal mEarestMoney = priceComputePrepareProcessor.checkNGetMergeEarnestMoney(uid, singleEarestMoney, |
337 | - num, ctx.getSalePrice(), isSuper); | 337 | + num, ctx.getSalePrice(), isSuper, ctx.getSkupType()); |
338 | SellerWalletDetail.Type swdType = SellerWalletDetail.Type.PUBLISH; | 338 | SellerWalletDetail.Type swdType = SellerWalletDetail.Type.PUBLISH; |
339 | MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid) | 339 | MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid) |
340 | .storageId(ctx.getStorageId()).earnestMoney(mEarestMoney) | 340 | .storageId(ctx.getStorageId()).earnestMoney(mEarestMoney) |
@@ -413,7 +413,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic | @@ -413,7 +413,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic | ||
413 | } | 413 | } |
414 | SellerWalletDetail.Type swdType = SellerWalletDetail.Type.SELLER_OFF; | 414 | SellerWalletDetail.Type swdType = SellerWalletDetail.Type.SELLER_OFF; |
415 | int uid = req.getUid(); | 415 | int uid = req.getUid(); |
416 | - SellerBo sellerBo = sellerAuthCheckService.checkAuth(uid, SellerFuncEnum.BATCH_OFFSHELVE); | 416 | + SellerBo sellerBo = sellerAuthCheckService.checkAuth(uid, null, SellerFuncEnum.BATCH_OFFSHELVE); |
417 | Boolean isSuper = sellerBo.isSuper(); | 417 | Boolean isSuper = sellerBo.isSuper(); |
418 | MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid) | 418 | MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid) |
419 | .earnestMoney(totalRefundEM).productCount(needCancelSkups.size()) | 419 | .earnestMoney(totalRefundEM).productCount(needCancelSkups.size()) |
@@ -590,7 +590,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic | @@ -590,7 +590,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic | ||
590 | ChangePricePrepareDTO cppDto = changePricePrepareProcessor.checkAndAcquire(req); | 590 | ChangePricePrepareDTO cppDto = changePricePrepareProcessor.checkAndAcquire(req); |
591 | BigDecimal preSalePrice = cppDto.getPreSalePrice(), | 591 | BigDecimal preSalePrice = cppDto.getPreSalePrice(), |
592 | salePrice = cppDto.getSalePrice(); | 592 | salePrice = cppDto.getSalePrice(); |
593 | - SellerBo sellerBo = sellerAuthCheckService.checkAuth(req.getUid(), SellerFuncEnum.BATCH_CHANGEPRICE); | 593 | + SellerBo sellerBo = sellerAuthCheckService.checkAuth(req.getUid(), null, SellerFuncEnum.BATCH_CHANGEPRICE); |
594 | boolean isSuper = sellerBo.isSuper(); | 594 | boolean isSuper = sellerBo.isSuper(); |
595 | int uid = req.getUid(); | 595 | int uid = req.getUid(); |
596 | Map<Integer, SkupDto> skupMap = cppDto.getSkupMap(); | 596 | Map<Integer, SkupDto> skupMap = cppDto.getSkupMap(); |
@@ -690,10 +690,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic | @@ -690,10 +690,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic | ||
690 | * @param req | 690 | * @param req |
691 | * @return | 691 | * @return |
692 | */ | 692 | */ |
693 | - public BatchChangePriceResp batchAdjustPrice(SellerBatchChangeReq req) throws GatewayException { | 693 | + public BatchChangePriceResp batchAdjustPrice(SellerBatchChangeReq req) { |
694 | //校验及计算金额 | 694 | //校验及计算金额 |
695 | ChangePricePrepareDTO cppDto = adjustPricePrepareProcessor.checkAndAcquire(req); | 695 | ChangePricePrepareDTO cppDto = adjustPricePrepareProcessor.checkAndAcquire(req); |
696 | - SellerBo sellerBo = sellerAuthCheckService.checkAuth(req.getUid(), SellerFuncEnum.BATCH_CHANGEPRICE); | 696 | + final SkupType skupType = cppDto.getSkupType(); |
697 | + SellerBo sellerBo = sellerAuthCheckService.checkAuth(req.getUid(), skupType, SellerFuncEnum.BATCH_CHANGEPRICE); | ||
697 | SellerTaskDTO<ChangePricePrepareDTO> taskDTO = null; | 698 | SellerTaskDTO<ChangePricePrepareDTO> taskDTO = null; |
698 | if (cppDto.getSalePrice().compareTo(cppDto.getPreSalePrice()) > 0) { | 699 | if (cppDto.getSalePrice().compareTo(cppDto.getPreSalePrice()) > 0) { |
699 | //涨价 | 700 | //涨价 |
@@ -725,8 +726,8 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic | @@ -725,8 +726,8 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic | ||
725 | } | 726 | } |
726 | 727 | ||
727 | public boolean batchDownShelf(SellerBatchChangeReq req) { | 728 | public boolean batchDownShelf(SellerBatchChangeReq req) { |
728 | - Map<Integer, SkupDto> skupDtoMap = sellerDownShelfPrepareProcessor.checkAndAcquire(req); | ||
729 | - SellerTaskDTO<Map<Integer, SkupDto>> taskDTO = new SellerTaskDTO(req.getUid(), | 729 | + SkupDownShelfPrepareDto skupDtoMap = sellerDownShelfPrepareProcessor.checkAndAcquire(req); |
730 | + SellerTaskDTO<SkupDownShelfPrepareDto> taskDTO = new SellerTaskDTO(req.getUid(), | ||
730 | SellerWalletDetail.Type.SELLER_OFF.getValue(), | 731 | SellerWalletDetail.Type.SELLER_OFF.getValue(), |
731 | sellerDownShelfTaskHandler, | 732 | sellerDownShelfTaskHandler, |
732 | JSON.toJSONString(req), | 733 | JSON.toJSONString(req), |
@@ -207,14 +207,14 @@ public class BuyerOrderChangeBusinessPostProcessor { | @@ -207,14 +207,14 @@ public class BuyerOrderChangeBusinessPostProcessor { | ||
207 | logger.info("[{}] notify resource to clear user cache", uid); | 207 | logger.info("[{}] notify resource to clear user cache", uid); |
208 | try { | 208 | try { |
209 | 209 | ||
210 | - String url = baseServiceCaller.getYohoGatewayUrl() + "?method=app.resources.clearUserCache&client_type=h5&uid=" + uid; | 210 | + String url = baseServiceCaller.getErpGatewayUrl() + "/erp/resources/user/clearCache/?uid=" + uid; |
211 | baseServiceCaller.proxyPost("app.resources.clearUserCache", url, null); | 211 | baseServiceCaller.proxyPost("app.resources.clearUserCache", url, null); |
212 | } catch (Exception ex) { | 212 | } catch (Exception ex) { |
213 | logger.error("clear user cache for resource,uid:{}", uid, ex); | 213 | logger.error("clear user cache for resource,uid:{}", uid, ex); |
214 | } | 214 | } |
215 | 215 | ||
216 | //2. | 216 | //2. |
217 | - logger.info("[{}] notify fofp to consume buyer order", uid); | 217 | + logger.info("[{}] notify fofp to consume buyer order", buyerOrder.getOrderCode()); |
218 | JSONObject jsonObject = new JSONObject(); | 218 | JSONObject jsonObject = new JSONObject(); |
219 | jsonObject.put("uid", uid); | 219 | jsonObject.put("uid", uid); |
220 | jsonObject.put("orderCode", buyerOrder.getOrderCode()); | 220 | jsonObject.put("orderCode", buyerOrder.getOrderCode()); |
@@ -29,17 +29,10 @@ public class BaseServiceCaller { | @@ -29,17 +29,10 @@ public class BaseServiceCaller { | ||
29 | @Value("${erp-gateway.url}") | 29 | @Value("${erp-gateway.url}") |
30 | private String erpGatewayUrl; | 30 | private String erpGatewayUrl; |
31 | 31 | ||
32 | - @Value("${yoho.gateway.url:http://service.yoho.yohoops.org}") | ||
33 | - private String yohoGatewayUrl; | ||
34 | - | ||
35 | public String getErpGatewayUrl() { | 32 | public String getErpGatewayUrl() { |
36 | return erpGatewayUrl; | 33 | return erpGatewayUrl; |
37 | } | 34 | } |
38 | 35 | ||
39 | - public String getYohoGatewayUrl() { | ||
40 | - return yohoGatewayUrl; | ||
41 | - } | ||
42 | - | ||
43 | public ApiResponse proxyPost(String serviceName, String url, Object object) { | 36 | public ApiResponse proxyPost(String serviceName, String url, Object object) { |
44 | return doPost(serviceName, url, object); | 37 | return doPost(serviceName, url, object); |
45 | } | 38 | } |
@@ -68,7 +68,7 @@ public class ImportPublishExcutor implements PublishExcutor<BatchImportPrdReq, S | @@ -68,7 +68,7 @@ public class ImportPublishExcutor implements PublishExcutor<BatchImportPrdReq, S | ||
68 | return null; | 68 | return null; |
69 | } | 69 | } |
70 | sellerWrapper = sellerWrapper.attachSellerLevelFunc((sw)->sellerFuncService.getSellerLevelFunc(sw)); | 70 | sellerWrapper = sellerWrapper.attachSellerLevelFunc((sw)->sellerFuncService.getSellerLevelFunc(sw)); |
71 | - sellerAuthCheckService.checkAuth(sellerBo, SellerFuncEnum.BATCH_PUBLISH); | 71 | + sellerAuthCheckService.checkAuth(sellerBo, null, SellerFuncEnum.BATCH_PUBLISH); |
72 | //TODO check left in wallet | 72 | //TODO check left in wallet |
73 | for(ProductImportTranItemBo importPrd : importPrds){ | 73 | for(ProductImportTranItemBo importPrd : importPrds){ |
74 | Integer storageId = importPrd.getStorageId(); | 74 | Integer storageId = importPrd.getStorageId(); |
@@ -5,11 +5,13 @@ import com.yohobuy.ufo.model.order.bo.SellerLevelFuncBo; | @@ -5,11 +5,13 @@ import com.yohobuy.ufo.model.order.bo.SellerLevelFuncBo; | ||
5 | import com.yohobuy.ufo.model.order.common.EntrySellerType; | 5 | import com.yohobuy.ufo.model.order.common.EntrySellerType; |
6 | import com.yohobuy.ufo.model.order.common.SellerFuncEnum; | 6 | import com.yohobuy.ufo.model.order.common.SellerFuncEnum; |
7 | import com.yohobuy.ufo.model.order.common.SellerWalletType; | 7 | import com.yohobuy.ufo.model.order.common.SellerWalletType; |
8 | +import com.yohobuy.ufo.model.order.constants.SkupType; | ||
8 | import com.yohoufo.common.exception.UfoServiceException; | 9 | import com.yohoufo.common.exception.UfoServiceException; |
9 | import com.yohoufo.dal.order.SellerWalletMapper; | 10 | import com.yohoufo.dal.order.SellerWalletMapper; |
10 | import com.yohoufo.dal.order.model.SellerWallet; | 11 | import com.yohoufo.dal.order.model.SellerWallet; |
11 | import com.yohoufo.order.service.seller.setting.SellerService; | 12 | import com.yohoufo.order.service.seller.setting.SellerService; |
12 | import com.yohoufo.order.utils.LoggerUtils; | 13 | import com.yohoufo.order.utils.LoggerUtils; |
14 | +import com.yohoufo.order.utils.SellerGoodsHelper; | ||
13 | import org.apache.commons.collections.CollectionUtils; | 15 | import org.apache.commons.collections.CollectionUtils; |
14 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
15 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -17,6 +19,7 @@ import org.springframework.stereotype.Service; | @@ -17,6 +19,7 @@ import org.springframework.stereotype.Service; | ||
17 | 19 | ||
18 | import java.math.BigDecimal; | 20 | import java.math.BigDecimal; |
19 | import java.util.List; | 21 | import java.util.List; |
22 | +import java.util.Objects; | ||
20 | 23 | ||
21 | /** | 24 | /** |
22 | * Created by chao.chen on 2019/1/15. | 25 | * Created by chao.chen on 2019/1/15. |
@@ -32,12 +35,13 @@ public class SellerAuthCheckService { | @@ -32,12 +35,13 @@ public class SellerAuthCheckService { | ||
32 | @Autowired | 35 | @Autowired |
33 | private SellerWalletMapper sellerWalletMapper; | 36 | private SellerWalletMapper sellerWalletMapper; |
34 | 37 | ||
35 | - public void checkAuth(SellerBo sellerBo, SellerFuncEnum sellerFunc){ | 38 | + public void checkAuth(SellerBo sellerBo, SkupType skupType, SellerFuncEnum sellerFunc){ |
36 | int uid = sellerBo.getUid(); | 39 | int uid = sellerBo.getUid(); |
37 | EntrySellerType est = sellerBo.getEntrySellerType(); | 40 | EntrySellerType est = sellerBo.getEntrySellerType(); |
38 | - boolean needCheck = sellerBo.isNormalSuper() || sellerBo.isLargeSettlementSuper(); | 41 | + boolean excludeSkupType = SellerGoodsHelper.isQuickDeliver(skupType); |
42 | + boolean includeSellerType = sellerBo.isNormalSuper() || sellerBo.isLargeSettlementSuper(); | ||
39 | 43 | ||
40 | - if (needCheck){ | 44 | + if (!excludeSkupType && includeSellerType){ |
41 | SellerLevelFuncBo slfb = sellerBo.getSellerLevelFunc(); | 45 | SellerLevelFuncBo slfb = sellerBo.getSellerLevelFunc(); |
42 | List<Integer> funcIdList = slfb.getFuncIdList(); | 46 | List<Integer> funcIdList = slfb.getFuncIdList(); |
43 | Integer level = slfb.getLevel(); | 47 | Integer level = slfb.getLevel(); |
@@ -53,9 +57,9 @@ public class SellerAuthCheckService { | @@ -53,9 +57,9 @@ public class SellerAuthCheckService { | ||
53 | } | 57 | } |
54 | } | 58 | } |
55 | 59 | ||
56 | - public SellerBo checkAuth(Integer uid, SellerFuncEnum sellerFunc){ | 60 | + public SellerBo checkAuth(Integer uid, SkupType skupType, SellerFuncEnum sellerFunc){ |
57 | SellerBo sellerBo = sellerService.getSellerWithAuth(uid); | 61 | SellerBo sellerBo = sellerService.getSellerWithAuth(uid); |
58 | - checkAuth(sellerBo, sellerFunc); | 62 | + checkAuth(sellerBo, skupType, sellerFunc); |
59 | return sellerBo; | 63 | return sellerBo; |
60 | } | 64 | } |
61 | 65 |
@@ -139,7 +139,7 @@ public class SingleGoodsChangePricePrepareProcessor { | @@ -139,7 +139,7 @@ public class SingleGoodsChangePricePrepareProcessor { | ||
139 | priceComputePrepareProcessor.checkIncome(storageId, computeResult.getIncome()); | 139 | priceComputePrepareProcessor.checkIncome(storageId, computeResult.getIncome()); |
140 | SellerBo sellerBo = sellerService.getSellerWithAuth(uid); | 140 | SellerBo sellerBo = sellerService.getSellerWithAuth(uid); |
141 | SellerFuncEnum sellerFuncEnum = SellerFuncEnum.SINGLE_CHANGE_PRICE; | 141 | SellerFuncEnum sellerFuncEnum = SellerFuncEnum.SINGLE_CHANGE_PRICE; |
142 | - sellerAuthCheckService.checkAuth(sellerBo, sellerFuncEnum); | 142 | + sellerAuthCheckService.checkAuth(sellerBo, skupType, sellerFuncEnum); |
143 | int num = req.getNum(); | 143 | int num = req.getNum(); |
144 | //作为入驻商户 检查钱包 | 144 | //作为入驻商户 检查钱包 |
145 | BigDecimal targetEM = computeResult.getEarnestMoney().getEarnestMoney(); | 145 | BigDecimal targetEM = computeResult.getEarnestMoney().getEarnestMoney(); |
@@ -147,7 +147,7 @@ public class SingleGoodsChangePricePrepareProcessor { | @@ -147,7 +147,7 @@ public class SingleGoodsChangePricePrepareProcessor { | ||
147 | BigDecimal diffEarnestMoney = BigDecimalHelper.calDiff(preEarnestMoney,targetEM); | 147 | BigDecimal diffEarnestMoney = BigDecimalHelper.calDiff(preEarnestMoney,targetEM); |
148 | if (sellerBo.isCommonEntry()){ | 148 | if (sellerBo.isCommonEntry()){ |
149 | priceComputePrepareProcessor.checkNGetMergeEarnestMoney(uid, diffEarnestMoney, | 149 | priceComputePrepareProcessor.checkNGetMergeEarnestMoney(uid, diffEarnestMoney, |
150 | - num, salePrice, false); | 150 | + num, salePrice, false, skupType); |
151 | } | 151 | } |
152 | //buildSellerBo one skup Map | 152 | //buildSellerBo one skup Map |
153 | Map<Integer, SkupDto> skupMap = new HashMap<>(1); | 153 | Map<Integer, SkupDto> skupMap = new HashMap<>(1); |
@@ -88,7 +88,6 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh | @@ -88,7 +88,6 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh | ||
88 | BigDecimal salePrice = priceComputePrepareProcessor.checkAndAcquireSalePrice(req.getPrice(), skupType); | 88 | BigDecimal salePrice = priceComputePrepareProcessor.checkAndAcquireSalePrice(req.getPrice(), skupType); |
89 | //若needChangePriceSkupList中有skup出现不存在于skupOfSalingMap keys中,说明该skup走到了其他状态中 | 89 | //若needChangePriceSkupList中有skup出现不存在于skupOfSalingMap keys中,说明该skup走到了其他状态中 |
90 | Map<Integer, SkupDto> skupMap = checkNeedProcessSkups(getExpectedSkups(req), req.getOldPrice(), salePrice, skupOfSalingMap); | 90 | Map<Integer, SkupDto> skupMap = checkNeedProcessSkups(getExpectedSkups(req), req.getOldPrice(), salePrice, skupOfSalingMap); |
91 | -// // | ||
92 | SkupDto sampleSkupDto = skupMap.values().iterator().next(); | 91 | SkupDto sampleSkupDto = skupMap.values().iterator().next(); |
93 | int sampleSkup = sampleSkupDto.getSkup(); | 92 | int sampleSkup = sampleSkupDto.getSkup(); |
94 | SellerOrderGoods sampleSog = sampleSkupDto.getSellerOrderGoods(); | 93 | SellerOrderGoods sampleSog = sampleSkupDto.getSellerOrderGoods(); |
@@ -113,7 +112,8 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh | @@ -113,7 +112,8 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh | ||
113 | BigDecimal diffEarnestMoney = BigDecimalHelper.calDiff(sourceEM,targetEM); | 112 | BigDecimal diffEarnestMoney = BigDecimalHelper.calDiff(sourceEM,targetEM); |
114 | SellerBo sellerBo = sellerService.getSellerWithAuth(uid); | 113 | SellerBo sellerBo = sellerService.getSellerWithAuth(uid); |
115 | if (diffEarnestMoney.compareTo(BigDecimal.ZERO)>0){ | 114 | if (diffEarnestMoney.compareTo(BigDecimal.ZERO)>0){ |
116 | - priceComputePrepareProcessor.checkNGetMergeEarnestMoney(uid, diffEarnestMoney, num, salePrice, sellerBo.isSuper()); | 115 | + priceComputePrepareProcessor.checkNGetMergeEarnestMoney(uid, diffEarnestMoney, num, |
116 | + salePrice, sellerBo.isSuper(), skupType); | ||
117 | } | 117 | } |
118 | priceComputePrepareProcessor.checkIncome(storageId, computeResult.getIncome()); | 118 | priceComputePrepareProcessor.checkIncome(storageId, computeResult.getIncome()); |
119 | 119 | ||
@@ -182,7 +182,8 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh | @@ -182,7 +182,8 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh | ||
182 | throw new UfoServiceException(400, "部分商品正在等待买家支付"); | 182 | throw new UfoServiceException(400, "部分商品正在等待买家支付"); |
183 | } | 183 | } |
184 | return sellerOrderGoodList.parallelStream().collect(Collectors.toMap(SellerOrderGoods::getId, | 184 | return sellerOrderGoodList.parallelStream().collect(Collectors.toMap(SellerOrderGoods::getId, |
185 | - (sog)-> SkupDto.builder().skup(sog.getId()).sellerOrderGoods(sog).batchNo(sog.getBatchNo()).build())); | 185 | + (sog)-> SkupDto.builder().skup(sog.getId()).sellerOrderGoods(sog) |
186 | + .batchNo(sog.getBatchNo()).build())); | ||
186 | } | 187 | } |
187 | 188 | ||
188 | 189 |
@@ -149,10 +149,10 @@ public class PriceComputePrepareProcessor { | @@ -149,10 +149,10 @@ public class PriceComputePrepareProcessor { | ||
149 | //check seller type and wallet | 149 | //check seller type and wallet |
150 | SellerFuncEnum sellerFuncEnum = SellerFuncEnum.BATCH_PUBLISH; | 150 | SellerFuncEnum sellerFuncEnum = SellerFuncEnum.BATCH_PUBLISH; |
151 | SellerBo sellerBo = sellerService.getSellerWithAuth(uid); | 151 | SellerBo sellerBo = sellerService.getSellerWithAuth(uid); |
152 | - sellerAuthCheckService.checkAuth(sellerBo, sellerFuncEnum); | 152 | + sellerAuthCheckService.checkAuth(sellerBo, skupType, sellerFuncEnum); |
153 | if (sellerBo.isCommonEntry()){ | 153 | if (sellerBo.isCommonEntry()){ |
154 | checkNGetMergeEarnestMoney(uid, computeResult.getEarnestMoney().getEarnestMoney(), | 154 | checkNGetMergeEarnestMoney(uid, computeResult.getEarnestMoney().getEarnestMoney(), |
155 | - num, salePrice, false); | 155 | + num, salePrice, false, skupType); |
156 | } | 156 | } |
157 | return PriceComputeNode.builder() | 157 | return PriceComputeNode.builder() |
158 | .uid(uid) | 158 | .uid(uid) |
@@ -212,15 +212,17 @@ public class PriceComputePrepareProcessor { | @@ -212,15 +212,17 @@ public class PriceComputePrepareProcessor { | ||
212 | if (prdPrice.subtract(minPrice).doubleValue() < 0D){ | 212 | if (prdPrice.subtract(minPrice).doubleValue() < 0D){ |
213 | log.warn("in computePublishPrd,uid {} minPrice {}, storageId {}", | 213 | log.warn("in computePublishPrd,uid {} minPrice {}, storageId {}", |
214 | uid, minPrice, storageId); | 214 | uid, minPrice, storageId); |
215 | - if (isShowError) | 215 | + if (isShowError){ |
216 | throw new UfoServiceException(501, "您的出价过低"); | 216 | throw new UfoServiceException(501, "您的出价过低"); |
217 | + } | ||
217 | } | 218 | } |
218 | 219 | ||
219 | if (prdPrice.subtract(maxPrice).doubleValue() > 0D){ | 220 | if (prdPrice.subtract(maxPrice).doubleValue() > 0D){ |
220 | log.warn("in computePublishPrd,uid {} maxPrice {}, storageId {}", | 221 | log.warn("in computePublishPrd,uid {} maxPrice {}, storageId {}", |
221 | uid, maxPrice, storageId); | 222 | uid, maxPrice, storageId); |
222 | - if (isShowError) | 223 | + if (isShowError){ |
223 | throw new UfoServiceException(501, "您的出价过高"); | 224 | throw new UfoServiceException(501, "您的出价过高"); |
225 | + } | ||
224 | } | 226 | } |
225 | } | 227 | } |
226 | 228 | ||
@@ -246,9 +248,13 @@ public class PriceComputePrepareProcessor { | @@ -246,9 +248,13 @@ public class PriceComputePrepareProcessor { | ||
246 | } | 248 | } |
247 | 249 | ||
248 | public BigDecimal checkNGetMergeEarnestMoney(int uid, BigDecimal singleEarestMoney, | 250 | public BigDecimal checkNGetMergeEarnestMoney(int uid, BigDecimal singleEarestMoney, |
249 | - int num, BigDecimal prdPrice, boolean isSuper){ | ||
250 | - BigDecimal mEarestMoney; | ||
251 | - mEarestMoney = BigDecimalHelper.halfUp(new BigDecimal(num).multiply(singleEarestMoney)); | 251 | + int num, BigDecimal prdPrice, |
252 | + boolean isSuper, SkupType skupType){ | ||
253 | + BigDecimal mEarestMoney = BigDecimalHelper.halfUp(new BigDecimal(num).multiply(singleEarestMoney)); | ||
254 | + | ||
255 | + if (SellerGoodsHelper.isQuickDeliver(skupType)){ | ||
256 | + return mEarestMoney; | ||
257 | + } | ||
252 | if(!isSuper) { | 258 | if(!isSuper) { |
253 | boolean isEnough = sellerAuthCheckService.isEnough(uid, mEarestMoney); | 259 | boolean isEnough = sellerAuthCheckService.isEnough(uid, mEarestMoney); |
254 | if (!isEnough) { | 260 | if (!isEnough) { |
1 | package com.yohoufo.order.service.seller.processor; | 1 | package com.yohoufo.order.service.seller.processor; |
2 | 2 | ||
3 | import com.yohobuy.ufo.model.order.common.SkupStatus; | 3 | import com.yohobuy.ufo.model.order.common.SkupStatus; |
4 | +import com.yohobuy.ufo.model.order.constants.SkupType; | ||
4 | import com.yohobuy.ufo.model.order.req.SellerBatchChangeReq; | 5 | import com.yohobuy.ufo.model.order.req.SellerBatchChangeReq; |
5 | import com.yohoufo.common.exception.UfoServiceException; | 6 | import com.yohoufo.common.exception.UfoServiceException; |
6 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; | 7 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; |
7 | import com.yohoufo.dal.order.model.SellerOrderGoods; | 8 | import com.yohoufo.dal.order.model.SellerOrderGoods; |
8 | import com.yohobuy.ufo.model.order.common.Payment; | 9 | import com.yohobuy.ufo.model.order.common.Payment; |
10 | +import com.yohoufo.order.model.dto.SkupDownShelfPrepareDto; | ||
9 | import com.yohoufo.order.model.dto.SkupDto; | 11 | import com.yohoufo.order.model.dto.SkupDto; |
10 | import com.yohoufo.order.utils.LoggerUtils; | 12 | import com.yohoufo.order.utils.LoggerUtils; |
11 | import org.apache.commons.collections.CollectionUtils; | 13 | import org.apache.commons.collections.CollectionUtils; |
@@ -35,12 +37,19 @@ public class SellerDownShelfPrepareProcessor { | @@ -35,12 +37,19 @@ public class SellerDownShelfPrepareProcessor { | ||
35 | @Autowired | 37 | @Autowired |
36 | private SellerOrderGoodsMapper sellerOrderGoodsMapper; | 38 | private SellerOrderGoodsMapper sellerOrderGoodsMapper; |
37 | 39 | ||
38 | - public Map<Integer, SkupDto> checkAndAcquire(SellerBatchChangeReq req) { | 40 | + public SkupDownShelfPrepareDto checkAndAcquire(SellerBatchChangeReq req) { |
39 | int uid = req.getUid(); | 41 | int uid = req.getUid(); |
40 | if (uid <= 0) { | 42 | if (uid <= 0) { |
41 | logger.warn("batch off shelve checkAndAcquire uid illegal , req {}", req); | 43 | logger.warn("batch off shelve checkAndAcquire uid illegal , req {}", req); |
42 | throw new UfoServiceException(400, "参数[uid]错误"); | 44 | throw new UfoServiceException(400, "参数[uid]错误"); |
43 | } | 45 | } |
46 | + Integer skupTypeCode = req.getSkupType(); | ||
47 | + SkupType skupType; | ||
48 | + if (Objects.isNull(skupTypeCode) || Objects.isNull(skupType=SkupType.getSkupType(skupTypeCode))){ | ||
49 | + logger.warn("batch off shelve checkAndAcquire skupTypeCode illegal , req {}", req); | ||
50 | + throw new UfoServiceException(400, "参数[skupType]错误"); | ||
51 | + } | ||
52 | + | ||
44 | int num = req.getNum(); | 53 | int num = req.getNum(); |
45 | if (num <= 0) { | 54 | if (num <= 0) { |
46 | logger.warn("batch off shelve checkAndAcquire num is illegal, req {}", req); | 55 | logger.warn("batch off shelve checkAndAcquire num is illegal, req {}", req); |
@@ -59,7 +68,12 @@ public class SellerDownShelfPrepareProcessor { | @@ -59,7 +68,12 @@ public class SellerDownShelfPrepareProcessor { | ||
59 | } | 68 | } |
60 | //检查 | 69 | //检查 |
61 | Map<Integer, SkupDto> skupMap = checkNeedProcessSkups(req); | 70 | Map<Integer, SkupDto> skupMap = checkNeedProcessSkups(req); |
62 | - return skupMap; | 71 | + |
72 | + SkupDownShelfPrepareDto sdspDto = SkupDownShelfPrepareDto.builder() | ||
73 | + .idSkupMap(skupMap) | ||
74 | + .skupType(skupType) | ||
75 | + .build(); | ||
76 | + return sdspDto; | ||
63 | } | 77 | } |
64 | 78 | ||
65 | private Map<Integer, SkupDto> checkNeedProcessSkups(SellerBatchChangeReq req) { | 79 | private Map<Integer, SkupDto> checkNeedProcessSkups(SellerBatchChangeReq req) { |
@@ -67,4 +67,9 @@ public final class SellerGoodsHelper { | @@ -67,4 +67,9 @@ public final class SellerGoodsHelper { | ||
67 | } | 67 | } |
68 | return result; | 68 | return result; |
69 | } | 69 | } |
70 | + | ||
71 | + | ||
72 | + public static boolean isQuickDeliver(SkupType skupType){ | ||
73 | + return skupType != null && SkupType.QUICK_DELIVER.equals(skupType); | ||
74 | + } | ||
70 | } | 75 | } |
@@ -3,6 +3,7 @@ package com.yohoufo.order.service.seller.setting; | @@ -3,6 +3,7 @@ package com.yohoufo.order.service.seller.setting; | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | import com.yohobuy.ufo.model.order.bo.SellerBo; | 4 | import com.yohobuy.ufo.model.order.bo.SellerBo; |
5 | import com.yohobuy.ufo.model.order.common.SellerFuncEnum; | 5 | import com.yohobuy.ufo.model.order.common.SellerFuncEnum; |
6 | +import com.yohobuy.ufo.model.order.constants.SkupType; | ||
6 | import com.yohoufo.order.BaseWebTest; | 7 | import com.yohoufo.order.BaseWebTest; |
7 | import com.yohoufo.order.service.seller.SellerAuthCheckService; | 8 | import com.yohoufo.order.service.seller.SellerAuthCheckService; |
8 | import org.junit.Test; | 9 | import org.junit.Test; |
@@ -17,7 +18,8 @@ public class SellerAuthCheckServiceTest extends BaseWebTest { | @@ -17,7 +18,8 @@ public class SellerAuthCheckServiceTest extends BaseWebTest { | ||
17 | public void testCheckAuth(){ | 18 | public void testCheckAuth(){ |
18 | Integer uid = 500031424; | 19 | Integer uid = 500031424; |
19 | SellerFuncEnum sellerFunc = SellerFuncEnum.BATCH_CHANGEPRICE; | 20 | SellerFuncEnum sellerFunc = SellerFuncEnum.BATCH_CHANGEPRICE; |
20 | - SellerBo sellerBo = sellerAuthCheckService.checkAuth(uid, sellerFunc); | 21 | + SkupType skupType = SkupType.IN_STOCK; |
22 | + SellerBo sellerBo = sellerAuthCheckService.checkAuth(uid, skupType, sellerFunc); | ||
21 | System.out.println("testCheckAuth BATCH_CHANGEPRICE "+ JSONObject.toJSONString(sellerBo)); | 23 | System.out.println("testCheckAuth BATCH_CHANGEPRICE "+ JSONObject.toJSONString(sellerBo)); |
22 | } | 24 | } |
23 | } | 25 | } |
-
Please register or login to post a comment