|
@@ -459,6 +459,28 @@ public class StudentController extends ControllerSupport {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "重置机构下所有学生密码", notes = "重置机构下所有学生密码")
|
|
|
+ @PutMapping("resetPasswordByOrgId/{orgId}")
|
|
|
+ @Transactional
|
|
|
+ public void resetPasswordByOrgId(@PathVariable Long orgId) {
|
|
|
+ OrgEntity org = GlobalHelper.getPresentEntity(orgRepo, orgId, OrgEntity.class);
|
|
|
+
|
|
|
+ validateRootOrgIsolation(org.getRootId());
|
|
|
+
|
|
|
+ List<StudentEntity> stuentList = studentRepo.findByOrgId(org.getId());
|
|
|
+ for (StudentEntity s : stuentList) {
|
|
|
+ String identityNumber = s.getIdentityNumber();
|
|
|
+ if (StringUtils.isNotEmpty(identityNumber)
|
|
|
+ && identityNumber.matches("[0-9a-zA-Z]{6,}")) {
|
|
|
+ s.setPassword(StringUtils.substring(identityNumber, -6, identityNumber.length()));
|
|
|
+ } else {
|
|
|
+ s.setPassword(BasicConsts.DEFAULT_PASSWORD);
|
|
|
+ }
|
|
|
+ s.setUpdateTime(new Date());
|
|
|
+ studentRepo.save(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 方法注释
|
|
|
*
|