puzhibing
2023-07-26 709a4a10be56952ead6340e4822fce41a66e47cd
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/UserMgrController.java
@@ -232,7 +232,6 @@
     */
    @RequestMapping("/add")
    @BussinessLog(value = "添加管理员", key = "account", dict = UserDict.class)
    @Permission(Const.ADMIN_NAME)
    @ResponseBody
    public Tip add(@Valid UserDto user, BindingResult result) {
        if (result.hasErrors()) {
@@ -252,11 +251,9 @@
        user.setCreatetime(new Date());
        User objectUser = UserFactory.createUser(user);
        //查找平台所属公司
        TCompany company = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1).orderBy("id", true).last(" limit 1"));
        if (SinataUtil.isNotEmpty(company)){
            objectUser.setObjectId(company.getId());
        }
        ShiroUser user1 = ShiroKit.getUser();
        objectUser.setRoleType(user1.getRoleType());
        objectUser.setObjectId(user1.getObjectId());
        objectUser.setPassWordUpdate(new Date());
        this.userService.insert(objectUser);
@@ -334,7 +331,6 @@
     */
    @RequestMapping("/reset")
    @BussinessLog(value = "重置管理员密码", key = "userId", dict = UserDict.class)
    @Permission(Const.ADMIN_NAME)
    @ResponseBody
    public Tip reset(@RequestParam Integer userId) {
        if (ToolUtil.isEmpty(userId)) {
@@ -349,15 +345,11 @@
        return SUCCESS_TIP;
    }
    @Autowired
    private ITCompanyService itCompanyService;
    /**
     * 冻结用户
     */
    @RequestMapping("/freeze")
    @BussinessLog(value = "冻结用户", key = "userId", dict = UserDict.class)
    @Permission(Const.ADMIN_NAME)
    @ResponseBody
    public Tip freeze(@RequestParam Integer userId) {
        if (ToolUtil.isEmpty(userId)) {
@@ -369,26 +361,6 @@
        }
        assertAuth(userId);
        this.userService.setStatus(userId, ManagerStatus.FREEZED.getCode());
        User user = userService.selectById(userId);
        if (user.getRoleType() == 2){
            //查询分公司
            TCompany company = itCompanyService.selectById(user.getObjectId());
            company.setState(1);
            itCompanyService.updateById(company);
            //设置该分公司下的所有司机状态
//            itDriverService.updateCompanyDriverState(3,company.getId());
        }else if (user.getRoleType() == 3){
            //查询加盟商
            TCompany franchisee = itCompanyService.selectById(user.getObjectId());
            franchisee.setState(1);
            itCompanyService.updateById(franchisee);
            //设置该加盟商下的所有司机状态
//            itDriverService.updateFranchiseeDriverState(3,franchisee.getId());
        }
        return SUCCESS_TIP;
    }
@@ -397,7 +369,6 @@
     */
    @RequestMapping("/unfreeze")
    @BussinessLog(value = "解除冻结用户", key = "userId", dict = UserDict.class)
    @Permission(Const.ADMIN_NAME)
    @ResponseBody
    public Tip unfreeze(@RequestParam Integer userId) {
        if (ToolUtil.isEmpty(userId)) {
@@ -407,24 +378,6 @@
        this.userService.setStatus(userId, ManagerStatus.OK.getCode());
        User user = userService.selectById(userId);
        if (user.getRoleType() == 2){
            //查询分公司
            TCompany company = itCompanyService.selectById(user.getObjectId());
            company.setState(0);
            itCompanyService.updateById(company);
            //设置该分公司下的所有司机状态
//            itDriverService.updateCompanyDriverState(2,company.getId());
        }else if (user.getRoleType() == 3){
            //查询加盟商
            TCompany franchisee = itCompanyService.selectById(user.getObjectId());
            franchisee.setState(0);
            itCompanyService.updateById(franchisee);
            //设置该加盟商下的所有司机状态
//            itDriverService.updateFranchiseeDriverState(2,franchisee.getId());
        }
        return SUCCESS_TIP;
    }
@@ -433,7 +386,6 @@
     */
    @RequestMapping("/setRole")
    @BussinessLog(value = "分配角色", key = "userId,roleIds", dict = UserDict.class)
    @Permission(Const.ADMIN_NAME)
    @ResponseBody
    public Tip setRole(@RequestParam("userId") Integer userId, @RequestParam("roleIds") String roleIds) {
        if (ToolUtil.isOneEmpty(userId, roleIds)) {