pull/1/head
siontion 9 months ago
commit 3b24c2b6e9

@ -0,0 +1,21 @@
package com.chanko.yunxi.mes.module.heli.enums;
import lombok.Getter;
/**
*
* @author chenxi
* @date 2024-01-16 10:38
*/
@Getter
public enum BusinessFileTypeEnum {
CONTRACT("合同"),
TECHNOLOGY_PROTOCOL("技术协议");
private String description;
BusinessFileTypeEnum(String description) {
this.description = description;
}
}

@ -45,8 +45,9 @@ public interface FileApi {
* @param content * @param content
* @param businessType * @param businessType
* @param businessId * @param businessId
* @param businessFileType
* @return * @return
*/ */
String createFile(String name, String path, byte[] content, String businessType, Long businessId); String createFile(String name, String path, byte[] content, String businessType, Long businessId, String businessFileType);
} }

@ -20,12 +20,12 @@ public class FileApiImpl implements FileApi {
@Override @Override
public String createFile(String name, String path, byte[] content) { public String createFile(String name, String path, byte[] content) {
return fileService.createFile(name, path, content, null, null); return fileService.createFile(name, path, content, null, null, null);
} }
@Override @Override
public String createFile(String name, String path, byte[] content, String businessType, Long businessId) { public String createFile(String name, String path, byte[] content, String businessType, Long businessId, String businessFileType) {
return fileService.createFile(name, path, content, businessType, businessId); return fileService.createFile(name, path, content, businessType, businessId, businessFileType);
} }
} }

@ -48,7 +48,7 @@ public class FileController {
public CommonResult<String> uploadFile(FileUploadReqVO uploadReqVO) throws Exception { public CommonResult<String> uploadFile(FileUploadReqVO uploadReqVO) throws Exception {
MultipartFile file = uploadReqVO.getFile(); MultipartFile file = uploadReqVO.getFile();
String path = uploadReqVO.getPath(); String path = uploadReqVO.getPath();
return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()), uploadReqVO.getBusinessType(), uploadReqVO.getBusinessId())); return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()), uploadReqVO.getBusinessType(), uploadReqVO.getBusinessId(), uploadReqVO.getBusinessFileType()));
} }
@PostMapping("/uploadBatch") @PostMapping("/uploadBatch")
@ -57,7 +57,7 @@ public class FileController {
public CommonResult<Void> uploadFileBatch(FileUploadBatchReqVO uploadReqVO) throws Exception { public CommonResult<Void> uploadFileBatch(FileUploadBatchReqVO uploadReqVO) throws Exception {
MultipartFile[] files = uploadReqVO.getFiles(); MultipartFile[] files = uploadReqVO.getFiles();
for (MultipartFile file : files) { for (MultipartFile file : files) {
fileService.createFile(file.getOriginalFilename(), null, IoUtil.readBytes(file.getInputStream()), uploadReqVO.getBusinessType(), uploadReqVO.getBusinessId()); fileService.createFile(file.getOriginalFilename(), null, IoUtil.readBytes(file.getInputStream()), uploadReqVO.getBusinessType(), uploadReqVO.getBusinessId(), uploadReqVO.getBusinessFileType());
} }
return success(null); return success(null);
} }

@ -16,10 +16,13 @@ public class FileUploadBatchReqVO {
@NotEmpty(message = "上传文件不能为空") @NotEmpty(message = "上传文件不能为空")
private MultipartFile[] files; private MultipartFile[] files;
@Schema(description = "文件业务类型") @Schema(description = "业务类型")
private String businessType; private String businessType;
@Schema(description = "文件业务id") @Schema(description = "业务id")
private Long businessId; private Long businessId;
@Schema(description = "业务文件类型")
private String businessFileType;
} }

@ -17,10 +17,13 @@ public class FileUploadReqVO {
@Schema(description = "文件附件", example = "mesyuanma.png") @Schema(description = "文件附件", example = "mesyuanma.png")
private String path; private String path;
@Schema(description = "文件业务类型") @Schema(description = "业务类型")
private String businessType; private String businessType;
@Schema(description = "文件业务id") @Schema(description = "业务id")
private Long businessId; private Long businessId;
@Schema(description = "业务文件类型")
private String businessFileType;
} }

@ -32,7 +32,7 @@ public class AppFileController {
public CommonResult<String> uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception { public CommonResult<String> uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception {
MultipartFile file = uploadReqVO.getFile(); MultipartFile file = uploadReqVO.getFile();
String path = uploadReqVO.getPath(); String path = uploadReqVO.getPath();
return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()), uploadReqVO.getBusinessType(), uploadReqVO.getBusinessId())); return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()), uploadReqVO.getBusinessType(), uploadReqVO.getBusinessId(), uploadReqVO.getBusinessFileType()));
} }
} }

@ -14,12 +14,15 @@ public class AppFileUploadReqVO {
@NotNull(message = "文件附件不能为空") @NotNull(message = "文件附件不能为空")
private MultipartFile file; private MultipartFile file;
@Schema(description = "文件业务类型") @Schema(description = "业务类型")
private String businessType; private String businessType;
@Schema(description = "文件业务id") @Schema(description = "业务id")
private Long businessId; private Long businessId;
@Schema(description = "业务文件类型")
private String businessFileType;
@Schema(description = "文件附件", example = "mesyuanma.png") @Schema(description = "文件附件", example = "mesyuanma.png")
private String path; private String path;

@ -27,9 +27,10 @@ public interface FileService {
* @param content * @param content
* @param businessType * @param businessType
* @param businessId * @param businessId
* @param businessFileType
* @return * @return
*/ */
String createFile(String name, String path, byte[] content, String businessType, Long businessId); String createFile(String name, String path, byte[] content, String businessType, Long businessId, String businessFileType);
/** /**
* *

@ -38,7 +38,7 @@ public class FileServiceImpl implements FileService {
@Override @Override
@SneakyThrows @SneakyThrows
public String createFile(String name, String path, byte[] content, String businessType, Long businessId) { public String createFile(String name, String path, byte[] content, String businessType, Long businessId, String businessFileType) {
// 计算默认的 path 名 // 计算默认的 path 名
String type = FileTypeUtils.getMineType(content, name); String type = FileTypeUtils.getMineType(content, name);
if (StrUtil.isEmpty(path)) { if (StrUtil.isEmpty(path)) {

@ -16,6 +16,12 @@ public class OperateLogPageReqVO extends PageParam {
@Schema(description = "操作模块,模拟匹配", example = "订单") @Schema(description = "操作模块,模拟匹配", example = "订单")
private String module; private String module;
@Schema(description = "业务类型 用于业务关联", example = "2")
private String businessType;
@Schema(description = "业务id", example = "18297")
private Long businessId;
@Schema(description = "用户昵称,模拟匹配", example = "芋道") @Schema(description = "用户昵称,模拟匹配", example = "芋道")
private String userNickname; private String userNickname;

@ -24,6 +24,12 @@ public class OperateLogRespVO {
@Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "89aca178-a370-411c-ae02-3f0d672be4ab") @Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
private String traceId; private String traceId;
@Schema(description = "业务类型 用于业务关联", example = "2")
private String businessType;
@Schema(description = "业务id", example = "18297")
private Long businessId;
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long userId; private Long userId;

@ -47,6 +47,14 @@ public class OperateLogDO extends BaseDO {
* 访logger * 访logger
*/ */
private String traceId; private String traceId;
/**
*
*/
private String businessType;
/**
* id
*/
private Long businessId;
/** /**
* *
* *

@ -15,6 +15,8 @@ public interface OperateLogMapper extends BaseMapperX<OperateLogDO> {
default PageResult<OperateLogDO> selectPage(OperateLogPageReqVO reqVO, Collection<Long> userIds) { default PageResult<OperateLogDO> selectPage(OperateLogPageReqVO reqVO, Collection<Long> userIds) {
LambdaQueryWrapperX<OperateLogDO> query = new LambdaQueryWrapperX<OperateLogDO>() LambdaQueryWrapperX<OperateLogDO> query = new LambdaQueryWrapperX<OperateLogDO>()
.eqIfPresent(OperateLogDO::getBusinessType, reqVO.getBusinessType())
.eqIfPresent(OperateLogDO::getBusinessId, reqVO.getBusinessId())
.likeIfPresent(OperateLogDO::getModule, reqVO.getModule()) .likeIfPresent(OperateLogDO::getModule, reqVO.getModule())
.inIfPresent(OperateLogDO::getUserId, userIds) .inIfPresent(OperateLogDO::getUserId, userIds)
.eqIfPresent(OperateLogDO::getType, reqVO.getType()) .eqIfPresent(OperateLogDO::getType, reqVO.getType())

@ -10,7 +10,7 @@
:auto-upload="autoUpload" :auto-upload="autoUpload"
:action="updateUrl" :action="updateUrl"
:headers="uploadHeaders" :headers="uploadHeaders"
:data="{'businessType': businessType, 'businessId': businessId}" :data="{'businessType': businessType, 'businessId': businessId, 'businessFileType': businessFileType}"
:limit="props.limit" :limit="props.limit"
:drag="drag" :drag="drag"
:before-upload="beforeUpload" :before-upload="beforeUpload"
@ -44,8 +44,9 @@ const message = useMessage() // 消息弹窗
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const props = defineProps({ const props = defineProps({
businessType: propTypes.string, businessType: propTypes.string, //
businessId: propTypes.number, businessId: propTypes.number, // id
businessFileType: propTypes.string, //
modelValue: propTypes.oneOfType<string | string[]>([String, Array<String>]).isRequired, modelValue: propTypes.oneOfType<string | string[]>([String, Array<String>]).isRequired,
title: propTypes.string.def('文件上传'), title: propTypes.string.def('文件上传'),
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_BATCH_URL), updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_BATCH_URL),

@ -1,3 +1,15 @@
ALTER TABLE system_operate_log MODIFY COLUMN `result_data` TEXT COMMENT '结果数据';
ALTER TABLE system_operate_log MODIFY COLUMN `java_method_args` TEXT COMMENT 'Java 方法的参数';
ALTER TABLE system_operate_log MODIFY COLUMN `content` TEXT COMMENT '操作内容';
ALTER TABLE system_operate_log ADD COLUMN `business_id` bigint(20) DEFAULT NULL COMMENT '业务id' AFTER trace_id;
ALTER TABLE system_operate_log ADD COLUMN `business_type` varchar(32) COMMENT '业务类型 用于业务关联' AFTER trace_id;
ALTER TABLE system_operate_log add INDEX `idx_business`(`business_type`,`business_id`);
ALTER TABLE infra_file ADD COLUMN business_file_type varchar(32) COMMENT '业务文件类型 用于区分不同业务类型文件' after business_id;
ALTER TABLE infra_file ADD INDEX `idx_business`(`business_type`,`business_id`,`business_file_type`);
DROP TABLE IF EXISTS `wms_storage`; DROP TABLE IF EXISTS `wms_storage`;
CREATE TABLE `wms_storage` ( CREATE TABLE `wms_storage` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id', `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',

Loading…
Cancel
Save