Commit 49480d70 by 吕明尚

房间详情增加标签

parent c25eced4
...@@ -10,7 +10,6 @@ import share.common.core.page.TableDataInfo; ...@@ -10,7 +10,6 @@ import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil; import share.common.utils.poi.ExcelUtil;
import share.system.domain.RoomLabel; import share.system.domain.RoomLabel;
import share.system.domain.vo.RoomLabelVo;
import share.system.service.RoomLabelService; import share.system.service.RoomLabelService;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -34,9 +33,7 @@ public class RoomLabelController extends BaseController { ...@@ -34,9 +33,7 @@ public class RoomLabelController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:roomLabel:list')") @PreAuthorize("@ss.hasPermi('system:roomLabel:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(RoomLabel roomLabel) { public TableDataInfo list(RoomLabel roomLabel) {
startPage(); return roomLabelService.pageList(roomLabel);
List<RoomLabelVo> list = roomLabelService.selectRoomLabelList(roomLabel);
return getDataTable(list);
} }
/** /**
...@@ -46,8 +43,8 @@ public class RoomLabelController extends BaseController { ...@@ -46,8 +43,8 @@ public class RoomLabelController extends BaseController {
@Log(title = "房间标签", businessType = BusinessType.EXPORT) @Log(title = "房间标签", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, RoomLabel roomLabel) { public void export(HttpServletResponse response, RoomLabel roomLabel) {
List<RoomLabelVo> list = roomLabelService.selectRoomLabelList(roomLabel); List<RoomLabel> list = roomLabelService.selectRoomLabelList(roomLabel);
ExcelUtil<RoomLabelVo> util = new ExcelUtil<RoomLabelVo>(RoomLabelVo.class); ExcelUtil<RoomLabel> util = new ExcelUtil<RoomLabel>(RoomLabel.class);
util.exportExcel(response, list, "房间标签数据"); util.exportExcel(response, list, "房间标签数据");
} }
......
package share.web.controller.system; package share.web.controller.system;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.annotation.Log; import share.common.annotation.Log;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.common.enums.CouponTypeEnum; import share.common.enums.CouponTypeEnum;
import share.common.enums.RoomType; import share.common.utils.poi.ExcelUtil;
import share.common.enums.StoreType;
import share.system.domain.SCoupon; import share.system.domain.SCoupon;
import share.system.domain.vo.SCouponVo;
import share.system.service.ISCouponService; import share.system.service.ISCouponService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo; import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* 优惠券Controller * 优惠券Controller
......
...@@ -12,5 +12,6 @@ public class RoomLabelVo extends RoomLabel { ...@@ -12,5 +12,6 @@ public class RoomLabelVo extends RoomLabel {
private String labelName; private String labelName;
private String packName; private String packName;
private Long labelType; private Long labelType;
private String labelDuration;
private BigDecimal packPrice; private BigDecimal packPrice;
} }
...@@ -111,6 +111,8 @@ public class SRoomVo extends BaseEntity ...@@ -111,6 +111,8 @@ public class SRoomVo extends BaseEntity
private List<SOrder> orderList; private List<SOrder> orderList;
private List<RoomLabelVo> roomLabelList;
/** /**
* 美团点评店铺id * 美团点评店铺id
*/ */
......
...@@ -59,4 +59,6 @@ public interface RoomLabelMapper extends BaseMapper<RoomLabel> { ...@@ -59,4 +59,6 @@ public interface RoomLabelMapper extends BaseMapper<RoomLabel> {
* @return 结果 * @return 结果
*/ */
public int deleteRoomLabelByIds(Long[] ids); public int deleteRoomLabelByIds(Long[] ids);
List<RoomLabel> pageList(RoomLabel roomLabel);
} }
package share.system.service; package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import share.system.domain.DeviceLog;
import share.system.domain.SCoupon; import share.system.domain.SCoupon;
import share.system.domain.vo.SCouponVo;
import java.util.List;
/** /**
* 优惠券Service接口 * 优惠券Service接口
......
package share.system.service; package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.page.TableDataInfo;
import share.system.domain.RoomLabel; import share.system.domain.RoomLabel;
import share.system.domain.vo.RoomLabelVo; import share.system.domain.vo.RoomLabelVo;
...@@ -27,7 +28,7 @@ public interface RoomLabelService extends IService<RoomLabel> { ...@@ -27,7 +28,7 @@ public interface RoomLabelService extends IService<RoomLabel> {
* @param roomLabel 房间标签 * @param roomLabel 房间标签
* @return 房间标签集合 * @return 房间标签集合
*/ */
public List<RoomLabelVo> selectRoomLabelList(RoomLabel roomLabel); public List<RoomLabel> selectRoomLabelList(RoomLabel roomLabel);
/** /**
* 新增房间标签 * 新增房间标签
...@@ -60,4 +61,8 @@ public interface RoomLabelService extends IService<RoomLabel> { ...@@ -60,4 +61,8 @@ public interface RoomLabelService extends IService<RoomLabel> {
* @return 结果 * @return 结果
*/ */
public int deleteRoomLabelById(Long id); public int deleteRoomLabelById(Long id);
public List<RoomLabelVo> doListToVoList(List<RoomLabel> list);
TableDataInfo pageList(RoomLabel roomLabel);
} }
...@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import share.common.core.page.PageDomain;
import share.common.core.page.TableDataInfo;
import share.common.core.page.TableSupport;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import share.common.utils.bean.BeanUtils; import share.common.utils.bean.BeanUtils;
import share.system.domain.*; import share.system.domain.*;
...@@ -60,12 +62,8 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel ...@@ -60,12 +62,8 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel
* @return 房间标签 * @return 房间标签
*/ */
@Override @Override
public List<RoomLabelVo> selectRoomLabelList(RoomLabel roomLabel) { public List<RoomLabel> selectRoomLabelList(RoomLabel roomLabel) {
List<RoomLabel> roomLabels = roomLabelMapper.selectRoomLabelList(roomLabel); return roomLabelMapper.pageList(roomLabel);
if (CollectionUtils.isEmpty(roomLabels)) {
return new ArrayList<>();
}
return doListToVoList(roomLabels);
} }
/** /**
...@@ -148,8 +146,30 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel ...@@ -148,8 +146,30 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel
vo.setPackPrice(packMap.containsKey(item.getPackId()) ? packMap.get(item.getPackId()).getPrice() : new BigDecimal("0.0")); vo.setPackPrice(packMap.containsKey(item.getPackId()) ? packMap.get(item.getPackId()).getPrice() : new BigDecimal("0.0"));
vo.setLabelName(labelMap.containsKey(item.getLabelId()) ? labelMap.get(item.getLabelId()).getName() : ""); vo.setLabelName(labelMap.containsKey(item.getLabelId()) ? labelMap.get(item.getLabelId()).getName() : "");
vo.setLabelType(labelMap.containsKey(item.getLabelId()) ? labelMap.get(item.getLabelId()).getType() : null); vo.setLabelType(labelMap.containsKey(item.getLabelId()) ? labelMap.get(item.getLabelId()).getType() : null);
vo.setLabelDuration(labelMap.containsKey(item.getLabelId()) ? labelMap.get(item.getLabelId()).getDuration() : "");
voList.add(vo); voList.add(vo);
}); });
return voList; return voList;
} }
@Override
public TableDataInfo pageList(RoomLabel 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();
int start = (pageNum - 1) * pageSize;
int end = Math.min(start + pageSize, voList.size());
List<RoomLabelVo> pagedList = voList.subList(start, end);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setRows(pagedList);
tableDataInfo.setTotal(roomLabels.size());
tableDataInfo.setCode(200);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
}
} }
...@@ -111,7 +111,7 @@ public class RoomStatusServiceImpl implements RoomStatusService { ...@@ -111,7 +111,7 @@ public class RoomStatusServiceImpl implements RoomStatusService {
//当前时间减15分钟前的订单 //当前时间减15分钟前的订单
queryWrapper.ge(SOrder::getEndDate, DateUtils.addMinutes(DateUtils.getNowDate(), -15)); queryWrapper.ge(SOrder::getEndDate, DateUtils.addMinutes(DateUtils.getNowDate(), -15));
SOrder one = orderService.getOne(queryWrapper); SOrder one = orderService.getOne(queryWrapper);
if (!ObjectUtils.isEmpty(one) | redisUtil.exists(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + one.getOrderNo())) { if (!ObjectUtils.isEmpty(one) || redisUtil.exists(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + one.getOrderNo())) {
isAvailable = true; isAvailable = true;
} else { } else {
isAvailable = false; isAvailable = false;
......
...@@ -430,11 +430,11 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -430,11 +430,11 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
newSConsumerCoupon.setCouponTimeEnd(sCoupon.getValidEndTime()); newSConsumerCoupon.setCouponTimeEnd(sCoupon.getValidEndTime());
newSConsumerCoupon.setCouponType(sCoupon.getCouponType()); newSConsumerCoupon.setCouponType(sCoupon.getCouponType());
newSConsumerCoupon.setMinPrice(new BigDecimal(0.00)); newSConsumerCoupon.setMinPrice(new BigDecimal(0.00));
newSConsumerCoupon.setSubPrice(sCoupon.getSubPrice());
newSConsumerCoupon.setWeeks(sCoupon.getWeeks()); newSConsumerCoupon.setWeeks(sCoupon.getWeeks());
newSConsumerCoupon.setStoreIds(sCoupon.getStoreIds()); newSConsumerCoupon.setStoreIds(sCoupon.getStoreIds());
newSConsumerCoupon.setSubPrice(sCoupon.getSubPrice()); newSConsumerCoupon.setSubPrice(sCoupon.getSubPrice());
newSConsumerCoupon.setCouponPayPrice(sCoupon.getCouponPayPrice()); newSConsumerCoupon.setCouponPayPrice(sCoupon.getCouponPayPrice());
newSConsumerCoupon.setPromotionPrice(sCoupon.getPromotionPrice());
newSConsumerCoupon.setMinDuration(sCoupon.getMinDuration()); newSConsumerCoupon.setMinDuration(sCoupon.getMinDuration());
newSConsumerCoupon.setMaxDuration(sCoupon.getMaxDuration()); newSConsumerCoupon.setMaxDuration(sCoupon.getMaxDuration());
newSConsumerCoupon.setDuration(sCoupon.getDuration()); newSConsumerCoupon.setDuration(sCoupon.getDuration());
......
...@@ -13,6 +13,7 @@ import share.common.utils.DateUtils; ...@@ -13,6 +13,7 @@ import share.common.utils.DateUtils;
import share.common.utils.SecurityUtils; import share.common.utils.SecurityUtils;
import share.system.domain.*; import share.system.domain.*;
import share.system.domain.vo.FrontTokenComponent; import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.RoomLabelVo;
import share.system.domain.vo.RoomStatusVo; import share.system.domain.vo.RoomStatusVo;
import share.system.domain.vo.SRoomVo; import share.system.domain.vo.SRoomVo;
import share.system.mapper.DeviceMapper; import share.system.mapper.DeviceMapper;
...@@ -54,6 +55,8 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements ...@@ -54,6 +55,8 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
private SStoreConsumerMapper storeConsumerMapper; private SStoreConsumerMapper storeConsumerMapper;
@Autowired @Autowired
private ISCleanRecordsService cleanRecordsService; private ISCleanRecordsService cleanRecordsService;
@Autowired
private RoomLabelService roomLabelService;
/** /**
...@@ -390,12 +393,20 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements ...@@ -390,12 +393,20 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
List<Long> packIds = roomPackService.selectPackListByRoomId(id); List<Long> packIds = roomPackService.selectPackListByRoomId(id);
//过滤首次下单套餐 //过滤首次下单套餐
List<SPack> packs = packService.selectPackListByIds(packIds); List<SPack> packs = packService.selectPackListByIds(packIds);
RoomLabel roomLabel = new RoomLabel();
roomLabel.setRoomId(id);
roomLabel.setStoreId(room.getStoreId());
List<RoomLabel> roomLabels = roomLabelService.selectRoomLabelList(roomLabel);
List<RoomLabelVo> voList = roomLabelService.doListToVoList(roomLabels);
room.setPackList(packs); room.setPackList(packs);
SRoomVo vo = null; SRoomVo vo = null;
if (Objects.nonNull(room)) { if (Objects.nonNull(room)) {
vo = new SRoomVo(); vo = new SRoomVo();
BeanUtils.copyProperties(room, vo); BeanUtils.copyProperties(room, vo);
} }
//排序按照标签时间和标签类型
voList.sort(Comparator.comparing(RoomLabelVo::getLabelDuration).thenComparing(RoomLabelVo::getLabelType));
vo.setRoomLabelList(voList);
vo.setStoreName(sStore.getName()); vo.setStoreName(sStore.getName());
return vo; return vo;
} }
......
...@@ -53,6 +53,33 @@ ...@@ -53,6 +53,33 @@
<include refid="selectRoomLabelVo"/> <include refid="selectRoomLabelVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="pageList" resultMap="RoomLabelResult">
select distinct r.id,
r.store_id,
r.room_id,
r.label_id,
r.pack_id,
r.promotion_duration,
r.promotion_amount,
r.create_by,
r.create_time,
r.update_by,
r.update_time,
r.remark,
l.duration,
l.type
from s_room_label r left join s_label l on r.label_id=l.id
where 1=1
<if test="storeId != null ">and r.store_id = #{storeId}</if>
<if test="roomId != null ">and r.room_id = #{roomId}</if>
<if test="labelId != null ">and r.label_id = #{labelId}</if>
<if test="packId != null ">and r.pack_id = #{packId}</if>
<if test="promotionDuration != null and promotionDuration != ''">and r.promotion_duration =
#{promotionDuration}
</if>
<if test="promotionAmount != null ">and r.promotion_amount = #{promotionAmount}</if>
order by l.duration,l.type desc
</select>
<insert id="insertRoomLabel" parameterType="RoomLabel" useGeneratedKeys="true" keyProperty="id"> <insert id="insertRoomLabel" parameterType="RoomLabel" useGeneratedKeys="true" keyProperty="id">
insert into s_room_label insert into s_room_label
......
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