longz
2026-07-29 61ed739b4ee4267653568a2aa91004ac6c43d248
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -696,8 +696,9 @@
    @PostMapping(value = "/user/addOrUpdate")
    @Log(title = "【用户列表】添加编辑用户", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
    public R addOrUpdate(@RequestBody TAppUser  tAppUser) {
        partnerAppUserAccessService.assertWritable();
        if (tAppUser.getId() != null){
            AuthUtil.checkPermi("/appUser/update");
            partnerAppUserAccessService.assertUserVisible(tAppUser.getId());
            //为编辑操作,要进行vip的逻辑处理
            TAppUser nowUser = appUserService.getById(tAppUser.getId());
            //会员结束时间不为空
@@ -731,6 +732,7 @@
            }
        }else {
           AuthUtil.checkPermi("/appUser/add");
           List<TAppUser> list = appUserService.lambdaQuery().eq(TAppUser::getPhone, tAppUser.getPhone()).list();
           if (!list.isEmpty()){
               return R.fail("该手机号已注册");
@@ -955,7 +957,7 @@
    @PostMapping(value = "/user/status/change")
    @Log(title = "【用户列表】冻结解冻用户", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
    public R pointsDetail(@RequestBody UserChangeDto userChangeDto) {
        partnerAppUserAccessService.assertWritable();
        partnerAppUserAccessService.assertUserVisible(userChangeDto.getUserId());
        TAppUser appUser = appUserService.getById(userChangeDto.getUserId());
        appUser.setStatus(userChangeDto.getStatus());
        appUser.setRemark(userChangeDto.getRemark());
@@ -969,9 +971,10 @@
    @PostMapping(value = "/user/unit/change")
    @Log(title = "【用户列表】修改用户单位", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
    public R unitChange(@RequestBody UnitChangeDto unitChangeDto) {
        partnerAppUserAccessService.assertWritable();
        for (String s : unitChangeDto.getIds().split(",")) {
            TAppUser byId = appUserService.getById(s);
        List<Long> userIds = parseUserIds(unitChangeDto.getIds());
        partnerAppUserAccessService.assertUsersVisible(userIds);
        for (Long userId : userIds) {
            TAppUser byId = appUserService.getById(userId);
            byId.setCompanyId(unitChangeDto.getUnitId());
            appUserService.updateById(byId);
        }
@@ -984,10 +987,10 @@
    @DeleteMapping(value = "/user/delete")
    @Log(title = "【用户列表】删除用户", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
    public R userDelete(String ids) {
        partnerAppUserAccessService.assertWritable();
        String[] split = ids.split(",");
        for (String s : split) {
            appUserService.removeById(s);
        List<Long> userIds = parseUserIds(ids);
        partnerAppUserAccessService.assertUsersVisible(userIds);
        for (Long userId : userIds) {
            appUserService.removeById(userId);
        }
        return R.ok();
@@ -1164,10 +1167,10 @@
    @PostMapping(value = "/user/give/vip")
    @Log(title = "【用户列表】赠送会员", businessType = BusinessType.OTHER,operatorType = OperatorType.MANAGE)
    public R giveVip(@RequestBody GiveVipDto  giveVipDto) {
        partnerAppUserAccessService.assertWritable();
        String[] split = giveVipDto.getUserIds().split(",");
        for (String s : split) {
            TAppUser nowUser = appUserService.getById(s);
        List<Long> userIds = parseUserIds(giveVipDto.getUserIds());
        partnerAppUserAccessService.assertUsersVisible(userIds);
        for (Long userId : userIds) {
            TAppUser nowUser = appUserService.getById(userId);
            int plusDay = 0;
            if (giveVipDto.getType() == 1) {
                plusDay = 1;
@@ -1204,6 +1207,18 @@
        }
        return R.ok();
    }
    private List<Long> parseUserIds(String ids) {
        if (StringUtils.isBlank(ids)) {
            return Collections.emptyList();
        }
        return Arrays.stream(ids.split(","))
                .map(String::trim)
                .filter(StringUtils::isNotBlank)
                .map(Long::valueOf)
                .distinct()
                .collect(Collectors.toList());
    }