Browse Source

Merge remote-tracking branch 'origin/master'

lfx 2 months ago
parent
commit
9dfc17f4fa
1 changed files with 33 additions and 3 deletions
  1. 33 3
      mjava-mc/src/main/java/com/malk/mc/controller/McDdController.java

+ 33 - 3
mjava-mc/src/main/java/com/malk/mc/controller/McDdController.java

@@ -3,19 +3,23 @@ package com.malk.mc.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.malk.server.common.McException;
 import com.malk.server.common.McException;
 import com.malk.server.common.McR;
 import com.malk.server.common.McR;
+import com.malk.server.dingtalk.DDR_New;
 import com.malk.service.dingtalk.DDClient;
 import com.malk.service.dingtalk.DDClient;
 import com.malk.service.dingtalk.DDClient_Group;
 import com.malk.service.dingtalk.DDClient_Group;
 import com.malk.service.dingtalk.DDClient_Report;
 import com.malk.service.dingtalk.DDClient_Report;
+import com.malk.utils.UtilMap;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
+import com.malk.service.dingtalk.DDClient_Attendance;
 
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
 
 
 @Slf4j
 @Slf4j
 @RestController
 @RestController
@@ -29,6 +33,11 @@ public class McDdController {
     @Autowired
     @Autowired
     private DDClient ddClient;
     private DDClient ddClient;
 
 
+    @Autowired
+    private DDClient_Attendance ddClientAttendance;
+
+
+
     @PostMapping("/group/createGroupByTemp")
     @PostMapping("/group/createGroupByTemp")
     public McR createGroupByTemp(@RequestBody JSONObject param){
     public McR createGroupByTemp(@RequestBody JSONObject param){
         log.info("创建场景群:{}",param);
         log.info("创建场景群:{}",param);
@@ -53,4 +62,25 @@ public class McDdController {
         return McR.success(result);
         return McR.success(result);
     }
     }
 
 
+    @PostMapping("/attendence/getAttendenceDetail")
+    public McR getAttendenceDetail(@RequestBody JSONObject param) throws ParseException {
+        log.info("考勤参数详情:{}",param);
+        McException.assertParamException_Null(param,"checkDateFrom","checkDateTo","userIds");
+        String accessToken = ddClient.getAccessToken();
+        List userIds = (List) param.get("userIds");
+        String checkDateFrom = param.getString("checkDateFrom")+" 00:00:00";
+        String checkDateTo = param.getString("checkDateTo")+" 00:00:00";
+        List<Map> results = ddClientAttendance.listAttendanceRecord(accessToken, userIds, checkDateFrom, checkDateTo);
+        log.info("获取考勤详情:{}",results);
+        Set<String> addressList = new HashSet<>();
+        String address = "";
+        for(Map result:results){
+            System.out.println("result:"+result.get("userAddress"));
+            addressList.add(result.get("userAddress").toString()) ;
+        }
+        System.out.println("address:"+addressList) ;
+         address = addressList.stream().collect(Collectors.joining(","));
+        return McR.success(address);
+    }
+
 }
 }