parent
f9feb9dbca
commit
56f15a2244
@ -0,0 +1,75 @@
|
||||
package au.com.royalpay.payment.manage.appclient.beans;
|
||||
|
||||
import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder;
|
||||
import au.com.royalpay.payment.manage.pushMessage.bean.AppMessageType;
|
||||
import au.com.royalpay.payment.tools.device.message.AppMessage;
|
||||
import au.com.royalpay.payment.tools.env.RequestEnvironment;
|
||||
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Create by davep at 2019-10-23 17:17
|
||||
*/
|
||||
public class RetailAppMessage {
|
||||
private String title;
|
||||
private String body;
|
||||
private PartnerRole role = PartnerRole.ADMIN;
|
||||
|
||||
public JSONObject forSave(String appid, int clientId) {
|
||||
JSONObject msg = new JSONObject();
|
||||
msg.put("appid", appid);
|
||||
msg.put("client_id", clientId);
|
||||
msg.put("role", role.getCode());
|
||||
msg.put("title", title);
|
||||
msg.put("body", body);
|
||||
msg.put("send_time", new Date());
|
||||
msg.put("from_ip", RequestEnvironment.getClientIp());
|
||||
return msg;
|
||||
}
|
||||
|
||||
public AppMessage initAppMessage(String msgId) {
|
||||
JSONObject sendType = new JSONObject();
|
||||
sendType.put("send_type", AppMessageType.MESSAGE.name());
|
||||
sendType.put("id", msgId);
|
||||
JSONObject managerMsg = new JSONObject();
|
||||
managerMsg.put("title", title);
|
||||
managerMsg.put("body", body);
|
||||
managerMsg.put("type", sendType);
|
||||
managerMsg.put("data", new JSONObject());
|
||||
managerMsg.put("msgType", AppMessageType.MESSAGE.name());
|
||||
return new AppManagerMessageBuilder(managerMsg).buildMessage();
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public RetailAppMessage setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public RetailAppMessage setBody(String body) {
|
||||
this.body = body;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PartnerRole getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public RetailAppMessage setRole(PartnerRole role) {
|
||||
this.role = role;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean acceptRole(int roleNumber) {
|
||||
return role.getCode() <= roleNumber;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@
|
||||
package au.com.royalpay.payment.manage.mappers.client;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* Create by davep at 2019-10-23 17:28
|
||||
*/
|
||||
@AutoMapper(tablename = "log_client_app_messages",pkName = "message_id")
|
||||
public interface AuthAppMessageMapper {
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject msg);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package au.com.royalpay.payment.manage.pushMessage.bean;
|
||||
|
||||
/**
|
||||
* Create by davep at 2019-10-23 17:11
|
||||
*/
|
||||
public enum AppMessageType {
|
||||
PAYMENT,
|
||||
REFUND,
|
||||
NOTICE,
|
||||
RISK,
|
||||
CLEAN,
|
||||
CASHBACK,
|
||||
DAILY_NOTICE,
|
||||
ANNUAL_BILL,
|
||||
MESSAGE
|
||||
}
|
Loading…
Reference in new issue