|
|
@ -196,7 +196,7 @@ public class WeiXinService implements IWeiXinService { |
|
|
|
params.put("department_id", department.getId()); |
|
|
|
params.put("fetch_child", 0); |
|
|
|
JSONObject userResult = (JSONObject) RestTemplateUtil.getForEntity(WeiXinConstant.USER_LIST, params, JSONObject.class); |
|
|
|
if (WeiXinConstant.pageResult(userResult)) { |
|
|
|
if (!WeiXinConstant.pageResult(userResult)) { |
|
|
|
log.error("查询员工信息异常:{},{}", params, userResult); |
|
|
|
return; |
|
|
|
} |
|
|
@ -218,7 +218,7 @@ public class WeiXinService implements IWeiXinService { |
|
|
|
DepartmentEmployee de = new DepartmentEmployee(); |
|
|
|
de.setId(snowflake.nextId()); |
|
|
|
de.setEmployeeId(employee.getId()); |
|
|
|
de.setDepartmentId((Long)departmentIds.get(0)); |
|
|
|
de.setDepartmentId(departmentIds.getLong(0)); |
|
|
|
de.setSort(i); |
|
|
|
des.add(de); |
|
|
|
} |
|
|
@ -228,12 +228,13 @@ public class WeiXinService implements IWeiXinService { |
|
|
|
} |
|
|
|
|
|
|
|
private void insertBatchEmployee(List<Employee> employees, List<DepartmentEmployee> des) { |
|
|
|
TransactionStatus status = getTransactionStatus(); |
|
|
|
|
|
|
|
int empSize = employees.size(); |
|
|
|
int deSize = des.size(); |
|
|
|
int once = 100; |
|
|
|
for (int i = 0; i < empSize; i+=once) { |
|
|
|
int end = i+once > empSize ? empSize : i+once; |
|
|
|
TransactionStatus status = getTransactionStatus(); |
|
|
|
try { |
|
|
|
employeeDao.insertBatch(employees.subList(i, end)); |
|
|
|
//提交事务
|
|
|
@ -246,6 +247,7 @@ public class WeiXinService implements IWeiXinService { |
|
|
|
} |
|
|
|
for (int i = 0; i < deSize; i+=once) { |
|
|
|
int end = i+once > deSize ? deSize : i+once; |
|
|
|
TransactionStatus status = getTransactionStatus(); |
|
|
|
try { |
|
|
|
departmentEmployeeDao.insertBatch(des.subList(i, end)); |
|
|
|
//提交事务
|
|
|
|