Skip to content

Commit

Permalink
Merge pull request #19 from NotFound403/1.2.8
Browse files Browse the repository at this point in the history
1.2.8
  • Loading branch information
NotFound403 authored Jul 18, 2024
2 parents 9168a2b + a7c8e90 commit bb363fc
Show file tree
Hide file tree
Showing 43 changed files with 638 additions and 97 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void webHooks()throws IOException{
<dependency>
<groupId>cn.felord</groupId>
<artifactId>wecom-sdk</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
</dependency>
```

Expand All @@ -115,7 +115,7 @@ void webHooks()throws IOException{
<dependency>
<groupId>cn.felord</groupId>
<artifactId>rx-wecom-sdk</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
</dependency>
```

Expand All @@ -127,7 +127,7 @@ void webHooks()throws IOException{
<dependency>
<groupId>cn.felord</groupId>
<artifactId>wecom-sdk</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
<exclusions>
<exclusion>
<groupId>com.squareup.okhttp3</groupId>
Expand Down
17 changes: 8 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<groupId>cn.felord</groupId>
<artifactId>wecom</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
<packaging>pom</packaging>

<name>wecom</name>
Expand Down Expand Up @@ -84,8 +84,8 @@
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -264,14 +264,13 @@
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.5.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
<publishingServerId>ossrh</publishingServerId>
<!-- <autoPublish>true</autoPublish>-->
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion rx-wecom-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>cn.felord</groupId>
<artifactId>wecom</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
</parent>
<artifactId>rx-wecom-sdk</artifactId>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public interface DepartmentApi {

/**
* 获取部门列表(自建)
* <p>
* 获取指定部门及其下的子部门(以及子部门的子部门等等,递归)
*
* @param departmentId departmentId
* @return DeptResponse generic response
Expand Down
2 changes: 1 addition & 1 deletion samples/spring-boot-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<dependency>
<groupId>cn.felord</groupId>
<artifactId>wecom-sdk</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import cn.felord.domain.approval.ApprovalApplyRequest;
import cn.felord.domain.approval.ApprovalDetail;
import cn.felord.domain.approval.ApprovalSpNo;
import cn.felord.domain.approval.ApprovalTitle;
import cn.felord.domain.approval.ApprovalTmpDetailResponse;
import cn.felord.domain.approval.Approver;
import cn.felord.domain.approval.ContactValue;
Expand All @@ -55,6 +54,8 @@
import cn.felord.domain.approval.MoneyValue;
import cn.felord.domain.approval.NumberValue;
import cn.felord.domain.approval.PhoneNumberValue;
import cn.felord.domain.approval.ProcessApplyRequest;
import cn.felord.domain.approval.ProcessNode;
import cn.felord.domain.approval.RelatedApprovalValue;
import cn.felord.domain.approval.SelectorValue;
import cn.felord.domain.approval.Summary;
Expand Down Expand Up @@ -106,6 +107,7 @@
import cn.felord.domain.wedoc.form.FormAnswerRequest;
import cn.felord.domain.wedrive.BufferSource;
import cn.felord.enumeration.AnswerReplyItemType;
import cn.felord.enumeration.ApvRel;
import cn.felord.enumeration.BoolEnum;
import cn.felord.enumeration.MediaTypeEnum;
import cn.felord.enumeration.NativeAgent;
Expand Down Expand Up @@ -357,6 +359,56 @@ public void kf() {
ImageKfMessageRequest kfMessageRequest = new ImageKfMessageRequest("客户id", "客服id", "图片素材 mediaid");
}

/**
* 新版审批
*
* @since 1.2.8
*/
@Test
void newApproval() {
String templateId = "3WLtyn8eQcZ5BhCx7CiBg35i4n7E1eDihMAgethW";
AgentDetails nativeAgent = DefaultAgent.of("企业ID", "审批应用密钥", "xxxx");
ApprovalApi approvalApi = workWeChatApi.approvalApi(nativeAgent);
ApprovalTmpDetailResponse templateDetail = approvalApi.getTemplateDetail(TemplateId.of(templateId));
System.out.println("templateDetail = " + templateDetail);

List<Summary> summaryList = Collections.singletonList(Summary.zhCN("测试模板"));


List<ContentDataValue> dataValues = Arrays.asList(
TextValue.tip(),
TextValue.from("洗发水"),
// 明细
ListContentDataValue.of(Arrays.asList(
MoneyValue.from(12.30),
NumberValue.from(7)
))
.append(Arrays.asList(
MoneyValue.from(34.64),
NumberValue.from(22)

))
);

List<ProcessNode> nodeList = Arrays.asList(
ProcessNode.cc(Collections.singletonList("3958")),
ProcessNode.assignees(ApvRel.ALL, Arrays.asList("4921", "2774")),
ProcessNode.assignees(ApvRel.OR, Arrays.asList("3958", "2824")),
ProcessNode.processor(Collections.singletonList("1008")),
ProcessNode.cc(Collections.singletonList("3804"))

);
GenericResponse<String> stringGenericResponse = approvalApi.applyEvent(ProcessApplyRequest.approverMode("3958",
templateId,
nodeList,
templateDetail.getTemplateContent().getControls(),
dataValues,
summaryList
));
System.out.println("stringGenericResponse = " + stringGenericResponse);


}
/**
* 企业微信发起审批
*/
Expand Down Expand Up @@ -423,11 +475,11 @@ void approval() {
new Approver("123"), new Approver("123")
);
// 摘要
List<Summary> summaryList = Collections.singletonList(new Summary(Collections.singletonList(ApprovalTitle.zhCN("测试模板"))));
List<Summary> summaryList = Collections.singletonList(Summary.zhCN("测试模板"));
// 模板
String templateId = "C4UEh71DAPh775HPfXipikZ5eAGosskDibU8hkfxJ";
// 查询模板配置 可以用缓存优化性能 避免直接查询企业微信
ApprovalTmpDetailResponse templateDetail = approvalApi.getTemplateDetail(new TemplateId(templateId));
ApprovalTmpDetailResponse templateDetail = approvalApi.getTemplateDetail(TemplateId.of(templateId));
Assertions.assertTrue(templateDetail.isSuccessful());
// 审批人模式:0-通过接口指定审批人、抄送人(此时approver、notifyer等参数可用);
// 1-使用此模板在管理后台设置的审批流程(需要保证审批流程中没有“申请人自选”节点),支持条件审批。
Expand Down
2 changes: 1 addition & 1 deletion wecom-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>cn.felord</groupId>
<artifactId>wecom</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
</parent>

<artifactId>wecom-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public final class WecomUserAgent {
/**
* 版本号
*/
public static final String VERSION = "1.2.5";
public static final String VERSION = "1.2.8";
/**
* UserAgent
*/
Expand Down
2 changes: 1 addition & 1 deletion wecom-objects/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>cn.felord</groupId>
<artifactId>wecom</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
</parent>
<artifactId>wecom-objects</artifactId>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @author dax
* @since 2024 /5/25
* @deprecated
* @see ProcessApplyRequest
*/
@ToString
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,33 @@
* The type Date range wrapper.
*
* @author dax
* @since 2024/12/19
* @since 2024 /12/19
*/
@ToString
@Getter
public class DateRangeWrapper {
/**
* 时间展示类型
*/
private final DateRangeType type;
/**
* 开始时间戳
*/
private final Instant newBegin;
/**
* 结束时间戳
*/
private final Instant newEnd;
/**
* 请假时长,单位秒 当slice_info有值时,无需填写,系统会根据slice_info 计算总时长
*/
@JsonFormat(shape = JsonFormat.Shape.NUMBER, pattern = "SECONDS")
private final Duration newDuration;
@JsonFormat(shape = JsonFormat.Shape.NUMBER, pattern = "SECONDS")
private final Duration perdayDuration;
/**
* 时区信息,只有在非UTC+8的情况下会返回
*/
private final TimezoneInfo timezoneInfo;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static ProcessNode create(ProcessNodeType type, ApvRel apvRel, List<Strin
}

/**
* Assignees process node.
* 审批人
*
* @param apvRel the apv rel
* @param userid the userid
Expand All @@ -72,23 +72,22 @@ public static ProcessNode assignees(ApvRel apvRel, List<String> userid) {
}

/**
* Cc process node.
* 抄送节点,支持前抄送后抄送
*
* @param apvRel the apv rel
* @param userid the userid
* @return the process node
*/
public static ProcessNode cc(ApvRel apvRel, List<String> userid) {
return create(ProcessNodeType.CC, apvRel, userid);
public static ProcessNode cc(List<String> userid) {
return create(ProcessNodeType.CC, ApvRel.ALL, userid);
}

/**
* Processor process node.
* 办理人节点
*
* @param userid the userid
* @return the process node
*/
public static ProcessNode processor(List<String> userid) {
return create(ProcessNodeType.PROCESSOR, null, userid);
return create(ProcessNodeType.PROCESSOR, ApvRel.ALL, userid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,47 @@
package cn.felord.domain.approval;

import cn.felord.enumeration.SliceState;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;

import java.time.Duration;
import java.util.List;

/**
* The type Slice info.
*
* @author dax
* @since 2023/12/19
* @since 2023 /12/19
*/
@Data
@Getter
public class SliceInfo {
private Duration duration;
private SliceState state;
private List<DayItem> dayItems;
private final Duration duration;
private final SliceState state;
private final List<DayItem> dayItems;

/**
* Instantiates a new Slice info.
*
* @param duration the duration
* @param state the state
* @param dayItems the day items
*/
@JsonCreator
SliceInfo(@JsonProperty("duration") Duration duration,
@JsonProperty("state") SliceState state,
@JsonProperty("day_items") List<DayItem> dayItems) {
this.duration = duration;
this.state = state;
this.dayItems = dayItems;
}

/**
* Instantiates a new Slice info.
*
* @param dayItems the day items
*/
public SliceInfo(List<DayItem> dayItems) {
this(null, null, dayItems);
}
}
Loading

0 comments on commit bb363fc

Please sign in to comment.