wangzhinan 1 ano atrás
pai
commit
6a0a994811

+ 97 - 4
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -27,10 +27,7 @@ import com.yihu.jw.security.oauth2.provider.WlyyTokenGranter;
import com.yihu.jw.security.oauth2.provider.error.WlyyOAuth2ExceptionTranslator;
import com.yihu.jw.security.oauth2.provider.error.WlyyOAuth2ExceptionTranslator;
import com.yihu.jw.security.service.*;
import com.yihu.jw.security.service.*;
import com.yihu.jw.security.utils.*;
import com.yihu.jw.security.utils.*;
import com.yihu.jw.sms.service.TXYSmsService;
import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.service.*;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.jw.util.common.StringUtil;
import com.yihu.jw.util.common.StringUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
@ -165,6 +162,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    private WlyyHospitalSysDictDao wlyyhospitalSysdictDao;
    private WlyyHospitalSysDictDao wlyyhospitalSysdictDao;
    @Autowired
    @Autowired
    private HttpClientUtil httpClientUtil;
    private HttpClientUtil httpClientUtil;
    @Autowired
    private IotSMSService iotSMSService;
    @PostConstruct
    @PostConstruct
@ -859,6 +858,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            return sendZBCaptcha(parameters);
            return sendZBCaptcha(parameters);
        }else if("hz_yyyzh_wx".equals(wxId)){
        }else if("hz_yyyzh_wx".equals(wxId)){
            return sendTXYCaptcha(parameters);
            return sendTXYCaptcha(parameters);
        }else if("hz_yyyzh_wx".equals(wxId)){
            return sendTXYCaptcha(parameters);
        }else if("xm_znyg_wx".equals(wxId)){
            return sendWlyyCaptcha(parameters);
        }
        }
        throw new IllegalStateException("验证码发送失败");
        throw new IllegalStateException("验证码发送失败");
    }
    }
@ -2228,6 +2231,38 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        }
        }
    }
    }
    @RequestMapping(value = "/oauth/findUserPw", method = RequestMethod.POST)
    public Envelop findUserPw(String mobile,String client_id,String captcha,String pw) throws Exception{
        if("xm_znyg_wx".equalsIgnoreCase(wechatId)){
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
            if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
                if (captcha.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
                }else {
                    return ObjEnvelop.getError("验证码错误!");
                }
            }else {
                if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
                    //验证码正确
                } else {
                    return ObjEnvelop.getError("验证码错误!");
                }
            }
            String rs = registerService.updateUserPw(mobile,pw,wechatId);
            if("ok".equals(rs)){
                return ObjEnvelop.getSuccess("修改成功!");
            }
            return ObjEnvelop.getError("手机号未注册!");
        }else {
            return ObjEnvelop.getError("暂未开放");
        }
    }
    @RequestMapping(value = "/oauth/updateDoctorMoble", method = RequestMethod.POST)
    @RequestMapping(value = "/oauth/updateDoctorMoble", method = RequestMethod.POST)
    public Envelop updateDoctorMoble(String id,String mobile,String client_id,String captcha){
    public Envelop updateDoctorMoble(String id,String mobile,String client_id,String captcha){
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
@ -2779,4 +2814,62 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        return getResponse(wlyyUserSimple);
        return getResponse(wlyyUserSimple);
    }
    }
    /**
     * 厦门i健康短信接口
     * @param parameters
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/oauth/sendWlyyCaptcha", method = RequestMethod.GET)
    public ResponseEntity<Oauth2Envelop<Captcha>> sendWlyyCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
        String client_id = parameters.get("client_id");
        String username = parameters.get("username");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if (StringUtils.isEmpty(username)) {
            throw new InvalidRequestException("username");
        }
        if (username.length()>12){
            throw new InvalidRequestException("请输入正确的手机号!");
        }
        //验证请求间隔超时,防止频繁获取验证码
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("success", 200);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }else {
            //发送短信获取验证码
            String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
            String result = iotSMSService.IotSendSMS(username, "您好,你的手机注册短信验证码是:" + captcha + ",5分钟内有效。");
            if (result.equals("success")) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
        }
        throw new IllegalStateException("验证码发送失败!");
    }
}
}

+ 18 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/RegisterService.java

@ -3,9 +3,11 @@ package com.yihu.jw.security.service;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.iot.UserDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.BasePatientMedicareCardDao;
import com.yihu.jw.security.dao.patient.BasePatientMedicareCardDao;
import com.yihu.jw.security.dao.patient.BasePatientWechatDao;
import com.yihu.jw.security.dao.patient.BasePatientWechatDao;
@ -50,6 +52,8 @@ public class RegisterService {
    @Autowired
    @Autowired
    private YkyyService ykyyService;
    private YkyyService ykyyService;
    @Autowired
    private UserDao userDao;
    public Map<String,Object> registerPatient(String name, String mobile, String idcard, String ssc, String pw,String openid,String wxId,String captcha)throws Exception{
    public Map<String,Object> registerPatient(String name, String mobile, String idcard, String ssc, String pw,String openid,String wxId,String captcha)throws Exception{
@ -229,6 +233,20 @@ public class RegisterService {
    }
    }
    public String updateUserPw(String mobile,String pw,String wxId){
        UserDO userDO = userDao.findByMobile(mobile);
        if(userDO!=null){
            String salt = randomString(5);
            userDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
            userDO.setSalt(salt);
            userDao.save(userDO);
        }else{
            return "-1";
        }
        return "ok";
    }
    public String updateDoctorMoble(String id,String mobile){
    public String updateDoctorMoble(String id,String mobile){
        BaseDoctorDO doctorDO = baseDoctorDao.findOne(id);
        BaseDoctorDO doctorDO = baseDoctorDao.findOne(id);
        //认证信息设置
        //认证信息设置

+ 2 - 2
svr/svr-base/pom.xml

@ -11,7 +11,7 @@
    </parent>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-base-yg</artifactId>
    <artifactId>svr-base</artifactId>
    <packaging>jar</packaging>
    <packaging>jar</packaging>
    <version>${parent.version}</version>
    <version>${parent.version}</version>
@ -232,7 +232,7 @@
    </dependencies>
    </dependencies>
    <build>
    <build>
        <finalName>svr-base-yg</finalName>
        <finalName>svr-base</finalName>
        <plugins>
        <plugins>
            <plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <groupId>org.apache.maven.plugins</groupId>

+ 2 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineOrderService.java

@ -352,7 +352,7 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
        }
        }
        if (!StringUtils.isEmpty(content)) {
        if (!StringUtils.isEmpty(content)) {
            conditionSql += " and CONCAT(IFNULL(t.`prescribe_num`,''),IFNULL(t.`contact`,''),IFNULL(t.`shipping_equ`,'')," +
            conditionSql += " and CONCAT(IFNULL(t.`prescribe_num`,''),IFNULL(t.`contact`,''),IFNULL(t.`shipping_equ`,'')," +
                    " IFNULL(t.`community`,'')) like '%" + content + "%'";
                    " IFNULL(t.`community`,''),IFNULL(t.`name`,''),IFNULL(t.`pick_up_num`,'')) like '%" + content + "%'";
        }
        }
        if (!StringUtils.isEmpty(community)) {
        if (!StringUtils.isEmpty(community)) {
            conditionSql += " and t.belong_community = '" + community + "'";
            conditionSql += " and t.belong_community = '" + community + "'";
@ -916,6 +916,7 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
            if (Integer.compare(totalShipmentLog, shipped + 1) == 0) {
            if (Integer.compare(totalShipmentLog, shipped + 1) == 0) {
                Mediicineorder order = orderDao.findOne(medicineShipmentLog.getOrderId());
                Mediicineorder order = orderDao.findOne(medicineShipmentLog.getOrderId());
                order.setSellState("1");
                order.setSellState("1");
                order.setShippingType(shippingType);
                if (org.apache.commons.lang.StringUtils.isNotBlank(order.getApplyNo())){
                if (org.apache.commons.lang.StringUtils.isNotBlank(order.getApplyNo())){
                    Boolean flag = sickPhysicDosage(order.getBelongCommunity(),order.getApplyNo(),medicineShipmentLog.getEquNum());
                    Boolean flag = sickPhysicDosage(order.getBelongCommunity(),order.getApplyNo(),medicineShipmentLog.getEquNum());
                    logger.info("flag"+flag);
                    logger.info("flag"+flag);