Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
bcd0a46d87
@ -8,10 +8,7 @@ import com.ebike.feign.model.dto.FeignEbikeDto;
|
|||||||
import com.ebike.feign.model.dto.FeignEbikeReportRecordDto;
|
import com.ebike.feign.model.dto.FeignEbikeReportRecordDto;
|
||||||
import com.ebike.feign.model.dto.FeignEbikeUserBikeInfo;
|
import com.ebike.feign.model.dto.FeignEbikeUserBikeInfo;
|
||||||
import com.ebike.feign.model.dto.FeignEbikeUserLockDto;
|
import com.ebike.feign.model.dto.FeignEbikeUserLockDto;
|
||||||
import com.ebike.feign.model.vo.EbikeLockVo;
|
import com.ebike.feign.model.vo.*;
|
||||||
import com.ebike.feign.model.vo.FeignEbikeBikeRadiusVo;
|
|
||||||
import com.ebike.feign.model.vo.FeignEbikeReportRecordVo;
|
|
||||||
import com.ebike.feign.model.vo.FeignInspectionSwapOrderVo;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -116,4 +113,15 @@ public interface OperationsFeignClient {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/ebikeReportRecord/getReportRecord")
|
@GetMapping("/ebikeReportRecord/getReportRecord")
|
||||||
JsonResult<List<FeignEbikeReportRecordVo>> getReportRecord(@RequestParam("userId") Long userId);
|
JsonResult<List<FeignEbikeReportRecordVo>> getReportRecord(@RequestParam("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前位置所属运营区
|
||||||
|
*
|
||||||
|
* @param lng 经度
|
||||||
|
* @param lat 维度
|
||||||
|
* @return 运营区信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/ebikeRegion/getRegionByLocation")
|
||||||
|
JsonResult<FeignEbikeRegionVo> getRegionByLocation(@RequestParam("lng") double lng,
|
||||||
|
@RequestParam("lat") double lat);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,70 @@
|
|||||||
|
package com.ebike.feign.model.vo;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.postgresql.geometric.PGpolygon;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营区域表 实体类。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-10-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class FeignEbikeRegionVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营区ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
private Long regionId;
|
||||||
|
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营区名称
|
||||||
|
*/
|
||||||
|
private String regionName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简称
|
||||||
|
*/
|
||||||
|
private String regionSimpleName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域
|
||||||
|
*/
|
||||||
|
private PGpolygon regionPolygon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点数量
|
||||||
|
*/
|
||||||
|
private Integer siteNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营区状态:0-未运营 1-运营中 2-停止运营
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
private Long createdBy;
|
||||||
|
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
private Long updatedBy;
|
||||||
|
|
||||||
|
}
|
||||||
@ -20,6 +20,7 @@ import com.mybatisflex.core.query.QueryWrapper;
|
|||||||
import com.mybatisflex.core.update.UpdateChain;
|
import com.mybatisflex.core.update.UpdateChain;
|
||||||
import com.mybatisflex.core.util.StringUtil;
|
import com.mybatisflex.core.util.StringUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.postgresql.geometric.PGpoint;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -142,7 +143,7 @@ public class EbikeRegionController {
|
|||||||
/**
|
/**
|
||||||
* 开始运营。
|
* 开始运营。
|
||||||
*
|
*
|
||||||
* @param regionId 运营区主键
|
* @param regionId 运营区主键
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@GetMapping("commenceOperation")
|
@GetMapping("commenceOperation")
|
||||||
@ -164,7 +165,7 @@ public class EbikeRegionController {
|
|||||||
/**
|
/**
|
||||||
* 结束运营。
|
* 结束运营。
|
||||||
*
|
*
|
||||||
* @param regionId 运营区主键
|
* @param regionId 运营区主键
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@GetMapping("stopOperation")
|
@GetMapping("stopOperation")
|
||||||
@ -180,7 +181,7 @@ public class EbikeRegionController {
|
|||||||
/**
|
/**
|
||||||
* 保存运营区默认计费规则。
|
* 保存运营区默认计费规则。
|
||||||
*
|
*
|
||||||
* @param configurationVo 配置信息
|
* @param configurationVo 配置信息
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@PostMapping("defaultConfiguration")
|
@PostMapping("defaultConfiguration")
|
||||||
@ -192,13 +193,13 @@ public class EbikeRegionController {
|
|||||||
/**
|
/**
|
||||||
* 获取运营区默认计费规则。
|
* 获取运营区默认计费规则。
|
||||||
*
|
*
|
||||||
* @param regionId 区域ID
|
* @param regionId 区域ID
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@GetMapping("getDefaultConfiguration")
|
@GetMapping("getDefaultConfiguration")
|
||||||
public JsonResult<?> getDefaultConfiguration(@RequestParam Long regionId) {
|
public JsonResult<?> getDefaultConfiguration(@RequestParam Long regionId) {
|
||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
.where(EBIKE_DEFAULT_BILLING_CONFIGURATION.REGION_ID.eq(regionId));
|
.where(EBIKE_DEFAULT_BILLING_CONFIGURATION.REGION_ID.eq(regionId));
|
||||||
EbikeDefaultBillingConfiguration configuration = defaultConfigurationService.getOne(queryWrapper);
|
EbikeDefaultBillingConfiguration configuration = defaultConfigurationService.getOne(queryWrapper);
|
||||||
return JsonResult.success(configuration);
|
return JsonResult.success(configuration);
|
||||||
}
|
}
|
||||||
@ -207,7 +208,7 @@ public class EbikeRegionController {
|
|||||||
/**
|
/**
|
||||||
* 保存运营区高峰计费规则。
|
* 保存运营区高峰计费规则。
|
||||||
*
|
*
|
||||||
* @param configurationVo 配置信息
|
* @param configurationVo 配置信息
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@PostMapping("specialConfiguration")
|
@PostMapping("specialConfiguration")
|
||||||
@ -219,7 +220,7 @@ public class EbikeRegionController {
|
|||||||
/**
|
/**
|
||||||
* 获取运营区高峰计费规则。
|
* 获取运营区高峰计费规则。
|
||||||
*
|
*
|
||||||
* @param regionId 区域ID
|
* @param regionId 区域ID
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@GetMapping("getSpecialConfiguration")
|
@GetMapping("getSpecialConfiguration")
|
||||||
@ -231,7 +232,7 @@ public class EbikeRegionController {
|
|||||||
/**
|
/**
|
||||||
* 保存运营配置。
|
* 保存运营配置。
|
||||||
*
|
*
|
||||||
* @param configurationVo 配置信息
|
* @param configurationVo 配置信息
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@PostMapping("operationConfiguration")
|
@PostMapping("operationConfiguration")
|
||||||
@ -243,7 +244,7 @@ public class EbikeRegionController {
|
|||||||
/**
|
/**
|
||||||
* 获取运营配置。
|
* 获取运营配置。
|
||||||
*
|
*
|
||||||
* @param regionId 区域ID
|
* @param regionId 区域ID
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@GetMapping("getOperationConfiguration")
|
@GetMapping("getOperationConfiguration")
|
||||||
@ -251,4 +252,18 @@ public class EbikeRegionController {
|
|||||||
EbikeOperationConfigVo configuration = ebikeRegionService.getOperationConfiguration(regionId);
|
EbikeOperationConfigVo configuration = ebikeRegionService.getOperationConfiguration(regionId);
|
||||||
return JsonResult.success(configuration);
|
return JsonResult.success(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据当前位置查询查询所属运营区
|
||||||
|
*
|
||||||
|
* @param lng 位置
|
||||||
|
* @return 当前运营区信息
|
||||||
|
*/
|
||||||
|
@GetMapping("getRegionByLocation")
|
||||||
|
public JsonResult<?> getRegionByLocation(@RequestParam("lng") double lng,
|
||||||
|
@RequestParam("lat") double lat) {
|
||||||
|
PGpoint point = new PGpoint(lng, lat);
|
||||||
|
EbikeRegion region = ebikeRegionService.getRegionByLocation(point);
|
||||||
|
return JsonResult.success(region);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.cdzy.operations.model.vo.EbikeOperationConfigVo;
|
|||||||
import com.cdzy.operations.model.vo.EbikeRegionVo;
|
import com.cdzy.operations.model.vo.EbikeRegionVo;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
import com.cdzy.operations.model.entity.EbikeRegion;
|
import com.cdzy.operations.model.entity.EbikeRegion;
|
||||||
|
import org.postgresql.geometric.PGpoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运营区域表 服务层。
|
* 运营区域表 服务层。
|
||||||
@ -37,4 +38,11 @@ public interface EbikeRegionService extends IService<EbikeRegion> {
|
|||||||
* @return 配置信息
|
* @return 配置信息
|
||||||
*/
|
*/
|
||||||
EbikeOperationConfigVo getOperationConfiguration(Long regionId);
|
EbikeOperationConfigVo getOperationConfiguration(Long regionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据当前位置查询当前运营区信息
|
||||||
|
* @param pGpoint 当前位置
|
||||||
|
* @return 运营区信息
|
||||||
|
*/
|
||||||
|
EbikeRegion getRegionByLocation(PGpoint pGpoint);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import com.cdzy.operations.service.EbikeRegionService;
|
|||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.postgresql.geometric.PGpoint;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
|||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
.where(EBIKE_OPERATION_CONFIG.REGION_ID.eq(regionId));
|
.where(EBIKE_OPERATION_CONFIG.REGION_ID.eq(regionId));
|
||||||
operationConfigMapper.deleteByQuery(queryWrapper);
|
operationConfigMapper.deleteByQuery(queryWrapper);
|
||||||
if (operationConfig.getRegionId() == null){
|
if (operationConfig.getRegionId() == null) {
|
||||||
operationConfig.setRegionId(regionId);
|
operationConfig.setRegionId(regionId);
|
||||||
}
|
}
|
||||||
operationConfigMapper.insert(operationConfig);
|
operationConfigMapper.insert(operationConfig);
|
||||||
@ -90,7 +91,7 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
|||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
.where(EBIKE_OPERATION_LOCK_CONFIG.REGION_ID.eq(regionId));
|
.where(EBIKE_OPERATION_LOCK_CONFIG.REGION_ID.eq(regionId));
|
||||||
lockConfigMapper.deleteByQuery(queryWrapper);
|
lockConfigMapper.deleteByQuery(queryWrapper);
|
||||||
if (lockConfig.getRegionId() == null){
|
if (lockConfig.getRegionId() == null) {
|
||||||
lockConfig.setRegionId(regionId);
|
lockConfig.setRegionId(regionId);
|
||||||
}
|
}
|
||||||
lockConfigMapper.insert(lockConfig);
|
lockConfigMapper.insert(lockConfig);
|
||||||
@ -99,7 +100,7 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
|||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
.where(EBIKE_OPERATION_RETURN_CONFIG.REGION_ID.eq(regionId));
|
.where(EBIKE_OPERATION_RETURN_CONFIG.REGION_ID.eq(regionId));
|
||||||
returnConfigMapper.deleteByQuery(queryWrapper);
|
returnConfigMapper.deleteByQuery(queryWrapper);
|
||||||
if (returnConfig.getRegionId() == null){
|
if (returnConfig.getRegionId() == null) {
|
||||||
returnConfig.setRegionId(regionId);
|
returnConfig.setRegionId(regionId);
|
||||||
}
|
}
|
||||||
returnConfigMapper.insert(returnConfig);
|
returnConfigMapper.insert(returnConfig);
|
||||||
@ -108,7 +109,7 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
|||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
.where(EBIKE_OPERATION_USE_CONFIG.REGION_ID.eq(regionId));
|
.where(EBIKE_OPERATION_USE_CONFIG.REGION_ID.eq(regionId));
|
||||||
useConfigMapper.deleteByQuery(queryWrapper);
|
useConfigMapper.deleteByQuery(queryWrapper);
|
||||||
if (useConfig.getRegionId() == null){
|
if (useConfig.getRegionId() == null) {
|
||||||
useConfig.setRegionId(regionId);
|
useConfig.setRegionId(regionId);
|
||||||
}
|
}
|
||||||
useConfigMapper.insert(useConfig);
|
useConfigMapper.insert(useConfig);
|
||||||
@ -142,4 +143,9 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
|||||||
.useConfig(useConfig)
|
.useConfig(useConfig)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EbikeRegion getRegionByLocation(PGpoint pGpoint) {
|
||||||
|
return this.mapper.findCurrentRegion(pGpoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.cdzy.user.controller;
|
package com.cdzy.user.controller;
|
||||||
|
|
||||||
|
import com.cdzy.common.enums.Code;
|
||||||
|
import com.cdzy.common.ex.EbikeException;
|
||||||
import com.cdzy.common.model.response.JsonResult;
|
import com.cdzy.common.model.response.JsonResult;
|
||||||
import com.cdzy.user.model.dto.EbikeUserPageDto;
|
import com.cdzy.user.model.dto.EbikeUserPageDto;
|
||||||
import com.cdzy.user.model.dto.UserValidateDto;
|
import com.cdzy.user.model.dto.UserValidateDto;
|
||||||
@ -12,6 +14,8 @@ import com.cdzy.user.service.EbikeUserRealInfoService;
|
|||||||
import com.cdzy.user.service.EbikeUserService;
|
import com.cdzy.user.service.EbikeUserService;
|
||||||
import com.cdzy.user.utils.RedisUtil;
|
import com.cdzy.user.utils.RedisUtil;
|
||||||
import com.cdzy.user.utils.VerifyUtil;
|
import com.cdzy.user.utils.VerifyUtil;
|
||||||
|
import com.ebike.feign.clients.OperationsFeignClient;
|
||||||
|
import com.ebike.feign.model.vo.FeignEbikeRegionVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@ -46,6 +50,9 @@ public class EbikeUserController {
|
|||||||
@Resource
|
@Resource
|
||||||
private EbikeUserRealInfoService ebikeUserRealInfoService;
|
private EbikeUserRealInfoService ebikeUserRealInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OperationsFeignClient operationsFeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户微信无感登录。
|
* 用户微信无感登录。
|
||||||
*
|
*
|
||||||
@ -185,4 +192,21 @@ public class EbikeUserController {
|
|||||||
Page<EbikeUserVo> list = ebikeUserService.queryPage(userPageDto);
|
Page<EbikeUserVo> list = ebikeUserService.queryPage(userPageDto);
|
||||||
return JsonResult.success(list);
|
return JsonResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前位置的所在运营区
|
||||||
|
*
|
||||||
|
* @param lng 经度
|
||||||
|
* @param lat 维度
|
||||||
|
* @return 运营区信息
|
||||||
|
*/
|
||||||
|
@GetMapping("getRegionByLocation")
|
||||||
|
public JsonResult<?> getRegionByLocation(@RequestParam("lng") double lng,
|
||||||
|
@RequestParam("lat") double lat) {
|
||||||
|
JsonResult<FeignEbikeRegionVo> jsonResult = operationsFeignClient.getRegionByLocation(lng, lat);
|
||||||
|
if (jsonResult.getCode() != Code.SUCCESS) {
|
||||||
|
throw new EbikeException(jsonResult.getMessage());
|
||||||
|
}
|
||||||
|
return JsonResult.success(jsonResult.getData());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user