Commit efbc08cbb0fe0fcf844147e61bf9c62f5f21544f
1 parent
12ee4916
update:修改购物车商品类型
Showing
2 changed files
with
13 additions
and
51 deletions
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/ShopCartImpl.java
... | ... | @@ -126,42 +126,20 @@ public class ShopCartImpl implements IShopCartService { |
126 | 126 | if (!CollectionUtils.isEmpty(productListVo.getImages())) { |
127 | 127 | shopCartMessageVo.setUrl(productListVo.getImages().get(0).getUrl()); |
128 | 128 | } |
129 | - //按件卖 | |
130 | - if (ProductTradeType.PIECES_TYPE.getCodeInteger().equals(shopCartMessageVo.getType())) { | |
131 | - ProductPresetVo productPresetVo = map.get(SaleUnitType.PIECE.getCode()); | |
129 | + ProductPresetVo productPresetVo = map.get(shopCartMessageVo.getType()); | |
132 | 130 | // AssertUtils.notNull(productPresetVo, |
133 | 131 | // "未找到商品按件卖的预售价格,productId:"+shopCartMessageVo.getProductId()+"SaleUnitType:"+SaleUnitType.PIECE.getCode()); |
134 | - if(productPresetVo == null){ | |
135 | - shopCartMessageVo.setPrePrice(0L); | |
136 | - shopCartMessageVo.setPieceWeight(0L); | |
137 | - shopCartMessageVo.setProductState(ShopCartMessageProductState.TYPE_CHANGE.getCodeInteger()); | |
138 | - }else{ | |
139 | - //商品包装单位 | |
140 | - shopCartMessageVo.setSaleUnit(productPresetVo.getSaleUnit()); | |
141 | - //预设价格分 | |
142 | - shopCartMessageVo.setPrePrice(productPresetVo.getPrePrice() == null ? 0L : productPresetVo.getPrePrice()); | |
143 | - //预设件重克 | |
144 | - shopCartMessageVo.setPieceWeight(productPresetVo.getPieceWeight()); | |
145 | - } | |
146 | - | |
147 | - } else { | |
148 | - //按斤卖 | |
149 | - ProductPresetVo productPresetVo = map.get(SaleUnitType.CATTY.getCode()); | |
150 | -// AssertUtils.notNull(productPresetVo, | |
151 | -// "未找到商品按斤卖的预售价格,productId:"+shopCartMessageVo.getProductId()+"SaleUnitType:"+SaleUnitType.CATTY.getCode()); | |
132 | + if(productPresetVo == null){ | |
133 | + shopCartMessageVo.setPrePrice(0L); | |
134 | + shopCartMessageVo.setPieceWeight(0L); | |
135 | + shopCartMessageVo.setProductState(ShopCartMessageProductState.TYPE_CHANGE.getCodeInteger()); | |
136 | + }else{ | |
137 | + //商品包装单位 | |
138 | + shopCartMessageVo.setSaleUnit(productPresetVo.getSaleUnit()); | |
152 | 139 | //预设价格分 |
153 | - if(productPresetVo == null){ | |
154 | - shopCartMessageVo.setPrePrice(0L); | |
155 | - shopCartMessageVo.setProductState(ShopCartMessageProductState.TYPE_CHANGE.getCodeInteger()); | |
156 | - }else{ | |
157 | - //商品包装单位 | |
158 | - shopCartMessageVo.setSaleUnit(productPresetVo.getSaleUnit()); | |
159 | - //商品包装单位 | |
160 | - shopCartMessageVo.setSaleUnit(productPresetVo.getSaleUnit()); | |
161 | - | |
162 | - shopCartMessageVo.setPrePrice(productPresetVo.getPrePrice() == null ? 0L : productPresetVo.getPrePrice()); | |
163 | - } | |
164 | - | |
140 | + shopCartMessageVo.setPrePrice(productPresetVo.getPrePrice() == null ? 0L : productPresetVo.getPrePrice()); | |
141 | + //预设件重克 | |
142 | + shopCartMessageVo.setPieceWeight(productPresetVo.getPieceWeight()); | |
165 | 143 | } |
166 | 144 | } |
167 | 145 | }); | ... | ... |
etrade-order/src/main/java/com/diligrp/etrade/order/util/ShopCartCheckOut.java
... | ... | @@ -52,15 +52,7 @@ public class ShopCartCheckOut { |
52 | 52 | AssertUtils.notNull(shopCartMessageDto.getProductId(), "新增购物车入参:商品id不为空"); |
53 | 53 | AssertUtils.notNull(shopCartMessageDto.getType(), "新增购物车入参:卖货方式不为空"); |
54 | 54 | checkOutAmount(shopCartMessageDto.getUnitAmount()); |
55 | - //按件卖,件数、件重不为空 | |
56 | - if (ProductTradeType.PIECES_TYPE.getCodeInteger().equals(shopCartMessageDto.getType())) { | |
57 | - checkOutWeight(shopCartMessageDto.getUnitWeight()); | |
58 | - checkOutNumber(shopCartMessageDto.getNumber()); | |
59 | - } | |
60 | - //按斤卖,重量不为空 | |
61 | - if (ProductTradeType.WEIGHT_TYPE.getCodeInteger().equals(shopCartMessageDto.getType())){ | |
62 | - checkOutWeight(shopCartMessageDto.getWeight()); | |
63 | - } | |
55 | + checkOutWeight(shopCartMessageDto.getWeight()); | |
64 | 56 | } |
65 | 57 | /** |
66 | 58 | *更新购物车入参校验 |
... | ... | @@ -71,15 +63,7 @@ public class ShopCartCheckOut { |
71 | 63 | AssertUtils.notNull(shopCartMessageDto.getId(), "更新购物车入参:shopCartMessageDto.getId() is null"); |
72 | 64 | AssertUtils.notNull(shopCartMessageDto.getType(), "更新购物车入参:卖货方式不为空"); |
73 | 65 | checkOutAmount(shopCartMessageDto.getUnitAmount()); |
74 | - //按件卖,件数、件重不为空 | |
75 | - if (ProductTradeType.PIECES_TYPE.getCodeInteger().equals(shopCartMessageDto.getType())) { | |
76 | - checkOutWeight(shopCartMessageDto.getUnitWeight()); | |
77 | - checkOutNumber(shopCartMessageDto.getNumber()); | |
78 | - } | |
79 | - //按斤卖,重量不为空 | |
80 | - if (ProductTradeType.WEIGHT_TYPE.getCodeInteger().equals(shopCartMessageDto.getType())){ | |
81 | - checkOutWeight(shopCartMessageDto.getWeight()); | |
82 | - } | |
66 | + checkOutWeight(shopCartMessageDto.getWeight()); | |
83 | 67 | } |
84 | 68 | |
85 | 69 | /** | ... | ... |