Commit e2de6a5c by 吕明尚

房间详情增加标签类型

parent fd125fae
......@@ -10,6 +10,7 @@ import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.RoomLabel;
import share.system.domain.vo.RoomLabelDto;
import share.system.service.RoomLabelService;
import javax.servlet.http.HttpServletResponse;
......@@ -32,7 +33,7 @@ public class RoomLabelController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:roomLabel:list')")
@GetMapping("/list")
public TableDataInfo list(RoomLabel roomLabel) {
public TableDataInfo list(RoomLabelDto roomLabel) {
return roomLabelService.pageList(roomLabel);
}
......@@ -42,7 +43,7 @@ public class RoomLabelController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:roomLabel:export')")
@Log(title = "房间标签", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RoomLabel roomLabel) {
public void export(HttpServletResponse response, RoomLabelDto roomLabel) {
List<RoomLabel> list = roomLabelService.selectRoomLabelList(roomLabel);
ExcelUtil<RoomLabel> util = new ExcelUtil<RoomLabel>(RoomLabel.class);
util.exportExcel(response, list, "房间标签数据");
......
package share.web.controller.system;
import java.util.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import share.common.core.controller.BaseController;
......@@ -15,12 +12,12 @@ import share.system.domain.SPack;
import share.system.domain.SRoom;
import share.system.domain.vo.RoomStatusVo;
import share.system.domain.vo.SRoomVo;
import share.system.service.DeviceLogService;
import share.system.service.IPackService;
import share.system.service.ISRoomService;
import share.common.core.page.TableDataInfo;
import share.system.service.RoomStatusService;
import java.util.Date;
import java.util.List;
/**
* 房间Controller
*
......@@ -54,8 +51,8 @@ public class SRoomController extends BaseController {
*/
@ApiOperation(value = "房间详情")
@RequestMapping(value = "/info", method = RequestMethod.GET)
public R<SRoomVo> getInfo(@RequestParam("id") Long id) {
return R.ok(sRoomService.queryById(id));
public R<SRoomVo> getInfo(@RequestParam("id") Long id, @RequestParam("id") Long type) {
return R.ok(sRoomService.queryById(id, type));
}
......
......@@ -36,9 +36,9 @@ public class Label extends BaseEntity {
private String duration;
/**
* 套餐类型:0:预定,1:续费
* 标签类型:0:预定,1:续费
*/
@Excel(name = "套餐类型:0:预定,1:续费")
@Excel(name = "标签类型:0:预定,1:续费")
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;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.RoomLabel;
import share.system.domain.vo.RoomLabelDto;
import java.util.List;
......@@ -60,5 +61,5 @@ public interface RoomLabelMapper extends BaseMapper<RoomLabel> {
*/
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>
List<SPack> getPackByRoomId(Long id);
SRoomVo queryById(Long id);
SRoomVo queryById(Long id, Long type);
int addRoomDevice(Long roomId, String[] devIds);
......
......@@ -3,6 +3,7 @@ package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.page.TableDataInfo;
import share.system.domain.RoomLabel;
import share.system.domain.vo.RoomLabelDto;
import share.system.domain.vo.RoomLabelVo;
import java.util.List;
......@@ -28,7 +29,7 @@ public interface RoomLabelService extends IService<RoomLabel> {
* @param roomLabel 房间标签
* @return 房间标签集合
*/
public List<RoomLabel> selectRoomLabelList(RoomLabel roomLabel);
public List<RoomLabel> selectRoomLabelList(RoomLabelDto roomLabel);
/**
* 新增房间标签
......@@ -64,5 +65,5 @@ public interface RoomLabelService extends IService<RoomLabel> {
public List<RoomLabelVo> doListToVoList(List<RoomLabel> list);
TableDataInfo pageList(RoomLabel roomLabel);
TableDataInfo pageList(RoomLabelDto roomLabel);
}
package share.system.service.impl;
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.enums.YesNoEnum;
import share.common.utils.DateUtils;
import share.system.domain.Label;
import share.system.domain.RoomLabel;
import share.system.mapper.LabelMapper;
import share.system.service.LabelService;
import share.system.service.RoomLabelService;
import java.util.List;
......@@ -21,7 +25,8 @@ import java.util.List;
public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements LabelService {
@Autowired
private LabelMapper labelMapper;
@Autowired
private RoomLabelService roomLabelService;
/**
* 查询标签
*
......@@ -76,6 +81,12 @@ public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements
*/
@Override
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);
}
......@@ -92,8 +103,10 @@ public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements
@Override
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 -> {
item.setName(item.getName() + "-" + YesNoEnum.getLabelName(Math.toIntExact(item.getType())));
});
......
......@@ -11,6 +11,7 @@ import share.common.core.page.TableSupport;
import share.common.utils.DateUtils;
import share.common.utils.bean.BeanUtils;
import share.system.domain.*;
import share.system.domain.vo.RoomLabelDto;
import share.system.domain.vo.RoomLabelVo;
import share.system.mapper.RoomLabelMapper;
import share.system.service.*;
......@@ -62,7 +63,7 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel
* @return 房间标签
*/
@Override
public List<RoomLabel> selectRoomLabelList(RoomLabel roomLabel) {
public List<RoomLabel> selectRoomLabelList(RoomLabelDto roomLabel) {
return roomLabelMapper.pageList(roomLabel);
}
......@@ -154,7 +155,7 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel
@Override
public TableDataInfo pageList(RoomLabel roomLabel) {
public TableDataInfo pageList(RoomLabelDto roomLabel) {
List<RoomLabel> roomLabels = roomLabelMapper.pageList(roomLabel);
List<RoomLabelVo> voList = doListToVoList(roomLabels);
//正序labelDuration,倒序labelType
......
......@@ -112,10 +112,10 @@ public class RoomStatusServiceImpl implements RoomStatusService {
//当前时间减15分钟前的订单
queryWrapper.ge(SOrder::getEndDate, DateUtils.addMinutes(DateUtils.getNowDate(), -15));
SOrder one = orderService.getOne(queryWrapper);
if (!ObjectUtils.isEmpty(one) || redisUtil.exists(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + one.getOrderNo())) {
isAvailable = true;
} else {
if (ObjectUtils.isEmpty(one) || !redisUtil.exists(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + one.getOrderNo())) {
isAvailable = false;
} else {
isAvailable = true;
}
}
}
......
......@@ -12,10 +12,7 @@ import share.common.exception.base.BaseException;
import share.common.utils.DateUtils;
import share.common.utils.SecurityUtils;
import share.system.domain.*;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.RoomLabelVo;
import share.system.domain.vo.RoomStatusVo;
import share.system.domain.vo.SRoomVo;
import share.system.domain.vo.*;
import share.system.mapper.DeviceMapper;
import share.system.mapper.SRoomMapper;
import share.system.mapper.SStoreConsumerMapper;
......@@ -378,7 +375,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
}
@Override
public SRoomVo queryById(Long id) {
public SRoomVo queryById(Long id, Long type) {
SRoom room = baseMapper.selectById(id);
SStore sStore = sStoreService.selectSStoreById(room.getStoreId());
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper();
......@@ -393,9 +390,10 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
List<Long> packIds = roomPackService.selectPackListByRoomId(id);
//过滤首次下单套餐
List<SPack> packs = packService.selectPackListByIds(packIds);
RoomLabel roomLabel = new RoomLabel();
RoomLabelDto roomLabel = new RoomLabelDto();
roomLabel.setRoomId(id);
roomLabel.setStoreId(room.getStoreId());
roomLabel.setType(type);
List<RoomLabel> roomLabels = roomLabelService.selectRoomLabelList(roomLabel);
List<RoomLabelVo> voList = roomLabelService.doListToVoList(roomLabels);
room.setPackList(packs);
......
......@@ -53,7 +53,7 @@
<include refid="selectRoomLabelVo"/>
where id = #{id}
</select>
<select id="pageList" resultMap="RoomLabelResult">
<select id="pageList" resultMap="RoomLabelResult" parameterType="share.system.domain.vo.RoomLabelDto">
select distinct r.id,
r.store_id,
r.room_id,
......@@ -78,6 +78,7 @@
#{promotionDuration}
</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
</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