Commit e2de6a5c by 吕明尚

房间详情增加标签类型

parent fd125fae
...@@ -10,6 +10,7 @@ import share.common.core.page.TableDataInfo; ...@@ -10,6 +10,7 @@ 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.RoomLabelDto;
import share.system.service.RoomLabelService; import share.system.service.RoomLabelService;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -32,7 +33,7 @@ public class RoomLabelController extends BaseController { ...@@ -32,7 +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(RoomLabelDto roomLabel) {
return roomLabelService.pageList(roomLabel); return roomLabelService.pageList(roomLabel);
} }
...@@ -42,7 +43,7 @@ public class RoomLabelController extends BaseController { ...@@ -42,7 +43,7 @@ public class RoomLabelController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:roomLabel:export')") @PreAuthorize("@ss.hasPermi('system:roomLabel:export')")
@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, RoomLabelDto roomLabel) {
List<RoomLabel> list = roomLabelService.selectRoomLabelList(roomLabel); List<RoomLabel> list = roomLabelService.selectRoomLabelList(roomLabel);
ExcelUtil<RoomLabel> util = new ExcelUtil<RoomLabel>(RoomLabel.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.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
...@@ -15,12 +12,12 @@ import share.system.domain.SPack; ...@@ -15,12 +12,12 @@ import share.system.domain.SPack;
import share.system.domain.SRoom; import share.system.domain.SRoom;
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.service.DeviceLogService;
import share.system.service.IPackService;
import share.system.service.ISRoomService; import share.system.service.ISRoomService;
import share.common.core.page.TableDataInfo;
import share.system.service.RoomStatusService; import share.system.service.RoomStatusService;
import java.util.Date;
import java.util.List;
/** /**
* 房间Controller * 房间Controller
* *
...@@ -54,8 +51,8 @@ public class SRoomController extends BaseController { ...@@ -54,8 +51,8 @@ public class SRoomController extends BaseController {
*/ */
@ApiOperation(value = "房间详情") @ApiOperation(value = "房间详情")
@RequestMapping(value = "/info", method = RequestMethod.GET) @RequestMapping(value = "/info", method = RequestMethod.GET)
public R<SRoomVo> getInfo(@RequestParam("id") Long id) { public R<SRoomVo> getInfo(@RequestParam("id") Long id, @RequestParam("id") Long type) {
return R.ok(sRoomService.queryById(id)); return R.ok(sRoomService.queryById(id, type));
} }
......
...@@ -36,9 +36,9 @@ public class Label extends BaseEntity { ...@@ -36,9 +36,9 @@ public class Label extends BaseEntity {
private String duration; private String duration;
/** /**
* 套餐类型:0:预定,1:续费 * 标签类型:0:预定,1:续费
*/ */
@Excel(name = "套餐类型:0:预定,1:续费") @Excel(name = "标签类型:0:预定,1:续费")
private Long type; private Long type;
......
package share.system.domain.vo;
import lombok.Data;
import share.system.domain.RoomLabel;
@Data
public class RoomLabelDto extends RoomLabel {
//标签类型 0:预定,1:续费
private Long type;
}
...@@ -2,6 +2,7 @@ package share.system.mapper; ...@@ -2,6 +2,7 @@ package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.RoomLabel; import share.system.domain.RoomLabel;
import share.system.domain.vo.RoomLabelDto;
import java.util.List; import java.util.List;
...@@ -60,5 +61,5 @@ public interface RoomLabelMapper extends BaseMapper<RoomLabel> { ...@@ -60,5 +61,5 @@ public interface RoomLabelMapper extends BaseMapper<RoomLabel> {
*/ */
public int deleteRoomLabelByIds(Long[] ids); public int deleteRoomLabelByIds(Long[] ids);
List<RoomLabel> pageList(RoomLabel roomLabel); List<RoomLabel> pageList(RoomLabelDto roomLabel);
} }
...@@ -97,7 +97,7 @@ public interface ISRoomService extends IService<SRoom> ...@@ -97,7 +97,7 @@ public interface ISRoomService extends IService<SRoom>
List<SPack> getPackByRoomId(Long id); List<SPack> getPackByRoomId(Long id);
SRoomVo queryById(Long id); SRoomVo queryById(Long id, Long type);
int addRoomDevice(Long roomId, String[] devIds); int addRoomDevice(Long roomId, String[] devIds);
......
...@@ -3,6 +3,7 @@ package share.system.service; ...@@ -3,6 +3,7 @@ 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.common.core.page.TableDataInfo;
import share.system.domain.RoomLabel; import share.system.domain.RoomLabel;
import share.system.domain.vo.RoomLabelDto;
import share.system.domain.vo.RoomLabelVo; import share.system.domain.vo.RoomLabelVo;
import java.util.List; import java.util.List;
...@@ -28,7 +29,7 @@ public interface RoomLabelService extends IService<RoomLabel> { ...@@ -28,7 +29,7 @@ public interface RoomLabelService extends IService<RoomLabel> {
* @param roomLabel 房间标签 * @param roomLabel 房间标签
* @return 房间标签集合 * @return 房间标签集合
*/ */
public List<RoomLabel> selectRoomLabelList(RoomLabel roomLabel); public List<RoomLabel> selectRoomLabelList(RoomLabelDto roomLabel);
/** /**
* 新增房间标签 * 新增房间标签
...@@ -64,5 +65,5 @@ public interface RoomLabelService extends IService<RoomLabel> { ...@@ -64,5 +65,5 @@ public interface RoomLabelService extends IService<RoomLabel> {
public List<RoomLabelVo> doListToVoList(List<RoomLabel> list); public List<RoomLabelVo> doListToVoList(List<RoomLabel> list);
TableDataInfo pageList(RoomLabel roomLabel); TableDataInfo pageList(RoomLabelDto roomLabel);
} }
package share.system.service.impl; package share.system.service.impl;
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.apache.commons.collections4.CollectionUtils;
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 share.common.enums.YesNoEnum; import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import share.system.domain.Label; import share.system.domain.Label;
import share.system.domain.RoomLabel;
import share.system.mapper.LabelMapper; import share.system.mapper.LabelMapper;
import share.system.service.LabelService; import share.system.service.LabelService;
import share.system.service.RoomLabelService;
import java.util.List; import java.util.List;
...@@ -21,7 +25,8 @@ import java.util.List; ...@@ -21,7 +25,8 @@ import java.util.List;
public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements LabelService { public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements LabelService {
@Autowired @Autowired
private LabelMapper labelMapper; private LabelMapper labelMapper;
@Autowired
private RoomLabelService roomLabelService;
/** /**
* 查询标签 * 查询标签
* *
...@@ -76,6 +81,12 @@ public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements ...@@ -76,6 +81,12 @@ public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements
*/ */
@Override @Override
public int deleteLabelByIds(Long[] ids) { public int deleteLabelByIds(Long[] ids) {
LambdaQueryWrapper<RoomLabel> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(RoomLabel::getLabelId, ids);
List<RoomLabel> roomLabels = roomLabelService.list(queryWrapper);
if (CollectionUtils.isNotEmpty(roomLabels)) {
throw new RuntimeException("标签已被使用,无法删除");
}
return labelMapper.deleteLabelByIds(ids); return labelMapper.deleteLabelByIds(ids);
} }
...@@ -92,8 +103,10 @@ public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements ...@@ -92,8 +103,10 @@ public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements
@Override @Override
public List<Label> querylist() { public List<Label> querylist() {
List<Label> labels = labelMapper.selectList(null); LambdaQueryWrapper<Label> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderBy(true, true, Label::getDuration);
queryWrapper.orderByDesc(Label::getType);
List<Label> labels = labelMapper.selectList(queryWrapper);
labels.stream().forEach(item -> { labels.stream().forEach(item -> {
item.setName(item.getName() + "-" + YesNoEnum.getLabelName(Math.toIntExact(item.getType()))); item.setName(item.getName() + "-" + YesNoEnum.getLabelName(Math.toIntExact(item.getType())));
}); });
......
...@@ -11,6 +11,7 @@ import share.common.core.page.TableSupport; ...@@ -11,6 +11,7 @@ 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.*;
import share.system.domain.vo.RoomLabelDto;
import share.system.domain.vo.RoomLabelVo; import share.system.domain.vo.RoomLabelVo;
import share.system.mapper.RoomLabelMapper; import share.system.mapper.RoomLabelMapper;
import share.system.service.*; import share.system.service.*;
...@@ -62,7 +63,7 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel ...@@ -62,7 +63,7 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel
* @return 房间标签 * @return 房间标签
*/ */
@Override @Override
public List<RoomLabel> selectRoomLabelList(RoomLabel roomLabel) { public List<RoomLabel> selectRoomLabelList(RoomLabelDto roomLabel) {
return roomLabelMapper.pageList(roomLabel); return roomLabelMapper.pageList(roomLabel);
} }
...@@ -154,7 +155,7 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel ...@@ -154,7 +155,7 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel
@Override @Override
public TableDataInfo pageList(RoomLabel roomLabel) { public TableDataInfo pageList(RoomLabelDto roomLabel) {
List<RoomLabel> roomLabels = roomLabelMapper.pageList(roomLabel); List<RoomLabel> roomLabels = roomLabelMapper.pageList(roomLabel);
List<RoomLabelVo> voList = doListToVoList(roomLabels); List<RoomLabelVo> voList = doListToVoList(roomLabels);
//正序labelDuration,倒序labelType //正序labelDuration,倒序labelType
......
...@@ -112,10 +112,10 @@ public class RoomStatusServiceImpl implements RoomStatusService { ...@@ -112,10 +112,10 @@ 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;
} else {
isAvailable = false; isAvailable = false;
} else {
isAvailable = true;
} }
} }
} }
......
...@@ -12,10 +12,7 @@ import share.common.exception.base.BaseException; ...@@ -12,10 +12,7 @@ import share.common.exception.base.BaseException;
import share.common.utils.DateUtils; 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.*;
import share.system.domain.vo.RoomLabelVo;
import share.system.domain.vo.RoomStatusVo;
import share.system.domain.vo.SRoomVo;
import share.system.mapper.DeviceMapper; import share.system.mapper.DeviceMapper;
import share.system.mapper.SRoomMapper; import share.system.mapper.SRoomMapper;
import share.system.mapper.SStoreConsumerMapper; import share.system.mapper.SStoreConsumerMapper;
...@@ -378,7 +375,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements ...@@ -378,7 +375,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
} }
@Override @Override
public SRoomVo queryById(Long id) { public SRoomVo queryById(Long id, Long type) {
SRoom room = baseMapper.selectById(id); SRoom room = baseMapper.selectById(id);
SStore sStore = sStoreService.selectSStoreById(room.getStoreId()); SStore sStore = sStoreService.selectSStoreById(room.getStoreId());
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper();
...@@ -393,9 +390,10 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements ...@@ -393,9 +390,10 @@ 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(); RoomLabelDto roomLabel = new RoomLabelDto();
roomLabel.setRoomId(id); roomLabel.setRoomId(id);
roomLabel.setStoreId(room.getStoreId()); roomLabel.setStoreId(room.getStoreId());
roomLabel.setType(type);
List<RoomLabel> roomLabels = roomLabelService.selectRoomLabelList(roomLabel); List<RoomLabel> roomLabels = roomLabelService.selectRoomLabelList(roomLabel);
List<RoomLabelVo> voList = roomLabelService.doListToVoList(roomLabels); List<RoomLabelVo> voList = roomLabelService.doListToVoList(roomLabels);
room.setPackList(packs); room.setPackList(packs);
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<include refid="selectRoomLabelVo"/> <include refid="selectRoomLabelVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="pageList" resultMap="RoomLabelResult"> <select id="pageList" resultMap="RoomLabelResult" parameterType="share.system.domain.vo.RoomLabelDto">
select distinct r.id, select distinct r.id,
r.store_id, r.store_id,
r.room_id, r.room_id,
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
#{promotionDuration} #{promotionDuration}
</if> </if>
<if test="promotionAmount != null ">and r.promotion_amount = #{promotionAmount}</if> <if test="promotionAmount != null ">and r.promotion_amount = #{promotionAmount}</if>
<if test="l.type != null ">and l.type = #{type}</if>
order by l.duration,l.type desc order by l.duration,l.type desc
</select> </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