| | |
| | | package org.jeecg.modules.dnc.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.shiro.SecurityUtils; |
| | |
| | | |
| | | import org.jeecg.modules.dnc.service.*; |
| | | import org.jeecg.modules.dnc.service.support.DeviceTreeWrapper; |
| | | import org.jeecg.modules.dnc.ucenter.UserDepartExt; |
| | | import org.jeecg.modules.dnc.utils.ValidateUtil; |
| | | import org.jeecg.modules.dnc.entity.*; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | |
| | | import org.jeecg.modules.mdc.service.IMdcProductionEquipmentService; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.entity.MdcProductionEquipment; |
| | | import org.jeecg.modules.system.entity.MdcUserProduction; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.IMdcUserProductionService; |
| | |
| | | @Lazy |
| | | private IProductInfoService productInfoService; |
| | | @Autowired |
| | | private INcLogInfoService iNcLogInfoService; |
| | | @Autowired |
| | | private IMdcProductionService mdcProductionService; |
| | | @Autowired |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | |
| | | if(group == null) { |
| | | ExceptionCast.cast(DeviceCode.DEVICE_GROUP_NONE); |
| | | } |
| | | //添加日志 |
| | | NcLogInfo ncLogInfo = new NcLogInfo(); |
| | | //模块 |
| | | ncLogInfo.setModuleInfo("设备结构树"); |
| | | //类型 |
| | | ncLogInfo.setOperateType(2); |
| | | //日志内容 |
| | | ncLogInfo.setLogContent("设备名称:"+deviceInfo.getDeviceName()+",设备编号:"+deviceInfo.getDeviceNo()); |
| | | iNcLogInfoService.saveLogNcInfos(ncLogInfo); |
| | | boolean b = super.save(deviceInfo); |
| | | if(!b) { |
| | | ExceptionCast.cast(DeviceCode.DEVICE_SAVE_ERROR); |
| | |
| | | ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); |
| | | deviceInfo.setDeviceId(id); |
| | | deviceInfo.setGroupId(null); |
| | | //添加日志 |
| | | NcLogInfo ncLogInfo = new NcLogInfo(); |
| | | //模块 |
| | | ncLogInfo.setModuleInfo("设备结构树"); |
| | | //类型 |
| | | ncLogInfo.setOperateType(3); |
| | | //日志内容 |
| | | ncLogInfo.setLogContent("设备名称:"+deviceInfo.getDeviceName()); |
| | | //修改保存备注 |
| | | ncLogInfo.setRemark(JSONObject.toJSONString(en)); |
| | | iNcLogInfoService.saveLogNcInfos(ncLogInfo); |
| | | return super.updateById(deviceInfo); |
| | | } |
| | | |
| | |
| | | b = devicePermissionStreamService.deleteDepartByDeviceId(en.getGroupId(), en.getDeviceId()); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | //添加日志 |
| | | NcLogInfo ncLogInfo = new NcLogInfo(); |
| | | //模块 |
| | | ncLogInfo.setModuleInfo("设备结构树"); |
| | | //类型 |
| | | ncLogInfo.setOperateType(4); |
| | | //日志内容 |
| | | ncLogInfo.setLogContent("设备名称:"+en.getDeviceName()); |
| | | iNcLogInfoService.saveLogNcInfos(ncLogInfo); |
| | | return super.removeById(en.getDeviceId()); |
| | | } |
| | | |
| | |
| | | if(mdcProduction == null) { |
| | | ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); |
| | | } |
| | | DeviceGroupPermission permission = deviceGroupPermissionService.getByUserIdAndGroupId(userId, mdcProduction.getId()); |
| | | if(permission == null) |
| | | MdcUserProduction mdcUserProduction=mdcUserProductionService.getByUserIdAndGroupId(userId,mdcProduction.getId()); |
| | | if(mdcUserProduction == null) |
| | | return false; |
| | | return true; |
| | | }else if(nodeType == 2) { |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean assignAddUser(MdcEquipment mdcEquipment, Collection<SysUser> userList) { |
| | | |
| | | |
| | | if(mdcEquipment == null || userList == null || userList.isEmpty()) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | MdcProductionEquipment mdcProductionEquipment=mdcProductionEquipmentService |
| | |
| | | if(stream == null) { |
| | | stream = new DevicePermissionStream(); |
| | | stream.setUserId(item.getId()); |
| | | stream.setGroupId(mdcProductionEquipment.getId()); |
| | | stream.setGroupId(mdcProductionEquipment.getProductionId()); |
| | | stream.setDeviceId(mdcEquipment.getId()); |
| | | permissionStreamList.add(stream); |
| | | } |