feat(竞赛): 竞赛资源库逻辑

This commit is contained in:
liuhuazhong 2025-04-11 09:58:00 +08:00
parent 553198b554
commit 58dfa24f9c
14 changed files with 125 additions and 19 deletions

View File

@ -1,7 +1,10 @@
package com.microservices.dms.achievementLibrary.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.microservices.common.core.annotation.Excel;
@ -117,7 +120,17 @@ public class Achievements extends BaseEntity
@Excel(name = "成果附件")
private String attachments;
public void setId(Long id)
private List<KeyValVo> attachmentList;
public List<KeyValVo> getAttachmentList() {
return attachmentList;
}
public void setAttachmentList(List<KeyValVo> attachmentList) {
this.attachmentList = attachmentList;
}
public void setId(Long id)
{
this.id = id;
}

View File

@ -3,6 +3,8 @@ package com.microservices.dms.achievementLibrary.service.impl;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.microservices.common.core.utils.DateUtils;
import com.microservices.common.core.utils.StringUtils;
import com.microservices.common.security.utils.SecurityUtils;
@ -100,17 +102,17 @@ public class AchievementsServiceImpl implements IAchievementsService {
@Override
public void buildFileInfoByIdents(String img, String att, Map<String, Object> map) {
Set<String> imgs = Arrays.stream(Optional.ofNullable(att).orElse("").split(",")).collect(Collectors.toSet());
Set<String> atts = Arrays.stream(Optional.ofNullable(img).orElse("").split(",")).collect(Collectors.toSet());
atts.addAll(imgs);
atts = atts.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toSet());
if (CollectionUtils.isEmpty(atts)) {
return;
Set<String> imgs = Arrays.stream(Optional.ofNullable(img).orElse("").split(",")).collect(Collectors.toSet());
imgs = imgs.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toSet());
HashMap<String,String> imgMap = new HashMap<>();
if (!CollectionUtils.isEmpty(imgs)) {
Optional.ofNullable(achievementsMapper.getFileInfoByIdents(imgs)).orElse(new ArrayList<>()).forEach(s -> {
imgMap.put(s.get("k"), s.get("v"));
});
}
Optional.ofNullable(achievementsMapper.getFileInfoByIdents(atts)).orElse(new ArrayList<>()).forEach(s -> {
map.put(s.get("k"), s.get("v"));
});
map.put("img", imgMap);
String a = Optional.ofNullable(img).orElse("[]");
JSONArray ao = JSONArray.parseArray(a);
map.put("att", ao);
}
}

View File

@ -145,4 +145,16 @@ public class CompetitionResourceLibraryController extends BaseController {
// 这里替换成你的实际逻辑
return competitionResourceLibraryService.getTotalFinishedCompetitions();
}
/**
* 返回需评审竞赛数
*
* @return 需评审竞赛数
*/
@ApiOperation(value = "需评审竞赛数")
@GetMapping(value = "/getReviewCompetitionCount")
public long getReviewCompetitionCount() {
// 这里替换成你的实际逻辑
return competitionResourceLibraryService.getReviewCompetitionCount();
}
}

View File

@ -177,6 +177,12 @@ public class TaskResourceLibraryController extends BaseController {
@GetMapping(value = "/getTaskAmount")
@ApiOperation(value = "获取任务金额")
public AjaxResult getTaskAmount() {
return success(taskResourceLibraryService.getTotalTasks());
return success(taskResourceLibraryService.getTaskAmount());
}
@GetMapping(value = "/getReviewTaskCount")
@ApiOperation(value = "需评审任务数")
public AjaxResult getReviewTaskCount() {
return success(taskResourceLibraryService.getReviewTaskCount());
}
}

View File

@ -53,9 +53,20 @@ public class CompetitionResourceLibrary extends BaseEntity {
private String image;
private Integer isExpertAudit;
private String attachment;
private List<KeyValVo<String, String>> attachmentList = new ArrayList<>();
public Integer getIsExpertAudit() {
return isExpertAudit;
}
public void setIsExpertAudit(Integer isExpertAudit) {
this.isExpertAudit = isExpertAudit;
}
public List<KeyValVo<String, String>> getAttachmentList() {
return attachmentList;
}

View File

@ -18,6 +18,7 @@ public class ProjectResourceLibrary extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String projectName;
private String projectDomain;
private String identifier;
private Long projectId;
private Long repositoryId;
@ -41,6 +42,14 @@ public class ProjectResourceLibrary extends BaseEntity {
private String attachments;
private List<KeyValVo<String, String>> attachmentList = new ArrayList<>();
public String getProjectDomain() {
return projectDomain;
}
public void setProjectDomain(String projectDomain) {
this.projectDomain = projectDomain;
}
public List<KeyValVo<String, String>> getAttachmentList() {
return attachmentList;
}

View File

@ -47,6 +47,15 @@ public class TaskResourceLibrary extends BaseEntity {
private String imageUrl;
private String attachmentUrl;
private List<KeyValVo<String, String>> attachmentList;
private Integer expertReview;
public Integer getExpertReview() {
return expertReview;
}
public void setExpertReview(Integer expertReview) {
this.expertReview = expertReview;
}
public List<KeyValVo<String, String>> getAttachmentList() {
return attachmentList;

View File

@ -45,4 +45,6 @@ public interface CompetitionResourceLibraryMapper {
long getTotalCompetitionSubmissions();
long getTotalFinishedCompetitions();
long getReviewCompetitionCount();
}

View File

@ -95,4 +95,11 @@ public interface TaskResourceLibraryMapper {
* @return 任务金额
*/
long getTaskAmount();
/**
* 获取需评审任务数
*
* @return 需评审任务数
*/
long getReviewTaskCount();
}

View File

@ -134,4 +134,14 @@ public class CompetitionResourceLibraryService {
// 这里替换成你的实际逻辑
return competitionResourceLibraryMapper.getTotalFinishedCompetitions();
}
/**
* 返回需评审竞赛数
*
* @return 需评审竞赛数
*/
public long getReviewCompetitionCount() {
// 这里替换成你的实际逻辑
return competitionResourceLibraryMapper.getReviewCompetitionCount();
}
}

View File

@ -165,8 +165,13 @@ public class TaskResourceLibraryService {
*
* @return 任务金额
*/
long getTaskAmount() {
public long getTaskAmount() {
return taskResourceLibraryMapper.getTaskAmount();
}
public long getReviewTaskCount() {
return taskResourceLibraryMapper.getReviewTaskCount();
}
}

View File

@ -145,7 +145,8 @@
create_by,
create_time,
update_by,
update_time
update_time,
ci.is_expert_audit
from competition_infos ci
join (select * from competition_users where `status` = 3) cu on ci.id = cu.competition_info_id
left join competition_resource_library crl on crl.competition_user_id = cu.id
@ -223,6 +224,12 @@
join (select * from competition_users where `status` = 3) cu on ci.id = cu.competition_info_id
where ci.upload_date &lt; now()
</select>
<select id="getReviewCompetitionCount" resultType="java.lang.Long">
select count(distinct ci.id)
from competition_infos ci
join (select * from competition_users where `status` = 3) cu on ci.id = cu.competition_info_id
where ci.is_expert_audit = 1
</select>
<insert id="insertCompetitionResourceLibrary" parameterType="CompetitionResourceLibrary" useGeneratedKeys="true"
keyProperty="id">

View File

@ -163,11 +163,12 @@
p.id as project_id,
r.id as repository_id,
v.id as version_releases_id,
pl.is_public,
p.is_public as is_public,
v.name as release_name,
v.created_at as release_date,
v.user_id as release_person,
(select name from project_categories s where s.id =p.project_category_id limit 1) as release_type,
(select login from uers where id=v.user_id) as release_person,
(select name from project_categories s where s.id =p.project_category_id limit 1) as project_domain,
pl.release_type,
pl.release_unit,
p.description as release_summary,
p.description as release_details,

View File

@ -362,7 +362,12 @@
transfer_to_results_date,
is_selected_result,
image_url,
attachment_url
attachment_url,
t.expert_review,
create_by,
create_time,
update_by,
update_time
from tasks t
join (select * from papers where status = 2) p on t.id = p.task_id
join paper_details pd on p.id = pd.paper_id
@ -440,6 +445,13 @@
join (select * from papers where status = 2) p on t.id = p.task_id
</select>
<select id="getReviewTaskCount" resultType="java.lang.Long">
select count(*)
from tasks t
join (select * from papers where status = 2) p on t.id = p.task_id
where expert_review = 1
</select>
<insert id="insertTaskResourceLibrary" parameterType="TaskResourceLibrary" useGeneratedKeys="true" keyProperty="id">
insert into task_resource_library
<trim prefix="(" suffix=")" suffixOverrides=",">