|  | @@ -1,29 +1,35 @@
 | 
	
		
			
				|  |  |  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.util.List;
 | 
	
		
			
				|  |  | +import java.util.Map;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.http.HttpStatus;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.GetMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.PostMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestBody;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.SporadicPayDto;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.enums.DealStatusEnum;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.PayStatus;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.MusicGroupService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.SporadicChargeInfoService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.StudentPaymentOrderService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  | -import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | -import io.swagger.annotations.ApiImplicitParam;
 | 
	
		
			
				|  |  | -import io.swagger.annotations.ApiImplicitParams;
 | 
	
		
			
				|  |  | -import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | -import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | -import org.springframework.http.HttpStatus;
 | 
	
		
			
				|  |  | -import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import java.math.BigDecimal;
 | 
	
		
			
				|  |  | -import java.util.HashMap;
 | 
	
		
			
				|  |  | -import java.util.Map;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @RequestMapping("sporadicChargeInfo")
 | 
	
		
			
				|  |  |  @Api(tags = "零星收费")
 | 
	
	
		
			
				|  | @@ -37,6 +43,8 @@ public class SporadicChargeInfoController extends BaseController {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private StudentPaymentOrderService studentPaymentOrderService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | +    private StudentPaymentOrderDao studentPaymentOrderDao;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  |      private MusicGroupService musicGroupService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @ApiOperation(value = "单查询")
 | 
	
	
		
			
				|  | @@ -65,8 +73,17 @@ public class SporadicChargeInfoController extends BaseController {
 | 
	
		
			
				|  |  |              sporadicPayDto.setUserId(sysUser.getId());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          if (sporadicPayDto.getIsRepeatPay() == false) {
 | 
	
		
			
				|  |  | -            Integer ingOrder = studentPaymentOrderService.findOrderByGroupType(sporadicPayDto.getUserId(), sporadicPayDto.getSporadicId(), "SPORADIC", DealStatusEnum.ING);
 | 
	
		
			
				|  |  | -            if (ingOrder != null && ingOrder > 0) {
 | 
	
		
			
				|  |  | +        	List<StudentPaymentOrder> studentPaymentOrderList = studentPaymentOrderDao.findPaymentOrderByGroupType(sporadicPayDto.getUserId(), sporadicPayDto.getSporadicId(), "SPORADIC", DealStatusEnum.ING);
 | 
	
		
			
				|  |  | +            if (studentPaymentOrderList != null && studentPaymentOrderList.size() > 0) {
 | 
	
		
			
				|  |  | +            	StudentPaymentOrder applyOrder = studentPaymentOrderList.get(0);
 | 
	
		
			
				|  |  | +            	// 查询订单状态
 | 
	
		
			
				|  |  | +                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
 | 
	
		
			
				|  |  | +                if(payStatus == PayStatus.SUCCESSED){
 | 
	
		
			
				|  |  | +            		throw new BizException("订单已支付成功,请勿重复支付");
 | 
	
		
			
				|  |  | +            	}else if(payStatus == PayStatus.PAYING){
 | 
	
		
			
				|  |  | +            		throw new BizException("订单还在交易中,请稍后重试");
 | 
	
		
			
				|  |  | +            	}
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  |                  return failed(HttpStatus.CONTINUE, "您有待支付的订单");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 |