响铃范围
This commit is contained in:
parent
a715642ef6
commit
248a6c0a7d
|
@ -293,6 +293,22 @@ public class GeoUtils {
|
||||||
return EARTH_RADIUS * c;
|
return EARTH_RADIUS * c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BigDecimal calculateDistance(BigDecimal lat1, BigDecimal lon1, BigDecimal lat2, BigDecimal lon2) {
|
||||||
|
if (lat1 == null) {
|
||||||
|
lat1 = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
if (lon1 == null) {
|
||||||
|
lon1 = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
if (lat2 == null) {
|
||||||
|
lat2 = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
if (lon2 == null) {
|
||||||
|
lon2 = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
return BigDecimal.valueOf(calculateDistance(lat1.doubleValue(), lon1.doubleValue(), lat2.doubleValue(), lon2.doubleValue()));
|
||||||
|
}
|
||||||
|
|
||||||
public static double[][] parseJsonTrack(String jsonString) {
|
public static double[][] parseJsonTrack(String jsonString) {
|
||||||
JSONArray jsonArray = JSONArray.parseArray(jsonString);
|
JSONArray jsonArray = JSONArray.parseArray(jsonString);
|
||||||
double[][] track = new double[jsonArray.size()][2];
|
double[][] track = new double[jsonArray.size()][2];
|
||||||
|
|
|
@ -179,6 +179,15 @@ public class Area extends BaseEntity implements LogBizParam
|
||||||
@Min(value = 0, message = "运营区外断电距离不能小于0")
|
@Min(value = 0, message = "运营区外断电距离不能小于0")
|
||||||
private BigDecimal outageDistance;
|
private BigDecimal outageDistance;
|
||||||
|
|
||||||
|
@Excel(name = "用户响铃寻车范围")
|
||||||
|
@ApiModelProperty("用户响铃寻车范围(米)")
|
||||||
|
@Min(value = 0, message = "用户响铃寻车范围不能小于0")
|
||||||
|
private BigDecimal ringRadius;
|
||||||
|
|
||||||
|
@Excel(name = "响铃寻车是否必须在范围内")
|
||||||
|
@ApiModelProperty("响铃寻车是否必须在范围内")
|
||||||
|
private Boolean requiredRingRadius;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object logBizId() {
|
public Object logBizId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -46,6 +46,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ba.deleted,
|
ba.deleted,
|
||||||
ba.boundary_distance,
|
ba.boundary_distance,
|
||||||
ba.outage_distance,
|
ba.outage_distance,
|
||||||
|
ba.ring_radius,
|
||||||
|
ba.required_ring_radius,
|
||||||
su.nick_name as user_name,
|
su.nick_name as user_name,
|
||||||
su.agent_id as agent_id,
|
su.agent_id as agent_id,
|
||||||
su.user_name as user_phone,
|
su.user_name as user_phone,
|
||||||
|
@ -160,6 +162,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="boundaryDistance != null">boundary_distance,</if>
|
<if test="boundaryDistance != null">boundary_distance,</if>
|
||||||
<if test="outageDistance != null">outage_distance,</if>
|
<if test="outageDistance != null">outage_distance,</if>
|
||||||
|
<if test="ringRadius != null">ring_radius,</if>
|
||||||
|
<if test="requiredRingRadius != null">required_ring_radius,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="userId != null">#{userId},</if>
|
<if test="userId != null">#{userId},</if>
|
||||||
|
@ -196,6 +200,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="boundaryDistance != null">#{boundaryDistance},</if>
|
<if test="boundaryDistance != null">#{boundaryDistance},</if>
|
||||||
<if test="outageDistance != null">#{outageDistance},</if>
|
<if test="outageDistance != null">#{outageDistance},</if>
|
||||||
|
<if test="ringRadius != null">#{ringRadius},</if>
|
||||||
|
<if test="requiredRingRadius != null">#{requiredRingRadius},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -242,6 +248,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||||
<if test="data.boundaryDistance != null">boundary_distance = #{data.boundaryDistance},</if>
|
<if test="data.boundaryDistance != null">boundary_distance = #{data.boundaryDistance},</if>
|
||||||
<if test="data.outageDistance != null">outage_distance = #{data.outageDistance},</if>
|
<if test="data.outageDistance != null">outage_distance = #{data.outageDistance},</if>
|
||||||
|
<if test="data.ringRadius != null">ring_radius = #{data.ringRadius},</if>
|
||||||
|
<if test="data.requiredRingRadius != null">required_ring_radius = #{data.requiredRingRadius},</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<delete id="deleteAreaById" parameterType="Long">
|
<delete id="deleteAreaById" parameterType="Long">
|
||||||
|
|
|
@ -45,6 +45,8 @@ public class AreaConverterImpl implements AreaConverter {
|
||||||
po.setLatitude(data.getLatitude());
|
po.setLatitude(data.getLatitude());
|
||||||
po.setLongitude(data.getLongitude());
|
po.setLongitude(data.getLongitude());
|
||||||
po.setBoundaryStr(data.getBoundaryStr());
|
po.setBoundaryStr(data.getBoundaryStr());
|
||||||
|
po.setRingRadius(data.getRingRadius());
|
||||||
|
po.setRequiredRingRadius(data.getRequiredRingRadius());
|
||||||
|
|
||||||
return po;
|
return po;
|
||||||
}
|
}
|
||||||
|
@ -85,6 +87,9 @@ public class AreaConverterImpl implements AreaConverter {
|
||||||
po.setLatitude(data.getLatitude());
|
po.setLatitude(data.getLatitude());
|
||||||
po.setLongitude(data.getLongitude());
|
po.setLongitude(data.getLongitude());
|
||||||
po.setBoundaryStr(data.getBoundaryStr());
|
po.setBoundaryStr(data.getBoundaryStr());
|
||||||
|
po.setRingRadius(data.getRingRadius());
|
||||||
|
po.setRingRadius(data.getRingRadius());
|
||||||
|
po.setRequiredRingRadius(data.getRequiredRingRadius());
|
||||||
|
|
||||||
return po;
|
return po;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,10 @@ public class DeviceVO extends Device {
|
||||||
@ApiModelProperty("运营区营业时间(结束)")
|
@ApiModelProperty("运营区营业时间(结束)")
|
||||||
@DateTimeFormat(pattern = "HH:mm:ss")
|
@DateTimeFormat(pattern = "HH:mm:ss")
|
||||||
private LocalTime areaTimeEnd;
|
private LocalTime areaTimeEnd;
|
||||||
|
@ApiModelProperty("运营区用户响铃寻车范围")
|
||||||
|
private BigDecimal areaRingRadius;
|
||||||
|
@ApiModelProperty("运营区用户必须响铃寻车范围")
|
||||||
|
private Boolean areaRequiredRingRadius;
|
||||||
|
|
||||||
// 订单
|
// 订单
|
||||||
@ApiModelProperty("当前订单ID")
|
@ApiModelProperty("当前订单ID")
|
||||||
|
|
|
@ -59,6 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ba.status as area_status,
|
ba.status as area_status,
|
||||||
ba.area_time_start as area_time_start,
|
ba.area_time_start as area_time_start,
|
||||||
ba.area_time_end as area_time_end,
|
ba.area_time_end as area_time_end,
|
||||||
|
ba.ring_radius as area_ring_radius,
|
||||||
|
ba.required_ring_radius as area_required_ring_radius,
|
||||||
basu.point as area_user_point,
|
basu.point as area_user_point,
|
||||||
basu.nick_name as area_user_name,
|
basu.nick_name as area_user_name,
|
||||||
basu.agent_id as area_agent_id,
|
basu.agent_id as area_agent_id,
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package com.ruoyi.system.operLog.domain;
|
package com.ruoyi.system.operLog.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.annotation.Excel.ColumnType;
|
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import lombok.Data;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录表 oper_log
|
* 操作日志记录表 oper_log
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.ruoyi.web.app;
|
package com.ruoyi.web.app;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -14,7 +16,9 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.enums.LogBizType;
|
import com.ruoyi.common.enums.LogBizType;
|
||||||
|
import com.ruoyi.common.utils.MathUtils;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
|
import com.ruoyi.common.utils.map.GeoUtils;
|
||||||
import com.ruoyi.iot.constants.IotConstants;
|
import com.ruoyi.iot.constants.IotConstants;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
@ -33,7 +37,10 @@ public class AppDeviceIotController extends BaseController {
|
||||||
@ApiOperation("用户响铃寻车")
|
@ApiOperation("用户响铃寻车")
|
||||||
@PutMapping("/ring")
|
@PutMapping("/ring")
|
||||||
@Log(title = "用户响铃寻车", businessType = BusinessType.OTHER, bizIdName = "arg0", bizType = LogBizType.DEVICE)
|
@Log(title = "用户响铃寻车", businessType = BusinessType.OTHER, bizIdName = "arg0", bizType = LogBizType.DEVICE)
|
||||||
public AjaxResult ring(@RequestParam(required = false) Long id, @RequestParam(required = false) String sn) {
|
public AjaxResult ring(@RequestParam(required = false) Long id,
|
||||||
|
@RequestParam(required = false) String sn,
|
||||||
|
@RequestParam(required = false) BigDecimal lon,
|
||||||
|
@RequestParam(required = false) BigDecimal lat) {
|
||||||
DeviceVO device = null;
|
DeviceVO device = null;
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
device = deviceService.selectDeviceById(id);
|
device = deviceService.selectDeviceById(id);
|
||||||
|
@ -41,6 +48,13 @@ public class AppDeviceIotController extends BaseController {
|
||||||
device = deviceService.selectDeviceBySn(sn);
|
device = deviceService.selectDeviceBySn(sn);
|
||||||
}
|
}
|
||||||
ServiceUtil.assertion(device == null, "当前车辆不存在,无法响铃寻车");
|
ServiceUtil.assertion(device == null, "当前车辆不存在,无法响铃寻车");
|
||||||
|
|
||||||
|
if (device.getAreaRequiredRingRadius() != null && device.getAreaRequiredRingRadius()) {
|
||||||
|
BigDecimal distance = GeoUtils.calculateDistance(device.getLatitude(), device.getLongitude(), lat, lon);
|
||||||
|
ServiceUtil.assertion(MathUtils.biggerThan(distance, device.getAreaRingRadius()),
|
||||||
|
"您当前距离车辆%s米,无法响铃寻车。请距离车辆%s米以内再试", distance, device.getAreaRingRadius());
|
||||||
|
}
|
||||||
|
|
||||||
return toAjax(deviceIotService.play(device, IotConstants.PLAY_WARNING, "用户响铃寻车", true));
|
return toAjax(deviceIotService.play(device, IotConstants.PLAY_WARNING, "用户响铃寻车", true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class OrderController extends BaseController
|
||||||
/**
|
/**
|
||||||
* 退款
|
* 退款
|
||||||
*/
|
*/
|
||||||
@Log(title = "退款", businessType = BusinessType.UPDATE, bizIdName = "arg0", bizType = LogBizType.ORDER)
|
@Log(title = "订单退款", businessType = BusinessType.UPDATE, bizIdName = "arg0", bizType = LogBizType.ORDER)
|
||||||
@PreAuthorize("@ss.hasPermi('bst:order:refund')")
|
@PreAuthorize("@ss.hasPermi('bst:order:refund')")
|
||||||
@PutMapping("/refund")
|
@PutMapping("/refund")
|
||||||
public AjaxResult refund(@RequestBody @Validated OrderRefundDTO dto) {
|
public AjaxResult refund(@RequestBody @Validated OrderRefundDTO dto) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user