|  | @ -47,7 +47,6 @@ import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.wechat.WeiXinPayUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.ByteToInputStream;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.StringUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.BasePatientWechatDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.WechatDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.WxPayLogDao;
 | 
	
	
		
			
				|  | @ -385,7 +384,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |         String appCallBack = businessOrderDO.getAppCallbackUrl();
 | 
	
		
			
				|  |  |         String url = wxWechatDO.getBaseUrl();
 | 
	
		
			
				|  |  |         String notifyUrl =url;
 | 
	
		
			
				|  |  |         Map<String,Object> map = unifiedorder(wechatId,description,businessOrderDO.getPayPrice().toString(),WeChatConfig.TRADE_TYPE_JSAPI,openId,orderNo,notifyUrl);
 | 
	
		
			
				|  |  |         Map<String,Object> map = unifiedorder(wechatId,description,businessOrderDO.getPayPrice().toString(),WeChatConfig.TRADE_TYPE_JSAPI,openId,orderNo,notifyUrl,patient);
 | 
	
		
			
				|  |  |         String doctorId = "";
 | 
	
		
			
				|  |  |         if (doctorMappingDO!=null){
 | 
	
		
			
				|  |  |             doctorId = doctorMappingDO.getMappingCode();
 | 
	
	
		
			
				|  | @ -451,12 +450,11 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |         if (!StringUtils.isNoneBlank(tradeType)){
 | 
	
		
			
				|  |  |             tradeType=WeChatConfig.TRADE_TYPE_JSAPI;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String url = wxWechatDO.getBaseUrl();
 | 
	
		
			
				|  |  |         String notifyUrl =url;
 | 
	
		
			
				|  |  |         Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |         if (payFlag){
 | 
	
		
			
				|  |  |             map = unifiedorder(wechatId,body,totalFee,tradeType,openid,ourTradeNo,notifyUrl);
 | 
	
		
			
				|  |  |             map = unifiedorder(wechatId,body,totalFee,tradeType,openid,ourTradeNo,notifyUrl,patient);
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             updatePayStatusByRelation(relationCode,wechatId);
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -475,7 +473,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public  Map<String,Object> unifiedorder(String wechatId,String body,String totalFee,String tradeType,String openId,String ourTradeNo,String notifyUrl) throws Exception {
 | 
	
		
			
				|  |  |     public  Map<String,Object> unifiedorder(String wechatId,String body,String totalFee,String tradeType,String openId,String ourTradeNo,String notifyUrl,String code) throws Exception {
 | 
	
		
			
				|  |  |         WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
 | 
	
		
			
				|  |  |         if(wxWechatDO==null){
 | 
	
		
			
				|  |  |             throw new Exception("can't find wechat:the wxId is "+wechatId);
 | 
	
	
		
			
				|  | @ -517,6 +515,12 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |         if (tradeType.equalsIgnoreCase("JSAPI")){
 | 
	
		
			
				|  |  |             map.put("openid", openId);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (tradeType.equalsIgnoreCase("APPLETS")){
 | 
	
		
			
				|  |  |             BasePatientDO patientDO = patientDao.findById(code);
 | 
	
		
			
				|  |  |             if (patientDO!=null){
 | 
	
		
			
				|  |  |                 map.put("openid",patientDO.getOpenid());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String wapUrl = "";
 | 
	
		
			
				|  |  |         String wapName = "";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
	
		
			
				|  | @ -796,6 +800,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |                         WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
 | 
	
		
			
				|  |  |                         wlyyOutpatientDO.setPayStatus(1);
 | 
	
		
			
				|  |  |                         outpatientDao.save(wlyyOutpatientDO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
 | 
	
		
			
				|  |  |                     WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
 | 
	
	
		
			
				|  | @ -888,11 +893,11 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |             wxPayLogDO.setPayTime(new Date());
 | 
	
		
			
				|  |  |             wxPayLogDO.setPayStatus(1);
 | 
	
		
			
				|  |  |             wxPayLogDao.save(wxPayLogDO);
 | 
	
		
			
				|  |  |             rs.put("code","1");
 | 
	
		
			
				|  |  |             rs.put("message","支付成功");
 | 
	
		
			
				|  |  |             rs.put("return_code","SUCCESS");
 | 
	
		
			
				|  |  |             rs.put("return_msg","OK");
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             rs.put("code","-1");
 | 
	
		
			
				|  |  |             rs.put("return_msg","FAIL");
 | 
	
		
			
				|  |  |             rs.put("return_code","FAIL");
 | 
	
		
			
				|  |  |             rs.put("return_msg","OK");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -1667,9 +1672,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
 | 
	
		
			
				|  |  |         String url = wxWechatDO.getBaseUrl();
 | 
	
		
			
				|  |  |         String notifyUrl =url;
 | 
	
		
			
				|  |  |         String price = (int)(businessOrderDO.getPayPrice()*100)+"";
 | 
	
		
			
				|  |  |         map = unifiedorder(wechatId,businessOrderDO.getDescription(),price,wxPayType,patientWechatDoList.get(0).getOpenid(),businessOrderDO.getOrderNo(),notifyUrl);
 | 
	
		
			
				|  |  |         map = unifiedorder(wechatId,businessOrderDO.getDescription(),price,wxPayType,patientWechatDoList.get(0).getOpenid(),businessOrderDO.getOrderNo(),notifyUrl,patientId);
 | 
	
		
			
				|  |  |         logger.info("success="+JSONObject.toJSONString(map));
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |