From 7ee7ababe11f6dd689661257d51ea4d88fb030e2 Mon Sep 17 00:00:00 2001
From: yixian
Date: Tue, 10 Mar 2020 02:03:25 +0800
Subject: [PATCH] =?UTF-8?q?feat(settle=20ui):=20=E6=B8=85=E7=AE=97?=
=?UTF-8?q?=E5=8F=91=E9=80=81=E5=8B=BE=E9=80=89=E5=8F=91=E9=80=81=E6=89=B9?=
=?UTF-8?q?=E6=AC=A1=EF=BC=8C=E5=8F=96=E6=B6=88=E6=AF=8F=E6=97=A5=E4=B8=80?=
=?UTF-8?q?=E6=AC=A1=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6=E9=99=90=E5=88=B6?=
=?UTF-8?q?=EF=BC=8C=E5=8F=96=E6=B6=88=E9=AA=8C=E8=AF=81=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../impls/PartnerCardDashboardServiceImp.java | 65 +++++-----
.../clearing/core/CleanService.java | 8 +-
.../clearing/core/impl/CleanServiceImpl.java | 111 ++++++++----------
.../clearing/web/SettlementDevController.java | 9 +-
.../mappers/log/LogSettleMailMapper.java | 3 +-
.../manage/support/abafile/ABAFile.java | 14 +++
.../templates/mail/settlement_mail.html | 3 +-
src/main/ui/static/analysis/clearing-log.js | 38 +++---
.../analysis/templates/settlement_detail.html | 4 +-
.../templates/settlement_send_check_code.html | 7 +-
.../payment/manage/task/SettleMailTest.java | 3 +-
11 files changed, 137 insertions(+), 128 deletions(-)
diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java
index 063e582df..fc60a39c4 100644
--- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java
+++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java
@@ -52,32 +52,33 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
private LogSettleMailMapper logSettleMailMapper;
@Resource
private PaymentApi paymentApi;
+
@Override
public JSONObject getCommonAnalysis(String client_moniker) {
JSONObject client = clientManager.getClientInfoByMoniker(client_moniker);
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
JSONObject earlistOrder = transactionAnalysisMapper.getEarliestOrder(client.getIntValue("client_id"));
Date data = new Date();
- if (earlistOrder != null){
- client.put("transaction_time", DateFormatUtils.format(earlistOrder.getDate("transaction_time"),"yyyy-MM-dd"));
+ if (earlistOrder != null) {
+ client.put("transaction_time", DateFormatUtils.format(earlistOrder.getDate("transaction_time"), "yyyy-MM-dd"));
}
- JSONObject res = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data,"Wechat");
- JSONObject best_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data,"Bestpay");
- JSONObject ali_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data,"Alipay");
+ JSONObject res = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Wechat");
+ JSONObject best_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Bestpay");
+ JSONObject ali_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Alipay");
JSONObject rate_value = new JSONObject();
- if (res!= null){
- rate_value.put("wechat_rate_value",res.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN));
+ if (res != null) {
+ rate_value.put("wechat_rate_value", res.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN));
if (res.getInteger("clean_days") != null) {
client.put("clean_days", res.getIntValue("clean_days"));
}
}
- if(best_pay != null){
- rate_value.put("best_rate_value",best_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN));
+ if (best_pay != null) {
+ rate_value.put("best_rate_value", best_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN));
}
- if(ali_pay != null){
- rate_value.put("ali_rate_value",ali_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN));
+ if (ali_pay != null) {
+ rate_value.put("ali_rate_value", ali_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN));
}
- client.put("rate_value",rate_value);
+ client.put("rate_value", rate_value);
return client;
}
@@ -86,7 +87,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
JSONObject client = clientManager.getClientInfoByMoniker(client_moniker);
Assert.notNull(client);
JSONObject params = new JSONObject();
- params.put("client_id",client.getIntValue("client_id"));
+ params.put("client_id", client.getIntValue("client_id"));
return transactionAnalysisMapper.getTransactionCommonAnalysis(params);
}
@@ -95,7 +96,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
JSONObject client = clientManager.getClientInfoByMoniker(client_moniker);
Assert.notNull(client);
JSONObject params = new JSONObject();
- params.put("client_id",client.getIntValue("client_id"));
+ params.put("client_id", client.getIntValue("client_id"));
return customerAndOrdersStatisticsMapper.getPartnerCustomerAndOrderStatistics(params);
}
@@ -104,16 +105,16 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
JSONObject client = clientManager.getClientInfoByMoniker(client_moniker);
Assert.notNull(client);
JSONObject params = new JSONObject();
- params.put("client_id",client.getIntValue("client_id"));
+ params.put("client_id", client.getIntValue("client_id"));
return dashboardService.getTradeInTypes(params);
}
@Override
- public JSONObject getOrderAndCustomerPerDay(String client_moniker){
+ public JSONObject getOrderAndCustomerPerDay(String client_moniker) {
JSONObject client = clientManager.getClientInfoByMoniker(client_moniker);
Assert.notNull(client);
JSONObject params = new JSONObject();
- params.put("client_id",client.getIntValue("client_id"));
+ params.put("client_id", client.getIntValue("client_id"));
return customerAndOrdersStatisticsMapper.getAvgOrderAndCustomerStatistics(params);
}
@@ -124,38 +125,38 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
JSONObject earlistOrder = transactionAnalysisMapper.getEarliestOrder(client.getIntValue("client_id"));
String timezone = client.getString("timezone");
AnalysisBean analysisBean = new AnalysisBean();
- if (earlistOrder != null){
- analysisBean.setBegin(DateFormatUtils.format(earlistOrder.getDate("transaction_time"),"yyyyMMdd"));
+ if (earlistOrder != null) {
+ analysisBean.setBegin(DateFormatUtils.format(earlistOrder.getDate("transaction_time"), "yyyyMMdd"));
}
- analysisBean.setEnd(DateFormatUtils.format(new Date(),"yyyyMMdd"));
+ analysisBean.setEnd(DateFormatUtils.format(new Date(), "yyyyMMdd"));
JSONObject params = analysisBean.toParams(timezone);
- params.put("client_id",client.getIntValue("client_id"));
+ params.put("client_id", client.getIntValue("client_id"));
return dashboardService.getTradeAnalysisInHours(params);
}
@Override
- public JSONObject getSettlementLog(String client_moniker,TradeLogQuery query) {
+ public JSONObject getSettlementLog(String client_moniker, TradeLogQuery query) {
JSONObject client = clientManager.getClientInfoByMoniker(client_moniker);
Assert.notNull(client);
int client_id = client.getIntValue("client_id");
String timezone = client.getString("timezone");
JSONObject earlistOrder = transactionAnalysisMapper.getEarliestOrder(client_id);
- if (earlistOrder!= null){
- query.setDatefrom(DateFormatUtils.format(earlistOrder.getDate("transaction_time"),"yyyyMMdd"));
+ if (earlistOrder != null) {
+ query.setDatefrom(DateFormatUtils.format(earlistOrder.getDate("transaction_time"), "yyyyMMdd"));
}
- query.setDateto(DateFormatUtils.format(new Date(),"yyyyMMdd"));
+ query.setDateto(DateFormatUtils.format(new Date(), "yyyyMMdd"));
JSONObject params = query.toParams(timezone);
params.put("client_id", client_id);
PageList logs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc")));
JSONObject result = PageListUtils.buildPageListResult(logs);
- if (query.getPage()==1){
- if (!logs.isEmpty() && logs.size()>0){
- JSONObject sendMailLog = logSettleMailMapper.findByDate(logs.get(0).getDate("clearing_time"));
- if (sendMailLog == null) {
- result.put("padding",true);
+ if (query.getPage() == 1) {
+ if (!logs.isEmpty()) {
+ List sendMailLogs = logSettleMailMapper.findByDate(logs.get(0).getDate("clearing_time"));
+ if (sendMailLogs.isEmpty()) {
+ result.put("padding", true);
}
- if (sendMailLog!=null && sendMailLog.getIntValue("mail_status") != 1) {
- result.put("padding",true);
+ if (!sendMailLogs.isEmpty() && sendMailLogs.stream().anyMatch(mail -> mail.getIntValue("mail_status") != 1)) {
+ result.put("padding", true);
}
}
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java
index 2becdc015..7d8560431 100644
--- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java
@@ -43,9 +43,9 @@ public interface CleanService {
void settlementXlsx(Date date, HttpServletResponse response) throws IOException;
- List getXlsx(Date dt, String bank) throws IOException;
+ List getXlsx(Date dt, String bank, List clearIds) throws IOException;
- List getAba(Date dt, String bank) throws IOException;
+ List getAba(Date dt, String bank, List clearIds) throws IOException;
void settlementAba(Date date, HttpServletResponse response) throws IOException;
@@ -79,11 +79,11 @@ public interface CleanService {
void getTodaySettlementLogs();
- JSONObject sendSettlementMail(Date date, String checkCode);
+ JSONObject sendSettlementMail(Date date, List clearIds);
void sendCheckCode(Date date, JSONObject manager);
- JSONObject findLogSettleByDate(Date date);
+ List findLogSettleByDate(Date date);
JSONObject validTransactions(Date date, boolean fix, boolean b, boolean b1);
diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java
index 7f1cb41ec..448b871a8 100644
--- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java
@@ -64,7 +64,6 @@ import org.springframework.format.number.CurrencyStyleFormatter;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
-import org.springframework.util.CollectionUtils;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring5.SpringTemplateEngine;
@@ -256,6 +255,12 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
return data;
}).collect(Collectors.toList());
log.put("bank_statistics", bankStatistics);
+ if (StringUtils.isNotEmpty(log.getString("plan_detail"))) {
+ try {
+ log.put("plan_detail", JSON.parseObject(log.getString("plan_detail")));
+ } catch (JSONException ignore) {
+ }
+ }
log.put("editable", DateUtils.isSameDay(log.getDate("settle_date"), new Date()) && log.getBooleanValue("editable"));
log.put("channel_analysis", clearingDetailAnalysisMapper.analysisChannelReport(clearingId));
}
@@ -390,9 +395,11 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
}
@Override
- public List getXlsx(Date dt, String bank) throws IOException {
+ public List getXlsx(Date dt, String bank, List clearIds) throws IOException {
List logs = clearingLogMapper.findByDate(dt);
- logs = logs.stream().filter(log -> log.getBooleanValue("editable")).collect(Collectors.toList());
+ logs = logs.stream().filter(log -> log.getBooleanValue("editable"))
+ .filter(log -> clearIds.isEmpty() || clearIds.contains(log.getString("clearing_id")))
+ .collect(Collectors.toList());
if (logs.isEmpty()) {
throw new NotFoundException();
}
@@ -486,9 +493,11 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
}
@Override
- public List getAba(Date dt, String bank) {
+ public List getAba(Date dt, String bank, List clearIds) {
List logs = clearingLogMapper.findByDate(dt);
- logs = logs.stream().filter(log -> log.getBooleanValue("editable")).collect(Collectors.toList());
+ logs = logs.stream().filter(log -> log.getBooleanValue("editable"))
+ .filter(log -> clearIds.isEmpty() || clearIds.contains(log.getString("clearing_id")))
+ .collect(Collectors.toList());
if (logs.isEmpty()) {
throw new NotFoundException();
}
@@ -496,11 +505,19 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
for (JSONObject log : logs) {
List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id"));
details = mergeBatchSettleClients(details);
- files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time")));
+ String remark = extractSettleRemark(log);
+ files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time"), remark));
}
return files.stream().filter(file -> bank.equals(file.bank())).collect(Collectors.toList());
}
+ public String extractSettleRemark(JSONObject log) {
+ return Optional.ofNullable(StringUtils.defaultIfEmpty(log.getString("plan_detail"), null))
+ .map(JSON::parseObject)
+ .map(plan -> StringUtils.defaultIfEmpty(plan.getString("remark"), plan.getString("plan_id")))
+ .orElse("");
+ }
+
private byte[] generateSettleXlsxFile(Date dt, List settlements, String bank) throws IOException {
try (Workbook wb = new XSSFWorkbook()) {
Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd"));
@@ -536,7 +553,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
for (JSONObject log : logs) {
List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id"));
details = mergeBatchSettleClients(details);
- files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time")));
+ files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time"), extractSettleRemark(log)));
}
OutputStream ous = resp.getOutputStream();
if (files.size() == 1) {
@@ -580,7 +597,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
resp.addHeader("Content-Disposition", "attachment; filename=" + zipName);
OutputStream ous = resp.getOutputStream();
- List abaFiles = generateSettleAbaFiles(settleDate, details, opTime);
+ List abaFiles = generateSettleAbaFiles(settleDate, details, opTime, extractSettleRemark(clearing));
try (ZipOutputStream zos = new ZipOutputStream(ous)) {
for (ABAFile aba : abaFiles) {
zos.putNextEntry(new ZipEntry(aba.filename()));
@@ -591,9 +608,12 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
}
}
- private List generateSettleAbaFiles(Date dt, List settlements, Date operateTime) {
+ private List generateSettleAbaFiles(Date dt, List settlements, Date operateTime, String remark) {
List banks = settlements.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList());
- return banks.stream().map(bank -> generateSettleAbaFile(bank, dt, settlements)).peek(file -> file.setOperateTime(operateTime)).collect(Collectors.toList());
+ return banks.stream().map(bank -> generateSettleAbaFile(bank, dt, settlements))
+ .peek(file -> file.setOperateTime(operateTime))
+ .peek(file -> file.setRemark(remark))
+ .collect(Collectors.toList());
}
private ABAFile generateSettleAbaFile(String bank, Date dt, List settlements) {
@@ -1092,28 +1112,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
}
@Override
- public JSONObject sendSettlementMail(Date date, String checkCode) {
+ public JSONObject sendSettlementMail(Date date, List clearIds) {
JSONObject result = new JSONObject();
- String redisCode = stringRedisTemplate.boundValueOps(reidsCheckCodeKey).get();
- if (StringUtils.isEmpty(redisCode)) {
- result.put("result", 1);
- result.put("msg", "The verification code has expired ,Please send the verification code again");
- return result;
- }
- if (!redisCode.equals(checkCode)) {
- result.put("result", 1);
- result.put("msg", "The verification code is incorrect");
- return result;
- }
- JSONObject settleMail = logSettleMailMapper.findByDate(date);
- if (settleMail != null) {
- List emailStatus = mailService.checkEmailStatus(settleMail.getString("email_id"));
- if (!CollectionUtils.isEmpty(emailStatus) && emailStatus.get(0).getIntValue("status") == 1 && settleMail.getIntValue("mail_status") == 1) {
- result.put("result", 0);
- result.put("msg", "Excel has been sent");
- return result;
- }
- }
try {
String title = "Royalpay Settlement File " + DateFormatUtils.format(date, "yyyyMMdd");
JSONObject model = new JSONObject();
@@ -1121,7 +1121,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
String fileName1 = "Merchant_Settlement_Info_xlsx_" + DateFormatUtils.format(date, "yyyyMMdd");
List attachList = new ArrayList<>();
JSONObject attach1 = new JSONObject();
- List xlsxFileList = getXlsx(date, "CBA");
+ List xlsxFileList = getXlsx(date, "CBA", clearIds);
if (xlsxFileList.size() > 1) {
fileName1 += ".zip";
attach1.put("content", Base64.encodeBase64String(getZipByteArr(xlsxFileList)));
@@ -1133,7 +1133,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
attachList.add(attach1);
JSONObject attach2 = new JSONObject();
- List abaFileList = getAba(date, "CBA");
+ List abaFileList = getAba(date, "CBA", clearIds);
String fileName2 = "Merchant_Settlement_Info_aba_" + DateFormatUtils.format(date, "yyyyMMdd");
if (abaFileList.size() > 1) {
fileName2 += ".zip";
@@ -1157,6 +1157,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
Context ctx = new Context();
ctx.setVariable("date", DateFormatUtils.format(date, "dd-MM-yyyy"));
ctx.setVariable("abaFiles", abaFileList);
+ ctx.setVariable("totalAmount", abaFileList.stream().map(ABAFile::getTotalSettleAmount).reduce(BigDecimal::add));
final String content = thymeleaf.process("mail/settlement_mail", ctx);
// 测试用地址
// String mailId = mailService.sendEmail(title, "164851225@qq.com", "1029811920@qq.com", content,
@@ -1164,35 +1165,21 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
JSONObject config = sysConfigManager.getSysConfig();
String mailId = mailService.sendEmail(title, config.getString("settle_mail_to"), config.getString("settle_mail_cc"), content, attachList);
- if (settleMail == null) {
- JSONObject settleMailRecord = new JSONObject();
- settleMailRecord.put("send_date", new Date());
- settleMailRecord.put("clearing_date", date);
- settleMailRecord.put("email_id", mailId);
- if (StringUtils.isEmpty(mailId)) {
- result.put("result", 1);
- result.put("msg", "System error");
- settleMailRecord.put("mail_status", 0);
- settleMailRecord.put("notice_status", 0);
- logSettleMailMapper.save(settleMailRecord);
- return result;
- } else {
- settleMailRecord.put("mail_status", 1);
- settleMailRecord.put("notice_status", 0);
- logSettleMailMapper.save(settleMailRecord);
- }
+ JSONObject settleMailRecord = new JSONObject();
+ settleMailRecord.put("send_date", new Date());
+ settleMailRecord.put("clearing_date", date);
+ settleMailRecord.put("email_id", mailId);
+ if (StringUtils.isEmpty(mailId)) {
+ result.put("result", 1);
+ result.put("msg", "System error");
+ settleMailRecord.put("mail_status", 0);
+ settleMailRecord.put("notice_status", 0);
+ logSettleMailMapper.save(settleMailRecord);
+ return result;
} else {
- if (!StringUtils.isEmpty(mailId)) {
- JSONObject updateRecord = new JSONObject();
- updateRecord.put("id", settleMail.getString("id"));
- updateRecord.put("mail_status", 1);
- updateRecord.put("email_id", mailId);
- logSettleMailMapper.update(updateRecord);
- } else {
- result.put("result", 0);
- result.put("msg", "System error");
- return result;
- }
+ settleMailRecord.put("mail_status", 1);
+ settleMailRecord.put("notice_status", 0);
+ logSettleMailMapper.save(settleMailRecord);
}
sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方", "发送清算通知");
clearingLogMapper.lockSettlements(date);
@@ -1246,7 +1233,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
}
@Override
- public JSONObject findLogSettleByDate(Date date) {
+ public List findLogSettleByDate(Date date) {
return logSettleMailMapper.findByDate(date);
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java
index ad48c2b8b..8a76ca76c 100644
--- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java
@@ -121,14 +121,15 @@ public class SettlementDevController {
}
}
- @ManagerMapping(value = "/reports/{date}/send_settlement_xlsx/{checkCode}", role = {ManagerRole.FINANCIAL_STAFF})
- public JSONObject sendSettlementMail(@PathVariable("date") String date, @PathVariable("checkCode") String checkCode) {
+ @ManagerMapping(value = "/reports/{date}/send_settlement_xlsx", role = {ManagerRole.FINANCIAL_STAFF}, method = RequestMethod.POST)
+ public JSONObject sendSettlementMail(@PathVariable("date") String date, @RequestBody JSONObject data) {
Date dt = null;
try {
dt = dateFormat.parse(date);
} catch (ParseException e) {
}
- return cleanService.sendSettlementMail(dt, checkCode);
+ List clearIds = data.getJSONArray("clearing_ids").toJavaList(String.class);
+ return cleanService.sendSettlementMail(dt, clearIds);
}
@ManagerMapping(value = "/reports/send_checkcode", role = {ManagerRole.FINANCIAL_STAFF})
@@ -137,7 +138,7 @@ public class SettlementDevController {
}
@RequestMapping(value = "/reports/{date}/send_status")
- public JSONObject sendStatus(@PathVariable String date) {
+ public List sendStatus(@PathVariable String date) {
Date dt = null;
try {
dt = dateFormat.parse(date);
diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogSettleMailMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogSettleMailMapper.java
index 3d9bf9e1e..bc1177425 100644
--- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogSettleMailMapper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogSettleMailMapper.java
@@ -6,6 +6,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import java.util.Date;
+import java.util.List;
/**
* Created by davep on 2016-09-04.
@@ -16,7 +17,7 @@ public interface LogSettleMailMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject clearingLog);
- JSONObject findByDate(Date date);
+ List findByDate(Date date);
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject update);
diff --git a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java
index 9e0f0d2e2..889f3d0c5 100644
--- a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java
+++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java
@@ -21,6 +21,7 @@ public class ABAFile {
private List settlements;
private BigDecimal totalSettleAmount;
private Date operateTime;
+ private String remark;
public ABAFile(ABAConfig.ABABase base, Date settleDate) {
this.base = base;
@@ -34,6 +35,15 @@ public class ABAFile {
totalSettleAmount = totalSettleAmount.add(settleAmount);
}
+ public String getRemark() {
+ return remark;
+ }
+
+ public ABAFile setRemark(String remark) {
+ this.remark = remark;
+ return this;
+ }
+
public boolean manualSending() {
return base.isManualSending();
}
@@ -62,6 +72,10 @@ public class ABAFile {
return format.format(totalSettleAmount);
}
+ public BigDecimal getTotalSettleAmount(){
+ return totalSettleAmount;
+ }
+
private String generateFinalLine() {
StringBuilder lineBuilder = new StringBuilder(baseLine);
lineBuilder.replace(0, 1, "7");
diff --git a/src/main/resources/templates/mail/settlement_mail.html b/src/main/resources/templates/mail/settlement_mail.html
index 3eb798957..6ca340d91 100644
--- a/src/main/resources/templates/mail/settlement_mail.html
+++ b/src/main/resources/templates/mail/settlement_mail.html
@@ -5,11 +5,12 @@
Please find the attached settlement files data up to
+
File Validation:
diff --git a/src/main/ui/static/analysis/clearing-log.js b/src/main/ui/static/analysis/clearing-log.js
index f8a642d0f..5ad0a7347 100644
--- a/src/main/ui/static/analysis/clearing-log.js
+++ b/src/main/ui/static/analysis/clearing-log.js
@@ -323,11 +323,16 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
if ($scope.datePattern == nowStr) {
$scope.sendNotice = true;
}
- $scope.displaySendCheckCode = function () {
+ $scope.displaySendCheck = function () {
$uibModal.open({
templateUrl: '/static/analysis/templates/settlement_send_check_code.html',
controller: 'settlementSendCheckCodeCtrl',
- size: 'sm'
+ size: 'sm',
+ resolve: {
+ settleLogs: function () {
+ return $scope.detail.logs.filter(log => log.editable);
+ }
+ }
});
};
@@ -348,15 +353,6 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
})[0];
};
- $http.get('/sys/settlement/reports/' + $stateParams.date + '/send_status/').then(function (resp) {
- if (resp.data != null && resp.data.mail_status == 1) {
- $scope.hasSentMail = true;
- }
- });
- $scope.$on("sendMailSuccess",
- function (event, msg) {
- $scope.hasSentMail = true;
- });
$scope.confirmSendSettlementMail = function () {
commonDialog.confirm({
@@ -497,7 +493,18 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
};
}]);
- app.controller('settlementSendCheckCodeCtrl', ['$scope', '$http', '$rootScope', '$stateParams', function ($scope, $http, $rootScope, $stateParams) {
+ app.controller('settlementSendCheckCodeCtrl', ['$scope', '$http', '$rootScope', '$stateParams', 'settleLogs', function ($scope, $http, $rootScope, $stateParams, settleLogs) {
+ $scope.settleLogs = settleLogs.map(log => {
+ let info = {
+ 'id': log.clearing_id,
+ 'remark': log.plan_detail.remark || log.plan_detail.plan_id,
+ 'send': false
+ };
+ return info
+ });
+ $scope.switchSendFlag=function(info){
+ info.send=!info.send
+ };
$scope.sendCheckCodeButton = false;
$scope.sendMailButton = false;
$scope.check_code = '';
@@ -510,12 +517,9 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
$scope.sendSettlementMail = function () {
$scope.error_msg = '正在发送,请稍后。';
- if ($scope.check_code == '' || $scope.check_code == null) {
- $scope.error_msg = '请输入验证码';
- return;
- }
$scope.sendMailButton = true;
- $http.get('/sys/settlement/reports/' + $stateParams.date + '/send_settlement_xlsx/' + $scope.check_code).then(function (resp) {
+ $http.post('/sys/settlement/reports/' + $stateParams.date + '/send_settlement_xlsx',
+ {clearing_ids:$scope.settleLogs.filter(log=>log.send).map(log=>log.clearing_id)}).then(function (resp) {
$scope.error_msg = resp.data.msg;
$scope.sendMailButton = false;
if (resp.data.result == 0) {
diff --git a/src/main/ui/static/analysis/templates/settlement_detail.html b/src/main/ui/static/analysis/templates/settlement_detail.html
index 195557b90..3e8a67a2e 100644
--- a/src/main/ui/static/analysis/templates/settlement_detail.html
+++ b/src/main/ui/static/analysis/templates/settlement_detail.html
@@ -29,7 +29,7 @@
Settlement.aba
diff --git a/src/main/ui/static/analysis/templates/settlement_send_check_code.html b/src/main/ui/static/analysis/templates/settlement_send_check_code.html
index 515eb2fa1..630ede11d 100644
--- a/src/main/ui/static/analysis/templates/settlement_send_check_code.html
+++ b/src/main/ui/static/analysis/templates/settlement_send_check_code.html
@@ -4,10 +4,9 @@
-
-
+
+ - [{{log.remark}}]log.clearing_id
+