feat(竞赛): 竞赛资源库逻辑
This commit is contained in:
parent
553198b554
commit
58dfa24f9c
|
@ -1,7 +1,10 @@
|
||||||
package com.microservices.dms.achievementLibrary.domain;
|
package com.microservices.dms.achievementLibrary.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
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.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.microservices.common.core.annotation.Excel;
|
import com.microservices.common.core.annotation.Excel;
|
||||||
|
@ -117,7 +120,17 @@ public class Achievements extends BaseEntity
|
||||||
@Excel(name = "成果附件")
|
@Excel(name = "成果附件")
|
||||||
private String attachments;
|
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;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.microservices.dms.achievementLibrary.service.impl;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
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.DateUtils;
|
||||||
import com.microservices.common.core.utils.StringUtils;
|
import com.microservices.common.core.utils.StringUtils;
|
||||||
import com.microservices.common.security.utils.SecurityUtils;
|
import com.microservices.common.security.utils.SecurityUtils;
|
||||||
|
@ -100,17 +102,17 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildFileInfoByIdents(String img, String att, Map<String, Object> map) {
|
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> imgs = Arrays.stream(Optional.ofNullable(img).orElse("").split(",")).collect(Collectors.toSet());
|
||||||
Set<String> atts = Arrays.stream(Optional.ofNullable(img).orElse("").split(",")).collect(Collectors.toSet());
|
imgs = imgs.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toSet());
|
||||||
atts.addAll(imgs);
|
HashMap<String,String> imgMap = new HashMap<>();
|
||||||
atts = atts.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toSet());
|
if (!CollectionUtils.isEmpty(imgs)) {
|
||||||
if (CollectionUtils.isEmpty(atts)) {
|
Optional.ofNullable(achievementsMapper.getFileInfoByIdents(imgs)).orElse(new ArrayList<>()).forEach(s -> {
|
||||||
return;
|
imgMap.put(s.get("k"), s.get("v"));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
map.put("img", imgMap);
|
||||||
Optional.ofNullable(achievementsMapper.getFileInfoByIdents(atts)).orElse(new ArrayList<>()).forEach(s -> {
|
String a = Optional.ofNullable(img).orElse("[]");
|
||||||
map.put(s.get("k"), s.get("v"));
|
JSONArray ao = JSONArray.parseArray(a);
|
||||||
});
|
map.put("att", ao);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,4 +145,16 @@ public class CompetitionResourceLibraryController extends BaseController {
|
||||||
// 这里替换成你的实际逻辑
|
// 这里替换成你的实际逻辑
|
||||||
return competitionResourceLibraryService.getTotalFinishedCompetitions();
|
return competitionResourceLibraryService.getTotalFinishedCompetitions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回需评审竞赛数
|
||||||
|
*
|
||||||
|
* @return 需评审竞赛数
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "需评审竞赛数")
|
||||||
|
@GetMapping(value = "/getReviewCompetitionCount")
|
||||||
|
public long getReviewCompetitionCount() {
|
||||||
|
// 这里替换成你的实际逻辑
|
||||||
|
return competitionResourceLibraryService.getReviewCompetitionCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,6 +177,12 @@ public class TaskResourceLibraryController extends BaseController {
|
||||||
@GetMapping(value = "/getTaskAmount")
|
@GetMapping(value = "/getTaskAmount")
|
||||||
@ApiOperation(value = "获取任务金额")
|
@ApiOperation(value = "获取任务金额")
|
||||||
public AjaxResult getTaskAmount() {
|
public AjaxResult getTaskAmount() {
|
||||||
return success(taskResourceLibraryService.getTotalTasks());
|
return success(taskResourceLibraryService.getTaskAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/getReviewTaskCount")
|
||||||
|
@ApiOperation(value = "需评审任务数")
|
||||||
|
public AjaxResult getReviewTaskCount() {
|
||||||
|
return success(taskResourceLibraryService.getReviewTaskCount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,20 @@ public class CompetitionResourceLibrary extends BaseEntity {
|
||||||
|
|
||||||
private String image;
|
private String image;
|
||||||
|
|
||||||
|
private Integer isExpertAudit;
|
||||||
|
|
||||||
private String attachment;
|
private String attachment;
|
||||||
|
|
||||||
private List<KeyValVo<String, String>> attachmentList = new ArrayList<>();
|
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() {
|
public List<KeyValVo<String, String>> getAttachmentList() {
|
||||||
return attachmentList;
|
return attachmentList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class ProjectResourceLibrary extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private Long id;
|
private Long id;
|
||||||
private String projectName;
|
private String projectName;
|
||||||
|
private String projectDomain;
|
||||||
private String identifier;
|
private String identifier;
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
private Long repositoryId;
|
private Long repositoryId;
|
||||||
|
@ -41,6 +42,14 @@ public class ProjectResourceLibrary extends BaseEntity {
|
||||||
private String attachments;
|
private String attachments;
|
||||||
private List<KeyValVo<String, String>> attachmentList = new ArrayList<>();
|
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() {
|
public List<KeyValVo<String, String>> getAttachmentList() {
|
||||||
return attachmentList;
|
return attachmentList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,15 @@ public class TaskResourceLibrary extends BaseEntity {
|
||||||
private String imageUrl;
|
private String imageUrl;
|
||||||
private String attachmentUrl;
|
private String attachmentUrl;
|
||||||
private List<KeyValVo<String, String>> attachmentList;
|
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() {
|
public List<KeyValVo<String, String>> getAttachmentList() {
|
||||||
return attachmentList;
|
return attachmentList;
|
||||||
|
|
|
@ -45,4 +45,6 @@ public interface CompetitionResourceLibraryMapper {
|
||||||
long getTotalCompetitionSubmissions();
|
long getTotalCompetitionSubmissions();
|
||||||
|
|
||||||
long getTotalFinishedCompetitions();
|
long getTotalFinishedCompetitions();
|
||||||
|
|
||||||
|
long getReviewCompetitionCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,4 +95,11 @@ public interface TaskResourceLibraryMapper {
|
||||||
* @return 任务金额
|
* @return 任务金额
|
||||||
*/
|
*/
|
||||||
long getTaskAmount();
|
long getTaskAmount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取需评审任务数
|
||||||
|
*
|
||||||
|
* @return 需评审任务数
|
||||||
|
*/
|
||||||
|
long getReviewTaskCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,4 +134,14 @@ public class CompetitionResourceLibraryService {
|
||||||
// 这里替换成你的实际逻辑
|
// 这里替换成你的实际逻辑
|
||||||
return competitionResourceLibraryMapper.getTotalFinishedCompetitions();
|
return competitionResourceLibraryMapper.getTotalFinishedCompetitions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回需评审竞赛数
|
||||||
|
*
|
||||||
|
* @return 需评审竞赛数
|
||||||
|
*/
|
||||||
|
public long getReviewCompetitionCount() {
|
||||||
|
// 这里替换成你的实际逻辑
|
||||||
|
return competitionResourceLibraryMapper.getReviewCompetitionCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,8 +165,13 @@ public class TaskResourceLibraryService {
|
||||||
*
|
*
|
||||||
* @return 任务金额
|
* @return 任务金额
|
||||||
*/
|
*/
|
||||||
long getTaskAmount() {
|
public long getTaskAmount() {
|
||||||
return taskResourceLibraryMapper.getTaskAmount();
|
return taskResourceLibraryMapper.getTaskAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getReviewTaskCount() {
|
||||||
|
return taskResourceLibraryMapper.getReviewTaskCount();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,8 @@
|
||||||
create_by,
|
create_by,
|
||||||
create_time,
|
create_time,
|
||||||
update_by,
|
update_by,
|
||||||
update_time
|
update_time,
|
||||||
|
ci.is_expert_audit
|
||||||
from competition_infos ci
|
from competition_infos ci
|
||||||
join (select * from competition_users where `status` = 3) cu on ci.id = cu.competition_info_id
|
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
|
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
|
join (select * from competition_users where `status` = 3) cu on ci.id = cu.competition_info_id
|
||||||
where ci.upload_date < now()
|
where ci.upload_date < now()
|
||||||
</select>
|
</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"
|
<insert id="insertCompetitionResourceLibrary" parameterType="CompetitionResourceLibrary" useGeneratedKeys="true"
|
||||||
keyProperty="id">
|
keyProperty="id">
|
||||||
|
|
|
@ -163,11 +163,12 @@
|
||||||
p.id as project_id,
|
p.id as project_id,
|
||||||
r.id as repository_id,
|
r.id as repository_id,
|
||||||
v.id as version_releases_id,
|
v.id as version_releases_id,
|
||||||
pl.is_public,
|
p.is_public as is_public,
|
||||||
v.name as release_name,
|
v.name as release_name,
|
||||||
v.created_at as release_date,
|
v.created_at as release_date,
|
||||||
v.user_id as release_person,
|
(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 release_type,
|
(select name from project_categories s where s.id =p.project_category_id limit 1) as project_domain,
|
||||||
|
pl.release_type,
|
||||||
pl.release_unit,
|
pl.release_unit,
|
||||||
p.description as release_summary,
|
p.description as release_summary,
|
||||||
p.description as release_details,
|
p.description as release_details,
|
||||||
|
|
|
@ -362,7 +362,12 @@
|
||||||
transfer_to_results_date,
|
transfer_to_results_date,
|
||||||
is_selected_result,
|
is_selected_result,
|
||||||
image_url,
|
image_url,
|
||||||
attachment_url
|
attachment_url,
|
||||||
|
t.expert_review,
|
||||||
|
create_by,
|
||||||
|
create_time,
|
||||||
|
update_by,
|
||||||
|
update_time
|
||||||
from tasks t
|
from tasks t
|
||||||
join (select * from papers where status = 2) p on t.id = p.task_id
|
join (select * from papers where status = 2) p on t.id = p.task_id
|
||||||
join paper_details pd on p.id = pd.paper_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
|
join (select * from papers where status = 2) p on t.id = p.task_id
|
||||||
</select>
|
</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 id="insertTaskResourceLibrary" parameterType="TaskResourceLibrary" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into task_resource_library
|
insert into task_resource_library
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
Loading…
Reference in New Issue