Merge remote-tracking branch 'origin/feat_chievements_dev' into feat_chievements_dev
This commit is contained in:
commit
f05d5cf548
|
@ -1,9 +1,6 @@
|
||||||
package com.microservices.dms.achievementLibrary.mapper;
|
package com.microservices.dms.achievementLibrary.mapper;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.microservices.common.datasource.annotation.Master;
|
import com.microservices.common.datasource.annotation.Master;
|
||||||
import com.microservices.common.datasource.annotation.Slave;
|
import com.microservices.common.datasource.annotation.Slave;
|
||||||
|
@ -117,7 +114,7 @@ public interface AchievementsMapper {
|
||||||
|
|
||||||
List<Map<String, Object>> getAchievementType();
|
List<Map<String, Object>> getAchievementType();
|
||||||
|
|
||||||
List<KeyValueVo> getAchievementActData();
|
List<KeyValueVo> getAchievementActData(@Param("s") Date s, @Param("e") Date e);
|
||||||
|
|
||||||
List<Map<String, Object>> getAchievementDomain();
|
List<Map<String, Object>> getAchievementDomain();
|
||||||
|
|
||||||
|
@ -150,4 +147,13 @@ public interface AchievementsMapper {
|
||||||
List<TaskResourceLibrary> getRelatedAchTaskOfExpert(@Param("id")Long id);
|
List<TaskResourceLibrary> getRelatedAchTaskOfExpert(@Param("id")Long id);
|
||||||
|
|
||||||
List<CompetitionResourceLibrary> getRelatedAchCompetitionOfExpert(@Param("id")Long id);
|
List<CompetitionResourceLibrary> getRelatedAchCompetitionOfExpert(@Param("id")Long id);
|
||||||
|
|
||||||
|
List<KeyValVo<String,Long>> getAchievementAddYearlyData(@Param("s") Date s, @Param("e") Date e);
|
||||||
|
|
||||||
|
List<KeyValueVo> getAchievementActDataW(@Param("s") Date s, @Param("e") Date e);
|
||||||
|
|
||||||
|
List<KeyValueVo> getAchievementActDataC(@Param("s") Date s, @Param("e") Date e);
|
||||||
|
|
||||||
|
List<KeyValueVo> getAchievementActDataD(@Param("s") Date s, @Param("e") Date e);
|
||||||
|
List<KeyValueVo> getAchievementActDataF(@Param("s") Date s, @Param("e") Date e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.microservices.dms.achievementLibrary.service;
|
package com.microservices.dms.achievementLibrary.service;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
|
||||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||||
import com.microservices.dms.achievementLibrary.mapper.AchievementsMapper;
|
import com.microservices.dms.achievementLibrary.mapper.AchievementsMapper;
|
||||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||||
|
@ -59,15 +60,75 @@ public class BigScreenStatisticService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String,Object>> getAchievementActData() {
|
public List<Map<String,Object>> getAchievementActData() {
|
||||||
List<KeyValueVo> list = achievementsMapper.getAchievementActData();
|
Date[] days = DateUtil.getDays(0, 6);
|
||||||
Map<String, List<KeyValueVo>> res = list.stream().collect(Collectors.groupingBy(KeyValueVo::getKey));
|
Map<String, Long> wlist = achievementsMapper.getAchievementActDataW(days[0], days[1]).stream().collect(Collectors.toMap(KeyValueVo::getName, KeyValueVo::getValue));
|
||||||
|
Map<String, Long> clist = achievementsMapper.getAchievementActDataC(days[0], days[1]).stream().collect(Collectors.toMap(KeyValueVo::getName, KeyValueVo::getValue));
|
||||||
|
Map<String, Long> dlist = achievementsMapper.getAchievementActDataD(days[0], days[1]).stream().collect(Collectors.toMap(KeyValueVo::getName, KeyValueVo::getValue));
|
||||||
|
Map<String, Long> flist = achievementsMapper.getAchievementActDataF(days[0], days[1]).stream().collect(Collectors.toMap(KeyValueVo::getName, KeyValueVo::getValue));
|
||||||
|
|
||||||
|
List<String> dateStr = DateUtil.getDateStrMMDD(days[0], days[1]);
|
||||||
|
List<KeyValueVo> wres = new ArrayList<>();
|
||||||
|
List<KeyValueVo> cres = new ArrayList<>();
|
||||||
|
List<KeyValueVo> dres = new ArrayList<>();
|
||||||
|
List<KeyValueVo> fres = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String s : dateStr) {
|
||||||
|
Long a = wlist.getOrDefault(s, 0L);
|
||||||
|
KeyValueVo k1 = new KeyValueVo();
|
||||||
|
k1.setKey(s);
|
||||||
|
k1.setValue(a);
|
||||||
|
k1.setName("关注");
|
||||||
|
wres.add(k1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String s : dateStr) {
|
||||||
|
Long a = clist.getOrDefault(s, 0L);
|
||||||
|
KeyValueVo k1 = new KeyValueVo();
|
||||||
|
k1.setKey(s);
|
||||||
|
k1.setValue(a);
|
||||||
|
k1.setName("浏览");
|
||||||
|
cres.add(k1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (String s : dateStr) {
|
||||||
|
Long a = dlist.getOrDefault(s, 0L);
|
||||||
|
KeyValueVo k1 = new KeyValueVo();
|
||||||
|
k1.setKey(s);
|
||||||
|
k1.setValue(a);
|
||||||
|
k1.setName("下载");
|
||||||
|
dres.add(k1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String s : dateStr) {
|
||||||
|
Long a = flist.getOrDefault(s, 0L);
|
||||||
|
KeyValueVo k1 = new KeyValueVo();
|
||||||
|
k1.setKey(s);
|
||||||
|
k1.setValue(a);
|
||||||
|
k1.setName("收藏");
|
||||||
|
fres.add(k1);
|
||||||
|
}
|
||||||
|
|
||||||
List<Map<String, Object>> r = new ArrayList<>();
|
List<Map<String, Object>> r = new ArrayList<>();
|
||||||
res.forEach( (k, v) -> {
|
Map<String, Object> w = new HashMap<>();
|
||||||
Map<String, Object> map = new HashMap<>();
|
w.put("key", "关注");
|
||||||
map.put("key", k);
|
w.put("value", wres);
|
||||||
map.put("value", v);
|
Map<String, Object> c = new HashMap<>();
|
||||||
r.add(map);
|
c.put("key","浏览");
|
||||||
});
|
c.put("value", cres);
|
||||||
|
Map<String, Object> d = new HashMap<>();
|
||||||
|
c.put("key","下载");
|
||||||
|
d.put("value", dres);
|
||||||
|
Map<String, Object> f = new HashMap<>();
|
||||||
|
f.put("key", "收藏");
|
||||||
|
f.put("value", fres);
|
||||||
|
|
||||||
|
|
||||||
|
r.add(w);
|
||||||
|
r.add(c);
|
||||||
|
r.add(d);
|
||||||
|
r.add(f);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +136,22 @@ public class BigScreenStatisticService {
|
||||||
return achievementsMapper.getAchievementDomain();
|
return achievementsMapper.getAchievementDomain();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> getAchievementAddYearly() {
|
public Object getAchievementAddYearly() {
|
||||||
return achievementsMapper.getAchievementAddYearly();
|
|
||||||
|
Date[] currentYear = DateUtil.getLast12Months();
|
||||||
|
|
||||||
|
Map<String, Long> m = achievementsMapper.getAchievementAddYearlyData(currentYear[0],currentYear[1])
|
||||||
|
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||||
|
List<String> dateStr = DateUtil.getDateStrYYYYMM(currentYear[0], currentYear[1]);
|
||||||
|
List<KeyValVo<String, Long>> res = new ArrayList<>();
|
||||||
|
for (String s : dateStr) {
|
||||||
|
Long a = m.getOrDefault(s, 0L);
|
||||||
|
KeyValVo<String, Long> k1 = new KeyValVo<>();
|
||||||
|
k1.setK(s);
|
||||||
|
k1.setV(a);
|
||||||
|
res.add(k1);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> getAchievementHotRank() {
|
public List<Map<String, Object>> getAchievementHotRank() {
|
||||||
|
@ -109,11 +184,11 @@ public class BigScreenStatisticService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<KeyValVo<String, Long>> getCompetitionYearlyPaperAdd() {
|
public List<KeyValVo<String, Long>> getCompetitionYearlyPaperAdd() {
|
||||||
Date[] currentYear = DateUtil.getCurrentYear();
|
Date[] currentYear = DateUtil.getLast12Months();
|
||||||
|
|
||||||
Map<String, Long> m = competitionResourceLibraryMapper.getCompetitionYearlyPaperAdd(currentYear[0],currentYear[1])
|
Map<String, Long> m = competitionResourceLibraryMapper.getCompetitionYearlyPaperAdd(currentYear[0],currentYear[1])
|
||||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||||
List<String> dateStr = DateUtil.getDateStrMMDD(currentYear[0], currentYear[1]);
|
List<String> dateStr = DateUtil.getDateStrYYYYMM(currentYear[0], currentYear[1]);
|
||||||
List<KeyValVo<String, Long>> res = new ArrayList<>();
|
List<KeyValVo<String, Long>> res = new ArrayList<>();
|
||||||
for (String s : dateStr) {
|
for (String s : dateStr) {
|
||||||
Long a = m.getOrDefault(s, 0L);
|
Long a = m.getOrDefault(s, 0L);
|
||||||
|
@ -126,12 +201,11 @@ public class BigScreenStatisticService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<KeyValVo<String, Long>> getCompetitionYearlyFinish() {
|
public List<KeyValVo<String, Long>> getCompetitionYearlyFinish() {
|
||||||
Date[] currentYear = DateUtil.getCurrentYear();
|
Date[] currentYear = DateUtil.getLast12Months();
|
||||||
Date[] YearEndOfCur = DateUtil.getCurrentYearEndOf(LocalDate.now());
|
|
||||||
|
|
||||||
Map<String, Long> m = competitionResourceLibraryMapper.getCompetitionYearlyFinish(YearEndOfCur[0],YearEndOfCur[1])
|
Map<String, Long> m = competitionResourceLibraryMapper.getCompetitionYearlyFinish(currentYear[0],currentYear[1])
|
||||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||||
List<String> dateStr = DateUtil.getDateStrMMDD(currentYear[0], currentYear[1]);
|
List<String> dateStr = DateUtil.getDateStrYYYYMM(currentYear[0], currentYear[1]);
|
||||||
List<KeyValVo<String, Long>> res = new ArrayList<>();
|
List<KeyValVo<String, Long>> res = new ArrayList<>();
|
||||||
for (String s : dateStr) {
|
for (String s : dateStr) {
|
||||||
Long a = m.getOrDefault(s, 0L);
|
Long a = m.getOrDefault(s, 0L);
|
||||||
|
|
|
@ -2,7 +2,8 @@ package com.microservices.dms.constant;
|
||||||
|
|
||||||
public class TaskConstant {
|
public class TaskConstant {
|
||||||
|
|
||||||
private TaskConstant() {}
|
private TaskConstant() {
|
||||||
|
}
|
||||||
|
|
||||||
public static final String TASK_TYPE_WATCHERS = "MakerTask";
|
public static final String TASK_TYPE_WATCHERS = "MakerTask";
|
||||||
public static final String TASK_TYPE_JOURNALS = "makerSpaceTask";
|
public static final String TASK_TYPE_JOURNALS = "makerSpaceTask";
|
||||||
|
@ -22,4 +23,16 @@ public class TaskConstant {
|
||||||
public static final String EXPERTS = "Experts";
|
public static final String EXPERTS = "Experts";
|
||||||
public static final String ACHIEVEMENTS = "Achievements";
|
public static final String ACHIEVEMENTS = "Achievements";
|
||||||
|
|
||||||
|
// task status dict
|
||||||
|
public static final int DRAFT_STATUS = 0; //草稿状态
|
||||||
|
public static final int TO_BE_REVIEWED_STATUS = 1; //待审核状态
|
||||||
|
public static final int REFUSED_STATUS = 2; //已拒绝状态
|
||||||
|
public static final int TASK_PAPER_COLLECTING_STATUS = 3; //成果征集中状态
|
||||||
|
public static final int TASK_PAPER_CHOOSING_STATUS = 4; //成果评选中状态
|
||||||
|
public static final int TASK_RESULT_PROOF_STATUS = 5; //公示中状态
|
||||||
|
public static final int TASK_SIGNING_STATUS = 6; //协议签定中状态
|
||||||
|
public static final int TASK_PAYING_STATUS = 7; //支付中状态
|
||||||
|
public static final int TASK_COMPLETE_STATUS = 8; //任务完成状态
|
||||||
|
public static final int TASK_TO_BE_REPAIRED_STATUS = 9; //待修缮状态
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,16 @@ import com.microservices.common.core.web.domain.AjaxResult;
|
||||||
import com.microservices.dms.referral.service.TalentReferralService;
|
import com.microservices.dms.referral.service.TalentReferralService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Data
|
||||||
@Api(tags = "数据管理体系-推荐接口")
|
@Api(tags = "数据管理体系-推荐接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/talentReferral")
|
@RequestMapping("/talentReferral")
|
||||||
|
@ -30,9 +34,24 @@ public class TalentReferralController {
|
||||||
return AjaxResult.success(talentReferralService.doPRTalentReferral(prId, projectId));
|
return AjaxResult.success(talentReferralService.doPRTalentReferral(prId, projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/taskTalentReferral")
|
@GetMapping("/taskAchievementTalentReferral")
|
||||||
@ApiOperation(value = "任务推荐")
|
@ApiOperation(value = "任务成果推荐")
|
||||||
public AjaxResult taskTalentReferral(@RequestParam("taskId") Long taskId) {
|
public AjaxResult taskAchievementTalentReferral(@RequestParam("taskId") Long taskId) {
|
||||||
return AjaxResult.success(talentReferralService.taskTalentReferral(taskId));
|
return AjaxResult.success(talentReferralService.taskAchievementTalentReferral(taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/taskExpertTalentReferral")
|
||||||
|
@ApiOperation(value = "任务专家推荐")
|
||||||
|
public AjaxResult taskExpertTalentReferral(@RequestParam("taskId") Long taskId) {
|
||||||
|
return AjaxResult.success(talentReferralService.taskExpertTalentReferral(taskId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/competitionExpertTalentReferral")
|
||||||
|
@ApiOperation(value = "竞赛专家推荐")
|
||||||
|
public AjaxResult competitionExpertTalentReferral(@RequestParam("competitionId") Long competitionId) {
|
||||||
|
return AjaxResult.success(talentReferralService.competitionExpertTalentReferral(competitionId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package com.microservices.dms.referral.mapper;
|
package com.microservices.dms.referral.mapper;
|
||||||
|
|
||||||
import com.microservices.common.datasource.annotation.Slave;
|
import com.microservices.common.datasource.annotation.Slave;
|
||||||
|
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||||
|
import com.microservices.dms.referral.vo.ExpertVo;
|
||||||
import com.microservices.dms.referral.vo.IssuesVo;
|
import com.microservices.dms.referral.vo.IssuesVo;
|
||||||
import com.microservices.dms.referral.vo.PullRequestVo;
|
import com.microservices.dms.referral.vo.PullRequestVo;
|
||||||
import com.microservices.dms.referral.vo.TaskVo;
|
import com.microservices.dms.referral.vo.TaskVo;
|
||||||
|
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -30,7 +33,17 @@ public interface TalentReferralMapper {
|
||||||
|
|
||||||
Long selectIdByLogin(@Param("login") String login);
|
Long selectIdByLogin(@Param("login") String login);
|
||||||
|
|
||||||
List<TaskVo> selectTaskByStatus();
|
List<TaskVo> selectTaskByStatus(@Param("statusIds") List<Integer> statusIds);
|
||||||
|
|
||||||
Map<String, Object> selectUsersById(@Param("id") Long id);
|
Map<String, Object> selectUsersById(@Param("id") Long id);
|
||||||
|
|
||||||
|
TaskVo selectTaskById(@Param("id") Long id);
|
||||||
|
|
||||||
|
List<ExpertVo> selectExpertsBy(ExpertVo expertVo);
|
||||||
|
|
||||||
|
List<KeyValVo<Long,String>> allTaskWithExpertIds(@Param("type") String type);
|
||||||
|
|
||||||
|
TaskVo selectCompetitionById(Long competitionId);
|
||||||
|
|
||||||
|
List<TaskVo> selectCompetitionIdByStatus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,20 @@ package com.microservices.dms.referral.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.microservices.common.core.exception.ServiceException;
|
import com.microservices.common.core.exception.ServiceException;
|
||||||
import com.microservices.common.core.utils.StringUtils;
|
import com.microservices.common.core.utils.StringUtils;
|
||||||
|
import com.microservices.dms.achievementLibrary.domain.Achievements;
|
||||||
|
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||||
|
import com.microservices.dms.achievementLibrary.mapper.AchievementsMapper;
|
||||||
import com.microservices.dms.constant.ReferralConstant;
|
import com.microservices.dms.constant.ReferralConstant;
|
||||||
|
import com.microservices.dms.constant.TaskConstant;
|
||||||
import com.microservices.dms.referral.mapper.TalentReferralMapper;
|
import com.microservices.dms.referral.mapper.TalentReferralMapper;
|
||||||
|
import com.microservices.dms.referral.vo.ExpertVo;
|
||||||
import com.microservices.dms.referral.vo.IssueDto;
|
import com.microservices.dms.referral.vo.IssueDto;
|
||||||
import com.microservices.dms.referral.vo.IssuesVo;
|
import com.microservices.dms.referral.vo.IssuesVo;
|
||||||
import com.microservices.dms.referral.vo.TaskVo;
|
import com.microservices.dms.referral.vo.TaskVo;
|
||||||
import com.microservices.dms.resourceLibrary.domain.TaskResourceLibrary;
|
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||||
import com.microservices.dms.resourceLibrary.mapper.TaskResourceLibraryMapper;
|
|
||||||
import com.microservices.dms.utils.DmsGitLinkRequestUrl;
|
import com.microservices.dms.utils.DmsGitLinkRequestUrl;
|
||||||
import com.microservices.dms.utils.DmsRequestHelper;
|
import com.microservices.dms.utils.DmsRequestHelper;
|
||||||
import com.microservices.dms.utils.SimilarityService;
|
import com.microservices.dms.utils.SimilarityService;
|
||||||
|
@ -35,7 +40,7 @@ public class TalentReferralService {
|
||||||
private DmsRequestHelper dmsRequestHelper;
|
private DmsRequestHelper dmsRequestHelper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TaskResourceLibraryMapper taskResourceLibraryMapper;
|
private AchievementsMapper achievementsMapper;
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(TalentReferralService.class);
|
private static final Logger logger = LoggerFactory.getLogger(TalentReferralService.class);
|
||||||
|
|
||||||
|
@ -44,8 +49,7 @@ public class TalentReferralService {
|
||||||
// 获取项目贡献者数量
|
// 获取项目贡献者数量
|
||||||
JSONArray contributorsArray = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.CONTRIBUTORS(projectFullName), "list", "total_count");
|
JSONArray contributorsArray = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.CONTRIBUTORS(projectFullName), "list", "total_count");
|
||||||
|
|
||||||
return contributorsArray.stream().map(o -> (JSONObject) o).map(s -> s.getString("contributions")).filter(StringUtils::isNotBlank)
|
return contributorsArray.stream().map(o -> (JSONObject) o).map(s -> s.getString("contributions")).filter(StringUtils::isNotBlank).mapToLong(Long::parseLong).boxed().collect(Collectors.toSet());
|
||||||
.mapToLong(Long::parseLong).boxed().collect(Collectors.toSet());
|
|
||||||
|
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.error("【{}】获取项目贡献者数量失败:{}", projectFullName, e.getMessage());
|
logger.error("【{}】获取项目贡献者数量失败:{}", projectFullName, e.getMessage());
|
||||||
|
@ -58,8 +62,7 @@ public class TalentReferralService {
|
||||||
// 获取项目成员者数量
|
// 获取项目成员者数量
|
||||||
JSONArray contributorsArray = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.QUERY_USER_FROM_PROJECT(projectFullName), "members", "total_count");
|
JSONArray contributorsArray = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.QUERY_USER_FROM_PROJECT(projectFullName), "members", "total_count");
|
||||||
|
|
||||||
return contributorsArray.stream().map(o -> (JSONObject) o).map(s -> s.getString("id"))
|
return contributorsArray.stream().map(o -> (JSONObject) o).map(s -> s.getString("id")).filter(StringUtils::isNotBlank).mapToLong(Long::parseLong).boxed().collect(Collectors.toSet());
|
||||||
.filter(StringUtils::isNotBlank).mapToLong(Long::parseLong).boxed().collect(Collectors.toSet());
|
|
||||||
|
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.error("【{}】获取项目成员者数量失败:{}", projectFullName, e.getMessage());
|
logger.error("【{}】获取项目成员者数量失败:{}", projectFullName, e.getMessage());
|
||||||
|
@ -93,7 +96,7 @@ public class TalentReferralService {
|
||||||
|
|
||||||
public List<Map<String, Object>> doIssueTalentReferral(Long projectId, Long issueId) {
|
public List<Map<String, Object>> doIssueTalentReferral(Long projectId, Long issueId) {
|
||||||
List<Map.Entry<Long, Double>> entries = issueTalentReferral(projectId, issueId);
|
List<Map.Entry<Long, Double>> entries = issueTalentReferral(projectId, issueId);
|
||||||
return entries.stream().map(s->{
|
return entries.stream().map(s -> {
|
||||||
Map<String, Object> mm = talentReferralMapper.selectUsersById(s.getKey());
|
Map<String, Object> mm = talentReferralMapper.selectUsersById(s.getKey());
|
||||||
return mm;
|
return mm;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
@ -177,8 +180,7 @@ public class TalentReferralService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算每个负责人关闭的 PR数量
|
// 计算每个负责人关闭的 PR数量
|
||||||
closedPullRequests.stream().map(IssueDto::getReviewers).flatMap(List::stream)
|
closedPullRequests.stream().map(IssueDto::getReviewers).flatMap(List::stream).forEach(s -> userNameFractionMap.merge(s, 40.0D, Double::sum));
|
||||||
.forEach(s -> userNameFractionMap.merge(s, 40.0D, Double::sum));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -232,7 +234,7 @@ public class TalentReferralService {
|
||||||
|
|
||||||
public List<Map<String, Object>> doPRTalentReferral(Long projectId, Long prId) {
|
public List<Map<String, Object>> doPRTalentReferral(Long projectId, Long prId) {
|
||||||
List<Map.Entry<Long, Double>> entries = PRTalentReferral(projectId, prId);
|
List<Map.Entry<Long, Double>> entries = PRTalentReferral(projectId, prId);
|
||||||
return entries.stream().map(s->{
|
return entries.stream().map(s -> {
|
||||||
Map<String, Object> mm = talentReferralMapper.selectUsersById(s.getKey());
|
Map<String, Object> mm = talentReferralMapper.selectUsersById(s.getKey());
|
||||||
return mm;
|
return mm;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
@ -240,13 +242,10 @@ public class TalentReferralService {
|
||||||
|
|
||||||
public List<Map.Entry<Long, Double>> PRTalentReferral(Long projectId, Long prId) {
|
public List<Map.Entry<Long, Double>> PRTalentReferral(Long projectId, Long prId) {
|
||||||
List<IssueDto> openPullRequests = getPullRequests(projectId, "1");
|
List<IssueDto> openPullRequests = getPullRequests(projectId, "1");
|
||||||
openPullRequests = openPullRequests.stream().filter(e -> e.getReviewers().isEmpty())
|
openPullRequests = openPullRequests.stream().filter(e -> e.getReviewers().isEmpty()).collect(Collectors.toList());
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
if (prId != null) {
|
if (prId != null) {
|
||||||
openPullRequests = openPullRequests.stream().filter(e -> Objects.equals((long) (e.getId()), prId))
|
openPullRequests = openPullRequests.stream().filter(e -> Objects.equals((long) (e.getId()), prId)).filter(e -> e.getReviewers().isEmpty()).collect(Collectors.toList());
|
||||||
.filter(e -> e.getReviewers().isEmpty())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
return PRTalentReferral(projectId, prId, openPullRequests);
|
return PRTalentReferral(projectId, prId, openPullRequests);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,31 +263,31 @@ public class TalentReferralService {
|
||||||
* 3、根据1中任务标题和任务正文 与数据仓库中名称和简介、详情比较 ;取前10获取对比计算分值大于0的结果
|
* 3、根据1中任务标题和任务正文 与数据仓库中名称和简介、详情比较 ;取前10获取对比计算分值大于0的结果
|
||||||
* 4、将2和3的结果相加,取前5个成果进行推荐
|
* 4、将2和3的结果相加,取前5个成果进行推荐
|
||||||
*/
|
*/
|
||||||
public List<TaskVo> taskTalentReferral(Long taskId) {
|
public List<Achievements> taskAchievementTalentReferral(Long taskId) {
|
||||||
List<TaskVo> taskVos = talentReferralMapper.selectTaskByStatus();
|
TaskVo task = talentReferralMapper.selectTaskById(taskId);
|
||||||
TaskResourceLibrary tCond = new TaskResourceLibrary();
|
Achievements tCond = new Achievements();
|
||||||
tCond.setTaskId(taskId);
|
tCond.setSourceId(taskId);
|
||||||
List<TaskResourceLibrary> taskResourceLibraries = taskResourceLibraryMapper.selectTaskResourceLibraryList(tCond);
|
tCond.setSource("2");
|
||||||
List<TaskVo> result = new ArrayList<>();
|
tCond.setStatus("1");
|
||||||
for (TaskResourceLibrary t : taskResourceLibraries) {
|
List<Achievements> taskAchievements = achievementsMapper.selectAchievementsList(tCond);
|
||||||
List<Long> trTaskIds = doTaskTalentReferral(t, taskVos);
|
List<Achievements> result;
|
||||||
result = trTaskIds.stream().map(s -> taskVos.stream().filter(e -> e.getTaskId().equals(s)).findFirst().orElse(null))
|
|
||||||
.filter(Objects::nonNull)
|
List<Long> trTaskIds = doTaskTalentReferral(task, taskAchievements);
|
||||||
.collect(Collectors.toList());
|
result = trTaskIds.stream().map(s -> taskAchievements.stream().filter(e -> e.getId().equals(s)).findFirst().orElse(null)).filter(Objects::nonNull).limit(5).collect(Collectors.toList());
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Long> doTaskTalentReferral(TaskResourceLibrary task, List<TaskVo> taskVos) {
|
private List<Long> doTaskTalentReferral(TaskVo task, List<Achievements> taskVos) {
|
||||||
String taskDomain = task.getTaskDomain();
|
Long taskDomain = task.getCategoryId();
|
||||||
Map<Long, Double> step1Map = new TreeMap<>();
|
Map<Long, Double> step1Map = new TreeMap<>();
|
||||||
Map<Long, Double> step2Map = new TreeMap<>();
|
Map<Long, Double> step2Map = new TreeMap<>();
|
||||||
for (TaskVo t1 : taskVos) {
|
for (Achievements t1 : taskVos) {
|
||||||
if (Objects.equals(String.valueOf(t1.getCategoryId()), taskDomain)) {
|
if (Objects.equals(String.valueOf(taskDomain), t1.getField1())) {
|
||||||
step1Map.put(t1.getId(), 50.0D);
|
step1Map.put(t1.getId(), 50.0D);
|
||||||
}
|
}
|
||||||
double subjectFraction = SimilarityService.sentence(task.getTaskName(), t1.getName());
|
double subjectFraction = SimilarityService.sentence(task.getName(), t1.getAchievementName());
|
||||||
double descFraction = SimilarityService.text(t1.getDescription(), task.getReleaseDetails());
|
double descFraction = SimilarityService.text(t1.getSummary(), task.getDescription());
|
||||||
step2Map.put(t1.getId(), (subjectFraction + descFraction) * 50.0D);
|
step2Map.put(t1.getId(), (subjectFraction + descFraction) * 50.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,6 +297,107 @@ public class TalentReferralService {
|
||||||
List<Map.Entry<Long, Double>> entryList = new ArrayList<>(step2Map.entrySet());
|
List<Map.Entry<Long, Double>> entryList = new ArrayList<>(step2Map.entrySet());
|
||||||
entryList.sort((entry1, entry2) -> Double.compare(entry2.getValue(), entry1.getValue()));
|
entryList.sort((entry1, entry2) -> Double.compare(entry2.getValue(), entry1.getValue()));
|
||||||
|
|
||||||
return entryList.stream().map(Map.Entry::getKey).limit(5).collect(Collectors.toList());
|
return entryList.stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创客任务评审专家推荐
|
||||||
|
* 1、先查找创客任务状态未结束,并且已加入评审的数据,新增存储到数据表中
|
||||||
|
* 2、技术匹配度:系统中专家领域 与 任务是一样的领域 20%
|
||||||
|
* 3、根据1中任务标题和任务描述 与专家简介进行比较 ,匹配结果分数,取前10;30%
|
||||||
|
* 4、根据1中任务标题和任务描述 与已完成的任务标题与任务描述比较,匹配结果分数,取前3 ,前3个竞赛中对应的专家 分数*50%
|
||||||
|
*/
|
||||||
|
public Object taskExpertTalentReferral(Long taskId) {
|
||||||
|
TaskVo task = talentReferralMapper.selectTaskById(taskId);
|
||||||
|
List<KeyValueVo> categories = achievementsMapper.getAreasByName(null);
|
||||||
|
List<TaskVo> completedTasks = talentReferralMapper.selectTaskByStatus(Lists.newArrayList(TaskConstant.TASK_COMPLETE_STATUS));
|
||||||
|
List<ExpertVo> allExperts = talentReferralMapper.selectExpertsBy(new ExpertVo());
|
||||||
|
|
||||||
|
List<Long> expertIds = doTaskExpertTalentReferral(task, categories, completedTasks, allExperts);
|
||||||
|
return expertIds.stream().map(s -> allExperts.stream().filter(e -> e.getId().equals(s)).findFirst().orElse(null)).filter(Objects::nonNull).limit(3).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Long> doTaskExpertTalentReferral(TaskVo task, List<KeyValueVo> categories, List<TaskVo> completedTasks, List<ExpertVo> allExperts) {
|
||||||
|
|
||||||
|
Map<Long, String> v2k = categories.stream().collect(Collectors.toMap(KeyValueVo::getValue, KeyValueVo::getKey, (o, n) -> n));
|
||||||
|
|
||||||
|
String taskDomain = v2k.get(task.getCategoryId());
|
||||||
|
Map<Long, Double> step1Map = new TreeMap<>();
|
||||||
|
Map<Long, Double> step2Map = new TreeMap<>();
|
||||||
|
for (ExpertVo t1 : allExperts) {
|
||||||
|
if (Objects.equals(taskDomain, t1.getReviewAreaOne()) || Objects.equals(taskDomain, t1.getReviewAreaTwo()) || Objects.equals(taskDomain, t1.getReviewAreaThree())) {
|
||||||
|
step1Map.put(t1.getId(), 50.0D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<KeyValVo<Long, String>> allTaskWithExpertIds = talentReferralMapper.allTaskWithExpertIds("1");
|
||||||
|
Map<Long, String> t2e = allTaskWithExpertIds.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV, (o, n) -> n));
|
||||||
|
for (TaskVo t2 : completedTasks) {
|
||||||
|
double subjectFraction = SimilarityService.sentence(task.getName(), t2.getName());
|
||||||
|
double descFraction = SimilarityService.text(t2.getDescription(), task.getDescription());
|
||||||
|
|
||||||
|
String[] split = t2e.getOrDefault(t2.getId(), "").split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
if (StringUtils.isNotBlank(s)) {
|
||||||
|
step2Map.put(Long.parseLong(s), (subjectFraction + descFraction) * 50.0D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
step1Map.forEach((k, v) -> step2Map.merge(k, v, Double::sum));
|
||||||
|
|
||||||
|
List<Map.Entry<Long, Double>> entryList = new ArrayList<>(step2Map.entrySet());
|
||||||
|
entryList.sort((entry1, entry2) -> Double.compare(entry2.getValue(), entry1.getValue()));
|
||||||
|
|
||||||
|
return entryList.stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开源竞赛评审专家推荐
|
||||||
|
* 1、先查找开放竞赛状态未结束,并且已提交评审的数据,新增存储到数据表中
|
||||||
|
* 2、技术匹配度:系统中专家领域 与 竞赛是一样的领域 ; 20%
|
||||||
|
* 3、根据1中竞赛标题和竞赛描述 与专家简介进行比较 ,匹配结果分数,取前10;30%
|
||||||
|
* 4、根据1中竞赛标题和竞赛描述 与已完成的竞赛标题与竞赛描述比较,匹配结果分数,取前3 ,前3个竞赛中对应的专家;*50%
|
||||||
|
*/
|
||||||
|
public Object competitionExpertTalentReferral(Long competitionId) {
|
||||||
|
TaskVo task = talentReferralMapper.selectCompetitionById(competitionId);
|
||||||
|
List<KeyValueVo> categories = new ArrayList<>();
|
||||||
|
List<TaskVo> completedTasks = talentReferralMapper.selectCompetitionIdByStatus();
|
||||||
|
List<ExpertVo> allExperts = talentReferralMapper.selectExpertsBy(new ExpertVo());
|
||||||
|
|
||||||
|
List<Long> expertIds = doCompetitionExpertTalentReferral(task, categories, completedTasks, allExperts);
|
||||||
|
return expertIds.stream().map(s -> allExperts.stream().filter(e -> e.getId().equals(s)).findFirst().orElse(null)).filter(Objects::nonNull).limit(3).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<Long> doCompetitionExpertTalentReferral(TaskVo task, List<KeyValueVo> categories, List<TaskVo> completedTasks, List<ExpertVo> allExperts) {
|
||||||
|
|
||||||
|
Map<Long, Double> step1Map = new TreeMap<>();
|
||||||
|
Map<Long, Double> step2Map = new TreeMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
List<KeyValVo<Long, String>> allTaskWithExpertIds = talentReferralMapper.allTaskWithExpertIds("2");
|
||||||
|
Map<Long, String> t2e = allTaskWithExpertIds.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV, (o, n) -> n));
|
||||||
|
for (TaskVo t2 : completedTasks) {
|
||||||
|
double subjectFraction = SimilarityService.sentence(task.getName(), t2.getName());
|
||||||
|
double descFraction = SimilarityService.text(t2.getDescription(), task.getDescription());
|
||||||
|
|
||||||
|
String[] split = t2e.getOrDefault(t2.getId(), "").split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
if (StringUtils.isNotBlank(s)) {
|
||||||
|
step2Map.put(Long.parseLong(s), (subjectFraction + descFraction) * 100.0D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
step1Map.forEach((k, v) -> step2Map.merge(k, v, Double::sum));
|
||||||
|
|
||||||
|
List<Map.Entry<Long, Double>> entryList = new ArrayList<>(step2Map.entrySet());
|
||||||
|
entryList.sort((entry1, entry2) -> Double.compare(entry2.getValue(), entry1.getValue()));
|
||||||
|
|
||||||
|
return entryList.stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.microservices.dms.referral.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExpertVo {
|
||||||
|
Long id;
|
||||||
|
Long userId;
|
||||||
|
String expertName;
|
||||||
|
String nickname;
|
||||||
|
String reviewAreaOne;
|
||||||
|
String reviewAreaTwo;
|
||||||
|
String reviewAreaThree;
|
||||||
|
Integer status;
|
||||||
|
}
|
|
@ -9,5 +9,5 @@ public class TaskVo {
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private Long categoryId;
|
private Long categoryId;
|
||||||
private Integer status;
|
private String identifier;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,20 @@ public class DateUtil {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Date[] getLast12Months() {
|
||||||
|
LocalDate endDate = LocalDate.now();
|
||||||
|
|
||||||
|
LocalDate startDate = endDate.minusMonths(11);
|
||||||
|
|
||||||
|
LocalDateTime startDateTime = LocalDateTime.of(startDate.getYear(),startDate.getMonth(),1,0,0,0);
|
||||||
|
LocalDateTime endDateTime = endDate.atTime(23, 59, 59);
|
||||||
|
|
||||||
|
return new Date[]{
|
||||||
|
Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant()),
|
||||||
|
Date.from(endDateTime.atZone(ZoneId.systemDefault()).toInstant())
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static Date[] getCurrentYearEndOf(LocalDate endDate) {
|
public static Date[] getCurrentYearEndOf(LocalDate endDate) {
|
||||||
Year year = Year.now();
|
Year year = Year.now();
|
||||||
|
|
||||||
|
@ -68,6 +82,19 @@ public class DateUtil {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static List<String> getDateStrYYYYMM(Date start, Date end) {
|
||||||
|
LocalDate s = start.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().toLocalDate();
|
||||||
|
LocalDate e = end.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().toLocalDate();
|
||||||
|
String pattern = "yyyy-MM";
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
|
||||||
|
return LongStream.range(0, s.until(e).getMonths() + 1)
|
||||||
|
.mapToObj(s::plusMonths)
|
||||||
|
.map(formatter::format)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
public static List<String> getDateStrYYYYMMDD(Date start, Date end) {
|
public static List<String> getDateStrYYYYMMDD(Date start, Date end) {
|
||||||
LocalDate s = start.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().toLocalDate();
|
LocalDate s = start.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().toLocalDate();
|
||||||
LocalDate e = end.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().toLocalDate();
|
LocalDate e = end.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().toLocalDate();
|
||||||
|
|
|
@ -493,13 +493,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="getAchievementActData" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
<select id="getAchievementActData" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||||
select * from (
|
select * from (
|
||||||
select '关注' as `key`, DATE_FORMAT(created_at, '%Y') as name ,COUNT(*) as value from watchers where watchable_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
select '关注' as `key`, DATE_FORMAT(created_at, '%m-%d') as name ,COUNT(*) as value from watchers where watchable_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||||
union all
|
union all
|
||||||
select '浏览' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from clickers where click_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
select '浏览' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from clickers where click_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||||
union all
|
union all
|
||||||
select '下载' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from downloads where download_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
select '下载' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from downloads where download_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||||
union all
|
union all
|
||||||
select '收藏' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from favorites where favorite_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y'))t
|
select '收藏' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from favorites where favorite_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d'))t
|
||||||
order by t.name
|
order by t.name
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -670,4 +670,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where a.id=#{id}
|
where a.id=#{id}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAchievementAddYearlyData" resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
||||||
|
select DATE_FORMAT(create_time, '%Y-%m') as 'k', count(*) as 'v'
|
||||||
|
from achievements
|
||||||
|
where create_time >= #{s}
|
||||||
|
and create_time <= #{e}
|
||||||
|
group by DATE_FORMAT(create_time, '%Y-%m')
|
||||||
|
order by DATE_FORMAT(create_time, '%Y-%m')
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getAchievementActDataW"
|
||||||
|
resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||||
|
select '关注' as `key`, DATE_FORMAT(created_at, '%m-%d') as name ,COUNT(*) as value from watchers where watchable_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||||
|
</select>
|
||||||
|
<select id="getAchievementActDataC"
|
||||||
|
resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||||
|
select '浏览' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from clickers where click_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<select id="getAchievementActDataD"
|
||||||
|
resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||||
|
select '下载' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from downloads where download_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getAchievementActDataF"
|
||||||
|
resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||||
|
select '收藏' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from favorites where favorite_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -284,21 +284,21 @@
|
||||||
|
|
||||||
<select id="getCompetitionYearlyPaperAdd"
|
<select id="getCompetitionYearlyPaperAdd"
|
||||||
resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
||||||
select DATE_FORMAT(created_at, '%m-%d') as 'k', count(*) as 'v'
|
select DATE_FORMAT(created_at, '%Y-%m') as 'k', count(*) as 'v'
|
||||||
from competition_infos
|
from competition_infos
|
||||||
where created_at >= #{s}
|
where created_at >= #{s}
|
||||||
and created_at <= #{e}
|
and created_at <= #{e}
|
||||||
group by DATE_FORMAT(created_at, '%m-%d')
|
group by DATE_FORMAT(created_at, '%Y-%m')
|
||||||
order by DATE_FORMAT(created_at, '%m-%d')
|
order by DATE_FORMAT(created_at, '%Y-%m')
|
||||||
</select>
|
</select>
|
||||||
<select id="getCompetitionYearlyFinish"
|
<select id="getCompetitionYearlyFinish"
|
||||||
resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
||||||
select DATE_FORMAT(upload_date, '%m-%d') as 'k', count(*) as 'v'
|
select DATE_FORMAT(upload_date, '%Y-%m') as 'k', count(*) as 'v'
|
||||||
from competition_infos
|
from competition_infos
|
||||||
where upload_date >= #{s}
|
where upload_date >= #{s}
|
||||||
and upload_date <= #{e}
|
and upload_date <= #{e}
|
||||||
group by DATE_FORMAT(upload_date, '%m-%d')
|
group by DATE_FORMAT(upload_date, '%Y-%m')
|
||||||
order by DATE_FORMAT(upload_date, '%m-%d')
|
order by DATE_FORMAT(upload_date, '%Y-%m')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertCompetitionResourceLibrary" parameterType="CompetitionResourceLibrary" useGeneratedKeys="true"
|
<insert id="insertCompetitionResourceLibrary" parameterType="CompetitionResourceLibrary" useGeneratedKeys="true"
|
||||||
|
|
|
@ -70,12 +70,50 @@
|
||||||
select t.id,td.task_id, name, status, category_id, description
|
select t.id,td.task_id, name, status, category_id, description
|
||||||
from tasks t
|
from tasks t
|
||||||
join task_details td on t.id = td.task_id
|
join task_details td on t.id = td.task_id
|
||||||
where status in (3, 4)
|
where status in
|
||||||
|
<foreach collection="list" item="item" close=")" index="idx" open="(" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUsersById" resultType="java.util.Map">
|
<select id="selectUsersById" resultType="java.util.Map">
|
||||||
select id,login,nickname from users where id = #{id}
|
select id,login,nickname from users where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTaskById" resultType="com.microservices.dms.referral.vo.TaskVo">
|
||||||
|
select t.id,td.task_id, name, status, category_id, description
|
||||||
|
from tasks t
|
||||||
|
join task_details td on t.id = td.task_id
|
||||||
|
where t.id =#{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectExpertsBy" resultType="com.microservices.dms.referral.vo.ExpertVo">
|
||||||
|
select id,
|
||||||
|
user_id,
|
||||||
|
review_area_one,
|
||||||
|
review_area_two,
|
||||||
|
review_area_three,
|
||||||
|
(select IFNULL(nickname,login) from users u where u.id = e.user_id) as nickname
|
||||||
|
from experts e
|
||||||
|
where is_delete = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="allTaskWithExpertIds" resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
||||||
|
select container_id as 'k', group_concat(expert_id) as v from task_expert where container_type = #{type}
|
||||||
|
group by container_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCompetitionById" resultType="com.microservices.dms.referral.vo.TaskVo">
|
||||||
|
select t.id, title as name, status, description
|
||||||
|
from competition_infos t
|
||||||
|
where t.id =#{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCompetitionIdByStatus" resultType="com.microservices.dms.referral.vo.TaskVo">
|
||||||
|
select t.id, title as name, status, description,identifier
|
||||||
|
from competition_infos t
|
||||||
|
where upload_date < now()
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue