huliguo
2025-04-01 9e8c542caf11c0b72639a8e323fa81fd3b4f594e
首页
1 文件已重命名
23个文件已修改
6个文件已添加
609 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/Price.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopScore.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/SysConfigFallbackFactory.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysConfigClient.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysConfigMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/AgreementController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopScoreMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopScoreService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java 165 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopScoreServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/Price.java
@@ -3,6 +3,7 @@
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class Price {
@@ -15,9 +16,14 @@
     */
    private Integer point;
    /**
     * 获取结束时间
     * 获取开始时间
     */
    private Long endTime;
    private LocalDateTime startTime;
    /**
     * 获取开始时间
     */
    private LocalDateTime endTime;
    /**
     * 现金支付
     */
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java
@@ -140,6 +140,13 @@
    @TableField(exist = false)
    private String payMethod;
    @ApiModelProperty(value = "经度")
    @TableField(exist = false)
    private BigDecimal longitude;
    @ApiModelProperty(value = "纬度")
    @TableField(exist = false)
    private BigDecimal latitude;
    /**
     * 排序字段
     */
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java
@@ -68,7 +68,7 @@
    @TableField("is_shelves")
    private Integer isShelves;
    @TableField(exist = false)
    private List<GoodsSeckill> goodsSeckills;
    @TableField(exist = false)
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopScore.java
New file
@@ -0,0 +1,42 @@
package com.ruoyi.other.api.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@TableName("t_shop_score")
@EqualsAndHashCode(callSuper = false)
@Data
@ApiModel(value="ShopScore对象", description="")
public class ShopScore implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "主键")
    @TableId("id")
    private Long id;
    @ApiModelProperty(value = "用户id")
    @TableField("app_user_id")
    private Long appUserId;
    @ApiModelProperty(value = "门店id")
    @TableField("shop_id")
    private Long shopId;
    @ApiModelProperty(value = "评分")
    @TableField("score")
    private BigDecimal score;
    @ApiModelProperty(value = "添加时间")
    @TableField("create_time")
    private LocalDateTime createTime;
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysConfig.java
File was renamed from ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java
@@ -1,4 +1,4 @@
package com.ruoyi.system.domain;
package com.ruoyi.system.api.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/SysConfigFallbackFactory.java
New file
@@ -0,0 +1,26 @@
package com.ruoyi.system.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysConfig;
import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysConfigClient;
import com.ruoyi.system.api.feignClient.SysUserClient;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class SysConfigFallbackFactory implements FallbackFactory<SysConfigClient> {
    @Override
    public SysConfigClient create(Throwable cause) {
        return new SysConfigClient(){
            @Override
            public R<SysConfig> getInfo(String configId) {
                System.out.println(cause.getMessage());
                return R.fail("获取系统配置失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysConfigClient.java
New file
@@ -0,0 +1,21 @@
package com.ruoyi.system.api.feignClient;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysConfig;
import com.ruoyi.system.api.factory.SysConfigFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
 * @author huliguo
 * @Date 2025/4/1
 */
@FeignClient(contextId = "SysConfigClient", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = SysConfigFallbackFactory.class)
public interface SysConfigClient {
    @GetMapping(value = "config/{configId}")
    R<SysConfig> getInfo(@PathVariable("configId") String configId);
}
ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -6,3 +6,4 @@
com.ruoyi.system.api.factory.SysLoginLogFallbackFactory
com.ruoyi.system.api.factory.SysUserRoleFallbackFactory
com.ruoyi.system.api.factory.UserShopClientFallbackFactory
com.ruoyi.system.api.factory.SysConfigFallbackFactory
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java
@@ -1,5 +1,6 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
@@ -7,7 +8,7 @@
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.api.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -49,8 +50,8 @@
     * 根据参数编号获取详细信息
     */
    @GetMapping(value = "/{configId}")
    public AjaxResult getInfo(@PathVariable Long configId) {
        return success(configService.selectConfigById(configId));
    public R getInfo(@PathVariable Long configId) {
        return R.ok(configService.selectConfigById(configId));
    }
    
    /**
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java
@@ -1,7 +1,7 @@
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.api.domain.SysConfig;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
@@ -1,6 +1,6 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.api.domain.SysConfig;
import java.util.List;
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
@@ -6,7 +6,7 @@
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.api.domain.SysConfig;
import com.ruoyi.system.mapper.SysConfigMapper;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.stereotype.Service;
ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysConfigMapper.xml
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysConfigMapper">
    
    <resultMap type="com.ruoyi.system.domain.SysConfig" id="SysConfigResult">
    <resultMap type="com.ruoyi.system.api.domain.SysConfig" id="SysConfigResult">
        <id     property="configId"      column="config_id"      />
        <result property="configName"    column="config_name"    />
        <result property="configKey"     column="config_key"     />
@@ -33,12 +33,12 @@
        </where>
    </sql>
    
    <select id="selectConfig" parameterType="com.ruoyi.system.domain.SysConfig" resultMap="SysConfigResult">
    <select id="selectConfig" parameterType="com.ruoyi.system.api.domain.SysConfig" resultMap="SysConfigResult">
        <include refid="selectConfigVo"/>
        <include refid="sqlwhereSearch"/>
    </select>
    
    <select id="selectConfigList" parameterType="com.ruoyi.system.domain.SysConfig" resultMap="SysConfigResult">
    <select id="selectConfigList" parameterType="com.ruoyi.system.api.domain.SysConfig" resultMap="SysConfigResult">
        <include refid="selectConfigVo"/>
        <where>
            <if test="configName != null and configName != ''">
@@ -69,7 +69,7 @@
        where config_key = #{configKey} limit 1
    </select>
    
    <insert id="insertConfig" parameterType="com.ruoyi.system.domain.SysConfig">
    <insert id="insertConfig" parameterType="com.ruoyi.system.api.domain.SysConfig">
        insert into sys_config (
            <if test="configName != null and configName != '' ">config_name,</if>
            <if test="configKey != null and configKey != '' ">config_key,</if>
@@ -89,7 +89,7 @@
        )
    </insert>
     
    <update id="updateConfig" parameterType="com.ruoyi.system.domain.SysConfig">
    <update id="updateConfig" parameterType="com.ruoyi.system.api.domain.SysConfig">
        update sys_config 
        <set>
            <if test="configName != null and configName != ''">config_name = #{configName},</if>
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -161,12 +161,12 @@
     */
    @Override
    public R<LoginVo> mobileLogin(MobileLogin mobileLogin) {
        /*String code = redisService.getCacheObject(mobileLogin.getPhone());
        String code = redisService.getCacheObject(mobileLogin.getPhone());
        if(!"999999".equals(mobileLogin.getCode())){
            if(null == code || !code.equals(mobileLogin.getCode())){
                return R.fail("验证码错误");
            }
        }*/
        }
        
        //查询用户是否注册,没有注册则系统注册
        AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, mobileLogin.getPhone())
@@ -177,12 +177,11 @@
            //使用jscode获取微信openid
            Map<String, Object> map = weChatUtil.code2Session(mobileLogin.getJscode());
            Integer errcode = Integer.valueOf(map.get("errcode").toString());
            /*if(0 != errcode){
            if(0 != errcode){
                return R.fail(map.get("msg").toString());
            }*/
//            String openid = map.get("openid").toString();
            String openid="";
            //设置默认头像
            }
            String openid = map.get("openid").toString();
            //设置默认信息
            appUser.setName(mobileLogin.getPhone().substring(0, 3) + "****" + mobileLogin.getPhone().substring(7));
            appUser.setPhone(mobileLogin.getPhone());
            appUser.setAvatar( DEFAULT_AVATAR_URL);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/AgreementController.java
@@ -33,7 +33,7 @@
    @GetMapping("/getAgreement/{type}")
    @ApiOperation(value = "获取协议", tags = {"小程序-登录注册"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,3=技师上门免责声明,4=注销协议,5门店提现免责声明)", name = "type", required = true, dataType = "int"),
            @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,4=注销协议,5门店提现免责声明)", name = "type", required = true, dataType = "int"),
    })
    public R<String> getAgreement(@PathVariable("type") Integer type){
        Agreement one = agreementService.getOne(new LambdaQueryWrapper<Agreement>().eq(Agreement::getType, type));
@@ -45,7 +45,7 @@
    @GetMapping("/getAgreementByType/{type}")
    @ApiOperation(value = "协议管理-详情", tags = {"管理后台"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,3=技师上门免责声明,4=注销协议,5门店提现免责声明)", name = "type", required = true, dataType = "int"),
            @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,4=注销协议,5门店提现免责声明)", name = "type", required = true, dataType = "int"),
    })
    public R<Agreement> getAgreementByType(@PathVariable("type") Integer type){
        Agreement one = agreementService.getOne(new LambdaQueryWrapper<Agreement>().eq(Agreement::getType, type));
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java
@@ -52,37 +52,27 @@
    @GetMapping("/list")
    @ApiOperation(value = "banner列表", tags = {"小程序-banner"})
    public R<List<Banner>> list(@ApiParam("名称") String name,
                                @ApiParam("跳转类型(1=无跳转,2=外部链接,3=商品详情,4=秒杀商品详情,5=领券中心)") Integer jumpType,
                                @ApiParam("跳转类型(1=无跳转,2=外部链接,3=商品详情,4=秒杀商品详情)") Integer jumpType,
                                @ApiParam("位置(1=首页,2=商城首页)") Integer position){
        List<Banner> list = bannerService.lambdaQuery().like(StringUtils.isNotEmpty(name), Banner::getName, name)
                .eq(jumpType!=null,Banner::getJumpType, jumpType)
                .eq(position!=null,Banner::getPosition, position)
                .list();
        Integer vipId = 0;
        String token = SecurityUtils.getToken(ServletUtils.getRequest());
        if(StringUtils.isNotEmpty(token)){
            Long userid = tokenService.getLoginUserApplet().getUserid();
            AppUser appUser = appUserClient.getAppUserById(userid);
            vipId = appUser.getVipId();
        }
        for (Banner banner : list) {
            Integer jumpType1 = banner.getJumpType();
            //商品详情
            if(null != jumpType1 && 3 == jumpType1){
                Goods goods = goodsService.getById(banner.getContent());
                if(null == goods || goods.getDelFlag() == 1){
                    banner.setJumpType(1);
                } else if(!goods.getCommodityAuthority().contains("-1") && !goods.getCommodityAuthority().contains(vipId.toString())){
                    banner.setJumpType(1);
                    banner.setJumpType(1);//商品不存在
                }
            }
            //秒杀活动
            if(null != jumpType1 && 4 == jumpType1){
                SeckillActivityInfo activityInfo = seckillActivityInfoService.getById(banner.getContent());
                if(null == activityInfo || activityInfo.getDelFlag() == 1 || !activityInfo.getVipIds().contains(vipId.toString())){
                    banner.setJumpType(1);
                if(null == activityInfo || activityInfo.getDelFlag() == 1 ){
                    banner.setJumpType(1);//秒杀活动不存在
                }
            }
        }
        return R.ok(list);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -162,9 +162,9 @@
     */
    @GetMapping("/getGoodsListByShopId")
    @ApiOperation(value = "商品购买列表", tags = {"小程序-首页-门店详情"})
    public R<PageInfo<Goods>> getGoodsListByShopId(@ApiParam("门店id") Integer shopId, Integer pageCurr, Integer pageSize) {
        PageInfo<Goods> pageInfo = new PageInfo(pageCurr, pageSize);
        List<Goods> goodsList = goodsService.getGoodsListByShopId(pageInfo, shopId);
    public R<PageInfo<GoodsVO>> getGoodsListByShopId(@ApiParam("门店id") Integer shopId, Integer pageCurr, Integer pageSize) {
        PageInfo<GoodsVO> pageInfo = new PageInfo(pageCurr, pageSize);
        List<GoodsVO> goodsList = goodsService.getGoodsListByShopId(pageInfo, shopId);
        return R.ok(pageInfo.setRecords(goodsList));
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -17,13 +17,11 @@
import com.ruoyi.order.vo.VerifiableShopVo;
import com.ruoyi.other.api.domain.*;
import com.ruoyi.other.mapper.ShopMapper;
import com.ruoyi.other.mapper.ShopScoreMapper;
import com.ruoyi.other.service.*;
import com.ruoyi.other.util.GeodesyUtil;
import com.ruoyi.other.util.tencentMap.TencentMapUtil;
import com.ruoyi.other.vo.NearbyShopVO;
import com.ruoyi.other.vo.SaveWithdrawalAccount;
import com.ruoyi.other.vo.ShopDetailVO;
import com.ruoyi.other.vo.ShopStatistics;
import com.ruoyi.other.vo.*;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.feignClient.UserShopClient;
@@ -70,6 +68,8 @@
    @Resource
    private ShopMapper shopMapper;
    @Resource
    private ShopScoreMapper shopScoreMapper;
    @Resource
    private UserShopClient userShopClient;
    @Resource
    private GoodsService goodsService;
@@ -79,9 +79,61 @@
    private OrderClient orderClient;
    @Resource
    private ReceiverBankChannelService receiverBankChannelService;
    @Resource
    private ShopScoreService shopScoreService;
    /**
     * 门店打分
     * @return
     */
    @PostMapping("/shopScore")
    @ApiOperation(value = "门店打分", tags = {"小程序-个人中心"})
    public R<Void> shopScore(@RequestBody ShopScore shopScore) {
        if (null==shopScore.getShopId()){
            return R.fail("门店不能为空");
        }
        if (null==shopScore.getScore()){
            return R.fail("评分不能为空");
        }
        //验证门店是否存在
        Shop one = shopService.getOne(new LambdaQueryWrapper<Shop>().eq(Shop::getId, shopScore.getShopId()).eq(Shop::getStatus, 1).eq(Shop::getDelFlag, 0));
        if (null == one){
            return R.fail("门店不存在");
        }
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        shopScore.setAppUserId(loginUserApplet.getUserid());
        shopScore.setCreateTime(LocalDateTime.now());
        shopScoreService.save(shopScore);
        //计算,更新到门店中
        //总评分
        List<BigDecimal> scores = shopScoreMapper.selectList(new LambdaQueryWrapper<ShopScore>().eq(ShopScore::getShopId, shopScore.getShopId())).stream().map(ShopScore::getScore).collect(Collectors.toList());
        BigDecimal score = getScore(scores);
        one.setId(shopScore.getShopId().intValue());
        one.setScore(score.doubleValue());
        shopMapper.updateById(one);
        return R.ok();
    }
    /**
     * 计算评分
     */
    private BigDecimal getScore(List<BigDecimal> scores) {
        if (scores == null || scores.isEmpty()) {
            return BigDecimal.ZERO.setScale(1, RoundingMode.HALF_UP); // 默认返回 0.0
        }
        // 计算总分
        BigDecimal totalScore = scores.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
        // 计算平均值,并保留 1 位小数(四舍五入)
        BigDecimal averageScore = totalScore.divide(
                new BigDecimal(scores.size()),
                1,  // 保留 1 位小数
                RoundingMode.HALF_UP  // 四舍五入
        );
        return averageScore;
    }
    @PostMapping
    @ApiOperation(value = "新增门店", tags = {"管理后台-门店管理"})
@@ -404,7 +456,7 @@
    @GetMapping("/list")
    @ApiOperation(value = "门店列表", tags = {"管理后台-门店管理"})
    public R<IPage<Shop>> list(@ApiParam("页码") @RequestParam Integer pageNum,@ApiParam("每一页数据大小") Integer pageSize,Shop shop){
    public R<IPage<Shop>> list(@ApiParam("页码") @RequestParam("pageNum") Integer pageNum,@ApiParam("每一页数据大小") @RequestParam("pageSize") Integer pageSize,Shop shop){
        IPage<Shop> shopIPage = shopService.getShopList(pageNum, pageSize, shop);
        for (Shop record : shopIPage.getRecords()) {
            record.setLaveUsePoint(record.getLavePoint());
@@ -459,16 +511,19 @@
    /**
     * 附近门店列表
     * 附近门店列表/更多门店
     */
    @GetMapping("/nearbyShopList")
    @ApiOperation(value = "附近门店列表", tags = {"小程序-首页"})
    @ApiOperation(value = "附近门店列表/更多门店", tags = {"小程序-首页"})
    public R<List<NearbyShopVO>> nearbyShopList(@ApiParam("经度") @RequestParam BigDecimal longitude,
                                                @ApiParam("纬度") @RequestParam BigDecimal latitude) {
        return R.ok(shopService.nearbyShopList(longitude, latitude));
                                                @ApiParam("纬度") @RequestParam BigDecimal latitude,
                                                Shop shop) {
        return R.ok(shopService.nearbyShopList(longitude, latitude,shop));
    }
    /**
     * 门店详情
     */
    @GetMapping("/shopDetail")
    @ApiOperation(value = "门店详情", tags = {"小程序-首页"})
    public R<ShopDetailVO> shopDetail(@ApiParam("门店id") @RequestParam Integer shopId,
@@ -478,6 +533,7 @@
    }
    /**
     * 绑定门店
     */
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java
@@ -19,7 +19,7 @@
 */
public interface GoodsMapper extends BaseMapper<Goods> {
    List<Goods> selectListByShopId(PageInfo<Goods> pageInfo, @Param("shopId") Integer shopId,@Param("vip") Integer vip);
    List<GoodsVO> selectListByShopId(PageInfo<GoodsVO> pageInfo, @Param("shopId") Integer shopId);
    IPage<Goods> selectManageGoodsList(@Param("page") IPage<Goods> page, @Param("goods") Goods goods);
@@ -30,5 +30,5 @@
     * @param name
     * @return
     */
    List<GoodsVO> goodsList(@Param("goodsCategoryId") Integer goodsCategoryId, @Param("name") String name, @Param("vip") Integer vip);
    List<GoodsVO> goodsList(@Param("goodsCategoryId") Integer goodsCategoryId, @Param("name") String name,@Param("shopIds") List<Long> shopIds);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java
@@ -9,7 +9,6 @@
import com.ruoyi.other.vo.ShopStatistics;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -24,7 +23,8 @@
    IPage<Shop> selectShopList(@Param("page") Page<Shop> page,@Param("shop") Shop shop);
    List<NearbyShopVO> selectNearbyShopList();
    List<NearbyShopVO> selectNearbyShopList(@Param("shop")Shop shop);
    ShopDetailVO selectShopDetail(@Param("shopId") Integer shopId);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopScoreMapper.java
New file
@@ -0,0 +1,7 @@
package com.ruoyi.other.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.other.api.domain.ShopScore;
public interface ShopScoreMapper extends BaseMapper<ShopScore> {
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java
@@ -23,7 +23,7 @@
    GoodsVO goodsDetail(Long goodsId, Integer shopId, String longitude, String latitude);
    List<Goods> getGoodsListByShopId(PageInfo<Goods> pageInfo, Integer shopId);
    List<GoodsVO> getGoodsListByShopId(PageInfo<GoodsVO> pageInfo, Integer shopId);
    void addGoods(Goods goods);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopScoreService.java
New file
@@ -0,0 +1,7 @@
package com.ruoyi.other.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.other.api.domain.ShopScore;
public interface ShopScoreService extends IService<ShopScore> {
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java
@@ -6,8 +6,6 @@
import com.ruoyi.other.vo.NearbyShopVO;
import com.ruoyi.other.vo.SaveWithdrawalAccount;
import com.ruoyi.other.vo.ShopDetailVO;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal;
import java.util.List;
@@ -24,7 +22,8 @@
    IPage<Shop> getShopList(Integer PageNum, Integer pageSize, Shop shop);
    List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude);
    List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude,Shop shop);
    ShopDetailVO getShopDetail(Integer shopId, BigDecimal longitude, BigDecimal latitude);
@@ -35,4 +34,6 @@
     * @param saveWithdrawalAccount
     */
    void saveWithdrawalAccount(SaveWithdrawalAccount saveWithdrawalAccount);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -1,15 +1,12 @@
package com.ruoyi.other.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.constant.TokenConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils;
@@ -21,8 +18,6 @@
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.vo.Price;
import com.ruoyi.other.api.domain.*;
import com.ruoyi.other.api.vo.GetGoodsBargainPrice;
import com.ruoyi.other.api.vo.GetSeckillActivityInfo;
import com.ruoyi.other.enums.GoodsStatus;
import com.ruoyi.other.mapper.GoodsMapper;
import com.ruoyi.other.mapper.GoodsShopMapper;
@@ -30,8 +25,9 @@
import com.ruoyi.other.service.*;
import com.ruoyi.other.util.GeodesyUtil;
import com.ruoyi.other.vo.GoodsVO;
import com.ruoyi.system.api.model.LoginUser;
import org.jetbrains.annotations.NotNull;
import com.ruoyi.other.vo.NearbyShopVO;
import com.ruoyi.system.api.domain.SysConfig;
import com.ruoyi.system.api.feignClient.SysConfigClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -40,7 +36,6 @@
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
 * <p>
@@ -72,38 +67,43 @@
    private GoodsSeckillService goodsSeckillService;
    @Resource
    private OrderClient orderClient;
    @Resource
    private SysConfigClient  sysConfigClient;
    @Resource
    private ShopService shopService;
    /**
     * 热门商品列表
     * @param search
     * @return
     */
    @Override
    public PageInfo<GoodsVO> goodsList(Goods search) {
        Integer vipId = 0;
        String provinceCode = "0";
        String cityCode = "0";
        String districtCode = "0";
        String token = SecurityUtils.getToken(ServletUtils.getRequest());
        if(StringUtils.isNotEmpty(token)){
            Long userid = tokenService.getLoginUserApplet().getUserid();
            AppUser appUser = appUserClient.getAppUserById(userid);
            vipId = appUser.getVipId();
            provinceCode = appUser.getProvinceCode();
            cityCode = appUser.getCityCode();
            districtCode = appUser.getDistrictCode();
        List<Long> shopIds=null;
        if (null!=search.getLongitude()&&null!=search.getLatitude()){
            //获取最近十家店的id
            List<NearbyShopVO> nearbyShopVOS = shopService.nearbyShopList(search.getLongitude(), search.getLatitude(), new Shop());
            shopIds = nearbyShopVOS.subList(0, 10).stream().map(NearbyShopVO::getId).collect(Collectors.toList());
        }
        List<GoodsVO> list = this.baseMapper.goodsList(search.getGoodsCategoryId(), search.getName(), vipId);
        List<GoodsVO> list = this.baseMapper.goodsList(search.getGoodsCategoryId(), search.getName(),shopIds);//查找所有商品
        for (GoodsVO goods : list) {
            Price price = getPrice(vipId, goods.getGoodsId(), null, 1, provinceCode, cityCode, districtCode);
            System.out.println(goods.getSellingPrice());
            //计算所需价格和积分
            Price price = getPrice( goods.getGoodsId(), 1);
            if(null != price){
                goods.setCashPayment(price.getCashPayment() ? 1 : 0);
                goods.setPointPayment(price.getPointPayment() ? 1 : 0);
                //秒杀活动
                goods.setSellingPrice(price.getCash());
                goods.setIntegral(price.getPoint());
                goods.setStartTime(price.getStartTime());
                goods.setEndTime(price.getEndTime());
            }
            //已售
            Integer data = orderClient.getGoodsSaleNum(goods.getGoodsId(), 1).getData();
            goods.setSaleNum(data);
        }
        //手动排序
        if(StringUtils.isNotEmpty(search.getOrderByColumn())){
            if("tgs.selling_price".equals(search.getOrderByColumn())){
@@ -123,7 +123,7 @@
                    }
                });
            }
            if("integral".equals(search.getOrderByColumn())){
            /*if("integral".equals(search.getOrderByColumn())){
                list.sort(new Comparator<GoodsVO>() {
                    @Override
                    public int compare(GoodsVO o1, GoodsVO o2) {
@@ -139,7 +139,7 @@
                        return 0;
                    }
                });
            }
            }*/
            if("sale_num".equals(search.getOrderByColumn())){
                list.sort(new Comparator<GoodsVO>() {
                    @Override
@@ -180,7 +180,7 @@
    @Override
    public GoodsVO goodsDetail(Long goodsId, Integer shopId, String longitude, String latitude) {
        if (goodsId == null || goodsId <= 0) {
        /*if (goodsId == null || goodsId <= 0) {
            throw new NullPointerException("商品ID不能为空");
        }
@@ -256,35 +256,26 @@
        }
        Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData();
        goodsVO.setSaleNum(integer);
        return goodsVO;
        return goodsVO;*/
        return null;
    }
    @Override
    public List<Goods> getGoodsListByShopId(PageInfo<Goods> pageInfo, Integer shopId) {
        Integer vipId = 0;
        String provinceCode = "0";
        String cityCode = "0";
        String districtCode = "0";
        String token = SecurityUtils.getToken(ServletUtils.getRequest());
        if(StringUtils.isNotEmpty(token)){
            Long userid = tokenService.getLoginUserApplet().getUserid();
            AppUser appUser = appUserClient.getAppUserById(userid);
            vipId = appUser.getVipId();
            provinceCode = appUser.getProvinceCode();
            cityCode = appUser.getCityCode();
            districtCode = appUser.getDistrictCode();
        }
        List<Goods> goods = goodsMapper.selectListByShopId(pageInfo, shopId, vipId);
        for (Goods good : goods) {
            Price price = getPrice(vipId, good.getId(), shopId, 1, provinceCode, cityCode, districtCode);
    public List<GoodsVO> getGoodsListByShopId(PageInfo<GoodsVO> pageInfo, Integer shopId) {
        //查询该门店商品
        List<GoodsVO> goods = goodsMapper.selectListByShopId(pageInfo, shopId);
        for (GoodsVO good : goods) {
            //价格
            Price price = getPrice( good.getGoodsId(), 1);
            if(null != price){
                good.setCashPayment(price.getCashPayment() ? 1 : 0);
                good.setPointPayment(price.getPointPayment() ? 1 : 0);
                //秒杀活动
                good.setSellingPrice(price.getCash());
                good.setIntegral(price.getPoint());
                good.setStartTime(price.getStartTime());
                good.setEndTime(price.getEndTime());
            }
            Integer data = orderClient.getGoodsSaleNum(good.getId(), 1).getData();
            Integer data = orderClient.getGoodsSaleNum(good.getGoodsId(), 1).getData();
            good.setSaleNum(data);
        }
        return goods;
@@ -375,44 +366,66 @@
    /**
     * 根据商品的价格配置体系获取商品当前的价格
     * @param vip
     * @param goodsId
     * @param type          1普通商品,2秒杀商品
     * @param shopId
     * @param provinceCode
     * @param cityCode
     * @param districtCode
     * @return
     */
    public Price getPrice(Integer vip, Integer goodsId, Integer shopId, Integer type, String provinceCode, String cityCode, String districtCode){
        //获取支付价格
        //秒杀活动>门店特价>地区价格>会员价格
    public Price getPrice( Integer goodsId, Integer type){
        //判断是否有秒杀活动
        Price price = new Price();
        SeckillActivityInfo one = seckillActivityInfoService.getOne(new LambdaQueryWrapper<SeckillActivityInfo>().eq(SeckillActivityInfo::getGoodId, goodsId)
                .eq(SeckillActivityInfo::getIsShelves, 1).eq(SeckillActivityInfo::getDelFlag, 0)
                .last(" and now() between start_time and end_time and FIND_IN_SET(" + vip + ", vip_ids) order by create_time desc limit 0, 1"));
        GoodsSeckill goodsSeckill = null;
                .last(" and now() between start_time and end_time order by create_time desc limit 0, 1"));
        GoodsSeckill goodsSeckill = null;//秒杀配置
        if(null != one){
            goodsSeckill = goodsSeckillService.getOne(new LambdaQueryWrapper<GoodsSeckill>().eq(GoodsSeckill::getSeckillActivityInfoId, one.getId()).eq(GoodsSeckill::getVip, vip));
            //有秒杀活动,查看秒杀价格
            goodsSeckill = goodsSeckillService.getOne(new LambdaQueryWrapper<GoodsSeckill>().eq(GoodsSeckill::getSeckillActivityInfoId, one.getId()));
        }
        //没有秒杀活动或者添加的普通商品则不使用秒杀活动价格
        if(null != goodsSeckill && type == 1){
            //构建价格数据
            if(goodsSeckill.getCashPayment() == 1 && goodsSeckill.getPointPayment() == 1){
        //没有秒杀活动或者添加的普通商品则使用秒杀活动价格
        if(null == goodsSeckill || type == 1){
           return null;
        }
        //秒杀活动价格
                price.setCash(goodsSeckill.getSellingPrice());
                price.setPoint(goodsSeckill.getIntegral());
            }
            if(goodsSeckill.getCashPayment() == 1 && goodsSeckill.getPointPayment() == 0){
                price.setCash(goodsSeckill.getSellingPrice());
            }
            if(goodsSeckill.getCashPayment() == 0 && goodsSeckill.getPointPayment() == 1){
                price.setPoint(goodsSeckill.getIntegral());
            }
            price.setCashPayment(goodsSeckill.getCashPayment() == 1);
            price.setPointPayment(goodsSeckill.getPointPayment() == 1);
        }
        //计算对应积分
        price.setPoint(getPoint(price.getCash()));
        price.setStartTime(one.getStartTime());
        price.setEndTime(one.getEndTime());
        return price;
    }
    /**
     * 获取现金对应积分
     */
    public Integer getPoint(BigDecimal cash){
        if (cash == null || cash.compareTo(BigDecimal.ZERO) < 0) {
            throw new IllegalArgumentException("金额不能为null或负数");
        }
        // 获取积分兑换比例配置
        R<SysConfig> info = sysConfigClient.getInfo("6");
        if (info == null || info.getData() == null) {
            throw new RuntimeException("获取积分兑换比例配置失败");
        }
        String configValue = info.getData().getConfigValue();
        if (StringUtils.isBlank(configValue)) {
            throw new RuntimeException("积分兑换比例配置值为空");
        }
        try {
            // 使用BigDecimal处理比例,避免精度问题
            BigDecimal ratio = new BigDecimal(configValue.trim());
            if (ratio.compareTo(BigDecimal.ZERO) <= 0) {
                throw new RuntimeException("积分兑换比例必须大于0");
            }
            // 计算积分并四舍五入取整
            return cash.multiply(ratio).intValue();
        } catch (NumberFormatException e) {
            throw new RuntimeException("积分兑换比例配置值格式错误", e);
        } catch (ArithmeticException e) {
            throw new RuntimeException("积分计算结果溢出", e);
        }
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopScoreServiceImpl.java
New file
@@ -0,0 +1,11 @@
package com.ruoyi.other.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.other.api.domain.ShopScore;
import com.ruoyi.other.mapper.ShopScoreMapper;
import com.ruoyi.other.service.ShopScoreService;
import org.springframework.stereotype.Service;
@Service
public class ShopScoreServiceImpl extends ServiceImpl<ShopScoreMapper, ShopScore> implements ShopScoreService {
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.other.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -8,12 +9,14 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.GeodesyUtil;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.other.api.domain.Phone;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.domain.ShopScore;
import com.ruoyi.other.mapper.PhoneMapper;
import com.ruoyi.other.mapper.ShopMapper;
import com.ruoyi.other.mapper.ShopScoreMapper;
import com.ruoyi.other.service.ShopScoreService;
import com.ruoyi.other.service.ShopService;
import com.ruoyi.other.vo.NearbyShopVO;
import com.ruoyi.other.vo.SaveWithdrawalAccount;
@@ -41,13 +44,26 @@
    @Resource
    private ShopMapper shopMapper;
    @Resource
    private PhoneMapper phoneMapper;
    @Resource
    private ShopScoreService shopScoreService;
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private TokenService tokenService;
    @Resource
    private SysUserClient sysUserClient;
    @Resource
    private ShopScoreMapper scoreMapper;
    /**
     *  获取门店列表
     * @param PageNum
     * @param pageSize
     * @param shop
     * @return
     */
    @Override
    public IPage<Shop> getShopList(Integer PageNum, Integer pageSize, Shop shop) {
        Page<Shop> page = new Page<>();
@@ -56,52 +72,33 @@
        return shopMapper.selectShopList(page, shop);
    }
    @Override
    public List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude) {
        String token = SecurityUtils.getToken(ServletUtils.getRequest());
        AppUser appUser = null;
        if(StringUtils.isNotEmpty(token)){
            Long userid = tokenService.getLoginUserApplet().getUserid();
            appUser = appUserClient.getAppUserById(userid);
        }
        List<NearbyShopVO> nearbyShopVOS = shopMapper.selectNearbyShopList();
    /**
     * 获取最近的门店
     * @param longitude
     * @param latitude
     * @return
     */
    @Override
    public List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude,Shop shop) {
        //获取所有店
        List<NearbyShopVO> nearbyShopVOS = shopMapper.selectNearbyShopList(shop);
        if (nearbyShopVOS == null || nearbyShopVOS.isEmpty()) {
            return Collections.emptyList();
        }
        //计算距离
        for (NearbyShopVO nearbyShopVO : nearbyShopVOS) {
            Double wgs84 = GeodesyUtil.getDistance(nearbyShopVO.getLongitude() + "," + nearbyShopVO.getLatitude(), longitude + "," + latitude).get("WGS84");
            nearbyShopVO.setDistance(new BigDecimal(wgs84).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
        }
        /*//排序
        nearbyShopVOS.sort(new Comparator<NearbyShopVO>() {
            @Override
            public int compare(NearbyShopVO o1, NearbyShopVO o2) {
                return o1.getDistance().compareTo(o2.getDistance());
            }
        });
        });*/
        if(null != appUser && null != appUser.getShopId()){
            AppUser finalAppUser = appUser;
            Optional<NearbyShopVO> first = nearbyShopVOS.stream().filter(s -> s.getId().equals(finalAppUser.getShopId().longValue())).findFirst();
            if(first.isPresent()){
                NearbyShopVO nearbyShopVO = first.get();
                if(null != nearbyShopVO){
                    nearbyShopVOS.remove(nearbyShopVO);
                }
            }
            Shop shop = shopMapper.selectById(appUser.getShopId());
            if(null != shop && shop.getDelFlag() == 0 && shop.getStatus() == 1){
                NearbyShopVO vo = new NearbyShopVO();
                vo.setId(appUser.getShopId().longValue());
                vo.setName(shop.getName());
                vo.setAddress(shop.getAddress());
                vo.setHomePicture(shop.getHomePicture());
                Double wgs84 = GeodesyUtil.getDistance(longitude.toString() + "," + latitude.toString(), shop.getLongitude() + "," + shop.getLatitude()).get("WGS84");
                vo.setDistance(new BigDecimal(wgs84).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
                nearbyShopVOS.add(0, vo);
            }
        }
        if (nearbyShopVOS == null || nearbyShopVOS.isEmpty()) {
            return Collections.emptyList();
        }
        return sortByDistance(nearbyShopVOS);
    }
@@ -122,6 +119,24 @@
        if (shopDetailVO == null) {
            throw new ServiceException("查询店铺不存在");
        }
        //查询客服电话
        Phone phone = phoneMapper.selectOne(new LambdaQueryWrapper<Phone>().eq(Phone::getShopId, shopDetailVO.getId()));
        ArrayList<String> phones = new ArrayList<>();
        if (phone != null) {
            if (phone.getPhoneOne() != null) {
                phones.add(phone.getPhoneOne());
            }
            if (phone.getPhoneTwo() != null) {
                phones.add(phone.getPhoneTwo());
            }
        }
        shopDetailVO.setPhones(phones);
        //我的评分
        if (userid != null){
            ShopScore one = shopScoreService.getOne(new LambdaQueryWrapper<ShopScore>().eq(ShopScore::getAppUserId, userid).eq(ShopScore::getShopId, shopId).last(" order by create_time desc limit 0, 1"));
            shopDetailVO.setMyScore(null == one ? BigDecimal.ZERO : one.getScore());
        }
        // 计算距离
        if (shopDetailVO.getLongitude() != null && shopDetailVO.getLatitude() != null){
@@ -133,6 +148,8 @@
        }
        return shopDetailVO;
    }
    @Override
    public Boolean cheUserByPhone(String phone) {
@@ -161,4 +178,6 @@
            this.updateById(shop);
        }
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java
@@ -6,6 +6,7 @@
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@ApiModel(value="商品热销对象", description="热门商品")
@@ -58,6 +59,12 @@
    @ApiModelProperty(value = "门店id")
    private Integer shopId;
    @ApiModelProperty(value = "活动开始时间")
    private LocalDateTime startTime;
    @ApiModelProperty(value = "活动结束时间")
    private LocalDateTime endTime;
    @ApiModelProperty(value = "门店列表")
    private List<Shop> shopList;
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml
@@ -2,24 +2,20 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.other.mapper.GoodsMapper">
    <select id="selectListByShopId" resultType="com.ruoyi.other.api.domain.Goods">
    <select id="selectListByShopId" resultType="com.ruoyi.other.vo.GoodsVO">
        SELECT
        tg.id,
        tg.`name`,
        tg.type,
        tg.id as goodsId,
        tg.`name` as goodsName,
        tg.integral,
        tg.introduction,
        tg.selling_price as sellingPrice,
        tg.original_price as originalPrice,
        tg.integral as integral,
        tg.sale_num as saleNum,
        tg.home_page_picture as homePagePicture,
        tg.sort
        FROM t_goods tg
        where tg.del_flag = 0 and tg.status = 2 and (tg.appoint_store = 2 or (tg.appoint_store = 1 and tg.id in (select goods_id from t_goods_shop where shop_id = #{shopId})))
        and tg.type = 1
        <if test="vip != null">
            and (tg.commodity_authority like '%-1%' or tg.commodity_authority like CONCAT('%', #{vip}, '%'))
        </if>
        where tg.del_flag = 0 and tg.status = 2 and tg.id in (select goods_id from t_goods_shop where shop_id = #{shopId})
        and tg.type = 2
        ORDER BY ifnull(tg.sort, -1) DESC
    </select>
    <select id="selectManageGoodsList" resultType="com.ruoyi.other.api.domain.Goods">
@@ -61,17 +57,34 @@
    </select>
    <select id="goodsList" resultType="com.ruoyi.other.vo.GoodsVO">
        select *, id as goodsId, name as goodsName from t_goods where status = 2 and del_flag = 0 and `type` = 2
        select  g.id as goodsId,
                g.name as goodsName,
                g.purchase_limit as purchaseLimit,
                g.selling_price as sellingPrice,
                g.integral,
                g.introduction,
                g.detail,
                g.home_page_picture as homePagePicture,
                g.sale_num as saleNum
        from t_goods g
        <if test="null != shopIds and shopIds.size() > 0">
            inner join t_goods_shop gs on g.id = gs.goods_id
        </if>
        where g.status = 2 and g.del_flag = 0 and g.`type` = 2
        <if test="null != goodsCategoryId">
            and goods_category_id = #{goodsCategoryId}
            and g.goods_category_id = #{goodsCategoryId}
        </if>
        <if test="null != name and '' != name">
            and name like CONCAT('%', #{name}, '%')
            and g.name like CONCAT('%', #{name}, '%')
        </if>
        <if test="null != vip">
            and (FIND_IN_SET(#{vip}, commodity_authority) or commodity_authority like '%-1%')
        <if test="null != shopIds and shopIds.size() > 0">
            and gs.shop_id in
            <foreach collection="shopIds" item="shopId" open="(" separator="," close=")">
                #{shopId}
            </foreach>
        </if>
        order by sort desc
        order by g.sort desc
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
@@ -6,11 +6,15 @@
        SELECT id,
               home_picture,
               name,
               score,
               address,
               longitude,
               latitude
        FROM t_shop
        where del_flag = 0 and status = 1
        <if test="shop.name != null and shop.name != ''">
            and name like concat('%',#{shop.name},'%')
        </if>
    </select>
    <select id="selectShopDetail" resultType="com.ruoyi.other.vo.ShopDetailVO">
        SELECT