bug 3327\3320\3321
This commit is contained in:
parent
26f6534bc1
commit
4a07c4b8d3
|
@ -165,4 +165,6 @@ public interface AchievementsMapper {
|
|||
List<KeyValVo<String, Long>> getExperts(@Param("s") Date s, @Param("e") Date e);
|
||||
|
||||
List<KeyValueVo> getAllAreas(@Param("areaName") String areaName);
|
||||
|
||||
void updateRelationAchievements(@Param("source") String source,@Param("sourceId") Long sourceId);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.microservices.common.datasource.annotation.Slave;
|
|||
import com.microservices.dms.achievementLibrary.domain.BlockchainListQueryVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.InBlockchainData;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 区块链数据入链Mapper接口
|
||||
|
@ -73,4 +74,6 @@ public interface InBlockchainDataMapper
|
|||
List<Map<String, Object>> prDataList(BlockchainListQueryVo queryVo);
|
||||
|
||||
List<String> getNeedToBlockCommitList();
|
||||
|
||||
List<String> getCommitListById(@Param("projectId") String projectId);
|
||||
}
|
||||
|
|
|
@ -21,14 +21,17 @@ public class BigScreenStatisticService {
|
|||
private final CompetitionResourceLibraryMapper competitionResourceLibraryMapper;
|
||||
|
||||
public Map<String, Object> getAchievementTopStatistic(String source) {
|
||||
//获取本周(近7天)的数据
|
||||
Date[] days = DateUtil.getDays(0, 6);
|
||||
Map<String, Long> m = achievementsMapper.getAchievement(days[0], days[1], source)
|
||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||
List<String> dateStr = DateUtil.getDateStrMMDD(days[0], days[1]);
|
||||
//获取上周(7-14天前)的数据
|
||||
Date[] lastDays = DateUtil.getDays(7, 13);
|
||||
long lastSum = Optional.ofNullable(achievementsMapper.countAchievementBySource(lastDays[0], lastDays[1], source)).orElse(0L);
|
||||
long sum = Optional.ofNullable(achievementsMapper.countAchievementBySource(null, null, source)).orElse(0L);
|
||||
long cSum = m.values().stream().mapToLong(Long::longValue).sum();
|
||||
//计算本周/上周增长%
|
||||
double rate;
|
||||
if (lastSum == 0) rate = 100D;
|
||||
else {
|
||||
|
|
|
@ -355,7 +355,7 @@ public class BlockChainService {
|
|||
}
|
||||
|
||||
//定时任务,将commit数据入链
|
||||
@Scheduled(cron = "${cron.commitPushBlock}")
|
||||
// @Scheduled(cron = "${cron.commitPushBlock}")
|
||||
public void commitPushBlock() {
|
||||
//先查询需要入链的数据
|
||||
List<String> commitIdList = inBlockchainDataMapper.getNeedToBlockCommitList();
|
||||
|
@ -370,7 +370,26 @@ public class BlockChainService {
|
|||
}
|
||||
|
||||
public AjaxResult commitCreate(CommitCreateVo commitCreateVo) {
|
||||
Map<String, Object> res = projectResourceLibraryMapper.selectCommitInfo(commitCreateVo.getCommit_id());
|
||||
List<String> commitIdList = new ArrayList<>();
|
||||
if(StringUtils.isEmpty(commitCreateVo.getCommit_id())) {
|
||||
String projectId = commitCreateVo.getProject_id();
|
||||
if (StringUtils.isNotEmpty(projectId)) {
|
||||
commitIdList = inBlockchainDataMapper.getCommitListById(projectId);
|
||||
}
|
||||
}else{
|
||||
commitIdList.add(commitCreateVo.getCommit_id());
|
||||
}
|
||||
if(commitIdList!=null && commitIdList.size()>0) {
|
||||
for(String commitId : commitIdList) {
|
||||
commitDataTnBlock(commitId);
|
||||
}
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
private AjaxResult commitDataTnBlock(String commitId) {
|
||||
//根据项目id,查询对应的需要入链的commit
|
||||
Map<String, Object> res = projectResourceLibraryMapper.selectCommitInfo(commitId);
|
||||
JSONObject params = JSONObject.from(res);
|
||||
params.put(REQUEST_TYPE, CREATE_COMMIT);
|
||||
Map<String, String> p = convertParams(params);
|
||||
|
@ -383,7 +402,7 @@ public class BlockChainService {
|
|||
InBlockchainData inBlockchainData = new InBlockchainData();
|
||||
inBlockchainData.setType("commit");
|
||||
inBlockchainData.setTxHash(txHash);
|
||||
inBlockchainData.setTypeId(commitCreateVo.getCommit_id());
|
||||
inBlockchainData.setTypeId(commitId);
|
||||
inBlockchainData.setCreateTime(DateUtils.getNowDate());
|
||||
inBlockchainData.setCreateBy(SecurityUtils.getUsername());
|
||||
inBlockchainDataMapper.insertInBlockchainData(inBlockchainData);
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.microservices.common.core.utils.StringUtils;
|
|||
import com.microservices.common.httpClient.service.HttpAPIService;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.*;
|
||||
import com.microservices.dms.achievementLibrary.mapper.SchoolEnterpriseAchievementsMapper;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementImageVo;
|
||||
import com.microservices.dms.behaviorImage.service.IBehaviorImageService;
|
||||
|
@ -19,6 +20,7 @@ import com.microservices.dms.resourceLibrary.domain.CompetitionResourceLibrary;
|
|||
import com.microservices.dms.resourceLibrary.domain.Searcher;
|
||||
import com.microservices.dms.resourceLibrary.domain.TaskResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import com.microservices.dms.resourceLibrary.mapper.CompetitionResourceLibraryMapper;
|
||||
import com.microservices.dms.resourceLibrary.mapper.ExpertResourceLibraryMapper;
|
||||
import com.microservices.dms.resourceLibrary.mapper.ProjectResourceLibraryMapper;
|
||||
import com.microservices.dms.resourceLibrary.mapper.TaskResourceLibraryMapper;
|
||||
|
@ -53,6 +55,7 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
@Autowired
|
||||
private ExpertResourceLibraryMapper expertResourceLibraryMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IBehaviorImageService behaviorImageService;
|
||||
|
||||
|
@ -189,6 +192,14 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
*/
|
||||
@Override
|
||||
public int deleteAchievementsById(Long id) {
|
||||
//根据id,获取数据仓库该数据信息
|
||||
Achievements achievements = achievementsMapper.selectAchievementsById(id);
|
||||
if(achievements != null){
|
||||
String source = achievements.getSource();
|
||||
if(StringUtils.isNotEmpty(source)) {
|
||||
achievementsMapper.updateRelationAchievements(source,achievements.getSourceId());
|
||||
}
|
||||
}
|
||||
return achievementsMapper.deleteAchievementsById(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,13 @@ public class SchoolEnterpriseAchievementsServiceImpl implements ISchoolEnterpris
|
|||
public int updateSchoolEnterpriseAchievements(SchoolEnterpriseAchievements schoolEnterpriseAchievements)
|
||||
{
|
||||
schoolEnterpriseAchievements.setUpdateTime(DateUtils.getNowDate());
|
||||
String status = schoolEnterpriseAchievements.getStatus();
|
||||
if(StringUtils.isNotEmpty(status)){
|
||||
schoolEnterpriseAchievements.setReviewDate(DateUtils.getNowDate());
|
||||
if (SecurityUtils.getLoginUser() != null) {
|
||||
schoolEnterpriseAchievements.setReviewer(SecurityUtils.getLoginUser().getUsername());
|
||||
}
|
||||
}
|
||||
return schoolEnterpriseAchievementsMapper.updateSchoolEnterpriseAchievements(schoolEnterpriseAchievements);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.microservices.dms.common.vo;
|
|||
public class CommitCreateVo {
|
||||
private String commit_id;
|
||||
|
||||
private String project_id;
|
||||
|
||||
public String getCommit_id() {
|
||||
return commit_id;
|
||||
}
|
||||
|
@ -10,4 +12,12 @@ public class CommitCreateVo {
|
|||
public void setCommit_id(String commit_id) {
|
||||
this.commit_id = commit_id;
|
||||
}
|
||||
|
||||
public String getProject_id() {
|
||||
return project_id;
|
||||
}
|
||||
|
||||
public void setProject_id(String project_id) {
|
||||
this.project_id = project_id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -892,4 +892,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="areaName != null and areaName != ''">and r.name = #{areaName}</if></where>
|
||||
GROUP BY r.name
|
||||
</select>
|
||||
|
||||
<update id="updateRelationAchievements">
|
||||
<if test='source != null and source == "1"'>
|
||||
update project_resource_library set is_transferred_to_achievement='0' ,transfer_date=null where id = #{sourceId}
|
||||
</if>
|
||||
<if test='source != null and source == "2"'>
|
||||
update task_resource_library set is_transferred_to_results_library='0' ,transfer_to_results_date=null where id = #{sourceId}
|
||||
</if>
|
||||
<if test='source != null and source == "3"'>
|
||||
update competition_resource_library set is_transferred_to_result_library='0' ,transferred_to_result_library_time=null where id = #{sourceId}
|
||||
</if>
|
||||
<if test='source != null and source == "4"'>
|
||||
update school_enterprise_achievements set status=null ,review_comments=null,review_date=null,reviewer=null where id = #{sourceId}
|
||||
</if>
|
||||
</update>
|
||||
</mapper>
|
|
@ -61,15 +61,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<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",
|
||||
|
@ -154,4 +145,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<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="getCommitListById" resultType="String">
|
||||
select
|
||||
cl.commit_id as "commit_id",ibd.tx_hash from commit_logs cl
|
||||
inner join projects p on cl.project_id = p.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 and p.id = #{projectId}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue