From 36f2f14ace300855a436f1ed9faf07049587a08f Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 04 一月 2025 09:31:26 +0800
Subject: [PATCH] 修改bug
---
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java | 30 ++--
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/GeodesyUtil.java | 4
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java | 24 ++++
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java | 5
ruoyi-service/ruoyi-order/pom.xml | 7 +
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java | 2
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 172 +++++++++++++++++++---------
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java | 17 ++
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 2
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java | 26 ----
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/tencentMap/TencentMapUtil.java | 40 ++++++
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserCoupon.java | 2
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java | 13 +
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/GeodesyUtil.java | 4
14 files changed, 241 insertions(+), 107 deletions(-)
diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserCoupon.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserCoupon.java
index 2136a62..f493dbb 100644
--- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserCoupon.java
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserCoupon.java
@@ -32,6 +32,8 @@
@TableId("id")
private Long id;
+ @TableField(exist = false)
+ private String idStr;
@ApiModelProperty(value = "删除标志(0=否,1=是)")
@TableField("del_flag")
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java
index 6e75148..0952e7e 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java
@@ -15,4 +15,6 @@
private Integer id;
@ApiModelProperty("门店名称")
private String name;
+ @ApiModelProperty("距离")
+ private Long distance;
}
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 fb706ed..8020f36 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
@@ -170,5 +170,29 @@
private LocalDateTime createTime;
+ @ApiModelProperty(value = "省")
+ @TableField("province")
+ private String province;
+
+ @ApiModelProperty(value = "省编号")
+ @TableField("province_code")
+ private String provinceCode;
+
+ @ApiModelProperty(value = "市")
+ @TableField("city")
+ private String city;
+
+ @ApiModelProperty(value = "市编号")
+ @TableField("city_code")
+ private String cityCode;
+
+ @ApiModelProperty(value = "区")
+ @TableField("district")
+ private String district;
+
+ @ApiModelProperty(value = "区编号")
+ @TableField("district_code")
+ private String districtCode;
+
}
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java
index 11736f4..8c95d49 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java
@@ -586,4 +586,21 @@
}
return R.ok();
}
+
+
+
+ @ResponseBody
+ @GetMapping("/switchShop")
+ @ApiOperation(value = "切换门店", tags = {"门店后台-首页"})
+ public R switchShop(@PathVariable("shopId") Integer shopId){
+ Long userid = tokenService.getLoginUser().getUserid();
+ UserShop one = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, userid).eq(UserShop::getShopId, shopId));
+ if(null == one){
+ return R.fail("切换失败");
+ }
+ SysUser sysUser = userService.getById(userid);
+ sysUser.setObjectId(shopId);
+ userService.updateById(sysUser);
+ return R.ok();
+ }
}
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
index 3f9f7e9..2b26388 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
@@ -228,13 +228,13 @@
@Override
public int insertDept(SysDept dept)
{
- SysDept info = deptMapper.selectDeptById(dept.getParentId());
- // 如果父节点不为正常状态,则不允许新增子节点
- if (null != info && !UserConstants.DEPT_NORMAL.equals(info.getStatus()))
- {
- throw new ServiceException("部门停用,不允许新增");
- }
- dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
+// SysDept info = deptMapper.selectDeptById(dept.getParentId());
+// // 如果父节点不为正常状态,则不允许新增子节点
+// if (null != info && !UserConstants.DEPT_NORMAL.equals(info.getStatus()))
+// {
+// throw new ServiceException("部门停用,不允许新增");
+// }
+// dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
//判断店铺数据
Long userid = tokenService.getLoginUser().getUserid();
SysUser sysUser = sysUserService.getById(userid);
@@ -253,14 +253,14 @@
@Override
public int updateDept(SysDept dept)
{
- SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
- SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
- if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
- String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
- String oldAncestors = oldDept.getAncestors();
- dept.setAncestors(newAncestors);
- updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
- }
+// SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
+// SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
+// if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
+// String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
+// String oldAncestors = oldDept.getAncestors();
+// dept.setAncestors(newAncestors);
+// updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
+// }
//判断店铺数据
Long userid = tokenService.getLoginUser().getUserid();
SysUser sysUser = sysUserService.getById(userid);
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
index 0ddb1ef..8608eff 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
@@ -75,6 +75,7 @@
.lt(status!=null&&status==3,UserCoupon::getEndTime, LocalDateTime.now())
.eq(UserCoupon::getAppUserId, userid).page(Page.of(pageNum-1, pageSize));
for (UserCoupon record : page.getRecords()) {
+ record.setIdStr(record.getId().toString());
CouponInfo data = couponClient.detail(record.getCouponId()).getData();
CouponInfoVo vo = new CouponInfoVo();
BeanUtils.copyProperties(data,vo);
@@ -228,6 +229,14 @@
BeanUtils.copyProperties(couponInfo, couponInfoVo);
couponInfoVo.setGoodNames(goods.stream().map(Goods::getName).collect(Collectors.toList()));
userCoupon.setCouponInfoVo(couponInfoVo);
+ if (userCoupon.getUseTime()==null){
+ userCoupon.setStatus(1);
+ if (userCoupon.getEndTime().isBefore(LocalDateTime.now())){
+ userCoupon.setStatus(3);
+ }
+ }else {
+ userCoupon.setStatus(2);
+ }
return R.ok(userCoupon);
}
@@ -239,10 +248,10 @@
if(null == userCoupon){
return R.ok("核销码错误");
}
- if(userCoupon.getStatus() == 2){
+ if(userCoupon.getUseTime() != null){
return R.ok("优惠券已使用");
}
- if(userCoupon.getStatus() == 3){
+ if(LocalDateTime.now().isAfter(userCoupon.getEndTime())){
return R.ok("优惠券已过期");
}
userCoupon.setStatus(2);
diff --git a/ruoyi-service/ruoyi-order/pom.xml b/ruoyi-service/ruoyi-order/pom.xml
index 52c2a8b..cffc4d5 100644
--- a/ruoyi-service/ruoyi-order/pom.xml
+++ b/ruoyi-service/ruoyi-order/pom.xml
@@ -156,6 +156,13 @@
<artifactId>sdk</artifactId>
<version>1.0.11</version>
</dependency>
+
+ <!-- 计算两坐标间的直线距离 -->
+ <dependency>
+ <groupId>org.gavaghan</groupId>
+ <artifactId>geodesy</artifactId>
+ <version>1.1.3</version>
+ </dependency>
</dependencies>
<build>
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java
index 25e73ec..a3e9576 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java
@@ -113,33 +113,7 @@
}
- @ResponseBody
- @GetMapping("/getVerifiableShop")
- @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"})
- public R<List<VerifiableShopVo>> getVerifiableShop(){
- LoginUser loginUser = tokenService.getLoginUserApplet();
- List<ShoppingCart> shoppingCarts = shoppingCartService.list(new LambdaQueryWrapper<ShoppingCart>()
- .eq(ShoppingCart::getAppUserId, loginUser.getUserid()));
- List<Integer> goodsIds = shoppingCarts.stream().map(ShoppingCart::getGoodsId).collect(Collectors.toList());
- GetGoodsShopByGoodsIds goodsShopByGoodsIds = new GetGoodsShopByGoodsIds();
- goodsShopByGoodsIds.setGoodsIds(goodsIds);
- R<List<GoodsShop>> r = goodsShopClient.getGoodsShopByGoodsIds(goodsShopByGoodsIds);
- List<GoodsShop> goodsShops = r.getData();
- List<VerifiableShopVo> verifiableShopVoList = new ArrayList<>();
- if (CollectionUtil.isNotEmpty(goodsShops)){
- for (GoodsShop goodsShop : goodsShops) {
- R<Shop> shopR = shopClient.getShopById(goodsShop.getShopId());
- if (R.isSuccess(shopR) && null != shopR.getData()){
- VerifiableShopVo verifiableShopVo = new VerifiableShopVo();
- verifiableShopVo.setId(shopR.getData().getId());
- verifiableShopVo.setName(shopR.getData().getName());
- verifiableShopVoList.add(verifiableShopVo);
- }
- }
- }
- return R.ok(verifiableShopVoList);
- }
@GetMapping("/getGoodsPrice")
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
index b5793fe..e3bc81d 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -335,7 +335,7 @@
@Override
public R cancelOrder(Long orderId) {
Order order = this.getById(orderId);
- if(Arrays.asList(4, 5, 6, 7, 8).contains(order.getOrderStatus())){
+ if(Arrays.asList(5, 6, 7).contains(order.getOrderStatus())){
return R.fail("无效的操作");
}
order.setOrderStatus(5);
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/task/GeodesyUtil.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/GeodesyUtil.java
similarity index 96%
rename from ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/task/GeodesyUtil.java
rename to ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/GeodesyUtil.java
index 42e9578..6cd7ad0 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/task/GeodesyUtil.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/GeodesyUtil.java
@@ -1,4 +1,4 @@
-package com.ruoyi.other.task;
+package com.ruoyi.order.util;
import com.ruoyi.common.core.utils.StringUtils;
import org.gavaghan.geodesy.Ellipsoid;
@@ -68,6 +68,6 @@
public static void main(String[] ages){
GeodesyUtil geodesyUtil = new GeodesyUtil();
- geodesyUtil.getDistance("115.481028,39.989643", "114.465302,40.004717");
+ getDistance("115.481028,39.989643", "114.465302,40.004717");
}
}
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 368c8ae..d33b3dd 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
@@ -11,11 +11,14 @@
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
+import com.ruoyi.order.vo.VerifiableShopVo;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.domain.ShopScore;
import com.ruoyi.other.mapper.ShopMapper;
import com.ruoyi.other.service.ShopScoreService;
import com.ruoyi.other.service.ShopService;
+import com.ruoyi.other.util.GeodesyUtil;
+import com.ruoyi.other.util.tencentMap.TencentMapUtil;
import com.ruoyi.other.vo.NearbyShopVO;
import com.ruoyi.other.vo.ShopDetailVO;
import com.ruoyi.other.vo.ShopStatistics;
@@ -34,10 +37,7 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -95,6 +95,10 @@
shop.setServerOrderNumber(0);
shop.setCustomOrderNumber(0);
shop.setAppUserId(appUser.getId());
+ String city = TencentMapUtil.inverseGeographicalAnalysis(shop.getLongitude(), shop.getLatitude(), false);
+ shop.setProvinceCode(city.substring(0, 2) + "0000");
+ shop.setCityCode(city.substring(0, 4) + "00");
+ shop.setDistrictCode(city);
shopService.save(shop);
AppUserShop appUserShop = new AppUserShop();
@@ -195,71 +199,73 @@
if (!shopService.cheUserByPhone(phone)) {
return R.fail("该手机号未注册");
}
+ String city = TencentMapUtil.inverseGeographicalAnalysis(shop.getLongitude(), shop.getLatitude(), false);
+ shop.setProvinceCode(city.substring(0, 2) + "0000");
+ shop.setCityCode(city.substring(0, 4) + "00");
+ shop.setDistrictCode(city);
Shop old_shop = shopService.getById(shop.getId());
shopService.updateById(shop);
//修改管理员
- if(!phone.equals(old_shop.getPhone())){
- AppUser appUser = appUserClient.getAppUserById(old_shop.getAppUserId());
- //需要先判断用户是否没有关联任何门店
- List<AppUserShop> userShops = appUserShopClient.getAppUserShop(appUser.getId()).getData();
- if(userShops.size() == 1 && userShops.get(0).getShopId().equals(shop.getId())){
- appUser.setUserType(1);
- appUserClient.editAppUserById(appUser);
- }
- AppUserShop appUserShop = new AppUserShop();
- appUserShop.setAppUserId(appUser.getId());
- appUserShop.setShopId(shop.getId());
- appUserShopClient.delAppUserShop(appUserShop);
+ AppUser appUser = appUserClient.getAppUserById(old_shop.getAppUserId());
+ //需要先判断用户是否没有关联任何门店
+ List<AppUserShop> userShops = appUserShopClient.getAppUserShop(appUser.getId()).getData();
+ if(userShops.size() == 1 && userShops.get(0).getShopId().equals(shop.getId())){
+ appUser.setUserType(1);
+ appUserClient.editAppUserById(appUser);
+ }
+ AppUserShop appUserShop = new AppUserShop();
+ appUserShop.setAppUserId(appUser.getId());
+ appUserShop.setShopId(shop.getId());
+ appUserShopClient.delAppUserShop(appUserShop);
- //添加新管理员
- appUser = appUserClient.getAppUserByPhone1(phone).getData();
- appUserShop = new AppUserShop();
- appUserShop.setAppUserId(appUser.getId());
- appUserShop.setShopId(shop.getId());
- appUserClient.addAppUserShop(appUserShop);
+ //添加新管理员
+ appUser = appUserClient.getAppUserByPhone1(phone).getData();
+ appUserShop = new AppUserShop();
+ appUserShop.setAppUserId(appUser.getId());
+ appUserShop.setShopId(shop.getId());
+ appUserClient.addAppUserShop(appUserShop);
- //修改管理员
- shop.setAppUserId(appUser.getId());
- shopService.updateById(shop);
+ //修改管理员
+ shop.setAppUserId(appUser.getId());
+ shopService.updateById(shop);
- //添加门店后台账号和门店关系数据
- SysUser sysUser = sysUserClient.queryUserByUserName(phone).getData();
- if(null != sysUser){
- UserShop userShop = new UserShop();
+ //添加门店后台账号和门店关系数据
+ SysUser sysUser = sysUserClient.queryUserByUserName(phone).getData();
+ if(null != sysUser){
+ UserShop userShop = new UserShop();
+ userShop.setUserId(sysUser.getUserId());
+ userShop.setShopId(shop.getId());
+ userShop.setRoleType(1);
+ List<UserShop> data = userShopClient.getUserShop(userShop).getData();
+ if(null == data || data.size() == 0){
+ userShop = new UserShop();
userShop.setUserId(sysUser.getUserId());
- userShop.setShopId(shop.getId());
- userShop.setRoleType(1);
- List<UserShop> data = userShopClient.getUserShop(userShop).getData();
- if(null == data || data.size() == 0){
- userShop = new UserShop();
- userShop.setUserId(sysUser.getUserId());
- userShop.setShopId(shop.getId());
- userShop.setRoleType(1);
- userShopClient.saveUserShop(userShop);
- }
- }else{
- //添加管理后台账号
- SysUser user = new SysUser();
- user.setDeptId(1L);
- user.setUserName(appUser.getPhone());
- user.setNickName(appUser.getName());
- user.setPhonenumber(appUser.getPhone());
- user.setAvatar(appUser.getAvatar());
- user.setStatus("0");
- user.setDelFlag("0");
- user.setRoleType(2);
- user.setObjectId(shop.getId());
- user.setAppUserId(appUser.getId());
- user.setPassword(phone.substring(5));
- user.setCreateTime(new Date());
- Long userId = sysUserClient.saveShopUser(user).getData();
-
- UserShop userShop = new UserShop();
- userShop.setUserId(userId);
userShop.setShopId(shop.getId());
userShop.setRoleType(1);
userShopClient.saveUserShop(userShop);
}
+ }else{
+ //添加管理后台账号
+ SysUser user = new SysUser();
+ user.setDeptId(1L);
+ user.setUserName(appUser.getPhone());
+ user.setNickName(appUser.getName());
+ user.setPhonenumber(appUser.getPhone());
+ user.setAvatar(appUser.getAvatar());
+ user.setStatus("0");
+ user.setDelFlag("0");
+ user.setRoleType(2);
+ user.setObjectId(shop.getId());
+ user.setAppUserId(appUser.getId());
+ user.setPassword(phone.substring(5));
+ user.setCreateTime(new Date());
+ Long userId = sysUserClient.saveShopUser(user).getData();
+
+ UserShop userShop = new UserShop();
+ userShop.setUserId(userId);
+ userShop.setShopId(shop.getId());
+ userShop.setRoleType(1);
+ userShopClient.saveUserShop(userShop);
}
return R.ok();
}
@@ -448,5 +454,55 @@
public void updateShop(@RequestBody Shop shop){
shopService.updateById(shop);
}
+
+
+
+
+ @ResponseBody
+ @GetMapping("/getVerifiableShop")
+ @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"})
+ public R<List<VerifiableShopVo>> getVerifiableShop(String longitude, String latitude){
+ String city = TencentMapUtil.inverseGeographicalAnalysis(longitude, latitude, false);
+ city = city.substring(0, 4) + "00";
+ List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getCityCode, city));
+ List<VerifiableShopVo> verifiableShopVoList = new ArrayList<>();
+ for (Shop shop : list) {
+ VerifiableShopVo vo = new VerifiableShopVo();
+ vo.setId(shop.getId());
+ vo.setName(shop.getName());
+ Double wgs84 = GeodesyUtil.getDistance(longitude + "," + latitude, shop.getLongitude() + "," + shop.getLatitude()).get("WGS84");
+ vo.setDistance(wgs84.longValue());
+ verifiableShopVoList.add(vo);
+ }
+ verifiableShopVoList.sort(new Comparator<VerifiableShopVo>() {
+ @Override
+ public int compare(VerifiableShopVo o1, VerifiableShopVo o2) {
+ return o1.getDistance().compareTo(o2.getDistance());
+ }
+ });
+ return R.ok(verifiableShopVoList);
+ }
+
+
+
+ @ResponseBody
+ @GetMapping("/getSysUserShop")
+ @ApiOperation(value = "获取可切换的门店列表", tags = {"门店后台-首页"})
+ public R<List<VerifiableShopVo>> getSysUserShop(){
+ Long userid = tokenService.getLoginUser().getUserid();
+ UserShop userShop = new UserShop();
+ userShop.setUserId(userid);
+ List<UserShop> data = userShopClient.getUserShop(userShop).getData();
+ List<Integer> collect = data.stream().map(UserShop::getShopId).collect(Collectors.toList());
+ List<Shop> shops = shopService.listByIds(collect);
+ List<VerifiableShopVo> list = new ArrayList<>();
+ for (Shop shop : shops) {
+ VerifiableShopVo vo = new VerifiableShopVo();
+ vo.setId(shop.getId());
+ vo.setName(shop.getName());
+ list.add(vo);
+ }
+ return R.ok(list);
+ }
}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
index cda2f44..bd8b676 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -19,6 +19,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
+import java.util.List;
/**
* <p>
@@ -103,7 +104,9 @@
@ApiOperation(value = "技师列表", tags = {"技师列表-小程序"})
public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId,@ApiParam("技师姓名") String name) {
startPage();
- return R.ok(getDataTable(technicianService.getTechnicianListByShopId(shopId,name)));
+ List<TechnicianVO> technicianListByShopId = technicianService.getTechnicianListByShopId(shopId, name);
+ TableDataInfo<TechnicianVO> dataTable = getDataTable(technicianListByShopId);
+ return R.ok(dataTable);
}
@GetMapping("/manage/list")
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/task/GeodesyUtil.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/GeodesyUtil.java
similarity index 96%
copy from ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/task/GeodesyUtil.java
copy to ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/GeodesyUtil.java
index 42e9578..a360115 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/task/GeodesyUtil.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/GeodesyUtil.java
@@ -1,4 +1,4 @@
-package com.ruoyi.other.task;
+package com.ruoyi.other.util;
import com.ruoyi.common.core.utils.StringUtils;
import org.gavaghan.geodesy.Ellipsoid;
@@ -68,6 +68,6 @@
public static void main(String[] ages){
GeodesyUtil geodesyUtil = new GeodesyUtil();
- geodesyUtil.getDistance("115.481028,39.989643", "114.465302,40.004717");
+ getDistance("115.481028,39.989643", "114.465302,40.004717");
}
}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/tencentMap/TencentMapUtil.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/tencentMap/TencentMapUtil.java
new file mode 100644
index 0000000..61dd2db
--- /dev/null
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/tencentMap/TencentMapUtil.java
@@ -0,0 +1,40 @@
+package com.ruoyi.other.util.tencentMap;
+
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 腾讯地图
+ * @author zhibing.pu
+ * @Date 2024/12/19 9:37
+ */
+@Slf4j
+public class TencentMapUtil {
+
+ private static String key = "NH7BZ-XNW6Z-IKUX7-TL3H2-UN6RO-KKFHQ";
+
+ /**
+ * 根据经纬度获取行政区划代码
+ * @param lon 经度
+ * @param lat 纬度
+ * @param poi 是否返回周边poi
+ * @return
+ */
+ public static String inverseGeographicalAnalysis(String lon, String lat, boolean poi){
+ HttpRequest get = HttpUtil.createGet("https://apis.map.qq.com/ws/geocoder/v1/?location=" + lat + "," + lon + "&key=" + key + "&get_poi=" + (poi ? 1 : 0));
+ HttpResponse execute = get.execute();
+ JSONObject jsonObject = JSON.parseObject(execute.body());
+ Integer status = jsonObject.getInteger("status");
+ if(0 != status){
+ log.error(jsonObject.getString("message"));
+ return null;
+ }
+ JSONObject result = jsonObject.getJSONObject("result");
+ JSONObject ad_info = result.getJSONObject("ad_info");
+ return ad_info.getString("adcode");
+ }
+}
--
Gitblit v1.7.1