|
|
|
@ -1,5 +1,42 @@
|
|
|
|
|
package au.com.royalpay.payment.manage.appclient.core.impls;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.TimeZone;
|
|
|
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
import org.jsoup.Jsoup;
|
|
|
|
|
import org.jsoup.nodes.Document;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.core.PaymentApi;
|
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
|
|
|
|
@ -14,17 +51,27 @@ import au.com.royalpay.payment.manage.mappers.log.ClearingDetailAnalysisMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.*;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceTokenMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientSettleDelayConfMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.CustomerRelationAlipayMapper;
|
|
|
|
|
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.core.NoticeManage;
|
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.NoticePartner;
|
|
|
|
|
import au.com.royalpay.payment.manage.pushMessage.APNSMessageHelper;
|
|
|
|
|
import au.com.royalpay.payment.manage.pushMessage.JpushMessageHelper;
|
|
|
|
|
import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder;
|
|
|
|
|
import au.com.royalpay.payment.manage.pushMessage.bean.JpushMessage;
|
|
|
|
|
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.impls.SignInAccountServiceImpl;
|
|
|
|
|
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
|
|
|
|
|
import au.com.royalpay.payment.tools.cms.RoyalPayCMSSupport;
|
|
|
|
|
import au.com.royalpay.payment.tools.device.DeviceSupport;
|
|
|
|
|
import au.com.royalpay.payment.tools.device.message.AppMessage;
|
|
|
|
|
import au.com.royalpay.payment.tools.device.message.AppMsgSender;
|
|
|
|
|
import au.com.royalpay.payment.tools.device.support.DeviceRegister;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
@ -35,37 +82,6 @@ import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
|
|
|
|
import com.notnoop.apns.APNS;
|
|
|
|
|
import com.notnoop.apns.ApnsService;
|
|
|
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
import org.jsoup.Jsoup;
|
|
|
|
|
import org.jsoup.nodes.Document;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by yishuqian on 28/03/2017.
|
|
|
|
@ -77,77 +93,64 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
private TransactionAnalysisMapper transactionAnalysisMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private TransactionMapper transactionMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientManager clientManager;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private NoticeManage noticeManage;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private NoticePartner noticePartner;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ClearingDetailMapper clearingDetailMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private OrderMapper orderMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientAccountMapper clientAccountMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AppMessageLogMapper appMessageLogMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private SignInAccountService signInAccountService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CashbackService cashbackService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ClearingDetailAnalysisMapper clearingDetailAnalysisMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientSettleDelayConfMapper clientSettleDelayConfMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private XPlanFundConfigServiceImpl xPlanFundConfigService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private MerchantInfoProvider merchantInfoProvider;
|
|
|
|
|
@Resource
|
|
|
|
|
private RoyalPayCMSSupport royalPayCMSSupport;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private PaymentApi paymentApi;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceSupport deviceSupport;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CustomerRelationAlipayMapper customerRelationAlipayMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private CustomerMapper customerMapper;
|
|
|
|
|
|
|
|
|
|
@Value("classpath:apple_message_cert_dev.p12")
|
|
|
|
|
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
|
|
|
|
|
private APNSMessageHelper apnsMessageHelper;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientDeviceTokenMapper clientDeviceTokenMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private JpushMessageHelper jpushMessageHelper;
|
|
|
|
|
|
|
|
|
|
private ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
|
|
|
|
|
private Map<String, AppMsgSender> senderMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
public void setAppMsgSenders(AppMsgSender[] senders) {
|
|
|
|
|
Arrays.stream(senders).forEach(appMsgSender -> senderMap.put(appMsgSender.devType(), appMsgSender));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CouponValidateService couponVerificationService;
|
|
|
|
|
|
|
|
|
|
//若app未传client_ids,检测是否包含子商户,若包含查询全部
|
|
|
|
|
// 若app未传client_ids,检测是否包含子商户,若包含查询全部
|
|
|
|
|
private void setAllClientIds(JSONObject params, int clientId) {
|
|
|
|
|
if (params.containsKey("client_ids")) {
|
|
|
|
|
return;
|
|
|
|
@ -175,10 +178,10 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
|
res.put("trade_amount", transactionAnalysisMapper.analysisTotalAmount(params));
|
|
|
|
|
res.put("trade_count", transactionAnalysisMapper.analysisTotalCount(params));
|
|
|
|
|
// res.put("refund_amount", transactionAnalysisMapper.analysisRefundAmount(params));
|
|
|
|
|
// res.put("refund_amount", transactionAnalysisMapper.analysisRefundAmount(params));
|
|
|
|
|
res.put("not_settled", transactionAnalysisMapper.analysisNotSettled(params));
|
|
|
|
|
res.put("old_customers", transactionAnalysisMapper.countOldCustomers(params));
|
|
|
|
|
//微信小程序不查询汇率
|
|
|
|
|
// 微信小程序不查询汇率
|
|
|
|
|
if (!StringUtils.equals(device.getString("client_type"), "wxapp")) {
|
|
|
|
|
res.put("rate", paymentApi.channelApi("Wechat").queryExchangeRateDecimal(client_id));
|
|
|
|
|
}
|
|
|
|
@ -266,7 +269,6 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getClientSettlementLog(JSONObject device, AppQueryBean appQueryBean) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
@ -280,7 +282,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
JSONObject params = appQueryBean.toParams();
|
|
|
|
|
setAllClientIds(params, 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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -354,11 +357,13 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
params.put("dev_id", device.getString("dev_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");
|
|
|
|
|
ArrayList<String> date_contains = new ArrayList<>();
|
|
|
|
|
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");
|
|
|
|
|
String trade_date = DateFormatUtils.format(calendar, "yyyy-MM-dd");
|
|
|
|
|
String trade_time = DateFormatUtils.format(calendar, "HH:mm:ss");
|
|
|
|
@ -369,7 +374,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
TradeLogQuery date_query = new TradeLogQuery();
|
|
|
|
|
date_query.setDatefrom(re_date);
|
|
|
|
|
date_query.setDateto(re_date);
|
|
|
|
|
// date_query.setStatus(OrderStatus.ALL);
|
|
|
|
|
// date_query.setStatus(OrderStatus.ALL);
|
|
|
|
|
if (params.containsKey("client_ids")) {
|
|
|
|
|
date_query.setClient_ids((String[]) params.get("client_ids"));
|
|
|
|
|
}
|
|
|
|
@ -388,7 +393,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
query.setGateway_app("11");
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
|
DeviceRegister register = deviceSupport.findRegister(clientType);
|
|
|
|
|
Assert.notNull(register,"Device is not registered");
|
|
|
|
|
Assert.notNull(register, "Device is not registered");
|
|
|
|
|
int client_id = device.getIntValue("client_id");
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(client_id);
|
|
|
|
|
String timezone = client.getString("timezone");
|
|
|
|
@ -455,31 +460,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
|
|
|
|
|
public void sendOrderAppMessage(final JSONObject order, int client_id) {
|
|
|
|
|
logger.debug("sendOrderAppMessage-" + client_id + "-" + order.getString("order_id"));
|
|
|
|
@ -491,21 +471,32 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
System.out.println("Device Token:" + token);
|
|
|
|
|
//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 {
|
|
|
|
|
order.put("send_type", "payment");
|
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
|
type.put("send_type", "payment");
|
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
|
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.payment"),
|
|
|
|
|
LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"), token, order, type);
|
|
|
|
|
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
|
|
|
|
|
if (token == null || sender == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
JSONObject managerMsg = new JSONObject();
|
|
|
|
|
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.payment"));
|
|
|
|
|
managerMsg.put("body",
|
|
|
|
|
LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"));
|
|
|
|
|
managerMsg.put("type", type);
|
|
|
|
|
managerMsg.put("data", order);
|
|
|
|
|
managerMsg.put("msgType", "payment");
|
|
|
|
|
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 Message Failed", e);
|
|
|
|
|
throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
sendingAppleMsgPool.execute(task);
|
|
|
|
@ -536,14 +527,26 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
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 {
|
|
|
|
|
order.put("send_type", "refund");
|
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
|
type.put("send_type", "refund");
|
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
|
sendAppleMessage("Refund Message",
|
|
|
|
|
LocaleSupport.localeMessage("app.message.body.refund") + refundAmount, token, order, type);
|
|
|
|
|
|
|
|
|
|
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
|
|
|
|
|
if (token == null || sender == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
JSONObject managerMsg = new JSONObject();
|
|
|
|
|
managerMsg.put("title", "Refund "+devToken.getString("client_type")+"");
|
|
|
|
|
managerMsg.put("body", LocaleSupport.localeMessage("app.message.body.refund") + refundAmount);
|
|
|
|
|
managerMsg.put("type", type);
|
|
|
|
|
managerMsg.put("data", order);
|
|
|
|
|
managerMsg.put("msgType", "refund");
|
|
|
|
|
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
|
|
|
|
|
sender.sendMessage(appMessage, devToken);
|
|
|
|
|
log.put("status", 2);
|
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -567,7 +570,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
if (token == null) {
|
|
|
|
|
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 {
|
|
|
|
|
notice.setContent(null);
|
|
|
|
|
JSONObject noticeObj = notice.toJson();
|
|
|
|
@ -575,7 +579,19 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
|
type.put("send_type", "notice");
|
|
|
|
|
type.put("id", notice.getNotice_id());
|
|
|
|
|
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"), notice.getTitle(), token, noticeObj, type);
|
|
|
|
|
|
|
|
|
|
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
|
|
|
|
|
if (token == null || sender == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
JSONObject managerMsg = new JSONObject();
|
|
|
|
|
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.notice"));
|
|
|
|
|
managerMsg.put("body", notice.getTitle());
|
|
|
|
|
managerMsg.put("type", type);
|
|
|
|
|
managerMsg.put("data", noticeObj);
|
|
|
|
|
managerMsg.put("msgType", "notice");
|
|
|
|
|
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
|
|
|
|
|
sender.sendMessage(appMessage, devToken);
|
|
|
|
|
log.put("status", 2);
|
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -600,19 +616,32 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
if (token == null) {
|
|
|
|
|
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 {
|
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
|
type.put("send_type", "cashback");
|
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
|
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"),
|
|
|
|
|
LocaleSupport.localeMessage("app.message.body.cashback") + PlatformEnvironment.getEnv().getForeignCurrency() + " " + cashbackAmount, token, order, type);
|
|
|
|
|
|
|
|
|
|
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
|
|
|
|
|
if (token == null || sender == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
JSONObject managerMsg = new JSONObject();
|
|
|
|
|
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.notice"));
|
|
|
|
|
managerMsg.put("body", LocaleSupport.localeMessage("app.message.body.cashback") + PlatformEnvironment.getEnv().getForeignCurrency()
|
|
|
|
|
+ " " + cashbackAmount);
|
|
|
|
|
managerMsg.put("type", type);
|
|
|
|
|
managerMsg.put("data", order);
|
|
|
|
|
managerMsg.put("msgType", "cashback");
|
|
|
|
|
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 Message Failed", e);
|
|
|
|
|
throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -625,7 +654,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
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_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);
|
|
|
|
|
for (JSONObject devToken : tokens) {
|
|
|
|
|
String token = devToken.getString("token");
|
|
|
|
@ -633,24 +663,36 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
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 {
|
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
|
type.put("send_type", "clean");
|
|
|
|
|
type.put("id", log_clearing_detail_id);
|
|
|
|
|
sendAppleMessage(LocaleSupport.localeMessage("app.message.title.clean"),
|
|
|
|
|
LocaleSupport.localeMessage("app.message.body.clean") + PlatformEnvironment.getEnv().getForeignCurrency() + " " + clearing_amount + " (" + settle_date_from + "-" + settle_date_to + ")", token, log_clearing_detail, type);
|
|
|
|
|
|
|
|
|
|
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
|
|
|
|
|
if (token == null || sender == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
JSONObject managerMsg = new JSONObject();
|
|
|
|
|
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.clean"));
|
|
|
|
|
managerMsg.put("body", LocaleSupport.localeMessage("app.message.body.clean") + PlatformEnvironment.getEnv().getForeignCurrency() + " "
|
|
|
|
|
+ clearing_amount + " (" + settle_date_from + "-" + settle_date_to + ")");
|
|
|
|
|
managerMsg.put("type", type);
|
|
|
|
|
managerMsg.put("data", log_clearing_detail);
|
|
|
|
|
managerMsg.put("msgType", "clean");
|
|
|
|
|
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 Message Failed", e);
|
|
|
|
|
throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void sendTransactionDailyMessage(JSONObject tradeInfo, int client_id) {
|
|
|
|
|
String trade_date = tradeInfo.getString("trade_date");
|
|
|
|
@ -663,51 +705,43 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
if (token == null) {
|
|
|
|
|
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 {
|
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
|
type.put("send_type", "daily_notice");
|
|
|
|
|
type.put("id", trade_date);
|
|
|
|
|
sendAppleMessageDetail(LocaleSupport.localeMessage("app.message.title.daily_notice"),
|
|
|
|
|
trade_date + ": 总交易额 " + PlatformEnvironment.getEnv().getForeignCurrency() + total_amount + ", 订单数:" + total_orders + ", 付款人数:" + customers, token, tradeInfo, type);
|
|
|
|
|
apnsMessageHelper.sendAppleMessageDetail(
|
|
|
|
|
LocaleSupport.localeMessage("app.message.title.daily_notice"), trade_date + ": 总交易额 "
|
|
|
|
|
+ PlatformEnvironment.getEnv().getForeignCurrency() + total_amount + ", 订单数:" + total_orders + ", 付款人数:" + customers,
|
|
|
|
|
token, tradeInfo, type);
|
|
|
|
|
AppMsgSender sender = senderMap.get(devToken.getString("client_type"));
|
|
|
|
|
if (token == null || sender == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
JSONObject managerMsg = new JSONObject();
|
|
|
|
|
managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.daily_notice"));
|
|
|
|
|
managerMsg.put("body", trade_date + ": 总交易额 "
|
|
|
|
|
+ PlatformEnvironment.getEnv().getForeignCurrency() + total_amount + ", 订单数:" + total_orders + ", 付款人数:" + customers);
|
|
|
|
|
managerMsg.put("type", type);
|
|
|
|
|
managerMsg.put("data", tradeInfo);
|
|
|
|
|
managerMsg.put("msgType", "daily_notice");
|
|
|
|
|
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 Message Failed", e);
|
|
|
|
|
throw new ServerErrorException("Send App "+devToken.getString("client_type")+" 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
|
|
|
|
|
public void updateReadStatus(JSONObject device, String noticeId) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
@ -747,7 +781,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
Document doc = Jsoup.parse(res.getString("content"));
|
|
|
|
|
String father = "<div style=\"padding:0 10px\"></div>";
|
|
|
|
|
String html = doc.body().children().wrap(father).html();
|
|
|
|
|
// logger.debug("wrapped html---->"+html);
|
|
|
|
|
// logger.debug("wrapped html---->"+html);
|
|
|
|
|
res.put("content", doc.html());
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
@ -756,7 +790,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
public void changeAccountPassword(JSONObject device, ChangePwdBean change, String account_id) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
|
deviceSupport.findRegister(clientType);
|
|
|
|
|
//JSONObject client = signInAccountService.getClient(account_id);
|
|
|
|
|
// JSONObject client = signInAccountService.getClient(account_id);
|
|
|
|
|
if (!account_id.equals(device.getString("account_id"))) {
|
|
|
|
|
throw new ForbiddenException("You have no permission");
|
|
|
|
|
}
|
|
|
|
@ -779,7 +813,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
JSONObject res = merchantInfoProvider.clientCurrentRate(clientId, now, "Wechat");
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(clientId);
|
|
|
|
|
Assert.notNull(client,"Client is null");
|
|
|
|
|
Assert.notNull(client, "Client is null");
|
|
|
|
|
|
|
|
|
|
JSONObject[] channels = new JSONObject[3];
|
|
|
|
|
|
|
|
|
@ -804,7 +838,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
JSONObject res = merchantInfoProvider.clientCurrentRate(clientId, now, "Wechat");
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(clientId);
|
|
|
|
|
Assert.notNull(client,"Client is null");
|
|
|
|
|
Assert.notNull(client, "Client is null");
|
|
|
|
|
|
|
|
|
|
ArrayList<JSONObject> channels = new ArrayList<>();
|
|
|
|
|
if (client.getBigDecimal("customer_surcharge_rate") != null) {
|
|
|
|
@ -889,7 +923,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
res.put("data", new_acts);
|
|
|
|
|
}
|
|
|
|
|
//手续费返还活动
|
|
|
|
|
// 手续费返还活动
|
|
|
|
|
List<JSONObject> acts = (List<JSONObject>) res.get("data");
|
|
|
|
|
for (JSONObject act : acts) {
|
|
|
|
|
if (StringUtils.isNotBlank(act.getString("page_keywords")) && act.getString("page_keywords").equalsIgnoreCase("native")) {
|
|
|
|
@ -923,7 +957,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
String newAppVersion = PlatformEnvironment.getEnv().getNewVersion();
|
|
|
|
|
Boolean isUpdate = PlatformEnvironment.getEnv().isAppUpdate();
|
|
|
|
|
String updateContent = PlatformEnvironment.getEnv().getAppUpdateContent();
|
|
|
|
|
int update_type = 0;//0:不更新 1:更新 2:强制更新
|
|
|
|
|
int update_type = 0;// 0:不更新 1:更新 2:强制更新
|
|
|
|
|
if (newAppVersion.compareToIgnoreCase(version) > 0) {
|
|
|
|
|
update_type = 1;
|
|
|
|
|
if (isUpdate) {
|
|
|
|
@ -943,7 +977,6 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return clientManager.listSubClients(device.getIntValue("client_id"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JSONObject saveAppMessageLog(String dev_id, int client_id, String messageType, String dev_token, String remark) {
|
|
|
|
|
JSONObject log = new JSONObject();
|
|
|
|
|
log.put("dev_id", dev_id);
|
|
|
|
@ -1078,7 +1111,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
if (clientRate.getIntValue("clean_days") == 1) {
|
|
|
|
|
JSONObject config = clientSettleDelayConfMapper.findClientConf(device.getIntValue("client_id"));
|
|
|
|
|
if (config == null) {
|
|
|
|
|
// res.put("show", true);
|
|
|
|
|
// res.put("show", true);
|
|
|
|
|
res.put("interest_rate", xPlanFundConfigService.configuration().getInterestRate().setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1086,7 +1119,6 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void sendMassageByCode(final JSONObject params) {
|
|
|
|
|
try {
|
|
|
|
@ -1095,7 +1127,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
if (params.getString("type").equals("Merchant")) {
|
|
|
|
|
for (String partner_code : codes) {
|
|
|
|
|
JSONObject client = clientManager.getClientInfoByMoniker(partner_code);
|
|
|
|
|
Assert.notNull(client,"Client is null");
|
|
|
|
|
Assert.notNull(client, "Client is null");
|
|
|
|
|
List<JSONObject> tokens = clientDeviceTokenMapper.listTokensByClient_id(client.getInteger("client_id"));
|
|
|
|
|
if (null != tokens && tokens.size() > 0) {
|
|
|
|
|
for (final JSONObject devToken : tokens) {
|
|
|
|
@ -1103,7 +1135,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
sendingAppleMsgPool.execute(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -1135,19 +1168,30 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void sending(String devToken, JSONObject params, JSONObject log) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
sendAppleMessage(params.getString("title"), params.getString("content"), devToken, new JSONObject(), new JSONObject());
|
|
|
|
|
JSONObject devTokenJson = new JSONObject();
|
|
|
|
|
devTokenJson.put("token", devToken);
|
|
|
|
|
AppMsgSender sender = senderMap.get(params.getString("client_type"));
|
|
|
|
|
if (devToken == null || sender == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
JSONObject managerMsg = new JSONObject();
|
|
|
|
|
managerMsg.put("title", params.getString("title"));
|
|
|
|
|
managerMsg.put("body", params.getString("content"));
|
|
|
|
|
managerMsg.put("type", new JSONObject());
|
|
|
|
|
managerMsg.put("data", new JSONObject());
|
|
|
|
|
managerMsg.put("msgType", "payment");
|
|
|
|
|
AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage();
|
|
|
|
|
sender.sendMessage(appMessage, devTokenJson);
|
|
|
|
|
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 Message Failed", e);
|
|
|
|
|
throw new ServerErrorException("Send App "+params.getString("client_type")+" Failed", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getCoupons(JSONObject device, int page, int limit) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
@ -1207,4 +1251,5 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
String regex = "[A-Za-z0-9]{8}";
|
|
|
|
|
return str.matches(regex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|