Commit 387a6edf by 吕明尚

修改新增房间没有默认状态

parent 17be0e13
......@@ -11,7 +11,9 @@ public enum OrderStatusEnum {
USED(2,"已使用"),
CANCEL(3, "已取消"),
REFUNDING(4, "退款中"),
REFUNDED(5, "已退款");
REFUNDED(5, "已退款"),
UNUSED_AND_INUSE(10, "待使用/已预约/使用中"),
;
private Integer code;
......
......@@ -143,6 +143,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
*/
@Override
public List<SOrder> selectSOrderList(SOrder sOrder) {
if (ObjectUtil.isNotEmpty(sOrder.getStatus()) && sOrder.getStatus().equals(OrderStatusEnum.UNUSED_AND_INUSE.getCode())) {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getRoomId, sOrder.getRoomId());
queryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex());
queryWrapper.in(SOrder::getStatus, OrderStatusEnum.getUnfinishOrderStatus());
queryWrapper.orderByDesc(SOrder::getCreateTime);
return baseMapper.selectList(queryWrapper);
}
List<SOrder> orders = baseMapper.selectSOrderList(sOrder);
return orders;
}
......@@ -300,6 +308,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public TableDataInfoVo pageList(SOrder sOrder) {
List<SOrder> sOrders = selectSOrderList(sOrder);
List<SOrderVo> sOrderVos = convertDosToVos(sOrders);
BigDecimal totalAmount = new BigDecimal("0.00");
......@@ -431,16 +440,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (oldSOrder.getStatus().equals(OrderStatusEnum.INUSE.getCode())) {
// 使用中订单断电, 延时3分钟断电
deviceOpService.openOrCloseDevice(oldSOrder.getRoomId(), oldSOrder.getConsumerPhone(),
OpTypeEnum.CUT_ELECTRIC.getCode(), true, 180);
} else if (oldSOrder.getStatus().equals(OrderStatusEnum.UNUSED.getCode())) {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getRoomId, oldSOrder.getRoomId());
queryWrapper.eq(SOrder::getStatus, OrderStatusEnum.INUSE.getCode());
List<SOrder> list = list(queryWrapper);
if (CollectionUtils.isEmpty(list)) {
deviceOpService.openOrCloseDevice(oldSOrder.getRoomId(), oldSOrder.getConsumerPhone(),
OpTypeEnum.CUT_ELECTRIC.getCode(), true, 180);
}
OpTypeEnum.CUT_ELECTRIC.getCode(), true, 10);
// } else if (oldSOrder.getStatus().equals(OrderStatusEnum.UNUSED.getCode())) {
// LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(SOrder::getRoomId, oldSOrder.getRoomId());
// queryWrapper.eq(SOrder::getStatus, OrderStatusEnum.INUSE.getCode());
// List<SOrder> list = list(queryWrapper);
// if (CollectionUtils.isEmpty(list)) {
// deviceOpService.openOrCloseDevice(oldSOrder.getRoomId(), oldSOrder.getConsumerPhone(),
// OpTypeEnum.CUT_ELECTRIC.getCode(), true, 10);
// }
}
} else if (oldSOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
......
package share.system.service.impl;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.util.StrUtil;
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.BeanUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.enums.*;
import share.common.exception.base.BaseException;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.SecurityUtils;
import share.system.domain.*;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.MqttxVo;
import share.system.domain.vo.RoomStatusVo;
import share.system.domain.vo.SRoomVo;
import share.system.mapper.DeviceMapper;
import share.system.mapper.SOrderMapper;
import share.system.mapper.SRoomMapper;
import share.system.mapper.SStoreConsumerMapper;
import share.system.service.*;
import java.util.*;
import java.util.stream.Collectors;
/**
* 房间Service业务层处理
*
......@@ -172,6 +169,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
public int insertSRoom(SRoom sRoom) {
int i = 0;
try {
sRoom.setStatus(YesNoEnum.no.getIndex());
sRoom.setCreateTime(DateUtils.getNowDate());
sRoom.setCreateBy(SecurityUtils.getUsername());
i = baseMapper.insertSRoom(sRoom);
......
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