订单多车辆

This commit is contained in:
磷叶 2025-04-01 21:30:47 +08:00
parent 03c52195d6
commit e0afb38346
53 changed files with 1246 additions and 170 deletions

View File

@ -12,7 +12,9 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.annotation.Sensitive;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.enums.DesensitizedType;
import com.ruoyi.common.xss.Xss;
import io.swagger.annotations.ApiModelProperty;
@ -99,11 +101,17 @@ public class User extends BaseEntity
private Boolean isReal;
@ApiModelProperty("真实姓名")
@Sensitive(desensitizedType = DesensitizedType.USERNAME)
private String realName;
@ApiModelProperty("实名身份证号")
@Sensitive(desensitizedType = DesensitizedType.ID_CARD)
private String realIdCard;
@ApiModelProperty("实名手机号")
@Sensitive(desensitizedType = DesensitizedType.PHONE)
private String realPhone;
@ApiModelProperty("余额")
private BigDecimal balance;

View File

@ -65,10 +65,11 @@ public class DataScopeUtil {
/**
* Mybatis直接使用的方法
* @param deptAlias
* @param userAlias
* @param needScope
* @return
* @param deptAlias 部门别名
* @param userAlias 用户别名
* @param deptSetAlias 部门逗号分隔字段别名
* @param userSetAlias 用户逗号分隔字段别名
* @param needScope 是否需要数据隔离
*/
public static String dataScope(String deptAlias, String userAlias, String deptSetAlias, String userSetAlias, boolean needScope) {
if (needScope) {

View File

@ -330,9 +330,16 @@ public class SysLoginService
return null;
}
// 生成昵称
String nickName = "微信" + openId.substring(openId.length() - 4);
if (StringUtils.hasText(phone)) {
nickName = "用户" + phone.substring(phone.length() - 4);
}
UserVO user = new UserVO();
user.setNickName("微信" + openId.substring(openId.length() - 4));
user.setNickName(nickName);
user.setPhonenumber(phone);
user.setUserName(phone);
return transactionTemplate.execute(status -> {
int rows = userService.insertUser(user);

View File

@ -14,4 +14,7 @@ public class AreaJoinQuery extends AreaJoinVO {
@ApiModelProperty("运营商ID")
private Long mchId;
@ApiModelProperty("排除ID")
private Long excludeId;
}

View File

@ -78,4 +78,11 @@ public interface AreaJoinMapper
* @return
*/
BigDecimal selectMaxOfPoint(@Param("query") AreaJoinQuery query);
/**
* 查询数量
* @param query
* @return
*/
int selectCount(@Param("query") AreaJoinQuery query);
}

View File

@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.areaName != null and query.areaName != ''">and ba.name like concat('%', #{query.areaName}, '%')</if>
<if test="query.userPhone != null and query.userPhone != ''">and su.phonenumber like concat('%', #{query.userPhone}, '%')</if>
<if test="query.mchId != null">and ba.user_id = #{query.mchId}</if>
<if test="query.excludeId != null">and baj.id != #{query.excludeId}</if>
<if test="query.ids != null and query.ids.size() > 0">
and baj.id in
<foreach item="item" collection="query.ids" open="(" separator="," close=")">
@ -142,4 +143,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectCount" parameterType="AreaJoinQuery" resultType="Integer">
select count(baj.id)
<include refid="searchTables"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
</mapper>

View File

@ -54,9 +54,21 @@ public class AreaJoinValidatorImpl implements AreaJoinValidator {
throw new ServiceException("分成比例【" + vo.getPoint() + "】不能高于运营商【" + vo.getMchPoint() + "");
}
// TODO 判断用户是否重复绑定到一个运营区上
// 校验用户是否重复绑定到一个运营区上
this.checkRepeat(vo);
}
private void checkRepeat(AreaJoinVO vo) {
if (vo == null || vo.getUserId() == null || vo.getAreaId() == null) {
return;
}
AreaJoinQuery query = new AreaJoinQuery();
query.setUserId(vo.getUserId());
query.setAreaId(vo.getAreaId());
query.setExcludeId(vo.getId());
int count = areaJoinMapper.selectCount(query);
ServiceUtil.assertion(count > 0, "用户%s已加盟运营区%s请勿重复操作", vo.getUserId(), vo.getAreaId());
}
}

View File

@ -142,9 +142,9 @@ public class Device extends BaseEntity implements IotDevice
@ApiModelProperty("最后在线时间")
private LocalDateTime lastOnlineTime;
@Excel(name = "当前正在进行的订单ID")
@ApiModelProperty("当前正在进行的订单ID")
private Long orderId;
@Excel(name = "当前订单设备ID")
@ApiModelProperty("当前订单设备ID")
private Long orderDeviceId;
@Override
public String mac() {

View File

@ -59,12 +59,18 @@ public class DeviceVO extends Device {
@ApiModelProperty("运营区代理商名称")
private String areaAgentName;
@ApiModelProperty("当前订单ID")
private Long orderId;
@ApiModelProperty("当前订单状态")
private String orderStatus;
@ApiModelProperty("当前订单编号")
private String orderNo;
@ApiModelProperty("当前订单设备状态")
private String orderDeviceStatus;
// 剩余续航公里
public BigDecimal getRemainEndurance() {
BigDecimal remainEndurance = MathUtils.mulDecimal(getRemainingPower(), getModelFullEndurance());

View File

@ -97,8 +97,8 @@ public interface DeviceMapper
/**
* 清除设备当前订单ID
* @param id 设备ID
* @param orderId 订单ID
* @param orderDeviceId 订单设备ID
* @return 结果
*/
int clearCurrentOrder(@Param("id") Long id, @Param("orderId") Long orderId);
int clearCurrentOrderDevice(@Param("id") Long id, @Param("orderDeviceId") Long orderDeviceId);
}

View File

@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bd.is_sound,
bd.deleted,
bd.last_online_time,
bd.order_id,
bd.order_device_id,
mch.nick_name as mch_name,
mch.point as mch_point,
bm.name as model_name,
@ -60,7 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
basua.point as area_agent_point,
basua.nick_name as area_agent_name,
bo.status as order_status,
bo.no as order_no
bo.no as order_no,
bod.status as order_device_status
<include refid="searchTables"/>
</sql>
@ -71,7 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join bst_area ba on bd.area_id = ba.id
left join sys_user basu on basu.user_id = ba.user_id
left join sys_user basua on basua.user_id = basu.agent_id
left join bst_order bo on bo.id = bd.order_id
left join bst_order_device bod on bod.id = bd.order_device_id
left join bst_order bo on bo.id = bod.order_id
</sql>
<sql id="searchCondition">
@ -172,7 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="iotStatus != null">iot_status,</if>
<if test="isSound != null">is_sound,</if>
<if test="lastOnlineTime != null">last_online_time,</if>
<if test="orderId != null">order_id,</if>
<if test="orderDeviceId != null">order_device_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelId != null">#{modelId},</if>
@ -205,7 +207,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="iotStatus != null">#{iotStatus},</if>
<if test="isSound != null">#{isSound},</if>
<if test="lastOnlineTime != null">#{lastOnlineTime},</if>
<if test="orderId != null">#{orderId},</if>
<if test="orderDeviceId != null">#{orderDeviceId},</if>
</trim>
</insert>
@ -248,7 +250,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.iotStatus != null">iot_status = #{data.iotStatus},</if>
<if test="data.isSound != null">is_sound = #{data.isSound},</if>
<if test="data.lastOnlineTime != null">last_online_time = #{data.lastOnlineTime},</if>
<if test="data.orderId != null">order_id = #{data.orderId},</if>
<if test="data.orderDeviceId != null">order_device_id = #{data.orderDeviceId},</if>
</sql>
<delete id="deleteDeviceById" parameterType="Long">
@ -296,27 +298,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</update>
<!-- selectSimpleForLocationLog -->
<select id="selectSimpleForLocationLog" resultMap="DeviceResult">
select
bd.id,
bd.mac,
bd.sn,
bd.status,
bd.order_id
bod.order_id
from bst_device bd
left join bst_order_device bod on bod.id = bd.order_device_id
<where>
<include refid="searchCondition"/>
</where>
</select>
<!-- clearCurrentOrder -->
<update id="clearCurrentOrder">
<update id="clearCurrentOrderDevice">
update bst_device
set order_id = null
where id = #{id}
and order_id = #{orderId}
set order_device_id = null
where id = #{id} and order_device_id = #{orderDeviceId}
</update>
</mapper>

View File

@ -134,18 +134,18 @@ public interface DeviceService
/**
* 更新设备当前订单ID
* @param id 设备ID
* @param orderId 订单ID
* @param deviceOrderId 设备订单ID
* @return 结果
*/
public int updateCurrentOrderId(Long id, Long orderId);
public int updateCurrentDeviceOrderId(Long id, Long deviceOrderId);
/**
* 清除设备当前订单ID
* @param id 设备ID
* @param orderId 订单ID
* @param orderDeviceId 订单设备ID
* @return 结果
*/
public int clearCurrentOrder(Long id, Long orderId);
public int clearCurrentOrderDevice(Long id, Long orderDeviceId);
/**
* 根据mac更新在线状态

View File

@ -20,7 +20,7 @@ import com.ruoyi.bst.device.domain.enums.DeviceStatus;
import com.ruoyi.bst.device.mapper.DeviceMapper;
import com.ruoyi.bst.device.service.DeviceIotService;
import com.ruoyi.bst.device.utils.DeviceUtil;
import com.ruoyi.bst.order.domain.enums.OrderStatus;
import com.ruoyi.bst.orderDevice.domain.enums.OrderDeviceStatus;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
@ -108,7 +108,7 @@ public class DeviceIotServiceImpl implements DeviceIotService {
ServiceUtil.assertion(!DeviceStatus.canLock().contains(device.getStatus()), "设备%s当前状态不允许锁车", device.getSn());
// 是否有正在进行的订单
boolean hasOrder = device.getOrderId() != null && OrderStatus.inUse().contains(device.getOrderStatus());
boolean hasOrder = device.getOrderDeviceId() != null && OrderDeviceStatus.inUse().contains(device.getOrderDeviceStatus());
Integer result = transactionTemplate.execute(status -> {
// 更新设备状态

View File

@ -354,22 +354,22 @@ public class DeviceServiceImpl implements DeviceService
}
@Override
public int updateCurrentOrderId(Long id, Long orderId) {
if (id == null || orderId == null) {
public int updateCurrentDeviceOrderId(Long id, Long deviceOrderId) {
if (id == null || deviceOrderId == null) {
return 0;
}
Device data = new Device();
data.setOrderId(orderId);
data.setOrderDeviceId(deviceOrderId);
data.setId(id);
return deviceMapper.updateDevice(data);
}
@Override
public int clearCurrentOrder(Long id, Long orderId) {
if (id == null || orderId == null) {
public int clearCurrentOrderDevice(Long id, Long orderDeviceId) {
if (id == null || orderDeviceId == null) {
return 0;
}
return deviceMapper.clearCurrentOrder(id, orderId);
return deviceMapper.clearCurrentOrderDevice(id, orderDeviceId);
}
@Override

View File

@ -39,22 +39,6 @@ public class Order extends BaseEntity
@ApiModelProperty("用户ID")
private Long userId;
@Excel(name = "设备ID")
@ApiModelProperty("设备ID")
private Long deviceId;
@Excel(name = "设备MAC")
@ApiModelProperty("设备MAC")
private String deviceMac;
@Excel(name = "设备SN")
@ApiModelProperty("设备SN")
private String deviceSn;
@Excel(name = "设备车牌号")
@ApiModelProperty("设备车牌号")
private String deviceVehicleNum;
@Excel(name = "支付成功的支付单ID")
@ApiModelProperty("支付成功的支付单ID")
private Long payId;
@ -212,4 +196,8 @@ public class Order extends BaseEntity
@ApiModelProperty("结束原因")
private String endReason;
@Excel(name = "当前订单设备ID")
@ApiModelProperty("当前订单设备ID")
private Long orderDeviceId;
}

View File

@ -3,12 +3,33 @@ package com.ruoyi.bst.order.domain;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class OrderVO extends Order {
@ApiModelProperty("原始设备ID")
private Long deviceId;
@Excel(name = "原始设备MAC")
@ApiModelProperty("原始设备MAC")
private String deviceMac;
@Excel(name = "原始设备SN")
@ApiModelProperty("原始设备SN")
private String deviceSn;
@Excel(name = "原始设备车牌号")
@ApiModelProperty("原始设备车牌号")
private String deviceVehicleNum;
@Excel(name = "原始设备所属用户ID")
@ApiModelProperty("原始设备所属用户ID")
private Long deviceMchId;
@ApiModelProperty("运营区名称")
private String areaName;

View File

@ -4,6 +4,7 @@ import com.ruoyi.bst.device.domain.DeviceVO;
import com.ruoyi.bst.order.domain.Order;
import com.ruoyi.bst.order.domain.dto.OrderCreateDTO;
import com.ruoyi.bst.order.domain.vo.OrderPrePriceVO;
import com.ruoyi.bst.orderDevice.domain.OrderDevice;
import com.ruoyi.bst.suit.domain.SuitVO;
import com.ruoyi.common.core.domain.vo.UserVO;
@ -30,4 +31,6 @@ public class OrderCreateBO {
// 生成的订单
private Order order;
// 生成的订单设备
private OrderDevice orderDevice;
}

View File

@ -9,6 +9,7 @@ import com.ruoyi.bst.locationLog.domain.vo.LocationLogPositionVO;
import com.ruoyi.bst.order.domain.OrderVO;
import com.ruoyi.bst.order.domain.dto.OrderEndDTO;
import com.ruoyi.bst.order.domain.vo.OrderInParkingVO;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceVO;
import lombok.Data;
@ -17,7 +18,10 @@ public class OrderEndBO {
// 原始参数
private OrderEndDTO dto;
// 设备
// 当前订单设备
private OrderDeviceVO orderDevice;
// 当前设备
private DeviceVO device;
// 运营区数据

View File

@ -14,7 +14,7 @@ public enum OrderStatus {
WAIT_PAY("WAIT_PAY", "待支付"),
PROCESSING("PROCESSING", "进行中"),
FINISHED("FINISHED", "已结束"),
CANCEL("CANCEL", "已取消"),
CANCELED("CANCELED", "已取消"),
WAIT_VERIFY("WAIT_VERIFY", "待审核"),
REFUNDED("REFUNDED", "已退款");
@ -46,4 +46,14 @@ public enum OrderStatus {
public static List<String> canRefund() {
return CollectionUtils.map(OrderStatus::getCode, FINISHED, REFUNDED);
}
// 未支付的订单状态
public static List<String> unPayList() {
return CollectionUtils.map(OrderStatus::getCode, WAIT_PAY);
}
// 可以取消支付的订单状态
public static List<String> canCancelPay() {
return CollectionUtils.map(OrderStatus::getCode, WAIT_PAY);
}
}

View File

@ -16,10 +16,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bo.suit_type,
bo.area_id,
bo.user_id,
bo.device_id,
bo.device_mac,
bo.device_sn,
bo.device_vehicle_num,
bo.pay_id,
bo.total_fee,
bo.deposit_fee,
@ -57,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bo.start_area_sub_name,
bo.end_area_sub_name,
bo.end_reason,
bo.order_device_id,
ba.name as area_name,
su.nick_name as user_name,
su.phonenumber as user_phone,
@ -65,13 +62,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.refunding as pay_refunding,
bp.pay_time as pay_time,
bp.channel_name as pay_channel_name,
bd.remaining_power as device_remaining_power,
bd.lock_status as device_lock_status
bod.device_id,
bod.device_mac,
bod.device_sn,
bod.device_vehicle_num,
bod.device_mch_id
from bst_order bo
left join bst_area ba on bo.area_id = ba.id
left join sys_user su on bo.user_id = su.user_id
left join bst_pay bp on bo.pay_id = bp.id
left join bst_device bd on bo.device_id = bd.id
left join bst_order_device bod on bod.id = bo.order_device_id
</sql>
<sql id="searchCondition">
@ -104,7 +104,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.endAreaSubName != null and query.endAreaSubName != ''"> and bo.end_area_sub_name like concat('%', #{query.endAreaSubName}, '%')</if>
<if test="query.maxTimeStart != null"> and bo.max_time &gt;= #{query.maxTimeStart}</if>
<if test="query.maxTimeEnd != null"> and bo.max_time &lt;= #{query.maxTimeEnd}</if>
<if test="query.deviceMchId != null "> and bo.device_mch_id = #{query.deviceMchId}</if>
<if test="query.endReason != null and query.endReason != ''"> and bo.end_reason like concat('%', #{query.endReason}, '%')</if>
<if test="query.orderDeviceId != null "> and bo.order_device_id = #{query.orderDeviceId}</if>
<if test="query.createDateRange != null and query.createDateRange.size() > 1">
and date(bo.create_time) &gt;= #{query.createDateRange[0]}
and date(bo.create_time) &lt;= #{query.createDateRange[1]}
@ -136,10 +138,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="suitType != null and suitType != ''">suit_type,</if>
<if test="areaId != null">area_id,</if>
<if test="userId != null">user_id,</if>
<if test="deviceId != null">device_id,</if>
<if test="deviceMac != null">device_mac,</if>
<if test="deviceSn != null">device_sn,</if>
<if test="deviceVehicleNum != null">device_vehicle_num,</if>
<if test="payId != null">pay_id,</if>
<if test="totalFee != null">total_fee,</if>
<if test="depositFee != null">deposit_fee,</if>
@ -177,16 +175,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="startAreaSubName != null">start_area_sub_name,</if>
<if test="endAreaSubName != null">end_area_sub_name,</if>
<if test="endReason != null">end_reason,</if>
<if test="orderDeviceId != null">order_device_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="no != null and no != ''">#{no},</if>
<if test="suitType != null and suitType != ''">#{suitType},</if>
<if test="areaId != null">#{areaId},</if>
<if test="userId != null">#{userId},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="deviceMac != null">#{deviceMac},</if>
<if test="deviceSn != null">#{deviceSn},</if>
<if test="deviceVehicleNum != null">#{deviceVehicleNum},</if>
<if test="payId != null">#{payId},</if>
<if test="totalFee != null">#{totalFee},</if>
<if test="depositFee != null">#{depositFee},</if>
@ -224,6 +219,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="startAreaSubName != null">#{startAreaSubName},</if>
<if test="endAreaSubName != null">#{endAreaSubName},</if>
<if test="endReason != null">#{endReason},</if>
<if test="orderDeviceId != null">#{orderDeviceId},</if>
</trim>
</insert>
@ -240,10 +236,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.suitType != null and data.suitType != ''">suit_type = #{data.suitType},</if>
<if test="data.areaId != null">area_id = #{data.areaId},</if>
<if test="data.userId != null">user_id = #{data.userId},</if>
<if test="data.deviceId != null">device_id = #{data.deviceId},</if>
<if test="data.deviceMac != null">device_mac = #{data.deviceMac},</if>
<if test="data.deviceSn != null">device_sn = #{data.deviceSn},</if>
<if test="data.deviceVehicleNum != null">device_vehicle_num = #{data.deviceVehicleNum},</if>
<if test="data.payId != null">pay_id = #{data.payId},</if>
<if test="data.totalFee != null">total_fee = #{data.totalFee},</if>
<if test="data.depositFee != null">deposit_fee = #{data.depositFee},</if>
@ -281,6 +273,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.startAreaSubName != null">start_area_sub_name = #{data.startAreaSubName},</if>
<if test="data.endAreaSubName != null">end_area_sub_name = #{data.endAreaSubName},</if>
<if test="data.endReason != null">end_reason = #{data.endReason},</if>
<if test="data.orderDeviceId != null">order_device_id = #{data.orderDeviceId},</if>
</sql>
<delete id="deleteOrderById" parameterType="Long">

View File

@ -108,7 +108,13 @@ public interface OrderService
* @param id 订单ID
* @return 结果
*/
public int cancelOrder(Long id);
public int cancelOrder(Long id, String remark);
/**
* 取消过期订单
* @param order 订单
*/
public void cancelWhenExpired(Order order);
/**
* 支付订单
@ -154,4 +160,12 @@ public interface OrderService
* @return 结果
*/
public int closeDevice(OrderVO order, boolean requiredIot);
/**
* 更新订单设备ID
* @param id 订单ID
* @param orderDeviceId 订单设备ID
* @return 结果
*/
public int updateOrderDeviceId(Long id, Long orderDeviceId);
}

View File

@ -35,6 +35,11 @@ import com.ruoyi.bst.order.domain.vo.OrderPrePriceVO;
import com.ruoyi.bst.order.service.OrderConverter;
import com.ruoyi.bst.order.service.OrderService;
import com.ruoyi.bst.order.utils.OrderUtil;
import com.ruoyi.bst.orderDevice.domain.OrderDevice;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceVO;
import com.ruoyi.bst.orderDevice.domain.enums.OrderDeviceStatus;
import com.ruoyi.bst.orderDevice.domain.enums.OrderDeviceType;
import com.ruoyi.bst.orderDevice.service.OrderDeviceService;
import com.ruoyi.bst.suit.domain.SuitVO;
import com.ruoyi.bst.suit.domain.enums.SuitType;
import com.ruoyi.bst.suit.service.SuitService;
@ -82,6 +87,9 @@ public class OrderConverterImpl implements OrderConverter{
@Autowired
private LocationLogService locationLogService;
@Autowired
private OrderDeviceService orderDeviceService;
@Override
public OrderPrePriceVO toOrderPrePriceVO(OrderCalcPrePriceDTO dto) {
if (dto == null) {
@ -120,9 +128,35 @@ public class OrderConverterImpl implements OrderConverter{
Order order = this.generateOrder(bo);
bo.setOrder(order);
// 生成订单设备
OrderDevice orderDevice = this.generateOrderDevice(bo);
bo.setOrderDevice(orderDevice);
return bo;
}
// 生成订单设备
private OrderDevice generateOrderDevice(OrderCreateBO bo) {
if (bo == null) {
return null;
}
OrderDevice orderDevice = new OrderDevice();
// 设备
DeviceVO device = bo.getDevice();
orderDevice.setType(OrderDeviceType.ORIGINAL.getCode());
orderDevice.setStatus(OrderDeviceStatus.WAIT_USE.getCode());
if (device != null) {
orderDevice.setDeviceId(device.getId());
orderDevice.setDeviceMac(device.getMac());
orderDevice.setDeviceSn(device.getSn());
orderDevice.setDeviceVehicleNum(device.getVehicleNum());
orderDevice.setDeviceMchId(device.getMchId());
}
return orderDevice;
}
// 生成订单
private Order generateOrder(OrderCreateBO bo) {
if (bo == null) {
@ -141,11 +175,7 @@ public class OrderConverterImpl implements OrderConverter{
// 设备信息
DeviceVO device = bo.getDevice();
if (device != null) {
order.setDeviceId(device.getId());
order.setAreaId(device.getAreaId());
order.setDeviceMac(device.getMac());
order.setDeviceSn(device.getSn());
order.setDeviceVehicleNum(device.getVehicleNum());
}
// 套餐信息
@ -259,28 +289,31 @@ public class OrderConverterImpl implements OrderConverter{
bo.setOrder(order);
if (order != null) {
// 获取设备信息
DeviceVO device = deviceService.selectDeviceById(order.getDeviceId());
deviceIotService.refresh(device, null);
bo.setDevice(device);
// 获取当前订单设备
OrderDeviceVO orderDevice = orderDeviceService.selectOrderDeviceById(order.getOrderDeviceId());
bo.setOrderDevice(orderDevice);
if (device != null) {
// 查询运营区
AreaVO area = areaService.selectAreaById(device.getAreaId());
bo.setArea(area);
if (area != null) {
// 查询运营区的可还车的子区域列表
List<AreaSubVO> areaSubList = areaSubService.selectParkingAreaByAreaId(area.getId());
bo.setParkingAreaSubList(areaSubList);
// 停车点信息
OrderInParkingVO inParkingVO = OrderUtil.getInParkingVO(area, areaSubList, device, dto.getLon(), dto.getLat());
bo.setInParkingVO(inParkingVO);
}
if (orderDevice != null) {
// 获取当前设备信息
DeviceVO device = deviceService.selectDeviceById(orderDevice.getDeviceId());
deviceIotService.refresh(device, null);
bo.setDevice(device);
}
// 查询运营区
AreaVO area = areaService.selectAreaById(order.getAreaId());
bo.setArea(area);
if (area != null) {
// 查询运营区的可还车的子区域列表
List<AreaSubVO> areaSubList = areaSubService.selectParkingAreaByAreaId(area.getId());
bo.setParkingAreaSubList(areaSubList);
}
// 停车点信息
OrderInParkingVO inParkingVO = OrderUtil.getInParkingVO(area, bo.getParkingAreaSubList(), bo.getDevice(), dto.getLon(), dto.getLat());
bo.setInParkingVO(inParkingVO);
// 查询订单车辆轨迹列表
List<LocationLogPositionVO> positionList = locationLogService.selectPositionListByOrderId(order.getId());
bo.setPositionList(positionList);

View File

@ -6,15 +6,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import com.ruoyi.bst.device.domain.DeviceVO;
import com.ruoyi.bst.device.service.DeviceIotService;
import com.ruoyi.bst.device.service.DeviceService;
import com.ruoyi.bst.order.domain.Order;
import com.ruoyi.bst.order.domain.OrderQuery;
import com.ruoyi.bst.order.domain.OrderVO;
import com.ruoyi.bst.order.domain.enums.OrderStatus;
import com.ruoyi.bst.order.mapper.OrderMapper;
import com.ruoyi.bst.order.service.OrderService;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceVO;
import com.ruoyi.bst.orderDevice.service.OrderDeviceService;
import com.ruoyi.bst.pay.domain.PayVO;
import com.ruoyi.bst.pay.domain.enums.PayBstType;
import com.ruoyi.bst.pay.interfaces.PayHandler;
@ -30,14 +29,11 @@ public class OrderPayHandlerImpl implements PayHandler {
@Autowired
private OrderMapper orderMapper;
@Autowired
private DeviceIotService deviceIotService;
@Autowired
private TransactionTemplate transactionTemplate;
@Autowired
private DeviceService deviceService;
private OrderDeviceService orderDeviceService;
// 支付成功后操作
@Override
@ -50,9 +46,9 @@ public class OrderPayHandlerImpl implements PayHandler {
OrderVO order = orderService.selectOrderById(pay.getBstId());
ServiceUtil.assertion(order == null, "ID为%s的订单不存在", pay.getBstId());
// 查询设备
DeviceVO device = deviceService.selectDeviceById(order.getDeviceId());
ServiceUtil.assertion(device == null, "ID为%s的设备不存在", order.getDeviceId());
// 查询订单设备
OrderDeviceVO orderDevice = orderDeviceService.selectOriginByOrderId(order.getId());
ServiceUtil.assertion(orderDevice == null, "ID为%s的订单设备不存在", order.getId());
LocalDateTime startTime = LocalDateTime.now();
@ -69,9 +65,9 @@ public class OrderPayHandlerImpl implements PayHandler {
int rows = orderMapper.updateByQuery(data, query);
ServiceUtil.assertion(rows != 1, "更新ID为%s的订单失败", order.getId());
// 操作设备解锁
int unlock = deviceIotService.unlock(device, false, "订单支付成功:" + order.getNo(), false);
ServiceUtil.assertion(unlock <= 0, "解锁ID为%s的设备失败", device.getId());
// 开始使用订单设备
int start = orderDeviceService.start(orderDevice, false);
ServiceUtil.assertion(start != 1, "开始使用ID为%s的订单设备失败", orderDevice.getId());
return rows;
});
@ -79,13 +75,6 @@ public class OrderPayHandlerImpl implements PayHandler {
return result != null && result == 1;
}
// 支付单关单后操作
@Override
public boolean onClose(PayVO pay) {
// TODO
return true;
}
// 支付单退款后操作啥也不用做
@Override
public boolean onRefundSuccess(RefundVO refund) {

View File

@ -44,8 +44,11 @@ import com.ruoyi.bst.order.service.OrderConverter;
import com.ruoyi.bst.order.service.OrderService;
import com.ruoyi.bst.order.service.OrderValidator;
import com.ruoyi.bst.order.utils.OrderUtil;
import com.ruoyi.bst.orderDevice.domain.OrderDevice;
import com.ruoyi.bst.orderDevice.service.OrderDeviceService;
import com.ruoyi.bst.pay.domain.Pay;
import com.ruoyi.bst.pay.domain.dto.PayRefundDTO;
import com.ruoyi.bst.pay.domain.enums.PayBstType;
import com.ruoyi.bst.pay.domain.vo.DoPayVO;
import com.ruoyi.bst.pay.service.PayConverter;
import com.ruoyi.bst.pay.service.PayService;
@ -109,6 +112,9 @@ public class OrderServiceImpl implements OrderService
@Autowired
private AreaSubService areaSubService;
@Autowired
private OrderDeviceService orderDeviceService;
/**
* 查询订单
*
@ -215,15 +221,20 @@ public class OrderServiceImpl implements OrderService
// 创建订单
Order order = bo.getOrder();
int rows = this.insertOrder(order);
if (rows != 1) {
return null;
}
ServiceUtil.assertion(rows != 1, "创建订单失败");
// 查询订单
OrderVO vo = this.selectOrderByNo(order.getNo());
ServiceUtil.assertion(vo == null, "创建订单失败");
// 创建订单设备
OrderDevice orderDevice = bo.getOrderDevice();
orderDevice.setOrderId(vo.getId());
int orderDeviceRows = orderDeviceService.insertOrderDevice(orderDevice);
ServiceUtil.assertion(orderDeviceRows != 1, "创建订单设备失败");
// 更新设备当前订单ID
int updateDevice = deviceService.updateCurrentOrderId(bo.getDevice().getId(), vo.getId());
int updateDevice = deviceService.updateCurrentDeviceOrderId(bo.getDevice().getId(), orderDevice.getId());
ServiceUtil.assertion(updateDevice != 1, "更新设备当前订单ID失败");
// 加入延时队列超时取消
@ -248,7 +259,8 @@ public class OrderServiceImpl implements OrderService
}
// 加入延时队列超时取消
private void cancelWhenExpired(Order order) {
@Override
public void cancelWhenExpired(Order order) {
if (order == null || order.getPayExpireTime() == null) {
return;
}
@ -261,19 +273,52 @@ public class OrderServiceImpl implements OrderService
scheduledExecutorService.schedule(() -> {
// 尝试取消订单
this.cancelOrder(order.getId());
this.cancelOrder(order.getId(), "订单超时取消");
}, delay, TimeUnit.SECONDS);
}
// TODO 取消订单
// 取消订单
@Override
public int cancelOrder(Long id) {
public int cancelOrder(Long id, String remark) {
if (id == null) {
return 0;
}
// TODO
return 0;
// 查询订单
OrderVO order = this.selectOrderById(id);
ServiceUtil.assertion(order == null, "ID为%s的订单不存在", id);
ServiceUtil.assertion(!OrderStatus.canCancelPay().contains(order.getStatus()), "ID为%s的订单当前状态不允许取消", id);
// 刷新支付结果
if (order.getPayNo() != null) {
payService.refreshPayResult(order.getPayNo());
}
// 查询最新订单状态
order = this.selectOrderById(id);
ServiceUtil.assertion(order == null, "ID为%s的订单不存在", id);
ServiceUtil.assertion(!OrderStatus.canCancelPay().contains(order.getStatus()), "ID为%s的订单当前状态不允许取消", id);
// 取消订单
Integer result = transactionTemplate.execute(status -> {
// 更新订单状态
Order data = new Order();
data.setStatus(OrderStatus.CANCELED.getCode());
data.setCancelRemark(remark);
OrderQuery query = new OrderQuery();
query.setId(id);
query.setStatusList(OrderStatus.canCancelPay());
int rows = orderMapper.updateByQuery(data, query);
ServiceUtil.assertion(rows != 1, "ID为%s的订单取消失败状态已发生变化", id);
// 取消支付单
boolean cancelPay = payService.closeByBstId(PayBstType.ORDER.getType(), id);
ServiceUtil.assertion(!cancelPay, "ID为%s的订单取消支付单失败", id);
return rows;
});
return result == null ? 0 : result;
}
@ -316,7 +361,6 @@ public class OrderServiceImpl implements OrderService
OrderVO order = bo.getOrder();
OrderInParkingVO inParkingVO = bo.getInParkingVO();
AreaVO area = bo.getArea();
DeviceVO device = bo.getDevice();
// 设置订单数据
order.setEndTime(LocalDateTime.now()); // 结束时间
@ -370,13 +414,9 @@ public class OrderServiceImpl implements OrderService
ServiceUtil.assertion(!after, "订单完成处理失败");
}
// 清除设备当前订单ID
int clear = deviceService.clearCurrentOrder(device.getId(), order.getId());
ServiceUtil.assertion(clear != 1, "清除设备当前订单ID失败");
// 设备上锁必须放最后因为会操作设备
int lock = deviceIotService.lock(device.getId(), false, "订单结束:" + order.getNo(), false);
ServiceUtil.assertion(lock != 1, "设备上锁失败");
// 结束订单设备
int finish = orderDeviceService.finish(bo.getOrderDevice(), false);
ServiceUtil.assertion(finish != 1, "结束订单设备失败");
return rows;
});
@ -504,4 +544,15 @@ public class OrderServiceImpl implements OrderService
return deviceIotService.lock(order.getDeviceId(), false, "订单锁车:" + order.getNo(), requiredIot);
}
@Override
public int updateOrderDeviceId(Long id, Long orderDeviceId) {
if (id == null || orderDeviceId == null) {
return 0;
}
Order order = new Order();
order.setId(id);
order.setOrderDeviceId(orderDeviceId);
return orderMapper.updateOrder(order);
}
}

View File

@ -21,6 +21,7 @@ import com.ruoyi.bst.order.domain.vo.OrderPrePriceVO;
import com.ruoyi.bst.order.service.OrderValidator;
import com.ruoyi.bst.order.utils.OrderUtil;
import com.ruoyi.bst.suit.domain.SuitVO;
import com.ruoyi.common.constants.ServiceCode;
import com.ruoyi.common.core.domain.vo.UserVO;
import com.ruoyi.common.utils.MathUtils;
import com.ruoyi.common.utils.ServiceUtil;
@ -52,7 +53,9 @@ public class OrderValidatorImpl implements OrderValidator{
// 用户
UserVO user = bo.getUser();
ServiceUtil.assertion(user == null, "ID为%s的用户不存在", dto.getUserId());
// TODO 实名认证
boolean needRealName = device.getAreaAuthentication() != null && device.getAreaAuthentication();
boolean isReal = user.getIsReal() != null && user.getIsReal();
ServiceUtil.assertion(needRealName && !isReal, "用户%s未实名认证", user.getNickName(), ServiceCode.USER_NOT_REAL_NAME);
// 价格
OrderPrePriceVO prePrice = bo.getPrePrice();

View File

@ -107,6 +107,9 @@ public class OrderUtil {
* @return
*/
public static OrderInParkingVO getInParkingVO(AreaVO area, List<AreaSubVO> areaSubList, DeviceVO device, BigDecimal lon, BigDecimal lat) {
if (area == null || areaSubList == null || device == null) {
return null;
}
OrderInParkingVO vo = new OrderInParkingVO();
// 通过设备定位获取所在区域

View File

@ -0,0 +1,76 @@
package com.ruoyi.bst.orderDevice.domain;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 订单设备对象 bst_order_device
*
* @author ruoyi
* @date 2025-04-01
*/
@Data
public class OrderDevice extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long id;
@Excel(name = "订单ID")
@ApiModelProperty("订单ID")
private Long orderId;
@Excel(name = "设备ID")
@ApiModelProperty("设备ID")
private Long deviceId;
@Excel(name = "类型", readConverterExp = "1=原始车辆,2=替换车辆")
@ApiModelProperty("类型")
private String type;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("开始时间")
private LocalDateTime startTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("结束时间")
private LocalDateTime endTime;
@Excel(name = "换车原因")
@ApiModelProperty("换车原因")
private String reason;
@Excel(name = "对应故障ID")
@ApiModelProperty("对应故障ID")
private Long faultId;
@Excel(name = "状态")
@ApiModelProperty("状态")
private String status;
@Excel(name = "设备MAC")
@ApiModelProperty("设备MAC")
private String deviceMac;
@Excel(name = "设备SN")
@ApiModelProperty("设备SN")
private String deviceSn;
@Excel(name = "设备车牌号")
@ApiModelProperty("设备车牌号")
private String deviceVehicleNum;
@Excel(name = "设备所属用户ID")
@ApiModelProperty("设备所属用户ID")
private Long deviceMchId;
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.bst.orderDevice.domain;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class OrderDeviceQuery extends OrderDeviceVO {
@ApiModelProperty("状态列表")
private List<String> statusList;
}

View File

@ -0,0 +1,12 @@
package com.ruoyi.bst.orderDevice.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class OrderDeviceVO extends OrderDevice{
@ApiModelProperty("订单编号")
private String orderNo;
}

View File

@ -0,0 +1,44 @@
package com.ruoyi.bst.orderDevice.domain.enums;
import java.util.List;
import com.ruoyi.common.utils.collection.CollectionUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum OrderDeviceStatus {
WAIT_USE("WAIT_USE", "待使用"),
USING("USING", "使用中"),
FINISHED("FINISHED", "已完成");
private String code;
private String name;
/**
* 允许开始的订单设备状态
* @return
*/
public static List<String> canStart() {
return CollectionUtils.map(OrderDeviceStatus::getCode, WAIT_USE);
}
/**
* 允许结束的订单设备状态
* @return
*/
public static List<String> canFinish() {
return CollectionUtils.map(OrderDeviceStatus::getCode, USING);
}
/**
* 在使用的订单设备状态
* @return
*/
public static List<String> inUse() {
return CollectionUtils.map(OrderDeviceStatus::getCode, USING);
}
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.bst.orderDevice.domain.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum OrderDeviceType {
ORIGINAL("1", "原始车辆"),
REPLACE("2", "替换车辆");
private String code;
private String name;
}

View File

@ -0,0 +1,74 @@
package com.ruoyi.bst.orderDevice.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.bst.orderDevice.domain.OrderDevice;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceQuery;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceVO;
/**
* 订单设备Mapper接口
*
* @author ruoyi
* @date 2025-04-01
*/
public interface OrderDeviceMapper
{
/**
* 查询订单设备
*
* @param id 订单设备主键
* @return 订单设备
*/
OrderDeviceVO selectOrderDeviceById(Long id);
/**
* 查询订单设备列表
*
* @param query 订单设备
* @return 订单设备集合
*/
List<OrderDeviceVO> selectOrderDeviceList(@Param("query")OrderDeviceQuery query);
/**
* 新增订单设备
*
* @param orderDevice 订单设备
* @return 结果
*/
int insertOrderDevice(OrderDevice orderDevice);
/**
* 修改订单设备
*
* @param orderDevice 订单设备
* @return 结果
*/
public int updateOrderDevice(@Param("data") OrderDevice orderDevice);
/**
* 删除订单设备
*
* @param id 订单设备主键
* @return 结果
*/
int deleteOrderDeviceById(Long id);
/**
* 批量删除订单设备
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteOrderDeviceByIds(Long[] ids);
/**
* 根据条件更新订单设备
* @param data 订单设备
* @param query 查询条件
* @return 结果
*/
int updateByQuery(@Param("data") OrderDevice data, @Param("query") OrderDeviceQuery query);
}

View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.bst.orderDevice.mapper.OrderDeviceMapper">
<resultMap type="OrderDeviceVO" id="OrderDeviceResult" autoMapping="true"/>
<sql id="selectOrderDeviceVo">
select
bod.id,
bod.order_id,
bod.device_id,
bod.type,
bod.start_time,
bod.end_time,
bod.reason,
bod.fault_id,
bod.status,
bod.device_mac,
bod.device_sn,
bod.device_vehicle_num,
bod.device_mch_id,
bo.no as order_no
from bst_order_device bod
left join bst_order bo on bo.id = bod.order_id
</sql>
<sql id="searchCondition">
<if test="query.id != null "> and bod.id = #{query.id}</if>
<if test="query.orderId != null "> and bod.order_id = #{query.orderId}</if>
<if test="query.deviceId != null "> and bod.device_id = #{query.deviceId}</if>
<if test="query.type != null and query.type != ''"> and bod.type = #{query.type}</if>
<if test="query.reason != null and query.reason != ''"> and bod.reason like concat('%', #{query.reason}, '%')</if>
<if test="query.faultId != null "> and bod.fault_id = #{query.faultId}</if>
<if test="query.status != null and query.status != ''"> and bod.status = #{query.status}</if>
<if test="query.deviceMac != null and query.deviceMac != ''"> and bod.device_mac like concat('%', #{query.deviceMac}, '%')</if>
<if test="query.deviceSn != null and query.deviceSn != ''"> and bod.device_sn like concat('%', #{query.deviceSn}, '%')</if>
<if test="query.deviceVehicleNum != null and query.deviceVehicleNum != ''"> and bod.device_vehicle_num like concat('%', #{query.deviceVehicleNum}, '%')</if>
<if test="query.deviceMchId != null "> and bod.device_mch_id = #{query.deviceMchId}</if>
<if test="query.statusList != null and query.statusList.size() > 0">
and bod.status in
<foreach item="item" collection="query.statusList" separator="," open="(" close=")">
#{item}
</foreach>
</if>
${query.params.dataScope}
</sql>
<select id="selectOrderDeviceList" parameterType="OrderDeviceQuery" resultMap="OrderDeviceResult">
<include refid="selectOrderDeviceVo"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<select id="selectOrderDeviceById" parameterType="Long" resultMap="OrderDeviceResult">
<include refid="selectOrderDeviceVo"/>
where bod.id = #{id}
</select>
<insert id="insertOrderDevice" parameterType="OrderDevice" useGeneratedKeys="true" keyProperty="id">
insert into bst_order_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="orderId != null">order_id,</if>
<if test="deviceId != null">device_id,</if>
<if test="type != null and type != ''">type,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="reason != null and reason != ''">reason,</if>
<if test="faultId != null">fault_id,</if>
<if test="status != null and status != ''">status,</if>
<if test="deviceMac != null and deviceMac != ''">device_mac,</if>
<if test="deviceSn != null and deviceSn != ''">device_sn,</if>
<if test="deviceVehicleNum != null and deviceVehicleNum != ''">device_vehicle_num,</if>
<if test="deviceMchId != null">device_mch_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="orderId != null">#{orderId},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="reason != null and reason != ''">#{reason},</if>
<if test="faultId != null">#{faultId},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="deviceMac != null and deviceMac != ''">#{deviceMac},</if>
<if test="deviceSn != null and deviceSn != ''">#{deviceSn},</if>
<if test="deviceVehicleNum != null and deviceVehicleNum != ''">#{deviceVehicleNum},</if>
<if test="deviceMchId != null">#{deviceMchId},</if>
</trim>
</insert>
<update id="updateOrderDevice" parameterType="OrderDevice">
update bst_order_device
<trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/>
</trim>
where id = #{data.id}
</update>
<sql id="updateColumns">
<if test="data.orderId != null">order_id = #{data.orderId},</if>
<if test="data.deviceId != null">device_id = #{data.deviceId},</if>
<if test="data.type != null and data.type != ''">type = #{data.type},</if>
<if test="data.startTime != null">start_time = #{data.startTime},</if>
<if test="data.endTime != null">end_time = #{data.endTime},</if>
<if test="data.reason != null and data.reason != ''">reason = #{data.reason},</if>
<if test="data.faultId != null">fault_id = #{data.faultId},</if>
<if test="data.status != null and data.status != ''">status = #{data.status},</if>
<if test="data.deviceMac != null and data.deviceMac != ''">device_mac = #{data.deviceMac},</if>
<if test="data.deviceSn != null and data.deviceSn != ''">device_sn = #{data.deviceSn},</if>
<if test="data.deviceVehicleNum != null and data.deviceVehicleNum != ''">device_vehicle_num = #{data.deviceVehicleNum},</if>
<if test="data.deviceMchId != null">device_mch_id = #{data.deviceMchId},</if>
</sql>
<delete id="deleteOrderDeviceById" parameterType="Long">
delete from bst_order_device where id = #{id}
</delete>
<delete id="deleteOrderDeviceByIds" parameterType="String">
delete from bst_order_device where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- updateByQuery -->
<update id="updateByQuery">
update bst_order_device bod
<trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/>
</trim>
<where>
<include refid="searchCondition"/>
</where>
</update>
</mapper>

View File

@ -0,0 +1,98 @@
package com.ruoyi.bst.orderDevice.service;
import java.util.List;
import com.ruoyi.bst.orderDevice.domain.OrderDevice;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceQuery;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceVO;
/**
* 订单设备Service接口
*
* @author ruoyi
* @date 2025-04-01
*/
public interface OrderDeviceService
{
/**
* 查询订单设备
*
* @param id 订单设备主键
* @return 订单设备
*/
public OrderDeviceVO selectOrderDeviceById(Long id);
/**
* 查询订单设备列表
*
* @param orderDevice 订单设备
* @return 订单设备集合
*/
public List<OrderDeviceVO> selectOrderDeviceList(OrderDeviceQuery orderDevice);
/**
* 新增订单设备
*
* @param orderDevice 订单设备
* @return 结果
*/
public int insertOrderDevice(OrderDevice orderDevice);
/**
* 修改订单设备
*
* @param orderDevice 订单设备
* @return 结果
*/
public int updateOrderDevice(OrderDevice orderDevice);
/**
* 批量删除订单设备
*
* @param ids 需要删除的订单设备主键集合
* @return 结果
*/
public int deleteOrderDeviceByIds(Long[] ids);
/**
* 删除订单设备信息
*
* @param id 订单设备主键
* @return 结果
*/
public int deleteOrderDeviceById(Long id);
/**
* 根据订单ID查询原始设备
*
* @param id 订单ID
* @return 订单设备
*/
public OrderDeviceVO selectOriginByOrderId(Long orderId);
/**
* 开始使用订单设备
*
* @param orderDevice 订单设备
* @param requiredIot Iot是否强制成功
* @return 结果
*/
public int start(OrderDeviceVO orderDevice, boolean requiredIot);
/**
* 根据订单ID查询订单设备列表
*
* @param id 订单ID
* @return 订单设备列表
*/
public List<OrderDeviceVO> selectOrderDeviceListByOrderId(Long orderId);
/**
* 结束订单设备
*
* @param orderDevice 订单设备
* @param requiredIot Iot是否强制成功
* @return 结果
*/
public int finish(OrderDeviceVO orderDevice, boolean requiredIot);
}

View File

@ -0,0 +1,212 @@
package com.ruoyi.bst.orderDevice.service.impl;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import com.github.pagehelper.PageHelper;
import com.ruoyi.bst.device.service.DeviceIotService;
import com.ruoyi.bst.device.service.DeviceService;
import com.ruoyi.bst.order.service.OrderService;
import com.ruoyi.bst.orderDevice.domain.OrderDevice;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceQuery;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceVO;
import com.ruoyi.bst.orderDevice.domain.enums.OrderDeviceStatus;
import com.ruoyi.bst.orderDevice.domain.enums.OrderDeviceType;
import com.ruoyi.bst.orderDevice.mapper.OrderDeviceMapper;
import com.ruoyi.bst.orderDevice.service.OrderDeviceService;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.collection.CollectionUtils;
/**
* 订单设备Service业务层处理
*
* @author ruoyi
* @date 2025-04-01
*/
@Service
public class OrderDeviceServiceImpl implements OrderDeviceService
{
@Autowired
private OrderDeviceMapper orderDeviceMapper;
@Autowired
private DeviceIotService deviceIotService;
@Autowired
private TransactionTemplate transactionTemplate;
@Autowired
private DeviceService deviceService;
@Autowired
private OrderService orderService;
/**
* 查询订单设备
*
* @param id 订单设备主键
* @return 订单设备
*/
@Override
public OrderDeviceVO selectOrderDeviceById(Long id)
{
return orderDeviceMapper.selectOrderDeviceById(id);
}
/**
* 查询订单设备列表
*
* @param orderDevice 订单设备
* @return 订单设备
*/
@Override
public List<OrderDeviceVO> selectOrderDeviceList(OrderDeviceQuery orderDevice)
{
return orderDeviceMapper.selectOrderDeviceList(orderDevice);
}
/**
* 新增订单设备
*
* @param orderDevice 订单设备
* @return 结果
*/
@Override
public int insertOrderDevice(OrderDevice orderDevice)
{
return orderDeviceMapper.insertOrderDevice(orderDevice);
}
/**
* 修改订单设备
*
* @param orderDevice 订单设备
* @return 结果
*/
@Override
public int updateOrderDevice(OrderDevice orderDevice)
{
return orderDeviceMapper.updateOrderDevice(orderDevice);
}
/**
* 批量删除订单设备
*
* @param ids 需要删除的订单设备主键
* @return 结果
*/
@Override
public int deleteOrderDeviceByIds(Long[] ids)
{
return orderDeviceMapper.deleteOrderDeviceByIds(ids);
}
/**
* 删除订单设备信息
*
* @param id 订单设备主键
* @return 结果
*/
@Override
public int deleteOrderDeviceById(Long id)
{
return orderDeviceMapper.deleteOrderDeviceById(id);
}
/**
* 根据订单ID查询原始设备
*
* @param id 订单ID
* @return 订单设备
*/
@Override
public OrderDeviceVO selectOriginByOrderId(Long orderId) {
if (orderId == null) {
return null;
}
OrderDeviceQuery query = new OrderDeviceQuery();
query.setOrderId(orderId);
query.setType(OrderDeviceType.ORIGINAL.getCode());
return selectOne(query);
}
private OrderDeviceVO selectOne(OrderDeviceQuery query) {
PageHelper.startPage(1, 1);
List<OrderDeviceVO> list = orderDeviceMapper.selectOrderDeviceList(query);
return CollectionUtils.firstElement(list);
}
@Override
public int start(OrderDeviceVO orderDevice, boolean requiredIot) {
ServiceUtil.assertion(orderDevice == null, "订单设备不能为空");
ServiceUtil.assertion(!OrderDeviceStatus.canStart().contains(orderDevice.getStatus()), "订单设备状态不允许开始");
Integer result = transactionTemplate.execute(status -> {
// 修改订单设备状态
OrderDevice data = new OrderDevice();
data.setStatus(OrderDeviceStatus.USING.getCode());
data.setStartTime(LocalDateTime.now());
OrderDeviceQuery query = new OrderDeviceQuery();
query.setId(orderDevice.getId());
query.setStatusList(OrderDeviceStatus.canStart());
int rows = orderDeviceMapper.updateByQuery(data, query);
// 修改订单信息
int updateOrder = orderService.updateOrderDeviceId(orderDevice.getOrderId(), orderDevice.getId());
ServiceUtil.assertion(updateOrder != 1, "更新订单信息失败");
// 操作设备解锁
if (rows > 0) {
int unlock = deviceIotService.unlock(orderDevice.getDeviceId(), false, "订单开锁:" + orderDevice.getOrderNo(), requiredIot);
ServiceUtil.assertion(unlock <= 0, "解锁ID为%s的设备失败", orderDevice.getDeviceId());
}
return rows;
});
return result == null ? 0 : result;
}
@Override
public List<OrderDeviceVO> selectOrderDeviceListByOrderId(Long orderId) {
if (orderId == null) {
return null;
}
OrderDeviceQuery query = new OrderDeviceQuery();
query.setOrderId(orderId);
return orderDeviceMapper.selectOrderDeviceList(query);
}
@Override
public int finish(OrderDeviceVO orderDevice, boolean requiredIot) {
ServiceUtil.assertion(orderDevice == null, "订单设备不能为空");
ServiceUtil.assertion(!OrderDeviceStatus.canFinish().contains(orderDevice.getStatus()), "订单设备状态不允许结束");
Integer result = transactionTemplate.execute(status -> {
// 修改状态
OrderDevice data = new OrderDevice();
data.setStatus(OrderDeviceStatus.FINISHED.getCode());
data.setEndTime(LocalDateTime.now());
OrderDeviceQuery query = new OrderDeviceQuery();
query.setId(orderDevice.getId());
query.setStatusList(OrderDeviceStatus.canFinish());
int rows = orderDeviceMapper.updateByQuery(data, query);
// 清除设备当前订单设备ID
int clear = deviceService.clearCurrentOrderDevice(orderDevice.getDeviceId(), orderDevice.getId());
ServiceUtil.assertion(clear != 1, "清除设备当前订单ID失败");
// 设备上锁必须放最后因为会操作设备
int lock = deviceIotService.lock(orderDevice.getDeviceId(), false, "订单上锁:" + orderDevice.getOrderNo(), requiredIot);
ServiceUtil.assertion(lock != 1, "设备上锁失败");
return rows;
});
return result == null ? 0 : result;
}
}

View File

@ -39,6 +39,11 @@ public enum PayStatus {
return asList(PAYED, REFUNDED);
}
// 未支付的状态
public static List<String> unPayList() {
return asList(WAIT_PAY, PAYING);
}
// 允许退款的状态
public static List<String> canRefund() {
return payedList();

View File

@ -92,4 +92,11 @@ public interface PayMapper
* @return 结果
*/
int recordRefundAmount(@Param("id") Long id, @Param("amount") BigDecimal amount);
/**
* 查询支付单号列表
* @param query
* @return
*/
List<String> selectNoList(@Param("query") PayQuery query);
}

View File

@ -183,4 +183,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} and refunding - #{amount} >= 0
</update>
<!-- selectNoList -->
<select id="selectNoList" parameterType="PayQuery" resultType="String">
select bp.no
from bst_pay bp
<where>
<include refid="searchCondition"/>
</where>
</select>
</mapper>

View File

@ -106,4 +106,10 @@ public interface PayService
* @return
*/
int refund(PayRefundDTO dto);
/**
* 刷新支付结果
*/
void refreshPayResultBeforeExpire(String no);
}

View File

@ -353,6 +353,7 @@ public class PayServiceImpl implements PayService {
return vo;
}
@Override
public void refreshPayResultBeforeExpire(String no) {
if (StringUtils.isBlank(no)) {
return;

View File

@ -8,6 +8,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import javax.validation.constraints.NotBlank;
/**
* 实名认证信息对象 bst_real_name
*
@ -27,10 +29,12 @@ public class RealName extends BaseEntity
@Excel(name = "用户姓名")
@ApiModelProperty("用户姓名")
@NotBlank(message = "用户姓名不允许为空")
private String userName;
@Excel(name = "身份证")
@ApiModelProperty("身份证")
@NotBlank(message = "身份证不允许为空")
private String idCard;
@Excel(name = "人脸图像")
@ -43,6 +47,7 @@ public class RealName extends BaseEntity
@Excel(name = "手机号")
@ApiModelProperty("手机号")
@NotBlank(message = "手机号不允许为空")
private String mobile;
@Excel(name = "实名认证状态:0-未实名 1-已实名")

View File

@ -1,18 +1,25 @@
package com.ruoyi.bst.realName.service.impl;
import java.time.Instant;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import com.ruoyi.bst.realName.domain.RealName;
import com.ruoyi.bst.realName.domain.RealNameQuery;
import com.ruoyi.bst.realName.domain.RealNameVO;
import com.ruoyi.bst.realName.domain.Face.Face;
import com.ruoyi.bst.realName.domain.Refresh.RealNameRefreshVO;
import com.ruoyi.bst.realName.domain.enums.RealNameStatus;
import com.ruoyi.bst.realName.mapper.RealNameMapper;
import com.ruoyi.bst.realName.service.RealNameService;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.domain.entity.User;
import com.ruoyi.common.core.domain.vo.UserVO;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil;
@ -27,20 +34,7 @@ import com.ruoyi.common.valid.liveness.LivenessResponseQueryData;
import com.ruoyi.common.valid.liveness.LivenessResponseTokenData;
import com.ruoyi.common.valid.liveness.LivenessUtils;
import com.ruoyi.common.valid.liveness.enums.LivenessQueryResult;
import com.ruoyi.system.user.mapper.UserMapper;
import com.ruoyi.system.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bst.realName.mapper.RealNameMapper;
import com.ruoyi.bst.realName.domain.RealName;
import com.ruoyi.bst.realName.domain.RealNameVO;
import com.ruoyi.bst.realName.domain.RealNameQuery;
import com.ruoyi.bst.realName.service.RealNameService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import static net.sf.jsqlparser.parser.feature.Feature.insert;
import static net.sf.jsqlparser.parser.feature.Feature.use;
/**
* 实名认证信息Service业务层处理
@ -174,9 +168,6 @@ public class RealNameServiceImpl implements RealNameService
public RealNameVO realName(RealName realName) {
UserVO user = userService.selectUserById(realName.getUserId());
ServiceUtil.assertion(user == null,"用户信息不存在");
ServiceUtil.assertion(StringUtils.isBlank(realName.getUserName()), "用户姓名不允许为空");
ServiceUtil.assertion(StringUtils.isBlank(realName.getIdCard()), "用户身份证不允许为空");
Boolean flag = realNameMapper.checkIdCard(realName.getIdCard());
ServiceUtil.assertion(flag,"用户身份证重复");
@ -185,8 +176,6 @@ public class RealNameServiceImpl implements RealNameService
LivenessResponseTokenData tokenData = LivenessUtils.getToken(LIVENESS_RETURN_URL, null, null);
ServiceUtil.assertion(tokenData == null || StringUtils.isBlank(tokenData.getToken()), "获取活体检测token失败");
// 存入缓存:10分钟
String cacheKey = CacheConstants.LIVENESS_TOKEN + realName.getUserId();
Face face = new Face();
@ -202,7 +191,6 @@ public class RealNameServiceImpl implements RealNameService
vo.setFaceToken(tokenData.getToken());
vo.setJumpUrl(LivenessUtils.JUMP_URL + "?token=" + tokenData.getToken());
return vo;
}
/**
@ -272,7 +260,7 @@ public class RealNameServiceImpl implements RealNameService
data.setUserId(realName.getUserId());
data.setRealName(realName.getUserName());
data.setRealIdCard(realName.getIdCard());
data.setPhonenumber(realName.getMobile());
data.setRealPhone(realName.getMobile());
data.setIsReal(true);
// 数据库操作

View File

@ -0,0 +1,10 @@
package com.ruoyi.common.constants;
/**
* 业务状态码
*/
public class ServiceCode {
// 用户未实名
public static final Integer USER_NOT_REAL_NAME = 10001;
}

View File

@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
u.is_real,
u.real_name,
u.real_id_card,
u.real_phone,
u.balance,
d.dept_id,
d.parent_id,
@ -128,6 +129,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="realIdCard != null and realIdCard != ''">
and u.real_id_card like concat('%', #{realIdCard}, '%')
</if>
<if test="realPhone != null and realPhone != ''">
and u.real_phone like concat('%', #{realPhone}, '%')
</if>
<if test="appId != null">
and u.user_id in (
select user_id from bst_user_app where app_id = #{appId}
@ -268,6 +272,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isReal != null">is_real,</if>
<if test="realName != null and realName != ''">real_name,</if>
<if test="realIdCard != null and realIdCard != ''">real_id_card,</if>
<if test="realPhone != null and realPhone != ''">real_phone,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
@ -288,6 +293,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isReal != null">#{isReal},</if>
<if test="realName != null and realName != ''">#{realName},</if>
<if test="realIdCard != null and realIdCard != ''">#{realIdCard},</if>
<if test="realPhone != null and realPhone != ''">#{realPhone},</if>
sysdate()
)
</insert>
@ -314,6 +320,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isReal != null">is_real = #{isReal},</if>
<if test="realName != null and realName != ''">real_name = #{realName},</if>
<if test="realIdCard != null and realIdCard != ''">real_id_card = #{realIdCard},</if>
<if test="realPhone != null and realPhone != ''">real_phone = #{realPhone},</if>
update_time = sysdate()
</set>
where user_id = #{userId}

View File

@ -4,12 +4,15 @@ import java.time.LocalDateTime;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import com.ruoyi.bst.order.domain.OrderQuery;
import com.ruoyi.bst.order.domain.OrderVO;
import com.ruoyi.bst.order.domain.dto.OrderEndDTO;
import com.ruoyi.bst.order.domain.enums.OrderStatus;
import com.ruoyi.bst.order.mapper.OrderMapper;
import com.ruoyi.bst.order.service.OrderService;
import com.ruoyi.common.utils.collection.CollectionUtils;
@ -17,11 +20,31 @@ import lombok.extern.slf4j.Slf4j;
@Component
@Slf4j
public class OrderTask {
public class OrderTask implements ApplicationRunner {
@Autowired
private OrderService orderService;
@Autowired
private OrderMapper orderMapper;
@Override
public void run(ApplicationArguments args) throws Exception {
// 查询所有未支付的订单
OrderQuery query = new OrderQuery();
query.setStatusList(OrderStatus.unPayList());
List<OrderVO> orderList = orderMapper.selectOrderList(query);
for (OrderVO order : orderList) {
try {
orderService.cancelWhenExpired(order);
} catch (Exception e) {
log.error("取消订单失败订单ID{}", order.getId(), e);
}
}
}
/**
* 关闭超过最大可用时间的订单
*/

View File

@ -0,0 +1,51 @@
package com.ruoyi.task.pay;
import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import com.ruoyi.bst.pay.domain.PayQuery;
import com.ruoyi.bst.pay.domain.enums.PayStatus;
import com.ruoyi.bst.pay.mapper.PayMapper;
import com.ruoyi.bst.pay.service.PayService;
import lombok.extern.slf4j.Slf4j;
@Component
@Slf4j
public class PayTask implements ApplicationRunner {
@Autowired
private PayService payService;
@Autowired
private PayMapper payMapper;
@Autowired
private ScheduledExecutorService scheduledExecutorService;
@Override
public void run(ApplicationArguments args) throws Exception {
// 查询所有未支付的支付单
PayQuery query = new PayQuery();
query.setStatusList(PayStatus.unPayList());
List<String> payList = payMapper.selectNoList(query);
log.info("查询到{}条未支付的支付单", payList.size());
for (String no : payList) {
scheduledExecutorService.schedule(() -> {
try {
payService.refreshPayResultBeforeExpire(no);
} catch (Exception e) {
log.error("刷新支付结果失败,支付单号:{}", no, e);
}
}, 0, TimeUnit.SECONDS);
}
}
}

View File

@ -2,7 +2,6 @@ package com.ruoyi.web.app;
import java.util.List;
import com.ruoyi.bst.order.domain.vo.OrderFeeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
@ -19,6 +18,7 @@ import com.ruoyi.bst.order.domain.dto.OrderCreateDTO;
import com.ruoyi.bst.order.domain.dto.OrderEndDTO;
import com.ruoyi.bst.order.domain.dto.OrderPayDTO;
import com.ruoyi.bst.order.domain.enums.OrderStatus;
import com.ruoyi.bst.order.domain.vo.OrderFeeVO;
import com.ruoyi.bst.order.domain.vo.OrderPrePriceVO;
import com.ruoyi.bst.order.service.OrderConverter;
import com.ruoyi.bst.order.service.OrderService;

View File

@ -24,7 +24,6 @@ public class AppRealNameController extends BaseController {
return success(realNameService.realName(realName));
}
@ApiOperation("刷新用户实名认证结果")
@GetMapping("/refreshRealName")
public AjaxResult refreshRealName() {

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;

View File

@ -0,0 +1,110 @@
package com.ruoyi.web.bst;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.bst.orderDevice.domain.OrderDevice;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceQuery;
import com.ruoyi.bst.orderDevice.domain.OrderDeviceVO;
import com.ruoyi.bst.orderDevice.service.OrderDeviceService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* 订单设备Controller
*
* @author ruoyi
* @date 2025-04-01
*/
@RestController
@RequestMapping("/bst/orderDevice")
public class OrderDeviceController extends BaseController
{
@Autowired
private OrderDeviceService orderDeviceService;
/**
* 查询订单设备列表
*/
@PreAuthorize("@ss.hasPermi('bst:orderDevice:list')")
@GetMapping("/list")
public TableDataInfo list(OrderDeviceQuery query)
{
startPage();
startOrderBy();
List<OrderDeviceVO> list = orderDeviceService.selectOrderDeviceList(query);
return getDataTable(list);
}
/**
* 导出订单设备列表
*/
@PreAuthorize("@ss.hasPermi('bst:orderDevice:export')")
@Log(title = "订单设备", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OrderDeviceQuery query)
{
List<OrderDeviceVO> list = orderDeviceService.selectOrderDeviceList(query);
ExcelUtil<OrderDeviceVO> util = new ExcelUtil<OrderDeviceVO>(OrderDeviceVO.class);
util.exportExcel(response, list, "订单设备数据");
}
/**
* 获取订单设备详细信息
*/
@PreAuthorize("@ss.hasPermi('bst:orderDevice:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(orderDeviceService.selectOrderDeviceById(id));
}
/**
* 新增订单设备
*/
@PreAuthorize("@ss.hasPermi('bst:orderDevice:add')")
@Log(title = "订单设备", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody OrderDevice orderDevice)
{
return toAjax(orderDeviceService.insertOrderDevice(orderDevice));
}
/**
* 修改订单设备
*/
@PreAuthorize("@ss.hasPermi('bst:orderDevice:edit')")
@Log(title = "订单设备", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody OrderDevice orderDevice)
{
return toAjax(orderDeviceService.updateOrderDevice(orderDevice));
}
/**
* 删除订单设备
*/
@PreAuthorize("@ss.hasPermi('bst:orderDevice:remove')")
@Log(title = "订单设备", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(orderDeviceService.deleteOrderDeviceByIds(ids));
}
}

View File

@ -3,13 +3,13 @@ package com.ruoyi.web.common;
import java.util.List;
import java.util.Set;
import com.ruoyi.common.annotation.Anonymous;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.Menu;

View File

@ -41,3 +41,7 @@ ruoyi:
pay:
# 支付回调主机地址
notifyHost: https://60.215.128.117:49553
# 活体检测
liveness:
returnUrl: http://192.168.2.99:4100/liveness

View File

@ -148,7 +148,6 @@ liveness:
appCode: 32b6c6445b1a42ed862dd4202392c47d
appSecret: td0vlGZRy9GxlrpinlrxSXFXVW34JxDh
jumpUrl: https://liveness.shumaidata.com/index
returnUrl: https://market.aliyun.com/apimarket/detail/cmapi00064393?spm=5176.730005.result.10.2271414a01R1ZI#sku=yuncode5839300001
# 人像比对
face:
appKey: 204590328