| 
					
				 | 
			
			
				@@ -1,109 +1,45 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.ym.mec.student.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import io.swagger.annotations.ApiImplicitParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import io.swagger.annotations.ApiImplicitParams; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.net.URLEncoder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Arrays; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Calendar; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Comparator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Iterator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.LinkedHashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Objects; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.commons.collections.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.commons.lang.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.http.HttpStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.scheduling.annotation.EnableScheduling; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.util.DigestUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.bind.annotation.GetMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.bind.annotation.ModelAttribute; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.bind.annotation.PostMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.bind.annotation.RequestParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.auth.api.client.SysUserFeignService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.auth.api.entity.SysUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.ChildrenDayDegreeDetailDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.CourseScheduleEvaluateDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.DegreeRegistrationDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.OrganizationDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.ReplacementInstrumentActivityDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.StudentGoodsSellDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.StudentRegistrationDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.SysConfigDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.SysCouponCodeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.VipGroupActivityDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.CloudTeacherOrderDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.LuckStatisDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.OrderStatisDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.Practice4OrganDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.PracticeGroupStatisDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.PracticeGroupsDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.VipBuyResultDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.DegreeRegistration; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.Goods; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.LuckDrawCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.MusicGroup; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.Organization; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.SellOrder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.SporadicChargeInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.StudentPaymentOrder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.StudentRegistration; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.TenantPaymentOrder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.biz.dal.dao.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.biz.dal.dto.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.biz.dal.entity.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.enums.CourseViewTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.enums.DealStatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.enums.GroupType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.enums.OrderTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.CloudTeacherOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.LuckDrawCountService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.MusicGroupService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.SellOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.SporadicChargeInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.StudentPaymentOrderDetailService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.StudentPaymentOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.SysConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.TenantOrderRecordService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.TenantPaymentOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.VipGroupService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.biz.service.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.controller.BaseController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.entity.HttpResponseResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.page.PageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.tenant.TenantContextHolder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.thirdparty.adapay.ConfigInit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.thirdparty.adapay.Payment; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.thirdparty.yqpay.Msg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.http.HttpUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import io.swagger.annotations.ApiImplicitParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import io.swagger.annotations.ApiImplicitParams; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.collections.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.lang.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.http.HttpStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.scheduling.annotation.EnableScheduling; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.net.URLEncoder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RequestMapping("studentOrder") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Api(tags = "订单回调") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -159,6 +95,8 @@ public class StudentOrderController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SellOrderService sellOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private TenantOrderRecordService tenantOrderRecordService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private OrderPayOpsService orderPayOpsService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Value("${spring.profiles.active:dev}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String profiles; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -214,6 +152,7 @@ public class StudentOrderController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (Objects.isNull(orderByOrderNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.info("checkOrderStatus >>>> tenantOrder {}", orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Map<String, Object> tenantOrder = tenantOrderRecordService.checkTenantOrder(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (Objects.nonNull(tenantOrder)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return succeed(tenantOrder); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -304,120 +243,13 @@ public class StudentOrderController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiImplicitParam(name = "orderNo", value = "订单号", required = true, dataType = "String"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiImplicitParam(name = "payChannel", value = "支付方式(alipay-支付宝app支付)", required = true, dataType = "String"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public Object executePayment(BigDecimal amount, String orderNo, String payChannel, String notifyUrl, String returnUrl, String orderSubject, String orderBody, String sign, String code, String platform) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Object> signParams = new LinkedHashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        signParams.put("appId", ConfigInit.appId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        signParams.put("amount", amount.setScale(2, BigDecimal.ROUND_HALF_UP)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        signParams.put("orderNo", orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        signParams.put("notifyUrl", notifyUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        signParams.put("returnUrl", returnUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        signParams.put("orderSubject", orderSubject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        signParams.put("orderBody", orderBody); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        signParams.put("wxAppId", ConfigInit.wxAppId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String originalStr = JSONObject.toJSONString(signParams); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String mewSign = DigestUtils.md5DigestAsHex(originalStr.getBytes()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!mewSign.equals(sign)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return failed("请勿非法请求"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String openId = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (payChannel.equals("wx_pub")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (code == null || code.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return failed("微信支付请先授权"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String wxMpOAuth2AccessTokenUrl = String.format(ConfigInit.wxMpOAuth2AccessTokenUrl, ConfigInit.wxAppId, ConfigInit.wxAppSecret, code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Map<String, String> weChatRes = JSON.parseObject(HttpUtil.get(wxMpOAuth2AccessTokenUrl, new HashMap<>()), Map.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (!weChatRes.containsKey("openid")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return failed("授权失败,请重新授权"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            openId = weChatRes.get("openid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Date createTime = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        TenantPaymentOrder tenantPaymentOrder = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        StudentPaymentOrder studentPaymentOrder = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (platform != null && platform.equals("teacher")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            tenantPaymentOrder = tenantPaymentOrderService.queryByOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (studentPaymentOrder == null && tenantPaymentOrder == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return failed("订单不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (studentPaymentOrder != null && !studentPaymentOrder.getStatus().equals(DealStatusEnum.ING)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String msg = studentPaymentOrder.getStatus().equals(DealStatusEnum.SUCCESS) ? "订单已支付,请勿重复支付" : "订单已关闭,不能支付"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return failed(msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (tenantPaymentOrder != null && !tenantPaymentOrder.getStatus().equals(DealStatusEnum.ING)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String msg = tenantPaymentOrder.getStatus().equals(DealStatusEnum.SUCCESS) ? "订单已支付,请勿重复支付" : "订单已关闭,不能支付"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return failed(msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (studentPaymentOrder != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            createTime = studentPaymentOrder.getCreateTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            createTime = tenantPaymentOrder.getCreateTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Calendar beforeTime = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        beforeTime.add(Calendar.MINUTE, -28);// 28 分钟之前的时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Date beforeDate = beforeTime.getTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (createTime.before(beforeDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return failed("订单已超时,请重新下单"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Date expireDate = DateUtil.addMinutes(createTime, 30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String timeExpire = new SimpleDateFormat("yyyyMMddHHmmss").format(expireDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Object> paymentParams = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        paymentParams.put("app_id", ConfigInit.appId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        paymentParams.put("order_no", orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        paymentParams.put("pay_channel", payChannel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        paymentParams.put("pay_amt", amount.setScale(2, BigDecimal.ROUND_HALF_UP)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        paymentParams.put("goods_title", orderSubject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        paymentParams.put("goods_desc", orderBody); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        paymentParams.put("time_expire", timeExpire); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        paymentParams.put("pay_mode", "delay"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //延时分账时不需要 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<StudentPaymentRouteOrder> routeOrders = studentPaymentRouteOrderDao.getRouteOrders(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<Map<String, Object>> divMembers = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        for (StudentPaymentRouteOrder routeOrder : routeOrders) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            Map<String, Object> divMember = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            divMember.put("member_id", routeOrder.getMerNo());//分佣账户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            divMember.put("amount", routeOrder.getRouteAmount().setScale(2, BigDecimal.ROUND_HALF_UP));//分佣金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            divMember.put("fee_flag", routeOrder.getFeeFlag()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            if (routeOrder.getMerNo().equals(ConfigInit.merNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                divMember.put("member_id", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            divMembers.add(divMember); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (divMembers.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            paymentParams.put("div_members", JSON.toJSONString(divMembers)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Object> expendParams = new HashMap<>(5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        expendParams.put("open_id", openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        expendParams.put("is_raw", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        expendParams.put("callback_url", returnUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        expendParams.put("limit_pay", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        paymentParams.put("expend", expendParams); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Object> payment = Payment.executePayment(paymentParams); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (studentPaymentOrder != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            studentPaymentOrder.setTransNo((String) payment.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            studentPaymentOrderService.update(studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            tenantPaymentOrder.setTransNo((String) payment.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            tenantPaymentOrderService.update(tenantPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Object executePayment(BigDecimal amount, String orderNo, String payChannel, String notifyUrl, String returnUrl, String orderSubject, String orderBody, String sign, String code, String platform) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, Object> payment = orderPayOpsService.executePayment(amount, orderNo, payChannel, returnUrl, orderSubject, orderBody, sign, code, platform); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return succeed(payment); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return failed(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return succeed(payment); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping("/authorize") 
			 |