Commit 5c6c6e34 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 8f66e2ee a9b5f524
...@@ -83,8 +83,8 @@ public interface IDingPersonService extends IDingTalkService { ...@@ -83,8 +83,8 @@ public interface IDingPersonService extends IDingTalkService {
* @param endTime 审批实例结束时间,Unix时间戳,单位毫秒。 * @param endTime 审批实例结束时间,Unix时间戳,单位毫秒。
* @param nextToken 分页游标。如果是非首次调用,该参数传上次调用时返回的nextToken。 * @param nextToken 分页游标。如果是非首次调用,该参数传上次调用时返回的nextToken。
* @param maxResults 分页参数,每页大小,最多传20。 * @param maxResults 分页参数,每页大小,最多传20。
* @param phone 发起人电话 * @param phones 发起人电话列表 最大列表长度为10
*/ */
Rest<ListProcessInstanceIdsResponse> getProcessInstanceIdByPhone(String processCode, long startTime, long endTime, long nextToken, long maxResults, String phone) throws Exception; Rest<ListProcessInstanceIdsResponse> getProcessInstanceIdByPhone(String processCode, long startTime, long endTime, long nextToken, long maxResults, String phones) throws Exception;
} }
...@@ -42,6 +42,7 @@ import org.springframework.util.ObjectUtils; ...@@ -42,6 +42,7 @@ import org.springframework.util.ObjectUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -190,12 +191,12 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID ...@@ -190,12 +191,12 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
/** /**
* 根据系统电话查询指定时间的审批表单 * 根据系统电话查询指定时间的审批表单
* @param processCode 审批流的唯一码 * @param processCode 审批流的唯一码(详见doc下 审批表单列表.txt)。 请假:PROC-2E5C0DFF-3615-4409-A614-A2011FED5D38 外出:PROC-56D3ADEE-45A4-47BC-931A-2A0DC067DE32
* @param startTime 审批实例开始时间,Unix时间戳,单位毫秒 * @param startTime 审批实例开始时间,Unix时间戳,单位毫秒
* @param endTime 审批实例结束时间,Unix时间戳,单位毫秒。 * @param endTime 审批实例结束时间,Unix时间戳,单位毫秒。
* @param nextToken 分页游标。如果是非首次调用,该参数传上次调用时返回的nextToken。 * @param nextToken 分页游标。如果是非首次调用,该参数传上次调用时返回的nextToken。
* @param maxResults 分页参数,每页大小,最多传20。 * @param maxResults 分页参数,每页大小,最多传20。
* @param phone 发起人电话 * @param phones 发起人电话列表 最大列表长度为10
* *
* @return 返回示例 { * @return 返回示例 {
* "result" : { * "result" : {
...@@ -205,13 +206,27 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID ...@@ -205,13 +206,27 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
* "success" : true * "success" : true
* } * }
*/ */
public Rest<ListProcessInstanceIdsResponse> getProcessInstanceIdByPhone(String processCode,long startTime,long endTime,long nextToken,long maxResults,String phone) throws Exception{ public Rest<ListProcessInstanceIdsResponse> getProcessInstanceIdByPhone(String processCode,long startTime,long endTime,long nextToken,long maxResults,String phones) throws Exception{
String userIds = "";
if(!phones.isEmpty()){
List<String> phonesList = Arrays.asList(phones);
for(String phone : phonesList){
Rest<String> mobileRest = getPersonByMobile(phone); Rest<String> mobileRest = getPersonByMobile(phone);
if (mobileRest.getCode() == Rest.SUCCESS) { if(mobileRest.getCode() == Rest.SUCCESS){
String userId = mobileRest.getData(); userIds += mobileRest.getData()+",";
}
}
}
//去掉末尾的逗号
if(userIds.endsWith(",")){
userIds = userIds.substring(0,userIds.lastIndexOf(","));
}
if (!userIds.equals("")) {
com.aliyun.dingtalkworkflow_1_0.Client client = new com.aliyun.dingtalkworkflow_1_0.Client(setConfig()); com.aliyun.dingtalkworkflow_1_0.Client client = new com.aliyun.dingtalkworkflow_1_0.Client(setConfig());
com.aliyun.dingtalkworkflow_1_0.models.ListProcessInstanceIdsHeaders listProcessInstanceIdsHeaders = new com.aliyun.dingtalkworkflow_1_0.models.ListProcessInstanceIdsHeaders(); com.aliyun.dingtalkworkflow_1_0.models.ListProcessInstanceIdsHeaders listProcessInstanceIdsHeaders = new com.aliyun.dingtalkworkflow_1_0.models.ListProcessInstanceIdsHeaders();
listProcessInstanceIdsHeaders.xAcsDingtalkAccessToken = getToken(); listProcessInstanceIdsHeaders.xAcsDingtalkAccessToken = getToken();
...@@ -224,7 +239,7 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID ...@@ -224,7 +239,7 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
.setEndTime(endTime) .setEndTime(endTime)
.setNextToken(nextToken) .setNextToken(nextToken)
.setMaxResults(maxResults) .setMaxResults(maxResults)
.setUserIds(java.util.Arrays.asList(userId)); .setUserIds(java.util.Arrays.asList(userIds));
try { try {
ListProcessInstanceIdsResponse rsp = client.listProcessInstanceIdsWithOptions(listProcessInstanceIdsRequest, listProcessInstanceIdsHeaders, new RuntimeOptions()); ListProcessInstanceIdsResponse rsp = client.listProcessInstanceIdsWithOptions(listProcessInstanceIdsRequest, listProcessInstanceIdsHeaders, new RuntimeOptions());
return Rest.ok("成功", rsp); return Rest.ok("成功", rsp);
...@@ -237,11 +252,9 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID ...@@ -237,11 +252,9 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
} }
return Rest.fail("获取审批实例列表失败:"+com.aliyun.teautil.Common.empty(err.message)); return Rest.fail("获取审批实例列表失败:"+com.aliyun.teautil.Common.empty(err.message));
} }
}else {
log.error("根据手机号: "+phone+" 未查询到钉钉userid; erro->"+mobileRest.getMsg());
return Rest.fail("根据手机号: "+phone+" 未查询到钉钉userid; erro->"+mobileRest.getMsg());
} }
return Rest.fail("根据手机号: "+phones+" 未查询到钉钉userid");
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment