提交 51078e83 编写于 作者: M megagao

使用统一的权限判断代码,消除了冗余

上级 a3d6f17f
package org.hqu.production_ms.controller;
import java.util.HashMap;
import java.util.Map;
import javax.validation.Valid;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.hqu.production_ms.domain.FinalMeasuretCheck;
import org.hqu.production_ms.domain.custom.ActiveUser;
import org.hqu.production_ms.domain.custom.CustomResult;
import org.hqu.production_ms.domain.custom.EUDataGridResult;
import org.hqu.production_ms.domain.customize.CustomResult;
import org.hqu.production_ms.domain.customize.EUDataGridResult;
import org.hqu.production_ms.service.MeasureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
......@@ -61,67 +56,11 @@ public class FMeasurementController {
return "measurement_add";
}
@RequestMapping("/add_judge")
@ResponseBody
public Map<String,Object> fMeasureCheckAddJudge() throws Exception{
//从shiro的session中取activeUser
Subject subject = SecurityUtils.getSubject();
//取身份信息
ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
Map<String,Object> map = new HashMap<String,Object>();
if(!activeUser.getUserStatus().equals("1")){
map.put("msg", "您的账户已被锁定,请切换账户登录!");
}else if(!activeUser.getRoleStatus().equals("1")){
map.put("msg", "当前角色已被锁定,请切换账户登录!");
}else{
if(!subject.isPermitted("fMeasureCheck:add")){
map.put("msg", "您没有权限,请切换用户登录!");
}
}
return map;
}
@RequestMapping("/edit")
public String edit() throws Exception{
return "measurement_edit";
}
@RequestMapping("/edit_judge")
@ResponseBody
public Map<String,Object> fMeasureCheckEditJudge() throws Exception{
Subject subject = SecurityUtils.getSubject();
ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
Map<String,Object> map = new HashMap<String,Object>();
if(!activeUser.getUserStatus().equals("1")){
map.put("msg", "您的账户已被锁定,请切换账户登录!");
}else if(!activeUser.getRoleStatus().equals("1")){
map.put("msg", "当前角色已被锁定,请切换账户登录!");
}else{
if(!subject.isPermitted("fMeasureCheck:edit")){
map.put("msg", "您没有权限,请切换用户登录!");
}
}
return map;
}
@RequestMapping("/delete_judge")
@ResponseBody
public Map<String,Object> fMeasureCheckDeleteJudge() throws Exception{
Subject subject = SecurityUtils.getSubject();
ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
Map<String,Object> map = new HashMap<String,Object>();
if(!activeUser.getUserStatus().equals("1")){
map.put("msg", "您的账户已被锁定,请切换账户登录!");
}else if(!activeUser.getRoleStatus().equals("1")){
map.put("msg", "当前角色已被锁定,请切换账户登录!");
}else{
if(!subject.isPermitted("fMeasureCheck:delete")){
map.put("msg", "您没有权限,请切换用户登录!");
}
}
return map;
}
//搜索
@RequestMapping("/search_fMeasureCheck_by_fMeasureCheckId")
@ResponseBody
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册