phpcjl
2024-12-11 f5ef4dc87297dad9c238d18006d4cef022dd30f5
1.后台管理-商品管理
15个文件已修改
120 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/TechnicianSubscribe.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/enums/TechnicianStatus.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java
@@ -13,6 +13,7 @@
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
 * <p>
@@ -242,6 +243,10 @@
    @TableField(exist = false)
    private Integer isSign;
    @ApiModelProperty("绑定门店id列表")
    @TableField(exist = false)
    private Set<Integer> shopIds;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java
@@ -55,7 +55,7 @@
    @TableField("user_address")
    private String userAddress;
    @ApiModelProperty(value = "状态(0=待服务,1=已服务,2=已取消)")
    @ApiModelProperty(value = "状态(0=待服务,1=已服务,2=已取消, 3=已到期)")
    @TableField("status")
    private Integer status;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java
@@ -7,6 +7,7 @@
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.List;
import java.util.Set;
@Slf4j
public class ShopClientFallbackFactory implements FallbackFactory<ShopClient> {
@@ -27,6 +28,11 @@
            public R<List<Shop>> getShopByUserIds(List<Long> userIds) {
                return R.fail("根据用户id集合获取门店数据失败");
            }
            @Override
            public R<Set<Integer>> getShopIdByName(String shopName) {
                return R.fail("根据门店名称获取门店id失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
@@ -6,11 +6,13 @@
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.factory.ShopClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Set;
/**
 * @author zhibing.pu
@@ -39,4 +41,7 @@
    @PostMapping("/getShopByUserIds")
    public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds);
    @GetMapping("/getShopIdByName")
    R<Set<Integer>> getShopIdByName(String shopName);
}
ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/TechnicianSubscribe.java
@@ -4,6 +4,7 @@
import lombok.extern.log4j.Log4j2;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Set;
@@ -19,9 +20,9 @@
    public void updateStatus() {
        long now = System.currentTimeMillis() / 1000; // 获取当前时间戳(秒)
        Set<String> subscribeIds = redisTemplate.opsForZSet().rangeByScore("delay_queue:subscribe", 0, now);
        if (subscribeIds != null) {
        if (!CollectionUtils.isEmpty(subscribeIds)) {
            subscribeIds.forEach(subscribeId -> {
                technicianClient.updateStatus(2, Long.valueOf(subscribeId));
                technicianClient.updateStatus(3, Long.valueOf(subscribeId));
            });
        }
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.UserCancellationLog;
import com.ruoyi.account.api.model.UserCoupon;
@@ -327,5 +328,20 @@
        return R.ok();
    }
    /**
     * 获取用户列表
     */
    @GetMapping("/getAppuserPage")
    @ApiOperation(value = "用户列表", tags = {"后台管理"})
    public R<IPage<AppUser>> getAppuserPage(@ApiParam("页码") @RequestParam Integer PageNum,
                                  @ApiParam("每一页数据大小") Integer pageSize,
                                  AppUser appUser)
    {
        IPage<AppUser> appuserPage = appUserService.getAppuserPage(PageNum, pageSize, appUser);
        return R.ok(appuserPage);
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.vo.NearbyReferrer;
import com.ruoyi.account.vo.NearbyReferrerVo;
@@ -26,6 +27,8 @@
     */
    List<NearbyReferrerVo> getNearbyReferrer(@Param("cityCode") String cityCode, @Param("nearbyReferrer") NearbyReferrer nearbyReferrer);
    
    IPage<AppUser> getAppuserPage(@Param("page") IPage<AppUser> page, @Param("appUser") AppUser appUser);
    
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java
@@ -1,5 +1,6 @@
package com.ruoyi.account.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.vo.*;
@@ -79,4 +80,6 @@
     * 在线记录操作,用于赠送积分
     */
    void onlineRecord();
    IPage<AppUser> getAppuserPage(Integer pageNum, Integer pageSize, AppUser appUser);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -3,6 +3,8 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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;
import com.ruoyi.account.api.model.AppUserShop;
import com.ruoyi.account.api.model.UserChangeLog;
@@ -31,8 +33,10 @@
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.model.LoginUser;
import org.apache.logging.log4j.core.util.UuidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
@@ -89,11 +93,8 @@
    @Resource
    private UserPointService userPointService;
    @Autowired
    private AppUserMapper appUserMapper;
    
    
    /**
@@ -610,4 +611,18 @@
            }
        }
    }
    @Override
    public IPage<AppUser> getAppuserPage(Integer pageNum, Integer pageSize, AppUser appUser) {
        if (StringUtils.isNotEmpty(appUser.getShopName())){
            R<Set<Integer>> shopR = shopClient.getShopIdByName(appUser.getShopName());
            if (R.isSuccess(shopR)){
                Set<Integer> shopIds = shopR.getData();
                if (!CollectionUtils.isEmpty(shopIds)){
                    appUser.setShopIds(shopIds);
                }
            }
        }
        return appUserMapper.getAppuserPage(new Page<>(pageNum, pageSize), appUser);
    }
}
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml
@@ -51,4 +51,28 @@
            </if>
        ) as aa order by aa.distance
    </select>
    <select id="getAppuserPage" resultType="com.ruoyi.account.api.model.AppUser">
        SELECT ta.id, ta.`name`, ta.vip_id, ta.shop_id
        FROM t_app_user ta
        <where>
            ta.del_flag = 0
            <if test="null != appUser.name and '' != appUser.name">
                and ta.`name` like CONCAT('%',#{appUser.name},'%')
            </if>
            <if test="null != appUser.phone and '' != appUser.phone">
                and ta.phone like CONCAT('%',#{appUser.phone},'%')
            </if>
            <if test="null != appUser.vipId">
                and ta.vip_id = #{appUser.vipId}
            </if>
            <if test="null != appUser.shopIds and appUser.shopIds.size() > 0">
                and ta.shop_id in
                <foreach collection="appUser.shopIds" item="shopId" open="(" separator="," close=")">
                    #{shopId}
                </foreach>
            </if>
        </where>
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -28,6 +28,7 @@
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -79,7 +80,10 @@
        AppUserShop appUserShop = new AppUserShop();
        appUserShop.setAppUserId(loginUserApplet.getUserid());
        appUserShop.setShopId(shop.getId());
        appUserClient.addAppUserShop(appUserShop);
        R<Void> r = appUserClient.addAppUserShop(appUserShop);
        if (R.isError(r)){
            throw new RuntimeException("添加失败");
        }
        return R.ok();
    }
@@ -206,5 +210,12 @@
        return R.ok(list);
    }
    @GetMapping("/getShopIdByName")
    R<Set<Integer>> getShopIdByName(@RequestParam String shopName){
        List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>()
                .like(Shop::getName, shopName));
        return R.ok(list.stream().map(Shop::getId).collect(Collectors.toSet()));
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/enums/TechnicianStatus.java
@@ -6,7 +6,8 @@
public enum TechnicianStatus {
    UNSUBSCRIBE(0, "待服务"),
    SERVE(1, "已服务"),
    CANCEL(2, "已取消");
    CANCEL(2, "已取消"),
    EXPIRED(3, "已到期");
    private final Integer code;
    private final String message;
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml
@@ -16,7 +16,7 @@
            t_shop ts
                LEFT JOIN t_goods_shop tgs ON ts.id = tgs.shop_id
                LEFT JOIN t_goods tg ON tg.id = tgs.goods_id
        where ts.id = #{shopId}
        where ts.id = #{shopId} and ts.del_flag = 0
        <if test="vip != null">
            and FIND_IN_SET(#{vip}, commodity_authority) > 0
        </if>
@@ -35,7 +35,8 @@
            t_goods tg
                LEFT JOIN t_goods_category tgc ON tg.goods_category_id = tgc.id
        <where>
            <if test="">
                tg.del_flag = 0
            <if test="goods.id != null">
                <if test="goods.id != null">
                    and tg.id = #{goods.id}
                </if>
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml
@@ -16,7 +16,7 @@
            t_seckill_activity_info tsai
                LEFT JOIN t_goods tg ON tsai.good_id = tg.id
                LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id
        WHERE tsai.end_time >= NOW()
        WHERE tsai.end_time >= NOW() AND tsai.del_flag = 0
        <if test="name != null and name != ''">
            AND tg.`name` LIKE concat('%',#{goodsName},'%')
        </if>
@@ -44,6 +44,6 @@
            t_seckill_activity_info tsai
                LEFT JOIN t_goods tg ON tsai.good_id = tg.id
                LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id
        WHERE tsai.id = #{seckillActivityId}
        WHERE tsai.id = #{seckillActivityId} AND tsai.del_flag = 0
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
@@ -66,6 +66,7 @@
            `qijisheng_other`.t_shop ts
                LEFT JOIN `qijisheng_account`.t_app_user tau ON ts.app_user_id = tau.id
        <where>
            ts.del_flag = 0
            <if test="shop.name != null and shop.name != ''">
                and ts.name like concat('%',#{shop.name},'%')
            </if>