七日新增统计

This commit is contained in:
admin 2025-04-17 15:55:33 +08:00
parent de02ce787a
commit ad1b5ca8c4
7 changed files with 139 additions and 17 deletions

View File

@ -152,7 +152,32 @@ public class AchievementsController extends BaseController {
@ApiOperation("七日新增")
@GetMapping("/get7DayAdd")
public AjaxResult getA(@RequestBody AchQueryVo achQueryVo) {
public AjaxResult get7DayAdd(@RequestBody AchQueryVo achQueryVo) {
return success(achievementsService.get7DayAdd(achQueryVo));
}
@ApiOperation("首页项目统计")
@GetMapping("/indexProjectStatistic")
public AjaxResult indexProjectStatistic() {
return success(achievementsService.indexProjectStatistic());
}
@ApiOperation("首页task统计")
@GetMapping("/indexTaskStatistic")
public AjaxResult indexTaskStatistic() {
return success(achievementsService.indexTaskStatistic());
}
@ApiOperation("首页Competition统计")
@GetMapping("/indexCompetitionStatistic")
public AjaxResult indexCompetitionStatistic() {
return success(achievementsService.indexCompetitionStatistic());
}
@ApiOperation("首页SchoolEnterprise统计")
@GetMapping("/indexSchoolEnterpriseStatistic")
public AjaxResult indexSchoolEnterpriseStatistic() {
return success(achievementsService.indexSchoolEnterpriseStatistic());
}
}

View File

@ -93,4 +93,12 @@ public interface AchievementsMapper {
List<KeyValVo<String, Long>> getAchievement(@Param("s") Date s, @Param("e") Date e, @Param("t") String source);
List<KeyValueVo> getHotAchievement();
Map<String, Long> indexProjectStatistic();
Map<String, Object> indexTaskStatistic();
Map<String, Long> indexCompetitionStatistic();
Long indexSchoolEnterpriseStatistic(@Param("s") String s, @Param("t") String tags);
}

View File

@ -80,4 +80,12 @@ public interface IAchievementsService {
List<KeyValueVo> getHotAchievement();
List<KeyValVo<String, Long>> get7DayAdd(AchQueryVo achQueryVo);
Map<String,Long> indexProjectStatistic();
Map<String,Object> indexTaskStatistic();
Map<String,Long> indexCompetitionStatistic();
Map<String,Long> indexSchoolEnterpriseStatistic();
}

View File

@ -10,6 +10,8 @@ import com.microservices.common.core.utils.StringUtils;
import com.microservices.common.security.utils.SecurityUtils;
import com.microservices.dms.achievementLibrary.domain.AchQueryVo;
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
import com.microservices.dms.achievementLibrary.service.ISchoolEnterpriseAchievementsService;
import com.microservices.dms.resourceLibrary.domain.Clicker;
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
import com.microservices.dms.resourceLibrary.mapper.TaskResourceLibraryMapper;
import com.microservices.dms.utils.DateUtil;
@ -35,6 +37,9 @@ public class AchievementsServiceImpl implements IAchievementsService {
@Autowired
private TaskResourceLibraryMapper taskResourceLibraryMapper;
private ISchoolEnterpriseAchievementsService schoolEnterpriseAchievementsService;
/**
* 查询成果
*
@ -122,18 +127,18 @@ public class AchievementsServiceImpl implements IAchievementsService {
@Override
public void buildFileInfoByIdents(String img, String att, Map<String, Object> map) {
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"));
});
}
map.put("img", imgMap);
String a = Optional.ofNullable(img).orElse("[]");
JSONArray ao = JSONArray.parseArray(a);
map.put("att", ao);
// 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"));
// });
// }
// map.put("img", imgMap);
// String a = Optional.ofNullable(img).orElse("[]");
// JSONArray ao = JSONArray.parseArray(a);
// map.put("att", ao);
}
@ -203,7 +208,7 @@ public class AchievementsServiceImpl implements IAchievementsService {
@Override
public List<KeyValVo<String, Long>> get7DayAdd(AchQueryVo achQueryVo) {
Date[] days = DateUtil.getDays(1, 7);
Map<String, Long> w = achievementsMapper.getaWatcher(days[0], days[1], achQueryVo.getSource())
Map<String, Long> w = achievementsMapper.getAchievement(days[0], days[1], achQueryVo.getSource())
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
List<String> dateStr = DateUtil.getDateStr(days[0], days[1]);
@ -218,4 +223,40 @@ public class AchievementsServiceImpl implements IAchievementsService {
}
return res;
}
@Override
public Map<String, Long> indexProjectStatistic() {
Map<String, Long> res = achievementsMapper.indexProjectStatistic();
return res;
}
@Override
public Map<String, Object> indexTaskStatistic() {
Map<String, Object> res = achievementsMapper.indexTaskStatistic();
double convertedTaskAmount = taskResourceLibraryMapper.getConvertedTaskAmount();
res.put("convertedTaskAmount", convertedTaskAmount);
return res;
}
@Override
public Map<String, Long> indexCompetitionStatistic() {
Map<String, Long> res = achievementsMapper.indexCompetitionStatistic();
return res;
}
@Override
public Map<String, Long> indexSchoolEnterpriseStatistic() {
Map<String, Long> res = new HashMap<>();
Long schoolEnterpriseCount = achievementsMapper.indexSchoolEnterpriseStatistic("4", "");
res.put("schoolEnterpriseCount", schoolEnterpriseCount);
Long schoolCount = achievementsMapper.indexSchoolEnterpriseStatistic("4", "1");
res.put("schoolCount", schoolCount);
Long enterpriseCount = achievementsMapper.indexSchoolEnterpriseStatistic("4", "2");
res.put("enterpriseCount", enterpriseCount);
Clicker clicker = new Clicker();
clicker.setClickType("schoolEnterprise");
long clickCount = taskResourceLibraryMapper.countClicker(clicker);
res.put("clickCount", clickCount);
return res;
}
}

View File

@ -61,7 +61,7 @@ public class CollectUserActDataController {
@ApiOperation(value = "记录搜索次数")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchType", value = "搜索类型(任务makerSpaceTask、项目Project、竞赛CompetitionInfo)", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "searchIds", value = "搜索对象ID", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "searchIds", 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)
})
@ -70,7 +70,7 @@ public class CollectUserActDataController {
}
@PostMapping("/addFavorite")
@ApiOperation(value = "记录搜索次数")
@ApiOperation(value = "记录收藏次数")
@ApiImplicitParams({
@ApiImplicitParam(name = "favoriteType", value = "收藏类型(成果Achievements、专家Experts)", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "favoriteId", value = "对象ID", paramType = "query", dataTypeClass = Integer.class),
@ -82,7 +82,7 @@ public class CollectUserActDataController {
}
@PostMapping("/addWatcher")
@ApiOperation(value = "记录搜索次数")
@ApiOperation(value = "记录关注次数")
@ApiImplicitParams({
@ApiImplicitParam(name = "favoriteType", value = "关注类型(成果Achievements、专家Experts)", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "favoriteId", value = "对象ID", paramType = "query", dataTypeClass = Integer.class),

View File

@ -290,4 +290,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by DATE_FORMAT(create_time, '%Y-%m-%d')
order by DATE_FORMAT(create_time, '%Y-%m-%d')
</select>
<select id="indexProjectStatistic" resultType="java.util.Map">
select COUNT(*) as projectCount,
IFNULL(SUM(attachment_count), 0) as attachmentCount,
(select COUNT(*) from clickers where click_type = 'Project') as clickCount,
(select COUNT(distinct project_id) from project_resource_library) as projectAchievementCount
from achievements
where source = '1';
</select>
<select id="indexTaskStatistic" resultType="java.util.Map">
select COUNT(*) as taskCount,
(select COUNT(*) from clickers where click_type = 'makerSpaceTask') as clickCount,
IFNULL(SUM(is_expert_audit), 0) as expertAuditCount
from achievements
where source = '2';
</select>
<select id="indexCompetitionStatistic" resultType="java.util.Map">
select COUNT(*) as CompetitionCount,
IFNULL(SUM(is_expert_audit), 0) as expertAuditCount,
(select COUNT(*) from clickers where click_type = 'CompetitionInfo') as clickCount,
(select COUNT(distinct open_competition_id) from competition_resource_library) as CompetitionCountAchievementCount
from achievements
where source = '3';
</select>
<select id="indexSchoolEnterpriseStatistic" resultType="java.lang.Long">
select COUNT(*)
from achievements a
where source = #{s}
and tags = #{t};
</select>
</mapper>

View File

@ -402,6 +402,13 @@ public class SysFileInfoServiceImpl implements ISysFileInfoService {
isCommonFileType = false;
break;
}
case "dms": {
// 项目管理下需生成唯一标识防止用户通过id递增访问
sysFileInfo.setFileIdentifier(genFileIdentifier());
baseFilePath += "/" + fileType + "/";
isCommonFileType = false;
break;
}
case "resource": {
baseFilePath += "/" + fileType + "/";
isCommonFileType = false;