From f2f8241dd52ef12ec109f6f4f0f13042055338ac Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期五, 14 二月 2025 14:55:56 +0800 Subject: [PATCH] 修改指派设备 修改设备结构树权限 优化查询 优化排序 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java | 43 +++++++++++++++++++++---------------------- 1 files changed, 21 insertions(+), 22 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java index 3856ff5..ef7d501 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java @@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.shiro.SecurityUtils; @@ -20,6 +21,7 @@ import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.dnc.entity.ComponentInfo; import org.springframework.beans.factory.annotation.Autowired; @@ -51,6 +53,8 @@ private IDocInfoService docInfoService; @Autowired private INcLogInfoService iNcLogInfoService; + @Autowired + private IDocRelativeService iDocRelativeService; @Override @Transactional(rollbackFor = {Exception.class}) @@ -133,7 +137,8 @@ b = componentPermissionService.save(permission); if(!b) ExceptionCast.cast(CommonCode.FAIL); - //娣诲姞榛樿宸ュ簭 + //鍘婚櫎榛樿鏂板宸ュ簭锛岃浆涓烘墜鍔ㄦ坊鍔� + /*/娣诲姞榛樿宸ュ簭 ProcessStream processStream = new ProcessStream(); processStream.setProductId(componentInfo.getProductId()); processStream.setComponentId(componentInfo.getComponentId()); @@ -149,7 +154,7 @@ iNcLogInfoService.saveLogNcInfos(ncLogInfogx); b = processStreamService.save(processStream); if(!b) - ExceptionCast.cast(CommonCode.FAIL); + ExceptionCast.cast(CommonCode.FAIL);*/ //娣诲姞鏉冮檺 PermissionStream stream = new PermissionStream(); stream.setUserId(userId); @@ -295,18 +300,12 @@ if(processStreamList != null && !processStreamList.isEmpty()) { ExceptionCast.cast(ComponentInfoCode.COMPONENT_PROCESS_EXIST); } - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(4); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("閮ㄤ欢鍚嶇О锛�"+componentInfo.getComponentName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); - boolean b = docInfoService.deleteByComponentId(id); - if(!b) - ExceptionCast.cast(CommonCode.FAIL); + boolean b; + //楠岃瘉鏄惁瀛樺湪鏂囨。 + List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","2").eq("attribution_id",id)); + if (!docRelativeList.isEmpty()){ + ExceptionCast.cast(ComponentInfoCode.COMPONENT_DOC_EXIST); + } b = componentPermissionService.deleteByComponentId(id); if(!b) ExceptionCast.cast(CommonCode.FAIL); @@ -411,23 +410,23 @@ @Override @Transactional(rollbackFor = {Exception.class}) - public boolean assignAddDepart(ComponentInfo componentInfo, Collection<Department> departmentList) { + public boolean assignAddDepart(ComponentInfo componentInfo, Collection<MdcProduction> departmentList) { if(componentInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ComponentDepartment> componentDepartments = new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { - ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getDepartId()); + ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getId()); if(en == null) { en = new ComponentDepartment(); - en.setDepartId(item.getDepartId()); + en.setDepartId(item.getId()); en.setComponentId(componentInfo.getComponentId()); componentDepartments.add(en); } - PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getDepartId()); + PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId()); if(stream == null) { stream = new PermissionStream(); - stream.setDepartId(item.getDepartId()); + stream.setDepartId(item.getId()); stream.setProductId(componentInfo.getProductId()); stream.setComponentId(componentInfo.getComponentId()); permissionStreamList.add(stream); @@ -450,17 +449,17 @@ @Override @Transactional(rollbackFor = {Exception.class}) - public boolean assignRemoveDepart(ComponentInfo componentInfo, Collection<Department> departmentList) { + public boolean assignRemoveDepart(ComponentInfo componentInfo, Collection<MdcProduction> departmentList) { if(componentInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ComponentDepartment> componentDepartments = new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { - ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getDepartId()); + ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getId()); if(en != null) { componentDepartments.add(en); } - PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getDepartId()); + PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId()); if(stream != null) { permissionStreamList.add(stream); } -- Gitblit v1.9.3