From 67bc268ffdc203fd0f3081261c8778bd61a23541 Mon Sep 17 00:00:00 2001
From: liyj <1003249715@qq.com>
Date: Sat, 31 Aug 2024 16:03:38 +0800
Subject: [PATCH] 1、新增附件管理模块
---
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/service/FileRelateService.java | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/dyh-service/dyh-sys/src/main/java/cn/huge/module/file/service/FileRelateService.java b/dyh-service/dyh-sys/src/main/java/cn/huge/module/file/service/FileRelateService.java
index 0bf31e4..50aea52 100644
--- a/dyh-service/dyh-sys/src/main/java/cn/huge/module/file/service/FileRelateService.java
+++ b/dyh-service/dyh-sys/src/main/java/cn/huge/module/file/service/FileRelateService.java
@@ -5,7 +5,10 @@
import cn.huge.base.common.utils.IdUtils;
import cn.huge.module.client.api.impl.UtilsClientImpl;
import cn.huge.module.file.dao.mapper.FileRelateMapper;
+import cn.huge.module.file.domain.dto.UploaderDTO;
+import cn.huge.module.file.domain.po.FileInfo;
import cn.huge.module.file.domain.po.FileRelate;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -130,4 +133,43 @@
}
}
+ /**
+ * 根据所属业务编号和类型统计
+ * @param ownerId 所属业务编号
+ * @param ownerType 所属业务类型
+ * @return int 统计数
+ */
+ public int countByOwnerIdAndType(String ownerId, String ownerType){
+ QueryWrapper<FileRelate> fileRelateQueryWrapper = new QueryWrapper<>();
+ fileRelateQueryWrapper.eq("owner_id", ownerId).eq("owner_type", ownerType);
+ return mapper.selectCount(fileRelateQueryWrapper);
+ }
+
+ /**
+ * 根据附件信息新增附件业务关系
+ * @param fileInfo 附件信息
+ */
+ public void saveByFileInfo(FileInfo fileInfo) {
+ try {
+ // 保存业务关系
+ FileRelate fileRelate = new FileRelate();
+ fileRelate.setId(utilsClient.getNewTimeId());
+ fileRelate.setFileId(fileInfo.getId());
+ fileRelate.setOwnerId(fileInfo.getOwnerId());
+ fileRelate.setOwnerCat(fileInfo.getOwnerCat());
+ fileRelate.setOwnerType(fileInfo.getOwnerType());
+ fileRelate.setUploaderId(fileInfo.getUploaderId());
+ fileRelate.setUploaderName(fileInfo.getUploaderName());
+ fileRelate.setUploaderType(fileInfo.getUploaderType());
+ fileRelate.setCustId(fileInfo.getCustId());
+ Date nowDate = DateUtils.getNowDate();
+ fileRelate.setCreateTime(nowDate);
+ fileRelate.setUpdateTime(nowDate);
+ mapper.insert(fileRelate);
+ } catch (Exception e) {
+ log.error("service方法[FileRelateService.uploadFile]调用异常:"+e, e);
+ throw new ServiceException("FileRelateService.uploadFile", e);
+ }
+ }
+
}
--
Gitblit v1.8.0