| 
					
				 | 
			
			
				@ -84,13 +84,12 @@ public class PayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 微信退款 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orderNo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param description 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> orderRefund(String patient,String orderNo,String description) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void orderRefund(String orderNo,String description) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WxWechatDO wxWechatDO = wechatDao.findById(wechatId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (wxWechatDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("this wechatId is null"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -99,7 +98,7 @@ public class PayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (businessOrderDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("this orderId not exit"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = patientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("this patient not exit"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -117,7 +116,7 @@ public class PayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        orderRefundDO.setAppId(wxWechatDO.getAppId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        orderRefundDO.setMchId(wxWechatDO.getMchId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        orderRefundDO.setOutRefundNo("CARE"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        orderRefundDO.setPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        orderRefundDO.setPatient(businessOrderDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        orderRefundDO.setPatientName(patientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        orderRefundDO.setRefundDesc(description); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        orderRefundDO = orderRefundDao.save(orderRefundDO); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -125,11 +124,11 @@ public class PayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer refundPrice1 = orderRefundDO.getRefundPrice().intValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> map = businessOrderService.refund(wechatId,orderRefundDO.getOrderNo(),orderRefundDO.getOutRefundNo(),orderPrice.toString(),refundPrice1.toString(),orderRefundDO.getRefundDesc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("map"+map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        addHttpLog("1",businessOrderDO.getOrderNo(),null,map.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (map.get("return_code").toString().equalsIgnoreCase("SUCCESS")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //退款申请提交成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception(map.get("return_msg").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -204,7 +203,7 @@ public class PayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (businessOrderDO.getStatus()!=0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError("待支付订单才能支付",-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDO.setOrderNo(getOrderNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String noceStr = WxpayUtil.getNonceStr(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 组装统一下单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SortedMap<String, String> reqMap = new TreeMap<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -249,6 +248,7 @@ public class PayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            businessOrderDao.save(businessOrderDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getSuccess("下单成功",fastdfs_file_url+fileUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError(map.get("return_msg"),-1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -262,7 +262,7 @@ public class PayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop wxWapPay(String relationId,Integer orderId,String patientId,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop wxWapPay(String relationId,Integer orderId,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BusinessOrderDO businessOrderDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtil.isBlank(relationId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            businessOrderDO = businessOrderDao.findOne(orderId); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -273,7 +273,8 @@ public class PayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (businessOrderDO.getStatus()!=0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError("待支付订单才能支付",-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = patientDao.findById(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDO.setOrderNo(getOrderNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String noceStr = WxpayUtil.getNonceStr(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 组装统一下单信息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -324,6 +325,7 @@ public class PayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String paySign = WxpayUtil.createSign(payMap, apiKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        payMap.put("paySign", paySign); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.error("【微信支付】WAP支付订单信息:{}", payMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDao.save(businessOrderDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ObjEnvelop.getSuccess("下单成功",payMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -373,11 +375,15 @@ public class PayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDO.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDO.setStatus(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDO.setOrderNo(""+System.currentTimeMillis()+(int)(Math.random()*900)+100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDO.setOrderNo(getOrderNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDO.setUploadStatus(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDO.setPayType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderDO.setPayPrice(Double.valueOf(price)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderService.save(businessOrderDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return businessOrderDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getOrderNo(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ""+System.currentTimeMillis()+(int)(Math.random()*900)+100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |