12 changed files with 213 additions and 34 deletions
@ -0,0 +1,66 @@ |
|||||||
|
package com.mh.user.utils; |
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject; |
||||||
|
import com.mh.user.entity.wechat.PushMsgEntity; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LJF |
||||||
|
* @version 1.0 |
||||||
|
* @project mh_esi |
||||||
|
* @description 微信模板枚举类 |
||||||
|
* @date 2025-09-08 13:58:43 |
||||||
|
*/ |
||||||
|
public enum TemplateType { |
||||||
|
SINGLE_DEVICE("qG3Odr74o4BRx8QigZuoiguLNSkw7QJ0zQI3LaHtMY8") { |
||||||
|
@Override |
||||||
|
public void fillData(JSONObject data, PushMsgEntity pushMsgEntity) { |
||||||
|
data.put("thing1", pushMsgEntity.getKey1()); |
||||||
|
data.put("character_string7", pushMsgEntity.getKey2()); |
||||||
|
data.put("character_string8", pushMsgEntity.getKey3()); |
||||||
|
data.put("character_string9", pushMsgEntity.getKey4()); |
||||||
|
data.put("time5", pushMsgEntity.getKey5()); |
||||||
|
} |
||||||
|
}, |
||||||
|
ENERGY_DATA("qG3Odr74o4BRx8QigZuoil3l3ZC2aAdDeO49robRLC8") { |
||||||
|
@Override |
||||||
|
public void fillData(JSONObject data, PushMsgEntity pushMsgEntity) { |
||||||
|
data.put("thing1", pushMsgEntity.getKey1()); |
||||||
|
data.put("character_string2", pushMsgEntity.getKey2()); |
||||||
|
data.put("character_string3", pushMsgEntity.getKey3()); |
||||||
|
data.put("character_string4", pushMsgEntity.getKey4()); |
||||||
|
data.put("time5", pushMsgEntity.getKey5()); |
||||||
|
} |
||||||
|
}, |
||||||
|
DEVICE_OFFLINE("LrSu6VlICV9sTIWZgl8SF7bFI7TfqbSpeJ-cvPaTe6I") { |
||||||
|
@Override |
||||||
|
public void fillData(JSONObject data, PushMsgEntity pushMsgEntity) { |
||||||
|
data.put("thing19", pushMsgEntity.getKey1()); |
||||||
|
data.put("thing25", pushMsgEntity.getKey2()); |
||||||
|
data.put("character_string7", pushMsgEntity.getKey3()); |
||||||
|
data.put("thing4", pushMsgEntity.getKey4()); |
||||||
|
data.put("time3", pushMsgEntity.getKey5()); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
private final String templateId; |
||||||
|
|
||||||
|
TemplateType(String templateId) { |
||||||
|
this.templateId = templateId; |
||||||
|
} |
||||||
|
|
||||||
|
public String getTemplateId() { |
||||||
|
return templateId; |
||||||
|
} |
||||||
|
|
||||||
|
public abstract void fillData(JSONObject data, PushMsgEntity pushMsgEntity); |
||||||
|
|
||||||
|
public static TemplateType fromTemplateId(String templateId) { |
||||||
|
for (TemplateType type : values()) { |
||||||
|
if (type.getTemplateId().equals(templateId)) { |
||||||
|
return type; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
Loading…
Reference in new issue