浏览代码

预注册

chenyongxing 6 年之前
父节点
当前提交
422f09e817

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

@ -197,4 +197,19 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        return success(smsDO, SmsVO.class);
    }
    @GetMapping(value = "bespeakRegist")
    @ApiOperation(value = "发送验证码")
    public Envelop bespeakRegist(
            @ApiParam(name = "mobile", value = "手机号")
            @RequestParam(value = "mobile", required = true) String mobile) throws Exception {
        Map<String, Object> map = patientService.bespeakRegist(mobile, 2L);
        Envelop envelop = new Envelop();
        String code = map.get("code").toString();
        String message = map.get("message").toString();
        System.out.println("code====>>"+code);
        System.out.println("message====>>"+message);
        return envelop;
    }
}

+ 12 - 2
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java

@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
import org.csource.common.MyException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@ -26,6 +27,7 @@ import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
 * 居民信息服务
@ -43,6 +45,11 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
    @Autowired
    private FileUploadService fileUploadService;
    @Autowired
    private StringRedisTemplate redisTemplate;
    private static String BespeakRegist = "bespeakRegist:";
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfsUrl;
@ -107,7 +114,7 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
    /**
     * 预注册功能接口
     * @param mobile
     * @param time 预注册过期时间
     * @param time 预注册过期时间 例如: 2 , 则2分钟过期
     * @return
     */
    public Map<String,Object> bespeakRegist(String mobile,long time){
@ -127,9 +134,12 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
            return map;
        }
        //将预注册信息存到redis中
        redisTemplate.opsForValue().set(BespeakRegist+mobile , mobile, time, TimeUnit.MINUTES);
        map.put("code",1);
        map.put("message","预注册成功");
        return map;
    }
    /**