Merge branch 'develop'

master
yixian 4 years ago
commit 483367cf45

@ -13,4 +13,7 @@ public interface SettleTasksService {
List<JSONObject> listMerchantsInfo(String mchMonikers); List<JSONObject> listMerchantsInfo(String mchMonikers);
void submitTasks(List<ManualSettleTask> tasks); void submitTasks(List<ManualSettleTask> tasks);
List<JSONObject> analysisYesterdayTransaction();
} }

@ -1,15 +1,20 @@
package au.com.royalpay.payment.manage.management.clearing.core.impl; package au.com.royalpay.payment.manage.management.clearing.core.impl;
import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.manage.management.clearing.core.SettleTasksService; import au.com.royalpay.payment.manage.management.clearing.core.SettleTasksService;
import au.com.royalpay.payment.manage.management.clearing.web.ManualSettleTask; import au.com.royalpay.payment.manage.management.clearing.web.ManualSettleTask;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.SysSettlePlanMapper; import au.com.royalpay.payment.manage.mappers.system.SysSettlePlanMapper;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.livecheck.AppLiveCheck; import au.com.royalpay.payment.tools.livecheck.AppLiveCheck;
import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
@ -25,8 +30,10 @@ import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI; import java.net.URI;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.TimeZone;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -34,6 +41,8 @@ public class SettleTaskServiceImpl implements SettleTasksService {
private final SysSettlePlanMapper planMapper; private final SysSettlePlanMapper planMapper;
private final StringRedisTemplate redisTemplate; private final StringRedisTemplate redisTemplate;
private final MerchantInfoProvider mchInfoProvider; private final MerchantInfoProvider mchInfoProvider;
private final PaymentApi paymentApi;
private final TransactionMapper transactionMapper;
private final String prefix; private final String prefix;
private final RestTemplate restTemplate; private final RestTemplate restTemplate;
private final String transactionHost; private final String transactionHost;
@ -41,11 +50,13 @@ public class SettleTaskServiceImpl implements SettleTasksService {
private static final String SETTLE_TASK_URI = "/dev/manual/settle_tasks"; private static final String SETTLE_TASK_URI = "/dev/manual/settle_tasks";
public SettleTaskServiceImpl(SysSettlePlanMapper planMapper, StringRedisTemplate redisTemplate, public SettleTaskServiceImpl(SysSettlePlanMapper planMapper, StringRedisTemplate redisTemplate,
MerchantInfoProvider mchInfoProvider, @Value("${app.redis.prefix}") String prefix, MerchantInfoProvider mchInfoProvider, PaymentApi paymentApi, TransactionMapper transactionMapper, @Value("${app.redis.prefix}") String prefix,
@Value("${platform.services.transaction:http://127.0.0.1:6012}") String transactionHost, AppLiveCheck appLiveCheck) { @Value("${platform.services.transaction:http://127.0.0.1:6012}") String transactionHost, AppLiveCheck appLiveCheck) {
this.planMapper = planMapper; this.planMapper = planMapper;
this.redisTemplate = redisTemplate; this.redisTemplate = redisTemplate;
this.mchInfoProvider = mchInfoProvider; this.mchInfoProvider = mchInfoProvider;
this.paymentApi = paymentApi;
this.transactionMapper = transactionMapper;
this.prefix = prefix; this.prefix = prefix;
this.appLiveCheck = appLiveCheck; this.appLiveCheck = appLiveCheck;
this.restTemplate = new RestTemplateBuilder() this.restTemplate = new RestTemplateBuilder()
@ -108,5 +119,15 @@ public class SettleTaskServiceImpl implements SettleTasksService {
} }
} }
@Override
public List<JSONObject> analysisYesterdayTransaction() {
Date from = DateTime.now().withMillisOfDay(0).withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone("Asia/Shanghai")))
.minusDays(1).toDate();
Date to = new DateTime(from).plusDays(1).toDate();
List<String> channels = paymentApi.channelsInGroup(BalanceGroup.NORMAL_CROSS_BORDER);
channels.remove("System");
return transactionMapper.analysisByChannels(from, to, channels);
}
} }

@ -14,14 +14,19 @@ import java.util.List;
@RestController @RestController
@ManagerMapping(value = "/sys/settle_tasks", role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.DEVELOPER}) @ManagerMapping(value = "/sys/settle_tasks", role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.DEVELOPER})
public class SettleTasksController { public class SettleTasksController {
private SettleTasksService svc; private final SettleTasksService svc;
private PriorityListManager priorityListManager; private final PriorityListManager priorityListManager;
public SettleTasksController(SettleTasksService svc, PriorityListManager priorityListManager) { public SettleTasksController(SettleTasksService svc, PriorityListManager priorityListManager) {
this.svc = svc; this.svc = svc;
this.priorityListManager = priorityListManager; this.priorityListManager = priorityListManager;
} }
@GetMapping("/yesterday_trans_analysis")
public List<JSONObject> getYesterdayTransAnalysis() {
return svc.analysisYesterdayTransaction();
}
@GetMapping("/plans") @GetMapping("/plans")
public List<JSONObject> listPlans() { public List<JSONObject> listPlans() {
return svc.listPlans(); return svc.listPlans();

@ -166,4 +166,5 @@ public interface TransactionMapper {
*/ */
List<JSONObject> getSettleDataDailyReport(@Param("beginTime") Date beginTime,@Param("endTime")Date endTime); List<JSONObject> getSettleDataDailyReport(@Param("beginTime") Date beginTime,@Param("endTime")Date endTime);
List<JSONObject> analysisByChannels(@Param("from") Date from, @Param("to") Date to, @Param("channels") List<String> channels);
} }

@ -1479,4 +1479,15 @@
AND channel != 'Settlement' AND channel != 'Settlement'
GROUP BY channel GROUP BY channel
</select> </select>
<select id="analysisByChannels" resultType="com.alibaba.fastjson.JSONObject">
select
o.merchant_id,t.channel,sum(if(transaction_type='Credit',clearing_amount-channel_surcharge,channel_surcharge-clearing_amount))
amt
from pmt_transactions t
inner join pmt_orders o on o.order_id=t.order_id
where t.transaction_time between #{from} and #{to}
and t.system_generate=0 and t.channel in
<foreach collection="channels" open="(" close=")" separator="," item="channel">#{channel}</foreach>
group by o.merchant_id
</select>
</mapper> </mapper>

@ -28,6 +28,20 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.redirectToSettleLogs = function () { $scope.redirectToSettleLogs = function () {
$state.go('clearingLogs.settlementDetail', {date: $filter('date')(new Date(), 'yyyy-MM-dd')}) $state.go('clearingLogs.settlementDetail', {date: $filter('date')(new Date(), 'yyyy-MM-dd')})
} }
$scope.displayYesterdayTransaction = function () {
$uibModal.open({
templateUrl: '/static/analysis/templates/yesterday_trans_report.html',
controller: ['$scope', 'data', function (scope, data) {
scope.data = data.data
}],
resolve: {
'data': ['$http', function (http) {
return http.get('/sys/settle_tasks/yesterday_trans_analysis')
}]
},
size: 'lg'
})
};
$scope.checkProgressStatus = function () { $scope.checkProgressStatus = function () {
let defer = $q.defer(); let defer = $q.defer();
$http.get('/sys/settle_tasks/current_progress').then(function (res) { $http.get('/sys/settle_tasks/current_progress').then(function (res) {

@ -25,6 +25,9 @@
<button type="button" class="btn btn-primary" ng-click="redirectToSettleLogs()">Today Settlement Logs <button type="button" class="btn btn-primary" ng-click="redirectToSettleLogs()">Today Settlement Logs
</button> </button>
<a class="btn btn-primary" ui-sref=".priority_list">Priority List</a> <a class="btn btn-primary" ui-sref=".priority_list">Priority List</a>
<button type="button" class="btn btn-primary" ng-click="displayYesterdayTransaction()">Yesterday
Transaction Funds
</button>
</div> </div>
</div> </div>
<div class="box box-info"> <div class="box box-info">

@ -0,0 +1,24 @@
<div class="modal-header">
Yesterday Transaction Analysis
</div>
<div class="modal-body">
<table class="table-bordered table-striped table-hover">
<thead>
<tr>
<th>Channel</th>
<th>Merchant ID</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="channel in data">
<td ng-bind="channel.channel"></td>
<td ng-bind="channel.merchant_id"></td>
<td ng-bind="channel.amt|currency:'A$'"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger"><i class="fa fa-close"></i> Close</button>
</div>
Loading…
Cancel
Save