parent
a4c59e9ba5
commit
a2a9e1c60e
@ -0,0 +1,15 @@
|
||||
package xyz.wbsite.zentao.sdk;
|
||||
|
||||
/**
|
||||
* 常用常量
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class Constant {
|
||||
|
||||
public final static String SUCCESS_KEY = "success";
|
||||
|
||||
public final static String LOGIN_OVERTIME = "登录已超时";
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package xyz.wbsite.zentao.sdk;
|
||||
|
||||
import xyz.wbsite.zentao.sdk.user.ent.ZtUser;
|
||||
import xyz.wbsite.zentao.sdk.user.req.ZtUserListAllRequest;
|
||||
import xyz.wbsite.zentao.sdk.user.rsp.ZtUserListAllResponse;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 禅道客户端
|
||||
* <p>
|
||||
* 基于开源版本18.1开发
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZentaoClient {
|
||||
|
||||
/**
|
||||
* 普通禅道账户
|
||||
*/
|
||||
private static Map<String, ZentaoInstance> cache = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 普通禅道账户
|
||||
*/
|
||||
private final ZentaoInstance managerInstance;
|
||||
|
||||
|
||||
/**
|
||||
* 禅道服务地址
|
||||
*/
|
||||
private final String serviceUrl;
|
||||
|
||||
/**
|
||||
* 禅道服务接入code
|
||||
*/
|
||||
private final String serviceCode;
|
||||
|
||||
/**
|
||||
* 禅道服务接入key
|
||||
*/
|
||||
private final String serviceKey;
|
||||
|
||||
/**
|
||||
* 禅道客户端构造器
|
||||
*
|
||||
* @param serviceUrl 禅道服务地址
|
||||
* @param serviceCode 禅道服务接入code
|
||||
* @param serviceKey 禅道服务接入key
|
||||
* @param managerAccount 管理账户
|
||||
*/
|
||||
public ZentaoClient(String serviceUrl, String serviceCode, String serviceKey, String managerAccount) {
|
||||
this.serviceUrl = serviceUrl;
|
||||
this.serviceCode = serviceCode;
|
||||
this.serviceKey = serviceKey;
|
||||
this.managerInstance = new ZentaoInstance(this, managerAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有账户信息
|
||||
* <p>
|
||||
* 要求managerAccount账户有管理员权限
|
||||
*/
|
||||
public List<ZtUser> listAllUser() {
|
||||
ZtUserListAllResponse ztUserListAllResponse = managerInstance.getZtUserService().listAll(new ZtUserListAllRequest());
|
||||
if (!ztUserListAllResponse.isSuccess()) {
|
||||
throw new IllegalArgumentException(ztUserListAllResponse.getMessage());
|
||||
}
|
||||
return ztUserListAllResponse.getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通账号进入
|
||||
*/
|
||||
public ZentaoInstance loginAs(String account) {
|
||||
if (cache.containsKey(account)) {
|
||||
return cache.get(account);
|
||||
}
|
||||
cache.put(account, new ZentaoInstance(this, account));
|
||||
return cache.get(account);
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目管理账号进入
|
||||
*/
|
||||
public ZentaoInstance loginAsPms() {
|
||||
return managerInstance;
|
||||
}
|
||||
|
||||
public String getServiceUrl() {
|
||||
return serviceUrl;
|
||||
}
|
||||
|
||||
public String getServiceCode() {
|
||||
return serviceCode;
|
||||
}
|
||||
|
||||
public String getServiceKey() {
|
||||
return serviceKey;
|
||||
}
|
||||
}
|
@ -0,0 +1,165 @@
|
||||
package xyz.wbsite.zentao.sdk;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.log.StaticLog;
|
||||
import xyz.wbsite.zentao.sdk.execution.ZtExecutionService;
|
||||
import xyz.wbsite.zentao.sdk.project.ZtProjectService;
|
||||
import xyz.wbsite.zentao.sdk.task.ZtTaskService;
|
||||
import xyz.wbsite.zentao.sdk.user.ZtUserService;
|
||||
|
||||
/**
|
||||
* 禅道客户端实例
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZentaoInstance {
|
||||
|
||||
/**
|
||||
* 客户端
|
||||
*/
|
||||
private ZentaoClient client;
|
||||
|
||||
/**
|
||||
* 模拟登录账户
|
||||
*/
|
||||
private String account;
|
||||
/**
|
||||
* 登录信息
|
||||
*/
|
||||
private String zentaosid;
|
||||
private static final int DEFAULT_CONNECT_TIMEOUT = 3 * 1000;
|
||||
private static final int DEFAULT_READ_TIMEOUT = 10 * 1000;
|
||||
private final ZtProjectService ztProjectService = new ZtProjectService(this);
|
||||
private final ZtExecutionService ztExecutionService = new ZtExecutionService(this);
|
||||
private final ZtTaskService ztTaskService = new ZtTaskService(this);
|
||||
private final ZtUserService ztUserService = new ZtUserService(this);
|
||||
|
||||
public ZentaoInstance(ZentaoClient client, String account) {
|
||||
this.client = client;
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public ZtProjectService getZtProjectService() {
|
||||
return ztProjectService;
|
||||
}
|
||||
|
||||
public ZtExecutionService getZtExecutionService() {
|
||||
return ztExecutionService;
|
||||
}
|
||||
|
||||
public ZtTaskService getZtTaskService() {
|
||||
return ztTaskService;
|
||||
}
|
||||
|
||||
public ZtUserService getZtUserService() {
|
||||
return ztUserService;
|
||||
}
|
||||
|
||||
private boolean login(String account) {
|
||||
String time = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
String token = SecureUtil.md5(client.getServiceCode() + client.getServiceKey() + time);
|
||||
String url = StrUtil.format(client.getServiceUrl() + "/api.php?m=user&f=apilogin&account={}&code={}&time={}&token={}", account, client.getServiceCode(), time, token);
|
||||
HttpRequest request = HttpUtil.createGet(url);
|
||||
HttpResponse response = request.execute();
|
||||
if (HttpStatus.HTTP_OK != response.getStatus()) {
|
||||
System.err.println("请求失败");
|
||||
return false;
|
||||
} else {
|
||||
this.zentaosid = response.getCookieValue("zentaosid");
|
||||
StaticLog.info("禅道登录凭证:{}", this.zentaosid);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查状态
|
||||
*
|
||||
* @return 登录状态是否正常
|
||||
*/
|
||||
public synchronized boolean checkStatus() {
|
||||
try {
|
||||
HttpRequest httpRequest = createTestUrl();
|
||||
HttpResponse execute = httpRequest.execute();
|
||||
if (HttpStatus.HTTP_OK != execute.getStatus()) {
|
||||
return false;
|
||||
}
|
||||
String body = execute.body();
|
||||
String string = Convert.unicodeToStr(body);
|
||||
if (!StrUtil.contains(string, Constant.LOGIN_OVERTIME)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
// 登录状态异常后尝试登录
|
||||
return login(account);
|
||||
}
|
||||
|
||||
public HttpRequest createTestUrl() {
|
||||
String fullUrl = client.getServiceUrl();
|
||||
HttpRequest request = HttpUtil.createGet(fullUrl);
|
||||
setDefault(request, fullUrl);
|
||||
request.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7");
|
||||
request.header("Upgrade-Insecure-Requests", "1");
|
||||
return request;
|
||||
}
|
||||
|
||||
public HttpRequest createGet(String url) {
|
||||
checkStatus();
|
||||
String fullUrl = client.getServiceUrl() + url;
|
||||
HttpRequest request = HttpUtil.createGet(fullUrl);
|
||||
setDefault(request, fullUrl);
|
||||
return request;
|
||||
}
|
||||
|
||||
public HttpRequest createGetForHtml(String url) {
|
||||
checkStatus();
|
||||
String fullUrl = client.getServiceUrl() + url;
|
||||
HttpRequest request = HttpUtil.createGet(fullUrl);
|
||||
setDefault(request, fullUrl);
|
||||
request.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7");
|
||||
request.header("Upgrade-Insecure-Requests", "1");
|
||||
return request;
|
||||
}
|
||||
|
||||
public HttpRequest createPost(String url) {
|
||||
checkStatus();
|
||||
String fullUrl = client.getServiceUrl() + url;
|
||||
HttpRequest request = HttpUtil.createPost(fullUrl);
|
||||
setDefault(request, fullUrl);
|
||||
return request;
|
||||
}
|
||||
|
||||
public HttpRequest createPostForHtml(String url) {
|
||||
checkStatus();
|
||||
String fullUrl = client.getServiceUrl() + url;
|
||||
HttpRequest request = HttpUtil.createPost(fullUrl);
|
||||
setDefault(request, fullUrl);
|
||||
request.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7");
|
||||
request.header("Upgrade-Insecure-Requests", "1");
|
||||
return request;
|
||||
}
|
||||
|
||||
public void setDefault(HttpRequest request, String url) {
|
||||
request.setConnectionTimeout(DEFAULT_CONNECT_TIMEOUT);
|
||||
request.setReadTimeout(DEFAULT_READ_TIMEOUT);
|
||||
request.header("Accept", "application/json, text/javascript, */*; q=0.01");
|
||||
request.header("Accept-Encoding", "gzip, deflate");
|
||||
request.header("Accept-Language", "zh-CN,zh;q=0.9");
|
||||
request.header("Connection", "keep-alive");
|
||||
request.header("Host", client.getServiceUrl().replaceAll("http[s]?://", ""));
|
||||
request.header("Origin", client.getServiceUrl());
|
||||
request.header("Referer", url);
|
||||
request.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36");
|
||||
request.header("X-Requested-With", "XMLHttpRequest");
|
||||
request.cookie("zentaosid=" + this.zentaosid);
|
||||
}
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.ent;
|
||||
|
||||
/**
|
||||
* 禅道执行信息
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecution {
|
||||
|
||||
/**
|
||||
* 执行ID
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* 执行名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 执行代号
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private int projectId;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String projectName;
|
||||
/**
|
||||
* 执行产品经理
|
||||
*/
|
||||
private String pm;
|
||||
/**
|
||||
* 执行状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 进度
|
||||
*/
|
||||
private String progress;
|
||||
/**
|
||||
* 计划开始时间
|
||||
*/
|
||||
private String begin;
|
||||
/**
|
||||
* 计划完成时间
|
||||
*/
|
||||
private String end;
|
||||
/**
|
||||
* 预计工时
|
||||
*/
|
||||
private String estimate;
|
||||
/**
|
||||
* 消耗工时
|
||||
*/
|
||||
private String consumed;
|
||||
/**
|
||||
* 剩余工时
|
||||
*/
|
||||
private String left;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(int projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getPm() {
|
||||
return pm;
|
||||
}
|
||||
|
||||
public void setPm(String pm) {
|
||||
this.pm = pm;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(String progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public String getBegin() {
|
||||
return begin;
|
||||
}
|
||||
|
||||
public void setBegin(String begin) {
|
||||
this.begin = begin;
|
||||
}
|
||||
|
||||
public String getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(String end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public String getEstimate() {
|
||||
return estimate;
|
||||
}
|
||||
|
||||
public void setEstimate(String estimate) {
|
||||
this.estimate = estimate;
|
||||
}
|
||||
|
||||
public String getConsumed() {
|
||||
return consumed;
|
||||
}
|
||||
|
||||
public void setConsumed(String consumed) {
|
||||
this.consumed = consumed;
|
||||
}
|
||||
|
||||
public String getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
public void setLeft(String left) {
|
||||
this.left = left;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.req;
|
||||
|
||||
/**
|
||||
* 禅道执行激活请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecutionActivateRequest {
|
||||
|
||||
private int executionId;
|
||||
|
||||
private String begin;
|
||||
|
||||
private String end;
|
||||
|
||||
/**
|
||||
* 是否重新调整时间 0/1
|
||||
*/
|
||||
private String readjustTime;
|
||||
|
||||
private String comment;
|
||||
|
||||
public int getExecutionId() {
|
||||
return executionId;
|
||||
}
|
||||
|
||||
public void setExecutionId(int executionId) {
|
||||
this.executionId = executionId;
|
||||
}
|
||||
|
||||
public String getBegin() {
|
||||
return begin;
|
||||
}
|
||||
|
||||
public void setBegin(String begin) {
|
||||
this.begin = begin;
|
||||
}
|
||||
|
||||
public String getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(String end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public String getReadjustTime() {
|
||||
return readjustTime;
|
||||
}
|
||||
|
||||
public void setReadjustTime(String readjustTime) {
|
||||
this.readjustTime = readjustTime;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.req;
|
||||
|
||||
/**
|
||||
* 禅道执行关闭请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecutionCloseRequest {
|
||||
|
||||
private int executionId;
|
||||
|
||||
private String comment;
|
||||
|
||||
private String realEnd;
|
||||
|
||||
public int getExecutionId() {
|
||||
return executionId;
|
||||
}
|
||||
|
||||
public void setExecutionId(int executionId) {
|
||||
this.executionId = executionId;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getRealEnd() {
|
||||
return realEnd;
|
||||
}
|
||||
|
||||
public void setRealEnd(String realEnd) {
|
||||
this.realEnd = realEnd;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.req;
|
||||
|
||||
/**
|
||||
* 禅道执行删除请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecutionDeleteRequest {
|
||||
|
||||
private int executionId;
|
||||
|
||||
public int getExecutionId() {
|
||||
return executionId;
|
||||
}
|
||||
|
||||
public void setExecutionId(int executionId) {
|
||||
this.executionId = executionId;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.req;
|
||||
|
||||
/**
|
||||
* 禅道执行启动请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecutionStartRequest {
|
||||
|
||||
private int executionId;
|
||||
|
||||
private String comment;
|
||||
|
||||
private String realBegan;
|
||||
|
||||
public int getExecutionId() {
|
||||
return executionId;
|
||||
}
|
||||
|
||||
public void setExecutionId(int executionId) {
|
||||
this.executionId = executionId;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getRealBegan() {
|
||||
return realBegan;
|
||||
}
|
||||
|
||||
public void setRealBegan(String realBegan) {
|
||||
this.realBegan = realBegan;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.rsp;
|
||||
|
||||
/**
|
||||
* 禅道执行激活响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecutionActivateResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.rsp;
|
||||
|
||||
/**
|
||||
* 禅道执行关闭响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecutionCloseResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.rsp;
|
||||
|
||||
/**
|
||||
* 禅道执行创建响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecutionCreateResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 执行id
|
||||
*/
|
||||
private int id;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.rsp;
|
||||
|
||||
/**
|
||||
* 禅道执行删除响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecutionDeleteResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.rsp;
|
||||
|
||||
import xyz.wbsite.zentao.sdk.execution.ent.ZtExecution;
|
||||
|
||||
/**
|
||||
* 检索执行
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecutionGetResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 执行
|
||||
*/
|
||||
private ZtExecution result;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ZtExecution getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ZtExecution result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package xyz.wbsite.zentao.sdk.execution.rsp;
|
||||
|
||||
/**
|
||||
* 禅道执行启动响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtExecutionStartResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package xyz.wbsite.zentao.sdk.project.ent;
|
||||
|
||||
/**
|
||||
* 禅道项目信息
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProject {
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 项目状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 项目产品经理
|
||||
*/
|
||||
private String pm;
|
||||
/**
|
||||
* 预算
|
||||
*/
|
||||
private String budget;
|
||||
/**
|
||||
* 计划开始时间
|
||||
*/
|
||||
private String begin;
|
||||
/**
|
||||
* 计划完成时间
|
||||
*/
|
||||
private String end;
|
||||
/**
|
||||
* 进度
|
||||
*/
|
||||
private String progress;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getPm() {
|
||||
return pm;
|
||||
}
|
||||
|
||||
public void setPm(String pm) {
|
||||
this.pm = pm;
|
||||
}
|
||||
|
||||
public String getBudget() {
|
||||
return budget;
|
||||
}
|
||||
|
||||
public void setBudget(String budget) {
|
||||
this.budget = budget;
|
||||
}
|
||||
|
||||
public String getBegin() {
|
||||
return begin;
|
||||
}
|
||||
|
||||
public void setBegin(String begin) {
|
||||
this.begin = begin;
|
||||
}
|
||||
|
||||
public String getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(String end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public String getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(String progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package xyz.wbsite.zentao.sdk.project.req;
|
||||
|
||||
/**
|
||||
* 禅道项目激活请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectActivateRequest {
|
||||
|
||||
private int projectId;
|
||||
|
||||
private String begin;
|
||||
|
||||
private String end;
|
||||
|
||||
/**
|
||||
* 是否重新调整时间 0/1
|
||||
*/
|
||||
private String readjustTime;
|
||||
|
||||
private String comment;
|
||||
|
||||
|
||||
public int getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(int projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getBegin() {
|
||||
return begin;
|
||||
}
|
||||
|
||||
public void setBegin(String begin) {
|
||||
this.begin = begin;
|
||||
}
|
||||
|
||||
public String getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(String end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public String getReadjustTime() {
|
||||
return readjustTime;
|
||||
}
|
||||
|
||||
public void setReadjustTime(String readjustTime) {
|
||||
this.readjustTime = readjustTime;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package xyz.wbsite.zentao.sdk.project.req;
|
||||
|
||||
/**
|
||||
* 禅道项目关闭请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectCloseRequest {
|
||||
|
||||
private int projectId;
|
||||
|
||||
private String comment;
|
||||
|
||||
private String realEnd;
|
||||
|
||||
public int getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(int projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getRealEnd() {
|
||||
return realEnd;
|
||||
}
|
||||
|
||||
public void setRealEnd(String realEnd) {
|
||||
this.realEnd = realEnd;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package xyz.wbsite.zentao.sdk.project.req;
|
||||
|
||||
/**
|
||||
* 禅道项目删除请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectDeleteRequest {
|
||||
|
||||
private int projectId;
|
||||
|
||||
public int getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(int projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package xyz.wbsite.zentao.sdk.project.req;
|
||||
|
||||
/**
|
||||
* 禅道项目启动响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectStartRequest {
|
||||
|
||||
private int projectId;
|
||||
|
||||
private String comment;
|
||||
|
||||
private String realBegan;
|
||||
|
||||
public int getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(int projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getRealBegan() {
|
||||
return realBegan;
|
||||
}
|
||||
|
||||
public void setRealBegan(String realBegan) {
|
||||
this.realBegan = realBegan;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package xyz.wbsite.zentao.sdk.project.rsp;
|
||||
|
||||
/**
|
||||
* 项目激活响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectActivateResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package xyz.wbsite.zentao.sdk.project.rsp;
|
||||
|
||||
/**
|
||||
* 项目关闭响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectCloseResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package xyz.wbsite.zentao.sdk.project.rsp;
|
||||
|
||||
/**
|
||||
* 项目创建结果响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectCreateResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
*
|
||||
* 项目id
|
||||
*/
|
||||
private int id;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package xyz.wbsite.zentao.sdk.project.rsp;
|
||||
|
||||
/**
|
||||
* 禅道项目删除响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectDeleteResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package xyz.wbsite.zentao.sdk.project.rsp;
|
||||
|
||||
/**
|
||||
* 项目信息更新响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectEditResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package xyz.wbsite.zentao.sdk.project.rsp;
|
||||
|
||||
import xyz.wbsite.zentao.sdk.project.ent.ZtProject;
|
||||
|
||||
/**
|
||||
* 检索项目
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectGetResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
private ZtProject result;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ZtProject getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ZtProject result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package xyz.wbsite.zentao.sdk.project.rsp;
|
||||
|
||||
/**
|
||||
* 项目启动响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtProjectStartResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private int id;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package xyz.wbsite.zentao.sdk.task.ent;
|
||||
|
||||
/**
|
||||
* 禅道任务信息
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTask {
|
||||
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 任务等级
|
||||
*/
|
||||
private String pri;
|
||||
/**
|
||||
* 指派人
|
||||
*/
|
||||
private String assignedTo;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 任务完成人
|
||||
*/
|
||||
private String finishedBy;
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
private String deadline;
|
||||
/**
|
||||
* 预计工时
|
||||
*/
|
||||
private String estimate;
|
||||
/**
|
||||
* 消耗工时
|
||||
*/
|
||||
private String consumed;
|
||||
/**
|
||||
* 剩余工时
|
||||
*/
|
||||
private String left;
|
||||
/**
|
||||
* 进度
|
||||
*/
|
||||
private String progress;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPri() {
|
||||
return pri;
|
||||
}
|
||||
|
||||
public void setPri(String pri) {
|
||||
this.pri = pri;
|
||||
}
|
||||
|
||||
public String getAssignedTo() {
|
||||
return assignedTo;
|
||||
}
|
||||
|
||||
public void setAssignedTo(String assignedTo) {
|
||||
this.assignedTo = assignedTo;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getFinishedBy() {
|
||||
return finishedBy;
|
||||
}
|
||||
|
||||
public void setFinishedBy(String finishedBy) {
|
||||
this.finishedBy = finishedBy;
|
||||
}
|
||||
|
||||
public String getDeadline() {
|
||||
return deadline;
|
||||
}
|
||||
|
||||
public void setDeadline(String deadline) {
|
||||
this.deadline = deadline;
|
||||
}
|
||||
|
||||
public String getEstimate() {
|
||||
return estimate;
|
||||
}
|
||||
|
||||
public void setEstimate(String estimate) {
|
||||
this.estimate = estimate;
|
||||
}
|
||||
|
||||
public String getConsumed() {
|
||||
return consumed;
|
||||
}
|
||||
|
||||
public void setConsumed(String consumed) {
|
||||
this.consumed = consumed;
|
||||
}
|
||||
|
||||
public String getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
public void setLeft(String left) {
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
public String getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(String progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package xyz.wbsite.zentao.sdk.task.req;
|
||||
|
||||
/**
|
||||
* 禅道任务执行请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskActivateRequest {
|
||||
|
||||
/**
|
||||
* 执行id
|
||||
*/
|
||||
private int executionId;
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
private String begin;
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
private String end;
|
||||
/**
|
||||
* 是否重新调整时间 0/1
|
||||
*/
|
||||
private boolean readjustTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String comment;
|
||||
|
||||
public int getExecutionId() {
|
||||
return executionId;
|
||||
}
|
||||
|
||||
public void setExecutionId(int executionId) {
|
||||
this.executionId = executionId;
|
||||
}
|
||||
|
||||
public String getBegin() {
|
||||
return begin;
|
||||
}
|
||||
|
||||
public void setBegin(String begin) {
|
||||
this.begin = begin;
|
||||
}
|
||||
|
||||
public String getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(String end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public boolean isReadjustTime() {
|
||||
return readjustTime;
|
||||
}
|
||||
|
||||
public void setReadjustTime(boolean readjustTime) {
|
||||
this.readjustTime = readjustTime;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package xyz.wbsite.zentao.sdk.task.req;
|
||||
|
||||
/**
|
||||
* 禅道任务关闭请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskCloseRequest {
|
||||
|
||||
private int taskId;
|
||||
|
||||
private String comment;
|
||||
|
||||
public int getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(int taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package xyz.wbsite.zentao.sdk.task.req;
|
||||
|
||||
/**
|
||||
* 禅道任务删除请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskDeleteRequest {
|
||||
|
||||
private int taskId;
|
||||
|
||||
public int getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(int taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package xyz.wbsite.zentao.sdk.task.req;
|
||||
|
||||
/**
|
||||
* 禅道任务完成请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskFinishRequest {
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private int taskId;
|
||||
/**
|
||||
* 本次消耗
|
||||
*/
|
||||
private int currentConsumed;
|
||||
/**
|
||||
* 之前消耗
|
||||
*/
|
||||
private String consumed;
|
||||
/**
|
||||
* 指派
|
||||
*/
|
||||
private String assignedTo;
|
||||
/**
|
||||
* 实际开始
|
||||
*/
|
||||
private String realStarted;
|
||||
/**
|
||||
* 实际完成
|
||||
*/
|
||||
private String finishedDate;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String comment;
|
||||
|
||||
public int getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(int taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public int getCurrentConsumed() {
|
||||
return currentConsumed;
|
||||
}
|
||||
|
||||
public void setCurrentConsumed(int currentConsumed) {
|
||||
this.currentConsumed = currentConsumed;
|
||||
}
|
||||
|
||||
public String getConsumed() {
|
||||
return consumed;
|
||||
}
|
||||
|
||||
public void setConsumed(String consumed) {
|
||||
this.consumed = consumed;
|
||||
}
|
||||
|
||||
public String getAssignedTo() {
|
||||
return assignedTo;
|
||||
}
|
||||
|
||||
public void setAssignedTo(String assignedTo) {
|
||||
this.assignedTo = assignedTo;
|
||||
}
|
||||
|
||||
public String getRealStarted() {
|
||||
return realStarted;
|
||||
}
|
||||
|
||||
public void setRealStarted(String realStarted) {
|
||||
this.realStarted = realStarted;
|
||||
}
|
||||
|
||||
public String getFinishedDate() {
|
||||
return finishedDate;
|
||||
}
|
||||
|
||||
public void setFinishedDate(String finishedDate) {
|
||||
this.finishedDate = finishedDate;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package xyz.wbsite.zentao.sdk.task.req;
|
||||
|
||||
/**
|
||||
* 禅道任务启动请求
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskStartRequest {
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private int taskId;
|
||||
/**
|
||||
* 指派给
|
||||
*/
|
||||
private String assignedTo;
|
||||
/**
|
||||
* 2023-11-10 10:09:26
|
||||
*/
|
||||
private String realStarted;
|
||||
/**
|
||||
* 总计消耗(小时)
|
||||
*/
|
||||
private String consumed;
|
||||
/**
|
||||
* 预计剩余(小时)
|
||||
*/
|
||||
private String left;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String comment;
|
||||
|
||||
public int getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(int taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getAssignedTo() {
|
||||
return assignedTo;
|
||||
}
|
||||
|
||||
public void setAssignedTo(String assignedTo) {
|
||||
this.assignedTo = assignedTo;
|
||||
}
|
||||
|
||||
public String getRealStarted() {
|
||||
return realStarted;
|
||||
}
|
||||
|
||||
public void setRealStarted(String realStarted) {
|
||||
this.realStarted = realStarted;
|
||||
}
|
||||
|
||||
public String getConsumed() {
|
||||
return consumed;
|
||||
}
|
||||
|
||||
public void setConsumed(String consumed) {
|
||||
this.consumed = consumed;
|
||||
}
|
||||
|
||||
public String getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
public void setLeft(String left) {
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package xyz.wbsite.zentao.sdk.task.rsp;
|
||||
|
||||
/**
|
||||
* 禅道任务激活响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskActivateResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private int id;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package xyz.wbsite.zentao.sdk.task.rsp;
|
||||
|
||||
/**
|
||||
* 禅道任务关闭响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskCloseResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private int id;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package xyz.wbsite.zentao.sdk.task.rsp;
|
||||
|
||||
/**
|
||||
* 禅道任务关闭响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskCreateResponse {
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private int id;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package xyz.wbsite.zentao.sdk.task.rsp;
|
||||
|
||||
/**
|
||||
* 禅道任务删除响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskDeleteResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package xyz.wbsite.zentao.sdk.task.rsp;
|
||||
|
||||
/**
|
||||
* 禅道任务完成响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskFinishResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private int id;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package xyz.wbsite.zentao.sdk.task.rsp;
|
||||
|
||||
import xyz.wbsite.zentao.sdk.task.ent.ZtTask;
|
||||
|
||||
/**
|
||||
* 检索任务
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskGetResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 任务信息
|
||||
*/
|
||||
private ZtTask result;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ZtTask getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ZtTask result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package xyz.wbsite.zentao.sdk.task.rsp;
|
||||
|
||||
/**
|
||||
* 禅道任务启动响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtTaskStartResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private int id;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package xyz.wbsite.zentao.sdk.user;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpException;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import cn.hutool.log.StaticLog;
|
||||
import xyz.wbsite.zentao.sdk.ZentaoInstance;
|
||||
import xyz.wbsite.zentao.sdk.user.ent.ZtUser;
|
||||
import xyz.wbsite.zentao.sdk.user.req.ZtUserListAllRequest;
|
||||
import xyz.wbsite.zentao.sdk.user.rsp.ZtUserListAllResponse;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 禅道用户服务
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtUserService {
|
||||
|
||||
private ZentaoInstance zentaoInstance;
|
||||
|
||||
public ZtUserService(ZentaoInstance client) {
|
||||
this.zentaoInstance = client;
|
||||
}
|
||||
|
||||
public ZtUserListAllResponse listAll(ZtUserListAllRequest request) {
|
||||
ZtUserListAllResponse response = new ZtUserListAllResponse();
|
||||
try {
|
||||
List<ZtUser> result = new ArrayList<>();
|
||||
int currentPage = 1;
|
||||
while (true) {
|
||||
String url = StrUtil.format("/company-browse-inside-0-bydept-id-32-2000-{}.html", currentPage);
|
||||
StaticLog.info(url);
|
||||
HttpRequest httpRequest = zentaoInstance.createGetForHtml(url);
|
||||
HttpResponse execute = httpRequest.execute();
|
||||
if (HttpStatus.HTTP_OK != execute.getStatus()) {
|
||||
response.setSuccess(false);
|
||||
response.setMessage("请求失败");
|
||||
return response;
|
||||
}
|
||||
String body = execute.body();
|
||||
Document parse = Jsoup.parse(body);
|
||||
Elements trs = parse.select(".main-table #userList tbody tr");
|
||||
for (Element tr : trs) {
|
||||
ZtUser ztUser = new ZtUser();
|
||||
ztUser.setId(Convert.toInt(tr.select(".c-id").text()));
|
||||
ztUser.setName(tr.child(1).attr("title"));
|
||||
ztUser.setAccount(tr.child(2).text());
|
||||
ztUser.setPosition(tr.child(3).text());
|
||||
ztUser.setEmail(tr.child(4).text());
|
||||
ztUser.setSex(tr.child(5).text());
|
||||
ztUser.setPhone(tr.child(6).text());
|
||||
ztUser.setQq(tr.child(7).text());
|
||||
ztUser.setLastLoginDate(tr.child(8).text());
|
||||
ztUser.setAccessTimes(Convert.toInt(tr.child(9).text(), 0));
|
||||
result.add(ztUser);
|
||||
}
|
||||
if (trs.size() < 2000) {
|
||||
break;
|
||||
}
|
||||
// 继续获取下一页数据
|
||||
currentPage++;
|
||||
}
|
||||
response.setResult(result);
|
||||
response.setSuccess(true);
|
||||
response.setMessage("请求成功");
|
||||
return response;
|
||||
} catch (HttpException e) {
|
||||
StaticLog.error(e);
|
||||
}
|
||||
response.setSuccess(false);
|
||||
response.setMessage("请求失败");
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package xyz.wbsite.zentao.sdk.user.ent;
|
||||
|
||||
/**
|
||||
* 禅道用户
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtUser {
|
||||
|
||||
/**
|
||||
* 账户ID
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 账户
|
||||
*/
|
||||
private String account;
|
||||
/**
|
||||
* 职位
|
||||
*/
|
||||
private String position;
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 电话号码
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* QQ
|
||||
*/
|
||||
private String qq;
|
||||
/**
|
||||
* 最后登录
|
||||
*/
|
||||
private String lastLoginDate;
|
||||
/**
|
||||
* 接入次数
|
||||
*/
|
||||
private int accessTimes;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(String position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getQq() {
|
||||
return qq;
|
||||
}
|
||||
|
||||
public void setQq(String qq) {
|
||||
this.qq = qq;
|
||||
}
|
||||
|
||||
public String getLastLoginDate() {
|
||||
return lastLoginDate;
|
||||
}
|
||||
|
||||
public void setLastLoginDate(String lastLoginDate) {
|
||||
this.lastLoginDate = lastLoginDate;
|
||||
}
|
||||
|
||||
public int getAccessTimes() {
|
||||
return accessTimes;
|
||||
}
|
||||
|
||||
public void setAccessTimes(int accessTimes) {
|
||||
this.accessTimes = accessTimes;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package xyz.wbsite.zentao.sdk.user.req;
|
||||
|
||||
/**
|
||||
* 查询所有账户信息
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtUserListAllRequest {
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package xyz.wbsite.zentao.sdk.user.rsp;
|
||||
|
||||
import xyz.wbsite.zentao.sdk.user.ent.ZtUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询所有账户信息
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZtUserListAllResponse {
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
private List<ZtUser> result;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public List<ZtUser> getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(List<ZtUser> result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue