|
|
@ -19,6 +19,7 @@ import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
|
|
|
|
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.NoticeManage;
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.NoticeManage;
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.NoticePartner;
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.NoticePartner;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.pushMessage.APNSMessageHelper;
|
|
|
|
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
|
|
|
|
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.impls.SignInAccountServiceImpl;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.impls.SignInAccountServiceImpl;
|
|
|
@ -77,73 +78,51 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
private TransactionAnalysisMapper transactionAnalysisMapper;
|
|
|
|
private TransactionAnalysisMapper transactionAnalysisMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private TransactionMapper transactionMapper;
|
|
|
|
private TransactionMapper transactionMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ClientManager clientManager;
|
|
|
|
private ClientManager clientManager;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private NoticeManage noticeManage;
|
|
|
|
private NoticeManage noticeManage;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private NoticePartner noticePartner;
|
|
|
|
private NoticePartner noticePartner;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper;
|
|
|
|
private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ClearingDetailMapper clearingDetailMapper;
|
|
|
|
private ClearingDetailMapper clearingDetailMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private OrderMapper orderMapper;
|
|
|
|
private OrderMapper orderMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ClientAccountMapper clientAccountMapper;
|
|
|
|
private ClientAccountMapper clientAccountMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private AppMessageLogMapper appMessageLogMapper;
|
|
|
|
private AppMessageLogMapper appMessageLogMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private SignInAccountService signInAccountService;
|
|
|
|
private SignInAccountService signInAccountService;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CashbackService cashbackService;
|
|
|
|
private CashbackService cashbackService;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ClearingDetailAnalysisMapper clearingDetailAnalysisMapper;
|
|
|
|
private ClearingDetailAnalysisMapper clearingDetailAnalysisMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ClientSettleDelayConfMapper clientSettleDelayConfMapper;
|
|
|
|
private ClientSettleDelayConfMapper clientSettleDelayConfMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private XPlanFundConfigServiceImpl xPlanFundConfigService;
|
|
|
|
private XPlanFundConfigServiceImpl xPlanFundConfigService;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private MerchantInfoProvider merchantInfoProvider;
|
|
|
|
private MerchantInfoProvider merchantInfoProvider;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private RoyalPayCMSSupport royalPayCMSSupport;
|
|
|
|
private RoyalPayCMSSupport royalPayCMSSupport;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private PaymentApi paymentApi;
|
|
|
|
private PaymentApi paymentApi;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private DeviceSupport deviceSupport;
|
|
|
|
private DeviceSupport deviceSupport;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CustomerRelationAlipayMapper customerRelationAlipayMapper;
|
|
|
|
private CustomerRelationAlipayMapper customerRelationAlipayMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CustomerMapper customerMapper;
|
|
|
|
private CustomerMapper customerMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Value("classpath:apple_message_cert_dev.p12")
|
|
|
|
private APNSMessageHelper apnsMessageHelper;
|
|
|
|
private org.springframework.core.io.Resource appleMessageFileDev;
|
|
|
|
|
|
|
|
@Value("classpath:apple_message_cert_product.p12")
|
|
|
|
|
|
|
|
private org.springframework.core.io.Resource appleMessageFileProduct;
|
|
|
|
|
|
|
|
@Value("${apple.message.apns.password}")
|
|
|
|
|
|
|
|
private String appleMessagePassword;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ClientDeviceTokenMapper clientDeviceTokenMapper;
|
|
|
|
private ClientDeviceTokenMapper clientDeviceTokenMapper;
|
|
|
|
|
|
|
|
|
|
|
|
private ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
|
|
|
|
private ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CouponValidateService couponVerificationService;
|
|
|
|
private CouponValidateService couponVerificationService;
|
|
|
|
|
|
|
|
|
|
|
@ -266,7 +245,6 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public JSONObject getClientSettlementLog(JSONObject device, AppQueryBean appQueryBean) {
|
|
|
|
public JSONObject getClientSettlementLog(JSONObject device, AppQueryBean appQueryBean) {
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
@ -280,7 +258,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
JSONObject params = appQueryBean.toParams();
|
|
|
|
JSONObject params = appQueryBean.toParams();
|
|
|
|
setAllClientIds(params, client_id);
|
|
|
|
setAllClientIds(params, client_id);
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
PageList<JSONObject> logs = clearingDetailMapper.listClientSettlementLog(params, new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("report_date.desc")));
|
|
|
|
PageList<JSONObject> logs = clearingDetailMapper.listClientSettlementLog(params,
|
|
|
|
|
|
|
|
new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("report_date.desc")));
|
|
|
|
return PageListUtils.buildPageListResult(logs);
|
|
|
|
return PageListUtils.buildPageListResult(logs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -354,11 +333,13 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
params.put("dev_id", device.getString("dev_id"));
|
|
|
|
params.put("dev_id", device.getString("dev_id"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
PageList<JSONObject> orders = orderMapper.listOrdersByClients(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
|
|
|
|
PageList<JSONObject> orders = orderMapper.listOrdersByClients(params,
|
|
|
|
|
|
|
|
new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
|
|
|
|
TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time");
|
|
|
|
TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time");
|
|
|
|
ArrayList<String> date_contains = new ArrayList<>();
|
|
|
|
ArrayList<String> date_contains = new ArrayList<>();
|
|
|
|
for (JSONObject order : orders) {
|
|
|
|
for (JSONObject order : orders) {
|
|
|
|
// Date tradeDate = order.getDate("confirm_time") == null ? (order.getDate("transaction_time") == null ? order.getDate("create_time") : order.getDate("transaction_time")) : order.getDate("confirm_time");
|
|
|
|
// Date tradeDate = order.getDate("confirm_time") == null ? (order.getDate("transaction_time") == null ?
|
|
|
|
|
|
|
|
// order.getDate("create_time") : order.getDate("transaction_time")) : order.getDate("confirm_time");
|
|
|
|
Calendar calendar = (Calendar) order.get("create_time");
|
|
|
|
Calendar calendar = (Calendar) order.get("create_time");
|
|
|
|
String trade_date = DateFormatUtils.format(calendar, "yyyy-MM-dd");
|
|
|
|
String trade_date = DateFormatUtils.format(calendar, "yyyy-MM-dd");
|
|
|
|
String trade_time = DateFormatUtils.format(calendar, "HH:mm:ss");
|
|
|
|
String trade_time = DateFormatUtils.format(calendar, "HH:mm:ss");
|
|
|
@ -455,31 +436,6 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void sendAppMessage() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// String p12Path = "D:/MbaikeDevCertificates.p12";
|
|
|
|
|
|
|
|
// InputStream keyIns = appleMessageFile.getInputStream();
|
|
|
|
|
|
|
|
// String password = "F1b5*ChJPp73";
|
|
|
|
|
|
|
|
String pushToken = "719e4b7a7ed8b9000188440228437714d9dc67785f1791fae01234dae6a1570c";
|
|
|
|
|
|
|
|
JSONObject order = new JSONObject();
|
|
|
|
|
|
|
|
order.put("clearing_amount", 0.01);
|
|
|
|
|
|
|
|
order.put("client_id", 9);
|
|
|
|
|
|
|
|
order.put("client_moniker", "PINE");
|
|
|
|
|
|
|
|
order.put("order_id", "9201704110348156694986");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
/**设置参数,发送数据**/
|
|
|
|
|
|
|
|
InputStream keyIns = appleMessageFileProduct.getInputStream();
|
|
|
|
|
|
|
|
ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
|
|
|
|
|
|
|
|
String payload = APNS.newPayload().alertTitle("到账通知").alertBody("Hello,0.01AUD").badge(1).sound("default").customField("data", order).build();
|
|
|
|
|
|
|
|
service.push(pushToken, payload);
|
|
|
|
|
|
|
|
System.out.println("推送信息已发送!");
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void sendOrderAppMessage(final JSONObject order, int client_id) {
|
|
|
|
public void sendOrderAppMessage(final JSONObject order, int client_id) {
|
|
|
|
logger.debug("sendOrderAppMessage-" + client_id + "-" + order.getString("order_id"));
|
|
|
|
logger.debug("sendOrderAppMessage-" + client_id + "-" + order.getString("order_id"));
|
|
|
@ -492,20 +448,22 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
System.out.println("Device Token:" + token);
|
|
|
|
System.out.println("Device Token:" + token);
|
|
|
|
// todo 抽象发送信息接口,根据设备类型选择不同实现类
|
|
|
|
// todo 抽象发送信息接口,根据设备类型选择不同实现类
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "payment", token, order.getString("order_id"));
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "payment", token,
|
|
|
|
|
|
|
|
order.getString("order_id"));
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
order.put("send_type", "payment");
|
|
|
|
order.put("send_type", "payment");
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
type.put("send_type", "payment");
|
|
|
|
type.put("send_type", "payment");
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.payment"),
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.payment"),
|
|
|
|
LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"), token, order, type);
|
|
|
|
LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"), token,
|
|
|
|
|
|
|
|
order, type);
|
|
|
|
log.put("status", 2);
|
|
|
|
log.put("status", 2);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
throw new ServerErrorException("Send App Message Failed", e);
|
|
|
|
throw new ServerErrorException("Send App JpushMessage Failed", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
sendingAppleMsgPool.execute(task);
|
|
|
|
sendingAppleMsgPool.execute(task);
|
|
|
@ -536,14 +494,15 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
System.out.println("Device Token:" + token);
|
|
|
|
System.out.println("Device Token:" + token);
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "refund", token, order.getString("order_id"));
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "refund", token,
|
|
|
|
|
|
|
|
order.getString("order_id"));
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
order.put("send_type", "refund");
|
|
|
|
order.put("send_type", "refund");
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
type.put("send_type", "refund");
|
|
|
|
type.put("send_type", "refund");
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
sendAppleMessage("Refund Message",
|
|
|
|
apnsMessageHelper.sendAppleMessage("Refund JpushMessage", LocaleSupport.localeMessage("app.message.body.refund") + refundAmount, token,
|
|
|
|
LocaleSupport.localeMessage("app.message.body.refund") + refundAmount, token, order, type);
|
|
|
|
order, type);
|
|
|
|
log.put("status", 2);
|
|
|
|
log.put("status", 2);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
@ -567,7 +526,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
if (token == null) {
|
|
|
|
if (token == null) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "notice", token, "notice_id:" + notice.getNotice_id());
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "notice", token,
|
|
|
|
|
|
|
|
"notice_id:" + notice.getNotice_id());
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
notice.setContent(null);
|
|
|
|
notice.setContent(null);
|
|
|
|
JSONObject noticeObj = notice.toJson();
|
|
|
|
JSONObject noticeObj = notice.toJson();
|
|
|
@ -575,7 +535,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
type.put("send_type", "notice");
|
|
|
|
type.put("send_type", "notice");
|
|
|
|
type.put("id", notice.getNotice_id());
|
|
|
|
type.put("id", notice.getNotice_id());
|
|
|
|
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"), notice.getTitle(), token, noticeObj, type);
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"), notice.getTitle(), token, noticeObj,
|
|
|
|
|
|
|
|
type);
|
|
|
|
log.put("status", 2);
|
|
|
|
log.put("status", 2);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
@ -600,19 +561,22 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
if (token == null) {
|
|
|
|
if (token == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "cashback", token, order.getString("order_id") + "返现" + cashbackAmount);
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "cashback", token,
|
|
|
|
|
|
|
|
order.getString("order_id") + "返现" + cashbackAmount);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
type.put("send_type", "cashback");
|
|
|
|
type.put("send_type", "cashback");
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"),
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"),
|
|
|
|
LocaleSupport.localeMessage("app.message.body.cashback") + PlatformEnvironment.getEnv().getForeignCurrency() + " " + cashbackAmount, token, order, type);
|
|
|
|
LocaleSupport.localeMessage("app.message.body.cashback") + PlatformEnvironment.getEnv().getForeignCurrency() + " "
|
|
|
|
|
|
|
|
+ cashbackAmount,
|
|
|
|
|
|
|
|
token, order, type);
|
|
|
|
log.put("status", 2);
|
|
|
|
log.put("status", 2);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
throw new ServerErrorException("Send App Message Failed", e);
|
|
|
|
throw new ServerErrorException("Send App JpushMessage Failed", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -625,7 +589,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
String clearing_amount = log_clearing_detail.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString();
|
|
|
|
String clearing_amount = log_clearing_detail.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString();
|
|
|
|
String settle_date_from = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_from"), "MM/dd/yyyy");
|
|
|
|
String settle_date_from = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_from"), "MM/dd/yyyy");
|
|
|
|
String settle_date_to = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_to"), "MM/dd/yyyy");
|
|
|
|
String settle_date_to = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_to"), "MM/dd/yyyy");
|
|
|
|
logger.debug("sendCleanMessage-" + log_clearing_detail.getString("client_moniker") + "- " + PlatformEnvironment.getEnv().getForeignCurrency() + " " + clearing_amount + "(" + settle_date_from + "-" + settle_date_to + ")");
|
|
|
|
logger.debug("sendCleanMessage-" + log_clearing_detail.getString("client_moniker") + "- " + PlatformEnvironment.getEnv().getForeignCurrency() + " "
|
|
|
|
|
|
|
|
+ clearing_amount + "(" + settle_date_from + "-" + settle_date_to + ")");
|
|
|
|
List<JSONObject> tokens = clientDeviceTokenMapper.listTokensByClient_id(client_id);
|
|
|
|
List<JSONObject> tokens = clientDeviceTokenMapper.listTokensByClient_id(client_id);
|
|
|
|
for (JSONObject devToken : tokens) {
|
|
|
|
for (JSONObject devToken : tokens) {
|
|
|
|
String token = devToken.getString("token");
|
|
|
|
String token = devToken.getString("token");
|
|
|
@ -633,24 +598,25 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String log_clearing_detail_id = log_clearing_detail.getString("clear_detail_id");
|
|
|
|
String log_clearing_detail_id = log_clearing_detail.getString("clear_detail_id");
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "clean", token, "本次清算" + log_clearing_detail_id + ",$" + clearing_amount + "(" + settle_date_from + "-" + settle_date_to + ")");
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "clean", token,
|
|
|
|
|
|
|
|
"本次清算" + log_clearing_detail_id + ",$" + clearing_amount + "(" + settle_date_from + "-" + settle_date_to + ")");
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
type.put("send_type", "clean");
|
|
|
|
type.put("send_type", "clean");
|
|
|
|
type.put("id", log_clearing_detail_id);
|
|
|
|
type.put("id", log_clearing_detail_id);
|
|
|
|
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.clean"),
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.clean"), LocaleSupport.localeMessage("app.message.body.clean")
|
|
|
|
LocaleSupport.localeMessage("app.message.body.clean") + PlatformEnvironment.getEnv().getForeignCurrency() + " " + clearing_amount + " (" + settle_date_from + "-" + settle_date_to + ")", token, log_clearing_detail, type);
|
|
|
|
+ PlatformEnvironment.getEnv().getForeignCurrency() + " " + clearing_amount + " (" + settle_date_from + "-" + settle_date_to + ")",
|
|
|
|
|
|
|
|
token, log_clearing_detail, type);
|
|
|
|
log.put("status", 2);
|
|
|
|
log.put("status", 2);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
throw new ServerErrorException("Send App Message Failed", e);
|
|
|
|
throw new ServerErrorException("Send App JpushMessage Failed", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void sendTransactionDailyMessage(JSONObject tradeInfo, int client_id) {
|
|
|
|
public void sendTransactionDailyMessage(JSONObject tradeInfo, int client_id) {
|
|
|
|
String trade_date = tradeInfo.getString("trade_date");
|
|
|
|
String trade_date = tradeInfo.getString("trade_date");
|
|
|
@ -663,50 +629,26 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
if (token == null) {
|
|
|
|
if (token == null) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "daily_notice", token, "Trade Date:" + trade_date);
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "daily_notice", token,
|
|
|
|
|
|
|
|
"Trade Date:" + trade_date);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
type.put("send_type", "daily_notice");
|
|
|
|
type.put("send_type", "daily_notice");
|
|
|
|
type.put("id", trade_date);
|
|
|
|
type.put("id", trade_date);
|
|
|
|
sendAppleMessageDetail(LocaleSupport.localeMessage("app.message.title.daily_notice"),
|
|
|
|
apnsMessageHelper.sendAppleMessageDetail(
|
|
|
|
trade_date + ": 总交易额 " + PlatformEnvironment.getEnv().getForeignCurrency() + total_amount + ", 订单数:" + total_orders + ", 付款人数:" + customers, token, tradeInfo, type);
|
|
|
|
LocaleSupport.localeMessage("app.message.title.daily_notice"), trade_date + ": 总交易额 "
|
|
|
|
|
|
|
|
+ PlatformEnvironment.getEnv().getForeignCurrency() + total_amount + ", 订单数:" + total_orders + ", 付款人数:" + customers,
|
|
|
|
|
|
|
|
token, tradeInfo, type);
|
|
|
|
log.put("status", 2);
|
|
|
|
log.put("status", 2);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
throw new ServerErrorException("Send App Message Failed", e);
|
|
|
|
throw new ServerErrorException("Send App JpushMessage Failed", e);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void sendAppleMessage(String title, String body, String token, JSONObject data, JSONObject type) throws IOException {
|
|
|
|
|
|
|
|
/**设置参数,发送数据**/
|
|
|
|
|
|
|
|
InputStream keyIns = appleMessageFileProduct.getInputStream();
|
|
|
|
|
|
|
|
ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
|
|
|
|
|
|
|
|
String payload = APNS.newPayload().alertTitle(title).alertBody(body).badge(1).sound("default").customField("data", data).customField("type", type).build();
|
|
|
|
|
|
|
|
service.push(token, payload);
|
|
|
|
|
|
|
|
System.out.println("推送信息已发送!");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 可显示详情
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param title
|
|
|
|
|
|
|
|
* @param body
|
|
|
|
|
|
|
|
* @param token
|
|
|
|
|
|
|
|
* @param data
|
|
|
|
|
|
|
|
* @param type
|
|
|
|
|
|
|
|
* @throws IOException
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void sendAppleMessageDetail(String title, String body, String token, JSONObject data, JSONObject type) throws IOException {
|
|
|
|
|
|
|
|
/**设置参数,发送数据**/
|
|
|
|
|
|
|
|
InputStream keyIns = appleMessageFileProduct.getInputStream();
|
|
|
|
|
|
|
|
ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
|
|
|
|
|
|
|
|
String payload = APNS.newPayload().alertTitle(title).alertBody(body).category("myNotificationCategory").badge(1).sound("default").customField("data", data).customField("type", type).build();
|
|
|
|
|
|
|
|
service.push(token, payload);
|
|
|
|
|
|
|
|
System.out.println("推送信息已发送!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateReadStatus(JSONObject device, String noticeId) {
|
|
|
|
public void updateReadStatus(JSONObject device, String noticeId) {
|
|
|
@ -943,7 +885,6 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
return clientManager.listSubClients(device.getIntValue("client_id"));
|
|
|
|
return clientManager.listSubClients(device.getIntValue("client_id"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
@ -1086,7 +1027,6 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
return res;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void sendMassageByCode(final JSONObject params) {
|
|
|
|
public void sendMassageByCode(final JSONObject params) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -1103,7 +1043,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
sendingAppleMsgPool.execute(new Runnable() {
|
|
|
|
sendingAppleMsgPool.execute(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "dev", token, "Param:partner_code,自定义推送消息");
|
|
|
|
JSONObject log = saveAppMessageLog(devToken.getString("dev_id"), devToken.getIntValue("client_id"), "dev", token,
|
|
|
|
|
|
|
|
"Param:partner_code,自定义推送消息");
|
|
|
|
sending(token, params, log);
|
|
|
|
sending(token, params, log);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -1129,7 +1070,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
throw new ServerErrorException(s.getMessage());
|
|
|
|
throw new ServerErrorException(s.getMessage());
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
throw new ServerErrorException("Send App Message Failed", e);
|
|
|
|
throw new ServerErrorException("Send App JpushMessage Failed", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1137,17 +1078,16 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
public void sending(String devToken, JSONObject params, JSONObject log) {
|
|
|
|
public void sending(String devToken, JSONObject params, JSONObject log) {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
sendAppleMessage(params.getString("title"), params.getString("content"), devToken, new JSONObject(), new JSONObject());
|
|
|
|
apnsMessageHelper.sendAppleMessage(params.getString("title"), params.getString("content"), devToken, new JSONObject(), new JSONObject());
|
|
|
|
log.put("status", 2);
|
|
|
|
log.put("status", 2);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
|
|
|
|
throw new ServerErrorException("Send App Message Failed", e);
|
|
|
|
throw new ServerErrorException("Send App JpushMessage Failed", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public JSONObject getCoupons(JSONObject device, int page, int limit) {
|
|
|
|
public JSONObject getCoupons(JSONObject device, int page, int limit) {
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|