diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java index 556e514d1..32ce78bd2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java @@ -164,7 +164,7 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { @Transactional public void doVerifyAlipaySettleLog(Date dateStr) throws Exception { - JSONObject aliSettleLog = alipayClient.downloadRetailSettlements(dateStr); + JSONObject aliSettleLog = alipayClient.oldDownloadRetailSettlements(dateStr); saveAlipaySettleLog(dateStr, aliSettleLog, "Alipay"); } diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFile.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFile.java new file mode 100644 index 000000000..f1a26bf68 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFile.java @@ -0,0 +1,123 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile; + +import au.com.royalpay.payment.core.ChannelBillValidator; +import au.com.royalpay.payment.core.beans.ChannelBillPackage; +import au.com.royalpay.payment.core.exceptions.ChannelNotSupportedException; +import au.com.royalpay.payment.tools.defines.PayChannel; +import com.github.miemiedev.mybatis.paginator.domain.PageList; +import org.apache.commons.io.IOUtils; +import org.springframework.stereotype.Component; +import org.thymeleaf.util.ListUtils; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * @Description + * @title: 渠道对账文件 + * @Date 2020/11/5 15:06 + * @author: zhangTao + */ +@Component +public class ChannelReconciliationFile { + + private ChannelReconciliationFileTunnel tunnel; + private final Map validatorMap ; + + public ChannelReconciliationFile(ChannelReconciliationFileTunnel tunnel ,ChannelBillValidator[] validators) { + this.tunnel = tunnel; + validatorMap = Arrays.stream(validators).collect(Collectors.toMap(ChannelBillValidator::payChannel,channelBillValidator -> channelBillValidator)); + } + + public PageList list(ChannelReconciliationFileQueryParameter channelReconciliationFileQueryParameter) { + return this.tunnel.list(channelReconciliationFileQueryParameter); + } + + + public ChannelReconciliationFileContent download(ChannelReconciliationFileDownloadParameter from) { + Optional> channel = findChannels(from.getChannel()); + + if (!channel.isPresent()) { + throw new ChannelNotSupportedException(); + } + + Map.Entry channelChannelBillValidatorEntry = channel.get(); + + ChannelBillValidator channelBillValidator = channelChannelBillValidatorEntry.getValue(); + + List channelBillPackageList = selectTypeDown(from ,channelBillValidator); + + if (isNull(channelBillPackageList)) { + throw new ChannelReconciliationFileEmptyException(); + } + + + if (isMultiFile(channelBillPackageList)) { + return genMultiFile(channelBillPackageList); + } + + return genSingleFile(channelBillPackageList.get(0)); + } + + private List selectTypeDown(ChannelReconciliationFileDownloadParameter from, ChannelBillValidator channelBillValidator) { + + if (from.billType().equals("SETTLEMENT")){ + return channelBillValidator + .downloadRawSettlementFiles(from.pid(), from.billDate(), from.isUseCash()); + + } + return channelBillValidator.downloadRawTransactionFiles(from.pid(), from.billDate(), from.isUseCash()); + + } + + private boolean isMultiFile(List channelBillPackageList) { + return channelBillPackageList.size() > 1; + } + + private boolean isNull(List channelBillPackageList){ + return ListUtils.isEmpty(channelBillPackageList); + } + + private ChannelReconciliationFileContent genSingleFile(ChannelBillPackage channelBillPackage) { + return ChannelReconciliationFileContent.instance(channelBillPackage.getFilename(), + channelBillPackage.getBillContent()); + } + + private ChannelReconciliationFileContent genMultiFile(List channelBillPackageList) { + try (ByteArrayOutputStream stream = new ByteArrayOutputStream(); ZipOutputStream zipOutputStream = new ZipOutputStream(stream)) { + + channelBillPackageList.forEach(bill -> toZipOutputStream(bill, zipOutputStream)); + + zipOutputStream.close(); + stream.close(); + return ChannelReconciliationFileContent.instance("reconciliationFile.zip", stream.toByteArray()); + } catch (IOException e) { + throw new MultiFileChannelReconciliationException(); + } + } + + private void toZipOutputStream(ChannelBillPackage channelBillPackage ,ZipOutputStream zipOutputStream){ + try (ByteArrayInputStream fis = new ByteArrayInputStream(channelBillPackage.getBillContent())) { + ZipEntry zipEntryXtv = new ZipEntry(channelBillPackage.getFilename()); + zipOutputStream.putNextEntry(zipEntryXtv); + IOUtils.copy(fis, zipOutputStream); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + private Optional> findChannels(String channel) { + return validatorMap.entrySet().stream().filter(entry -> channel.equals(entry.getKey().getChannelCode())).findAny(); + } + + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileContent.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileContent.java new file mode 100644 index 000000000..78510f04b --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileContent.java @@ -0,0 +1,66 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile; + + +import org.apache.commons.io.FilenameUtils; + +/** + * 渠道对账文件内容 + * @Date 2020/11/5 17:21 + * @author: zhangTao + */ +public class ChannelReconciliationFileContent { + + private static String SUFFIX =".txt"; + private final FileName fileName; + private final byte[] content; + + private ChannelReconciliationFileContent(String fileName, byte[] content) { + this.fileName = new FileName(fileName) ; + this.content = content; + } + + public String name() { + return this.fileName.getName(); + } + + + public int length() { + return this.content.length; + } + + public byte[] content() { + return this.content; + } + + public static ChannelReconciliationFileContent instance(String fileName, byte[] billContent) { + if (!checkFileName(fileName)){ + fileName = fileName+SUFFIX; + // throw new ChannelReconciliationFileNameSuffixException(); + } + return new ChannelReconciliationFileContent(fileName, billContent); + } + + private static boolean checkFileName(String fileName) { + return fileName.contains("."); + } + + private class FileName { + + private final String name; + private final String type; + + public FileName(String name) { + this.name = name; + this.type = FilenameUtils.getExtension(name); + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } + } + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileDTO.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileDTO.java new file mode 100644 index 000000000..3cb10dfd4 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileDTO.java @@ -0,0 +1,49 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile; + +import lombok.Data; + +/** + * @Description + * @title: + * @Date 2020/11/4 16:40 + * @author: zhangTao + */ +@Data +public class ChannelReconciliationFileDTO { + + + private String batchId; + /** + * + */ + private String channel; + /** + * + */ + private String pid; + /** + * + */ + private String billDate; + /** + * + */ + private String billType; + /** + * + */ + private String createTime; + + private String fileId; + + + private String filename; + + private String fileType; + + private String attachId; + /** + * + */ + private String attachUrl; +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileDownloadParameter.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileDownloadParameter.java new file mode 100644 index 000000000..2810248e9 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileDownloadParameter.java @@ -0,0 +1,51 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile; + +import java.util.Date; + +/** + * @Description + * @title: + * @Date 2020/11/16 14:42 + * @author: zhangTao + */ +public class ChannelReconciliationFileDownloadParameter { + private DownloadParameter parameter; + private boolean useCashFlag; + + public ChannelReconciliationFileDownloadParameter(String pid, Date billDate, String channel, boolean isUseCash,String billType) { + this.parameter = new DownloadParameter(pid, billDate, channel,billType); + this.useCashFlag = isUseCash; + } + + public String getChannel() { + return this.parameter.channel; + } + + public boolean isUseCash() { + return this.useCashFlag; + } + + public String pid(){ + return this.parameter.pid; + } + public Date billDate(){ + return this.parameter.billDate; + } + public String billType(){ + return this.parameter.billType; + } + + + private static class DownloadParameter { + private String pid; + private String channel; + private Date billDate; + private String billType; + public DownloadParameter(String pid, Date billDate, String channel,String billType) { + this.pid = pid; + this.billDate = billDate; + this.channel = channel; + this.billType = billType; + } + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileEmptyException.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileEmptyException.java new file mode 100644 index 000000000..bed1072e1 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileEmptyException.java @@ -0,0 +1,15 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile; + +/** + * @Description + * @title: + * @Date 2020/11/12 11:27 + * @author: zhangTao + */ +public class ChannelReconciliationFileEmptyException extends RuntimeException { + + public ChannelReconciliationFileEmptyException() { + super("渠道对账文件查询为空"); + } + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileNameSuffixException.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileNameSuffixException.java new file mode 100644 index 000000000..bdcf5977d --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileNameSuffixException.java @@ -0,0 +1,12 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile; + +/** + * @Description + * @title: + * @Date 2020/11/19 18:35 + * @author: zhangTao + */ +public class ChannelReconciliationFileNameSuffixException extends RuntimeException { + + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileQueryParameter.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileQueryParameter.java new file mode 100644 index 000000000..744f45446 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileQueryParameter.java @@ -0,0 +1,35 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile; + + +import au.com.royalpay.payment.manage.management.channelreconciliationfile.common.TimeRangeAndPageSizeQueryParameter; + +/** + * @Description + * @title: 渠道对账文件查询参数 + * @Date 2020/11/16 11:54 + * @author: zhangTao + */ +public class ChannelReconciliationFileQueryParameter { + + private TimeRangeAndPageSizeQueryParameter timeRangeAndPageSizeQueryParameter; + private String channel; + private String billType; + + public ChannelReconciliationFileQueryParameter(TimeRangeAndPageSizeQueryParameter timeRangeAndPageSizeQueryParameter, String channel ,String billType) { + this.timeRangeAndPageSizeQueryParameter = timeRangeAndPageSizeQueryParameter; + this.channel = channel; + this.billType = billType; + } + + public String getChannel() { + return channel; + } + + public String getBillType() { + return billType; + } + + public TimeRangeAndPageSizeQueryParameter getTimeRangeAndPageSizeQueryParameter() { + return timeRangeAndPageSizeQueryParameter; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileTunnel.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileTunnel.java new file mode 100644 index 000000000..99654c9f4 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/ChannelReconciliationFileTunnel.java @@ -0,0 +1,15 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile; + +import com.github.miemiedev.mybatis.paginator.domain.PageList; + +/** + * @Description + * @title: + * @Date 2020/11/5 16:50 + * @author: zhangTao + */ +public interface ChannelReconciliationFileTunnel { + + PageList list(ChannelReconciliationFileQueryParameter channelReconciliationFileQueryParameter); + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/FileDownloadException.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/FileDownloadException.java new file mode 100644 index 000000000..cbe6c8897 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/FileDownloadException.java @@ -0,0 +1,14 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile; + +/** + * @Description + * @title: + * @Date 2020/11/6 11:24 + * @author: zhangTao + */ +public class FileDownloadException extends RuntimeException { + + public FileDownloadException() { + super("文件下载异常"); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/MultiFileChannelReconciliationException.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/MultiFileChannelReconciliationException.java new file mode 100644 index 000000000..451cb4c92 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/MultiFileChannelReconciliationException.java @@ -0,0 +1,14 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile; + +/** + * @Description + * @title: + * @Date 2020/11/6 11:24 + * @author: zhangTao + */ +public class MultiFileChannelReconciliationException extends RuntimeException { + + public MultiFileChannelReconciliationException() { + super("渠道多文件异常"); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/common/PageSize.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/common/PageSize.java new file mode 100644 index 000000000..8784a4162 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/common/PageSize.java @@ -0,0 +1,29 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile.common; + +/** + * @Description + * @title: + * @Date 2020/11/16 13:36 + * @author: zhangTao + */ +public class PageSize { + + private int page; + protected int rows; + + public PageSize(int page, int rows) { + this.page = page; + this.rows = rows; + } + + public int getPage() { + if (page == 0) { + return 1; + } + return page; + } + + public int getRows() { + return rows; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/common/TimeRange.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/common/TimeRange.java new file mode 100644 index 000000000..4ad8d01ca --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/common/TimeRange.java @@ -0,0 +1,26 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile.common; + +/** + * @Description + * @title: 时间区间 + * @Date 2020/11/16 11:59 + * @author: zhangTao + */ +public class TimeRange { + + private String startTime; + private String endTime; + + public TimeRange(String startTime, String endTime) { + this.startTime = startTime; + this.endTime = endTime; + } + + public String getStartTime() { + return startTime; + } + + public String getEndTime() { + return endTime; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/common/TimeRangeAndPageSizeQueryParameter.java b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/common/TimeRangeAndPageSizeQueryParameter.java new file mode 100644 index 000000000..77187cf86 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/channelreconciliationfile/common/TimeRangeAndPageSizeQueryParameter.java @@ -0,0 +1,26 @@ +package au.com.royalpay.payment.manage.management.channelreconciliationfile.common; + +/** + * @Description + * @title: + * @Date 2020/11/16 13:47 + * @author: zhangTao + */ +public class TimeRangeAndPageSizeQueryParameter { + + private TimeRange timeRange; + private PageSize pageSize; + + public TimeRangeAndPageSizeQueryParameter(TimeRange timeRange, PageSize pageSize) { + this.timeRange = timeRange; + this.pageSize = pageSize; + } + + public TimeRange getTimeRange() { + return timeRange; + } + + public PageSize getPageSize() { + return pageSize; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/beans/TransactionStatus.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/beans/TransactionStatus.java new file mode 100644 index 000000000..9c8a4bc1e --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/beans/TransactionStatus.java @@ -0,0 +1,60 @@ +package au.com.royalpay.payment.manage.management.clearing.beans; + +import com.alibaba.fastjson.annotation.JSONField; + + +/** + * Create by Todking at 2020-12-28 + */ +public class TransactionStatus { + + @JSONField(name = "status") + private Integer status; + + @JSONField(name = "time") + private String time; + + private String statusInfo; + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getStatusInfo() { + return statusInfo; + } + + public void setStatusInfo(String statusInfo) { + this.statusInfo = statusInfo; + } + + public TransactionStatus toSet() { + TransactionStatus transactionStatus = new TransactionStatus(); + switch (status) { + case 0: + transactionStatus.setStatusInfo("Ready To Clear"); + break; + case 1: + transactionStatus.setStatusInfo("Cleared"); + break; + case 2: + transactionStatus.setStatusInfo("Preauthorised"); + break; + } + transactionStatus.setStatus(status); + transactionStatus.setTime(time); + return transactionStatus; + } +} 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 6ee1221d2..b4d478137 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 @@ -1,5 +1,7 @@ package au.com.royalpay.payment.manage.management.clearing.core; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.ChannelReconciliationFileContent; +import au.com.royalpay.payment.manage.management.clearing.beans.TransactionStatus; import au.com.royalpay.payment.manage.support.abafile.ABAFile; import au.com.royalpay.payment.manage.tradelog.beans.ClearingLogQuery; import com.alibaba.fastjson.JSONObject; @@ -109,4 +111,8 @@ public interface CleanService { JSONObject findSettleLog(int clearingId); JSONObject findClearingDetail(int clearingId, String clientMoniker); + + ChannelReconciliationFileContent downloadChannelReconciliationFile(String pid, Date billDate, boolean noCache, String channel, String billType); + + TransactionStatus getTransactionStatus(String transactionId); } 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 7e9a9343b..e6e295462 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 @@ -3,9 +3,15 @@ package au.com.royalpay.payment.manage.management.clearing.core.impl; import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.beans.OrderValidationResult; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; +import au.com.royalpay.payment.core.exceptions.ParamInvalidException; +import au.com.royalpay.payment.core.impls.LogChannelValidationStorage; import au.com.royalpay.payment.core.tasksupport.SettlementSupport; import au.com.royalpay.payment.core.utils.ExtParamsUtils; import au.com.royalpay.payment.core.validation.domain.ChannelValidationTask; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.ChannelReconciliationFile; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.ChannelReconciliationFileContent; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.ChannelReconciliationFileDownloadParameter; +import au.com.royalpay.payment.manage.management.clearing.beans.TransactionStatus; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.mappers.log.*; import au.com.royalpay.payment.manage.mappers.payment.TaskManualSettleMapper; @@ -150,8 +156,13 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider @Resource private ClientIncrementalMapper clientIncrementalMapper; @Resource + private ChannelReconciliationFile channelReconciliationFile; + @Resource private ChannelValidationTask channelValidationTask; + @Resource + private LogChannelValidationStorage logChannelValidationStorage; + @Resource private ClientDeviceMapper clientDeviceMapper; private static final int MAX_TRACK_DAYS = 31; @@ -163,11 +174,14 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider @Override public List listValidatedDays(Date month) { - List reports = validationLogMapper.listValidatedReports(month); - List topReports = new ArrayList<>(); - for (JSONObject report : reports) { + List originOriginReports = validationLogMapper.listValidatedDates(month); + List newReports = logChannelValidationStorage.listMonthReports(month); + Map reports = new TreeMap<>(); + for (JSONObject report : originOriginReports) { JSONObject item = new JSONObject(); - item.put("date", DateFormatUtils.format(report.getDate("valid_date"), "yyyy/MM/dd")); + String dateStr = DateFormatUtils.format(report.getDate("valid_date"), "yyyy/MM/dd"); + item.put("date", dateStr); + item.put("isOld", true); JSONObject result = JSON.parseObject(report.getString("result")); int warningLevel = result.getBooleanValue("valid") ? 0 : 1; if (!result.getJSONArray("not_exists").isEmpty()) { @@ -175,9 +189,18 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } item.put("warning_level", warningLevel); item.put("success", result.getBooleanValue("valid")); - topReports.add(item); + reports.put(dateStr, item); } - return topReports; + for (OrderValidationResult res : newReports) { + JSONObject item = new JSONObject(); + String dateStr = DateFormatUtils.format(res.getTransDate(), "yyyy/MM/dd"); + item.put("date", dateStr); + item.put("isOld", false); + item.put("warning_level", res.getWarningLevel()); + item.put("success", res.getWarningLevel() == OrderValidationResult.LEVEL_SUCCESS); + reports.put(dateStr, item); + } + return new ArrayList<>(reports.values()); } @Override @@ -1692,6 +1715,20 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider .orElseThrow(() -> new NotFoundException("No clearing log found for " + clientMoniker)); } + @Override + public ChannelReconciliationFileContent downloadChannelReconciliationFile(String pid, Date billDate, boolean noCache, String channel, String billType) { + return channelReconciliationFile.download(new ChannelReconciliationFileDownloadParameter(pid, billDate, channel, noCache, billType)); + } + + @Override + public TransactionStatus getTransactionStatus(String transactionId) { + TransactionStatus transactionStatus = transactionMapper.getTransactionStatusById(transactionId); + if (transactionStatus == null) { + throw new ParamInvalidException("date","The transaction was not found"); + } + return transactionStatus.toSet(); + } + private void releaseDistributedSurcharge(JSONObject clearingDetail) { int clientId = clearingDetail.getIntValue("client_id"); BigDecimal distributedSurcharge = clearingDetail.getBigDecimal("distributed_surcharge"); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/FinancialController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/FinancialController.java index 6f259bcbd..dd7de3bc3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/FinancialController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/FinancialController.java @@ -1,23 +1,36 @@ package au.com.royalpay.payment.manage.management.clearing.web; +import au.com.royalpay.payment.core.beans.OrderValidationChannelResult; import au.com.royalpay.payment.core.exceptions.ParamInvalidException; +import au.com.royalpay.payment.core.impls.LogChannelValidationStorage; +import au.com.royalpay.payment.core.validation.domain.ChannelValidationTask; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.ChannelReconciliationFileContent; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.FileDownloadException; +import au.com.royalpay.payment.manage.management.clearing.beans.TransactionStatus; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.CommonConsts; import com.alibaba.fastjson.JSONObject; +import org.apache.commons.codec.Charsets; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; import org.joda.time.DateTime; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; +import java.net.URLEncoder; import java.text.ParseException; import java.util.Date; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * Created by davep on 2016-09-02. @@ -28,6 +41,12 @@ public class FinancialController { @Resource private CleanService cleanService; + @Resource + private LogChannelValidationStorage logChannelValidationStorage; + + @Resource + private ChannelValidationTask channelValidationTask; + @GetMapping("/validated_dates/{month}") public List listMonthValidatedDays(@PathVariable String month) { try { @@ -49,6 +68,70 @@ public class FinancialController { } } + @GetMapping("/order_validation_new/{date}") + public Map> getCheckReportNew(@PathVariable String date) { + try { + Date dt = DateUtils.parseDate(date, "yyyyMMdd"); + List orderValidationChannelResults = logChannelValidationStorage.listDailyLogs(dt); + Map> collect = orderValidationChannelResults.stream().collect(Collectors.groupingBy(e -> e.getChannel().getChannelCode())); + return collect; + } catch (ParseException e) { + throw new ParamInvalidException("date", "error.payment.valid.invalid_date_format"); + } + } + + @PostMapping("/mark/resolve/message") + public void markResolveMessage(@RequestBody JSONObject jsonObject) { + logChannelValidationStorage.markResolveMessage(jsonObject.getString("log_id"), jsonObject.getString("message")); + } + + @PostMapping("/redo_channel_validation/{date}") + public void redoChannelValidation(@PathVariable String date, @RequestBody JSONObject jsonObject) { + try { + Date dt = DateUtils.parseDate(date, "yyyyMMdd"); + channelValidationTask.redoChannelValidation(dt, jsonObject.getString("channel"), jsonObject.getBoolean("cache")); + } catch (ParseException e) { + throw new ParamInvalidException("date", "error.payment.valid.invalid_date_format"); + } + } + + @GetMapping("/get/transaction/status/{transactionId}") + public TransactionStatus getTransactionStatus(@PathVariable String transactionId) { + if(transactionId.isEmpty()){ + throw new ParamInvalidException("date","Transaction flow is empty"); + } + return cleanService.getTransactionStatus(transactionId); + } + + @GetMapping("/downloadChannelReconciliationFile") + public JSONObject downloadChannelReconciliationFile(@RequestParam(value = "pid") String pid, + @RequestParam(value = "billDate") String billDate, + @RequestParam(value = "noCache") boolean noCache, + @RequestParam(value = "billType", required = false) String billType, + @RequestParam(value = "channel") String channel, + HttpServletResponse response) { + ChannelReconciliationFileContent file = cleanService.downloadChannelReconciliationFile(pid, au.com.royalpay.payment.tools.utils.DateUtils.parseDate(billDate) + , noCache, channel, billType); + + + + try (InputStream in = new ByteArrayInputStream(file.content())) { + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(file.name(), Charsets.UTF_8.name())); + response.setContentLength(file.length()); + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + OutputStream out = response.getOutputStream(); + byte[] buff = new byte[1024]; + int n; + while ((n = in.read(buff)) != -1) { + out.write(buff, 0, n); + } + } catch (IOException ex) { + throw new FileDownloadException(); + } + + return null; + } + @GetMapping("/clean_logs") public JSONObject getDailyTransactions(@RequestParam String date, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { try { diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ChannelReconciliationFileTunnelMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ChannelReconciliationFileTunnelMapper.java new file mode 100644 index 000000000..91fbc4899 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ChannelReconciliationFileTunnelMapper.java @@ -0,0 +1,37 @@ +package au.com.royalpay.payment.manage.mappers.log; + + +import au.com.royalpay.payment.manage.management.channelreconciliationfile.ChannelReconciliationFileDTO; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.ChannelReconciliationFileQueryParameter; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.ChannelReconciliationFileTunnel; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.common.PageSize; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.common.TimeRange; +import au.com.royalpay.payment.manage.management.channelreconciliationfile.common.TimeRangeAndPageSizeQueryParameter; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; +import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; + + +/** + * @Description + * @title: + * @Date 2020/11/4 14:25 + * @author: zhangTao + */ +@AutoMapper(tablename = "log_validation_attachment_batches", pkName = "batch_id") +public interface ChannelReconciliationFileTunnelMapper extends ChannelReconciliationFileTunnel { + + + PageList queryChannelReconciliationFile(String billType, String channel, String startTime, String endTime, PageBounds pagination); + + @Override + default PageList list(ChannelReconciliationFileQueryParameter channelReconciliationFileQueryParameter){ + TimeRangeAndPageSizeQueryParameter timeRangeAndPageSizeQueryParameter = channelReconciliationFileQueryParameter.getTimeRangeAndPageSizeQueryParameter(); + TimeRange timeRange = timeRangeAndPageSizeQueryParameter.getTimeRange(); + PageSize pageSize = timeRangeAndPageSizeQueryParameter.getPageSize(); + + String channel = channelReconciliationFileQueryParameter.getChannel(); + String billType = channelReconciliationFileQueryParameter.getBillType(); + return this.queryChannelReconciliationFile(billType,channel, timeRange.getStartTime(), timeRange.getEndTime() , new PageBounds(pageSize.getPage(), pageSize.getRows())); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ValidationLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ValidationLogMapper.java index ac05821b4..ad98d8d2a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ValidationLogMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ValidationLogMapper.java @@ -24,4 +24,6 @@ public interface ValidationLogMapper { JSONObject findByDate(@Param("valid_date") Date validDate); List listValidatedReports(@Param("month") Date month); + + List listValidatedDates(Date month); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java index ee28809df..828a5ca80 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java @@ -1,5 +1,6 @@ package au.com.royalpay.payment.manage.mappers.payment; +import au.com.royalpay.payment.manage.management.clearing.beans.TransactionStatus; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; @@ -167,4 +168,6 @@ public interface TransactionMapper { List getSettleDataDailyReport(@Param("beginTime") Date beginTime,@Param("endTime")Date endTime); List analysisByChannels(@Param("from") Date from, @Param("to") Date to, @Param("channels") List channels); + + TransactionStatus getTransactionStatusById(String transactionId); } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ChannelReconciliationFileTunnelMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ChannelReconciliationFileTunnelMapper.xml new file mode 100644 index 000000000..b192eb741 --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ChannelReconciliationFileTunnelMapper.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ValidationLogMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ValidationLogMapper.xml index a022a7728..c6c49fe1f 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ValidationLogMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ValidationLogMapper.xml @@ -10,4 +10,7 @@ + \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index 9b33ff4cf..c9a4b53ae 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -1490,4 +1490,11 @@ #{channel} group by o.merchant_id + diff --git a/src/main/ui/static/images/alipay_direct_sign.png b/src/main/ui/static/images/alipay_direct_sign.png new file mode 100644 index 000000000..b305234fa Binary files /dev/null and b/src/main/ui/static/images/alipay_direct_sign.png differ diff --git a/src/main/ui/static/images/unionpay_sign.png b/src/main/ui/static/images/unionpay_sign.png new file mode 100644 index 000000000..bb3f6f1de Binary files /dev/null and b/src/main/ui/static/images/unionpay_sign.png differ diff --git a/src/main/ui/static/images/upop_sign.png b/src/main/ui/static/images/upop_sign.png new file mode 100644 index 000000000..56129f5d1 Binary files /dev/null and b/src/main/ui/static/images/upop_sign.png differ diff --git a/src/main/ui/static/payment/validation/order-validation.js b/src/main/ui/static/payment/validation/order-validation.js index 0a66b25cd..fc901dba7 100644 --- a/src/main/ui/static/payment/validation/order-validation.js +++ b/src/main/ui/static/payment/validation/order-validation.js @@ -2,83 +2,297 @@ * Created by davep on 2016-09-01. */ define(['angular', 'uiRouter'], function () { - 'use strict'; - var app = angular.module('orderValidApp', ['ui.router']); - app.config(['$stateProvider', function ($stateProvider) { - $stateProvider.state('order_valid', { - url: '/order_validation', - templateUrl: '/static/payment/validation/templates/valid-calendar.html', - controller: 'orderValidCalendarCtrl' - }).state('order_valid.report', { - url: '/{date}', - templateUrl: '/static/payment/validation/templates/valid.html', - controller: 'orderValidationCtrl' - }); - }]); - app.controller('orderValidCalendarCtrl', ['$scope', '$http', '$filter', function ($scope, $http, $filter) { - $scope.today = new Date(); - $scope.loadValidatedDates = function (month) { - let monthStr = $filter('date')(month, 'yyyyMM'); - $http.get('/sys/financial/validated_dates/' + monthStr).then(function (resp) { - $scope.validatedDates = resp.data; + 'use strict' + var app = angular.module('orderValidApp', ['ui.router']) + app.config([ + '$stateProvider', + function ($stateProvider) { + $stateProvider + .state('order_valid', { + url: '/order_validation', + templateUrl: '/static/payment/validation/templates/valid-calendar.html', + controller: 'orderValidCalendarCtrl', + }) + .state('order_valid.report', { + url: '/{date}', + templateUrl: '/static/payment/validation/templates/valid.html', + controller: 'orderValidationCtrl', + }) + .state('order_valid.report_new', { + url: '/new/{date}', + templateUrl: '/static/payment/validation/templates/valid_new.html', + controller: 'orderValidationNewCtrl', + }) + }, + ]) + app.controller('orderValidCalendarCtrl', [ + '$scope', + '$http', + '$filter', + '$state', + 'commonDialog', + function ($scope, $http, $filter, $state, commonDialog) { + $scope.today = new Date() + $scope.loadValidatedDates = function (month) { + let monthStr = $filter('date')(month, 'yyyyMM') + $http.get('/sys/financial/validated_dates/' + monthStr).then(function (resp) { + $scope.validatedDates = resp.data + }) + } + $scope.findReport = function (dateStr) { + if ($scope.validatedDates == null) { + return null + } + let filtered = $scope.validatedDates.filter(rp => rp.date === dateStr) + return filtered.length ? filtered[0] : null + } + $scope.checkDetail = function (date) { + const filterItem = $scope.validatedDates.filter(rp => rp.date === date) + const dateStr = date.replace(/\//g, '') + if (filterItem.length) { + if (filterItem[0].isOld) { + $state.go('order_valid.report', { date: dateStr }) + } else { + sessionStorage.setItem('warningLevel', filterItem[0].warning_level) + $state.go('order_valid.report_new', { date: dateStr }) + } + } else { + commonDialog + .confirm({ + title: 'Confirm', + content: '是否确认重新执行对账?', + }) + .then(function () { + $http + .get('/sys/financial/order_validations/' + dateStr, { + params: { + use_cache: false, + }, + timeout: 300000, + }) + .then( + function () { + $state.reload() + }, + function (resp) { + $state.reload() + } + ) }) - }; - $scope.findReport = function (dateStr) { - if ($scope.validatedDates == null) { - return null; - } - let filtered = $scope.validatedDates.filter(rp => rp.date === dateStr); - return filtered.length ? filtered[0] : null } - }]); - app.controller('orderValidationCtrl', ['$scope', '$http', '$filter', '$stateParams', 'commonDialog', - function ($scope, $http, $filter, $stateParams, commonDialog) { - $scope.date = $stateParams.date; - $scope.startValid = function (forceRebuild) { - $scope.report = {loading: true}; - $http.get('/sys/financial/order_validations/' + $scope.date, { - params: { - use_cache: !forceRebuild - }, - timeout: 300000 - }).then(function (resp) { - $scope.report = resp.data; - $scope.notExistsKeys = []; - $scope.notEqualsKeys = []; - angular.forEach($scope.report.not_exists, function (item) { - angular.forEach(item, function (val, key) { - if ($scope.notExistsKeys.indexOf(key) < 0) { - $scope.notExistsKeys.push(key); - } - }) - }); - angular.forEach($scope.report.not_equals, function (item) { - angular.forEach(item, function (val, key) { - if ($scope.notExistsKeys.indexOf(key) < 0) { - $scope.notExistsKeys.push(key); - } - }) - }); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - $scope.report = null; + } + }, + ]) + // old + app.controller('orderValidationCtrl', [ + '$scope', + '$http', + '$filter', + '$stateParams', + 'commonDialog', + function ($scope, $http, $filter, $stateParams, commonDialog) { + $scope.date = $stateParams.date + $scope.startValid = function (forceRebuild) { + $scope.report = { loading: true } + $http + .get('/sys/financial/order_validations/' + $scope.date, { + params: { + use_cache: !forceRebuild, + }, + timeout: 300000, + }) + .then( + function (resp) { + $scope.report = resp.data + $scope.notExistsKeys = [] + $scope.notEqualsKeys = [] + angular.forEach($scope.report.not_exists, function (item) { + angular.forEach(item, function (val, key) { + if ($scope.notExistsKeys.indexOf(key) < 0) { + $scope.notExistsKeys.push(key) + } + }) + }) + angular.forEach($scope.report.not_equals, function (item) { + angular.forEach(item, function (val, key) { + if ($scope.notExistsKeys.indexOf(key) < 0) { + $scope.notExistsKeys.push(key) + } }) - }; - $scope.startValid(false); + }) + }, + function (resp) { + commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) + $scope.report = null + } + ) + } + $scope.startValid(false) - $scope.fixReport = function () { - var datePattern = $filter('date')($scope.valid.date, 'yyyyMMdd'); - $http.get('/sys/financial/order_validations', { - params: { - date: datePattern, - fix: true - } - }).then(function (resp) { - commonDialog.alert({title: 'Success', content: '修复完毕', type: 'success'}) - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + $scope.fixReport = function () { + var datePattern = $filter('date')($scope.valid.date, 'yyyyMMdd') + $http + .get('/sys/financial/order_validations', { + params: { + date: datePattern, + fix: true, + }, + }) + .then( + function (resp) { + commonDialog.alert({ title: 'Success', content: '修复完毕', type: 'success' }) + }, + function (resp) { + commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) + } + ) + } + }, + ]) + // new + app.controller('orderValidationNewCtrl', [ + '$scope', + '$http', + '$stateParams', + 'commonDialog', + '$uibModal', + function ($scope, $http, $stateParams, commonDialog, $uibModal) { + // 清除sessionStorage + $scope.$on('$destroy', function () { + sessionStorage.clear() + }) + $scope.date = angular.copy($stateParams.date) + $scope.date = $scope.date.substr(0, 4) + '-' + $scope.date.substr(4, 2) + '-' + $scope.date.substr(6) + $scope.warningLevel = JSON.parse(sessionStorage.getItem('warningLevel')) + // 加载渠道信息 + $scope.startValid = function () { + $http + .get('/sys/financial/order_validation_new/' + $stateParams.date, { + timeout: 300000, + }) + .then( + function (resp) { + $scope.channelList = [] + for (let key in resp.data) { + const obj = {} + obj.key = key + obj.channel = resp.data[key] + obj.selected = false + $scope.channelList.push(obj) + } + $scope.channelList.map(item => { + const arr = item.channel.filter(f => { + return f.success === false + }) + item.status = arr.length ? 'FAILED' : 'SUCCESS' + item.success = arr.length ? false : true + }) + if (sessionStorage.getItem('channel')) { + const channel = JSON.parse(sessionStorage.getItem('channel')) + channel.map(item => { + $scope.channelList.filter(f => f.key === item.key)[0].selected = item.selected }) + } else { + $scope.channelList[0].selected = true + } + console.log($scope.channelList) + }, + function (resp) { + commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) } - }]); - return app; -}); \ No newline at end of file + ) + } + $scope.startValid() + // 受否折叠 + $scope.fold = function (index) { + $scope.channelList[index].selected = !$scope.channelList[index].selected + } + // 是否清除缓存 + $scope.clear = function (channelName, flag) { + $http.post('/sys/financial/redo_channel_validation/' + $stateParams.date, { channel: channelName, cache: flag }).then( + function () { + $scope.startValid() + }, + function (resp) { + commonDialog.alert({ title: 'failed', content: resp.data.message, type: 'error' }) + } + ) + } + // 处理 + $scope.handle = function (merchant) { + sessionStorage.setItem('channel', JSON.stringify($scope.channelList)) + $uibModal + .open({ + templateUrl: '/static/payment/validation/templates/handle_desc.html', + controller: [ + '$scope', + '$http', + 'commonDialog', + 'merchantInfo', + function ($scope, $http, commonDialog, merchantInfo) { + if (merchantInfo.resolve_msg) { + $scope.message = merchantInfo.resolve_msg + } + $scope.confirm = function () { + $http.post('/sys/financial/mark/resolve/message', { log_id: merchantInfo.log_id, message: $scope.message }).then( + function () { + $scope.$close() + }, + function (resp) { + commonDialog.alert({ title: 'failed', content: resp.data.message, type: 'error' }) + } + ) + } + }, + ], + resolve: { + merchantInfo: [ + '$stateParams', + function () { + return merchant + }, + ], + }, + }) + .result.then(function () { + $scope.startValid() + }) + } + // 下载 + $scope.download = function (merchant, keyName) { + if (merchant != null) { + const params = {} + params.channel = keyName + params.pid = merchant.pid + params.billDate = merchant.bill_date + params.noCache = false + params.billType = '' + window.open( + '/sys/financial/downloadChannelReconciliationFile?billDate=' + + params.billDate + + '&channel=' + + params.channel + + '&noCache=' + + params.noCache + + '&pid=' + + params.pid + + '&billType=' + + params.billType + ) + } + } + // 查看what + $scope.checkStatus = function (transactionId) { + $http.get('/sys/financial/get/transaction/status/' + transactionId, {}).then( + function (resp) { + commonDialog.alert({ title: resp.data.statusInfo, content: '', type: 'success' }) + }, + function (resp) { + commonDialog.alert({ title: 'failed', content: resp.data.message, type: 'error' }) + } + ) + } + }, + ]) + return app +}) diff --git a/src/main/ui/static/payment/validation/templates/handle_desc.html b/src/main/ui/static/payment/validation/templates/handle_desc.html new file mode 100644 index 000000000..4c226da3b --- /dev/null +++ b/src/main/ui/static/payment/validation/templates/handle_desc.html @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/src/main/ui/static/payment/validation/templates/valid-calendar.html b/src/main/ui/static/payment/validation/templates/valid-calendar.html index 232e60798..f7e6b4970 100644 --- a/src/main/ui/static/payment/validation/templates/valid-calendar.html +++ b/src/main/ui/static/payment/validation/templates/valid-calendar.html @@ -7,19 +7,35 @@
-
+
+
+ +  All channel transactions are reconciled successfully. +
+
+ + Yellow warning: There are some abnormal orders in a channel in the transaction reconciliation + result, such as the difference between the amount of an order in the system and the bill amount + of the corresponding channel. +
+
+ + There are some missing orders in a channel in the result of the transaction reconciliation, + for example, by comparing the statement of a channel, it is found that the payment order was not + found in the system on the same day. +
+
-
\ No newline at end of file diff --git a/src/main/ui/static/payment/validation/templates/valid_new.html b/src/main/ui/static/payment/validation/templates/valid_new.html new file mode 100644 index 000000000..38246adf3 --- /dev/null +++ b/src/main/ui/static/payment/validation/templates/valid_new.html @@ -0,0 +1,278 @@ +
+ +
+
+

{{date}}

+ + + +
+
+
+
+
+
+ + + + + + + + +

{{item.key}}

+
+
Status: {{item.status}} + + (UpdateTime : {{item.channel[0].valid_time}}) +
+
+ Revalidate + + clear + cache +
+
+
+
+
+

{{merchant.pid}}: + (Transaction Time Range : + {{merchant.valid_from_time}} ~ {{merchant.valid_to_time}}) +

+ handle +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Payment Amount in Local CurrencyPayment Transactions NumberRefund Amount in Local CurrencyRefund Transactions NumberTotal Payment NumberTotal Refund Number
+ + {{merchant.channel_analysis.total_paid || merchant.channel_analysis.total_paid + === 0 ? merchant.channel_analysis.total_paid : '-'}} + + {{merchant.channel_analysis.pay_count || merchant.channel_analysis.pay_count === + 0 ? merchant.channel_analysis.pay_count : '-'}} + + {{merchant.channel_analysis.total_refund || + merchant.channel_analysis.total_refund === 0 ? + merchant.channel_analysis.total_refund : '-'}} + + {{merchant.channel_analysis.refund_count || + merchant.channel_analysis.refund_count === 0 ? + merchant.channel_analysis.refund_count : '-'}} + + {{merchant.channel_analysis.total_paid_number || + merchant.channel_analysis.total_paid_number === 0 ? + merchant.channel_analysis.total_paid_number : '-'}} + + {{merchant.channel_analysis.total_refund_number || + merchant.channel_analysis.total_refund_number === 0 ? + merchant.channel_analysis.total_refund_number : '-'}} +
+ {{merchant.db_analysis.total_paid || merchant.db_analysis.total_paid === 0 ? + merchant.db_analysis.total_paid : '-'}} + + {{merchant.db_analysis.pay_count || merchant.db_analysis.pay_count === 0 ? + merchant.db_analysis.pay_count : '-'}} + + {{merchant.db_analysis.total_refund || merchant.db_analysis.total_refund === 0 ? + merchant.db_analysis.total_refund : '-'}} + + {{merchant.db_analysis.refund_count || merchant.db_analysis.refund_count === 0 ? + merchant.db_analysis.refund_count : '-'}} + + {{merchant.db_analysis.total_paid_number || + merchant.db_analysis.total_paid_number === 0 ? + merchant.db_analysis.total_paid_number : '-'}} + + {{merchant.db_analysis.total_refund_number || + merchant.db_analysis.total_refund_number === 0 ? + merchant.db_analysis.total_refund_number : '-'}} +
+ download +
+
+

Not Exists Transactions

+
+ + + + + + + + + + + + + + + + + + + + + + + +
Missing TypeTransaction TimeTransaction IDOrder IDTransaction TypeTransaction AmountOperation
{{ notExist.missing_side ? notExist.missing_side : '-' }}{{ notExist.transaction_time ? notExist.transaction_time : '-' }} + {{ notExist.channel_trans_id ? notExist.channel_trans_id : '-' }} + {{ notExist.order_id ? notExist.order_id : '-' }}{{ notExist.trans_type ? notExist.trans_type : '-' }}{{ notExist.amount || notExist.amount === 0 ? notExist.amount : '-' + }} + + + - + +
+
+
+ +
+

Not Equals Transactions

+
+ + + + + + + + + + + + + + + + + + + + + +
Transaction TimeTransaction IDOrder IDTransaction TypeTransaction AmountOperation
{{notEqual.trans_time ? notEqual.trans_time : '-'}}{{notEqual.transaction_id ? notEqual.transaction_id : '-'}}{{notEqual.order_id ? notEqual.order_id : '-'}}{{notEqual.trans_type ? notEqual.trans_type : '-'}}{{notEqual.channel_amount || notEqual.channel_amount === 0 ? + notEqual.channel_amount : '-'}} + + - + +
+
+
+
+
Handle Description:
+
{{ merchant.resolve_msg }}
+
+
+
+
+
+ + +
+ \ No newline at end of file