xuhy
2025-01-15 a0a29587681bed434199487a1912940229f71385
Merge remote-tracking branch 'origin/master'

# Conflicts:
# ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
63个文件已修改
1个文件已添加
1188 ■■■■ 已修改文件
doc/a.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/WithdrawalRequests.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteUserService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/SysUserFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/UserShopClientFallbackFactory.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserClient.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/UserShopClient.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/UserShopController.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WithdrawalRequestsServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointDetailVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/ExpressDeliveryUtil.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ConfirmDelivery.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageListVo.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassList.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RegionController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 116 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java 3 ●●●● 补丁 | 查看 | 原始文档 | 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 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/SeckillActivityVO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsBargainPriceMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
doc/a.json
New file
@@ -0,0 +1 @@
{"address":"四川省成都市武侯区锦辉西二街天府新谷9号楼二单元1005A","days":10,"name":"平台退货地址嘎嘎嘎嘎","phone":"19912351325"}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/WithdrawalRequests.java
@@ -74,9 +74,13 @@
    @TableField("audit_status")
    private Integer auditStatus;
    
    @ApiModelProperty(value = "状态(1=处理中,2=成功)")
    @ApiModelProperty(value = "状态(1=处理中,2=成功,3=失败)")
    @TableField("status")
    private Integer status;
    @ApiModelProperty(value = "处理结果")
    @TableField("remark")
    private String remark;
    
    @ApiModelProperty(value = "到账时间")
    @TableField("arrival_time")
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java
@@ -94,4 +94,8 @@
    @ApiModelProperty("收货地址JSON")
    @TableField(exist = false)
    private String addressJson;
    @ApiModelProperty(value = "第三方快递结果")
    @TableField("express_result")
    private String expressResult;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java
@@ -59,10 +59,14 @@
    @TableField("audit_msg")
    private String auditMsg;
    @ApiModelProperty(value = "状态(1=申请中,2=已到账)")
    @ApiModelProperty(value = "状态(1=申请中,2=已到账,3=失败)")
    @TableField("status")
    private Integer status;
    @ApiModelProperty(value = "处理结果")
    @TableField("remark")
    private String remark;
    @ApiModelProperty(value = "到账时间")
    @TableField("arrival_time")
    private LocalDateTime arrivalTime;
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteUserService.java
@@ -26,6 +26,8 @@
     */
    @GetMapping("/user/info/{username}")
    public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
    @GetMapping("/user/infoShop/{username}")
    public R<LoginUser> infoShop(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
    /**
     * 注册用户信息
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserFallbackFactory.java
@@ -30,6 +30,11 @@
            {
                return R.fail("获取用户失败:" + throwable.getMessage());
            }
            @Override
            public R<LoginUser> infoShop(String username, String source)
            {
                return R.fail("门店登录获取用户失败:" + throwable.getMessage());
            }
            @Override
            public R<Boolean> registerUserInfo(SysUser sysUser, String source)
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/SysUserFallbackFactory.java
@@ -88,6 +88,11 @@
            public R delShopUser(Integer objectId, Integer roleType) {
                return R.fail("删除门店管理员账号失败:" + cause.getMessage());
            }
            @Override
            public R delSysUserById(Long userId) {
                return R.fail("根据id删除管理员账户失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/UserShopClientFallbackFactory.java
@@ -24,6 +24,16 @@
            public R saveUserShop(UserShop userShop) {
                return R.fail("保存门店用户关系数据失败:" + cause.getMessage());
            }
            @Override
            public R delUserShop(UserShop userShop) {
                return R.fail("删除后台账号和门店关系数据失败:" + cause.getMessage());
            }
            @Override
            public R delShopAllUserShop(Integer shopId) {
                return R.fail("删除门店所有后台账号和门店关系数据失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserClient.java
@@ -79,7 +79,7 @@
     * @return
     */
    @PostMapping("/user/queryUserByUserNameAndRoleType")
    R<SysUser>  queryUserByUserNameAndRoleType(@RequestParam("roleType") String userName, @RequestParam("roleType") Integer roleType);
    R<SysUser>  queryUserByUserNameAndRoleType(@RequestParam("userName") String userName, @RequestParam("roleType") Integer roleType);
    
    /**
     * 新增加用户信息
@@ -114,6 +114,13 @@
     */
    @PostMapping("/user/user/delShopUser")
    R delShopUser(@RequestParam("objectId") Integer objectId, @RequestParam("roleType") Integer roleType);
    /**
     * 根据id删除管理员账户
     * @param userId
     * @return
     */
    @PostMapping("/user/delSysUserById")
    R delSysUserById(@RequestParam("userId") Long userId);
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/UserShopClient.java
@@ -7,6 +7,7 @@
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;
import java.util.List;
@@ -34,4 +35,20 @@
     */
    @PostMapping("/userShop/saveUserShop")
    R saveUserShop(@RequestBody UserShop userShop);
    /**
     * 删除后台账号和门店关系数据
     * @param userShop
     * @return
     */
    @PostMapping("/userShop/delUserShop")
    R delUserShop(@RequestBody UserShop userShop);
    /**
     * 删除门店所有后台账号和门店关系数据
     * @param shopId
     * @return
     */
    @PostMapping("/userShop/delShopAllUserShop")
    R delShopAllUserShop(@RequestParam("shopId") Integer shopId);
}
ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java
@@ -64,6 +64,27 @@
        userClient.updateSysUser(sysUser);
        return R.ok(map);
    }
    @PostMapping("loginShop")
    public R<?> loginShop(@RequestBody LoginBody form, HttpServletRequest request) {
        // 用户登录
        LoginUser userInfo = sysLoginService.loginShop(form.getUsername(), form.getPassword(), request);
        HashMap<String, Object> map = new HashMap<>();
        map.put("token", tokenService.createToken(userInfo));
        List<SysRole> roles = userInfo.getSysUser().getRoles();
        if(CollectionUtils.isEmpty(roles)){
            return R.fail("请关联角色!");
        }
        map.put("roleName",roles.get(0).getRoleName());
        map.put("info", userInfo);
        // 修改用户最后登录时间
        SysUser sysUser = new SysUser();
        sysUser.setUserId(userInfo.getSysUser().getUserId());
        sysUser.setLoginDate(new Date());
        System.out.println("修改用户登录时间" + sysUser);
        userClient.updateSysUser(sysUser);
        return R.ok(map);
    }
    
    @DeleteMapping("logout")
    public R<?> logout(HttpServletRequest request) {
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java
@@ -97,6 +97,60 @@
        recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "登录成功");
        return userInfo;
    }
    public LoginUser loginShop(String username, String password, HttpServletRequest request) {
        username = username.trim();
        // 查询用户信息
        R<LoginUser> userResult = remoteUserService.infoShop(username, SecurityConstants.INNER);
        if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
            recordLogService.recordLogininfor(request, null, username, Constants.LOGIN_FAIL_STATUS, "登录用户不存在");
            throw new ServiceException("登录用户:" + username + " 不存在");
        }
        LoginUser userInfo = userResult.getData();
        SysUser user = userResult.getData().getSysUser();
        // 用户名或密码为空 错误
        if (StringUtils.isAnyBlank(username, password)) {
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户/密码必须填写");
            throw new ServiceException("用户/密码必须填写");
        }
        // 密码如果不在指定范围内 错误
        if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
                || password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户密码不在指定范围");
            throw new ServiceException("用户密码不在指定范围");
        }
        // 用户名不在指定范围内 错误
        if (username.length() < UserConstants.USERNAME_MIN_LENGTH
                || username.length() > UserConstants.USERNAME_MAX_LENGTH) {
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户名不在指定范围");
            throw new ServiceException("用户名不在指定范围");
        }
        // IP黑名单校验
        String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
        if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "很遗憾,访问IP已被列入系统黑名单");
            throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
        }
        if (R.FAIL == userResult.getCode()) {
            throw new ServiceException(userResult.getMsg());
        }
        if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "对不起,您的账号已被删除");
            throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
        }
        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("您的账号已被禁用,请联系平台");
        }
        passwordService.validate(user, password, request);
        recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "登录成功");
        return userInfo;
    }
    
    public void logout(String loginName, HttpServletRequest request) {
        recordLogService.recordLogininfor(request, null, loginName, Constants.LOGIN_SUCCESS_STATUS, "退出成功");
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java
@@ -138,6 +138,12 @@
            if(null == appUser){
                return error("请先注册小程序账号");
            }
            SysUser one2 = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, user.getPhonenumber())
                    .eq(SysUser::getDelFlag, "0").eq(SysUser::getStatus, "0").eq(SysUser::getObjectId, sysUser1.getObjectId())
                    .eq(SysUser::getRoleType, 2));
            if(null != one2){
                return error("登录账号重复");
            }
            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){
@@ -172,15 +178,18 @@
            }
            //添加门店员工关系数据
            UserShop userShop = new UserShop();
            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);
            UserShop one1 = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, one.getUserId()).eq(UserShop::getShopId, sysUser1.getObjectId()));
            if(null == one1){
                UserShop userShop = new UserShop();
                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"));
@@ -393,6 +402,30 @@
    @GetMapping("/info/{username}")
    public R<LoginUser> info(@PathVariable("username") String username) {
        SysUser sysUser = userService.selectUserByUserName(username);
        if (StringUtils.isNull(sysUser)) {
            return R.fail("用户名或密码错误");
        }
        // 角色集合
        Set<String> roles = permissionService.getRolePermission(sysUser);
        // 权限集合getRolePermission
        Set<String> permissions = permissionService.getMenuPermission(sysUser);
        LoginUser sysUserVo = new LoginUser();
        sysUserVo.setSysUser(sysUser);
        sysUserVo.setRoles(roles);
        sysUserVo.setPermissions(permissions);
        return R.ok(sysUserVo);
    }
    /**
     * 门店登录使用
     * @param username
     * @return
     */
    @InnerAuth
    @GetMapping("/infoShop/{username}")
    public R<LoginUser> infoShop(@PathVariable("username") String username) {
        SysUser sysUser = userService.selectUserShopByUserName(username);
        if (StringUtils.isNull(sysUser)) {
            return R.fail("用户名或密码错误");
        }
@@ -639,7 +672,7 @@
    @PostMapping("/saveShopUser")
    public R<Long> saveShopUser(@RequestBody SysUser user){
        SysUser one = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getPhonenumber, user.getPhonenumber()).eq(SysUser::getDelFlag, "0")
                .eq(SysUser::getStatus, "0").eq(SysUser::getRoleType, 2).eq(SysUser::getAppUserId, user.getAppUserId()));
                .eq(SysUser::getStatus, "0").eq(SysUser::getRoleType, 2));
        if(null == one){
            user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
            userService.save(user);
@@ -661,21 +694,25 @@
     */
    @PostMapping("/user/delShopUser")
    public R delShopUser(@RequestParam("objectId") Integer objectId, @RequestParam("roleType") Integer roleType){
        List<SysUser> list = userService.list(new LambdaUpdateWrapper<SysUser>().eq(SysUser::getObjectId, objectId).eq(SysUser::getRoleType, roleType)
                .eq(SysUser::getDelFlag, "0").eq(SysUser::getStatus, "0"));
        for (SysUser sysUser : list) {
            List<UserShop> list1 = userShopService.list(new LambdaUpdateWrapper<UserShop>().eq(UserShop::getUserId, sysUser.getUserId()));
            List<Integer> collect = list1.stream().map(UserShop::getShopId).collect(Collectors.toList());
            if(collect.contains(objectId) && collect.size() == 1){
                sysUser.setDelFlag("2");
                userService.updateById(sysUser);
        List<UserShop> list2 = userShopService.list(new LambdaQueryWrapper<UserShop>().eq(UserShop::getShopId, objectId));
        for (UserShop userShop : list2) {
            List<UserShop> list1 = userShopService.list(new LambdaUpdateWrapper<UserShop>().eq(UserShop::getUserId, userShop.getUserId()));
            if(list1.size() == 1 && list1.get(0).getShopId().equals(objectId)){
                //删除管理员账号
                userService.deleteUserById(userShop.getUserId());
            }else{
                //修改管理后台账号关联的门店数据
                SysUser sysUser = userService.getById(userShop.getUserId());
                if(sysUser.getObjectId().equals(objectId)){
                    Optional<UserShop> first = list1.stream().filter(s -> !s.getShopId().equals(objectId)).findFirst();
                    if(first.isPresent()){
                        sysUser.setObjectId(first.get().getShopId());
                        userService.updateById(sysUser);
                    }
                }
            }
            if(sysUser.getObjectId().equals(objectId) && collect.size() > 1){
                Integer integer = collect.stream().filter(s -> !s.equals(sysUser.getObjectId())).findFirst().get();
                sysUser.setObjectId(integer);
                userService.updateById(sysUser);
            }
            userShopService.remove(new LambdaUpdateWrapper<UserShop>().eq(UserShop::getUserId, sysUser.getUserId()).eq(UserShop::getShopId, objectId));
            userShopService.removeById(userShop.getId());
        }
        return R.ok();
    }
@@ -708,7 +745,7 @@
     * @return
     */
    @PostMapping("/queryUserByUserNameAndRoleType")
    public R<SysUser>  queryUserByUserNameAndRoleType(@RequestParam("roleType") String userName, @RequestParam("roleType") Integer roleType){
    public R<SysUser>  queryUserByUserNameAndRoleType(@RequestParam("userName") String userName, @RequestParam("roleType") Integer roleType){
        SysUser user = userService.getOne(Wrappers.lambdaQuery(SysUser.class)
                .eq(SysUser::getUserName, userName)
                .eq(SysUser::getDelFlag, "0")
@@ -717,4 +754,11 @@
                .last("LIMIT 1"));
        return R.ok(user);
    }
    @PostMapping("/delSysUserById")
    public R delSysUserById(@RequestParam("userId") Long userId){
        userService.deleteUserById(userId);
        return R.ok();
    }
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/UserShopController.java
@@ -1,13 +1,11 @@
package com.ruoyi.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.model.UserShop;
import com.ruoyi.system.service.UserShopService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@@ -56,4 +54,28 @@
        userShopService.save(userShop);
        return R.ok();
    }
    /**
     * 删除后台账号和门店关系数据
     * @param userShop
     * @return
     */
    @PostMapping("/delUserShop")
    public R delUserShop(@RequestBody UserShop userShop){
        userShopService.remove(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, userShop.getUserId()).eq(UserShop::getShopId, userShop.getShopId()));
        return R.ok();
    }
    /**
     * 删除门店所有关系数据
     * @param shopId
     * @return
     */
    @PostMapping("/delShopAllUserShop")
    public R delShopAllUserShop(@RequestParam("shopId") Integer shopId){
        userShopService.remove(new LambdaQueryWrapper<UserShop>().eq(UserShop::getShopId, shopId));
        return R.ok();
    }
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -23,7 +23,7 @@
     * @param sysUser 用户信息
     * @return 用户信息集合信息
     */
    public List<SysUser> selectUserList(SysUser sysUser);
    List<SysUser> selectUserList(SysUser sysUser);
    /**
     * 根据条件分页查询已配用户角色列表
@@ -31,7 +31,7 @@
     * @param user 用户信息
     * @return 用户信息集合信息
     */
    public List<SysUser> selectAllocatedList(SysUser user);
    List<SysUser> selectAllocatedList(SysUser user);
    /**
     * 根据条件分页查询未分配用户角色列表
@@ -39,7 +39,7 @@
     * @param user 用户信息
     * @return 用户信息集合信息
     */
    public List<SysUser> selectUnallocatedList(SysUser user);
    List<SysUser> selectUnallocatedList(SysUser user);
    /**
     * 通过用户名查询用户
@@ -47,7 +47,8 @@
     * @param userName 用户名
     * @return 用户对象信息
     */
    public SysUser selectUserByUserName(String userName);
    SysUser selectUserByUserName(String userName);
    SysUser selectUserShopByUserName(String userName);
    /**
     * 通过用户ID查询用户
@@ -55,7 +56,7 @@
     * @param userId 用户ID
     * @return 用户对象信息
     */
    public SysUser selectUserById(Long userId);
    SysUser selectUserById(Long userId);
    /**
     * 新增用户信息
@@ -63,7 +64,7 @@
     * @param user 用户信息
     * @return 结果
     */
    public int insertUser(SysUser user);
    int insertUser(SysUser user);
    /**
     * 修改用户信息
@@ -71,7 +72,7 @@
     * @param user 用户信息
     * @return 结果
     */
    public int updateUser(SysUser user);
    int updateUser(SysUser user);
    /**
     * 修改用户头像
@@ -80,7 +81,7 @@
     * @param avatar 头像地址
     * @return 结果
     */
    public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
    int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
    /**
     * 重置用户密码
@@ -89,7 +90,7 @@
     * @param password 密码
     * @return 结果
     */
    public int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
    int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
    /**
     * 通过用户ID删除用户
@@ -97,7 +98,7 @@
     * @param userId 用户ID
     * @return 结果
     */
    public int deleteUserById(Long userId);
    int deleteUserById(Long userId);
    /**
     * 批量删除用户信息
@@ -105,7 +106,7 @@
     * @param userIds 需要删除的用户ID
     * @return 结果
     */
    public int deleteUserByIds(Long[] userIds);
    int deleteUserByIds(Long[] userIds);
    /**
     * 校验用户名称是否唯一
@@ -113,7 +114,7 @@
     * @param userName 用户名称
     * @return 结果
     */
    public SysUser checkUserNameUnique(String userName);
    SysUser checkUserNameUnique(String userName);
    /**
     * 校验手机号码是否唯一
@@ -121,7 +122,7 @@
     * @param phonenumber 手机号码
     * @return 结果
     */
    public SysUser checkPhoneUnique(String phonenumber);
    SysUser checkPhoneUnique(String phonenumber);
    
    
@@ -131,7 +132,7 @@
     * @param email 用户邮箱
     * @return 结果
     */
    public SysUser checkEmailUnique(String email);
    SysUser checkEmailUnique(String email);
    List<SysUser> getList(@Param("pageInfo") PageInfo<SysUser> pageInfo, @Param("req") GetSysUserList getSysUserList);
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
@@ -22,7 +22,7 @@
     * @param user 用户信息
     * @return 用户信息集合信息
     */
    public List<SysUser> selectUserList(SysUser user);
    List<SysUser> selectUserList(SysUser user);
    /**
     * 根据条件分页查询已分配用户角色列表
@@ -30,7 +30,7 @@
     * @param user 用户信息
     * @return 用户信息集合信息
     */
    public List<SysUser> selectAllocatedList(SysUser user);
    List<SysUser> selectAllocatedList(SysUser user);
    /**
     * 根据条件分页查询未分配用户角色列表
@@ -38,7 +38,7 @@
     * @param user 用户信息
     * @return 用户信息集合信息
     */
    public List<SysUser> selectUnallocatedList(SysUser user);
    List<SysUser> selectUnallocatedList(SysUser user);
    /**
     * 通过用户名查询用户
@@ -46,7 +46,8 @@
     * @param userName 用户名
     * @return 用户对象信息
     */
    public SysUser selectUserByUserName(String userName);
    SysUser selectUserByUserName(String userName);
    SysUser selectUserShopByUserName(String userName);
    /**
     * 通过用户ID查询用户
@@ -54,7 +55,7 @@
     * @param userId 用户ID
     * @return 用户对象信息
     */
    public SysUser selectUserById(Long userId);
    SysUser selectUserById(Long userId);
    /**
     * 根据用户ID查询用户所属角色组
@@ -62,7 +63,7 @@
     * @param userName 用户名
     * @return 结果
     */
    public String selectUserRoleGroup(String userName);
    String selectUserRoleGroup(String userName);
    /**
     * 根据用户ID查询用户所属岗位组
@@ -70,7 +71,7 @@
     * @param userName 用户名
     * @return 结果
     */
    public String selectUserPostGroup(String userName);
    String selectUserPostGroup(String userName);
    /**
     * 校验用户名称是否唯一
@@ -78,7 +79,7 @@
     * @param user 用户信息
     * @return 结果
     */
    public boolean checkUserNameUnique(SysUser user);
    boolean checkUserNameUnique(SysUser user);
    /**
     * 校验手机号码是否唯一
@@ -86,7 +87,7 @@
     * @param user 用户信息
     * @return 结果
     */
    public boolean checkPhoneUnique(SysUser user);
    boolean checkPhoneUnique(SysUser user);
    /**
     * 校验email是否唯一
@@ -94,21 +95,21 @@
     * @param user 用户信息
     * @return 结果
     */
    public boolean checkEmailUnique(SysUser user);
    boolean checkEmailUnique(SysUser user);
    /**
     * 校验用户是否允许操作
     * 
     * @param user 用户信息
     */
    public void checkUserAllowed(SysUser user);
    void checkUserAllowed(SysUser user);
    /**
     * 校验用户是否有数据权限
     * 
     * @param userId 用户id
     */
    public void checkUserDataScope(Long userId);
    void checkUserDataScope(Long userId);
    /**
     * 新增用户信息
@@ -116,7 +117,7 @@
     * @param user 用户信息
     * @return 结果
     */
    public int insertUser(SysUser user);
    int insertUser(SysUser user);
    /**
     * 注册用户信息
@@ -124,7 +125,7 @@
     * @param user 用户信息
     * @return 结果
     */
    public boolean registerUser(SysUser user);
    boolean registerUser(SysUser user);
    /**
     * 修改用户信息
@@ -132,7 +133,7 @@
     * @param user 用户信息
     * @return 结果
     */
    public int updateUser(SysUser user);
    int updateUser(SysUser user);
    /**
     * 用户授权角色
@@ -140,7 +141,7 @@
     * @param userId 用户ID
     * @param roleIds 角色组
     */
    public void insertUserAuth(Long userId, Long[] roleIds);
    void insertUserAuth(Long userId, Long[] roleIds);
    /**
     * 修改用户状态
@@ -148,7 +149,7 @@
     * @param user 用户信息
     * @return 结果
     */
    public int updateUserStatus(SysUser user);
    int updateUserStatus(SysUser user);
    /**
     * 修改用户基本信息
@@ -156,7 +157,7 @@
     * @param user 用户信息
     * @return 结果
     */
    public int updateUserProfile(SysUser user);
    int updateUserProfile(SysUser user);
    /**
     * 修改用户头像
@@ -165,7 +166,7 @@
     * @param avatar 头像地址
     * @return 结果
     */
    public boolean updateUserAvatar(String userName, String avatar);
    boolean updateUserAvatar(String userName, String avatar);
    /**
     * 重置用户密码
@@ -173,7 +174,7 @@
     * @param user 用户信息
     * @return 结果
     */
    public int resetPwd(SysUser user);
    int resetPwd(SysUser user);
    /**
     * 重置用户密码
@@ -182,7 +183,7 @@
     * @param password 密码
     * @return 结果
     */
    public int resetUserPwd(String userName, String password);
    int resetUserPwd(String userName, String password);
    /**
     * 通过用户ID删除用户
@@ -190,7 +191,7 @@
     * @param userId 用户ID
     * @return 结果
     */
    public int deleteUserById(Long userId);
    int deleteUserById(Long userId);
    /**
     * 批量删除用户信息
@@ -198,7 +199,7 @@
     * @param userIds 需要删除的用户ID
     * @return 结果
     */
    public int deleteUserByIds(Long[] userIds);
    int deleteUserByIds(Long[] userIds);
    /**
     * 导入用户数据
@@ -208,7 +209,7 @@
     * @param operName 操作用户
     * @return 结果
     */
    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
    String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
    PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, GetSysUserList getSysUserList);
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -137,6 +137,10 @@
    public SysUser selectUserByUserName(String userName) {
        return userMapper.selectUserByUserName(userName);
    }
    @Override
    public SysUser selectUserShopByUserName(String userName) {
        return userMapper.selectUserShopByUserName(userName);
    }
    
    /**
     * 通过用户ID查询用户
@@ -296,15 +300,6 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateUser(SysUser user) {
//        Long userId = user.getUserId();
//        // 删除用户与角色关联
//        userRoleMapper.deleteUserRoleByUserId(userId);
//        // 新增用户与角色管理
//        insertUserRole(user);
//        // 删除用户与岗位关联
//        userPostMapper.deleteUserPostByUserId(userId);
//        // 新增用户与岗位管理
//        insertUserPost(user);
        return userMapper.updateUser(user);
    }
    
@@ -450,19 +445,12 @@
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteUserByIds(Long[] userIds) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = this.getById(userid);
        for (Long userId : userIds) {
            checkUserAllowed(new SysUser(userId));
//            checkUserDataScope(userId);
        }
        // 删除用户与角色关联
//        userRoleMapper.deleteUserRole(userIds);
//        // 删除用户与岗位关联
//        userPostMapper.deleteUserPost(userIds);
//        int i = userMapper.deleteUserByIds(userIds);
        List<SysUser> sysUsers = this.listByIds(Arrays.asList(userIds));
        for (SysUser user : sysUsers) {
            if(2 == user.getRoleType()){
@@ -481,12 +469,10 @@
                }
                long count = userShopService.count(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()));
                if(0 == count){
                    user.setDelFlag("2");
                    this.updateById(user);
                    userMapper.deleteUserById(user.getUserId());
                }
            }else{
                user.setDelFlag("2");
                this.updateById(user);
                userMapper.deleteUserById(user.getUserId());
            }
        }
        return 0;
ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml
@@ -105,6 +105,12 @@
    <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
        <include refid="selectUserVo"/>
        where u.user_name = #{userName} and u.del_flag = '0'
        and u.role_type = 1
    </select>
    <select id="selectUserShopByUserName" parameterType="String" resultMap="SysUserResult">
        <include refid="selectUserVo"/>
        where u.user_name = #{userName} and u.del_flag = '0'
        and u.role_type = 2
    </select>
    
    <select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -23,6 +23,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.bean.BeanUtils;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.redis.annotation.DistributedLock;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.feignClient.OrderClient;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
@@ -237,6 +238,14 @@
        userCancellationLogService.save(userCancellationLog);
        user.setStatus(3);
        appUserService.updateById(user);
        List<AppUser> subUserList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                .eq(AppUser::getInviteUserId, userId));
        for (AppUser appUser : subUserList) {
            Long inviteUserId = user.getInviteUserId();
            appUser.setInviteUserId(inviteUserId);
        }
        appUserService.updateBatchById(subUserList);
        return R.ok();
    }
@@ -463,8 +472,10 @@
        //获取在该本店下单的用户ids
        Integer objectId = sysUser.getObjectId();
        R<List<Order>> listR = remoteOrderGoodsClient.byShopId(objectId);
        for (Order datum : listR.getData()) {
            userIds.add(datum.getAppUserId());
        if (listR.getData()!=null){
            for (Order datum : listR.getData()) {
                userIds.add(datum.getAppUserId());
            }
        }
        IPage<AppUser> appuserPage = appUserService.getAppuserPage1(pageCurr, pageSize, appUser, objectId, userIds);
        return R.ok(appuserPage);
@@ -701,14 +712,11 @@
        SysUser data = sysUserClient.getSysUser(userid).getData();
        Integer shopId = null;
        Set<Long> userId = null;
        Set<Long> userIdT = null;
        if(data.getRoleType() == 2){
            shopId = data.getObjectId();
            userId = orderClient.getAppUserByShoppingShop(shopId).getData();
        }
        UserStatistics userStatistics = appUserMapper.getUserStatistics(shopId, userId);
        UserStatistics userStatistics1 = appUserMapper.getUserStatistics(shopId, userIdT);
        userStatistics.setShopUser(userStatistics1.getShopUser());
        return R.ok(userStatistics);
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
@@ -98,7 +98,9 @@
                    List<Goods> data1 = goodsClient.getAllGoods().getData();
                    List<String> collect = data1.stream().map(Goods::getName).collect(Collectors.toList());
                    goodNames.addAll(collect);
                }else{
                }else if(StringUtils.isEmpty(data.getForGoodIds())){
                    goodNames.addAll(JSON.parseArray(data.getGoodsNameJson(), String.class));
                }else {
                    String[] split = vo.getForGoodIds().split(",");
                    R<List<Goods>> goodsById = goodsClient.getGoodsById(split);
                    if (goodsById.getData()!=null){
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
@@ -135,7 +135,7 @@
    @ApiOperation(value = "积分管理-用户积分明细(必传用户id)", tags = "后台")
    public R<Page<UserPoint>> userlist(UserPoint userPoint) {
        Page<UserPoint> page = userPointService.lambdaQuery()
                .eq(UserPoint::getType, userPoint.getType())
                .eq(userPoint.getType()!=null,UserPoint::getType, userPoint.getType())
                .eq(UserPoint::getAppUserId, userPoint.getAppUserId())
                .orderByDesc(UserPoint::getCreateTime)
                .page(Page.of(userPoint.getPageNum(), userPoint.getPageSize()));
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java
@@ -111,7 +111,11 @@
        R<BigDecimal> bigDecimalR = systemConfigClient.redPackegeSet();
        userSignRecord.setRedAmount(bigDecimalR.getData());
        userSignRecord.setSignDay(LocalDate.now());
        BigDecimal sum = appUser.getTotalRedPacketAmount().add(bigDecimalR.getData());
        appUser.setTotalRedPacketAmount(sum);
        BigDecimal sum2 = appUser.getBalance().add(bigDecimalR.getData());
        appUser.setBalance(sum2);
        appUserService.updateById(appUser);
        SignBackRDto signBackRDto = new SignBackRDto();
        signBackRDto.setPoint(userSignRecord.getPoint());
        signBackRDto.setRedAmount(userSignRecord.getRedAmount());
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java
@@ -158,9 +158,9 @@
    @PostMapping("/withdrawalCallback")
    public Object withdrawalCallback(@RequestBody SinglePayCallbackResult singlePayCallbackResult){
        Integer status = singlePayCallbackResult.getStatus();
        String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo();
        WithdrawalRequests withdrawalRequests = withdrawalRequestsService.getById(merchantOrderNo);
        if(203 == status || 205 == status){
            String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo();
            WithdrawalRequests withdrawalRequests = withdrawalRequestsService.getById(merchantOrderNo);
            if(1 == withdrawalRequests.getStatus()){
                withdrawalRequests.setStatus(2);
                withdrawalRequests.setArrivalTime(LocalDateTime.now());
@@ -169,8 +169,39 @@
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("statusCode", 2001);
            return jsonObject;
        }else{
            //回退扣除的金额,添加明细记录
            //修改用户的可提现金额
            BigDecimal withdrawalAmount = withdrawalRequests.getWithdrawalAmount();
            AppUser appUser = appUserService.getById(withdrawalRequests.getAppUserId());
            BigDecimal withdrawableAmount = appUser.getWithdrawableAmount();
            BigDecimal withdrawnAmount = appUser.getWithdrawnAmount();
            BigDecimal balance = appUser.getBalance();
            appUser.setWithdrawableAmount(withdrawableAmount.add(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN));
            appUser.setWithdrawnAmount(withdrawnAmount.subtract(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN));
            appUser.setBalance(appUser.getBalance().add(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN));
            appUserService.updateById(appUser);
            //添加变动明细
            BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
            balanceChangeRecord.setAppUserId(appUser.getId());
            balanceChangeRecord.setVipId(appUser.getVipId());
            balanceChangeRecord.setOrderId(withdrawalRequests.getId());
            balanceChangeRecord.setChangeType(2);
            balanceChangeRecord.setBeforeAmount(balance);
            balanceChangeRecord.setChangeAmount(withdrawalAmount);
            balanceChangeRecord.setAfterAmount(appUser.getBalance());
            balanceChangeRecord.setDelFlag(0);
            balanceChangeRecord.setCreateTime(LocalDateTime.now());
            balanceChangeRecordService.save(balanceChangeRecord);
            withdrawalRequests.setStatus(3);
            withdrawalRequests.setRemark(singlePayCallbackResult.getErrorCodeDesc());
            withdrawalRequestsService.updateById(withdrawalRequests);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("statusCode", 2001);
            return jsonObject;
        }
        return new JSONObject();
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -22,6 +22,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.redis.annotation.DistributedLock;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.*;
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -97,6 +97,11 @@
                userPointDetailVO.setVariablePoint(p.getVariablePoint());
                String format = p.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
                userPointDetailVO.setCreateTime(format);
                Integer historicalPoint = p.getHistoricalPoint();
                Integer balance = p.getBalance();
                if (historicalPoint != null && balance != null) {
                    userPointDetailVO.setFlag(historicalPoint > balance ? 2 : 1);
                }
                return userPointDetailVO;
            }).collect(Collectors.toList());
            PageInfo<UserPointDetailVO> pageInfo1 = new PageInfo<>(pageCurr, pageSize);
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java
@@ -42,18 +42,16 @@
        // 获取提现审核中的金额
        List<WithdrawalRequests> waitAuditList = withdrawalRequestsService.list(new LambdaQueryWrapper<WithdrawalRequests>()
                .eq(WithdrawalRequests::getAppUserId, userId)
                .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT));
                .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT.getCode()));
        BigDecimal reduce = waitAuditList.stream().map(WithdrawalRequests::getWithdrawalAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
        WalletVO walletVO = new WalletVO();
        walletVO.setWithdrawalAmount(appUser.getWithdrawableAmount());
        walletVO.setWithdrawnAmount(appUser.getWithdrawnAmount());
        walletVO.setWithdrawnAmount(appUser.getWithdrawnAmount().subtract(reduce));
        walletVO.setVipWithdrawalMinAmount(data.getVipWithdrawalMinAmount());
        walletVO.setTotalRechargeAmount(appUser.getTotalRechargeAmount());
        walletVO.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount());
        walletVO.setTotalDistributionAmount(appUser.getTotalDistributionAmount());
        walletVO.setAuditAmount(waitAuditList.stream()
                .map(WithdrawalRequests::getWithdrawalAmount)
                .reduce(BigDecimal.ZERO, BigDecimal::add));
        walletVO.setAuditAmount(reduce);
        walletVO.setBalance(appUser.getBalance());
        return walletVO;
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WithdrawalRequestsServiceImpl.java
@@ -78,8 +78,7 @@
                .divide(VIP_WITHDRAWAL_FEE_DENOMINATOR, 2, RoundingMode.HALF_UP);
        // 减去手续费
        BigDecimal multiply = params.getWithdrawalAmount().multiply(vipWithdrawalFee);
        params.setWithdrawalAmount(params.getWithdrawalAmount()
                .subtract(multiply));
        params.setWithdrawalAmount(params.getWithdrawalAmount().subtract(multiply));
        WithdrawalRequests withdrawalRequests = new WithdrawalRequests();
        BeanUtils.copyBeanProp(withdrawalRequests, params);
@@ -92,7 +91,7 @@
            withdrawalRequests.setBankCardNumber(appUserBank.getBankNumber());
        }
        withdrawalRequests.setWithdrawalAmount(withdrawalAmount);
        withdrawalRequests.setArrivalAmount(withdrawalRequests.getWithdrawalAmount());
        withdrawalRequests.setArrivalAmount(params.getWithdrawalAmount());
        withdrawalRequests.setServiceCharge(multiply);
        withdrawalRequests.setDelFlag(0);
        withdrawalRequests.setAppUserId(SecurityUtils.getUserId());
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointDetailVO.java
@@ -21,4 +21,6 @@
    @ApiModelProperty(value = "变动时间")
    private String createTime;
    @ApiModelProperty(value = "增或减标识: 1-增 2-减")
    private Integer flag;
}
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml
@@ -130,10 +130,13 @@
        t_app_user tau
        <where>
            <if test="null != shopId">
                tau.shop_id = #{shopId} or tau.id in
                <foreach collection="userId" item="item" index="index" open="(" separator="," close=")">
                    #{item}
                </foreach>
                tau.shop_id = #{shopId}
                <if test="null != userId">
                    or tau.id in
                    <foreach collection="userId" item="item" index="index" open="(" separator="," close=")">
                        #{item}
                    </foreach>
                </if>
            </if>
        and  tau.del_flag = 0
        and tau.`status` !=3
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -131,9 +131,9 @@
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "String"),
    })
    @GetMapping("/writeOff/{id}/{shopId}")
    public R<Void> writeOff(@PathVariable("id") String id, @PathVariable("shopId") Integer shopId){
        orderService.writeOff(id, shopId);
    @GetMapping("/writeOff")
    public R<Void> writeOff(String code, Integer shopId, String technicianId){
        orderService.writeOff(code, shopId, technicianId);
        return R.ok();
    }
@@ -250,7 +250,7 @@
    @PostMapping("/confirmDelivery")
    @ApiOperation(value = "已发货操作", tags = {"管理后台-订单管理"})
    public R confirmDelivery(@RequestBody ConfirmDelivery confirmDelivery){
        return orderService.confirmDelivery(confirmDelivery.getOrderId(), confirmDelivery.getCode());
        return orderService.confirmDelivery(confirmDelivery);
    }
    
    
@@ -301,8 +301,12 @@
                .orderByAsc(Order::getCreateTime));
        Map<String, List<Order>> map = orderList.stream().collect(Collectors.groupingBy(item -> item.getCreateTime()
                .format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
        Map<String, List<Order>> map = orderList.stream()
                .collect(Collectors.groupingBy(
                        item -> item.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),
                        TreeMap::new, // 使用 TreeMap 按键排序
                        Collectors.toList()
                ));
        List<OrderStatisticsDetail> orderStatisticsDetails = new ArrayList<>();
        map.forEach((key, value) -> {
@@ -317,12 +321,14 @@
                if (order.getOrderType().equals(1)) {
                    serviceTotal++;
                    serviceTotalMoney = serviceTotalMoney.add(order.getPaymentAmount());
                }else if (order.getOrderType().equals(2)){
                    total++;
                    totalMoney = totalMoney.add(order.getPaymentAmount());
                }else if (order.getOrderType().equals(2) && 1 == order.getDistributionMode()){
                    singleTotal++;
                    singleTotalMoney = singleTotalMoney.add(order.getPaymentAmount());
                    total++;
                    totalMoney = totalMoney.add(order.getPaymentAmount());
                }
                total++;
                totalMoney = totalMoney.add(order.getPaymentAmount());
            }
            orderStatisticsDetail.setDate(key);
            orderStatisticsDetail.setServiceTotal(serviceTotal);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
@@ -1,8 +1,12 @@
package com.ruoyi.order.controller;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.model.UserAddress;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.core.web.page.TableDataInfo;
@@ -11,13 +15,20 @@
import com.ruoyi.order.model.RefundPass;
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.service.RefundPassService;
import com.ruoyi.order.util.ExpressDeliveryUtil;
import com.ruoyi.order.util.vo.MapTrackKD100Vo;
import com.ruoyi.order.vo.*;
import com.ruoyi.other.api.domain.SystemConfig;
import com.ruoyi.other.api.feignClient.SystemConfigClient;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -44,6 +55,12 @@
    @Resource
    private OrderService orderService;
    
    @Resource
    private RedisTemplate redisTemplate;
    @Resource
    private SystemConfigClient systemConfigClient;
    
    @ResponseBody
    @PostMapping("/applyRefundPass")
@@ -66,6 +83,9 @@
        }
        RefundPass one = refundPassService.getOne(new LambdaQueryWrapper<RefundPass>().eq(RefundPass::getOrderId, orderId)
                .eq(RefundPass::getDelFlag, 0).last(" order by create_time desc limit 0,1"));
        if(null == one){
            return R.fail("无效的售后数据");
        }
        one.setIdStr(one.getId().toString());
        one.setAddressJson(order.getAddressJson());
        return R.ok(one);
@@ -121,6 +141,20 @@
        }
        refundPass.setStatus(5);
        refundPass.setCode(pass.getCode());
        //添加查询快递信息队列
        //一小时后定时查询快递信息
        SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData();
        JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
        Integer waitTime = jsonObject.getInteger("waitTime");
        redisTemplate.opsForZSet().add("order_refund_express", refundPass.getId(), LocalDateTime.now().plusHours(waitTime).toEpochSecond(ZoneOffset.UTC));
        JSONObject jsonObject1 = JSON.parseObject(pass.getCode());
        String com = jsonObject1.getString("com");
        String num = jsonObject1.getString("num");
        UserAddress userAddress = JSON.parseObject(order.getAddressJson(), UserAddress.class);
        MapTrackKD100Vo mapTrackKD100Vo = ExpressDeliveryUtil.kd100MapTrack(com, num, userAddress.getProvince() + userAddress.getCity(), order.getDeliverProvince() + order.getDeliverCity());
        refundPass.setExpressResult(JSON.toJSONString(mapTrackKD100Vo));
        refundPassService.updateById(refundPass);
        return R.ok();
    }
@@ -168,5 +202,23 @@
    }
    
    
    /**
     * 获取订单快递明细
     * @param id
     * @return
     */
    @GetMapping("/getOrderExpress/{id}")
    @ApiOperation(value = "获取售后订单快递明细", tags = {"小程序-订单管理"})
    public R<MapTrackKD100Vo> getOrderExpress(@PathVariable("id") Long id){
        RefundPass refundPass = refundPassService.getById(id);
        String expressResult = refundPass.getExpressResult();
        if(StringUtils.isNotEmpty(expressResult)){
            MapTrackKD100Vo mapTrackKD100Vo = JSON.parseObject(expressResult, MapTrackKD100Vo.class);
            return R.ok(mapTrackKD100Vo);
        }
        return R.ok();
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
@@ -26,7 +26,7 @@
    boolean check(Order order, Integer shopId, Long userId);
    void writeOff(String id,Integer shopId);
    void writeOff(String id,Integer shopId, String technicianId);
    
    
    /**
@@ -45,11 +45,9 @@
    
    /**
     * 确认发货操作
     * @param orderId
     * @param code
     * @return
     */
    R confirmDelivery(Long orderId, String code);
    R confirmDelivery(ConfirmDelivery confirmDelivery);
    
    
    /**
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java
@@ -62,4 +62,10 @@
     * @return
     */
    RefundPassInfo getRefundPassInfo(Long id);
    /**
     * 定时查询快递信息
     */
    void taskExpress();
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -177,14 +177,6 @@
        }
        OrderDetailVO orderDetailVO = new OrderDetailVO();
        orderDetailVO.setDistributionMode(order.getDistributionMode());
        Technician technician = new Technician();
        if (order.getTechnicianId() != null){
            R<Technician> shopdetail = technicianClient.shopdetail(order.getTechnicianId());
            if (shopdetail.getCode() != R.SUCCESS){
                throw new ServiceException("获取技师信息失败");
            }
            technician = shopdetail.getData();
        }
        Shop shop = shopR.getData();
        orderDetailVO.setId(order.getId());
        orderDetailVO.setOrderStatus(order.getOrderStatus());
@@ -209,18 +201,19 @@
        orderDetailVO.setLongitude(shop.getLongitude());
        orderDetailVO.setLatitude(shop.getLatitude());
        orderDetailVO.setShopId(shop.getId());
        orderDetailVO.setTechnicianName(technician.getName());
        orderDetailVO.setTechnicianId(technician.getId());
        if(order.getOrderType() == 1){
            List<TechnicianSubscribe> data = technicianSubscribeClient.getTechnicianSubscribeList(order.getId()).getData();
            if(data.size() > 0){
                Long id = data.get(0).getId();
                orderDetailVO.setTechnicianSubscribeId(id.toString());
                Technician technician = technicianClient.shopdetail(order.getTechnicianId()).getData();
                orderDetailVO.setTechnicianName(technician.getName());
                orderDetailVO.setTechnicianId(technician.getId());
            }
        }
        // 生成核销码BASE64
        try {
            String base64 = QRCodeGenerator.generateQRCodeBase64(order.getOrderNumber(), 124, 124);
            String base64 = QRCodeGenerator.generateQRCodeBase64(String.valueOf(order.getId()), 124, 124);
            orderDetailVO.setWriteOffCode(base64);
        } catch (Exception e) {
            e.printStackTrace();
@@ -258,12 +251,12 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void writeOff(String id,Integer shopId) {
    public void writeOff(String id, Integer shopId, String technicianId) {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        Order order = orderMapper.selectById(id);
        boolean check = check(order, shopId, loginUserApplet.getUserid());
        if (!check){
            throw new ServiceException("订单不存在");
            throw new ServiceException("该订单与当前扫码门店不一致");
        }
        // 售后设置
@@ -283,6 +276,9 @@
        order.setAfterSaleTime(LocalDateTime.now().plusDays(days));
        order.setEndTime(LocalDateTime.now());
        order.setCancellerAppUserId(loginUserApplet.getUserid());
        if(StringUtils.isNotEmpty(technicianId) && !"null".equals(technicianId)){
            order.setTechnicianId(Integer.valueOf(technicianId));
        }
        orderMapper.updateById(order);
    }
    
@@ -334,8 +330,14 @@
                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"));
//            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"));
            RefundPass one = refundPassService.lambdaQuery().eq(RefundPass::getOrderId, orderPageListVo.getId()).one();
            orderPageListVo.setRefundPassId(null != one ? one.getId().toString() : null);
            // 平台分佣
            List<ShopBalanceStatement> data = shopBalanceStatementClient.getShopBalanceStatementList(Arrays.asList(1, 2, 3), Long.valueOf(orderPageListVo.getId())).getData();
            BigDecimal reduce = data.stream().map(ShopBalanceStatement::getVariableAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
            orderPageListVo.setGetCommission(reduce);
        }
        return pageInfo.setRecords(list);
    }
@@ -372,13 +374,11 @@
    /**
     * 确认发货操作
     * @param orderId
     * @param code
     * @return
     */
    @Override
    public R confirmDelivery(Long orderId, String code) {
        Order order = this.getById(orderId);
    public R confirmDelivery(ConfirmDelivery confirmDelivery) {
        Order order = this.getById(confirmDelivery.getOrderId());
        if(1 == order.getPayStatus()){
            return R.fail("订单还未完成支付");
        }
@@ -389,8 +389,28 @@
            return R.fail("无效的操作");
        }
        //添加快递号和修改订单状态
        order.setExpressJson(code);
        order.setExpressJson(confirmDelivery.getCode());
        order.setDeliverProvince(confirmDelivery.getDeliverProvince());
        order.setDeliverProvinceCode(confirmDelivery.getDeliverProvinceCode());
        order.setDeliverCity(confirmDelivery.getDeliverCity());
        order.setDeliverCityCode(confirmDelivery.getDeliverCityCode());
        order.setDeliverDistrict(confirmDelivery.getDeliverDistrict());
        order.setDeliverDistrictCode(confirmDelivery.getDeliverDistrictCode());
        order.setOrderStatus(2);
        //添加查询快递信息队列
        //一小时后定时查询快递信息
        SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData();
        JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
        Integer waitTime = jsonObject.getInteger("waitTime");
        redisTemplate.opsForZSet().add("order_express", order.getId(), LocalDateTime.now().plusHours(waitTime).toEpochSecond(ZoneOffset.UTC));
        JSONObject jsonObject1 = JSON.parseObject(confirmDelivery.getCode());
        String com = jsonObject1.getString("com");
        String num = jsonObject1.getString("num");
        UserAddress userAddress = JSON.parseObject(order.getAddressJson(), UserAddress.class);
        MapTrackKD100Vo mapTrackKD100Vo = ExpressDeliveryUtil.kd100MapTrack(com, num, order.getDeliverProvince() + order.getDeliverCity(),
                userAddress.getProvince() + userAddress.getCity());
        order.setExpressResult(JSON.toJSONString(mapTrackKD100Vo));
        this.updateById(order);
        return R.ok();
    }
@@ -578,6 +598,7 @@
            userPoint.setAppUserId(order.getAppUserId());
            userPoint.setObjectId(order.getId());
            userPointClient.saveUserPoint(userPoint);
            appUserClient.editAppUserById(appUser);
        }
        order.setRefundStatus(2);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
@@ -7,6 +7,7 @@
import com.kuaidi100.sdk.contant.CompanyConstant;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.UserAddress;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils;
@@ -17,13 +18,18 @@
import com.ruoyi.order.model.RefundPass;
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.service.RefundPassService;
import com.ruoyi.order.util.ExpressDeliveryUtil;
import com.ruoyi.order.util.vo.MapTrackKD100Vo;
import com.ruoyi.order.vo.*;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.api.domain.SystemConfig;
import com.ruoyi.other.api.feignClient.BaseSettingClient;
import com.ruoyi.other.api.feignClient.ShopClient;
import com.ruoyi.other.api.feignClient.SystemConfigClient;
import com.ruoyi.other.api.feignClient.TechnicianClient;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -32,6 +38,7 @@
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -57,6 +64,12 @@
    
    @Resource
    private SysUserClient sysUserClient;
    @Resource
    private RedisTemplate redisTemplate;
    @Resource
    private SystemConfigClient systemConfigClient;
    
    
    
@@ -97,6 +110,7 @@
        refundPass.setPhone(jsonObject.getString("phone"));
        refundPass.setAddress(jsonObject.getString("address"));
        this.save(refundPass);
        order.setOldOrderStatus(order.getOrderStatus());
        order.setOrderStatus(7);
        orderService.updateById(order);
        return R.ok();
@@ -243,4 +257,41 @@
        }
        return refundPassInfo;
    }
    /**
     * 定时查询快递信息
     */
    @Override
    public void taskExpress() {
        Set<Long> order_express = redisTemplate.opsForZSet().rangeByScore("order_refund_express", 0, LocalDateTime.now().toEpochSecond(ZoneOffset.UTC));
        if(order_express.size() > 0){
            for (Long id : order_express) {
                RefundPass refundPass = this.getById(id);
                Order order = orderService.getById(refundPass.getOrderId());
                if(refundPass.getPassStatus() != 5){
                    redisTemplate.opsForZSet().remove("order_refund_express", id);
                    continue;
                }
                String expressJson = refundPass.getCode();
                if(StringUtils.isEmpty(expressJson)){
                    redisTemplate.opsForZSet().remove("order_refund_express", id);
                    continue;
                }
                //{"com":"jd","num":"JDV016336234367"}
                JSONObject jsonObject1 = JSON.parseObject(refundPass.getCode());
                String com = jsonObject1.getString("com");
                String num = jsonObject1.getString("num");
                UserAddress userAddress = JSON.parseObject(order.getAddressJson(), UserAddress.class);
                MapTrackKD100Vo mapTrackKD100Vo = ExpressDeliveryUtil.kd100MapTrack(com, num, userAddress.getProvince() + userAddress.getCity(), order.getDeliverProvince() + order.getDeliverCity());
                refundPass.setExpressResult(JSON.toJSONString(mapTrackKD100Vo));
                this.updateById(refundPass);
                //延长时间x小时
                SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData();
                JSONObject jsonObject2 = JSON.parseObject(systemConfig.getContent());
                Integer waitTime = jsonObject2.getInteger("waitTime");
                redisTemplate.opsForZSet().add("order_refund_express", refundPass.getId(), LocalDateTime.now().plusHours(waitTime).toEpochSecond(ZoneOffset.UTC));
            }
        }
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -418,12 +418,14 @@
            BigDecimal bigDecimal = BigDecimal.ZERO;
            for (MyShoppingCartVo myShoppingCartVo : goodsList) {
                bigDecimal = bigDecimal.add(myShoppingCartVo.getCash().multiply(new BigDecimal(myShoppingCartVo.getNumber())));
                myShoppingCartVo.setEarnSpendingPoints(myShoppingCartVo.getEarnSpendingPoints() * myShoppingCartVo.getNumber());
            }
            confirmOrderVo.setOrderMoney(bigDecimal);
        }else{
            int sum = 0;
            for (MyShoppingCartVo myShoppingCartVo : goodsList) {
                sum += (myShoppingCartVo.getPoint() * myShoppingCartVo.getNumber());
                myShoppingCartVo.setEarnSpendingPoints(myShoppingCartVo.getEarnSpendingPoints() * myShoppingCartVo.getNumber());
            }
            confirmOrderVo.setOrderPoint(sum);
        }
@@ -1148,11 +1150,7 @@
                        userCouponClient.editUserCoupon(userCoupon);
                    }
                }
                //添加查询快递信息队列
                if(StringUtils.isNotEmpty(order.getExpressJson())){
                    //一小时后定时查询快递信息
                    redisTemplate.opsForZSet().add("order_express", order.getId(), LocalDateTime.now().plusHours(1).toEpochSecond(ZoneOffset.UTC));
                }
                //删除购物车数据
                userid = tokenService.getLoginUserApplet().getUserid();
@@ -1265,11 +1263,7 @@
                    userCouponClient.editUserCoupon(userCoupon);
                }
            }
            //添加查询快递信息队列
            if(StringUtils.isNotEmpty(order.getExpressJson())){
                //一小时后定时查询快递信息
                redisTemplate.opsForZSet().add("order_express", order.getId(), LocalDateTime.now().plusHours(1).toEpochSecond(ZoneOffset.UTC));
            }
        }
        //积分支付
        if(3 == shoppingCartPayment.getPaymentType()){
@@ -1392,14 +1386,7 @@
                //删除购物车数据
                this.removeBatchByIds(ids);
            }
            //添加查询快递信息队列
            if(StringUtils.isNotEmpty(order.getExpressJson())){
                //一小时后定时查询快递信息
                SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData();
                JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
                Integer waitTime = jsonObject.getInteger("waitTime");
                redisTemplate.opsForZSet().add("order_express", order.getId(), LocalDateTime.now().plusHours(waitTime).toEpochSecond(ZoneOffset.UTC));
            }
        }
        //添加账户余额支付明细
@@ -1491,11 +1478,6 @@
                userCoupon.setUseTime(LocalDateTime.now());
                userCouponClient.editUserCoupon(userCoupon);
            }
        }
        //添加查询快递信息队列
        if(StringUtils.isNotEmpty(order.getExpressJson())){
            //一小时后定时查询快递信息
            redisTemplate.opsForZSet().add("order_express", order.getId(), LocalDateTime.now().plusHours(1).toEpochSecond(ZoneOffset.UTC));
        }
        //删除购物车数据
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/ExpressDeliveryUtil.java
@@ -75,7 +75,8 @@
    public static MapTrackKD100Vo kd100MapTrack(String com, String num, String from, String to){
        QueryTrackReq queryTrackReq = new QueryTrackReq();
        QueryTrackParam queryTrackParam = new QueryTrackParam();
        queryTrackParam.setCom(CompanyConstant.YD);
//        queryTrackParam.setCom(CompanyConstant.YD);
        queryTrackParam.setCom(com);
        queryTrackParam.setNum(num);
        queryTrackParam.setFrom(from);
        queryTrackParam.setTo(to);
@@ -99,4 +100,9 @@
        return mapTrackKD100Vo;
    }
    
    public static void main(String[] args) {
        ExpressDeliveryUtil.kd100MapTrack("zhongtong", "75617413683310", "湖南省长沙市", "四川省成都市");
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ConfirmDelivery.java
@@ -1,5 +1,6 @@
package com.ruoyi.order.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -15,4 +16,22 @@
    private Long orderId;
    @ApiModelProperty("快递json信息{\"com\":\"shunfeng\",\"num\":\"123456\"}")
    private String code;
    @ApiModelProperty(value = "发货省")
    private String deliverProvince;
    @ApiModelProperty(value = "发货省编号")
    private String deliverProvinceCode;
    @ApiModelProperty(value = "发货市")
    private String deliverCity;
    @ApiModelProperty(value = "发货市编号")
    private String deliverCityCode;
    @ApiModelProperty(value = "发货区")
    private String deliverDistrict;
    @ApiModelProperty(value = "发货区编号")
    private String deliverDistrictCode;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageListVo.java
@@ -37,10 +37,18 @@
    private Integer status;
    @ApiModelProperty("配送方式(1=自提,2=快递)")
    private Integer distributionMode;
    @ApiModelProperty("获得分佣")
    private BigDecimal getCommission;
    /**
     * 用户id
     */
    private Long appUserId;
    @ApiModelProperty("售后订单id")
    private String refundPassId;
    private Integer shopId;
    public BigDecimal getGetPoint(){
        return point;
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassList.java
@@ -1,8 +1,11 @@
package com.ruoyi.order.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
 * @author zhibing.pu
@@ -20,7 +23,8 @@
    @ApiModelProperty("联系电话")
    private String phone;
    @ApiModelProperty("申请时间")
    private String createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    @ApiModelProperty("售后类型(1退货退款2仅退款)")
    private Integer refundMethod;
    @ApiModelProperty("申请原因")
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java
@@ -22,4 +22,24 @@
    private Integer refundMethod;
    @ApiModelProperty("售后状态(1待审核2已完成3已拒绝4待退货5待平台收货)")
    private Integer status;
    private String orderNumber;
    private String userName;
    private Integer passStatus;
    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
        this.setCode(orderNumber);
    }
    public void setUserName(String userName) {
        this.userName = userName;
        this.setName(userName);
    }
    public void setPassStatus(Integer passStatus) {
        this.passStatus = passStatus;
        this.setStatus(passStatus);
    }
}
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -61,6 +61,7 @@
            total_amount as orderMoney,
            point,
            order_status as status,
            shop_id,
            distribution_mode as distributionMode
        from t_order where del_flag = 0 and pay_status = 2
        <if test="null != item.code and '' != item.code">
@@ -85,13 +86,13 @@
            and order_status in (4, 8)
        </if>
        <if test="null != item.shopId">
            and shop_id = #{item.shopId} and address_json is null
            and shop_id = #{item.shopId} and distribution_mode != 2
        </if>
        order by create_time desc
    </select>
    <select id="getOrderStatistics" resultType="com.ruoyi.order.vo.OrderStatistics">
        SELECT
            count(*) as total,
            SUM( CASE WHEN tor.order_type = 2 and distribution_mode = 2 THEN 0 ELSE 1 END ) as total,
            SUM( CASE WHEN tor.order_type = 1 THEN 1 ELSE 0 END ) as serviceTotal,
            SUM( CASE WHEN tor.order_type = 2 and distribution_mode = 1 THEN 1 ELSE 0 END ) as singleTotal,
            SUM( tor.total_amount ) as totalMoney,
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml
@@ -8,7 +8,7 @@
            a.id,
            b.order_number as orderNumber,
            b.app_user_id as appUserId,
            DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%m:%s') as createTime,
            a.create_time as createTime,
            a.refund_method as refundMethod,
            a.refund_reason as refundReason,
            a.pass_status as passStatus,
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -179,11 +179,14 @@
     */
    @GetMapping("/goodsDetail/{goodsId}")
    @ApiOperation(value = "商品详情", tags = {"小程序-商城-首页"})
    public R<GoodsVO> goodsDetail(@PathVariable("goodsId") Long goodsId, String longitude, String latitude){
        return R.ok(goodsService.goodsDetail(goodsId, longitude, latitude));
    public R<GoodsVO> goodsDetail(@PathVariable("goodsId") Long goodsId,
                                  Integer shopId,
                                  String longitude,
                                  String latitude) {
        return R.ok(goodsService.goodsDetail(goodsId, shopId, longitude, latitude));
    }
    /**
     * 根据类型(1=服务商品,2=单品商品)获取商品数据
     * @param type
@@ -195,8 +198,8 @@
        List<Goods> list = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getType, type).eq(Goods::getDelFlag, 0).eq(Goods::getStatus, 2));
        return R.ok(list);
    }
    /**
     * 根据id获取商品信息
     * @param id
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RegionController.java
@@ -41,9 +41,9 @@
        List<Region> list = regionService.list();
        List<Region> collect = list.stream().filter(s -> s.getParentId() == 0).collect(Collectors.toList());
        for (Region region : collect) {
            List<Region> collect1 = list.stream().filter(s -> s.getParentId() == region.getId()).collect(Collectors.toList());
            List<Region> collect1 = list.stream().filter(s -> s.getParentId().equals(region.getId())).collect(Collectors.toList());
            for (Region region1 : collect1) {
                List<Region> collect2 = list.stream().filter(s -> s.getParentId() == region1.getId()).collect(Collectors.toList());
                List<Region> collect2 = list.stream().filter(s -> s.getParentId().equals(region1.getId())).collect(Collectors.toList());
                region1.setChilds(collect2);
            }
            region.setChilds(collect1);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -73,7 +73,10 @@
    @GetMapping("/list")
    public R<List<Share>> list(@RequestParam Integer objectId) {
        List<Share> list = shareService.list(new LambdaQueryWrapper<Share>()
                .eq(Share::getObjectId, objectId).eq(Share::getDelFlag, 0).or().eq(Share::getAddType, 1).eq(Share::getDelFlag, 0));
                .eq(Share::getObjectId, objectId)
                .eq(Share::getDelFlag, 0).or()
                .eq(Share::getAddType, 1)
                .eq(Share::getDelFlag, 0));
        return R.ok(list);
    }
@@ -146,11 +149,15 @@
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        share.setAddType(sysUser.getRoleType() == 1 ? 1 : 3);
        share.setAppletShare(0);
        share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode());
        if(sysUser.getRoleType() == 2){
            share.setObjectId(sysUser.getObjectId().longValue());
        }
        share.setAuditStatus(0);
//        if (sysUser.getRoleType() == 1){
//            share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode());
//        }else{
//            share.setAuditStatus(ShareAuditStatus.WAIT.getCode());
//        }
        share.setAuditStatus(ShareAuditStatus.WAIT.getCode());
        share.setDelFlag(0);
        shareService.save(share);
        return R.ok();
@@ -159,7 +166,7 @@
    @ApiOperation(value = "广告管理-分享管理-编辑", tags = {"管理后台"})
    @PostMapping("/manage/edit")
    public R<Void> manageedit(@RequestBody Share share) {
        if (share.getAuditStatus()==2){
        if (null == share.getAuditStatus() || share.getAuditStatus()==2){
            share.setAuditStatus(0);
        }
        shareService.updateById(share);
@@ -175,16 +182,27 @@
    @ApiOperation(value = "广告管理-分享管理-列表", tags = {"管理后台"})
    @GetMapping("/manage/list")
    public R<Page<Share>> managelist(String name, Integer addType, @RequestParam Integer pageNum, Integer pageSize) {
    public R<Page<Share>> managelist(String name,
                                     Integer addType,
                                     Integer auditStatus,
                                     @RequestParam Integer pageNum, Integer pageSize) {
        //判断当前登陆人是平台还是门店
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        if (sysUser.getRoleType()==1) {
            Page<Share> page = shareService.lambdaQuery().eq(Share::getAuditStatus, 1).eq(Share::getDelFlag, 0).like(name != null, Share::getName, name)
                    .eq(addType != null , Share::getAddType, addType).page(Page.of(pageNum, pageSize));
            Page<Share> page = shareService.lambdaQuery()
                    .eq(Share::getAuditStatus, 1)
                    .eq(Share::getDelFlag, 0)
                    .like(name != null, Share::getName, name)
                    .eq(addType != null , Share::getAddType, addType)
                    .page(Page.of(pageNum, pageSize));
            return R.ok(page);
        }else {
            Page<Share> page = shareService.lambdaQuery().eq(Share::getAddType,3).eq(Share::getDelFlag, 0).eq(Share::getObjectId, sysUser.getObjectId())
            Page<Share> page = shareService.lambdaQuery()
                    .eq(auditStatus!= null, Share::getAuditStatus, auditStatus)
                    .eq(Share::getAddType,3)
                    .eq(Share::getDelFlag, 0)
                    .eq(Share::getObjectId, sysUser.getObjectId())
                    .like(name != null, Share::getName, name).page(Page.of(pageNum, pageSize));
            return R.ok(page);
        }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -45,6 +45,8 @@
import java.util.*;
import java.util.stream.Collectors;
import static javax.swing.UIManager.get;
/**
 * <p>
 * 前端控制器
@@ -114,6 +116,9 @@
        shop.setCustomOrderNumber(0);
        shop.setAppUserId(appUser.getId());
        String city = TencentMapUtil.inverseGeographicalAnalysis(shop.getLongitude(), shop.getLatitude(), false);
        if(!StringUtils.hasLength(city)){
            city = "510100";
        }
        shop.setProvinceCode(city.substring(0, 2) + "0000");
        shop.setCityCode(city.substring(0, 4) + "00");
        shop.setDistrictCode(city);
@@ -176,10 +181,17 @@
            userShop.setUserId(userId);
            userShop.setShopId(shopId);
            userShop.setRoleType(1);
            userShop.setRoleId(2L);
            userShop.setNickName(user.getNickName());
            userShop.setCreateTime(LocalDateTime.now());
            userShopClient.saveUserShop(userShop);
            List<UserShop> data = userShopClient.getUserShop(userShop).getData();
            if(null == data || data.size() == 0){
                userShop = new UserShop();
                userShop.setUserId(userId);
                userShop.setShopId(shopId);
                userShop.setRoleType(1);
                userShop.setRoleId(2L);
                userShop.setNickName(user.getNickName());
                userShop.setCreateTime(LocalDateTime.now());
                userShopClient.saveUserShop(userShop);
            }
        }
        // 更换下级会员绑定门店
@@ -211,24 +223,27 @@
        }
        Shop shop = shopService.getById(id);
        shop.setDelFlag(1);
        shopService.updateById(shop);
        // 查询有没有门店绑定这个被删除的门店
        List<Shop> shops = shopService.lambdaQuery().eq(Shop::getPid, shop.getId()).list();
        for (Shop shop1 : shops) {
            shop1.setPid(0);
            LambdaUpdateWrapper<Shop> set = new LambdaUpdateWrapper<Shop>().set(Shop::getPid, null)
                    .eq(Shop::getId,shop1.getId());
            shopService.update(set);
        }
        shopService.updateBatchById(shops);
        //清除用户绑定当前门店
        appUserClient.clearBindShop(shop.getId());
        //查询门店绑定的平台账号
        UserShop userShop = new UserShop();
        userShop.setShopId(shop.getId());
        List<UserShop> data = userShopClient.getUserShop(userShop).getData();
        if(data.size() > 0){
            //删除门店后台账号和关系数据
            sysUserClient.delShopUser(shop.getId(), 2);
            //修改小程序用户类型和门店数据
            List<Integer> collect = data.stream().map(UserShop::getUserId).collect(Collectors.toList()).stream().map(Long::intValue).collect(Collectors.toList());
            List<SysUser> sysUserList = sysUserClient.getUserList(collect).getData();
            //删除门店下的所有员工
            sysUserClient.delShopUser(shop.getId(), 2);
            //修改小程序用户类型和门店数据
            for (SysUser sysUser : sysUserList) {
                //通过电话号码查询小程序用户和门店关系数据
                AppUser appUser = appUserClient.getAppUserByPhone1(sysUser.getUserName()).getData();
@@ -238,10 +253,10 @@
                    appUser.setUserType(1);
                    appUserClient.editAppUserById(appUser);
                }
                //删除用户门店关系表数据
                //删除用户门店关系数据
                AppUserShop appUserShop = new AppUserShop();
                appUserShop.setAppUserId(appUser.getId());
                appUserShop.setShopId(shop.getId());
                appUserShop.setAppUserId(sysUser.getUserId());
                appUserShopClient.delAppUserShop(appUserShop);
            }
        }
@@ -252,6 +267,14 @@
                technician.setDelFlag(1);
            }
            technicianService.updateBatchById(list);
            //删除技师和门店关系数据
            //删除用户门店关系数据
            AppUserShop appUserShop = new AppUserShop();
            appUserShop.setShopId(shop.getId());
            appUserShop.setRoleType(3);
            appUserShopClient.delAppUserShop(appUserShop);
            //取消门店预约技师数据
            Set<Integer> collect = list.stream().map(Technician::getId).collect(Collectors.toSet());
            technicianSubscribeService.update(new LambdaUpdateWrapper<TechnicianSubscribe>().in(TechnicianSubscribe::getTechnicianId, collect).eq(TechnicianSubscribe::getDelFlag, 0)
                    .eq(TechnicianSubscribe::getStatus, 0).set(TechnicianSubscribe::getStatus, 2));
@@ -266,7 +289,7 @@
        if (!shopService.cheUserByPhone(phone)) {
            return R.fail("该手机号未注册");
        }
        if (shop.getPid()!=null){
        if (shop.getPid() != null && shop.getPid() != 0){
            Shop shopP = shopService.getById(shop.getPid());
            if (shopP.getPid()!=null&&shopP.getPid()!=0&& shopP.getPid().equals(shop.getId())){
                return R.fail("门店之间不能互相作为上级门店");
@@ -285,15 +308,33 @@
        AppUser appUser = appUserClient.getAppUserById(old_shop.getAppUserId());
        //需要先判断用户是否没有关联任何门店
        List<AppUserShop> userShops = appUserShopClient.getAppUserShop(appUser.getId()).getData();
        //当前小程序账号如果关联的店铺是最后一个,则将其修改为普通用户
        if(userShops.size() == 1 && userShops.get(0).getShopId().equals(shop.getId())){
            appUser.setUserType(1);
            appUserClient.editAppUserById(appUser);
        }
        //删除原店长关系数据
        AppUserShop appUserShop = new AppUserShop();
        appUserShop.setAppUserId(appUser.getId());
        appUserShop.setShopId(shop.getId());
        appUserShop.setRoleType(1);
        appUserShopClient.delAppUserShop(appUserShop);
        //删除后台用户和店铺关系数据
        UserShop userShop = new UserShop();
        userShop.setShopId(shop.getId());
        userShop.setRoleType(1);
        List<UserShop> data = userShopClient.getUserShop(userShop).getData();
        if(null != data && data.size() > 0){
            UserShop userShop1 = data.get(0);
            userShopClient.delUserShop(userShop1);
            //如果当前后台账户关联的店铺是最后一个,删除后台账户
            userShop = new UserShop();
            userShop.setUserId(userShop1.getUserId());
            data = userShopClient.getUserShop(userShop).getData();
            if(data.size() == 0){
                sysUserClient.delSysUserById(userShop1.getUserId());
            }
        }
        //添加新管理员
        appUser = appUserClient.getAppUserByPhone1(phone).getData();
@@ -305,25 +346,25 @@
        appUser.setUserType(2);
        appUserClient.editAppUserById(appUser);
        
        //修改管理员
        shop.setAppUserId(appUser.getId());
        shopService.updateById(shop);
        //添加门店后台账号和门店关系数据
        SysUser sysUser = sysUserClient.queryUserByUserName(phone).getData();
        if(null != sysUser){
            UserShop userShop = new UserShop();
            userShop.setUserId(sysUser.getUserId());
            userShop = new UserShop();
            userShop.setShopId(shop.getId());
            userShop.setRoleType(1);
            List<UserShop> data = userShopClient.getUserShop(userShop).getData();
            userShop.setUserId(sysUser.getUserId());
            data = userShopClient.getUserShop(userShop).getData();
            if(null == data || data.size() == 0){
                userShop = new UserShop();
                userShop.setUserId(sysUser.getUserId());
                userShop.setShopId(shop.getId());
                userShop.setRoleType(1);
                userShop.setRoleId(2L);
                userShop.setNickName(sysUser.getNickName());
                userShop.setCreateTime(LocalDateTime.now());
                userShopClient.saveUserShop(userShop);
            }
        }else{
@@ -342,13 +383,21 @@
            user.setPassword(phone.substring(5));
            user.setCreateTime(new Date());
            Long userId = sysUserClient.saveShopUser(user).getData();
            UserShop userShop = new UserShop();
            userShop.setUserId(userId);
            userShop = new UserShop();
            userShop.setShopId(shop.getId());
            userShop.setRoleType(1);
            userShop.setRoleId(2L);
            userShopClient.saveUserShop(userShop);
            userShop.setUserId(userId);
            data = userShopClient.getUserShop(userShop).getData();
            if(null == data || data.size() == 0){
                userShop = new UserShop();
                userShop.setUserId(userId);
                userShop.setShopId(shop.getId());
                userShop.setRoleType(1);
                userShop.setRoleId(2L);
                userShop.setNickName(appUser.getName());
                userShop.setCreateTime(LocalDateTime.now());
                userShopClient.saveUserShop(userShop);
            }
        }
        return R.ok();
    }
@@ -363,6 +412,21 @@
        }
        shop.setStatus(status);
        shopService.updateById(shop);
        //处理员工等数据
        UserShop userSh = new UserShop();
        userSh.setShopId(id);
        List<UserShop> data = userShopClient.getUserShop(userSh).getData();
        for (UserShop datum : data) {
            UserShop userShop = new UserShop();
            userShop.setUserId(datum.getUserId());
            List<UserShop> data1 = userShopClient.getUserShop(userShop).getData();
            long count = data1.stream().filter(s -> !s.getShopId().equals(id)).count();
            if(0 == count){
                SysUser sysUser = sysUserClient.getSysUser(datum.getUserId()).getData();
                sysUser.setStatus(status == 1 ? "0" : "1");
                sysUserClient.updateUser(sysUser);
            }
        }
        return R.ok();
    }
@@ -679,7 +743,7 @@
    
    @PostMapping("/saveWithdrawalAccount")
    @ApiOperation(value = "保存提现账户", tags = {"门店后台-财务统计-提现明细"})
    public R saveWithdrawalAccount(SaveWithdrawalAccount saveWithdrawalAccount) {
    public R saveWithdrawalAccount(@RequestBody SaveWithdrawalAccount saveWithdrawalAccount) {
        shopService.saveWithdrawalAccount(saveWithdrawalAccount);
        return R.ok();
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
@@ -70,9 +70,13 @@
    @Resource
    private SysUserClient sysUserClient;
    @GetMapping("/getShopById")
    @ApiOperation("通过门店id获取账户信息回填")
    public R<Shop> getShopById(Integer id) {
        return R.ok(shopService.getById(id));
    }
    /**
     * 提现申请列表
@@ -90,7 +94,8 @@
            return R.ok(Page.of(pageNum, pageSize));
        }
        Page<ShopWithdraw> page = shopWithdrawService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<ShopWithdraw>()
                .in(collect1.size() > 0, ShopWithdraw::getShopId, collect1));
                .in(collect1.size() > 0, ShopWithdraw::getShopId, collect1)
        .orderByDesc(ShopWithdraw::getCreateTime));
        List<ShopWithdraw> records = page.getRecords();
        List<Integer> collect = records.stream().map(ShopWithdraw::getShopId).collect(Collectors.toList());
        List<Shop> shops = null;
@@ -112,9 +117,10 @@
    public R<IPage<ShopWithdraw>> shoplist(@ApiParam("页码") @RequestParam Integer pageNum,
                                       @ApiParam("每一页数据大小") Integer pageSize,
                                       ShopWithdraw shopWithdraw) {
        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
        LoginUser loginUser = tokenService.getLoginUser();
        SysUser sysUser = sysUserClient.getSysUser(loginUser.getUserid()).getData();
        Page<ShopWithdraw> page = shopWithdrawService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<ShopWithdraw>()
                        .eq(ShopWithdraw::getShopId,objectId)
                        .eq(sysUser!=null,ShopWithdraw::getShopId,sysUser.getObjectId())
                        .eq(shopWithdraw.getAuditStatus()!=null,ShopWithdraw::getAuditStatus,shopWithdraw.getAuditStatus())
                        .orderByDesc(ShopWithdraw::getCreateTime)
                );
@@ -125,9 +131,10 @@
    @GetMapping("/shop/info")
    @ApiOperation(value = "提现申请列表上方数据", notes = "提现申请列表", tags = {"门店后台"})
    public R<Shop> shopCommissionStatisticsinfo(){
        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
        Shop byId = shopService.getById(objectId);
        List<ShopWithdraw> list = shopWithdrawService.lambdaQuery().eq(ShopWithdraw::getShopId, objectId)
        LoginUser loginUser = tokenService.getLoginUser();
        SysUser sysUser = sysUserClient.getSysUser(loginUser.getUserid()).getData();
        Shop byId = shopService.getById(sysUser.getObjectId());
        List<ShopWithdraw> list = shopWithdrawService.lambdaQuery().eq(ShopWithdraw::getShopId, sysUser.getObjectId())
                .eq(ShopWithdraw::getAuditStatus, 0).list();
        if (!list.isEmpty()){
            BigDecimal bigDecimal = list.stream().map(ShopWithdraw::getMoney).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
@@ -135,6 +142,7 @@
        }else {
            byId.setWithdrawAuditMoney(BigDecimal.ZERO);
        }
        byId.setWithdrawMoney(byId.getWithdrawMoney().subtract(byId.getWithdrawAuditMoney()));
        return R.ok(byId);
    }
    
@@ -191,6 +199,7 @@
    @ApiOperation("审核")
    public R<Void> audit(@RequestBody ShopWithdraw shopWithdraw) {
        LoginUser loginUser = tokenService.getLoginUser();
        ShopWithdraw shopWithdraw1 = shopWithdrawService.getById(shopWithdraw.getId());
        if(0 != shopWithdraw1.getAuditStatus()){
            return R.fail("不能重复审核");
@@ -263,9 +272,9 @@
    @PostMapping("/withdrawalCallback")
    public Object withdrawalCallback(@RequestBody SinglePayCallbackResult singlePayCallbackResult){
        Integer status = singlePayCallbackResult.getStatus();
        String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo();
        ShopWithdraw shopWithdraw = shopWithdrawService.getById(merchantOrderNo);
        if(203 == status || 205 == status){
            String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo();
            ShopWithdraw shopWithdraw = shopWithdrawService.getById(merchantOrderNo);
            if(1 == shopWithdraw.getStatus()){
                shopWithdraw.setStatus(2);
                shopWithdraw.setArrivalTime(LocalDateTime.now());
@@ -274,8 +283,35 @@
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("statusCode", 2001);
            return jsonObject;
        }else{
            //回退金额和添加变动明细
            Shop shop = shopService.getById(shopWithdraw.getShopId());
            BigDecimal balance = shop.getBalance();
            BigDecimal canWithdrawMoney = shop.getCanWithdrawMoney();
            BigDecimal withdrawMoney = shop.getWithdrawMoney();
            shop.setBalance(balance.add(shopWithdraw.getMoney()).setScale(2, RoundingMode.HALF_EVEN));
            shop.setCanWithdrawMoney(canWithdrawMoney.add(shopWithdraw.getMoney()).setScale(2, RoundingMode.HALF_EVEN));
            shop.setWithdrawMoney(withdrawMoney.subtract(shopWithdraw.getMoney()).setScale(2, RoundingMode.HALF_EVEN));
            shopService.updateById(shop);
            //添加门店变动明细
            ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
            shopBalanceStatement.setShopId(shop.getId());
            shopBalanceStatement.setType(4);
            shopBalanceStatement.setHistoricalBalance(balance);
            shopBalanceStatement.setVariableAmount(shopWithdraw.getMoney());
            shopBalanceStatement.setBalance(shop.getBalance());
            shopBalanceStatement.setCreateUserId(shopWithdraw.getAuditUserId());
            shopBalanceStatement.setCreateTime(LocalDateTime.now());
            shopBalanceStatement.setObjectId(shopWithdraw.getId());
            shopBalanceStatementService.save(shopBalanceStatement);
            shopWithdraw.setStatus(3);
            shopWithdraw.setRemark(singlePayCallbackResult.getErrorCodeDesc());
            shopWithdrawService.updateById(shopWithdraw);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("statusCode", 2001);
            return jsonObject;
        }
        return new JSONObject();
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -61,9 +61,10 @@
     */
    @GetMapping("/technicianListByShopId")
    @ApiOperation(value = "技师列表", tags = {"技师列表-小程序"})
    public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId,@ApiParam("技师姓名") String name) {
    public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId,@ApiParam("技师姓名") String name,@ApiParam("评分") Integer point) {
        //@ApiParam("评分") Integer point 1倒序 2正序
        startPage();
        List<TechnicianVO> technicianListByShopId = technicianService.getTechnicianListByShopId(shopId, name);
        List<TechnicianVO> technicianListByShopId = technicianService.getTechnicianListByShopId(shopId, name,point);
        TableDataInfo<TechnicianVO> dataTable = getDataTable(technicianListByShopId);
        return R.ok(dataTable);
    }
@@ -85,11 +86,8 @@
    @PostMapping("/manage/addorupdate")
    @ApiOperation(value = "添加编辑", tags = {"门店-技师列表"})
    public R<Page<Technician>> add(@RequestBody Technician technician) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        if (technician.getId()==null) {
            technician.setSubscribeStatus(2);
            List<Technician> list = technicianService.lambdaQuery()
@@ -144,7 +142,21 @@
    @GetMapping("/manage/delete")
    @ApiOperation(value = "删除", tags = {"门店-技师列表"})
    public R<Page<Technician>> delete(@RequestParam Integer id) {
        technicianService.removeById(id);
        Technician technician = technicianService.getById(id);
        technician.setDelFlag(1);
        technicianService.updateById(technician);
        //检查删除app_user_shop数据
        AppUserShop appUserShop = new AppUserShop();
        appUserShop.setAppUserId(technician.getAppUserId());
        appUserShop.setShopId(technician.getShopId());
        appUserShop.setRoleType(3);
        appUserShopClient.delAppUserShop(appUserShop);
        List<AppUserShop> userShopList = appUserShopClient.getAppUserShop(technician.getAppUserId()).getData();
        if(userShopList.size() == 0){
            AppUser appUser = appUserClient.getAppUserById(technician.getAppUserId());
            appUser.setUserType(1);
            appUserClient.editAppUserById(appUser);
        }
        return R.ok();
    }
    
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
@@ -52,11 +52,11 @@
    @ApiOperation(value = "预约列表", tags = {"门店-预约列表"})
    public R<PageInfo<TechnicianSubscribeVO>> shoplist(@ApiParam(value = "状态") Integer status,
                                @ApiParam("电话")String phone,
                                @ApiParam("姓名")String name,
                                @ApiParam("姓名")String userName,
                                @ApiParam("服务方式:1=上门服务,2=到店服务")Integer serviceMode, Integer pageCurr, Integer pageSize) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        PageInfo<TechnicianSubscribeVO> pageInfo = technicianSubscribeService.getTechnicianSubscribeByUserAndShop1(Long.valueOf(sysUser.getObjectId()), status, phone, name, serviceMode, pageCurr, pageSize);
        PageInfo<TechnicianSubscribeVO> pageInfo = technicianSubscribeService.getTechnicianSubscribeByUserAndShop1(Long.valueOf(sysUser.getObjectId()), status, phone, userName, serviceMode, pageCurr, pageSize);
        return R.ok(pageInfo);
    }
@@ -82,15 +82,7 @@
    }
    /**
     * 预约技师
     */
    @PostMapping("/switchingTechnician")
    @ApiOperation(value = "切换技师", notes = "切换技师", tags = {"小程序-个人中心-门店管理-预约列表"})
    public R<Void> switchingTechnician(@RequestBody TechnicianSubscribe technicianSubscribe) {
        technicianSubscribeService.switchingTechnician(technicianSubscribe);
        return R.ok();
    }
    /**
@@ -149,7 +141,7 @@
    @PostMapping("/getTechnicianSubscribeList")
    public R<List<TechnicianSubscribe>> getTechnicianSubscribeList(@RequestParam("orderId") Long orderId){
        List<TechnicianSubscribe> list = technicianSubscribeService.list(new LambdaQueryWrapper<TechnicianSubscribe>().eq(TechnicianSubscribe::getOrderId, orderId)
                .eq(TechnicianSubscribe::getDelFlag, 0).in(TechnicianSubscribe::getStatus, Arrays.asList(0, 1)));
                .eq(TechnicianSubscribe::getDelFlag, 0).in(TechnicianSubscribe::getStatus, Arrays.asList(0, 1)).orderByDesc(TechnicianSubscribe::getCreateTime));
        return R.ok(list);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java
@@ -18,7 +18,7 @@
 */
public interface TechnicianMapper extends BaseMapper<Technician> {
    List<TechnicianVO> selectTechnicianListByShopId(@Param("shopId") Long shopId,@Param("name") String name);
    List<TechnicianVO> selectTechnicianListByShopId(@Param("shopId") Long shopId,@Param("name") String name,@Param("point")Integer point);
    TechnicianDetailVO selectTechnicianDetail(Long technicianId);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java
@@ -21,7 +21,7 @@
    PageInfo<GoodsVO> goodsList(Goods goods);
    GoodsVO goodsDetail(Long goodsId, String longitude, String latitude);
    GoodsVO goodsDetail(Long goodsId, Integer shopId, String longitude, String latitude);
    List<Goods> getGoodsListByShopId(PageInfo<Goods> pageInfo, Integer shopId);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java
@@ -4,6 +4,7 @@
import com.ruoyi.other.api.domain.Technician;
import com.ruoyi.other.vo.TechnicianDetailVO;
import com.ruoyi.other.vo.TechnicianVO;
import io.swagger.models.auth.In;
import java.util.List;
@@ -16,7 +17,7 @@
 * @since 2024-11-20
 */
public interface TechnicianService extends IService<Technician> {
    List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name);
    List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name, Integer point);
    TechnicianDetailVO technicianDetail(Long technicianId);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java
@@ -33,11 +33,7 @@
    void subscribe(TechnicianSubscribe technicianSubscribe);
    /**
     * 切換技師
     * @param technicianSubscribe
     */
    void switchingTechnician(TechnicianSubscribe technicianSubscribe);
    /**
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -165,25 +165,37 @@
                });
            }
        }
        //手动处理分页
        // 手动处理分页
        PageInfo<GoodsVO> pageInfo = new PageInfo<>();
        pageInfo.setSize(search.getPageSize());
        pageInfo.setTotal(list.size());
        Integer pageSize = search.getPageSize();
        Integer pageNum = (search.getPageCurr() - 1) * pageSize;
        if(list.size() >= (pageNum + 1) * pageSize){
            list = list.subList(pageNum, pageNum + pageSize);
        }else if(pageNum < list.size() && list.size() < (pageNum + 1) * pageSize){
            list = list.subList(pageNum, list.size());
        }else{
            list = new ArrayList<>();
        int pageSize = search.getPageSize();
        int pageCurr = search.getPageCurr();
        // 计算起始索引
        int pageNum = (pageCurr - 1) * pageSize;
        // 检查 pageNum 是否合法
        if (pageNum < 0 || pageNum >= list.size()) {
            // 如果 pageNum 不合法,返回空列表
            pageInfo.setRecords(new ArrayList<>());
            return pageInfo;
        }
        return pageInfo.setRecords(list);
        // 计算结束索引
        int endIndex = Math.min(pageNum + pageSize, list.size());
        // 获取分页数据
        List<GoodsVO> pageList = list.subList(pageNum, endIndex);
        // 设置分页结果
        pageInfo.setRecords(pageList);
        return pageInfo;
    }
    @Override
    public GoodsVO goodsDetail(Long goodsId, String longitude, String latitude) {
    public GoodsVO goodsDetail(Long goodsId, Integer shopId, String longitude, String latitude) {
        if (goodsId == null || goodsId <= 0) {
            throw new NullPointerException("商品ID不能为空");
        }
@@ -216,7 +228,7 @@
        BeanUtils.copyBeanProp(goodsVO, goods);
        goodsVO.setGoodsId(goods.getId());
        goodsVO.setGoodsName(goods.getName());
        Price price = getPrice(vipId, goods.getId(), null, 1, provinceCode, cityCode, districtCode);
        Price price = getPrice(vipId, goods.getId(), shopId, 1, provinceCode, cityCode, districtCode);
        if(null != price){
            goodsVO.setPointPayment(price.getPointPayment() ? 1 : 0);
            goodsVO.setCashPayment(price.getCashPayment() ? 1 : 0);
@@ -394,9 +406,10 @@
                    area.setProvinceCode(goodsArea.getProvinceCode());
                    area.setCityCode(goodsArea.getCityCode());
                    area.setDistrictsCode(goodsArea.getDistrictsCode());
                    if(null != area.getSellingPrice() || null != area.getIntegral()){
                        goodsAreaList2.add(area);
                    }
//                    if(null != area.getSellingPrice() || null != area.getIntegral()){
//                        goodsAreaList2.add(area);
//                    }
                    goodsAreaList2.add(area);
                }
                goodsAreaService.saveBatch(goodsAreaList2);
            }
@@ -572,15 +585,15 @@
            if(null == bargainPriceDetail){
                //没有门店特价,判断地区价格配置
                LambdaQueryWrapper<GoodsArea> queryWrapper = new LambdaQueryWrapper<GoodsArea>().eq(GoodsArea::getGoodsId, goodsId).eq(GoodsArea::getVip, vip);
                if(StringUtils.isNotEmpty(districtCode)){
                    queryWrapper.eq(GoodsArea::getDistrictsCode, districtCode);
                }
                if(StringUtils.isNotEmpty(cityCode)){
                    queryWrapper.eq(GoodsArea::getCityCode, cityCode);
                }
                if(StringUtils.isNotEmpty(provinceCode)){
                    queryWrapper.eq(GoodsArea::getProvinceCode, provinceCode);
                }
                if(StringUtils.isNotEmpty(cityCode)){
                    queryWrapper.and(i -> i.eq(GoodsArea::getCityCode, cityCode).or().isNull(GoodsArea::getCityCode));
                }
                if(StringUtils.isNotEmpty(districtCode)){
                    queryWrapper.and(i -> i.eq(GoodsArea::getDistrictsCode, districtCode).or().isNull(GoodsArea::getDistrictsCode));
                }
                GoodsArea goodsArea = goodsAreaService.getOne(queryWrapper);
                if(null == goodsArea){
                    //没有地区价格,则使用会员价格
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
@@ -1,13 +1,16 @@
package com.ruoyi.other.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.domain.ShopPoint;
import com.ruoyi.other.api.enums.PointChangeType;
import com.ruoyi.other.mapper.ShopPointMapper;
import com.ruoyi.other.service.ShopPointService;
import com.ruoyi.other.service.ShopService;
import com.ruoyi.other.vo.ShopPointStatistics;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
@@ -37,6 +40,8 @@
    private TokenService tokenService;
    @Resource
    private SysUserClient sysUserClient;
    @Resource
    private ShopService shopService;
@@ -45,17 +50,14 @@
    public ShopPointStatistics statistics(IPage<ShopPoint> page, ShopPoint shopPoint) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        List<ShopPoint> shopPoints = this.baseMapper.selectShopPointList(shopPoint);
        Map<Integer, Integer> shopPointMap = shopPoints.stream()
                .collect(Collectors.groupingBy(
                        ShopPoint::getType,
                        Collectors.summingInt(ShopPoint::getVariablePoint)
                ));
        Integer sPoint = 0;
        Integer shopCommissionPoint = 0;
        Integer subShopCommissionPoint = 0;
        Shop shop = shopService.getById(sysUser.getObjectId());
        sPoint += shop.getServerPoint();
        shopCommissionPoint += shop.getSharePoint();
        subShopCommissionPoint += shop.getLowerLevelSharePoint();
        ShopPointStatistics shopPointStatistics = new ShopPointStatistics();
        int sPoint = shopPointMap.getOrDefault(PointChangeType.SHOP_ACHIEVEMENT.getCode(), 0);
        int shopCommissionPoint = shopPointMap.getOrDefault(PointChangeType.SHOP_REBATE.getCode(), 0);
        int subShopCommissionPoint = shopPointMap.getOrDefault(PointChangeType.JUNIOR_SHOP_REBATE.getCode(), 0);
        shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint);
        shopPointStatistics.setShopPoint(sPoint);
        shopPointStatistics.setShopCommissionPoint(shopCommissionPoint);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java
@@ -39,8 +39,8 @@
    private TechnicianScoreService technicianScoreService;
    @Override
    public List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name) {
        return technicianMapper.selectTechnicianListByShopId(shopId,name);
    public List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name,Integer point) {
        return technicianMapper.selectTechnicianListByShopId(shopId,name,point);
    }
    @Override
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.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -8,6 +9,7 @@
import com.ruoyi.account.api.feignClient.AppUserShopClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.AppUserShop;
import com.ruoyi.account.api.model.UserAddress;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.security.service.TokenService;
@@ -70,10 +72,16 @@
        Optional<AppUserShop> first = data.stream().filter(s -> s.getShopId() == shopId.intValue() && s.getRoleType() == 3).findFirst();
        Integer technicianId = null;
        if(first.isPresent()){
            AppUserShop appUserShop = first.get();
            Technician technician = technicianService.getOne(new LambdaQueryWrapper<Technician>().eq(Technician::getAppUserId, appUserShop.getAppUserId())
                    .eq(Technician::getShopId, appUserShop.getShopId()).eq(Technician::getDelFlag, 0).eq(Technician::getStatus, 1));
            technicianId = technician.getId();
            //既是店员又是技师,需要取员工身份获取列表数据
            Optional<AppUserShop> first1 = data.stream().filter(s -> s.getShopId() == shopId.intValue() && s.getRoleType() != 3).findFirst();
            if(!first1.isPresent()){
                AppUserShop appUserShop = first.get();
                Technician technician = technicianService.getOne(new LambdaQueryWrapper<Technician>().eq(Technician::getAppUserId, appUserShop.getAppUserId())
                        .eq(Technician::getShopId, appUserShop.getShopId()).eq(Technician::getDelFlag, 0).eq(Technician::getStatus, 2));
                if(null != technician){
                    technicianId = technician.getId();
                }
            }
        }
        List<TechnicianSubscribeVO> list = technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(pageInfo, shopId, status, technicianId);
        for (TechnicianSubscribeVO technicianSubscribeVO : list) {
@@ -82,6 +90,11 @@
            AppUser appUser = appUserClient.getAppUserById(technicianSubscribe.getAppUserId());
            technicianSubscribeVO.setUserName(appUser.getName());
            technicianSubscribeVO.setPhone(appUser.getPhone());
            Integer serviceMode = technicianSubscribeVO.getServiceMode();
            if(1 == serviceMode){
                UserAddress userAddress = JSON.parseObject(technicianSubscribeVO.getUserAddress(), UserAddress.class);
                technicianSubscribeVO.setUserAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress());
            }
        }
        return pageInfo.setRecords(list);
    }
@@ -119,19 +132,6 @@
    }
    @Override
    public void switchingTechnician(TechnicianSubscribe technicianSubscribe) {
        List<TechnicianSubscribe> list = this.list(new LambdaQueryWrapper<TechnicianSubscribe>().eq(TechnicianSubscribe::getOrderId, technicianSubscribe.getOrderId())
                .eq(TechnicianSubscribe::getDelFlag, 0).eq(TechnicianSubscribe::getStatus, 0));
        for (TechnicianSubscribe subscribe : list) {
            if(subscribe.getTechnicianId().equals(technicianSubscribe.getTechnicianId())){
                throw new RuntimeException("不能切换相同的技师");
            }
            subscribe.setTechnicianId(technicianSubscribe.getTechnicianId());
            this.updateById(subscribe);
        }
    }
    /**
     * 定时修改到期状态
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/SeckillActivityVO.java
@@ -68,4 +68,9 @@
    @ApiModelProperty(value = "展示状态:0下架中  1上架中")
    private Integer showStatus;
    public Integer getType(){
        return goodsType;
    }
}
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsBargainPriceMapper.xml
@@ -31,5 +31,6 @@
        <if test="gp.auditStatus != null">
            and tgbp.audit_status = #{gp.auditStatus}
        </if>
        order by tgbp.create_time desc
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml
@@ -13,6 +13,7 @@
            tgs.selling_price as sellingPrice,
            tgs.integral as integral,
            tg.sale_num as saleNum,
            tg.type goodsType,
            tsai.start_time as startTime,
            tsai.end_time as endTime
        FROM
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
@@ -48,7 +48,7 @@
        tsp.type,
        tsp.create_time,
        tsp.variable_point,
        tsp.order_num
        tsp.order_num as orderNum
        FROM
        t_shop_point tsp
        LEFT JOIN t_shop ts ON tsp.shop_id = ts.id
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
@@ -18,13 +18,19 @@
          AND tt.del_flag = 0
          AND tt.shop_id = #{shopId}
        <if test="name != null and name != ''">
            AND tt.`name` LIKE concat('%', #{name}, '%')
            AND tt.name LIKE concat('%', #{name}, '%')
        </if>
        GROUP BY
            tt.id,
            tt.`name`,
            tt.introduction,
            tt.home_picture
        <if test="point != null and point == 1">
        order by score DESC
        </if>
        <if test="point != null and point == 2">
        order by score
        </if>
    </select>
    <select id="selectTechnicianDetail" resultType="com.ruoyi.other.vo.TechnicianDetailVO">
        SELECT
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml
@@ -13,6 +13,7 @@
            ts.latitude,
            tts.subscribe_time,
            tts.service_mode,
            tts.user_address,
            tts.status
        FROM
            t_technician_subscribe tts