diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/core/CustomService.java b/src/main/java/au/com/royalpay/payment/manage/custom/core/CustomService.java index 6eb040782..e0bcff181 100644 --- a/src/main/java/au/com/royalpay/payment/manage/custom/core/CustomService.java +++ b/src/main/java/au/com/royalpay/payment/manage/custom/core/CustomService.java @@ -20,4 +20,5 @@ public interface CustomService { List channelCustomConfigs(String channel); + void resend(String report_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java index b7709c6ad..d21e86bf9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java @@ -6,6 +6,7 @@ import au.com.royalpay.payment.core.beans.OrderStatus; import au.com.royalpay.payment.manage.custom.core.CustomService; import au.com.royalpay.payment.manage.mappers.custom.CustomReportDetailsMapper; import au.com.royalpay.payment.manage.mappers.custom.CustomReportsMapper; +import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.utils.PageListUtils; import com.alibaba.fastjson.JSONObject; @@ -49,6 +50,10 @@ public class CustomServiceImpl implements CustomService { @Override public void add(String orderId, String mchCustomId, String custom, String mchCustomName, List subOrders) { + JSONObject report = customReportsMapper.findOne(orderId); + if(report!=null){ + throw new BadRequestException("report record exist"); + } CustomReport customReport = new CustomReport(orderId, mchCustomId, mchCustomName, custom); if (!CollectionUtils.isEmpty(subOrders)) { subOrders.forEach(p -> { @@ -90,4 +95,14 @@ public class CustomServiceImpl implements CustomService { return customSupport.channelCustomConfigs(channel); } + @Override + public void resend(String report_id) { + JSONObject report = customReportsMapper.findOne(report_id); + if(report.getIntValue("report_status")!=2){ + throw new BadRequestException("order can't report"); + } + customSupport.sendCustom(report_id); + + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/web/CustomController.java b/src/main/java/au/com/royalpay/payment/manage/custom/web/CustomController.java index a11082be8..797ba3722 100644 --- a/src/main/java/au/com/royalpay/payment/manage/custom/web/CustomController.java +++ b/src/main/java/au/com/royalpay/payment/manage/custom/web/CustomController.java @@ -50,4 +50,10 @@ public class CustomController { public List channelCustomConfigs(@RequestParam String channel) { return customService.channelCustomConfigs(channel); } + + @RequestMapping(value = "/{report_id}/resend",method = RequestMethod.POST) + public void resend(@PathVariable String report_id) { + customService.resend(report_id); + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.java index 462675dd6..441f8756a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.java @@ -20,5 +20,8 @@ public interface CustomReportsMapper { @AutoSql(type = SqlType.SELECT) JSONObject findOne(@Param("report_id") String report_id); + @AutoSql(type = SqlType.SELECT) + JSONObject findByOrderId(@Param("order_id")String order_id); + PageList queryWithTrans(JSONObject param,PageBounds pagination); } diff --git a/src/main/ui/static/payment/custom/custom.js b/src/main/ui/static/payment/custom/custom.js index 27d96937b..c8195b668 100644 --- a/src/main/ui/static/payment/custom/custom.js +++ b/src/main/ui/static/payment/custom/custom.js @@ -80,6 +80,14 @@ }) } + $scope.resend = function (order) { + $http.post('/custom/'+order.report_id+'/resend').then(function () { + $scope.loadList(1); + }, function (resp) { + $scope.loadList(1); + }); + } + }]); app.controller('customAddCtrl', ['$scope', '$http','commonDialog','order_id','channelCustom', function ($scope, $http,commonDialog,order_id,channelCustom) { diff --git a/src/main/ui/static/payment/custom/templates/custom.html b/src/main/ui/static/payment/custom/templates/custom.html index 48f4d1b6e..2a15a45f7 100644 --- a/src/main/ui/static/payment/custom/templates/custom.html +++ b/src/main/ui/static/payment/custom/templates/custom.html @@ -124,6 +124,13 @@ ng-click="detail(order)"> + + + + + +