|
|
|
@ -4,7 +4,6 @@ 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 org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
|
@ -16,13 +15,13 @@ import java.util.Date;
|
|
|
|
|
public class RetailAppMessage {
|
|
|
|
|
private String title;
|
|
|
|
|
private String body;
|
|
|
|
|
private PartnerRole role = PartnerRole.ADMIN;
|
|
|
|
|
private JSONObject data;
|
|
|
|
|
|
|
|
|
|
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("role", "admin");
|
|
|
|
|
msg.put("title", title);
|
|
|
|
|
msg.put("body", body);
|
|
|
|
|
msg.put("send_time", new Date());
|
|
|
|
@ -38,7 +37,7 @@ public class RetailAppMessage {
|
|
|
|
|
managerMsg.put("title", title);
|
|
|
|
|
managerMsg.put("body", body);
|
|
|
|
|
managerMsg.put("type", sendType);
|
|
|
|
|
managerMsg.put("data", new JSONObject());
|
|
|
|
|
managerMsg.put("data", data == null ? new JSONObject() : data);
|
|
|
|
|
managerMsg.put("msgType", AppMessageType.MESSAGE.name());
|
|
|
|
|
return new AppManagerMessageBuilder(managerMsg).buildMessage();
|
|
|
|
|
}
|
|
|
|
@ -61,16 +60,12 @@ public class RetailAppMessage {
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PartnerRole getRole() {
|
|
|
|
|
return role;
|
|
|
|
|
public JSONObject getData() {
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public RetailAppMessage setRole(PartnerRole role) {
|
|
|
|
|
this.role = role;
|
|
|
|
|
public RetailAppMessage setData(JSONObject data) {
|
|
|
|
|
this.data = data;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean acceptRole(int roleNumber) {
|
|
|
|
|
return role.getCode() <= roleNumber;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|