## 188注册不能使用政策币;
This commit is contained in:
parent
600c427aa8
commit
15da9da473
|
@ -1,103 +0,0 @@
|
|||
package com.hzs.sale.order.controller.api;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.hzs.common.core.annotation.RepeatSubmit;
|
||||
import com.hzs.common.core.constant.HttpStatus;
|
||||
import com.hzs.common.core.constant.msg.MemberMsgConstants;
|
||||
import com.hzs.common.core.constant.msg.SaOrderMsgConstants;
|
||||
import com.hzs.common.core.web.domain.AjaxResult;
|
||||
import com.hzs.common.domain.member.base.CuMember;
|
||||
import com.hzs.common.security.utils.SecurityUtils;
|
||||
import com.hzs.common.util.TransactionUtils;
|
||||
import com.hzs.member.base.IMemberServiceApi;
|
||||
import com.hzs.sale.order.controller.ParentOrderController;
|
||||
import com.hzs.sale.order.param.*;
|
||||
import com.hzs.sale.shopping.vo.ShoppingCartVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 嗨粉订单
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/order")
|
||||
@Slf4j
|
||||
public class ApiFanSaOrderController extends ParentOrderController {
|
||||
|
||||
@DubboReference
|
||||
IMemberServiceApi iMemberServiceApi;
|
||||
|
||||
/**
|
||||
* @param orderParam 订单参数
|
||||
* @Description: 报单中心确认嗨粉订单,生成待支付订单,只有注册订单有待支付订单
|
||||
* @return: AjaxResult
|
||||
*/
|
||||
@PostMapping("/confirm-fun-order")
|
||||
@RepeatSubmit
|
||||
public AjaxResult confirmHaiFunOrder(@Validated @RequestBody OrderParam orderParam) {
|
||||
if (orderParam.getDeleteList() == null || orderParam.getDeleteList().size() == 0) {
|
||||
return AjaxResult.error(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY);
|
||||
}
|
||||
//校验休止期、已终止的会员不允许报单
|
||||
AjaxResult ajaxResult = validateMemberDeclaration(SecurityUtils.getUserId());
|
||||
if ((Integer) ajaxResult.get(AjaxResult.CODE_TAG) != HttpStatus.SUCCESS) {
|
||||
return ajaxResult;
|
||||
}
|
||||
initSecurityOrderParam(orderParam);
|
||||
// 验证必输项
|
||||
if (validateFieldNotNull(orderParam, orderParam.getValidConfirmField()) ||
|
||||
!checkRecMsgBoolean(orderParam)) {
|
||||
return AjaxResult.error(MemberMsgConstants.REQUIRED_NOT_EMPTY);
|
||||
}
|
||||
orderParam.setIsHaiFun(true);
|
||||
AjaxResult result = validateSaveMember(orderParam);
|
||||
if ((Integer) result.get(AjaxResult.CODE_TAG) == HttpStatus.ERROR) {
|
||||
return result;
|
||||
}
|
||||
convertShoppingCarToSku(orderParam);
|
||||
if (getOrderService().confirmRegSaOrderByOrderParam(orderParam)) {
|
||||
//删除购物车下单的数据
|
||||
if (CollectionUtil.isNotEmpty(orderParam.getDeleteList())) {
|
||||
ShoppingCartVO sop = new ShoppingCartVO();
|
||||
sop.setDeleteList(orderParam.getDeleteList());
|
||||
iShoppingCartService.batchDelShopping(SecurityUtils.getUserId(), sop);
|
||||
}
|
||||
return AjaxResult.success(orderParam);
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param orderParam 订单参数 自注册
|
||||
* @Description: 报单中心确认嗨粉订单,生成待支付订单,只有注册订单有待支付订单
|
||||
* @return: AjaxResult
|
||||
*/
|
||||
@PostMapping("/confirm-self-fun-order")
|
||||
@RepeatSubmit
|
||||
public AjaxResult confirmSelfFunOrder(@Validated @RequestBody OrderParam orderParam) {
|
||||
initSecurityOrderParam(orderParam);
|
||||
// 验证必输项
|
||||
if (!checkRecMsgBoolean(orderParam)) {
|
||||
return AjaxResult.error(MemberMsgConstants.REQUIRED_NOT_EMPTY);
|
||||
}
|
||||
orderParam.setIsHaiFun(true);
|
||||
|
||||
CuMember cuMember = iMemberServiceApi.queryMember(orderParam.getCenterCodeId()).getData();
|
||||
if (cuMember == null) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.PARENT_NOT_EXISTS));
|
||||
}
|
||||
|
||||
if (getOrderService().confirmSelfFunOrderByOrderParam(orderParam, cuMember)) {
|
||||
return AjaxResult.success(orderParam);
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -71,8 +71,9 @@ public class ApiRegSaOrderController extends ParentOrderController {
|
|||
|
||||
initSecurityOrderParam(orderParam);
|
||||
// 验证必输项
|
||||
if (source == null || validateFieldNotNull(orderParam, orderParam.getValidConfirmField()) ||
|
||||
!checkRecMsgBoolean(orderParam)) {
|
||||
if (source == null
|
||||
|| validateFieldNotNull(orderParam, orderParam.getValidConfirmField())
|
||||
|| !checkRecMsgBoolean(orderParam)) {
|
||||
return AjaxResult.error(MemberMsgConstants.REQUIRED_NOT_EMPTY);
|
||||
}
|
||||
orderParam.setSource(source);
|
||||
|
|
|
@ -330,14 +330,14 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
|
|||
payMoney = ComputeUtil.computeSubtract(payMoney, orderItemPayMoney);
|
||||
List<AreaCurrencyDTO> areaCurrencyDtoList = iAreaCurrencyServiceApi.queryAreaCurrencyByCondition(saOrderItems.getPkSpecialCurrency()).getData();
|
||||
|
||||
if (!handleSaOrderAmount(upPolicyCurrency, cuMemberAccount, orderItemPayMoney, BigDecimal.ZERO, areaCurrencyDtoList)) {
|
||||
if (!handleSaOrderAmount(upPolicyCurrency, cuMemberAccount, orderItemPayMoney, BigDecimal.ZERO, saOrder.getOrderTypeExtend(), areaCurrencyDtoList)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleSaOrderAmount(upPolicyCurrency, cuMemberAccount, payMoney, saOrder.getPostage(), areaCurrencyDTOList);
|
||||
handleSaOrderAmount(upPolicyCurrency, cuMemberAccount, payMoney, saOrder.getPostage(), saOrder.getOrderTypeExtend(), areaCurrencyDTOList);
|
||||
|
||||
if (null != cuMemberAccount.getPayAccount5() && cuMemberAccount.getPayAccount5().compareTo(BigDecimal.ZERO) > 0) {
|
||||
// 2024.09.24 重消专区可以使用其它币种,此处只记录重消币,其它币种需要单独计算统计
|
||||
|
@ -353,7 +353,7 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
|
|||
}
|
||||
|
||||
private Boolean handleSaOrderAmount(UpPolicyCurrency upPolicyCurrency, CuMemberAccountExt cuMemberAccount,
|
||||
BigDecimal payMoney, BigDecimal postage,
|
||||
BigDecimal payMoney, BigDecimal postage, Integer orderTypeExtend,
|
||||
List<AreaCurrencyDTO> areaCurrencyDTOList) {
|
||||
boolean flag = Boolean.TRUE;
|
||||
if (!ComputeUtil.compareValue(ComputeUtil.computeAdd(payMoney, postage))) {
|
||||
|
@ -364,6 +364,12 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
|
|||
BigDecimal original = payMoney;
|
||||
|
||||
for (AreaCurrencyDTO areaCurrencyDTO : areaCurrencyDTOList) {
|
||||
if (EAccount.POLICY.getValue() == areaCurrencyDTO.getFieldValue()
|
||||
&& null != orderTypeExtend
|
||||
&& EOrderTypeExtend.REG_REP.getValue() == orderTypeExtend) {
|
||||
// 2025.07.17 新需求,注册转复购订单不能使用政策币
|
||||
continue;
|
||||
}
|
||||
// 开始扣款
|
||||
// 待支付金额>0进行扣减
|
||||
if (ComputeUtil.compareValue(payMoney)) {
|
||||
|
@ -470,6 +476,12 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
|
|||
if (setLastCuMemberGrade(cuMember, saOrderExt)) {
|
||||
return false;
|
||||
}
|
||||
if (null != cuMember.getPkSettleGradeValue()
|
||||
&& EGrade.HAI_FAN.getValue() == cuMember.getPkSettleGradeValue()) {
|
||||
// 最终等级是顾客,就是需要注册转复购订单
|
||||
saOrderExt.setOrderTypeExtend(EOrderTypeExtend.REG_REP.getValue());
|
||||
}
|
||||
|
||||
// 保存 用户、订单、订单明细 分布式事务
|
||||
// 启用待支付,或者海粉订单
|
||||
if (isToBePay && !orderParam.getIsHaiFun()) {
|
||||
|
|
|
@ -203,7 +203,7 @@ public class SaOrder extends BaseEntity {
|
|||
private String modifiedTimeStr;
|
||||
|
||||
/**
|
||||
* 订单扩展类型(0=正常,1=海粉板粟)
|
||||
* 订单扩展类型(0=正常,1=注册转复购)
|
||||
*/
|
||||
@TableField("ORDER_TYPE_EXTEND")
|
||||
private Integer orderTypeExtend;
|
||||
|
|
Loading…
Reference in New Issue