小程序首页接口修改
This commit is contained in:
parent
870a4de2fd
commit
f8f46d8f3c
|
|
@ -0,0 +1,39 @@
|
|||
package com.czg.controller.user;
|
||||
|
||||
import com.czg.account.entity.PlatformDict;
|
||||
import com.czg.account.service.PlatformDictService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 小程序平台配置相关
|
||||
* @author Administrator
|
||||
*/
|
||||
@RequestMapping("/user/dict")
|
||||
@RestController
|
||||
public class UPlatFormDictController {
|
||||
@Resource
|
||||
private PlatformDictService platformDictService;
|
||||
|
||||
/**
|
||||
* 获取小程序dict配置
|
||||
* @param type homeDistrict--金刚区(首页)
|
||||
* carousel--轮播图
|
||||
* proTag--商品标签
|
||||
* shopTag--店铺标签
|
||||
* icon--小图标
|
||||
* subShop--预约到店顶部图
|
||||
* group--团购卷分类对应顶部图 value为团购卷Id
|
||||
* ownMenu--个人中心菜单
|
||||
* @return dict信息
|
||||
*/
|
||||
@GetMapping
|
||||
public CzgResult<PlatformDict> get(@RequestParam String type) {
|
||||
return CzgResult.success(platformDictService.getOne(new QueryWrapper().eq(PlatformDict::getType, type)));
|
||||
}
|
||||
}
|
||||
|
|
@ -2,9 +2,11 @@ package com.czg.controller.user;
|
|||
|
||||
import com.czg.account.dto.shopinfo.ShopInfoByCodeDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoDetailDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoSubVO;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
|
@ -39,4 +41,16 @@ public class UShopInfoController {
|
|||
public CzgResult<ShopInfoDetailDTO> get(Long shopId) {
|
||||
return CzgResult.success(shopInfoService.getDetail(shopId == null ? StpKit.USER.getShopId() : shopId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约店铺列表,对应预约到店
|
||||
* @param lng 精度
|
||||
* @param lat 维度
|
||||
* @param distance 单位m
|
||||
* @return 列表
|
||||
*/
|
||||
@GetMapping("/subList")
|
||||
public CzgResult<Page<ShopInfoSubVO>> subList(@RequestParam String lng, @RequestParam String lat, @RequestParam float distance) {
|
||||
return CzgResult.success(shopInfoService.getSubList(lat, lng, distance));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.czg.account.dto.shopinfo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class ShopInfoSubVO {
|
||||
private Long id;
|
||||
private String shopName;
|
||||
private String logo;
|
||||
private String phone;
|
||||
private String address;
|
||||
private Long distance;
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.czg.account.dto.shopuser;
|
||||
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
|
@ -29,4 +30,6 @@ public class ShopUserDetailDTO extends ShopUser {
|
|||
*/
|
||||
private Long shopId;
|
||||
|
||||
private ShopInfo shopInfo;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.czg.product.service;
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.PlatformDict;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.czg.product.service;
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.PlatformDictType;
|
||||
|
|
@ -21,4 +21,7 @@ public interface ShopInfoService extends IService<ShopInfo> {
|
|||
ShopInfoByCodeDTO getByCode(String tableCode, String lat, String lng, boolean checkState);
|
||||
|
||||
ShopInfoDetailDTO getDetail(Long shopId);
|
||||
|
||||
Page<ShopInfoSubVO> getSubList(String lat, String lng, float distance);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.czg.service.product.mapper;
|
||||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.account.entity.PlatformDict;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.czg.service.product.mapper;
|
||||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.account.entity.PlatformDictType;
|
||||
|
|
@ -1,7 +1,12 @@
|
|||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.czg.account.dto.shopinfo.ShopInfoDetailDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoSubVO;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺信息 映射层。
|
||||
|
|
@ -11,4 +16,5 @@ import com.mybatisflex.core.BaseMapper;
|
|||
*/
|
||||
public interface ShopInfoMapper extends BaseMapper<ShopInfo> {
|
||||
|
||||
List<ShopInfoSubVO> getSubList(@Param("lng") String lng, @Param("lat") String lat, @Param("distance") float distance);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.czg.service.product.service.impl;
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.czg.service.product.mapper.PlatformDictMapper;
|
||||
import com.czg.service.account.mapper.PlatformDictMapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.account.entity.PlatformDict;
|
||||
import com.czg.product.service.PlatformDictService;
|
||||
import com.czg.account.service.PlatformDictService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
package com.czg.service.product.service.impl;
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.czg.service.product.mapper.PlatformDictTypeMapper;
|
||||
import com.czg.service.account.mapper.PlatformDictTypeMapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.account.entity.PlatformDictType;
|
||||
import com.czg.product.service.PlatformDictTypeService;
|
||||
import com.czg.account.service.PlatformDictTypeService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
|
@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|||
* @author zs
|
||||
* @since 2025-02-28
|
||||
*/
|
||||
@DubboService
|
||||
@Service
|
||||
public class PlatformDictTypeServiceImpl extends ServiceImpl<PlatformDictTypeMapper, PlatformDictType> implements PlatformDictTypeService{
|
||||
|
||||
|
|
@ -17,6 +17,9 @@ import com.czg.service.RedisService;
|
|||
import com.czg.service.account.mapper.ShopInfoMapper;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.utils.GeoUtil;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
|
|
@ -210,4 +213,10 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||
Map<String, ShopExtend> shopExtendMap = shopExtends.stream().collect(Collectors.toMap(ShopExtend::getAutoKey, i -> i));
|
||||
return new ShopInfoDetailDTO(shopInfo, shopExtendMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ShopInfoSubVO> getSubList(String lat, String lng, float distance) {
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
return PageUtil.convert(new PageInfo<>(mapper.getSubList(lng, lat, distance)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,8 +274,11 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||
shopUserDetailDTO.setCouponNum(couponNum);
|
||||
|
||||
ShopInfo shopInfo = shopInfoMapper.selectOneById(shopId);
|
||||
shopUserDetailDTO.setShopName(shopInfo.getShopName());
|
||||
shopUserDetailDTO.setShopId(shopInfo.getId());
|
||||
if (shopInfo != null) {
|
||||
shopUserDetailDTO.setShopName(shopInfo.getShopName());
|
||||
shopUserDetailDTO.setShopId(shopInfo.getId());
|
||||
shopUserDetailDTO.setShopInfo(shopInfo);
|
||||
}
|
||||
return shopUserDetailDTO;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.product.mapper.PlatformDictMapper">
|
||||
<mapper namespace="com.czg.service.account.mapper.PlatformDictMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -2,6 +2,6 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.product.mapper.PlatformDictTypeMapper">
|
||||
<mapper namespace="com.czg.service.account.mapper.PlatformDictTypeMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -4,4 +4,13 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.account.mapper.ShopInfoMapper">
|
||||
|
||||
<select id="getSubList" resultType="com.czg.account.dto.shopinfo.ShopInfoSubVO">
|
||||
select ST_Distance_Sphere(
|
||||
POINT(lng, lat),
|
||||
POINT(#{lng}, #{lat})
|
||||
) / 1000 AS distance, id, shop_name, logo, phone, address
|
||||
from tb_shop_info
|
||||
WHERE ST_Distance_Sphere(POINT(lng, lat), POINT(#{lng}, #{lat})) <= #{distance}
|
||||
order by distance
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
package com.czg.service.product.service.impl;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.entity.PlatformDict;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.SysDict;
|
||||
import com.czg.product.service.HomePageService;
|
||||
import com.czg.product.service.PlatformDictService;
|
||||
import com.czg.account.service.PlatformDictService;
|
||||
import com.czg.product.service.SysDictService;
|
||||
import com.czg.account.vo.home.BannerInfoVo;
|
||||
import com.czg.account.vo.home.HomePageVO;
|
||||
|
|
@ -17,18 +15,15 @@ import com.czg.product.service.ProdSkuService;
|
|||
import com.czg.product.service.ProductService;
|
||||
import com.czg.product.vo.RecommendProVO;
|
||||
import com.czg.service.product.mapper.ProductMapper;
|
||||
import com.czg.utils.JoinQueryWrapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -45,8 +40,9 @@ public class HomePageServiceImpl implements HomePageService {
|
|||
};
|
||||
|
||||
|
||||
@Resource
|
||||
@DubboReference
|
||||
private PlatformDictService platformDictService;
|
||||
|
||||
@Resource
|
||||
private SysDictService sysDictService;
|
||||
@Resource
|
||||
|
|
|
|||
Loading…
Reference in New Issue