Inspiry设备管理

master
lujian 6 years ago
parent 83916a28fc
commit a9b363fddf

@ -53,6 +53,10 @@
<artifactId>jpinyin</artifactId>
<version>1.1.7</version>
</dependency>
<dependency>
<groupId>com.globalfreepay.payment</groupId>
<artifactId>payment-core</artifactId>
</dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>

@ -28,7 +28,10 @@ public interface ClientDeviceMapper {
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
JSONObject findByClientDevId(@Param("client_dev_id") String clientDevId, @Param("client_type") String clientType);
JSONObject findByClientDevIdAndClientType(@Param("client_dev_id") String clientDevId, @Param("client_type") String clientType);
@AutoSql(type = SqlType.SELECT)
JSONObject findByClientDevId(@Param("client_dev_id") String clientDevId);
PageList<JSONObject> listClientDevices(JSONObject params, PageBounds pagination);

@ -407,4 +407,5 @@ public interface ClientManager {
void partnerCBChannelConfig(String clientMoniker, String channelKey, String channel_id);
void addDevice(JSONObject manager, String clientMoniker, JSONObject device);
}

@ -2072,6 +2072,30 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return PageListUtils.buildPageListResult(devices);
}
@Override
public void addDevice(JSONObject manager, String clientMoniker,JSONObject device) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
String clientDevId = device.getString("client_dev_id");
JSONObject dev = clientDeviceMapper.findByClientDevId(clientDevId);
if(dev == null){
throw new NotFoundException("设备不存在");
}
if (dev.getIntValue("client_id") != client.getIntValue("client_id")) {
if(dev.getIntValue("is_valid") == 1){
throw new BadRequestException("其他商户正在使用");
}
}
device.put("dev_id",dev.getString("dev_id"));
device.put("client_id",client.getIntValue("client_id"));
device.put("remark",dev.getString("remark"));
clientDeviceMapper.update(device);
}
@Override
public void updateDevie(JSONObject manager, String clientMoniker, String devId, String remark) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -3812,8 +3836,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant();
//Element resultElement = alipayClient.registerGmsPortal(mch.getPid(), client);
Element resultElement = null;
Element resultElement = alipayClient.registerGmsPortal(mch.getPid(), client);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
throw new BadRequestException(resultElement.elementText("error"));
}
@ -4027,7 +4050,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
yeepayConfig.put("industry",merchantInfo.getString("industry"));
yeepayConfig.put("business_content",merchantInfo.getString("business_content"));
yeepayConfig.put("business_licence",merchantInfo.getString("business_licence"));
//yeePayClientConfigMapper.update(yeepayConfig);
yeePayClientConfigMapper.update(yeepayConfig);
yeepayConfig.put("company_website",merchantInfo.getString("company_website"));
yeepayConfig.put("abn",merchantInfo.getString("abn"));
yeepayConfig.put("company_name",merchantInfo.getString("company_name"));

@ -446,6 +446,7 @@ public class PartnerManageController {
clientManager.registerClient(clientMoniker, registery, manager);
}
//商户设备管理 获取商户设备信息
@ManagerMapping(value = "/{clientMoniker}/devices", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.DIRECTOR})
public JSONObject listClientDevices(@PathVariable String clientMoniker, @RequestParam(required = false) String remark, @RequestParam(required = false) String client_type,
@RequestParam(required = false) String[] client_ids,
@ -454,6 +455,13 @@ public class PartnerManageController {
return clientManager.listClientDevices(manager, clientMoniker, remark, page, limit,client_type,client_ids);
}
//给商户新增设备
@ManagerMapping(value = "/{clientMoniker}/addDevices", method = RequestMethod.POST, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER})
public void addDevice(@PathVariable String clientMoniker, @RequestBody JSONObject device,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.addDevice(manager, clientMoniker,device);
}
@ManagerMapping(value = "/{clientMoniker}/devices/{devId}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER})
public void modifyDevice(@PathVariable String clientMoniker, @PathVariable String devId, @RequestBody JSONObject remark,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {

@ -2818,8 +2818,13 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
}
}]);
app.controller('partnerDeviceCtrl', ['$scope', '$http', 'orderService', 'commonDialog', 'refunder', function ($scope, $http, orderService, commonDialog, refunder) {
$scope.pagination = {};
app.controller('partnerDeviceCtrl', ['$scope', '$http', 'orderService', 'commonDialog', 'refunder','$uibModal', function ($scope,$http, orderService, commonDialog, refunder,$uibModal) {
$scope.pagination = {};
/**
* 查看设备
* @param page
*/
$scope.listDevices = function (page) {
var params = angular.copy($scope.devsearch) || {};
params.page = page || $scope.pagination.page || 1;
@ -2829,6 +2834,24 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
};
$scope.listDevices(1);
/**
* 添加设备
*/
$scope.addDevices = function () {
$uibModal.open({
templateUrl: '/static/payment/partner/templates/add_device.html',
controller: 'newDeviceDialogCtrl',
resolve: {
clientMoniker: function () {
return $scope.partner.client_moniker;
}
}
}).result.then(function () {
$scope.listDevices();
})
};
$scope.showDeviceOrders = function (dev) {
$scope.params.dev_id = dev.dev_id;
$scope.listOrders(1);
@ -2964,6 +2987,32 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}
}]);
app.controller('newDeviceDialogCtrl', ['$scope', '$http', 'clientMoniker', function ($scope, $http,clientMoniker) {
$scope.params = {};
$scope.manager = {};
$scope.save = function (form) {
$scope.errmsg = null;
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) {
item.$dirty = true;
}
});
return;
}
$http.post('/sys/partners/' + clientMoniker + '/addDevices', $scope.device).then(function () {
$scope.$close();
}, function (resp) {
$scope.errmsg = resp.data.message;
})
};
}]);
app.controller('partnerChooseBDUserDialogCtrl', ['$scope', '$http', '$filter', 'partner', 'bdUsers', 'type', function ($scope, $http, $filter, partner, bdUsers, type) {
$scope.bdUsers = bdUsers.data;
$scope.data = {};

@ -2,9 +2,9 @@
* partner info in partner client
* Created by yixian on 2016-07-03.
*/
define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular, Decimal) {
define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBootstrap'], function (angular, Decimal) {
'use strict';
var app = angular.module('partnerInfoApp', ['ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload']);
var app = angular.module('partnerInfoApp', ['ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload','ui.bootstrap']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('basic', {
url: '/basic',
@ -969,9 +969,13 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct
};
$scope.loadSubPartners();
}]);
app.controller('clientDeviceCtrl', ['$scope', '$http', 'orderService', 'commonDialog', 'refunder','$filter', function ($scope, $http, orderService, commonDialog, refunder,$filter) {
app.controller('clientDeviceCtrl','newDive','newDeviceDialogCtrl', ['$scope', '$http', 'orderService', 'commonDialog', 'refunder','$filter', '$uibModal', function ($scope, $http, orderService, commonDialog, refunder,$filter,$uibModal) {
$scope.pagination = {};
$scope.params = {};
/**
* 查询设备
* @param page
*/
$scope.listDevices = function (page) {
var params = angular.copy($scope.devsearch) || {};
params.page = page || $scope.pagination.page || 1;
@ -981,6 +985,8 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct
})
};
$scope.listDevices(1);
$scope.showDeviceOrders = function (dev) {
$scope.params.dev_id = dev.dev_id;
$scope.listOrders(1);
@ -1067,6 +1073,10 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct
$scope.refundOrder = function (order) {
refunder.refunded(order.order_id)
};
}]);
return app;
});

@ -0,0 +1,57 @@
<div class="modal-header">
<h4>New Manager Device</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<form novalidate name="accountForm">
<div class="form-group"
ng-class="{'has-error':accountForm.client_dev_id.$invalid && accountForm.client_dev_id.$dirty}">
<label class="control-label" for="client_dev_id-input">* 设备编号</label>
<input required class="form-control text-lowercase" id="client_dev_id-input" name="client_dev_id"
ng-model="device.client_dev_id" maxlength="50">
<div ng-messages="accountForm.client_dev_id.$error" ng-if="accountForm.client_dev_id.$dirty">
<p class="small text-danger" ng-message="required">client_dev_id field is required</p>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':accountForm.auth_code.$invalid && accountForm.auth_code.$dirty}">
<label class="control-label" for="auth_code-input">* 设备密钥</label>
<input required class="form-control" id="auth_code-input" name="auth_code"
ng-model="device.auth_code" maxlength="50">
<div ng-messages="accountForm.auth_code.$error" ng-if="accountForm.auth_code.$dirty">
<p class="small text-danger" ng-message="required">设备密钥 field is required</p>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':accountForm.client_type.$invalid && accountForm.client_type.$dirty}">
<label class="control-label" for="client_type-input">* 设备类型</label>
<input required class="form-control" id="client_type-input" name="client_type"
ng-model="device.client_type">
<div ng-messages="accountForm.auth_code.$error" ng-if="accountForm.auth_code.$dirty">
<p class="small text-danger" ng-message="required">设备类型 field is required</p>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':accountForm.version.$invalid && accountForm.version.$dirty}">
<label class="control-label" for="version-input">* version</label>
<input required class="form-control" id="version-input" name="version"
ng-model="device.version">
<div ng-messages="accountForm.auth_code.$error" ng-if="accountForm.auth_code.$dirty">
<p class="small text-danger" ng-message="required">version field is required</p>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button class="btn btn-success" type="button" ng-click="save(accountForm)">Submit</button>
</div>
<div class="btn-group">
<button class="btn btn-danger" type="button" ng-click="$dismiss()">Cancel</button>
</div>
</div>

@ -3,11 +3,14 @@
<div class="list-group">
<div class="list-group-item">
<div class="input-group">
<input class="form-control" placeholder="Keywords" ng-model="devsearch.remark">
<input class="form-control" placeholder="Keywords" ng-model="devsearch.remark" >
<div class="input-group-btn">
<button class="btn btn-success" ng-click="listDevices()">
<i class="fa fa-search"></i>
</button>
<button class="btn btn-primary" ng-click="addDevices()">
<i class="fa fa-plus"></i> addDevice
</button>
</div>
</div>
</div>

Loading…
Cancel
Save