Commit 016b6efb by 吕明尚

Merge branch 'dev' into test

parents 40e5e3e5 5acd6ba5
......@@ -34,6 +34,14 @@ public class ConsumerMonthlyCard extends BaseEntity {
@Excel(name = "月卡配置表id")
private Long monthlyCardConfId;
//配置名称
@Excel(name = "月卡配置名称")
private String confName;
//月卡金额
@Excel(name = "月卡金额")
private BigDecimal confAmount;
/**
* 用户ID
*/
......
......@@ -32,6 +32,14 @@ public class ConsumerSecondaryCard extends BaseEntity {
@Excel(name = "次卡配置表id")
private Long secondaryCardConfId;
//配置名称
@Excel(name = "次卡配置名称")
private String confName;
//月卡金额
@Excel(name = "次卡金额")
private BigDecimal confAmount;
/**
* 用户ID
*/
......
......@@ -3,16 +3,10 @@ package share.system.domain.vo;
import lombok.Data;
import share.system.domain.ConsumerMonthlyCard;
import java.math.BigDecimal;
@Data
public class ConsumerMonthlyCardVo extends ConsumerMonthlyCard {
//用户昵称
private String nickName;
//用户头像
private String avatar;
//配置名称
private String confName;
//月卡金额
private BigDecimal confAmount;
}
......@@ -3,18 +3,12 @@ package share.system.domain.vo;
import lombok.Data;
import share.system.domain.ConsumerSecondaryCard;
import java.math.BigDecimal;
@Data
public class ConsumerSecondaryCardVo extends ConsumerSecondaryCard {
//用户昵称
private String nickName;
//用户头像
private String avatar;
//配置名称
private String confName;
//次卡金额
private BigDecimal confAmount;
//是否适用当前套餐
private Integer isUse;
//原因
......
......@@ -103,6 +103,24 @@ public class SOrderVo
@Excel(name = "优惠卷促销价")
private BigDecimal couponPayPrice;
@Excel(name = "次卡ID")
private Long secondaryCardId;
@Excel(name = "次卡名称")
private String secondaryCardName;
@Excel(name = "次卡金额")
private BigDecimal secondaryCardAmount;
@Excel(name = "月卡ID")
private Long monthlyCardId;
@Excel(name = "月卡名称")
private String monthlyCardName;
@Excel(name = "月卡金额")
private BigDecimal monthlyCardAmount;
@ApiModelProperty(value = "订单总价")
@Excel(name = "订单总价")
private BigDecimal totalPrice;
......@@ -283,11 +301,7 @@ public class SOrderVo
@ApiModelProperty(name = "是否可以申请退款")
private Boolean isRefund;
@Excel(name = "次卡ID")
private Long secondaryCardId;
@Excel(name = "月卡ID")
private Long monthlyCardId;
@Excel(name = "历史订单号")
private String historicalOrderNo;
......
......@@ -5,6 +5,7 @@ import share.system.domain.ConsumerMonthlyCard;
import share.system.domain.vo.ConsumerMonthlyCardVo;
import share.system.request.MonthlyCardRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -66,4 +67,6 @@ public interface ConsumerMonthlyCardService extends IService<ConsumerMonthlyCard
List<ConsumerMonthlyCardVo> selectByConsumerId();
Map<String, List<Long>> queryCardType(MonthlyCardRequest monthlyCardRequest);
List<ConsumerMonthlyCard> confNameByIds(ArrayList<Long> longs);
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.ConsumerSecondaryCard;
import share.system.domain.vo.ConsumerSecondaryCardVo;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -64,4 +65,6 @@ public interface ConsumerSecondaryCardService extends IService<ConsumerSecondary
List<ConsumerSecondaryCardVo> selectByConsumerId();
List<ConsumerSecondaryCardVo> selectByPaclId(Long packId);
List<ConsumerSecondaryCard> confNameByIds(ArrayList<Long> longs);
}
......@@ -66,5 +66,5 @@ public interface IPackService extends IService<SPack> {
List<SPack> pageList(SPack sPack);
List<SPack> storeNameByIds(List<Long> longs);
List<SPack> packNameByIds(List<Long> longs);
}
......@@ -90,7 +90,7 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
SConsumerCoupon selectSConsumerCouponByCode(String code);
List<SConsumerCoupon> storeNameByIds(List<Long> longs);
List<SConsumerCoupon> couponNameByIds(List<Long> longs);
List<SConsumerCoupon> selectOrderList();
......
......@@ -109,5 +109,5 @@ public interface ISRoomService extends IService<SRoom>
List<SRoomVo> convertDoListToVoList(List<SRoom> roomList);
List<SRoom> storeNameByIds(List<Long> longs);
List<SRoom> roomNameByIds(List<Long> longs);
}
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -223,4 +224,14 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
}
return new HashMap<>();
}
@Override
public List<ConsumerMonthlyCard> confNameByIds(ArrayList<Long> longs) {
LambdaQueryWrapper<ConsumerMonthlyCard> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(ConsumerMonthlyCard::getId, ConsumerMonthlyCard::getConfName);
if (CollectionUtils.isNotEmpty(longs)) {
queryWrapper.in(ConsumerMonthlyCard::getId, longs);
}
return list(queryWrapper);
}
}
package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.exception.base.BaseException;
......@@ -15,6 +17,7 @@ import share.system.service.ConsumerSecondaryCardService;
import share.system.service.IPackService;
import share.system.service.SConsumerService;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
......@@ -134,4 +137,14 @@ public class ConsumerSecondaryCardServiceImpl extends ServiceImpl<ConsumerSecond
// });
return consumerSecondaryCardVos;
}
@Override
public List<ConsumerSecondaryCard> confNameByIds(ArrayList<Long> longs) {
LambdaQueryWrapper<ConsumerSecondaryCard> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(ConsumerSecondaryCard::getId, ConsumerSecondaryCard::getConfName);
if (CollectionUtils.isNotEmpty(longs)) {
queryWrapper.in(ConsumerSecondaryCard::getId, longs);
}
return list(queryWrapper);
}
}
......@@ -179,6 +179,8 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, monthlyCardOrder.getConsumerId()));
MonthlyCardConf byId = monthlyCardConfService.getById(monthlyCardOrder.getMonthlyCardConfId());
consumerMonthlyCard.setMonthlyCardConfId(byId.getId());
consumerMonthlyCard.setConfName(byId.getName());
consumerMonthlyCard.setConfAmount(byId.getMonthlyCardAmount());
consumerMonthlyCard.setConsumerId(monthlyCardOrder.getConsumerId());
consumerMonthlyCard.setPhone(monthlyCardOrder.getPhone());
consumerMonthlyCard.setExpirationDate(DateUtils.addDays(new Date(), byId.getMonthlyCardDays().intValue()));
......
......@@ -159,7 +159,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
}
@Override
public List<SPack> storeNameByIds(List<Long> longs) {
public List<SPack> packNameByIds(List<Long> longs) {
LambdaQueryWrapper<SPack> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SPack::getId, SPack::getName);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(longs)) {
......
......@@ -591,7 +591,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
}
@Override
public List<SConsumerCoupon> storeNameByIds(List<Long> longs) {
public List<SConsumerCoupon> couponNameByIds(List<Long> longs) {
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SConsumerCoupon::getId, SConsumerCoupon::getName);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(longs)) {
......
......@@ -2436,6 +2436,24 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
Set<Long> roomIds = orderList.stream().map(SOrder::getRoomId).distinct().collect(Collectors.toSet());
Set<Long> couponIds = orderList.stream().map(SOrder::getCouponId).distinct().collect(Collectors.toSet());
Set<Long> packIds = orderList.stream().map(SOrder::getPackId).distinct().collect(Collectors.toSet());
Set<Long> secondaryCardIds = orderList.stream().map(SOrder::getSecondaryCardId).distinct().collect(Collectors.toSet());
Set<Long> monthlyCardIds = orderList.stream().map(SOrder::getMonthlyCardId).distinct().collect(Collectors.toSet());
Map<Long, ConsumerSecondaryCard> secondaryCardMap;
if (!secondaryCardIds.isEmpty()) {
List<ConsumerSecondaryCard> consumerSecondaryCardVos = consumerSecondaryCardService.confNameByIds(new ArrayList<>(secondaryCardIds));
secondaryCardMap = consumerSecondaryCardVos.stream().collect(Collectors.toMap(ConsumerSecondaryCard::getId, s -> s));
} else {
secondaryCardMap = new HashMap<>();
}
Map<Long, ConsumerMonthlyCard> monthlyCardMap;
if (!monthlyCardIds.isEmpty()) {
List<ConsumerMonthlyCard> consumerMonthlyCards = consumerMonthlyCardService.confNameByIds(new ArrayList<>(monthlyCardIds));
monthlyCardMap = consumerMonthlyCards.stream().collect(Collectors.toMap(ConsumerMonthlyCard::getId, s -> s));
} else {
monthlyCardMap = new HashMap<>();
}
Map<Long, SStore> storeMap;
if (!storeIds.isEmpty()) {
......@@ -2447,7 +2465,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
Map<Long, SRoom> roomMap;
if (!roomIds.isEmpty()) {
List<SRoom> rooms = roomService.storeNameByIds(new ArrayList<>(roomIds));
List<SRoom> rooms = roomService.roomNameByIds(new ArrayList<>(roomIds));
roomMap = rooms.stream().collect(Collectors.toMap(SRoom::getId, s -> s));
} else {
roomMap = new HashMap<>();
......@@ -2455,7 +2473,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
Map<Long, SConsumerCoupon> couponMap;
if (!couponIds.isEmpty()) {
List<SConsumerCoupon> coupons = consumerCouponService.storeNameByIds(new ArrayList<>(couponIds));
List<SConsumerCoupon> coupons = consumerCouponService.couponNameByIds(new ArrayList<>(couponIds));
couponMap = coupons.stream().collect(Collectors.toMap(SConsumerCoupon::getId, s -> s));
} else {
couponMap = new HashMap<>();
......@@ -2463,7 +2481,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
Map<Long, SPack> packMap;
if (!packIds.isEmpty()) {
List<SPack> packs = packService.storeNameByIds(new ArrayList<>(packIds));
List<SPack> packs = packService.packNameByIds(new ArrayList<>(packIds));
packMap = packs.stream().collect(Collectors.toMap(SPack::getId, s -> s));
} else {
packMap = new HashMap<>();
......@@ -2477,6 +2495,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
vo.setStoreName(store.getName());
vo.setAddress(store.getAddress());
}
ConsumerSecondaryCard consumerSecondaryCard = secondaryCardMap.get(vo.getSecondaryCardId());
if (consumerSecondaryCard != null) {
vo.setSecondaryCardName(consumerSecondaryCard.getConfName());
vo.setSecondaryCardAmount(consumerSecondaryCard.getConfAmount());
}
ConsumerMonthlyCard consumerMonthlyCard = monthlyCardMap.get(vo.getMonthlyCardId());
if (consumerMonthlyCard != null) {
vo.setMonthlyCardName(consumerMonthlyCard.getConfName());
vo.setMonthlyCardAmount(consumerMonthlyCard.getConfAmount());
}
SRoom room = roomMap.get(vo.getRoomId());
if (room != null) {
vo.setRoomName(room.getName());
......
......@@ -476,7 +476,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
}
@Override
public List<SRoom> storeNameByIds(List<Long> longs) {
public List<SRoom> roomNameByIds(List<Long> longs) {
LambdaQueryWrapper<SRoom> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SRoom::getId, SRoom::getName, SRoom::getImages, SRoom::getRoomType);
if (CollectionUtils.isNotEmpty(longs)) {
......
......@@ -165,6 +165,8 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde
ConsumerSecondaryCard consumerSecondaryCard = new ConsumerSecondaryCard();
SecondaryCardConf secondaryCardConf = secondaryCardConfService.getById(secondaryCardOrder.getSecondaryCardConfId());
consumerSecondaryCard.setSecondaryCardConfId(secondaryCardOrder.getSecondaryCardConfId());
consumerSecondaryCard.setConfName(secondaryCardConf.getName());
consumerSecondaryCard.setConfAmount(secondaryCardConf.getSecondaryCardAmount());
consumerSecondaryCard.setConsumerId(secondaryCardOrder.getConsumerId());
consumerSecondaryCard.setPhone(secondaryCardOrder.getPhone());
consumerSecondaryCard.setSingleAmount(secondaryCardConf.getSingleAmount());
......
......@@ -27,6 +27,8 @@
<sql id="selectConsumerMonthlyCardVo">
select id,
monthly_card_conf_id,
conf_name,
conf_amount,
consumer_id,
phone,
free_duration,
......@@ -45,8 +47,8 @@
resultMap="ConsumerMonthlyCardResult">
select c.id,
c.monthly_card_conf_id,
c1.name as 'conf_name',
c1.monthly_card_amount as 'conf_amount',
c.conf_name,
c.conf_amount,
c.consumer_id,
c2.nick_name,
c2.avatar,
......@@ -60,7 +62,7 @@
c.update_by,
c.update_time,
c.remark
from s_consumer_monthly_card c join s_monthly_card_conf c1 on c.monthly_card_conf_id = c1.id
from s_consumer_monthly_card c
join s_consumer c2 on c.consumer_id = c2.id
where c.is_delete = 0
<if test="monthlyCardConfId != null ">and c.monthly_card_conf_id = #{monthlyCardConfId}</if>
......@@ -78,7 +80,8 @@
<select id="selectByConsumerId" resultMap="ConsumerMonthlyCardResult">
select c.id,
c.monthly_card_conf_id,
c1.name as 'conf_name', c1.monthly_card_amount as 'conf_amount',
c.conf_name,
c.conf_amount,
c.consumer_id,
c2.nick_name,
c2.avatar,
......@@ -94,7 +97,6 @@
c.remark
from s_consumer_monthly_card c
join s_consumer c2 on c.consumer_id = c2.id
join s_monthly_card_conf c1 on c.monthly_card_conf_id = c1.id
where c.is_delete = 0
and c.consumer_id = #{consumerId}
</select>
......
......@@ -28,6 +28,8 @@
<sql id="selectConsumerSecondaryCardVo">
select id,
secondary_card_conf_id,
conf_name,
conf_amount,
consumer_id,
phone,
single_duration,
......@@ -51,8 +53,8 @@
c.phone,
m.nick_name,
m.avatar,
c2.name as 'conf_name',
c2.secondary_card_amount as 'conf_amount',
c.conf_name,
c.conf_amount,
c.single_duration,
c.single_amount,
c.expiration_date,
......@@ -64,7 +66,6 @@
c.update_time,
c. remark
from s_consumer_secondary_card c join s_consumer m on c.consumer_id = m.id
join s_secondary_card_conf c2 on c.secondary_card_conf_id = c2.id
where
c.is_delete = 0
<if test="secondaryCardConfId != null ">and c.secondary_card_conf_id = #{secondaryCardConfId}</if>
......@@ -87,7 +88,8 @@
c.phone,
m.nick_name,
m.avatar,
s.name as 'conf_name', s.secondary_card_amount as 'conf_amount',
c.conf_name,
c.conf_amount,
c.single_duration,
c.single_amount,
c.expiration_date,
......@@ -100,7 +102,6 @@
c.remark
from s_consumer_secondary_card c
join s_consumer m on c.consumer_id = m.id
join s_secondary_card_conf s on c.secondary_card_conf_id = s.id
where c.is_delete = 0
and c.number > 0
and c.consumer_id = #{consumerId}
......
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