This commit is contained in:
磷叶 2025-04-30 11:47:57 +08:00
parent 06c3157d6b
commit f26dd92ba9
5 changed files with 52 additions and 1 deletions

View File

@ -96,5 +96,9 @@ public interface OrderValidator {
* @return 是否超时
*/
boolean isTimeout(OrderVO order);
/**
* 是否是用户
*/
boolean isUser(Long orderId, Long userId);
}

View File

@ -236,4 +236,10 @@ public class OrderValidatorImpl implements OrderValidator{
public boolean isTimeout(OrderVO order) {
return order != null && order.getMaxTime() != null && order.getMaxTime().isBefore(LocalDateTime.now());
}
@Override
public boolean isUser(Long orderId, Long userId) {
OrderVO order = orderMapper.selectOrderById(orderId);
return isUser(order, userId);
}
}

View File

@ -22,6 +22,7 @@ public class RefundConverterImpl implements RefundConverter{
refund.setReason(dto.getRefundReason());
refund.setUserId(dto.getUserId());
refund.setUserName(dto.getUserName());
refund.setType(dto.getType());
return refund;
}
}

View File

@ -50,6 +50,7 @@ public class AppDeviceIotController extends BaseController {
ServiceUtil.assertion(device == null, "当前车辆不存在,无法响铃寻车");
if (device.getAreaRequiredRingRadius() != null && device.getAreaRequiredRingRadius()) {
ServiceUtil.assertion(lon == null || lat == null, "请开启定位后重试");
BigDecimal distance = GeoUtils.calculateDistance(device.getLatitude(), device.getLongitude(), lat, lon);
ServiceUtil.assertion(MathUtils.biggerThan(distance, device.getAreaRingRadius()),
"您当前距离车辆%s米无法响铃寻车。请距离车辆%s米以内再试", distance, device.getAreaRingRadius());

View File

@ -1,12 +1,51 @@
package com.ruoyi.web.app;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.bst.locationLog.domain.LocationLogQuery;
import com.ruoyi.bst.locationLog.domain.LocationLogVO;
import com.ruoyi.bst.locationLog.service.LocationLogService;
import com.ruoyi.bst.order.service.OrderValidator;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/app/locationLog")
public class AppLocationLogController extends BaseController {
@Autowired
private LocationLogService locationLogService;
@Autowired
private OrderValidator orderValidator;
private boolean canView(Long orderId) {
return orderValidator.isUser(orderId, getUserId());
}
@ApiOperation("根据订单ID查询定位日志")
@GetMapping("/allByOrder")
public AjaxResult getAllByOrder(Long orderId) {
if (orderId == null) {
return error("订单ID不允许为空");
}
if (!canView(orderId)) {
return error("您无权查看ID为" + orderId + "的订单轨迹");
}
LocationLogQuery query = new LocationLogQuery();
query.setOrderId(orderId);
List<LocationLogVO> list = locationLogService.selectLocationLogList(query);
return success(list);
}
}