|
|
@@ -7,6 +7,8 @@ import com.railway.business.safetool.service.IBaseSafetyToolService;
|
|
|
import com.railway.common.annotation.Log;
|
|
|
import com.railway.common.core.controller.BaseController;
|
|
|
import com.railway.common.core.domain.AjaxResult;
|
|
|
+import com.railway.common.core.domain.entity.SysRole;
|
|
|
+import com.railway.common.core.domain.entity.SysUser;
|
|
|
import com.railway.common.enums.BusinessType;
|
|
|
import com.railway.common.utils.QrCodeUtil;
|
|
|
import com.railway.common.utils.SecurityUtils;
|
|
|
@@ -44,9 +46,21 @@ public class SecQcodeController extends BaseController {
|
|
|
if (null == tool) {
|
|
|
return AjaxResult.error("二维码已失效,请检查!");
|
|
|
}
|
|
|
- Long deptId = SecurityUtils.getDeptId();
|
|
|
- if (tool.getDeptId().compareTo(deptId) != 0) {
|
|
|
- return AjaxResult.error("非本车间安全工具,请检查!");
|
|
|
+ if(!SecurityUtils.isAdmin()){
|
|
|
+ String labRoleName = "实验员";
|
|
|
+ boolean isLabRole = false;
|
|
|
+ SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
+ List<SysRole> roles = user.getRoles();
|
|
|
+ for(SysRole role : roles){
|
|
|
+ if(labRoleName.equals(role.getRoleKey())){
|
|
|
+ isLabRole = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Long deptId = SecurityUtils.getDeptId();
|
|
|
+ if (!isLabRole && tool.getDeptId().compareTo(deptId) != 0) {
|
|
|
+ return AjaxResult.error("非本车间安全工具,请检查!");
|
|
|
+ }
|
|
|
}
|
|
|
// 是否已报废
|
|
|
if (tool.getState().equals(ToolStateEnum.NORMAL.getCode())) {
|