Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Commit 481140b

Browse files
committed
feat: admin export work and cominfo
1 parent 8236a43 commit 481140b

23 files changed

Lines changed: 275 additions & 124 deletions

.mvn/wrapper/MavenWrapperDownloader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public static void main(String args[]) {
8989
System.exit(0);
9090
} catch (Throwable e) {
9191
System.out.println("- Error downloading");
92-
e.printStackTrace();
92+
9393
System.exit(1);
9494
}
9595
}

approval-common/src/main/java/fun/sast/enums/ErrorEnum.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ public enum ErrorEnum {
1919
HAVE_NOT_SIGNED_COM(2003, "您还未报名该比赛"),
2020
HAVE_NOT_UPLOAD_WORK(2004, "您还未上传作品"),
2121
INVALID_FILE_TYPE_ERROR(3001, "文件类型不合法"),
22-
OSS_FAILED_UPLOAD_ERROR(3002, "文件上传至存储服务器时出错"),
23-
OSS_FAILED_DOWNLOAD_ERROR(3003, "文件下载至服务器时出错"),
24-
OSS_FAILED_DELETE_ERROR(3004, "删除存储服务器上的文件时出错"),
25-
OSS_BUCKET_NOT_EXIST(3005, "Bucket不存在"),
26-
OSS_FILE_NOT_EXIST(3006, "文件不存在"),
22+
COS_FAILED_UPLOAD_ERROR(3002, "文件上传至存储服务器时出错"),
23+
COS_FAILED_DOWNLOAD_ERROR(3003, "文件下载至服务器时出错"),
24+
COS_FAILED_DELETE_ERROR(3004, "删除存储服务器上的文件时出错"),
25+
COS_BUCKET_NOT_EXIST(3005, "Bucket不存在"),
26+
COS_FILE_NOT_EXIST(3006, "文件不存在"),
2727
INVALID_URL_ERROR(3007, "URL格式不合法"),
2828
TOO_MANY_REQUESTS(3008, "请求过于频繁"),
2929
FILE_DOWNLOAD_ERROR(3009, "文件下载失败"),
@@ -38,8 +38,11 @@ public enum ErrorEnum {
3838
SCHEMA_ERROR(6007, "表单未设置"),
3939
WORK_NOT_EXIST(6008, "作品不存在"),
4040
ASSIGN_ERROR(6009, "无法分配评委,存在未审批或审批未通过的作品"),
41+
WORK_NOT_UNIQUE(6010, "同一队长提交多个作品"),
4142
USER_NOT_EXIST(7001, "用户不存在"),
4243
USER_EXIST(7002, "用户已存在"),
44+
TEAM_NOT_EXIST(7003, "队伍不存在"),
45+
CAPTAIN_NOT_EXIST(7004, "队长不存在"),
4346
FILE_NOT_EXIST(8001, "文件不存在"),
4447
FILE_EXPIRED_ERROR(8002, "文件已过期,请重新提交"),
4548
NOTICE_ERROR(9001, "公告操作失败"),

approval-common/src/main/java/fun/sast/utils/COSUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public Map<String, String> getUploadCertificateCOS(String objectName, int folder
9494
*/
9595
public String getDownloadCertificate(String url) {
9696
if (!StringUtils.hasText(url) || !StringUtils.hasText(bucketUrlPrefix)) {
97-
throw new BaseException(ErrorEnum.OSS_BUCKET_NOT_EXIST);
97+
throw new BaseException(ErrorEnum.COS_BUCKET_NOT_EXIST);
9898
}
9999

100100
String key = extractObjectKey(url);

approval-common/src/main/java/fun/sast/utils/FileUtil.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void deleteFileCOS(String url, int folderNumber) {
7474
* @return 上传文件的凭证
7575
*/
7676
public Map<String, String> getUploadCertificate(
77-
String filename, Long comId, Long id, String input) {
77+
String filename, Integer comId, Long id, String input) {
7878
String typeName = CommonUtil.getTypeByFilename(filename);
7979
if (!CommonUtil.isAllowUploadType(typeName)) {
8080
throw new BaseException(ErrorEnum.INVALID_FILE_TYPE_ERROR);
@@ -122,14 +122,14 @@ public void downloadPackFile(
122122

123123
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
124124
for (Map<String, String> fileInfo : fileIntoList) {
125-
String ossUrl = fileInfo.get("ossUrl");
125+
String cosUrl = fileInfo.get("cosUrl");
126126
String fileName = fileInfo.get("fileName");
127-
if (!StringUtils.hasText(ossUrl) || !StringUtils.hasText(fileName)) {
127+
if (!StringUtils.hasText(cosUrl) || !StringUtils.hasText(fileName)) {
128128
log.warn("文件信息不完整,跳过该文件");
129129
continue;
130130
}
131-
// 生成OSS临时授权链接
132-
String authorizedUrl = cosUtil.getDownloadCertificate(ossUrl);
131+
// 生成COS临时授权链接
132+
String authorizedUrl = cosUtil.getDownloadCertificate(cosUrl);
133133
// 从授权链接下载文件流
134134
try (InputStream fileIn = getInputStreamFromUrl(authorizedUrl)) {
135135
if (fileIn == null) {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package fun.sast.dto;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import lombok.Data;
5+
6+
@Data
7+
public class FileResponseDTO {
8+
private Integer id; // 文件id
9+
10+
@JsonProperty("com_id")
11+
private Integer comId; // 比赛id
12+
13+
@JsonProperty("user_id")
14+
private Integer userId; // 队长id(通过user_code查询得到)
15+
16+
@JsonProperty("name")
17+
private String input; // 文件名(映射实体类的input字段)
18+
19+
private String url; // 文件地址
20+
}

approval-pojo/src/main/java/fun/sast/entity/File.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
import com.baomidou.mybatisplus.annotation.IdType;
44
import com.baomidou.mybatisplus.annotation.TableField;
55
import com.baomidou.mybatisplus.annotation.TableId;
6+
import com.fasterxml.jackson.annotation.JsonProperty;
67
import java.io.Serializable;
78
import java.time.LocalDateTime;
8-
9-
import com.fasterxml.jackson.annotation.JsonProperty;
109
import lombok.AllArgsConstructor;
1110
import lombok.Data;
1211
import lombok.NoArgsConstructor;
@@ -21,26 +20,29 @@ public class File implements Serializable {
2120
/** 比赛ID */
2221
@TableField("com_id")
2322
@JsonProperty("com_id")
24-
private Long comId;
23+
private Integer comId;
2524

2625
/** 队长学号 */
2726
@TableField("user_code")
2827
@JsonProperty("user_code")
2928
private String userCode;
3029

31-
/** 输入框名 */
30+
/** 输入框文件名 */
31+
@JsonProperty("name")
3232
private String input;
3333

34-
/** 作品地址 */
34+
/** 文件地址 */
3535
private String url;
3636

37+
@TableField("create_time")
38+
@JsonProperty("create_time")
3739
private LocalDateTime createTime; // 创建时间
3840

41+
@TableField("update_time")
42+
@JsonProperty("update_time")
3943
private LocalDateTime updateTime; // 更新时间
4044

4145
private Long createUser; // 创建用户ID
4246

4347
private Long updateUser; // 更新用户ID
44-
45-
4648
}

approval-pojo/src/main/java/fun/sast/entity/Judge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@AllArgsConstructor
1212
public class Judge implements Serializable {
1313
/** 活动id */
14-
private long comId;
14+
private Integer comId;
1515

1616
/** 评委id */
1717
private Integer id;

approval-pojo/src/main/java/fun/sast/entity/Score.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package fun.sast.entity;
22

3+
import com.baomidou.mybatisplus.annotation.TableField;
4+
import com.baomidou.mybatisplus.annotation.TableName;
35
import java.io.Serializable;
46
import java.time.LocalDateTime;
57
import lombok.AllArgsConstructor;
@@ -9,6 +11,7 @@
911
@Data
1012
@AllArgsConstructor
1113
@NoArgsConstructor
14+
@TableName("score")
1215
public class Score implements Serializable {
1316
/** 活动id编号 */
1417
private Integer comId;
@@ -19,6 +22,7 @@ public class Score implements Serializable {
1922
private Integer judgeId;
2023

2124
/** 评审意见 */
25+
@TableField(value = "t_option")
2226
private String option;
2327

2428
/** 打分 */

approval-pojo/src/main/java/fun/sast/entity/Team.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class Team implements Serializable {
1616

1717
/** 比赛ID */
1818
@TableField("com_id")
19-
private Long comId;
19+
private Integer comId;
2020

2121
/** 队伍名称(仅团队赛) */
2222
private String name;

approval-pojo/src/main/java/fun/sast/entity/WhiteList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class WhiteList {
1919
private Long id;
2020

2121
/** 比赛ID 关联competition表的id字段 */
22-
private Long comId;
22+
private Integer comId;
2323

2424
@TableField(typeHandler = JacksonTypeHandler.class)
2525
private List<String> userCodes;

0 commit comments

Comments
 (0)