diff --git a/pom.xml b/pom.xml
index 351b5ceee..fcc8224a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
au.com.royalpay.payment
payment-parent
- 0.2.0
+ 0.2.0-dev
4.0.0
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 4c39e4ea5..5f929c292 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
@@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
/**
* @author kira
* @date 2018/7/27
@@ -18,7 +21,12 @@ public class QueryCustomVo {
public JSONObject toParam() {
JSONObject result = new JSONObject();
if (StringUtils.isNotEmpty(date)) {
- result.put("data", date);
+ date = date.replace("Z", " UTC");
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
+ try {
+ result.put("date", format.parse(date));
+ } catch (ParseException e) {
+ }
}
if (StringUtils.isNotEmpty(channel)) {
result.put("channel", channel);
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 dbeee4095..c363146b5 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
@@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.custom.core.impl;
import au.com.royalpay.payment.core.CustomSupport;
import au.com.royalpay.payment.core.beans.CustomReport;
+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;
@@ -42,7 +43,7 @@ public class CustomServiceImpl implements CustomService {
CustomReport customReport = new CustomReport(orderId, mchCustomId, custom);
if (!CollectionUtils.isEmpty(subOrders)) {
subOrders.forEach(p -> {
- customReport.addSubOrder(p.getBigDecimal("order_fee"), p.getBigDecimal("product_fee"));
+ customReport.addSubOrder(p.getBigDecimal("sub_order_fee"), p.getBigDecimal("sub_order_fee").subtract(p.getBigDecimal("transport_fee")));
});
}
JSONObject result = customSupport.saveCustom(customReport);
@@ -64,6 +65,7 @@ public class CustomServiceImpl implements CustomService {
@Override
public JSONObject query(JSONObject param, int page, int limit) {
+ param.put("orderStatus", OrderStatus.SUCCESS.getStatus());
return PageListUtils.buildPageListResult(customReportsMapper.queryWithTrans(param, new PageBounds(page, limit)));
}
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 2378dd501..c0e11c353 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
@@ -3,10 +3,14 @@ package au.com.royalpay.payment.manage.custom.web;
import au.com.royalpay.payment.manage.custom.beans.AddCustomVO;
import au.com.royalpay.payment.manage.custom.beans.QueryCustomVo;
import au.com.royalpay.payment.manage.custom.core.CustomService;
+import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
+import au.com.royalpay.payment.tools.CommonConsts;
import com.alibaba.fastjson.JSONObject;
+import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -15,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
-@RequestMapping(value = "/custom")
+@PartnerMapping(value = "/custom")
public class CustomController {
@Resource
@@ -27,13 +31,15 @@ public class CustomController {
}
@RequestMapping(value = "/query",method = RequestMethod.GET)
- public JSONObject queryWithTran( QueryCustomVo queryCustomVo) {
- return customService.query(queryCustomVo.toParam(),queryCustomVo.getPage(),queryCustomVo.getLimit());
+ public JSONObject queryWithTran(@ModelAttribute(CommonConsts.PARTNER_STATUS)JSONObject partner, QueryCustomVo queryCustomVo) {
+ JSONObject param = queryCustomVo.toParam();
+ param.put("client_id",partner.getIntValue("client_id"));
+ return customService.query(param,queryCustomVo.getPage(),queryCustomVo.getLimit());
}
@RequestMapping(value = "",method = RequestMethod.POST)
@ResponseBody
- public void add(AddCustomVO addCustomVO) {
+ public void add(@RequestBody AddCustomVO addCustomVO) {
customService.add(addCustomVO.getOrder_id(),addCustomVO.getMch_custom_no(),addCustomVO.getCustom(),addCustomVO.getSubOrders());
}
}
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 acfa29292..d17fd9fa3 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
@@ -3,18 +3,28 @@
diff --git a/src/main/ui/static/boot/index-boot.js b/src/main/ui/static/boot/index-boot.js
index 55e98e262..ebd3a9b18 100644
--- a/src/main/ui/static/boot/index-boot.js
+++ b/src/main/ui/static/boot/index-boot.js
@@ -59,6 +59,7 @@ var modules = [
{path: 'static/boot/indexMainApp', module: 'indexMainApp', roles: [1, 2, 3]},
{path: 'static/commons/commons', module: 'commons', roles: [1, 2, 3]},
{path: 'static/payment/good/good-manage', module: 'goodManagement', roles: [1, 2, 3]},
+ {path: 'static/payment/custom/custom', module: 'customManagement', roles: [1, 2, 3]},
{path: 'static/payment/partner/partner', module: 'partnerInfoApp', roles: [1, 2, 3]},
{path: 'static/payment/tradelog/tradelog', module: 'tradeLogApp', roles: [1, 2, 3]},
{path: 'static/payment/tradelog/transflow', module: 'balanceReport', roles: [1, 2, 3]},
diff --git a/src/main/ui/static/payment/custom/custom.js b/src/main/ui/static/payment/custom/custom.js
index cde928ad1..3bbaaa8fa 100644
--- a/src/main/ui/static/payment/custom/custom.js
+++ b/src/main/ui/static/payment/custom/custom.js
@@ -1,106 +1,105 @@
-define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch'], function (angular) {
- 'use strict';
-
- var app = angular.module('customManagement', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch']);
- app.config(['$stateProvider', function ($stateProvider) {
- $stateProvider.state('custom', {
- url: '/custom',
- templateUrl: '/static/payment/custom/templates/custom.html',
- controller: 'customCtrl'
- })
- }]);
- app.controller('customCtrl', ['$scope', '$http', 'commonDialog','$filter','orderService', function ($scope, $http, commonDialog,$filter,orderService) {
+ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) {
+ 'use strict';
+ var app = angular.module('customManagement', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload']);
+ app.config(['$stateProvider', function ($stateProvider) {
+ $stateProvider.state('custom', {
+ url: '/custom',
+ templateUrl: '/static/payment/custom/templates/custom.html',
+ controller: 'customCtrl'
+ })
+ }]);
+ app.controller('customCtrl', ['$scope', '$http', 'commonDialog','$filter','$uibModal', function ($scope, $http, commonDialog,$filter,$uibModal) {
$scope.pagination = {};
- $scope.params = {};
- $scope.new_bill = {};
- $scope.minDate = new Date();
- var maxDate = new Date();
- $scope.maxDate = maxDate.setDate(maxDate.getDate() + 14);
+ $scope.customOrders = {};
+ $scope.params = {channel:'ALL'};
+ $scope.loadList = function () {
+ var params = angular.copy($scope.params);
+ if (params.channel =='ALL'){
+ delete params.channel;
+ }
+ params.page = $scope.pagination.page || 1;
+ console.log(params);
+ $http.get('/custom/query',{params: params}).then(function (resp) {
+ $scope.customOrders = resp.data.data;
+ $scope.pagination = resp.data.pagination;
+ })
+ };
+ $scope.loadList(1);
+ $scope.add = function (order_id) {
+ $uibModal.open({
+ templateUrl: '/static/payment/custom/templates/custom_add.html',
+ controller: 'customAddCtrl',
+ size: 'lg',
+ resolve: {
+ order_id: function () {
+ return order_id;
+ }
+ }
+ })
+ }
+ }]);
- $scope.loadBills = function (page) {
- var params = angular.copy($scope.params);
- params.page = page || $scope.pagination.page || 1;
- $http.get('/partner/qrcode', {params: params}).then(function (resp) {
- $scope.bills = resp.data;
- $scope.pagination = resp.data.pagination;
- });
+ app.controller('customAddCtrl', ['$scope', '$http','commonDialog','order_id', function ($scope, $http,commonDialog,order_id) {
+ $scope.custom = {has_sub:false,order_id:order_id};
+ $scope.subOrders = new Array();
+ $scope.subOrder = {};
+ $scope.addSubOrders = function () {
+ var subOrder = angular.copy($scope.subOrder);
+ subOrder.idNum = $scope.subOrders.length+1;
+ $scope.subOrders.push(subOrder);
};
- $scope.loadBills(1);
- $scope.generateBill = function () {
- var params = angular.copy($scope.new_bill);
- if(!params.client_order_id){
- alert("client order id为空,是否后台自动生成?");
- }
- if(!params.order_amount){
- alert("order amount不可为空!");
- return;
+ $scope.submit=function () {
+ if($scope.custom.custom==''){
+ alert('请输入海关名称');
}
- if(params.cancle_time){
- params.cancle_time = $filter('date')(params.cancle_time, 'yyyy-MM-dd HH:mm:ss')
- }else {
- alert("Expire Date 不可为空!");
+ if($scope.custom.mchCustomId==''){
+ alert('请输入备案号');
}
- $http.post('/partner/qrcode/bills',params).then(function (resp) {
- commonDialog.alert({title: 'Success', content: 'Success', type: 'success'});
- $scope.code_url = resp.data;
- $scope.loadBills(1);
- },function (resp) {
+ $scope.custom.subOrders = $scope.subOrders;
+ var param = angular.copy($scope.custom);
+ $http.post('/custom', param).then(function (resp) {
+ $scope.$close();
+ }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
- });
- };
- $scope.disableBill = function (bill) {
- commonDialog.confirm(
- {
- title: 'Delete Bill',
- content: 'Are you sure to delete this bill?'
- }).then(function () {
- $http.delete('/partner/qrcode/'+bill.bill_code_id).then(function(){
- $scope.loadBills(1);
- });
})
- };
- $scope.clearBill = function () {
- $scope.new_bill = {};
- $scope.code_url = "";
- };
+ }
+ $scope.removeSubOrders = function (order) {
+ for(var i= 0 ;i<$scope.subOrders.length;i++){
+ if($scope.subOrders[i].idNum == order.idNum){
+ $scope.subOrders.splice(i,1);
+ return;
+ }
+ }
+
+ }
+
+
+
+ }]);
+
+ app.controller('customDetailCtrl', ['$scope', '$http','commonDialog', function ($scope, $http,commonDialog) {
+ $scope.subOrders = {};
+
- $scope.showTradeDetail = function (order) {
- orderService.clientOrderDetail(order)
- };
}]);
- app.filter('billStatus', function () {
+
+ app.filter('reportStatus', function () {
return function (status) {
switch (status + '') {
+ case '0':
+ return '暂存';
case '1':
- return 'wait for payment';
+ return '提交';
case '2':
- return 'disabled';
+ return '提交失败';
case '3':
- return 'payment success'
+ return '提交成功';
}
}
});
- app.filter('remarkCut', function () {
- return function (value, wordwise, max, tail) {
- if (!value) return '';
-
- max = parseInt(max, 10);
- if (!max) return value;
- if (value.length <= max) return value;
-
- value = value.substr(0, max);
- if (wordwise) {
- var lastspace = value.lastIndexOf(' ');
- if (lastspace != -1) {
- value = value.substr(0, lastspace);
- }
- }
- return value + (tail || ' …');
- };
- });
return app;
diff --git a/src/main/ui/static/payment/custom/templates/custom.html b/src/main/ui/static/payment/custom/templates/custom.html
index 112dfc9b8..40b07cf2e 100644
--- a/src/main/ui/static/payment/custom/templates/custom.html
+++ b/src/main/ui/static/payment/custom/templates/custom.html
@@ -22,146 +22,75 @@
-
-
-
-
- | Order Amount |
- Reference NO |
- Payer |
- Order Status |
- Bill Status |
- Expire Date |
- Remark |
- Create time |
- Operation |
+ 订单号 |
+ 时间 |
+ 订单金额 |
+ 人民币金额 |
+ 报关状态 |
+ 操作 |
-
- |
- |
- |
- |
- |
- |
- |
- |
+
+ |
+ |
+ |
+ |
+ |
-
+
-
- Disable
|
-