settle tasks api

master
yixian 5 years ago
parent 89bbdc5c6e
commit 53797f8654

@ -1,7 +1,5 @@
package au.com.royalpay.payment.manage.analysis.beans.ato; package au.com.royalpay.payment.manage.analysis.beans.ato;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;

@ -8,7 +8,7 @@ import java.util.List;
public interface PriorityListManager { public interface PriorityListManager {
List<JSONObject> listPriorityMerchants(); List<JSONObject> listPriorityMerchants();
void setMerchantPriority(String clientMoniker, JSONObject manager); JSONObject setMerchantPriority(String clientMoniker, JSONObject manager);
void removePriorityMerchant(String clientMoniker, JSONObject manager); void removePriorityMerchant(String clientMoniker, JSONObject manager);

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.management.clearing.core.impl;
import au.com.royalpay.payment.manage.management.clearing.beans.PriorityModifyLog; import au.com.royalpay.payment.manage.management.clearing.beans.PriorityModifyLog;
import au.com.royalpay.payment.manage.management.clearing.core.PriorityListManager; import au.com.royalpay.payment.manage.management.clearing.core.PriorityListManager;
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.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil; import au.com.royalpay.payment.tools.utils.id.IdUtil;
@ -47,8 +48,8 @@ public class PriorityListManagerImpl implements PriorityListManager {
} }
@Override @Override
public void setMerchantPriority(String clientMoniker, JSONObject manager) { public JSONObject setMerchantPriority(String clientMoniker, JSONObject manager) {
JSONObject client = mchInfoProvider.getClientInfoByMoniker(clientMoniker); JSONObject client = MonikerStringUtils.getSimplifiedClientsInfo(mchInfoProvider, clientMoniker);
if (client == null) { if (client == null) {
throw new NotFoundException("Client " + clientMoniker + " not found"); throw new NotFoundException("Client " + clientMoniker + " not found");
} }
@ -57,7 +58,7 @@ public class PriorityListManagerImpl implements PriorityListManager {
List<String> monikerList = MonikerStringUtils.splitStringArray(clientMonikers).collect(Collectors.toList()); List<String> monikerList = MonikerStringUtils.splitStringArray(clientMonikers).collect(Collectors.toList());
if (monikerList.stream().anyMatch(moniker -> moniker.equalsIgnoreCase(clientMoniker))) { if (monikerList.stream().anyMatch(moniker -> moniker.equalsIgnoreCase(clientMoniker))) {
logger.debug("{} exists,ignore", clientMoniker); logger.debug("{} exists,ignore", clientMoniker);
return; throw new BadRequestException("Client exists");
} }
monikerList.add(clientMoniker.toUpperCase()); monikerList.add(clientMoniker.toUpperCase());
String joinedMonikers = String.join(",", monikerList); String joinedMonikers = String.join(",", monikerList);
@ -74,6 +75,7 @@ public class PriorityListManagerImpl implements PriorityListManager {
mongoTemplate.insert(log); mongoTemplate.insert(log);
} catch (Exception ignore) { } catch (Exception ignore) {
} }
return client;
} }
@Override @Override

@ -49,8 +49,8 @@ public class SettleTasksController {
} }
@PutMapping("/priority_merchants/{clientMoniker}") @PutMapping("/priority_merchants/{clientMoniker}")
public void setMerchantPriority(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public JSONObject setMerchantPriority(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
priorityListManager.setMerchantPriority(clientMoniker, manager); return priorityListManager.setMerchantPriority(clientMoniker, manager);
} }
@DeleteMapping("/priority_merchants/{clientMoniker}") @DeleteMapping("/priority_merchants/{clientMoniker}")

@ -152,7 +152,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
tasks.push(submitTask) tasks.push(submitTask)
} }
$http.post('/sys/settle_tasks', tasks).then(function (resp) { $http.post('/sys/settle_tasks', tasks).then(function (resp) {
commonDialog.alert({type: 'success', title: 'Success', content: resp.data.message}) commonDialog.alert({type: 'success', title: 'Success', content: 'Task submitted'})
ctrl.update_task = $interval(function () { ctrl.update_task = $interval(function () {
$scope.checkProgressStatus() $scope.checkProgressStatus()
}, 5000); }, 5000);
@ -198,18 +198,29 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
if (!$scope.input.moniker) { if (!$scope.input.moniker) {
return; return;
} }
$http.put('/sys/settle_tasks/priority_merchants/' + $scope.input.moniker).then(function () { $http.put('/sys/settle_tasks/priority_merchants/' + $scope.input.moniker).then(function (res) {
commonDialog.alert({
type: 'success',
title: 'Client Added',
content: res.data.client_moniker + ' added into priority list'
});
$scope.loadPriorities(); $scope.loadPriorities();
}, function (res) { }, function (res) {
commonDialog.alert({type: 'error', title: 'Error', content: res.data.message}) commonDialog.alert({type: 'error', title: 'Error', content: res.data.message})
}) })
}; };
$scope.dropPriorityClient = function (client) { $scope.dropPriorityClient = function (client) {
$http['delete']('/sys/settle_tasks/priority_merchants/' + client.client_moniker).then(function () { commonDialog.confirm({
$scope.loadPriorities(); title: 'Disable client priority',
}, function (res) { content: 'Disabling ' + client.client_moniker + ' in priority list, confirm?'
commonDialog.alert({type: 'error', title: 'Error', content: res.data.message}) }).then(function () {
$http['delete']('/sys/settle_tasks/priority_merchants/' + client.client_moniker).then(function () {
$scope.loadPriorities();
}, function (res) {
commonDialog.alert({type: 'error', title: 'Error', content: res.data.message})
})
}) })
}; };
$scope.listHistory = function () { $scope.listHistory = function () {
$uibModal.open({ $uibModal.open({

@ -19,7 +19,7 @@ import java.nio.charset.StandardCharsets;
* Create by yixian at 2018-08-31 14:40 * Create by yixian at 2018-08-31 14:40
*/ */
@SpringBootTest @SpringBootTest
@ActiveProfiles({"proxy", "wechat","alipay","bestpay","rpay","jd","yeepay"}) @ActiveProfiles({"proxy", "wechat", "alipay", "common", "rppaysvc", "rpay"})
@TestPropertySource(properties = {"spring.datasource.username=root", "spring.datasource.password=ZOIBhellor0yalpay"}) @TestPropertySource(properties = {"spring.datasource.username=root", "spring.datasource.password=ZOIBhellor0yalpay"})
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
public class ExportATOReport { public class ExportATOReport {
@ -28,7 +28,7 @@ public class ExportATOReport {
@Test @Test
public void export() throws IOException { public void export() throws IOException {
String content = atoReportService.exportBTTPSFile(DateTime.parse("2018-07-01").toDate(), DateTime.parse("2019-06-30").toDate()); String content = atoReportService.exportBTTPSFile(DateTime.parse("2019-07-01").toDate(), DateTime.parse("2020-06-30").toDate());
FileUtils.write(new File("C:\\Users\\davep\\Documents\\royalpay2018070120190630.bttps"), content, StandardCharsets.US_ASCII); FileUtils.write(new File("/Users/yixian/documents/royalpay2019070120200630.bttps"), content, StandardCharsets.US_ASCII);
} }
} }

Loading…
Cancel
Save