mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🎨 重构优化代码
This commit is contained in:
parent
60fdf91ce7
commit
ace4f9a278
@ -3,7 +3,7 @@ package me.chanjar.weixin.mp.bean.template;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模版消息行业枚举.
|
* 模版消息行业枚举.
|
||||||
@ -200,13 +200,10 @@ public enum WxMpTemplateIndustryEnum {
|
|||||||
* @return 如果找不到, 返回null
|
* @return 如果找不到, 返回null
|
||||||
*/
|
*/
|
||||||
public static WxMpTemplateIndustryEnum findByClass(String firstClass, String secondClass) {
|
public static WxMpTemplateIndustryEnum findByClass(String firstClass, String secondClass) {
|
||||||
for (WxMpTemplateIndustryEnum industryEnum : WxMpTemplateIndustryEnum.values()) {
|
return Arrays.stream(WxMpTemplateIndustryEnum.values())
|
||||||
if (industryEnum.firstClass.equals(firstClass) && industryEnum.secondClass.contains(secondClass)) {
|
.filter(industryEnum -> industryEnum.firstClass.equals(firstClass)
|
||||||
return industryEnum;
|
&& industryEnum.secondClass.contains(secondClass))
|
||||||
}
|
.findFirst().orElse(null);
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,12 +213,8 @@ public enum WxMpTemplateIndustryEnum {
|
|||||||
* @return .
|
* @return .
|
||||||
*/
|
*/
|
||||||
public static WxMpTemplateIndustryEnum findByCode(int code) {
|
public static WxMpTemplateIndustryEnum findByCode(int code) {
|
||||||
for (WxMpTemplateIndustryEnum industryEnum : WxMpTemplateIndustryEnum.values()) {
|
return Arrays.stream(WxMpTemplateIndustryEnum.values())
|
||||||
if (industryEnum.code == code) {
|
.filter(industryEnum -> industryEnum.code == code)
|
||||||
return industryEnum;
|
.findFirst().orElse(null);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user