Merge branch 'develop'

master
taylor.dang 6 years ago
commit 8b2fcee8bb

@ -148,7 +148,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
return commonAnalysis4;
}
JSONObject res = new JSONObject();
List<JSONObject> topOrders = transactionAnalysisMapper.getTopOrders(params, new PageBounds(1, 1, Order.formString("aud_fee.desc")));
List<JSONObject> topOrders = transactionAnalysisMapper.getTopOrders(params);
if (!topOrders.isEmpty()) {
res.put("top_amount_order", topOrders.get(0));
}
@ -163,16 +163,15 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Override
public List<JSONObject> getTopTradePartners(JSONObject params, int limit) {
return clientAnalysisMapper.listPartnersTradeAmount(params, new PageBounds(1, limit, Order.formString("aud_fee.desc")));
params.put("rankType", "aud_fee");
params.put("limit", limit);
return clientAnalysisMapper.listPartnersTradeAmount(params);
}
@Override
public List<JSONObject> getTopTradePartners(JSONObject params) {
String rankType = "aud_fee";
if (params.getString("rankType")!=null){
rankType = params.getString("rankType");
}
return clientAnalysisMapper.listPartnersTradeAmount(params, new PageBounds(Order.formString(rankType+".desc")));
params.putIfAbsent("rankType", "aud_fee");
return clientAnalysisMapper.listPartnersTradeAmount(params);
}
@Override

@ -33,7 +33,7 @@ public interface ClientAnalysisMapper {
List<JSONObject> countTradePartnersHistory(JSONObject params);
List<JSONObject> listPartnersTradeAmount(JSONObject params, PageBounds pageBounds);
List<JSONObject> listPartnersTradeAmount(JSONObject params);
List<JSONObject> countClientsTypes(JSONObject params);

@ -33,7 +33,7 @@ public interface TransactionAnalysisMapper {
JSONObject getEarliestOrder(@Param("client_id") int client_id);
List<JSONObject> getTopOrders(JSONObject params, PageBounds pagination);
List<JSONObject> getTopOrders(JSONObject params);
List<JSONObject> getTradeAmountInTypes(JSONObject params);

@ -75,11 +75,11 @@ public class DashboardController {
@ManagerMapping("/rank_trade_partners")
public List<JSONObject> rankTradePartners(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
orgManager.checkOrg(manager,params);
orgManager.checkOrg(manager, params);
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){
params.put("bd_group_bd",analysis.getGroup_bd());
params.put("bd_group_bd", analysis.getGroup_bd());
}
}
return dashboardService.getTopTradePartners(params);

@ -21,6 +21,7 @@ import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.payment.RefundMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.CommonConsts;
@ -56,6 +57,8 @@ import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@ -113,6 +116,9 @@ public class TestController implements ApplicationEventPublisherAware {
private HfClearAmountService hfClearAmountService;
@Resource
private HfUpdateService hfUpdateService;
@Resource
private ClientManager clientManager;
private final static String EMAIL = "lily.tao@royalpay.com.au,bella.sun@royalpay.com.au,astro.dai@royalpay.com.au,taylor.dang@royalpay.com.au";
@ManagerMapping(value = "/{clientMoniker}/export/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
public void exportAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception {
@ -416,4 +422,16 @@ public class TestController implements ApplicationEventPublisherAware {
public String rpayUpdateClearing() {
return hfUpdateService.rpayUpdate();
}
@ManagerMapping(value = "/partner/reset_password", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public void resetPartnerPassword() {
final List<String> emails = new ArrayList<>();
List<String> emailList = Arrays.asList(EMAIL.split(","));
emailList.stream().forEach(email -> {
if (!emails.contains(email)) {
emails.add(email);
}
});
clientManager.updateAllPartnerPassword("PINE", emails);
}
}

@ -10,6 +10,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -24,13 +25,12 @@ public class UpdatePartnerPasswordTask {
@Resource
private ManagerMapper managerMapper;
private final static String EMAIL = "lily.tao@royalpay.com.au,bella.sun@royalpay.com.au," +
"astro.dai@royalpay.com.au,taylor.dang@royalpay.com.au";
private final static String EMAIL = "lily.tao@royalpay.com.au,bella.sun@royalpay.com.au,astro.dai@royalpay.com.au,taylor.dang@royalpay.com.au";
@Scheduled(cron = "0 0 9 28 * ?")
public void resetPartnerPassword() {
synchronizedScheduler.executeProcess("manage_task:resetPartnerPassword", 120_000, () -> {
final List<String> emails = managerMapper.listDevManager();
synchronizedScheduler.executeProcess("manage_task:resetPartnerPassword", 300_000, () -> {
final List<String> emails = new ArrayList<>();
List<String> emailList = Arrays.asList(EMAIL.split(","));
emailList.stream().forEach(email -> {
if (!emails.contains(email)) {

@ -97,30 +97,100 @@
GROUP BY date(o.create_time)
</select>
<!-- 原来的SQL语句
<select id="listPartnersTradeAmount" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
p.client_moniker,p.short_name,ifnull(sum(if(t.transaction_type='Credit',t.clearing_amount,0)),0)aud_fee,
count(DISTINCT t.order_id) orders,max(t.clearing_amount)max_order,ifnull(sum(if(t.refund_id is not null,if(t.transaction_type='Debit',t.clearing_amount,-t.clearing_amount),0)),0)refund_amount,
ifnull(sum(if(t.refund_id is not null and t.transaction_type='Debit',1,0)),0)refund_orders,max(if(t.refund_id is not null and t.transaction_type='Debit',t.clearing_amount,0))max_refund
SELECT
p.client_moniker,
p.short_name,
ifnull(sum(if(t.transaction_type = 'Credit', t.clearing_amount, 0)), 0) aud_fee,
count(DISTINCT t.order_id) orders,
max(t.clearing_amount) max_order,
ifnull(sum(if(t.refund_id is not null, if(t.transaction_type='Debit', t.clearing_amount, -t.clearing_amount), 0)), 0) refund_amount,
ifnull(sum(if(t.refund_id is not null and t.transaction_type='Debit', 1, 0)), 0)refund_orders, max(if(t.refund_id is not null and t.transaction_type='Debit', t.clearing_amount, 0)) max_refund
FROM sys_clients p
INNER JOIN pmt_transactions t ON t.client_id = p.client_id and (t.transaction_type='Credit' or t.refund_id is not null)
INNER JOIN pmt_orders o ON t.order_id = o.order_id
WHERE o.create_time >= #{begin} AND o.create_time <= #{end}
INNER JOIN pmt_transactions t
ON t.client_id = p.client_id
and (t.transaction_type = 'Credit' or t.refund_id is not null)
INNER JOIN pmt_orders o
ON t.order_id = o.order_id
WHERE o.create_time >= #{begin}
AND o.create_time <= #{end}
]]>
<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
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="bd_group!=null">and p.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 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
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">
#{org_id}
</foreach>
</if>
<if test="bd_group != null">
and p.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>
GROUP BY p.client_id
</select>
-->
<!-- 优化后的SQL语句 -->
<select id="listPartnersTradeAmount" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
p.client_moniker,
p.short_name,
ifnull(sum(if(t.transaction_type = 'Credit', t.clearing_amount, 0)), 0) aud_fee,
count(DISTINCT t.order_id) orders,
max(t.clearing_amount) max_order,
ifnull(sum(if(t.refund_id is not null, if(t.transaction_type='Debit', t.clearing_amount, -t.clearing_amount), 0)), 0) refund_amount,
ifnull(sum(if(t.refund_id is not null and t.transaction_type='Debit', 1, 0)), 0)refund_orders, max(if(t.refund_id is not null and t.transaction_type='Debit', t.clearing_amount, 0)) max_refund
FROM sys_clients p
INNER JOIN pmt_transactions t
ON t.client_id = p.client_id
WHERE t.create_time >= #{begin}
AND t.create_time <= #{end}
]]>
<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
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">
#{org_id}
</foreach>
</if>
<if test="bd_group != null">
and p.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>
GROUP BY p.client_id
ORDER BY #{rankType} DESC
<if test="limit != null">
limit ${limit}
</if>
</select>
<select id="countClientsTypes" resultType="com.alibaba.fastjson.JSONObject">

@ -163,7 +163,7 @@
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<![CDATA[
GROUP BY o.order_id
GROUP BY o.order_id ORDER BY aud_fee DESC limit 1
]]>
</select>

@ -18,7 +18,7 @@
</where>
</select>
<select id="partnerAndSubPartnerAccounts" resultType="com.alibaba.fastjson.JSONObject">
SELECT sc.client_moniker, sa.*
SELECT sc.client_moniker, sa.account_id, sa.role, sa.username
FROM sys_clients sc
INNER JOIN sys_accounts sa ON sc.client_id = sa.client_id AND sa.is_valid = 1
WHERE sc.client_id = #{client_id} OR sc.parent_client_id = #{client_id} AND sc.is_valid = 1

@ -85,7 +85,7 @@
</a>
<a class="btn btn-app" role="button" ui-sref=".rpayupdate">
<i class="fa fa-credit-card-alt"></i>
更新HF短连接
更新Rpay+商户费率时间
</a>
</div>
</div>

Loading…
Cancel
Save