From b60e601d62c0e2d5c4fd1df9f12fa09f2bf99987 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期一, 14 十月 2024 17:56:48 +0800 Subject: [PATCH] 调试支付 --- xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java | 38 ++++++++++++++------------------------ 1 files changed, 14 insertions(+), 24 deletions(-) diff --git a/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java b/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java index 70d639d..5842e00 100644 --- a/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java +++ b/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java @@ -95,21 +95,12 @@ @Resource private RemoteUserService remoteUserService; public static void main(String[] args) { -// LocalDateTime dateTime = LocalDateTime.now(); -// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); -// String formattedDateTime = dateTime.format(formatter); -// System.err.println(formattedDateTime); // 收件人电子邮箱,TODO 换成自己的收件箱 String to = "443237572@qq.com"; - // 发件人电子邮箱,TODO 换成自己的发件箱 String from = "13281306557@163.com"; - // 指定发送邮件的主机为 String host = "smtp.163.com"; - - // 获取系统属性 - //Properties properties = System.getProperties(); Properties properties = new Properties(); // 设置邮件服务器 properties.setProperty("mail.smtp.host", host); @@ -142,37 +133,30 @@ InternetAddress toMail2 = new InternetAddress("443237572@qq.com"); //发一个邮箱 // message.setRecipient(Message.RecipientType.TO, toMail); - //发多个邮箱 Address[] allRecipients = {toMail, toMail2}; message.setRecipients(Message.RecipientType.TO, allRecipients); - // Set Subject: 邮件主体 message.setSubject("明星电力"); - // 设置消息体 message.setSentDate(new Date()); - // 指定为混合关系 MimeMultipart msgMultipart = new MimeMultipart("mixed"); message.setContent(msgMultipart); - // 邮件信息组装 //组装的顺序非常重要,一定要先组装文本域,再组装文件 MimeBodyPart htmlPart = new MimeBodyPart(); // 组装内容 htmlPart.setContent("This is message content", "text/html;charset=UTF-8"); msgMultipart.addBodyPart(htmlPart); - // 组装附件 MimeBodyPart filePart = new MimeBodyPart(); - String imageUrl = "http://221.182.45.100:8090/2024-10-10/04-18-09-0466d831fc6365571080.pdf"; + String imageUrl = "https://xqgwzh.obs.cn-south-1.myhuaweicloud.com/xinquan/b176cf9af35d4773a276e55b7afe3b63.mp4"; try { // 下载数据 URL url = new URL(imageUrl); InputStream inputStream = url.openStream(); byte[] imageBytes = IOUtils.toByteArray(inputStream); - // 创建临时文件 // 截取imageUrl后缀名 String fileExtension = imageUrl.substring(imageUrl.lastIndexOf(".")); @@ -180,7 +164,6 @@ try (FileOutputStream fos = new FileOutputStream(tempFile)) { fos.write(imageBytes); } - // 创建 FileDataSource FileDataSource fileDataSource = new FileDataSource(tempFile); System.out.println("FileDataSource created: " + fileDataSource.getName()); @@ -650,19 +633,26 @@ // 查询登录用户邀请了哪些人 List<Long> collect = page.getRecords().stream().map(AppUser::getId).collect(Collectors.toList()); if (collect.isEmpty())return R.ok(PageDTO.empty(page)); - StringBuilder stringBuilder = new StringBuilder(); - collect.forEach(id -> stringBuilder.append(id).append(",")); - // 去除最后一位 - StringBuilder stringBuilder1 = stringBuilder.deleteCharAt(stringBuilder.length() - 1); - String[] split = stringBuilder1.toString().split(","); for (int i = 0; i < page.getRecords().size(); i++) { AppUser appUser = page.getRecords().get(i); - appUser.setMoney(new BigDecimal(split[i])); + // 查询该给用户带来收益 + List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery().eq(AppUserWalletRecord::getAppUserId, userId) + .eq(AppUserWalletRecord::getChildAppUserId,appUser.getUserId()).list(); + BigDecimal bigDecimal = new BigDecimal("0"); + for (AppUserWalletRecord appUserWalletRecord : list) { + if (appUserWalletRecord.getAmount()!=null && appUserWalletRecord.getChangeType() == 1){ + bigDecimal = bigDecimal.add(appUserWalletRecord.getAmount()); + } + } + appUser.setMoney(bigDecimal); + } // 根据佣金金额 从大到小排序 page.getRecords().sort((o1, o2) -> o2.getMoney().compareTo(o1.getMoney())); return R.ok(PageDTO.of(page, InviteRankListVO.class)); } + @Resource + private AppUserWalletRecordService appUserWalletRecordService; /** * 爱心助力榜单-分页 * -- Gitblit v1.7.1