提交更新
This commit is contained in:
parent
6336f41a79
commit
62cef22f1f
|
@ -113,4 +113,8 @@ public class CacheConstants
|
|||
* 设备运营区处理状态
|
||||
*/
|
||||
public static final String DEVICE_AREA_HANDLE_KEY = "device_area_handle_key:";
|
||||
/**
|
||||
* 所有硬件版本名称
|
||||
*/
|
||||
public static final String ALL_HARDWARE_VERSION_NAME = "all_hardware_version_name";
|
||||
}
|
||||
|
|
|
@ -115,10 +115,12 @@ public class Area extends BaseEntity
|
|||
|
||||
@Excel(name = "停车点外调度费")
|
||||
@ApiModelProperty("停车点外调度费")
|
||||
@Min(value = 0, message = "停车点外调度费不能小于0")
|
||||
private BigDecimal dispatchFee;
|
||||
|
||||
@Excel(name = "运营区外调度费")
|
||||
@ApiModelProperty("运营区外调度费")
|
||||
@Min(value = 0, message = "运营区外调度费不能小于0")
|
||||
private BigDecimal vehicleManagementFee;
|
||||
|
||||
@Excel(name = "运营开始时间")
|
||||
|
@ -163,9 +165,11 @@ public class Area extends BaseEntity
|
|||
|
||||
@Excel(name = "靠近边界播报距离")
|
||||
@ApiModelProperty("靠近边界播报距离(米)")
|
||||
@Min(value = 0, message = "靠近边界播报距离不能小于0")
|
||||
private BigDecimal boundaryDistance;
|
||||
|
||||
@Excel(name = "运营区外断电距离")
|
||||
@ApiModelProperty("运营区外断电距离(米)")
|
||||
@Min(value = 0, message = "运营区外断电距离不能小于0")
|
||||
private BigDecimal outageDistance;
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!-- selectIdByQuery -->
|
||||
|
||||
<select id="selectIdByQuery" resultType="Long">
|
||||
select ba.id from bst_area ba
|
||||
select ba.id from <include refid="searchTables"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
|
|
|
@ -85,4 +85,11 @@ public interface AreaSubService
|
|||
* @return 子区域列表
|
||||
*/
|
||||
public List<AreaSubVO> selectNoRidingListByAreaId(Long areaId);
|
||||
|
||||
/**
|
||||
* 查询运营区的禁停区列表
|
||||
* @param areaId 运营区ID
|
||||
* @return 子区域列表
|
||||
*/
|
||||
public List<AreaSubVO> selectNoParkingAreaByAreaId(Long areaId);
|
||||
}
|
||||
|
|
|
@ -211,6 +211,24 @@ public class AreaSubServiceImpl implements AreaSubService
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaSubVO> selectNoParkingAreaByAreaId(Long areaId) {
|
||||
if (areaId == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
String key = CacheConstants.NO_PARKING_AREA_SUB_LIST + areaId;
|
||||
List<AreaSubVO> list = redisCache.getCacheObject(key);
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
AreaSubQuery query = new AreaSubQuery();
|
||||
query.setAreaId(areaId);
|
||||
query.setStatus(AreaSubStatus.ENABLED.getCode());
|
||||
query.setType(AreaSubType.NO_PARKING.getCode());
|
||||
list = areaSubMapper.selectAreaSubList(query);
|
||||
redisCache.setCacheObject(key, list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void clearCache(Long areaId) {
|
||||
if (areaId == null) {
|
||||
return;
|
||||
|
|
|
@ -74,6 +74,12 @@ public class DeviceVO extends Device {
|
|||
@ApiModelProperty("当前订单用户ID")
|
||||
private Long orderUserId;
|
||||
|
||||
@ApiModelProperty("硬件版本")
|
||||
private String hardwareVersion;
|
||||
|
||||
@ApiModelProperty("硬件版本说明")
|
||||
private String hardwareVersionInstructions;
|
||||
|
||||
// 剩余续航(公里)
|
||||
public BigDecimal getRemainEndurance() {
|
||||
BigDecimal remainEndurance = MathUtils.mulDecimal(getRemainingPower(), getModelFullEndurance());
|
||||
|
|
|
@ -63,7 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bo.no as order_no,
|
||||
bo.user_id as order_user_id,
|
||||
bod.status as order_device_status,
|
||||
bod.order_id as order_id
|
||||
bod.order_id as order_id,
|
||||
bhv.version as hardware_version,
|
||||
bhv.instructions as hardware_version_instructions
|
||||
from <include refid="searchTables"/>
|
||||
</sql>
|
||||
|
||||
|
@ -76,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join sys_user basua on basua.user_id = basu.agent_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
|
||||
left join bst_hardware_version bhv on bhv.id = bd.hardware_version_id
|
||||
</sql>
|
||||
|
||||
<sql id="searchCondition">
|
||||
|
|
|
@ -157,5 +157,10 @@ public interface DeviceService
|
|||
*/
|
||||
public int transfer(List<DeviceVO> deviceList, Long areaId);
|
||||
|
||||
/**
|
||||
* 获取可用车辆
|
||||
*/
|
||||
public DeviceVO selectAvaliableDevice(Long id, String sn);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -133,7 +133,14 @@ public class DeviceIotServiceImpl implements DeviceIotService {
|
|||
|
||||
if (rows > 0) {
|
||||
// 发送命令锁车
|
||||
CommandResponse res = iotService.lock(device, SUB_SLOW, reason);
|
||||
CommandResponse res = null;
|
||||
if (DeviceStatus.TEMP_LOCKED.getCode().equals(device.getStatus())) {
|
||||
// 临时锁车
|
||||
res = iotService.tempLock(device, SUB_SLOW, reason);
|
||||
} else {
|
||||
// 锁车
|
||||
res = iotService.lock(device, SUB_SLOW, reason);
|
||||
}
|
||||
ServiceUtil.assertion(requiredIot && !IotUtil.isSuccess(res), IotUtil.getMsg(res));
|
||||
}
|
||||
|
||||
|
|
|
@ -450,4 +450,19 @@ public class DeviceServiceImpl implements DeviceService
|
|||
query.setIds(ids);
|
||||
return deviceMapper.updateByQuery(data, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceVO selectAvaliableDevice(Long id, String sn) {
|
||||
if (id == null && StringUtils.isBlank(sn)) {
|
||||
return null;
|
||||
}
|
||||
DeviceQuery query = new DeviceQuery();
|
||||
query.setStatus(DeviceStatus.AVAILABLE.getCode());
|
||||
if (id != null) {
|
||||
query.setId(id);
|
||||
} else if (StringUtils.hasText(sn)) {
|
||||
query.setEqSn(sn);
|
||||
}
|
||||
return this.selectOne(query);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package com.ruoyi.bst.hardwareVersion.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
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_hardware_version
|
||||
*
|
||||
|
@ -34,10 +35,10 @@ public class HardwareVersion extends BaseEntity
|
|||
@ApiModelProperty("版本号")
|
||||
private String version;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "生产时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "生产时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("生产时间")
|
||||
private Date productionTime;
|
||||
private LocalDateTime productionTime;
|
||||
|
||||
@Excel(name = "数量")
|
||||
@ApiModelProperty("数量")
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.ruoyi.bst.hardwareVersion.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardwareVersionNameVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long parentId;
|
||||
|
||||
private String version;
|
||||
|
||||
private String instructions;
|
||||
}
|
|
@ -1,11 +1,14 @@
|
|||
package com.ruoyi.bst.hardwareVersion.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersion;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionVO;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionQuery;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersion;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionQuery;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionVO;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.vo.HardwareVersionNameVO;
|
||||
|
||||
/**
|
||||
* 硬件版本Mapper接口
|
||||
*
|
||||
|
@ -85,4 +88,9 @@ public interface HardwareVersionMapper
|
|||
*/
|
||||
int countUnBoundNum(Long id);
|
||||
|
||||
/**
|
||||
* 查询硬件版本名称
|
||||
*/
|
||||
List<HardwareVersionNameVO> selectNameList(@Param("query") HardwareVersionQuery query);
|
||||
|
||||
}
|
||||
|
|
|
@ -275,4 +275,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- selectNameList -->
|
||||
|
||||
<select id="selectNameList" resultType="HardwareVersionNameVO">
|
||||
select
|
||||
bhv.id,
|
||||
bhv.parent_id,
|
||||
bhv.version,
|
||||
bhv.instructions
|
||||
from bst_hardware_version bhv
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.ruoyi.bst.hardwareVersion.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersion;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionVO;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionQuery;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionVO;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.vo.HardwareVersionNameVO;
|
||||
|
||||
/**
|
||||
* 硬件版本Service接口
|
||||
|
@ -53,13 +55,13 @@ public interface HardwareVersionService
|
|||
*/
|
||||
public int deleteHardwareVersionByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除硬件版本信息
|
||||
*
|
||||
* @param id 硬件版本主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHardwareVersionById(Long id);
|
||||
|
||||
List<HardwareVersionVO> computeNumber(HardwareVersionQuery query);
|
||||
|
||||
/**
|
||||
* 查询所有硬件版本名称
|
||||
* @return
|
||||
*/
|
||||
public List<HardwareVersionNameVO> selectAllNames();
|
||||
|
||||
}
|
||||
|
|
|
@ -2,16 +2,19 @@ package com.ruoyi.bst.hardwareVersion.service.impl;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.hardwareVersion.domain.enums.SelectCondition;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.bst.hardwareVersion.mapper.HardwareVersionMapper;
|
||||
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersion;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionVO;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionQuery;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionVO;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.vo.HardwareVersionNameVO;
|
||||
import com.ruoyi.bst.hardwareVersion.mapper.HardwareVersionMapper;
|
||||
import com.ruoyi.bst.hardwareVersion.service.HardwareVersionService;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
||||
/**
|
||||
* 硬件版本Service业务层处理
|
||||
|
@ -25,6 +28,9 @@ public class HardwareVersionServiceImpl implements HardwareVersionService
|
|||
@Autowired
|
||||
private HardwareVersionMapper hardwareVersionMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 查询硬件版本
|
||||
*
|
||||
|
@ -59,7 +65,11 @@ public class HardwareVersionServiceImpl implements HardwareVersionService
|
|||
public int insertHardwareVersion(HardwareVersion hardwareVersion)
|
||||
{
|
||||
hardwareVersion.setCreateTime(DateUtils.getNowDate());
|
||||
return hardwareVersionMapper.insertHardwareVersion(hardwareVersion);
|
||||
int rows = hardwareVersionMapper.insertHardwareVersion(hardwareVersion);
|
||||
if (rows > 0) {
|
||||
this.clearCache();
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +81,11 @@ public class HardwareVersionServiceImpl implements HardwareVersionService
|
|||
@Override
|
||||
public int updateHardwareVersion(HardwareVersion hardwareVersion)
|
||||
{
|
||||
return hardwareVersionMapper.updateHardwareVersion(hardwareVersion);
|
||||
int rows = hardwareVersionMapper.updateHardwareVersion(hardwareVersion);
|
||||
if (rows > 0) {
|
||||
this.clearCache();
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,20 +97,13 @@ public class HardwareVersionServiceImpl implements HardwareVersionService
|
|||
@Override
|
||||
public int deleteHardwareVersionByIds(Long[] ids)
|
||||
{
|
||||
return hardwareVersionMapper.deleteHardwareVersionByIds(ids);
|
||||
int rows = hardwareVersionMapper.deleteHardwareVersionByIds(ids);
|
||||
if (rows > 0) {
|
||||
this.clearCache();
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除硬件版本信息
|
||||
*
|
||||
* @param id 硬件版本主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteHardwareVersionById(Long id)
|
||||
{
|
||||
return hardwareVersionMapper.deleteHardwareVersionById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HardwareVersionVO> computeNumber(HardwareVersionQuery query) {
|
||||
|
@ -138,4 +145,22 @@ public class HardwareVersionServiceImpl implements HardwareVersionService
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HardwareVersionNameVO> selectAllNames() {
|
||||
String key = CacheConstants.ALL_HARDWARE_VERSION_NAME;
|
||||
List<HardwareVersionNameVO> list = redisCache.getCacheObject(key);
|
||||
if (CollectionUtils.isEmptyElement(list)){
|
||||
list = hardwareVersionMapper.selectNameList(new HardwareVersionQuery());
|
||||
if (CollectionUtils.isNotEmptyElement(list)){
|
||||
redisCache.setCacheObject(key, list);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void clearCache() {
|
||||
String key = CacheConstants.ALL_HARDWARE_VERSION_NAME;
|
||||
redisCache.deleteObject(key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ public class Model extends BaseEntity
|
|||
|
||||
@Excel(name = "骑行低电量提醒")
|
||||
@ApiModelProperty("骑行低电量提醒")
|
||||
@Min(value = 0, message = "骑行低电量提醒不能小于0")
|
||||
private Integer lowBatteryReminder;
|
||||
|
||||
@ApiModelProperty("套餐ID列表")
|
||||
|
|
|
@ -33,8 +33,11 @@ public class OrderChangeBO {
|
|||
// 运营区
|
||||
private AreaVO area;
|
||||
|
||||
// 运营区子区域列表
|
||||
private List<AreaSubVO> areaSubs;
|
||||
// 运营区停车区列表
|
||||
private List<AreaSubVO> parkingList;
|
||||
|
||||
// 运营区禁停区列表
|
||||
private List<AreaSubVO> noParkingAreaSubList;
|
||||
|
||||
// 旧设备是否在停车点内
|
||||
private OrderInParkingVO inParkingVO;
|
||||
|
|
|
@ -28,7 +28,10 @@ public class OrderEndBO {
|
|||
private AreaVO area;
|
||||
|
||||
// 停车点数据
|
||||
private List<AreaSubVO> parkingAreaSubList;
|
||||
private List<AreaSubVO> parkingList;
|
||||
|
||||
// 禁停点数据
|
||||
private List<AreaSubVO> noParkingList;
|
||||
|
||||
// 停车点信息
|
||||
private OrderInParkingVO inParkingVO;
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.ruoyi.bst.order.domain.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 订单设备临时锁车DTO
|
||||
*/
|
||||
@Data
|
||||
public class OrderCloseDeviceDTO {
|
||||
|
||||
// 订单ID
|
||||
@NotNull(message = "订单ID不允许为空")
|
||||
private Long orderId;
|
||||
|
||||
// 手机定位经度
|
||||
private BigDecimal lon;
|
||||
|
||||
// 手机定位纬度
|
||||
private BigDecimal lat;
|
||||
|
||||
// iot
|
||||
private Boolean requiredIot;
|
||||
|
||||
}
|
|
@ -10,13 +10,13 @@ import lombok.Data;
|
|||
@Data
|
||||
public class OrderInParkingVO {
|
||||
|
||||
@ApiModelProperty("手机定位所在区域")
|
||||
@ApiModelProperty("手机定位所在停车区")
|
||||
private AreaSubVO mobileAreaSub;
|
||||
|
||||
@ApiModelProperty("设备定位所在区域")
|
||||
@ApiModelProperty("设备定位所在停车区")
|
||||
private AreaSubVO deviceAreaSub;
|
||||
|
||||
@ApiModelProperty("实际所在区域")
|
||||
@ApiModelProperty("实际所在停车区")
|
||||
private AreaSubVO actualAreaSub;
|
||||
|
||||
@ApiModelProperty("实际经度")
|
||||
|
@ -37,4 +37,13 @@ public class OrderInParkingVO {
|
|||
@ApiModelProperty("是否在运营区")
|
||||
private Boolean inArea;
|
||||
|
||||
@ApiModelProperty("手机所在禁停区")
|
||||
private AreaSubVO mobileNoParking;
|
||||
|
||||
@ApiModelProperty("设备所在禁停区")
|
||||
private AreaSubVO deviceNoParking;
|
||||
|
||||
@ApiModelProperty("是否在禁停区")
|
||||
private Boolean inNoParking;
|
||||
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ 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.dto.OrderChangeDeviceDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderCloseDeviceDTO;
|
||||
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.dto.OrderRefundDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderVerifyDTO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderFeeVO;
|
||||
|
@ -153,7 +153,7 @@ public interface OrderService
|
|||
* @param requiredIot 是否必须成功
|
||||
* @return 结果
|
||||
*/
|
||||
public int closeDevice(OrderVO order, boolean requiredIot);
|
||||
public int closeDevice(OrderCloseDeviceDTO dto);
|
||||
|
||||
/**
|
||||
* 更新订单设备ID
|
||||
|
|
|
@ -356,12 +356,16 @@ public class OrderConverterImpl implements OrderConverter{
|
|||
|
||||
if (area != null) {
|
||||
// 查询运营区的可还车的子区域列表
|
||||
List<AreaSubVO> areaSubList = areaSubService.selectParkingAreaByAreaId(area.getId());
|
||||
bo.setParkingAreaSubList(areaSubList);
|
||||
List<AreaSubVO> parkingList = areaSubService.selectParkingAreaByAreaId(area.getId());
|
||||
bo.setParkingList(parkingList);
|
||||
|
||||
// 查询运营区的禁停区列表
|
||||
List<AreaSubVO> noParkingList = areaSubService.selectNoParkingAreaByAreaId(area.getId());
|
||||
bo.setNoParkingList(noParkingList);
|
||||
}
|
||||
|
||||
// 停车点信息
|
||||
OrderInParkingVO inParkingVO = OrderUtil.getInParkingVO(area, bo.getParkingAreaSubList(), bo.getDevice(), dto.getLon(), dto.getLat());
|
||||
OrderInParkingVO inParkingVO = OrderUtil.getInParkingVO(area, bo.getParkingList(), bo.getNoParkingList(), bo.getDevice(), dto.getLon(), dto.getLat());
|
||||
bo.setInParkingVO(inParkingVO);
|
||||
|
||||
// 查询订单车辆轨迹列表
|
||||
|
@ -417,8 +421,12 @@ public class OrderConverterImpl implements OrderConverter{
|
|||
bo.setArea(area);
|
||||
|
||||
// 查询运营区子区域列表
|
||||
List<AreaSubVO> areaSubs = areaSubService.selectParkingAreaByAreaId(area.getId());
|
||||
bo.setAreaSubs(areaSubs);
|
||||
List<AreaSubVO> parkingList = areaSubService.selectParkingAreaByAreaId(area.getId());
|
||||
bo.setParkingList(parkingList);
|
||||
|
||||
// 查询运营区禁停区列表
|
||||
List<AreaSubVO> noParkingList = areaSubService.selectNoParkingAreaByAreaId(area.getId());
|
||||
bo.setNoParkingAreaSubList(noParkingList);
|
||||
|
||||
// 查询旧设备
|
||||
DeviceVO oldDevice = deviceService.selectDeviceById(oldOrderDevice.getDeviceId());
|
||||
|
@ -427,7 +435,7 @@ public class OrderConverterImpl implements OrderConverter{
|
|||
bo.setOldDevice(oldDevice);
|
||||
|
||||
// 获取旧设备是否在停车点内
|
||||
OrderInParkingVO inParkingVO = OrderUtil.getInParkingVO(area, areaSubs, oldDevice, dto.getLon(), dto.getLat());
|
||||
OrderInParkingVO inParkingVO = OrderUtil.getInParkingVO(area, parkingList, noParkingList, oldDevice, dto.getLon(), dto.getLat());
|
||||
bo.setInParkingVO(inParkingVO);
|
||||
// 校验旧设备是否在停车点内
|
||||
orderValidator.checkInParking(area, inParkingVO);
|
||||
|
|
|
@ -36,6 +36,7 @@ import com.ruoyi.bst.order.domain.bo.OrderChangeBO;
|
|||
import com.ruoyi.bst.order.domain.bo.OrderCreateBO;
|
||||
import com.ruoyi.bst.order.domain.bo.OrderEndBO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderChangeDeviceDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderCloseDeviceDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderCreateDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderEndDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderRefundDTO;
|
||||
|
@ -548,10 +549,13 @@ public class OrderServiceImpl implements OrderService
|
|||
}
|
||||
|
||||
// 查询还车点
|
||||
List<AreaSubVO> areaSubs = areaSubService.selectParkingAreaByAreaId(area.getId());
|
||||
List<AreaSubVO> parkingList = areaSubService.selectParkingAreaByAreaId(area.getId());
|
||||
|
||||
// 查询禁停点
|
||||
List<AreaSubVO> noParkingList = areaSubService.selectNoParkingAreaByAreaId(area.getId());
|
||||
|
||||
// 获取是否在停车点内
|
||||
OrderInParkingVO inParkingVO = OrderUtil.getInParkingVO(area, areaSubs, device, dto.getLon(), dto.getLat());
|
||||
OrderInParkingVO inParkingVO = OrderUtil.getInParkingVO(area, parkingList, noParkingList, device, dto.getLon(), dto.getLat());
|
||||
|
||||
// 计算金额
|
||||
return OrderUtil.calcOrderFee(order, area, inParkingVO, LocalDateTime.now());
|
||||
|
@ -578,15 +582,30 @@ public class OrderServiceImpl implements OrderService
|
|||
}
|
||||
|
||||
@Override
|
||||
public int closeDevice(OrderVO order, boolean requiredIot) {
|
||||
ServiceUtil.assertion(order == null, "参数错误,order不允许为空");
|
||||
ServiceUtil.assertion(!OrderStatus.inUse().contains(order.getStatus()), "ID为%s的订单当前状态并非使用中,无法操作设备", order.getId());
|
||||
public int closeDevice(OrderCloseDeviceDTO dto) {
|
||||
ServiceUtil.assertion(dto == null, "参数错误,dto不允许为空");
|
||||
|
||||
OrderVO order = this.selectOrderById(dto.getOrderId());
|
||||
ServiceUtil.assertion(order == null, "ID为%s的订单不存在", dto.getOrderId());
|
||||
|
||||
OrderDeviceVO orderDevice = orderDeviceService.selectOrderDeviceById(order.getOrderDeviceId());
|
||||
ServiceUtil.assertion(orderDevice == null, "ID为%s的订单设备不存在", order.getId());
|
||||
ServiceUtil.assertion(!OrderDeviceStatus.inUse().contains(orderDevice.getStatus()), "ID为%s的订单设备当前状态并非使用中,无法操作设备", order.getId());
|
||||
|
||||
return deviceIotService.lock(orderDevice.getDeviceId(), false, "订单锁车:" + order.getNo(), requiredIot);
|
||||
// 查询设备
|
||||
DeviceVO device = deviceService.selectDeviceById(orderDevice.getDeviceId());
|
||||
ServiceUtil.assertion(device == null, "ID为%s的设备不存在", orderDevice.getDeviceId());
|
||||
deviceIotService.refresh(device, null);
|
||||
|
||||
// 判断是否在禁停区内
|
||||
List<AreaSubVO> noParkingList = areaSubService.selectNoParkingAreaByAreaId(order.getAreaId());
|
||||
if (CollectionUtils.isNotEmptyElement(noParkingList)) {
|
||||
OrderInParkingVO inParkingVO = OrderUtil.getInParkingVO(null, null, noParkingList, device, dto.getLon(), dto.getLat());
|
||||
ServiceUtil.assertion(inParkingVO == null, "获取设备位置失败");
|
||||
ServiceUtil.assertion(inParkingVO.getInNoParking() != null && inParkingVO.getInNoParking(), "禁止在禁停区内停车");
|
||||
}
|
||||
|
||||
return deviceIotService.lock(device, false, "订单锁车:" + order.getNo(), dto.getRequiredIot());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.ruoyi.bst.order.service.impl;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -34,6 +33,8 @@ import com.ruoyi.common.utils.ServiceUtil;
|
|||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class OrderValidatorImpl implements OrderValidator{
|
||||
|
@ -153,6 +154,8 @@ public class OrderValidatorImpl implements OrderValidator{
|
|||
boolean inParking = inParkingVO.getInParking() != null && inParkingVO.getInParking();
|
||||
ServiceUtil.assertion(mustInParking && !inParking, "请将车辆停放在停车点内");
|
||||
|
||||
boolean isInNoParking = inParkingVO.getInNoParking() != null && inParkingVO.getInNoParking();
|
||||
ServiceUtil.assertion(isInNoParking, "请勿将车辆停放在禁停区内");
|
||||
|
||||
boolean mustInArea = area.getAreaOutReturn() != null && !area.getAreaOutReturn();
|
||||
boolean inArea = inParkingVO.getInArea() != null && inParkingVO.getInArea();
|
||||
|
|
|
@ -124,23 +124,26 @@ public class OrderUtil {
|
|||
* @param lat 手机定位纬度
|
||||
* @return
|
||||
*/
|
||||
public static OrderInParkingVO getInParkingVO(AreaVO area, List<AreaSubVO> areaSubList, DeviceVO device, BigDecimal lon, BigDecimal lat) {
|
||||
if (area == null || areaSubList == null || device == null) {
|
||||
public static OrderInParkingVO getInParkingVO(AreaVO area, List<AreaSubVO> parkingList, List<AreaSubVO> noParkingList, DeviceVO device, BigDecimal lon, BigDecimal lat) {
|
||||
if (device == null) {
|
||||
return null;
|
||||
}
|
||||
OrderInParkingVO vo = new OrderInParkingVO();
|
||||
BigDecimal areaError = area == null ? BigDecimal.ZERO : area.getError();
|
||||
BigDecimal deviceLon = device.getLongitude();
|
||||
BigDecimal deviceLat = device.getLatitude();
|
||||
|
||||
// 通过设备定位获取所在区域
|
||||
AreaSubVO deviceAreaSub = AreaSubUtil.getInAreaSub(areaSubList, device.getLongitude(), device.getLatitude(), area.getError());
|
||||
// 通过设备定位获取所在停车点
|
||||
AreaSubVO deviceAreaSub = AreaSubUtil.getInAreaSub(parkingList, deviceLon, deviceLat, areaError);
|
||||
vo.setDeviceAreaSub(deviceAreaSub);
|
||||
// 通过手机定位获取所在区域
|
||||
AreaSubVO mobileAreaSub = AreaSubUtil.getInAreaSub(areaSubList, lon, lat, area.getError());
|
||||
// 通过手机定位获取所在停车点
|
||||
AreaSubVO mobileAreaSub = AreaSubUtil.getInAreaSub(parkingList, lon, lat, areaError);
|
||||
vo.setMobileAreaSub(mobileAreaSub);
|
||||
// 是否在停车点
|
||||
boolean inParking = deviceAreaSub != null || mobileAreaSub != null;
|
||||
vo.setInParking(inParking);
|
||||
|
||||
// 实际还车点
|
||||
// 实际停车点
|
||||
if (deviceAreaSub != null) {
|
||||
vo.setActualAreaSub(deviceAreaSub);
|
||||
vo.setActualLon(device.getLongitude());
|
||||
|
@ -151,8 +154,18 @@ public class OrderUtil {
|
|||
vo.setActualLat(lat);
|
||||
}
|
||||
|
||||
// 通过设备定位获取是否在禁停区
|
||||
AreaSubVO deviceNoParking = AreaSubUtil.getInAreaSub(noParkingList, deviceLon, deviceLat, areaError);
|
||||
vo.setDeviceNoParking(deviceNoParking);
|
||||
// 通过手机定位获取是否在禁停区
|
||||
AreaSubVO mobileNoParking = AreaSubUtil.getInAreaSub(noParkingList, lon, lat, areaError);
|
||||
vo.setMobileNoParking(mobileNoParking);
|
||||
// 是否在禁停区
|
||||
boolean inNoParking = deviceNoParking != null || mobileNoParking != null;
|
||||
vo.setInNoParking(inNoParking);
|
||||
|
||||
// 通过设备定位获取是否在运营区
|
||||
boolean deviceInArea = AreaUtil.isInAreaMax(area, device.getLongitude(), device.getLatitude()); // 是否在运营区
|
||||
boolean deviceInArea = AreaUtil.isInAreaMax(area, deviceLon, deviceLat); // 是否在运营区
|
||||
vo.setDeviceInArea(deviceInArea);
|
||||
// 通过手机定位获取是否在运营区
|
||||
boolean mobileInArea = AreaUtil.isInAreaMax(area, lon, lat); // 是否在运营区
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.bst.withdraw.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
|
@ -13,4 +14,11 @@ public interface WithdrawDashboard {
|
|||
* @return
|
||||
*/
|
||||
WithdrawStatVO selectStat(WithdrawQuery query, List<String> keys);
|
||||
|
||||
/**
|
||||
* 查询提现成功金额
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
BigDecimal selectSuccessAmount(WithdrawQuery query);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,8 @@ public class WithdrawDashboardImpl implements WithdrawDashboard {
|
|||
return vo;
|
||||
}
|
||||
|
||||
private BigDecimal selectSuccessAmount(WithdrawQuery query) {
|
||||
@Override
|
||||
public BigDecimal selectSuccessAmount(WithdrawQuery query) {
|
||||
WithdrawQuery successQuery = new WithdrawQuery();
|
||||
BeanUtils.copyProperties(query, successQuery);
|
||||
successQuery.setStatus(WithdrawStatus.SUCCESS.getCode());
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.iot.service;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import com.ruoyi.iot.constants.IotConstants;
|
||||
import com.ruoyi.iot.domain.IotDeviceInfo;
|
||||
import com.ruoyi.iot.domain.response.CommandResponse;
|
||||
|
@ -54,7 +55,7 @@ public interface IotService {
|
|||
* @return 结果
|
||||
*/
|
||||
CommandResponse lock(IotDevice device, int sub, String reason);
|
||||
|
||||
|
||||
/**
|
||||
* 强制断电
|
||||
* @param device 设备
|
||||
|
@ -89,4 +90,12 @@ public interface IotService {
|
|||
*/
|
||||
CommandResponse unlockSeat(IotDevice device, String reason);
|
||||
|
||||
/**
|
||||
* 临时锁车
|
||||
* @param device
|
||||
* @param sub
|
||||
* @param reason
|
||||
* @return
|
||||
*/
|
||||
CommandResponse tempLock(DeviceVO device, int sub, String reason);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -327,7 +328,7 @@ public class IotServiceImpl implements IotService {
|
|||
String command = IotConstants.COMMAND_QLOSE + IotConstants.COMMAND_SUB + sub + IotConstants.COMMAND_SEPARATOR;
|
||||
return sendCommand(device, command, reason);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CommandResponse play(IotDevice device, String type, String reason) {
|
||||
if (StringUtils.isBlank(type)) {
|
||||
|
@ -345,4 +346,11 @@ public class IotServiceImpl implements IotService {
|
|||
public CommandResponse unlockSeat(IotDevice device, String reason) {
|
||||
return sendCommand(device, IotConstants.COMMAND_HPEN, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResponse tempLock(DeviceVO device, int sub, String reason) {
|
||||
return sendCommand(device, IotConstants.COMMAND_LLOSE, reason);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,14 +3,12 @@ package com.ruoyi.web.app;
|
|||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.bst.device.domain.DeviceQuery;
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import com.ruoyi.bst.device.domain.enums.DeviceStatus;
|
||||
import com.ruoyi.bst.device.service.DeviceService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
|
@ -26,6 +24,8 @@ public class AppDeviceController extends BaseController {
|
|||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
|
||||
|
||||
|
||||
@ApiOperation("获取附近可用车辆列表")
|
||||
@GetMapping("/listNearBy")
|
||||
@Anonymous
|
||||
|
@ -47,20 +47,7 @@ public class AppDeviceController extends BaseController {
|
|||
@GetMapping("/availableDetail")
|
||||
@Anonymous
|
||||
public AjaxResult getAvailableDetail(@RequestParam(required = false) Long id, @RequestParam(required = false) String sn) {
|
||||
DeviceQuery query = new DeviceQuery();
|
||||
query.setStatus(DeviceStatus.AVAILABLE.getCode());
|
||||
if (id != null) {
|
||||
query.setId(id);
|
||||
} else if (StringUtils.hasText(sn)) {
|
||||
query.setEqSn(sn);
|
||||
} else {
|
||||
return error("ID和SN不允许同时为空");
|
||||
}
|
||||
|
||||
DeviceVO device = deviceService.selectOne(query);
|
||||
return success(device);
|
||||
return success(deviceService.selectAvaliableDevice(id, sn));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.ruoyi.web.app;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import com.ruoyi.bst.device.service.DeviceIotService;
|
||||
import com.ruoyi.bst.device.service.DeviceService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.iot.constants.IotConstants;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/device/iot")
|
||||
public class AppDeviceIotController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DeviceIotService deviceIotService;
|
||||
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
|
||||
|
||||
@ApiOperation("用户响铃寻车")
|
||||
@PutMapping("/ring")
|
||||
public AjaxResult ring(@RequestParam(required = false) Long id, @RequestParam(required = false) String sn) {
|
||||
DeviceVO device = deviceService.selectAvaliableDevice(id, sn);
|
||||
ServiceUtil.assertion(device == null, "当前车辆不可用,无法响铃寻车");
|
||||
return toAjax(deviceIotService.play(device, IotConstants.PLAY_WARNING, "用户响铃寻车"));
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import com.ruoyi.bst.order.domain.OrderQuery;
|
|||
import com.ruoyi.bst.order.domain.OrderVO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderCalcPrePriceDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderChangeDeviceDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderCloseDeviceDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderCreateDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderEndDTO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderPayDTO;
|
||||
|
@ -130,11 +131,12 @@ public class AppOrderController extends BaseController {
|
|||
|
||||
@ApiOperation("操作订单设备关闭")
|
||||
@PutMapping("/closeDevice")
|
||||
public AjaxResult closeDevice(Long orderId) {
|
||||
OrderVO order = orderService.selectOrderById(orderId);
|
||||
public AjaxResult closeDevice(@RequestBody @Validated OrderCloseDeviceDTO dto) {
|
||||
OrderVO order = orderService.selectOrderById(dto.getOrderId());
|
||||
ServiceUtil.assertion(order == null, "订单不存在");
|
||||
ServiceUtil.assertion(!orderValidator.canCloseDevice(order, getUserId()), "您无权操作ID为%s的订单设备关闭", order.getId());
|
||||
return toAjax(orderService.closeDevice(order, true));
|
||||
dto.setRequiredIot(true);
|
||||
return toAjax(orderService.closeDevice(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("订单换车")
|
||||
|
|
|
@ -1,5 +1,20 @@
|
|||
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.hardwareVersion.domain.HardwareVersion;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionQuery;
|
||||
import com.ruoyi.bst.hardwareVersion.domain.HardwareVersionVO;
|
||||
|
@ -10,12 +25,6 @@ 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;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 硬件版本Controller
|
||||
|
@ -43,6 +52,15 @@ public class HardwareVersionController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部硬件版本列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:hardwareVersion:list')")
|
||||
@GetMapping("/all")
|
||||
public AjaxResult all() {
|
||||
return success(hardwareVersionService.selectAllNames());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出硬件版本列表
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user