|  | @@ -1,47 +1,5 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.student.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 | 
	
		
			
				|  |  | -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.lang3.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.CollectionUtils;
 | 
	
		
			
				|  |  | -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;
 | 
	
	
		
			
				|  | @@ -53,8 +11,8 @@ 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.service.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 | 
	
		
			
				|  |  | +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;
 | 
	
	
		
			
				|  | @@ -138,7 +96,8 @@ public class StudentOrderController extends BaseController {
 | 
	
		
			
				|  |  |      private VipGroupActivityDao vipGroupActivityDao;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private SellOrderService sellOrderService;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TenantOrderRecordService tenantOrderRecordService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Value("${spring.profiles.active:dev}")
 | 
	
		
			
				|  |  |      private String profiles;
 | 
	
	
		
			
				|  | @@ -194,6 +153,10 @@ public class StudentOrderController extends BaseController {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo);
 | 
	
		
			
				|  |  |          if (Objects.isNull(orderByOrderNo)) {
 | 
	
		
			
				|  |  | +            Map<String, Object> tenantOrder = tenantOrderRecordService.checkTenantOrder(orderNo);
 | 
	
		
			
				|  |  | +            if (Objects.nonNull(tenantOrder)) {
 | 
	
		
			
				|  |  | +                return tenantOrder;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              return failed("未找到指定订单");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          HashMap<String, Object> orderDetail = new HashMap<>();
 | 
	
	
		
			
				|  | @@ -233,7 +196,7 @@ public class StudentOrderController extends BaseController {
 | 
	
		
			
				|  |  |                  orderDetail.put("member", cloudTeacherOrderService.queryOrderInfoByOrderId(orderByOrderNo.getId()));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          } else if (orderByOrderNo.getGroupType().equals(GroupType.VIP)) {
 | 
	
		
			
				|  |  | -            if(StringUtils.isNotEmpty(orderByOrderNo.getMusicGroupId())){
 | 
	
		
			
				|  |  | +            if (StringUtils.isNotEmpty(orderByOrderNo.getMusicGroupId())) {
 | 
	
		
			
				|  |  |                  VipBuyResultDto vipBuyResultInfo = vipGroupService.findVipBuyResultInfo(Integer.valueOf(orderByOrderNo.getMusicGroupId()));
 | 
	
		
			
				|  |  |                  orderDetail.put("detail", vipBuyResultInfo);
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -263,11 +226,11 @@ public class StudentOrderController extends BaseController {
 | 
	
		
			
				|  |  |              orderDetail.put("detail", vipGroupActivityDao.queryByIds(orderByOrderNo.getActivityId()));
 | 
	
		
			
				|  |  |          } else if (orderByOrderNo.getGroupType().equals(GroupType.MEMBER)) {
 | 
	
		
			
				|  |  |              CloudTeacherOrderDto orderDto = cloudTeacherOrderService.queryOrderInfoByOrderId(orderByOrderNo.getId());
 | 
	
		
			
				|  |  | -            orderDetail.put("detail",orderDto);
 | 
	
		
			
				|  |  | -            if(orderDto != null){
 | 
	
		
			
				|  |  | -                Map<String,Object> map = new HashMap<>(1);
 | 
	
		
			
				|  |  | -                map.put("paymentOrderId",orderDto.getCloudTeacherOrder().getOrderId());
 | 
	
		
			
				|  |  | -                orderDetail.put("couponList",sysCouponCodeDao.querySysCouponUseList(map));
 | 
	
		
			
				|  |  | +            orderDetail.put("detail", orderDto);
 | 
	
		
			
				|  |  | +            if (orderDto != null) {
 | 
	
		
			
				|  |  | +                Map<String, Object> map = new HashMap<>(1);
 | 
	
		
			
				|  |  | +                map.put("paymentOrderId", orderDto.getCloudTeacherOrder().getOrderId());
 | 
	
		
			
				|  |  | +                orderDetail.put("couponList", sysCouponCodeDao.querySysCouponUseList(map));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return succeed(orderDetail);
 | 
	
	
		
			
				|  | @@ -902,9 +865,9 @@ public class StudentOrderController extends BaseController {
 | 
	
		
			
				|  |  |          if (orderDetails.size() > 0) {
 | 
	
		
			
				|  |  |              MusicGroup musicGroup = musicGroupService.get(order.getMusicGroupId());
 | 
	
		
			
				|  |  |              BigDecimal couponRemitFee = order.getCouponRemitFee();
 | 
	
		
			
				|  |  | -            if(couponRemitFee.compareTo(BigDecimal.ZERO) > 0){
 | 
	
		
			
				|  |  | +            if (couponRemitFee.compareTo(BigDecimal.ZERO) > 0) {
 | 
	
		
			
				|  |  |                  BigDecimal musicFee = orderDetails.stream().filter(o -> o.getType().getCode().equals("MUSICAL")
 | 
	
		
			
				|  |  | -                        || o.getType().getCode().equals("ACCESSORIES") || o.getType().getCode().equals("TEACHING"))
 | 
	
		
			
				|  |  | +                                || o.getType().getCode().equals("ACCESSORIES") || o.getType().getCode().equals("TEACHING"))
 | 
	
		
			
				|  |  |                          .map(o -> o.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
 | 
	
		
			
				|  |  |                  BigDecimal expectAmount = order.getExpectAmount();
 | 
	
		
			
				|  |  |                  //获取比例
 | 
	
	
		
			
				|  | @@ -912,7 +875,7 @@ public class StudentOrderController extends BaseController {
 | 
	
		
			
				|  |  |                  //获取分配的减免金额
 | 
	
		
			
				|  |  |                  couponRemitFee = couponRemitFee.multiply(ratioAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            sellOrders = sellOrderService.addOrderDetail2SellOrder(orderDetails, order, musicGroup,couponRemitFee);
 | 
	
		
			
				|  |  | +            sellOrders = sellOrderService.addOrderDetail2SellOrder(orderDetails, order, musicGroup, couponRemitFee);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return succeed(sellOrders);
 | 
	
		
			
				|  |  |  
 |