forked from angelo/java-retail-app
				
			## 注册、升级根据商品上传盒数计算等级;
This commit is contained in:
		
							parent
							
								
									62b9ed4df4
								
							
						
					
					
						commit
						43c0fca728
					
				| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
package com.hzs.member.base.vo;
 | 
					package com.hzs.member.base.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.fasterxml.jackson.annotation.JsonFormat;
 | 
					import com.fasterxml.jackson.annotation.JsonFormat;
 | 
				
			||||||
 | 
					import com.hzs.common.core.annotation.BigDecimalFormat;
 | 
				
			||||||
import com.hzs.common.core.annotation.Excel;
 | 
					import com.hzs.common.core.annotation.Excel;
 | 
				
			||||||
import com.hzs.common.core.annotation.Transaction;
 | 
					import com.hzs.common.core.annotation.Transaction;
 | 
				
			||||||
import com.hzs.common.core.constant.EnumsPrefixConstants;
 | 
					import com.hzs.common.core.constant.EnumsPrefixConstants;
 | 
				
			||||||
| 
						 | 
					@ -90,13 +91,15 @@ public class RetailMemberVO implements Serializable {
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 消费金额 注册金额
 | 
					     * 消费金额 注册金额
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Excel(name = "注册金额")
 | 
					    @Excel(name = "注册金额", scale = 2)
 | 
				
			||||||
 | 
					    @BigDecimalFormat()
 | 
				
			||||||
    private BigDecimal consumeMoney;
 | 
					    private BigDecimal consumeMoney;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 消费业绩 注册业绩
 | 
					     * 消费业绩 注册业绩
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Excel(name = "注册业绩($)")
 | 
					    @Excel(name = "注册业绩", scale = 2)
 | 
				
			||||||
 | 
					    @BigDecimalFormat()
 | 
				
			||||||
    private BigDecimal consumeAchieve;
 | 
					    private BigDecimal consumeAchieve;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 隶属体系
 | 
					     * 隶属体系
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -633,7 +633,6 @@ public class ApiRetailOrderController {
 | 
				
			||||||
                    .channel(shoppingCartRedis.getSource())
 | 
					                    .channel(shoppingCartRedis.getSource())
 | 
				
			||||||
                    .waresCode(shoppingCartRedis.getWaresCode())
 | 
					                    .waresCode(shoppingCartRedis.getWaresCode())
 | 
				
			||||||
                    .quantity(shoppingCartRedis.getNumber())
 | 
					                    .quantity(shoppingCartRedis.getNumber())
 | 
				
			||||||
                    .pkMakerSpace(shoppingCartRedis.getPkMakerSpace())
 | 
					 | 
				
			||||||
                    .build();
 | 
					                    .build();
 | 
				
			||||||
            List<WaresItemsParam> waresItemsParamList = new ArrayList<>(shoppingCartRedis.getProductGroup().size());
 | 
					            List<WaresItemsParam> waresItemsParamList = new ArrayList<>(shoppingCartRedis.getProductGroup().size());
 | 
				
			||||||
            for (ProductGroup productGroup : shoppingCartRedis.getProductGroup()) {
 | 
					            for (ProductGroup productGroup : shoppingCartRedis.getProductGroup()) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -283,7 +283,7 @@ public class RetailOrderServiceImpl implements IRetailOrderService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (boxWaresList.contains(waresDetailExt.getWaresCode())) {
 | 
					                if (boxWaresList.contains(waresDetailExt.getWaresCode())) {
 | 
				
			||||||
                    // 商品是盒数商品,需要累计数量
 | 
					                    // 商品是盒数商品,需要累计数量
 | 
				
			||||||
                    boxNum += orderItems.getWaresQuantity();
 | 
					                    boxNum += waresDetailExt.getBoxNum() * orderItems.getWaresQuantity();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -601,7 +601,6 @@ public abstract class ParentOrderController extends BaseController {
 | 
				
			||||||
                    .channel(shoppingCartRedis.getSource())
 | 
					                    .channel(shoppingCartRedis.getSource())
 | 
				
			||||||
                    .waresCode(shoppingCartRedis.getWaresCode())
 | 
					                    .waresCode(shoppingCartRedis.getWaresCode())
 | 
				
			||||||
                    .quantity(shoppingCartRedis.getNumber())
 | 
					                    .quantity(shoppingCartRedis.getNumber())
 | 
				
			||||||
                    .pkMakerSpace(shoppingCartRedis.getPkMakerSpace())
 | 
					 | 
				
			||||||
                    .build();
 | 
					                    .build();
 | 
				
			||||||
            List<WaresItemsParam> waresItemsParamList = new ArrayList<>(shoppingCartRedis.getProductGroup().size());
 | 
					            List<WaresItemsParam> waresItemsParamList = new ArrayList<>(shoppingCartRedis.getProductGroup().size());
 | 
				
			||||||
            for (ProductGroup productGroup : shoppingCartRedis.getProductGroup()) {
 | 
					            for (ProductGroup productGroup : shoppingCartRedis.getProductGroup()) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,9 +40,9 @@ public class OrderItemsParam implements Serializable {
 | 
				
			||||||
    private Integer quantity;
 | 
					    private Integer quantity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 创客空间id
 | 
					     * 商品盒数
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private Long pkMakerSpace;
 | 
					    private Integer boxNum;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 商品明细
 | 
					     * 商品明细
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2157,11 +2157,13 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 当前产品盒数
 | 
					        // 当前产品盒数
 | 
				
			||||||
        int boxNum = 0;
 | 
					        int boxNum = 0;
 | 
				
			||||||
 | 
					        // 处理商品盒数
 | 
				
			||||||
 | 
					        this.handleWaresBoxNum(specialArea, orderItemsParams);
 | 
				
			||||||
        // 判断订单明细中指定产品数量,校验等级
 | 
					        // 判断订单明细中指定产品数量,校验等级
 | 
				
			||||||
        for (OrderItemsParam orderItemsParam : orderItemsParams) {
 | 
					        for (OrderItemsParam orderItemsParam : orderItemsParams) {
 | 
				
			||||||
            if (boxWaresList.contains(orderItemsParam.getWaresCode())) {
 | 
					            if (boxWaresList.contains(orderItemsParam.getWaresCode())) {
 | 
				
			||||||
                // 存在指定商品,需要累计盒数
 | 
					                // 存在指定商品,需要累计盒数
 | 
				
			||||||
                boxNum += orderItemsParam.getQuantity();
 | 
					                boxNum += orderItemsParam.getBoxNum() * orderItemsParam.getQuantity();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2297,4 +2299,29 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 处理商品盒数
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param orderItemsParams
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void handleWaresBoxNum(Integer specialArea, List<OrderItemsParam> orderItemsParams) {
 | 
				
			||||||
 | 
					        if (CollectionUtil.isNotEmpty(orderItemsParams)) {
 | 
				
			||||||
 | 
					            List<String> waresCodeList = orderItemsParams.stream().map(OrderItemsParam::getWaresCode).collect(Collectors.toList());
 | 
				
			||||||
 | 
					            List<BdWares> waresList = iBdWaresService.list(Wrappers.<BdWares>lambdaQuery()
 | 
				
			||||||
 | 
					                    .eq(BdWares::getSpecialArea, specialArea)
 | 
				
			||||||
 | 
					                    .in(BdWares::getWaresCode, waresCodeList)
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					            if (CollectionUtil.isNotEmpty(waresList)) {
 | 
				
			||||||
 | 
					                for (OrderItemsParam orderItemsParam : orderItemsParams) {
 | 
				
			||||||
 | 
					                    for (BdWares bdWares : waresList) {
 | 
				
			||||||
 | 
					                        if (orderItemsParam.getWaresCode().equals(bdWares.getWaresCode())) {
 | 
				
			||||||
 | 
					                            orderItemsParam.setBoxNum(bdWares.getBoxNum());
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,7 +76,6 @@ public class ApiShoppingCartController extends BaseController {
 | 
				
			||||||
                String jsonString = innerShopMap.get(innerKey.toString());
 | 
					                String jsonString = innerShopMap.get(innerKey.toString());
 | 
				
			||||||
                ShoppingCartRedis shoppingCartRedis = JSONUtil.toBean(jsonString, ShoppingCartRedis.class);
 | 
					                ShoppingCartRedis shoppingCartRedis = JSONUtil.toBean(jsonString, ShoppingCartRedis.class);
 | 
				
			||||||
                shoppingCartRedis.setNumber(shoppingCartRedis.getNumber() + scr.getNumber());
 | 
					                shoppingCartRedis.setNumber(shoppingCartRedis.getNumber() + scr.getNumber());
 | 
				
			||||||
                shoppingCartRedis.setPkMakerSpace(scr.getPkMakerSpace());
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                innerShopMap.put(innerKey.toString(), JSONUtil.toJsonStr(shoppingCartRedis));
 | 
					                innerShopMap.put(innerKey.toString(), JSONUtil.toJsonStr(shoppingCartRedis));
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,11 +21,6 @@ public class ShoppingCartRedis implements Serializable {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private Integer number;
 | 
					    private Integer number;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 创客空间id
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private Long pkMakerSpace;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 产品 sku 组合
 | 
					     * 产品 sku 组合
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,6 @@ public class BdWaresDetailServiceImpl extends ServiceImpl<BdWaresDetailMapper, B
 | 
				
			||||||
                        .waresCode(orderItemsParam.getWaresCode())
 | 
					                        .waresCode(orderItemsParam.getWaresCode())
 | 
				
			||||||
                        .pkWaresSpecsSku(waresItemsParam.getPkWaresSpecsSku())
 | 
					                        .pkWaresSpecsSku(waresItemsParam.getPkWaresSpecsSku())
 | 
				
			||||||
                        .waresQuantity(orderItemsParam.getQuantity())
 | 
					                        .waresQuantity(orderItemsParam.getQuantity())
 | 
				
			||||||
                        .pkMakerSpace(orderItemsParam.getPkMakerSpace())
 | 
					 | 
				
			||||||
                        .price(BigDecimal.ZERO)
 | 
					                        .price(BigDecimal.ZERO)
 | 
				
			||||||
                        .achieve(BigDecimal.ZERO)
 | 
					                        .achieve(BigDecimal.ZERO)
 | 
				
			||||||
                        .build();
 | 
					                        .build();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,13 +49,13 @@ public class WaresVo {
 | 
				
			||||||
     * 商品价格
 | 
					     * 商品价格
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Excel(name = "商品价格")
 | 
					    @Excel(name = "商品价格")
 | 
				
			||||||
    @BigDecimalFormat("#0.0000")
 | 
					    @BigDecimalFormat("#0.00")
 | 
				
			||||||
    private BigDecimal waresPrice;
 | 
					    private BigDecimal waresPrice;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 商品业绩
 | 
					     * 商品业绩
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Excel(name = "商品业绩")
 | 
					    @Excel(name = "商品业绩")
 | 
				
			||||||
    @BigDecimalFormat("#0.0000")
 | 
					    @BigDecimalFormat("#0.00")
 | 
				
			||||||
    private BigDecimal waresAchieve;
 | 
					    private BigDecimal waresAchieve;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,8 +11,6 @@ import java.lang.annotation.Target;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * BigDecimal自定义序列化处理
 | 
					 * BigDecimal自定义序列化处理
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @author
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Retention(RetentionPolicy.RUNTIME)
 | 
					@Retention(RetentionPolicy.RUNTIME)
 | 
				
			||||||
@Target(ElementType.FIELD)
 | 
					@Target(ElementType.FIELD)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue