| 
					
				 | 
			
			
				@ -1,12 +1,13 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.jw.hospital.prescription.service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseOrgDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.prescription.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.util.SFUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.org.dao.BaseOrgDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.sfutils.HttpClientUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.sfutils.SHAUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -19,6 +20,7 @@ import org.dom4j.Element; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.orm.jpa.JpaTransactionManager; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.transaction.TransactionDefinition; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -38,12 +40,15 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //顺丰快递接口请求地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${express.sf_url}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String sf_url; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //顺丰快递接口接入编码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${express.sf_code}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String sf_code; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //顺丰快递接口checkword 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${express.sf_check_word}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String sf_check_word; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -73,6 +78,9 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private OutpatientDao outpatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BasePatientDao basePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private SfConfigDao sfConfigDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -98,12 +106,12 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        params.add(new BasicNameValuePair("xml", xml)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        params.add(new BasicNameValuePair("verifyCode", verifyCode)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject j =  addOrder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        j.put("xml",xml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        j.put("verifyCode",verifyCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        JSONObject j =  addOrder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        j.put("xml",xml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        j.put("verifyCode",verifyCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String re = HttpClientUtils.doPost(sf_url, j.toJSONString(), ContentType.APPLICATION_JSON); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return re; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String re = HttpClientUtils.doPost(sf_url, j.toJSONString(), ContentType.APPLICATION_JSON); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -197,56 +205,20 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //获取医生所处的医院详细地址,作为寄件人地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(sfexpress_obj.getOutpatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseOrgDO hospital = baseOrgDao.findByCode(outpatientDO.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String xml = SFUtils.postSFOrderService(sfexpress_obj,hospital,sf_code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("顺丰快递下订单:xml"+xml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String re = this.SFExpressPost(xml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String re = "<Response service=\"OrderService\"><Head>OK</Head><Body><OrderResponse filter_result=\"2\" destcode=\"592\" mailno=\"444844978335\" origincode=\"592\" orderid=\"6daa6baec5fd4b65a1b023a8b60e2e91\"/></Body></Response>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject params = SFUtils.postSFOrderServiceV2(sfexpress_obj,hospital,basePatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String re = this.SFExpressPostV2(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //xml验证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("顺丰快递下订单:re"+re); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        verificationResponXml(re,"向顺丰快递下订单失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        verificationResponV2(re); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Document doc = DocumentHelper.parseText(re); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String headvalue = doc.selectSingleNode("/Response/Head").getText(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(headvalue) && "OK".equals(headvalue)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Element root = doc.getRootElement(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (root.element("Body") != null)     //包含OrderResponse节点 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                root = root.element("Body"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //是否能派送:1:人工确认;2:可收派;3:不可以收派 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String filter_result = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String orderid = "";//业务订单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String mailno = "";//顺丰运单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String destCode = "";//目的地区域代码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<?> child = root.elements(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Object o : child) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Element e = (Element) o; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                filter_result = e.attributeValue("filter_result"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                orderid = e.attributeValue("orderid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mailno = e.attributeValue("mailno"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                destCode = e.attributeValue("destcode"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(filter_result) && "1".equals(filter_result)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("顺丰快递下订单失败:派送地址需人工审核,门诊编号:"+sfexpress_obj.getOutpatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new Exception("顺丰快递下订单失败:派送地址需人工审核"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject respone = JSONObject.parseObject(re); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(filter_result) && "3".equals(filter_result)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("顺丰快递下订单失败:派送地址不可派送,门诊编号:"+sfexpress_obj.getOutpatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new Exception("顺丰快递下订单失败:派送地址不可派送"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isBlank(mailno)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("顺丰快递下订单失败:未获取到快递单号!门诊编号:"+sfexpress_obj.getOutpatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new Exception("顺丰快递下订单失败:未获取到快递单号!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sfexpress_obj.setMailno(mailno); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sfexpress_obj.setCityCode(destCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String mailno = "";//顺丰运单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        mailno = respone.getJSONObject("result").getJSONArray("successResult").getJSONObject(0).getString("mailNo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sfexpress_obj.setMailno(mailno); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return sfexpress_obj; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -740,58 +712,53 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionLog.setFlag(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientExpressageLogDao.save(prescriptionLog); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject addOrder(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String json = "{" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    \"orderThirds\": [" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "        {" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"bspOrderNo\": \"jkzltest05\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"depositumInfo\": \"西瓜\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"depositumNo\": \"3\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"destAddress\": \"白石龙一区175栋\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"destCity\": \"深圳市\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"destDistrict\": \"龙华新区\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"destName\": \"梁飞\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"destPhone\": \"15986618684\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"destProvince\": \"广东省\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"expressType\": \"1\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"hospitalCode\": \"\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"monthlyCard\": \"\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"orderDate\": 1561363194848," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"packagesNo\": 1," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"parcelWeighs\": \"10\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"patientIdentityCardNo\": \"411081199102201259\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"patientName\": \"佩奇\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"patientPhone\": \"15113149999\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"payMethod\": 1," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"remark\": \"备注\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"srcAddress\": \"中山大道\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"srcCity\": \"上海市\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"srcDistrict\": \"黄浦区\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"srcName\": \"佩奇\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"srcPhone\": \"15113149999\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"productCode\": \"OTHER\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "            \"srcProvince\": \"上海市\"" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "        }" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    ]" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject j = JSON.parseObject(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 组装请求参数,发送请求 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param params 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String SFExpressPostV2(JSONObject params)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("version","1.0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("timestamp",new Date().getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sign = SHAUtils.SHA512(params.toJSONString()+sf_check_word); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String url =sf_url+"/api/open/api/addOrder?hospitalCode="+sf_code+"&sign="+sign; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("顺丰快递下订单:sf_url"+url); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("顺丰快递下订单:params"+params.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String re = HttpClientUtils.doPost(url, params.toJSONString(), ContentType.APPLICATION_JSON); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return re; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void test()throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject j =  addOrder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        j.put("version","1.0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        j.put("timestamp",new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sign = SHAUtils.SHA512(j.toJSONString()+"AAAABBBBCCCCDDDD"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String hospitalCode = "HD000001"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String url ="http://mrds-admin-ci.sit.sf-express.com:45478/api/open/api/addOrder?hospitalCode="+hospitalCode+"&sign="+sign; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String rs = HttpClientUtils.doPost(url,j.toJSONString(), ContentType.APPLICATION_JSON); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        System.out.println(rs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 校验返回的报文 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param response 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private void verificationResponV2(String response) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String error = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(response)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 如果返回的XML报文为空,请求也算失败 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存http日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            error = "返回的报文为空!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject object = JSONObject.parseObject(response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//          报错的报文示例<Response service="ScopeService"><Head>ERR</Head><ERROR code="8014">校验码错误 </ERROR></Response> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean success = object.getBoolean("success"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String message = object.getString("message"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(message) && !success){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //错误代码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String errorCode = object.getString("code"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                error = "顺丰快递接口请求失败:"+errorCode+","+message; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new Exception(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    public JSONObject addSFOrder(WlyyPrescriptionExpressageDO expressageDO){ 
			 |