Commit 8cfb12e5 by xugaojun

调整欢迎语部门条目限制

parent dc2b7e3e
......@@ -47,7 +47,7 @@ public class WelcomeServiceImpl implements WelcomeService {
private TabMiniprogramSettingMapper miniprogramSettingMapper;
private static final int WELCOME_LIMIT = 50;
private static final int DEPARTMENT_NUM_LIMIT = 2000;
private static final int DEPARTMENT_NUM_LIMIT = 10000;
private static final int STAFF_NUM_LIMIT = 2000;
@Override
......
......@@ -28,13 +28,33 @@ public class WelcomeSuitRangServiceImpl implements WelcomeSuitRangService {
@Autowired
private TabHaobanWelcomeSuitRangMapper welcomeSuitRangMapper;
private static final int INSERT_LIMIT = 500;
@Override
public void addSuitDepartment(String welcomeId, String wxEnterpriseId, List<WelcomeSuitDepartmentBO> suitDepartmentList) {
if (CollectionUtils.isEmpty(suitDepartmentList)) {
return;
}
// 构建实体类
List<TabHaobanWelcomeSuitRang> welcomeSuitRangList = suitDepartmentList.stream().map(one -> {
int size = suitDepartmentList.size();
if (size <= INSERT_LIMIT) {
welcomeSuitRangMapper.batchInsert(convertWelcomeSuitRang(welcomeId, wxEnterpriseId, suitDepartmentList));
return;
}
int from;
int to;
int times = (size / INSERT_LIMIT) + 1;
for (int i = 1; i <= times; i++) {
from = (i - 1) * INSERT_LIMIT;
to = Math.min(i * INSERT_LIMIT, size);
List<WelcomeSuitDepartmentBO> subTaskIdList = suitDepartmentList.subList(from, to);
welcomeSuitRangMapper.batchInsert(convertWelcomeSuitRang(welcomeId, wxEnterpriseId, subTaskIdList));
}
}
private List<TabHaobanWelcomeSuitRang> convertWelcomeSuitRang(String welcomeId,
String wxEnterpriseId,
List<WelcomeSuitDepartmentBO> suitDepartmentList) {
return suitDepartmentList.stream().map(one -> {
TabHaobanWelcomeSuitRang welcomeSuitRang = new TabHaobanWelcomeSuitRang();
welcomeSuitRang.setWelcomeSuitRangId(UniqueIdUtils.uniqueLong());
welcomeSuitRang.setWxEnterpriseId(wxEnterpriseId);
......@@ -52,7 +72,6 @@ public class WelcomeSuitRangServiceImpl implements WelcomeSuitRangService {
welcomeSuitRang.setDeleteFlag(0);
return welcomeSuitRang;
}).collect(Collectors.toList());
welcomeSuitRangMapper.batchInsert(welcomeSuitRangList);
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment