| | |
| | | import cc.mrbird.febs.mall.entity.HappyActivityOption; |
| | | import cc.mrbird.febs.mall.entity.HappyActivityOrder; |
| | | import cc.mrbird.febs.mall.service.IAdminHappyActivityService; |
| | | import cc.mrbird.febs.mall.vo.activity.AdminHappyActivityOrderCheckVo; |
| | | import cn.hutool.core.date.DatePattern; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | |
| | | ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, res, os, false); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 核销记录列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("activityOrderCheckList") |
| | | public FebsResponse activityOrderCheckList(AdminHappyActivityOrderCheckDto dto, QueryRequest request) { |
| | | |
| | | Map<String, Object> data = getDataTable(adminHappyActivityService.activityOrderCheckList(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 核销记录-手动核销 |
| | | */ |
| | | @PostMapping("checkOrderItem") |
| | | @ControllerEndpoint(operation = "核销记录-手动核销", exceptionMessage = "操作失败") |
| | | public FebsResponse checkOrderItem(@RequestBody List<Long> dto) { |
| | | |
| | | return adminHappyActivityService.checkOrderItem(dto); |
| | | } |
| | | |
| | | @SneakyThrows |
| | | @GetMapping("/exportOrderCheckList") |
| | | public void exportOrderCheckList(@RequestParam Map<String, String> params, HttpServletResponse response) { |
| | | //获取查询参数 |
| | | if(ObjectUtil.isEmpty(params.get("activityId"))){ |
| | | throw new FebsException("请选择活动"); |
| | | } |
| | | String activityId = params.get("activityId"); |
| | | HappyActivity happyActivity = adminHappyActivityService.getBaseMapper().selectById(activityId); |
| | | if(ObjectUtil.isEmpty(happyActivity)){ |
| | | throw new FebsException("活动不存在"); |
| | | } |
| | | List<ExcelSheetPO> res = new ArrayList<>(); |
| | | ExcelSheetPO orderSheet = new ExcelSheetPO(); |
| | | String title = happyActivity.getName() + "的核销记录"; |
| | | orderSheet.setTitle(title); |
| | | |
| | | String[] header = {"序号", "票号","参与人","电话", "地址","使用状态","核销时间","核销员", "姓名", "联系方式"}; |
| | | orderSheet.setHeaders(header); |
| | | |
| | | List<AdminHappyActivityOrderCheckVo> orderListForExport = adminHappyActivityService.getOrderCheckListForExport(params); |
| | | List<List<Object>> list = new ArrayList<>(); |
| | | if (orderListForExport.size() > 0) { |
| | | int i = 0; |
| | | for (AdminHappyActivityOrderCheckVo item : orderListForExport) { |
| | | i++; |
| | | List<Object> temp = new ArrayList<>(); |
| | | temp.add(i); |
| | | temp.add(item.getCode()); |
| | | temp.add(item.getName()); |
| | | temp.add(item.getPhone()); |
| | | temp.add(item.getAddress()); |
| | | temp.add(item.getState() == 1 ? "已使用" : "待使用"); |
| | | temp.add(item.getState() == 1 ? item.getUpdatedTime() : ""); |
| | | temp.add(item.getCheckName()); |
| | | temp.add(item.getCheckRealName()); |
| | | temp.add(item.getCheckPhone()); |
| | | list.add(temp); |
| | | } |
| | | } |
| | | orderSheet.setDataList(list); |
| | | res.add(orderSheet); |
| | | response = ResponseHeadUtil.setExcelHead(response); |
| | | response.setHeader("Content-Disposition", |
| | | "attachment;filename=" + URLEncoder.encode(title + DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN) + ".xlsx".trim(), "UTF-8")); |
| | | OutputStream os = null; |
| | | os = response.getOutputStream(); |
| | | ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, res, os, false); |
| | | } |
| | | |
| | | } |