Merge branch 'test6.9.12' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.12
Showing
25 changed files
with
216 additions
and
127 deletions
@@ -12,4 +12,6 @@ public interface BrandMapper { | @@ -12,4 +12,6 @@ public interface BrandMapper { | ||
12 | List<Brand> selectAll(); | 12 | List<Brand> selectAll(); |
13 | 13 | ||
14 | int updateByPrimaryKey(Brand record); | 14 | int updateByPrimaryKey(Brand record); |
15 | + | ||
16 | + List<Integer> selectExcludeAppraise(); | ||
15 | } | 17 | } |
@@ -8,10 +8,12 @@ import java.util.List; | @@ -8,10 +8,12 @@ import java.util.List; | ||
8 | 8 | ||
9 | public interface IdentifyRecordsMapper { | 9 | public interface IdentifyRecordsMapper { |
10 | IdentifyRecord selectByTagAndNfcId(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid); | 10 | IdentifyRecord selectByTagAndNfcId(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid); |
11 | - | 11 | + |
12 | int updateOwner(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("owner") Integer owner, @Param("newOrderCode")Long newOrderCode); | 12 | int updateOwner(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("owner") Integer owner, @Param("newOrderCode")Long newOrderCode); |
13 | 13 | ||
14 | int updateAllowPop(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("allowPop") Integer allowPop); | 14 | int updateAllowPop(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("allowPop") Integer allowPop); |
15 | 15 | ||
16 | IdentifyRecord selectByOrderCode(@Param("orderCode") Long orderCode); | 16 | IdentifyRecord selectByOrderCode(@Param("orderCode") Long orderCode); |
17 | + | ||
18 | + IdentifyRecord selectByTagId(@Param("tagId") String tagId); | ||
17 | } | 19 | } |
@@ -48,4 +48,8 @@ | @@ -48,4 +48,8 @@ | ||
48 | edit_time, edit_pid, order_by | 48 | edit_time, edit_pid, order_by |
49 | from brand | 49 | from brand |
50 | </select> | 50 | </select> |
51 | + <select id="selectExcludeAppraise" resultMap="BaseResultMap"> | ||
52 | + select id | ||
53 | + from brand where ex_raise = 1 | ||
54 | + </select> | ||
51 | </mapper> | 55 | </mapper> |
@@ -47,4 +47,10 @@ | @@ -47,4 +47,10 @@ | ||
47 | select <include refid="Base_Column_List" /> | 47 | select <include refid="Base_Column_List" /> |
48 | from identify_records where order_code = #{orderCode} or last_order_code = #{orderCode} limit 1 | 48 | from identify_records where order_code = #{orderCode} or last_order_code = #{orderCode} limit 1 |
49 | </select> | 49 | </select> |
50 | + | ||
51 | + <select id="selectByTagId" resultMap="BaseResultMap"> | ||
52 | + select | ||
53 | + <include refid="Base_Column_List" /> | ||
54 | + from identify_records where tag_id = #{tagId} limit 1 | ||
55 | + </select> | ||
50 | </mapper> | 56 | </mapper> |
@@ -4,5 +4,4 @@ public interface ClientSpecialSemanticCode { | @@ -4,5 +4,4 @@ public interface ClientSpecialSemanticCode { | ||
4 | int needRealName = 440; | 4 | int needRealName = 440; |
5 | int WaitingPayLimit = 512; | 5 | int WaitingPayLimit = 512; |
6 | int realNameMisMatch = 443; | 6 | int realNameMisMatch = 443; |
7 | - int mobileMisMatch = 444; | ||
8 | } | 7 | } |
@@ -135,19 +135,6 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -135,19 +135,6 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
135 | //是否直接鉴定通过 | 135 | //是否直接鉴定通过 |
136 | boolean isDirectPass = false; | 136 | boolean isDirectPass = false; |
137 | 137 | ||
138 | - // 极速 不管是寄存还是发货 都需要通知卖家发货 | ||
139 | - if (fastDeliveryProxyService.isFastDeliveryGoods(orderInfo.getSkup())){ | ||
140 | - | ||
141 | - String wayBillCode = fastDeliveryProxyService.getVRWaybillCode(orderInfo.getOrderCode()); | ||
142 | - // 同时生成物流单号,通知第三方发货 | ||
143 | - fastDeliveryProxyService.order(orderInfo.getSkup(), wayBillCode); | ||
144 | - | ||
145 | - // 卖家自动发货 | ||
146 | - executors.submit(()->{ | ||
147 | - expressInfoService.deliverToDepot(orderInfo.getSellerUid(), 0, orderInfo.getOrderCode(), wayBillCode, DepotType.NJ.getCode()); | ||
148 | - }); | ||
149 | - } | ||
150 | - | ||
151 | //门店订单支付后直接完成 | 138 | //门店订单支付后直接完成 |
152 | if (BuyerOrderUtils.isOffline(orderInfo)) { | 139 | if (BuyerOrderUtils.isOffline(orderInfo)) { |
153 | targetOrderStatus = OrderStatus.DONE; | 140 | targetOrderStatus = OrderStatus.DONE; |
@@ -187,6 +174,19 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -187,6 +174,19 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
187 | } | 174 | } |
188 | } | 175 | } |
189 | orderInfo.setStatus(orderStatusCode); | 176 | orderInfo.setStatus(orderStatusCode); |
177 | + | ||
178 | + // 极速 不管是寄存还是发货 都需要通知卖家发货 | ||
179 | + if (fastDeliveryProxyService.isFastDeliveryGoods(orderInfo.getSkup())){ | ||
180 | + | ||
181 | + String wayBillCode = fastDeliveryProxyService.getVRWaybillCode(orderInfo.getOrderCode()); | ||
182 | + // 同时生成物流单号,通知第三方发货 | ||
183 | + fastDeliveryProxyService.order(orderInfo.getSkup(), wayBillCode); | ||
184 | + | ||
185 | + // 卖家自动发货 | ||
186 | + executors.submit(()->{ | ||
187 | + expressInfoService.deliverToDepot(orderInfo.getSellerUid(), 0, orderInfo.getOrderCode(), wayBillCode, DepotType.NJ.getCode()); | ||
188 | + }); | ||
189 | + } | ||
190 | return result; | 190 | return result; |
191 | } | 191 | } |
192 | 192 |
@@ -33,6 +33,7 @@ import com.yohoufo.order.service.impl.PaymentServiceImpl; | @@ -33,6 +33,7 @@ import com.yohoufo.order.service.impl.PaymentServiceImpl; | ||
33 | import com.yohoufo.order.service.seller.setting.SellerService; | 33 | import com.yohoufo.order.service.seller.setting.SellerService; |
34 | import com.yohoufo.order.service.seller.setting.SellerWrapper; | 34 | import com.yohoufo.order.service.seller.setting.SellerWrapper; |
35 | import com.yohoufo.order.service.impl.TradeBillsService; | 35 | import com.yohoufo.order.service.impl.TradeBillsService; |
36 | +import com.yohoufo.order.utils.SellerHelper; | ||
36 | import org.apache.commons.lang3.StringUtils; | 37 | import org.apache.commons.lang3.StringUtils; |
37 | import org.slf4j.Logger; | 38 | import org.slf4j.Logger; |
38 | import org.slf4j.LoggerFactory; | 39 | import org.slf4j.LoggerFactory; |
@@ -861,7 +862,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { | @@ -861,7 +862,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { | ||
861 | private boolean isSuperWithoutLock(int uid){ | 862 | private boolean isSuperWithoutLock(int uid){ |
862 | SellerWrapper sellerWrapper = sellerService.getBaseSellerWrapper(uid); | 863 | SellerWrapper sellerWrapper = sellerService.getBaseSellerWrapper(uid); |
863 | SellerBo sellerBo = sellerWrapper.buildSellerBo(); | 864 | SellerBo sellerBo = sellerWrapper.buildSellerBo(); |
864 | - return sellerBo.isNormalSuper() || sellerBo.isLargeSettlementSuper(); | 865 | + return SellerHelper.isSuper(sellerBo.getEntrySellerType()); |
865 | } | 866 | } |
866 | 867 | ||
867 | private static class CalculateNode{ | 868 | private static class CalculateNode{ |
@@ -377,14 +377,12 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { | @@ -377,14 +377,12 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { | ||
377 | // 上架 | 377 | // 上架 |
378 | List<ProductImportTranItemBo> responseList = Lists.newArrayList(); | 378 | List<ProductImportTranItemBo> responseList = Lists.newArrayList(); |
379 | 379 | ||
380 | - List<Integer> skupIds = Lists.newArrayList(); | ||
381 | - | ||
382 | // 上架的代码(和之前同) | 380 | // 上架的代码(和之前同) |
383 | List<FastDeliveryBatchOnShelfResp> shelfResps = Lists.newArrayList(); | 381 | List<FastDeliveryBatchOnShelfResp> shelfResps = Lists.newArrayList(); |
384 | for(FastDeliveryBatchOnShelfReq.ProductInfo productInfo : req.getProductInfos()){ | 382 | for(FastDeliveryBatchOnShelfReq.ProductInfo productInfo : req.getProductInfos()){ |
385 | 383 | ||
386 | StorageCheckResp storage = storageMap.get(getProductCodeSizeNameKey(productInfo.getProductCode(), productInfo.getSizeName())); | 384 | StorageCheckResp storage = storageMap.get(getProductCodeSizeNameKey(productInfo.getProductCode(), productInfo.getSizeName())); |
387 | - if (storage == null){ | 385 | + if (storage == null || storage.getStorageId() == null){ |
388 | logger.warn("productCode {} and sizeName {}. storageId not exist.", productInfo.getProductCode(), productInfo.getSizeName()); | 386 | logger.warn("productCode {} and sizeName {}. storageId not exist.", productInfo.getProductCode(), productInfo.getSizeName()); |
389 | throw new UfoServiceException(403, "货号和尺寸对应的storageId不存在"); | 387 | throw new UfoServiceException(403, "货号和尺寸对应的storageId不存在"); |
390 | } | 388 | } |
@@ -487,7 +485,7 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { | @@ -487,7 +485,7 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { | ||
487 | 485 | ||
488 | private ProductImportTranItemBo buildShelfResp(FastDeliveryBatchOnShelfReq req, FastDeliveryBatchOnShelfReq.ProductInfo productInfo, | 486 | private ProductImportTranItemBo buildShelfResp(FastDeliveryBatchOnShelfReq req, FastDeliveryBatchOnShelfReq.ProductInfo productInfo, |
489 | SellerOrderSubmitHandler.ForkJoinResult fjr) { | 487 | SellerOrderSubmitHandler.ForkJoinResult fjr) { |
490 | - // 构造结果对象 最终结果插入到 商品服务的product_import_tran_item表中 | 488 | + // 构造结果对象 最终结果插入到 商品服务的 product_import_tran_item 表中 |
491 | ProductImportTranItemBo productImportTranItemBo = new ProductImportTranItemBo(); | 489 | ProductImportTranItemBo productImportTranItemBo = new ProductImportTranItemBo(); |
492 | productImportTranItemBo.setUid(req.getUid()); | 490 | productImportTranItemBo.setUid(req.getUid()); |
493 | productImportTranItemBo.setProductCode(productInfo.getProductCode()); | 491 | productImportTranItemBo.setProductCode(productInfo.getProductCode()); |
@@ -71,18 +71,12 @@ public class ShoppingRiskWatchDog { | @@ -71,18 +71,12 @@ public class ShoppingRiskWatchDog { | ||
71 | logger.warn("checkOverseaOrderUserInfo: need realName cert, uid is {}", uid); | 71 | logger.warn("checkOverseaOrderUserInfo: need realName cert, uid is {}", uid); |
72 | throw new UfoServiceException(ClientSpecialSemanticCode.needRealName, "请完成实名认证后操作"); | 72 | throw new UfoServiceException(ClientSpecialSemanticCode.needRealName, "请完成实名认证后操作"); |
73 | } | 73 | } |
74 | - //(3) 校验和收件人的姓名,手机号是否一致 | 74 | + //(3) 校验收件人姓名是否和实名认证的姓名一致 |
75 | String buyerName = zhimaCert.getCertName(); | 75 | String buyerName = zhimaCert.getCertName(); |
76 | String receiverName = addressInfo.getConsignee(); | 76 | String receiverName = addressInfo.getConsignee(); |
77 | if(!buyerName.equals(receiverName)){ | 77 | if(!buyerName.equals(receiverName)){ |
78 | logger.warn("checkOverseaOrderUserInfo: name not match, receiverName is {}, buyerMobile is {}", receiverName, buyerName); | 78 | logger.warn("checkOverseaOrderUserInfo: name not match, receiverName is {}, buyerMobile is {}", receiverName, buyerName); |
79 | - throw new UfoServiceException(ClientSpecialSemanticCode.realNameMisMatch, "收件人姓名必须与实名认证信息一致"); | ||
80 | - } | ||
81 | - String buyerMobile = userProxyService.getMobile(uid); | ||
82 | - String receiverMobile = addressInfo.getMobile(); | ||
83 | - if(!buyerMobile.equals(receiverMobile)){ | ||
84 | - logger.warn("checkOverseaOrderUserInfo: mobile not match, receiverMobile is {}, buyerMobile is {}", receiverMobile, buyerMobile); | ||
85 | - throw new UfoServiceException(ClientSpecialSemanticCode.mobileMisMatch, "收件人手机号必须与账号对应手机号一致"); | 79 | + throw new UfoServiceException(ClientSpecialSemanticCode.realNameMisMatch, "收件人姓名必须与实名认证的姓名一致"); |
86 | } | 80 | } |
87 | } | 81 | } |
88 | 82 |
@@ -552,7 +552,7 @@ public class ShoppingServiceImpl implements IShoppingService { | @@ -552,7 +552,7 @@ public class ShoppingServiceImpl implements IShoppingService { | ||
552 | //查询并校验用户地址 | 552 | //查询并校验用户地址 |
553 | Pair<AddressInfo, AddressInfo> userAddressPair = getAndCheckAddressInfo(shoppingRequest); | 553 | Pair<AddressInfo, AddressInfo> userAddressPair = getAndCheckAddressInfo(shoppingRequest); |
554 | 554 | ||
555 | - //若购买的是香港仓商品,uid必须实名认证,且姓名和手机号必须与收货人一致 | 555 | + //若购买的是香港仓商品,uid必须实名认证,收货人姓名必须和实名认证姓名一致 |
556 | shoppingRiskWatchDog.checkOverseasOrderUserInfo(uid, psog.getAttributes(), userAddressPair.getKey()); | 556 | shoppingRiskWatchDog.checkOverseasOrderUserInfo(uid, psog.getAttributes(), userAddressPair.getKey()); |
557 | 557 | ||
558 | //算费 | 558 | //算费 |
@@ -47,7 +47,7 @@ public class FastDeliveryProxyService { | @@ -47,7 +47,7 @@ public class FastDeliveryProxyService { | ||
47 | 47 | ||
48 | 48 | ||
49 | public boolean isOnToThird(){ | 49 | public boolean isOnToThird(){ |
50 | - return configReader.getBoolean("ufo.fast.delivery.toThired", true); | 50 | + return configReader.getBoolean("ufo.fast.delivery.toThird", true); |
51 | } | 51 | } |
52 | 52 | ||
53 | /** | 53 | /** |
@@ -1076,6 +1076,22 @@ public class InBoxFacade extends BaseNoticeFacade{ | @@ -1076,6 +1076,22 @@ public class InBoxFacade extends BaseNoticeFacade{ | ||
1076 | } | 1076 | } |
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | + | ||
1080 | + public void noticeFastDeliverySeller(Integer uid, BigDecimal theshold){ | ||
1081 | + String logPrefix = "notice fast delivery seller"; | ||
1082 | + | ||
1083 | + try{ | ||
1084 | + newNotice(uid) | ||
1085 | + .withLogPrefix(logPrefix) | ||
1086 | + .withInBox(InboxBusinessTypeEnum.FAST_DELIVERY_SELLER_PART_FUNC, theshold) | ||
1087 | + .withSms(InboxBusinessTypeEnum.SMS_FAST_DELIVERY_SELLER_PERMISSION, theshold) | ||
1088 | + .send(); | ||
1089 | + }catch (Exception e){ | ||
1090 | + | ||
1091 | + } | ||
1092 | + | ||
1093 | + } | ||
1094 | + | ||
1079 | public void noticeSuperSellerDegrade(Integer uid, SuperEnterStageLevel sesl, BigDecimal leftInWallet) { | 1095 | public void noticeSuperSellerDegrade(Integer uid, SuperEnterStageLevel sesl, BigDecimal leftInWallet) { |
1080 | String logPrefix = "notice super seller degrade"; | 1096 | String logPrefix = "notice super seller degrade"; |
1081 | try { | 1097 | try { |
@@ -472,8 +472,22 @@ public class SellerEnterApplyService { | @@ -472,8 +472,22 @@ public class SellerEnterApplyService { | ||
472 | EntryThreshold set = estMap.get(currentEST); | 472 | EntryThreshold set = estMap.get(currentEST); |
473 | Supplier<SellerLevelFuncBo> slfSupplier = () ->SellerHelper.getSellerLevelFunc(currentEST, set, left); | 473 | Supplier<SellerLevelFuncBo> slfSupplier = () ->SellerHelper.getSellerLevelFunc(currentEST, set, left); |
474 | //目标身份对应的等级 | 474 | //目标身份对应的等级 |
475 | - logger.info("in changeLevel4Super ready change StoredSeller targetFuncLevel func, uid {} currentEnterType {}", | ||
476 | - uid, currentEnterType); | 475 | + logger.info("in changeLevel4Super ready change StoredSeller targetFuncLevel func, uid {} currentEnterType {}, {}", |
476 | + uid, currentEnterType, left); | ||
477 | + | ||
478 | + // 扣保证金 极速卖家场景-触发阀值场景 | ||
479 | + if (sellerBo.isFastDeliverySuper()){ | ||
480 | + | ||
481 | + if (left.compareTo(set.getPrepaymentAmount())<0){ | ||
482 | + inBoxFacade.noticeFastDeliverySeller(uid, set.getPrepaymentAmount()); | ||
483 | + }else if(left.compareTo(set.getGoodsOnOffShelveAmount())<0 && left.compareTo(set.getHiddenGoodsAmount())>=0){ | ||
484 | + inBoxFacade.noticeFastDeliverySeller(uid, set.getGoodsOnOffShelveAmount()); | ||
485 | + }else if(left.compareTo(set.getHiddenGoodsAmount())<0){ | ||
486 | + inBoxFacade.noticeFastDeliverySeller(uid, set.getHiddenGoodsAmount()); | ||
487 | + } | ||
488 | + | ||
489 | + return 0; | ||
490 | + } | ||
477 | 491 | ||
478 | int result = 0; | 492 | int result = 0; |
479 | if (sellerBo.isNormalSuper()) { | 493 | if (sellerBo.isNormalSuper()) { |
@@ -493,7 +507,10 @@ public class SellerEnterApplyService { | @@ -493,7 +507,10 @@ public class SellerEnterApplyService { | ||
493 | inBoxFacade.noticeSuperSellerDegrade(uid, targetSESL, bslfb.getWalletThreshold()); | 507 | inBoxFacade.noticeSuperSellerDegrade(uid, targetSESL, bslfb.getWalletThreshold()); |
494 | } | 508 | } |
495 | 509 | ||
496 | - processLargeSettlementSuperWhenWalletChange(sellerWrapper, left, slfSupplier); | 510 | + if (sellerBo.isLargeSettlementSuper() ){ |
511 | + processLargeSettlementSuperWhenWalletChange(sellerWrapper, left, slfSupplier); | ||
512 | + } | ||
513 | + | ||
497 | return result; | 514 | return result; |
498 | } | 515 | } |
499 | 516 |
@@ -303,6 +303,7 @@ public class SellerService { | @@ -303,6 +303,7 @@ public class SellerService { | ||
303 | List<EntrySellerType> targetESTs = new ArrayList<>(2); | 303 | List<EntrySellerType> targetESTs = new ArrayList<>(2); |
304 | targetESTs.add(EntrySellerType.SUPER_ENTRY); | 304 | targetESTs.add(EntrySellerType.SUPER_ENTRY); |
305 | targetESTs.add(EntrySellerType.LARGE_SETTLEMENT); | 305 | targetESTs.add(EntrySellerType.LARGE_SETTLEMENT); |
306 | + targetESTs.add(EntrySellerType.FAST_DELIVERY_SUPER); | ||
306 | if (!targetESTs.contains(currentEST)){ | 307 | if (!targetESTs.contains(currentEST)){ |
307 | logger.warn("processAfterWalletChange user was {} , uid {}", currentEST , uid); | 308 | logger.warn("processAfterWalletChange user was {} , uid {}", currentEST , uid); |
308 | return ; | 309 | return ; |
1 | package com.yohoufo.order.service.support; | 1 | package com.yohoufo.order.service.support; |
2 | 2 | ||
3 | import com.google.common.collect.Lists; | 3 | import com.google.common.collect.Lists; |
4 | +import com.yoho.core.config.ConfigReader; | ||
4 | import com.yohobuy.ufo.model.order.common.OrderAttributes; | 5 | import com.yohobuy.ufo.model.order.common.OrderAttributes; |
5 | import com.yohobuy.ufo.model.order.constants.DeliveryWayEnum; | 6 | import com.yohobuy.ufo.model.order.constants.DeliveryWayEnum; |
6 | import com.yohobuy.ufo.model.order.constants.OrderConstant; | 7 | import com.yohobuy.ufo.model.order.constants.OrderConstant; |
@@ -15,6 +16,7 @@ import com.yohoufo.order.utils.MathUtils; | @@ -15,6 +16,7 @@ import com.yohoufo.order.utils.MathUtils; | ||
15 | import com.yohoufo.order.utils.OrderDetailDescHelper; | 16 | import com.yohoufo.order.utils.OrderDetailDescHelper; |
16 | import com.yohoufo.order.utils.SellerGoodsHelper; | 17 | import com.yohoufo.order.utils.SellerGoodsHelper; |
17 | import org.apache.commons.lang3.StringUtils; | 18 | import org.apache.commons.lang3.StringUtils; |
19 | +import org.springframework.beans.factory.annotation.Autowired; | ||
18 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
19 | 21 | ||
20 | import java.math.BigDecimal; | 22 | import java.math.BigDecimal; |
@@ -24,6 +26,10 @@ import java.util.Objects; | @@ -24,6 +26,10 @@ import java.util.Objects; | ||
24 | @Service | 26 | @Service |
25 | public class ShoppingSupport { | 27 | public class ShoppingSupport { |
26 | 28 | ||
29 | + | ||
30 | + @Autowired | ||
31 | + private ConfigReader configReader; | ||
32 | + | ||
27 | /** | 33 | /** |
28 | * 支付方式 | 34 | * 支付方式 |
29 | * @return | 35 | * @return |
@@ -273,10 +279,27 @@ public class ShoppingSupport { | @@ -273,10 +279,27 @@ public class ShoppingSupport { | ||
273 | 279 | ||
274 | public DepositResp getDepositResp(SkupType skupType){ | 280 | public DepositResp getDepositResp(SkupType skupType){ |
275 | DepositResp depositResp = null; | 281 | DepositResp depositResp = null; |
276 | - if(SellerGoodsHelper.canDeposit(skupType)){ | 282 | + //若订单类型支持寄存,且开关已打开,则页面展示寄存 |
283 | + if(SellerGoodsHelper.canDeposit(skupType) && isDepositSwitchOpen(skupType)){ | ||
277 | SkupType target = SellerGoodsHelper.getTargetSkupType4DepositOrder(OrderAttributes.DEPOSITE.getCode(), skupType); | 284 | SkupType target = SellerGoodsHelper.getTargetSkupType4DepositOrder(OrderAttributes.DEPOSITE.getCode(), skupType); |
278 | depositResp = DepositResp.builder().desc(OrderDetailDescHelper.getPaymentDepositDesc(target)).depositable(OrderConstant.Y_STR).build(); | 285 | depositResp = DepositResp.builder().desc(OrderDetailDescHelper.getPaymentDepositDesc(target)).depositable(OrderConstant.Y_STR).build(); |
279 | } | 286 | } |
280 | return depositResp; | 287 | return depositResp; |
281 | } | 288 | } |
289 | + | ||
290 | + | ||
291 | + private boolean isDepositSwitchOpen(SkupType skupType){ | ||
292 | + boolean depositSwitchStatus ; | ||
293 | + switch (skupType){ | ||
294 | + case IN_STOCK://现货寄存 | ||
295 | + depositSwitchStatus = configReader.getBoolean("ufo.order.deposit.inStock.switch", false);break; | ||
296 | + case QUICK_DELIVER://闪购寄存 | ||
297 | + depositSwitchStatus = configReader.getBoolean("ufo.order.deposit.quickDeliver.switch", false);break; | ||
298 | + case FAST_DELIVERY://极速寄存 | ||
299 | + depositSwitchStatus = configReader.getBoolean("ufo.order.deposit.fastDeliver.switch", false);break; | ||
300 | + default: | ||
301 | + depositSwitchStatus = false; | ||
302 | + } | ||
303 | + return depositSwitchStatus; | ||
304 | + } | ||
282 | } | 305 | } |
@@ -80,6 +80,7 @@ public final class SellerGoodsHelper { | @@ -80,6 +80,7 @@ public final class SellerGoodsHelper { | ||
80 | switch (skupType){ | 80 | switch (skupType){ |
81 | case IN_STOCK: | 81 | case IN_STOCK: |
82 | case QUICK_DELIVER: | 82 | case QUICK_DELIVER: |
83 | + case FAST_DELIVERY: | ||
83 | result = true; | 84 | result = true; |
84 | break; | 85 | break; |
85 | default: result = false; | 86 | default: result = false; |
@@ -189,4 +189,26 @@ public class ProductIdentifyController { | @@ -189,4 +189,26 @@ public class ProductIdentifyController { | ||
189 | return new ApiResponse.ApiResponseBuilder().code(402).message("操作失败,请稍后重试").build(); | 189 | return new ApiResponse.ApiResponseBuilder().code(402).message("操作失败,请稍后重试").build(); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | + | ||
193 | + @ApiOperation(name = "ufo.product.shareIdentifyInfo", desc="NFC分享") | ||
194 | + @ApiParam(name="tagId",required = true,desc="NFC标签id",type=Integer.class) | ||
195 | + @ApiResp(dataClazz=ProductIdentifyResp.class, desc="NFC分享") | ||
196 | + @ApiRespCode(code=200,desc="查询成功") | ||
197 | + @ApiRespCode(code=402,desc="查询失败") | ||
198 | + @IgnoreSignature | ||
199 | + @RequestMapping(params = "method=ufo.product.shareIdentifyInfo") | ||
200 | + public ApiResponse shareIdentifyInfo(@RequestParam(value = "tagId", required = true) String tagId) throws GatewayException { | ||
201 | + logger.info("enter shareIdentifyInfo with tagId={}", tagId); | ||
202 | + try{ | ||
203 | + ProductIdentifyResp info = identifyService.queryShareIdentifyInfo(tagId); | ||
204 | + info.setTagId(tagId); | ||
205 | + return new ApiResponse.ApiResponseBuilder().code(200).data(info).build(); | ||
206 | + }catch (Exception e){ | ||
207 | + logger.warn("shareIdentifyInfo error! tagId={}", tagId); | ||
208 | + if( e instanceof GatewayException){ | ||
209 | + throw e; | ||
210 | + } | ||
211 | + return new ApiResponse.ApiResponseBuilder().code(402).message("查询失败,请稍后重试").build(); | ||
212 | + } | ||
213 | + } | ||
192 | } | 214 | } |
@@ -330,7 +330,7 @@ public class ProductSearchController { | @@ -330,7 +330,7 @@ public class ProductSearchController { | ||
330 | } | 330 | } |
331 | 331 | ||
332 | @ApiOperation(name = "ufo.product.search.appraise.list", desc="首页商品推荐") | 332 | @ApiOperation(name = "ufo.product.search.appraise.list", desc="首页商品推荐") |
333 | - @RequestMapping(params = "method=ufo.product.appraise.list") | 333 | + @RequestMapping(params = "method=ufo.product.search.appraise.list") |
334 | @IgnoreSession | 334 | @IgnoreSession |
335 | @Cachable(expire = 180) | 335 | @Cachable(expire = 180) |
336 | public ApiResponse searchAppraiseProductList( | 336 | public ApiResponse searchAppraiseProductList( |
@@ -339,7 +339,7 @@ public class ProductSearchController { | @@ -339,7 +339,7 @@ public class ProductSearchController { | ||
339 | @RequestParam(value = "page", required = false)Integer page, | 339 | @RequestParam(value = "page", required = false)Integer page, |
340 | @RequestParam(value = "app_version", required = false)String appVersion | 340 | @RequestParam(value = "app_version", required = false)String appVersion |
341 | ) { | 341 | ) { |
342 | - ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page).setExcludeLimit("true"); | 342 | + ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page).setExcludeLimit("Y"); |
343 | searchHelpService.setQuery(query, req); | 343 | searchHelpService.setQuery(query, req); |
344 | //设置是否包含有货商品 | 344 | //设置是否包含有货商品 |
345 | LOG.info("in method=ufo.product.search.appraise.list req={}", req.toString()); | 345 | LOG.info("in method=ufo.product.search.appraise.list req={}", req.toString()); |
@@ -84,6 +84,8 @@ public final class SearchConstants { | @@ -84,6 +84,8 @@ public final class SearchConstants { | ||
84 | String SOON_SALE = "isSoonSale"; | 84 | String SOON_SALE = "isSoonSale"; |
85 | 85 | ||
86 | String NOT_ID = "not_id"; | 86 | String NOT_ID = "not_id"; |
87 | + | ||
88 | + String NOT_BRAND = "not_brand"; | ||
87 | 89 | ||
88 | String FILTER_YEAR_MONTH = "filter_year_month"; | 90 | String FILTER_YEAR_MONTH = "filter_year_month"; |
89 | 91 | ||
@@ -95,7 +97,7 @@ public final class SearchConstants { | @@ -95,7 +97,7 @@ public final class SearchConstants { | ||
95 | String RANK_TYPE = "rankType"; | 97 | String RANK_TYPE = "rankType"; |
96 | String TYPE = "product_type"; | 98 | String TYPE = "product_type"; |
97 | 99 | ||
98 | - String EXCLUDE_LIMIT = "exclude_limit"; | 100 | + String EXCLUDE_LIMIT = "isFilterLimitSale"; |
99 | 101 | ||
100 | } | 102 | } |
101 | 103 |
@@ -57,7 +57,8 @@ public class SearchParam { | @@ -57,7 +57,8 @@ public class SearchParam { | ||
57 | .setContainYoho(req.getContainYoho()) | 57 | .setContainYoho(req.getContainYoho()) |
58 | .setRankType(req.getRankType()) | 58 | .setRankType(req.getRankType()) |
59 | .setNotId(req.getNot_id()) | 59 | .setNotId(req.getNot_id()) |
60 | - .setExcludeLimit(req.getExcludeLimit()); | 60 | + .setExcludeLimit(req.getExcludeLimit()) |
61 | + .setNotBrand(req.getNot_brand()); | ||
61 | return this; | 62 | return this; |
62 | } | 63 | } |
63 | 64 | ||
@@ -70,7 +71,7 @@ public class SearchParam { | @@ -70,7 +71,7 @@ public class SearchParam { | ||
70 | .setStartTime(req.getStartTime()) | 71 | .setStartTime(req.getStartTime()) |
71 | .setEndTime(req.getEndTime()) | 72 | .setEndTime(req.getEndTime()) |
72 | .setContainYoho(req.getContainYoho()) | 73 | .setContainYoho(req.getContainYoho()) |
73 | - .setRankType(req.getRankType()).setId(req.getId()).setNotId(req.getNot_id()).setExcludeLimit(req.getExcludeLimit());; | 74 | + .setRankType(req.getRankType()).setId(req.getId()).setNotId(req.getNot_id()).setExcludeLimit(req.getExcludeLimit()).setNotBrand(req.getNot_brand()); |
74 | return this; | 75 | return this; |
75 | } | 76 | } |
76 | 77 | ||
@@ -237,6 +238,13 @@ public class SearchParam { | @@ -237,6 +238,13 @@ public class SearchParam { | ||
237 | return this; | 238 | return this; |
238 | } | 239 | } |
239 | 240 | ||
241 | + public SearchParam setNotBrand(String notBrand) { | ||
242 | + if (StringUtils.isNotBlank(notBrand)) { | ||
243 | + param.put(SearchConstants.IndexNameConstant.NOT_BRAND, notBrand); | ||
244 | + } | ||
245 | + return this; | ||
246 | + } | ||
247 | + | ||
240 | /** | 248 | /** |
241 | * 每次查询的条数 | 249 | * 每次查询的条数 |
242 | * | 250 | * |
@@ -27,6 +27,7 @@ public class ProductSearchReq { | @@ -27,6 +27,7 @@ public class ProductSearchReq { | ||
27 | private String rankType; | 27 | private String rankType; |
28 | private String couponToken; | 28 | private String couponToken; |
29 | private String excludeLimit; | 29 | private String excludeLimit; |
30 | + private String not_brand; | ||
30 | 31 | ||
31 | @Override | 32 | @Override |
32 | public String toString() { | 33 | public String toString() { |
@@ -256,6 +257,15 @@ public class ProductSearchReq { | @@ -256,6 +257,15 @@ public class ProductSearchReq { | ||
256 | return this; | 257 | return this; |
257 | } | 258 | } |
258 | 259 | ||
260 | + public ProductSearchReq setNotBrand(String notBrand) { | ||
261 | + this.not_brand = notBrand; | ||
262 | + return this; | ||
263 | + } | ||
264 | + | ||
265 | + public String getNot_brand() { | ||
266 | + return not_brand; | ||
267 | + } | ||
268 | + | ||
259 | public String getExcludeLimit() { | 269 | public String getExcludeLimit() { |
260 | return excludeLimit; | 270 | return excludeLimit; |
261 | } | 271 | } |
@@ -14,8 +14,10 @@ public interface ProductIdentifyService { | @@ -14,8 +14,10 @@ public interface ProductIdentifyService { | ||
14 | ProductIdentifyResp queryIdentifyInfo(String tagId, String nfcUid) throws GatewayException; | 14 | ProductIdentifyResp queryIdentifyInfo(String tagId, String nfcUid) throws GatewayException; |
15 | 15 | ||
16 | IdentifyShareInfoResp getShareIdentifyInfo( String tagId, String nfcUid) throws GatewayException; | 16 | IdentifyShareInfoResp getShareIdentifyInfo( String tagId, String nfcUid) throws GatewayException; |
17 | - | 17 | + |
18 | ProductIdentifyResp queryNewIdentifyInfo(String tagId, String nfcUid, Integer uid) throws GatewayException; | 18 | ProductIdentifyResp queryNewIdentifyInfo(String tagId, String nfcUid, Integer uid) throws GatewayException; |
19 | + | ||
20 | + ProductIdentifyResp queryShareIdentifyInfo(String tagId) throws GatewayException; | ||
19 | 21 | ||
20 | int applyToBeOwner(String tagId, String nfcUid, Integer uid) throws GatewayException; | 22 | int applyToBeOwner(String tagId, String nfcUid, Integer uid) throws GatewayException; |
21 | 23 |
@@ -1086,4 +1086,23 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -1086,4 +1086,23 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
1086 | transferRecords.setOrderCode(null == orderCode ? 0L : orderCode); | 1086 | transferRecords.setOrderCode(null == orderCode ? 0L : orderCode); |
1087 | transferRecordsMapper.insert(transferRecords); //增加记录到transfer_records | 1087 | transferRecordsMapper.insert(transferRecords); //增加记录到transfer_records |
1088 | } | 1088 | } |
1089 | + | ||
1090 | + @Override | ||
1091 | + public ProductIdentifyResp queryShareIdentifyInfo(String tagId) throws GatewayException { | ||
1092 | + | ||
1093 | + try { | ||
1094 | + ProductIdentifyResp result = new ProductIdentifyResp(); | ||
1095 | + | ||
1096 | + IdentifyRecord record = identifyRecordsMapper.selectByTagId(tagId); | ||
1097 | + if (null != record) { | ||
1098 | + | ||
1099 | + result = queryNewIdentifyInfo(record.getTagId(), record.getNfcUid(), record.getOwner()); | ||
1100 | + } else { | ||
1101 | + logger.warn("queryShareIdentifyInfo is not exist, tagId={}", tagId); | ||
1102 | + } | ||
1103 | + return result; | ||
1104 | + } catch (Exception err) { | ||
1105 | + throw new GatewayException(402, "鉴定信息不存在"); | ||
1106 | + } | ||
1107 | + } | ||
1089 | } | 1108 | } |
@@ -13,6 +13,7 @@ import java.util.stream.Collectors; | @@ -13,6 +13,7 @@ import java.util.stream.Collectors; | ||
13 | 13 | ||
14 | import com.yohobuy.ufo.model.promotion.response.CouponInfo; | 14 | import com.yohobuy.ufo.model.promotion.response.CouponInfo; |
15 | import com.yohoufo.common.ApiResponse; | 15 | import com.yohoufo.common.ApiResponse; |
16 | +import com.yohoufo.dal.product.BrandMapper; | ||
16 | import org.apache.commons.collections.MapUtils; | 17 | import org.apache.commons.collections.MapUtils; |
17 | import org.apache.commons.lang3.StringUtils; | 18 | import org.apache.commons.lang3.StringUtils; |
18 | import org.slf4j.Logger; | 19 | import org.slf4j.Logger; |
@@ -72,6 +73,9 @@ public class ProductSearchServiceImpl implements ProductSearchService { | @@ -72,6 +73,9 @@ public class ProductSearchServiceImpl implements ProductSearchService { | ||
72 | private ProductSortMapper productSortMapper; | 73 | private ProductSortMapper productSortMapper; |
73 | 74 | ||
74 | @Autowired | 75 | @Autowired |
76 | + private BrandMapper brandMapper; | ||
77 | + | ||
78 | + @Autowired | ||
75 | ProductSalesService productSalesService; | 79 | ProductSalesService productSalesService; |
76 | 80 | ||
77 | @Autowired | 81 | @Autowired |
@@ -183,6 +187,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { | @@ -183,6 +187,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { | ||
183 | 187 | ||
184 | @Override | 188 | @Override |
185 | public JSONObject searchAppraiseProductList(ProductSearchReq req) { | 189 | public JSONObject searchAppraiseProductList(ProductSearchReq req) { |
190 | + req.setNotBrand(StringUtils.join(brandMapper.selectExcludeAppraise(), ",")); | ||
186 | SearchParam searchParam = new SearchParam().buildPageSearchParam(req); | 191 | SearchParam searchParam = new SearchParam().buildPageSearchParam(req); |
187 | String url = PRODUCT_SEARCH_QUERY_URL; | 192 | String url = PRODUCT_SEARCH_QUERY_URL; |
188 | JSONObject data = search(searchParam.getParam(), url); | 193 | JSONObject data = search(searchParam.getParam(), url); |
1 | package com.yohoufo.product.service.impl; | 1 | package com.yohoufo.product.service.impl; |
2 | 2 | ||
3 | import java.math.BigDecimal; | 3 | import java.math.BigDecimal; |
4 | -import java.util.ArrayList; | ||
5 | -import java.util.Arrays; | ||
6 | -import java.util.Collection; | ||
7 | -import java.util.Collections; | ||
8 | -import java.util.Comparator; | ||
9 | -import java.util.HashMap; | ||
10 | -import java.util.List; | ||
11 | -import java.util.Map; | 4 | +import java.util.*; |
12 | import java.util.Map.Entry; | 5 | import java.util.Map.Entry; |
13 | -import java.util.Objects; | ||
14 | -import java.util.UUID; | ||
15 | import java.util.function.BinaryOperator; | 6 | import java.util.function.BinaryOperator; |
16 | import java.util.function.Function; | 7 | import java.util.function.Function; |
17 | import java.util.stream.Collectors; | 8 | import java.util.stream.Collectors; |
@@ -2026,9 +2017,9 @@ public class ProductServiceImpl implements ProductService { | @@ -2026,9 +2017,9 @@ public class ProductServiceImpl implements ProductService { | ||
2026 | Map<String, List<GoodsBO>> tabs = new HashMap<>(); | 2017 | Map<String, List<GoodsBO>> tabs = new HashMap<>(); |
2027 | tabs.put("goods_list", Arrays.asList(goodsBO)); | 2018 | tabs.put("goods_list", Arrays.asList(goodsBO)); |
2028 | tabs.put("pre_sale_goods_list", Arrays.asList(preSaleGoodsBO)); | 2019 | tabs.put("pre_sale_goods_list", Arrays.asList(preSaleGoodsBO)); |
2029 | - tabs.put("seconds_goods_list", Arrays.asList(goodsBO)); | 2020 | + tabs.put("seconds_goods_list", Arrays.asList(secondsGoodsBO)); |
2030 | product_info.setGoodsListTabs(tabs); | 2021 | product_info.setGoodsListTabs(tabs); |
2031 | - product_info.setGoodsList(null); | 2022 | + allGoodsBO.setSizeList(allSizeList); |
2032 | } | 2023 | } |
2033 | } | 2024 | } |
2034 | 2025 | ||
@@ -2133,9 +2124,9 @@ public class ProductServiceImpl implements ProductService { | @@ -2133,9 +2124,9 @@ public class ProductServiceImpl implements ProductService { | ||
2133 | } | 2124 | } |
2134 | return sp2; | 2125 | return sp2; |
2135 | } | 2126 | } |
2136 | - private boolean notAllNull(Object... obj) { | ||
2137 | - for (Object o : obj) { | ||
2138 | - if (o != null) { | 2127 | + private boolean notAllNull(Integer... numbers) { |
2128 | + for (Integer n : numbers) { | ||
2129 | + if (n != null && n > 0) { | ||
2139 | return true; | 2130 | return true; |
2140 | } | 2131 | } |
2141 | } | 2132 | } |
@@ -2144,28 +2135,17 @@ public class ProductServiceImpl implements ProductService { | @@ -2144,28 +2135,17 @@ public class ProductServiceImpl implements ProductService { | ||
2144 | 2135 | ||
2145 | @Override | 2136 | @Override |
2146 | public List<StorageCheckResp> getStorageByCodeAndColorName(List<ProductRequestBo> reqList) { | 2137 | public List<StorageCheckResp> getStorageByCodeAndColorName(List<ProductRequestBo> reqList) { |
2147 | - List<StorageCheckResp> result = new ArrayList<>(); | 2138 | + LOGGER.info("method ProductServiceImpl.getStorageByCodeAndColorName in, params is {}", reqList); |
2148 | 2139 | ||
2140 | + // 返回结果 | ||
2141 | + List<StorageCheckResp> result = new ArrayList<>(); | ||
2149 | // 请求参数中的货号 | 2142 | // 请求参数中的货号 |
2150 | List<String> reqProductCode = new ArrayList<>(); | 2143 | List<String> reqProductCode = new ArrayList<>(); |
2151 | - | ||
2152 | - // 系统中有的货号 | ||
2153 | - List<String> resultProductCode = new ArrayList<>(); | ||
2154 | - | ||
2155 | - // 系统中货号对应的productIds | ||
2156 | - List<Integer> productIds = new ArrayList<>(); | ||
2157 | - HashMap<Integer, String> productIdAndCode = new HashMap<>(); | ||
2158 | - | ||
2159 | // 请求参数中的尺码名称 | 2144 | // 请求参数中的尺码名称 |
2160 | List<String> reqSizeName = new ArrayList<>(); | 2145 | List<String> reqSizeName = new ArrayList<>(); |
2161 | 2146 | ||
2162 | - // 系统中的尺码名称 | ||
2163 | - List<String> resultSizeName = new ArrayList<>(); | ||
2164 | - HashMap<Integer, String> sizeIdAndName = new HashMap<>(); | ||
2165 | - | ||
2166 | - List<Integer> resultSizeIds = new ArrayList<>(); | ||
2167 | - | ||
2168 | if (CollectionUtils.isEmpty(reqList)) { | 2147 | if (CollectionUtils.isEmpty(reqList)) { |
2148 | + LOGGER.error("getStorageByCodeAndColorName 参数错误, reqList = {}", reqList); | ||
2169 | throw new ServiceException(400, "参数错误"); | 2149 | throw new ServiceException(400, "参数错误"); |
2170 | } | 2150 | } |
2171 | 2151 | ||
@@ -2173,72 +2153,49 @@ public class ProductServiceImpl implements ProductService { | @@ -2173,72 +2153,49 @@ public class ProductServiceImpl implements ProductService { | ||
2173 | reqList.stream().forEach(item -> { | 2153 | reqList.stream().forEach(item -> { |
2174 | reqProductCode.add(item.getProductCode()); | 2154 | reqProductCode.add(item.getProductCode()); |
2175 | reqSizeName.add(item.getSizeName()); | 2155 | reqSizeName.add(item.getSizeName()); |
2176 | - result.add(OrikaUtils.map(item, StorageCheckResp.class)); | 2156 | + // 默认货号不存在 |
2157 | + StorageCheckResp resultItem = OrikaUtils.map(item, StorageCheckResp.class); | ||
2158 | + setStorageCheckRespStatusInfo(resultItem, StorageCheckEnum.PRODUCT_NOT_FOUND.getType()); | ||
2159 | + result.add(resultItem); | ||
2177 | }); | 2160 | }); |
2178 | 2161 | ||
2179 | - LOGGER.info("int reqProductCode lengh= {}", resultProductCode.size()); | ||
2180 | - // 2. 查询 productCode 对应的product_id, 根据product_id 查询storage | ||
2181 | - List<Product> products = productMapper.selectByCodes(reqProductCode); | ||
2182 | - | ||
2183 | - // 货号都不存在 | ||
2184 | - if (CollectionUtils.isEmpty(products)) { | ||
2185 | - for(StorageCheckResp item : result) { | ||
2186 | - setStorageCheckRespStatusInfo(item, StorageCheckEnum.PRODUCT_NOT_FOUND.getType()); | ||
2187 | - } | ||
2188 | - return result; | ||
2189 | - } | ||
2190 | - | ||
2191 | - products.stream().forEach(item -> { | ||
2192 | - productIds.add(item.getId()); | ||
2193 | - resultProductCode.add(item.getProductCode()); | ||
2194 | - productIdAndCode.put(item.getId(), item.getProductCode()); | ||
2195 | - }); | ||
2196 | - LOGGER.info("int resultProductCode lengh= {}", resultProductCode.size()); | ||
2197 | - | ||
2198 | - // 3.查询系统中的库存 | ||
2199 | - List<Storage> storages = storageMapper.selectByProductIds(productIds); | ||
2200 | - | ||
2201 | - // 4. 查询 sizeName 对应的size_id | ||
2202 | - List<Size> sizes = sizeMapper.selectByNames(reqSizeName); | ||
2203 | - sizes.stream().forEach(item->{ | ||
2204 | - resultSizeName.add(item.getSizeName()); | ||
2205 | - resultSizeIds.add(item.getId()); | ||
2206 | - sizeIdAndName.put(item.getId(), item.getSizeName()); | ||
2207 | - }); | ||
2208 | - | ||
2209 | - // 5. 标记检测情况 | ||
2210 | - // 5.1 不存在的货号 | ||
2211 | - reqProductCode.removeAll(resultProductCode); | ||
2212 | - // 5.2 不存在的尺码名称 | ||
2213 | - reqSizeName.removeAll(resultSizeName); | ||
2214 | - | ||
2215 | - loop: for(StorageCheckResp item : result) { | ||
2216 | - // 不存在的货号 | ||
2217 | - if (reqProductCode.contains(item.getProductCode())) { | ||
2218 | - setStorageCheckRespStatusInfo(item, StorageCheckEnum.PRODUCT_NOT_FOUND.getType()); | ||
2219 | - LOGGER.info("货号不存在 = {}", item); | ||
2220 | - continue; | 2162 | + // 2. 查询 productCode/product_id对应关系 |
2163 | + List<Integer> productIds = new ArrayList<>(); | ||
2164 | + Map<String, Integer> productCodeIdMap = productMapper.selectByCodes(reqProductCode).stream().map(item -> {productIds.add(item.getId()); return item;}).collect(Collectors.toMap(Product::getProductCode, Product::getId)); | ||
2165 | + | ||
2166 | + // 3. 查询 sizeId/sizeName对应关系 | ||
2167 | + Set<String> sizeNamesSet = new HashSet<>(); | ||
2168 | + Map<Integer, String> sizeIdNameMap = sizeMapper.selectByNames(reqSizeName).stream().map(item -> { | ||
2169 | + sizeNamesSet.add(item.getSizeName()); | ||
2170 | + return item;}).collect(Collectors.toMap(Size::getId, Size::getSizeName)); | ||
2171 | + | ||
2172 | + // 4.查询所有productCode 的库存 | ||
2173 | + Map<Integer, List<Storage>> storagesMap = storageMapper.selectByProductIds(productIds).stream().collect(Collectors.groupingBy(Storage::getProductId)); | ||
2174 | + | ||
2175 | + // 5.标记查询结果 | ||
2176 | + result.stream().map(item -> { | ||
2177 | + // 获取productCode 库存信息 | ||
2178 | + List<Storage> storages = storagesMap.get(productCodeIdMap.get(item.getProductCode())); | ||
2179 | + if (null == storages) { | ||
2180 | + return item; | ||
2221 | } | 2181 | } |
2222 | 2182 | ||
2223 | - // 不存在的尺码 | ||
2224 | - if (reqSizeName.contains(item.getSizeName())) { | ||
2225 | - LOGGER.info("尺码名称不存在 = {}", item); | 2183 | + // 尺码不存在 |
2184 | + if (!sizeNamesSet.contains(item.getSizeName())) { | ||
2226 | setStorageCheckRespStatusInfo(item, StorageCheckEnum.SIZE_NOT_FOUND.getType()); | 2185 | setStorageCheckRespStatusInfo(item, StorageCheckEnum.SIZE_NOT_FOUND.getType()); |
2227 | - continue; | 2186 | + return item; |
2228 | } | 2187 | } |
2229 | 2188 | ||
2230 | - for(Storage storage : storages) { | ||
2231 | - // 货号和尺码匹配 | ||
2232 | - if (item.getProductCode().equals(productIdAndCode.get(storage.getProductId())) && item.getSizeName().equals(sizeIdAndName.get(storage.getSizeId()))) { | ||
2233 | - setStorageCheckRespStatusInfo(item, StorageCheckEnum.PRODUCT_SIZE_MATCH.getType()); | ||
2234 | - item.setStorageId(storage.getId()); | ||
2235 | - continue loop; | 2189 | + // sizeName 匹配 |
2190 | + storages.stream().forEach(storage -> { | ||
2191 | + if (null != sizeIdNameMap.get(storage.getSizeId()) && sizeIdNameMap.get(storage.getSizeId()).equals(item.getSizeName())){ | ||
2192 | + setStorageCheckRespStatusInfo(item, StorageCheckEnum.PRODUCT_SIZE_MATCH.getType()); | ||
2193 | + item.setStorageId((storage.getId())); | ||
2236 | } | 2194 | } |
2237 | - } | 2195 | + }); |
2196 | + return item; | ||
2238 | 2197 | ||
2239 | - // 货号和尺码不匹配 | ||
2240 | - setStorageCheckRespStatusInfo(item, StorageCheckEnum.PRODUCT_SIZE_NOT_MATCH.getType()); | ||
2241 | - } | 2198 | + }).collect(Collectors.toList()); |
2242 | 2199 | ||
2243 | return result; | 2200 | return result; |
2244 | } | 2201 | } |
-
Please register or login to post a comment