## 调整等级、奖衔初始处理;
This commit is contained in:
		
							parent
							
								
									4549fedc13
								
							
						
					
					
						commit
						f1c8f2b7d6
					
				|  | @ -10,12 +10,10 @@ import com.hzs.common.core.constant.CountryConstants; | |||
| import com.hzs.common.core.constant.RetailConstants; | ||||
| import com.hzs.common.core.domain.R; | ||||
| import com.hzs.common.core.enums.EGrade; | ||||
| import com.hzs.common.core.enums.EOrderPrefix; | ||||
| import com.hzs.common.core.enums.ESpecialArea; | ||||
| import com.hzs.common.core.enums.EYesNo; | ||||
| import com.hzs.common.core.exception.ServiceException; | ||||
| import com.hzs.common.core.service.RedisService; | ||||
| import com.hzs.common.core.utils.CommonUtil; | ||||
| import com.hzs.common.core.utils.StringUtils; | ||||
| import com.hzs.common.core.web.domain.AjaxResult; | ||||
| import com.hzs.common.domain.member.base.CuMember; | ||||
|  | @ -24,7 +22,6 @@ import com.hzs.common.domain.member.ext.CuMemberAccountExt; | |||
| import com.hzs.common.domain.sale.ext.BdWaresSpecsSkuExt; | ||||
| import com.hzs.common.domain.sale.ext.SaOrderExt; | ||||
| import com.hzs.common.domain.sale.wares.BdWares; | ||||
| import com.hzs.common.domain.system.config.BdAwards; | ||||
| import com.hzs.common.domain.system.config.BdGrade; | ||||
| import com.hzs.common.security.service.MemberTokenService; | ||||
| import com.hzs.common.security.utils.SecurityUtils; | ||||
|  | @ -34,7 +31,6 @@ import com.hzs.retail.sale.param.*; | |||
| import com.hzs.retail.sale.vo.*; | ||||
| import com.hzs.sale.order.param.*; | ||||
| import com.hzs.sale.order.service.ISaOrderService; | ||||
| import com.hzs.sale.order.service.ISaOrderShareTmpService; | ||||
| import com.hzs.sale.shopping.service.IShoppingCartService; | ||||
| import com.hzs.sale.shopping.vo.ProductGroup; | ||||
| import com.hzs.sale.shopping.vo.ShoppingCartRedis; | ||||
|  | @ -42,7 +38,6 @@ import com.hzs.sale.shopping.vo.ShoppingCartVO; | |||
| import com.hzs.sale.wares.service.IBdWaresService; | ||||
| import com.hzs.sale.wares.service.IBdWaresSpecsSkuService; | ||||
| import com.hzs.system.base.IAreaServiceApi; | ||||
| import com.hzs.system.config.IAwardsServiceApi; | ||||
| import com.hzs.system.config.IGradeServiceApi; | ||||
| import com.hzs.system.config.dto.GradeDTO; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
|  | @ -78,8 +73,6 @@ public class ApiRetailOrderController { | |||
|     private IBdWaresService iBdWaresService; | ||||
|     @Autowired | ||||
|     private IBdWaresSpecsSkuService iBdWaresSpecsSkuService; | ||||
|     @Autowired | ||||
|     private ISaOrderShareTmpService iSaOrderShareTmpService; | ||||
| 
 | ||||
|     @DubboReference | ||||
|     IMemberServiceApi iMemberServiceApi; | ||||
|  | @ -87,8 +80,6 @@ public class ApiRetailOrderController { | |||
|     IGradeServiceApi iGradeServiceApi; | ||||
|     @DubboReference | ||||
|     IAreaServiceApi iAreaServiceApi; | ||||
|     @DubboReference | ||||
|     IAwardsServiceApi iAwardsServiceApi; | ||||
|     @Autowired | ||||
|     private MemberTokenService memberTokenService; | ||||
| 
 | ||||
|  | @ -772,17 +763,10 @@ public class ApiRetailOrderController { | |||
| //        registerParam.setOrderItemsParams(convertShoppingCarToSku(registerParam.getPkCreator(), registerParam.getShopList())); | ||||
| 
 | ||||
|         // 遍历商品,封装订单明细 | ||||
|         // 订单金额 | ||||
|         BigDecimal orderAmount = BigDecimal.ZERO; | ||||
| 
 | ||||
|         // 生成订单编号 | ||||
|         String orderCode = CommonUtil.createSerialNumber(EOrderPrefix.ORDER_CODE); | ||||
|         List<OrderItemsParam> orderItemsParams = new ArrayList<>(); | ||||
|         for (FansConfirmOrderWaresParam waresParam : registerParam.getWaresList()) { | ||||
|             // 遍历sku | ||||
|             // 产品价格等map | ||||
|             Map<Long, BdWaresSpecsSkuExt> skuMap = iBdWaresSpecsSkuService.queryWaresSpecsSkuList(waresParam.getSkuList().stream().map(FansConfirmOrderSkuParam::getPkWaresSku).collect(Collectors.toList())); | ||||
| 
 | ||||
|             // 查询商品 | ||||
|             BdWares bdWares = iBdWaresService.getWares(waresParam.getPkWares()); | ||||
| 
 | ||||
|  | @ -790,9 +774,6 @@ public class ApiRetailOrderController { | |||
|             List<WaresItemsParam> itemsParamList = new ArrayList<>(waresParam.getSkuList().size()); | ||||
|             // 遍历产品信息 | ||||
|             for (FansConfirmOrderSkuParam skuParam : waresParam.getSkuList()) { | ||||
|                 BdWaresSpecsSkuExt specsSku = skuMap.get(skuParam.getPkWaresSku()); | ||||
|                 orderAmount = orderAmount.add(specsSku.getPrice().multiply(new BigDecimal(skuParam.getQuantity() * waresParam.getQuantity()))); | ||||
| 
 | ||||
|                 itemsParamList.add(WaresItemsParam.builder() | ||||
|                         .pkWaresSpecsSku(skuParam.getPkWaresSku().intValue()) | ||||
|                         .quantity(skuParam.getQuantity()) | ||||
|  |  | |||
|  | @ -225,19 +225,22 @@ public class RetailOrderServiceImpl implements IRetailOrderService { | |||
|         } else if (ESpecialArea.RETAIL_REPURCHASE.getValue() == orderParam.getSpecialArea()) { | ||||
| //            saOrderExt.setOrderAmount(saOrderExt.getOrderAmount().add(orderParam.getPostage())); | ||||
|             saOrderExt.setPostage(orderParam.getPostage()); | ||||
|             // 注册、升级订单,计算会员等级 | ||||
|             BdGrade newGrade = this.calculateGrade(orderParam.getSpecialArea(), orderParam.getOrderItemsParams(), | ||||
|                     gradeList, cuMember, orderAchieve); | ||||
|             if (null == newGrade) { | ||||
|                 throw new ServiceException("会员不满足升级条件"); | ||||
|             } | ||||
|             saOrderExt.setPkGrade(newGrade.getPkId()); | ||||
|             // 会员信息 | ||||
|             if (null != cuMember) { | ||||
|                 cuMember.setPkSettleGrade(newGrade.getPkId()); | ||||
|                 if (null == cuMember.getPkAwards()) { | ||||
|                     // 新会员没有奖衔,则进行赋值 | ||||
|                     cuMember.setPkAwards(newGrade.getPkAwards()); | ||||
|                 if (null == cuMember.getPkSettleGrade()) { | ||||
|                     // 注册、升级订单,计算会员等级 | ||||
|                     BdGrade newGrade = this.calculateGrade(orderParam.getSpecialArea(), orderParam.getOrderItemsParams(), | ||||
|                             gradeList, cuMember, orderAchieve); | ||||
|                     if (null == newGrade) { | ||||
|                         throw new ServiceException("会员不满足升级条件"); | ||||
|                     } | ||||
|                     saOrderExt.setPkGrade(newGrade.getPkId()); | ||||
|                     cuMember.setPkSettleGrade(newGrade.getPkId()); | ||||
| 
 | ||||
|                     if (null == cuMember.getPkAwards()) { | ||||
|                         // 会员没有奖衔,则进行赋值 | ||||
|                         cuMember.setPkAwards(newGrade.getPkAwards()); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } else if (ESpecialArea.RETAIL_UPGRADE.getValue() == orderParam.getSpecialArea()) { | ||||
|  |  | |||
|  | @ -365,7 +365,8 @@ | |||
|         bwss.pk_wares_detail, | ||||
|         bwss.price, | ||||
|         bwss.achieve, | ||||
|         bwss.ass_achieve | ||||
|         bwss.ass_achieve, | ||||
|         bwd.is_gift | ||||
|         from bd_wares_specs_sku bwss | ||||
|         left join BD_WARES_DETAIL bwd | ||||
|         on bwd.del_flag = 0 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue