|
|
@@ -12,10 +12,8 @@ import com.alibaba.fastjson.TypeReference;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fs.app.annotation.Login;
|
|
|
import com.fs.app.controller.AppBaseController;
|
|
|
-import com.fs.common.config.FSSysConfig;
|
|
|
+import com.fs.app.pay.constant.PaymentTypeConstant;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
-import com.fs.common.core.domain.entity.SysUser;
|
|
|
-import com.fs.common.core.domain.model.LoginUser;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.*;
|
|
|
import com.fs.common.utils.ip.IpUtils;
|
|
|
@@ -24,6 +22,7 @@ import com.fs.erp.service.IErpOrderService;
|
|
|
import com.fs.factory.SnowflakeFactory;
|
|
|
import com.fs.his.domain.FsStoreOrderScrmComment;
|
|
|
import com.fs.his.domain.FsUser;
|
|
|
+import com.fs.his.dto.PayConfigDTO;
|
|
|
import com.fs.his.service.IFsStoreOrderScrmCommentService;
|
|
|
import com.fs.his.service.IFsUserService;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
@@ -39,16 +38,17 @@ import com.fs.hisStore.service.*;
|
|
|
import com.fs.hisStore.vo.*;
|
|
|
import com.fs.hospital580.entity.Hospital580PrescriptionScrmEntity;
|
|
|
import com.fs.hospital580.service.Hospital580PrescriptionScrmService;
|
|
|
-import com.fs.hospital580.vo.CacheOpenInformationVo;
|
|
|
import com.fs.huifuPay.domain.HuiFuCreateOrder;
|
|
|
import com.fs.huifuPay.domain.HuifuCreateOrderResult;
|
|
|
import com.fs.huifuPay.service.HuiFuService;
|
|
|
import com.fs.pay.pay.dto.OrderQueryDTO;
|
|
|
+import com.fs.pay.pay.dto.WxJspayDTO;
|
|
|
import com.fs.pay.service.IPayService;
|
|
|
import com.fs.store.config.StoreConfig;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.fs.utils.TwelveDigitSnowflake;
|
|
|
import com.fs.wx.miniapp.config.WxMaProperties;
|
|
|
+import com.fs.ybPay.domain.CreateWxOrderResult;
|
|
|
import com.fs.ybPay.domain.OrderResult;
|
|
|
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
|
|
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
|
@@ -63,7 +63,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
import org.redisson.api.RLock;
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
-import org.redisson.api.RLock;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -573,6 +572,13 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
return R.error(errorMsg);
|
|
|
}
|
|
|
|
|
|
+ String jsonPay=configService.selectConfigByKey("his.pay");
|
|
|
+ PayConfigDTO payConfigDTO= JSONUtil.toBean(jsonPay, PayConfigDTO.class);
|
|
|
+
|
|
|
+ if(payConfigDTO == null){
|
|
|
+ return R.error("支付配置不存在");
|
|
|
+ }
|
|
|
+
|
|
|
//新增的支付详情id
|
|
|
ArrayList<Long> paymentIds = new ArrayList<>();
|
|
|
for (FsStoreOrderScrm order : orders) {
|
|
|
@@ -678,55 +684,79 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
storePayment.setOpenId(fsStoreOrder.getRealName());
|
|
|
storePayment.setUserId(fsUser.getUserId());
|
|
|
|
|
|
- //支付
|
|
|
- HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
- o.setTradeType("T_MINIAPP");
|
|
|
- o.setOpenid(fsUser.getMaOpenId());
|
|
|
- o.setReqSeqId("store-" + storePayment.getPayCode());
|
|
|
- o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
- o.setGoodsDesc("商城订单支付");
|
|
|
- o.setAppId(param.getAppId());
|
|
|
- HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
- //创建订单
|
|
|
- if (result.getBank_code() != null && result.getBank_code().equals("00000000")) {
|
|
|
- for (Long paymentId : paymentIds) {
|
|
|
- FsStorePaymentScrm mt = new FsStorePaymentScrm();
|
|
|
- mt.setPaymentId(paymentId);
|
|
|
- mt.setTradeNo(result.getHf_seq_id());
|
|
|
- fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
- }
|
|
|
+ //获取支付配置
|
|
|
+
|
|
|
+ if(payConfigDTO.getType().equals(PaymentTypeConstant.HF)){
|
|
|
+ //支付
|
|
|
+ HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
+ o.setTradeType("T_MINIAPP");
|
|
|
+ o.setOpenid(fsUser.getMaOpenId());
|
|
|
+ o.setReqSeqId("store-" + storePayment.getPayCode());
|
|
|
+ o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
+ o.setGoodsDesc("商城订单支付");
|
|
|
+ o.setAppId(param.getAppId());
|
|
|
+ HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
+ //创建订单
|
|
|
+ if (result.getBank_code() != null && result.getBank_code().equals("00000000")) {
|
|
|
+ for (Long paymentId : paymentIds) {
|
|
|
+ FsStorePaymentScrm mt = new FsStorePaymentScrm();
|
|
|
+ mt.setPaymentId(paymentId);
|
|
|
+ mt.setTradeNo(result.getHf_seq_id());
|
|
|
+ fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
+ }
|
|
|
|
|
|
- String mes = result.getPay_info();
|
|
|
- JSONObject payInfo = JSONUtil.parseObj(mes);
|
|
|
- FsHuiFuPayInfo fsHuiFuPayInfo = new FsHuiFuPayInfo();
|
|
|
- if (payInfo.get("timeStamp") != null) {
|
|
|
- fsHuiFuPayInfo.setTimeStamp(payInfo.get("timeStamp").toString());
|
|
|
- }
|
|
|
- if (payInfo.get("package") != null) {
|
|
|
- fsHuiFuPayInfo.setPackageStr(payInfo.get("package").toString());
|
|
|
- }
|
|
|
- if (payInfo.get("paySign") != null) {
|
|
|
- fsHuiFuPayInfo.setPaySign(payInfo.get("paySign").toString());
|
|
|
+ String mes = result.getPay_info();
|
|
|
+ JSONObject payInfo = JSONUtil.parseObj(mes);
|
|
|
+ FsHuiFuPayInfo fsHuiFuPayInfo = new FsHuiFuPayInfo();
|
|
|
+ if (payInfo.get("timeStamp") != null) {
|
|
|
+ fsHuiFuPayInfo.setTimeStamp(payInfo.get("timeStamp").toString());
|
|
|
+ }
|
|
|
+ if (payInfo.get("package") != null) {
|
|
|
+ fsHuiFuPayInfo.setPackageStr(payInfo.get("package").toString());
|
|
|
+ }
|
|
|
+ if (payInfo.get("paySign") != null) {
|
|
|
+ fsHuiFuPayInfo.setPaySign(payInfo.get("paySign").toString());
|
|
|
|
|
|
- }
|
|
|
- if (payInfo.get("appId") != null) {
|
|
|
- fsHuiFuPayInfo.setAppId(payInfo.get("appId").toString());
|
|
|
+ }
|
|
|
+ if (payInfo.get("appId") != null) {
|
|
|
+ fsHuiFuPayInfo.setAppId(payInfo.get("appId").toString());
|
|
|
|
|
|
- }
|
|
|
- if (payInfo.get("signType") != null) {
|
|
|
- fsHuiFuPayInfo.setSignType(payInfo.get("signType").toString());
|
|
|
+ }
|
|
|
+ if (payInfo.get("signType") != null) {
|
|
|
+ fsHuiFuPayInfo.setSignType(payInfo.get("signType").toString());
|
|
|
|
|
|
+ }
|
|
|
+ if (payInfo.get("nonceStr") != null) {
|
|
|
+ fsHuiFuPayInfo.setNonceStr(payInfo.get("nonceStr").toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.ok().put("payType", param.getPayType()).put("result", fsHuiFuPayInfo);
|
|
|
+ } else {
|
|
|
+ return R.error(result.getResp_desc());
|
|
|
}
|
|
|
- if (payInfo.get("nonceStr") != null) {
|
|
|
- fsHuiFuPayInfo.setNonceStr(payInfo.get("nonceStr").toString());
|
|
|
+ }else if(payConfigDTO.getType().equals(PaymentTypeConstant.YB)){
|
|
|
+ WxJspayDTO p = new WxJspayDTO();
|
|
|
+ // 使用setter方法为对象赋值
|
|
|
+ p.setPayMoney(storePayment.getPayMoney().toString());
|
|
|
+ p.setLowOrderId("inquiry-"+storePayment.getPayCode());
|
|
|
+ p.setBody("商城订单支付");
|
|
|
+ p.setIsMinipg("1");
|
|
|
+ p.setOpenId(fsUser.getMaOpenId());
|
|
|
+ p.setAttach("");
|
|
|
+ p.setStoreid("0");
|
|
|
+ p.setAppId(param.getAppId());
|
|
|
+ CreateWxOrderResult wxOrder = ybPayService.createWxOrder(p);
|
|
|
+ if(wxOrder.getStatus().equals("100")){
|
|
|
+ for (Long paymentId : paymentIds) {
|
|
|
+ FsStorePaymentScrm mt = new FsStorePaymentScrm();
|
|
|
+ mt.setPaymentId(paymentId);
|
|
|
+ mt.setTradeNo(wxOrder.getUpOrderId());
|
|
|
+ fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
+ }
|
|
|
+ return R.ok().put("isPay",0).put("data",wxOrder).put("type",PaymentTypeConstant.YB);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-// return R.ok().put("payType",param.getPayType()).put("result",result.getPay_info());
|
|
|
- return R.ok().put("payType", param.getPayType()).put("result", fsHuiFuPayInfo);
|
|
|
- } else {
|
|
|
- return R.error(result.getResp_desc());
|
|
|
}
|
|
|
+
|
|
|
} else if (fsStoreOrder.getPayType().equals("3")) {
|
|
|
for (FsStoreOrderScrm order : orders) {
|
|
|
//货到付款
|