Commit 0a3ca9775fab9be12bc2775a69b5162097d07113

Authored by yiming
1 parent 83a2de61

模板下载 重置密码

src/main/java/com/bsth/controller/sys/UserController.java
@@ -313,4 +313,9 @@ public class UserController extends BaseController<SysUser, Integer> { @@ -313,4 +313,9 @@ public class UserController extends BaseController<SysUser, Integer> {
313 return sysUserService.getAllClass(); 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
@@ -24,4 +24,7 @@ public interface SysUserService extends BaseService&lt;SysUser, Integer&gt;{ @@ -24,4 +24,7 @@ public interface SysUserService extends BaseService&lt;SysUser, Integer&gt;{
24 List<Map<String,String>> userNameList(); 24 List<Map<String,String>> userNameList();
25 25
26 List<String> getAllClass(); 26 List<String> getAllClass();
  27 +
  28 + Map<String, Object> resetPWD(@RequestParam Integer id);
  29 +
27 } 30 }
src/main/java/com/bsth/service/sys/impl/SysUserServiceImpl.java
@@ -95,6 +95,7 @@ public class SysUserServiceImpl extends BaseServiceImpl&lt;SysUser, Integer&gt; implem @@ -95,6 +95,7 @@ public class SysUserServiceImpl extends BaseServiceImpl&lt;SysUser, Integer&gt; implem
95 } 95 }
96 else{ 96 else{
97 u.setPassword(new BCryptPasswordEncoder(4).encode(u.getPassword())); 97 u.setPassword(new BCryptPasswordEncoder(4).encode(u.getPassword()));
  98 + u.setStatus("0");
98 rs = super.save(u); 99 rs = super.save(u);
99 } 100 }
100 }catch (Exception e){ 101 }catch (Exception e){
@@ -199,4 +200,18 @@ public class SysUserServiceImpl extends BaseServiceImpl&lt;SysUser, Integer&gt; implem @@ -199,4 +200,18 @@ public class SysUserServiceImpl extends BaseServiceImpl&lt;SysUser, Integer&gt; implem
199 List<String> classList=sysUserRepository.findAllClassByParentID(String.valueOf(loginUser.getId())); 200 List<String> classList=sysUserRepository.findAllClassByParentID(String.valueOf(loginUser.getId()));
200 return classList; 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,6 +84,7 @@
84 批量创建 84 批量创建
85 </button> 85 </button>
86 <button type="button" class="btn btn-primary textk" id="onckil2">初始化当天排班</button> 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 </div> 88 </div>
88 <div class="col-md-12 nt" > 89 <div class="col-md-12 nt" >
89 <div class="col-md-12 sct"> 90 <div class="col-md-12 sct">
@@ -260,5 +261,7 @@ @@ -260,5 +261,7 @@
260 firstLoad=false; 261 firstLoad=false;
261 }) 262 })
262 } 263 }
263 - 264 + function download(){
  265 + window.open("/downloadFile/download?fileName=import_student.xlsx");
  266 + }
264 </script> 267 </script>
265 \ No newline at end of file 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,6 +115,7 @@
115 <td> 115 <td>
116 {{if obj.isEdit == 0}} 116 {{if obj.isEdit == 0}}
117 <a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a> 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 <!--<button type="button" class="btn btn-sm line_allot_btn" data-id="{{obj.id}}">线调线路分配</button>--> 119 <!--<button type="button" class="btn btn-sm line_allot_btn" data-id="{{obj.id}}">线调线路分配</button>-->
119 {{/if}} 120 {{/if}}
120 {{if obj.isAdmin}} 121 {{if obj.isAdmin}}
@@ -334,4 +335,16 @@ function changeEnabled(id,enabled){ @@ -334,4 +335,16 @@ function changeEnabled(id,enabled){
334 jsDoQuery(null, true); 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 </script> 350 </script>
338 \ No newline at end of file 351 \ No newline at end of file