|
|
|
@ -8,7 +8,6 @@ import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionModify;
|
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
|
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
|
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage;
|
|
|
|
|
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
|
|
|
|
@ -24,10 +23,8 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -68,7 +65,6 @@ public class PostponeClientTask {
|
|
|
|
|
String expireDate = DateFormatUtils.format(yearTomorrow, "yyyy-MM-dd");
|
|
|
|
|
List<JSONObject> expiryClient = clientRateMapper.getAllExpiry(now);
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
List<JSONObject> successClients = new LinkedList<>();
|
|
|
|
|
if (CollectionUtils.isEmpty(expiryClient)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -122,32 +118,32 @@ public class PostponeClientTask {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void sendClientPostponeNotify(JSONObject account, String newExpireDate) {
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(account.getIntValue("client_id"));
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (StringUtils.isEmpty(account.getString("wechat_openid"))) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
MpWechatApi api = mpWechatApiProvider.getApiFromOpenId(account.getString("wechat_openid"));
|
|
|
|
|
if (api != null) {
|
|
|
|
|
String templateId = api.getTemplateId("client-postpone");
|
|
|
|
|
if (templateId != null) {
|
|
|
|
|
TemplateMessage notice = initClientMessage(client, newExpireDate, account.getString("wechat_openid"), templateId);
|
|
|
|
|
api.sendTemplateMessage(notice);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("Sending Notify failure", e);
|
|
|
|
|
}
|
|
|
|
|
// JSONObject client = clientManager.getClientInfo(account.getIntValue("client_id"));
|
|
|
|
|
//
|
|
|
|
|
// try {
|
|
|
|
|
// if (StringUtils.isEmpty(account.getString("wechat_openid"))) {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// MpWechatApi api = mpWechatApiProvider.getApiFromOpenId(account.getString("wechat_openid"));
|
|
|
|
|
// if (api != null) {
|
|
|
|
|
// String templateId = api.getTemplateId("client-postpone");
|
|
|
|
|
// if (templateId != null) {
|
|
|
|
|
// TemplateMessage notice = initClientMessage(client, newExpireDate, account.getString("wechat_openid"), templateId);
|
|
|
|
|
// api.sendTemplateMessage(notice);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// logger.error("Sending Notify failure", e);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void sendComplianceNotify(StringBuilder sb, String newExpireDate) {
|
|
|
|
|
List<String> compliance = managerMapper.listOpenIdsOfCompliances();
|
|
|
|
|
compliance.forEach(p -> {
|
|
|
|
|
MpWechatApi api = mpWechatApiProvider.getApiFromOpenId(p);
|
|
|
|
|
TemplateMessage notice = initComplianceMessage(sb.toString(), newExpireDate, p, api.getTemplateId("client-postpone"));
|
|
|
|
|
api.sendTemplateMessage(notice);
|
|
|
|
|
});
|
|
|
|
|
// List<String> compliance = managerMapper.listOpenIdsOfCompliances();
|
|
|
|
|
// compliance.forEach(p -> {
|
|
|
|
|
// MpWechatApi api = mpWechatApiProvider.getApiFromOpenId(p);
|
|
|
|
|
// TemplateMessage notice = initComplianceMessage(sb.toString(), newExpireDate, p, api.getTemplateId("client-postpone"));
|
|
|
|
|
// api.sendTemplateMessage(notice);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|