|
|
@ -137,7 +137,6 @@ public class AppActServiceImp implements AppActService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void sendAnnualBillMessage(JSONObject params) {
|
|
|
|
public void sendAnnualBillMessage(JSONObject params) {
|
|
|
|
|
|
|
|
|
|
|
|
logger.debug("sendAnnualMessage Begin");
|
|
|
|
logger.debug("sendAnnualMessage Begin");
|
|
|
|
List<JSONObject> tokens = clientDeviceTokenMapper.listAllTokens(params);
|
|
|
|
List<JSONObject> tokens = clientDeviceTokenMapper.listAllTokens(params);
|
|
|
|
for (JSONObject devToken : tokens) {
|
|
|
|
for (JSONObject devToken : tokens) {
|
|
|
@ -183,6 +182,48 @@ public class AppActServiceImp implements AppActService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void sendTESTAnnualBillMessage(JSONObject params) {
|
|
|
|
|
|
|
|
logger.debug("sendAnnualMessage Begin");
|
|
|
|
|
|
|
|
JSONObject devToken = clientDeviceTokenMapper.findByDevId("cf90a252-1121-4bfd-a201-fb573b44ac11");
|
|
|
|
|
|
|
|
Runnable task = () -> {
|
|
|
|
|
|
|
|
String token = devToken.getString("token");
|
|
|
|
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"),
|
|
|
|
|
|
|
|
devToken.getIntValue("client_id"),
|
|
|
|
|
|
|
|
"annual_bill" + devToken.getString("client_type"),
|
|
|
|
|
|
|
|
token,
|
|
|
|
|
|
|
|
"年度账单"
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
|
|
|
|
type.put("send_type", "annual_bill");
|
|
|
|
|
|
|
|
type.put("id", devToken.getString("dev_token_id"));
|
|
|
|
|
|
|
|
AppMsgSender sender = senderMap.get((devToken.getString("client_type")));
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(token) || sender == null) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject managerMsg = new JSONObject();
|
|
|
|
|
|
|
|
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.annual_bill"));
|
|
|
|
|
|
|
|
managerMsg.put("body", LocaleSupport.localeMessage("app.message.body.annual_bill"));
|
|
|
|
|
|
|
|
managerMsg.put("type", type);
|
|
|
|
|
|
|
|
JSONObject messageData = new JSONObject();
|
|
|
|
|
|
|
|
messageData.put("url", PlatformEnvironment.getEnv().concatUrl("/annual_bill.html"));
|
|
|
|
|
|
|
|
System.out.println(PlatformEnvironment.getEnv().concatUrl("/annual_bill.html"));
|
|
|
|
|
|
|
|
managerMsg.put("data", messageData);
|
|
|
|
|
|
|
|
managerMsg.put("msgType", "annual_bill");
|
|
|
|
|
|
|
|
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
|
|
|
|
|
|
|
|
sender.sendMessage(appMessage, devToken);
|
|
|
|
|
|
|
|
log.put("status", 2);
|
|
|
|
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
|
|
|
|
throw new ServerErrorException("Send App" + devToken.getString("client_type") + "Filed" + ",token" + token, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
sendingAppleMsgPool.execute(task);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private JSONObject saveAppMessageLog(String dev_id, int client_id, String messageType, String dev_token, String remark) {
|
|
|
|
private JSONObject saveAppMessageLog(String dev_id, int client_id, String messageType, String dev_token, String remark) {
|
|
|
|
JSONObject log = new JSONObject();
|
|
|
|
JSONObject log = new JSONObject();
|
|
|
|
log.put("dev_id", dev_id);
|
|
|
|
log.put("dev_id", dev_id);
|
|
|
|