| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.dnc.response.*; |
| | | import org.jeecg.modules.dnc.service.IDevicePermissionService; |
| | | import org.jeecg.modules.mdc.model.MdcEquipmentTree; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.dnc.entity.DeviceInfo; |
| | | import org.jeecg.modules.dnc.service.IDeviceInfoService; |
| | |
| | | public class DeviceInfoController extends JeecgController<DeviceInfo, IDeviceInfoService> { |
| | | @Autowired |
| | | private IDeviceInfoService deviceInfoService; |
| | | @Autowired |
| | | private IDevicePermissionService devicePermissionService; |
| | | |
| | | @AutoLog(value = "设备表-新增设备") |
| | | @ApiOperation(value = "设备表-新增设备", notes = "设备表-新增设备") |
| | |
| | | @AutoLog(value = "设备表-获取节点已分配的用户") |
| | | @ApiOperation(value = "设备表-获取节点已分配的用户", notes = "设备表-获取节点已分配的用户") |
| | | @GetMapping("/get/perm/user/{nodeType}/{paramId}") |
| | | public QueryListResponseResult<UserDepartExt> getUserPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { |
| | | List<UserDepartExt> list = deviceInfoService.getUserPermsList(nodeType, paramId); |
| | | public QueryListResponseResult<SysUser> getUserPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { |
| | | List<SysUser> list = deviceInfoService.getUserPermsList(nodeType, paramId); |
| | | if(list == null) |
| | | list = Collections.emptyList(); |
| | | return new QueryListResponseResult(CommonCode.SUCCESS, list); |
| | |
| | | } |
| | | return new ResponseResult(CommonCode.SUCCESS); |
| | | } |
| | | |
| | | /** |
| | | * 加载产线设备树 |
| | | */ |
| | | @AutoLog(value = "设备表-加载产线设备树") |
| | | @ApiOperation(value = "设备表-加载产线设备树", notes = "设备表-加载产线设备树") |
| | | @GetMapping(value = "/queryTreeListByProduction") |
| | | public Result<List<MdcEquipmentTree>> queryTreeListByProduction() { |
| | | Result<List<MdcEquipmentTree>> result = new Result<>(); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | try { |
| | | List<MdcEquipmentTree> mdcEquipmentTreeList = devicePermissionService.DncLoadTreeListByProduction(userId); |
| | | result.setSuccess(true); |
| | | result.setResult(mdcEquipmentTreeList); |
| | | } catch (Exception e) { |
| | | return Result.error("加载产线设备树失败!" + e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | } |