Merge remote-tracking branch 'origin/develop' into develop

master
yixian 5 years ago
commit 70b1ca4cea

@ -15,6 +15,8 @@ public interface CashierService {
void updateCashier(JSONObject partner, String cashier_id, CashierBean info); void updateCashier(JSONObject partner, String cashier_id, CashierBean info);
void changeCashierValidStatus(JSONObject partner, String cashier_id,boolean isValid);
JSONObject getCashierByCashierId(String cashier_id); JSONObject getCashierByCashierId(String cashier_id);
JSONObject getCashierByCashierId(String cashier_id, JSONObject partner); JSONObject getCashierByCashierId(String cashier_id, JSONObject partner);

@ -11,12 +11,10 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.QRCodeUtils; import au.com.royalpay.payment.tools.utils.QRCodeUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
@ -24,12 +22,11 @@ import org.springframework.stereotype.Service;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
/** /**
* Created by yishuqian on 20/12/2016. * Created by yishuqian on 20/12/2016.
*/ */
@ -77,6 +74,17 @@ public class CashierServiceImp implements CashierService {
cashierMapper.update(cashierUpdate); cashierMapper.update(cashierUpdate);
} }
@Override
public void changeCashierValidStatus(JSONObject partner, String cashier_id,boolean isValid) {
JSONObject cashier = cashierMapper.findOne(cashier_id);
Assert.notNull(cashier, "cashier not found");
if (partner.getIntValue("client_id") != cashier.getIntValue("client_id")) {
throw new ForbiddenException("You have no permission!");
}
cashier.put("is_valid", isValid);
cashierMapper.update(cashier);
}
@Override @Override
public JSONObject getCashierByCashierId(String cashier_id) { public JSONObject getCashierByCashierId(String cashier_id) {
return cashierMapper.findOne(cashier_id); return cashierMapper.findOne(cashier_id);

@ -5,10 +5,10 @@ import au.com.royalpay.payment.manage.cashiers.beans.CashierQueryBean;
import au.com.royalpay.payment.manage.cashiers.core.CashierOrderService; import au.com.royalpay.payment.manage.cashiers.core.CashierOrderService;
import au.com.royalpay.payment.manage.cashiers.core.CashierService; import au.com.royalpay.payment.manage.cashiers.core.CashierService;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping; import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.manage.permission.manager.RequirePartner; import au.com.royalpay.payment.manage.permission.manager.RequirePartner;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType; import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping; import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -81,5 +81,19 @@ public class CashierManageController {
return cashierOrderService.listCashierOrders(cashier_id, partner, query); return cashierOrderService.listCashierOrders(cashier_id, partner, query);
} }
@PartnerMapping(value = "/{cashier_id}/disable", method = RequestMethod.PUT,roles = {PartnerRole.ADMIN,PartnerRole.MANAGER})
@ResponseBody
public void deleteVipCustomer(@PathVariable String cashier_id,
@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) {
cashierService.changeCashierValidStatus(partner, cashier_id, false);
}
@PartnerMapping(value = "/{cashier_id}/enable", method = RequestMethod.PUT,roles = {PartnerRole.ADMIN,PartnerRole.MANAGER})
@ResponseBody
public void enableVipCustomer(@PathVariable String cashier_id,
@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) {
cashierService.changeCashierValidStatus(partner, cashier_id, true);
}
} }

@ -35,7 +35,32 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
app.controller('CashiersCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) { app.controller('CashiersCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
$scope.pagination = {}; $scope.pagination = {};
$scope.params = {}; $scope.params = {};
$scope.disableCashier = function (cashier) {
commonDialog.confirm({
title: 'Disable Cashier',
content: 'Are you sure to disable' + cashier.name + ''
}).then(function () {
$http.put('/partner/cashiers/' + cashier.cashier_id + '/disable').then(function (resp) {
commonDialog.alert({title: 'Success', content: 'Disable cashier successfully', type: 'success'});
$scope.loadCashiers(1);
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
})
};
$scope.enableCashier = function (cashier) {
commonDialog.confirm({
title: 'Enable Cashier',
content: 'Are you sure to enable' + cashier.name + ''
}).then(function () {
$http.put('/partner/cashiers/' + cashier.cashier_id + '/enable').then(function (resp) {
commonDialog.alert({title: 'Success', content: 'Enable cashier successfully', type: 'success'});
$scope.loadCashiers(1);
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
})
};
$scope.loadCashiers = function (page) { $scope.loadCashiers = function (page) {
var params = angular.copy($scope.params); var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1; params.page = page || $scope.pagination.page || 1;

@ -1,5 +1,5 @@
<section class="content-header"> <section class="content-header">
<h1><span ng-bind="cashier.name"></span></h1> <h1><span>{{cashier.name}}<span ng-if="!cashier.is_valid" style="color: red">(Disabled)</span></span></h1>
<ol class="breadcrumb"> <ol class="breadcrumb">
<li> <li>
<i class="fa fa-sitemap"></i> Cashiers <i class="fa fa-sitemap"></i> Cashiers

@ -51,24 +51,35 @@
<th>Cashier Code</th> <th>Cashier Code</th>
<th>Wechat</th> <th>Wechat</th>
<th>Create time</th> <th>Create time</th>
<th>Status</th>
<th>Operation</th> <th>Operation</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="cashier in cashiers"> <tr ng-repeat="cashier in cashiers">
<td ng-bind="cashier.name"></td> <td>{{cashier.name}} <span ng-if="!cashier.is_valid" style="color: red">(Disabled)</span></td>
<td ng-bind="cashier.code"></td> <td ng-bind="cashier.code"></td>
<td ng-bind="cashier.nick_name"></td> <td ng-bind="cashier.nick_name"></td>
<td ng-bind="cashier.create_time"></td> <td ng-bind="cashier.create_time"></td>
<td>
<a ng-if="!cashier.is_valid" class="text-primary" style="padding-right: 5px" role="button" title="Detail">
<i class="text-danger fa fa-close"></i>
</a>
<a ng-if="cashier.is_valid" class="text-primary" style="padding-right: 5px" role="button" title="Detail">
<i class="text-success fa fa-check"></i>
</a>
</td>
<td> <td>
<a class="text-primary" style="padding-right: 5px" role="button" title="Edit" <a class="text-primary" style="padding-right: 5px" role="button" title="Edit"
ui-sref=".edit({cashier_id:cashier.cashier_id})"> ui-sref=".edit({cashier_id:cashier.cashier_id})">
<i class="fa fa-pencil-square-o"></i> <i class="fa fa-pencil-square-o"></i>
</a> </a> |
<a class="text-primary" style="padding-right: 5px" role="button" title="Detail" <a class="text-primary" style="padding-right: 5px" role="button" title="Detail"
ui-sref=".detail({cashier_id:cashier.cashier_id})"> ui-sref=".detail({cashier_id:cashier.cashier_id})">
<i class="fa fa-search"></i> <i class="fa fa-search"></i>
</a> </a> |
<a ng-if="cashier.is_valid" role="button" class="text-danger text-bold" ng-click="disableCashier(cashier)">Disable</a>
<a ng-if="!cashier.is_valid" role="button" class="text-success text-bold" ng-click="enableCashier(cashier)">Enable</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>

Loading…
Cancel
Save