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.FeignEbikeUserBikeInfo;
|
||||
import com.ebike.feign.model.dto.FeignEbikeUserLockDto;
|
||||
import com.ebike.feign.model.vo.EbikeLockVo;
|
||||
import com.ebike.feign.model.vo.FeignEbikeBikeRadiusVo;
|
||||
import com.ebike.feign.model.vo.FeignEbikeReportRecordVo;
|
||||
import com.ebike.feign.model.vo.FeignInspectionSwapOrderVo;
|
||||
import com.ebike.feign.model.vo.*;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -116,4 +113,15 @@ public interface OperationsFeignClient {
|
||||
*/
|
||||
@GetMapping("/ebikeReportRecord/getReportRecord")
|
||||
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.util.StringUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.postgresql.geometric.PGpoint;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -251,4 +252,18 @@ public class EbikeRegionController {
|
||||
EbikeOperationConfigVo configuration = ebikeRegionService.getOperationConfiguration(regionId);
|
||||
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.mybatisflex.core.service.IService;
|
||||
import com.cdzy.operations.model.entity.EbikeRegion;
|
||||
import org.postgresql.geometric.PGpoint;
|
||||
|
||||
/**
|
||||
* 运营区域表 服务层。
|
||||
@ -37,4 +38,11 @@ public interface EbikeRegionService extends IService<EbikeRegion> {
|
||||
* @return 配置信息
|
||||
*/
|
||||
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.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.postgresql.geometric.PGpoint;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -81,7 +82,7 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_OPERATION_CONFIG.REGION_ID.eq(regionId));
|
||||
operationConfigMapper.deleteByQuery(queryWrapper);
|
||||
if (operationConfig.getRegionId() == null){
|
||||
if (operationConfig.getRegionId() == null) {
|
||||
operationConfig.setRegionId(regionId);
|
||||
}
|
||||
operationConfigMapper.insert(operationConfig);
|
||||
@ -90,7 +91,7 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_OPERATION_LOCK_CONFIG.REGION_ID.eq(regionId));
|
||||
lockConfigMapper.deleteByQuery(queryWrapper);
|
||||
if (lockConfig.getRegionId() == null){
|
||||
if (lockConfig.getRegionId() == null) {
|
||||
lockConfig.setRegionId(regionId);
|
||||
}
|
||||
lockConfigMapper.insert(lockConfig);
|
||||
@ -99,7 +100,7 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_OPERATION_RETURN_CONFIG.REGION_ID.eq(regionId));
|
||||
returnConfigMapper.deleteByQuery(queryWrapper);
|
||||
if (returnConfig.getRegionId() == null){
|
||||
if (returnConfig.getRegionId() == null) {
|
||||
returnConfig.setRegionId(regionId);
|
||||
}
|
||||
returnConfigMapper.insert(returnConfig);
|
||||
@ -108,7 +109,7 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_OPERATION_USE_CONFIG.REGION_ID.eq(regionId));
|
||||
useConfigMapper.deleteByQuery(queryWrapper);
|
||||
if (useConfig.getRegionId() == null){
|
||||
if (useConfig.getRegionId() == null) {
|
||||
useConfig.setRegionId(regionId);
|
||||
}
|
||||
useConfigMapper.insert(useConfig);
|
||||
@ -142,4 +143,9 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
||||
.useConfig(useConfig)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EbikeRegion getRegionByLocation(PGpoint pGpoint) {
|
||||
return this.mapper.findCurrentRegion(pGpoint);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
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.user.model.dto.EbikeUserPageDto;
|
||||
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.utils.RedisUtil;
|
||||
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.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -46,6 +50,9 @@ public class EbikeUserController {
|
||||
@Resource
|
||||
private EbikeUserRealInfoService ebikeUserRealInfoService;
|
||||
|
||||
@Resource
|
||||
private OperationsFeignClient operationsFeignClient;
|
||||
|
||||
/**
|
||||
* 用户微信无感登录。
|
||||
*
|
||||
@ -185,4 +192,21 @@ public class EbikeUserController {
|
||||
Page<EbikeUserVo> list = ebikeUserService.queryPage(userPageDto);
|
||||
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