소스 검색

替换封禁短信通知

zoujiajian 2 년 전
부모
커밋
e363e7d087
1개의 변경된 파일14개의 추가작업 그리고 7개의 파일을 삭제
  1. 14 7
      netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

+ 14 - 7
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -928,6 +928,7 @@ public class CmsAccountController {
 	@PostMapping("/replace/banned")
 	public Result<List<String>> replaceBannedAccount(Long goodsId, MultipartFile file) throws IOException {
 		List<String> repeat = new ArrayList<>();
+		List<Long> sendMsgList = new ArrayList<>();
 		EasyExcel.read(file.getInputStream(), ExcelBannedAccountData.class, new AnalysisEventListener<ExcelBannedAccountData>() {
 			@Override
 			public void invoke(ExcelBannedAccountData data, AnalysisContext analysisContext) {
@@ -956,13 +957,7 @@ public class CmsAccountController {
 				dbAccount.setExpiryTime(DateUtil.offsetMonth(DateTime.now(), 1));
 				accountService.updateById(dbAccount);
 
-				TASK_EXECUTOR.execute(() -> {
-					GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class)
-							.eq(GroupsTrips::getAccountId, dbAccount.getId()).last("limit 1"));
-					if (groupsTrips != null) {
-						cmsGroupService.sendChangeAccountMsg(groupsTrips.getId(), goodsId);
-					}
-				});;
+				sendMsgList.add(dbAccount.getId());
 			}
 
 			@Override
@@ -970,6 +965,18 @@ public class CmsAccountController {
 
 			}
 		}).sheet().doRead();
+
+		if (CollUtil.isNotEmpty(sendMsgList)) {
+			TASK_EXECUTOR.execute(() -> {
+				sendMsgList.forEach(accountId -> {
+					GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class)
+							.eq(GroupsTrips::getAccountId, accountId).last("limit 1"));
+					if (groupsTrips != null) {
+						cmsGroupService.sendChangeAccountMsg(groupsTrips.getId(), goodsId);
+					}
+				});
+			});
+		}
 		return GatewayResponse.SUCCESS.newBuilder().toResult(repeat);
 	}