| | |
| | | package com.project.admin.controller.system; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.project.common.annotation.Log; |
| | | import com.project.common.annotation.RepeatSubmit; |
| | | import com.project.common.config.ProjectConfig; |
| | | import com.project.common.core.controller.BaseController; |
| | | import com.project.common.core.domain.AjaxResult; |
| | | import com.project.common.core.page.TableDataInfo; |
| | |
| | | |
| | | @ApiOperation("下载二维码") |
| | | @GetMapping("/downloadQrcode") |
| | | public void downloadQrcode(SysCompanyQueryBo bo, HttpServletResponse response) |
| | | public void downloadQrcode(String companyIds, HttpServletResponse response) |
| | | { |
| | | List<SysCompanyVo> list = iSysCompanyService.queryList(bo); |
| | | if (StringUtils.isNotEmpty(companyIds)){ |
| | | String[] split = companyIds.split(","); |
| | | List<Long> longs = new ArrayList<>(); |
| | | for (String s : split) { |
| | | long l = Long.parseLong(s); |
| | | longs.add(l); |
| | | } |
| | | List<SysCompany> list = iSysCompanyService.list(iSysCompanyService.lq() |
| | | .in(StringUtils.isNotEmpty(longs), SysCompany::getCompanyId, longs) |
| | | ); |
| | | list.forEach(e->{ |
| | | if (StringUtils.isEmpty(e.getQrcodeImg())){ |
| | | String qrcode = ImageUtils.createQrcode(e.getCompanyCode(), e.getCompanyName(), "2"); |
| | | e.setQrcodeImg(qrcode); |
| | | iSysCompanyService.updateById(Convert.convert(SysCompany.class, e)); |
| | | iSysCompanyService.updateById(e); |
| | | } |
| | | }); |
| | | List<String> collect = list.stream().map(SysCompanyVo::getQrcodeImg).collect(Collectors.toList()); |
| | | ZipUtils.downloadToZip(collect, response); |
| | | List<String> collect = list.stream().map(SysCompany::getQrcodeImg).collect(Collectors.toList()); |
| | | List<String> names = list.stream().map(SysCompany::getCompanyName).collect(Collectors.toList()); |
| | | ZipUtils.downloadToZip(collect,names, response); |
| | | } |
| | | } |
| | | |
| | | |