|
@@ -2,6 +2,8 @@ package com.malk.kaiyue_nt.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.malk.kaiyue_nt.service.KYNTService;
|
|
|
import com.malk.server.common.McR;
|
|
|
import com.malk.server.dingtalk.DDConf;
|
|
@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -403,6 +406,32 @@ public class KYNTServiceImpl implements KYNTService {
|
|
|
return McR.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map getUserLeaveInfo(String userId) {
|
|
|
+ Map leaveMap = new HashMap();
|
|
|
+ //查询员工调休假余额
|
|
|
+ Map body2 = new HashMap();
|
|
|
+ body2.put("leave_code","8a10b574-4274-47bc-9bad-1df1c4308f60");//调休假
|
|
|
+ body2.put("op_userid",ddConf.getOperator());
|
|
|
+ body2.put("userids",userId);
|
|
|
+ body2.put("offset",0);
|
|
|
+ body2.put("size",10);
|
|
|
+ DDR_New ddrNew2 = (DDR_New) UtilHttp.doPost("https://oapi.dingtalk.com/topapi/attendance/vacation/quota/list", null, ddClient.initTokenParams(), body2, DDR_New.class);
|
|
|
+ Map result2 = (Map)ddrNew2.getResult();
|
|
|
+ int leaveNum = 0;
|
|
|
+ if (Objects.nonNull(result2.get("leave_quotas"))){
|
|
|
+ for (Map leaveQuotas : (List<Map>) result2.get("leave_quotas")) {
|
|
|
+ if (Objects.isNull(leaveQuotas.get("quota_num_per_day")) && Objects.nonNull(leaveQuotas.get("quota_num_per_hour"))){
|
|
|
+ leaveNum += ((int) leaveQuotas.get("quota_num_per_hour")) / 100;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ leaveMap.put("可预支调休",leaveNum);
|
|
|
+ leaveMap.put("实际加班小时数",Math.max(0,leaveNum-80));
|
|
|
+ leaveMap.put("已预支调休",Math.max(0,80-leaveNum));
|
|
|
+ }
|
|
|
+ return leaveMap;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 检查该更新事件在5s内是否处理过,应对钉钉瞬间重复回调
|
|
|
*
|