puzhibing
2025-01-08 b22df417e0bc423c788b013feaad686531d69eed
修改bug
50个文件已修改
2个文件已删除
2个文件已添加
918 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AgentApplication.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/WithdrawalRequests.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/OrderClientFallbackFactory.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderFallbackFactory.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/OrderClient.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderClient.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ConfirmOrder.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/SeckillActivityInfoClientFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SeckillActivityInfoClient.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysUser.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/UserShop.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/query/GetSysUserList.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AgentApplicationMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserCancellationLogMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserClickLogMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java 128 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageListVo.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassList.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/task/TaskUtil.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AgentApplication.java
@@ -94,6 +94,8 @@
    @TableField(exist = false)
    private String idStr;
    @TableField(exist = false)
    private Integer vipId;
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/WithdrawalRequests.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.api.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -38,6 +39,7 @@
    @ApiModelProperty(value = "添加时间")
    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "用户id")
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/OrderClientFallbackFactory.java
New file
@@ -0,0 +1,28 @@
package com.ruoyi.order.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.feignClient.OrderClient;
import org.springframework.cloud.openfeign.FallbackFactory;
/**
 * @author zhibing.pu
 * @date 2025/1/7 14:38
 */
public class OrderClientFallbackFactory implements FallbackFactory<OrderClient> {
    @Override
    public OrderClient create(Throwable cause) {
        return new OrderClient(){
            @Override
            public R<Integer> getGoodsSaleNum(Integer goodsId, Integer type) {
                return R.fail("获取商品销售数量失败:" + cause.getMessage());
            }
            @Override
            public R<Integer> getShopSaleNum(Integer shopId, Integer type) {
                return R.fail("获取门店销售订单数量失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderFallbackFactory.java
File was deleted
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/OrderClient.java
New file
@@ -0,0 +1,35 @@
package com.ruoyi.order.feignClient;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.factory.OrderClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author zhibing.pu
 * @date 2025/1/7 14:37
 */
@FeignClient(contextId = "OrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = OrderClientFallbackFactory.class)
public interface OrderClient {
    /**
     * 获取商品销售数量
     * @param goodsId
     * @return
     */
    @PostMapping("/order/getGoodsSaleNum")
    R<Integer> getGoodsSaleNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("type") Integer type);
    /**
     * 获取门店销售订单数量
     * @param shopId    门店id
     * @param type      1:服务订单,2:单品订单
     * @return
     */
    @PostMapping("/order/getShopSaleNum")
    R<Integer> getShopSaleNum(@RequestParam("shopId") Integer shopId, @RequestParam("type") Integer type);
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderClient.java
File was deleted
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java
@@ -108,6 +108,9 @@
    @ApiModelProperty(value = "绑定门店上级门店可获得返佣积分")
    @TableField("bound_shop_superiors_points")
    private Integer boundShopSuperiorsPoints;
    @ApiModelProperty("购买类型(1=普通商品,2=秒杀商品)")
    @TableField("type")
    private Integer type;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ConfirmOrder.java
@@ -21,4 +21,6 @@
    private Integer shopId;
    @ApiModelProperty(value = "商品类型(1=服务商品,2=单品商品)", required = true)
    private Integer type;
    @ApiModelProperty("优惠券id")
    private Long couponId;
}
ruoyi-api/ruoyi-api-order/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -1 +1,2 @@
com.ruoyi.order.factory.RemoteOrderGoodsFallbackFactory
com.ruoyi.order.factory.RemoteOrderGoodsFallbackFactory
com.ruoyi.order.factory.OrderClientFallbackFactory
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/SeckillActivityInfoClientFallbackFactory.java
@@ -2,6 +2,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.GoodsSeckill;
import com.ruoyi.other.api.domain.SeckillActivityInfo;
import com.ruoyi.other.api.feignClient.SeckillActivityInfoClient;
import com.ruoyi.other.api.vo.GetSeckillActivityInfo;
import lombok.extern.slf4j.Slf4j;
@@ -16,6 +17,11 @@
            public R<GoodsSeckill> getSeckillActivityInfo(GetSeckillActivityInfo info) {
                return R.fail("根据商品id和会员等级获取对应的秒杀活动失败:" + cause.getMessage());
            }
            @Override
            public R<SeckillActivityInfo> getSeckillActivityInfoById(Integer id) {
                return R.fail("根据id获取秒杀活动失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java
@@ -49,6 +49,11 @@
            public void updateShop(Shop shop) {
                R.fail("编辑门店失败:" + cause.getMessage());
            }
            @Override
            public R<List<Shop>> getAllShop() {
                return R.fail("获取所有门店失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SeckillActivityInfoClient.java
@@ -3,11 +3,13 @@
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.GoodsSeckill;
import com.ruoyi.other.api.domain.SeckillActivityInfo;
import com.ruoyi.other.api.factory.SeckillActivityInfoClientFallbackFactory;
import com.ruoyi.other.api.vo.GetSeckillActivityInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author zhibing.pu
@@ -24,4 +26,13 @@
     */
    @PostMapping("/seckill-activity-info/getSeckillActivityInfo")
    R<GoodsSeckill> getSeckillActivityInfo(@RequestBody GetSeckillActivityInfo info);
    /**
     * 根据id获取秒杀活动
     * @param id
     * @return
     */
    @PostMapping("/seckill-activity-info/getSeckillActivityInfoById")
    R<SeckillActivityInfo> getSeckillActivityInfoById(@RequestParam("id") Integer id);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
@@ -57,4 +57,12 @@
     */
    @PostMapping("/shop/updateShop")
    void updateShop(Shop shop);
    /**
     * 获取所有门店
     * @return
     */
    @PostMapping("/shop/getAllShop")
    R<List<Shop>> getAllShop();
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysUser.java
@@ -113,7 +113,7 @@
    private Long roleId;
    /**
     * 角色类型 1=平台 2=公司 3=门店 4=修理厂
     * 角色类型 1=平台 2=门店
     */
    @ApiModelProperty(value = "角色类型 1=平台 2=门店")
    @TableField("role_type")
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/UserShop.java
@@ -4,7 +4,11 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.annotation.Excel;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
/**
 * @author zhibing.pu
@@ -38,4 +42,15 @@
     */
    @TableField("role_id")
    private Long roleId;
    /** 部门ID */
    @TableField("dept_id")
    private Long deptId;
    /** 用户昵称 */
    @TableField("nick_name")
    private String nickName;
    @TableField("create_time")
    private LocalDateTime createTime;
}
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java
@@ -90,7 +90,8 @@
        }
        if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户已停用,请联系管理员");
            throw new ServiceException("对不起,您的账号:" + username + " 已停用");
//            throw new ServiceException("对不起,您的账号:" + username + " 已停用");
            throw new ServiceException("您的账号已被禁用,请联系平台");
        }
        passwordService.validate(user, password, request);
        recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "登录成功");
ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java
@@ -118,7 +118,7 @@
    
    public static void main(String[] args) {
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        String encode = passwordEncoder.encode("49a15811ea47e8e9c6d8f3ef4d7bbc54");
        String encode = passwordEncoder.encode("31dc4a464b71db3ddaea244410af4833");
        System.err.println(encode);
    }
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java
@@ -33,6 +33,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -112,9 +113,6 @@
        user.setUserName(user.getPhonenumber());
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser1 = userService.getById(userid);
        if(sysUser1.getRoleType() == 2){
            user.setObjectId(sysUser1.getObjectId());
        }
        if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){
            user.setNickName(user.getPhonenumber());
        }
@@ -124,22 +122,41 @@
        if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) {
            return error("登录账号重复");
        }
        user.setCreateBy(SecurityUtils.getUsername());
        user.setPassword(SecurityUtils.encryptPassword("a123456"));
        user.setRoleType(sysUser1.getRoleType());
        userService.insertUser(user);
        SysUserRole sysUserRole = new SysUserRole();
        sysUserRole.setRoleId(user.getRoleId());
        sysUserRole.setUserId(user.getUserId());
        userRoleService.insertSysUserRole(sysUserRole);
        //添加门店员工关系数据
        if(2 == user.getRoleType()){
        //门店员工添加数据,需要判断账号是否存在,共用同一个账号
        if(2 == sysUser1.getRoleType()){
            SysUser one = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, user.getPhonenumber())
                    .eq(SysUser::getDelFlag, "0").eq(SysUser::getStatus, "0").eq(SysUser::getRoleType, 2));
            if(null == one){
                user.setCreateBy(SecurityUtils.getUsername());
                user.setPassword(SecurityUtils.encryptPassword("a123456"));
                user.setRoleType(sysUser1.getRoleType());
                user.setObjectId(sysUser1.getObjectId());
                userService.insertUser(user);
                one = user;
                SysUserRole sysUserRole = new SysUserRole();
                sysUserRole.setRoleId(user.getRoleId());
                sysUserRole.setUserId(user.getUserId());
                userRoleService.insertSysUserRole(sysUserRole);
            }
            //添加门店员工关系数据
            UserShop userShop = new UserShop();
            userShop.setUserId(user.getUserId());
            userShop.setShopId(user.getObjectId());
            userShop.setUserId(one.getUserId());
            userShop.setShopId(sysUser1.getObjectId());
            userShop.setRoleType(2);
            userShop.setRoleId(user.getRoleId());
            userShop.setDeptId(user.getDeptId());
            userShop.setNickName(user.getNickName());
            userShop.setCreateTime(LocalDateTime.now());
            userShopService.save(userShop);
        }else{
            user.setCreateBy(SecurityUtils.getUsername());
            user.setPassword(SecurityUtils.encryptPassword("a123456"));
            user.setRoleType(sysUser1.getRoleType());
            userService.insertUser(user);
            SysUserRole sysUserRole = new SysUserRole();
            sysUserRole.setRoleId(user.getRoleId());
            sysUserRole.setUserId(user.getUserId());
            userRoleService.insertSysUserRole(sysUserRole);
        }
        return AjaxResult.success();
    }
@@ -174,6 +191,17 @@
        ajax.put("posts", postService.selectPostAll());
        if (StringUtils.isNotNull(userId)) {
            SysUser sysUser = userService.selectUserById(userId);
            if(sysUser.getRoleType() == 2){
                Long userid = tokenService.getLoginUser().getUserid();
                SysUser sysUser1 = userService.selectUserById(userid);
                UserShop one = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, sysUser.getUserId()).eq(UserShop::getShopId, sysUser1.getObjectId()));
                sysUser.setDeptId(one.getDeptId());
                sysUser.setNickName(one.getNickName());
                SysDept sysDept = deptService.selectDeptById(one.getDeptId());
                sysUser.setDept(sysDept);
                sysUser.setRoleId(one.getRoleId());
            }
            ajax.put("data", sysUser);
            ajax.put("postIds", postService.selectPostListByUserId(userId));
            ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
@@ -231,13 +259,14 @@
    
        //添加门店员工关系数据
        if(2 == user.getRoleType()){
            userShopService.remove(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, user.getObjectId()));
            UserShop userShop = new UserShop();
            userShop.setUserId(user.getUserId());
            userShop.setShopId(user.getObjectId());
            userShop.setRoleType(2);
            userShop.setRoleId(user.getRoleId());
            userShopService.save(userShop);
            UserShop one = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, user.getObjectId()));
            one.setUserId(user.getUserId());
            one.setShopId(user.getObjectId());
            one.setRoleType(one.getRoleType());
            one.setRoleId(user.getRoleId());
            one.setDeptId(user.getDeptId());
            one.setNickName(user.getNickName());
            userShopService.updateById(one);
        }
        return success();
    }
@@ -614,7 +643,7 @@
    @ResponseBody
    @GetMapping("/switchShop")
    @PutMapping("/switchShop/{shopId}")
    @ApiOperation(value = "切换门店", tags = {"门店后台-首页"})
    public R<Set<String>> switchShop(@PathVariable("shopId") Integer shopId){
        Long userid = tokenService.getLoginUser().getUserid();
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/query/GetSysUserList.java
@@ -14,13 +14,11 @@
@Data
@ApiModel
public class GetSysUserList extends BasePage {
    @ApiModelProperty(value = "人员搜索")
    @ApiModelProperty(value = "账号名称")
    private String search;
    @ApiModelProperty(value = "充电站id")
    private Integer siteId;
    @ApiModelProperty(value = "角色id")
    private List<Integer> roleIds;
    @ApiModelProperty(value = "账户状态(0=正常,1=禁用)")
    private Integer status;
    @ApiModelProperty(value = "联系电话")
    private String phonenumber;
    @ApiModelProperty(value = "所属部门")
    private Integer deptId;
    private Integer objectId;
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -455,12 +455,6 @@
        for (SysUser user : sysUsers) {
            if(2 == user.getRoleType()){
                userShopService.remove(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, user.getObjectId()));
                UserShop userShop = new UserShop();
                userShop.setUserId(user.getUserId());
                userShop.setShopId(user.getObjectId());
                userShop.setRoleType(2);
                userShop.setRoleId(user.getRoleId());
                userShopService.save(userShop);
            }
        }
        return i;
@@ -533,20 +527,31 @@
        }
        List<SysUser> list = this.baseMapper.getList(pageInfo, getSysUserList);
        for (SysUser sysUser : list) {
            List<SysUserRole> list1 = sysUserRoleService.list(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, sysUser.getUserId()));
            List<String> roleNames = new ArrayList<>();
            for (SysUserRole sysUserRole : list1) {
                SysRole sysRole = sysRoleService.selectRoleById(sysUserRole.getRoleId());
                if(null == sysRole){
                    continue;
            if(sysUser.getRoleType() == 2){
                UserShop userShop = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getShopId, sysUser1.getObjectId()).eq(UserShop::getUserId, sysUser.getUserId()));
                SysRole sysRole = roleMapper.selectRoleById(userShop.getRoleId());
                Long[] roleIds = new Long[]{userShop.getRoleId()};
                sysUser.setNickName(userShop.getNickName());
                sysUser.setRoleIds(roleIds);
                sysUser.setRoleNames(Arrays.asList(sysRole.getRoleName()));
                SysDept sysDept = deptService.selectDeptById(userShop.getDeptId());
                sysUser.setDept(sysDept);
            }else{
                List<SysUserRole> list1 = sysUserRoleService.list(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, sysUser.getUserId()));
                List<String> roleNames = new ArrayList<>();
                for (SysUserRole sysUserRole : list1) {
                    SysRole sysRole = sysRoleService.selectRoleById(sysUserRole.getRoleId());
                    if(null == sysRole){
                        continue;
                    }
                    roleNames.add(sysRole.getRoleName());
                }
                roleNames.add(sysRole.getRoleName());
                Long[] roleIds = new Long[]{};
                sysUser.setRoleIds(list1.stream().map(SysUserRole::getRoleId).collect(Collectors.toList()).toArray(roleIds));
                sysUser.setRoleNames(roleNames);
                SysDept sysDept = deptService.selectDeptById(sysUser.getDeptId());
                sysUser.setDept(sysDept);
            }
            Long[] roleIds = new Long[]{};
            sysUser.setRoleIds(list1.stream().map(SysUserRole::getRoleId).collect(Collectors.toList()).toArray(roleIds));
            sysUser.setRoleNames(roleNames);
            SysDept sysDept = deptService.selectDeptById(sysUser.getDeptId());
            sysUser.setDept(sysDept);
        }
        return pageInfo.setRecords(list);
    }
ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml
@@ -132,28 +132,30 @@
        select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
    </select>
    <select id="getList" resultMap="SysUserResult">
        select * from sys_user where 1=1
        <if test="req.search !=null and req.search !=''">
            and (phonenumber like concat("%", #{req.search},"%") or nick_name like concat("%", #{req.search},"%"))
        select * from sys_user where del_flag = '0' and status = '0'
        <if test="null != req.phonenumber and '' != req.phonenumber">
            and phonenumber like CONCAT('%', #{req.phonenumber}, '%')
        </if>
        <if test="null != req.siteId">
            and user_id in (select user_id from t_user_site where site_id = #{req.siteId})
            and user_id in (select user_id from sys_user_role where role_id in (select role_id from t_role_site where site_id = #{req.siteId}))
        </if>
        <if test="null != req.roleIds and req.roleIds.size() > 0">
            and user_id in (select user_id from sys_user_role where role_id in
            <foreach collection="req.roleIds" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
            )
        </if>
        <if test="null != req.status">
            and status = #{req.status}
        </if>
        <if test="null != req.objectId">
            and objectId = #{req.objectId}
        </if>
        and del_flag = '0'
        <choose>
            <when test="null != req.objectId">
                and user_id in (select user_id from t_user_shop where shop_id = #{req.objectId}
                <if test="null != req.deptId">
                    and dept_id = #{req.deptId}
                </if>
                <if test="req.search !=null and req.search !=''">
                    and nick_name like concat("%", #{req.search},"%")
                </if>
                )
            </when>
            <otherwise>
                <if test="null != req.deptId">
                    and dept_id = #{req.deptId}
                </if>
                <if test="req.search !=null and req.search !=''">
                    and nick_name like concat("%", #{req.search},"%")
                </if>
            </otherwise>
        </choose>
        order by create_time desc
    </select>
    <select id="getAllList" resultType="com.ruoyi.system.api.domain.SysUser">
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java
@@ -48,8 +48,14 @@
    @PostMapping("/page")
    @ApiOperation(value = "会员申请列表", tags = {"后台"})
    public R<IPage<AgentApplication>> page(@RequestBody AgentQuery agentQuery) {
        return R.ok(agentApplicationService.pageList(agentQuery));
        IPage<AgentApplication> agentApplicationIPage = agentApplicationService.pageList(agentQuery);
        for (AgentApplication record : agentApplicationIPage.getRecords()) {
            AppUser byId = appUserService.getById(record.getAppUserId());
            if (byId!=null){
                record.setVipId(byId.getVipId());
            }
        }
        return R.ok(agentApplicationIPage);
    }
    @Resource
    private VipSettingClient vipSettingClient;
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -81,6 +81,10 @@
    private VipSettingService vipSettingService;
    @Resource
    private AppUserMapper appUserMapper;
    @Resource
    private ShopClient shopClient;
    @Resource
    private RemoteOrderGoodsClient remoteOrderGoodsClient;
    @ResponseBody
@@ -203,8 +207,8 @@
        userCancellationLog.setAppUserId(user.getId());
        userCancellationLog.setVipId(user.getVipId());
        userCancellationLogService.save(userCancellationLog);
        user.setStatus(3);
        appUserService.updateById(user);
        return R.ok();
    }
@@ -288,13 +292,13 @@
                user.setShopName(storeById.getData().getName());
            }
        }
        Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, userId).count();
        Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getInviteUserId, userId).count();
        Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getInviteUserId, userId).count();
        Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getInviteUserId, userId).count();
        Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getInviteUserId, userId).count();
        Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getInviteUserId, userId).count();
        Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getInviteUserId, userId).count();
        Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
        Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
        Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
        Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
        Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
        Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
        Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
        user.setCount1(count1);
        user.setCount2(count2);
        user.setCount3(count3);
@@ -516,10 +520,8 @@
    }
    @Resource
    private ShopClient shopClient;
    @Resource
    private RemoteOrderGoodsClient remoteOrderGoodsClient;
    @GetMapping("/detail")
    @ApiOperation(value = "用户列表-详情", tags = {"管理后台"})
@@ -610,7 +612,7 @@
    @PostMapping("/getAppUserByPhone1")
    public R<AppUser> getAppUserByPhone1(@RequestParam("phone") String phone) {
        AppUser appUser = appUserService.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1)
        AppUser appUser = appUserService.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).ne(AppUser::getStatus, 3)
                .eq(AppUser::getPhone, phone));
        return R.ok(appUser);
    }
@@ -656,13 +658,7 @@
        for (AppUser appUser : appUserList) {
            BigDecimal distributionAmount = Optional.ofNullable(appUser.getTotalDistributionAmount()).orElse(BigDecimal.ZERO);
            BigDecimal serviceFee = Optional.ofNullable(appUser.getShopServiceFee()).orElse(BigDecimal.ZERO);
            BigDecimal userCommission = Optional.ofNullable(appUser.getShopCommission()).orElse(BigDecimal.ZERO);
            totalCommission = totalCommission.add(distributionAmount);
            totalServiceFee = totalServiceFee.add(serviceFee);
            totalUserCommission = totalUserCommission.add(userCommission);
            Integer vipId = appUser.getVipId();
            if (vipId != null && vipId >= 1 && vipId <= 7) {
                vipCommissions.merge(vipId, distributionAmount, BigDecimal::add);
@@ -672,6 +668,11 @@
                        .merge(vipId, distributionAmount, BigDecimal::add);
            }
        }
        List<Shop> data = shopClient.getAllShop().getData();
        for (Shop shop : data) {
            totalServiceFee = totalServiceFee.add(shop.getServerGiveawayMoney());
            totalUserCommission = totalUserCommission.add(shop.getGiveawayMoney());
        }
        CommissionDetail commissionDetail = new CommissionDetail();
        commissionDetail.setTotalCommission(totalCommission);
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.controller;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.account.api.model.AppUser;
@@ -12,6 +13,7 @@
import com.ruoyi.account.service.UserCouponService;
import com.ruoyi.account.service.UserPointService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils;
import com.ruoyi.account.api.vo.PaymentUserCoupon;
import com.ruoyi.other.api.domain.Goods;
@@ -153,6 +155,7 @@
            userPoint.setBalance(byId.getLavePoint());
            userPoint.setAppUserId(userid);
            userPoint.setObjectId(Long.valueOf(data.getId()));
            userPoint.setCreateTime(LocalDateTime.now());
            userPointService.save(userPoint);
        }
        //增加优惠券记录,根据时间类型设置开始结束时间
@@ -219,15 +222,22 @@
    public R<UserCoupon> getCouponInfoInfo(String id){
        UserCoupon userCoupon = userCouponService.getById(id);
        CouponInfo couponInfo = couponClient.detail(userCoupon.getCouponId()).getData();
        List<Goods> goods = null;
        if("-1".equals(couponInfo.getForGoodIds())){
            goods = goodsClient.getGoodsByType(2).getData();
        List<String> goodNames = new ArrayList<>();
        if(!"null".equals(couponInfo.getGoodsNameJson()) && StringUtils.isNotEmpty(couponInfo.getGoodsNameJson())){
            goodNames = JSON.parseArray(couponInfo.getGoodsNameJson(), String.class);
        }else{
            goods = goodsClient.getGoodsById(couponInfo.getForGoodIds().split(",")).getData();
            List<Goods> goods = null;
            if("-1".equals(couponInfo.getForGoodIds())){
                goods = goodsClient.getGoodsByType(2).getData();
            }else{
                goods = goodsClient.getGoodsById(couponInfo.getForGoodIds().split(",")).getData();
            }
            goodNames = goods.stream().map(Goods::getName).collect(Collectors.toList());
        }
        CouponInfoVo couponInfoVo = new CouponInfoVo();
        BeanUtils.copyProperties(couponInfo, couponInfoVo);
        couponInfoVo.setGoodNames(goods.stream().map(Goods::getName).collect(Collectors.toList()));
        couponInfoVo.setGoodNames(goodNames);
        userCoupon.setCouponInfoVo(couponInfoVo);
        if (userCoupon.getUseTime()==null){
            userCoupon.setStatus(1);
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -662,6 +662,9 @@
    public List<NearbyReferrerVo> getNearbyReferrer(NearbyReferrer nearbyReferrer) {
        //使用地图获取省市区数据
        String citycode = TencentMapUtil.inverseGeographicalAnalysis(nearbyReferrer.getLongitude(), nearbyReferrer.getLatitude(), false);
        if(StringUtils.isEmpty(citycode)){
            citycode = "510100";
        }
        if(null != citycode){
            String cityCode = citycode.substring(0, 4) + "00";
            List<NearbyReferrerVo> list = this.baseMapper.getNearbyReferrer(cityCode, nearbyReferrer);
@@ -729,7 +732,7 @@
        Integer vipCancelDay = vipSetting.getVipCancelDay();
        Integer vipChangeDay = vipSetting.getVipChangeDay();
        List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, 1).eq(AppUser::getDelFlag, 0).isNotNull(AppUser::getInviteUserId)
                .eq(AppUser::getStatus, 1).last(" and ADDDATE(create_time,INTERVAL " + vipCancelDay + " DAY) <= now()"));
                .eq(AppUser::getStatus, 1).last(" and (UNIX_TIMESTAMP(create_time) + (" + vipCancelDay + " * 86400)) <= UNIX_TIMESTAMP()"));
        for (AppUser appUser : list) {
            UpdateWrapper<AppUser> updateWrapper = new UpdateWrapper<>();
            updateWrapper.set("invite_user_id", null).set("shop_id", null).eq("id", appUser.getId());
@@ -738,7 +741,7 @@
        
        //可更换推广人
        list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getChangePromoter, 0)
                .eq(AppUser::getStatus, 1).last(" and ADDDATE(ifnull(last_shop_time, create_time),INTERVAL " + vipChangeDay + " DAY) <= now()"));
                .eq(AppUser::getStatus, 1).last(" and (UNIX_TIMESTAMP(ifnull(last_shop_time, create_time)) + (" + vipChangeDay + " * 86400)) <= UNIX_TIMESTAMP()"));
        for (AppUser appUser : list) {
            appUser.setChangePromoter(1);
            this.updateById(appUser);
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AgentApplicationMapper.xml
@@ -45,6 +45,7 @@
                and t1.status = #{agentQuery.status}
            </if>
        </where>
        order by t1.status asc
    </select>
</mapper>
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserCancellationLogMapper.xml
@@ -20,11 +20,11 @@
        from t_user_cancellation_log t1
        left join t_app_user t2 on t1.app_user_id = t2.id
        <where>
            <if test="agentQuery.name != null and agentQuery.name != ''">
                and t2.name like concat('%',#{agentQuery.name},'%')
            <if test="agentQuery.userName != null and agentQuery.userName != ''">
                and t2.name like concat('%',#{agentQuery.userName},'%')
            </if>
            <if test="agentQuery.phone != null and agentQuery.phone != ''">
                and t2.phone like concat('%',#{agentQuery.phone},'%')
            <if test="agentQuery.userPhone != null and agentQuery.userPhone != ''">
                and t2.phone like concat('%',#{agentQuery.userPhone},'%')
            </if>
            <if test="agentQuery.vipId != null">
                and t1.vip_id = #{agentQuery.vipId}
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserClickLogMapper.xml
@@ -37,6 +37,7 @@
                    and DATE(t1.create_time) between #{agentQuery.localDate1} and #{agentQuery.localDate2}
                </if>
            </where>
        order by t1.create_time desc
    </select>
</mapper>
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml
@@ -23,7 +23,7 @@
        select t1.*,t2.name as userName,t2.phone as userPhone
        from t_withdrawal_requests t1
        left join t_app_user t2 on t1.app_user_id = t2.id
        order by t1.create_time desc
    </select>
</mapper>
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -33,10 +33,7 @@
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -135,11 +132,8 @@
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
    @GetMapping("/cancel/{orderId}")
    public R<Void> cancel(@PathVariable("orderId") Long orderId){
        orderService.update(new LambdaUpdateWrapper<Order>()
                .eq(Order::getId, orderId)
                .set(Order::getOrderStatus, OrderStatus.CANCELLED.getCode()));
        return R.ok();
    public R cancel(@PathVariable("orderId") Long orderId){
        return orderService.cancel(orderId);
    }
    /**
@@ -370,5 +364,31 @@
        }
    }
    /**
     * 获取商品销售数量
     * @param goodsId
     * @return
     */
    @PostMapping("/getGoodsSaleNum")
    public R<Integer> getGoodsSaleNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("type") Integer type){
        Integer goodsSaleNum = orderService.getGoodsSaleNum(goodsId, type);
        return R.ok(goodsSaleNum);
    }
    /**
     * 获取门店销售订单数量
     * @param shopId    门店id
     * @param type      1:服务订单,2:单品订单
     * @return
     */
    @PostMapping("/getShopSaleNum")
    public R<Integer> getShopSaleNum(@RequestParam("shopId") Integer shopId, @RequestParam("type") Integer type){
        Integer shopSaleNum = orderService.getShopSaleNum(shopId, type);
        return R.ok(shopSaleNum);
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderMapper.java
@@ -36,4 +36,21 @@
    OrderStatistics getOrderStatistics(@Param("startTime")String startTime,
                                       @Param("endTime") String endTime);
    /**
     * 获取商品销售数量
     * @param goodsId
     * @return
     */
    Integer getGoodsSaleNum(@Param("goodsId") Integer goodsId, @Param("type") Integer type);
    /**
     * 获取店铺订单数量
     * @param shopId
     * @param type
     * @return
     */
    Integer getShopSaleNum(@Param("shopId") Integer shopId, @Param("type") Integer type);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
@@ -6,6 +6,7 @@
import com.ruoyi.order.model.Order;
import com.ruoyi.order.util.payment.model.RefundCallbackResult;
import com.ruoyi.order.vo.*;
import org.omg.CORBA.INTERNAL;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
@@ -34,7 +35,13 @@
     * @return
     */
    PageInfo<OrderPageListVo> getOrderPageList(OrderPageList orderPageList);
    /**
     * 小程序取消订单
     * @param orderId
     * @return
     */
    R cancel(Long orderId);
    
    /**
     * 确认发货操作
@@ -87,4 +94,20 @@
     * @return
     */
    OrderInfoVo getOrderInfo(Long orderId);
    /**
     * 获取商品销售数量
     * @param goodsId
     * @return
     */
    Integer getGoodsSaleNum(Integer goodsId, Integer type);
    /**
     * 获取店铺订单数量
     * @param shopId
     * @param type
     * @return
     */
    Integer getShopSaleNum(Integer shopId, Integer type);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.feignClient.BalanceChangeRecordClient;
@@ -304,11 +305,42 @@
            AppUser appUser = appUserClient.getAppUserById(appUserId);
            orderPageListVo.setUserName(appUser.getName());
            orderPageListVo.setPhone(appUser.getPhone());
            RefundPass one = refundPassService.getOne(new LambdaQueryWrapper<RefundPass>().eq(RefundPass::getOrderId, orderPageListVo.getId()).eq(RefundPass::getDelFlag, 0).last(" order by create_time desc limit 0, 1"));
            orderPageListVo.setRefundPassId(null != one ? one.getId().toString() : null);
        }
        return pageInfo.setRecords(list);
    }
    /**
     * 小程序取消订单
     * @param orderId
     * @return
     */
    @Override
    public R cancel(Long orderId) {
        Order order = this.getById(orderId);
        if(null == order){
            return R.fail("取消失败");
        }
        Long userid = tokenService.getLoginUserApplet().getUserid();
        if(!order.getAppUserId().equals(userid)){
            return R.fail("取消失败");
        }
        if(!Arrays.asList(1, 2, 3).contains(order.getOrderStatus())){
            return R.fail("订单取消失败");
        }
        if(LocalDateTime.now().isAfter(order.getAfterSaleTime())){
            return R.fail("订单取消失败");
        }
        order.setOrderStatus(5);
        R r = refundPayMoney(order);
        if(200 == r.getCode()){
            this.updateById(order);
        }
        return r;
    }
    /**
     * 确认发货操作
     * @param orderId
@@ -345,6 +377,9 @@
        Order order = this.getById(orderId);
        if(Arrays.asList(5, 6, 7).contains(order.getOrderStatus())){
            return R.fail("无效的操作");
        }
        if(LocalDateTime.now().isAfter(order.getAfterSaleTime())){
            return R.fail("订单取消失败");
        }
        order.setOrderStatus(5);
        R r = refundPayMoney(order);
@@ -667,6 +702,18 @@
            return R.fail("无效的操作");
        }
        order.setOrderStatus(4);
        R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(5);
        if (R.isError(baseSettingR)) {
            return R.fail("售后设置获取失败");
        }
        BaseSetting baseSetting = baseSettingR.getData();
        if (baseSetting == null) {
            return R.fail("售后设置获取失败");
        }
        String content = baseSetting.getContent();
        JSONObject jsonObject = JSONObject.parseObject(content);
        Long days = jsonObject.getLong("days");
        order.setAfterSaleTime(LocalDateTime.now().plusDays(days));
        this.updateById(order);
        return R.ok();
    }
@@ -730,4 +777,27 @@
        orderInfo.setGoodsJson(JSON.toJSONString(goodsJson));
        return orderInfo;
    }
    /**
     * 获取商品销售数量
     * @param goodsId
     * @return
     */
    @Override
    public Integer getGoodsSaleNum(Integer goodsId, Integer type) {
        return this.baseMapper.getGoodsSaleNum(goodsId, type);
    }
    /**
     * 获取店铺订单数量
     * @param shopId
     * @param type
     * @return
     */
    @Override
    public Integer getShopSaleNum(Integer shopId, Integer type) {
        return this.baseMapper.getShopSaleNum(shopId, type);
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
@@ -132,8 +132,10 @@
        List<OrderRefundPassList> orderRefundPassList = this.baseMapper.getOrderRefundPassList(pageInfo, refundPassListVo.getCode(), appUserIds, shopId, refundPassListVo.getRefundMethod(), refundPassListVo.getStatus());
        for (OrderRefundPassList refundPassList : orderRefundPassList) {
            AppUser appUser = appUserClient.getAppUserById(refundPassList.getAppUserId());
            refundPassList.setUserName(appUser.getName());
            refundPassList.setPhone(appUser.getPhone());
            if(null != appUser){
                refundPassList.setUserName(appUser.getName());
                refundPassList.setPhone(appUser.getPhone());
            }
        }
        return pageInfo.setRecords(orderRefundPassList);
    }
@@ -160,6 +162,9 @@
        if(refundPass.getRefundMethod() == 2 && 2 == status){
            refundPass.setStatus(2);
        }
        if(3 == status){
            refundPass.setStatus(3);
        }
        refundPass.setPassRemark(passRemark);
        //仅退款的售后需要将支付金额原路返回,然后再扣减支付获得的积分
        if(refundPass.getRefundMethod() == 2 && 2 == status){
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -388,16 +388,89 @@
            }
            confirmOrderVo.setOrderPoint(sum);
        }
        //查询当前是否有订单活动
        OrderActivityInfo orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData();
        BigDecimal orderMoney = confirmOrderVo.getOrderMoney();
        BigDecimal paymentMoney = orderMoney;
        //总优惠金额
        BigDecimal activityAmount = BigDecimal.ZERO;
        //减去优惠券优惠金额
        CouponInfoVo couponInfoVo = null;
        if(null != confirmOrder.getCouponId() && 2 != confirmOrder.getPaymentType()){
            couponInfoVo = userCouponClient.getCouponInfo(confirmOrder.getCouponId()).getData();
            String forGoodIds = couponInfoVo.getForGoodIds();
            String[] split = forGoodIds.split(",");
            List<String> parseArray = Arrays.asList(split);
            //全部商品
            if("-1".equals(forGoodIds)){
                //满减
                if(1 == couponInfoVo.getCouponType() && couponInfoVo.getConditionAmount().compareTo(paymentMoney) <= 0){
                    paymentMoney = paymentMoney.subtract(couponInfoVo.getDiscountAmount());
                    activityAmount = activityAmount.add(couponInfoVo.getDiscountAmount());
                }
                //代金券
                if(2 == couponInfoVo.getCouponType()){
                    paymentMoney = paymentMoney.subtract(couponInfoVo.getMoneyAmount());
                    activityAmount = activityAmount.add(couponInfoVo.getMoneyAmount());
                    if(paymentMoney.compareTo(BigDecimal.ZERO) < 0){
                        paymentMoney = BigDecimal.ZERO;
                    }
                }
                //折扣券
                if(3 == couponInfoVo.getCouponType()){
                    BigDecimal paymentMoney1 = couponInfoVo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney);
                    BigDecimal bigDecimal = paymentMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN);
                    paymentMoney = paymentMoney1;
                    activityAmount = activityAmount.add(bigDecimal);
                }
            }else{
                //部分商品,需要计算参与优惠商品的支付金额,然后再对商品进行优惠券处理
                paymentMoney = BigDecimal.ZERO;
                BigDecimal goodsMoney = BigDecimal.ZERO;
                for (MyShoppingCartVo myShoppingCartVo : goodsList) {
                    String goodsId = myShoppingCartVo.getGoodsId().toString();
                    BigDecimal cash = myShoppingCartVo.getCash();
                    if(parseArray.contains(goodsId)){
                        goodsMoney = goodsMoney.add(cash);
                    }else{
                        paymentMoney = paymentMoney.add(cash);
                    }
                }
                //满减
                if(1 == couponInfoVo.getCouponType() && couponInfoVo.getConditionAmount().compareTo(goodsMoney) <= 0){
                    goodsMoney = goodsMoney.subtract(couponInfoVo.getDiscountAmount());
                    activityAmount = activityAmount.add(couponInfoVo.getDiscountAmount());
                }
                //代金券
                if(2 == couponInfoVo.getCouponType()){
                    goodsMoney = goodsMoney.subtract(couponInfoVo.getMoneyAmount());
                    activityAmount = activityAmount.add(couponInfoVo.getMoneyAmount());
                    if(goodsMoney.compareTo(BigDecimal.ZERO) < 0){
                        goodsMoney = BigDecimal.ZERO;
                    }
                }
                //折扣券
                if(3 == couponInfoVo.getCouponType()){
                    BigDecimal paymentMoney1 = couponInfoVo.getDiscount().divide(new BigDecimal(10)).multiply(goodsMoney);
                    BigDecimal bigDecimal = goodsMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN);
                    goodsMoney = paymentMoney1;
                    activityAmount = activityAmount.add(bigDecimal);
                }
                paymentMoney = paymentMoney.add(goodsMoney);
            }
        }
        //查询当前是否有订单活动
        OrderActivityInfo orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData();
        //满XX才打折,只有现金才能优惠
        if(null != orderActivityInfo && confirmOrder.getPaymentType() == 1 && orderActivityInfo.getConditionAmount().compareTo(orderMoney) <= 0){
            confirmOrderVo.setActivityName(orderActivityInfo.getActivityName());
            paymentMoney = orderActivityInfo.getDiscount().divide(new BigDecimal(10)).multiply(orderMoney);
            confirmOrderVo.setDiscountAmount(orderMoney.subtract(paymentMoney).setScale(2, RoundingMode.HALF_EVEN));
            BigDecimal multiply = orderActivityInfo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney);
            BigDecimal bigDecimal = paymentMoney.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN);
            activityAmount = activityAmount.add(bigDecimal);
        }
        confirmOrderVo.setDiscountAmount(activityAmount);
        BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData();
        confirmOrderVo.setUseSimultaneously(JSON.parseObject(baseSetting.getContent()).getInteger("status") == 1);
        int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum();
@@ -582,21 +655,26 @@
        for (int i = 0; i < objects.size(); i++) {
            Long id = objects.getJSONObject(i).getLong("id");
            Integer num1 = objects.getJSONObject(i).getInteger("num");
            Integer type = objects.getJSONObject(i).getInteger("type");
            num += num1;
            ShoppingCart shoppingCart = this.getById(id);
            //判断当前数量是否已经超出限购数量(需要计算已经购买的数量)
            Integer goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), type);
            Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData();
            if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit()){
                List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getAppUserId, appUser.getId()).eq(Order::getDelFlag, 0).notIn(Order::getOrderStatus, Arrays.asList(5, 6)));
                List<Long> orderIds = orders.stream().map(Order::getId).collect(Collectors.toList());
                int sum = 0;
                if(orderIds.size() > 0){
                    List<OrderGood> orderGoodList = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().in(OrderGood::getOrderId, orderIds)
                            .eq(OrderGood::getGoodsId, shoppingCart.getGoodsId()).eq(OrderGood::getDelFlag, 0));
                    sum = orderGoodList.stream().mapToInt(OrderGood::getNum).sum();
                }
                if((num1 + sum) > goods.getPurchaseLimit()){
            if(1 == type){
                if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && (goodsSaleNum + num1) > goods.getPurchaseLimit()){
                    return R.fail(goods.getName() + "已超出购买上限");
                }
            }else{
                GetSeckillActivityInfo info = new GetSeckillActivityInfo();
                info.setGoodsId(shoppingCart.getGoodsId());
                info.setVip(appUser.getVipId());
                GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData();
                if(null != goodsSeckill ){
                    SeckillActivityInfo activityInfo = seckillActivityInfoClient.getSeckillActivityInfoById(goodsSeckill.getSeckillActivityInfoId()).getData();
                    if(null != activityInfo.getMaxNum() && -1 != activityInfo.getMaxNum() && (goodsSaleNum + num1) > activityInfo.getMaxNum()){
                        return R.fail(goods.getName() + "已超出秒杀活动购买上限");
                    }
                }
            }
            ids.add(id);
@@ -861,19 +939,23 @@
            OrderGood orderGood = new OrderGood();
            orderGood.setGoodsId(myShoppingCartVo.getGoodsId());
            orderGood.setOrderId(order.getId());
            GetSeckillActivityInfo info = new GetSeckillActivityInfo();
            info.setGoodsId(myShoppingCartVo.getGoodsId());
            info.setVip(appUser.getVipId());
            GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData();
            if(null != goodsSeckill){
                orderGood.setSeckillJson(JSON.toJSONString(goodsSeckill));
            }
            for (int i = 0; i < objects.size(); i++) {
                Long id = objects.getJSONObject(i).getLong("id");
                if(myShoppingCartVo.getId().equals(id.toString())){
                    ShoppingCart shoppingCart = this.getById(id);
                    Integer num1 = objects.getJSONObject(i).getInteger("num");
                    Integer type = objects.getJSONObject(i).getInteger("type");
                    orderGood.setNum(num1);
                    orderGood.setType(type);
                    if(2 == type){
                        GetSeckillActivityInfo info = new GetSeckillActivityInfo();
                        info.setGoodsId(myShoppingCartVo.getGoodsId());
                        info.setVip(appUser.getVipId());
                        GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData();
                        if(null != goodsSeckill){
                            orderGood.setSeckillJson(JSON.toJSONString(goodsSeckill));
                        }
                    }
                    Goods goods1 = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData();
                    orderGood.setGoodJson(JSON.toJSONString(goods1));
                    break;
@@ -1298,6 +1380,7 @@
        for (String code : orderPayment) {
            Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNumber, code));
            if(null == order || order.getPayStatus() != 1){
                redisTemplate.opsForZSet().remove("OrderPayment", code);
                continue;
            }
            //开始执行关闭订单操作
@@ -1307,6 +1390,7 @@
                redisTemplate.opsForZSet().add("OrderPayment", code, 0);
                log.error("关闭订单失败:{}---->{}", code, JSON.toJSONString(closeOrderResult));
            }
            redisTemplate.opsForZSet().remove("OrderPayment", code);
        }
        
        //快递支付
@@ -1315,6 +1399,7 @@
            code = code.substring(0, 23);
            Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNumber, code));
            if(null == order || order.getPayStatus() != 1){
                redisTemplate.opsForZSet().remove("MaterialFlowPayment", code);
                continue;
            }
            //开始执行关闭订单操作
@@ -1324,6 +1409,7 @@
                redisTemplate.opsForZSet().add("MaterialFlowPayment", code, 0);
                log.error("关闭订单失败:{}---->{}", code, JSON.toJSONString(closeOrderResult));
            }
            redisTemplate.opsForZSet().remove("MaterialFlowPayment", code);
        }
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageListVo.java
@@ -31,9 +31,10 @@
    private BigDecimal orderMoney;
    @ApiModelProperty("订单状态(1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价)")
    private Integer status;
    /**
     * 用户id
     */
    private Long appUserId;
    @ApiModelProperty("售后订单id")
    private String refundPassId;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassList.java
@@ -25,6 +25,8 @@
    private Integer refundMethod;
    @ApiModelProperty("申请原因")
    private String refundReason;
    @ApiModelProperty("1待审核2已完成3已拒绝4待退货5待平台收货")
    private Integer status;
    @ApiModelProperty("状态(1待审核2同意3拒绝)")
    private Integer passStatus;
    /**
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -91,4 +91,30 @@
            and tor.create_time between #{startTime} and #{endTime}
        </if>
    </select>
    <select id="getGoodsSaleNum" resultType="int">
        select
        ifnull(sum(a.num), 0)
        from t_order_good a
        left join t_order b on (a.order_id = b.id)
        where b.del_flag = 0 and b.pay_status = 2 and b.order_status in (1, 2, 3, 4, 7, 8) and a.goods_id = #{goodsId}
        <if test="null != type">
            and a.type = #{type}
        </if>
    </select>
    <select id="getShopSaleNum" resultType="int">
        select
        ifnull(count(1), 0)
        from t_order a
        where del_flag = 0 and pay_status = 2 and order_status in (1, 2, 3, 4, 7, 8)
        <if test="null != shopId and 0 != shopId">
            and shop_id = #{shopId}
        </if>
        <if test="null != type">
            and order_type = #{type}
        </if>
    </select>
</mapper>
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml
@@ -11,7 +11,8 @@
            DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%m:%s') as createTime,
            a.refund_method as refundMethod,
            a.refund_reason as refundReason,
            a.pass_status as passStatus
            a.pass_status as passStatus,
            a.status
        from t_refund_pass a
        left join t_order b on (a.order_id = b.id)
        where a.del_flag = 0
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java
@@ -97,6 +97,18 @@
    /**
     * 获取商品秒杀活动
     * @param id
     * @return
     */
    @PostMapping("/getSeckillActivityInfoById")
    public R<SeckillActivityInfo> getSeckillActivityInfoById(@RequestParam("id") Integer id){
        SeckillActivityInfo one = seckillActivityInfoService.getById(id);
        return R.ok(one);
    }
    /**
     * 秒杀活动列表
     */
    @GetMapping("/manageList")
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -11,6 +11,7 @@
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.feignClient.OrderClient;
import com.ruoyi.order.vo.VerifiableShopVo;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.GoodsShop;
@@ -77,6 +78,8 @@
    private GoodsService goodsService;
    @Resource
    private GoodsShopService goodsShopService;
    @Resource
    private OrderClient orderClient;
@@ -471,6 +474,14 @@
    @ApiOperation(value = "门店统计", tags = {"管理后台-首页统计"})
    public R<ShopStatistics> shopStatistics(@ApiParam("门店id") Integer shopId) {
        ShopStatistics shopStatistics = shopMapper.getShopStatistics(shopId);
        if(null == shopId){
            shopId = 0;
        }
        Integer serviceOrder = orderClient.getShopSaleNum(shopId, 1).getData();
        Integer goodsOrder = orderClient.getShopSaleNum(shopId, 2).getData();
        shopStatistics.setTotalOrder(serviceOrder + goodsOrder);
        shopStatistics.setServiceOrder(serviceOrder);
        shopStatistics.setGoodsOrder(goodsOrder);
        return R.ok(shopStatistics);
    }
    
@@ -558,5 +569,16 @@
        shopService.saveWithdrawalAccount(saveWithdrawalAccount);
        return R.ok();
    }
    /**
     * 获取所有门店
     * @return
     */
    @PostMapping("/getAllShop")
    public R<List<Shop>> getAllShop(){
        List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1));
        return R.ok(list);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
@@ -119,14 +121,41 @@
                .page(Page.of(pageNum, pageSize));
        return R.ok(page);
    }
    @Resource
    private AppUserClient appUserClient;
    @PostMapping("/manage/addorupdate")
    @ApiOperation(value = "添加编辑", tags = {"门店-技师列表"})
    public R<Page<Technician>> add(@RequestBody Technician technician) {
        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
        if (technician.getId()==null){
        if (technician.getId()==null) {
            technician.setSubscribeStatus(2);
            List<Technician> list = technicianService.lambdaQuery().eq(Technician::getPhone, technician.getPhone()).list();
            if (!list.isEmpty()) {
                return R.fail("当前号码已经添加");
            }
            R<AppUser> appUserByPhone1 = appUserClient.getAppUserByPhone1(technician.getPhone());
            if (appUserByPhone1.getData()==null){
                return R.fail("当前号码暂无注册用户");
            }
        }else {
            Technician byId = technicianService.getById(technician.getId());
            if (byId.getPhone()!=technician.getPhone()){
                List<Technician> list = technicianService.lambdaQuery().eq(Technician::getPhone, technician.getPhone()).list();
                if (!list.isEmpty()) {
                    return R.fail("当前号码已经添加");
                }
                R<AppUser> appUserByPhone1 = appUserClient.getAppUserByPhone1(technician.getPhone());
                if (appUserByPhone1.getData()==null){
                    return R.fail("当前号码暂无注册用户");
                }
            }
        }
        technician.setShopId(objectId);
        R<AppUser> appUserByPhone1 = appUserClient.getAppUserByPhone1(technician.getPhone());
        if (appUserByPhone1.getData()!=null){
            technician.setAppUserId(appUserByPhone1.getData().getId());
        }
        technicianService.saveOrUpdate(technician);
        return R.ok();
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
@@ -76,7 +76,6 @@
    @GetMapping("/cancel")
    @ApiOperation(value = "取消服务", notes = "取消服务", tags = {"小程序-个人中心-门店管理,小程序-个人中心-我的预约","门店-预约管理"})
    public R<Void> cancel(@ApiParam(value = "预约id") @RequestParam Long id) {
        TechnicianSubscribe subscribe = technicianSubscribeService.getOne(new LambdaQueryWrapper<TechnicianSubscribe>()
                .eq(TechnicianSubscribe::getId, id)
                .eq(TechnicianSubscribe::getStatus, 0));
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java
@@ -31,4 +31,10 @@
    IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status);
    void subscribe(TechnicianSubscribe technicianSubscribe);
    /**
     * 定时修改到期状态
     */
    void taskEditStstus();
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -16,6 +16,7 @@
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.order.feignClient.OrderClient;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.vo.Price;
import com.ruoyi.other.api.domain.*;
@@ -82,6 +83,8 @@
    private GoodsBargainPriceService goodsBargainPriceService;
    @Resource
    private GoodsBargainPriceDetailService goodsBargainPriceDetailService;
    @Resource
    private OrderClient orderClient;
@@ -103,8 +106,10 @@
        }
        List<GoodsVO> list = this.baseMapper.goodsList(pageInfo, search.getGoodsCategoryId(), search.getName(), vipId);
        for (GoodsVO goods : list) {
            Price price = getPrice(vipId, goods.getGoodsId(), 1, null, provinceCode, cityCode, districtCode);
            Price price = getPrice(vipId, goods.getGoodsId(), null, 1, provinceCode, cityCode, districtCode);
            if(null != price){
                goods.setCashPayment(price.getCashPayment() ? 1 : 0);
                goods.setPointPayment(price.getPointPayment() ? 1 : 0);
                goods.setSellingPrice(price.getCash());
                goods.setIntegral(price.getPoint());
            }
@@ -139,6 +144,8 @@
        goodsVO.setGoodsName(goods.getName());
        Price price = getPrice(vipId, goods.getId(), 1, null, provinceCode, cityCode, districtCode);
        if(null != price){
            goodsVO.setPointPayment(price.getPointPayment() ? 1 : 0);
            goodsVO.setCashPayment(price.getCashPayment() ? 1 : 0);
            goodsVO.setSellingPrice(price.getCash());
            goodsVO.setIntegral(price.getPoint());
        }
@@ -163,6 +170,8 @@
                    .in(Shop::getDelFlag, 0));
            goodsVO.setShopList(shopList);
        }
        Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData();
        goodsVO.setSaleNum(integer);
        return goodsVO;
    }
@@ -184,8 +193,10 @@
        }
        List<Goods> goods = goodsMapper.selectListByShopId(pageInfo, shopId, vipId);
        for (Goods good : goods) {
            Price price = getPrice(vipId, good.getId(), 1, shopId, provinceCode, cityCode, districtCode);
            Price price = getPrice(vipId, good.getId(), shopId, 1, provinceCode, cityCode, districtCode);
            if(null != price){
                good.setCashPayment(price.getCashPayment() ? 1 : 0);
                good.setPointPayment(price.getPointPayment() ? 1 : 0);
                good.setSellingPrice(price.getCash());
                good.setIntegral(price.getPoint());
            }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java
@@ -9,6 +9,7 @@
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.order.feignClient.OrderClient;
import com.ruoyi.other.api.domain.*;
import com.ruoyi.other.mapper.GoodsShopMapper;
import com.ruoyi.other.mapper.SeckillActivityInfoMapper;
@@ -51,6 +52,8 @@
    private GoodsSeckillService goodsSeckillService;
    @Resource
    private GoodsService goodsService;
    @Resource
    private OrderClient orderClient;
    @Override
    public List<SeckillActivityVO> listSeckillActivity(Goods goods) {
@@ -86,6 +89,8 @@
            shops = shopMapper.selectList(new LambdaUpdateWrapper<Shop>().eq(Shop::getDelFlag, 0));
        }
        seckillActivityDetailVO.setShopList(shops);
        Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 2).getData();
        seckillActivityDetailVO.setSaleNum(integer);
        return seckillActivityDetailVO;
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.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;
@@ -51,7 +52,7 @@
        PageInfo<TechnicianSubscribeVO> pageInfo = new PageInfo(pageCurr, pageSize);
        List<TechnicianSubscribeVO> list = technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(pageInfo, shopId, status);
        for (TechnicianSubscribeVO technicianSubscribeVO : list) {
            Long id = technicianSubscribeVO.getId();
            String id = technicianSubscribeVO.getId();
            TechnicianSubscribe technicianSubscribe = this.getById(id);
            AppUser appUser = appUserClient.getAppUserById(technicianSubscribe.getAppUserId());
            technicianSubscribeVO.setUserName(appUser.getName());
@@ -65,6 +66,11 @@
                                                                                Integer serviceMode, Integer pageCurr, Integer pageSize) {
        PageInfo<TechnicianSubscribeVO> pageInfo = new PageInfo(pageCurr, pageSize);
        List<TechnicianSubscribeVO> technicianSubscribeByUserAndShop1 = technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop1(pageInfo, shopId, status, phone, name, serviceMode);
        for (TechnicianSubscribeVO technicianSubscribeVO : technicianSubscribeByUserAndShop1) {
            AppUser appUser = appUserClient.getAppUserById(technicianSubscribeVO.getAppUserId());
            technicianSubscribeVO.setUserName(appUser.getName());
            technicianSubscribeVO.setPhone(appUser.getPhone());
        }
        return pageInfo.setRecords(technicianSubscribeByUserAndShop1);
    }
    @Override
@@ -87,4 +93,18 @@
        long deadlineTimestamp = subscribeTime.atZone(ZoneId.systemDefault()).toEpochSecond();
        redisTemplate.opsForZSet().add("delay_queue:subscribe", subscribe.getId().toString(), deadlineTimestamp);
    }
    /**
     * 定时修改到期状态
     */
    @Override
    public void taskEditStstus() {
        List<TechnicianSubscribe> list = this.list(new LambdaQueryWrapper<TechnicianSubscribe>().eq(TechnicianSubscribe::getStatus, 0).eq(TechnicianSubscribe::getDelFlag, 0)
                .lt(TechnicianSubscribe::getSubscribeTime, LocalDateTime.now()));
        list.forEach(s->s.setStatus(3));
        if(list.size() > 0){
            this.updateBatchById(list);
        }
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/task/TaskUtil.java
@@ -2,9 +2,11 @@
import com.ruoyi.other.service.TechnicianSubscribeService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
@@ -13,6 +15,17 @@
@Component
public class TaskUtil {
    @Resource
    private TechnicianSubscribeService technicianSubscribeService;
    /**
     * 每分钟定时
     */
    @Scheduled(fixedRate = 60000)
    public void taskMonth() {
        technicianSubscribeService.taskEditStstus();
    }
    /**
     * 每天的凌晨执行的任务
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java
@@ -1,5 +1,6 @@
package com.ruoyi.other.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.other.api.domain.Shop;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -36,6 +37,10 @@
    @ApiModelProperty(value = "详情图,多个逗号分隔")
    private String detailPicture;
    @ApiModelProperty(value = "现金支付(0=否,1=是)")
    private Integer cashPayment;
    @ApiModelProperty(value = "积分支付(0=否,1=是)")
    private Integer pointPayment;
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java
@@ -11,7 +11,7 @@
public class TechnicianSubscribeVO {
    @ApiModelProperty(value = "预约id")
    private Long id;
    private String id;
    /**
     * 门店名称
@@ -67,5 +67,7 @@
    @ApiModelProperty(value = "联系电话")
    private String phone;
    private Long appUserId;
}
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml
@@ -14,8 +14,8 @@
        tg.sale_num as saleNum,
        tg.home_page_picture as homePagePicture
        FROM t_goods tg
        left join t_goods_shop tgs ON tg.id = tgs.goods_id
        where tg.del_flag = 0 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})))
        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>
@@ -61,7 +61,7 @@
    <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
        select *, id as goodsId, name as goodsName from t_goods where status = 2 and del_flag = 0 and `type` = 2
        <if test="null != goodsCategoryId">
            and goods_category_id = #{goodsCategoryId}
        </if>
@@ -69,7 +69,7 @@
            and name like CONCAT('%', #{name}, '%')
        </if>
        <if test="null != vip">
            and id in (select goods_id from t_goods_vip where vip = #{vip})
            and (FIND_IN_SET(#{vip}, commodity_authority) or commodity_authority like '%-1%')
        </if>
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml
@@ -11,6 +11,7 @@
            tg.home_page_picture as homePagePicture,
            tg.original_price as originalPrice,
            tgs.selling_price as sellingPrice,
            tgs.integral as integral,
            tg.sale_num as saleNum,
            tsai.start_time as startTime,
            tsai.end_time as endTime
@@ -18,7 +19,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 and tgs.vip = #{vipId}
        WHERE tsai.is_shelves = 1 AND tsai.del_flag = 0 and now() between tsai.start_time and tsai.end_time
        WHERE tsai.is_shelves = 1 AND tsai.del_flag = 0
        <if test="name != null and name != ''">
            AND tg.`name` LIKE concat('%',#{name},'%')
        </if>
@@ -46,6 +47,7 @@
            tsai.start_time as startTime,
            tg.detail_picture as detailPicture,
            tsai.end_time as endTime,
            tsai.max_num as maxNum,
            tg.detail
        FROM
            t_seckill_activity_info tsai
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
@@ -9,7 +9,8 @@
        ts.phone,
        tsp.type,
        tsp.create_time,
        tsp.variable_point
        tsp.variable_point,
        tsp.order_num
        FROM
        t_shop_point tsp
        LEFT JOIN t_shop ts ON tsp.shop_id = ts.id
@@ -29,8 +30,11 @@
            <if test="shopPoint.startTime !=null and shopPoint.endTime !=null">
                AND tsp.create_time BETWEEN #{shopPoint.startTime} AND #{shopPoint.endTime}
            </if>
            <if test="shopPoint.shopId !=null">
                AND tsp.shop_id = #{shopPoint.shopId}
            </if>
        </where>
        order by tsp.create_time desc
    </sql>
    <select id="selectShopPointList" resultType="com.ruoyi.other.api.domain.ShopPoint">
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml
@@ -28,7 +28,7 @@
    </select>
    <select id="getTechnicianSubscribeByUserAndShop1" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO">
        SELECT
            CAST(tts.id AS CHAR) id,
            tts.id,
            tts.user_address,
            ts.`name` shopName,
            ts.address shopAddress,
@@ -37,7 +37,8 @@
            ts.latitude,
            tts.subscribe_time,
            tts.service_mode,
            tts.status
            tts.status,
            tts.app_user_id as appUserId
        FROM
            t_technician_subscribe tts
                LEFT JOIN t_technician tt ON tts.technician_id = tt.id AND tt.del_flag = 0