Browse Source

重置密码

chenyongxing 6 years ago
parent
commit
2b07a57256

+ 1 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -472,7 +472,7 @@ public class BaseRequestMapping {
        public static final String idcardOccupied  = "/idcardOccupied";
        public static final String updateMobile  = "/updateMobile";
        public static final String resetPassword  = "/resetPassword";
        public static final String resetPasswordByCapcha  = "/resetPwdByCapcha";
        public static final String ForgetPwd  = "/forgetPwd";
        public static final String Regist = "regist";
        public static final String GetKey = "getKey";
        public static final String Login = "login";

+ 4 - 4
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientEndpoint.java

@ -173,13 +173,13 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.resetPasswordByCapcha)
    @ApiOperation(value = "通过验证码设置密码")
    public ObjEnvelop resetPwd(@ApiParam(name = "id", value = "居民标识", required = true) @RequestParam String id,
    @PostMapping(value = BaseRequestMapping.BasePatient.ForgetPwd)
    @ApiOperation(value = "通过验证码重置密码")
    public ObjEnvelop forgetPws(@ApiParam(name = "mobile", value = "手机号", required = true) @RequestParam String mobile,
                            @ApiParam(name = "password", value = "密码", required = true) @RequestParam String password,
                            @ApiParam(name = "captcha", value = "验证码", required = true) @RequestParam String captcha) throws Exception {
        ObjEnvelop envelop = new ObjEnvelop();
        Map<String, Object> result = patientService.resetPwd(id, password,captcha);
        Map<String, Object> result = patientService.forget(mobile, password,captcha);
        envelop.setObj(result);
        return envelop;
    }

+ 14 - 4
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java

@ -332,7 +332,7 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
        return patient;
    }
    public Map<String,Object> resetPwd(String id, String password, String captcha) {
    public Map<String,Object> forget(String mobile, String password, String captcha) {
        Map<String, Object> map = new HashMap<>();
        //增加密码
        if (password.length() < 6 || password.length() > 20) {
@ -340,8 +340,18 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
            map.put("message", "密码长度需为6-20位");
            return map;
        }
        BasePatientDO patient = basePatientDao.findOne(id);
        String mobile = patient.getMobile();
        List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile, "1");
        if (CollectionUtils.isEmpty(list)) {
            map.put("code", -1);
            map.put("message", "该手机号暂未注册!");
            return map;
        }else if(list.size()>1){
            map.put("code", -1);
            map.put("message", "该手机号对应多个账号,请联系管理员");
            return map;
        }
        BasePatientDO patient = list.get(0);
        // 对验证码进行校验
        int res = baseSmsService.check(mobile, 2, captcha);
        if (-2 == res) {
@ -357,7 +367,7 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
            map.put("message", "验证码无效!");
            return map;
        } else {
            resetPassword(id, password);
            resetPassword(patient.getId(), password);
            map.put("code", 1);
            map.put("message", "设置成功!");
        }