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/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java index dce09e4de..e063a67fe 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java @@ -109,21 +109,24 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { mod.put("funcs", funcList); modules.add(mod); } - report.put("modules", modules); return report; } @Override + @Transactional public void permissionClientModuleSave(int clientId, String clientMoniker) { + permissionClientModulesService.removeByClientMoniker(clientMoniker); List moduleId = permissionPartnerModuleMapper.list(); for (JSONObject moduleClientAdd : moduleId) { moduleClientAdd.put("client_id", clientId); moduleClientAdd.put("client_moniker", clientMoniker); moduleClientAdd.put("module_id", moduleClientAdd.getString("id")); - moduleClientAdd.put("is_valid", true); + moduleClientAdd.put("is_valid", moduleClientAdd.getBoolean("initialize")); permissionClientModulesService.save(moduleClientAdd); } + systemPackageCacheSupport.clearClientPermission(clientMoniker); + systemPackageCacheSupport.clearClientPermission(clientId); } @@ -152,13 +155,10 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { permissionClientModulesService.save(clientMod); } } - module.initObject(mod); permissionPartnerModuleMapper.update(mod); - sysPermissionClientModulesMapper.updateFunctionValid(mod.getString("id"),mod.getBooleanValue("initialize")); - systemPackageCacheSupport.clearClientPermissionAll(); - - +// sysPermissionClientModulesMapper.updateFunctionValid(mod.getString("id"), mod.getBooleanValue("initialize")); +// systemPackageCacheSupport.clearClientPermissionAll(); } @Override @@ -214,7 +214,6 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { @Transactional @CacheEvict(value = ":login:partners:", allEntries = true) public void authorizeRole(PartnerRole role, List functions) { - permissionPartnerFunctionMapper.clearRolePermission(role.getCode()); permissionPartnerFunctionMapper.authorizeRole(role.getCode(), functions); } diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java index dd311283e..9710db8df 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java @@ -1,6 +1,8 @@ package au.com.royalpay.payment.manage.management.sysconfig.web; import au.com.royalpay.payment.manage.management.sysconfig.beans.PermissionClientVO; +import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionPartnerManager; +import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService; import au.com.royalpay.payment.tools.CommonConsts; @@ -26,6 +28,10 @@ import javax.annotation.Resource; public class SysPermissionClientController { @Resource private PermissionClientModulesService permissionClientModulesService; + @Resource + private PermissionPartnerManager permissionPartnerManager; + @Resource + private ClientManager clientManager; @RequestMapping(value = "/list", method = RequestMethod.GET) @@ -38,4 +44,11 @@ public class SysPermissionClientController { permissionClientModulesService.switchValid(id,permissionClientVO.getIsValid(),loginManager); } + @RequestMapping(value = "/init", method = RequestMethod.POST) + public void init(@RequestBody JSONObject param) { + JSONObject client = clientManager.getClientInfoByMoniker(param.getString("client_moniker")); + permissionPartnerManager.permissionClientModuleSave(client.getIntValue("client_id"),client.getString("client_moniker")); + } + + } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java index b9ce4eba3..11d41797b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java @@ -24,6 +24,8 @@ public interface SysPermissionClientModulesMapper { void delete(@Param("module_name") String moduleName); + void deleteByClientMoniker(@Param("client_moniker") String client_moniker); + @AutoSql(type = SqlType.SELECT) List listByClientId(@Param("client_id") int client_id); diff --git a/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java b/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java index 967ef6324..389dc7631 100644 --- a/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java +++ b/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java @@ -111,6 +111,8 @@ public class ManagerUserInterceptor extends HandlerInterceptorAdapter implements if(func!=null && StringUtils.isNotEmpty(func.getString("module_id"))){ JSONArray arr = loginUser.getJSONArray("available_module_ids"); if (arr == null || !arr.contains(func.getString("module_id"))) { + logger.info(partner.toString()); + logger.info(partnerStatusKey); logger.info(funcId); throw new ForbiddenException("error.permission.nopermission"); } diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java b/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java index 7e9d97220..984eb440a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java @@ -19,4 +19,5 @@ public interface PermissionClientModulesService { void switchValid(Long id,boolean isValid,JSONObject account); + void removeByClientMoniker(String clientMoniker); } \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java index 05a99e1f0..20c8dbdce 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java @@ -72,6 +72,11 @@ public class PermissionClientModulesServiceImpl implements PermissionClientModul } + @Override + public void removeByClientMoniker(String clientMoniker) { + permissionClientModulesMapper.deleteByClientMoniker(clientMoniker); + } + private void saveMongoLog(JSONObject account, JSONObject oldRecord, JSONObject modifyData, String business) { try { modifyData.remove("id"); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml index b396def8c..4a329d96e 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml @@ -28,4 +28,9 @@ delete from sys_permission_partner_modules_clients where module_id = (SELECT id from sys_permission_partner_modules where module_name=#{module_name}) + + + delete from sys_permission_partner_modules_clients + where client_moniker= #{client_moniker} + \ No newline at end of file diff --git a/src/main/ui/static/application/apply_open_quickly.js b/src/main/ui/static/application/apply_open_quickly.js index 8c2693b82..8dda0f28b 100644 --- a/src/main/ui/static/application/apply_open_quickly.js +++ b/src/main/ui/static/application/apply_open_quickly.js @@ -90,38 +90,46 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.photoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}); + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.photoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; diff --git a/src/main/ui/static/application/clientAuthentication.js b/src/main/ui/static/application/clientAuthentication.js index 913f48b09..b6150c976 100644 --- a/src/main/ui/static/application/clientAuthentication.js +++ b/src/main/ui/static/application/clientAuthentication.js @@ -90,38 +90,46 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }; $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.photoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}); + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.photoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; @@ -176,37 +184,45 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS //audit files $scope.uploadBankFile = function (file) { if (file != null) { - $scope.bankFileProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.bankFileProgress; - $scope.partner.file.file_bank_info = resp.data.url; - }, function (resp) { - delete $scope.bankFileProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.bankFileProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + } else { + $scope.bankFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.bankFileProgress; + $scope.partner.file.file_bank_info = resp.data.url; + }, function (resp) { + delete $scope.bankFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.bankFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadCompanyFile = function (file) { if (file != null) { - $scope.companyFileProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.companyFileProgress; - $scope.partner.file.file_company_info = resp.data.url; - }, function (resp) { - delete $scope.companyFileProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.companyFileProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}); + } else { + $scope.companyFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.companyFileProgress; + $scope.partner.file.file_company_info = resp.data.url; + }, function (resp) { + delete $scope.companyFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.companyFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; diff --git a/src/main/ui/static/application/templates/apply_basicinfo.html b/src/main/ui/static/application/templates/apply_basicinfo.html index 1305c0914..d7d89784a 100644 --- a/src/main/ui/static/application/templates/apply_basicinfo.html +++ b/src/main/ui/static/application/templates/apply_basicinfo.html @@ -63,7 +63,7 @@
@@ -110,7 +110,7 @@
diff --git a/src/main/ui/static/application/templates/clientAuthentication.html b/src/main/ui/static/application/templates/clientAuthentication.html index 9e39e569e..641f22bea 100644 --- a/src/main/ui/static/application/templates/clientAuthentication.html +++ b/src/main/ui/static/application/templates/clientAuthentication.html @@ -84,7 +84,7 @@
@@ -186,7 +186,7 @@
@@ -492,7 +492,7 @@
@@ -512,7 +512,7 @@
diff --git a/src/main/ui/static/config/onedollarday/onedollarday.js b/src/main/ui/static/config/onedollarday/onedollarday.js index dd3800bd0..ba4258ced 100644 --- a/src/main/ui/static/config/onedollarday/onedollarday.js +++ b/src/main/ui/static/config/onedollarday/onedollarday.js @@ -200,7 +200,7 @@ define(['angular'], function (angular) { }; }]); - app.controller('merchantConfigDialogCtrl', ['$scope', '$http', 'Upload', 'merchant', function ($scope, $http, Upload, merchant) { + app.controller('merchantConfigDialogCtrl', ['$scope', '$http', 'Upload', 'merchant', 'commonDialog', function ($scope, $http, Upload, merchant, commonDialog) { $scope.merchant = angular.copy(merchant); $scope.save = function () { $scope.errmsg = null; @@ -219,6 +219,10 @@ define(['angular'], function (angular) { if(!file){ return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.photoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', diff --git a/src/main/ui/static/config/onedollarday/templates/merchant_config.html b/src/main/ui/static/config/onedollarday/templates/merchant_config.html index 56f79185f..e39e62ab0 100644 --- a/src/main/ui/static/config/onedollarday/templates/merchant_config.html +++ b/src/main/ui/static/config/onedollarday/templates/merchant_config.html @@ -10,7 +10,7 @@
diff --git a/src/main/ui/static/config/organizations/organizations.js b/src/main/ui/static/config/organizations/organizations.js index 750a5e4ca..be688acaa 100644 --- a/src/main/ui/static/config/organizations/organizations.js +++ b/src/main/ui/static/config/organizations/organizations.js @@ -108,6 +108,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { if (file == null) { return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.logoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', @@ -215,6 +219,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { if (file == null) { return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.logoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', @@ -321,6 +329,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { if (file == null) { return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.logoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', diff --git a/src/main/ui/static/config/organizations/templates/new_org.html b/src/main/ui/static/config/organizations/templates/new_org.html index f8296afb5..13eaf2fed 100644 --- a/src/main/ui/static/config/organizations/templates/new_org.html +++ b/src/main/ui/static/config/organizations/templates/new_org.html @@ -24,7 +24,7 @@

diff --git a/src/main/ui/static/config/organizations/templates/org_detail.html b/src/main/ui/static/config/organizations/templates/org_detail.html index 2140946c9..9fa311101 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail.html +++ b/src/main/ui/static/config/organizations/templates/org_detail.html @@ -36,7 +36,7 @@

diff --git a/src/main/ui/static/config/organizations/templates/org_detail_parent.html b/src/main/ui/static/config/organizations/templates/org_detail_parent.html index 464290749..3464f49de 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail_parent.html +++ b/src/main/ui/static/config/organizations/templates/org_detail_parent.html @@ -173,7 +173,7 @@

diff --git a/src/main/ui/static/payment/cashiers/cashier-manage.js b/src/main/ui/static/payment/cashiers/cashier-manage.js index 721f8f3fa..5982e122c 100644 --- a/src/main/ui/static/payment/cashiers/cashier-manage.js +++ b/src/main/ui/static/payment/cashiers/cashier-manage.js @@ -51,19 +51,23 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.cashier = {}; $scope.uploadPhoto = function (file) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.cashier.photo = resp.data.url; - }, function (resp) { - delete $scope.photoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.cashier.photo = resp.data.url; + }, function (resp) { + delete $scope.photoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.save = function (form) { @@ -178,19 +182,23 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.cashier = angular.copy(cashier.data); $scope.uploadPhoto = function (file) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.cashier.photo = resp.data.url; - }, function (resp) { - delete $scope.photoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.cashier.photo = resp.data.url; + }, function (resp) { + delete $scope.photoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.updateCashier = function (form) { diff --git a/src/main/ui/static/payment/cashiers/templates/cashier_add.html b/src/main/ui/static/payment/cashiers/templates/cashier_add.html index 070a596de..fdf0b33ee 100644 --- a/src/main/ui/static/payment/cashiers/templates/cashier_add.html +++ b/src/main/ui/static/payment/cashiers/templates/cashier_add.html @@ -71,7 +71,7 @@

diff --git a/src/main/ui/static/payment/cashiers/templates/cashier_edit.html b/src/main/ui/static/payment/cashiers/templates/cashier_edit.html index 2fae846ce..6e20bba43 100644 --- a/src/main/ui/static/payment/cashiers/templates/cashier_edit.html +++ b/src/main/ui/static/payment/cashiers/templates/cashier_edit.html @@ -59,7 +59,7 @@
diff --git a/src/main/ui/static/payment/good/good-manage.js b/src/main/ui/static/payment/good/good-manage.js index cf2324d83..d89378dca 100644 --- a/src/main/ui/static/payment/good/good-manage.js +++ b/src/main/ui/static/payment/good/good-manage.js @@ -93,22 +93,26 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.good.images = []; $scope.uploadImage = function (file) { if (file != null) { - $scope.imageProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.imageProgress; - var image = {}; - image.fileId = resp.data.fileid; - image.url = resp.data.url; - $scope.good.images.push(image); - }, function (resp) { - delete $scope.imageProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.imageProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.imageProgress; + var image = {}; + image.fileId = resp.data.fileid; + image.url = resp.data.url; + $scope.good.images.push(image); + }, function (resp) { + delete $scope.imageProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; }]); @@ -172,22 +176,26 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }; $scope.uploadImage = function (file) { if (file != null) { - $scope.imageProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.imageProgress; - var image = {}; - image.fileId = resp.data.fileid; - image.url = resp.data.url; - $scope.good.images.push(image); - }, function (resp) { - delete $scope.imageProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.imageProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.imageProgress; + var image = {}; + image.fileId = resp.data.fileid; + image.url = resp.data.url; + $scope.good.images.push(image); + }, function (resp) { + delete $scope.imageProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; }]); diff --git a/src/main/ui/static/payment/good/templates/add_good.html b/src/main/ui/static/payment/good/templates/add_good.html index 53c0c97a5..82d0a5f07 100644 --- a/src/main/ui/static/payment/good/templates/add_good.html +++ b/src/main/ui/static/payment/good/templates/add_good.html @@ -136,7 +136,7 @@
diff --git a/src/main/ui/static/payment/good/templates/good_edit.html b/src/main/ui/static/payment/good/templates/good_edit.html index 7623a4ed0..d280e96e8 100644 --- a/src/main/ui/static/payment/good/templates/good_edit.html +++ b/src/main/ui/static/payment/good/templates/good_edit.html @@ -147,7 +147,7 @@
diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 3cdaf3946..0084d5263 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -439,56 +439,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadStorePhoto = function (file) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; @@ -677,24 +689,28 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.uploadAgreeFile = function (file) { if (file != null) { - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - $scope.agree_file_import = resp.data.url; - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Succeed Imported! Please notify BD', - type: 'success' - }); - $state.reload(); + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.agree_file_import = resp.data.url; + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Succeed Imported! Please notify BD', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }) - }, function (resp) { - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }) + } } }; $scope.notifyBD = function () { @@ -1093,56 +1109,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadStorePhoto = function (file) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; @@ -2108,56 +2136,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadStorePhoto = function (file) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.updateMerchantLocation = function () { @@ -3107,6 +3147,14 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; + $scope.init = function () { + var params = {client_moniker:$scope.partner.client_moniker}; + $http.post('/sys/permission/init',params).then(function (resp) { + },function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }) + }; + }]); diff --git a/src/main/ui/static/payment/partner/partner.js b/src/main/ui/static/payment/partner/partner.js index 989273068..9e5a7e7d8 100644 --- a/src/main/ui/static/payment/partner/partner.js +++ b/src/main/ui/static/payment/partner/partner.js @@ -72,56 +72,68 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadStorePhoto = function (file) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; @@ -223,56 +235,68 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadStorePhoto = function (file) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; diff --git a/src/main/ui/static/payment/partner/templates/add_partner.html b/src/main/ui/static/payment/partner/templates/add_partner.html index 70595e710..5aa55efa2 100644 --- a/src/main/ui/static/payment/partner/templates/add_partner.html +++ b/src/main/ui/static/payment/partner/templates/add_partner.html @@ -127,7 +127,7 @@
@@ -230,8 +230,7 @@
1: 
@@ -242,8 +241,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html b/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html index 07814fd95..52463ae66 100644 --- a/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html +++ b/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html @@ -98,7 +98,7 @@
@@ -188,8 +188,7 @@
1: 
@@ -200,8 +199,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/client_partner_detail.html b/src/main/ui/static/payment/partner/templates/client_partner_detail.html index 5725d8577..9c8ebcfa4 100644 --- a/src/main/ui/static/payment/partner/templates/client_partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/client_partner_detail.html @@ -363,7 +363,7 @@
@@ -430,8 +430,7 @@
1: 
@@ -443,8 +442,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/client_partner_edit.html b/src/main/ui/static/payment/partner/templates/client_partner_edit.html index 9dd641196..2ab021514 100644 --- a/src/main/ui/static/payment/partner/templates/client_partner_edit.html +++ b/src/main/ui/static/payment/partner/templates/client_partner_edit.html @@ -58,7 +58,7 @@
@@ -105,7 +105,7 @@
1: 
@@ -116,8 +116,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 35cde22f8..0c1b85386 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -85,7 +85,7 @@ 制作全支付合同 + accept="pdf/*"> 上传合同 (通用合同请选择制作合同,非通用合同模板请人工制作合同后上传)
diff --git a/src/main/ui/static/payment/partner/templates/partner_edit.html b/src/main/ui/static/payment/partner/templates/partner_edit.html index c351e7a31..7380f340f 100644 --- a/src/main/ui/static/payment/partner/templates/partner_edit.html +++ b/src/main/ui/static/payment/partner/templates/partner_edit.html @@ -166,7 +166,7 @@
@@ -255,7 +255,7 @@
1: 
@@ -266,8 +266,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/partner_permission.html b/src/main/ui/static/payment/partner/templates/partner_permission.html index 08ae6de79..8efc66ba3 100644 --- a/src/main/ui/static/payment/partner/templates/partner_permission.html +++ b/src/main/ui/static/payment/partner/templates/partner_permission.html @@ -1,6 +1,8 @@

Permissions

+ + 初始化权限
diff --git a/src/main/ui/static/payment/product/product_manager.js b/src/main/ui/static/payment/product/product_manager.js index 41050759a..87bd1421e 100644 --- a/src/main/ui/static/payment/product/product_manager.js +++ b/src/main/ui/static/payment/product/product_manager.js @@ -30,26 +30,30 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.importExcel = function (file) { if (file != null) { - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - $scope.agree_file_import = resp.data.url; - $http.put('/sys/product/importExcel', {source_agree_file: $scope.agree_file_import}).then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Succeed Imported', - type: 'success' - }); - $state.reload(); + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.agree_file_import = resp.data.url; + $http.put('/sys/product/importExcel', {source_agree_file: $scope.agree_file_import}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Succeed Imported', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }) - }, function (resp) { - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }) + } } - } + }; $scope.deleteProduct = function (product) { commonDialog.confirm({ title: 'Confirm', diff --git a/src/main/ui/static/payment/product/templates/product.html b/src/main/ui/static/payment/product/templates/product.html index 9e66b1834..08a1a31bf 100644 --- a/src/main/ui/static/payment/product/templates/product.html +++ b/src/main/ui/static/payment/product/templates/product.html @@ -31,7 +31,7 @@