Commit 747e6f47 by 吕明尚

修改订单价格计算

parent 67f45a36
...@@ -11,7 +11,6 @@ import share.common.core.page.TableDataInfo; ...@@ -11,7 +11,6 @@ import share.common.core.page.TableDataInfo;
import share.common.enums.YesNoEnum; import share.common.enums.YesNoEnum;
import share.system.domain.Activity; import share.system.domain.Activity;
import share.system.domain.vo.ActivityDto; import share.system.domain.vo.ActivityDto;
import share.system.domain.vo.ActivityVo;
import share.system.service.ActivityService; import share.system.service.ActivityService;
import java.util.Date; import java.util.Date;
...@@ -43,7 +42,7 @@ public class ActivityController extends BaseController { ...@@ -43,7 +42,7 @@ public class ActivityController extends BaseController {
@GetMapping("/query") @GetMapping("/query")
public AjaxResult query(ActivityDto dto) { public AjaxResult query(ActivityDto dto) {
dto.setIsOpen(Long.valueOf(YesNoEnum.yes.getIndex())); dto.setIsOpen(Long.valueOf(YesNoEnum.yes.getIndex()));
Map<Date, List<ActivityVo>> map = activityService.queryList(dto); Map<Date, List<Activity>> map = activityService.queryList(dto);
return success(map); return success(map);
} }
......
...@@ -3,7 +3,6 @@ package share.system.service; ...@@ -3,7 +3,6 @@ package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Activity; import share.system.domain.Activity;
import share.system.domain.vo.ActivityDto; import share.system.domain.vo.ActivityDto;
import share.system.domain.vo.ActivityVo;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -64,5 +63,5 @@ public interface ActivityService extends IService<Activity> { ...@@ -64,5 +63,5 @@ public interface ActivityService extends IService<Activity> {
*/ */
public int deleteActivityById(Long id); public int deleteActivityById(Long id);
Map<Date, List<ActivityVo>> queryList(ActivityDto dto); Map<Date, List<Activity>> queryList(ActivityDto dto);
} }
...@@ -20,7 +20,6 @@ import share.system.domain.ConsumerMember; ...@@ -20,7 +20,6 @@ import share.system.domain.ConsumerMember;
import share.system.domain.SConsumer; import share.system.domain.SConsumer;
import share.system.domain.SStore; import share.system.domain.SStore;
import share.system.domain.vo.ActivityDto; import share.system.domain.vo.ActivityDto;
import share.system.domain.vo.ActivityVo;
import share.system.mapper.ActivityMapper; import share.system.mapper.ActivityMapper;
import share.system.service.ActivityService; import share.system.service.ActivityService;
import share.system.service.ConsumerMemberService; import share.system.service.ConsumerMemberService;
...@@ -121,7 +120,7 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i ...@@ -121,7 +120,7 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i
} }
@Override @Override
public Map<Date, List<ActivityVo>> queryList(ActivityDto dto) { public Map<Date, List<Activity>> queryList(ActivityDto dto) {
SConsumer user = sConsumerService.getInfo(); SConsumer user = sConsumerService.getInfo();
if (ObjectUtil.isEmpty(user)) { if (ObjectUtil.isEmpty(user)) {
return new HashMap<>(); return new HashMap<>();
...@@ -139,26 +138,25 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i ...@@ -139,26 +138,25 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i
} }
Activity activity = new Activity(); Activity activity = new Activity();
BeanUtils.copyProperties(dto, activity); BeanUtils.copyProperties(dto, activity);
activity.setMemberType(MemberTypeEnum.NORMAL.getIndex());
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
activity.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
activity.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
}
List<Activity> activities = selectActivityList(activity); List<Activity> activities = selectActivityList(activity);
CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)); CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
Map<Date, List<ActivityVo>> map = new HashMap<>(); Map<Date, List<Activity>> map = new HashMap<>();
days.stream().forEach(day -> { days.stream().forEach(day -> {
List<ActivityVo> voList = new ArrayList<>(); List<Activity> voList = new ArrayList<>();
activities.stream().forEach(item -> { activities.stream().forEach(item -> {
Cron cron = cronParser.parse(item.getCronExpression()); Cron cron = cronParser.parse(item.getCronExpression());
ExecutionTime executionTime = ExecutionTime.forCron(cron); ExecutionTime executionTime = ExecutionTime.forCron(cron);
boolean match = executionTime.isMatch(ZonedDateTime.ofInstant(day.toInstant(), ZoneId.systemDefault())); boolean match = executionTime.isMatch(ZonedDateTime.ofInstant(day.toInstant(), ZoneId.systemDefault()));
if (match) { if (match) {
ActivityVo activityVo = new ActivityVo(); voList.add(item);
activityVo.setMemberType(MemberTypeEnum.NORMAL.getIndex());
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
activityVo.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
activityVo.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
}
BeanUtils.copyProperties(item, activityVo);
voList.add(activityVo);
} }
}); });
if (voList.size() > 0) { if (voList.size() > 0) {
......
...@@ -2428,14 +2428,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2428,14 +2428,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId())); consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()));
if (ObjectUtil.isNotEmpty(consumerMember)) { if (ObjectUtil.isNotEmpty(consumerMember)) {
queryWrapper.eq(Activity::getIsOpen, YesNoEnum.yes.getIndex()); queryWrapper.eq(Activity::getIsOpen, YesNoEnum.yes.getIndex());
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.NORMAL.getIndex());
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RECHARGE.getIndex());
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) { if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RIGHTS.getIndex()); queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RIGHTS.getIndex());
} else if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()) && consumerMember.getIsRights().equals(YesNoEnum.no.getIndex())) {
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RECHARGE.getIndex());
} else {
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.NORMAL.getIndex());
} }
} }
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
priceResponse.setAvailableBalance(consumerWallet.getBalance()); priceResponse.setAvailableBalance(consumerWallet.getBalance());
......
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