Merge remote-tracking branch 'origin/develop' into develop

master
yixian 5 years ago
commit c32e555e5e

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

@ -301,6 +301,14 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
}
cleanLog.put("channels", channelsObj);
cleanLog.put("client_moniker", client.getString("client_moniker"));
//跨境商城支持
// JSONObject incremental = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城");
// if (incremental != null) {
// cleanLog.put("incremental_rate", incremental.getBigDecimal("incremental_rate_value"));
// cleanLog.putAll(incrementalAnalysisTransLogs(transactions));
// BigDecimal royalpayTax = cleanLog.getBigDecimal("tax_amount").subtract(cleanLog.getBigDecimal("incremental_tax"));
// cleanLog.put("royalpay_tax", royalpayTax.setScale(2, RoundingMode.HALF_UP));
// }
return cleanLog;
}
@ -1714,4 +1722,23 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
notices.add(new TodoNotice("settlement", settleDateSettingMsg, "#/analysis/clearing_logs/date_setting"));
}
}
private JSONObject incrementalAnalysisTransLogs(List<JSONObject> logs) {
final JSONObject analysis = new JSONObject();
analysis.put("real_royalpay_charge", logs.parallelStream()
.map(log -> getSymbol(log).multiply(log.getBigDecimal("royal_surcharge")))
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
analysis.put("incremental_charge", logs.parallelStream()
.map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge")))
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
analysis.put("incremental_tax", logs.parallelStream()
.filter(log -> StringUtils.equalsIgnoreCase("RP跨境商城", log.getString("source")))
.map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge")).divide(new BigDecimal(10), 2, RoundingMode.HALF_UP))
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
return analysis;
}
private BigDecimal getSymbol(JSONObject log) {
return "Credit".equals(log.getString("transaction_type")) || "Settlement".equals(log.getString("channel")) ? BigDecimal.ONE : BigDecimal.valueOf(-1);
}
}

@ -38,6 +38,7 @@ public class TradeLogQuery {
private int group_bd;
private String org_id;
private String org_id2;
private boolean onlyIncrementAmount = false;
public Integer getGatewayChild() {
return gatewayChild;
@ -105,6 +106,9 @@ public class TradeLogQuery {
if (StringUtils.isNotEmpty(org_id2)) {
params.put("org_id2", org_id2);
}
if (onlyIncrementAmount) {
params.put("onlyIncrementAmount", "1");
}
return params;
}
@ -252,4 +256,12 @@ public class TradeLogQuery {
public void setSource(String source) {
this.source = source;
}
public boolean isOnlyIncrementAmount() {
return onlyIncrementAmount;
}
public void setOnlyIncrementAmount(boolean onlyIncrementAmount) {
this.onlyIncrementAmount = onlyIncrementAmount;
}
}

@ -63,10 +63,7 @@ import org.springframework.ui.Model;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat;
@ -137,6 +134,8 @@ public class TradeLogServiceImpl implements TradeLogService {
// @Value("classpath:/jasper/trans_flow_new.jasper")
@Value("classpath:/jasper/partner_invoice_gst.jasper")
private org.springframework.core.io.Resource trans_flow;
@Value("classpath:/jasper/incremental_partner_invoice_gst.jasper")
private org.springframework.core.io.Resource incremental_trans_flow;
@Value("classpath:/jasper/royalpay_logo.png")
private org.springframework.core.io.Resource logo;
@Value("classpath:/jasper/trans_excel.jasper")
@ -256,13 +255,6 @@ public class TradeLogServiceImpl implements TradeLogService {
if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role")) && !ManagerRole.ORG_MANAGER.hasRole(manager.getIntValue("role"))) {
params.put("bd_user", manager.getString("manager_id"));
}
if (query.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.remove("bd_user");
params.put("bd_group", manager.getString("manager_id"));
if (query.getGroup_bd() > 0) {
params.put("bd_group_bd", query.getGroup_bd());
}
}
orgManager.checkOrgIds(manager, params);
if (query.getGatewayChild() != null) {
params.put("trade_type", new ArrayList<Integer>() {{
@ -624,6 +616,20 @@ public class TradeLogServiceImpl implements TradeLogService {
.filter(log -> log.getBigDecimal("settle_amount") != null)
.map(log -> getSymbol(log).multiply(log.getBigDecimal("royal_surcharge")))
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
analysis.put("total_royalpay_fee", logs.parallelStream()
.filter(log -> log.getBigDecimal("settle_amount") != null)
.map(log -> getSymbol(log).multiply(log.getBigDecimal("royal_surcharge")
.add(log.getBigDecimal("surcharge_cashback"))
.add(log.getBigDecimal("channel_surcharge"))))
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
analysis.put("total_incremental_surcharge", logs.parallelStream()
.filter(log -> log.getBigDecimal("settle_amount") != null)
.map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge")))
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
analysis.put("total_incremental_tax", logs.parallelStream()
.filter(log -> log.getBigDecimal("settle_amount") != null)
.map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP)))
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
analysis.put("total_surcharge", logs.parallelStream()
.filter(log -> log.getBigDecimal("settle_amount") != null)
.map(log -> getSymbol(log).multiply(log.getBigDecimal("total_surcharge").add(log.getBigDecimal("tax_amount"))))
@ -696,7 +702,25 @@ public class TradeLogServiceImpl implements TradeLogService {
parmerters.put("jd_fee", takeDecimalOrDefault(analysis, "jd_fee", BigDecimal.ZERO));
parmerters.put("alipay_online_fee", takeDecimalOrDefault(analysis, "alipay_online_fee", BigDecimal.ZERO));
parmerters.put("gst", takeDecimalOrDefault(analysis, "tax_amount", BigDecimal.ZERO));
parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", BigDecimal.ZERO));
parmerters.put("incremental_fee", takeDecimalOrDefault(analysis, "total_incremental_surcharge", BigDecimal.ZERO));
parmerters.put("incremental_gst", takeDecimalOrDefault(analysis, "total_incremental_tax", BigDecimal.ZERO));
parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2,RoundingMode.HALF_UP));
dataList.parallelStream().forEach(item -> {
BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO;
BigDecimal taxAmount = item.containsKey("tax_amount") ? item.getBigDecimal("tax_amount") : BigDecimal.ZERO;
BigDecimal royalpaySurhcarge = item.containsKey("royal_surcharge") ? item.getBigDecimal("royal_surcharge") : BigDecimal.ZERO;
BigDecimal surhcargeBack = item.containsKey("surcharge_cashback") ? item.getBigDecimal("surcharge_cashback") : BigDecimal.ZERO;
BigDecimal channelSurcharge = item.containsKey("channel_surcharge") ? item.getBigDecimal("channel_surcharge") : BigDecimal.ZERO;
BigDecimal incrementalTax = incrementalSurcharge.divide(new BigDecimal(10), 2, RoundingMode.HALF_UP);
BigDecimal royalpayTax = taxAmount.subtract(incrementalTax);
BigDecimal realRoyalpayCharge = royalpaySurhcarge
.add(surhcargeBack)
.add(channelSurcharge)
.add(royalpayTax);
item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP));
item.put("real_royalpay_surcharge", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP));
scaleDecimalVal(item, "display_amount", item.getString("currency"));
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
scaleDecimalVal(item, "clearing_amount", platformCurrency);
@ -708,7 +732,10 @@ public class TradeLogServiceImpl implements TradeLogService {
String fileName = client.getString("client_moniker") + "_" + parmerters.getString("dateRange").replaceAll("/", "");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
OutputStream outs = response.getOutputStream();
byte[] bytes = JasperRunManager.runReportToPdf(trans_flow.getInputStream(), parmerters, jrDataSource);
// JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城");
JSONObject clientIncrement = null;
InputStream jasper = clientIncrement == null ? trans_flow.getInputStream() : incremental_trans_flow.getInputStream();
byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource);
outs.write(bytes, 0, bytes.length);
outs.flush();
outs.close();

@ -363,7 +363,7 @@
<if test="client_ids == null and client_id != null">
AND p.client_id = #{client_id}
</if>
LEFT JOIN pmt_transactions t
INNER JOIN pmt_transactions t
ON t.order_id = o.order_id
AND t.refund_id IS NULL
AND t.transaction_type = 'Credit'
@ -391,6 +391,9 @@
AND t.system_transaction_id = #{search_text}
</if>
</if>
<if test="onlyIncrementAmount != null">
AND t.incremental_surcharge >0
</if>
<if test="org_id != null and org_ids == null">
AND p.org_id = #{org_id}
</if>
@ -668,6 +671,9 @@
<if test="to!=null">and o.create_time &lt; #{to}</if>
<if test="date!=null">and date(o.create_time)=date(#{date})</if>
<if test="dev_id!=null">and binary o.dev_id=#{dev_id}</if>
<if test="onlyIncrementAmount != null">
AND t.incremental_surcharge >0
</if>
<if test="status!=null">
and
<foreach collection="status" item="std" open="(" close=")" separator=" or ">o.status=#{std}</foreach>

@ -1146,6 +1146,9 @@
<select id="listTransactionsOfClearingOrder" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT t.*,
(t.royal_surcharge + t.channel_surcharge + t.surcharge_cashback) as real_royal_surcharge,
round((t.incremental_surcharge * 0.1),2) as incremental_tax,
(t.tax_amount - round((t.incremental_surcharge * 0.1),2)) as royalpay_tax,
IFNULL(t.incremental_surcharge, 0.00) incremental_surcharge_settle,
o.display_amount,
o.client_order_id,
@ -1155,7 +1158,7 @@
o.order_detail,
o.dev_id,
o.source,
ifnull(sci.incremental_rate_value,0) as rate_value
ifnull(if(o.source='RP跨境商城',sci.incremental_rate_value,0),0) as rate_value
FROM pmt_transactions t
LEFT JOIN pmt_orders o ON o.order_id = t.order_id
LEFT JOIN pmt_refunds r ON r.refund_id = t.refund_id

@ -352,7 +352,7 @@ margin-bottom: 10%;"/>
</li>
<li ui-sref-active="active" ng-if="'tradelog'|withModule">
<a ui-sref="incremental_trade" ui-sref-opts="{reload:true}">
<i class="fa fa-list-alt"></i> <span>增值服务交易流水|Incremental Trades Logs</span>
<i class="fa fa-list-alt"></i> <span>R-Service交易统计</span>
</a>
</li>
<li ui-sref-active="active" ng-if="('transAnalysis'|withModule) && (currentUser.org_id==null || currentUser.org_id==1)">

@ -253,10 +253,13 @@
<th>Currency</th>
<th>Input Amount</th>
<th>Total Amount</th>
<th>Surcharge Rate</th>
<th>Surcharge Amount</th>
<th>Surcharge rate for RoyalPay</th>
<th>Surcharge Amount for RoyalPay</th>
<th>GST Amount for RoyalPay</th>
<th>Surcharge rate for Mini Program</th>
<th>Surcharge Amount for Mini Program</th>
<th>GST Amount for Mini Program </th>
<th>Settle Amount</th>
<th>Tax Amount</th>
<th>Remark</th>
</tr>
</thead>
@ -269,10 +272,15 @@
<td ng-bind="tr.transaction_currency"></td>
<td ng-bind="tr.display_amount|currency:''"></td>
<td ng-bind="tr.transaction_amount|currency:''"></td>
<td ng-bind="tr.surcharge_rate|percentage:1"></td>
<td ng-bind="(tr.total_surcharge?tr.total_surcharge:0)|currency:''"></td>
<td>
{{(((tr.surcharge_rate * 100) > tr.rate_value)?((tr.surcharge_rate * 100-tr.rate_value)):(tr.surcharge_rate))|number:2}} %
</td>
<td ng-bind="(tr.real_royal_surcharge?tr.real_royal_surcharge:0)|currency:''"></td>
<td ng-bind="tr.royalpay_tax|currency:''"></td>
<td ng-bind="(tr.rate_value/100)|percentage:2"></td>
<td ng-bind="(tr.incremental_surcharge?tr.incremental_surcharge:0)|currency:''"></td>
<td ng-bind="tr.incremental_tax|currency:''"></td>
<td ng-bind="tr.settle_amount|currency:''"></td>
<td ng-bind="tr.tax_amount|currency:''"></td>
<td ng-bind="tr.remark"></td>
</tr>
</tbody>
@ -289,10 +297,13 @@
<th>Transaction Time</th>
<th>Currency</th>
<th>Total Amount</th>
<th>Surcharge Rate</th>
<th>Surcharge Amount</th>
<th>Surcharge rate for RoyalPay</th>
<th>Surcharge Amount for RoyalPay</th>
<th>GST Amount for RoyalPay</th>
<th>Surcharge rate for Mini Program</th>
<th>Surcharge Amount for Mini Program</th>
<th>GST Amount for Mini Program </th>
<th>Settle Amount</th>
<th>Tax Amount</th>
<th>Remark</th>
</tr>
</thead>
@ -304,10 +315,15 @@
<td ng-bind="tr.transaction_time"></td>
<td ng-bind="tr.transaction_currency"></td>
<td ng-bind="tr.transaction_amount|currency:''"></td>
<td ng-bind="tr.surcharge_rate|percentage:1"></td>
<td ng-bind="(tr.total_surcharge?tr.total_surcharge:0)|currency:''"></td>
<td>
{{(((tr.surcharge_rate * 100) > tr.rate_value)?((tr.surcharge_rate * 100-tr.rate_value)):(tr.surcharge_rate))|number:2}} %
</td>
<td ng-bind="(tr.real_royal_surcharge?tr.real_royal_surcharge:0)|currency:''"></td>
<td ng-bind="tr.royalpay_tax|currency:''"></td>
<td ng-bind="(tr.rate_value/100)|percentage:2"></td>
<td ng-bind="(tr.incremental_surcharge?tr.incremental_surcharge:0)|currency:''"></td>
<td ng-bind="tr.incremental_tax|currency:''"></td>
<td ng-bind="tr.settle_amount|currency:''"></td>
<td ng-bind="tr.tax_amount|currency:''"></td>
<td ng-bind="tr.remark"></td>
</tr>
</tbody>

@ -153,3 +153,25 @@ section.content {
display: none;
}
}
@media (min-width: 768px) {
.dl-horizontal dd {
margin-left: 180px;
line-height: 32px;
}
}
@media (min-width: 768px) {
.dl-horizontal dt {
float: left;
width: 160px;
overflow: hidden;
clear: left;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 32px;
}
}

@ -23,6 +23,7 @@ section.content {
display: block;
margin: 40px auto;
background: #fff;
border-radius: 10px;
overflow: visible;
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.30);
}

@ -148,7 +148,7 @@
<div class="description-block">
<img src="/static/images/main_menu/transaction_flow.png"/>
<div class="description-text">
<span class="description-text">增值服务交易流水</span>
<span class="description-text">R-Service交易统计</span>
</div>
</div>
</a>

@ -7,10 +7,10 @@
<tr>
<th>Logo</th>
<th>Channel</th>
<th>Mode</th>
<th>Rate Value</th>
<th>Amount</th>
<th>Operator</th>
<th>remark</th>
<th>Create Time</th>
<th>Update Time</th>
<th>Operation</th>
@ -20,10 +20,10 @@
<tr ng-repeat="service in serviceAll">
<td style="max-width: 160px;line-height: 90px"><img style=" height:80px; max-width: 180px;"ng-src="{{service.logo_url}}"/></td>
<td style="line-height: 90px">{{service.channel}}</td>
<td style="line-height: 90px">{{service.incremental_mode==1?'固定手续费':'固定金额扣款' }}</td>
<td style="line-height: 90px">{{service.incremental_rate_value!=null?service.incremental_rate_value+'%':'-'}}</td>
<td style="line-height: 90px">{{service.total_incremental_amount}}</td>
<td style="line-height: 90px">{{service.operator}}</td>
<td style="line-height: 90px">{{service.title}}</td>
<td style="line-height: 90px">{{service.create_time}}</td>
<td style="line-height: 90px">{{service.update_time}}</td>
<td style="line-height: 90px">

@ -213,18 +213,15 @@
</div>
</div>
<div class="form-group col-xs-12" ng-if="'1000000000'|withRole">
<label class="control-label col-xs-4 col-sm-2">My Group</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}"
ng-click="chooseBD('all')">All</a>
<label ng-repeat="sub in bd_group_bds">
|&nbsp;<a role="button"
ng-class="{'bg-primary':sub.manager_id==chooseBDId}"
ng-click="chooseBD(sub.manager_id)">{{sub.bd_name}}</a>&nbsp;
</label>
</p>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2" for="only-mine-search">
产生增值服务费交易
</label>
<div class="col-xs-8 col-sm-4">
<div class="checkbox-inline">
<input type="checkbox" id="only-mine-search"
ng-model="params.onlyIncrementAmount" ng-click="loadTradeLogs(1)">
</div>
</div>
</div>

@ -22,8 +22,12 @@ $(function () {
cardFrame.frameStyle = {
width: '100%',
height: '400px',
border: 'none'
border: 'none',
borderRadius: '10px'
};
cardFrame.onReady = function(){
$('#readyModal').hide()
}
cardFrame.onError = function (msg) {
$('#errorMsgBox').text(msg).show();
};

@ -14,27 +14,27 @@ $(function () {
window.redirect = redirect;
}
}
if (window.disable_ws) {
setTimeout(checkStatus, 3000);
} else {
var sock = new SockJS('/register');
var client = Stomp.over(sock);
client.connect({}, function () {
client.subscribe('/app/payment/orders/' + window.order_id, function (msg) {
var json = JSON.parse(msg.body);
var concat = '?';
if (window.redirect.indexOf('?') > 0) {
concat = '&';
}
location.href = window.redirect + concat + 'time=' + json.time + '&nonce_str=' + json.nonce_str + '&sign=' + json.sign;
})
},function () {
setTimeout(checkStatus, 3000);
})
}
setTimeout(checkStatus, 3000);
// if (window.disable_ws) {
//
//
// } else {
//
// var sock = new SockJS('/register');
// var client = Stomp.over(sock);
// client.connect({}, function () {
// client.subscribe('/app/payment/orders/' + window.order_id, function (msg) {
// var json = JSON.parse(msg.body);
// var concat = '?';
// if (window.redirect.indexOf('?') > 0) {
// concat = '&';
// }
// location.href = window.redirect + concat + 'time=' + json.time + '&nonce_str=' + json.nonce_str + '&sign=' + json.sign;
// })
// },function () {
// setTimeout(checkStatus, 3000);
// })
// }
function checkStatus() {
$.ajax({
url: 'status',

Loading…
Cancel
Save