Merge remote-tracking branch 'origin/master'

This commit is contained in:
tonglin 2023-01-09 11:24:14 +08:00
commit d6e82c9350
8 changed files with 47 additions and 8 deletions

View File

@ -1,6 +1,7 @@
package com.gitlink.softbot.service.market.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -210,8 +211,8 @@ public class MarketService implements IMarketService {
.eq(Bot::getId,botId));
MarketBot marketBot = marketBotMapper.selectOne(Wrappers.<MarketBot>lambdaQuery()
.eq(MarketBot::getBotId,botId));
BotLimitEvent botLimitEvent = botLimitMapper.selectOne(Wrappers.<BotLimitEvent>lambdaQuery()
.eq(BotLimitEvent::getBotId,botId));
List<BotLimitEvent> botLimitEvents = botLimitMapper.selectList(new QueryWrapper<BotLimitEvent>()
.eq("bot_id",botId));
RegisterBot registerBot = registerMapper.selectOne(Wrappers.<RegisterBot>lambdaQuery()
.eq(RegisterBot::getBotId,botId));
GetBotDetailResponse getBotDetailResponse = new GetBotDetailResponse();
@ -220,7 +221,7 @@ public class MarketService implements IMarketService {
BeanUtils.copyProperties(marketBot,getBotDetailResponse);
}
BeanUtils.copyProperties(registerBot,getBotDetailResponse);
BeanUtils.copyProperties(botLimitEvent,getBotDetailResponse);
getBotDetailResponse.setLimitAndEvents(getLimitFromLimitEvents(botLimitEvents));
return getBotDetailResponse;
}
@ -267,4 +268,45 @@ public class MarketService implements IMarketService {
return marketBotPagesVO;
}
private LimitVO getLimitFromLimitEvents(List<BotLimitEvent> botLimitEvents){
LimitVO limitVO = new LimitVO();
//无权限情况下
if (botLimitEvents.size()==1&&botLimitEvents.get(0).getEvent()==5){
limitVO.setEventPr("");
limitVO.setEventCode("");
limitVO.setJurisDictionCode(2);
limitVO.setJurisDictionPr(2);
}
StringBuffer codeStr = new StringBuffer();
StringBuffer prStr = new StringBuffer();
botLimitEvents.forEach(botLimitEvent -> {
if (botLimitEvent.getEvent()>=3){
prStr.append(botLimitEvent.getEvent());
prStr.append(",");
limitVO.setJurisDictionPr(botLimitEvent.getReadWritePr());
}else {
codeStr.append(botLimitEvent.getEvent());
codeStr.append(",");
limitVO.setJurisDictionCode(botLimitEvent.getReadWriteCode());
}
});
if (codeStr.length()>1){
codeStr.deleteCharAt(codeStr.length()-1);
}else {
limitVO.setJurisDictionCode(2);
}
if (prStr.length()>1){
prStr.deleteCharAt(prStr.length()-1);
}else {
limitVO.setJurisDictionPr(2);
}
limitVO.setEventPr(prStr.toString());
limitVO.setEventCode(codeStr.toString());
log.info("limitVO:{}",limitVO);
return limitVO;
}
}

View File

@ -62,10 +62,7 @@ public class GetBotDetailResponse {
private String marketDesc;
/**
* 权限
* 权限与事件
*/
private Integer readWriteCode;
private Integer readWritePr;
private Integer authCategory;
// private Integer read_write_code;
LimitVO limitAndEvents;
}