From 3302ff7054d02f6b21452f2f2cd3658c8cad6b53 Mon Sep 17 00:00:00 2001 From: lyh <liuyuanheng@xalxzn.com> Date: 星期四, 20 二月 2025 10:36:23 +0800 Subject: [PATCH] 增加工序工步用户权限 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java | 40 ++++++++-------------------------------- 1 files changed, 8 insertions(+), 32 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java index 7b67da4..a7b5a5e 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.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; @@ -54,6 +55,8 @@ private IDocInfoService docInfoService; @Autowired private INcLogInfoService iNcLogInfoService; + @Autowired + private IDocRelativeService iDocRelativeService; @Override @Transactional(rollbackFor = {Exception.class}) public boolean addPartsInfo(PartsInfo partsInfo) { @@ -81,15 +84,6 @@ if(componentInfo == null) ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE); partsInfo.setPartsStatus(1); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(2); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName()+"锛岄浂浠朵唬鍙凤細"+partsInfo.getPartsCode()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); boolean b = super.save(partsInfo); List<PermissionStream> oldDepartPermList = permissionStreamService.getByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { @@ -126,23 +120,12 @@ b = partsPermissionService.save(permission); if(!b) ExceptionCast.cast(CommonCode.FAIL); -// if(!b) -// ExceptionCast.cast(CommonCode.FAIL); //娣诲姞鐢ㄦ埛鏉冮檺 PermissionStream stream = new PermissionStream(); stream.setProductId(partsInfo.getProductId()); stream.setComponentId(partsInfo.getComponentId()); stream.setPartsId(partsInfo.getPartsId()); stream.setUserId(userId); -// //娣诲姞鏃ュ織 -// NcLogInfo ncLogInfogx = new NcLogInfo(); -// //妯″潡 -// ncLogInfogx.setModuleInfo("浜у搧缁撴瀯鏍�"); -// //绫诲瀷 -// ncLogInfogx.setOperateType(2); -// //鏃ュ織鍐呭 -// ncLogInfogx.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName()+"鐢熸垚榛樿宸ュ簭锛屽伐搴忓彿锛�"+processStream.getProcessCode()); -// iNcLogInfoService.saveLogNcInfos(ncLogInfogx); return permissionStreamService.save(stream); } @@ -273,6 +256,11 @@ if(processStreams != null && !processStreams.isEmpty()) ExceptionCast.cast(PartsInfoCode.PARTS_PROCESS_EXIST); boolean b = partsPermissionService.deleteByPartsId(partsInfo.getPartsId()); + //楠岃瘉鏄惁瀛樺湪鏂囨。 + List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","3").eq("attribution_id",partsId)); + if (!docRelativeList.isEmpty()){ + ExceptionCast.cast(PartsInfoCode.PARTS_DOC_EXIST); + } if(!b) ExceptionCast.cast(CommonCode.FAIL); b = partsDepartmentService.deleteByPartsId(partsInfo.getPartsId()); @@ -284,18 +272,6 @@ b = permissionStreamService.deleteDepartPermsByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId()); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = docInfoService.deleteByPartsId(partsInfo.getPartsId()); - if(!b) - ExceptionCast.cast(CommonCode.FAIL); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(4); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.removeById(partsInfo.getPartsId()); } -- Gitblit v1.9.3