|
@@ -61,24 +61,35 @@ public class AdminPostageController {
|
|
|
Admin admin = new Admin();
|
|
|
admin.setAdminStatus(1);
|
|
|
List<Admin> adminList = sysService.listSelectAdmin(admin);
|
|
|
+
|
|
|
+ int operationPermissions = getAdminDept();
|
|
|
+
|
|
|
+ mv.addObject("operationPermissions", operationPermissions);
|
|
|
+ mv.addObject("adminList", adminList);
|
|
|
+ StitchAttrUtil.setModelAndView(postage, mv, "/admin/postage/postage_list", pagedResult);
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 获取登录用户的权限
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Integer getAdminDept(){
|
|
|
|
|
|
Admin loginAdmin = AdminUtils.getLoginAdmin();
|
|
|
|
|
|
- int operationPermissions = 0;
|
|
|
+ int operationPermissions = 0;
|
|
|
if(loginAdmin.getAdminDept() == 3){
|
|
|
operationPermissions = 1;
|
|
|
if(loginAdmin.getAdminManager() == 2){
|
|
|
operationPermissions = 2;
|
|
|
}
|
|
|
- }else if(loginAdmin.getAdminDept() == 4 && loginAdmin.getAdminManager() == 2){
|
|
|
+ }else if(loginAdmin.getAdminDept() == 5){
|
|
|
operationPermissions = 3;
|
|
|
- }else if(loginAdmin.getAdminDept() == 1 && loginAdmin.getAdminManager() == 2){
|
|
|
+ }else if(loginAdmin.getAdminDept() == 1){
|
|
|
operationPermissions = 4;
|
|
|
}
|
|
|
- mv.addObject("operationPermissions", operationPermissions);
|
|
|
- mv.addObject("adminList", adminList);
|
|
|
- StitchAttrUtil.setModelAndView(postage, mv, "/admin/postage/postage_list", pagedResult);
|
|
|
- return mv;
|
|
|
+ return operationPermissions;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -93,27 +104,47 @@ public class AdminPostageController {
|
|
|
if(postageId == null || postageId == 0){
|
|
|
return new ResponseJson(500, "未获取到记录id", 500);
|
|
|
}
|
|
|
- if(type == null || type == 0){
|
|
|
- return new ResponseJson(500, "修改失败。请刷新重试", 500);
|
|
|
- }
|
|
|
- if(status == null || status == 0){
|
|
|
- return new ResponseJson(500, "修改失败。请刷新重试", 500);
|
|
|
+ if(type == null || type == 0 || status == null || status == 0){
|
|
|
+ return new ResponseJson(500, "修改失败,请重试", 500);
|
|
|
}
|
|
|
+
|
|
|
+ Postage post = postageService.getPostage(postageId);
|
|
|
+
|
|
|
+ int operationPermissions = getAdminDept();
|
|
|
+
|
|
|
Postage postage = new Postage();
|
|
|
postage.setPostageId(postageId);
|
|
|
-
|
|
|
+
|
|
|
+ Integer num = 0;
|
|
|
switch (type){
|
|
|
case 1:
|
|
|
- postage.setPostageCustomerStatus(status);
|
|
|
- break;
|
|
|
+ if(post.getPostageCustomerStatus() == 1 && (operationPermissions == 1 || operationPermissions ==2 || operationPermissions ==4)){
|
|
|
+ if(status == 2){
|
|
|
+ postage.setPostageCustomerStatus(status);
|
|
|
+ postage.setPostageManagerStatus(1);
|
|
|
+ }
|
|
|
+ num = postageService.updatePostage(postage);
|
|
|
+ }
|
|
|
+ break;
|
|
|
case 2:
|
|
|
- postage.setPostageManagerStatus(status);
|
|
|
+ if(post.getPostageManagerStatus() == 1 && (operationPermissions ==2 || operationPermissions ==4)){
|
|
|
+ if(status == 2){
|
|
|
+ postage.setPostageManagerStatus(status);
|
|
|
+ postage.setPostageFinanceStatus(1);
|
|
|
+ }else{
|
|
|
+ postage.setPostageManagerStatus(status);
|
|
|
+ }
|
|
|
+ num = postageService.updatePostage(postage);
|
|
|
+ }
|
|
|
break;
|
|
|
case 3:
|
|
|
- postage.setPostageFinanceStatus(status);
|
|
|
+ if((post.getPostageFinanceStatus() == 1 ||post.getPostageFinanceStatus() == 2) && (operationPermissions ==3 || operationPermissions ==4)){
|
|
|
+
|
|
|
+ postage.setPostageFinanceStatus(status);
|
|
|
+ num = postageService.updatePostage(postage);
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
- Integer num = postageService.updatePostage(postage);
|
|
|
if(num > 0){
|
|
|
return new ResponseJson(200, "修改成功", 200);
|
|
|
}else{
|