| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.DiscountMemberMapper; |
| | | import com.doumee.dao.business.RefundMapper; |
| | | import com.doumee.dao.business.TransactionsMapper; |
| | | import com.doumee.dao.business.model.DiscountMember; |
| | | import com.doumee.dao.business.model.Transactions; |
| | | import com.doumee.service.business.TransactionsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 交易流水表Service实现 |
| | |
| | | |
| | | @Autowired |
| | | private TransactionsMapper transactionsMapper; |
| | | |
| | | @Autowired |
| | | private DiscountMemberMapper discountMemberMapper; |
| | | |
| | | @Autowired |
| | | private RefundMapper refundMapper; |
| | | |
| | | |
| | | @Override |
| | | public String create(Transactions transactions) { |
| | |
| | | @Override |
| | | public Transactions findOne(Transactions transactions) { |
| | | QueryWrapper<Transactions> wrapper = new QueryWrapper<>(transactions); |
| | | return transactionsMapper.selectOne(wrapper); |
| | | return transactionsMapper.selectOne(wrapper.last(" limit 1")); |
| | | } |
| | | |
| | | @Override |
| | |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | queryWrapper.lambda().eq(Transactions::getMemberId, memberId); |
| | | queryWrapper.orderByDesc("create_date"); |
| | | return PageData.from(transactionsMapper.selectPage(page, queryWrapper)); |
| | | PageData<Transactions> pageData = PageData.from(transactionsMapper.selectPage(page, queryWrapper)); |
| | | for (Transactions transactions:pageData.getRecords()) { |
| | | if(Constants.equalsInteger(transactions.getType(),Constants.TRANSACTIONS_TYPE.DISCOUNT.getKey())){ |
| | | //购买套餐 处理内容 |
| | | DiscountMember discountMember = discountMemberMapper.selectById(transactions.getObjId()); |
| | | if(Objects.nonNull(discountMember)){ |
| | | transactions.setContent(discountMember.getName() +" | 有效期" + DateUtil.dateToString(discountMember.getUseStartDate(),"yyyy-MM-dd") +" 至 "+DateUtil.dateToString(discountMember.getUseEndDate(),"yyyy-MM-dd")); |
| | | } |
| | | }else if(Constants.equalsInteger(transactions.getType(),Constants.TRANSACTIONS_TYPE.PLATFORM_REFUND.getKey())){ |
| | | DiscountMember discountMember = discountMemberMapper.selectOne( |
| | | new QueryWrapper<DiscountMember>().lambda().eq(DiscountMember::getGoodsorderId, transactions.getOrderId()).last("limit 1")); |
| | | if(Objects.nonNull(discountMember)){ |
| | | transactions.setContent(discountMember.getName() +" | 有效期" + DateUtil.dateToString(discountMember.getUseStartDate(),"yyyy-MM-dd") +" 至 "+DateUtil.dateToString(discountMember.getUseEndDate(),"yyyy-MM-dd")); |
| | | } |
| | | } |
| | | } |
| | | return pageData; |
| | | } |
| | | |
| | | |