中扬CRM客户关系管理系统
#
lsh
2024-04-19 775a4818b1ff4f18f17b24108cc92c23f728ea61
src/main/java/com/zy/crm/system/controller/UserController.java
@@ -8,9 +8,12 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.domain.KeyValueVo;
import com.core.exception.CoolException;
import com.zy.crm.common.web.BaseController;
import com.zy.crm.manager.entity.result.KeyValueVo;
import com.zy.crm.manager.entity.param.UserChildrenParam;
import com.zy.crm.manager.service.CstmrService;
import com.zy.crm.manager.utils.UserChildrenParamUtils;
import com.zy.crm.system.entity.Role;
import com.zy.crm.system.entity.User;
import com.zy.crm.system.service.RoleService;
@@ -28,6 +31,8 @@
    private UserService userService;
    @Autowired
    private RoleService roleService;
    @Autowired
    private CstmrService cstmrService;
    @RequestMapping(value = "/user/{id}/auth")
    @ManagerAuth
@@ -132,7 +137,9 @@
        User one = userService.selectById(user.getId());
        if (!one.getDeptId().equals(user.getDeptId())) {
            // todo: 修改关联数据的deptId字段
            cstmrService.updateDeptIdByUserId(user.getId(), user.getDeptId());
        }
        user.setNickname(user.getUsername());
        if (!userService.updateById(user)) {
            throw new CoolException("修改用户失败");
        }
@@ -202,5 +209,22 @@
        return R.ok().add(valueVos);
    }
    @RequestMapping("/user/id/popup/auth")
    public R popupUserId(String token) {
        Long item = 0L;
        if (Cools.isEmpty(token)){
            return R.ok();
        }
        try{
            User user = getUser(token);
            if (Cools.isEmpty(user) || Cools.isEmpty(user.getId())){
                return R.ok(item);
            }
            UserChildrenParam userChildrenParamList = UserChildrenParamUtils.getUserChildrenParamList(user);
            return R.ok().add(userChildrenParamList);
        }catch (Exception ignored){ }
        return R.ok();
    }
}