|
|
|
@ -1,5 +1,39 @@
|
|
|
|
|
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.Calendar;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
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,12 +48,18 @@ 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.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;
|
|
|
|
@ -36,37 +76,9 @@ 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;
|
|
|
|
|
import cn.jpush.api.JPushClient;
|
|
|
|
|
import cn.jpush.api.push.model.PushPayload;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by yishuqian on 28/03/2017.
|
|
|
|
@ -120,6 +132,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
private APNSMessageHelper apnsMessageHelper;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientDeviceTokenMapper clientDeviceTokenMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private JpushMessageHelper jpushMessageHelper;
|
|
|
|
|
|
|
|
|
|
private ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
|
|
|
|
|
|
|
|
|
@ -455,10 +469,24 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
|
type.put("send_type", "payment");
|
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.payment"),
|
|
|
|
|
LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"), token,
|
|
|
|
|
order, type);
|
|
|
|
|
log.put("status", 2);
|
|
|
|
|
if("iphone".equals(devToken.getString("client_type"))) {
|
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.payment"),
|
|
|
|
|
LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"), token,
|
|
|
|
|
order, type);
|
|
|
|
|
}
|
|
|
|
|
if("android".equals(devToken.getString("client_type"))) {
|
|
|
|
|
JPushClient jPushClient= JpushMessageHelper.getPush();
|
|
|
|
|
JpushMessage jpushMessage = new JpushMessage();
|
|
|
|
|
jpushMessage.setTitle(LocaleSupport.localeMessage("app.message.title.payment"));
|
|
|
|
|
jpushMessage.setText(LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"));
|
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
|
param.put("data",order);
|
|
|
|
|
param.put("type",type);
|
|
|
|
|
jpushMessage.setParams(param);
|
|
|
|
|
PushPayload pushPayload =JpushMessageHelper.generateSinglePayload(token,jpushMessage);
|
|
|
|
|
jPushClient.sendPush(pushPayload);
|
|
|
|
|
}
|
|
|
|
|
log.put("status", 2);
|
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
@ -501,9 +529,14 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
|
type.put("send_type", "refund");
|
|
|
|
|
type.put("id", order.getString("order_id"));
|
|
|
|
|
apnsMessageHelper.sendAppleMessage("Refund JpushMessage", LocaleSupport.localeMessage("app.message.body.refund") + refundAmount, token,
|
|
|
|
|
order, type);
|
|
|
|
|
log.put("status", 2);
|
|
|
|
|
if("iphone".equals(devToken.getString("client_type"))) {
|
|
|
|
|
apnsMessageHelper.sendAppleMessage("Refund JpushMessage", LocaleSupport.localeMessage("app.message.body.refund") + refundAmount, token,
|
|
|
|
|
order, type);
|
|
|
|
|
}
|
|
|
|
|
if("android".equals(devToken.getString("client_type"))) {
|
|
|
|
|
sendAppleMessage
|
|
|
|
|
}
|
|
|
|
|
log.put("status", 2);
|
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
@ -535,8 +568,23 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
JSONObject type = new JSONObject();
|
|
|
|
|
type.put("send_type", "notice");
|
|
|
|
|
type.put("id", notice.getNotice_id());
|
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"), notice.getTitle(), token, noticeObj,
|
|
|
|
|
type);
|
|
|
|
|
if("iphone".equals(devToken.getString("client_type"))){
|
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"), notice.getTitle(), token, noticeObj,
|
|
|
|
|
type);
|
|
|
|
|
}
|
|
|
|
|
if("android".equals(devToken.getString("client_type"))){
|
|
|
|
|
JPushClient jPushClient= JpushMessageHelper.getPush();
|
|
|
|
|
JpushMessage jpushMessage = new JpushMessage();
|
|
|
|
|
jpushMessage.setTitle(notice.getTitle());
|
|
|
|
|
jpushMessage.setText(LocaleSupport.localeMessage("app.message.title.notice"));
|
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
|
param.put("data",noticeObj);
|
|
|
|
|
param.put("type",type);
|
|
|
|
|
jpushMessage.setParams(param);
|
|
|
|
|
PushPayload pushPayload =JpushMessageHelper.generateSinglePayload(token,jpushMessage);
|
|
|
|
|
jPushClient.sendPush(pushPayload);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.put("status", 2);
|
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -1147,4 +1195,9 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
String regex = "[A-Za-z0-9]{8}";
|
|
|
|
|
return str.matches(regex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void sendJpush(int client_id,JpushMessage message){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|