111
This commit is contained in:
parent
726e8e3979
commit
47689f80fa
|
@ -99,17 +99,17 @@ public class AppEquipmentController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据店铺查大门
|
||||
*/
|
||||
@Log(title = "根据店铺查大门", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/gateGate")
|
||||
public AjaxResult gateGate(Long storeId)
|
||||
{
|
||||
ServiceUtil.assertion(storeId == null, "店铺ID不能为空");
|
||||
logger.info("根据店铺查大门:【{}】",storeId);
|
||||
EquipmentVO vo = equipmentService.selectGate(storeId);
|
||||
equipmentAssembler.assembleDeviceInfo(vo);
|
||||
return success(vo);
|
||||
}
|
||||
// /**
|
||||
// * 根据店铺查大门
|
||||
// */
|
||||
// @Log(title = "根据店铺查大门", businessType = BusinessType.UPDATE)
|
||||
// @GetMapping("/gateGate")
|
||||
// public AjaxResult gateGate(Long storeId)
|
||||
// {
|
||||
// ServiceUtil.assertion(storeId == null, "店铺ID不能为空");
|
||||
// logger.info("根据店铺查大门:【{}】",storeId);
|
||||
//// EquipmentVO vo = equipmentService.selectGate(storeId);
|
||||
// equipmentAssembler.assembleDeviceInfo(vo);
|
||||
// return success(vo);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -174,15 +174,25 @@ public class ServiceConstants {
|
|||
/**----------------------------支付状态start----------------------------*/
|
||||
|
||||
/**
|
||||
* 支付状态:0-未支付,1-已支付
|
||||
* 支付状态: 0-未支付
|
||||
* 支付状态:1-待支付,2-支付中,3-支付成功,4-已取消
|
||||
* 支付状态: 1-待支付
|
||||
*/
|
||||
public static final String ORDER_PAY_STATUS_NON_PAYMENT = "0";
|
||||
public static final String ORDER_PAY_STATUS_NON_PAYMENT = "1";
|
||||
|
||||
/**
|
||||
* 支付状态: 1-已支付
|
||||
* 支付状态: 2-支付中
|
||||
*/
|
||||
public static final String ORDER_PAY_STATUS_PAID = "1";
|
||||
public static final String ORDER_PAY_STATUS_PAYING = "2";
|
||||
|
||||
/**
|
||||
* 支付状态: 3-支付成功
|
||||
*/
|
||||
public static final String ORDER_PAY_STATUS_PAID = "3";
|
||||
|
||||
/**
|
||||
* 支付状态: 4-已取消
|
||||
*/
|
||||
public static final String ORDER_PAY_STATUS_CANCELED = "4";
|
||||
|
||||
/**----------------------------支付状态end----------------------------*/
|
||||
|
||||
|
@ -212,12 +222,12 @@ public class ServiceConstants {
|
|||
/**----------------------------类型start----------------------------*/
|
||||
/** 套餐:1-按小时计费;2-自定义模板 */
|
||||
/**
|
||||
* 套餐: 1-按小时计费
|
||||
* 套餐: 1-押金模式
|
||||
*/
|
||||
public static final String CHARGE_MODE_HOURLY = "1";
|
||||
|
||||
/**
|
||||
* 套餐: 2-自定义模板
|
||||
* 套餐: 2-套餐模式
|
||||
*/
|
||||
public static final String CHARGE_MODE_CUSTOM_TEMPLATE = "2";
|
||||
|
||||
|
@ -834,9 +844,9 @@ public class ServiceConstants {
|
|||
public static final String ORDER_OPERATION_PLACE_ORDER = "1";
|
||||
|
||||
/**
|
||||
* 2 - 改价
|
||||
* 2 - 续单
|
||||
*/
|
||||
public static final String ORDER_OPERATION_CHANGE_PRICE = "2";
|
||||
public static final String ORDER_OPERATION_RENEW_ORDER = "2";
|
||||
|
||||
/**
|
||||
* 3 - 支付
|
||||
|
@ -844,7 +854,7 @@ public class ServiceConstants {
|
|||
public static final String ORDER_OPERATION_PAY = "3";
|
||||
|
||||
/**
|
||||
* 4 - 还车结束订单
|
||||
* 4 - 结束订单
|
||||
*/
|
||||
public static final String ORDER_OPERATION_RETURN_END = "4";
|
||||
|
||||
|
@ -868,11 +878,6 @@ public class ServiceConstants {
|
|||
*/
|
||||
public static final String ORDER_OPERATION_SYSTEM_CANCEL = "8";
|
||||
|
||||
/**
|
||||
* 9 - 用户结束
|
||||
*/
|
||||
public static final String ORDER_OPERATION_USER_END = "9";
|
||||
|
||||
/**----------------------------订单操作类型end----------------------------*/
|
||||
|
||||
/**----------------------------钥匙状态start----------------------------*/
|
||||
|
|
|
@ -456,10 +456,9 @@ public class CallbackServiceImpl implements ICallbackService {
|
|||
|
||||
|
||||
// 更新退款表状态
|
||||
|
||||
Refund rlRefund = new Refund();
|
||||
rlRefund.setRefundNo(outRefundNo);
|
||||
rlRefund.setStatus(REFUND_STATUS_SUCCESS);//
|
||||
rlRefund.setStatus(REFUND_STATUS_SUCCESS);
|
||||
int i = etRefundService.updateEtRefundByRefundNo(rlRefund);
|
||||
ServiceUtil.assertion(i == 0, "【微信退款回调】更新退款单失败");
|
||||
logger.info("【微信退款回调】全部结束!!!!!");
|
||||
|
|
|
@ -503,7 +503,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<update id="cleanPlacementStatus">
|
||||
update ss_device
|
||||
set placement_status = 0,
|
||||
set store_id = null,
|
||||
store_name = null,
|
||||
placement_status = 0,
|
||||
placement_type = null,
|
||||
status = 1
|
||||
where device_id = #{deviceId}
|
||||
|
@ -520,8 +522,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<update id="bind">
|
||||
update ss_device
|
||||
set store_id = #{storeId},
|
||||
user_id = #{userId},
|
||||
set user_id = #{userId},
|
||||
activation_time = now()
|
||||
where device_id = #{deviceId} and user_id is null
|
||||
</update>
|
||||
|
|
|
@ -118,12 +118,12 @@ public interface EquipmentMapper
|
|||
*/
|
||||
boolean uniqueGate(Long storeId);
|
||||
|
||||
/**
|
||||
* 根据店铺查询大门
|
||||
* @param storeId 店铺id
|
||||
* @return String
|
||||
*/
|
||||
EquipmentVO selectGate(Long storeId);
|
||||
// /**
|
||||
// * 根据店铺查询大门
|
||||
// * @param storeId 店铺id
|
||||
// * @return String
|
||||
// */
|
||||
// EquipmentVO selectGate(Long storeId);
|
||||
|
||||
/**
|
||||
* 根据设备id查询店铺
|
||||
|
|
|
@ -106,10 +106,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select count(1) from ss_equipment where store_id = #{storeId} and deleted = 0 and type = '6'
|
||||
</select>
|
||||
|
||||
<select id="selectGate" resultMap="EquipmentResult">
|
||||
<include refid="selectEquipmentVo"/>
|
||||
where e.store_id = #{storeId} and e.deleted = 0 and e.type = '6'
|
||||
</select>
|
||||
<!-- <select id="selectGate" resultMap="EquipmentResult">-->
|
||||
<!-- <include refid="selectEquipmentVo"/>-->
|
||||
<!-- where e.store_id = #{storeId} and e.deleted = 0 and e.type = '6'-->
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="selectStoreIdByDeviceId" resultType="java.lang.Long">
|
||||
select store_id from ss_equipment where device_id = #{deviceId} and deleted = 0 and type = '6' limit 1
|
||||
|
|
|
@ -124,12 +124,12 @@ public interface IEquipmentService
|
|||
boolean uniqueGate(Long storeId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据店铺查询大门
|
||||
* @param storeId 店铺id
|
||||
* @return String
|
||||
*/
|
||||
EquipmentVO selectGate(Long storeId);
|
||||
// /**
|
||||
// * 根据店铺查询大门
|
||||
// * @param storeId 店铺id
|
||||
// * @return String
|
||||
// */
|
||||
// EquipmentVO selectGate(Long storeId);
|
||||
|
||||
/**
|
||||
* 根据设备id查询店铺
|
||||
|
|
|
@ -224,15 +224,15 @@ public class EquipmentServiceImpl implements IEquipmentService
|
|||
return equipmentMapper.uniqueGate(storeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据店铺查询大门
|
||||
* @param storeId 店铺id
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public EquipmentVO selectGate(Long storeId) {
|
||||
return equipmentMapper.selectGate(storeId);
|
||||
}
|
||||
// /**
|
||||
// * 根据店铺查询大门
|
||||
// * @param storeId 店铺id
|
||||
// * @return String
|
||||
// */
|
||||
// @Override
|
||||
// public EquipmentVO selectGate(Long storeId) {
|
||||
// return equipmentMapper.selectGate(storeId);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 根据设备id查询店铺
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.springframework.stereotype.Service;
|
|||
import com.ruoyi.ss.feeRule.domain.FeeRuleQuery;
|
||||
import com.ruoyi.ss.feeRule.service.IFeeRuleService;
|
||||
|
||||
import static com.ruoyi.common.constant.ServiceConstants.CHARGE_MODE_HOURLY;
|
||||
|
||||
/**
|
||||
* 收费模板Service业务层处理
|
||||
|
|
|
@ -310,6 +310,12 @@ public class Order extends BaseEntity {
|
|||
@Excel(name = "房间类型")
|
||||
private String roomType;
|
||||
|
||||
/**
|
||||
* 房间类型
|
||||
*/
|
||||
@Excel(name = "房间类型2:1-房间;2-大厅设施")
|
||||
private String roomType2;
|
||||
|
||||
/**
|
||||
* 设施Id
|
||||
*/
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
package com.ruoyi.ss.order.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.ss.channel.domain.ChannelVO;
|
||||
import com.ruoyi.ss.dividendDetail.domain.DividendDetail;
|
||||
import com.ruoyi.ss.device.domain.vo.DeviceVO;
|
||||
import com.ruoyi.ss.equipment.domain.EquipmentVO;
|
||||
import com.ruoyi.ss.feeRule.domain.FeeRuleVO;
|
||||
import com.ruoyi.ss.order.domain.dto.OrderDTO;
|
||||
import com.ruoyi.ss.order.domain.dto.ProductDTO;
|
||||
import com.ruoyi.ss.order.domain.dto.ReOrderDTO;
|
||||
import com.ruoyi.ss.order.domain.dto.TopUpOrderDTO;
|
||||
import com.ruoyi.ss.product.domain.ProductVO;
|
||||
import com.ruoyi.ss.user.domain.UserVO;
|
||||
import com.ruoyi.ss.device.domain.vo.DeviceVO;
|
||||
import com.ruoyi.ss.order.domain.dto.ReOrderDTO;
|
||||
import com.ruoyi.ss.room.domain.RoomVO;
|
||||
import com.ruoyi.ss.feeRule.domain.FeeRuleVO;
|
||||
import com.ruoyi.ss.store.domain.StoreVO;
|
||||
import com.ruoyi.ss.order.domain.dto.OrderDTO;
|
||||
import com.ruoyi.ss.user.domain.UserVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OrderBO {
|
||||
|
@ -55,8 +53,8 @@ public class OrderBO {
|
|||
// 设施
|
||||
private EquipmentVO equipment;
|
||||
|
||||
//房间门
|
||||
private DeviceVO door;
|
||||
//房间门(如果是大厅设施则是大厅设备)
|
||||
private DeviceVO device;
|
||||
|
||||
//套餐
|
||||
private FeeRuleVO feeRule;
|
||||
|
@ -79,6 +77,9 @@ public class OrderBO {
|
|||
// 是否续单:1-预定单;2-续单
|
||||
private String reType;
|
||||
|
||||
// 类型:1-房间;2-大厅设施
|
||||
private String viewType;
|
||||
|
||||
// 平台服务费
|
||||
private BigDecimal platformServiceFee;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class OrderDTO {
|
|||
@DictValid(type = DictTypeConstants.ORDER_TYPE, message = "非法的订单类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty("类型:1-房间;2-设施")
|
||||
@ApiModelProperty("类型:1-房间;2-大厅设施")
|
||||
private String viewType;
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select order_id, order_no, user_id, user_name, real_name, phone, rule_id, gate_mac, gate_mac2, gate_sn, gate_id, room_mac, room_mac2, room_sn, pay_time, pay_type, paid, pay_id, type,
|
||||
total_fee, pay_fee, deposit, deposit_refund, refund, refund_time, is_refund, platform_service_fee, mark, duration, status, create_time, change_reason, pay_channel,
|
||||
channel_name, channel_cost, store_name, lng,lat, store_id, merchant_id, original_order_no, price, `explain`, auto_cancel_time, is_send_msg, room_id,equipment_id,
|
||||
equipment_type,equipment_name, room_name, room_type, mode, hours, reserve_start_time, reserve_end_time, wifi, wifi_password, manager_phone, deposit_refund_desc,
|
||||
equipment_type,equipment_name, room_name, room_type, room_type2, mode, hours, reserve_start_time, reserve_end_time, wifi, wifi_password, manager_phone, deposit_refund_desc,
|
||||
product_id, product_name from ss_order
|
||||
</sql>
|
||||
|
||||
|
@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
o.room_id,
|
||||
o.room_name,
|
||||
o.room_type,
|
||||
o.room_type2,
|
||||
o.equipment_id,
|
||||
o.equipment_type,
|
||||
o.equipment_name,
|
||||
|
@ -399,6 +400,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="roomId != null">room_id,</if>
|
||||
<if test="roomName != null">room_name,</if>
|
||||
<if test="roomType != null">room_type,</if>
|
||||
<if test="roomType2 != null">room_type2,</if>
|
||||
<if test="equipmentId != null">equipment_id,</if>
|
||||
<if test="equipmentType != null">equipment_type,</if>
|
||||
<if test="equipmentName != null">equipment_name,</if>
|
||||
|
@ -457,6 +459,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="roomId != null">#{roomId},</if>
|
||||
<if test="roomName != null">#{roomName},</if>
|
||||
<if test="roomType != null">#{roomType},</if>
|
||||
<if test="roomType2 != null">#{roomType2},</if>
|
||||
<if test="equipmentId != null">#{equipmentId},</if>
|
||||
<if test="equipmentType != null">#{equipmentType},</if>
|
||||
<if test="equipmentName != null">#{equipmentName},</if>
|
||||
|
@ -520,6 +523,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="roomId != null">room_id = #{roomId},</if>
|
||||
<if test="roomName != null">room_name = #{roomName},</if>
|
||||
<if test="roomType != null">room_type = #{roomType}</if>
|
||||
<if test="roomType2 != null">room_type2 = #{roomType2}</if>
|
||||
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
|
||||
<if test="equipmentType != null">equipment_type = #{equipmentType},</if>
|
||||
<if test="equipmentName != null">equipment_name = #{equipmentName},</if>
|
||||
|
@ -585,6 +589,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="roomId != null">room_id = #{roomId},</if>
|
||||
<if test="roomName != null">room_name = #{roomName},</if>
|
||||
<if test="roomType != null">room_type = #{roomType}</if>
|
||||
<if test="roomType2 != null">room_type2 = #{roomType2}</if>
|
||||
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
|
||||
<if test="equipmentType != null">equipment_type = #{equipmentType},</if>
|
||||
<if test="equipmentName != null">equipment_name = #{equipmentName},</if>
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.ss.order.service;
|
|||
|
||||
import com.ruoyi.common.core.domain.ValidateResult;
|
||||
import com.ruoyi.common.core.domain.entity.User;
|
||||
import com.ruoyi.ss.order.domain.Order;
|
||||
import com.ruoyi.ss.order.domain.OrderBO;
|
||||
import com.ruoyi.ss.order.domain.OrderQuery;
|
||||
import com.ruoyi.ss.order.domain.OrderVO;
|
||||
|
@ -19,6 +20,14 @@ public interface IOrderValidator {
|
|||
*/
|
||||
ValidateResult preAddOrder(OrderBO bo);
|
||||
|
||||
/**
|
||||
* 创建订单后校验
|
||||
*
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
ValidateResult afterAddOrder(Order order);
|
||||
|
||||
/**
|
||||
* 更换包间校验
|
||||
*/
|
||||
|
|
|
@ -8,6 +8,9 @@ import com.ruoyi.common.core.domain.ValidateResult;
|
|||
import com.ruoyi.common.core.domain.entity.User;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.ss.feeRule.domain.FeeRuleVO;
|
||||
import com.ruoyi.ss.feeRule.service.IFeeRuleService;
|
||||
import com.ruoyi.ss.order.domain.Order;
|
||||
import com.ruoyi.ss.order.domain.OrderBO;
|
||||
import com.ruoyi.ss.order.domain.OrderQuery;
|
||||
import com.ruoyi.ss.order.domain.OrderVO;
|
||||
|
@ -23,6 +26,8 @@ import org.springframework.stereotype.Service;
|
|||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -50,44 +55,78 @@ public class IOrderValidatorImpl extends BaseValidator implements IOrderValidato
|
|||
|
||||
// 营业时间判断
|
||||
StoreVO store = bo.getStore();
|
||||
Date businessTimeStart = store.getBusinessTimeStart();
|
||||
Date businessTimeEnd = store.getBusinessTimeEnd();
|
||||
LocalTime businessTimeStart = store.getBusinessTimeStart();
|
||||
LocalTime businessTimeEnd = store.getBusinessTimeEnd();
|
||||
if (businessTimeStart == null || businessTimeEnd == null) {
|
||||
return error("营业时间为空");
|
||||
}
|
||||
|
||||
if (!isStoreOpen(store)) {
|
||||
return error("不在营业时间内");
|
||||
}
|
||||
|
||||
// 房间还有进行中的订单
|
||||
// RoomVO room = bo.getRoom();
|
||||
// boolean inProgressOrder = getInProgressOrder(room.getRoomId());
|
||||
// if (inProgressOrder) {
|
||||
// return error("该房间还有进行中的订单");
|
||||
// }
|
||||
//
|
||||
// // 该房间在预约时段是否在订单
|
||||
// if(bo.getType().equals(ServiceConstants.ORDER_TYPE_RESERVE)){
|
||||
// if(isReserved(room.getRoomId(), bo.getOrder().getReserveStartTime(), bo.getOrder().getReserveEndTime()) > 0){
|
||||
// return error("该房间在预约时段存在订单");
|
||||
// }
|
||||
// // 价格已发生变化
|
||||
// if(bo.getFeeRule().getPrice().compareTo(bo.getOrder().getPrice()) != 0){
|
||||
// return error("价格已发生变化");
|
||||
// }
|
||||
// // 价格未配置
|
||||
// if(ObjectUtil.isNull(bo.getFeeRule().getPrice()) || bo.getFeeRule().getPrice().compareTo(BigDecimal.ZERO) == 0){
|
||||
// return error("价格未配置");
|
||||
// }
|
||||
// // 小时未配置
|
||||
// if(ObjectUtil.isNull(bo.getFeeRule().getHours()) || bo.getFeeRule().getHours() <= 0){
|
||||
// return error("小时未配置");
|
||||
// }
|
||||
// }else{
|
||||
// if(isReserved(room.getRoomId(), bo.getOriginalOrder().getReserveStartTime(), bo.getOriginalOrder().getReserveEndTime()) > 0){
|
||||
// return error("该房间在预约时段存在订单");
|
||||
// }
|
||||
// }
|
||||
RoomVO room = bo.getRoom();
|
||||
boolean inProgressOrder = getInProgressOrder(room.getRoomId());
|
||||
if (inProgressOrder) {
|
||||
return error("该房间还有进行中的订单");
|
||||
}
|
||||
|
||||
FeeRuleVO feeRule = bo.getFeeRule();
|
||||
if(!room.getRuleIds().contains(feeRule.getRuleId())){
|
||||
return error(StrUtil.format("该房间【{}】没有应用该套餐【{}】",room.getRoomName(),feeRule.getExplain()));
|
||||
}
|
||||
|
||||
// 该房间在预约时段是否在订单
|
||||
if(bo.getType().equals(ServiceConstants.ORDER_TYPE_RESERVE)){
|
||||
// 价格已发生变化
|
||||
if(feeRule.getPrice().compareTo(bo.getParams().getPrice()) != 0){
|
||||
return error("价格已发生变化");
|
||||
}
|
||||
// 价格未配置
|
||||
if(ObjectUtil.isNull(feeRule.getPrice()) || feeRule.getPrice().compareTo(BigDecimal.ZERO) == 0){
|
||||
return error("价格未配置");
|
||||
}
|
||||
// 小时未配置
|
||||
if(ServiceConstants.CHARGE_MODE_CUSTOM_TEMPLATE.equals(feeRule.getMode()) && (ObjectUtil.isNull(feeRule.getHours()) || feeRule.getHours() <= 0)){
|
||||
return error("小时未配置");
|
||||
}
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidateResult afterAddOrder(Order order) {
|
||||
if(isReserved(order.getRoomId(), order.getReserveStartTime(), order.getReserveEndTime()) > 0){
|
||||
return error("该房间在预约时段存在订单");
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
public boolean isStoreOpen(StoreVO store) {
|
||||
// 将 Date 转换为 LocalTime
|
||||
LocalTime startTime = store.getBusinessTimeStart();
|
||||
LocalTime endTime = store.getBusinessTimeEnd();
|
||||
|
||||
// 判断营业时间是否为空
|
||||
if (startTime == null || endTime == null) {
|
||||
return false; // 或者抛出异常,根据业务需求
|
||||
}
|
||||
|
||||
// 获取当前时间
|
||||
LocalTime currentTime = LocalTime.now();
|
||||
|
||||
// 判断是否跨天
|
||||
if (startTime.isBefore(endTime)) {
|
||||
// 不跨天,直接判断当前时间是否在营业时间内
|
||||
return !currentTime.isBefore(startTime) && !currentTime.isAfter(endTime);
|
||||
} else {
|
||||
// 跨天,判断当前时间是否在 startTime 到 23:59:59 或者 00:00:00 到 endTime 之间
|
||||
return !currentTime.isBefore(startTime) || !currentTime.isAfter(endTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -78,13 +78,19 @@ public class OrderConverterImpl implements IOrderConverter {
|
|||
OrderBO orderBO = new OrderBO();
|
||||
StoreVO eStoreVO;
|
||||
if("2".equals(order.getViewType())){//下单的是大厅的设施
|
||||
EquipmentVO equipmentVO = equipmentService.selectEquipmentByEquipmentId(order.getRoomId());
|
||||
ServiceUtil.assertion(equipmentVO == null, "该设施【"+order.getRoomId()+"】不存在");
|
||||
ServiceUtil.assertion(equipmentVO.getDeviceId() == null, "设施未绑定设备");
|
||||
|
||||
RoomVO eRoomVO = roomService.selectERoomByRoomId(order.getRoomId());
|
||||
ServiceUtil.assertion(eRoomVO == null, "该大厅设施(房间级别)【"+order.getRoomId()+"】不存在");
|
||||
List<EquipmentVO> equipmentVOS = equipmentService.selectEquipmentListByRoomId(order.getRoomId());
|
||||
ServiceUtil.assertion(equipmentVOS.isEmpty(), "该大厅设施(房设施级别)【"+order.getRoomId()+"】不存在");
|
||||
EquipmentVO equipmentVO = equipmentVOS.get(0);
|
||||
ServiceUtil.assertion(equipmentVO.getDeviceId() == null, "大厅设施未绑定设备");
|
||||
DeviceVO device = deviceService.selectById(equipmentVO.getDeviceId());
|
||||
// 店铺
|
||||
eStoreVO = storeService.selectEStoreByStoreId(equipmentVO.getStoreId());
|
||||
orderBO.setRoom(eRoomVO);
|
||||
orderBO.setDevice(device);
|
||||
orderBO.setEquipment(equipmentVO);
|
||||
|
||||
}else{
|
||||
// 房间
|
||||
RoomVO eRoomVO = roomService.selectERoomByRoomId(order.getRoomId());
|
||||
|
@ -100,14 +106,13 @@ public class OrderConverterImpl implements IOrderConverter {
|
|||
// 店铺
|
||||
eStoreVO = storeService.selectEStoreByStoreId(eRoomVO.getStoreId());
|
||||
orderBO.setRoom(eRoomVO);
|
||||
orderBO.setDoor(roomDoorDevice);
|
||||
orderBO.setDevice(roomDoorDevice);
|
||||
}
|
||||
|
||||
ServiceUtil.assertion(eStoreVO == null, "店铺不存在");
|
||||
// 大门设施
|
||||
EquipmentVO equipmentVO = equipmentService.selectGate(eStoreVO.getStoreId());
|
||||
ServiceUtil.assertion(equipmentVO == null, "大门设施不存在");
|
||||
ServiceUtil.assertion(equipmentVO.getDeviceId() == null, "大门设备未绑定不存在");
|
||||
DeviceVO gate = deviceService.selectById(equipmentVO.getDeviceId());
|
||||
ServiceUtil.assertion(eStoreVO.getGateId() == null, "大门未绑定设备");
|
||||
DeviceVO gate = deviceService.selectById(eStoreVO.getGateId());
|
||||
ServiceUtil.assertion(gate == null, "店铺大门设备不存在");
|
||||
|
||||
// 商户
|
||||
|
@ -139,6 +144,7 @@ public class OrderConverterImpl implements IOrderConverter {
|
|||
orderBO.setUser(eUserVO);
|
||||
orderBO.setType(order.getType());
|
||||
orderBO.setReType(ServiceConstants.ORDER_TYPE_RESERVE);
|
||||
orderBO.setViewType(order.getViewType());
|
||||
return orderBO;
|
||||
}
|
||||
|
||||
|
@ -147,6 +153,7 @@ public class OrderConverterImpl implements IOrderConverter {
|
|||
public OrderBO toOrderBO(ReOrderDTO order) {
|
||||
// 原订单
|
||||
OrderVO originalOrder = orderService.selectRlOrderByOrderNo(order.getOriginalOrderNo());
|
||||
ServiceUtil.assertion(originalOrder == null, "原订单不存在");
|
||||
|
||||
// 房间
|
||||
RoomVO eRoomVO = roomService.selectERoomByRoomId(originalOrder.getRoomId());
|
||||
|
@ -164,14 +171,12 @@ public class OrderConverterImpl implements IOrderConverter {
|
|||
ServiceUtil.assertion(eStoreVO == null, "店铺不存在");
|
||||
|
||||
// 大门设施
|
||||
EquipmentVO equipmentVO = equipmentService.selectGate(eStoreVO.getStoreId());
|
||||
ServiceUtil.assertion(equipmentVO == null, "大门设施不存在");
|
||||
ServiceUtil.assertion(equipmentVO.getDeviceId() == null, "大门设备未绑定不存在");
|
||||
DeviceVO gate = deviceService.selectById(equipmentVO.getDeviceId());
|
||||
ServiceUtil.assertion(eStoreVO.getGateId() == null, "大门未绑定设备");
|
||||
DeviceVO gate = deviceService.selectById(eStoreVO.getGateId());
|
||||
ServiceUtil.assertion(gate == null, "店铺大门设备不存在");
|
||||
|
||||
// 商户
|
||||
UserVO merchantVO = userService.selectUserById(eStoreVO.getManagerId());
|
||||
UserVO merchantVO = userService.selectUserById(eStoreVO.getMerchantId());
|
||||
ServiceUtil.assertion(merchantVO == null, "商户不存在");
|
||||
|
||||
ServiceUtil.assertion(merchantVO.getServiceFeeProportion() == null, "商户【"+merchantVO.getUserName()+"】的平台服务费未配置");
|
||||
|
@ -193,7 +198,7 @@ public class OrderConverterImpl implements IOrderConverter {
|
|||
OrderBO orderBO = new OrderBO();
|
||||
orderBO.setReOrderDTO(order);
|
||||
orderBO.setRoom(eRoomVO);
|
||||
orderBO.setDoor(roomDoorDevice);
|
||||
orderBO.setDevice(roomDoorDevice);
|
||||
orderBO.setFeeRule(eFeeRuleVO);
|
||||
orderBO.setMerchant(merchantVO);
|
||||
orderBO.setStore(eStoreVO);
|
||||
|
@ -203,6 +208,7 @@ public class OrderConverterImpl implements IOrderConverter {
|
|||
orderBO.setOriginalOrder(originalOrder);
|
||||
orderBO.setType(order.getType());
|
||||
orderBO.setReType(ServiceConstants.ORDER_TYPE_REORDER);
|
||||
orderBO.setViewType(originalOrder.getRoomType2());
|
||||
return orderBO;
|
||||
}
|
||||
|
||||
|
|
|
@ -366,7 +366,9 @@ public class OrderServiceImpl implements IOrderService
|
|||
|
||||
@NotNull
|
||||
private PrepayResponseVO getPrepayResponseVO(OrderBO orderBO) {
|
||||
Long roomId = orderBO.getParams().getRoomId();
|
||||
Long roomId = ORDER_TYPE_REORDER.equals(orderBO.getReType())
|
||||
? orderBO.getOriginalOrder().getRoomId()
|
||||
: orderBO.getParams().getRoomId();
|
||||
String type = orderBO.getType();
|
||||
RedisLockKey key ;
|
||||
String desc = "当前预定该包间人数较多,请稍后再试";
|
||||
|
@ -551,6 +553,8 @@ public class OrderServiceImpl implements IOrderService
|
|||
// 取消时间
|
||||
String configByKey = configService.selectConfigByKey("rl.order.auto.cancel");
|
||||
order.setAutoCancelTime(DateUtils.getTimeAfterXMinutes(order.getCreateTime(),Integer.parseInt(configByKey)));
|
||||
// 校验
|
||||
ServiceUtil.assertion(orderValidator.afterAddOrder(order));
|
||||
return order;
|
||||
}
|
||||
|
||||
|
@ -591,7 +595,7 @@ public class OrderServiceImpl implements IOrderService
|
|||
order.setGateId(orderBO.getGate().getDeviceId());
|
||||
|
||||
//房间
|
||||
if(orderBO.getRoom() == null){
|
||||
if(orderBO.getViewType().equals("2")){
|
||||
order.setEquipmentId(orderBO.getEquipment().getEquipmentId());
|
||||
order.setEquipmentType(orderBO.getEquipment().getType());
|
||||
order.setEquipmentName(orderBO.getEquipment().getName());
|
||||
|
@ -599,10 +603,11 @@ public class OrderServiceImpl implements IOrderService
|
|||
order.setRoomId(orderBO.getRoom().getRoomId());
|
||||
order.setRoomName(orderBO.getRoom().getRoomName());
|
||||
order.setRoomType(orderBO.getRoom().getType());
|
||||
order.setRoomMac(orderBO.getDoor().getMac());
|
||||
order.setRoomMac2(orderBO.getDoor().getMac2());
|
||||
order.setRoomSn(orderBO.getDoor().getSn());
|
||||
order.setRoomType2(orderBO.getRoom().getType2());
|
||||
}
|
||||
order.setRoomMac(orderBO.getDevice().getMac());
|
||||
order.setRoomMac2(orderBO.getDevice().getMac2());
|
||||
order.setRoomSn(orderBO.getDevice().getSn());
|
||||
}
|
||||
|
||||
// /**
|
||||
|
@ -861,7 +866,7 @@ public class OrderServiceImpl implements IOrderService
|
|||
}else{// 用户结束订单
|
||||
rlOrder.setStatus(ORDER_STATUS_USER_FINISH);
|
||||
desc = "用户结束订单";
|
||||
operType = ORDER_OPERATION_USER_END;
|
||||
operType = ORDER_OPERATION_RETURN_END;
|
||||
rlOrder.setRefundTime(order.getRefundTime());
|
||||
rlOrder.setDepositRefund(refundAmount);
|
||||
rlOrder.setDepositRefundDesc(depositRefundDesc);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.ss.store.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -77,12 +78,12 @@ public class Store extends BaseEntity{
|
|||
@JsonFormat(pattern = "HH:mm", timezone = "GMT+8")
|
||||
@ApiModelProperty("营业起始时间")
|
||||
@NotNull(message = "营业起始时间不允许为空", groups = {ValidGroup.Create.class})
|
||||
private Date businessTimeStart;
|
||||
private LocalTime businessTimeStart;
|
||||
|
||||
@JsonFormat(pattern = "HH:mm", timezone = "GMT+8")
|
||||
@ApiModelProperty("营业结束时间")
|
||||
@NotNull(message = "营业结束时间不允许为空", groups = {ValidGroup.Create.class})
|
||||
private Date businessTimeEnd;
|
||||
private LocalTime businessTimeEnd;
|
||||
|
||||
@Excel(name = "省")
|
||||
@ApiModelProperty("省")
|
||||
|
|
Loading…
Reference in New Issue
Block a user