lidongdong
2022-11-25 b3bc52d303a62b67791f193b6e84306f6462c3db
flower_city/src/main/java/com/dg/core/controller/UserController.java
@@ -56,7 +56,14 @@
        if(user==null)
        {
            HuaChengSysUser huaChengSysUser=iHuaChengSysUserService.selectData("",account,"");
            List<HuaChengSysUser> list=iHuaChengSysUserService.selectData("",account,"");
            HuaChengSysUser huaChengSysUser=null;
            if(list!=null && list.size()>0 )
            {
                huaChengSysUser=list.get(0);
            }
            if(huaChengSysUser==null || !password.equals(huaChengSysUser.getPassword()))
            {
                //提示用户名或密码错误
@@ -106,11 +113,18 @@
            map.put("userType", user.getUserType());
            map.put("departmentId", user.getDepartmentId());
            map.put("departmentName", user.getDepartmentName());
            map.put("moreDepartmentIds", user.getMoreDepartmentIds());
            return ResultData.success(map);
        }
        else
        {
            if(StringUtils.equals("4",user.getUserType()))
            {
                //提示用户名或密码错误
                return ResultData.fail(HttpStatus.UNAUTHORIZED, "账户不存在");
            }
            if(!password.equals(user.getPassword()))
            {
                //提示用户名或密码错误
@@ -135,6 +149,7 @@
            map.put("userType", user.getUserType());
            map.put("departmentId", user.getDepartmentId());
            map.put("departmentName", user.getDepartmentName());
            map.put("moreDepartmentIds", user.getMoreDepartmentIds());
            return ResultData.success(map);
        }
@@ -182,9 +197,9 @@
        Assert.notNull(pageNum, "pageNum can not be empty");
        Assert.notNull(pageSize, "pageSize can not be empty");
        Page<SysUser> pageParam = new Page<>(pageNum,pageSize);
        List<SysUser> list = IUserService.selectConfigList(pageParam,pageSize,"3",keyword);
        List<SysUser> list = IUserService.selectConfigList(pageParam,pageSize,null,keyword,null,"1");
        int num=IUserService.selectNum("3",keyword);
        int num=IUserService.selectNum(null,keyword,null,"1");
        return getDataTable(list,num);
    }
@@ -222,23 +237,63 @@
            return error("手机号不能为空");
        }
        SysUser user = IUserService.selectData("",config.getPhonenumber(),"");
        SysUser user2 = IUserService.selectData("","",config.getLoginName());
        if (user != null) {
            //提示用户名或密码错误
            return error("该用户已存在!");
            if(StringUtils.equals("4",user.getUserType()))
            {
                config.setUserId(user.getUserId());
                config.setCreateBy(user.getUserId()+"");
                config.setUserType("3");
                config.setIsDivisionHead("1");
                config.setUpdateTime(LocalDateTime.now());
                config.setMasterIds(user2.getMasterIds());
                config.setDepartmentIds(config.getDepartmentIds());
                config.setDepartmentIdStr(config.getDepartmentIdStr());
                config.setMattersIds(config.getMattersIds());
                config.setMasterNames(config.getMasterNames());
                config.setMattersNames(config.getMattersNames());
                return toAjax(IUserService.updateConfig(config));
            }
            else
            {
                //提示用户名或密码错误
                return error("该用户已存在!");
            }
        }
        if(user2 != null)
        {
            //提示用户名或密码错误
            return error("该登录账户已存在!请修改登录账户");
            if(StringUtils.equals("4",user2.getUserType()))
            {
                config.setUserId(user2.getUserId());
                config.setCreateBy(user2.getUserId()+"");
                config.setUserType("3");
                config.setIsDivisionHead("1");
                config.setUpdateTime(LocalDateTime.now());
                config.setMasterIds(user2.getMasterIds());
                config.setDepartmentIds(config.getDepartmentIds());
                config.setDepartmentIdStr(config.getDepartmentIdStr());
                config.setMattersIds(config.getMattersIds());
                config.setMasterNames(config.getMasterNames());
                config.setMattersNames(config.getMattersNames());
                return toAjax(IUserService.updateConfig(config));
            }
            else
            {
                //提示用户名或密码错误
                return error("该用户已存在!");
            }
        }
        config.setCreateBy(sysUser.getUserId()+"");
        config.setUserId(Snowflake.getId()+"");
        config.setUserType("3");
        config.setIsDivisionHead("1");
        config.setMoreDepartmentIds(config.getDepartmentId());
        config.setCreateTime(LocalDateTime.now());
        config.setUpdateTime(LocalDateTime.now());
@@ -265,9 +320,7 @@
        {
            return error("账户不能为空");
        }
        config.setUserType("3");
        config.setPassword(null);
        config.setUpdateBy(sys.getUserId()+"");
        return toAjax(IUserService.updateConfig(config));
@@ -350,6 +403,30 @@
    }
    /**
     * 获取登录人员信息
     *
     * @return 结果
     */
    @ApiOperation(value = "获取登录人员信息,userType=1 为超级管理员  isDivisionHead=1 为部门领导",response = SysUser.class)
    @PostMapping("/getLoginInformation")
    @Authorization
    public ResultData getLoginInformation(@CurrentUser SysUser sysUse)
    {
      return  ResultData.success(sysUse);
    }
    @ApiOperation("切换部门接口")
    @GetMapping(value = "/switch/department")
    public ResultData switchDepartment(@RequestParam(value = "departmentId",required = false) String departmentId,
                                       @CurrentUser SysUser sysUse)
    {
        sysUse.setDepartmentId(departmentId);
        return toAjax(IUserService.updateConfig(sysUse));
    }