🎨 格式化部分代码

This commit is contained in:
Binary Wang 2021-08-05 09:19:48 +08:00
parent 622b838005
commit 091d74b6ee
17 changed files with 66 additions and 92 deletions

View File

@ -40,12 +40,8 @@ public class WxCpOaServiceImpl implements WxCpOaService {
} }
@Override @Override
public List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, Date startTime, Date endTime, public List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, @NonNull Date startTime, @NonNull Date endTime,
List<String> userIdList) throws WxErrorException { List<String> userIdList) throws WxErrorException {
if (startTime == null || endTime == null) {
throw new WxRuntimeException("starttime and endtime can't be null");
}
if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) { if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) {
throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取"); throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取");
} }
@ -73,20 +69,14 @@ public class WxCpOaServiceImpl implements WxCpOaService {
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_DATA); final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_DATA);
String responseContent = this.mainService.post(url, jsonObject.toString()); String responseContent = this.mainService.post(url, jsonObject.toString());
JsonObject tmpJson = GsonParser.parse(responseContent); JsonObject tmpJson = GsonParser.parse(responseContent);
return WxCpGsonBuilder.create() return WxCpGsonBuilder.create().fromJson(tmpJson.get("checkindata"),
.fromJson( new TypeToken<List<WxCpCheckinData>>() {
tmpJson.get("checkindata"), }.getType()
new TypeToken<List<WxCpCheckinData>>() { );
}.getType()
);
} }
@Override @Override
public List<WxCpCheckinOption> getCheckinOption(Date datetime, List<String> userIdList) throws WxErrorException { public List<WxCpCheckinOption> getCheckinOption(@NonNull Date datetime, List<String> userIdList) throws WxErrorException {
if (datetime == null) {
throw new WxRuntimeException("datetime can't be null");
}
if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) { if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) {
throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取"); throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取");
} }
@ -104,34 +94,29 @@ public class WxCpOaServiceImpl implements WxCpOaService {
String responseContent = this.mainService.post(url, jsonObject.toString()); String responseContent = this.mainService.post(url, jsonObject.toString());
JsonObject tmpJson = GsonParser.parse(responseContent); JsonObject tmpJson = GsonParser.parse(responseContent);
return WxCpGsonBuilder.create() return WxCpGsonBuilder.create().fromJson(tmpJson.get("info"),
.fromJson( new TypeToken<List<WxCpCheckinOption>>() {
tmpJson.get("info"), }.getType()
new TypeToken<List<WxCpCheckinOption>>() { );
}.getType()
);
} }
@Override @Override
public List<WxCpCropCheckinOption> getCropCheckinOption() throws WxErrorException { public List<WxCpCropCheckinOption> getCropCheckinOption() throws WxErrorException {
JsonObject jsonObject = new JsonObject(); JsonObject jsonObject = new JsonObject();
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CORP_CHECKIN_OPTION); final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CORP_CHECKIN_OPTION);
String responseContent = this.mainService.post(url, jsonObject.toString()); String responseContent = this.mainService.post(url, jsonObject.toString());
JsonObject tmpJson = GsonParser.parse(responseContent); JsonObject tmpJson = GsonParser.parse(responseContent);
return WxCpGsonBuilder.create() return WxCpGsonBuilder.create().fromJson(tmpJson.get("group"),
.fromJson( new TypeToken<List<WxCpCropCheckinOption>>() {
tmpJson.get("group"), }.getType()
new TypeToken<List<WxCpCropCheckinOption>>() { );
}.getType()
);
} }
@Override @Override
public WxCpApprovalInfo getApprovalInfo(@NonNull Date startTime, @NonNull Date endTime, public WxCpApprovalInfo getApprovalInfo(@NonNull Date startTime, @NonNull Date endTime,
Integer cursor, Integer size, List<WxCpApprovalInfoQueryFilter> filters) throws WxErrorException { Integer cursor, Integer size, List<WxCpApprovalInfoQueryFilter> filters)
throws WxErrorException {
if (cursor == null) { if (cursor == null) {
cursor = 0; cursor = 0;
} }
@ -171,7 +156,6 @@ public class WxCpOaServiceImpl implements WxCpOaService {
@Override @Override
public WxCpApprovalDetailResult getApprovalDetail(@NonNull String spNo) throws WxErrorException { public WxCpApprovalDetailResult getApprovalDetail(@NonNull String spNo) throws WxErrorException {
JsonObject jsonObject = new JsonObject(); JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("sp_no", spNo); jsonObject.addProperty("sp_no", spNo);
@ -198,7 +182,6 @@ public class WxCpOaServiceImpl implements WxCpOaService {
jsonObject.addProperty("limit", limit); jsonObject.addProperty("limit", limit);
if (startTime != null && endTime != null) { if (startTime != null && endTime != null) {
long endtimestamp = endTime.getTime() / 1000L; long endtimestamp = endTime.getTime() / 1000L;
long starttimestamp = startTime.getTime() / 1000L; long starttimestamp = startTime.getTime() / 1000L;
@ -230,12 +213,8 @@ public class WxCpOaServiceImpl implements WxCpOaService {
} }
@Override @Override
public List<WxCpCheckinDayData> getCheckinDayData(Date startTime, Date endTime, List<String> userIdList) throws WxErrorException { public List<WxCpCheckinDayData> getCheckinDayData(@NonNull Date startTime, @NonNull Date endTime, List<String> userIdList)
throws WxErrorException {
if (startTime == null || endTime == null) {
throw new WxRuntimeException("starttime and endtime can't be null");
}
if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) { if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) {
throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取"); throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取");
} }
@ -257,20 +236,15 @@ public class WxCpOaServiceImpl implements WxCpOaService {
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_DAY_DATA); final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_DAY_DATA);
String responseContent = this.mainService.post(url, jsonObject.toString()); String responseContent = this.mainService.post(url, jsonObject.toString());
JsonObject tmpJson = GsonParser.parse(responseContent); JsonObject tmpJson = GsonParser.parse(responseContent);
return WxCpGsonBuilder.create() return WxCpGsonBuilder.create().fromJson(tmpJson.get("datas"),
.fromJson( new TypeToken<List<WxCpCheckinDayData>>() {
tmpJson.get("datas"), }.getType()
new TypeToken<List<WxCpCheckinDayData>>() { );
}.getType()
);
} }
@Override @Override
public List<WxCpCheckinMonthData> getCheckinMonthData(Date startTime, Date endTime, List<String> userIdList) throws WxErrorException { public List<WxCpCheckinMonthData> getCheckinMonthData(@NonNull Date startTime, @NonNull Date endTime, List<String> userIdList)
if (startTime == null || endTime == null) { throws WxErrorException {
throw new WxRuntimeException("starttime and endtime can't be null");
}
if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) { if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) {
throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取"); throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取");
} }
@ -292,25 +266,19 @@ public class WxCpOaServiceImpl implements WxCpOaService {
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_MONTH_DATA); final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_MONTH_DATA);
String responseContent = this.mainService.post(url, jsonObject.toString()); String responseContent = this.mainService.post(url, jsonObject.toString());
JsonObject tmpJson = GsonParser.parse(responseContent); JsonObject tmpJson = GsonParser.parse(responseContent);
return WxCpGsonBuilder.create() return WxCpGsonBuilder.create().fromJson(tmpJson.get("datas"),
.fromJson( new TypeToken<List<WxCpCheckinMonthData>>() {
tmpJson.get("datas"), }.getType()
new TypeToken<List<WxCpCheckinMonthData>>() { );
}.getType()
);
} }
@Override @Override
public List<WxCpCheckinSchedule> getCheckinScheduleList(Date startTime, Date endTime, List<String> userIdList) throws WxErrorException { public List<WxCpCheckinSchedule> getCheckinScheduleList(@NonNull Date startTime, @NonNull Date endTime, List<String> userIdList)
if (startTime == null || endTime == null) { throws WxErrorException {
throw new WxRuntimeException("starttime and endtime can't be null");
}
if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) { if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) {
throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取"); throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取");
} }
long endTimestamp = endTime.getTime() / 1000L; long endTimestamp = endTime.getTime() / 1000L;
long startTimestamp = startTime.getTime() / 1000L; long startTimestamp = startTime.getTime() / 1000L;
@ -329,12 +297,10 @@ public class WxCpOaServiceImpl implements WxCpOaService {
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_SCHEDULE_DATA); final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_SCHEDULE_DATA);
String responseContent = this.mainService.post(url, jsonObject.toString()); String responseContent = this.mainService.post(url, jsonObject.toString());
JsonObject tmpJson = GsonParser.parse(responseContent); JsonObject tmpJson = GsonParser.parse(responseContent);
return WxCpGsonBuilder.create() return WxCpGsonBuilder.create().fromJson(tmpJson.get("schedule_list"),
.fromJson( new TypeToken<List<WxCpCheckinSchedule>>() {
tmpJson.get("schedule_list"), }.getType()
new TypeToken<List<WxCpCheckinSchedule>>() { );
}.getType()
);
} }
@Override @Override

View File

@ -172,7 +172,7 @@ public class WxCpContactWayInfo implements Serializable {
@JsonAdapter(WxCpConclusionAdapter.class) @JsonAdapter(WxCpConclusionAdapter.class)
public static class Conclusion implements Serializable { public static class Conclusion implements Serializable {
private static final long serialVersionUID = -8697184659526210472L; private static final long serialVersionUID = -8697184659526210472L;
private String textContent; private String textContent;
private String imgMediaId; private String imgMediaId;
private String imgPicUrl; private String imgPicUrl;

View File

@ -12,10 +12,10 @@ import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
public class WxCpContactWayResult extends WxCpBaseResp { public class WxCpContactWayResult extends WxCpBaseResp {
@SerializedName("config_id") @SerializedName("config_id")
private String configId; private String configId;
@SerializedName("qr_code") @SerializedName("qr_code")
private String qrCode; private String qrCode;
public static WxCpContactWayResult fromJson(String json) { public static WxCpContactWayResult fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpContactWayResult.class); return WxCpGsonBuilder.create().fromJson(json, WxCpContactWayResult.class);
} }

View File

@ -18,7 +18,7 @@ import java.util.List;
*/ */
public class WxCpUserExternalContactList implements Serializable { public class WxCpUserExternalContactList implements Serializable {
private static final long serialVersionUID = -4301684507150486556L; private static final long serialVersionUID = -4301684507150486556L;
@SerializedName("errcode") @SerializedName("errcode")
@Expose @Expose
private Long errcode; private Long errcode;

View File

@ -67,10 +67,10 @@ public class WxCpUserExternalGroupChatInfo extends WxCpBaseResp {
private Long joinTime; private Long joinTime;
/** /**
* 外部联系人在微信开放平台的唯一身份标识微信unionid * 外部联系人在微信开放平台的唯一身份标识微信unionid
* 通过此字段企业可将外部联系人与公众号/小程序用户关联起来 * 通过此字段企业可将外部联系人与公众号/小程序用户关联起来
* 仅当群成员类型是微信用户包括企业成员未添加好友且企业或第三方服务商绑定了微信开发者ID有此字段 * 仅当群成员类型是微信用户包括企业成员未添加好友且企业或第三方服务商绑定了微信开发者ID有此字段
*/ */
@SerializedName("unionid") @SerializedName("unionid")
private String unionId; private String unionId;
@ -106,7 +106,7 @@ public class WxCpUserExternalGroupChatInfo extends WxCpBaseResp {
@Getter @Getter
@Setter @Setter
public static class Invitor{ public static class Invitor {
/** /**
* 邀请者的userid * 邀请者的userid
@ -117,7 +117,7 @@ public class WxCpUserExternalGroupChatInfo extends WxCpBaseResp {
@Getter @Getter
@Setter @Setter
public static class GroupAdmin{ public static class GroupAdmin {
/** /**
* 群管理员userid * 群管理员userid

View File

@ -10,6 +10,7 @@ import java.util.List;
/** /**
* 分配离职成员的客户群结果 * 分配离职成员的客户群结果
*
* @author pg * @author pg
* @date 2021年6月21日 * @date 2021年6月21日
*/ */
@ -33,7 +34,7 @@ public class WxCpUserExternalGroupChatTransferResp extends WxCpBaseResp {
@Getter @Getter
@Setter @Setter
public static class GroupChatFailedTransfer extends WxCpBaseResp { public static class GroupChatFailedTransfer extends WxCpBaseResp {
private static final long serialVersionUID = -5836775099634587239L; private static final long serialVersionUID = -5836775099634587239L;
/** /**
* 没能成功继承的群ID * 没能成功继承的群ID

View File

@ -64,13 +64,13 @@ public class WxCpUserExternalTagGroupInfo extends WxCpBaseResp {
private String name; private String name;
@SerializedName("create_time") @SerializedName("create_time")
private Long createTime; private Long createTime;
@SerializedName("order") @SerializedName("order")
private Integer order; private Integer order;
@SerializedName("deleted") @SerializedName("deleted")
private Boolean deleted; private Boolean deleted;
} }

View File

@ -60,13 +60,13 @@ public class WxCpUserExternalTagGroupList extends WxCpBaseResp {
private String name; private String name;
@SerializedName("create_time") @SerializedName("create_time")
private Long createTime; private Long createTime;
@SerializedName("order") @SerializedName("order")
private Long order; private Long order;
@SerializedName("deleted") @SerializedName("deleted")
private Boolean deleted; private Boolean deleted;
} }
} }

View File

@ -11,6 +11,7 @@ import java.util.List;
/** /**
* 离职员工外部联系人列表 * 离职员工外部联系人列表
*
* @author yqx * @author yqx
* @date 2020/3/15 * @date 2020/3/15
*/ */

View File

@ -11,6 +11,7 @@ import java.util.List;
/** /**
* 联系客户统计数据 * 联系客户统计数据
*
* @author yqx * @author yqx
* @date 2020/3/16 * @date 2020/3/16
*/ */

View File

@ -10,6 +10,7 @@ import java.io.Serializable;
/** /**
* 在职成员的客户转接情况 * 在职成员的客户转接情况
*
* @author pg * @author pg
* @date 2021年6月21日 * @date 2021年6月21日
*/ */

View File

@ -14,7 +14,7 @@ import java.util.List;
@Data @Data
public class WxCpUserWithExternalPermission implements Serializable { public class WxCpUserWithExternalPermission implements Serializable {
private static final long serialVersionUID = -4301684507150486556L; private static final long serialVersionUID = -4301684507150486556L;
@SerializedName("errcode") @SerializedName("errcode")
@Expose @Expose
private Long errCode; private Long errCode;

View File

@ -1,8 +1,12 @@
package me.chanjar.weixin.cp.bean.external; package me.chanjar.weixin.cp.bean.external;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import lombok.*; import lombok.AllArgsConstructor;
import me.chanjar.weixin.cp.bean.external.msg.*; import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.cp.bean.external.msg.Attachment;
import me.chanjar.weixin.cp.bean.external.msg.Text;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable; import java.io.Serializable;

View File

@ -14,7 +14,7 @@ import java.io.Serializable;
@Data @Data
public class FollowedUser implements Serializable { public class FollowedUser implements Serializable {
private static final long serialVersionUID = -4301684507150486556L; private static final long serialVersionUID = -4301684507150486556L;
@SerializedName("userid") @SerializedName("userid")
private String userId; private String userId;

View File

@ -1,7 +1,7 @@
package me.chanjar.weixin.cp.bean.external.contact; package me.chanjar.weixin.cp.bean.external.contact;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import lombok.*; import lombok.Data;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable; import java.io.Serializable;

View File

@ -67,8 +67,8 @@ public class ContentValue implements Serializable {
@Data @Data
public static class Member implements Serializable { public static class Member implements Serializable {
private static final long serialVersionUID = 1316551341955496067L; private static final long serialVersionUID = 1316551341955496067L;
@SerializedName("userid") @SerializedName("userid")
private String userId; private String userId;
private String name; private String name;
@ -97,7 +97,6 @@ public class ContentValue implements Serializable {
private List<ApplyDataContent> list; private List<ApplyDataContent> list;
} }
@Data @Data
public static class Attendance implements Serializable { public static class Attendance implements Serializable {
private static final long serialVersionUID = -6627566040706594166L; private static final long serialVersionUID = -6627566040706594166L;

View File

@ -65,6 +65,7 @@ public class OriginNotifyResponse implements Serializable {
*/ */
@SerializedName(value = "summary") @SerializedName(value = "summary")
private String summary; private String summary;
/** /**
* <pre> * <pre>
* 字段名通知数据类型 * 字段名通知数据类型