|  | @ -4,6 +4,10 @@ package com.yihu.jw.care.service.pay;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.node.ObjectNode;
 | 
	
		
			
				|  |  | import com.yihu.fastdfs.FastDFSUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.doorCoach.BaseDoorCoachFeeDetailDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.doorCoach.BaseDoorCoachOrderDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.lifeCare.LifeCareFeeDetailDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.lifeCare.LifeCareOrderDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.pay.WxPayHttpLogDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.lifeCare.LifeCareOrderService;
 | 
	
	
		
			
				|  | @ -12,31 +16,35 @@ import com.yihu.jw.care.util.XMLUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.wx.WxWechatDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.common.WxPayHttpLogDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachFeeDetailDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.lifeCare.LifeCareFeeDetailDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.order.BusinessOrderDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.order.BusinessOrderRefundDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.BusinessOrderService;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.dao.BusinessOrderDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.dao.BusinessOrderRefundDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.ResponseContant;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.IpUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.QrcodeUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.StringUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.WechatDao;
 | 
	
		
			
				|  |  | 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.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | import org.springframework.util.Assert;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import javax.servlet.http.HttpServletRequest;
 | 
	
		
			
				|  |  | import java.io.InputStream;
 | 
	
		
			
				|  |  | import java.util.Date;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | import java.util.SortedMap;
 | 
	
		
			
				|  |  | import java.util.TreeMap;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import static jxl.biff.FormatRecord.logger;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -78,17 +86,174 @@ public class PayService {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private LifeCareOrderService lifeCareOrderService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private LifeCareOrderDao lifeCareOrderDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PatientDoorCoachOrderService doorCoachOrderService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseDoorCoachOrderDao baseDoorCoachOrderDao;
 | 
	
		
			
				|  |  |     @Value("${fastDFS.fastdfs_file_url}")
 | 
	
		
			
				|  |  |     private String fastdfs_file_url;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private JdbcTemplate jdbcTemplate;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private LifeCareFeeDetailDao lifeCareFeeDetailDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseDoorCoachFeeDetailDao doorCoachFeeDetailDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 微信退款
 | 
	
		
			
				|  |  |      * 顶部状态栏订单各分类总条数
 | 
	
		
			
				|  |  |      * 0待支付、1已支付、2已取消、3申请退款中、4已售后
 | 
	
		
			
				|  |  |      * @param patient
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Map<String, Integer> topStatusBarNum(String patient) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = "SELECT a.`status`,COUNT(*) num from base_business_order_pay a  where patient = '"+patient+"' " +
 | 
	
		
			
				|  |  |                 "GROUP BY a.`status` " ;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         Map<String, Integer> map = new HashMap<>();
 | 
	
		
			
				|  |  |         //状态 0待支付、1已支付、2已取消、3申请退款中、4已售后
 | 
	
		
			
				|  |  |         map.put("0",0);
 | 
	
		
			
				|  |  |         map.put("1",0);
 | 
	
		
			
				|  |  |         map.put("2",0);
 | 
	
		
			
				|  |  |         map.put("3",0);
 | 
	
		
			
				|  |  |         map.put("4",0);
 | 
	
		
			
				|  |  |         int total = 0;
 | 
	
		
			
				|  |  |         if(list.size()>0){
 | 
	
		
			
				|  |  |             for (Map<String, Object> one:list){
 | 
	
		
			
				|  |  |                 map.put(String.valueOf(one.get("status")), Integer.valueOf(String.valueOf(one.get("num"))));
 | 
	
		
			
				|  |  |                 total+=Integer.valueOf(String.valueOf(one.get("num")));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         map.put("total", total);
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 居民我的订单列表
 | 
	
		
			
				|  |  |      * @param patient
 | 
	
		
			
				|  |  |      * @param status
 | 
	
		
			
				|  |  |      * @param page
 | 
	
		
			
				|  |  |      * @param size
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject orderList(String patient, String status, int page, int size) {
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         int start = 0 == page ? page++ : (page - 1) * size;
 | 
	
		
			
				|  |  |         int end = 0 == size ? 15 : size;
 | 
	
		
			
				|  |  |         String filter = " where patient = '"+patient+"' ";
 | 
	
		
			
				|  |  |         if(!StringUtil.isEmpty(status)){
 | 
	
		
			
				|  |  |             filter += " and status = "+ status +" ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = "select a.id,a.patient,a.patient_name patientName,a.order_no orderNo,a.status, " +
 | 
	
		
			
				|  |  |                 "DATE_FORMAT(a.create_time,'%Y-%m-%d %H:%i:%s') createTime " +
 | 
	
		
			
				|  |  |                 ",a.order_category orderCategory,a.relation_code relationCode,a.relation_name relationName " +
 | 
	
		
			
				|  |  |                 ",a.pay_type payType,a.pay_price payPrice from base_business_order_pay a " + filter ;
 | 
	
		
			
				|  |  |          sql += " ORDER BY a.create_time desc " +
 | 
	
		
			
				|  |  |                 " LIMIT {start},{end};";
 | 
	
		
			
				|  |  |         String finalSql = sql.replace("{start}", String.valueOf(start))
 | 
	
		
			
				|  |  |                 .replace("{end}", String.valueOf(end));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String countSql = "SELECT  count(a.id)  FROM  base_business_order_pay a" + filter ;
 | 
	
		
			
				|  |  |         List<Map<String,Object>> sqlResultlist;
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             sqlResultlist = jdbcTemplate.queryForList(finalSql);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultFlag, ResponseContant.fail);
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultMsg, "从数据库查询工单列表信息失败");
 | 
	
		
			
				|  |  |             return result;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Long count;
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             count = jdbcTemplate.queryForObject(countSql, Long.class);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultFlag, ResponseContant.fail);
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultMsg, "从数据库统计工单数量失败" );
 | 
	
		
			
				|  |  |             return result;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         result.put(ResponseContant.resultFlag, ResponseContant.success);
 | 
	
		
			
				|  |  |         result.put(ResponseContant.resultMsg, sqlResultlist);
 | 
	
		
			
				|  |  |         JSONObject countItem = new JSONObject();
 | 
	
		
			
				|  |  |         countItem.put("count", count);
 | 
	
		
			
				|  |  |         result.putAll(countItem);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 订单详情接口
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject orderInfo(Integer id){
 | 
	
		
			
				|  |  |         JSONObject resJson = new JSONObject();
 | 
	
		
			
				|  |  |         resJson.put("id",id);
 | 
	
		
			
				|  |  |         BusinessOrderDO businessOrderDO = businessOrderDao.findOne(id);
 | 
	
		
			
				|  |  |         String type = businessOrderDO.getOrderCategory();
 | 
	
		
			
				|  |  |         resJson.put("orderCategory",type);
 | 
	
		
			
				|  |  |         resJson.put("orderNo",businessOrderDO.getOrderNo());
 | 
	
		
			
				|  |  |         resJson.put("payPrice",businessOrderDO.getPayPrice());
 | 
	
		
			
				|  |  |         resJson.put("payTime", DateUtil.dateToStrLong(businessOrderDO.getPayTime()));
 | 
	
		
			
				|  |  |         resJson.put("createTime",DateUtil.dateToStrLong(businessOrderDO.getCreateTime()));
 | 
	
		
			
				|  |  |         resJson.put("status",businessOrderDO.getStatus());
 | 
	
		
			
				|  |  |         resJson.put("updateTime",DateUtil.dateToStrLong(businessOrderDO.getUpdateTime()));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if("3".equals(type)){
 | 
	
		
			
				|  |  |             List<BaseDoorCoachFeeDetailDO> feeDetailDOList = doorCoachFeeDetailDao.findByOrderId(businessOrderDO.getRelationCode());
 | 
	
		
			
				|  |  |             resJson.put("fees",feeDetailDOList);
 | 
	
		
			
				|  |  |         }else if("4".equals(type)){
 | 
	
		
			
				|  |  |             List<LifeCareFeeDetailDO> feeDetailDOList = lifeCareFeeDetailDao.findByOrderId(businessOrderDO.getRelationCode());
 | 
	
		
			
				|  |  |             resJson.put("fees",feeDetailDOList);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return resJson;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void applyRefund(Integer id,String content,String imgs){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 取消订单
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String cancleOrder(Integer id){
 | 
	
		
			
				|  |  |         BusinessOrderDO businessOrderDO = businessOrderDao.findOne(id);
 | 
	
		
			
				|  |  |         if(businessOrderDO.getStatus()==0){
 | 
	
		
			
				|  |  |             String type = businessOrderDO.getOrderCategory();
 | 
	
		
			
				|  |  |             String orderId = businessOrderDO.getRelationCode();
 | 
	
		
			
				|  |  |             if("3".equals(type)){
 | 
	
		
			
				|  |  |                 BaseDoorCoachOrderDO orderDO = baseDoorCoachOrderDao.findOne(orderId);
 | 
	
		
			
				|  |  |                 if(orderDO.getStatus()==0){
 | 
	
		
			
				|  |  |                     orderDO.setStatus(-1);
 | 
	
		
			
				|  |  |                     baseDoorCoachOrderDao.save(orderDO);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else if("4".equals(type)){
 | 
	
		
			
				|  |  |                 LifeCareOrderDO orderDO = lifeCareOrderDao.findOne(orderId);
 | 
	
		
			
				|  |  |                 if(orderDO.getStatus()==0){
 | 
	
		
			
				|  |  |                     orderDO.setStatus(-1);
 | 
	
		
			
				|  |  |                     lifeCareOrderDao.save(orderDO);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             businessOrderDO.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |             businessOrderDao.save(businessOrderDO);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             return "只有待支付的订单才能取消";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 微信退款
 | 
	
		
			
				|  |  |      * @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");
 | 
	
	
		
			
				|  | @ -97,7 +262,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");
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -115,7 +280,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);
 | 
	
	
		
			
				|  | @ -123,11 +288,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;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -180,6 +345,8 @@ public class PayService {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         orderDO.setStatus(1);
 | 
	
		
			
				|  |  |         orderDO.setPayType(1);
 | 
	
		
			
				|  |  |         orderDO.setPayTime(new Date());
 | 
	
		
			
				|  |  |         businessOrderDao.save(orderDO);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -232,7 +399,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<>();
 | 
	
	
		
			
				|  | @ -277,7 +444,8 @@ public class PayService {
 | 
	
		
			
				|  |  |             } catch (Exception e) {
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             return ObjEnvelop.getSuccess("下单成功",serverUrl+fileUrl);
 | 
	
		
			
				|  |  |             businessOrderDao.save(businessOrderDO);
 | 
	
		
			
				|  |  |             return ObjEnvelop.getSuccess("下单成功",fastdfs_file_url+fileUrl);
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             return ObjEnvelop.getError(map.get("return_msg"),-1);
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -290,7 +458,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);
 | 
	
	
		
			
				|  | @ -301,7 +469,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();
 | 
	
		
			
				|  |  |         // 组装统一下单信息
 | 
	
	
		
			
				|  | @ -352,6 +521,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);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -401,11 +571,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;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |