内网短信集成示例demo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

177 lines
19 KiB

package com.tptj.demo.hg.third.sms;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
/**
* @author 秃破天际
* @version 10.0
* Created by 秃破天际 on 2021/7/23
**/
public class SMSUserInfo {
public static final JSONObject DATA = JSONObject.create()
.put("data", getData() )
.put("status","success");
private static JSONObject getData(){
return JSONObject.create()
.put("balance",1000)
.put("testSMSNum",5)
.put("userId",99999)
.put("sign",getSigns())
.put("public_tpl",getPublicTpl())
.put("private_tpl",getPrivateTpl());
}
private static JSONArray getSigns(){
return JSONArray.create()
.put(newSign(2,"【信息平台】",null,"success", true ) )
.put(newSign(3,"【帆软软件】",null,"success", true ) )
.put(newSign(4,"【呵呵平台】",null,"success", true ) );
}
private static JSONArray getPublicTpl(){
return JSONArray.create()
.put(newTpl( 10,"【信息平台】尊敬的管理员,#taskname#于#time#运行失败,请知晓。", "zh_CN", true ))
.put(newTpl( 11,"【帆软软件】尊敬的#name#,您有一个工单号为:#order_number#的待处理工单,请您及时处理!", "zh_CN", true ))
.put(newTpl( 13,"【帆软软件】您好,#webname#系统内存持续#m#分钟内存高于#n#,可能存在宕机风险,请及时关注。", "zh_CN", true ))
.put(newTpl( 14,"【帆软软件】尊敬的管理员,#taskname#于#time#运行失败,请知晓。", "zh_CN", true ))
.put(newTpl( 15,"【帆软软件】您好,#taskname#于#time#运行成功。", "zh_CN", true ))
.put(newTpl( 16,"【帆软软件】您的手机验证码为#Verifiecode#,请于10分钟内正确输入。", "zh_CN", true ))
.put(newTpl( 17,"【信息平台】您好,#webname#系统内存持续#m#分钟内存高于#n#,可能存在宕机风险,请及时关注。", "zh_CN", true ))
.put(newTpl( 18,"【信息平台】恭喜!您的短信服务已经配置成功。", "zh_CN", true ))
.put(newTpl( 20,"【信息平台】您的手机验证码为#verifiecode#,请于10分钟内正确输入。", "zh_CN", true ))
.put(newTpl( 49,"【信息平台】您好,#webname#系统日志文件已大于#logsize#M,请及时登录平台进行日志清理。", "zh_CN", true ))
.put(newTpl( 50,"【信息平台】您好,#webname#系统#clustername#内存持续#m#分钟内存高于#n#,可能存在宕机风险,请及时关注。", "zh_CN", true ))
.put(newTpl( 51,"【信息平台】你好,#task#出错,请及时处理。该任务开始执行时间:#time#", "zh_CN", true ))
.put(newTpl( 53,"【信息平台】上报任务 #task#,已经到您这里#time#,请尽快处理!", "zh_CN", true ))
.put(newTpl( 54,"【信息平台】#name#您好,上报任务#task#已经发起,请尽快处理!", "zh_CN", true ))
.put(newTpl( 63,"【信息平台】节点#nodename2#,与节点#nodename1#系统时间相差超过#time_different#秒,为避免影响用户使用,请及时调整使各节点时间保持一致。", "zh_CN", true ))
.put(newTpl( 64,"【信息平台】节点#nodename#已脱离集群环境,可能原因为:节点FullGC、节点宕机、节点间通…其他异常。为避免影响用户使用,请及时检查该节点状态,若该节点长时间无法自行恢复,则建议重启该节点。", "zh_CN", true ))
.put(newTpl( 89,"【信息平台】节点#nodename#,与节点#node1name#的jar包不一致,将影响集群工程的稳定性,请前往集群节点管理页面查看详细异常信息,并及时处理。", "zh_CN", true ))
.put(newTpl( 90,"【信息平台】节点#nodename#情况异常,用户不能正常访问,请及时检查该节点状态。", "zh_CN", true ))
.put(newTpl( 125,"【信息平台】您有个#proname#任务即将过期,请您尽快办理。", "zh_CN", true ))
.put(newTpl( 127,"【信息平台】您有个#proname#任务需要处理,请您尽快办理。发起人:#startpeople#,发起时间:#starttime#。", "zh_CN", true ))
.put(newTpl( 134,"【信息平台】Redis集群#ip_port#节点已无法正常使用,可能原因为:节点宕机、内存已满、其他异常。为避免影响用户使用,请前往状态服务器配置页面查看详情,并及时处理。", "zh_CN", true ))
.put(newTpl( 135,"【信息平台】文件服务器出现无法读写的情况,可能原因为:文件服务器宕机、磁盘已满、其他异常。为避免影响用户使用,请及时检查文件服务器状态。", "zh_CN", true ))
.put(newTpl( 136,"【信息平台】您好,#webname#系统#clustername#当前负载状态过高,可能存在宕机风险,请及时关注。建议使用管理系统-智能运维-云端运维功能分析当前系统存在的性能问题。", "zh_CN", true ))
.put(newTpl( 239,"【帆软软件】您好,预警任务#warningname#达到阈值被触发,请及时关注!模板路径:#templatePath#", "zh_CN", true ))
.put(newTpl( 264,"【信息平台】更新任务「#job_name#」结束。任务开始于#year#年#month#月#day#…aset# , 关联更新 #success_relation#/#total_relation#。", "zh_CN", true ))
.put(newTpl( 265,"【信息平台】报表系统已宕机,请访问运维工具关注问题处理状态或及时进行系统重启。", "zh_CN", true ))
.put(newTpl( 266,"【信息平台】报表系统已宕机,自动重启系统失败,请及时进行手动重启。", "zh_CN", true ))
.put(newTpl( 269,"【信息平台】检查到系统环境配置存有不合理项,请及时查看并改正不合理项。", "zh_CN", true ))
.put(newTpl( 276,"【信息平台】你好,[#taskname#]备份失败,请及时处理,备份时间:#time#", "zh_CN", true ))
.put(newTpl( 306,"【信息平台】尊敬的管理員,#taskname#於#time#運行失敗,請知曉。", "zh_TW", true ))
.put(newTpl( 307,"【信息平台】您好,#webname#系統記憶體持續#m#分鐘記憶體高於#n#,可能存在宕機風險,請及時關注。", "zh_TW", true ))
.put(newTpl( 308,"【信息平台】恭喜!您的簡訊服務已經配置成功。", "zh_TW", true ))
.put(newTpl( 309,"【信息平台】您的手機驗證碼為#verifiecode#,請於10分鐘內正確輸入。", "zh_TW", true ))
.put(newTpl( 310,"【信息平台】您好,#webname#系統日誌檔已大於#logsize#M,請及時登入平臺進行日誌清理。", "zh_TW", true ))
.put(newTpl( 311,"【信息平台】您好,#webname#系統#clustername#記憶體持續#m#分鐘記憶體高於#n#,可能存在宕機風險,請及時關注。", "zh_TW", true ))
.put(newTpl( 312,"【信息平台】你好,#task#出錯,請及時處理。該任務開始執行時間:#time#", "zh_TW", true ))
.put(newTpl( 313,"【信息平台】上報任務#task#,已經到您這裡#time#,請儘快處理!", "zh_TW", true ))
.put(newTpl( 314,"【信息平台】#name#您好,上報任務#task#已經發起,請儘快處理!", "zh_TW", true ))
.put(newTpl( 315,"【信息平台】系統檢測到,節點#node_id#的系統時間與其他節點不一致。請配置時間伺服器,實現節點時間的自動同步。", "zh_TW", true ))
.put(newTpl( 316,"【信息平台】節點#nodename#已脫離叢集環境,可能原因為:節點FullGC、節點宕機、節點間通…他异常。為避免影響使用者使用,請及時檢查該節點狀態,若該節點長時間無法自行恢復,則建議重啓該節點。", "zh_TW", true ))
.put(newTpl( 317,"【信息平台】節點#nodename#,與節點#node1name#的jar包不一致,將影響叢集工程的穩定性,請前往叢集節點管理頁面查看詳細异常資訊,並及時處理。", "zh_TW", true ))
.put(newTpl( 318,"【信息平台】節點#nodename#情况异常,使用者不能正常訪問,請及時檢查該節點狀態。", "zh_TW", true ))
.put(newTpl( 319,"【信息平台】您有個#proname#任務即將過期,請您儘快辦理。", "zh_TW", true ))
.put(newTpl( 320,"【信息平台】您有個#proname#任務需要處理,請您儘快辦理。發起人:#startpeople#,發起時間:#starttime#。", "zh_TW", true ))
.put(newTpl( 321,"【信息平台】Redis叢集#ip_port#節點已無法正常使用,可能原因為:節點宕機、記憶體已滿、其他異常。為避免影響使用者使用,請前往狀態伺服器配置頁面檢視詳情,並及時處理。", "zh_TW", true ))
.put(newTpl( 322,"【信息平台】檔案伺服器出現無法讀寫的情况,可能原因為:檔案伺服器宕機、磁片已滿、其他异常。為避免影響使用者使用,請及時檢查檔案伺服器狀態。", "zh_TW", true ))
.put(newTpl( 323,"【信息平台】您好,#webname#系統#clustername#當前負載狀態過高,可能存在宕機風險,請及時關注。", "zh_TW", true ))
.put(newTpl( 324,"【信息平台】更新任務「#job_name#」結束。任務開始於#year#年#month#月#day#…dataset#,關聯更新#success_relation#/#total_relation#。", "zh_TW", true ))
.put(newTpl( 325,"【信息平台】報表系統已宕機,請訪問維運工具關注問題處理狀態或及時進行系統重啓。", "zh_TW", true ))
.put(newTpl( 326,"【信息平台】報表系統已宕機,自動重啟系統失敗,請及時進行手動重啓。", "zh_TW", true ))
.put(newTpl( 327,"【信息平台】檢查到系統環境配置存有不合理項,請及時查看並改正不合理項。", "zh_TW", true ))
.put(newTpl( 328,"【信息平台】你好,[#taskname#]備份失敗,請及時處理,備份時間:#time#", "zh_TW", true ))
.put(newTpl( 329,"【信息平台】Dear administrator, #taskname# failed to run at #time#.", "en_US", true ))
.put(newTpl( 330,"【信息平台】Hello, the system memory of #webname# keeps …y be downtime risk. Please pay attention in time.", "en_US", true ))
.put(newTpl( 331,"【信息平台】Congratulations! Your SMS service has been configured successfully.", "en_US", true ))
.put(newTpl( 332,"【信息平台】Your mobile phone verification code is #veri…de#. Please input it correctly within 10 minutes.", "en_US", true ))
.put(newTpl( 333,"【信息平台】Hello, the system log files of #webname# occ…g in the platform to clean the log files in time.", "en_US", true ))
.put(newTpl( 334,"【信息平台】Hello, the memory of #clustername# in system…y be downtime risk. Please pay attention in time.", "en_US", true ))
.put(newTpl( 335,"【信息平台】Hello, there is an error in the task #task#,…t in time. The start time of the task is: #time#.", "en_US", true ))
.put(newTpl( 336,"【信息平台】Reporting task #task# has arrived at #time#. Please deal with it as soon as possible!", "en_US", true ))
.put(newTpl( 337,"【信息平台】Hello #name#, the reporting task #task# has … initiated. Please handle it as soon as possible!", "en_US", true ))
.put(newTpl( 338,"【信息平台】The system detects that the system time of n…o realize automatic synchronization of node time.", "en_US", true ))
.put(newTpl( 339,"【信息平台】Node #nodename# has been out of the cluster …der to avoid affecting the user's use, please che", "en_US", true ))
.put(newTpl( 340,"【信息平台】The jar packages of node #nodename# and node…iled exception information and handle it in time.", "en_US", true ))
.put(newTpl( 341,"【信息平台】There exists abnormal condition of node #nod…lly. Please check the status of the node in time.", "en_US", true ))
.put(newTpl( 342,"【信息平台】Task #proname# will expire recently. Please handle it as soon as possible.", "en_US", true ))
.put(newTpl( 343,"【信息平台】Task #proname# needs to be handled. Please h…nitiator: #startpeople#. Start time: #starttime#.", "en_US", true ))
.put(newTpl( 344,"【信息平台】The Redis cluster #ip_port# node is no longe…page, check the details and deal with it in time.", "en_US", true ))
.put(newTpl( 345,"【信息平台】The file server is unable to read and write.…ease check the status of the file server in time.", "en_US", true ))
.put(newTpl( 346,"【信息平台】Hello, the load of #clustername# in system #…intenance and use the function of Cloud Operation", "en_US", true ))
.put(newTpl( 347,"【信息平台】Update task 「#job_name#」is completed. The ta…table#/#total_basetable# basic table, #success_da", "en_US", true ))
.put(newTpl( 348,"【信息平台】The report system has been down. Please use … processing status or restart the system in time.", "en_US", true ))
.put(newTpl( 349,"【信息平台】The report system has been down, and automat… restart failed. Please restart manually in time.", "en_US", true ))
.put(newTpl( 350,"【信息平台】It is found that there are unreasonable item…check and correct the unreasonable items in time.", "en_US", true ))
.put(newTpl( 351,"【信息平台】Hello, [#taskname#] backup failed. Please handle it in time. Backup time: #time#.", "en_US", true ))
.put(newTpl( 367,"【信息平台】集群节点#node_name#与基准节点存在不一致文件,且无法自动同步。请检查该节点状态", "zn_CN", true ))
.put(newTpl( 368,"【信息平台】集群节点#node_name#与基准节点存在不一致文件,已自动同步与基准节点一致,不一致文件备份在该节点工程WEB-INF/#directory#/下", "zh_CN", true ))
.put(newTpl( 369,"【信息平台】節點#nodename1#與節點#nodename1#之間通訊異常,無法加入節點管理,請…7830, 7840, 7850,7860,7870][UDP:45588~65536 隨機埠]。", "zh_TW", true ))
.put(newTpl( 370,"【信息平台】節點#node_name#的#type#模組存在異常,暫無法正常提供服務,請及時對異常狀況進行排查", "zh_TW", true ))
.put(newTpl( 371,"【信息平台】叢集節點#node_name#與基準節點存在不一致檔案,且無法自動同步。請檢查該節點狀態", "zh_TW", true ))
.put(newTpl( 372,"【信息平台】叢集節點#node_name#與基準節點存在不一致檔案,已自動同步與基準節點一致,不一致檔案備份在該節點工程WEB-INF/#directory#/下", "zh_TW", true ))
.put(newTpl( 373,"【信息平台】The communication between node #nodename1# a…7850,7860,7870] [UDP: 45588 ~ 65536 random port].", "en_US", true ))
.put(newTpl( 374,"【信息平台】The #node_name# node #type# module has start…ng. Please check for abnormal conditions in time.", "en_US", true ))
.put(newTpl( 375,"【信息平台】Cluster node #node_name# has inconsistent fi…ized automatically. Please check the node status.", "en_US", true ))
.put(newTpl( 376,"【信息平台】The cluster node #node_name# has an inconsis…up under the node project WEB-INF/ #directory# /.", "en_US", true ))
.put(newTpl( 401,"【信息平台】Hello, #taskname# runs successfully on #time#.", "en_US", true ))
.put(newTpl( 402,"【信息平台】您好,#taskname#於#time#運行成功運行。", "zh_TW", true ))
.put(newTpl( 509,"【信息平台】尊敬的管理员,用户管理-同步用户于#time#运行失败,可手动触发同步,以查看详细报错。", "zh_CN", true ))
.put(newTpl( 550,"【信息平台】Dear administrator, \\\"User>Sync user\\\" failed … sync manually to view the detailed error report.", "en_US", true ))
.put(newTpl( 551,"【信息平台】尊敬的管理員,使用者管理-同步使用者於#time#執行失敗,可手動觸發同步,以檢視詳細報錯。", "zh_TW", true ))
.put(newTpl( 998,"【信息平台】节点#nodename1#与节点#nodename2#之间通信异常,无法加入节点管理,请…830, 7840, 7850,7860,7870][UDP:45588~65536 随机端口]。", "zh_CN", true ))
.put(newTpl( 999,"【信息平台】节点#node_name#的#type#模块存在异常,暂无法正常提供服务,请及时对异常状况进行排查", "zh_CN", true ))
.put(newTpl( 1001,"【信息平台】随便测试一下", "zh_CN", true ))
.put(newTpl( 1002,"【呵呵平台】随便测试一下", "zh_CN", true ));
}
public static Map<String,String> getTpls(){
JSONArray arrs = getPublicTpl();
Map<String,String> rt = new HashMap<String,String>();
for( int i=0,len=arrs.length();i<len;i++ ){
JSONObject tpl = arrs.optJSONObject(i);
rt.put( ""+tpl.optInt("id"), tpl.optString("content") );
}
arrs = getPrivateTpl();
for( int i=0,len=arrs.length();i<len;i++ ){
JSONObject tpl = arrs.optJSONObject(i);
rt.put( ""+tpl.optInt("id"), tpl.optString("content") );
}
return rt;
}
private static JSONArray getPrivateTpl(){
return JSONArray.create();
}
private static JSONObject newSign(int id, String sign, String remark, String status, boolean isDefault){
return JSONObject.create()
.put("id",id)
.put("sign",sign)
.put("remark",remark)
.put("status",status)
.put("is_default",isDefault);
}
private static JSONObject newTpl( int id, String content, String language, boolean isDefault ){
return JSONObject.create()
.put("id",id)
.put("content",content)
.put("language",language)
.put("remark",(String)null)
.put("status","success")
.put("is_default",isDefault);
}
}