| | |
| | | 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; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据所属业务编号和类型统计 |
| | | * @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.setMainId(fileInfo.getMainId()); |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | } |