Merge pull request '【资源库-成果库】详情增加用户对接数量' (#882) from liuhuazhong/microservices:feat_chievements_dev into master

This commit is contained in:
wanjia9506 2025-05-26 19:47:24 +08:00
commit 93185be706
5 changed files with 13 additions and 53 deletions

View File

@ -21,11 +21,11 @@ public class BlockChainController extends BaseController {
@Autowired
private IAchievementsService achievementsService;
@GetMapping("/projectTokenList")
@ApiOperation(value = "项目token列表")
public TableDataInfo projectTokenList() {
startPage();
List<TokenListVo> list = achievementsService.projectTokenList();
return getDataTable(list);
}
// @GetMapping("/projectTokenList")
// @ApiOperation(value = "项目token列表")
// public TableDataInfo projectTokenList() {
// startPage();
// List<TokenListVo> list = achievementsService.projectTokenList();
// return getDataTable(list);
// }
}

View File

@ -1,6 +1,8 @@
package com.microservices.dms.achievementLibrary.mapper;
import java.util.List;
import com.microservices.common.datasource.annotation.Slave;
import com.microservices.dms.achievementLibrary.domain.AchievementDictData;
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
import org.apache.ibatis.annotations.Mapper;
@ -13,6 +15,7 @@ import org.apache.ibatis.annotations.Param;
* @date 2025-05-23
*/
@Mapper
@Slave
public interface AchievementDictDataMapper
{
/**

View File

@ -117,7 +117,4 @@ public interface IAchievementsService {
List<TaskResourceLibrary> getRelatedAchTaskOfExpert(Long id);
List<CompetitionResourceLibrary> getRelatedAchCompetitionOfExpert(Long id);
List<TokenListVo> projectTokenList();
}

View File

@ -52,9 +52,6 @@ public class AchievementsServiceImpl implements IAchievementsService {
@Autowired
private ExpertResourceLibraryMapper expertResourceLibraryMapper;
@Autowired
private ProjectResourceLibraryMapper projectResourceLibraryMapper;
@Autowired
private IBehaviorImageService behaviorImageService;
@ -67,12 +64,6 @@ public class AchievementsServiceImpl implements IAchievementsService {
@Value("${http.gatewayUrl}")
public String gatewayUrl;
// @Value("${gitlink.fiscobcosUrl}")
public String fiscobcosUrl;
@Autowired
private HttpAPIService httpAPIService;
/**
* 查询成果
*
@ -557,36 +548,4 @@ public class AchievementsServiceImpl implements IAchievementsService {
public List<String> getExpertAreasByName(String areaName) {
return achievementsMapper.getExpertAreasByName(areaName);
}
@Override
public List<TokenListVo> projectTokenList() {
List<TokenListVo> list = projectResourceLibraryMapper.selectProjectInfos();
for (TokenListVo v : list) {
Long totalToken = queryTotalToken(v);
Long issueTokenSum = projectResourceLibraryMapper.sumProjectIssueToken(v.getId());
v.setCurrentToken(totalToken - issueTokenSum);
v.setTotalToken(totalToken);
}
return list;
}
private Long queryTotalToken(TokenListVo v) {
JSONObject param = new JSONObject();
param.put("request-type",QUERY_REPO);
param.put("token_name",v.getId());
try {
JSONObject reps = httpAPIService.doPost(fiscobcosUrl,param);
if (reps.containsKey("status") && reps.getString("status").equals("0")) {
// Long curSupply = reps.getLong("cur_supply");
return reps.getLong("total_supply");
}
} catch (Exception e) {
log.error("区块链信息查询失败", e);
return -1L;
}
return -1L;
}
}

View File

@ -462,10 +462,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getWatchFavoriteStatusById" resultType="com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo">
select b.watchSum, d.favoriteSum
select b.watchSum, d.favoriteSum,c.userDockingSum
from (
(select count(1) as watchSum from watchers where watchable_type = 'Achievements' and watchable_id = #{id} and user_id=#{userId}) b,
(select count(1) as favoriteSum from favorites where favorite_type = 'Achievements' and favorite_id = #{id} and user_id=#{userId}) d
(select count(1) as favoriteSum from favorites where favorite_type = 'Achievements' and favorite_id = #{id} and user_id=#{userId}) d,
(select count(1) as userDockingSum from clickers where click_type = 'userDocking' and click_id = #{id} and user_id=#{userId}) c
)
</select>