master
kira 8 years ago
parent bfad3255f4
commit 981459d0bb

@ -5,7 +5,7 @@
<parent>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId>
<version>0.2.0</version>
<version>0.2.0-dev</version>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -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);

@ -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)));
}

@ -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());
}
}

@ -3,18 +3,28 @@
<mapper namespace="au.com.royalpay.payment.manage.mappers.custom.CustomReportsMapper">
<select id="queryWithTrans" resultType="com.alibaba.fastjson.JSONObject">
select * from
pmt_custom_reports r
select o.order_id order_id, t.transaction_time transaction_time, t.transaction_amount transaction_amount,t.cny_amount cny_amount ,r.report_status report_status
from
pmt_orders o
left join
pmt_transactions t
on r.order_id = t.order_id
<if test="channel!=null">
and r.channel = #{channel}
</if>
on o.order_id = t.order_id
and
o.status in (
<foreach collection="orderStatus" item="item" separator=",">
#{item}
</foreach>
)
left join
pmt_custom_reports r
on r.order_id = o.order_id
and o.client_id = #{client_id}
<where>
<if test="channel!=null">
and o.channel = #{channel}
</if>
<if test="date!=null">
DATE(t.transaction_time) = #{date}
and DATE(t.transaction_time) = #{date}
</if>
</where>
</select>

@ -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]},

@ -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;

@ -22,146 +22,75 @@
<div class="box-header">
<div class="form-horizontal col-sm-8">
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">* Order Amount</label>
<label class="control-label col-xs-4 col-sm-3">Channel</label>
<div class="col-xs-8 col-sm-6">
<div class="input-group">
<input type="number" step="0.01" name="order_amount" class="form-control form-control-float"
ng-model="new_bill.order_amount" required
onkeyup="this.value=this.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2">$</span>
</div>
<p class="small text-info"></p>
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.channel=='ALL'}"
ng-click="params.channel='ALL';loadList()">All</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='Wechat'}"
ng-click="params.channel='Wechat';loadList()">Wechat Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='Alipay'}"
ng-click="params.channel='Alipay';loadList()">Alipay</a> |
</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">* Expire Date</label>
<label class="control-label col-xs-4 col-sm-3">Date</label>
<div class="col-xs-8 col-sm-6">
<input class="form-control" ng-model="new_bill.cancle_time"
<input class="form-control" ng-model="params.date"
uib-datepicker-popup size="10" is-open="ctrl.dateInput"
ng-click="ctrl.dateInput=true"
datepicker-options="{minDate:minDate,maxDate:maxDate}" name="cancle_time" required>
<p class="small text-info">The date of expiry should not exceed fifteen days</p>
datepicker-options="{minDate:minDate,maxDate:maxDate}" name="date" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">Reference NO</label>
<div class="col-xs-8 col-sm-6">
<input class="form-control" ng-model="new_bill.client_order_id">
<p class="small text-info"> System will automatically generate when the Reference NO is empty</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">Remark</label>
<div class="col-xs-8 col-sm-6">
<textarea maxlength="100" class="form-control" ng-model="new_bill.remark"></textarea>
<p class="small text-info">within 100 characters</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3"></label>
<div class="col-sm-6">
<button class="btn btn-success" ng-click="generateBill()">generate
</button>&nbsp;&nbsp;&nbsp;
<button class="btn btn-primary" ng-click="clearBill()">clear</button>
</div>
</div>
</div>
<div class="col-sm-4" style="text-align: center" ng-if="code_url">
<a class="thumbnail" download ng-href="{{code_url}}" uib-tooltip="Download">
<img ng-src="{{code_url}}">
</a>
<p>
<a ng-href="{{code_url}}" download><i class="fa fa-download"></i> Download Bill QR
Code Image</a>
</p>
</div>
</div>
</div>
<div class="box box-warning">
<div class="box-header">
<div class="form-inline">
<div class="form-group">
<label class="control-label">Bill Status</label>
&nbsp;
<a role="button" ng-class="{'bg-primary':params.status==null}"
ng-click="params.status=null;loadBills(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.status==3}"
ng-click="params.status=3;loadBills(1)">Success</a> |
<a role="button" ng-class="{'bg-primary':params.status==2}"
ng-click="params.status=2;loadBills(1)">Disabled</a>
</div>
&nbsp; &nbsp; &nbsp; &nbsp;
<div class="form-group">
<label class="control-label" >Reference NO</label>
<input type="text" class="form-control"
ng-model="params.client_order_id"
ng-enter="loadBills(1)">
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="loadBills(1)"><i
<button class="btn btn-primary" type="button" ng-click="loadList(1)"><i
class="fa fa-search"></i></button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">
Bill List
Custom Order List
</h3>
</div>
<div class="box-body table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Order Amount</th>
<th>Reference NO</th>
<th>Payer</th>
<th>Order Status</th>
<th>Bill Status</th>
<th>Expire Date</th>
<th>Remark</th>
<th>Create time</th>
<th>Operation</th>
<th>订单号</th>
<th>时间</th>
<th>订单金额</th>
<th>人民币金额</th>
<th>报关状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="bill in bills"
ng-class="{'delete':bill.status==2}">
<td ng-bind="bill.order_amount | currency:'AUD '"></td>
<th ng-bind="bill.client_order_id"></th>
<td ng-bind="bill.nickname"></td>
<th ng-bind="bill.order_status|tradeStatus"></th>
<th ng-bind="bill.status|billStatus"></th>
<td ng-bind="bill.cancle_time |limitTo:10"></td>
<td ng-bind="bill.remark|remarkCut:true:10:'...'"></td>
<td ng-bind="bill.create_time"></td>
<tr ng-repeat="order in customOrders">
<td ng-bind="order.order_id"></td>
<th ng-bind="order.transaction_time"></th>
<td ng-bind="order.transaction_amount"></td>
<th ng-bind="order.cny_amount"></th>
<th ng-bind="order.report_status|reportStatus"></th>
<td>
<a ng-if="bill.order_id&&bill.status!=2" class="text-primary" role="button" title="Detail"
ng-click="showTradeDetail(bill)">
<a class="text-primary" role="button" title="Detail"
ng-click="add(order.order_id)">
<i class="fa fa-search"></i>
</a>
<a ng-if="bill.code_url&&bill.status==1" ng-href="{{bill.code_url}}" download><i
class="fa fa-download"
uib-tooltip="Download Bill QR Code Image"></i></a>
<a ng-if="!bill.order_id&&bill.status==1"
class="text-bold text-danger" role="button" ng-click="disableBill(bill)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="bills.length">
<div class="box-footer" ng-if="customOrders.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadBills(1)"
ng-change="loadList(1)"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"

@ -0,0 +1,80 @@
<div class="modal-header">
<h4>Add Declare Custom</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<form class="form-horizontal" novalidate name="rate_form">
<div class="form-group">
<label class="control-label col-sm-4" for="custom">海关</label>
<div class="col-sm-6">
<input class="form-control" ng-model="custom.custom" id="custom" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="mch_custom_no">备案号</label>
<div class="col-sm-6">
<input class="form-control" ng-model="custom.mch_custom_no" id="mch_custom_no" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="has_sub">是否拆单</label>
<div class="col-sm-6">
<input ng-model="custom.has_sub" id="has_sub" type="checkbox">
</div>
</div>
<div class="form-group" ng-if="custom.has_sub">
<table class="table table-striped">
<thead>
<tr>
<th>海关金额</th>
<th>运费金额</th>
<th>消费者名称</th>
<th>消费者ID</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="subOrder in subOrders">
<td ng-bind="subOrder.sub_order_fee | currency:'AUD '"></td>
<td ng-bind="subOrder.transport_fee"></td>
<td ng-bind="subOrder.buyer_name"></td>
<td ng-bind="subOrder.cert_id"></td>
<td>
<a role="button" class="text-danger text-bold ng-scope" ng-click="removeSubOrders(subOrder)">remove</a>
</td>
</tr>
</tbody>
</table>
</div>
<div ng-if="custom.has_sub">
<div class="form-group">
<label class="control-label col-sm-4" for="sub_order_fee">订单金额</label>
<div class="col-sm-6">
<input class="form-control" ng-model="subOrder.sub_order_fee" id="sub_order_fee" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="transport_fee">运费金额</label>
<div class="col-sm-6">
<input class="form-control" ng-model="subOrder.transport_fee" id="transport_fee" type="text">
</div>
</div>
<div class="form-group" style="text-align: right;margin-right: 17%;" ng-click="addSubOrders()">
<button class="btn btn-success" type="button"> add</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-success" type="button" ng-click="submit()" ng-disabled="ctrl.sending">Submit</button>
<button class="btn btn-danger" type="button" ng-click="$dismiss()">Cancel</button>
</div>

@ -0,0 +1,83 @@
<div class="modal-header">
<h4 ng-if="isAdd">Add Declare Custom</h4>
<h4 ng-if="!isAdd">Custom Order Detail</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<form class="form-horizontal" novalidate name="rate_form">
<div class="form-group">
<label class="control-label col-sm-4" for="custom">海关</label>
<div class="col-sm-6">
<input class="form-control" ng-model="custom.custom" id="custom" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="mchCustomId">备案号</label>
<div class="col-sm-6">
<input class="form-control" ng-model="custom.mchCustomId" id="mchCustomId" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="has_sub">是否拆单</label>
<div class="col-sm-6">
<input ng-model="custom.has_sub" id="has_sub" type="checkbox">
</div>
</div>
<div class="form-group" ng-if="custom.has_sub">
<table class="table table-striped">
<thead>
<tr>
<th>海关金额</th>
<th>运费金额</th>
<th>消费者名称</th>
<th>消费者ID</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="subOrder in subOrders">
<td ng-bind="subOrder.subOrderFee | currency:'AUD '"></td>
<td ng-bind="subOrder.transportFee"></td>
<td ng-bind="subOrder.buyer_name"></td>
<td ng-bind="subOrder.cert_id"></td>
<td>
<a role="button" class="text-danger text-bold ng-scope" ng-click="removeSubOrders(subOrder)">remove</a>
</td>
</tr>
</tbody>
</table>
</div>
<div ng-if="custom.has_sub">
<div class="form-group">
<label class="control-label col-sm-4" for="subOrderFee">订单金额</label>
<div class="col-sm-6">
<input class="form-control" ng-model="subOrder.subOrderFee" id="subOrderFee" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="transportFee">运费金额</label>
<div class="col-sm-6">
<input class="form-control" ng-model="subOrder.transportFee" id="transportFee" type="text">
</div>
</div>
<div class="form-group" ng-click="addSubOrders()">
add
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-success" type="button" ng-click="saveRate(rate_form)" ng-disabled="ctrl.sending">Submit</button>
<button class="btn btn-danger" type="button" ng-click="$dismiss()">Cancel</button>
</div>
Loading…
Cancel
Save