|
|
@ -1,5 +1,39 @@
|
|
|
|
package au.com.royalpay.payment.manage.appclient.core.impls;
|
|
|
|
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.core.PaymentApi;
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
|
|
|
|
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.log.ClearingDetailMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
|
|
|
|
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.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.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.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.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;
|
|
|
@ -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.permission.enums.PartnerRole;
|
|
|
|
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
|
|
|
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
|
|
|
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
|
|
|
|
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 cn.jpush.api.JPushClient;
|
|
|
|
import java.io.IOException;
|
|
|
|
import cn.jpush.api.push.model.PushPayload;
|
|
|
|
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.
|
|
|
|
* Created by yishuqian on 28/03/2017.
|
|
|
@ -120,6 +132,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
private APNSMessageHelper apnsMessageHelper;
|
|
|
|
private APNSMessageHelper apnsMessageHelper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ClientDeviceTokenMapper clientDeviceTokenMapper;
|
|
|
|
private ClientDeviceTokenMapper clientDeviceTokenMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private JpushMessageHelper jpushMessageHelper;
|
|
|
|
|
|
|
|
|
|
|
|
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>());
|
|
|
|
|
|
|
|
|
|
|
@ -455,10 +469,24 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
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"));
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.payment"),
|
|
|
|
if("iphone".equals(devToken.getString("client_type"))) {
|
|
|
|
LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"), token,
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.payment"),
|
|
|
|
order, type);
|
|
|
|
LocaleSupport.localeMessage("app.message.body.payment") + order.getString("currency") + order.getDoubleValue("total_amount"), token,
|
|
|
|
log.put("status", 2);
|
|
|
|
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);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
@ -501,9 +529,14 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
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"));
|
|
|
|
apnsMessageHelper.sendAppleMessage("Refund JpushMessage", LocaleSupport.localeMessage("app.message.body.refund") + refundAmount, token,
|
|
|
|
if("iphone".equals(devToken.getString("client_type"))) {
|
|
|
|
order, type);
|
|
|
|
apnsMessageHelper.sendAppleMessage("Refund JpushMessage", LocaleSupport.localeMessage("app.message.body.refund") + refundAmount, token,
|
|
|
|
log.put("status", 2);
|
|
|
|
order, type);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if("android".equals(devToken.getString("client_type"))) {
|
|
|
|
|
|
|
|
sendAppleMessage
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.put("status", 2);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
|
logger.error("出错了:" + e.getMessage());
|
|
|
@ -535,8 +568,23 @@ 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());
|
|
|
|
apnsMessageHelper.sendAppleMessage(LocaleSupport.localeMessage("app.message.title.notice"), notice.getTitle(), token, noticeObj,
|
|
|
|
if("iphone".equals(devToken.getString("client_type"))){
|
|
|
|
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);
|
|
|
|
log.put("status", 2);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
appMessageLogMapper.update(log);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
@ -1147,4 +1195,9 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
String regex = "[A-Za-z0-9]{8}";
|
|
|
|
String regex = "[A-Za-z0-9]{8}";
|
|
|
|
return str.matches(regex);
|
|
|
|
return str.matches(regex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void sendJpush(int client_id,JpushMessage message){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|