forked from wanjia9506/soft_bot
gitInstallBot,judgeIsInstallBot接口入参修改:repos -> repoIds
This commit is contained in:
parent
6581a39d41
commit
3f1fccdb59
|
|
@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import com.gitlink.softbot.vo.BotInputVO;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
|
|
@ -205,8 +204,8 @@ public class UserController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/getInstallBot")
|
||||
public Result<?> getInstallBot(@RequestParam("user_id") Integer userId, @RequestParam("bot_id") Integer botId,@RequestParam("login") String login, @RequestParam("repos") String repos ) throws BotException{
|
||||
GetInstallBotRequest getInstallBotRequest = new GetInstallBotRequest(userId, login, botId ,repos);
|
||||
public Result<?> getInstallBot(@RequestParam("user_id") Integer userId, @RequestParam("bot_id") Integer botId,@RequestParam("login") String login, @RequestParam("repoIds") String repoIds) throws BotException{
|
||||
GetInstallBotRequest getInstallBotRequest = new GetInstallBotRequest(userId, login, botId , repoIds);
|
||||
Result<?> result = new Result<>();
|
||||
GetInstallBotResponse getInstallBotResponse = userService.getInstallBot(getInstallBotRequest);
|
||||
return result.build(200).build(getInstallBotResponse).build("get installBot success!");
|
||||
|
|
@ -291,14 +290,14 @@ public class UserController {
|
|||
|
||||
/**
|
||||
* 判断是否安装该bot
|
||||
* @param repos
|
||||
* @param repoIds
|
||||
* @param botId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/judgeIsIntallBot")
|
||||
public Result<?> judgeIsInstallBot(@RequestParam("repos") String repos, @RequestParam("bot_id") Integer botId){
|
||||
public Result<?> judgeIsInstallBot(@RequestParam("repoIds") String repoIds, @RequestParam("bot_id") Integer botId){
|
||||
|
||||
JudgeIsInstallBotResponse judgeIsInstallBotResponse = userService.judgeIsInstallBot(repos,botId);
|
||||
JudgeIsInstallBotResponse judgeIsInstallBotResponse = userService.judgeIsInstallBot(repoIds,botId);
|
||||
Result<JudgeIsInstallBotResponse> result = new Result<>();
|
||||
return result.build(judgeIsInstallBotResponse).build(200).build("success!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public interface IUserService {
|
|||
//拒绝接收转让Bot
|
||||
void refuseTransferBot(RefuseTransferBotRequest refuseTransferBotRequest) throws BotException;
|
||||
//判断是否安装过此bot
|
||||
JudgeIsInstallBotResponse judgeIsInstallBot(String repos, Integer botId);
|
||||
JudgeIsInstallBotResponse judgeIsInstallBot(String repoIds, Integer botId);
|
||||
|
||||
GetAllInstallBotsResponse getAllInstallBots(Integer userId, String repoIds);
|
||||
|
||||
|
|
|
|||
|
|
@ -907,7 +907,7 @@ public class UserService extends AbstractUserBot implements IUserService {
|
|||
//2.到install_bot表中查看state
|
||||
List<InstallBot> installBots = installMapper.selectList(new QueryWrapper<InstallBot>()
|
||||
.eq("bot_id",getInstallBotRequest.getBotId())
|
||||
.in("store_repo", Arrays.asList(getInstallBotRequest.getRepos().split(","))));
|
||||
.in("store_id", Arrays.asList(getInstallBotRequest.getRepoIds().split(","))));
|
||||
assert installBots.size()>0;
|
||||
getInstallBotResponse.setCreateTime(installBots.get(0).getCreateTime());
|
||||
getInstallBotResponse.setState(installBots.get(0).getState());
|
||||
|
|
@ -1142,30 +1142,30 @@ public class UserService extends AbstractUserBot implements IUserService {
|
|||
|
||||
/**
|
||||
* 判断该用户是否安装此bot
|
||||
* @param repos
|
||||
* @param repoIds
|
||||
* @param botId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JudgeIsInstallBotResponse judgeIsInstallBot(String repos, Integer botId) {
|
||||
public JudgeIsInstallBotResponse judgeIsInstallBot(String repoIds, Integer botId) {
|
||||
JudgeIsInstallBotResponse judgeIsInstallBotResponse = new JudgeIsInstallBotResponse();
|
||||
List<String> installRepoList = new ArrayList<>();
|
||||
List<String> unInstallRepoList = new ArrayList<>();
|
||||
List<String> repoList = Arrays.asList(repos.split(","));
|
||||
for (String repo : repoList) {
|
||||
List<String> installRepoIdList = new ArrayList<>();
|
||||
List<String> unInstallRepoIdList = new ArrayList<>();
|
||||
List<String> repoIdList = Arrays.asList(repoIds.split(","));
|
||||
for (String repoId : repoIdList) {
|
||||
//如果公开,则判断安装表里面有没有该用户安装的bot
|
||||
List<InstallBot> installBots = installMapper.selectList(Wrappers.
|
||||
<InstallBot>lambdaQuery().eq(InstallBot::getBotId, botId)
|
||||
.eq(InstallBot::getStoreRepo, repo));
|
||||
.eq(InstallBot::getStoreId, repoId));
|
||||
if (!Objects.isNull(installBots) && installBots.size() > 0) {
|
||||
installRepoList.add(repo);
|
||||
installRepoIdList.add(repoId);
|
||||
} else {
|
||||
unInstallRepoList.add(repo);
|
||||
unInstallRepoIdList.add(repoId);
|
||||
}
|
||||
|
||||
}
|
||||
judgeIsInstallBotResponse.setInstallRepos(installRepoList);
|
||||
judgeIsInstallBotResponse.setUninstallRepos(unInstallRepoList);
|
||||
judgeIsInstallBotResponse.setInstallRepoIds(installRepoIdList);
|
||||
judgeIsInstallBotResponse.setUninstallRepoIds(unInstallRepoIdList);
|
||||
return judgeIsInstallBotResponse;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,5 +24,5 @@ public class GetInstallBotRequest implements Serializable {
|
|||
@NotNull(message = "botId is required")
|
||||
private Integer botId;
|
||||
|
||||
private String repos;
|
||||
private String repoIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class JudgeIsInstallBotResponse {
|
||||
|
||||
private List<String> installRepos;
|
||||
private List<String> installRepoIds;
|
||||
|
||||
private List<String> uninstallRepos;
|
||||
private List<String> uninstallRepoIds;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue