| @@ -7,24 +7,17 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.dto.OrderSaveDto; | import com.iformall.domain.dto.OrderSaveDto; | ||||
| import com.iformall.domain.po.WxCUser; | |||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponChannel; | |||||
| import com.iformall.domain.po.WxOrder; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.vo.WxMerchantSubsidyVo; | import com.iformall.domain.vo.WxMerchantSubsidyVo; | ||||
| import com.iformall.domain.vo.WxOrderQueryVo; | import com.iformall.domain.vo.WxOrderQueryVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | |||||
| import com.iformall.service.WxCUserService; | |||||
| import com.iformall.service.WxCouponChannelService; | |||||
| import com.iformall.service.WxCouponService; | |||||
| import com.iformall.service.WxOrderService; | |||||
| import com.iformall.service.*; | |||||
| import com.iformall.service.order.OrderFactory; | import com.iformall.service.order.OrderFactory; | ||||
| import com.iformall.service.order.entity.WxComposeOrder; | import com.iformall.service.order.entity.WxComposeOrder; | ||||
| import com.iformall.utils.MaUtil; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -54,6 +47,9 @@ public class WxOrderController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxOrderService wxOrderService; | private WxOrderService wxOrderService; | ||||
| @Autowired | |||||
| private WxPayOrderService wxPayOrderService; | |||||
| @Autowired | @Autowired | ||||
| private WxCUserService wxCUserService; | private WxCUserService wxCUserService; | ||||
| @@ -62,7 +58,7 @@ public class WxOrderController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | private WxCUserBasicInfoService wxCUserBasicInfoService; | ||||
| @Autowired | @Autowired | ||||
| OrderFactory orderFactory; | OrderFactory orderFactory; | ||||
| @@ -268,4 +264,19 @@ public class WxOrderController extends BaseController { | |||||
| } | } | ||||
| @ApiOperation("查看抖音订单状态") | |||||
| @GetMapping("/ttorderQuery") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "订单管理-id查询") | |||||
| public ResultData ttorderQuery(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxOrderController::ttorderQuery"); | |||||
| WxBatchOrder wxBatchOrder = wxOrderService.getWxBatchOrder(getTenantInfo(), id); | |||||
| if(wxBatchOrder == null || !EnumPayWay.PAY_WAY_TT.getCode().equals(wxBatchOrder.getPayVendor())){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "订单未找到或不支持"); | |||||
| } | |||||
| return new ResultData(wxPayOrderService.ttorderQuery(wxBatchOrder)); | |||||
| } | |||||
| } | } | ||||
| @@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.OrderComposeSaveDto; | import com.iformall.domain.dto.OrderComposeSaveDto; | ||||
| import com.iformall.domain.dto.OrderSaveDto; | import com.iformall.domain.dto.OrderSaveDto; | ||||
| @@ -3,6 +3,7 @@ package com.iformall.service; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| @@ -160,4 +161,11 @@ public interface WxPayOrderService { | |||||
| boolean hasCompleted(WxComposeOrder composeOrder, WxPayOrder payOrder); | boolean hasCompleted(WxComposeOrder composeOrder, WxPayOrder payOrder); | ||||
| /** | |||||
| * 只douyin查询,不做任何操作 | |||||
| * @param wxBatchOrder | |||||
| * @return | |||||
| */ | |||||
| PayQueryAdapterResult ttorderQuery(WxBatchOrder wxBatchOrder); | |||||
| } | } | ||||
| @@ -997,6 +997,19 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| return false; | return false; | ||||
| } | } | ||||
| @Override | |||||
| public PayQueryAdapterResult ttorderQuery(WxBatchOrder wxBatchOrder) { | |||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(wxBatchOrder,EnumPayWay.getEnum(wxBatchOrder.getPayVendor()).getPlat()); | |||||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||||
| WxPayOrder payOrder = new WxPayOrder(); | |||||
| payOrder.setOrderId(wxBatchOrder.getId()); | |||||
| try { | |||||
| return payServiceFactory.getPayAdapterService(wxBatchOrder.getPayVendor()).queryPayStatus(payOrder, appInfo, payAccount); | |||||
| } catch (Exception e) { | |||||
| return new PayQueryAdapterResult(ErrorCode.SYS_SERVER_ERROR.getCode(), e.getMessage(),wxBatchOrder.getPayVendor(),null,null,null); | |||||
| } | |||||
| } | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| @@ -51,6 +51,9 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen | |||||
| @Override | @Override | ||||
| public PayAdapterResult pay(WxPayAccount payAccount, WxPayOrder record,WxComposeOrder composeOrder,String productName,EnumPayShare isShare,WxAppinfo appInfo,Date currentDate, PayExtraParam params) throws Exception { | public PayAdapterResult pay(WxPayAccount payAccount, WxPayOrder record,WxComposeOrder composeOrder,String productName,EnumPayShare isShare,WxAppinfo appInfo,Date currentDate, PayExtraParam params) throws Exception { | ||||
| throw new Exception("请升级抖音版本"); | |||||
| // 新下单接口 | // 新下单接口 | ||||
| // TtPayService ttPayService = maUtil.getTtPayService(appInfo, payAccount); | // TtPayService ttPayService = maUtil.getTtPayService(appInfo, payAccount); | ||||
| // TtPayUnifiedOrderV2Request request = new TtPayUnifiedOrderV2Request(); | // TtPayUnifiedOrderV2Request request = new TtPayUnifiedOrderV2Request(); | ||||
| @@ -58,34 +61,34 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen | |||||
| // | // | ||||
| // TtPayUnifiedOrderV2Result result = ttPayService.createOrderV2(request); | // TtPayUnifiedOrderV2Result result = ttPayService.createOrderV2(request); | ||||
| DouYinCreatePreOrder preOrder = new DouYinCreatePreOrder(); | |||||
| preOrder.setAppId(appInfo.getAppId()); | |||||
| preOrder.setSercrect(appInfo.getSecret()); | |||||
| preOrder.setSalt(payAccount.getApiKey()); | |||||
| preOrder.setOutOrderNo(record.getPayOrderNo()); | |||||
| preOrder.setTotalAmount(composeOrder.getPayment()); | |||||
| preOrder.setSubject(productName); | |||||
| preOrder.setBody(productName); | |||||
| preOrder.setValidTime(30*60); | |||||
| // preOrder.setNotifyUrl();//回调地址 | |||||
| // preOrder.setThirdpartyId();//第三方服务商ID | |||||
| // preOrder.setStoreId(record.getStoreId()); | |||||
| CreatePreOrderResult preOrderResult = DouYinPayHelper.createPreOrder(preOrder); | |||||
| if(preOrderResult.isSuccess()){ | |||||
| // record.setPrepayId(preOrderResult.getOrderId()); | |||||
| record.setTransactionId(preOrderResult.getOrderId()); | |||||
| }else{ | |||||
| record.setFailReason(preOrderResult.getMsg()); | |||||
| } | |||||
| record.setUpdateTime(new Date()); | |||||
| PayAdapterResult par = new PayAdapterResult(); | |||||
| par.setSuccess(preOrderResult.isSuccess()); | |||||
| par.setMsg(preOrderResult.getMsg()); | |||||
| par.setTransactionId(preOrderResult.getOrderId()); | |||||
| par.setData(preOrderResult); | |||||
| return par; | |||||
| // DouYinCreatePreOrder preOrder = new DouYinCreatePreOrder(); | |||||
| // preOrder.setAppId(appInfo.getAppId()); | |||||
| // preOrder.setSercrect(appInfo.getSecret()); | |||||
| // preOrder.setSalt(payAccount.getApiKey()); | |||||
| // preOrder.setOutOrderNo(record.getPayOrderNo()); | |||||
| // preOrder.setTotalAmount(composeOrder.getPayment()); | |||||
| // preOrder.setSubject(productName); | |||||
| // preOrder.setBody(productName); | |||||
| // preOrder.setValidTime(30*60); | |||||
| //// preOrder.setNotifyUrl();//回调地址 | |||||
| //// preOrder.setThirdpartyId();//第三方服务商ID | |||||
| //// preOrder.setStoreId(record.getStoreId()); | |||||
| // CreatePreOrderResult preOrderResult = DouYinPayHelper.createPreOrder(preOrder); | |||||
| // | |||||
| // if(preOrderResult.isSuccess()){ | |||||
| //// record.setPrepayId(preOrderResult.getOrderId()); | |||||
| // record.setTransactionId(preOrderResult.getOrderId()); | |||||
| // }else{ | |||||
| // record.setFailReason(preOrderResult.getMsg()); | |||||
| // } | |||||
| // record.setUpdateTime(new Date()); | |||||
| // | |||||
| // PayAdapterResult par = new PayAdapterResult(); | |||||
| // par.setSuccess(preOrderResult.isSuccess()); | |||||
| // par.setMsg(preOrderResult.getMsg()); | |||||
| // par.setTransactionId(preOrderResult.getOrderId()); | |||||
| // par.setData(preOrderResult); | |||||
| // return par; | |||||
| } | } | ||||
| @Override | @Override | ||||