zoujiajian 9 maanden geleden
bovenliggende
commit
e54c81624b

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mange/CmsAccountService.java

@@ -61,5 +61,5 @@ public interface CmsAccountService extends IService<Account> {
 
 	void batchDeleteAccountTrips(DelAccountTripsReq delAccountTripsReq, long adminId) throws Exception;
 
-	void batchDelAccountTripsByGoodsAccount(DelAccountTripsReq delAccountTripsReq, long adminId) throws Exception;
+	List<String> batchDelAccountTripsByGoodsAccount(DelAccountTripsReq delAccountTripsReq, long adminId) throws Exception;
 }

+ 6 - 1
netflix-service/src/main/java/com/cyksj/service/mange/account/CmsAccountServiceImpl.java

@@ -560,7 +560,7 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 	}
 
 	@Override
-	public void batchDelAccountTripsByGoodsAccount(DelAccountTripsReq delAccountTripsReq, long adminId) throws Exception {
+	public List<String> batchDelAccountTripsByGoodsAccount(DelAccountTripsReq delAccountTripsReq, long adminId) throws Exception {
 		CmsUser cmsUser = cmsUserMapper.selectById(adminId);
 		Integer goodsId = delAccountTripsReq.getGoodsId();
 		List<String> accounts = delAccountTripsReq.getAccounts();
@@ -568,11 +568,14 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 		GoodsDon goodsDon = goodsDonMapper.selectById(goodsId);
 		Assert.notNull(goodsDon,"平台不存在");
 
+		List<String> fails = new ArrayList<>();
+
 		if (CollUtil.isNotEmpty(accounts)) {
 			DelAccountRecord delAccountRecord = null;
 			for (String account : accounts) {
 				Account dbAccount = accountMapper.selectOne(Wrappers.lambdaQuery(Account.class).eq(Account::getAccount, account.trim()).eq(Account::getGoodsId, goodsId));
 				if (dbAccount == null) {
+					fails.add(account);
 					continue;
 				}
 				GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class)
@@ -584,6 +587,7 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 							.ne(GroupsRelation::getUserId, 0));
 					//车队上存在用户不删除 下个循环
 					if (selectCount > 0) {
+						fails.add(account);
 						continue;
 					}
 					groupsMapper.deleteById(groupsTrips.getId());
@@ -599,5 +603,6 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 				accountMapper.deleteById(dbAccount.getId());
 			}
 		}
+		return fails;
 	}
 }

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

@@ -811,10 +811,10 @@ public class CmsAccountController {
 	 * 导入账号 批量删除
 	 */
 	@DeleteMapping("/batch/delete/goods/accountTrips")
-	public Result<String> batchDelAccountTripsByGoodsAccount(@RequestBody DelAccountTripsReq delAccountTripsReq) throws Exception {
+	public Result<List<String>> batchDelAccountTripsByGoodsAccount(@RequestBody DelAccountTripsReq delAccountTripsReq) throws Exception {
 		long adminId = StpUtil.getLoginIdAsLong();
-		accountService.batchDelAccountTripsByGoodsAccount(delAccountTripsReq, adminId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
+		List<String> fails = accountService.batchDelAccountTripsByGoodsAccount(delAccountTripsReq, adminId);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(fails);
 	}
 
     @PutMapping("/update/expiryTime")