lyh
2025-04-17 990ad5f6db0bb3ad5a3795e77c5d6f3971c12ff3
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java
@@ -11,6 +11,7 @@
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.FileUploadResult;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.dnc.entity.*;
import org.jeecg.modules.dnc.exception.ExceptionCast;
@@ -25,6 +26,8 @@
import org.jeecg.modules.dncFlow.entity.DispatchFile;
import org.jeecg.modules.dncFlow.service.IDispatchFileService;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.system.entity.SysParams;
import org.jeecg.modules.system.service.ISysParamsService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
@@ -58,6 +61,8 @@
    private IDeviceGroupService deviceGroupService;
    @Autowired
    private IDispatchFileService dispatchFileService;
    @Autowired
    private ISysParamsService sysParamsService;
    /*备份处理*/
    @Override
@@ -137,7 +142,11 @@
            }
        }
        boolean saveBool = super.save(docInfo);
        if (uploadRequest.getIsApprove()&&saveBool){
        SysParams sysParams=sysParamsService.getSysPramBySettingKey("nc_dispatch_file");
        if (sysParams ==null){
            throw new JeecgBootException("未配置导入NC与电子图版是否触发审签流程,请联系管理员");
        }else {
            if (saveBool&&sysParams.getSettingValue().equals("1")&&uploadRequest.getDocClassCode().equals("NC")){
            //触发审签
            DispatchFile dispatchFile = new DispatchFile();
            dispatchFile.setDocId(docInfo.getDocId());
@@ -146,6 +155,7 @@
            dispatchFile.setAttributionType(String.valueOf(uploadRequest.getAttributionType()));
            dispatchFile.setDocClassCode(uploadRequest.getDocClassCode());
            dispatchFileService.saveDispatchFile(dispatchFile);
            }
        }
        return saveBool;
    }
@@ -828,6 +838,45 @@
        return super.getBaseMapper().findDocExtList(queryWrapper);
    }
    /**
     * 通过一组attributionId,docClassCode,attributionType查询可指派的文档信息列表
     * @param docQuery
     * @return
     */
    @Override
    public List<DocInfo> findListByDocQuery(DocInfoQueryRequest docQuery){
        if(docQuery == null || !ValidateUtil.validateString(docQuery.getAttributionIds())
                || !ValidateUtil.validateInteger(docQuery.getAttributionType()) ||
                !ValidateUtil.validateString(docQuery.getDocClassCode())) {
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        }
        DocClassification docClassification = docClassificationService.getByCode(docQuery.getDocClassCode());
        if(docClassification == null) {
            ExceptionCast.cast(CommonCode.INVALID_PAGE);
        }
        List<String> attributionIds = Arrays.asList(docQuery.getAttributionIds().split(","));
        QueryWrapper<DocInfo> queryWrapper = Wrappers.query();
        queryWrapper.eq(StrUtil.isNotEmpty(docQuery.getDocId()),"u.doc_id",docQuery.getDocId());
        queryWrapper.eq("r.attribution_type", docQuery.getAttributionType())
                .in("r.attribution_id", attributionIds)
                .eq("r.classification_id", docClassification.getClassificationId());
        if (StringUtils.isNotEmpty(docQuery.getDocName())) {
            int dotIndex = docQuery.getDocName().lastIndexOf(".");
            if (dotIndex == -1) {
                queryWrapper.like("u.doc_name", docQuery.getDocName());
            } else {
                String[] docNameArr = docQuery.getDocName().split("\\.");
                queryWrapper.like(StrUtil.isNotEmpty(docNameArr[0]), "u.doc_name", docNameArr[0]);
                queryWrapper.eq(StrUtil.isNotEmpty(docNameArr[1]), "u.doc_suffix", docNameArr[1]);
            }
        }
        getDocQuery(docQuery, queryWrapper);
        return super.getBaseMapper().findDocExtList(queryWrapper);
    }
    @Override
    public List<DocInfo> getByProcessIds(List<ProcessStream> streams) {
        List<String> ids = new ArrayList<>();