Browse Source

组织信息同步

master
liuxinxin 1 year ago
parent
commit
65ca2a69b2
3 changed files with 15 additions and 10 deletions
  1. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingEmployeeInfo.java
  3. +7
    -7
      pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java

+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java View File

@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -75,7 +76,8 @@ public class EmployeeBatchGetTask {
}
Long totalSize = data.getTotalSize();
if (totalSize > PAGE_SIZE) {
int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE);
int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0;
int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo;
for (pageNo = 2; pageNo <= maxPageNo; pageNo++) {
query.setPageNo(maxPageNo);
GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
@@ -99,7 +101,6 @@ public class EmployeeBatchGetTask {
saveBatch(dingEmployeeInfoSaveRecordList);
}
}

}


@@ -137,6 +138,10 @@ public class EmployeeBatchGetTask {
dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode());
dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode());
dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus());
dingEmployeeInfo.setCreateOn(LocalDateTime.now());
dingEmployeeInfo.setUpdateOn(LocalDateTime.now());
dingEmployeeInfo.setCreateBy(-1L);
dingEmployeeInfo.setUpdateBy(-1L);
segmentSaveRecordList.add(dingEmployeeInfo);
}
saveRecordList.addAll(segmentSaveRecordList);


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingEmployeeInfo.java View File

@@ -32,7 +32,7 @@ public class DingEmployeeInfo implements Serializable {

private Long updateBy;

private String emplyeeName;
private String employeeName;

private String gmtCreate;



+ 7
- 7
pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java View File

@@ -1,7 +1,7 @@
package com.ningdatech.pmapi.organization;

import com.ningdatech.pmapi.AppTests;
//import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask;
import com.ningdatech.zwdd.client.ZwddAuthClient;
import com.ningdatech.zwdd.client.ZwddClient;
@@ -24,17 +24,17 @@ class OrganizationTest extends AppTests {
@Autowired
private OrganizationBatchGetTask organizationBatchGetTask;

// @Autowired
// private EmployeeBatchGetTask employeeBatchGetTask;
@Autowired
private EmployeeBatchGetTask employeeBatchGetTask;

@Test
public void testBatchGetOrganization() {
organizationBatchGetTask.batchGetOrganizationTask();
}

// @Test
// public void testEmployeeBatchGetTask(){
// employeeBatchGetTask.batchGetEmployeeTask();
// }
@Test
public void testEmployeeBatchGetTask(){
employeeBatchGetTask.batchGetEmployeeTask();
}

}

Loading…
Cancel
Save