chenyongxing 6 лет назад
Родитель
Сommit
a400460b64

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

@ -472,6 +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 Regist = "regist";
        public static final String GetKey = "getKey";
        public static final String Login = "login";

+ 1 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/WlyyTokenGranter.java

@ -314,7 +314,7 @@ public class WlyyTokenGranter implements TokenGranter {
            String client_id = parameters.get("client_id");
            String username = parameters.get("username");
            String captcha = parameters.get("captcha");
                //todo cyx  部署应注释掉
                //todo cyx  部署应取消注释(自测试,可注释,不验证短信直接登录)
           if (!wlyyRedisVerifyCodeService.verification(client_id, username, captcha)){
                throw new InvalidGrantException("Invalid captcha");
            }

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

@ -172,6 +172,19 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        return success(patientService.resetPassword(id, password));
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.resetPasswordByCapcha)
    @ApiOperation(value = "通过验证码设置密码")
    public ObjEnvelop resetPwd(@ApiParam(name = "id", value = "居民标识", required = true) @RequestParam String id,
                            @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);
        envelop.setObj(result);
        return envelop;
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.getCompletedInfo)
    @ApiOperation(value = "查询完善后信息详情")
    public ObjEnvelop<BasePatientVO> getCompletedInfo(

+ 33 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java

@ -179,6 +179,7 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
        }
        patient.setSalt(randomString(5));
        patient.setPassword(MD5.md5Hex(newPassword + "{" + patient.getSalt() + "}"));
        save(patient);
        return ConstantUtils.SUCCESS;
    }
@ -330,4 +331,36 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
        }
        return patient;
    }
    public Map<String,Object> resetPwd(String id, String password, String captcha) {
        Map<String, Object> map = new HashMap<>();
        //增加密码
        if (password.length() < 6 || password.length() > 20) {
            map.put("code", -1);
            map.put("message", "密码长度需为6-20位");
            return map;
        }
        BasePatientDO patient = basePatientDao.findOne(id);
        String mobile = patient.getMobile();
        // 对验证码进行校验
        int res = baseSmsService.check(mobile, 2, captcha);
        if (-2 == res) {
            map.put("code", -1);
            map.put("message", "验证码已过期!");
            return map;
        } else if (-1 == res) {
            map.put("code", -1);
            map.put("message", "请输入正确的验证码!");
            return map;
        } else if (0 == res) {
            map.put("code", -1);
            map.put("message", "验证码无效!");
            return map;
        } else {
            resetPassword(id, password);
            map.put("code", 1);
            map.put("message", "设置成功!");
        }
        return map;
    }
}