parent
3d2548cffe
commit
47d9d86be3
@ -0,0 +1,32 @@
|
|||||||
|
package com.mashibing.common.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: CMPP2DeliverEnums
|
||||||
|
* @Description: CMPP2.0协议-短信发送后回调枚举
|
||||||
|
* @date 2025/6/17 17:56
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum CMPP2DeliverEnums {
|
||||||
|
|
||||||
|
DELIVERED("DELIVRD", "Message is delivered to destination"),
|
||||||
|
EXPIRED("EXPIRED", "Message validity period has expired"),
|
||||||
|
DELETED("DELETED", "Message has been deleted."),
|
||||||
|
UNDELIVERABLE("UNDELIV", "Message is undeliverable"),
|
||||||
|
ACCEPTED("ACCEPTD", "Message is in accepted state"),
|
||||||
|
UNKNOWN("UNKNOWN", "Message is in invalid state"),
|
||||||
|
REJECTED("REJECTD", "Message is in a rejected state"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private String stat;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
CMPP2DeliverEnums(String stat, String description) {
|
||||||
|
this.stat = stat;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.mashibing.common.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: CMPP2ResultEnums
|
||||||
|
* @Description: CMPP2.0协议-短信提交后的应答枚举
|
||||||
|
* @date 2025/6/17 17:32
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum CMPP2ResultEnums {
|
||||||
|
|
||||||
|
OK(0, "正确"),
|
||||||
|
MESSAGE_BUILD_ERROR(1, "消息结构错"),
|
||||||
|
COMMAND_WORD_ERROR(2, "命令字错"),
|
||||||
|
MESSAGE_SEQUENCE_ERROR(3, "消息序号重复"),
|
||||||
|
MESSAGE_LENGTH_ERROR(4, "消息长度错"),
|
||||||
|
INCORRECT_TARIFF_CODE(5, "资费代码错"),
|
||||||
|
Exceeding_maximum_message_length(6, "超过最大信息长"),
|
||||||
|
BUSINESS_CODE_ERROR(7, "业务代码错"),
|
||||||
|
FLOW_CONTROL_ERROR(8, "流量控制错"),
|
||||||
|
UNKNOWN(9, "其他错误");
|
||||||
|
|
||||||
|
private final Integer result;
|
||||||
|
|
||||||
|
private final String msg;
|
||||||
|
|
||||||
|
CMPP2ResultEnums(Integer result, String msg) {
|
||||||
|
this.result = result;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.mashibing.common.utils;
|
||||||
|
|
||||||
|
import com.mashibing.common.enums.CMPP2DeliverEnums;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: CMPP2DeliverUtil
|
||||||
|
* @Description: CMPP2.0协议-短信发送后回调枚举工具类
|
||||||
|
* @date 2025/6/17 17:59
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CMPP2DeliverUtil {
|
||||||
|
|
||||||
|
private static Map<String, String> stats = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
CMPP2DeliverEnums[] cmpp2DeliverEnums = CMPP2DeliverEnums.values();
|
||||||
|
for (CMPP2DeliverEnums cmpp2DeliverEnum : cmpp2DeliverEnums) {
|
||||||
|
stats.put(cmpp2DeliverEnum.getStat(), cmpp2DeliverEnum.getDescription());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过result结果拿到对应的错误信息
|
||||||
|
*
|
||||||
|
* @param stat CMPP2DeliverEnum.stat
|
||||||
|
* @return CMPP2DeliverEnums.description
|
||||||
|
*/
|
||||||
|
public static String getResultMessage(String stat) {
|
||||||
|
return stats.get(stat);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.mashibing.common.utils;
|
||||||
|
|
||||||
|
import com.mashibing.common.enums.CMPP2ResultEnums;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: CMPP2ResultUtil
|
||||||
|
* @Description: CMPP2.0协议-短信提交后的应答枚举工具类
|
||||||
|
* @date 2025/6/17 17:39
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CMPP2ResultUtil {
|
||||||
|
|
||||||
|
private static Map<Integer, String> results = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
CMPP2ResultEnums[] cmpp2ResultEnums = CMPP2ResultEnums.values();
|
||||||
|
for (CMPP2ResultEnums cmpp2ResultEnum : cmpp2ResultEnums) {
|
||||||
|
results.put(cmpp2ResultEnum.getResult(), cmpp2ResultEnum.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过result结果拿到对应的错误信息
|
||||||
|
*
|
||||||
|
* @param result CMPP2ResultEnum.result
|
||||||
|
* @return CMPP2ResultEnum.msg
|
||||||
|
*/
|
||||||
|
public static String getResultMessage(Integer result) {
|
||||||
|
return results.get(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.mashibing.common.utils;
|
||||||
|
|
||||||
|
import com.mashibing.common.pojo.StandardReport;
|
||||||
|
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: CMPPDeliverMapUtil
|
||||||
|
* @Description: 临时存储StandardReport对象
|
||||||
|
* @date 2025/6/17 18:01
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CMPPDeliverMapUtil {
|
||||||
|
|
||||||
|
private static ConcurrentHashMap<String, StandardReport> tempReport = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public static void put(String msgId, StandardReport submit) {
|
||||||
|
tempReport.put(msgId, submit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StandardReport get(String msgId) {
|
||||||
|
return tempReport.get(msgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StandardReport remove(String msgId) {
|
||||||
|
return tempReport.remove(msgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue