Merge branch 'develop'

# Conflicts:
#	src/main/java/au/com/royalpay/payment/manage/system/core/impl/TradeSecureServiceHanyinImpl.java
#	src/main/ui/static/payment/partner/templates/partner_edit.html
master
yangkai 6 years ago
commit 471d88614f

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId> <artifactId>payment-parent</artifactId>
<version>0.2.0</version> <version>0.2.0-dev</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

@ -20,9 +20,9 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService {
@Override @Override
public List<JSONObject> getChannelMount(JSONObject params) { public List<JSONObject> getChannelMount(JSONObject params) {
if (!params.containsKey("client_ids") && !params.containsKey("org_id")){ /*if (!params.containsKey("client_ids") && !params.containsKey("org_id")){
params.put("client_id",0); params.put("client_id",0);
} }*/
List<JSONObject> listChannel = new ArrayList<>(); List<JSONObject> listChannel = new ArrayList<>();
listChannel.add(putParam(params,"Wechat")); listChannel.add(putParam(params,"Wechat"));
listChannel.add(putParam(params,"Bestpay")); listChannel.add(putParam(params,"Bestpay"));
@ -86,6 +86,18 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService {
obj.put("total",count.getIntValue("total")); obj.put("total",count.getIntValue("total"));
obj.put("order",count.getIntValue("orders")); obj.put("order",count.getIntValue("orders"));
obj.put("channel",name); obj.put("channel",name);
obj.put("transaction_partners",count.getIntValue("transaction_partners"));
int enablePartners = 0;
if ("AlipayOnline".equals(name)) {
params.put("gateway_alipay_online", 1);
enablePartners = customerAndOrdersStatisticsMapper.countEnableChannel(params);
params.remove("gateway_alipay_online");
} else {
params.put("enable_" + name.toLowerCase(), 1);
enablePartners = customerAndOrdersStatisticsMapper.countEnableChannel(params);
params.remove("enable_" + name.toLowerCase());
}
obj.put("enable_partners", enablePartners);
return obj; return obj;
} }
} }

@ -61,4 +61,6 @@ public interface CustomerAndOrdersStatisticsMapper {
int countTotalCustomers(JSONObject params); int countTotalCustomers(JSONObject params);
int countTotalOldCustomers(JSONObject params); int countTotalOldCustomers(JSONObject params);
int countEnableChannel(JSONObject params);
} }

@ -21,4 +21,7 @@ public interface SysChannelConfigMapper {
@Param(value = "last_update_by")String lastUpdateBy, @Param(value = "is_valid") boolean is_valid); @Param(value = "last_update_by")String lastUpdateBy, @Param(value = "is_valid") boolean is_valid);
JSONObject findOne(@Param(value = "type") int type); JSONObject findOne(@Param(value = "type") int type);
@AutoSql(type = SqlType.SELECT)
JSONObject selectByChannelId (@Param(value = "channel_id") String channel_id);
} }

@ -380,4 +380,6 @@ public interface ClientManager {
String cbBankPayLink(String clientMoniker); String cbBankPayLink(String clientMoniker);
void switchPaymentConfigPC(String clientMoniker, HttpServletResponse response) throws IOException; void switchPaymentConfigPC(String clientMoniker, HttpServletResponse response) throws IOException;
void partnerCBChannelConfig(String clientMoniker, String channelKey, String channel_id);
} }

@ -4314,6 +4314,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (paymentConfig == null) { if (paymentConfig == null) {
throw new BadRequestException("服务商未开启快捷支付"); throw new BadRequestException("服务商未开启快捷支付");
} }
if (client.getString("cb_channel_id") != null) {
JSONObject channelConfig = sysChannelConfigMapper.selectByChannelId(client.getString("cb_channel_id"));
if (channelConfig != null) {
paymentConfig = channelConfig;
}
}
response.sendRedirect(String.format(PlatformEnvironment.getEnv().concatUrl(paymentConfig.getString("path")), clientMoniker)); response.sendRedirect(String.format(PlatformEnvironment.getEnv().concatUrl(paymentConfig.getString("path")), clientMoniker));
} }
@ -4346,6 +4352,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (paymentConfig == null) { if (paymentConfig == null) {
throw new BadRequestException("服务商未开启快捷支付"); throw new BadRequestException("服务商未开启快捷支付");
} }
if (client.getString("cb_channel_id") != null) {
JSONObject channelConfig = sysChannelConfigMapper.selectByChannelId(client.getString("cb_channel_id"));
if (channelConfig != null) {
paymentConfig = channelConfig;
}
}
return String.format(PlatformEnvironment.getEnv().concatUrl(paymentConfig.getString("path")), clientMoniker); return String.format(PlatformEnvironment.getEnv().concatUrl(paymentConfig.getString("path")), clientMoniker);
} }
@ -4359,11 +4371,35 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (paymentConfig == null) { if (paymentConfig == null) {
throw new BadRequestException("服务商未开启快捷支付"); throw new BadRequestException("服务商未开启快捷支付");
} }
if (client.getString("cb_channel_id") != null) {
JSONObject channelConfig = sysChannelConfigMapper.selectByChannelId(client.getString("cb_channel_id"));
if (channelConfig != null) {
paymentConfig = channelConfig;
}
}
String path = paymentConfig.getString("path"); String path = paymentConfig.getString("path");
path = path.replaceAll("app","pc"); path = path.replaceAll("app","pc");
response.sendRedirect(String.format(PlatformEnvironment.getEnv().concatUrl(path), clientMoniker)); response.sendRedirect(String.format(PlatformEnvironment.getEnv().concatUrl(path), clientMoniker));
} }
@Override
public void partnerCBChannelConfig(String clientMoniker, String channelKey, String channel_id) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) {
throw new BadRequestException("partner code is not exists!");
}
if (StringUtils.isNotEmpty(channel_id)) {
JSONObject cbBankConfig = sysChannelConfigMapper.selectByChannelId(channel_id);
if (cbBankConfig == null) {
throw new BadRequestException("不存在该支付渠道");
}
}
JSONObject updateClient = new JSONObject();
updateClient.put("client_id", client.getIntValue("client_id"));
updateClient.put(channelKey, channel_id);
clientMapper.update(updateClient);
}
private TemplateMessage initClientMessage(JSONObject client, String newExpiryDate, String wechatOpenid, String templateId) { private TemplateMessage initClientMessage(JSONObject client, String newExpiryDate, String wechatOpenid, String templateId) {
TemplateMessage notice = new TemplateMessage(wechatOpenid, templateId, null); TemplateMessage notice = new TemplateMessage(wechatOpenid, templateId, null);
notice.put("first", "您好您的合同费率已到期根据合同协议系统已自动为您延期1年。", "#ff0000"); notice.put("first", "您好您的合同费率已到期根据合同协议系统已自动为您延期1年。", "#ff0000");

@ -646,4 +646,16 @@ public class PartnerManageController {
public void switchPaymentWayPC(@PathVariable String clientMoniker, HttpServletResponse response) throws IOException { public void switchPaymentWayPC(@PathVariable String clientMoniker, HttpServletResponse response) throws IOException {
clientManager.switchPaymentConfigPC(clientMoniker, response); clientManager.switchPaymentConfigPC(clientMoniker, response);
} }
/**
*
* @param clientMoniker
* @param channelKey
* @throws IOException
*/
@ManagerMapping(value = "/{clientMoniker}/cb_bankpay/{channelKey}/channel_id", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void switchPartnerCBChannelConfig(@PathVariable String clientMoniker, @PathVariable String channelKey, @RequestBody JSONObject channel) {
clientManager.partnerCBChannelConfig(clientMoniker, channelKey, channel.getString("channel_id"));
}
} }

@ -52,4 +52,6 @@ public interface TradeLogService {
PageList<JSONObject> listPreRefundClients(PreRefundQueryBean params); PageList<JSONObject> listPreRefundClients(PreRefundQueryBean params);
void exportSettlementLog(TradeLogQuery query, JSONObject partner, HttpServletResponse response); void exportSettlementLog(TradeLogQuery query, JSONObject partner, HttpServletResponse response);
void exportPDFSettlement(TradeLogQuery query, JSONObject partner, HttpServletResponse response);
} }

@ -156,6 +156,8 @@ public class TradeLogServiceImpl implements TradeLogService {
private org.springframework.core.io.Resource trans_excel; private org.springframework.core.io.Resource trans_excel;
@Value("classpath:/jasper/austrac_report.jasper") @Value("classpath:/jasper/austrac_report.jasper")
private org.springframework.core.io.Resource austrac_report; private org.springframework.core.io.Resource austrac_report;
@Value("classpath:/jasper/partner_settlement_detail.jasper")
private org.springframework.core.io.Resource partner_settlement_flow;
@Override @Override
public JSONObject listPartnerTradeLogs(JSONObject manager, JSONObject account, String shortId, TradeLogQuery query, String timezone) throws Exception { public JSONObject listPartnerTradeLogs(JSONObject manager, JSONObject account, String shortId, TradeLogQuery query, String timezone) throws Exception {
@ -670,64 +672,99 @@ public class TradeLogServiceImpl implements TradeLogService {
} }
@Override @Override
public void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { public void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse resp) throws Exception {
logger.debug("excel The method======= exportExcel() start......................."); logger.debug("excel The method======= exportExcel() start.......................");
JSONObject transFlow = listPartnerTransFlow(query, partner); JSONObject transFlow = listPartnerTransFlow(query, partner);
// JSONObject analysis = transFlow.getJSONObject("analysis"); // JSONObject analysis = transFlow.getJSONObject("analysis");
if (transFlow.getJSONArray("data").size() > 0) { if (transFlow.getJSONArray("data").size() > 0) {
OutputStream ous = null;
try { try {
List<JSONObject> dataList = (List<JSONObject>) transFlow.get("data"); List<JSONObject> dataList = (List<JSONObject>) transFlow.get("data");
String transType; String transType;
JSONObject device; JSONObject device;
int status; int status;
for (JSONObject data : dataList) { resp.setContentType("application/octet-stream;");
transType = data.getString("trans_type"); resp.addHeader("Content-Disposition",
if (!"refund".equals(transType)) "attachment; filename=" + "Merchant_Settlement_Info_" + query.getDatefrom() + "_" + query.getDateto() + ".xlsx");
continue; ous = resp.getOutputStream();
status = data.getIntValue("status"); Workbook wb = new XSSFWorkbook();
if (status == 6) Font font = wb.createFont();
transType = "Partly " + transType; font.setBoldweight(Font.BOLDWEIGHT_BOLD);
else if (status == 7) { font.setFontHeightInPoints((short) 10);
transType = "Fully " + transType; CellStyle analysisStyle = wb.createCellStyle();
analysisStyle.setFont(font);
String[] clientIds = query.getClient_ids();
List<String> clientIdList = new ArrayList<>();
clientIdList.add("ALL");
if (clientIds.length >= 2) {
clientIdList.addAll(Arrays.asList(clientIds));
}
Sheet sheet = null;
JSONObject client = null;
for (int i = 0;i < clientIdList.size();i++) {
if (i == 0) {
sheet = wb.createSheet("ALL");
} else {
client = clientManager.getClientInfo(Integer.parseInt(clientIdList.get(i)));
sheet = wb.createSheet(client == null ? clientIdList.get(i) : client.getString("client_moniker"));
}
int rowNum = 0;
Row row = sheet.createRow(rowNum);
String[] title = {"Transaction Time", "Client Order ID", "System Order ID", "Client Moniker", "Short Name", "Order ID", "Channel", "Input Amount", "Transaction Amount", "Transaction Currency", "Clearing Amount", "Exchange Rate",
"Transaction Type", "Clearing Status", "Gateway", "Remark", "Dev No"};
for (int j = 0; j < title.length; j++) {
row.createCell(j, Cell.CELL_TYPE_STRING).setCellValue(title[j]);
}
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
for (JSONObject data : dataList) {
if (!clientIdList.get(i).equals(data.getString("client_id")) && i != 0) {
continue;
}
if (i == 0) {
transType = data.getString("trans_type");
if (!"refund".equals(transType)) {
status = data.getIntValue("status");
if (status == 6)
transType = "Partly " + transType;
else if (status == 7) {
transType = "Fully " + transType;
}
}
data.put("trans_type", transType);
device = clientDeviceMapper.find(data.getString("order_dev_id"));
if (device != null)
data.put("dev_id", device.getString("client_dev_id"));
scaleDecimalVal(data, "display_amount", platformCurrency);
scaleDecimalVal(data, "transaction_amount", platformCurrency);
scaleDecimalVal(data, "clearing_amount", platformCurrency);
}
row = sheet.createRow(++rowNum);
row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(data.getString("transaction_time"));
row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(data.getString("client_order_id"));
row.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(data.getString("system_transaction_id"));
row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(data.getString("client_moniker"));
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(data.getString("short_name"));
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(data.getString("order_id"));
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(data.getString("channel"));
row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(data.getString("display_amount"));
row.createCell(8, Cell.CELL_TYPE_STRING).setCellValue(data.getString("transaction_amount"));
row.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(data.getString("currency"));
row.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(data.getString("clearing_amount"));
row.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(data.getString("trans_type").equals("clearing")?"-":data.getBigDecimal("exchange_rate").toString());
row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(data.getString("trans_type"));
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(data.getString("clear_status"));
row.createCell(14, Cell.CELL_TYPE_STRING).setCellValue(data.getString("gateway"));
row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(data.getString("order_detail"));
row.createCell(16, Cell.CELL_TYPE_STRING).setCellValue(data.getString("dev_id"));
} }
data.put("trans_type", transType);
device = clientDeviceMapper.find(data.getString("order_dev_id"));
if (device != null)
data.put("dev_id", device.getString("client_dev_id"));
} }
JSONObject parmerters = new JSONObject(); wb.write(ous);
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom()) ? query.getDatefrom() : ""); ous.flush();
parmerters.put("dateTo", StringUtils.isNotBlank(query.getDateto()) ? query.getDateto() : DateFormatUtils.format(new Date(), "yyyyMMdd")); } catch (IOException e) {
parmerters.put("partnerCode", partner.getString("client_moniker"));
// parmerters.put("actual_fee", analysis.containsKey("actual_fee") ?
// analysis.getBigDecimal("actual_fee") : 0);
JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList);
response.setContentType("application/vnd.ms-excel");
String fileName = StringUtils.isEmpty(parmerters.getString("dateFrom")) ? parmerters.getString("dateTo")
: (parmerters.getString("dateFrom") + "~" + parmerters.getString("dateTo"));
// String fileName = new String(URLEncoder.encode(defaultname,"utf8"));
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
OutputStream outputStream = response.getOutputStream();
JasperPrint jasperPrint = JasperFillManager.fillReport(trans_excel.getInputStream(), parmerters, jrDataSource);
// JRXlsExporter exporter = new JRXlsExporter();
JRXlsxExporter exporter = new JRXlsxExporter();
ExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
exporter.setExporterInput(exporterInput);
OutputStreamExporterOutput exporterOutput = new SimpleOutputStreamExporterOutput(outputStream);
exporter.setExporterOutput(exporterOutput);
// 设置导出时参数
SimpleXlsxReportConfiguration xlsReportConfiguration = new SimpleXlsxReportConfiguration();
xlsReportConfiguration.setOnePagePerSheet(false);
xlsReportConfiguration.setRemoveEmptySpaceBetweenRows(true);
xlsReportConfiguration.setDetectCellType(true);
xlsReportConfiguration.setWhitePageBackground(false);
exporter.setConfiguration(xlsReportConfiguration);
exporter.exportReport();
outputStream.close();
} catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
IOUtils.closeQuietly(ous);
} }
} }
} }
@ -1246,7 +1283,7 @@ public class TradeLogServiceImpl implements TradeLogService {
row.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("rate") == null? "": settle.getBigDecimal("rate").toPlainString() + "%"); row.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("rate") == null? "": settle.getBigDecimal("rate").toPlainString() + "%");
row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("settle_amount") == null ? "" row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("settle_amount") == null ? ""
: settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); : settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("order_detail")); row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("remark"));
device = clientDeviceMapper.find(settle.getString("dev_id")); device = clientDeviceMapper.find(settle.getString("dev_id"));
if (device != null) if (device != null)
clientDevId = device.getString("client_dev_id"); clientDevId = device.getString("client_dev_id");
@ -1273,4 +1310,54 @@ public class TradeLogServiceImpl implements TradeLogService {
IOUtils.closeQuietly(ous); IOUtils.closeQuietly(ous);
} }
} }
@Override
public void exportPDFSettlement(TradeLogQuery query, JSONObject partner, HttpServletResponse response) {
int client_id = partner.getIntValue("client_id");
String begin = query.getDatefrom() == null ?"":query.getDatefrom();
String end = query.getDateto() == null ?"":query.getDateto();
JSONObject client = partner.getJSONObject("client");
String timezone = client.getString("timezone");
JSONObject params = query.toParams(timezone);
params.put("client_id", client_id);
List<JSONObject> clientOrderList = transactionMapper.getClientOrderByTransactionTime(params);
List<Integer> clientOrders = new ArrayList<>(clientOrderList.size());
clientOrderList.parallelStream().forEach(p->{
clientOrders.add(p.getInteger("clearing_order"));
});
List<JSONObject> settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders, client_id);
TimeZoneUtils.switchTimeZoneToString(settlementLogDetailList, timezone, "yyyy-MM-dd HH:mm:ss", Arrays.asList("transaction_time"));
try {
JSONObject parmerters = new JSONObject();
parmerters.put("dateRange", "(Statement Period " + begin + "~"
+ end + ")");
parmerters.put("clientName", client.getString("company_name"));
parmerters.put("clientAddress", client.getString("address"));
parmerters.put("clientLocation", client.getString("suburb") + "," + client.getString("state") + "," + client.getString("postcode"));
parmerters.put("logo", logo.getInputStream());
settlementLogDetailList.parallelStream().forEach(item -> {
scaleDecimalVal(item, "display_amount", item.getString("transaction_currency"));
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
scaleDecimalVal(item, "clearing_amount", platformCurrency);
scaleDecimalVal(item, "settle_amount", platformCurrency);
scaleDecimalVal(item, "total_surcharge", platformCurrency);
scaleDecimalVal(item, "transaction_amount", platformCurrency);
item.put("exchange_rate", item.getBigDecimal("exchange_rate").setScale(5, BigDecimal.ROUND_DOWN));
item.put("gateway" , item.getInteger("gateway") == null ? "-" : TradeType.fromGatewayNumber(item.getIntValue("gateway")).getTradeType());
item.put("rate", item.getBigDecimal("rate") == null? "-": item.getBigDecimal("rate").toPlainString() + "%");
});
JRDataSource jrDataSource = new JRBeanCollectionDataSource(settlementLogDetailList);
response.setContentType("application/pdf");
String fileName = partner.getString("client_moniker") + "_" + parmerters.getString("dateRange").replaceAll("/", "");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
OutputStream outs = response.getOutputStream();
byte[] bytes = JasperRunManager.runReportToPdf(partner_settlement_flow.getInputStream(), parmerters, jrDataSource);
outs.write(bytes, 0, bytes.length);
outs.flush();
outs.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} }

@ -65,4 +65,10 @@ public class TradeFlowController {
tradeLogService.exportSettlementLog(query, partner, response); tradeLogService.exportSettlementLog(query, partner, response);
} }
@PartnerMapping(value = "/settlement/log/pdf",method = RequestMethod.GET)
@ResponseBody
public void exportLogPDF(TradeLogQuery query, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, HttpServletResponse response) {
tradeLogService.exportPDFSettlement(query, partner, response);
}
} }

@ -275,10 +275,12 @@
SELECT SELECT
ifnull(sum(s.orders),0) orders, ifnull(sum(s.orders),0) orders,
ifnull(sum(s.total),0) total, ifnull(sum(s.total),0) total,
ifnull(sum(s.single_amount),0) single_amount ifnull(sum(s.single_amount),0) single_amount,
ifnull(count(distinct s.client_id), 0) transaction_partners
FROM statistics_customer_order s FROM statistics_customer_order s
LEFT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1 LEFT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1
<where> <where>
AND s.client_id != 0
<if test="client_ids!=null"> <if test="client_ids!=null">
AND s.client_id IN AND s.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id"> <foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
@ -566,4 +568,50 @@
</if> </if>
</where> </where>
</select> </select>
<select id="countEnableChannel" resultType="java.lang.Integer">
<![CDATA[
SELECT
IFNULL(
COUNT(DISTINCT c.client_id),
0
) count
FROM
sys_clients c
INNER JOIN sys_client_config cc ON cc.client_id = c.client_id
INNER JOIN sys_org o ON o.org_id = c.org_id
WHERE
c.open_status = 5
AND c.approve_result = 1
AND c.approve_time IS NOT NULL
]]>
<if test="client_ids!=null">
AND c.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null and client_id != null">
and c.client_id=#{client_id}
</if>
<if test="gateway_alipay_online!=null">and cc.gateway_alipay_online = #{gateway_alipay_online}</if>
<if test="enable_wechat!=null">and cc.enable_wechat = #{enable_wechat}</if>
<if test="enable_alipay!=null">and cc.enable_alipay = #{enable_alipay}</if>
<if test="enable_bestpay!=null">and cc.enable_bestpay = #{enable_bestpay}</if>
<if test="enable_jd!=null">and cc.enable_jd = #{enable_jd}</if>
<if test="enable_hf!=null">and cc.enable_hf = #{enable_hf}</if>
<if test="enable_rpay!=null">and cc.enable_rpay = #{enable_rpay}</if>
<if test="enable_yeepay!=null">and cc.enable_yeepay = #{enable_yeepay}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now())
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if>
)
</if>
</select>
</mapper> </mapper>

@ -58,6 +58,8 @@
<select id="listTransFlow" resultType="com.alibaba.fastjson.JSONObject"> <select id="listTransFlow" resultType="com.alibaba.fastjson.JSONObject">
SELECT t.*, SELECT t.*,
o.status, o.status,
c.client_moniker,
c.short_name,
o.dev_id order_dev_id, o.dev_id order_dev_id,
ifnull(o.client_order_id,'--') client_order_id, ifnull(o.client_order_id,'--') client_order_id,
if(t.channel='Settlement','clearing', if(t.channel='Settlement','clearing',
@ -109,6 +111,7 @@
FROM pmt_transactions t FROM pmt_transactions t
LEFT JOIN pmt_orders o ON o.order_id=t.order_id LEFT JOIN pmt_orders o ON o.order_id=t.order_id
left join sys_customer_relation_alipay ra on ra.alipay_uid = o.customer_id left join sys_customer_relation_alipay ra on ra.alipay_uid = o.customer_id
LEFT JOIN sys_clients c on c.client_id = t.client_id
<where> <where>
<if test="client_ids!=null"> <if test="client_ids!=null">
AND t.client_id IN AND t.client_id IN

@ -131,6 +131,8 @@
<th>Channels</th> <th>Channels</th>
<th>Total Amount (AUD)</th> <th>Total Amount (AUD)</th>
<th>Total orders</th> <th>Total orders</th>
<th>Transaction Partners</th>
<th>Enable Partners</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -139,6 +141,8 @@
ng-bind="channels.channel"></td> ng-bind="channels.channel"></td>
<td ng-bind="channels.total"></td> <td ng-bind="channels.total"></td>
<td ng-bind="channels.order"></td> <td ng-bind="channels.order"></td>
<td ng-bind="channels.transaction_partners"></td>
<td ng-bind="channels.enable_partners"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

@ -1649,7 +1649,37 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}); });
}) })
}; };
$scope.cb_bankpay = [];
$scope.cbChannelConfig = function () {
$http.get('/sysconfig/payment/config').then(function (resp) {
resp.data.forEach(function (channel) {
if (channel.type === 1) {
$scope.cb_bankpay.push(channel);
}
})
})
};
$scope.cbChannelConfig();
$scope.updateCBBankPayConfig = function (key, channel) {
var content = "";
if (channel == null) {
content = "你确定要将支付通道跟随系统"
} else {
content = '你确定要将支付通道更改为:' + channel
}
commonDialog.confirm({
title: 'Confirm',
content: content
}).then(function () {
$http.put('/sys/partners/'+ $scope.partner.client_moniker + '/cb_bankpay/'+ key +'/channel_id', {channel_id: channel}).then(function (resp) {
commonDialog.alert({type: 'success', title: 'Success', content: '修改成功'});
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message});
$scope.loadPartnerPaymentInfo();
});
})
};
$scope.toggleGatewayEmailNotice = function (channel) { $scope.toggleGatewayEmailNotice = function (channel) {
if (!$scope.paymentInfo) { if (!$scope.paymentInfo) {
return; return;

@ -414,6 +414,17 @@
<input ng-if="paymentInfo.enable_cb_bankpay_link" style="opacity: 0" id="cpcbbankpay" value={{paymentInfo.cb_bankpay_url}} readonly> <input ng-if="paymentInfo.enable_cb_bankpay_link" style="opacity: 0" id="cpcbbankpay" value={{paymentInfo.cb_bankpay_url}} readonly>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-2 control-label">CB Bank Pay Channel</label>
<div class="col-sm-3">
<select class="form-control" name="industry" ng-change="updateCBBankPayConfig('cb_channel_id',partner.cb_channel_id)"
ng-model="partner.cb_channel_id"
id="cbbankpay-input" required
ng-options="channel.channel_id as channel.channel_name for channel in cb_bankpay">
<option value="">跟随系统</option>
</select>
</div>
</div>
<div class="form-group" ng-if="paymentInfo.enable_cb_bankpay && paymentInfo.enable_cb_bankpay_link"> <div class="form-group" ng-if="paymentInfo.enable_cb_bankpay && paymentInfo.enable_cb_bankpay_link">
<label class="col-sm-2 control-label">CB Bank Pay QR Code</label> <label class="col-sm-2 control-label">CB Bank Pay QR Code</label>
<img ng-src="{{paymentInfo.cbBankPayQrcodeUrl}}" class="img-responsive" /> <img ng-src="{{paymentInfo.cbBankPayQrcodeUrl}}" class="img-responsive" />

@ -92,9 +92,12 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
}; };
$scope.loadSettlementLogs(1); $scope.loadSettlementLogs(1);
$scope.exportSettlementLogs = function() { $scope.exportSettlementLogs = function(pattern) {
var params = angular.copy($scope.params); var params = angular.copy($scope.params);
var url = '/client/trans_flow/settlement/log/excel'; var url = '/client/trans_flow/settlement/log/excel';
if (pattern === 'pdf') {
url = '/client/trans_flow/settlement/log/pdf';
}
var connectSymbol = '?'; var connectSymbol = '?';
if (params.datefrom) { if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd'); params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');

@ -88,9 +88,15 @@
<button class="btn btn-success" type="button" ng-click="loadSettlementLogs()"> <button class="btn btn-success" type="button" ng-click="loadSettlementLogs()">
<i class="fa fa-search"></i> Search <i class="fa fa-search"></i> Search
</button> </button>
<a role="button" class="btn btn-primary" style="float: right;right: 20px;" type="button" ng-href="{{exportSettlementLogs()}}"> <div class="btn-group" uib-dropdown ng-if="pagination.totalCount>0" style="float: right;right: 20px;">
<i class="fa fa-download"></i> export <button id="single-button" type="button" class="btn btn-primary" uib-dropdown-toggle ng-disabled="disabled">
</a> Export Settlement <span class="caret"></span>
</button>
<ul class="dropdown-menu" uib-dropdown-menu aria-labelledby="single-button" style="min-width: 80px">
<li><a target="_blank" ng-href="{{exportSettlementLogs('pdf')}}">PDF</a></li>
<li><a target="_blank" ng-href="{{exportSettlementLogs('excel')}}">EXCEL</a></li>
</ul>
</div>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save