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 businessType
* @param businessId
* @param businessFileType
* @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
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
public String createFile(String name, String path, byte[] content, String businessType, Long businessId) {
return fileService.createFile(name, path, content, businessType, businessId);
public String createFile(String name, String path, byte[] content, String businessType, Long businessId, String businessFileType) {
return fileService.createFile(name, path, content, businessType, businessId, businessFileType);
}
}

@ -48,7 +48,7 @@ public class FileController {
public CommonResult<String> uploadFile(FileUploadReqVO uploadReqVO) throws Exception {
MultipartFile file = uploadReqVO.getFile();
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")
@ -57,7 +57,7 @@ public class FileController {
public CommonResult<Void> uploadFileBatch(FileUploadBatchReqVO uploadReqVO) throws Exception {
MultipartFile[] files = uploadReqVO.getFiles();
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);
}

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

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

@ -32,7 +32,7 @@ public class AppFileController {
public CommonResult<String> uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception {
MultipartFile file = uploadReqVO.getFile();
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 = "文件附件不能为空")
private MultipartFile file;
@Schema(description = "文件业务类型")
@Schema(description = "业务类型")
private String businessType;
@Schema(description = "文件业务id")
@Schema(description = "业务id")
private Long businessId;
@Schema(description = "业务文件类型")
private String businessFileType;
@Schema(description = "文件附件", example = "mesyuanma.png")
private String path;

@ -22,14 +22,15 @@ public interface FileService {
/**
* 访
*
* @param name
* @param path
* @param content
* @param name
* @param path
* @param content
* @param businessType
* @param businessId
* @param businessFileType
* @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
@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 名
String type = FileTypeUtils.getMineType(content, name);
if (StrUtil.isEmpty(path)) {

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

@ -24,6 +24,12 @@ public class OperateLogRespVO {
@Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
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")
private Long userId;

@ -47,6 +47,14 @@ public class OperateLogDO extends BaseDO {
* 访logger
*/
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) {
LambdaQueryWrapperX<OperateLogDO> query = new LambdaQueryWrapperX<OperateLogDO>()
.eqIfPresent(OperateLogDO::getBusinessType, reqVO.getBusinessType())
.eqIfPresent(OperateLogDO::getBusinessId, reqVO.getBusinessId())
.likeIfPresent(OperateLogDO::getModule, reqVO.getModule())
.inIfPresent(OperateLogDO::getUserId, userIds)
.eqIfPresent(OperateLogDO::getType, reqVO.getType())

@ -10,7 +10,7 @@
:auto-upload="autoUpload"
:action="updateUrl"
:headers="uploadHeaders"
:data="{'businessType': businessType, 'businessId': businessId}"
:data="{'businessType': businessType, 'businessId': businessId, 'businessFileType': businessFileType}"
:limit="props.limit"
:drag="drag"
:before-upload="beforeUpload"
@ -44,8 +44,9 @@ const message = useMessage() // 消息弹窗
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
businessType: propTypes.string,
businessId: propTypes.number,
businessType: propTypes.string, //
businessId: propTypes.number, // id
businessFileType: propTypes.string, //
modelValue: propTypes.oneOfType<string | string[]>([String, Array<String>]).isRequired,
title: propTypes.string.def('文件上传'),
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`;
CREATE TABLE `wms_storage` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
@ -42,4 +54,4 @@ CREATE TABLE `wms_storage_mat` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`tenant_id` bigint(20) NOT NULL COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '入/出库物料表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '入/出库物料表' ROW_FORMAT = DYNAMIC;

Loading…
Cancel
Save