|  | @ -1,18 +1,11 @@
 | 
	
		
			
				|  |  | package com.yihu.wlyy.service.service.prescription;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.serializer.SerializerFeature;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.SystemConfig;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.http.HttpApiException;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.util.StringUtil;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.util.WebserviceUtil;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.service.LogService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.service.ZysoftApi;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.service.ZysoftBaseService;
 | 
	
		
			
				|  |  | import com.zoe.phip.ssp.sdk.ApiException;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.io.PrintWriter;
 | 
	
		
			
				|  |  | import java.io.StringWriter;
 | 
	
	
		
			
				|  | @ -20,48 +13,12 @@ import java.util.HashMap;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | import java.util.UUID;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * Created by hzp on 2017-07-31
 | 
	
		
			
				|  |  |  * 长处方CA认证服务
 | 
	
		
			
				|  |  |  * Created by ${liuwenbin} on 2017/8/28.
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | @Service
 | 
	
		
			
				|  |  | public class PrescriptionCAService extends ZysoftBaseService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private String IS_APPLIED="XMCAF_SOFT_judgeRealNameSoftCertIsApplied"; //判断实名软证书是否已申请
 | 
	
		
			
				|  |  |     private String REQUEST_SIGN = "XMCAF_SOFT_requestRealNameSoftCertAndSign";//请求实名软证书并进行数字签名
 | 
	
		
			
				|  |  |     private String EXPIRED_DATETIME = "XMCAF_SOFT_getRealNameSoftCertExpiredDatetime"; //获取实名软证书的过期时间
 | 
	
		
			
				|  |  |     private String MODIFY_PASSWD = "XMCAF_SOFT_ModifyRealNameSoftCertCalledPasswd"; //修改实名软证书调用保护口令
 | 
	
		
			
				|  |  |     private String VERIFY_SIGN = "XMCA3_JMSVR_verifySignOnMultiServer"; //验证签名(带多服务器负载均衡)
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private String unifiedCallInterface = "XMCA6_UnifiedCallInterface";
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private LogService logService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ObjectMapper objectMapper;
 | 
	
		
			
				|  |  | public interface PrescriptionCAService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private String getHeaderXml(String api,String srcBusinessStreamNO,String srcRequestStreamNO)
 | 
	
		
			
				|  |  |     {
 | 
	
		
			
				|  |  |         return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
 | 
	
		
			
				|  |  |             "<root>\n" +
 | 
	
		
			
				|  |  |             "   <serverName>"+api+"</serverName>\n" +
 | 
	
		
			
				|  |  |             "   <format>xml</format>\n" +
 | 
	
		
			
				|  |  |             "   <callOperator></callOperator>\n" +
 | 
	
		
			
				|  |  |             "   <certificate></certificate>\n" +
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             "   <srcIP>10.95.22.10</srcIP >\n" +
 | 
	
		
			
				|  |  |             "   <srcUserMac>00:50:56:85:39:82</srcUserMac>\n" +
 | 
	
		
			
				|  |  |             "   <srcSystemCode>1</srcSystemCode>\n" +
 | 
	
		
			
				|  |  |             "   <srcSystemName>厦门i健康</srcSystemName>\n" +
 | 
	
		
			
				|  |  |             "   <srcBusinessNodeCode>node01</srcBusinessNodeCode>\n" +
 | 
	
		
			
				|  |  |             "   <srcBusinessNodeName>审核</srcBusinessNodeName>\n" +
 | 
	
		
			
				|  |  |             "   <srcOperatorAccount>"+srcBusinessStreamNO+"</srcOperatorAccount>\n" +
 | 
	
		
			
				|  |  |             "   <srcBusinessStreamNO>"+srcBusinessStreamNO+"</srcBusinessStreamNO>\n" +
 | 
	
		
			
				|  |  |             "   <srcRequestStreamNO>"+srcRequestStreamNO+"</srcRequestStreamNO>\n" +
 | 
	
		
			
				|  |  |             "   <srcDataExtProperty></srcDataExtProperty>\n" +
 | 
	
		
			
				|  |  |             "</root>";
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | //    String getHeaderXml(String api,String srcBusinessStreamNO,String srcRequestStreamNO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 生产环境 智业CA接口二次封装
 | 
	
	
		
			
				|  | @ -71,432 +28,36 @@ public class PrescriptionCAService extends ZysoftBaseService {
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String postZyCaServer(String api, Map<String,String> params,String srcBusinessStreamNO,String content) throws Exception{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String msgBody = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
 | 
	
		
			
				|  |  |                 "<root>\n";
 | 
	
		
			
				|  |  |         if(params!=null && params.size()>0)
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             for(String key : params.keySet())
 | 
	
		
			
				|  |  |             {
 | 
	
		
			
				|  |  |                 msgBody += "    <"+key+">"+params.get(key)+"</"+key+">\n";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         msgBody += "</root>";
 | 
	
		
			
				|  |  |         String srcRequestStreamNO = UUID.randomUUID().toString().replace("-", "");
 | 
	
		
			
				|  |  |         String msgHeader = getHeaderXml(api,srcBusinessStreamNO,srcRequestStreamNO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         System.out.println("msgHerder:"+msgHeader);
 | 
	
		
			
				|  |  |         System.out.println("msgBody:"+msgBody);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String re = "";
 | 
	
		
			
				|  |  |         Map<String,String> paramsList = new HashMap<>();
 | 
	
		
			
				|  |  |         paramsList.put("msgHeader",msgHeader);
 | 
	
		
			
				|  |  |         paramsList.put("msgBody",msgBody);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //新增日志
 | 
	
		
			
				|  |  |         String method = "POST";
 | 
	
		
			
				|  |  |         Boolean isSuccess = true;
 | 
	
		
			
				|  |  |         String error = "";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         int times = 0;
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  | //            re = ZysoftApi.getSingleton().post(ca_url, paramsList, null,true);
 | 
	
		
			
				|  |  |             re = ZysoftApi.getSingleton().capost(paramsList, null,true);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             System.out.println("re=====>:"+re);
 | 
	
		
			
				|  |  | //            Map<String,String> map = objectMapper.readValue(re,Map.class);
 | 
	
		
			
				|  |  | //            String code = map.get("CODE");
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            if(!code.equals("1"))
 | 
	
		
			
				|  |  | //            {
 | 
	
		
			
				|  |  | //                throw new HttpApiException(Integer.valueOf(code),map.get("MESSAGE"));
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //保存http日志
 | 
	
		
			
				|  |  |             logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         catch (Exception ex)
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             StringWriter sw = new StringWriter();
 | 
	
		
			
				|  |  |             PrintWriter pw = new PrintWriter(sw);
 | 
	
		
			
				|  |  |             ex.printStackTrace(pw);
 | 
	
		
			
				|  |  |             System.out.println("error1:"+ex.getMessage());
 | 
	
		
			
				|  |  |             error = sw.toString();
 | 
	
		
			
				|  |  |             System.out.println("error2:"+error);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //保存http日志
 | 
	
		
			
				|  |  |             logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if(ex instanceof ApiException)
 | 
	
		
			
				|  |  |             {
 | 
	
		
			
				|  |  |                 ApiException apiEx = (ApiException) ex;
 | 
	
		
			
				|  |  |                 System.out.println("error3:"+ex.getMessage());
 | 
	
		
			
				|  |  |                 throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else{
 | 
	
		
			
				|  |  |                 System.out.println("error4:"+ex.getMessage());
 | 
	
		
			
				|  |  |                 throw new HttpApiException(-1,ex.getMessage());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | //    public String postZyCaServer(String api, Map<String,String> params, String srcBusinessStreamNO, String content) throws Exception;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 测试环境:CA认证服务二次封装
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     private String postCAServer(String api, Map<String,String> params,String srcBusinessStreamNO) throws Exception
 | 
	
		
			
				|  |  |     {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String urlString = SystemConfig.sysPropertiesSets.get("ca_url");
 | 
	
		
			
				|  |  |         String namespace = SystemConfig.sysPropertiesSets.get("ca_namespace");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String msgBody = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
 | 
	
		
			
				|  |  |                          "<root>\n";
 | 
	
		
			
				|  |  |         if(params!=null && params.size()>0)
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             for(String key : params.keySet())
 | 
	
		
			
				|  |  |             {
 | 
	
		
			
				|  |  |                 msgBody += "    <"+key+">"+params.get(key)+"</"+key+">\n";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         msgBody += "</root>";
 | 
	
		
			
				|  |  |         String srcRequestStreamNO = UUID.randomUUID().toString().replace("-", "");
 | 
	
		
			
				|  |  |         String msgHeader = getHeaderXml(api,srcBusinessStreamNO,srcRequestStreamNO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map<String,String> p = new HashMap<>();
 | 
	
		
			
				|  |  |         p.put("msgHeader",msgHeader);
 | 
	
		
			
				|  |  |         p.put("msgBody",msgBody);
 | 
	
		
			
				|  |  |         return WebserviceUtil.post(urlString,namespace,unifiedCallInterface,p);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 判断是否有实名证书
 | 
	
		
			
				|  |  |      **/
 | 
	
		
			
				|  |  |     public String isApplied(String strUserIdcardNum,String srcBusinessStreamNO)  throws Exception
 | 
	
		
			
				|  |  |     {
 | 
	
		
			
				|  |  |         Boolean isSuccess = true;
 | 
	
		
			
				|  |  |         String re = "";
 | 
	
		
			
				|  |  |         String body = "";
 | 
	
		
			
				|  |  |         String error = "";
 | 
	
		
			
				|  |  |         String action = IS_APPLIED;
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Map<String,String> params = new HashMap<>();
 | 
	
		
			
				|  |  |             params.put("strUserIdcardNum",strUserIdcardNum);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             body = objectMapper.writeValueAsString(params);
 | 
	
		
			
				|  |  | //            re = postCAServer(action, params,srcBusinessStreamNO);
 | 
	
		
			
				|  |  |             //生产环境,调用智业统一平台接口,rest接口
 | 
	
		
			
				|  |  |             re = postZyCaServer(action, params,srcBusinessStreamNO,"判断是否有实名证书");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if(StringUtil.isEmpty(re))
 | 
	
		
			
				|  |  |             {
 | 
	
		
			
				|  |  |                 throw new Exception("返回为空!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else{
 | 
	
		
			
				|  |  |                 if(re.startsWith("error"))
 | 
	
		
			
				|  |  |                 {
 | 
	
		
			
				|  |  |                     throw new Exception(re);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         catch (Exception ex)
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             isSuccess = false;
 | 
	
		
			
				|  |  |             ex.printStackTrace();
 | 
	
		
			
				|  |  |             error = ex.getMessage();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //保存http日志
 | 
	
		
			
				|  |  |         logService.saveHttpLog(isSuccess,action,"判断是否有实名证书","POST",null,body,re,error,logService.caType);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!StringUtil.isEmpty(error))
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             throw new Exception(error);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | //    public String postCAServer(String api, Map<String,String> params,String srcBusinessStreamNO) throws Exception;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 请求实名软证书并进行数字签名
 | 
	
		
			
				|  |  |      **/
 | 
	
		
			
				|  |  |     public String requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData,String srcBusinessStreamNO) throws Exception
 | 
	
		
			
				|  |  |     {
 | 
	
		
			
				|  |  |         Boolean isSuccess = true;
 | 
	
		
			
				|  |  |         String re = "";
 | 
	
		
			
				|  |  |         String body = "";
 | 
	
		
			
				|  |  |         String error = "";
 | 
	
		
			
				|  |  |         String action = REQUEST_SIGN;
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Map<String,String> params = new HashMap<>();
 | 
	
		
			
				|  |  |             params.put("strUserIdcardNum",strUserIdcardNum);
 | 
	
		
			
				|  |  |             params.put("strRealNameSoftCertCalledPasswd",strRealNameSoftCertCalledPasswd);
 | 
	
		
			
				|  |  |             params.put("strOriginalData",strOriginalData);
 | 
	
		
			
				|  |  | //            params.put("srcBusinessStreamNO",srcBusinessStreamNO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             body = objectMapper.writeValueAsString(params);
 | 
	
		
			
				|  |  |             //测试环境开启下面这行代码,webservice接口
 | 
	
		
			
				|  |  | //            re = postCAServer(action, params,srcBusinessStreamNO);
 | 
	
		
			
				|  |  |             //生产环境,调用智业统一平台接口,rest接口
 | 
	
		
			
				|  |  |             re = postZyCaServer(action, params,srcBusinessStreamNO,"请求实名软证书并进行数字签名");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if(StringUtil.isEmpty(re))
 | 
	
		
			
				|  |  |             {
 | 
	
		
			
				|  |  |                 throw new Exception("返回为空!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else{
 | 
	
		
			
				|  |  |                 if(re.startsWith("error"))
 | 
	
		
			
				|  |  |                 {
 | 
	
		
			
				|  |  |                     throw new Exception(re);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData,String srcBusinessStreamNO)  throws Exception;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         catch (Exception ex)
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             isSuccess = false;
 | 
	
		
			
				|  |  |             ex.printStackTrace();
 | 
	
		
			
				|  |  |             error = ex.getMessage();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //保存http日志
 | 
	
		
			
				|  |  |         logService.saveHttpLog(isSuccess, action, "请求实名软证书并进行数字签名", "POST", null, body, re, error, logService.caType);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!StringUtil.isEmpty(error))
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             throw new Exception(error);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取实名软证书的过期时间
 | 
	
		
			
				|  |  |      **/
 | 
	
		
			
				|  |  |     public String getRealNameSoftCertExpiredDatetime(String strUserIdcardNum,String srcBusinessStreamNO)  throws Exception
 | 
	
		
			
				|  |  |     {
 | 
	
		
			
				|  |  |         Boolean isSuccess = true;
 | 
	
		
			
				|  |  |         String re = "";
 | 
	
		
			
				|  |  |         String body = "";
 | 
	
		
			
				|  |  |         String error = "";
 | 
	
		
			
				|  |  |         String action = EXPIRED_DATETIME;
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Map<String,String> params = new HashMap<>();
 | 
	
		
			
				|  |  |             params.put("strUserIdcardNum",strUserIdcardNum);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             body = objectMapper.writeValueAsString(params);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //            re = postCAServer(action, params,srcBusinessStreamNO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             re = postZyCaServer(action, params,srcBusinessStreamNO,"获取实名软证书的过期时间");
 | 
	
		
			
				|  |  |             if(StringUtil.isEmpty(re))
 | 
	
		
			
				|  |  |             {
 | 
	
		
			
				|  |  |                 throw new Exception("返回为空!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else{
 | 
	
		
			
				|  |  |                 if(re.startsWith("error"))
 | 
	
		
			
				|  |  |                 {
 | 
	
		
			
				|  |  |                     throw new Exception(re);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         catch (Exception ex)
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             isSuccess = false;
 | 
	
		
			
				|  |  |             ex.printStackTrace();
 | 
	
		
			
				|  |  |             error = ex.getMessage();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //保存http日志
 | 
	
		
			
				|  |  |         logService.saveHttpLog(isSuccess,action,"获取实名软证书的过期时间","POST",null,body,re,error,logService.caType);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!StringUtil.isEmpty(error))
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             throw new Exception(error);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public String getRealNameSoftCertExpiredDatetime(String strUserIdcardNum,String srcBusinessStreamNO)  throws Exception;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 修改实名软证书调用保护口令
 | 
	
		
			
				|  |  |      **/
 | 
	
		
			
				|  |  |     public String modifyRealNameSoftCertCalledPasswd(String strUserIdcardNum,String strOldCalledPasswd,String strNewCalledPasswd,String srcBusinessStreamNO) throws Exception
 | 
	
		
			
				|  |  |     {
 | 
	
		
			
				|  |  |         Boolean isSuccess = true;
 | 
	
		
			
				|  |  |         String re = "";
 | 
	
		
			
				|  |  |         String body = "";
 | 
	
		
			
				|  |  |         String error = "";
 | 
	
		
			
				|  |  |         Throwable errorLog =null;
 | 
	
		
			
				|  |  |         String action = MODIFY_PASSWD;
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Map<String,String> params = new HashMap<>();
 | 
	
		
			
				|  |  |             params.put("strUserIdcardNum",strUserIdcardNum);
 | 
	
		
			
				|  |  |             params.put("strOldCalledPasswd",strOldCalledPasswd);
 | 
	
		
			
				|  |  |             params.put("strNewCalledPasswd",strNewCalledPasswd);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             body = objectMapper.writeValueAsString(params);
 | 
	
		
			
				|  |  | //            re = postCAServer(action, params,srcBusinessStreamNO);
 | 
	
		
			
				|  |  |             re = postZyCaServer(action, params,srcBusinessStreamNO,"修改实名软证书调用保护口令");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if(StringUtil.isEmpty(re))
 | 
	
		
			
				|  |  |             {
 | 
	
		
			
				|  |  |                 throw new Exception("返回为空!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else{
 | 
	
		
			
				|  |  |                 if(re.startsWith("error"))
 | 
	
		
			
				|  |  |                 {
 | 
	
		
			
				|  |  |                     throw new Exception(re);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         catch (Exception ex)
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             isSuccess = false;
 | 
	
		
			
				|  |  |             ex.printStackTrace();
 | 
	
		
			
				|  |  |             error = ex.getMessage();
 | 
	
		
			
				|  |  |             errorLog = ex.getCause();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //保存http日志
 | 
	
		
			
				|  |  |         logService.saveHttpLog(isSuccess,action,"修改实名软证书调用保护口令","POST",null,body,re,error,logService.caType);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!StringUtil.isEmpty(error))
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             throw new Exception(error);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(errorLog!=null)
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             throw new Exception("CA服务器维护中。。。");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public String modifyRealNameSoftCertCalledPasswd(String strUserIdcardNum,String strOldCalledPasswd,String strNewCalledPasswd,String srcBusinessStreamNO) throws Exception;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 验证签名(带多服务器负载均衡)
 | 
	
		
			
				|  |  |      **/
 | 
	
		
			
				|  |  |     public String verifySignOnMultiServer(String strSignData,String strCertData,String strOriginalData,String srcBusinessStreamNO) throws Exception
 | 
	
		
			
				|  |  |     {
 | 
	
		
			
				|  |  |         Boolean isSuccess = true;
 | 
	
		
			
				|  |  |         String re = "";
 | 
	
		
			
				|  |  |         String body = "";
 | 
	
		
			
				|  |  |         String error = "";
 | 
	
		
			
				|  |  |         String action = VERIFY_SIGN;
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Map<String,String> params = new HashMap<>();
 | 
	
		
			
				|  |  |             params.put("strSignData",strSignData);
 | 
	
		
			
				|  |  |             params.put("strCertData",strCertData);
 | 
	
		
			
				|  |  |             params.put("strOriginalData",strOriginalData);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             body = objectMapper.writeValueAsString(params);
 | 
	
		
			
				|  |  | //            re = postCAServer(action, params,srcBusinessStreamNO);
 | 
	
		
			
				|  |  |             re = postZyCaServer(action, params,srcBusinessStreamNO,"验证签名(带多服务器负载均衡)");
 | 
	
		
			
				|  |  |             if(StringUtil.isEmpty(re))
 | 
	
		
			
				|  |  |             {
 | 
	
		
			
				|  |  |                 throw new Exception("返回为空!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else{
 | 
	
		
			
				|  |  |                 if(re.startsWith("error"))
 | 
	
		
			
				|  |  |                 {
 | 
	
		
			
				|  |  |                     throw new Exception(re);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         catch (Exception ex)
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             isSuccess = false;
 | 
	
		
			
				|  |  |             ex.printStackTrace();
 | 
	
		
			
				|  |  |             error = ex.getMessage();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     public String verifySignOnMultiServer(String strSignData,String strCertData,String strOriginalData,String srcBusinessStreamNO)  throws Exception;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //保存http日志
 | 
	
		
			
				|  |  |         logService.saveHttpLog(isSuccess,action,"验证签名","POST",null,body,re,error,logService.caType);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!StringUtil.isEmpty(error))
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             throw new Exception(error);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //    public static void main(String args[]) {
 | 
	
		
			
				|  |  | //        try {
 | 
	
		
			
				|  |  | //            String caUrl = SystemConfig.getInstance().getCAUrl();
 | 
	
		
			
				|  |  | //            String caNamespace = SystemConfig.getInstance().getCANamespace();
 | 
	
		
			
				|  |  | //            /*//获取实名软证书的过期时间
 | 
	
		
			
				|  |  | //            String api = "XMCAF_SOFT_getRealNameSoftCertExpiredDatetime";
 | 
	
		
			
				|  |  | //            String msgBody = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
 | 
	
		
			
				|  |  | //                    "<root>\n"+
 | 
	
		
			
				|  |  | //                    "    <strUserIdcardNum>123456</strUserIdcardNum>\n" +
 | 
	
		
			
				|  |  | //                    "</root>";*/
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            /*//判断实名软证书是否已申请
 | 
	
		
			
				|  |  | //            String api = "XMCAF_SOFT_judgeRealNameSoftCertIsApplied";
 | 
	
		
			
				|  |  | //            String msgBody = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
 | 
	
		
			
				|  |  | //                    "<root>\n"+
 | 
	
		
			
				|  |  | //                    "    <strUserIdcardNum>123456</strUserIdcardNum>\n" +
 | 
	
		
			
				|  |  | //                    "</root>";*/
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            //修改实名软证书调用保护口令
 | 
	
		
			
				|  |  | //            String api = "XMCAF_SOFT_ModifyRealNameSoftCertCalledPasswd";
 | 
	
		
			
				|  |  | //            String msgBody = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
 | 
	
		
			
				|  |  | //                    "<root>\n"+
 | 
	
		
			
				|  |  | //                    "    <strUserIdcardNum>123456</strUserIdcardNum>\n" +
 | 
	
		
			
				|  |  | //                    "   <strOldCalledPasswd>12345678</strOldCalledPasswd>\n" +
 | 
	
		
			
				|  |  | //                    "   <strNewCalledPasswd>11111111</strNewCalledPasswd>\n" +
 | 
	
		
			
				|  |  | //                    "</root>";
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            //请求实名软证书并进行数字签名
 | 
	
		
			
				|  |  | //            /*String orgData = "测试数据";
 | 
	
		
			
				|  |  | //            String api = "XMCAF_SOFT_requestRealNameSoftCertAndSign";
 | 
	
		
			
				|  |  | //            String msgBody = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
 | 
	
		
			
				|  |  | //                    "<root>\n"+
 | 
	
		
			
				|  |  | //                    "   <strUserIdcardNum>123456</strUserIdcardNum>\n" +
 | 
	
		
			
				|  |  | //                    "   <strRealNameSoftCertCalledPasswd>11111111</strRealNameSoftCertCalledPasswd>\n" +
 | 
	
		
			
				|  |  | //                    "   <strOriginalData>"+ MD5Util.GetMD5Code(orgData)+"</strOriginalData>\n" +
 | 
	
		
			
				|  |  | //                    "</root>";*/
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            String msgHeader = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
 | 
	
		
			
				|  |  | //                    "<root>\n" +
 | 
	
		
			
				|  |  | //                    "   <serverName>"+api+"</serverName>\n" +
 | 
	
		
			
				|  |  | //                    "   <format>xml</format>\n" +
 | 
	
		
			
				|  |  | //                    "   <callOperator></callOperator>\n" +
 | 
	
		
			
				|  |  | //                    "   <certificate></certificate>\n" +
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //                    "   <srcIP>10.95.22.10</srcIP >\n" +
 | 
	
		
			
				|  |  | //                    "   <srcUserMac>60-D8-19-57-66-E3</srcUserMac>\n" +
 | 
	
		
			
				|  |  | //                    "   <srcSystemCode>1</srcSystemCode>\n" +
 | 
	
		
			
				|  |  | //                    "   <srcSystemName>厦门i健康</srcSystemName>\n" +
 | 
	
		
			
				|  |  | //                    "   <srcBusinessNodeCode>node01</srcBusinessNodeCode>\n" +
 | 
	
		
			
				|  |  | //                    "   <srcBusinessNodeName>审核</srcBusinessNodeName>\n" +
 | 
	
		
			
				|  |  | //                    "   <srcOperatorAccount>Zhuangsd</srcOperatorAccount>\n" +
 | 
	
		
			
				|  |  | //                    "   <srcBusinessStreamNO>11111</srcBusinessStreamNO>\n" +
 | 
	
		
			
				|  |  | //                    "   <srcDataExtProperty></srcDataExtProperty>\n" +
 | 
	
		
			
				|  |  | //                    "</root>";
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            Map<String, String> params = new HashMap<>();
 | 
	
		
			
				|  |  | //            params.put("msgBody", msgBody);
 | 
	
		
			
				|  |  | //            params.put("msgHeader", msgHeader);
 | 
	
		
			
				|  |  | //            System.out.print(WebserviceUtil.post(caUrl, caNamespace, "XMCA6_UnifiedCallInterface", params) + "\r\n");
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        catch (Exception ex)
 | 
	
		
			
				|  |  | //        {
 | 
	
		
			
				|  |  | //            ex.printStackTrace();
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 判断是否有实名证书
 | 
	
		
			
				|  |  |      **/
 | 
	
		
			
				|  |  |     public String isApplied(String strUserIdcardNum,String srcBusinessStreamNO)  throws Exception;
 | 
	
		
			
				|  |  | }
 |