From c06fab29ca7826a6dc9736c1ba8ce1e26a11c829 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期四, 06 三月 2025 15:57:08 +0800 Subject: [PATCH] 新增层级结构工艺规程版本、结构树表、新权限表 修改原有权限验证 删除原有代码 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java | 198 +++++++++++++++++++++---------------------------- 1 files changed, 84 insertions(+), 114 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java index 7a0745f..809ae76 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java @@ -16,6 +16,7 @@ import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.mapper.DocInfoMapper; import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.utils.CamelToSnakeRegex; import org.jeecg.modules.dnc.utils.ValidateUtil; @@ -25,6 +26,7 @@ import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.response.*; +import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.system.service.ISysDictService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -37,7 +39,9 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; @Service public class DocInfoServiceImpl extends ServiceImpl<DocInfoMapper, DocInfo> implements IDocInfoService { @@ -55,8 +59,7 @@ private IDeviceInfoService deviceInfoService; @Autowired private IDeviceGroupService deviceGroupService; - @Autowired - private INcLogInfoService iNcLogInfoService; + /*澶囦唤澶勭悊*/ @Override @@ -136,15 +139,6 @@ } } - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("瀵煎叆"+docClass.getClassificationName()+"锛屾枃妗e悕绉�:"+(docFile.getFileName()+"."+docFile.getFileSuffix())); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); boolean saveBool = super.save(docInfo); return saveBool; } @@ -300,17 +294,6 @@ docInfo.setClassificationId(null); docInfo.setPublishFileId(null); docInfo.setPublishVersion(null); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(3); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鏂囨。鍚嶇О锛�"+docInfo.getDocName()); - //淇敼淇濆瓨澶囨敞 - ncLogInfo.setRemark(JSONObject.toJSONString(en)); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.updateById(docInfo); } @@ -333,15 +316,6 @@ b = docRelativeService.deleteByDocId(id); if(!b) ExceptionCast.cast(CommonCode.FAIL); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(4); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鏂囨。鍚嶇О锛�"+en.getDocName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.removeById(id); } @@ -359,7 +333,7 @@ DocInfo en = super.getById(id); if(en == null) ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); - List<DeviceInfo> deviceList = docRelativeService.findDeviceByDocId(en.getDocId()); + List<MdcEquipment> deviceList = docRelativeService.findDeviceByDocId(en.getDocId()); if(deviceList != null && !deviceList.isEmpty()) ExceptionCast.cast(DocumentCode.DOC_DEVICE_EXIST); String suffix = FileUtilS.getFileSuffix(file.getOriginalFilename()); @@ -380,16 +354,6 @@ docFile.setFilePath(fileUploadResult.getFilePath()); docFile.setFileSize(fileUploadResult.getFileSize()); docFile.setFileSuffix(fileUploadResult.getFileSuffix()); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍏ュ簱"+docFile.getFileSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+docFile.getFileName()); - ncLogInfo.setRemark(JSONObject.toJSONString(en)); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); boolean b = fileOperateService.deleteByDocId(id); if(!b) ExceptionCast.cast(CommonCode.FAIL); @@ -448,15 +412,6 @@ DocFile old = docFileService.getDocFileNearest(en.getDocId()); if(old == null) ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NONE); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍙戝竷"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); if(old.getDocVersion().contains(".")) { DocFile docFile = new DocFile(); BeanUtils.copyProperties(pubFile, docFile); @@ -483,15 +438,6 @@ ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); if(en.getDocStatus() != 2) ExceptionCast.cast(DocumentCode.DOC_REPUBLISH_ERROR); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("閲嶆柊鍙戝竷"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.lambdaUpdate().eq(DocInfo::getDocId, id).set(DocInfo::getDocStatus, 1).update(); } @@ -508,15 +454,6 @@ FileOperate operate = fileOperateService.getByDocId(id); if(operate != null) ExceptionCast.cast(DocumentCode.DOC_IS_OPERATING); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("褰掓。"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.lambdaUpdate().eq(DocInfo::getDocId, id).set(DocInfo::getDocStatus, 3).update(); } @@ -534,15 +471,6 @@ DocInfo en = super.getById(id); if(en == null) ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍙栨秷鍑哄簱"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return fileOperateService.deleteByDocId(id); } @@ -578,18 +506,33 @@ queryWrapper.eq(StrUtil.isNotEmpty(docNameArr[1]), "u.doc_suffix", docNameArr[1]); } } - queryWrapper.ge(StrUtil.isNotEmpty(docQuery.getStartTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getStartTime()); - queryWrapper.le(StrUtil.isNotEmpty(docQuery.getEndTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getEndTime()); - if(ValidateUtil.validateString(docQuery.getAscStr())) { - String[] ascArr = docQuery.getAscStr().split(","); -// ((Page<DocInfo>) pageData).setAsc(ascArr); - } - if(ValidateUtil.validateString(docQuery.getDescStr())) { - String[] descStr = docQuery.getDescStr().split(","); -// ((Page<DocInfo>) pageData).setDesc(descStr); - } + getDocQuery(docQuery, queryWrapper); IPage<DocInfo> docInfoIPage = super.getBaseMapper().findDocExtList(pageData, queryWrapper); return Result.ok(docInfoIPage); + } + + private void getDocQuery(DocInfoQueryRequest docQuery, QueryWrapper<DocInfo> queryWrapper) { + if (docQuery.getDocStatus() != null && docQuery.getDocStatus().contains(",")) { + String[] docStatusArray = docQuery.getDocStatus().split(","); + List<Integer> docStatusList = Arrays.stream(docStatusArray).map(Integer::parseInt).collect(Collectors.toList()); + queryWrapper.in("u.doc_status",docStatusList); + }else { + queryWrapper.eq(StrUtil.isNotEmpty(docQuery.getDocStatus()),"u.doc_status",docQuery.getDocStatus()); + } + if (StrUtil.isNotEmpty(docQuery.getPullStatus())){ + if (("1").equals(docQuery.getPullStatus())){ + queryWrapper.isNull("o.doc_id"); + }else if (("2").equals(docQuery.getPullStatus())){ + queryWrapper.isNotNull("o.doc_id"); + } + } + queryWrapper.ge(StrUtil.isNotEmpty(docQuery.getStartTime()),"u.create_time",docQuery.getStartTime()+" 00:00:00"); + queryWrapper.le(StrUtil.isNotEmpty(docQuery.getEndTime()),"u.create_time",docQuery.getEndTime()+" 23:59:59"); + if (("desc").equals(docQuery.getOrder())){ + queryWrapper.orderByDesc("u."+ CamelToSnakeRegex.camelToSnake(docQuery.getColumn())); + }else { + queryWrapper.orderByAsc("u."+CamelToSnakeRegex.camelToSnake(docQuery.getColumn())); + } } @Override @@ -680,7 +623,7 @@ public boolean deleteByProcessId(String processId) { if(!ValidateUtil.validateString(processId)) ExceptionCast.cast(CommonCode.INVALID_PARAM); - Integer attrType = 4; + Integer attrType = 5; boolean b = docFileService.deleteByDocAttr(attrType, processId); if(!b) ExceptionCast.cast(CommonCode.FAIL); @@ -689,6 +632,27 @@ ExceptionCast.cast(CommonCode.FAIL); } return docRelativeService.deleteByDocAttr(attrType, processId); + } + + /** + * 鍒犻櫎宸ユ涓嬬殑鎵�鏈夋枃妗� + * @param stepId + * @return + */ + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByStepId(String stepId){ + if(!ValidateUtil.validateString(stepId)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + Integer attrType = 6; + boolean b = docFileService.deleteByDocAttr(attrType, stepId); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = deleteByDocAttr(attrType, stepId); + if(!b) { + ExceptionCast.cast(CommonCode.FAIL); + } + return docRelativeService.deleteByDocAttr(attrType, stepId); } @Override @@ -717,15 +681,6 @@ String filePath = docFile.getFilePath(); String fileEncodeName = docFile.getFileEncodeName(); FileUtilS.downLoadFile(response, fileEncodeName, filePath, fileName); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍑哄簱"+docFile.getFileSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+fileName); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return null; } @@ -756,7 +711,7 @@ } @Override - public QueryPageResponseResult<DocInfo> findPageListByDevice(int page, int size, DocInfoQueryRequest docQuery) { + public IPage<DocInfo> findPageListByDevice(int page, int size, DocInfoQueryRequest docQuery) { if(page < 1 || size < 1) { ExceptionCast.cast(CommonCode.INVALID_PAGE); } @@ -784,16 +739,33 @@ queryWrapper.eq(StrUtil.isNotEmpty(docNameArr[1]), "u.doc_suffix", docNameArr[1]); } } - queryWrapper.ge(StrUtil.isNotEmpty(docQuery.getStartTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getStartTime()); - queryWrapper.le(StrUtil.isNotEmpty(docQuery.getEndTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getEndTime()); - - if(ValidateUtil.validateString(docQuery.getAscStr())) { - String[] ascArr = docQuery.getAscStr().split(","); -// ((Page<DocInfo>) pageData).setAsc(ascArr); + if (docQuery.getDocStatus() != null && docQuery.getDocStatus().contains(",")) { + String[] docStatusArray = docQuery.getDocStatus().split(","); + List<Integer> docStatusList = Arrays.stream(docStatusArray).map(Integer::parseInt).collect(Collectors.toList()); + queryWrapper.in("u.doc_status",docStatusList); + }else { + queryWrapper.eq(StrUtil.isNotEmpty(docQuery.getDocStatus()),"u.doc_status",docQuery.getDocStatus()); } - if(ValidateUtil.validateString(docQuery.getDescStr())) { - String[] descStr = docQuery.getDescStr().split(","); -// ((Page<DocInfo>) pageData).setDesc(descStr); + if (StrUtil.isNotEmpty(docQuery.getPullStatus())){ + if (("1").equals(docQuery.getPullStatus())){ + queryWrapper.isNull("o.doc_id"); + }else if (("2").equals(docQuery.getPullStatus())){ + queryWrapper.isNotNull("o.doc_id"); + } + } + if (docQuery.getSyncStatus()!=null){ + if (docQuery.getSyncStatus()==1){ + queryWrapper.isNotNull("t.sync_flag"); + }else if (docQuery.getSyncStatus()==2){ + queryWrapper.isNull("t.sync_flag"); + } + } + queryWrapper.ge(StrUtil.isNotEmpty(docQuery.getStartTime()),"u.create_time",docQuery.getStartTime()+" 00:00:00"); + queryWrapper.le(StrUtil.isNotEmpty(docQuery.getEndTime()),"u.create_time",docQuery.getEndTime()+" 23:59:59"); + if (("desc").equals(docQuery.getOrder())){ + queryWrapper.orderByDesc("u."+ CamelToSnakeRegex.camelToSnake(docQuery.getColumn())); + }else { + queryWrapper.orderByAsc("u."+CamelToSnakeRegex.camelToSnake(docQuery.getColumn())); } IPage<DocInfo> docInfoIPage = super.getBaseMapper().findDeviceDocExtList(pageData, queryWrapper); if (docInfoIPage != null && docInfoIPage.getRecords() != null && !docInfoIPage.getRecords().isEmpty()) { @@ -801,11 +773,11 @@ d.setSyncStatus(2); } } - return new QueryPageResponseResult<>(CommonCode.SUCCESS, docInfoIPage); + return docInfoIPage; } @Override - public QueryListResponseResult<DocInfo> findList(DocInfoQueryRequest docQuery) { + public List<DocInfo> findList(DocInfoQueryRequest docQuery) { if(docQuery == null || !ValidateUtil.validateString(docQuery.getAttributionId()) || !ValidateUtil.validateInteger(docQuery.getAttributionType()) || !ValidateUtil.validateString(docQuery.getDocClassCode())) { @@ -829,10 +801,8 @@ queryWrapper.eq(StrUtil.isNotEmpty(docNameArr[1]), "u.doc_suffix", docNameArr[1]); } } - queryWrapper.ge(StrUtil.isNotEmpty(docQuery.getStartTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getStartTime()); - queryWrapper.le(StrUtil.isNotEmpty(docQuery.getEndTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getEndTime()); - List<DocInfo> docInfoIPage = super.getBaseMapper().findDocExtList(queryWrapper); - return new QueryListResponseResult<>(CommonCode.SUCCESS, docInfoIPage); + getDocQuery(docQuery, queryWrapper); + return super.getBaseMapper().findDocExtList(queryWrapper); } @Override -- Gitblit v1.9.3