EDZ 3 лет назад
Родитель
Сommit
4cf65ddc8f

+ 72 - 3
src/main/java/net/chenlin/dp/modules/api/controller/DingdingOpenInterface.java

@@ -77,7 +77,7 @@ public class DingdingOpenInterface {
 
             req.setProcessCode(processCode);
             Calendar nowTime = Calendar.getInstance();
-            nowTime.add(Calendar.DAY_OF_YEAR, -30);
+            nowTime.add(Calendar.DAY_OF_YEAR, -1);
             Date date = nowTime.getTime();
             req.setStartTime(Long.valueOf(date.getTime()));//时间戳:例1586448000000
             String next_cursor = "1";
@@ -153,8 +153,75 @@ public class DingdingOpenInterface {
         return newMap;
     }
 
-    public static void main(String[] args) {
-        getOrderIdList("PROC-A561B73E-8282-4780-BB05-DCBA8125C45C");
+
+    /**
+     * 获取员工id列表
+     */
+    public static List<String> getPersonIdList() throws Exception {
+        getToken();//获取token
+        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/queryonjob");
+        OapiSmartworkHrmEmployeeQueryonjobRequest req = new OapiSmartworkHrmEmployeeQueryonjobRequest();
+        req.setStatusList("2,3,5,-1");
+        req.setOffset(0L);
+        req.setSize(50L);
+
+        List<String> list = new ArrayList<>();
+        Map<String,Object> map;
+        String next_cursor = "1";
+        while (!StringUtils.isNullOrEmpty(next_cursor)){
+
+            OapiSmartworkHrmEmployeeQueryonjobResponse rsp = client.execute(req, gettoken);
+            map = JSONUtils.jsonToMap(rsp.getBody());
+            if(map.get("errcode").equals(0)){
+                Map<String,Object> mapList = (Map<String, Object>) map.get("result");
+                if(mapList.get("next_cursor") != null){
+                    next_cursor = mapList.get("next_cursor").toString();
+                    req.setOffset(Long.valueOf(next_cursor));
+                }else{
+                    next_cursor = "";
+                }
+
+                list.addAll((List<String>) mapList.get("data_list"));
+            }
+        }
+
+        return list;
+    }
+
+
+    /**
+     * 通过用户id查询详情
+     * @throws ApiException
+     */
+    public static void getViewByUserId(String userId) throws Exception {
+        getToken();//获取token
+        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get");
+        OapiV2UserGetRequest req = new OapiV2UserGetRequest();
+        req.setUserid("2965176200854153");
+        req.setLanguage("zh_CN");
+        OapiV2UserGetResponse rsp = client.execute(req, gettoken);
+        Map<String,Object> map;
+        map = JSONUtils.jsonToMap(rsp.getBody());
+        if(map.get("errcode").equals(0)){
+            Map<String,Object> mapList = (Map<String, Object>) map.get("result");
+            System.out.println(mapList);
+            System.out.println(mapList.get("dept_id_list"));//所属部门ID列表。
+            System.out.println(mapList.get("email"));
+            System.out.println(mapList.get("extension"));
+            System.out.println(mapList.get("job_number"));
+            System.out.println(mapList.get("mobile"));
+            System.out.println(mapList.get("name"));
+            System.out.println(mapList.get("title"));
+            System.out.println(mapList.get("work_place"));
+        }
+
+    }
+
+
+
+    public static void main(String[] args) throws Exception {
+        getViewByUserId("");
+//        getOrderIdList("PROC-A561B73E-8282-4780-BB05-DCBA8125C45C");
 //            for (Map.Entry<String, Object> entry : JSONUtils.jsonToMap(rsp.getBody()).entrySet()) {
 //                System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
 //            }
@@ -180,7 +247,9 @@ public class DingdingOpenInterface {
             result.put(key, value);
 
         }
+
         return result;
+
     }
 
 }

+ 5 - 5
src/main/java/net/chenlin/dp/modules/api/controller/interfaceTest.java

@@ -66,11 +66,11 @@ public class interfaceTest {
         }
 
         //根据单据名称获取对应process_code
-        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/process/get_by_name");
-        OapiProcessGetByNameRequest req = new OapiProcessGetByNameRequest();
-        req.setName("报销申请");
-        OapiProcessGetByNameResponse rsp = client.execute(req, gettoken);
-        System.out.println(rsp.getBody());
+//        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/process/get_by_name");
+//        OapiProcessGetByNameRequest req = new OapiProcessGetByNameRequest();
+//        req.setName("付款申请单");
+//        OapiProcessGetByNameResponse rsp = client.execute(req, gettoken);
+//        System.out.println(rsp.getBody());
 
 
         /**

+ 41 - 0
src/main/java/net/chenlin/dp/modules/sys/controller/U8TestController.java

@@ -0,0 +1,41 @@
+package net.chenlin.dp.modules.sys.controller;
+
+import net.chenlin.dp.modules.sys.service.testU8Service;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.sql.*;
+
+public class U8TestController {
+
+
+    @Autowired
+    private testU8Service testU8Mapper;
+
+    public static void main(String[] args) {
+
+        String connectionUrl =
+
+                "jdbc:sqlserver://10.0.0.199:1433;DatabaseName=UFDATA_998_2021;integratedSecurity=false;";
+
+        try (Connection con = DriverManager.getConnection(connectionUrl, "sa", "123@qaz");
+
+             Statement stmt = con.createStatement();) {
+
+            String SQL = "SELECT TOP 10 * FROM AA_Bank";
+
+            ResultSet rs = stmt.executeQuery(SQL);
+
+            while (rs.next()) {
+
+                System.out.println(rs.getString("i_id"));
+
+            }
+
+        } catch (SQLException e) {
+
+            e.printStackTrace();
+
+        }
+
+    }
+}

+ 18 - 0
src/main/java/net/chenlin/dp/modules/sys/dao/TestU8Mapper.java

@@ -0,0 +1,18 @@
+package net.chenlin.dp.modules.sys.dao;
+
+import net.chenlin.dp.modules.sys.entity.QuartzJobLogEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+
+/**
+ * 定时任务日志
+ * @author zcl<yczclcn@163.com>
+ */
+@Mapper
+public interface TestU8Mapper extends BaseMapper<QuartzJobLogEntity> {
+
+	int testAll();
+	
+}

+ 13 - 0
src/main/java/net/chenlin/dp/modules/sys/mapper/testU8.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="net.chenlin.dp.modules.sys.dao.TestU8Mapper">
+	
+	<select id="testAll" resultType="int">
+		SELECT
+			count(1)
+		FROM
+			AA_Bank
+	</select>
+
+</mapper>

+ 30 - 0
src/main/java/net/chenlin/dp/modules/sys/service/impl/testU8ServiceImpl.java

@@ -0,0 +1,30 @@
+package net.chenlin.dp.modules.sys.service.impl;
+
+import net.chenlin.dp.common.annotation.DataSource;
+import net.chenlin.dp.common.support.orm.db.DynamicDataSource;
+import net.chenlin.dp.modules.sys.dao.QuartzJobLogMapper;
+import net.chenlin.dp.modules.sys.dao.TestU8Mapper;
+import net.chenlin.dp.modules.sys.service.testU8Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * 定时任务日志
+ * @author zcl<yczclcn@163.com>
+ */
+@Service("testU8Service")
+public class testU8ServiceImpl implements testU8Service {
+	@Autowired
+	private TestU8Mapper testU8Mapper;
+
+	@Override
+	public int testAll() {
+		DynamicDataSource.setDataSource("slave-data-source");
+		return testU8Mapper.testAll();
+	}
+
+}

+ 16 - 0
src/main/java/net/chenlin/dp/modules/sys/service/testU8Service.java

@@ -0,0 +1,16 @@
+package net.chenlin.dp.modules.sys.service;
+
+import net.chenlin.dp.common.entity.Page;
+import net.chenlin.dp.common.entity.R;
+import net.chenlin.dp.modules.sys.entity.QuartzJobLogEntity;
+import org.springframework.beans.factory.annotation.Qualifier;
+
+import java.util.Map;
+
+/**
+ * 定时任务日志
+ * @author zcl<yczclcn@163.com>
+ */
+public interface testU8Service {
+	int testAll();
+}

+ 2 - 2
src/main/webapp/static/js/base/quartz/list.js

@@ -32,7 +32,7 @@ function getGrid() {
 		}, {
 			field : "beanName",
 			title : "类名",
-			width : "200px"
+			width : "100px"
 		}, {
 			field : "methodName",
 			title : "方法名",
@@ -40,7 +40,7 @@ function getGrid() {
 		}, {
 			field : "params",
 			title : "参数",
-			width : "300px"
+			width : "50px"
 		}, {
 			field : "cronExpression",
 			title : "表达式",