|
@ -1,5 +1,7 @@ |
|
|
package com.lottery.admin.service.Impl; |
|
|
package com.lottery.admin.service.Impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
|
import com.alibaba.excel.support.ExcelTypeEnum; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
@ -22,6 +24,9 @@ import com.lottery.vo.WinUserVo; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
|
import java.net.URLEncoder; |
|
|
import java.util.Collections; |
|
|
import java.util.Collections; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
@ -66,6 +71,7 @@ public class AdminWinServiceImpl extends ServiceImpl<AdminWinMapper, WinnerRecor |
|
|
"%" + winUserQueryDto.getUsername() + "%" |
|
|
"%" + winUserQueryDto.getUsername() + "%" |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(winUserQueryDto.getJwcode())) { |
|
|
if (StringUtils.isNotBlank(winUserQueryDto.getJwcode())) { |
|
|
// 需要关联用户表查询jw号 |
|
|
// 需要关联用户表查询jw号 |
|
|
recordWrapper.exists( |
|
|
recordWrapper.exists( |
|
@ -137,4 +143,36 @@ public class AdminWinServiceImpl extends ServiceImpl<AdminWinMapper, WinnerRecor |
|
|
// List<UserVo> userVolist = ConvertBeanUtil.convertList(userPage.getRecords(), UserVo.class); |
|
|
// List<UserVo> userVolist = ConvertBeanUtil.convertList(userPage.getRecords(), UserVo.class); |
|
|
// return PageInfo.of(userPage, userVolist); |
|
|
// return PageInfo.of(userPage, userVolist); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//导出数据 |
|
|
|
|
|
@Override |
|
|
|
|
|
public void exportWinUser(WinUserQueryDto winUserQueryDto, HttpServletResponse response) throws UnsupportedEncodingException { |
|
|
|
|
|
|
|
|
|
|
|
// response.setContentType("application/json.openxmlfomats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
|
|
|
|
|
// response.setCharacterEncoding("utf-8"); |
|
|
|
|
|
// |
|
|
|
|
|
// // 根据姓名获取user_id(列表) |
|
|
|
|
|
// |
|
|
|
|
|
// |
|
|
|
|
|
// // 根据user_id查询用户信息 |
|
|
|
|
|
// |
|
|
|
|
|
// |
|
|
|
|
|
// |
|
|
|
|
|
// // 3. 处理中文文件名(URL 编码) |
|
|
|
|
|
// String fileName = "获奖记录" + ".xlsx"; |
|
|
|
|
|
// String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20"); |
|
|
|
|
|
// |
|
|
|
|
|
// // 4. 设置 Content-Disposition 响应头(指定下载文件名) |
|
|
|
|
|
// response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encodedFileName); |
|
|
|
|
|
// |
|
|
|
|
|
// |
|
|
|
|
|
// // 查询数据列表 |
|
|
|
|
|
// List<FundingExport> list = listWinUser(1,10,winUserQueryDto); |
|
|
|
|
|
// |
|
|
|
|
|
// EasyExcel.write(response.getOutputStream(), FundingExport.class) |
|
|
|
|
|
// .excelType(ExcelTypeEnum.XLSX) |
|
|
|
|
|
// .sheet("获奖记录") |
|
|
|
|
|
// .doWrite(list); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |