联调
This commit is contained in:
parent
b153ffd2e5
commit
232a100586
|
@ -5,7 +5,7 @@ import com.alibaba.fastjson2.JSON;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
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.core.domain.entity.SysDictData;
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
import com.ruoyi.system.domain.device.RlDevice;
|
import com.ruoyi.system.domain.RlFunction;
|
||||||
import com.ruoyi.system.domain.agent.RlAgent;
|
import com.ruoyi.system.domain.agent.RlAgent;
|
||||||
import com.ruoyi.system.domain.city.RlCity;
|
import com.ruoyi.system.domain.city.RlCity;
|
||||||
import com.ruoyi.system.domain.city.RlCityQuery;
|
import com.ruoyi.system.domain.city.RlCityQuery;
|
||||||
|
@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,9 +82,25 @@ public class AppController extends BaseController
|
||||||
public AjaxResult getAgentByCityId(Long cityId)
|
public AjaxResult getAgentByCityId(Long cityId)
|
||||||
{
|
{
|
||||||
logger.info("根据城市id获取代理商:【cityId="+cityId+"】");
|
logger.info("根据城市id获取代理商:【cityId="+cityId+"】");
|
||||||
|
if(cityId == null){
|
||||||
|
return error("城市id不能为空");
|
||||||
|
}
|
||||||
return success(rlAgentService.selectRlAgentByCityId(cityId));
|
return success(rlAgentService.selectRlAgentByCityId(cityId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据代理商id获取代理商
|
||||||
|
*/
|
||||||
|
@GetMapping("/getAgentByAgentId")
|
||||||
|
public AjaxResult getAgentByAgentId(Long agentId)
|
||||||
|
{
|
||||||
|
logger.info("根据代理商id获取代理商:【agentId="+agentId+"】");
|
||||||
|
if(agentId == null){
|
||||||
|
return error("代理商id不能为空");
|
||||||
|
}
|
||||||
|
return success(rlAgentService.selectRlAgentByAgentId(agentId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据城市id获取车型列表
|
* 根据城市id获取车型列表
|
||||||
|
@ -223,4 +240,35 @@ public class AppController extends BaseController
|
||||||
Boolean i =eDeviceService.ring(sn);
|
Boolean i =eDeviceService.ring(sn);
|
||||||
return success(i);
|
return success(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算距离
|
||||||
|
*/
|
||||||
|
@GetMapping("/computeDistance")
|
||||||
|
public AjaxResult computeDistance(String lon,String lat,Long storeId)
|
||||||
|
{
|
||||||
|
logger.info("计算距离:【lon="+lon+",lat="+lat+",storeId="+storeId+"】");
|
||||||
|
//判空
|
||||||
|
if(StrUtil.isBlank(lon)||StrUtil.isBlank(lat)||storeId==null){
|
||||||
|
return error("参数[lon,lat,storeId]不能为空");
|
||||||
|
}
|
||||||
|
BigDecimal distance = storeService.computeDistance(lon,lat,storeId);
|
||||||
|
return success(distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据车型id获取功能
|
||||||
|
*/
|
||||||
|
@GetMapping("/getFunctionListByModelId")
|
||||||
|
public AjaxResult getFunctionListByModelId(Long modelId)
|
||||||
|
{
|
||||||
|
logger.info("根据车型id获取功能:【modelId="+modelId+"】");
|
||||||
|
//判空
|
||||||
|
if(modelId == null){
|
||||||
|
return error("参数[modelId]不能为空");
|
||||||
|
}
|
||||||
|
List<RlFunction> functionList = modelService.getFunctionListByModelId(modelId);
|
||||||
|
return success(functionList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能对象 rl_function
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-09-26
|
||||||
|
*/
|
||||||
|
public class RlFunction extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 功能id */
|
||||||
|
private Long functionId;
|
||||||
|
|
||||||
|
/** 车型id */
|
||||||
|
@Excel(name = "车型id")
|
||||||
|
private Long modelId;
|
||||||
|
|
||||||
|
/** 功能 */
|
||||||
|
@Excel(name = "功能")
|
||||||
|
private String function;
|
||||||
|
|
||||||
|
public void setFunctionId(Long functionId)
|
||||||
|
{
|
||||||
|
this.functionId = functionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getFunctionId()
|
||||||
|
{
|
||||||
|
return functionId;
|
||||||
|
}
|
||||||
|
public void setModelId(Long modelId)
|
||||||
|
{
|
||||||
|
this.modelId = modelId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getModelId()
|
||||||
|
{
|
||||||
|
return modelId;
|
||||||
|
}
|
||||||
|
public void setFunction(String function)
|
||||||
|
{
|
||||||
|
this.function = function;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFunction()
|
||||||
|
{
|
||||||
|
return function;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("functionId", getFunctionId())
|
||||||
|
.append("modelId", getModelId())
|
||||||
|
.append("function", getFunction())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.system.domain.model;
|
package com.ruoyi.system.domain.model;
|
||||||
|
|
||||||
import com.ruoyi.system.domain.accessory.RlAccessory;
|
import com.ruoyi.system.domain.accessory.RlAccessory;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -17,4 +18,7 @@ public class RlModelVO extends RlModel{
|
||||||
|
|
||||||
/** 单位 */
|
/** 单位 */
|
||||||
private String rentalUnit;
|
private String rentalUnit;
|
||||||
|
|
||||||
|
@ApiModelProperty("可租车辆")
|
||||||
|
private Integer rentalCar;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.ruoyi.system.domain.store;
|
package com.ruoyi.system.domain.store;
|
||||||
|
|
||||||
import com.ruoyi.system.domain.model.RlModel;
|
import com.ruoyi.system.domain.model.RlModelVO;
|
||||||
import com.ruoyi.system.domain.modelStore.RlModelStore;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -26,7 +25,7 @@ public class StoreVo extends Store {
|
||||||
private double distance;
|
private double distance;
|
||||||
|
|
||||||
@ApiModelProperty("车型列表")
|
@ApiModelProperty("车型列表")
|
||||||
private List<RlModel> models;
|
private List<RlModelVO> models;
|
||||||
|
|
||||||
// @ApiModelProperty("是否免费送取车")
|
// @ApiModelProperty("是否免费送取车")
|
||||||
// private Boolean isFreeCar;
|
// private Boolean isFreeCar;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.ruoyi.system.domain.device.RlDevice;
|
import com.ruoyi.system.domain.device.RlDevice;
|
||||||
import com.ruoyi.system.domain.device.RlDeviceQuery;
|
import com.ruoyi.system.domain.device.RlDeviceQuery;
|
||||||
import com.ruoyi.system.domain.device.RlDeviceVO;
|
import com.ruoyi.system.domain.device.RlDeviceVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -149,5 +150,5 @@ public interface RlDeviceMapper extends BaseMapper<RlDevice>
|
||||||
/**
|
/**
|
||||||
* 根据店铺id查询可租车辆数
|
* 根据店铺id查询可租车辆数
|
||||||
*/
|
*/
|
||||||
Integer selectRentalDeviceCountByStoreId(Long storeId);
|
Integer selectRentalDeviceCountByStoreId(@Param("storeId")Long storeId, @Param("modelId")Long modelId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.system.domain.RlFunction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-09-26
|
||||||
|
*/
|
||||||
|
public interface RlFunctionMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询功能
|
||||||
|
*
|
||||||
|
* @param functionId 功能主键
|
||||||
|
* @return 功能
|
||||||
|
*/
|
||||||
|
public RlFunction selectRlFunctionByFunctionId(Long functionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询功能列表
|
||||||
|
*
|
||||||
|
* @param rlFunction 功能
|
||||||
|
* @return 功能集合
|
||||||
|
*/
|
||||||
|
public List<RlFunction> selectRlFunctionList(RlFunction rlFunction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增功能
|
||||||
|
*
|
||||||
|
* @param rlFunction 功能
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertRlFunction(RlFunction rlFunction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改功能
|
||||||
|
*
|
||||||
|
* @param rlFunction 功能
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateRlFunction(RlFunction rlFunction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除功能
|
||||||
|
*
|
||||||
|
* @param functionId 功能主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRlFunctionByFunctionId(Long functionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除功能
|
||||||
|
*
|
||||||
|
* @param functionIds 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRlFunctionByFunctionIds(Long[] functionIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据车型id获取功能
|
||||||
|
*/
|
||||||
|
List<RlFunction> selectRlFunctionByModelId(Long modelId);
|
||||||
|
}
|
|
@ -43,7 +43,7 @@ public interface RlModelMapper
|
||||||
* @param storeId 店铺id
|
* @param storeId 店铺id
|
||||||
* @return 车辆型号集合
|
* @return 车辆型号集合
|
||||||
*/
|
*/
|
||||||
public List<RlModel> selectEModelListByStoreId(Long storeId);
|
public List<RlModelVO> selectEModelListByStoreId(Long storeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增车辆型号
|
* 新增车辆型号
|
||||||
|
|
|
@ -387,7 +387,7 @@ public interface IRlDeviceService extends IService<RlDevice>
|
||||||
/**
|
/**
|
||||||
* 根据店铺id查询可租车辆数
|
* 根据店铺id查询可租车辆数
|
||||||
*/
|
*/
|
||||||
Integer selectRentalDeviceCountByStoreId(Long storeId);
|
Integer selectRentalDeviceCountByStoreId(Long storeId,Long modelId);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 是否靠近运营区边界
|
// * 是否靠近运营区边界
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.system.domain.RlFunction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-09-26
|
||||||
|
*/
|
||||||
|
public interface IRlFunctionService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询功能
|
||||||
|
*
|
||||||
|
* @param functionId 功能主键
|
||||||
|
* @return 功能
|
||||||
|
*/
|
||||||
|
public RlFunction selectRlFunctionByFunctionId(Long functionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询功能列表
|
||||||
|
*
|
||||||
|
* @param rlFunction 功能
|
||||||
|
* @return 功能集合
|
||||||
|
*/
|
||||||
|
public List<RlFunction> selectRlFunctionList(RlFunction rlFunction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增功能
|
||||||
|
*
|
||||||
|
* @param rlFunction 功能
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertRlFunction(RlFunction rlFunction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改功能
|
||||||
|
*
|
||||||
|
* @param rlFunction 功能
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateRlFunction(RlFunction rlFunction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除功能
|
||||||
|
*
|
||||||
|
* @param functionIds 需要删除的功能主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRlFunctionByFunctionIds(Long[] functionIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除功能信息
|
||||||
|
*
|
||||||
|
* @param functionId 功能主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRlFunctionByFunctionId(Long functionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据车型id获取功能
|
||||||
|
*/
|
||||||
|
List<RlFunction> selectRlFunctionByModelId(Long modelId);
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.RlFunction;
|
||||||
import com.ruoyi.system.domain.model.RlModel;
|
import com.ruoyi.system.domain.model.RlModel;
|
||||||
import com.ruoyi.system.domain.model.RlModelVO;
|
import com.ruoyi.system.domain.model.RlModelVO;
|
||||||
import com.ruoyi.system.domain.store.StoreVo;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public interface IRlModelService
|
||||||
* @param storeId 店铺id
|
* @param storeId 店铺id
|
||||||
* @return 车辆型号
|
* @return 车辆型号
|
||||||
*/
|
*/
|
||||||
public List<RlModel> selectEModelListByStoreId(Long storeId);
|
public List<RlModelVO> selectEModelListByStoreId(Long storeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增车辆型号
|
* 新增车辆型号
|
||||||
|
@ -84,4 +84,9 @@ public interface IRlModelService
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int selectAllCount();
|
public int selectAllCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据车型id获取功能
|
||||||
|
*/
|
||||||
|
List<RlFunction> getFunctionListByModelId(Long modelId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2055,8 +2055,8 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
|
||||||
* 根据店铺id查询可租车辆数
|
* 根据店铺id查询可租车辆数
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Integer selectRentalDeviceCountByStoreId(Long storeId) {
|
public Integer selectRentalDeviceCountByStoreId(Long storeId,Long modelId) {
|
||||||
return deviceMapper.selectRentalDeviceCountByStoreId(storeId);
|
return deviceMapper.selectRentalDeviceCountByStoreId(storeId,modelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.system.mapper.RlFunctionMapper;
|
||||||
|
import com.ruoyi.system.domain.RlFunction;
|
||||||
|
import com.ruoyi.system.service.IRlFunctionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-09-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RlFunctionServiceImpl implements IRlFunctionService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private RlFunctionMapper rlFunctionMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询功能
|
||||||
|
*
|
||||||
|
* @param functionId 功能主键
|
||||||
|
* @return 功能
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RlFunction selectRlFunctionByFunctionId(Long functionId)
|
||||||
|
{
|
||||||
|
return rlFunctionMapper.selectRlFunctionByFunctionId(functionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询功能列表
|
||||||
|
*
|
||||||
|
* @param rlFunction 功能
|
||||||
|
* @return 功能
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RlFunction> selectRlFunctionList(RlFunction rlFunction)
|
||||||
|
{
|
||||||
|
return rlFunctionMapper.selectRlFunctionList(rlFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增功能
|
||||||
|
*
|
||||||
|
* @param rlFunction 功能
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertRlFunction(RlFunction rlFunction)
|
||||||
|
{
|
||||||
|
return rlFunctionMapper.insertRlFunction(rlFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改功能
|
||||||
|
*
|
||||||
|
* @param rlFunction 功能
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateRlFunction(RlFunction rlFunction)
|
||||||
|
{
|
||||||
|
return rlFunctionMapper.updateRlFunction(rlFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除功能
|
||||||
|
*
|
||||||
|
* @param functionIds 需要删除的功能主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteRlFunctionByFunctionIds(Long[] functionIds)
|
||||||
|
{
|
||||||
|
return rlFunctionMapper.deleteRlFunctionByFunctionIds(functionIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除功能信息
|
||||||
|
*
|
||||||
|
* @param functionId 功能主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteRlFunctionByFunctionId(Long functionId)
|
||||||
|
{
|
||||||
|
return rlFunctionMapper.deleteRlFunctionByFunctionId(functionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据车型id获取功能
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RlFunction> selectRlFunctionByModelId(Long modelId) {
|
||||||
|
return rlFunctionMapper.selectRlFunctionByModelId(modelId);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.system.domain.RlFunction;
|
||||||
import com.ruoyi.system.domain.device.RlDevice;
|
import com.ruoyi.system.domain.device.RlDevice;
|
||||||
import com.ruoyi.system.domain.accessory.RlAccessory;
|
import com.ruoyi.system.domain.accessory.RlAccessory;
|
||||||
import com.ruoyi.system.domain.model.RlModel;
|
import com.ruoyi.system.domain.model.RlModel;
|
||||||
|
@ -10,6 +11,7 @@ import com.ruoyi.system.domain.model.RlModelVO;
|
||||||
import com.ruoyi.system.mapper.RlModelMapper;
|
import com.ruoyi.system.mapper.RlModelMapper;
|
||||||
import com.ruoyi.system.service.IRlAccessoryService;
|
import com.ruoyi.system.service.IRlAccessoryService;
|
||||||
import com.ruoyi.system.service.IRlDeviceService;
|
import com.ruoyi.system.service.IRlDeviceService;
|
||||||
|
import com.ruoyi.system.service.IRlFunctionService;
|
||||||
import com.ruoyi.system.service.IRlModelService;
|
import com.ruoyi.system.service.IRlModelService;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -39,6 +41,9 @@ public class RlModelServiceImpl implements IRlModelService
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRlAccessoryService accessoryService;
|
private IRlAccessoryService accessoryService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IRlFunctionService rlFunctionService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆型号
|
* 查询车辆型号
|
||||||
|
@ -105,9 +110,9 @@ public class RlModelServiceImpl implements IRlModelService
|
||||||
* @return 车辆型号
|
* @return 车辆型号
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<RlModel> selectEModelListByStoreId(Long storeId)
|
public List<RlModelVO> selectEModelListByStoreId(Long storeId)
|
||||||
{
|
{
|
||||||
List<RlModel> etModels = rlModelMapper.selectEModelListByStoreId(storeId);
|
List<RlModelVO> etModels = rlModelMapper.selectEModelListByStoreId(storeId);
|
||||||
return etModels;
|
return etModels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,4 +177,12 @@ public class RlModelServiceImpl implements IRlModelService
|
||||||
return rlModelMapper.selectAllCount();
|
return rlModelMapper.selectAllCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据车型id获取功能
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RlFunction> getFunctionListByModelId(Long modelId) {
|
||||||
|
return rlFunctionService.selectRlFunctionByModelId(modelId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ package com.ruoyi.system.service.store;
|
||||||
|
|
||||||
|
|
||||||
import com.ruoyi.system.domain.store.Store;
|
import com.ruoyi.system.domain.store.Store;
|
||||||
import com.ruoyi.system.domain.store.StoreBO;
|
|
||||||
import com.ruoyi.system.domain.store.StoreQuery;
|
import com.ruoyi.system.domain.store.StoreQuery;
|
||||||
import com.ruoyi.system.domain.store.StoreVo;
|
import com.ruoyi.system.domain.store.StoreVo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
@ -159,4 +159,9 @@ public interface RlStoreService
|
||||||
* 根据定位获取附近店铺列表
|
* 根据定位获取附近店铺列表
|
||||||
*/
|
*/
|
||||||
List<StoreVo> getStoreListByLocation(StoreQuery query);
|
List<StoreVo> getStoreListByLocation(StoreQuery query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算距离
|
||||||
|
*/
|
||||||
|
BigDecimal computeDistance(String lon,String lat,Long storeId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
package com.ruoyi.system.service.store.impl;
|
package com.ruoyi.system.service.store.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import com.ruoyi.common.utils.bean.collection.CollectionUtils;
|
import com.ruoyi.common.utils.bean.collection.CollectionUtils;
|
||||||
import com.ruoyi.common.utils.map.GeoUtils;
|
import com.ruoyi.common.utils.map.GeoUtils;
|
||||||
import com.ruoyi.system.domain.model.RlModel;
|
import com.ruoyi.system.domain.model.RlModel;
|
||||||
|
import com.ruoyi.system.domain.model.RlModelVO;
|
||||||
import com.ruoyi.system.domain.store.Store;
|
import com.ruoyi.system.domain.store.Store;
|
||||||
import com.ruoyi.system.domain.store.StoreCountVO;
|
import com.ruoyi.system.domain.store.StoreCountVO;
|
||||||
import com.ruoyi.system.domain.store.StoreQuery;
|
import com.ruoyi.system.domain.store.StoreQuery;
|
||||||
|
@ -74,7 +76,23 @@ public class StoreServiceImpl implements RlStoreService
|
||||||
@Override
|
@Override
|
||||||
public StoreVo selectSmStoreById(Long storeId)
|
public StoreVo selectSmStoreById(Long storeId)
|
||||||
{
|
{
|
||||||
return storeMapper.selectSmStoreById(storeId);
|
StoreVo store = storeMapper.selectSmStoreById(storeId);
|
||||||
|
if (store != null) {
|
||||||
|
// 获取可租车辆数量
|
||||||
|
Integer rentalCount = deviceService.selectRentalDeviceCountByStoreId(storeId,null);
|
||||||
|
store.setRentalCar(rentalCount);
|
||||||
|
|
||||||
|
// 获取车型列表
|
||||||
|
List<RlModelVO> modelList = modelService.selectEModelListByStoreId(storeId);
|
||||||
|
// 遍历
|
||||||
|
for (RlModelVO model : modelList) {
|
||||||
|
// 获取车型对应的车辆数量
|
||||||
|
Integer modelRentalCount = deviceService.selectRentalDeviceCountByStoreId(storeId,model.getModelId());
|
||||||
|
model.setRentalCar(modelRentalCount);
|
||||||
|
}
|
||||||
|
store.setModels(modelList);
|
||||||
|
}
|
||||||
|
return store;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -431,10 +449,10 @@ public class StoreServiceImpl implements RlStoreService
|
||||||
// 过滤出在方圆X公里内的店铺
|
// 过滤出在方圆X公里内的店铺
|
||||||
List<StoreVo> nearbyStores = allStores.stream()
|
List<StoreVo> nearbyStores = allStores.stream()
|
||||||
.map(store -> {
|
.map(store -> {
|
||||||
List<RlModel> list = modelService.selectEModelListByStoreId(store.getStoreId());
|
List<RlModelVO> list = modelService.selectEModelListByStoreId(store.getStoreId());
|
||||||
store.setModels(list);
|
store.setModels(list);
|
||||||
/** 多少辆可租 */
|
/** 多少辆可租 */
|
||||||
Integer integer = deviceService.selectRentalDeviceCountByStoreId(store.getStoreId());
|
Integer integer = deviceService.selectRentalDeviceCountByStoreId(store.getStoreId(),null);
|
||||||
store.setRentalCar(integer);
|
store.setRentalCar(integer);
|
||||||
double storeLon = store.getLng().doubleValue();
|
double storeLon = store.getLng().doubleValue();
|
||||||
double storeLat = store.getLat().doubleValue();
|
double storeLat = store.getLat().doubleValue();
|
||||||
|
@ -452,4 +470,25 @@ public class StoreServiceImpl implements RlStoreService
|
||||||
return nearbyStores;
|
return nearbyStores;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算距离
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BigDecimal computeDistance(String lon1,String lat1,Long storeId) {
|
||||||
|
StoreVo storeVo = storeMapper.selectSmStoreById(storeId);
|
||||||
|
if(storeVo == null){
|
||||||
|
throw new ServiceException("店铺不存在");
|
||||||
|
}
|
||||||
|
BigDecimal lng2 = storeVo.getLng();
|
||||||
|
BigDecimal lat2 = storeVo.getLat();
|
||||||
|
if (lng2 != null && lat2 != null) {
|
||||||
|
double[] point1 = {lng2.doubleValue(), lat2.doubleValue()};
|
||||||
|
double[] point2 = {Double.valueOf(lon1), Double.valueOf(lat1)};
|
||||||
|
double distance = GeoUtils.haversineDistance(point1, point2);
|
||||||
|
BigDecimal distanceFormatted = new BigDecimal(distance).setScale(1, RoundingMode.HALF_UP);
|
||||||
|
return distanceFormatted;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRentalDeviceCountByStoreId" resultType="java.lang.Integer">
|
<select id="selectRentalDeviceCountByStoreId" resultType="java.lang.Integer">
|
||||||
select count(1) from rl_device where store_id = #{storeId} and status = '1'
|
select count(1) from rl_device where status = '1'
|
||||||
|
<if test="storeId != null"> and store_id = #{storeId}</if>
|
||||||
|
<if test="modelId != null"> and model_id = #{modelId}</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertDevice" parameterType="RlDeviceQuery" useGeneratedKeys="true" keyProperty="deviceId">
|
<insert id="insertDevice" parameterType="RlDeviceQuery" useGeneratedKeys="true" keyProperty="deviceId">
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?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.system.mapper.RlFunctionMapper">
|
||||||
|
|
||||||
|
<resultMap type="RlFunction" id="RlFunctionResult">
|
||||||
|
<result property="functionId" column="function_id" />
|
||||||
|
<result property="modelId" column="model_id" />
|
||||||
|
<result property="function" column="function" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectRlFunctionVo">
|
||||||
|
select function_id, model_id, function from rl_function
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectRlFunctionList" parameterType="RlFunction" resultMap="RlFunctionResult">
|
||||||
|
<include refid="selectRlFunctionVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="modelId != null "> and model_id = #{modelId}</if>
|
||||||
|
<if test="function != null and function != ''"> and function = #{function}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRlFunctionByFunctionId" parameterType="Long" resultMap="RlFunctionResult">
|
||||||
|
<include refid="selectRlFunctionVo"/>
|
||||||
|
where function_id = #{functionId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRlFunctionByModelId" resultType="com.ruoyi.system.domain.RlFunction">
|
||||||
|
<include refid="selectRlFunctionVo"/>
|
||||||
|
where model_id = #{modelId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertRlFunction" parameterType="RlFunction">
|
||||||
|
insert into rl_function
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="functionId != null">function_id,</if>
|
||||||
|
<if test="modelId != null">model_id,</if>
|
||||||
|
<if test="function != null">function,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="functionId != null">#{functionId},</if>
|
||||||
|
<if test="modelId != null">#{modelId},</if>
|
||||||
|
<if test="function != null">#{function},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateRlFunction" parameterType="RlFunction">
|
||||||
|
update rl_function
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="modelId != null">model_id = #{modelId},</if>
|
||||||
|
<if test="function != null">function = #{function},</if>
|
||||||
|
</trim>
|
||||||
|
where function_id = #{functionId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteRlFunctionByFunctionId" parameterType="Long">
|
||||||
|
delete from rl_function where function_id = #{functionId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteRlFunctionByFunctionIds" parameterType="String">
|
||||||
|
delete from rl_function where function_id in
|
||||||
|
<foreach item="functionId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{functionId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user