Commit 80eaf171 by 吕明尚

修改计算订单金额

parent ea136a42
...@@ -3,6 +3,8 @@ package share.system.domain.vo; ...@@ -3,6 +3,8 @@ package share.system.domain.vo;
import lombok.Data; import lombok.Data;
import share.system.domain.MemberConfig; import share.system.domain.MemberConfig;
import java.math.BigDecimal;
@Data @Data
public class MemberConfigVo extends MemberConfig { public class MemberConfigVo extends MemberConfig {
//下一级的额度要求 //下一级的额度要求
...@@ -11,4 +13,6 @@ public class MemberConfigVo extends MemberConfig { ...@@ -11,4 +13,6 @@ public class MemberConfigVo extends MemberConfig {
private Long nextMembershipLevel; private Long nextMembershipLevel;
//下一级的会员名称 //下一级的会员名称
private String nextMembershipName; private String nextMembershipName;
//下一周多少积分清零
private BigDecimal nextWeekClearIntegral;
} }
package share.system.service.impl; package share.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
...@@ -15,9 +16,11 @@ import share.common.constant.SmsConstants; ...@@ -15,9 +16,11 @@ import share.common.constant.SmsConstants;
import share.common.enums.ConsumerCouponUseStatusEnum; import share.common.enums.ConsumerCouponUseStatusEnum;
import share.common.enums.PositionEnum; import share.common.enums.PositionEnum;
import share.common.enums.RoleTypeEnum; import share.common.enums.RoleTypeEnum;
import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException; import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil; import share.common.utils.BaseUtil;
import share.common.utils.DateUtil; import share.common.utils.DateUtil;
import share.common.utils.DateUtils;
import share.system.domain.*; import share.system.domain.*;
import share.system.domain.vo.FrontTokenComponent; import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.MemberConfigVo; import share.system.domain.vo.MemberConfigVo;
...@@ -27,6 +30,8 @@ import share.system.mapper.SStoreConsumerMapper; ...@@ -27,6 +30,8 @@ import share.system.mapper.SStoreConsumerMapper;
import share.system.request.RegisterThirdSConsumerRequest; import share.system.request.RegisterThirdSConsumerRequest;
import share.system.service.*; import share.system.service.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -53,6 +58,8 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -53,6 +58,8 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
private ConsumerMemberService consumerMemberService; private ConsumerMemberService consumerMemberService;
@Autowired @Autowired
private MemberConfigService memberConfigService; private MemberConfigService memberConfigService;
@Autowired
private MemberProgressLogService memberProgressLogService;
/** /**
* 查询会员用户 * 查询会员用户
...@@ -206,6 +213,22 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -206,6 +213,22 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
memberConfigVo.setNextMembershipLevel(nexMemberConfig.getMembershipLevel()); memberConfigVo.setNextMembershipLevel(nexMemberConfig.getMembershipLevel());
memberConfigVo.setNextMembershipName(nexMemberConfig.getLevelName()); memberConfigVo.setNextMembershipName(nexMemberConfig.getLevelName());
} }
List<MemberProgressLog> memberProgressLogs = memberProgressLogService.list(new LambdaQueryWrapper<MemberProgressLog>()
.lt(MemberProgressLog::getExpirationTime, DateUtils.addDays(new Date(), 7))
.eq(MemberProgressLog::getConsumerId, currentUser.getId())
);
final BigDecimal[] sum = {BigDecimal.ZERO};
if (CollectionUtil.isNotEmpty(memberProgressLogs)) {
//计算扣除进度
memberProgressLogs.stream().forEach(log -> {
if (log.getOperationType().equals(YesNoEnum.yes.getIndex())) {
sum[0] = sum[0].add(log.getVariableProgress());
} else if (log.getOperationType().equals(YesNoEnum.no.getIndex())) {
sum[0] = sum[0].subtract(log.getVariableProgress());
}
});
}
memberConfigVo.setNextWeekClearIntegral(sum[0]);
vo.setMemberConfig(memberConfigVo); vo.setMemberConfig(memberConfigVo);
} }
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
......
...@@ -2594,11 +2594,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2594,11 +2594,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
}); });
if (i.get() == 0) { if (i.get() == 0) {
boolean match = executionTime.isMatch(ZonedDateTime.ofInstant(request.getPreStartDate().toInstant(), ZoneId.systemDefault()));
boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(request.getPreEndDate().toInstant(), ZoneId.systemDefault()));
if (match && match1) {
payPrice = payPrice.multiply(activity.getDiscountRatio()).divide(new BigDecimal(100)); payPrice = payPrice.multiply(activity.getDiscountRatio()).divide(new BigDecimal(100));
} else { } else {
MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId()); MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId());
payPrice = payPrice.multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100)); payPrice = payPrice.multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100));
} }
// payPrice = payPrice.multiply(activity.getDiscountRatio()).divide(new BigDecimal(100));
} else {
MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId());
payPrice = payPrice.multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100));
}
} }
} else { } else {
MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId()); MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment