修改转赠保存方式

This commit is contained in:
liaozetao
2023-11-06 16:07:53 +08:00
parent 87dc834aae
commit f2198f37e2

View File

@@ -16,10 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -53,6 +50,7 @@ public class GiveUserAdminServiceImpl implements GiveUserAdminService {
}
String[] erBanNoArray = erBanNoStr.split(StrUtil.COMMA);
Date now = new Date();
List<GiveUser> giveUsers = new ArrayList<>();
for (String erBanNo : erBanNoArray) {
List<String> uidList = usersBaseService.getUidByErbanNo(Collections.singletonList(erBanNo));
if (CollectionUtil.isEmpty(uidList)) {
@@ -68,8 +66,9 @@ public class GiveUserAdminServiceImpl implements GiveUserAdminService {
if (count > 0) {
throw new ServiceException("添加失败," + erBanNo + "已存在");
}
giveUserService.save(giveUser);
giveUsers.add(giveUser);
}
giveUserService.saveBatch(giveUsers);
}
@Override