| | |
| | | import org.jeecg.modules.system.entity.MdcProductionEquipment; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.IMdcUserProductionService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.jeecg.modules.dnc.response.DeviceCode; |
| | | import org.jeecg.modules.dnc.response.DeviceGroupCode; |
| | |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | @Autowired |
| | | private IMdcProductionEquipmentService mdcProductionEquipmentService; |
| | | |
| | | @Autowired |
| | | private IMdcUserProductionService mdcUserProductionService; |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean addDeviceInfo(DeviceInfo deviceInfo) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<UserDepartExt> getUserPermsList(Integer nodeType, String paramId) { |
| | | public List<SysUser> getUserPermsList(Integer nodeType, String paramId) { |
| | | if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) |
| | | return null; |
| | | if(nodeType == 1) { |
| | | return deviceGroupPermissionService.getUserPermsByGroupId(paramId); |
| | | return mdcUserProductionService.getUserPermsByGroupId(paramId); |
| | | }else if(nodeType == 2) { |
| | | return devicePermissionService.getUserPermsByDeviceId(paramId); |
| | | return mdcUserProductionService.getUserPermsByDeviceId(paramId); |
| | | }else { |
| | | return null; |
| | | } |
| | |
| | | if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) |
| | | return null; |
| | | if(nodeType == 1) { |
| | | return deviceGroupPermissionService.getUserNonPermsByGroupId(paramId); |
| | | return mdcUserProductionService.getUserNonPermsByGroupId(paramId); |
| | | }else if(nodeType == 2) { |
| | | return devicePermissionService.getUserNonPermsByDeviceId(paramId); |
| | | return mdcUserProductionService.getUserNonPermsByDeviceId(paramId); |
| | | }else { |
| | | return null; |
| | | } |
| | |
| | | ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); |
| | | } |
| | | //获取分组下所有的子分组 |
| | | List<MdcProduction> childrenList = mdcProductionService.queryProdByPid(mdcProduction.getId()); |
| | | List<MdcProduction> childrenList = mdcProductionService.recursionChildrenByPid(mdcProduction.getId()); |
| | | List<String> childrenIds = new ArrayList<>(); |
| | | if(childrenList != null && !childrenList.isEmpty()) { |
| | | childrenList.forEach(item -> { |
| | | childrenIds.add(item.getId()); |
| | | boolean b = checkDevicePerm(1, item.getId()); |
| | | if(b) { |
| | | b = deviceGroupPermissionService.assignAddUser(mdcProduction, userList); |
| | | b = deviceGroupPermissionService.assignAddUser(item, userList); |
| | | if(!b) { |
| | | ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); |
| | | } |
| | |
| | | ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); |
| | | } |
| | | //获取分组下所有的子分组 |
| | | List<MdcProduction> childrenList = mdcProductionService.queryProdByPid(mdcProduction.getId()); |
| | | List<MdcProduction> childrenList = mdcProductionService.recursionChildrenByPid(mdcProduction.getId()); |
| | | List<String> childrenIds = new ArrayList<>(); |
| | | if(childrenList != null && !childrenList.isEmpty()) { |
| | | childrenList.forEach(item -> { |
| | | childrenIds.add(item.getId()); |
| | | boolean b = checkDevicePerm(1, item.getId()); |
| | | if(b) { |
| | | b = deviceGroupPermissionService.assignRemoveUser(mdcProduction, userList); |
| | | b = deviceGroupPermissionService.assignRemoveUser(item, userList); |
| | | if(!b) { |
| | | ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); |
| | | } |