Commit 87514e92 by 吕明尚

修改优惠券配置,优惠券领取记录表字段

parent 79d5b30d
......@@ -170,7 +170,7 @@ public class QPServiceImplAspect {
couponLog.setConsumerId(one.getConsumerId());
couponLog.setCouponId(one.getId());
couponLog.setCouponName(one.getName());
couponLog.setCouponValue(one.getSubPrice());
couponLog.setCouponValue(one.getOriginalPrice());
// 查询SStore
LambdaQueryWrapper<SStore> sStoreLambdaQueryWrapper = new LambdaQueryWrapper<>();
sStoreLambdaQueryWrapper.eq(SStore::getOpenShopUuid, jsonObject.getString("openShopUuid"));
......
......@@ -152,15 +152,15 @@ public class CouponRetryTask {
public void AutoUpdateCouponPromotionPrice() {
try {
LambdaQueryWrapper<SCoupon> sCouponLambdaQueryWrapper = Wrappers.lambdaQuery(SCoupon.class);
sCouponLambdaQueryWrapper.isNotNull(SCoupon::getPromotionPrice);
sCouponLambdaQueryWrapper.isNotNull(SCoupon::getSubPrice);
sCouponLambdaQueryWrapper.isNotNull(SCoupon::getSalePrice);
sCouponLambdaQueryWrapper.isNotNull(SCoupon::getOriginalPrice);
List<SCoupon> couponList = sCouponService.list(sCouponLambdaQueryWrapper);
LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = Wrappers.lambdaQuery(SConsumerCoupon.class);
consumerCouponWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
consumerCouponWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
consumerCouponWrapper.in(SConsumerCoupon::getCouponId, couponList.stream().map(SCoupon::getId).collect(Collectors.toList()));
consumerCouponWrapper.isNull(SConsumerCoupon::getPromotionPrice);
consumerCouponWrapper.isNull(SConsumerCoupon::getSalePrice);
List<SConsumerCoupon> sConsumerCouponList = sConsumerCouponService.list(consumerCouponWrapper);
if (CollectionUtils.isEmpty(sConsumerCouponList)) {
......@@ -193,9 +193,9 @@ public class CouponRetryTask {
}
couponToMatch.ifPresent(coupon -> {
consumerCoupon.setPromotionPrice(coupon.getPromotionPrice());
consumerCoupon.setSalePrice(coupon.getSalePrice());
if (PlatformTypeEnum.SELF.getCode().equals(consumerCoupon.getPlatformType())) {
consumerCoupon.setSubPrice(coupon.getSubPrice());
consumerCoupon.setOriginalPrice(coupon.getOriginalPrice());
}
});
});
......
......@@ -114,7 +114,7 @@ public class SConsumerCoupon extends BaseEntity
/** 减去金额(满减券单位:元,折扣为系数) */
@Excel(name = "优惠券原价")
private BigDecimal subPrice;
private BigDecimal originalPrice;
/**
* 优惠卷购买金额
......@@ -126,7 +126,7 @@ public class SConsumerCoupon extends BaseEntity
* 优惠券促销金额
*/
@Excel(name = "优惠券促销金额(单位:元)")
private BigDecimal promotionPrice;
private BigDecimal salePrice;
/** 优惠券来源(1:领取,2:赠送,3:验券) */
......
......@@ -79,7 +79,7 @@ public class SCoupon extends BaseEntity
/** 减去金额(满减券单位:元,折扣为系数) */
@Excel(name = "优惠券原价")
private BigDecimal subPrice;
private BigDecimal originalPrice;
/**
* 优惠卷购买金额
......@@ -91,7 +91,7 @@ public class SCoupon extends BaseEntity
* 优惠券促销金额
*/
@Excel(name = "优惠券促销金额(单位:元)")
private BigDecimal promotionPrice;
private BigDecimal salePrice;
/**
* 订单类型(0:订房订单,1:续房订单,2:充值订单)
......
......@@ -3,8 +3,11 @@ package share.system.domain.vo;
import lombok.Data;
import share.system.domain.RoomLabel;
import java.util.List;
@Data
public class RoomLabelDto extends RoomLabel {
//标签类型 0:预定,1:续费
private Long type;
private List<Long> roomIds;
}
......@@ -129,7 +129,7 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon.setUseStatus(UserStatusEnum.UNUSED.getCode());
sConsumerCoupon.setCreateBy(String.valueOf(user.getId()));
sConsumerCoupon.setCreateTime(new Date());
sConsumerCoupon.setSubPrice(BigDecimal.valueOf(prepare.getDeal_marketprice()));
sConsumerCoupon.setOriginalPrice(BigDecimal.valueOf(prepare.getDeal_marketprice()));
sConsumerCoupon.setCouponPayPrice(BigDecimal.valueOf(prepare.getDeal_price()));
//查询美团团购信息
List<TuangouDealQueryShopDealResponseEntity> groupActivities = queryshopdeal(sStore.getOpenShopUuid());
......@@ -173,7 +173,7 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon.setMinPrice(DEFAULT_MIN_PRICE);
sConsumerCoupon.setCouponTimeStart(DEFAULT_START_TIME);
sConsumerCoupon.setCouponTimeEnd(DEFAULT_END_TIME);
sConsumerCoupon.setPromotionPrice(sConsumerCoupon.getCouponPayPrice());
sConsumerCoupon.setSalePrice(sConsumerCoupon.getCouponPayPrice());
} else {
sConsumerCoupon.setCouponId(sCoupon.getId());
sConsumerCoupon.setCouponType(sCoupon.getCouponType());
......@@ -191,7 +191,7 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon.setPackIds(sCoupon.getPackIds());
sConsumerCoupon.setWeeks(sCoupon.getWeeks());
sConsumerCoupon.setRemark(sCoupon.getRemark());
sConsumerCoupon.setPromotionPrice(sCoupon.getPromotionPrice());
sConsumerCoupon.setSalePrice(sCoupon.getSalePrice());
}
isConsumerCouponService.insertSConsumerCoupon(sConsumerCoupon);
//核销美团券
......
......@@ -159,7 +159,6 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel
public TableDataInfo pageList(RoomLabelDto roomLabel) {
List<RoomLabel> roomLabels = roomLabelMapper.pageList(roomLabel);
List<RoomLabelVo> voList = doListToVoList(roomLabels);
//正序labelDuration,倒序labelType
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
......
package share.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.util.CollectionUtils;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import share.common.utils.DateUtils;
import share.system.domain.SRoom;
import share.system.mapper.RoomPackMapper;
import share.system.domain.SRoomPack;
import share.system.mapper.RoomPackMapper;
import share.system.mapper.SRoomMapper;
import share.system.service.IRoomPackService;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* 包房套餐关系Service业务层处理
*
......
......@@ -203,7 +203,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
queryWrapper.orderByDesc(SConsumerCoupon::getOrderType);
}
queryWrapper.orderByAsc(SConsumerCoupon::getEndDate, SConsumerCoupon::getCouponType);
queryWrapper.orderByDesc(SConsumerCoupon::getSubPrice);
queryWrapper.orderByDesc(SConsumerCoupon::getOriginalPrice);
//查询用户未使用的优惠券
List<SConsumerCoupon> sConsumerCoupons = baseMapper.selectList(queryWrapper);
//计算时长
......@@ -439,9 +439,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
newSConsumerCoupon.setMinPrice(new BigDecimal(0.00));
newSConsumerCoupon.setWeeks(sCoupon.getWeeks());
newSConsumerCoupon.setStoreIds(sCoupon.getStoreIds());
newSConsumerCoupon.setSubPrice(sCoupon.getSubPrice());
newSConsumerCoupon.setOriginalPrice(sCoupon.getOriginalPrice());
newSConsumerCoupon.setCouponPayPrice(sCoupon.getCouponPayPrice());
newSConsumerCoupon.setPromotionPrice(sCoupon.getPromotionPrice());
newSConsumerCoupon.setSalePrice(sCoupon.getSalePrice());
newSConsumerCoupon.setMinDuration(sCoupon.getMinDuration());
newSConsumerCoupon.setMaxDuration(sCoupon.getMaxDuration());
newSConsumerCoupon.setDuration(sCoupon.getDuration());
......
......@@ -201,40 +201,40 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
if (!CollectionUtils.isEmpty(queryshopdeal)) {
queryshopdeal.stream().forEach(item -> {
// if (TWO.equals(item.getSale_status())) {
SCoupon sCoupon1 = sCouponList.get(item.getDealgroup_id());
if (ObjectUtils.isEmpty(sCoupon1)) {
SCoupon sCoupon = new SCoupon();
//添加团购id
sCoupon.setDealgroupId(item.getDealgroup_id());
//套餐名称
sCoupon.setName(item.getTitle());
//套餐原价
sCoupon.setSubPrice(BigDecimal.valueOf(item.getMarketprice()));
sCoupon.setCouponPayPrice(BigDecimal.valueOf(item.getPrice()));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date receiptEndDate = sdf.parse(item.getReceipt_end_date());
Date receiptBeginDate = sdf.parse(item.getReceipt_begin_date());
sCoupon.setStartDate(receiptBeginDate);
sCoupon.setEndDate(receiptEndDate);
} catch (ParseException e) {
throw new RuntimeException(e);
}
sCoupon.setPlatformType(PlatformTypeEnum.MEITUAN.getCode());
sCoupon.setRoomType(RoomType.getCodeList());
sCoupon.setStoreType(StoreType.getCodeList());
sCoupon.setValidStartTime(DEFAULT_START_TIME);
sCoupon.setValidEndTime(DEFAULT_END_TIME);
sCoupon.setMinDuration(DEFAULT_DURATION);
sCoupon.setMaxDuration(DEFAULT_MAX_DURATION);
sCoupon.setMinPrice(new BigDecimal("0.00"));
sCoupon.setCouponType(CouponTypeEnum.CASH.getCode());
sCouponList.put(item.getDealgroup_id(), sCoupon);
//从门店列表中获取门店id
sCoupon.setStoreIds(String.valueOf(sStores.stream().filter(store -> store.getOpenShopUuid().equals(openShopUuid)).findFirst().get().getId()));
} else {
sCoupon1.setStoreIds(sCoupon1.getStoreIds() + "," + sStores.stream().filter(store -> store.getOpenShopUuid().equals(openShopUuid)).findFirst().get().getId());
SCoupon sCoupon1 = sCouponList.get(item.getDealgroup_id());
if (ObjectUtils.isEmpty(sCoupon1)) {
SCoupon sCoupon = new SCoupon();
//添加团购id
sCoupon.setDealgroupId(item.getDealgroup_id());
//套餐名称
sCoupon.setName(item.getTitle());
//套餐原价
sCoupon.setOriginalPrice(BigDecimal.valueOf(item.getMarketprice()));
sCoupon.setCouponPayPrice(BigDecimal.valueOf(item.getPrice()));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date receiptEndDate = sdf.parse(item.getReceipt_end_date());
Date receiptBeginDate = sdf.parse(item.getReceipt_begin_date());
sCoupon.setStartDate(receiptBeginDate);
sCoupon.setEndDate(receiptEndDate);
} catch (ParseException e) {
throw new RuntimeException(e);
}
sCoupon.setPlatformType(PlatformTypeEnum.MEITUAN.getCode());
sCoupon.setRoomType(RoomType.getCodeList());
sCoupon.setStoreType(StoreType.getCodeList());
sCoupon.setValidStartTime(DEFAULT_START_TIME);
sCoupon.setValidEndTime(DEFAULT_END_TIME);
sCoupon.setMinDuration(DEFAULT_DURATION);
sCoupon.setMaxDuration(DEFAULT_MAX_DURATION);
sCoupon.setMinPrice(new BigDecimal("0.00"));
sCoupon.setCouponType(CouponTypeEnum.CASH.getCode());
sCouponList.put(item.getDealgroup_id(), sCoupon);
//从门店列表中获取门店id
sCoupon.setStoreIds(String.valueOf(sStores.stream().filter(store -> store.getOpenShopUuid().equals(openShopUuid)).findFirst().get().getId()));
} else {
sCoupon1.setStoreIds(sCoupon1.getStoreIds() + "," + sStores.stream().filter(store -> store.getOpenShopUuid().equals(openShopUuid)).findFirst().get().getId());
}
// }
});
}
......@@ -312,26 +312,26 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
JSONObject sku = jsonObject.getJSONObject("sku");
JSONObject product = jsonObject.getJSONObject("product");
JSONArray pois = product.getJSONArray("pois");
SCoupon sCoupon = new SCoupon();
SCoupon sCoupon = new SCoupon();
sCoupon.setTiktokSkuId(sku.getStr("sku_id"));
sCoupon.setName(sku.getStr("sku_name"));
sCoupon.setStartDate(new Date(product.getInt("sold_start_time") * 1000L));
sCoupon.setEndDate(new Date(product.getInt("sold_end_time") * 1000L));
sCoupon.setSubPrice(sku.getBigDecimal("origin_amount").divide(new BigDecimal("100")));
sCoupon.setRoomType(RoomType.getCodeList());
sCoupon.setName(sku.getStr("sku_name"));
sCoupon.setStartDate(new Date(product.getInt("sold_start_time") * 1000L));
sCoupon.setEndDate(new Date(product.getInt("sold_end_time") * 1000L));
sCoupon.setOriginalPrice(sku.getBigDecimal("origin_amount").divide(new BigDecimal("100")));
sCoupon.setRoomType(RoomType.getCodeList());
sCoupon.setPlatformType(PlatformTypeEnum.TIKTOK.getCode());
sCoupon.setStoreType(StoreType.getCodeList());
sCoupon.setValidStartTime(DEFAULT_START_TIME);
sCoupon.setValidEndTime(DEFAULT_END_TIME);
sCoupon.setMinDuration(DEFAULT_DURATION);
sCoupon.setMaxDuration(DEFAULT_MAX_DURATION);
sCoupon.setMinPrice(new BigDecimal("0.00"));
sCoupon.setStoreType(StoreType.getCodeList());
sCoupon.setValidStartTime(DEFAULT_START_TIME);
sCoupon.setValidEndTime(DEFAULT_END_TIME);
sCoupon.setMinDuration(DEFAULT_DURATION);
sCoupon.setMaxDuration(DEFAULT_MAX_DURATION);
sCoupon.setMinPrice(new BigDecimal("0.00"));
sCoupon.setCouponPayPrice(sku.getBigDecimal("actual_amount").divide(new BigDecimal("100")));
sCoupon.setCouponType(CouponTypeEnum.CASH.getCode());
if (finalSStores.size() == 0) {
sCouponList.add(sCoupon);
return;
}
sCoupon.setCouponType(CouponTypeEnum.CASH.getCode());
if (finalSStores.size() == 0) {
sCouponList.add(sCoupon);
return;
}
Set<String> poiIds = pois.stream().map(poi -> ((JSONObject) poi).getStr("poi_id")).collect(Collectors.toSet());
sCoupon.setStoreIds(String.valueOf(finalSStores.stream().filter(store -> poiIds.contains(store.getTiktokPoiId())).map(SStore::getId).collect(Collectors.toList())).replace("[", "").replace("]", "").replace(" ", "").trim());
sCouponList.add(sCoupon);
......
......@@ -1118,7 +1118,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (ObjectUtils.isEmpty(coupon)) {
throw new BaseException("优惠券异常,联系客服!");
}
sOrder.setCouponPrice(coupon.getSubPrice());
sOrder.setCouponPrice(coupon.getOriginalPrice());
}
sOrder.setPayPrice(request.getPayFee());
sOrder.setBuyType(request.getBuyType());
......@@ -1557,59 +1557,55 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private List<SOrderVo> convertDosToVos(List<SOrder> orderList) {
List<SOrderVo> voList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(orderList)) {
List<Long> storeIds = orderList.stream().map(SOrder::getStoreId).collect(Collectors.toList());
List<Long> roomIds = orderList.stream().map(SOrder::getRoomId).collect(Collectors.toList());
List<Long> couponIds = orderList.stream().map(SOrder::getCouponId).collect(Collectors.toList());
List<Long> packIds = orderList.stream().map(SOrder::getPackId).collect(Collectors.toList());
List<SStore> storeList = storeService.listByIds(storeIds);
List<SRoom> roomList = roomService.listByIds(roomIds);
List<SConsumerCoupon> userCouponList = consumerCouponService.queryByIds(couponIds);
List<SPack> packList = packService.listByIds(packIds);
orderList.stream().forEach(o -> {
// 使用Map缓存查询结果,减少重复查询
Map<Long, SStore> storeMap = storeService.listByIds(orderList.stream().map(SOrder::getStoreId).collect(Collectors.toSet()))
.stream().collect(Collectors.toMap(SStore::getId, s -> s));
Map<Long, SRoom> roomMap = roomService.listByIds(orderList.stream().map(SOrder::getRoomId).collect(Collectors.toSet()))
.stream().collect(Collectors.toMap(SRoom::getId, s -> s));
Map<Long, SConsumerCoupon> couponMap = consumerCouponService.queryByIds(orderList.stream().map(SOrder::getCouponId).distinct().collect(Collectors.toList()))
.stream().collect(Collectors.toMap(SConsumerCoupon::getId, s -> s));
Map<Long, SPack> packMap = packService.listByIds(orderList.stream().map(SOrder::getPackId).distinct().collect(Collectors.toList()))
.stream().collect(Collectors.toMap(SPack::getId, s -> s));
orderList.forEach(o -> {
SOrderVo vo = new SOrderVo();
BeanUtils.copyProperties(o, vo);
storeList.stream().forEach(store -> {
if (store.getId().equals(vo.getStoreId())) {
vo.setStoreName(store.getName());
vo.setAddress(store.getAddress());
}
});
roomList.stream().forEach(room -> {
if (room.getId().equals(vo.getRoomId())) {
vo.setRoomName(room.getName());
vo.setRoomImages(room.getImages());
vo.setRoomType(room.getRoomType());
vo.setRoomTypeName(RoomType.getNameByCode(room.getRoomType()));
}
});
SStore store = storeMap.get(vo.getStoreId());
if (store != null) {
vo.setStoreName(store.getName());
vo.setAddress(store.getAddress());
}
SRoom room = roomMap.get(vo.getRoomId());
if (room != null) {
vo.setRoomName(room.getName());
vo.setRoomImages(room.getImages());
vo.setRoomType(room.getRoomType());
vo.setRoomTypeName(RoomType.getNameByCode(room.getRoomType()));
}
if (Objects.nonNull(vo.getCouponId())) {
userCouponList.stream().forEach(userCoupon -> {
if (userCoupon.getId().equals(vo.getCouponId())) {
// 判断是否可以退款
vo.setIsRefund(isRefund(vo, userCoupon));
vo.setCouponName(userCoupon.getName());
}
});
SConsumerCoupon userCoupon = couponMap.get(vo.getCouponId());
if (userCoupon != null) {
// 判断是否可以退款
vo.setIsRefund(isRefund(vo, userCoupon));
vo.setCouponName(userCoupon.getName());
} else {
// 如果优惠券为空,则调用isRefund方法时需要传入null
vo.setIsRefund(isRefund(vo, null));
}
} else {
// 判断是否可以退款
vo.setIsRefund(isRefund(o, null));
vo.setIsRefund(isRefund(vo, null));
}
if (Objects.nonNull(vo.getPackId())) {
packList.stream().forEach(pack -> {
if (pack.getId().equals(vo.getPackId())) {
vo.setPackName(pack.getName());
}
});
SPack pack = packMap.get(vo.getPackId());
if (pack != null) {
vo.setPackName(pack.getName());
}
voList.add(vo);
});
}
return voList;
}
@Override
public String openDoor(String orderNo) {
LambdaQueryWrapper<SOrder> orderLambdaQueryWrapper = new LambdaQueryWrapper<>();
......@@ -1752,17 +1748,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SRoom room = roomService.getById(request.getRoomId());
BigDecimal totalPrice = computeTotalPrice(room.getPrice(), request.getPreStartDate(), request.getPreEndDate());
BigDecimal payPrice;
BuyTypeEnum buyTypeEnum = BuyTypeEnum.getEnumByCode(request.getBuyType());
switch (buyTypeEnum) {
case TIME://小时模式
payPrice = totalPrice;
break;
case PACK://套餐模式
payPrice = computeTotalPrice(request.getPackId(), totalPrice);
break;
default:
throw new BaseException("购买方式类型异常!");
}
RoomLabel roomLabel = roomLabelService.selectRoomLabelById(request.getRoomLabelId());
if (ObjectUtils.isEmpty(roomLabel.getPackId())) {
payPrice = totalPrice;
} else {
payPrice = computeTotalPrice(roomLabel.getPackId(), totalPrice);
}
priceResponse.setTotalFee(payPrice);
// 计算优惠券金额
if (ObjectUtil.isNull(request.getCouponId()) || request.getCouponId() <= 0) {
......@@ -1823,7 +1814,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
RoomLabel roomLabel = roomLabelService.selectRoomLabelById(request.getRoomLabelId());
//(促销价-优惠券促销价)+((时长-促销时长)*单价)
SRoom room = roomService.getById(request.getRoomId());
BigDecimal subtract = (roomLabel.getPromotionAmount().subtract(consumerCoupon.getPromotionPrice())).
BigDecimal subtract = (roomLabel.getPromotionAmount().subtract(consumerCoupon.getSalePrice())).
add(((DateUtils.differentHour(request.getPreStartDate(), request.getPreEndDate()).subtract(new BigDecimal(roomLabel.getPromotionDuration()))).multiply(room.getPrice())));
//判断是否为负数
if (subtract.compareTo(BigDecimal.ZERO) < 0) {
......
......@@ -114,6 +114,19 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
* @param roomList
* @return
*/
/**
* 查询房间列表
*
* @param sRoom 房间
* @return 房间
*/
@Override
public List<SRoomVo> selectSRoomVoList(SRoom sRoom) {
List<SRoom> roomList = baseMapper.selectSRoomList(sRoom);
return convertVoList(roomList);
}
private List<SRoomVo> convertVoList(List<SRoom> roomList) {
List<SRoomVo> voList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(roomList)) {
......@@ -134,6 +147,14 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
wrapper.eq(SOrder::getStatus, OrderStatusEnum.INUSE.getCode());
wrapper.orderByAsc(SOrder::getEndDate);
List<SOrder> list = orderService.list(wrapper);
RoomLabelDto roomLabel = new RoomLabelDto();
roomLabel.setStoreId(roomList.get(0).getStoreId());
roomLabel.setType(Long.valueOf(YesNoEnum.no.getIndex()));
roomLabel.setRoomIds(roomIds);
List<RoomLabel> roomLabels = roomLabelService.selectRoomLabelList(roomLabel);
//转Map
Map<Long, List<RoomLabelVo>> roomLabelMap = Optional.ofNullable(roomLabelService.doListToVoList(roomLabels))
.orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(RoomLabelVo::getRoomId));
// 查询每一个房间最后一条预定订单下单时间
// Date now = DateUtil.date();
// SOrder orderQuery = new SOrder();
......@@ -146,6 +167,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
SRoomVo vo = new SRoomVo();
BeanUtils.copyProperties(sRoom, vo);
vo.setStoreName(store.getName());
vo.setRoomLabelList(roomLabelMap.get(sRoom.getId()));
vo.setRoomStatusList(roomStatusMap.get(sRoom.getId()));
if (CollectionUtils.isNotEmpty(sCleanRecordsList)) {
if (CollectionUtils.isNotEmpty(recordsMap.get(vo.getId()))) {
......@@ -194,19 +216,6 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
return voList;
}
/**
* 查询房间列表
*
* @param sRoom 房间
* @return 房间
*/
@Override
public List<SRoomVo> selectSRoomVoList(SRoom sRoom) {
List<SRoom> roomList = baseMapper.selectSRoomList(sRoom);
return convertVoList(roomList);
}
/**
* 新增房间
*
......
......@@ -395,7 +395,7 @@ public class TiktokServiceImpl implements TiktokService {
sConsumerCoupon.setCreateBy(String.valueOf(user.getId()));
sConsumerCoupon.setCreateTime(new Date());
Integer originalAmount = amount.getInt("list_market_amount");
sConsumerCoupon.setSubPrice(BigDecimal.valueOf(originalAmount / 100));
sConsumerCoupon.setOriginalPrice(BigDecimal.valueOf(originalAmount / 100));
sConsumerCoupon.setCouponPayPrice(BigDecimal.valueOf(amount.getInt("coupon_pay_amount") / 100));
//时间戳转年月日时分秒
sConsumerCoupon.setEndDate(new Date(entries.getInt("expire_time") * 1000L));
......@@ -426,7 +426,7 @@ public class TiktokServiceImpl implements TiktokService {
sConsumerCoupon.setMinPrice(DEFAULT_MIN_PRICE);
sConsumerCoupon.setCouponTimeStart(DEFAULT_START_TIME);
sConsumerCoupon.setCouponTimeEnd(DEFAULT_END_TIME);
sConsumerCoupon.setPromotionPrice(sConsumerCoupon.getCouponPayPrice());
sConsumerCoupon.setSalePrice(sConsumerCoupon.getCouponPayPrice());
} else {
sConsumerCoupon.setCouponId(sCoupon.getId());
sConsumerCoupon.setCouponType(sCoupon.getCouponType());
......@@ -444,7 +444,7 @@ public class TiktokServiceImpl implements TiktokService {
sConsumerCoupon.setPackIds(sCoupon.getPackIds());
sConsumerCoupon.setWeeks(sCoupon.getWeeks());
sConsumerCoupon.setRemark(sCoupon.getRemark());
sConsumerCoupon.setPromotionPrice(sCoupon.getPromotionPrice());
sConsumerCoupon.setSalePrice(sCoupon.getSalePrice());
}
isConsumerCouponService.insertSConsumerCoupon(sConsumerCoupon);
} catch (RuntimeException e) {
......
......@@ -79,6 +79,12 @@
</if>
<if test="promotionAmount != null ">and r.promotion_amount = #{promotionAmount}</if>
<if test="type != null ">and l.type = #{type}</if>
<if test="roomIds != null ">
and r.room_id in
<foreach item="roomIds" collection="roomIds" open="(" separator="," close=")">
#{roomIds}
</foreach>
</if>
order by l.duration,l.type desc
</select>
......
......@@ -23,9 +23,9 @@
<result property="maxDuration" column="max_duration" />
<result property="duration" column="duration" />
<result property="minPrice" column="min_price" />
<result property="subPrice" column="sub_price" />
<result property="originalPrice" column="original_price"/>
<result property="couponPayPrice" column="coupon_pay_price"/>
<result property="promotionPrice" column="promotion_price"/>
<result property="salePrice" column="sale_price"/>
<result property="sourceType" column="source_type" />
<result property="roomType" column="room_type" />
<result property="storeType" column="store_type" />
......@@ -66,9 +66,9 @@
min_duration,
duration,
min_price,
sub_price,
original_price,
coupon_pay_price,
promotion_price,
sale_price,
source_type,
platform_type,
start_date,
......@@ -110,7 +110,7 @@
<if test="minDuration != null and minDuration != ''"> and min_duration = #{minDuration}</if>
<if test="duration != null and duration != ''"> and duration = #{duration}</if>
<if test="minPrice != null "> and min_price = #{minPrice}</if>
<if test="subPrice != null "> and sub_price = #{subPrice}</if>
<if test="originalPrice != null ">and original_price = #{originalPrice}</if>
<if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType}</if>
<if test="platformType != null and platformType != ''"> and platform_type = #{platformType}</if>
<if test="orderType != null and orderType != ''">and order_type = #{orderType}</if>
......@@ -124,7 +124,7 @@
<if test="deleteTime != null "> and delete_time = #{deleteTime}</if>
<if test="tiktokSkuId != null ">and tiktok_sku_id = #{tiktokSkuId}</if>
<if test="couponPayPrice != null ">and coupon_pay_price = #{couponPayPrice}</if>
<if test="promotionPrice != null ">and promotion_price = #{promotionPrice}</if>
<if test="salePrice != null ">and sale_price = #{salePrice}</if>
ORDER BY create_time DESC
</select>
......@@ -147,7 +147,7 @@
and end_date >= NOW()
and use_status = '0'
<if test="consumerId != null ">and consumer_id = #{consumerId}</if>
order by coupon_type,end_date,sub_price desc
order by coupon_type,end_date,original_price desc
</where>
</select>
<select id="queryById" resultType="share.system.domain.SConsumerCoupon">
......@@ -182,7 +182,7 @@
<if test="minDuration != null">min_duration,</if>
<if test="duration != null and duration != ''">duration,</if>
<if test="minPrice != null">min_price,</if>
<if test="subPrice != null">sub_price,</if>
<if test="originalPrice != null">original_price,</if>
<if test="sourceType != null">source_type,</if>
<if test="platformType != null">platform_type,</if>
<if test="startDate != null">start_date,</if>
......@@ -206,7 +206,7 @@
<if test="tiktokSkuId != null">tiktok_sku_id,</if>
<if test="storeIds != null">store_ids,</if>
<if test="couponPayPrice != null">coupon_pay_price,</if>
<if test="promotionPrice != null">promotion_price,</if>
<if test="salePrice != null">sale_price,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerId != null">#{consumerId},</if>
......@@ -223,7 +223,7 @@
<if test="minDuration != null">#{minDuration},</if>
<if test="duration != null and duration != ''">#{duration},</if>
<if test="minPrice != null">#{minPrice},</if>
<if test="subPrice != null">#{subPrice},</if>
<if test="originalPrice != null">#{originalPrice},</if>
<if test="sourceType != null">#{sourceType},</if>
<if test="platformType != null">#{platformType},</if>
<if test="startDate != null">#{startDate},</if>
......@@ -247,7 +247,7 @@
<if test="tiktokSkuId != null">#{tiktokSkuId},</if>
<if test="storeIds != null">#{storeIds},</if>
<if test="couponPayPrice != null">#{couponPayPrice},</if>
<if test="promotionPrice != null">#{promotionPrice},</if>
<if test="salePrice != null">#{salePrice},</if>
</trim>
</insert>
......@@ -268,7 +268,7 @@
<if test="minDuration != null">min_duration = #{minDuration},</if>
<if test="duration != null and duration != ''">duration = #{duration},</if>
<if test="minPrice != null">min_price = #{minPrice},</if>
<if test="subPrice != null">sub_price = #{subPrice},</if>
<if test="originalPrice != null">original_price = #{originalPrice},</if>
<if test="sourceType != null">source_type = #{sourceType},</if>
<if test="platformType != null">platform_type = #{platformType},</if>
<if test="startDate != null">start_date = #{startDate},</if>
......@@ -292,7 +292,7 @@
<if test="tiktokSkuId != null">tiktok_sku_id = #{tiktokSkuId},</if>
<if test="storeIds != null">store_ids = #{storeIds},</if>
<if test="couponPayPrice != null">coupon_pay_price = #{couponPayPrice},</if>
<if test="promotionPrice != null">promotion_price = #{promotionPrice},</if>
<if test="salePrice != null">sale_price = #{salePrice},</if>
</trim>
where id = #{id}
</update>
......
......@@ -23,9 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="minDuration" column="min_duration" />
<result property="maxDuration" column="max_duration" />
<result property="minPrice" column="min_price" />
<result property="subPrice" column="sub_price" />
<result property="originalPrice" column="original_price"/>
<result property="couponPayPrice" column="coupon_pay_price"/>
<result property="promotionPrice" column="promotion_price"/>
<result property="salePrice" column="sale_price"/>
<result property="isOverlay" column="is_overlay" />
<result property="weeks" column="weeks"/>
<result property="platformType" column="platform_type" />
......@@ -50,9 +50,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
weeks,
store_ids,
coupon_pay_price,
promotion_price,
sale_price,
duration,min_duration,max_duration,
min_price,sub_price,is_overlay,
min_price,
original_price,
is_overlay,
platform_type,number,create_by,
create_time,update_by,update_time,
remark from s_coupon
......@@ -78,9 +80,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="minDuration != null and minDuration != ''"> and min_duration = #{minDuration}</if>
<if test="maxDuration != null and maxDuration != ''"> and max_duration = #{maxDuration}</if>
<if test="minPrice != null and minPrice != ''"> and min_price = #{minPrice}</if>
<if test="subPrice != null and subPrice != ''"> and sub_price = #{subPrice}</if>
<if test="originalPrice != null and originalPrice != ''">and original_price = #{originalPrice}</if>
<if test="couponPayPrice != null and couponPayPrice != ''">and coupon_pay_price = #{couponPayPrice}</if>
<if test="promotionPrice != null and promotionPrice != ''">and promotion_price = #{promotionPrice}</if>
<if test="salePrice != null and salePrice != ''">and sale_price = #{salePrice}</if>
<if test="isOverlay != null"> and is_overlay = #{isOverlay}</if>
<if test="platformType != null"> and platform_type = #{platformType}</if>
<if test="weeks != null">and weeks = #{weeks}</if>
......@@ -141,7 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="minDuration != null and minDuration != ''">min_duration,</if>
<if test="maxDuration != null and maxDuration != ''">max_duration,</if>
<if test="minPrice != null">min_price,</if>
<if test="subPrice != null">sub_price,</if>
<if test="originalPrice != null">original_price,</if>
<if test="isOverlay != null">is_overlay,</if>
<if test="weeks != null">weeks,</if>
<if test="platformType != null">platform_type,</if>
......@@ -155,7 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tiktokSkuId != null">tiktok_sku_id,</if>
<if test="storeIds != null">store_ids,</if>
<if test="couponPayPrice != null">coupon_pay_price,</if>
<if test="promotionPrice != null">promotion_price,</if>
<if test="salePrice != null">sale_price,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
......@@ -170,7 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="minDuration != null and minDuration != ''">#{minDuration},</if>
<if test="maxDuration != null and maxDuration != ''">#{maxDuration},</if>
<if test="minPrice != null">#{minPrice},</if>
<if test="subPrice != null">#{subPrice},</if>
<if test="originalPrice != null">#{originalPrice},</if>
<if test="isOverlay != null">#{isOverlay},</if>
<if test="weeks != null">#{weeks},</if>
<if test="platformType != null">#{platformType},</if>
......@@ -184,7 +186,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tiktokSkuId != null">#{tiktokSkuId},</if>
<if test="storeIds != null">#{storeIds},</if>
<if test="couponPayPrice != null">#{couponPayPrice},</if>
<if test="promotionPrice != null">#{promotionPrice},</if>
<if test="salePrice != null">#{salePrice},</if>
</trim>
</insert>
......@@ -209,7 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maxDuration != null and maxDuration != ''">max_duration = #{maxDuration},</if>
<if test="weeks != null">weeks = #{weeks},</if>
<if test="minPrice != null and minPrice != ''">min_price = #{minPrice},</if>
<if test="subPrice != null and subPrice != ''">sub_price = #{subPrice},</if>
<if test="originalPrice != null and originalPrice != ''">original_price = #{originalPrice},</if>
<if test="isOverlay != null">is_overlay = #{isOverlay},</if>
<if test="platformType != null">platform_type = #{platformType},</if>
<if test="number != null">number = #{number},</if>
......@@ -219,7 +221,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="couponPayPrice != null">coupon_pay_price = #{couponPayPrice},</if>
<if test="promotionPrice != null">promotion_price = #{promotionPrice},</if>
<if test="salePrice != null">sale_price = #{salePrice},</if>
</trim>
where id = #{id}
</update>
......
......@@ -26,7 +26,7 @@
</if>
</select>
<select id="queryByConsumerId" resultMap="SStoreConsumerResult">
select store_id, store_id, position
select store_id, consumer_id, position
from s_store_consumer
where consumer_id = #{consumerId}
</select>
......
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