|
@ -3,6 +3,7 @@ package com.yihu.jw.order;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.JSONPObject;
|
|
|
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
|
|
|
import com.yihu.jw.entity.IntegerIdentityEntity;
|
|
|
import com.yihu.jw.entity.base.im.ConsultDo;
|
|
@ -32,9 +33,11 @@ import com.yihu.jw.order.pay.ylz.YlzPayService;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
|
|
|
import com.yihu.jw.util.common.BeanUtils;
|
|
|
import com.yihu.jw.util.common.QrcodeUtil;
|
|
|
import com.yihu.jw.util.common.XMLUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.wechat.WeiXinPayUtils;
|
|
|
import com.yihu.jw.utils.ByteToInputStream;
|
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
|
import com.yihu.jw.wechat.dao.WxPayLogDao;
|
|
@ -47,6 +50,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
import java.net.InetAddress;
|
|
|
import java.net.UnknownHostException;
|
|
|
import java.util.*;
|
|
@ -752,6 +756,23 @@ public class BusinessOrderService extends BaseJpaService {
|
|
|
String notifyUrl = hospitalSysDictDO.getDictCode();
|
|
|
response = ylzPayService.rechargeConsume("123456",businessOrderDO.getPatientName(),"01",ssc,"01",idcard,depositType,
|
|
|
price,price,businessOrderDO.getOrderNo(),idcard,"0",businessOrderDO.getPatientName(),businessOrderDO.getRematk(),openId,notifyUrl,notifyUrl,null);
|
|
|
if (depositType.equalsIgnoreCase("WX_QR")){
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if (object!=null){
|
|
|
JSONObject jsonObject = object.getJSONObject("param");
|
|
|
if (object.getString("respCode").equalsIgnoreCase("000000")){
|
|
|
InputStream qrcode = QrcodeUtil.createQrcode(jsonObject.getString("qrcode"),300,"jpg");
|
|
|
ByteToInputStream byteToInputStream = new ByteToInputStream();
|
|
|
String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
|
|
|
jsonObject.put("qrcodeUrl","data:image/png;base64,"+ QRCodeImg);
|
|
|
String traceNo = jsonObject.getString("traceNo");
|
|
|
businessOrderDO.setTraceNo(traceNo);
|
|
|
businessOrderDao.save(businessOrderDO);
|
|
|
}
|
|
|
response = object.toJSONString();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}else {
|
|
|
return "找不到订单!";
|
|
|
}
|
|
@ -759,6 +780,13 @@ public class BusinessOrderService extends BaseJpaService {
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public BusinessOrderDO selectStatus(String relationCode){
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
|
|
|
return businessOrderDO;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 易联众退款
|
|
|
* @param wechatId
|
|
@ -824,4 +852,35 @@ public class BusinessOrderService extends BaseJpaService {
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param traceNo
|
|
|
* @return
|
|
|
*/
|
|
|
public BusinessOrderDO updatePayStatus(String traceNo) throws Exception {
|
|
|
logger.info("入参:"+traceNo);
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByTraceNo(traceNo);
|
|
|
if (businessOrderDO==null){
|
|
|
throw new Exception("查不到订单!");
|
|
|
}
|
|
|
if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
|
|
|
ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
|
|
|
consultDo.setPayStatus(1);
|
|
|
consultOrderDao.save(consultDo);
|
|
|
}else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
|
|
|
wlyyOutpatientDO.setPayStatus(1);
|
|
|
outpatientDao.save(wlyyOutpatientDO);
|
|
|
} else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
|
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
|
wlyyPrescriptionDO.setPayStatus(1);
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
}
|
|
|
}
|
|
|
return businessOrderDO;
|
|
|
}
|
|
|
}
|