bug 3305\3205\3230\3294
This commit is contained in:
parent
80ac027567
commit
15bab4fe0a
|
@ -222,12 +222,29 @@ public class AchievementsController extends BaseController {
|
|||
return success(achievementsService.get7AddClickById(id,clickType));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("根据专家id,获取近7日成果点击数量(折线图)")
|
||||
@GetMapping("/getExpert7AddClickById")
|
||||
public AjaxResult getExpert7AddClickById(String id,@RequestParam(value = "clickType",required = false, defaultValue = "Experts")
|
||||
String clickType) {
|
||||
return success(achievementsService.get7AddClickById(id,clickType));
|
||||
}
|
||||
|
||||
@ApiOperation("根据成果ID,获取成果的相关行为数据统计(点击量、搜索量、附件下载量、收藏、关注)")
|
||||
@GetMapping("/getActDataStatisticById")
|
||||
public AjaxResult getActDataStatisticById(Long id) {
|
||||
return success(achievementsService.getActDataStatisticById(id));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("根据领域来源、领域分类名称,获取领域相关数据")
|
||||
@GetMapping("/getAllAreas")
|
||||
public AjaxResult getAllAreas(String areaName) {
|
||||
return success(achievementsService.getAllAreas(areaName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("根据领域,将成果数据进行分类")
|
||||
@GetMapping("/getAreaStatistic")
|
||||
public AjaxResult getAreaStatistic(String areaKey)
|
||||
|
|
|
@ -125,7 +125,7 @@ public interface AchievementsMapper {
|
|||
|
||||
List<Long> getAllId();
|
||||
|
||||
List<AreaStatisticVo> getAreaStatistic(@Param("areaKey") String areaKey);
|
||||
List<AreaStatisticVo> getAreaStatistic(@Param("source")String source,@Param("areaKey") String areaKey);
|
||||
|
||||
List<AchRelatedVo> getRelatedAch(@Param("id")Long id, @Param("sourceId") List<Long> sourceId, @Param("paramYear")String paramYear);
|
||||
|
||||
|
@ -164,4 +164,5 @@ public interface AchievementsMapper {
|
|||
|
||||
List<KeyValVo<String, Long>> getExperts(@Param("s") Date s, @Param("e") Date e);
|
||||
|
||||
List<KeyValueVo> getAllAreas(@Param("areaName") String areaName);
|
||||
}
|
||||
|
|
|
@ -71,4 +71,6 @@ public interface InBlockchainDataMapper
|
|||
List<Map<String, Object>> commitDataList(BlockchainListQueryVo queryVo);
|
||||
|
||||
List<Map<String, Object>> prDataList(BlockchainListQueryVo queryVo);
|
||||
|
||||
List<String> getNeedToBlockCommitList();
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.microservices.common.core.utils.DateUtils;
|
|||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.httpClient.service.HttpAPIService;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.Achievements;
|
||||
import com.microservices.dms.achievementLibrary.domain.BlockchainListQueryVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.TokenListVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.InBlockchainData;
|
||||
|
@ -14,6 +15,7 @@ import com.microservices.dms.achievementLibrary.domain.blockchain.UserProjectTra
|
|||
import com.microservices.dms.achievementLibrary.domain.blockchain.UserVo;
|
||||
import com.microservices.dms.achievementLibrary.mapper.InBlockchainDataMapper;
|
||||
import com.microservices.dms.achievementLibrary.mapper.UserProjectTransferRecordsMapper;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementImageVo;
|
||||
import com.microservices.dms.common.vo.*;
|
||||
import com.microservices.dms.referral.mapper.TalentReferralMapper;
|
||||
import com.microservices.dms.resourceLibrary.mapper.ProjectResourceLibraryMapper;
|
||||
|
@ -24,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
//import org.fisco.bcos.sdk.client.protocol.response.BcosTransaction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -259,29 +262,7 @@ public class BlockChainService {
|
|||
return -1L;
|
||||
}
|
||||
|
||||
public AjaxResult commitCreate(CommitCreateVo commitCreateVo) {
|
||||
Map<String, Object> res = projectResourceLibraryMapper.selectCommitInfo(commitCreateVo.getCommit_id());
|
||||
JSONObject params = JSONObject.from(res);
|
||||
params.put(REQUEST_TYPE, CREATE_COMMIT);
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
String txHash = rsp.getString(TX_HASH);
|
||||
// insert to db 4、 :数据入链表(id,type,type_id,tx_hash,create_time) (type:issue,type_id:issue_id)
|
||||
if (StringUtils.isNotEmpty(txHash)) {
|
||||
InBlockchainData inBlockchainData = new InBlockchainData();
|
||||
inBlockchainData.setType("commit");
|
||||
inBlockchainData.setTxHash(txHash);
|
||||
inBlockchainData.setTypeId(commitCreateVo.getCommit_id());
|
||||
inBlockchainData.setCreateTime(DateUtils.getNowDate());
|
||||
inBlockchainData.setCreateBy(SecurityUtils.getUsername());
|
||||
inBlockchainDataMapper.insertInBlockchainData(inBlockchainData);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
public AjaxResult prCreate(PrCreateVo prCreateVo) {
|
||||
Map<String, Object> res = projectResourceLibraryMapper.selectPrInfo(prCreateVo.getPr_id());
|
||||
|
@ -349,6 +330,45 @@ public class BlockChainService {
|
|||
return inBlockchainDataMapper.issueDataList(queryVo);
|
||||
}
|
||||
|
||||
//定时任务,将commit数据入链
|
||||
@Scheduled(cron = "${cron.commitPushBlock}")
|
||||
public void commitPushBlock() {
|
||||
//先查询需要入链的数据
|
||||
List<String> commitIdList = inBlockchainDataMapper.getNeedToBlockCommitList();
|
||||
if(commitIdList!=null && commitIdList.size()>0) {
|
||||
//遍历数据入区块链
|
||||
for(String commitId : commitIdList) {
|
||||
CommitCreateVo commitCreateVo = new CommitCreateVo();
|
||||
commitCreateVo.setCommit_id(commitId);
|
||||
commitCreate(commitCreateVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AjaxResult commitCreate(CommitCreateVo commitCreateVo) {
|
||||
Map<String, Object> res = projectResourceLibraryMapper.selectCommitInfo(commitCreateVo.getCommit_id());
|
||||
JSONObject params = JSONObject.from(res);
|
||||
params.put(REQUEST_TYPE, CREATE_COMMIT);
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
String txHash = rsp.getString(TX_HASH);
|
||||
// insert to db 4、 :数据入链表(id,type,type_id,tx_hash,create_time) (type:issue,type_id:issue_id)
|
||||
if (StringUtils.isNotEmpty(txHash)) {
|
||||
InBlockchainData inBlockchainData = new InBlockchainData();
|
||||
inBlockchainData.setType("commit");
|
||||
inBlockchainData.setTxHash(txHash);
|
||||
inBlockchainData.setTypeId(commitCreateVo.getCommit_id());
|
||||
inBlockchainData.setCreateTime(DateUtils.getNowDate());
|
||||
inBlockchainData.setCreateBy(SecurityUtils.getUsername());
|
||||
inBlockchainDataMapper.insertInBlockchainData(inBlockchainData);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> commitDataList(BlockchainListQueryVo queryVo) {
|
||||
return inBlockchainDataMapper.commitDataList(queryVo);
|
||||
}
|
||||
|
|
|
@ -121,4 +121,7 @@ public interface IAchievementsService {
|
|||
AchDetailVo getAreaDetail(String areaKey, String kyxm);
|
||||
|
||||
List<KeyValVo<String, Long>> get7DayAddExport(AchQueryVo achQueryVo);
|
||||
|
||||
List<KeyValueVo> getAllAreas(String areaName);
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.microservices.dms.resourceLibrary.mapper.ProjectResourceLibraryMapper
|
|||
import com.microservices.dms.resourceLibrary.mapper.TaskResourceLibraryMapper;
|
||||
import com.microservices.dms.utils.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.checkerframework.checker.units.qual.K;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
@ -458,7 +459,19 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
|
||||
@Override
|
||||
public List<AreaStatisticVo> getAreaStatistic(String areaKey) {
|
||||
return achievementsMapper.getAreaStatistic(areaKey);
|
||||
List<AreaStatisticVo> areaStatisticVoList = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(areaKey)) {
|
||||
//根据逗号进行分割
|
||||
String[] res =areaKey.split(",");
|
||||
for (String s : res) {
|
||||
String[] ss = s.split("_");
|
||||
List<AreaStatisticVo> tmpList = achievementsMapper.getAreaStatistic(ss[1],ss[0]);
|
||||
areaStatisticVoList.addAll(tmpList);
|
||||
}
|
||||
return areaStatisticVoList;
|
||||
}else{
|
||||
return achievementsMapper.getAreaStatistic(null,areaKey);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -593,4 +606,12 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
return achDetailVo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<KeyValueVo> getAllAreas(String areaName) {
|
||||
List<KeyValueVo> resultVal = achievementsMapper.getAllAreas(areaName);
|
||||
return resultVal;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class OpenController extends BaseController {
|
|||
}
|
||||
|
||||
@ApiOperation("七日新增专家")
|
||||
@GetMapping("/achievements/get7DayAddExport")
|
||||
@GetMapping("/achievements/get7DayAddExpert")
|
||||
public AjaxResult get7DayAddExport(AchQueryVo achQueryVo) {
|
||||
return success(achievementsService.get7DayAddExport(achQueryVo));
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.microservices.common.core.web.domain.AjaxResult;
|
|||
import com.microservices.common.core.web.page.TableDataInfo;
|
||||
import com.microservices.common.log.annotation.Log;
|
||||
import com.microservices.common.log.enums.BusinessType;
|
||||
import com.microservices.dms.achievementLibrary.domain.AchQueryVo;
|
||||
import com.microservices.dms.resourceLibrary.domain.ExpertResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.service.IExpertResourceLibraryService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -138,4 +139,5 @@ public class ExpertResourceLibraryController extends BaseController
|
|||
public AjaxResult getActDataStatisticById(Long id) {
|
||||
return success(expertResourceLibraryService.getActDataStatisticById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ExpertResourceLibrary extends BaseEntity {
|
|||
private String expertDomain;
|
||||
|
||||
private String titleRank;
|
||||
|
||||
//准入状态
|
||||
private Long status;
|
||||
//评审领域1
|
||||
private String reviewAreaOne;
|
||||
|
|
|
@ -568,6 +568,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getAreaStatistic" resultType="com.microservices.dms.achievementLibrary.domain.AreaStatisticVo">
|
||||
<if test="source == '' or source == null">
|
||||
select
|
||||
z.name as "areaName",
|
||||
z.field_1 as "areaKey",
|
||||
|
@ -605,6 +606,73 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</where>
|
||||
group by z.name, z.field_1, z.remark
|
||||
</if>
|
||||
<if test='source=="1"'>
|
||||
select
|
||||
z.name as "areaName",
|
||||
z.field_1 as "areaKey",
|
||||
z.remark as "remark",
|
||||
sum(z.kyxm) as "kyxmSum",
|
||||
sum(z.ckrw) as "ckrwSum",
|
||||
sum(z.kfjs) as "kfjsSum",
|
||||
sum(z.xqcg) as "xqcgSum"
|
||||
from (
|
||||
select
|
||||
r.name,
|
||||
r.field_1,
|
||||
r.remark,
|
||||
case when r.source = 1 then tmp else 0 end as "kyxm",
|
||||
case when r.source = 2 then tmp else 0 end as "ckrw",
|
||||
case when r.source = 3 then tmp else 0 end as "kfjs",
|
||||
case when r.source = 4 then tmp else 0 end as "xqcg"
|
||||
from (
|
||||
select c.name,a.source, a.field_1,c.remark,count(1) as "tmp"
|
||||
from achievements a
|
||||
left join project_categories c on a.field_1 = c.id
|
||||
where a.source='1' and a.field_1 is not null and a.field_1 !=""
|
||||
group by c.name, a.source, a.field_1, c.remark
|
||||
) r
|
||||
) z
|
||||
<where>
|
||||
<if test="areaKey != null and areaKey != ''">
|
||||
and z.field_1 = #{areaKey}
|
||||
</if>
|
||||
</where>
|
||||
group by z.name, z.field_1, z.remark
|
||||
</if>
|
||||
<if test='source=="2" or source=="3" or source=="4" '>
|
||||
select
|
||||
z.name as "areaName",
|
||||
z.field_1 as "areaKey",
|
||||
z.remark as "remark",
|
||||
sum(z.kyxm) as "kyxmSum",
|
||||
sum(z.ckrw) as "ckrwSum",
|
||||
sum(z.kfjs) as "kfjsSum",
|
||||
sum(z.xqcg) as "xqcgSum"
|
||||
from (
|
||||
select
|
||||
r.name,
|
||||
r.field_1,
|
||||
r.remark,
|
||||
case when r.source = 1 then tmp else 0 end as "kyxm",
|
||||
case when r.source = 2 then tmp else 0 end as "ckrw",
|
||||
case when r.source = 3 then tmp else 0 end as "kfjs",
|
||||
case when r.source = 4 then tmp else 0 end as "xqcg"
|
||||
from (
|
||||
select c.name, a.source, a.field_1, c.remark,count(1) as tmp
|
||||
from achievements a
|
||||
left join categories c on a.field_1 = c.id
|
||||
where a.source in ('2','3','4') and a.field_1 is not null and a.field_1 !=""
|
||||
group by c.name, a.source, a.field_1, c.remark
|
||||
) r
|
||||
) z
|
||||
<where>
|
||||
<if test="areaKey != null and areaKey != ''">
|
||||
and z.field_1 = #{areaKey}
|
||||
</if>
|
||||
</where>
|
||||
group by z.name, z.field_1, z.remark
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getAllSourceId" resultType="java.lang.Long">
|
||||
|
@ -812,4 +880,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
order by create_time desc
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getAllAreas" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select r.name as "name",GROUP_CONCAT( r.source SEPARATOR ',') as "result"
|
||||
from (
|
||||
select name,CONCAT(id, '_', '2')as source from categories
|
||||
union all
|
||||
select name,CONCAT(id, '_', '1') as source from project_categories
|
||||
)r
|
||||
<where>
|
||||
<if test="areaName != null and areaName != ''">and r.name = #{areaName}</if></where>
|
||||
GROUP BY r.name
|
||||
</select>
|
||||
</mapper>
|
|
@ -56,11 +56,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
inner join issue_statuses it on i.status_id = it.id
|
||||
inner join projects p on i.project_id = p.id
|
||||
inner join repositories r on p.id = r.project_id
|
||||
where p.use_blockchain='1'
|
||||
where p.use_blockchain='1' and i.project_issues_index is not null
|
||||
<if test="projectName != null and projectName != ''">and p.name like concat('%', #{projectName}, '%')</if>
|
||||
<if test="issueName != null and issueName != ''">and i.subject like concat('%', #{issueName}, '%')</if>
|
||||
</select>
|
||||
|
||||
<select id="getNeedToBlockCommitList" resultType="String">
|
||||
select
|
||||
cl.commit_id as "commit_id"
|
||||
from commit_logs cl
|
||||
inner join projects p on cl.project_id = p.id
|
||||
left join repositories re on cl.repository_id = re.id
|
||||
left join in_blockchain_data ibd on cl.commit_id = ibd.type_id
|
||||
where p.use_blockchain = '1' and ibd.tx_hash is null
|
||||
</select>
|
||||
|
||||
<select id="commitDataList" resultType="java.util.Map">
|
||||
select cl.commit_id as "commit_id",
|
||||
cl.repository_id as "repo_id",
|
||||
|
|
Loading…
Reference in New Issue