feat(数据记录): 相关数据记录

This commit is contained in:
admin 2025-04-15 16:32:36 +08:00
parent 430590814c
commit d82b01f514
17 changed files with 222 additions and 45 deletions

View File

@ -46,6 +46,16 @@ public class AchievementsController extends BaseController {
return getDataTable(list);
}
/**
* 查询成果列表
*/
@GetMapping("/frontList")
public TableDataInfo frontList(Achievements achievements) {
startPage();
List<Achievements> list = achievementsService.selectAchievementsFrontList(achievements);
return getDataTable(list);
}
/**
* 导出成果列表
*/

View File

@ -62,4 +62,6 @@ public interface IAchievementsService
public int deleteAchievementsById(Long id);
void buildFileInfoByIdents(String img, String att, Map<String, Object> map);
List<Achievements> selectAchievementsFrontList(Achievements achievements);
}

View File

@ -52,6 +52,17 @@ public class AchievementsServiceImpl implements IAchievementsService {
return list;
}
@Override
public List<Achievements> selectAchievementsFrontList(Achievements achievements) {
List<Achievements> list = achievementsMapper.selectAchievementsList(achievements);
for (Achievements a : list) {
a.setDetails(null);
buildFileInfoByIdents(a.getImages(), a.getAttachments(), a.getParams());
}
return list;
}
/**
* 新增成果
*

View File

@ -0,0 +1,5 @@
package com.microservices.dms.constant;
public class DmsConstants {
}

View File

@ -18,4 +18,8 @@ public class TaskConstant {
public static final String MARKER_SPACE_DOWNLOAD_API_BY_NAME = "%s/busiAttachments/downloadAttachment/%s";
public static final String MARKER_SPACE_DOWNLOAD_API_BY_ID = "%s/busiAttachments/download/%s";
//favorites
public static final String EXPERTS = "Experts";
public static final String ACHIEVEMENTS = "Achievements";
}

View File

@ -2,9 +2,7 @@ package com.microservices.dms.resourceLibrary.controller;
import com.microservices.common.core.web.domain.AjaxResult;
import com.microservices.dms.resourceLibrary.domain.Clicker;
import com.microservices.dms.resourceLibrary.domain.Downloader;
import com.microservices.dms.resourceLibrary.domain.Searcher;
import com.microservices.dms.resourceLibrary.domain.*;
import com.microservices.dms.resourceLibrary.service.TaskResourceLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -25,7 +23,7 @@ public class CollectUserActDataController {
@PostMapping("/addClicker")
@ApiImplicitParams({
@ApiImplicitParam(name = "clickType", value = "点击类型(任务makerSpaceTask、竞赛CompetitionInfo、项目Project)", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "clickType", value = "点击类型(任务makerSpaceTask、竞赛CompetitionInfo、项目Project、成果Achievements、专家Experts)", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "clickId", value = "点击对象ID", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "extInfo", value = "补充信息", paramType = "query", dataTypeClass = String.class)
@ -38,7 +36,7 @@ public class CollectUserActDataController {
@PostMapping("/addDownloader")
@ApiOperation(value = "记录下载次数")
@ApiImplicitParams({
@ApiImplicitParam(name = "downloadType", value = "下载类型(任务makerSpaceTask、竞赛作品CompetitionOpusDownload)", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "downloadType", value = "下载类型(任务makerSpaceTask、竞赛作品CompetitionOpusDownload、成果Achievements、专家Experts)", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "downloadId", value = "下载对象ID", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "extInfo", value = "补充信息", paramType = "query", dataTypeClass = String.class)
@ -58,4 +56,28 @@ public class CollectUserActDataController {
public AjaxResult addSearcher(Searcher searcher) {
return AjaxResult.success(taskResourceLibraryService.addSearcher(searcher));
}
@PostMapping("/addFavorite")
@ApiOperation(value = "记录搜索次数")
@ApiImplicitParams({
@ApiImplicitParam(name = "favoriteType", value = "收藏类型(成果Achievements、专家Experts)", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "favoriteId", value = "对象ID", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "extInfo", value = "补充信息", paramType = "query", dataTypeClass = String.class)
})
public AjaxResult addFavorite(Favorite favorite) {
return AjaxResult.success(taskResourceLibraryService.addFavorite(favorite));
}
@PostMapping("/addWatcher")
@ApiOperation(value = "记录搜索次数")
@ApiImplicitParams({
@ApiImplicitParam(name = "favoriteType", value = "关注类型(成果Achievements、专家Experts)", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "favoriteId", value = "对象ID", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "extInfo", value = "补充信息", paramType = "query", dataTypeClass = String.class)
})
public AjaxResult addFavorite(Watcher watcher) {
return AjaxResult.success(taskResourceLibraryService.addWatcher(watcher));
}
}

View File

@ -105,9 +105,9 @@ public class CompetitionResourceLibraryController extends BaseController {
*/
@ApiOperation(value = "返回开放竞赛总数")
@GetMapping(value = "/getTotalOpenCompetitions")
public long getTotalOpenCompetitions() {
public AjaxResult getTotalOpenCompetitions() {
// 这里替换成你的实际逻辑例如从数据库查询
return competitionResourceLibraryService.getTotalOpenCompetitions();
return AjaxResult.success(competitionResourceLibraryService.getTotalOpenCompetitions());
}
/**
@ -117,9 +117,9 @@ public class CompetitionResourceLibraryController extends BaseController {
*/
@ApiOperation(value = "返回竞赛转换成果数")
@GetMapping(value = "/getTotalCompetitionAchievements")
public long getTotalCompetitionAchievements() {
public AjaxResult getTotalCompetitionAchievements() {
// 这里替换成你的实际逻辑
return competitionResourceLibraryService.getTotalCompetitionAchievements();
return AjaxResult.success(competitionResourceLibraryService.getTotalCompetitionAchievements());
}
/**
@ -129,9 +129,9 @@ public class CompetitionResourceLibraryController extends BaseController {
*/
@ApiOperation(value = "返回竞赛提交作品数")
@GetMapping(value = "/getTotalCompetitionSubmissions")
public long getTotalCompetitionSubmissions() {
public AjaxResult getTotalCompetitionSubmissions() {
// 这里替换成你的实际逻辑
return competitionResourceLibraryService.getTotalCompetitionSubmissions();
return AjaxResult.success(competitionResourceLibraryService.getTotalCompetitionSubmissions());
}
/**
@ -141,9 +141,9 @@ public class CompetitionResourceLibraryController extends BaseController {
*/
@ApiOperation(value = "返回已结束竞赛数")
@GetMapping(value = "/getTotalFinishedCompetitions")
public long getTotalFinishedCompetitions() {
public AjaxResult getTotalFinishedCompetitions() {
// 这里替换成你的实际逻辑
return competitionResourceLibraryService.getTotalFinishedCompetitions();
return AjaxResult.success(competitionResourceLibraryService.getTotalFinishedCompetitions());
}
/**
@ -153,8 +153,8 @@ public class CompetitionResourceLibraryController extends BaseController {
*/
@ApiOperation(value = "需评审竞赛数")
@GetMapping(value = "/getReviewCompetitionCount")
public long getReviewCompetitionCount() {
public AjaxResult getReviewCompetitionCount() {
// 这里替换成你的实际逻辑
return competitionResourceLibraryService.getReviewCompetitionCount();
return AjaxResult.success(competitionResourceLibraryService.getReviewCompetitionCount());
}
}

View File

@ -8,6 +8,7 @@ import com.microservices.common.log.annotation.Log;
import com.microservices.common.log.enums.BusinessType;
import com.microservices.dms.resourceLibrary.domain.ExpertResourceLibrary;
import com.microservices.dms.resourceLibrary.service.IExpertResourceLibraryService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -20,8 +21,9 @@ import java.util.List;
* @author microservices
* @date 2025-04-11
*/
@Api(tags = "数据管理体系-优质专家库")
@RestController
@RequestMapping("/library")
@RequestMapping("/expertResourceLibrary")
public class ExpertResourceLibraryController extends BaseController
{
@Autowired

View File

@ -92,7 +92,6 @@ public class ProjectResourceLibraryController extends BaseController {
@ApiImplicitParam(name = "itemType", value = "类型(Project)", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "itemId", value = "对象ID", paramType = "query", dataTypeClass = Integer.class),
})
public GenericsTableDataInfo<UserActionDataVo> selectPraisesCondition(UserActionDataVo taskJournals) {
PageUtils.startPage();
List<UserActionDataVo> userActionDataVos = projectResourceLibraryService.selectPraisesCondition(taskJournals);

View File

@ -0,0 +1,19 @@
package com.microservices.dms.resourceLibrary.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class Favorite {
private Long id;
private String favoriteType;
private Long favoriteId;
private Long userId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "")
private Date createdAt;
private String extInfo;
}

View File

@ -0,0 +1,19 @@
package com.microservices.dms.resourceLibrary.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class Watcher {
private Long id;
private String watchableType;
private Long watchableId;
private Long userId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "")
private Date createdAt;
private String extInfo;
}

View File

@ -1,10 +1,7 @@
package com.microservices.dms.resourceLibrary.mapper;
import com.microservices.common.datasource.annotation.Slave;
import com.microservices.dms.resourceLibrary.domain.Clicker;
import com.microservices.dms.resourceLibrary.domain.Downloader;
import com.microservices.dms.resourceLibrary.domain.Searcher;
import com.microservices.dms.resourceLibrary.domain.TaskResourceLibrary;
import com.microservices.dms.resourceLibrary.domain.*;
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
import com.microservices.dms.resourceLibrary.domain.vo.TaskListVo;
import com.microservices.dms.resourceLibrary.domain.vo.UserActionDataVo;
@ -102,4 +99,8 @@ public interface TaskResourceLibraryMapper {
* @return 需评审任务数
*/
long getReviewTaskCount();
int insertFavorite(Favorite favorite);
int insertWatcher(Watcher watcher);
}

View File

@ -104,7 +104,7 @@ public class TaskResourceLibraryService {
for (TaskResourceLibrary l : list) {
List<KeyValVo<String, String>> attachments = taskResourceLibraryMapper.getAttachments(l.getPaperId());
for (KeyValVo<String, String> a : attachments) {
String v = a.getV();
Object v = a.getV();
a.setV(String.format(MARKER_SPACE_DOWNLOAD_API_BY_ID, markerSpaceUrl, v));
}
l.setAttachmentList(attachments);
@ -138,7 +138,7 @@ public class TaskResourceLibraryService {
*
* @return 任务总数
*/
public long getTotalTasks() {
public Long getTotalTasks() {
return taskResourceLibraryMapper.getTotalTasks();
}
@ -147,7 +147,7 @@ public class TaskResourceLibraryService {
*
* @return 转换成果任务金额
*/
public double getConvertedTaskAmount() {
public Double getConvertedTaskAmount() {
return taskResourceLibraryMapper.getConvertedTaskAmount();
}
@ -156,7 +156,7 @@ public class TaskResourceLibraryService {
*
* @return 任务转换成果数
*/
public long getConvertedTasksCount() {
public Long getConvertedTasksCount() {
return taskResourceLibraryMapper.getConvertedTasksCount();
}
@ -165,13 +165,22 @@ public class TaskResourceLibraryService {
*
* @return 任务金额
*/
public long getTaskAmount() {
public Long getTaskAmount() {
return taskResourceLibraryMapper.getTaskAmount();
}
public long getReviewTaskCount() {
public Long getReviewTaskCount() {
return taskResourceLibraryMapper.getReviewTaskCount();
}
public int addFavorite(Favorite favorite) {
favorite.setCreatedAt(DateUtils.getNowDate());
return taskResourceLibraryMapper.insertFavorite(favorite);
}
public int addWatcher(Watcher watcher) {
watcher.setCreatedAt(DateUtils.getNowDate());
return taskResourceLibraryMapper.insertWatcher(watcher);
}
}

View File

@ -1,5 +0,0 @@
package com.microservices.dms.utils;
public class DmsConstants {
}

View File

@ -122,7 +122,7 @@
<select id="selectCompetitionResourceLibraryList" parameterType="CompetitionResourceLibrary"
resultType="com.microservices.dms.resourceLibrary.domain.CompetitionResourceLibrary">
select cul.id,
select crl.id,
ci.id as open_competition_id,
ci.title as open_competition_name,
cu.id as competition_user_id,
@ -133,8 +133,8 @@
cu.leader as submitter,
submission_type,
cu.org_name as submitting_unit,
cu. submission_summary,
submission_details,
cu.sub_item as submission_summary,
cu.sub_item as submission_details,
cu.leader as contact_person,
cu.phone as contact_phone,
is_transferred_to_result_library,

View File

@ -166,8 +166,8 @@
p.is_public as is_public,
v.name as release_name,
v.created_at as release_date,
(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,
(select login from users where id=v.user_id) as release_person,
p.project_category_id as project_domain,
pl.release_type,
pl.release_unit,
p.description as release_summary,

View File

@ -120,6 +120,84 @@
</trim>
</insert>
<insert id="insertFavorite" useGeneratedKeys="true" keyColumn="id" keyProperty="id"
parameterType="com.microservices.dms.resourceLibrary.domain.Favorite">
INSERT INTO favorites
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != favoriteType and '' != favoriteType">
favorite_type,
</if>
<if test="null != favoriteId ">
favorite_id,
</if>
<if test="null != userId ">
user_id,
</if>
<if test="null != createdAt ">
created_at,
</if>
<if test="null != extInfo and '' != extInfo">
ext_info
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != downloadType and '' != downloadType">
#{downloadType},
</if>
<if test="null != downloadId ">
#{downloadId},
</if>
<if test="null != userId ">
#{userId},
</if>
<if test="null != createdAt ">
#{createdAt},
</if>
<if test="null != extInfo and '' != extInfo">
#{extInfo}
</if>
</trim>
</insert>
<insert id="insertWatcher" useGeneratedKeys="true" keyColumn="id" keyProperty="id"
parameterType="com.microservices.dms.resourceLibrary.domain.Favorite">
INSERT INTO watchers
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != watchableType and '' != watchableType">
watchable_type,
</if>
<if test="null != watchableId ">
watchable_id,
</if>
<if test="null != userId ">
user_id,
</if>
<if test="null != createdAt ">
created_at,
</if>
<if test="null != extInfo and '' != extInfo">
ext_info
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != downloadType and '' != downloadType">
#{downloadType},
</if>
<if test="null != downloadId ">
#{downloadId},
</if>
<if test="null != userId ">
#{userId},
</if>
<if test="null != createdAt ">
#{createdAt},
</if>
<if test="null != extInfo and '' != extInfo">
#{extInfo}
</if>
</trim>
</insert>
<select id="selectClickerCondition" resultType="com.microservices.dms.resourceLibrary.domain.vo.UserActionDataVo">
select click_type as itemType, click_id as itemId, user_id as userId, created_at as createAt,
(select login from users where id = user_id) as userName from clickers
@ -344,10 +422,10 @@
<select id="selectTaskResourceLibraryList" parameterType="TaskResourceLibrary"
resultType="com.microservices.dms.resourceLibrary.domain.TaskResourceLibrary">
select ts.id,
t.task_id,
p.paper_id,
t.id as task_id,
pd.paper_id as paper_id,
t.name as task_name,
(select pc.name from project_categories pc where pc.id = t.category_id) as task_domain,
t.category_id as task_domain,
t.bounty as task_amount,
(select IFNULL(u.lastname,u.login) from users u where u.id = p.user_id) as submission_name,
p.created_at as submission_date,
@ -413,18 +491,19 @@
<select id="getAttachments" resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
select b.file_name as k, b.id as v
from paper_details pd join busi_attachments b on pd.files = b.id
from paper_details pd
join busi_attachments b on pd.files = b.id
where pd.paper_id = #{id}
</select>
<select id="getTotalTasks" resultType="java.lang.Long">
select count(*)
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
</select>
<select id="getConvertedTaskAmount" resultType="java.lang.Double">
select sum(t.bounty)
select IFNULL(sum(t.bounty), 0)
from tasks t
join (select * from papers where status = 2) p on t.id = p.task_id
join task_resource_library on t.id = task_resource_library.task_id
@ -440,9 +519,9 @@
</select>
<select id="getTaskAmount" resultType="java.lang.Long">
select sum(t.bounty)
select IFNULL(sum(t.bounty), 0)
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
</select>
<select id="getReviewTaskCount" resultType="java.lang.Long">