| 
					
				 | 
			
			
				@ -1,12 +1,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.jw.patient.service.wechat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.wx.WxPayLogDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.wx.WxWechatDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.servicepackage.ServicePackageSignRecordDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.patient.PatientRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.XMLUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.wechat.WeiXinPayUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.wechat.dao.WechatDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.wechat.dao.WxPayLogDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.wechat.service.WxPayLogService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.collections.map.HashedMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -14,7 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@Service 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -26,6 +30,8 @@ public class WechatPayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ServicePackageSignRecordDao servicePackageSignRecordDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WxPayLogService wxPayLogService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WxPayLogDao wxPayLogDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -36,9 +42,10 @@ public class WechatPayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> unifiedorder(Map<String,String> par,String appKey) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String xml = WeiXinPayUtils.getXmlBeforUnifiedorder(par, appKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> map = WeiXinPayUtils.unifiedorder(xml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> map = WeiXinPayUtils.unifiedorder(xml,true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //创建日志记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wxPayLogService.createLog(par,xml,map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        map.remove("wxPayResult"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -118,6 +125,14 @@ public class WechatPayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            spsr.setStatus(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            servicePackageSignRecordDao.save(spsr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //操作微信日志表记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WxPayLogDO> wxPayLogDOs = wxPayLogDao.findBySeqNo(seqNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WxPayLogDO wxPayLogDO = wxPayLogDOs.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wxPayLogDO.setPayResponse(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wxPayLogDO.setPayStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wxPayLogDO.setPayTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wxPayLogDO.setPayStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wxPayLogService.save(wxPayLogDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("code","1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("message","支付成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 |