🎨 升级部分依赖版本,优化代码,部分代码增加泛型参数
This commit is contained in:
@@ -5,8 +5,6 @@ import me.chanjar.weixin.cp.bean.oa.meeting.WxCpMeeting;
|
||||
import me.chanjar.weixin.cp.bean.oa.meeting.WxCpMeetingUpdateResult;
|
||||
import me.chanjar.weixin.cp.bean.oa.meeting.WxCpUserMeetingIdResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业微信日程接口.
|
||||
* 企业和开发者通过会议接口可以便捷地预定及管理会议,用于小组周会、部门例会等场景。
|
||||
|
||||
@@ -110,7 +110,7 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
|
||||
return SHA1.gen(this.configStorage.getToken(), timestamp, nonce, data)
|
||||
.equals(msgSignature);
|
||||
} catch (Exception e) {
|
||||
log.error("Checking signature failed, and the reason is :" + e.getMessage());
|
||||
log.error("Checking signature failed, and the reason is :{}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
import me.chanjar.weixin.cp.api.WxCpCorpGroupService;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.corpgroup.WxCpCorpGroupCorp;
|
||||
import me.chanjar.weixin.cp.bean.corpgroup.WxCpCorpGroupCorpListAppShareInfoResp;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,6 +16,7 @@ import me.chanjar.weixin.cp.api.WxCpMediaService;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.media.MediaUploadByUrlReq;
|
||||
import me.chanjar.weixin.cp.bean.media.MediaUploadByUrlResult;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -67,12 +68,7 @@ public class WxCpMediaServiceImpl implements WxCpMediaService {
|
||||
, this.mainService.getWxCpConfigStorage().getApiUrl(MEDIA_UPLOAD + mediaType),
|
||||
new InputStreamData(inputStream, filename));
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
IOUtils.closeQuietly(inputStream);
|
||||
if (conn != null) {
|
||||
conn.disconnect();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import me.chanjar.weixin.cp.bean.oa.meeting.WxCpUserMeetingIdResult;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Oa.*;
|
||||
|
||||
@@ -66,9 +66,9 @@ public class WxCpMsgAuditServiceImpl implements WxCpMsgAuditService {
|
||||
|
||||
List<String> libList = Arrays.asList(libFiles);
|
||||
// 判断windows系统会话存档sdk中dll的加载,因为会互相依赖所以是有顺序的,否则会导致无法加载sdk #2598
|
||||
List<String> osLib = new LinkedList();
|
||||
List<String> fileLib = new ArrayList();
|
||||
libList.stream().forEach(s -> {
|
||||
List<String> osLib = new LinkedList<>();
|
||||
List<String> fileLib = new ArrayList<>();
|
||||
libList.forEach(s -> {
|
||||
if (s.contains("lib")) {
|
||||
osLib.add(s);
|
||||
} else {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class WxCpSchoolUserServiceImpl implements WxCpSchoolUserService {
|
||||
if (StringUtils.isNotEmpty(name)) {
|
||||
jsonObject.addProperty("name", name);
|
||||
}
|
||||
if (departments != null && departments.size() > 0) {
|
||||
if (departments != null && !departments.isEmpty()) {
|
||||
JsonArray jsonArray = new JsonArray();
|
||||
for (Integer depart : departments) {
|
||||
jsonArray.add(new JsonPrimitive(depart));
|
||||
|
||||
@@ -2,7 +2,6 @@ package me.chanjar.weixin.cp.bean.corpgroup;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.bean.external.acquisition.WxCpCustomerAcquisitionInfo;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -2,10 +2,7 @@ package me.chanjar.weixin.cp.bean.external.interceptrule;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.*;
|
||||
import me.chanjar.weixin.common.bean.ToJson;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.bean.external.acquisition.WxCpCustomerAcquisitionInfo;
|
||||
import me.chanjar.weixin.cp.bean.external.acquisition.WxCpCustomerAcquisitionList;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import static me.chanjar.weixin.cp.constant.WxCpConsts.GroupRobotMsgType.*;
|
||||
import static me.chanjar.weixin.cp.constant.WxCpConsts.GroupRobotMsgType.TEMPLATE_CARD;
|
||||
|
||||
/**
|
||||
* 微信群机器人消息
|
||||
|
||||
@@ -6,10 +6,8 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* The type Base builder.
|
||||
*
|
||||
* @param <T> the type parameter
|
||||
*/
|
||||
public class BaseBuilder<T> {
|
||||
public abstract class BaseBuilder<T> {
|
||||
/**
|
||||
* The Msg type.
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@ public class WxCpCheckinDayData implements Serializable {
|
||||
* The type Base info.
|
||||
*/
|
||||
@Data
|
||||
public class BaseInfo implements Serializable {
|
||||
public static class BaseInfo implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 3679745559788648438L;
|
||||
@@ -143,7 +143,7 @@ public class WxCpCheckinDayData implements Serializable {
|
||||
* The type Summary info.
|
||||
*/
|
||||
@Data
|
||||
public class SummaryInfo implements Serializable {
|
||||
public static class SummaryInfo implements Serializable {
|
||||
private static final long serialVersionUID = 3428576099259666595L;
|
||||
/**
|
||||
* checkin_count 当日打卡次数
|
||||
@@ -186,7 +186,7 @@ public class WxCpCheckinDayData implements Serializable {
|
||||
* The type Holiday infos.
|
||||
*/
|
||||
@Data
|
||||
public class HolidayInfos implements Serializable {
|
||||
public static class HolidayInfos implements Serializable {
|
||||
private static final long serialVersionUID = -6671577072585561527L;
|
||||
/**
|
||||
* sp_number 假勤相关信息
|
||||
@@ -282,7 +282,7 @@ public class WxCpCheckinDayData implements Serializable {
|
||||
* The type Exception infos.
|
||||
*/
|
||||
@Data
|
||||
public class ExceptionInfos implements Serializable {
|
||||
public static class ExceptionInfos implements Serializable {
|
||||
private static final long serialVersionUID = -5987438373762518299L;
|
||||
/**
|
||||
* exception 校准状态类型:1-迟到;2-早退;3-缺卡;4-旷工;5-地点异常;6-设备异常
|
||||
@@ -313,7 +313,7 @@ public class WxCpCheckinDayData implements Serializable {
|
||||
* The type Ot info.
|
||||
*/
|
||||
@Data
|
||||
public class OtInfo implements Serializable {
|
||||
public static class OtInfo implements Serializable {
|
||||
private static final long serialVersionUID = -6557759801572150175L;
|
||||
/**
|
||||
* ot_status 状态:0-无加班;1-正常;2-缺时长
|
||||
@@ -344,7 +344,7 @@ public class WxCpCheckinDayData implements Serializable {
|
||||
* The type Sp item.
|
||||
*/
|
||||
@Data
|
||||
public class SpItem implements Serializable {
|
||||
public static class SpItem implements Serializable {
|
||||
private static final long serialVersionUID = 2423158264958352024L;
|
||||
/**
|
||||
* type 类型:1-请假;2-补卡;3-出差;4-外出;100-外勤
|
||||
|
||||
@@ -49,7 +49,7 @@ public class WxCpCheckinSchedule implements Serializable {
|
||||
* The type User schedule.
|
||||
*/
|
||||
@Data
|
||||
public class UserSchedule implements Serializable {
|
||||
public static class UserSchedule implements Serializable {
|
||||
private static final long serialVersionUID = 9138985222324576857L;
|
||||
/**
|
||||
* scheduleList 个人排班表信息
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package me.chanjar.weixin.cp.bean.oa.meeting;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 为标签添加或移除用户结果对象类.
|
||||
|
||||
@@ -59,7 +59,7 @@ public class MultipleSelect implements Serializable {
|
||||
}
|
||||
// select_list
|
||||
List<CheckboxOption> options = this.getOptions();
|
||||
if (null != options && options.size() > 0) {
|
||||
if (null != options && !options.isEmpty()) {
|
||||
JsonArray optionJsonArray = new JsonArray();
|
||||
for (CheckboxOption option : this.getOptions()) {
|
||||
JsonObject tempObject = option.toJson();
|
||||
|
||||
@@ -44,7 +44,7 @@ public class TemplateCardButtonSelection implements Serializable {
|
||||
btnObject.addProperty("selected_id", this.selectedId);
|
||||
}
|
||||
|
||||
if (this.optionList != null && this.optionList.size() > 0) {
|
||||
if (this.optionList != null && !this.optionList.isEmpty()) {
|
||||
JsonArray optionJsonArray = new JsonArray();
|
||||
for (TemplateCardButtonSelectionOption jump : this.getOptionList()) {
|
||||
JsonObject tempObject = jump.toJson();
|
||||
|
||||
@@ -17,7 +17,6 @@ import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.corpgroup.WxCpCorpGroupCorpGetTokenReq;
|
||||
import me.chanjar.weixin.cp.bean.corpgroup.WxCpMaTransferSession;
|
||||
import me.chanjar.weixin.cp.config.WxCpCorpGroupConfigStorage;
|
||||
import me.chanjar.weixin.cp.config.WxCpTpConfigStorage;
|
||||
import me.chanjar.weixin.cp.corpgroup.service.WxCpCgService;
|
||||
import me.chanjar.weixin.cp.corpgroup.service.WxCpLinkedCorpService;
|
||||
|
||||
|
||||
@@ -205,12 +205,12 @@ public class WxCpMessageRouter {
|
||||
}
|
||||
}
|
||||
|
||||
if (matchRules.size() == 0) {
|
||||
if (matchRules.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
WxCpXmlOutMessage res = null;
|
||||
final List<Future> futures = new ArrayList<>();
|
||||
final List<Future<?>> futures = new ArrayList<>();
|
||||
for (final WxCpMessageRouterRule rule : matchRules) {
|
||||
// 返回最后一个非异步的rule的执行结果
|
||||
if (rule.isAsync()) {
|
||||
@@ -228,9 +228,9 @@ public class WxCpMessageRouter {
|
||||
}
|
||||
}
|
||||
|
||||
if (futures.size() > 0) {
|
||||
if (!futures.isEmpty()) {
|
||||
this.executorService.submit(() -> {
|
||||
for (Future future : futures) {
|
||||
for (Future<?> future : futures) {
|
||||
try {
|
||||
future.get();
|
||||
log.debug("End session access: async=true, sessionId={}", wxMessage.getFromUserName());
|
||||
|
||||
@@ -213,12 +213,12 @@ public class WxCpTpMessageRouter {
|
||||
}
|
||||
}
|
||||
|
||||
if (matchRules.size() == 0) {
|
||||
if (matchRules.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
WxCpXmlOutMessage res = null;
|
||||
final List<Future> futures = new ArrayList<>();
|
||||
final List<Future<?>> futures = new ArrayList<>();
|
||||
for (final WxCpTpMessageRouterRule rule : matchRules) {
|
||||
// 返回最后一个非异步的rule的执行结果
|
||||
if (rule.isAsync()) {
|
||||
@@ -236,9 +236,9 @@ public class WxCpTpMessageRouter {
|
||||
}
|
||||
}
|
||||
|
||||
if (futures.size() > 0) {
|
||||
if (!futures.isEmpty()) {
|
||||
this.executorService.submit(() -> {
|
||||
for (Future future : futures) {
|
||||
for (Future<?> future : futures) {
|
||||
try {
|
||||
future.get();
|
||||
log.debug("End session access: async=true, sessionId={}", wxMessage.getSuiteId());
|
||||
|
||||
@@ -6,8 +6,6 @@ import me.chanjar.weixin.cp.bean.WxCpTpOpenKfIdConvertResult;
|
||||
import me.chanjar.weixin.cp.bean.WxCpTpTagIdListConvertResult;
|
||||
import me.chanjar.weixin.cp.bean.WxCpTpUnionidToExternalUseridResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业微信三方应用ID转换接口
|
||||
|
||||
@@ -104,7 +104,7 @@ public abstract class BaseWxCpTpServiceImpl<H, P> implements WxCpTpService, Requ
|
||||
return SHA1.gen(this.configStorage.getToken(), timestamp, nonce, data)
|
||||
.equals(msgSignature);
|
||||
} catch (Exception e) {
|
||||
log.error("Checking signature failed, and the reason is :" + e.getMessage());
|
||||
log.error("Checking signature failed, and the reason is :{}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@ import me.chanjar.weixin.cp.constant.WxCpApiPathConsts;
|
||||
import me.chanjar.weixin.cp.tp.service.WxCpTpIdConvertService;
|
||||
import me.chanjar.weixin.cp.tp.service.WxCpTpService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author cocoa
|
||||
|
||||
@@ -17,7 +17,7 @@ public class XStreamTransformer {
|
||||
/**
|
||||
* The constant CLASS_2_XSTREAM_INSTANCE.
|
||||
*/
|
||||
protected static final Map<Class, XStream> CLASS_2_XSTREAM_INSTANCE = configXStreamInstance();
|
||||
protected static final Map<Class<?>, XStream> CLASS_2_XSTREAM_INSTANCE = configXStreamInstance();
|
||||
|
||||
/**
|
||||
* xml -> pojo
|
||||
@@ -53,7 +53,7 @@ public class XStreamTransformer {
|
||||
* @param clz 类型
|
||||
* @param xStream xml解析器
|
||||
*/
|
||||
public static void register(Class clz, XStream xStream) {
|
||||
public static void register(Class<?> clz, XStream xStream) {
|
||||
CLASS_2_XSTREAM_INSTANCE.put(clz, xStream);
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ public class XStreamTransformer {
|
||||
return CLASS_2_XSTREAM_INSTANCE.get(clazz).toXML(object);
|
||||
}
|
||||
|
||||
private static Map<Class, XStream> configXStreamInstance() {
|
||||
Map<Class, XStream> map = new HashMap<>();
|
||||
private static Map<Class<?>, XStream> configXStreamInstance() {
|
||||
Map<Class<?>, XStream> map = new HashMap<>();
|
||||
map.put(WxCpXmlMessage.class, configWxCpXmlMessage());
|
||||
map.put(WxCpXmlOutNewsMessage.class, configWxCpXmlOutNewsMessage());
|
||||
map.put(WxCpXmlOutTextMessage.class, configWxCpXmlOutTextMessage());
|
||||
|
||||
Reference in New Issue
Block a user