| | |
| | | if(Objects.isNull(discountMember)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | List<DiscountLog> discountLogList = discountLogMapper.selectJoinList(DiscountLog.class,new MPJLambdaWrapper<DiscountLog>() |
| | | .selectAll(DiscountLog.class) |
| | | .selectAs(SystemUser::getRealname,DiscountLog::getCreatorName) |
| | | .eq(DiscountLog::getDiscountMemberId,discountMember.getId()) |
| | | .eq(DiscountLog::getIsdeleted,Constants.ZERO) |
| | | .orderByDesc(DiscountLog::getId) |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(discountLogList)){ |
| | | discountMember.setDiscountLogList(discountLogList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList())); |
| | | discountMember.setOptLogList(discountLogList.stream().filter(i->!Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList())); |
| | | discountMember.setUseTimes(discountMember.getDiscountLogList().size()); |
| | | } |
| | | // List<DiscountLog> discountLogList = discountLogMapper.selectJoinList(DiscountLog.class,new MPJLambdaWrapper<DiscountLog>() |
| | | // .selectAll(DiscountLog.class) |
| | | // .selectAs(SystemUser::getRealname,DiscountLog::getCreatorName) |
| | | // .leftJoin(SystemUser.class,SystemUser::getId,DiscountLog::getCreator) |
| | | // .eq(DiscountLog::getDiscountMemberId,discountMember.getId()) |
| | | // .eq(DiscountLog::getIsdeleted,Constants.ZERO) |
| | | // .orderByDesc(DiscountLog::getId) |
| | | // ); |
| | | // discountMember.setUseTimes(discountMember.getDiscountLogList().size()); |
| | | // if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(discountLogList)){ |
| | | // discountMember.setDiscountLogList(discountLogList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList())); |
| | | // discountMember.setOptLogList(discountLogList.stream().filter(i->!Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList())); |
| | | // |
| | | // } |
| | | return discountMember; |
| | | } |
| | | |
| | |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | DiscountMember model = pageWrap.getModel(); |
| | | queryWrapper.selectAll(DiscountMember.class) |
| | | .selectAs(Member::getOpenid,DiscountMember::getOpenid) |
| | | .select(" ( select count(1) from discount_log d where d.discount_member_id = t.id and d.type = 0 ) ",DiscountMember::getUseTimes) |
| | | .leftJoin(Member.class,Member::getId,DiscountMember::getMemberId) |
| | | .like(StringUtils.isNotBlank(model.getCode()),DiscountMember::getCode,model.getCode()) |
| | | .like(StringUtils.isNotBlank(model.getName()),DiscountMember::getName,model.getName()) |
| | | .like(StringUtils.isNotBlank(model.getOpenid()),Member::getOpenid,model.getOpenid()) |
| | | .eq(Objects.nonNull(model.getStatus()),DiscountMember::getStatus,model.getStatus()) |
| | | .orderByDesc(DiscountMember::getId); |
| | | .ne(DiscountMember::getStatus,Constants.TWO) |
| | | .orderByDesc(DiscountMember::getCode); |
| | | return PageData.from(discountMemberJoinMapper.selectJoinPage(page, DiscountMember.class,queryWrapper)); |
| | | } |
| | | |
| | |
| | | .orderByDesc(DiscountMember::getId); |
| | | List<DiscountMember> list = discountMemberJoinMapper.selectJoinList(DiscountMember.class,queryWrapper); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到可报废的套餐卡信息"); |
| | | return; |
| | | } |
| | | for (DiscountMember discountMember:list) { |
| | | if(!Constants.equalsInteger(discountMember.getStatus(),Constants.ZERO)){ |
| | | continue; |
| | | } |
| | | discountMemberMapper.update(null,new UpdateWrapper<DiscountMember>().lambda() |
| | | .set(DiscountMember::getStatus,Constants.ONE) |
| | | .eq(DiscountMember::getId,discountMember.getId()) |
| | |
| | | discountLog.setGoodsorderId(discountMember.getGoodsorderId()); |
| | | discountLogMapper.insert(discountLog); |
| | | } |
| | | //退款操作 |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public void adjust(DiscountMemberDTO model){ |
| | | if(Objects.isNull(model) |
| | | || Objects.isNull(model.getAddDays())){ |
| | | || Objects.isNull(model.getAddDays())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | |
| | | discountLog.setDiscountMemberId(discountMember.getId()); |
| | | discountLog.setType(Constants.TWO); |
| | | discountLog.setGoodsorderId(discountMember.getGoodsorderId()); |
| | | discountLog.setEditInfo(model.getInfo()); |
| | | discountLog.setInfo(model.getInfo()); |
| | | discountLog.setEditDays(model.getAddDays()); |
| | | discountLog.setEditInfo("将有效期增加"+model.getAddDays()+"天, 调整后有效期至"+useEndDate); |
| | | discountLogMapper.insert(discountLog); |
| | | |
| | | } |