|
@@ -171,6 +171,43 @@ public class TenantActivationCodeController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @GetMapping("/exportOrderCode")
|
|
|
+ @ApiOperation(value = "导出订单激活码模板")
|
|
|
+ public void exportOrderCode(HttpServletResponse response,String orderNo) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("请登录");
|
|
|
+ }
|
|
|
+ Long tenantId = sysUser.getTenantId();
|
|
|
+
|
|
|
+ TenantActivationCodeWrapper.TenantActivationCodeQuery query =
|
|
|
+ new TenantActivationCodeWrapper.TenantActivationCodeQuery();
|
|
|
+ query.setTenantId(tenantId);
|
|
|
+ query.setActivationStatus(false);
|
|
|
+ query.setOrderNo(orderNo);
|
|
|
+ query.setPage(1);
|
|
|
+ query.setRows(9999);
|
|
|
+ IPage<TenantActivationCodeWrapper.TenantActivationCode> queryInfo =
|
|
|
+ tenantActivationCodeService.selectPage(QueryInfo.getPage(query), query);
|
|
|
+ List<TenantActivationCodeWrapper.TenantActivationCode> rows = queryInfo.getRecords();
|
|
|
+ if (rows.isEmpty()) {
|
|
|
+ throw new BizException("没有可导出数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ try (OutputStream outputStream = response.getOutputStream()) {
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"激活码"}, new String[]{
|
|
|
+ "activationCode"}, rows);
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attac:wq" +
|
|
|
+ "hment;filename=active_code-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
+ workbook.write(outputStream);
|
|
|
+ outputStream.flush();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("导出激活码异常", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("/importActiveCode")
|
|
|
@ApiOperation(value = "导入", notes = "传入file")
|
|
|
public HttpResponseResult<List<ErrMsg>> importActiveCode(
|