|
@@ -34,15 +34,18 @@ public class SapEmployeeTimeService extends BaseService {
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public void saveEmployeeTimes() throws Exception {
|
|
|
List<String> allUserIds = wxUserService.selectAllUserIds();
|
|
|
- String url = "https://api15.sapsf.cn/odata/v2/EmployeeTime?$filter=userId in %s&$format=json";
|
|
|
- Map<String, List<String>> map = groupList(allUserIds);
|
|
|
+ Map<String, List<String>> map = groupList(allUserIds, 25);
|
|
|
+ String url = null;
|
|
|
for (String key : map.keySet()) {
|
|
|
- url = String.format(url, getUserIdList(map.get(key)));
|
|
|
+ System.out.println(getUserIdList(map.get(key)));
|
|
|
+ url = String.format("https://api15.sapsf.cn/odata/v2/EmployeeTime?$filter=userId in %s&$format=json",
|
|
|
+ getUserIdList(map.get(key)));
|
|
|
JsonNode node = requestService.getForObject(url, getHttpHeaders());
|
|
|
SapEmployeeTime dbEmployeeTime = null;
|
|
|
SapEmployeeTime employeeTime = null;
|
|
|
if (node != null) {
|
|
|
Iterator<JsonNode> iterator = node.get("d").get("results").elements();
|
|
|
+ int i = 0;
|
|
|
while (iterator.hasNext()) {
|
|
|
JsonNode userNode = iterator.next();
|
|
|
String externalCode = JsonNodeUtil.getValue(userNode, "externalCode");
|
|
@@ -66,7 +69,8 @@ public class SapEmployeeTimeService extends BaseService {
|
|
|
String startTime = JsonNodeUtil.getValue(userNode, "startTime");
|
|
|
String loaEndJobInfoId = JsonNodeUtil.getValue(userNode, "loaEndJobInfoId");
|
|
|
String approvalStatus = JsonNodeUtil.getValue(userNode, "approvalStatus");
|
|
|
- String cancellationWorkflowRequestId = JsonNodeUtil.getValue(userNode, "cancellationWorkflowRequestId");
|
|
|
+ String cancellationWorkflowRequestId = JsonNodeUtil.getValue(userNode,
|
|
|
+ "cancellationWorkflowRequestId");
|
|
|
String deductionQuantity = JsonNodeUtil.getValue(userNode, "deductionQuantity");
|
|
|
String editable = JsonNodeUtil.getValue(userNode, "editable");
|
|
|
String lastModifiedBy = JsonNodeUtil.getValue(userNode, "lastModifiedBy");
|
|
@@ -86,14 +90,14 @@ public class SapEmployeeTimeService extends BaseService {
|
|
|
.createdDateTime(createdDateTime).timeType(timeType)
|
|
|
.loaExpectedReturnDate(loaExpectedReturnDate).flexibleRequesting(flexibleRequesting)
|
|
|
.timeRecordOrigin(timeRecordOrigin).mdfSystemRecordStatus(mdfSystemRecordStatus)
|
|
|
- .custPeriod(custPeriod).quantityInHours(quantityInHours).loaStartJobInfoId(loaStartJobInfoId)
|
|
|
- .startDate(startDate).startDateTime(startDateTime).endDate(endDate).endDateTime(endDateTime)
|
|
|
- .displayQuantity(displayQuantity).quantityInDays(quantityInDays).startTime(startTime)
|
|
|
- .loaEndJobInfoId(loaEndJobInfoId).approvalStatus(approvalStatus)
|
|
|
- .cancellationWorkflowRequestId(cancellationWorkflowRequestId)
|
|
|
+ .custPeriod(custPeriod).quantityInHours(quantityInHours)
|
|
|
+ .loaStartJobInfoId(loaStartJobInfoId).startDate(startDate).startDateTime(startDateTime)
|
|
|
+ .endDate(endDate).endDateTime(endDateTime).displayQuantity(displayQuantity)
|
|
|
+ .quantityInDays(quantityInDays).startTime(startTime).loaEndJobInfoId(loaEndJobInfoId)
|
|
|
+ .approvalStatus(approvalStatus).cancellationWorkflowRequestId(cancellationWorkflowRequestId)
|
|
|
.deductionQuantity(deductionQuantity).editable(editable).lastModifiedBy(lastModifiedBy)
|
|
|
- .workflowRequestId(workflowRequestId).undeterminedEndDate(undeterminedEndDate).userId(userId)
|
|
|
- .recurrenceGroup(recurrenceGroup).createdBy(createdBy)
|
|
|
+ .workflowRequestId(workflowRequestId).undeterminedEndDate(undeterminedEndDate)
|
|
|
+ .userId(userId).recurrenceGroup(recurrenceGroup).createdBy(createdBy)
|
|
|
.workflowInitiatedByAdmin(workflowInitiatedByAdmin).comment(comment)
|
|
|
.fractionQuantity(fractionQuantity).endTime(endTime)
|
|
|
.originalQuantityInDays(originalQuantityInDays).build();
|
|
@@ -107,10 +111,12 @@ public class SapEmployeeTimeService extends BaseService {
|
|
|
} else {
|
|
|
saveOne(employeeTime);
|
|
|
}
|
|
|
+ i++;
|
|
|
}
|
|
|
+ System.out.println(i);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 更新所有未通过的为无效
|
|
|
update("SapEmployeeTimeMapper.updateUnApprovedDelete", null);
|
|
|
|