diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/beans/QueryCustomVo.java b/src/main/java/au/com/royalpay/payment/manage/custom/beans/QueryCustomVo.java index 1297d19f7..0f285f0ec 100644 --- a/src/main/java/au/com/royalpay/payment/manage/custom/beans/QueryCustomVo.java +++ b/src/main/java/au/com/royalpay/payment/manage/custom/beans/QueryCustomVo.java @@ -1,9 +1,12 @@ package au.com.royalpay.payment.manage.custom.beans; +import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateUtils; +import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -12,8 +15,9 @@ import java.text.SimpleDateFormat; * @date 2018/7/27 */ public class QueryCustomVo { - - private String date; + private final DateFormat format = new SimpleDateFormat("yyyyMMdd"); + private String datefrom; + private String dateto; private String channel; private String report_status; private int page = 1; @@ -21,12 +25,18 @@ public class QueryCustomVo { public JSONObject toParam() { JSONObject result = new JSONObject(); - if (StringUtils.isNotEmpty(date)) { - date = date.replace("Z", " UTC"); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z"); + if (datefrom != null) { + try { + result.put("from", format.parse(datefrom)); + } catch (ParseException e) { + throw new ParamInvalidException("datefrom", "error.payment.valid.invalid_date_format"); + } + } + if (dateto != null) { try { - result.put("date", format.parse(date)); + result.put("to", DateUtils.addDays(format.parse(dateto), 1)); } catch (ParseException e) { + throw new ParamInvalidException("dateto", "error.payment.valid.invalid_date_format"); } } if (StringUtils.isNotEmpty(channel)) { @@ -54,12 +64,20 @@ public class QueryCustomVo { this.limit = limit; } - public String getDate() { - return date; + public String getDatefrom() { + return datefrom; + } + + public void setDatefrom(String datefrom) { + this.datefrom = datefrom; + } + + public String getDateto() { + return dateto; } - public void setDate(String date) { - this.date = date; + public void setDateto(String dateto) { + this.dateto = dateto; } public String getChannel() { 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 8d473b7a5..47694c5e7 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 @@ -19,7 +19,9 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; +import java.util.ArrayList; import java.util.List; +import java.util.UUID; import javax.annotation.Resource; @@ -55,7 +57,7 @@ public class CustomServiceImpl implements CustomService { if (report != null) { throw new BadRequestException("report record exist"); } - CustomReport customReport = new CustomReport(addCustomVO.getOrder_id(), addCustomVO.getMch_custom_id(), addCustomVO.getMch_custom_name(), + CustomReport customReport = new CustomReport(UUID.randomUUID().toString(),addCustomVO.getOrder_id(), addCustomVO.getMch_custom_id(), addCustomVO.getMch_custom_name(), addCustomVO.getCustom()); customReport.addExtMchCustom(addCustomVO.getMch_ext_custom_id(), addCustomVO.getMch_ext_custom_name()); if (!CollectionUtils.isEmpty(addCustomVO.getSubOrders())) { @@ -83,7 +85,11 @@ public class CustomServiceImpl implements CustomService { @Override public JSONObject query(JSONObject param, int page, int limit) { param.put("orderStatus", OrderStatus.SUCCESS.getStatus()); - List channels = customSupport.customSupportedChannels(param.getIntValue("client_id")); +// List channels = customSupport.customSupportedChannels(param.getIntValue("client_id")); + List channels = new ArrayList<>(); + channels.add("Wechat"); + channels.add("Alipay"); + channels.add("AlipayOnline"); param.put("channels", channels); if (!StringUtils.isEmpty(param.getString("channel"))) { channels.clear(); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportDetailsMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportDetailsMapper.java index 59316c558..1d148ba56 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportDetailsMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportDetailsMapper.java @@ -15,7 +15,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.SqlType; /** * Created by yishuqian on 9/1/16. */ -@AutoMapper(tablename = "pmt_custom_report_details", pkName = "sub_order_no") +@AutoMapper(tablename = "pmt_custom_report_detail", pkName = "sub_order_no") public interface CustomReportDetailsMapper { @AutoSql(type = SqlType.SELECT) List findByReportId(@Param("report_id") String 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 441f8756a..f06a9b6e6 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 @@ -15,7 +15,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.SqlType; /** * Created by yishuqian on 9/1/16. */ -@AutoMapper(tablename = "pmt_custom_reports", pkName = "report_id") +@AutoMapper(tablename = "pmt_custom_report", pkName = "report_id") public interface CustomReportsMapper { @AutoSql(type = SqlType.SELECT) JSONObject findOne(@Param("report_id") String report_id); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.xml index ec3880a92..a8653e78c 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.xml @@ -12,7 +12,7 @@ pmt_transactions t on o.order_id = t.order_id left join - pmt_custom_reports r + pmt_custom_report r on r.order_id = o.order_id where o.channel in ( @@ -33,13 +33,12 @@ - - and DATE(t.transaction_time) = #{date} - + and t.transaction_time >= #{from} + and t.transaction_time < #{to} and r.report_status = #{report_status} order by transaction_time desc - \ No newline at end of file + diff --git a/src/main/ui/static/payment/custom/custom.js b/src/main/ui/static/payment/custom/custom.js index d81c288da..e62eb0dea 100644 --- a/src/main/ui/static/payment/custom/custom.js +++ b/src/main/ui/static/payment/custom/custom.js @@ -11,7 +11,41 @@ app.controller('customCtrl', ['$scope', '$http', 'commonDialog','$filter','$uibModal', function ($scope, $http, commonDialog,$filter,$uibModal) { $scope.pagination = {}; $scope.customOrders = {}; - $scope.params = {channel:'ALL',report_status:'ALL'}; + $scope.params = {channel :'ALL' ,report_status:'ALL',datefrom: new Date(), dateto: new Date()}; + $scope.chooseToday = function () { + $scope.params.datefrom = $scope.params.dateto = new Date(); + $scope.loadList(1); + }; + $scope.chooseYesterday = function () { + var yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + $scope.params.datefrom = $scope.params.dateto = yesterday; + $scope.loadList(1); + }; + $scope.chooseLast7Days = function () { + $scope.params.dateto = new Date(); + var day = new Date(); + day.setDate(day.getDate() - 7); + $scope.params.datefrom = day; + $scope.loadList(1); + }; + $scope.thisMonth = function () { + $scope.params.dateto = new Date(); + var monthBegin = new Date(); + monthBegin.setDate(1); + $scope.params.datefrom = monthBegin; + $scope.loadList(1); + }; + $scope.lastMonth = function () { + var monthFinish = new Date(); + monthFinish.setDate(0); + $scope.params.dateto = monthFinish; + var monthBegin = new Date(); + monthBegin.setDate(0); + monthBegin.setDate(1); + $scope.params.datefrom = monthBegin; + $scope.loadList(1); + }; $scope.loadList = function () { var params = angular.copy($scope.params); if (params.channel =='ALL'){ @@ -20,6 +54,16 @@ if (params.report_status =='ALL'){ delete params.report_status; } + if (params.datefrom) { + params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd'); + } else { + params.datefrom = $filter('date')(new Date(), 'yyyyMMdd'); + } + if (params.dateto) { + params.dateto = $filter('date')(params.dateto, 'yyyyMMdd'); + } else { + params.dateto = $filter('date')(new Date(), 'yyyyMMdd'); + } params.page = $scope.pagination.page || 1; $http.get('/custom/query',{params: params}).then(function (resp) { $scope.customOrders = resp.data.data; @@ -109,12 +153,24 @@ } $scope.custom.subOrders = $scope.subOrders; var param = angular.copy($scope.custom); - $http.post('/custom', param).then(function (resp) { + param.custom = $scope.custom.ext_custom_info[0]; + $http.post('/custom',param).then(function (resp) { $scope.$close(); }, function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); $scope.$close(); - }) + }); + if($scope.custom.ext_custom_info[1]){ + var infos = angular.copy($scope.custom); + infos.custom = $scope.custom.ext_custom_info[1]; + $http.post('/custom', infos).then(function (resp) { + $scope.$close(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + $scope.$close(); + }) + } + } $scope.removeSubOrders = function (order) { for(var i= 0 ;i<$scope.subOrders.length;i++){ @@ -195,13 +251,13 @@ return function (status) { switch (status + '') { case '0': - return 'Saved'; + return '暂存'; case '1': - return 'Submitted'; + return '已提交'; case '2': - return 'Failed'; + return '失败'; case '3': - return 'Success'; + return '成功'; } } }); @@ -209,4 +265,4 @@ return app; -}); \ No newline at end of file +}); diff --git a/src/main/ui/static/payment/custom/templates/custom.html b/src/main/ui/static/payment/custom/templates/custom.html index 15473745f..1d16e662d 100644 --- a/src/main/ui/static/payment/custom/templates/custom.html +++ b/src/main/ui/static/payment/custom/templates/custom.html @@ -5,12 +5,12 @@
-

Custom

+

海关

@@ -35,52 +35,114 @@
-->
- +

All | + ng-click="params.report_status='ALL';loadList()">全部 | Saved | + ng-click="params.report_status='0';loadList()">暂存 | Submitted | + ng-click="params.report_status='1';loadList()">已提交 | Failed | + ng-click="params.report_status='2';loadList()">失败 | Success | + ng-click="params.report_status='3';loadList()">成功 |

- +
- +

+ 全部 | + 微信 | + 支付宝| + 支付宝线上 +

+
+
+
+ +
+ +
+ ~ +
+ +
+
+ 今日 +
+
+ 昨日 +
+ +
+ 本月 +
+
+ 上月 +
+
+ +
+
+
-
+ + + + + + + + + + +
-

- Custom Order List +

+ 报关订单列表 + 商户报关API

- - - - - - + + + + + + @@ -116,20 +178,20 @@
Order IdTimeOrder AmountCNY AmountReport StatusOperation订单号时间金额金额(CNY)报关状态操作
- - Submit + 提交 - - @@ -153,8 +215,7 @@ first-text="«" last-text="»">
-
Total Records:{{pagination.totalCount}};Total - Pages:{{pagination.totalPages}} +
总单数:{{pagination.totalCount}};总页数:{{pagination.totalPages}}
diff --git a/src/main/ui/static/payment/custom/templates/custom_add.html b/src/main/ui/static/payment/custom/templates/custom_add.html index decf68d7b..7fd6cfe75 100644 --- a/src/main/ui/static/payment/custom/templates/custom_add.html +++ b/src/main/ui/static/payment/custom/templates/custom_add.html @@ -1,6 +1,6 @@