|
|
@@ -17,6 +17,8 @@ import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fs.api.param.OrderListParam;
|
|
|
import com.fs.api.vo.OrderListVO;
|
|
|
import com.fs.api.vo.ProductListVO;
|
|
|
@@ -61,18 +63,16 @@ import com.fs.erp.dto.ErpRefundUpdateRequest;
|
|
|
import com.fs.erp.dto.df.*;
|
|
|
import com.fs.erp.mapper.FsErpFinishPushMapper;
|
|
|
import com.fs.erp.service.IErpOrderService;
|
|
|
+import com.fs.his.config.AppConfig;
|
|
|
import com.fs.his.config.FsSysConfig;
|
|
|
import com.fs.his.domain.*;
|
|
|
-import com.fs.his.dto.FsPrescribeUsageDTO;
|
|
|
-import com.fs.his.dto.FsProdItemDTO;
|
|
|
-import com.fs.his.dto.FsStoreOrderAmountScrmStatsQueryDto;
|
|
|
-import com.fs.his.dto.FsStoreOrderItemDTO;
|
|
|
-import com.fs.his.enums.FsStoreOrderLogEnum;
|
|
|
-import com.fs.his.enums.FsStoreOrderStatusEnum;
|
|
|
-import com.fs.his.enums.FsUserIntegralLogTypeEnum;
|
|
|
+import com.fs.his.dto.*;
|
|
|
+import com.fs.his.enums.*;
|
|
|
import com.fs.his.mapper.*;
|
|
|
+import com.fs.his.param.FsIntegralOrderDoPayParam;
|
|
|
import com.fs.his.param.FsStoreOrderSalesParam;
|
|
|
import com.fs.his.param.FsUserAddIntegralTemplateParam;
|
|
|
+import com.fs.his.param.PayOrderParam;
|
|
|
import com.fs.his.service.IFsPrescribeService;
|
|
|
import com.fs.his.service.IFsUserIntegralLogsService;
|
|
|
import com.fs.his.service.IFsUserWatchService;
|
|
|
@@ -88,7 +88,17 @@ import com.fs.hisStore.config.StoreIntegralConfig;
|
|
|
import com.fs.hisStore.constants.StoreConstants;
|
|
|
import com.fs.hisStore.domain.*;
|
|
|
import com.fs.hisStore.dto.*;
|
|
|
+import com.fs.hisStore.dto.ErpRemarkDTO;
|
|
|
+import com.fs.hisStore.dto.ExpressDataDTO;
|
|
|
+import com.fs.hisStore.dto.ExpressInfoDTO;
|
|
|
+import com.fs.hisStore.dto.ExpressNotifyDTO;
|
|
|
+import com.fs.hisStore.dto.ExpressResultDTO;
|
|
|
+import com.fs.hisStore.dto.FsStoreCartDTO;
|
|
|
+import com.fs.hisStore.dto.StoreOrderExpressExportDTO;
|
|
|
+import com.fs.hisStore.dto.StorePackageProductDTO;
|
|
|
+import com.fs.hisStore.dto.StoreProductGroupDTO;
|
|
|
import com.fs.hisStore.enums.*;
|
|
|
+import com.fs.hisStore.enums.ShipperCodeEnum;
|
|
|
import com.fs.hisStore.mapper.*;
|
|
|
import com.fs.hisStore.param.*;
|
|
|
import com.fs.hisStore.service.*;
|
|
|
@@ -109,9 +119,12 @@ import com.fs.huifuPay.domain.HuifuCreateOrderResult;
|
|
|
import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayRefundRequest;
|
|
|
import com.fs.huifuPay.sdk.opps.core.utils.HuiFuUtils;
|
|
|
import com.fs.huifuPay.service.HuiFuService;
|
|
|
+import com.fs.live.domain.LiveOrder;
|
|
|
+import com.fs.live.mapper.LiveOrderMapper;
|
|
|
import com.fs.pay.pay.dto.OrderQueryDTO;
|
|
|
import com.fs.pay.pay.dto.RefundDTO;
|
|
|
import com.fs.pay.service.IPayService;
|
|
|
+import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.mapper.SysConfigMapper;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.fs.system.service.ISysDictTypeService;
|
|
|
@@ -126,14 +139,18 @@ import com.fs.wx.order.utils.WxShippingErrorHandler;
|
|
|
import com.fs.ybPay.domain.OrderResult;
|
|
|
import com.fs.ybPay.domain.RefundResult;
|
|
|
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
|
|
+import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
|
|
|
import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request;
|
|
|
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
|
import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
|
|
|
+import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
|
|
|
import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
|
|
|
import com.github.binarywang.wxpay.config.WxPayConfig;
|
|
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
|
+ import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
|
|
|
import com.google.common.base.Joiner;
|
|
|
+ import com.google.gson.Gson;
|
|
|
import lombok.Synchronized;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
@@ -157,6 +174,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.nio.charset.Charset;
|
|
|
import java.sql.Timestamp;
|
|
|
import java.text.ParseException;
|
|
|
@@ -295,6 +313,8 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
private WxPayService wxPayService;
|
|
|
@Autowired
|
|
|
private WxPayProperties wxPayProperties;
|
|
|
+ @Autowired
|
|
|
+ private IFsStorePaymentScrmService storePaymentService;
|
|
|
|
|
|
@Autowired
|
|
|
private FsErpFinishPushMapper fsErpFinishPushMapper;
|
|
|
@@ -2608,24 +2628,26 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
//货到付款
|
|
|
} else {
|
|
|
//将钱退还给用户
|
|
|
- List<FsStorePaymentScrm> payments = paymentService.selectFsStorePaymentByOrderId(order.getId());
|
|
|
+ List<FsStorePaymentScrm> payments = paymentService.selectFsStorePaymentByOrderIdApp(order.getId());
|
|
|
if (payments != null) {
|
|
|
+ SysConfig sysConfig = configService.selectConfigByConfigKey("app.config");
|
|
|
+ AppConfig config = new Gson().fromJson(sysConfig.getConfigValue(), AppConfig.class);
|
|
|
for (FsStorePaymentScrm payment : payments) {
|
|
|
+ if (order.getPayType().equals("99")){
|
|
|
+ payment.setAppId(config.getAppId());
|
|
|
+ }
|
|
|
if (StringUtils.isBlank(payment.getAppId())) {
|
|
|
throw new IllegalArgumentException("appId不能为空");
|
|
|
}
|
|
|
- FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(payment.getAppId());
|
|
|
- if (fsCoursePlaySourceConfig == null) {
|
|
|
- throw new CustomException("未找到appId对应的小程序配置: " + payment.getAppId());
|
|
|
- }
|
|
|
- Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
|
|
|
- if (merchantConfigId == null || merchantConfigId <= 0) {
|
|
|
- throw new CustomException("小程序没有配置商户信息");
|
|
|
+ String payType = payment.getPayMode();
|
|
|
+ if ("wxApp".equals(payment.getPayMode())){
|
|
|
+ payType = "wx";
|
|
|
}
|
|
|
- MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
|
|
|
- FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
|
|
|
if (payment.getPayMode() == null || payment.getPayMode().equals("wx")) {
|
|
|
+
|
|
|
+ MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigByAppId(payment.getAppId(),payType);
|
|
|
+ FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
|
payConfig.setAppId(payment.getAppId());
|
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
@@ -2666,20 +2688,20 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
return R.error("退款请求失败" + e.getErrCodeDes());
|
|
|
}
|
|
|
} else if (payment.getPayMode() != null && payment.getPayMode().equals("hf")) {
|
|
|
+ MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigByAppId(payment.getAppId(),payType);
|
|
|
+ FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
+
|
|
|
String huifuId="";
|
|
|
- FsHfpayConfigMapper fsHfpayConfigMapper = SpringUtils.getBean(FsHfpayConfigMapper.class);
|
|
|
if (payment.getAppId() != null) {
|
|
|
- FsHfpayConfig fsHfpayConfig = fsHfpayConfigMapper.selectByAppId(payment.getAppId());
|
|
|
- if (fsHfpayConfig == null){
|
|
|
+ if (merchantAppConfig == null){
|
|
|
huifuId = fsPayConfig.getHuifuId();
|
|
|
}else {
|
|
|
- huifuId = fsHfpayConfig.getHuifuId();
|
|
|
+ huifuId = merchantAppConfig.getMerchantId();
|
|
|
}
|
|
|
} else {
|
|
|
if (("益善缘".equals(cloudHostProper.getCompanyName()))) {
|
|
|
|
|
|
- FsHfpayConfig fsPayConfig2 = fsHfpayConfigMapper.selectByAppId("wx0d1a3dd485268521");
|
|
|
- huifuId = fsPayConfig2.getHuifuId();
|
|
|
+ huifuId = merchantAppConfig.getMerchantId();
|
|
|
}else {
|
|
|
huifuId=fsPayConfig.getHuifuId();
|
|
|
}
|
|
|
@@ -2689,12 +2711,18 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
V2TradePaymentScanpayRefundRequest request = new V2TradePaymentScanpayRefundRequest();
|
|
|
request.setOrgHfSeqId(payment.getTradeNo());
|
|
|
request.setHuifuId(huifuId);
|
|
|
- request.setOrdAmt(payment.getPayMoney().toString());
|
|
|
+ Map<String, Object> extendInfoMap = new HashMap<>();
|
|
|
+ if (order.getPayType().equals("99")){
|
|
|
+ request.setOrdAmt(payment.getPayMoney().setScale(2, RoundingMode.DOWN).toString());
|
|
|
+ extendInfoMap.put("org_req_seq_id", "store-"+payment.getPayCode());
|
|
|
+ }else {
|
|
|
+ request.setOrdAmt(payment.getPayMoney().toString());
|
|
|
+ extendInfoMap.put("org_party_order_id", payment.getBankSerialNo());
|
|
|
+ request.setAppId(payment.getAppId());
|
|
|
+ }
|
|
|
+
|
|
|
request.setOrgReqDate(new SimpleDateFormat("yyyyMMdd").format(payment.getCreateTime()));
|
|
|
request.setReqSeqId("refund-" + payment.getPayCode());
|
|
|
- Map<String, Object> extendInfoMap = new HashMap<>();
|
|
|
- extendInfoMap.put("org_party_order_id", payment.getBankSerialNo());
|
|
|
- request.setExtendInfo(extendInfoMap);
|
|
|
request.setAppId(payment.getAppId());
|
|
|
HuiFuRefundResult refund = huiFuService.refund(request);
|
|
|
logger.info("退款:" + refund);
|
|
|
@@ -2707,7 +2735,41 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return R.error(refund.getResp_desc());
|
|
|
}
|
|
|
+ }else if ("wxApp".equals(payment.getPayMode()) && "wx_app".equals(payment.getPayTypeCode())) {
|
|
|
+ // 处理微信退款
|
|
|
+ WxPayService wxPayService = getWxPayService();
|
|
|
+ WxPayRefundRequest refundRequest = new WxPayRefundRequest();
|
|
|
+ refundRequest.setOutTradeNo("store-"+payment.getPayCode());
|
|
|
+ refundRequest.setOutRefundNo("store-"+payment.getPayCode());
|
|
|
+ refundRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(payment.getPayMoney().toString()));
|
|
|
+ refundRequest.setRefundFee(WxPayUnifiedOrderRequest.yuanToFen(payment.getPayMoney().toString()));
|
|
|
+ try {
|
|
|
+ WxPayRefundResult refundResult = wxPayService.refund(refundRequest);
|
|
|
+ WxPayRefundQueryResult refundQueryResult = wxPayService.refundQuery("", refundResult.getOutTradeNo(), refundResult.getOutRefundNo(), refundResult.getRefundId());
|
|
|
+ if (refundQueryResult != null && refundQueryResult.getResultCode().equals("SUCCESS")) {
|
|
|
+ FsStorePaymentScrm paymentMap = new FsStorePaymentScrm();
|
|
|
+ paymentMap.setPaymentId(payment.getPaymentId());
|
|
|
+ paymentMap.setStatus(-1);
|
|
|
+ paymentMap.setRefundTime(DateUtils.getNowDate());
|
|
|
+ paymentMap.setRefundMoney(payment.getPayMoney());
|
|
|
+ paymentService.updateFsStorePayment(paymentMap);
|
|
|
+ } else {
|
|
|
+ throw new CustomException("退款请求失败" + refundQueryResult.getReturnMsg());
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (WxPayException e) {
|
|
|
+ throw new CustomException("退款请求失败" + e);
|
|
|
+ }
|
|
|
|
|
|
+// }else if (payment.getPayMode()!=null&&payment.getPayMode().equals("cz")) {
|
|
|
+// FsStorePaymentScrm paymentMap = new FsStorePaymentScrm();
|
|
|
+// paymentMap.setPaymentId(payment.getPaymentId());
|
|
|
+// paymentMap.setStatus(-1);
|
|
|
+// paymentMap.setRefundTime(DateUtils.getNowDate());
|
|
|
+// paymentMap.setRefundMoney(payment.getPayMoney());
|
|
|
+// paymentService.updateFsStorePayment(paymentMap);
|
|
|
+// FsUserScrm fsUserScrm = userService.selectFsUserById(order.getUserId());
|
|
|
+// processStoreRechargePayment(payment,fsUserScrm,order);
|
|
|
} else {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return R.error("支付类型异常");
|
|
|
@@ -2793,6 +2855,34 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 封装微信参数
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private WxPayService getWxPayService(){
|
|
|
+ SysConfig sysConfig = configService.selectConfigByConfigKey("app.config");
|
|
|
+ AppConfig config = new Gson().fromJson(sysConfig.getConfigValue(), AppConfig.class);
|
|
|
+ FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(config.getAppId());
|
|
|
+ if (fsCoursePlaySourceConfig == null) {
|
|
|
+ throw new CustomException("未找到appId对应的小程序配置: " + config.getAppId());
|
|
|
+ }
|
|
|
+ MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
|
|
|
+ FsPayConfig payConfig1 = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
+
|
|
|
+ WxPayConfig payConfig = new WxPayConfig();
|
|
|
+ payConfig.setAppId(merchantAppConfig.getAppId());
|
|
|
+ payConfig.setMchId(payConfig1.getWxMchId());
|
|
|
+ payConfig.setMchKey(payConfig1.getWxMchKey());
|
|
|
+ payConfig.setSubAppId(StringUtils.trimToNull(null));
|
|
|
+ payConfig.setSubMchId(StringUtils.trimToNull(null));
|
|
|
+ payConfig.setKeyPath(payConfig1.getKeyPath());
|
|
|
+ payConfig.setNotifyUrl(payConfig1.getNotifyUrlScrm());
|
|
|
+ WxPayServiceImpl payService = new WxPayServiceImpl();
|
|
|
+ payService.setConfig(payConfig);
|
|
|
+ return payService;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public R updateExpress(FsStoreOrderExpressEditParam param) {
|
|
|
FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(param.getOrderId());
|
|
|
@@ -4644,14 +4734,21 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
.add(vo);
|
|
|
}
|
|
|
|
|
|
- // 按小程序appId分组订单(从支付记录中获取)
|
|
|
+ // 按小程序appId分组订单(从支付记录中获取);business_type=8 为 App 发货,跳过小程序仅更新本地已发货
|
|
|
Map<String, List<FsOrderDeliveryNoteDTO>> ordersByAppId = new HashMap<>();
|
|
|
+ List<FsOrderDeliveryNoteDTO> appDeliveryBusinessType8List = new ArrayList<>();
|
|
|
for (FsOrderDeliveryNoteDTO dto : successList) {
|
|
|
String orderNumber = dto.getOrderNumber();
|
|
|
// 通过订单号查询订单
|
|
|
FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(orderNumber);
|
|
|
if (order != null) {
|
|
|
- // 查询订单的支付记录获取appId
|
|
|
+ List<FsStorePaymentScrm> appDeliveryPayments = fsStorePaymentMapper.selectFsStorePaymentByOrderIdBusinessType8(order.getId());
|
|
|
+ if (!appDeliveryPayments.isEmpty()) {
|
|
|
+ appDeliveryBusinessType8List.add(dto);
|
|
|
+ log.debug("订单号: {} 为 business_type=8(App发货),跳过小程序发货流程", orderNumber);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 查询订单的支付记录获取appId(business_type=2)
|
|
|
List<FsStorePaymentScrm> paymentList = fsStorePaymentMapper.selectFsStorePaymentByOrderId(order.getId());
|
|
|
if (!paymentList.isEmpty() && paymentList.get(0).getAppId() != null) {
|
|
|
String orderAppId = paymentList.get(0).getAppId();
|
|
|
@@ -4669,11 +4766,13 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (ordersByAppId.isEmpty()) {
|
|
|
+ if (ordersByAppId.isEmpty() && appDeliveryBusinessType8List.isEmpty()) {
|
|
|
return R.error("所有订单都无法获取对应的小程序appId,请确保订单已支付");
|
|
|
}
|
|
|
|
|
|
- log.info("导入订单涉及{}个小程序,开始分组处理", ordersByAppId.size());
|
|
|
+ if (!ordersByAppId.isEmpty()) {
|
|
|
+ log.info("导入订单涉及{}个小程序,开始分组处理", ordersByAppId.size());
|
|
|
+ }
|
|
|
|
|
|
// 按小程序分组批量上传微信发货信息
|
|
|
for (Map.Entry<String, List<FsOrderDeliveryNoteDTO>> entry : ordersByAppId.entrySet()) {
|
|
|
@@ -4728,6 +4827,25 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // business_type=8:仅更新本地订单物流与已发货状态,不上传微信小程序
|
|
|
+ if (!appDeliveryBusinessType8List.isEmpty()) {
|
|
|
+ log.info("business_type=8(App发货) 订单共{}条,跳过小程序,仅更新本地发货信息", appDeliveryBusinessType8List.size());
|
|
|
+ }
|
|
|
+ for (FsOrderDeliveryNoteDTO dto : appDeliveryBusinessType8List) {
|
|
|
+ int rowNum = successList.indexOf(dto) + 2;
|
|
|
+ if (StringUtils.isEmpty(dto.getOrderNumber())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String deliverySn = expressDeliveryMap.get(dto.getDeliveryName());
|
|
|
+ if (deliverySn == null) {
|
|
|
+ result.addFailure(rowNum, dto.getOrderNumber(), dto.getDeliveryId(), "物流公司名称异常");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ dto.setDeliverySn(deliverySn);
|
|
|
+ updateList.add(dto);
|
|
|
+ result.addSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
//批量更新数据
|
|
|
if (!updateList.isEmpty()) {
|
|
|
batchUpdateDeliveryNotes(updateList);
|
|
|
@@ -6321,4 +6439,65 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
return WxShippingErrorHandler.handleExceptionErrorWithDetail(e.getMessage(), dto.getOrderNumber());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预支付
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public R payment(FsIntegralOrderDoPayParam param, PaymentMethodEnum paymentMethod) {
|
|
|
+ FsStoreOrderScrm order = buildPayment(param);
|
|
|
+ if (Objects.isNull(order) || !order.getStatus().equals(0)
|
|
|
+ || order.getPayMoney().compareTo(BigDecimal.ZERO) <= 0){
|
|
|
+ return R.error("非法操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ PayOrderParam payOrderParam = buildPayOrderParam(paymentMethod, order);
|
|
|
+ return storePaymentService.processPaymentScrm(payOrderParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private LiveOrderMapper liveOrderMapper;
|
|
|
+
|
|
|
+ public FsStoreOrderScrm buildPayment(FsIntegralOrderDoPayParam param){
|
|
|
+ if(param.getType().equals("live")){
|
|
|
+ LiveOrder liveOrder = liveOrderMapper.selectLiveOrderByOrderId(String.valueOf(param.getOrderId()));
|
|
|
+ if (ObjectUtil.isNotEmpty(liveOrder)){
|
|
|
+ FsStoreOrderScrm orderScrm = new FsStoreOrderScrm();
|
|
|
+ BeanUtils.copyProperties(liveOrder,orderScrm);
|
|
|
+ orderScrm.setId(liveOrder.getOrderId());
|
|
|
+ orderScrm.setUserId(Long.valueOf(liveOrder.getUserId()));
|
|
|
+ orderScrm.setIsLive(true);
|
|
|
+ return orderScrm;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (param.getType().equals("store")){
|
|
|
+ FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(param.getOrderId());
|
|
|
+ if (ObjectUtil.isNotEmpty(order)){
|
|
|
+ return order;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 构建参数
|
|
|
+ */
|
|
|
+ private static PayOrderParam buildPayOrderParam(PaymentMethodEnum paymentMethod, FsStoreOrderScrm order) {
|
|
|
+ PayOrderParam payOrderParam = new PayOrderParam();
|
|
|
+ payOrderParam.setOrderId(order.getId());
|
|
|
+ payOrderParam.setOrderCode(order.getOrderCode());
|
|
|
+ payOrderParam.setAmount(order.getPayMoney());
|
|
|
+ payOrderParam.setUserId(order.getUserId());
|
|
|
+ payOrderParam.setCompanyId(order.getCompanyId());
|
|
|
+ payOrderParam.setCompanyUserId(order.getCompanyUserId());
|
|
|
+ payOrderParam.setPaymentMethod(paymentMethod);
|
|
|
+ if (order.getIsLive()){
|
|
|
+ payOrderParam.setBusinessType(BusinessTypeEnum.LIVE_ORDER);
|
|
|
+ }else {
|
|
|
+ payOrderParam.setBusinessType(BusinessTypeEnum.ORDER_ORDER);
|
|
|
+ }
|
|
|
+ return payOrderParam;
|
|
|
+ }
|
|
|
}
|