diff --git a/jeecg-boot-master/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java b/jeecg-boot-master/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java index 94d264f4..33a44cf2 100644 --- a/jeecg-boot-master/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java +++ b/jeecg-boot-master/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java @@ -79,6 +79,8 @@ public class ShiroConfig { filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除 filterChainDefinitionMap.put("/sys/checkCaptcha", "anon"); //登录验证码接口排除 filterChainDefinitionMap.put("/sys/login", "anon"); //登录接口排除 + filterChainDefinitionMap.put("/sys/sysDepart/queryDepartStuTreeSync", "anon"); //学生部门注册接口排除 + filterChainDefinitionMap.put("/sys/sysDepart/queryTreeStuList", "anon"); //学生部门注册接口排除 filterChainDefinitionMap.put("/sys/mLogin", "anon"); //登录接口排除 filterChainDefinitionMap.put("/sys/logout", "anon"); //登出接口排除 filterChainDefinitionMap.put("/sys/thirdLogin/**", "anon"); //第三方登录 @@ -87,6 +89,7 @@ public class ShiroConfig { filterChainDefinitionMap.put("/sys/phoneLogin", "anon");//手机登录 filterChainDefinitionMap.put("/sys/user/checkOnlyUser", "anon");//校验用户是否存在 filterChainDefinitionMap.put("/sys/user/register", "anon");//用户注册 + filterChainDefinitionMap.put("/sys/user/sturegister", "anon");//学生-用户注册 filterChainDefinitionMap.put("/sys/user/phoneVerification", "anon");//用户忘记密码验证手机号 filterChainDefinitionMap.put("/sys/user/passwordChange", "anon");//用户更改密码 filterChainDefinitionMap.put("/auth/2step-code", "anon");//登录验证码 diff --git a/jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java b/jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java index 36ac1382..b34ebee5 100644 --- a/jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java +++ b/jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java @@ -141,6 +141,54 @@ public class SysDepartController { return result; } + /** + * 学生-异步查询部门list + * @param parentId 父节点 异步加载时传递 + * @param ids 前端回显是传递 + * @param primaryKey 主键字段(id或者orgCode) + * @return + */ + @RequestMapping(value = "/queryDepartStuTreeSync", method = RequestMethod.GET) + public Result> queryDepartStuTreeSync(@RequestParam(name = "pid", required = false) String parentId,@RequestParam(name = "ids", required = false) String ids, @RequestParam(name = "primaryKey", required = false) String primaryKey) { + Result> result = new Result<>(); + try { + List list = sysDepartService.queryTreeListByPid(parentId, ids, primaryKey); + result.setResult(list); + result.setSuccess(true); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return result; + } + + /** + * 学生-查询数据 查出所有部门,并以树结构数据格式响应给前端 + * + * @return + */ + @RequestMapping(value = "/queryTreeStuList", method = RequestMethod.GET) + public Result> queryTreeStuList(@RequestParam(name = "ids", required = false) String ids) { + Result> result = new Result<>(); + try { + // 从内存中读取 +// List list =FindsDepartsChildrenUtil.getSysDepartTreeList(); +// if (CollectionUtils.isEmpty(list)) { +// list = sysDepartService.queryTreeList(); +// } + if(oConvertUtils.isNotEmpty(ids)){ + List departList = sysDepartService.queryTreeList(ids); + result.setResult(departList); + }else{ + List list = sysDepartService.queryTreeList(); + result.setResult(list); + } + result.setSuccess(true); + } catch (Exception e) { + log.error(e.getMessage(),e); + } + return result; + } + /** * 异步查询当前用户部门 diff --git a/jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java b/jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java index f4019134..2e572bbf 100644 --- a/jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java +++ b/jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java @@ -370,7 +370,7 @@ public class SysUserController { /** * 删除用户 */ - @RequiresPermissions("system:user:delete") + // @RequiresPermissions("system:user:delete") @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public Result delete(@RequestParam(name="id",required=true) String id) { baseCommonService.addLog("删除用户,id: " +id ,CommonConstant.LOG_TYPE_2, 3); @@ -1122,6 +1122,82 @@ public class SysUserController { return result; } + /** + * 用户注册接口 + * + * @param jsonObject + * @param user + * @return + */ + @PostMapping("/sturegister") + public Result sturUserRegister(@RequestBody JSONObject jsonObject, SysUser user) { + Result result = new Result(); + String phone = jsonObject.getString("phone"); + String smscode = jsonObject.getString("smscode"); + String departmentid = jsonObject.getString("departmentid"); + String realname = jsonObject.getString("realname"); + + //update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906 + String redisKey = CommonConstant.PHONE_REDIS_KEY_PRE+phone; + Object code = redisUtil.get(redisKey); + //update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906 + + String username = jsonObject.getString("username"); + //未设置用户名,则用手机号作为用户名 + if(oConvertUtils.isEmpty(username)){ + username = phone; + } + //未设置密码,则随机生成一个密码 + String password = jsonObject.getString("password"); + String email = jsonObject.getString("email"); + SysUser sysUser1 = sysUserService.getUserByName(username); + if (sysUser1 != null) { + result.setMessage("用户名已注册"); + result.setSuccess(false); + return result; + } + SysUser sysUser2 = sysUserService.getUserByPhone(phone); + if (sysUser2 != null) { + result.setMessage("该手机号已注册"); + result.setSuccess(false); + return result; + } + + if(null == code){ + result.setMessage("验证码失效,请重新获取"); + result.setSuccess(false); + return result; + } + if (!smscode.equals(code.toString())) { + result.setMessage("验证码错误!"); + result.setSuccess(false); + return result; + } + if(oConvertUtils.isEmpty(realname)){ + realname = username; + } + + try { + user.setCreateTime(new Date());// 设置创建时间 + String salt = oConvertUtils.randomGen(8); + String passwordEncode = PasswordUtil.encrypt(username, password, salt); + user.setSalt(salt); + user.setUsername(username); + user.setRealname(realname); + user.setPassword(passwordEncode); + //user.setEmail(email); + user.setPhone(phone); + user.setStatus(CommonConstant.USER_UNFREEZE); + user.setDelFlag(CommonConstant.DEL_FLAG_0); + user.setActivitiSync(CommonConstant.ACT_SYNC_0); + sysUserService.addUserWithRole(user,"1724327596426760194"); + sysUserService.addUserWithDepart(user,departmentid); + result.success("注册成功"); + } catch (Exception e) { + result.error500("注册失败"); + } + return result; + } diff --git a/jeecgboot-vue3-master/src/api/common/api.ts b/jeecgboot-vue3-master/src/api/common/api.ts index d219fddd..4be01130 100644 --- a/jeecgboot-vue3-master/src/api/common/api.ts +++ b/jeecgboot-vue3-master/src/api/common/api.ts @@ -9,6 +9,8 @@ enum Api { roleList = '/sys/role/list', queryDepartTreeSync = '/sys/sysDepart/queryDepartTreeSync', queryTreeList = '/sys/sysDepart/queryTreeList', + queryStuDepartTreeSync = '/sys/sysDepart/queryDepartStuTreeSync', + queryStuTreeList = '/sys/sysDepart/queryTreeStuList', loadTreeData = '/sys/category/loadTreeData', loadDictItem = '/sys/category/loadDictItem/', getDictItems = '/sys/dict/getDictItems/', @@ -63,6 +65,20 @@ export const queryTreeList = (params?) => { return defHttp.get({ url: Api.queryTreeList, params }); }; +/** + * 学生-异步获取部门树列表 + */ +export const queryStuDepartTreeSync = (params?) => { + return defHttp.get({ url: Api.queryStuDepartTreeSync, params }); +}; +/** + * 学生-获取部门树列表 + */ +export const queryStuTreeList = (params?) => { + return defHttp.get({ url: Api.queryStuTreeList, params }); +}; + + /** * 分类字典树控件 加载节点 */ @@ -164,4 +180,4 @@ export const getStudent = () => { return defHttp.get({ url:'/annualcompetitionprojectregistration/annualCompetitionProjectRegistration/xssybsjs' }) -} \ No newline at end of file +} diff --git a/jeecgboot-vue3-master/src/api/sys/user.ts b/jeecgboot-vue3-master/src/api/sys/user.ts index 253c4a26..bfc93a61 100644 --- a/jeecgboot-vue3-master/src/api/sys/user.ts +++ b/jeecgboot-vue3-master/src/api/sys/user.ts @@ -26,6 +26,8 @@ enum Api { getCaptcha = '/sys/sms', //注册接口 registerApi = '/sys/user/register', + //学生_注册接口 + registerStuApi = '/sys/user/sturegister', //校验用户接口 checkOnlyUser = '/sys/user/checkOnlyUser', //SSO登录校验 @@ -127,6 +129,13 @@ export function register(params) { return defHttp.post({ url: Api.registerApi, params }, { isReturnNativeResponse: true }); } +/** + * @description: 注册接口 + */ +export function registerStu(params) { + return defHttp.post({ url: Api.registerStuApi, params }, { isReturnNativeResponse: true }); +} + /** *校验用户是否存在 * @param params diff --git a/jeecgboot-vue3-master/src/components/Form/src/jeecg/components/JStuSelectDept.vue b/jeecgboot-vue3-master/src/components/Form/src/jeecg/components/JStuSelectDept.vue new file mode 100644 index 00000000..543436ce --- /dev/null +++ b/jeecgboot-vue3-master/src/components/Form/src/jeecg/components/JStuSelectDept.vue @@ -0,0 +1,169 @@ + + + + diff --git a/jeecgboot-vue3-master/src/components/Form/src/jeecg/components/modal/DeptStuSelectModal.vue b/jeecgboot-vue3-master/src/components/Form/src/jeecg/components/modal/DeptStuSelectModal.vue new file mode 100644 index 00000000..45103fa3 --- /dev/null +++ b/jeecgboot-vue3-master/src/components/Form/src/jeecg/components/modal/DeptStuSelectModal.vue @@ -0,0 +1,122 @@ + + + diff --git a/jeecgboot-vue3-master/src/views/system/loginmini/MiniRegister.vue b/jeecgboot-vue3-master/src/views/system/loginmini/MiniRegister.vue index 327bfb4a..4ad46724 100644 --- a/jeecgboot-vue3-master/src/views/system/loginmini/MiniRegister.vue +++ b/jeecgboot-vue3-master/src/views/system/loginmini/MiniRegister.vue @@ -24,21 +24,21 @@
- +
- - + +
- +
+ + + + + + + + +
@@ -109,13 +109,14 @@