From 2c249b86e922aef7397dc496fe5bbd84730b0772 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 04 十二月 2024 18:35:04 +0800 Subject: [PATCH] 修改启动异常 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 5 +++-- ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml | 6 +++++- ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java | 4 ++-- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java | 3 ++- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopDetailVO.java | 9 +++++---- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java | 9 +++++---- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java index d9cba6a..788932a 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java @@ -38,9 +38,9 @@ @TableField("pid") private Integer pid; - @ApiModelProperty(value = "营业星期(1,2,3,4,5,6,7)") + @ApiModelProperty(value = "营业星期:1-周一到周日 2-周一周五 3-仅周末") @TableField("business_date") - private String businessDate; + private Integer businessDate; @ApiModelProperty(value = "开始时间(HH:mm)") @TableField("start_time") diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index 577d5d6..d42134e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.List; /** @@ -76,8 +77,8 @@ @GetMapping("/shopDetail") @ApiOperation(value = "门店详情", tags = {"小程序-首页-门店详情"}) public R<ShopDetailVO> shopDetail(@ApiParam("门店id") @RequestParam Integer shopId, - @ApiParam("经度") @RequestParam String longitude, - @ApiParam("纬度") @RequestParam String latitude) { + @ApiParam("经度") @RequestParam BigDecimal longitude, + @ApiParam("纬度") @RequestParam BigDecimal latitude) { return R.ok(shopService.getShopDetail(shopId, longitude, latitude)); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java index eef7edc..78bd58c 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java @@ -5,6 +5,7 @@ import com.ruoyi.other.vo.NearbyShopVO; import com.ruoyi.other.vo.ShopDetailVO; +import java.math.BigDecimal; import java.util.List; /** @@ -19,5 +20,5 @@ List<NearbyShopVO> nearbyShopList(String longitude, String latitude); - ShopDetailVO getShopDetail(Integer shopId,String longitude, String latitude); + ShopDetailVO getShopDetail(Integer shopId, BigDecimal longitude, BigDecimal latitude); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java index d4e899b..32febc1 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java @@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -29,11 +30,11 @@ @Override public List<NearbyShopVO> nearbyShopList(String longitude, String latitude) { - return shopMapper.selectNearbyShopList(longitude,latitude); + return shopMapper.selectNearbyShopList(longitude,latitude); } @Override - public ShopDetailVO getShopDetail(Integer shopId, String longitude, String latitude) { + public ShopDetailVO getShopDetail(Integer shopId, BigDecimal longitude, BigDecimal latitude) { // 查询店铺详情 ShopDetailVO shopDetailVO = shopMapper.selectShopDetail(shopId); if (shopDetailVO == null) { @@ -43,9 +44,9 @@ // 计算距离 if (shopDetailVO.getLongitude() != null && shopDetailVO.getLatitude() != null){ String shopLocation = String.format("%s,%s", shopDetailVO.getLongitude(), shopDetailVO.getLatitude()); - String userLocation = String.format("%s,%s", longitude, latitude); + String userLocation = String.format("%s,%s", longitude.toString(), latitude.toString()); Map<String, Double> distanceMap = GeodesyUtil.getDistance(userLocation, shopLocation); - Double wGs84 = distanceMap.get("WGs84"); + Double wGs84 = distanceMap.get("WGS84"); shopDetailVO.setDistance(wGs84); } return shopDetailVO; diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopDetailVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopDetailVO.java index 96b1aa0..5e13e1f 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopDetailVO.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopDetailVO.java @@ -1,5 +1,6 @@ package com.ruoyi.other.vo; +import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -29,8 +30,8 @@ @ApiModelProperty(value = "资质证书图片") private String certification; - @ApiModelProperty(value = "营业星期(1,2,3,4,5,6,7)") - private String businessDate; + @ApiModelProperty(value = "营业星期:1-周一到周日 2-周一周五 3-仅周末") + private Integer businessDate; @ApiModelProperty(value = "开始时间(HH:mm)") private String startTime; @@ -63,8 +64,8 @@ private Double distance; @ApiModelProperty(value = "经度") - private String longitude; + private BigDecimal longitude; @ApiModelProperty(value = "纬度") - private String latitude; + private BigDecimal latitude; } diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml index 7576bb5..d73727f 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml @@ -31,6 +31,8 @@ ts.business_date, ts.start_time, ts.end_time, + ts.longitude, + ts.latitude, AVG( tss.score ) score FROM t_shop ts @@ -47,6 +49,8 @@ ts.address, ts.business_date, ts.start_time, - ts.end_time + ts.end_time, + ts.longitude, + ts.latitude </select> </mapper> \ No newline at end of file -- Gitblit v1.7.1