update alph收益相关数据更新

This commit is contained in:
jxy_duyi 2025-04-18 18:27:53 +08:00
parent de4788319b
commit 7f1175e9bd
6 changed files with 46 additions and 6 deletions

View File

@ -201,7 +201,6 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.6</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>

View File

@ -69,7 +69,7 @@ public class ReadOnlyController extends BaseController {
} }
@DeleteMapping("/delPage") @DeleteMapping("/delPage")
@ApiOperation(value = "修改只读页面 只能修改备注和权限") @ApiOperation(value = "删除只读页面")
@RequiresLogin @RequiresLogin
public AjaxResult delPage(@Valid @RequestBody ReadOnlyKeyVo vo){ public AjaxResult delPage(@Valid @RequestBody ReadOnlyKeyVo vo){

View File

@ -546,7 +546,6 @@ public class MinerAccountServiceImpl implements MinerAccountService {
List<ProfitDto> list = distributionMapper.getDayDistributionByMinerAccount(dto.getCoin(), dto.getAccount()); List<ProfitDto> list = distributionMapper.getDayDistributionByMinerAccount(dto.getCoin(), dto.getAccount());
//查询挖矿账户每日0点的算力 查询结果需要-1 才能代表当天的算力 //查询挖矿账户每日0点的算力 查询结果需要-1 才能代表当天的算力
List<PowerLineDto> mhsList = poolMapper.get24hAccountPowerListByAccount(dto.getCoin() + "_users_24h", dto.getAccount()); List<PowerLineDto> mhsList = poolMapper.get24hAccountPowerListByAccount(dto.getCoin() + "_users_24h", dto.getAccount());
//查询账号每日0点24h算力 //查询账号每日0点24h算力
List<IncomeDto> returnList = list.stream().map(e -> { List<IncomeDto> returnList = list.stream().map(e -> {
IncomeDto income = new IncomeDto(); IncomeDto income = new IncomeDto();
@ -562,7 +561,16 @@ public class MinerAccountServiceImpl implements MinerAccountService {
if(StringUtils.isNotNull(e.getProfit())){ if(StringUtils.isNotNull(e.getProfit())){
income.setAmount(e.getProfit() income.setAmount(e.getProfit()
.setScale(10,BigDecimal.ROUND_HALF_UP)); .setScale(10,BigDecimal.ROUND_HALF_UP));
//alph需要除以10的18次方
if("aplh".equals(dto.getCoin())){
income.setAmount(e.getProfit()
.divide(BigDecimal.valueOf(1000*1000))
.divide(BigDecimal.valueOf(1000*1000))
.divide(BigDecimal.valueOf(1000*1000))
.setScale(10,BigDecimal.ROUND_HALF_UP));
} }
}
return income; return income;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -624,7 +632,15 @@ public class MinerAccountServiceImpl implements MinerAccountService {
int limit = vo.getLimit() < 1 ? 1 : vo.getLimit(); int limit = vo.getLimit() < 1 ? 1 : vo.getLimit();
List<OutcomeDto> pageList = list.stream().skip((page - 1) * limit).limit(limit).collect(Collectors.toList()); List<OutcomeDto> pageList = list.stream().skip((page - 1) * limit).limit(limit).collect(Collectors.toList());
if("aplh".equals(dto.getCoin())){
pageList.stream().forEach(e ->{
e.setAmount(BigDecimal.valueOf(e.getAmount())
.divide(BigDecimal.valueOf(1000*1000))
.divide(BigDecimal.valueOf(1000*1000))
.divide(BigDecimal.valueOf(1000*1000))
.setScale(10,BigDecimal.ROUND_HALF_UP).doubleValue());
});
}
rspData.setRows(pageList); rspData.setRows(pageList);
return rspData; return rspData;

View File

@ -824,6 +824,14 @@ public class ReadOnlyServiceImpl implements ReadOnlyService {
if(StringUtils.isNotNull(e.getProfit())){ if(StringUtils.isNotNull(e.getProfit())){
income.setAmount(e.getProfit() income.setAmount(e.getProfit()
.setScale(10,BigDecimal.ROUND_HALF_UP)); .setScale(10,BigDecimal.ROUND_HALF_UP));
//alph需要除以10的18次方
if("aplh".equals(dto.getCoin())){
income.setAmount(e.getProfit()
.divide(BigDecimal.valueOf(1000*1000))
.divide(BigDecimal.valueOf(1000*1000))
.divide(BigDecimal.valueOf(1000*1000))
.setScale(10,BigDecimal.ROUND_HALF_UP));
}
} }
return income; return income;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -903,6 +911,16 @@ public class ReadOnlyServiceImpl implements ReadOnlyService {
int limit = vo.getLimit() < 1 ? 1 : vo.getLimit(); int limit = vo.getLimit() < 1 ? 1 : vo.getLimit();
List<OutcomeDto> pageList = list.stream().skip((page - 1) * limit).limit(limit).collect(Collectors.toList()); List<OutcomeDto> pageList = list.stream().skip((page - 1) * limit).limit(limit).collect(Collectors.toList());
if("aplh".equals(dto.getCoin())){
pageList.stream().forEach(e ->{
e.setAmount(BigDecimal.valueOf(e.getAmount())
.divide(BigDecimal.valueOf(1000*1000))
.divide(BigDecimal.valueOf(1000*1000))
.divide(BigDecimal.valueOf(1000*1000))
.setScale(10,BigDecimal.ROUND_HALF_UP).doubleValue());
});
}
rspData.setRows(pageList); rspData.setRows(pageList);

View File

@ -621,6 +621,7 @@ public class UserMinerServiceImpl implements UserMinserService {
@Override @Override
public AjaxResult updateApi(ApiKeyUpdateVo vo) { public AjaxResult updateApi(ApiKeyUpdateVo vo) {
System.out.println("入参:"+vo);
String user = SecurityUtils.getUsername(); String user = SecurityUtils.getUsername();
if(StringUtils.isNotBlank(vo.getPerms())){ if(StringUtils.isNotBlank(vo.getPerms())){
if(!vo.getPerms().equals(StringUtils.clean(vo.getPerms()))){ if(!vo.getPerms().equals(StringUtils.clean(vo.getPerms()))){
@ -630,9 +631,11 @@ public class UserMinerServiceImpl implements UserMinserService {
return AjaxResult.error("权限传参不能为空"); return AjaxResult.error("权限传参不能为空");
} }
//todo 判断ip //todo 判断ip
if(StringUtils.isBlank(vo.getIp())){ if(StringUtils.isBlank(vo.getIp())){
vo.setIp(IpUtils.getIpAddr(ServletUtils.getRequest())); vo.setIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
System.out.println("用户未传ip,默认使用本机ip"+vo.getIp());
} }
//ip字段格式校验 //ip字段格式校验
@ -657,6 +660,7 @@ public class UserMinerServiceImpl implements UserMinserService {
return AjaxResult.error("id未找到"); return AjaxResult.error("id未找到");
} }
OpenApiKeyInfo info = openApiService.getOpenApiKeyInfo(userApi.getKey()); OpenApiKeyInfo info = openApiService.getOpenApiKeyInfo(userApi.getKey());
System.out.println("info:"+info);
boolean result = uaMapper.updateApiKey(vo,user); boolean result = uaMapper.updateApiKey(vo,user);
if(result){ if(result){
@ -702,7 +706,11 @@ public class UserMinerServiceImpl implements UserMinserService {
//执行删除 //执行删除
try { try {
uaMapper.batchDeleteAPIByIdsAndUser(ids, email); uaMapper.batchDeleteAPIByIdsAndUser(ids, email);
list.stream().forEach(e ->{openApiService.delOpenApiKey(e.getKey());}); list.stream().forEach(e ->{
if(ids.contains(Convert.toStr(e.getId()))){
openApiService.delOpenApiKey(e.getKey());
}
});
//redis删除api_key相关 //redis删除api_key相关
return AjaxResult.success("删除成功"); return AjaxResult.success("删除成功");

View File

@ -95,7 +95,6 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.6</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>