Merge branch 'develop'

master
taylor.dang 6 years ago
commit f257c60950

@ -515,7 +515,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
if (settle.getBigDecimal("clearing_amount").compareTo(BigDecimal.ZERO) == 0) {
continue;
}
aba.addSettleMerchant(settle.getString("bsb_no"), settle.getString("account_no"), settle.getString("account_name"),
aba.addSettleMerchant(settle.getString("client_moniker"), settle.getString("bsb_no"), settle.getString("account_no"), settle.getString("account_name"),
settle.getBigDecimal("clearing_amount"));
}
return aba;
@ -1016,7 +1016,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
// String mailId = mailService.sendEmail(title, "164851225@qq.com", "1029811920@qq.com", content,
// attachList);
JSONObject config = sysConfigManager.getSysConfig();
String mailId = mailService.sendEmail(title, config.getString("settle_mail_to"),config.getString("settle_mail_cc"), content, attachList);
String mailId = mailService.sendEmail(title, config.getString("settle_mail_to"), config.getString("settle_mail_cc"), content, attachList);
if (settleMail == null) {
JSONObject settleMailRecord = new JSONObject();

@ -46,6 +46,10 @@ public interface ClientRateMapper {
List<JSONObject> getAllExpiry(@Param("expiry_date")Date expiry_date);
List<JSONObject> getAllClientRateExpiryMerchants();
void postponeMerchantRateByClientId(int clientId);
JSONObject latestChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id);
JSONObject latestExpiryConfig(@Param("client_id")int client_id,@Param("rate_name") String rate_name);

@ -342,4 +342,11 @@ public interface ClientManager {
void updateAllPartnerPassword(String clientMoniker, List<String> emails);
void postponeClientRate(Date now, Date yearTomorrow, String expireDate, JSONObject client);
/**
*
*
* @param clientId
*/
boolean postponeClientRate(int clientId, String clientMoniker,String nextYearExipryDate);
}

@ -4029,6 +4029,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
});
}
@Override
@Transactional
public boolean postponeClientRate(int clientId, String clientMoniker, String nextYearExipryDate) {
try {
clientRateMapper.postponeMerchantRateByClientId(clientId);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(null, clientMoniker, "tax_in_surcharge", false));
List<JSONObject> adminAccounts = clientAccountMapper.listAdminAccounts(clientId);
adminAccounts.forEach(o -> {
sendClientPostponeNotify(o, nextYearExipryDate);
});
logger.error("[{}]费率自动延期成功", clientMoniker);
return true;
} catch (Exception e) {
logger.error("[{}]费率自动延期失败", clientMoniker);
return false;
}
}
private TemplateMessage initClientMessage(JSONObject client, String newExpiryDate, String wechatOpenid, String templateId) {

@ -29,8 +29,8 @@ public class ABAFile {
totalSettleAmount = BigDecimal.ZERO;
}
public void addSettleMerchant(String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) {
settlements.add(new SettleMerchantInfo(bsbNo, accountNo, accountName, settleAmount));
public void addSettleMerchant(String clientMoniker, String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) {
settlements.add(new SettleMerchantInfo(clientMoniker, bsbNo, accountNo, accountName, settleAmount));
totalSettleAmount = totalSettleAmount.add(settleAmount);
}
@ -129,12 +129,14 @@ public class ABAFile {
}
private class SettleMerchantInfo {
private final String clientMoniker;
private final String bsbNo;
private final String accountNo;
private final String accountName;
private final BigDecimal settleAmount;
public SettleMerchantInfo(String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) {
public SettleMerchantInfo(String clientMoniker, String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) {
this.clientMoniker = clientMoniker;
this.bsbNo = bsbNo;
this.accountNo = accountNo.replaceAll("\\D", "");
this.accountName = accountName;
@ -149,7 +151,7 @@ public class ABAFile {
lineBuilder.replace(18, 20, "50");
lineBuilder.replace(20, 30, getSettleAmount());
lineBuilder.replace(30, 62, getAccountName());
lineBuilder.replace(62, 80, StringUtils.rightPad("RoyalPay" + DateFormatUtils.format(settleDate, "yyyyMMdd"), 18));
lineBuilder.replace(62, 80, StringUtils.rightPad("RoyalPay" + DateFormatUtils.format(settleDate, "MMdd") + clientMoniker, 18));
lineBuilder.replace(80, 87, bsbNo(base.getBsb()));
lineBuilder.replace(87, 96, StringUtils.leftPad(base.getAccountNo(), 9));
lineBuilder.replace(96, 112, StringUtils.left(StringUtils.rightPad(base.getAccountName(), 16), 16));

@ -69,6 +69,23 @@ public class PostponeClientTask {
});
}
@Scheduled(cron = "0 30 6 * * ?")
private void postponeMerchantRate() {
synchronizedScheduler.executeProcess("manage_task:postponeMerchantRate", 120_000, () -> {
String nextYearExipryDate = DateFormatUtils.format(DateUtils.addYears(new Date(), 1), "yyyy-MM-dd");
List<JSONObject> expiryRateMerchants = clientRateMapper.getAllClientRateExpiryMerchants();
StringBuilder merchantStrBuilder = new StringBuilder();
expiryRateMerchants.forEach(merchant -> {
if (clientManager.postponeClientRate(merchant.getIntValue("client_id"), merchant.getString("client_moniker"),nextYearExipryDate)) {
merchantStrBuilder.append(merchant.getString("client_moniker")).append("、");
}
});
merchantStrBuilder.deleteCharAt(merchantStrBuilder.length() - 1);
sendComplianceNotify(merchantStrBuilder, nextYearExipryDate);
});
}
private void sendComplianceNotify(StringBuilder sb, String newExpireDate) {
List<String> compliance = managerMapper.listOpenIdsOfCompliances();
compliance.forEach(p -> {
@ -76,8 +93,8 @@ public class PostponeClientTask {
TemplateMessage notice = initComplianceMessage(sb.toString(), newExpireDate, p, api.getTemplateId("client-postpone"));
api.sendTemplateMessage(notice);
});
}
private TemplateMessage initComplianceMessage(String clients, String newExpiryDate, String wechatOpenid, String templateId) {
TemplateMessage notice = new TemplateMessage(wechatOpenid, templateId, null);
notice.put("first", "以下商户据合同费率已经自动延期1年", "#ff0000");

@ -119,6 +119,43 @@
a.expiry_time < #{expiry_date}
]]>
</select>
<select id="getAllClientRateExpiryMerchants" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
c.client_moniker,
c.client_id
FROM sys_clients c
LEFT JOIN sys_client_rates r
ON r.client_id = c.client_id
WHERE c.skip_clearing = 0
AND (c.approve_result = 1
OR (c.approve_result = 2
AND (c.source = 1
OR c.source = 2)))
AND c.is_valid = 1
AND (r.expiry_time = (SELECT
MAX(expiry_time)
FROM sys_client_rates r3
WHERE r3.client_id = c.client_id
AND r3.rate_name = r.rate_name)
AND r.expiry_time <= CURRENT_DATE()
OR r.client_rate_id IS NULL
)
]]>
</select>
<insert id="postponeMerchantRateByClientId" parameterType="int">
INSERT sys_client_rates (manager_id, client_id, rate_name, rate_value, transaction_fee, active_time, expiry_time, create_time, update_time, manager_name, clean_days, remark)
SELECT CONCAT('System-', CURRENT_DATE()),r.client_id,r.rate_name,r.rate_value,r.transaction_fee,DATE_ADD(r.expiry_time, INTERVAL 1 day),DATE_ADD(r.expiry_time, INTERVAL 1 year),NOW(), NOW(),
CONCAT('System-', CURRENT_DATE()),r.clean_days,'费率自动延期一年'
FROM sys_clients c
LEFT JOIN sys_client_rates r ON r.client_id = c.client_id
WHERE c.client_id = #{clientId} AND c.skip_clearing = 0 AND (c.approve_result = 1 OR (c.approve_result = 2 AND (c.source = 1 OR c.source = 2)))
AND c.is_valid = 1 AND (r.expiry_time = (SELECT MAX(expiry_time)FROM sys_client_rates r3
WHERE r3.client_id = c.client_id
AND r3.rate_name = r.rate_name)
AND CURRENT_DATE() >= r.expiry_time
OR r.client_rate_id IS NULL)
</insert>
<select id="latestConfig" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM
sys_client_rates

@ -57,8 +57,9 @@ $(document).ready(function () {
} else {
// 如果没有注入则监听注入的事件
document.addEventListener('AlipayJSBridgeReady', function () {
callPayment(pay.trade_no);
}, false);
});
callPayment(pay.trade_no);
}
},

Loading…
Cancel
Save