|  | @@ -1,6 +1,7 @@
 | 
	
		
			
				|  |  |  package com.yonge.cooleshow.admin.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  | +import com.microsvc.toolkit.common.response.paging.PageInfo;
 | 
	
		
			
				|  |  |  import com.microsvc.toolkit.common.response.paging.QueryInfo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.entity.TenantActivationCode;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.entity.TenantAlbumPurchase;
 | 
	
	
		
			
				|  | @@ -13,7 +14,6 @@ import com.yonge.cooleshow.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.tenant.vo.TenantActivationCodeVo;
 | 
	
		
			
				|  |  |  import com.yonge.toolset.base.exception.BizException;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.base.page.PageInfo;
 | 
	
		
			
				|  |  |  import com.yonge.toolset.mybatis.support.PageUtil;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiOperation;
 | 
	
	
		
			
				|  | @@ -28,6 +28,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RequestParam;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.text.ParsePosition;
 | 
	
		
			
				|  |  | +import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | +import java.util.Calendar;
 | 
	
		
			
				|  |  | +import java.util.Date;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Slf4j
 | 
	
		
			
				|  |  |  @Validated
 | 
	
	
		
			
				|  | @@ -51,23 +56,30 @@ public class TenantActivationCodeController extends BaseController {
 | 
	
		
			
				|  |  |      public HttpResponseResult<PageInfo<TenantActivationCodeWrapper.TenantActivationCode>> page(
 | 
	
		
			
				|  |  |              @RequestBody TenantActivationCodeWrapper.TenantActivationCodeQuery query) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if (StringUtils.isBlank(query.getOrderNo())) {
 | 
	
		
			
				|  |  | -            throw new BizException("订单号不能为空");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        // 查询订单购买的专辑
 | 
	
		
			
				|  |  | -        TenantAlbumPurchase albumPurchase = tenantAlbumPurchaseService.getByOrderNo(query.getOrderNo());
 | 
	
		
			
				|  |  | -        if (albumPurchase == null) {
 | 
	
		
			
				|  |  | -            return succeed(new PageInfo<>());
 | 
	
		
			
				|  |  | +        String activationTime = query.getActivationTime();
 | 
	
		
			
				|  |  | +        if (StringUtils.isNotEmpty(activationTime)) {
 | 
	
		
			
				|  |  | +            Date parse = new SimpleDateFormat("yyyy-MM").parse(activationTime, new ParsePosition(0));
 | 
	
		
			
				|  |  | +            query.setActivationStartTime(parse);
 | 
	
		
			
				|  |  | +            Calendar instance = Calendar.getInstance();
 | 
	
		
			
				|  |  | +            instance.setTime(parse);
 | 
	
		
			
				|  |  | +            instance.add(Calendar.MONTH, 1);
 | 
	
		
			
				|  |  | +            instance.add(Calendar.DATE, -1);
 | 
	
		
			
				|  |  | +            instance.set(Calendar.HOUR_OF_DAY, 23);
 | 
	
		
			
				|  |  | +            instance.set(Calendar.MINUTE, 59);
 | 
	
		
			
				|  |  | +            instance.set(Calendar.MILLISECOND, 59);
 | 
	
		
			
				|  |  | +            query.setActivationEndTime(instance.getTime());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        query.setActivationStatus(true);
 | 
	
		
			
				|  |  | -        query.setTenantAlbumPurchaseId(albumPurchase.getId());
 | 
	
		
			
				|  |  | -        // 查询数据
 | 
	
		
			
				|  |  |          IPage<TenantActivationCodeWrapper.TenantActivationCode> pages =
 | 
	
		
			
				|  |  |                  tenantActivationCodeService.selectPage(QueryInfo.getPage(query), query);
 | 
	
		
			
				|  |  | -        PageInfo<TenantActivationCodeWrapper.TenantActivationCode> pageInfo = PageUtil.pageInfo(pages);
 | 
	
		
			
				|  |  | +        com.microsvc.toolkit.common.response.paging.PageInfo<TenantActivationCodeWrapper.TenantActivationCode> pageInfo = QueryInfo.pageInfo(pages,
 | 
	
		
			
				|  |  | +                pages.getRecords());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (query.getTenantAlbumPurchaseId() != null) {
 | 
	
		
			
				|  |  | -            pageInfo.setStatInfo(albumPurchase);
 | 
	
		
			
				|  |  | +            TenantActivationCodeWrapper.TenantActivationCode extra =
 | 
	
		
			
				|  |  | +                    new TenantActivationCodeWrapper.TenantActivationCode();
 | 
	
		
			
				|  |  | +            TenantAlbumPurchase purchase = tenantAlbumPurchaseService.getById(query.getTenantAlbumPurchaseId());
 | 
	
		
			
				|  |  | +            extra.setActiveQuantity(purchase.getActiveQuantity());
 | 
	
		
			
				|  |  | +            pageInfo.setExtra(extra);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return succeed(pageInfo);
 |