| | |
| | | package org.jeecg.modules.dnc.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | private IDispatchFileService dispatchFileService; |
| | | @Autowired |
| | | private ISysParamsService sysParamsService; |
| | | @Autowired |
| | | @Lazy |
| | | private IComponentInfoService componentInfoService; |
| | | |
| | | /*备份处理*/ |
| | | @Override |
| | |
| | | docRelative.setAttributionType(uploadRequest.getAttributionType()); |
| | | docRelative.setClassificationId(docClass.getClassificationId()); |
| | | boolean b = docRelativeService.save(docRelative); |
| | | if (uploadRequest.getAttributionType()==2){ |
| | | //查询借用的部件 |
| | | List<ComponentInfo> borrowComponentInfoList=componentInfoService.list(new QueryWrapper<ComponentInfo>().eq("borrow_id", uploadRequest.getAttributionId())); |
| | | if (!borrowComponentInfoList.isEmpty()) { |
| | | borrowComponentInfoList.forEach(item->{ |
| | | DocRelative borrowDocRelative = new DocRelative(); |
| | | BeanUtil.copyProperties(docRelative,borrowDocRelative); |
| | | borrowDocRelative.setAttributionId(item.getComponentId()); |
| | | borrowDocRelative.setId(null); |
| | | docRelativeService.save(borrowDocRelative); |
| | | }); |
| | | } |
| | | } |
| | | if(!b) |
| | | ExceptionCast.cast(DocumentCode.DOC_UPLOAD_ERROR); |
| | | DocFile docFile = new DocFile(); |
| | |
| | | if (sysParams ==null){ |
| | | throw new JeecgBootException("未配置导入NC与电子图版是否触发审签流程,请联系管理员"); |
| | | }else { |
| | | if (saveBool&&sysParams.getSettingValue().equals("1")&&uploadRequest.getDocClassCode().equals("NC")){ |
| | | if (saveBool&&sysParams.getSettingValue().equals("1")){ |
| | | //触发审签 |
| | | DispatchFile dispatchFile = new DispatchFile(); |
| | | dispatchFile.setDocId(docInfo.getDocId()); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean deleteDocInfo(String id) { |
| | | public boolean deleteDocInfo(String id,String attrType,String attrId) { |
| | | if(!ValidateUtil.validateString(id)) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | DocInfo en = super.getById(id); |
| | |
| | | ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); |
| | | if(en.getDocStatus() != 1) |
| | | ExceptionCast.cast(DocumentCode.DOC_DEL_ERROR); |
| | | //查询对应的关系 |
| | | if ("2".equals(attrType)) { |
| | | //判断部件引用 |
| | | ComponentInfo componentInfo=componentInfoService.getById(attrId); |
| | | if(componentInfo!=null&&componentInfo.getBorrowId()!=null){ |
| | | //借用的部件,只删除自己的关系 |
| | | DocRelative docRelative=docRelativeService.getOne(new QueryWrapper<DocRelative>() |
| | | .eq("attribution_id", attrId).eq("attribution_type", 2).eq("doc_id",id)); |
| | | if(docRelative!=null){ |
| | | docRelativeService.removeById(docRelative.getId()); |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | FileOperate operate = fileOperateService.getByDocId(id); |
| | | if(operate != null) |
| | | ExceptionCast.cast(DocumentCode.DOC_IS_OPERATING); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean batchRemoveDocInfo(String[] docIds) { |
| | | public boolean batchRemoveDocInfo(String[] docIds,String attrType,String attrId) { |
| | | if(docIds == null || docIds.length < 1) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | for(String docId : docIds) { |
| | | this.deleteDocInfo(docId); |
| | | this.deleteDocInfo(docId,attrType,attrId); |
| | | } |
| | | return true; |
| | | } |