|
@@ -2,41 +2,30 @@ package com.fs.app.controller;
|
|
|
|
|
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
|
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
|
-
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.TypeReference;
|
|
import com.alibaba.fastjson.TypeReference;
|
|
import com.fs.app.annotation.Login;
|
|
import com.fs.app.annotation.Login;
|
|
-import com.fs.common.annotation.Log;
|
|
|
|
-import com.fs.common.annotation.RepeatSubmit;
|
|
|
|
-
|
|
|
|
import com.fs.common.config.FSSysConfig;
|
|
import com.fs.common.config.FSSysConfig;
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
-import com.fs.common.enums.BusinessType;
|
|
|
|
import com.fs.common.exception.CustomException;
|
|
import com.fs.common.exception.CustomException;
|
|
-import com.fs.common.utils.*;
|
|
|
|
|
|
+import com.fs.common.utils.IpUtil;
|
|
|
|
+import com.fs.common.utils.ParseUtils;
|
|
|
|
+import com.fs.common.utils.ServletUtils;
|
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
import com.fs.common.utils.ip.IpUtils;
|
|
import com.fs.common.utils.ip.IpUtils;
|
|
|
|
+import com.fs.erp.service.IErpOrderService;
|
|
import com.fs.huifuPay.domain.HuiFuCreateOrder;
|
|
import com.fs.huifuPay.domain.HuiFuCreateOrder;
|
|
import com.fs.huifuPay.domain.HuifuCreateOrderResult;
|
|
import com.fs.huifuPay.domain.HuifuCreateOrderResult;
|
|
import com.fs.huifuPay.service.HuiFuService;
|
|
import com.fs.huifuPay.service.HuiFuService;
|
|
-import com.fs.pay.pay.config.PayConfig;
|
|
|
|
-import com.fs.pay.pay.domain.CreateWxOrderResult;
|
|
|
|
import com.fs.pay.pay.domain.OrderResult;
|
|
import com.fs.pay.pay.domain.OrderResult;
|
|
import com.fs.pay.pay.dto.OrderQueryDTO;
|
|
import com.fs.pay.pay.dto.OrderQueryDTO;
|
|
-import com.fs.pay.pay.dto.WxJspayDTO;
|
|
|
|
import com.fs.pay.pay.service.PayService;
|
|
import com.fs.pay.pay.service.PayService;
|
|
-import com.fs.pay.pay.service.impl.PayApiServiceImpl;
|
|
|
|
-import com.fs.pay.service.dto.PayQueryDTO;
|
|
|
|
-import com.fs.store.domain.*;
|
|
|
|
-import com.fs.system.domain.SysConfig;
|
|
|
|
-import com.fs.wx.miniapp.config.WxMaConfiguration;
|
|
|
|
-import com.fs.wx.miniapp.config.WxMaProperties;
|
|
|
|
-import com.fs.wx.pay.config.WxPayProperties;
|
|
|
|
-import com.fs.erp.service.IErpOrderService;
|
|
|
|
|
|
+import com.fs.pay.service.IPayService;
|
|
import com.fs.store.config.StoreConfig;
|
|
import com.fs.store.config.StoreConfig;
|
|
-
|
|
|
|
|
|
+import com.fs.store.domain.*;
|
|
import com.fs.store.dto.FsStoreOrderComputeDTO;
|
|
import com.fs.store.dto.FsStoreOrderComputeDTO;
|
|
import com.fs.store.enums.OrderInfoEnum;
|
|
import com.fs.store.enums.OrderInfoEnum;
|
|
import com.fs.store.mapper.FsStorePaymentMapper;
|
|
import com.fs.store.mapper.FsStorePaymentMapper;
|
|
@@ -44,26 +33,20 @@ import com.fs.store.param.*;
|
|
import com.fs.store.service.*;
|
|
import com.fs.store.service.*;
|
|
import com.fs.store.vo.FsMyStoreOrderListQueryVO;
|
|
import com.fs.store.vo.FsMyStoreOrderListQueryVO;
|
|
import com.fs.store.vo.FsStoreOrderItemVO;
|
|
import com.fs.store.vo.FsStoreOrderItemVO;
|
|
-import com.fs.pay.service.IPayService;
|
|
|
|
-import com.fs.pay.service.dto.CreatePayDTO;
|
|
|
|
-import com.fs.pay.service.dto.PayDTO;
|
|
|
|
-import com.fs.pay.service.dto.TradeOrder;
|
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
import com.fs.system.service.ISysConfigService;
|
|
-import com.github.binarywang.wxpay.bean.entpay.EntPayResult;
|
|
|
|
|
|
+import com.fs.wx.miniapp.config.WxMaConfiguration;
|
|
|
|
+import com.fs.wx.miniapp.config.WxMaProperties;
|
|
|
|
+import com.fs.wx.pay.config.WxPayProperties;
|
|
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
|
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
|
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
import com.github.binarywang.wxpay.config.WxPayConfig;
|
|
import com.github.binarywang.wxpay.config.WxPayConfig;
|
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
-import com.github.binarywang.wxpay.service.EntPayService;
|
|
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
-import com.google.gson.Gson;
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
-import lombok.Synchronized;
|
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
-import org.apache.catalina.servlets.DefaultServlet;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -78,8 +61,6 @@ import java.util.*;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
@Api("商城接口")
|
|
@Api("商城接口")
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping(value="/app/storeOrder")
|
|
@RequestMapping(value="/app/storeOrder")
|
|
@@ -241,7 +222,6 @@ public class StoreOrderController extends AppBaseController {
|
|
//@Synchronized
|
|
//@Synchronized
|
|
public R pay(HttpServletRequest request, @Validated @RequestBody FsStoreOrderPayParam param)
|
|
public R pay(HttpServletRequest request, @Validated @RequestBody FsStoreOrderPayParam param)
|
|
{
|
|
{
|
|
- logger.info("zzf \n【pay】:"+param.getOrderId()+"的订单支付类型为"+param.getPayType());
|
|
|
|
FsStoreOrder order=orderService.selectFsStoreOrderById(param.getOrderId());
|
|
FsStoreOrder order=orderService.selectFsStoreOrderById(param.getOrderId());
|
|
if(order==null){
|
|
if(order==null){
|
|
return R.error("订单不存在");
|
|
return R.error("订单不存在");
|
|
@@ -259,6 +239,7 @@ public class StoreOrderController extends AppBaseController {
|
|
//已改价处理
|
|
//已改价处理
|
|
if(order.getIsEditMoney()!=null&&order.getIsEditMoney()==1){
|
|
if(order.getIsEditMoney()!=null&&order.getIsEditMoney()==1){
|
|
//改过价不做处理
|
|
//改过价不做处理
|
|
|
|
+
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
String config=configService.selectConfigByKey("store.config");
|
|
String config=configService.selectConfigByKey("store.config");
|
|
@@ -285,7 +266,6 @@ public class StoreOrderController extends AppBaseController {
|
|
}
|
|
}
|
|
String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
// order.setOrderCode(orderCode);
|
|
// order.setOrderCode(orderCode);
|
|
- //易宝支付
|
|
|
|
if(order.getPayType().equals("1")||order.getPayType().equals("2")){
|
|
if(order.getPayType().equals("1")||order.getPayType().equals("2")){
|
|
String json = configService.selectConfigByKey("store.pay");
|
|
String json = configService.selectConfigByKey("store.pay");
|
|
FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
|
|
FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
|
|
@@ -306,29 +286,6 @@ public class StoreOrderController extends AppBaseController {
|
|
storePayment.setOrderId(order.getId());
|
|
storePayment.setOrderId(order.getId());
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
|
|
|
-// //创建订单
|
|
|
|
-// WxJspayDTO p = new WxJspayDTO();
|
|
|
|
-// // 使用setter方法为对象赋值
|
|
|
|
-// p.setPayMoney(order.getPayMoney().toString());
|
|
|
|
-// p.setLowOrderId("store-"+payCode);
|
|
|
|
-// p.setBody("商城订单支付");
|
|
|
|
-// p.setIsMinipg("1");
|
|
|
|
-// p.setReturnUrl(PayConfig.notifyUrl);
|
|
|
|
-// p.setOpenId(user.getMaOpenId());
|
|
|
|
-// p.setAttach("");
|
|
|
|
-// p.setStoreid("0");
|
|
|
|
-// CreateWxOrderResult wxOrder = ybPayService.createWxOrder(p);
|
|
|
|
-// if(wxOrder.getStatus().equals("100")){
|
|
|
|
-// FsStorePayment ment=new FsStorePayment();
|
|
|
|
-// ment.setPaymentId(storePayment.getPaymentId());
|
|
|
|
-// ment.setTradeNo(wxOrder.getUpOrderId());
|
|
|
|
-// fsStorePaymentMapper.updateFsStorePayment(ment);
|
|
|
|
-// redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
|
|
-// return R.ok().put("payType",param.getPayType()).put("result",wxOrder.getPay_info());
|
|
|
|
-// }
|
|
|
|
-// else{
|
|
|
|
-// return R.error(wxOrder.getMessage());
|
|
|
|
-// }
|
|
|
|
if (fsPayConfig.getType().equals("hf")){
|
|
if (fsPayConfig.getType().equals("hf")){
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
o.setTradeType("T_MINIAPP");
|
|
o.setTradeType("T_MINIAPP");
|
|
@@ -337,7 +294,7 @@ public class StoreOrderController extends AppBaseController {
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
o.setGoodsDesc("商城订单支付");
|
|
o.setGoodsDesc("商城订单支付");
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
- if(result.getBank_code()!=null&&result.getBank_code().equals("00000000")){
|
|
|
|
|
|
+ if(result.getResp_code()!=null&&(result.getResp_code().equals("00000000")||result.getResp_code().equals("00000100"))){
|
|
FsStorePayment mt=new FsStorePayment();
|
|
FsStorePayment mt=new FsStorePayment();
|
|
mt.setPaymentId(storePayment.getPaymentId());
|
|
mt.setPaymentId(storePayment.getPaymentId());
|
|
mt.setTradeNo(result.getHf_seq_id());
|
|
mt.setTradeNo(result.getHf_seq_id());
|
|
@@ -520,14 +477,17 @@ public class StoreOrderController extends AppBaseController {
|
|
o.setGoodsDesc("商城订单尾款支付");
|
|
o.setGoodsDesc("商城订单尾款支付");
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
//创建订单
|
|
//创建订单
|
|
- if(result.getBank_code()!=null&&result.getBank_code().equals("00000000")){
|
|
|
|
|
|
+ if(result.getResp_code()!=null&&(result.getResp_code().equals("00000000")||result.getResp_code().equals("00000100"))){
|
|
|
|
+
|
|
FsStorePayment mt=new FsStorePayment();
|
|
FsStorePayment mt=new FsStorePayment();
|
|
mt.setPaymentId(storePayment.getPaymentId());
|
|
mt.setPaymentId(storePayment.getPaymentId());
|
|
mt.setTradeNo(result.getHf_seq_id());
|
|
mt.setTradeNo(result.getHf_seq_id());
|
|
fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
- return R.ok().put("result",resultMap);
|
|
|
|
|
|
+ String s = (String) resultMap.get("package");
|
|
|
|
+ resultMap.put("packageValue",s);
|
|
|
|
+ return R.ok().put("payType",param.getPayType()).put("result",resultMap);
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
return R.error(result.getResp_desc());
|
|
return R.error(result.getResp_desc());
|
|
@@ -635,13 +595,16 @@ public class StoreOrderController extends AppBaseController {
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
o.setGoodsDesc("商城订单支付");
|
|
o.setGoodsDesc("商城订单支付");
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
- if(result.getBank_code()!=null&&result.getBank_code().equals("00000000")){
|
|
|
|
|
|
+ if(result.getResp_code()!=null&&(result.getResp_code().equals("00000000")||result.getResp_code().equals("00000100"))){
|
|
|
|
+
|
|
FsStorePayment mt=new FsStorePayment();
|
|
FsStorePayment mt=new FsStorePayment();
|
|
mt.setPaymentId(storePayment.getPaymentId());
|
|
mt.setPaymentId(storePayment.getPaymentId());
|
|
mt.setTradeNo(result.getHf_seq_id());
|
|
mt.setTradeNo(result.getHf_seq_id());
|
|
fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
|
|
+ String s = (String) resultMap.get("package");
|
|
|
|
+ resultMap.put("packageValue",s);
|
|
return R.ok().put("result",resultMap);
|
|
return R.ok().put("result",resultMap);
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
@@ -752,13 +715,16 @@ public class StoreOrderController extends AppBaseController {
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
o.setGoodsDesc("商城订单支付");
|
|
o.setGoodsDesc("商城订单支付");
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
- if(result.getBank_code()!=null&&result.getBank_code().equals("00000000")){
|
|
|
|
|
|
+ if(result.getResp_code()!=null&&(result.getResp_code().equals("00000000")||result.getResp_code().equals("00000100"))){
|
|
|
|
+
|
|
FsStorePayment mt=new FsStorePayment();
|
|
FsStorePayment mt=new FsStorePayment();
|
|
mt.setPaymentId(storePayment.getPaymentId());
|
|
mt.setPaymentId(storePayment.getPaymentId());
|
|
mt.setTradeNo(result.getHf_seq_id());
|
|
mt.setTradeNo(result.getHf_seq_id());
|
|
fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
|
|
+ String s = (String) resultMap.get("package");
|
|
|
|
+ resultMap.put("packageValue",s);
|
|
return R.ok().put("result",resultMap);
|
|
return R.ok().put("result",resultMap);
|
|
}
|
|
}
|
|
else{
|
|
else{
|