| | |
| | | } |
| | | TAppUser appUser = appUserService.getById(dto.getId()); |
| | | String code = appUser.getCode(); |
| | | if (dto.getCode() != null && !dto.getCode().isEmpty() && code!=null && !code.equals(dto.getCode())) { |
| | | if(code==null){ |
| | | appUser.setCode(dto.getCode()); |
| | | // 移除之前的二维码 |
| | | redisTemplate.delete("USER_WX_IMG" + appUser.getId()); |
| | | }else { |
| | | if (dto.getCode() != null && !dto.getCode().isEmpty() && !dto.getCode().equals(code)) { |
| | | appUser.setCode(dto.getCode()); |
| | | // 移除之前的二维码 |
| | | redisTemplate.delete("USER_WX_IMG" + appUser.getId()); |
| | | } |
| | | } |
| | | if (dto.getPromotionStatus() != null) { |
| | | appUser.setPromotionStatus(dto.getPromotionStatus()); |
| | |
| | | tAppUserVo.setReferrerUser(appUserService.getById(appUser.getReferrerUserId())); |
| | | } |
| | | return R.ok(tAppUserVo); |
| | | } |
| | | |
| | | @ApiOperation(value = "小程序用户金币导入模板下载") |
| | | @GetMapping("/import-template_gold") |
| | | public void importTemplateGold() { |
| | | List<AppUserGoldImport> imports = new ArrayList<>(); |
| | | AppUserGoldImport goldImport = new AppUserGoldImport(); |
| | | imports.add(goldImport); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), AppUserGoldImport.class, imports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("金币导入模板.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | System.out.println("金币导入模板下载失败!"); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "小程序用户导入模板下载") |
| | | @GetMapping("/import-template_user") |
| | | public void importTemplate() { |
| | | List<AppUserImport> imports = new ArrayList<>(); |
| | | AppUserImport appUserImport = new AppUserImport(); |
| | | imports.add(appUserImport); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), AppUserImport.class, imports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("小程序用户导入模板.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | System.out.println("小程序用户导入模板下载失败!"); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Log(title = "小程序用户-用户导入", businessType = BusinessType.IMPORT) |
| | | @ApiOperation(value = "小程序用户-用户导入") |
| | |
| | | if (one != null) { |
| | | tAppUser.setCompanyId(one.getId()); |
| | | } |
| | | appUserService.save(user); |
| | | appUserService.save(tAppUser); |
| | | i++; |
| | | } |
| | | if (!result.isEmpty()) { |