|  | @@ -5,12 +5,11 @@ import com.microsvc.toolkit.common.webportal.exception.BizException;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.queryInfo.SysMusicCompareRecordQueryInfo;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.PaymentDivMemberRecordService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.SysMusicCompareRecordService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.TenantPersonStatService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.UserOrderService;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.service.*;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.wrapper.OssFileWrapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.wrapper.PaymentDivMemberRecordWrapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.wrapper.TenantPersonStatWrapper;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.wrapper.teacher.TeacherWrapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  |  import com.yonge.toolset.base.page.PageInfo;
 | 
	
	
		
			
				|  | @@ -24,7 +23,11 @@ import org.springframework.web.bind.annotation.RequestBody;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | +import java.util.Date;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  |  import java.util.Objects;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Api(tags = "首页统计")
 | 
	
		
			
				|  |  |  @RequestMapping("${app-config.url.tenant:}/index")
 | 
	
	
		
			
				|  | @@ -41,6 +44,8 @@ public class IndexController extends BaseController {
 | 
	
		
			
				|  |  |      private PaymentDivMemberRecordService paymentDivMemberRecordService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private UserOrderService userOrderService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private OssFileService ossFileService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @ApiOperation("学员训练数据统计列表")
 | 
	
	
		
			
				|  | @@ -58,6 +63,39 @@ public class IndexController extends BaseController {
 | 
	
		
			
				|  |  |          return succeed(sysMusicCompareRecordService.weChatStudentTrainData(queryInfo));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @ApiOperation("导出学员训练数据统计列表")
 | 
	
		
			
				|  |  | +    @PostMapping("exportStudentTrainData")
 | 
	
		
			
				|  |  | +    public HttpResponseResult<OssFileWrapper.ExportFile> exportStudentTrainData
 | 
	
		
			
				|  |  | +            (@RequestBody SysMusicCompareRecordQueryInfo.WechatCompareRecordQueryInfo queryInfo){
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (sysUser == null) {
 | 
	
		
			
				|  |  | +            return failed("获取用户信息失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(StringUtils.isEmpty(queryInfo.getStartTime())){
 | 
	
		
			
				|  |  | +            throw new BizException("请选择筛选时间");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        queryInfo.setTenantId(sysUser.getTenantId());
 | 
	
		
			
				|  |  | +        List<SysMusicCompareRecordQueryInfo.WechatCompareRecordPageDto> rows = sysMusicCompareRecordService.weChatStudentTrainData(queryInfo).getRows();
 | 
	
		
			
				|  |  | +        if (rows.isEmpty()) {
 | 
	
		
			
				|  |  | +            throw new BizException("没有可导出数据");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<SysMusicCompareRecordQueryInfo.WechatCompareRecordExportDto> templates = rows.stream().map(next -> {
 | 
	
		
			
				|  |  | +            SysMusicCompareRecordQueryInfo.WechatCompareRecordExportDto template = new SysMusicCompareRecordQueryInfo.WechatCompareRecordExportDto();
 | 
	
		
			
				|  |  | +            template.setUsername(next.getUsername());
 | 
	
		
			
				|  |  | +            template.setSubjectName(next.getSubjectName());
 | 
	
		
			
				|  |  | +            template.setAvgTrainTimes(next.getAvgTrainTimes());
 | 
	
		
			
				|  |  | +            template.setTrainTimes(next.getTrainTimes());
 | 
	
		
			
				|  |  | +            template.setTrainDays(next.getTrainDays());
 | 
	
		
			
				|  |  | +            return template;
 | 
	
		
			
				|  |  | +        }).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        String format = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
 | 
	
		
			
				|  |  | +        OssFileWrapper.ExportFile exportFile = ossFileService.uploadFile(templates,
 | 
	
		
			
				|  |  | +                TeacherWrapper.ExportTeacherTemplate.class, format, "练习统计列表");
 | 
	
		
			
				|  |  | +        return succeed(exportFile);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @ApiOperation("首页学员训练数据统计列表、汇总")
 | 
	
		
			
				|  |  |      @PostMapping("studentTrainData")
 | 
	
	
		
			
				|  | @@ -125,6 +163,36 @@ public class IndexController extends BaseController {
 | 
	
		
			
				|  |  |          return succeed(PageUtil.pageInfo(paymentDivMemberRecordService.queryIncome(QueryInfo.getPage(query), query)));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @ApiOperation("导出收入明细列表")
 | 
	
		
			
				|  |  | +    @PostMapping("exportIncome")
 | 
	
		
			
				|  |  | +    public HttpResponseResult<OssFileWrapper.ExportFile>
 | 
	
		
			
				|  |  | +    exportIncome(@RequestBody PaymentDivMemberRecordWrapper.IndexIncomeQuery query){
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (sysUser == null) {
 | 
	
		
			
				|  |  | +            return failed("获取用户信息失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        query.setTenantId(sysUser.getTenantId());
 | 
	
		
			
				|  |  | +        List<PaymentDivMemberRecordWrapper.IndexIncomeQueryDto> rows = paymentDivMemberRecordService.queryIncome(QueryInfo.getPage(query), query).getRecords();
 | 
	
		
			
				|  |  | +        if (rows.isEmpty()) {
 | 
	
		
			
				|  |  | +            throw new BizException("没有可导出数据");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<PaymentDivMemberRecordWrapper.IndexIncomeExportDto> templates = rows.stream().map(next -> {
 | 
	
		
			
				|  |  | +            PaymentDivMemberRecordWrapper.IndexIncomeExportDto template = new PaymentDivMemberRecordWrapper.IndexIncomeExportDto();
 | 
	
		
			
				|  |  | +            template.setName(next.getName());
 | 
	
		
			
				|  |  | +            template.setPhone(next.getPhone());
 | 
	
		
			
				|  |  | +            template.setAmount(next.getAmount());
 | 
	
		
			
				|  |  | +            template.setPayTime(next.getPayTime());
 | 
	
		
			
				|  |  | +            template.setOrderType(next.getOrderType().getName());
 | 
	
		
			
				|  |  | +            return template;
 | 
	
		
			
				|  |  | +        }).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        String format = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
 | 
	
		
			
				|  |  | +        OssFileWrapper.ExportFile exportFile = ossFileService.uploadFile(templates,
 | 
	
		
			
				|  |  | +                TeacherWrapper.ExportTeacherTemplate.class, format, "练习统计列表");
 | 
	
		
			
				|  |  | +        return succeed(exportFile);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @ApiOperation("收入订单详情")
 | 
	
		
			
				|  |  |      @PostMapping("getIncomeOrderDetail")
 | 
	
		
			
				|  |  |      public HttpResponseResult<PaymentDivMemberRecordWrapper.OrderDetailDto> getIncomeOrderDetail(String orderNo){
 |