| | |
| | | package cn.lili.modules.lmk.service.impl; |
| | | |
| | | import cn.lili.common.security.context.UserContext; |
| | | import cn.lili.common.utils.StringUtils; |
| | | import cn.lili.modules.lmk.domain.query.PrizeGrantRecordQuery; |
| | | import cn.lili.modules.lmk.domain.query.PrizeRecordTimeQuery; |
| | | import cn.lili.modules.lmk.domain.vo.PrizeRecordTimeVO; |
| | | import cn.lili.modules.lmk.enums.general.PrizeDistributeStatusEnum; |
| | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | for (PrizeRecordVO vo : list){ |
| | | PrizeRecordExportDetailDTO detailDtO = new PrizeRecordExportDetailDTO(); |
| | | BeanUtils.copyProperties(vo,detailDtO); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // 将Date类型转换为指定格式的字符串 |
| | | String createTimeStr = sdf.format(vo.getCreateTime()); |
| | | // 设置到DTO中 |
| | | detailDtO.setCreateTime(createTimeStr); |
| | | exportDetailDTOS.add(detailDtO); |
| | | } |
| | | XSSFWorkbook workbook = new XSSFWorkbook(); |
| | |
| | | Row header = sheet.createRow(0); |
| | | String[] headers = { |
| | | "用户昵称", "活动名","中奖状态", |
| | | "中奖内容","奖品发放状态" |
| | | "中奖内容","奖品发放状态","抽奖时间" |
| | | }; |
| | | for(int i= 0 ;i< headers.length;i++){ |
| | | Cell cell = header.createCell(i); |
| | |
| | | }else { |
| | | row.createCell(4).setCellValue(PrizeDistributeStatusEnum.WAIT.getDescription()); |
| | | } |
| | | |
| | | row.createCell(5).setCellValue(dto.getCreateTime()); |
| | | } |
| | | |
| | | return workbook; |
| | |
| | | } |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | | @Override |
| | | public Result pageByUserId(PrizeRecordQuery query) { |
| | | String userId = UserContext.getCurrentUser().getId(); |
| | | IPage<PrizeRecordVO> page = PageUtil.getPage(query, PrizeRecordVO.class); |
| | | if (StringUtils.isNotBlank(userId)){ |
| | | baseMapper.getByUserIdPage(page, query, userId); |
| | | for (PrizeRecordVO vo :page.getRecords()){ |
| | | if (StringUtils.isNotBlank(vo.getPrizeActivityCover())){ |
| | | vo.setPrizeActivityCoverUrl(cosUtil.getPreviewUrl(vo.getPrizeActivityCover())); |
| | | } |
| | | if (StringUtils.isNotBlank(vo.getPrizeImg())){ |
| | | vo.setPrizeImgUrl(cosUtil.getPreviewUrl(vo.getPrizeImg())); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 根据id查找 |