Merge branch 'develop'

master
taylor.dang 4 years ago
commit 63355f405e

@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>2.3.47</version> <version>2.3.48</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version> <jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>

@ -51,4 +51,6 @@ public interface ClientAnalysisMapper {
List<JSONObject> tradeSubMerchantIdBy60Days(@Param("begin") Date begin); List<JSONObject> tradeSubMerchantIdBy60Days(@Param("begin") Date begin);
List<JSONObject> countClientsSettlementCycle(JSONObject params); List<JSONObject> countClientsSettlementCycle(JSONObject params);
List<JSONObject> listSecurePayMchs();
} }

@ -579,4 +579,9 @@ public class TestController {
params.put("client_moniker", clientMoniker); params.put("client_moniker", clientMoniker);
return params; return params;
} }
@GetMapping(value = "/securepay/settle/file")
public void sendSecurePaySettleFile() {
tradeSecureService.sendSecurePaySettleFile("20200803");
}
} }

@ -16,4 +16,6 @@ public interface TradeSecureService {
void manualDownloadHanyinSecureReport(Date date, boolean upload, HttpServletResponse resp); void manualDownloadHanyinSecureReport(Date date, boolean upload, HttpServletResponse resp);
TradeSecureFile getSecureReportFile(Date date); TradeSecureFile getSecureReportFile(Date date);
void sendSecurePaySettleFile(String dateStr);
} }

@ -1,12 +1,17 @@
package au.com.royalpay.payment.manage.system.core.impl; package au.com.royalpay.payment.manage.system.core.impl;
import au.com.royalpay.payment.core.exceptions.ChannelNetworkException; import au.com.royalpay.payment.core.exceptions.ChannelNetworkException;
import au.com.royalpay.payment.manage.analysis.mappers.ClientAnalysisMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.system.core.TradeSecureService; import au.com.royalpay.payment.manage.system.core.TradeSecureService;
import au.com.royalpay.payment.manage.system.core.beans.TradeSecureFile; import au.com.royalpay.payment.manage.system.core.beans.TradeSecureFile;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jcraft.jsch.*; import com.jcraft.jsch.*;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.vfs2.FileSystemOptions; import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.provider.sftp.SftpClientFactory; import org.apache.commons.vfs2.provider.sftp.SftpClientFactory;
import org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder; import org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder;
@ -40,10 +45,18 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService {
private String sftpUsername; private String sftpUsername;
@Value("${app.hanyin-secure.sftp-pwd}") @Value("${app.hanyin-secure.sftp-pwd}")
private String sftpPwd; private String sftpPwd;
@Value("${app.securepay.sftp.username:upitest}")
private String securePaySftpName;
@Value("${app.securepay.sftp.password:upitest}")
private String securePaySftpPwd;
@Resource @Resource
private TransactionMapper transactionMapper; private TransactionMapper transactionMapper;
@Resource @Resource
private ClientAnalysisMapper clientAnalysisMapper;
@Resource
private SysConfigManager sysConfigManager; private SysConfigManager sysConfigManager;
@Resource
private TradeLogService tradeLogService;
@Override @Override
public void uploadSecureReportYesterday() { public void uploadSecureReportYesterday() {
@ -119,4 +132,51 @@ public class TradeSecureServiceHanyinImpl implements TradeSecureService {
file.addTransactions(debits); file.addTransactions(debits);
return file; return file;
} }
@Override
public void sendSecurePaySettleFile(String dateStr) {
List<JSONObject> scpayMchs = clientAnalysisMapper.listSecurePayMchs();
scpayMchs.forEach(mch -> {
TradeLogQuery query = new TradeLogQuery();
query.setDatefrom(dateStr);
query.setDatefrom(dateStr);
byte[] fileData = tradeLogService.exportPDFSettlement(query, mch);
String fileName = dateStr + "-SETTLEMENT-" + RandomStringUtils.random(9, true, true).toUpperCase() + "-"
+ mch.getString("client_moniker") + ".pdf";
sendSftpFile(dateStr, fileName, fileData);
});
}
private void sendSftpFile(String dateStr, String fileName, byte[] data) {
Session session = null;
ChannelSftp command = null;
try {
session = initSFTPConnection(securePaySftpName, securePaySftpPwd);
Channel channel = session.openChannel("sftp");
channel.connect();
command = (ChannelSftp) channel;
try {
command.put(new ByteArrayInputStream(data), "/" + StringUtils.substring(dateStr, 0, 6) + "/" + fileName);
logger.info("文件发送成功!");
} catch (SftpException e) {
logger.error(e.getMessage());
}
} catch (IOException | JSchException e) {
throw new ChannelNetworkException("Send Settlement file failed", e);
} finally {
if (command != null && command.isConnected()) {
command.exit();
session.disconnect();
}
}
}
private Session initSFTPConnection(String sftpUsername, String sftpPassword) throws IOException {
FileSystemOptions fso = new FileSystemOptions();
return SftpClientFactory.createConnection("124.156.126.236", 2022,
sftpUsername.toCharArray(), sftpPassword.toCharArray(), fso);
}
} }

@ -0,0 +1,28 @@
package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.system.core.TradeSecureService;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
@Component
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
public class SecurePaySettleFileTask {
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Resource
private TradeSecureService tradeSecureService;
@Scheduled(cron = "0 0 3 * * *")
public void sendSecurePaySettleFile() {
synchronizedScheduler.executeProcess("task:securepay_settle_file_sending", 60_000, () ->
tradeSecureService.sendSecurePaySettleFile(DateFormatUtils.format(new Date(), "yyyyMMdd"))
);
}
}

@ -69,6 +69,8 @@ public interface TradeLogService {
void exportPDFSettlement(TradeLogQuery query, JSONObject partner, HttpServletResponse response); void exportPDFSettlement(TradeLogQuery query, JSONObject partner, HttpServletResponse response);
byte[] exportPDFSettlement(TradeLogQuery query, JSONObject client);
void exportExcelAllPartner(TradeLogQuery query, JSONObject partner, HttpServletResponse httpResponse) throws Exception; void exportExcelAllPartner(TradeLogQuery query, JSONObject partner, HttpServletResponse httpResponse) throws Exception;
} }

@ -1975,6 +1975,50 @@ public class TradeLogServiceImpl implements TradeLogService {
} }
} }
@Override
public byte[] exportPDFSettlement(TradeLogQuery query, JSONObject client) {
String begin = query.getDatefrom() == null ? "" : query.getDatefrom();
String end = query.getDateto() == null ? "" : query.getDateto();
String timezone = client.getString("timezone");
JSONObject params = query.toParams(timezone);
if (params.get("client_ids") == null) {
params.put("client_id", client.getString("client_id"));
}
clientManager.queryModifyClientIds(client.getIntValue("client_id"), params);
List<JSONObject> clientOrderList = transactionMapper.getClientOrderByTransactionTime(params);
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"));
List<JSONObject> settlementLogDetailList = new ArrayList<>();
try {
parmerters.put("logo", logo.getInputStream());
if (clientOrderList.size() > 0) {
List<Integer> clientOrders = new ArrayList<>(clientOrderList.size());
clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order")));
settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders);
TimeZoneUtils.switchTimeZoneToString(settlementLogDetailList, timezone, "yyyy-MM-dd HH:mm:ss", Collections.singletonList("transaction_time"));
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, RoundingMode.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);
return JasperRunManager.runReportToPdf(partner_settlement_flow.getInputStream(), parmerters, jrDataSource);
} catch (Exception e) {
throw new ServerErrorException(e);
}
}
@Override @Override
public void exportExcelAllPartner(TradeLogQuery query, JSONObject partner, HttpServletResponse resp) throws public void exportExcelAllPartner(TradeLogQuery query, JSONObject partner, HttpServletResponse resp) throws
Exception { Exception {

@ -10,7 +10,8 @@
]]> ]]>
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in <if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</select> </select>
<select id="countNewClientsHistory" resultType="com.alibaba.fastjson.JSONObject"> <select id="countNewClientsHistory" resultType="com.alibaba.fastjson.JSONObject">
@ -20,16 +21,17 @@
right join calendar a on a.datelist = date(c.create_time) right join calendar a on a.datelist = date(c.create_time)
]]> ]]>
<!--<if test="city!=null">--> <!--<if test="city!=null">-->
<!--INNER JOIN sys_client_bd b on b.client_id=c.client_id and b.start_date&lt;=curdate() --> <!--INNER JOIN sys_client_bd b on b.client_id=c.client_id and b.start_date&lt;=curdate() -->
<!--AND (b.end_date is null or b.end_date&gt;=curdate())--> <!--AND (b.end_date is null or b.end_date&gt;=curdate())-->
<!--inner join financial_bd_config bc on bc.manager_id=b.bd_id and bc.city=#{city}--> <!--inner join financial_bd_config bc on bc.manager_id=b.bd_id and bc.city=#{city}-->
<!--</if>--> <!--</if>-->
<![CDATA[ <![CDATA[
where a.datelist>= #{begin} AND a.datelist< #{end} AND c.is_valid=1 where a.datelist>= #{begin} AND a.datelist< #{end} AND c.is_valid=1
]]> ]]>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</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 <if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="bd_group!=null">and c.client_id in <if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b (SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -50,7 +52,8 @@
]]> ]]>
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in <if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</select> </select>
<!--显示所有的商户,包括禁用的--> <!--显示所有的商户,包括禁用的-->
@ -77,7 +80,8 @@
]]> ]]>
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in <if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
GROUP BY YEAR(create_time),MONTH(create_time),DAY(create_time) ORDER BY create_time desc GROUP BY YEAR(create_time),MONTH(create_time),DAY(create_time) ORDER BY create_time desc
</select> </select>
@ -90,7 +94,8 @@
]]> ]]>
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in <if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</select> </select>
<select id="countTradedPartners" resultType="java.lang.Integer"> <select id="countTradedPartners" resultType="java.lang.Integer">
<![CDATA[ <![CDATA[
@ -101,7 +106,8 @@
]]> ]]>
<if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if>
<if test="org_ids!=null">and p.org_id in <if test="org_ids!=null">and p.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</select> </select>
<select id="countTradePartnersHistory" resultType="com.alibaba.fastjson.JSONObject"> <select id="countTradePartnersHistory" resultType="com.alibaba.fastjson.JSONObject">
@ -113,7 +119,8 @@
]]> ]]>
<if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if>
<if test="org_ids!=null">and p.org_id in <if test="org_ids!=null">and p.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="bd_group!=null">and p.client_id in <if test="bd_group!=null">and p.client_id in
(SELECT b.client_id FROM sys_client_bd b (SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -206,17 +213,17 @@
</if> </if>
<if test="bd_group != null"> <if test="bd_group != null">
AND p.client_id IN ( AND p.client_id IN (
SELECT b.client_id SELECT b.client_id
FROM sys_client_bd b FROM sys_client_bd b
INNER JOIN financial_bd_config c INNER JOIN financial_bd_config c
ON c.manager_id = b.bd_id ON c.manager_id = b.bd_id
WHERE b.is_valid = 1 WHERE b.is_valid = 1
AND b.start_date &lt;= now() AND b.start_date &lt;= now()
AND (b.end_date IS NULL OR b.end_date &gt;= 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}) AND (c.bd_group = #{bd_group} OR c.manager_id = #{bd_group})
<if test="bd_group_bd"> <if test="bd_group_bd">
AND c.manager_id = #{bd_group_bd} AND c.manager_id = #{bd_group_bd}
</if> </if>
) )
</if> </if>
GROUP BY p.client_id GROUP BY p.client_id
@ -229,8 +236,8 @@
</select> </select>
<select id="countClientsTypes" resultType="com.alibaba.fastjson.JSONObject"> <select id="countClientsTypes" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.industry,c.royalpayindustry,count(1) partner_counts FROM sys_clients c SELECT c.industry,c.royalpayindustry,count(1) partner_counts FROM sys_clients c
<if test="bd_user!=null"> <if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= date(now()) and (d.end_date is null or date(d.end_date)&gt;= date(now())) and date(d.start_date)&lt;= date(now()) and (d.end_date is null or date(d.end_date)&gt;= date(now())) and
d.is_valid=1 d.is_valid=1
@ -239,7 +246,8 @@
is_valid = 1 and industry &lt;'400' AND approve_result=1 is_valid = 1 and industry &lt;'400' AND approve_result=1
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in <if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="bd_group!=null">and c.client_id in <if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b (SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -249,79 +257,86 @@
) )
</if> </if>
</where> </where>
GROUP BY c.royalpayindustry order by partner_counts desc GROUP BY c.royalpayindustry order by partner_counts desc
</select> </select>
<select id="notTradeSubMerchantId" resultType="com.alibaba.fastjson.JSONObject"> <select id="notTradeSubMerchantId" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[
SELECT COUNT(DISTINCT c.client_id) client_count,
c.sub_merchant_id, SELECT COUNT(DISTINCT c.client_id) client_count,
c.merchant_id c.sub_merchant_id,
FROM sys_clients c c.merchant_id
WHERE c.sub_merchant_id not in FROM sys_clients c
(SELECT p.sub_merchant_id FROM sys_clients p INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL WHERE c.sub_merchant_id not in
WHERE datediff(now(), o.create_time) <= 25 AND p.sub_merchant_id is not null GROUP BY p.sub_merchant_id) AND c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL (SELECT p.sub_merchant_id FROM sys_clients p INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL
AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 WHERE datediff(now(), o.create_time) <= 25 AND p.sub_merchant_id is not null GROUP BY p.sub_merchant_id) AND c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL
AND c.enable_wechat = 1 AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
]]> AND c.enable_wechat = 1
GROUP by c.sub_merchant_id ]]>
</select> GROUP by c.sub_merchant_id
</select>
<select id="tradeSubMerchantIdBy60Days" resultType="com.alibaba.fastjson.JSONObject"> <select id="tradeSubMerchantIdBy60Days" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[
SELECT COUNT(DISTINCT c.client_id) client_count,
c.sub_merchant_id, SELECT COUNT(DISTINCT c.client_id) client_count,
c.merchant_id, c.sub_merchant_id,
tmp.create_time last_trade_time, c.merchant_id,
datediff(now(), tmp.create_time) diff_days tmp.create_time last_trade_time,
FROM sys_clients c INNER JOIN (SELECT sub_merchant_id, max(create_time) create_time datediff(now(), tmp.create_time) diff_days
FROM pmt_orders where status>=5 and create_time>=#{begin} and create_time<=now() FROM sys_clients c INNER JOIN (SELECT sub_merchant_id, max(create_time) create_time
and channel='Wechat' FROM pmt_orders where status>=5 and create_time>=#{begin} and create_time<=now()
GROUP BY sub_merchant_id and channel='Wechat'
) tmp on c.sub_merchant_id = tmp.sub_merchant_id GROUP BY sub_merchant_id
WHERE ) tmp on c.sub_merchant_id = tmp.sub_merchant_id
c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL WHERE
AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL
AND c.enable_wechat = 1 AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
]]> AND c.enable_wechat = 1
GROUP BY c.sub_merchant_id ORDER BY diff_days desc ]]>
</select> GROUP BY c.sub_merchant_id ORDER BY diff_days desc
</select>
<select id="countClientsSettlementCycle" resultType="com.alibaba.fastjson.JSONObject"> <select id="countClientsSettlementCycle" resultType="com.alibaba.fastjson.JSONObject">
SELECT COUNT(DISTINCT c.client_id) client_count, SELECT COUNT(DISTINCT c.client_id) client_count,
CASE c.clean_days CASE c.clean_days
WHEN 1 WHEN 1
THEN 'T+1' THEN 'T+1'
WHEN 2 WHEN 2
THEN 'T+2' THEN 'T+2'
WHEN 3 WHEN 3
THEN 'T+3' THEN 'T+3'
END AS clean_days END AS clean_days
FROM sys_clients c FROM sys_clients c
<where> <where>
(c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in <if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
<if test="bd_group!=null">and c.client_id in </if>
(SELECT b.client_id FROM sys_client_bd b <if test="bd_group!=null">and c.client_id in
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id (SELECT b.client_id FROM sys_client_bd b
where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now()) INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group}) where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now())
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if>) AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
</if> <if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if>)
</if>
<if test="begin!=null"> <if test="begin!=null">
AND c.client_id in (SELECT o.client_id FROM statistics_customer_order o AND c.client_id in (SELECT o.client_id FROM statistics_customer_order o
<where> <where>
<if test="begin!=null"> <if test="begin!=null">
o.date >=#{begin} o.date >=#{begin}
</if> </if>
<if test="eng!=null"> <if test="eng!=null">
o.date > #{end} o.date > #{end}
</if> </if>
</where>) </where>
)
</if> </if>
</where> </where>
GROUP by c.clean_days GROUP by c.clean_days
</select> </select>
<select id="listSecurePayMchs" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM sys_clients sc where sc.org_id in (112,113) and is_valid=1
</select>
</mapper> </mapper>

Loading…
Cancel
Save