Merge branch 'develop'

master
taylor.dang 6 years ago
commit 615edca662

@ -62,7 +62,7 @@ public class AnalysisBean {
if (bd_id != null){
params.put("bd_id",bd_id);
}
if (org_id !=null){
if (org_id != null){
params.put("org_id",org_id);
}
if (begin_month != null){
@ -71,25 +71,25 @@ public class AnalysisBean {
if (end_month != null){
params.put("end_month",end_month);
}
if (customer_id!=null && !customer_id.isEmpty()){
params.put("customer_id",customer_id.trim());
if (customer_id != null && !customer_id.isEmpty()){
params.put("customer_id", customer_id.trim());
}
if (rankType!=null){
params.put("rankType",rankType);
if (rankType != null){
params.put("rankType", rankType);
}
if(channel!=null){
params.put("channel",channel);
if(channel != null){
params.put("channel", channel);
}
if(bd_name!=null){
params.put("bd_name",bd_name);
if(bd_name != null){
params.put("bd_name", bd_name);
}
if (client_moniker!=null){
if (client_moniker != null){
params.put("client_moniker", client_moniker);
}
if (amount_from!=null && amount_from.length()>0){
if (amount_from != null && amount_from.length() > 0){
params.put("amount_from", new BigDecimal(amount_from));
}
if (amount_to!=null && amount_to.length()>0){
if (amount_to != null && amount_to.length() > 0){
params.put("amount_to", new BigDecimal(amount_to));
}
return params;

@ -24,7 +24,7 @@ public interface DashboardService {
List<JSONObject> getTopTradePartners(JSONObject params, int limit);
List<JSONObject> getTopTradePartners(JSONObject params);
List<JSONObject> getTopTradePartnersNew(JSONObject params);
List<JSONObject> getTradeAnalysisInHours(JSONObject params);

@ -161,17 +161,18 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
return transactionAnalysisMapper.getTradeAmountInTypes(params);
}
@Override
public List<JSONObject> getTopTradePartners(JSONObject params, int limit) {
params.put("rankType", "aud_fee");
params.put("limit", limit);
return clientAnalysisMapper.listPartnersTradeAmount(params);
return clientAnalysisMapper.listPartnersTradeAmount(params,
new PageBounds(1, limit, Order.formString("aud_fee.desc")));
}
@Override
public List<JSONObject> getTopTradePartners(JSONObject params) {
public List<JSONObject> getTopTradePartnersNew(JSONObject params) {
params.putIfAbsent("rankType", "aud_fee");
return clientAnalysisMapper.listPartnersTradeAmount(params);
return clientAnalysisMapper.listPartnersTradeAmountNew(params);
}
@Override

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

@ -67,9 +67,11 @@ public class DashboardController {
@ManagerMapping("/top_trade_partners")
public List<JSONObject> topTradePartners(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,
@RequestParam(defaultValue = "10") int limit) {
JSONObject params = analysis.toParams(analysis.getTimezone());
orgManager.checkOrg(manager,params);
return dashboardService.getTopTradePartners(params, limit);
orgManager.checkOrg(manager, params);
params.put("limit", limit);
return dashboardService.getTopTradePartnersNew(params);
}
@ManagerMapping("/rank_trade_partners")
@ -78,11 +80,11 @@ public class DashboardController {
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){
if (analysis.getGroup_bd() > 0){
params.put("bd_group_bd", analysis.getGroup_bd());
}
}
return dashboardService.getTopTradePartners(params);
return dashboardService.getTopTradePartnersNew(params);
}
@ManagerMapping("/trade_in_hours")

@ -18,15 +18,23 @@ public class ClientRateConfig {
@JSONField(name = "rate_name")
@NotEmpty(message = "error.payment.valid.param_missing")
private String rateName;
@JSONField(name = "rate_value")
@NotNull(message = "error.payment.valid.param_missing")
private Double rateValue;
@JSONField(name = "transaction_fee")
@NotNull(message = "error.payment.valid.param_missing")
private Double transactionFee;
@JSONField(name = "active_time")
@NotNull(message = "error.payment.valid.param_missing")
private Date activeTime;
@JSONField(name = "expiry_time")
@NotNull(message = "error.payment.valid.param_missing")
private Date expiryTime;
@JSONField(name = "clean_days")
@NotNull(message = "error.payment.valid.param_missing")
private Integer cleanDays = 3;
@ -86,4 +94,12 @@ public class ClientRateConfig {
public void setRemark(String remark) {
this.remark = remark;
}
public Double getTransactionFee() {
return transactionFee;
}
public void setTransactionFee(Double transactionFee) {
this.transactionFee = transactionFee;
}
}

@ -144,17 +144,23 @@
</select>
-->
<!-- 优化后的SQL语句 -->
<select id="listPartnersTradeAmount" resultType="com.alibaba.fastjson.JSONObject">
<!--
优化后的SQL语句
在之前的SQL语句中与transaction表内连接时加了and (t.transaction_type = 'Credit' or t.refund_id is not null)这个条件
是因为在transaction_type = 'Debit'的记录中有的并没有refund_id所以剔除这些记录
优化后的SQL语句去掉了这个条件而是在需要的字段中添加t.refund_id IS NOT NULL这一条件
-->
<select id="listPartnersTradeAmountNew" 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
p.short_name,
p.client_moniker,
COUNT(t.refund_id) refund_orders,
COUNT(DISTINCT t.order_id) orders,
IFNULL(MAX(t.clearing_amount), 0) max_order,
MAX(IF(t.refund_id IS NOT NULL, t.clearing_amount, 0)) max_refund,
SUM(IF(t.refund_id IS NOT NULL, t.clearing_amount, 0)) refund_amount,
IFNULL(SUM(IF(t.transaction_type = 'Credit', t.clearing_amount, 0)), 0) aud_fee
FROM sys_clients p
INNER JOIN pmt_transactions t
ON t.client_id = p.client_id
@ -162,37 +168,38 @@
AND t.create_time <= #{end}
]]>
<if test="org_id != null and org_ids == null">
and p.org_id = #{org_id}
AND p.org_id = #{org_id}
</if>
<if test="org_ids != null">
and p.org_id in
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
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})
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}
AND c.manager_id = #{bd_group_bd}
</if>
)
</if>
GROUP BY p.client_id
ORDER BY #{rankType} DESC
<if test="rankType != null">
ORDER BY ${rankType} DESC
</if>
<if test="limit != null">
limit ${limit}
LIMIT ${limit}
</if>
</select>
<select id="countClientsTypes" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.industry,c.royalpayindustry,count(1) partner_counts FROM sys_clients c
<if test="bd_user!=null">

@ -179,6 +179,7 @@
<tr>
<th>Rate Name</th>
<th>Rate Value</th>
<th>Transaction Fee</th>
<th>Active Time</th>
<th>Expire Time</th>
<th ng-if="bankCtrl.rate_name=='Wechat'">Clean Days</th>
@ -193,6 +194,7 @@
ng-class="{'text-bold':rate.current,'success':rate.active}">
<td ng-bind="rate.rate_name"></td>
<td ng-bind="rate.rate_value"></td>
<td ng-bind="rate.transaction_fee"></td>
<td ng-bind="rate.active_time|date:'yyyy-MM-dd'"></td>
<td ng-bind="rate.expiry_time|date:'yyyy-MM-dd'"></td>
<td ng-if="rate.rate_name=='Wechat'">T+{{rate.clean_days}}</td>

@ -160,6 +160,29 @@
</div>
</div>
<!-- 新增transaction_fee -->
<div class="form-group"
ng-class="{'has-error':rate_form.transaction_fee.$invalid && rate_form.transaction_fee.$dirty}">
<label class="control-label col-sm-4" for="transaction_fee_input">Transaction Fee</label>
<div class="col-sm-6">
<div class="input-group">
<input type="number" name="Transaction_fee_value" stringToNumber2 class="form-control" ng-model="rate.transaction_fee"
min="0" step="0.1" id="transaction_fee_input" required>
</div>
<div ng-messages="rate_form.transaction_fee.$error" ng-if="rate_form.transaction_fee.$dirty">
<div class="small text-danger" ng-message="min">
<i class="glyphicon glyphicon-alert"></i> No less than 0
</div>
<div class="small text-danger" ng-message="required">
<i class="glyphicon glyphicon-alert"></i> Required Field
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="active_time_input">Active Date</label>
<div class="col-sm-6">

@ -35,6 +35,31 @@
</div>
</div>
<!-- 新增transaction_fee字段 -->
<div class="form-group"
ng-class="{'has-error':rate_form.transaction_fee.$invalid && rate_form.transaction_fee.$dirty}">
<label class="control-label col-sm-4" for="transaction_fee_input">Transaction Fee</label>
<div class="col-sm-6">
<div class="input-group">
<input type="number" name="transaction_fee" class="form-control" ng-model="rate.transaction_fee"
min="0" step="0.1" id="transaction_fee_input" required>
</div>
<div ng-messages="rate_form.transaction_fee.$error" ng-if="rate_form.transaction_fee.$dirty">
<!--<div class="small text-danger" ng-message="max">-->
<!--<i class="glyphicon glyphicon-alert"></i> No more than 2.2%-->
<!--</div>-->
<div class="small text-danger" ng-message="min">
<i class="glyphicon glyphicon-alert"></i> No less than 0
</div>
<div class="small text-danger" ng-message="required">
<i class="glyphicon glyphicon-alert"></i> Required Field
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="active_time_input">Active Date</label>
<div class="col-sm-6">

Loading…
Cancel
Save