소스 검색

CA接口修改

liuwenbin 7 년 전
부모
커밋
bd6e365ae4

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java

@ -67,7 +67,7 @@ public class Doctor extends IdEntity {
    private Double evaluateScore;//评分
    private String checkPassword;   //审方密码
    private String checkSalt;       //审方密码的盐
    private String certifiedOvertime; //CA证书过期时间
    private Date certifiedOvertime; //CA证书过期时间
    public Double getEvaluateScore() {
        return evaluateScore;
@ -416,11 +416,11 @@ public class Doctor extends IdEntity {
        this.checkSalt = checkSalt;
    }
    public String getCertifiedOvertime() {
    public Date getCertifiedOvertime() {
        return certifiedOvertime;
    }
    public void setCertifiedOvertime(String certifiedOvertime) {
    public void setCertifiedOvertime(Date certifiedOvertime) {
        this.certifiedOvertime = certifiedOvertime;
    }
}

+ 51 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1295,12 +1295,43 @@ public class DoctorInfoService extends BaseService {
//        doctor.setCheckPassword(Encodes.encodeHex(hashPassword));
//    }
    /**
     * 获取CA证书过期时间
     * 获取线上CA是否认证过
     */
    public JSONObject getCAPastDue(String strUserIdcardNum)  throws Exception{
    public JSONObject isAuthentication(String doctorCode)  throws Exception{
        Doctor doctor = findDoctorByCode(doctorCode);
        String strUserIdcardNum = doctor.getIdcard();
        Boolean isSuccess = true;
        JSONObject jsonObject = new JSONObject();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if(doctor.getIscertified()==1){
            if(doctor.getCertifiedOvertime().getTime()>System.currentTimeMillis()){
                jsonObject.put("type",4);
                String data = simpleDateFormat.format(doctor.getCertifiedOvertime());
                jsonObject.put("time",data);
            }else{
                jsonObject = getCAPastDue(doctorCode,jsonObject);
            }
        }else{
            jsonObject = getCAPastDue(doctorCode,jsonObject);
        }
        return jsonObject;
    }
    /**
     * 获取CA证书过期时间
     */
    public JSONObject getCAPastDue(String doctorCode,JSONObject jsonObject)  throws Exception{
        Doctor doctor = findDoctorByCode(doctorCode);
        String strUserIdcardNum = doctor.getIdcard();
        String data ="";
//        JSONObject jsonObject = new JSONObject();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String url = jwUrl+"/third/prescription/GetRealNameSoftCertExpiredDatetime";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
@ -1311,18 +1342,16 @@ public class DoctorInfoService extends BaseService {
            int status = responseObject.getInt("status");
            String msg = responseObject.getString("msg");
            if (status == 200) {
                String data = responseObject.getString("data");
                data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                } else {
//                    JSONObject jsonData = new JSONObject(data);
//                    JSONArray jsonArray = jsonData.getJSONArray("EventList");
//                    re = jsonArray.toString();
                    JSONObject jsonObject = new JSONObject();
                    //1、有证书,并有效,2、有证书,已过期,3、无证书
                    //1、线上未认证,有证书,并有效,2、线上未认证,有证书,已过期,3、线上未认证,无证书,4、线上已认证,并有效
                    if(StringUtils.isNotEmpty(data)){
                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        long times = simpleDateFormat.parse(data).getTime();
                        Date CertifiedOvertime = simpleDateFormat.parse(data);
                        doctor.setCertifiedOvertime(CertifiedOvertime);
                        doctorDao.save(doctor);
                        long times = CertifiedOvertime.getTime();
                        if(System.currentTimeMillis()<=times){
                            jsonObject.put("type",1);
                        }else{
@ -1331,9 +1360,7 @@ public class DoctorInfoService extends BaseService {
                    }else{
                        jsonObject.put("type",3);
                    }
                    jsonObject.put("time",data);
                    return jsonObject;
                }
            } else {
                throw new Exception(responseObject.getString("msg"));
@ -1341,12 +1368,14 @@ public class DoctorInfoService extends BaseService {
        }else {
            throw new Exception("null response.");
        }
        jsonObject.put("time",data);
        return jsonObject;
    }
    /**
     * 修改实名软证书调用保护口令
     */
    public boolean updateAuthenticationPassword(String strUserIdcardNum,String strOldCalledPasswd,String strNewCalledPasswd) throws Exception{
    public boolean updateAuthenticationPassword(String strUserIdcardNum,String strOldCalledPasswd,String strNewCalledPasswd,String doctorCode) throws Exception{
        String url = jwUrl+"/third/prescription/ModifyRealNameSoftCertCalledPasswd";
        List<NameValuePair> params = new ArrayList<>();
@ -1364,6 +1393,9 @@ public class DoctorInfoService extends BaseService {
                    throw new Exception(data);
                }else{
                    if("0".equals(data)){
                        Doctor doctor = findDoctorByCode(doctorCode);
                        doctor.setIscertified(1);
                        doctorDao.save(doctor);
                        return true;
                    }
                }
@ -1441,4 +1473,9 @@ public class DoctorInfoService extends BaseService {
        }
        return false;
    }
//    //判断线上是否已经认证过(即是否设置过密码)
//    public boolean  iscertifiedAuthentication(S){
//
//    }
}

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -12,6 +12,8 @@ import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.QrcodeUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import org.apache.axis.encoding.*;
import org.apache.axis.encoding.Base64;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -131,7 +133,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            }
        }
        // 生成二维码
        InputStream ipt = QrcodeUtil.createQrcode(code,300,"png");
        InputStream ipt = QrcodeUtil.createQrcode(Base64.encode(code.getBytes()),300,"png");
        ObjectNode imgNode = FastDFSUtil.upload(ipt,"png","QRCode_"+System.currentTimeMillis());
//        Prescription类  取药类型:1 自取 2快递配送 3健管师配送
        String fileUrl = fastdfs_file_url + imgNode.get("groupName").toString().replaceAll("\"","")
@ -162,7 +164,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        //String jgsID= "";//配送员用户ID后4位
//        String jgsCode = code+"1234";//code+jgsID.substring(jgsID.length()-4);
        // 生成二维码
        InputStream ipt = QrcodeUtil.createQrcode(code,300,"png");
        InputStream ipt = QrcodeUtil.createQrcode(Base64.encode(jgsCode.getBytes()),300,"png");
        ObjectNode imgNode = FastDFSUtil.upload(ipt,"png","QRCode_"+System.currentTimeMillis());
//        Prescription类  取药类型:1 自取 2快递配送 3健管师配送
        String fileUrl = fastdfs_file_url + imgNode.get("groupName").toString().replaceAll("\"","")

+ 19 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -1949,12 +1949,12 @@ public class DoctorController extends BaseController {
    //获取实名软证书的过期时间
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/getAuthenticationCA", method = RequestMethod.GET)
    public String getAuthenticationCA(){
    @RequestMapping(value = "/getAuthenticationCAOvertime", method = RequestMethod.GET)
    public String getAuthenticationCAOvertime(){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            JSONObject data = doctorInfoService.getCAPastDue(doctor.getIdcard());
//            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            JSONObject data = doctorInfoService.getCAPastDue(getRepUID(),new JSONObject());
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
            error(e);
@ -1963,6 +1963,20 @@ public class DoctorController extends BaseController {
    }
    //判断是否在线上安装证书
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/isAuthentication", method = RequestMethod.GET)
    public String isAuthentication(){
        try {
            JSONObject data = doctorInfoService.isAuthentication(getRepUID());
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
            error(e);
            return error(-1, "获取信息失败!");
        }
    }
    //修改实名软证书调用保护口令
    @ObserverRequired
    @ResponseBody
@ -1972,7 +1986,7 @@ public class DoctorController extends BaseController {
            @RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd);
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,getRepUID());
            if(b){
                return write(200, "修改密码成功!", "data", b);
            }

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java

@ -8,6 +8,7 @@ import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.axis.encoding.Base64;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -115,6 +116,7 @@ public class PrescriptionCodeController extends BaseController{
        try{
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(dispensaryCode,getRepUID(),2);
            map.put("code", Base64.encode(map.get("code").toString().getBytes()));
            return write(200, "获取配送员取药码成功!", "data", map);
        }catch (Exception e) {
            error(e);
@ -133,6 +135,7 @@ public class PrescriptionCodeController extends BaseController{
        try{
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(dispensaryCode,getRepUID(),3);
            map.put("code",Base64.encode(map.get("code").toString().getBytes()));
            return write(200, "获取配送员配送码成功!", "data", map);
        }catch (Exception e) {
            error(e);

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -11,6 +11,7 @@ import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.axis.encoding.Base64;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -129,6 +130,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
        try{
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(dispensaryCode,getRepUID(),1);
            map.put("code",Base64.encode(map.get("code").toString().getBytes()));
            return write(200, "获取居民取药码成功!", "data", map);
        }catch (Exception e) {
            error(e);