Commit 0a3ca9775fab9be12bc2775a69b5162097d07113
1 parent
83a2de61
模板下载 重置密码
Showing
6 changed files
with
40 additions
and
1 deletions
src/main/java/com/bsth/controller/sys/UserController.java
| ... | ... | @@ -313,4 +313,9 @@ public class UserController extends BaseController<SysUser, Integer> { |
| 313 | 313 | return sysUserService.getAllClass(); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | + @RequestMapping(value = "/resetPWD", method = RequestMethod.POST) | |
| 317 | + public Map<String, Object> resetPWD(@RequestParam Integer id) { | |
| 318 | + return sysUserService.resetPWD(id); | |
| 319 | + } | |
| 320 | + | |
| 316 | 321 | } | ... | ... |
src/main/java/com/bsth/service/sys/SysUserService.java
src/main/java/com/bsth/service/sys/impl/SysUserServiceImpl.java
| ... | ... | @@ -95,6 +95,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implem |
| 95 | 95 | } |
| 96 | 96 | else{ |
| 97 | 97 | u.setPassword(new BCryptPasswordEncoder(4).encode(u.getPassword())); |
| 98 | + u.setStatus("0"); | |
| 98 | 99 | rs = super.save(u); |
| 99 | 100 | } |
| 100 | 101 | }catch (Exception e){ |
| ... | ... | @@ -199,4 +200,18 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implem |
| 199 | 200 | List<String> classList=sysUserRepository.findAllClassByParentID(String.valueOf(loginUser.getId())); |
| 200 | 201 | return classList; |
| 201 | 202 | } |
| 203 | + | |
| 204 | + public Map<String, Object> resetPWD(@RequestParam Integer id){ | |
| 205 | + Map<String, Object> rs = new HashMap(); | |
| 206 | + try { | |
| 207 | + sysUserRepository.changePWD(id,new BCryptPasswordEncoder(4).encode("123456")); | |
| 208 | + rs.put("status", ResponseCode.SUCCESS); | |
| 209 | + rs.put("msg", "密码重置成功!"); | |
| 210 | + } catch (Exception e) { | |
| 211 | + logger.error("", e); | |
| 212 | + rs.put("status", ResponseCode.ERROR); | |
| 213 | + rs.put("msg", e.getMessage()); | |
| 214 | + } | |
| 215 | + return rs; | |
| 216 | + } | |
| 202 | 217 | } | ... | ... |
src/main/resources/static/pages/ddexam/index.html
| ... | ... | @@ -84,6 +84,7 @@ |
| 84 | 84 | 批量创建 |
| 85 | 85 | </button> |
| 86 | 86 | <button type="button" class="btn btn-primary textk" id="onckil2">初始化当天排班</button> |
| 87 | + <button type="button" class="btn btn-primary textk" onclick="download()">模板下载</button> | |
| 87 | 88 | </div> |
| 88 | 89 | <div class="col-md-12 nt" > |
| 89 | 90 | <div class="col-md-12 sct"> |
| ... | ... | @@ -260,5 +261,7 @@ |
| 260 | 261 | firstLoad=false; |
| 261 | 262 | }) |
| 262 | 263 | } |
| 263 | - | |
| 264 | + function download(){ | |
| 265 | + window.open("/downloadFile/download?fileName=import_student.xlsx"); | |
| 266 | + } | |
| 264 | 267 | </script> |
| 265 | 268 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forms/export/import_student.xlsx
0 → 100644
No preview for this file type
src/main/resources/static/pages/permission/user/list.html
| ... | ... | @@ -115,6 +115,7 @@ |
| 115 | 115 | <td> |
| 116 | 116 | {{if obj.isEdit == 0}} |
| 117 | 117 | <a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a> |
| 118 | + <a class="btn btn-sm blue btn-outline" onclick="resetPWD('{{obj.id}}')" data-pjax><i class="fa fa-edit"></i> 重置密码</a> | |
| 118 | 119 | <!--<button type="button" class="btn btn-sm line_allot_btn" data-id="{{obj.id}}">线调线路分配</button>--> |
| 119 | 120 | {{/if}} |
| 120 | 121 | {{if obj.isAdmin}} |
| ... | ... | @@ -334,4 +335,16 @@ function changeEnabled(id,enabled){ |
| 334 | 335 | jsDoQuery(null, true); |
| 335 | 336 | }) |
| 336 | 337 | } |
| 338 | +function resetPWD(id){ | |
| 339 | + $.post('/user/resetPWD',{'id':id},function(result){ | |
| 340 | + if(result.status=='SUCCESS') { | |
| 341 | + // 弹出添加成功提示消息 | |
| 342 | + swal("密码重置成功!", "success"); | |
| 343 | + } else if(result.status=='ERROR') { | |
| 344 | + // 弹出添加失败提示消息 | |
| 345 | + swal("重置失败!", result.msg+",请联系开发人员!", "ERROR"); | |
| 346 | + } | |
| 347 | + jsDoQuery(getParams(), true); | |
| 348 | + }); | |
| 349 | +} | |
| 337 | 350 | </script> |
| 338 | 351 | \ No newline at end of file | ... | ... |