settle tasks api

master
yixian 4 years ago
parent 89bbdc5c6e
commit 53797f8654

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

@ -8,7 +8,7 @@ import java.util.List;
public interface PriorityListManager {
List<JSONObject> listPriorityMerchants();
void setMerchantPriority(String clientMoniker, JSONObject manager);
JSONObject setMerchantPriority(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.core.PriorityListManager;
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.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
@ -47,8 +48,8 @@ public class PriorityListManagerImpl implements PriorityListManager {
}
@Override
public void setMerchantPriority(String clientMoniker, JSONObject manager) {
JSONObject client = mchInfoProvider.getClientInfoByMoniker(clientMoniker);
public JSONObject setMerchantPriority(String clientMoniker, JSONObject manager) {
JSONObject client = MonikerStringUtils.getSimplifiedClientsInfo(mchInfoProvider, clientMoniker);
if (client == null) {
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());
if (monikerList.stream().anyMatch(moniker -> moniker.equalsIgnoreCase(clientMoniker))) {
logger.debug("{} exists,ignore", clientMoniker);
return;
throw new BadRequestException("Client exists");
}
monikerList.add(clientMoniker.toUpperCase());
String joinedMonikers = String.join(",", monikerList);
@ -74,6 +75,7 @@ public class PriorityListManagerImpl implements PriorityListManager {
mongoTemplate.insert(log);
} catch (Exception ignore) {
}
return client;
}
@Override

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

@ -152,7 +152,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
tasks.push(submitTask)
}
$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 () {
$scope.checkProgressStatus()
}, 5000);
@ -198,18 +198,29 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
if (!$scope.input.moniker) {
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();
}, function (res) {
commonDialog.alert({type: 'error', title: 'Error', content: res.data.message})
})
};
$scope.dropPriorityClient = function (client) {
$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})
commonDialog.confirm({
title: 'Disable client priority',
content: 'Disabling ' + client.client_moniker + ' in priority list, confirm?'
}).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 () {
$uibModal.open({

@ -19,7 +19,7 @@ import java.nio.charset.StandardCharsets;
* Create by yixian at 2018-08-31 14:40
*/
@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"})
@RunWith(SpringRunner.class)
public class ExportATOReport {
@ -28,7 +28,7 @@ public class ExportATOReport {
@Test
public void export() throws IOException {
String content = atoReportService.exportBTTPSFile(DateTime.parse("2018-07-01").toDate(), DateTime.parse("2019-06-30").toDate());
FileUtils.write(new File("C:\\Users\\davep\\Documents\\royalpay2018070120190630.bttps"), content, StandardCharsets.US_ASCII);
String content = atoReportService.exportBTTPSFile(DateTime.parse("2019-07-01").toDate(), DateTime.parse("2020-06-30").toDate());
FileUtils.write(new File("/Users/yixian/documents/royalpay2019070120200630.bttps"), content, StandardCharsets.US_ASCII);
}
}

Loading…
Cancel
Save