Skip to content

Commit

Permalink
bug fix: RequestMapping instead of GetMapping/PostMapping (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
caseone committed Mar 19, 2021
1 parent 3935b77 commit f991f09
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ public void setDiscoveryClient(DiscoveryClient discoveryClient) {
this.discoveryClient = discoveryClient;
}

@GetMapping(path = "/listGroup")
@RequestMapping(path = "/listGroup")
public BaseResponse<List<String>> listGroup() throws BrokerException {
return BaseResponse.buildSuccess(this.consumer.listGroupId());
}

@GetMapping(path = "/listNodes")
@RequestMapping(path = "/listNodes")
public BaseResponse<List<String>> listNodes() {
log.info("query node list");

Expand All @@ -92,7 +92,7 @@ public BaseResponse<List<String>> listNodes() {
return BaseResponse.buildSuccess(nodesInfo);
}

@GetMapping(path = "/listSubscription")
@RequestMapping(path = "/listSubscription")
public BaseResponse<Map<String, List<SubscriptionInfo>>> listSubscription(@RequestParam(name = "nodeInstances") String nodeInstances,
@RequestParam(name = "groupId", required = false) String groupId) {
log.info("groupId:{}, nodeInstances:{}", groupId, nodeInstances);
Expand Down Expand Up @@ -133,22 +133,22 @@ public BaseResponse<Map<String, List<SubscriptionInfo>>> listSubscription(@Reque
return BaseResponse.buildSuccess(subscriptions);
}

@GetMapping(path = "/innerListSubscription")
@RequestMapping(path = "/innerListSubscription")
public BaseResponse<Map<String, SubscriptionInfo>> innerListSubscription(@RequestParam(name = "groupId", required = false) String groupId) throws BrokerException {
log.info("groupId: {}", groupId);

return BaseResponse.buildSuccess(this.consumer.listSubscription(groupId));
}

@GetMapping(path = "/getVersion")
@RequestMapping(path = "/getVersion")
public BaseResponse<BuildInfo> getVersion() {
return BaseResponse.buildSuccess(this.buildInfo);
}

/**
* get general
*/
@GetMapping(path = "/group/general")
@RequestMapping(path = "/group/general")
public BaseResponse<GroupGeneral> getGroupGeneral(@RequestParam(value = "groupId", required = false) String groupId) throws BrokerException {
log.info("groupId: {}", groupId);

Expand All @@ -161,7 +161,7 @@ public BaseResponse<GroupGeneral> getGroupGeneral(@RequestParam(value = "groupId
/**
* query transaction list.
*/
@GetMapping(path = "/transaction/transList")
@RequestMapping(path = "/transaction/transList")
public BaseResponse<ListPage<TbTransHash>> queryTransList(@RequestParam(value = "groupId", required = false) String groupId,
@RequestParam("pageNumber") Integer pageNumber,
@RequestParam("pageSize") Integer pageSize,
Expand All @@ -179,7 +179,7 @@ public BaseResponse<ListPage<TbTransHash>> queryTransList(@RequestParam(value =
/**
* query block list.
*/
@GetMapping(path = "/block/blockList")
@RequestMapping(path = "/block/blockList")
public BaseResponse<ListPage<TbBlock>> queryBlockList(@RequestParam(value = "groupId", required = false) String groupId,
@RequestParam("pageNumber") Integer pageNumber,
@RequestParam("pageSize") Integer pageSize,
Expand All @@ -196,7 +196,7 @@ public BaseResponse<ListPage<TbBlock>> queryBlockList(@RequestParam(value = "gro
/**
* query node info list.
*/
@GetMapping(path = "/node/nodeList")
@RequestMapping(path = "/node/nodeList")
public BaseResponse<ListPage<TbNode>> queryNodeList(@RequestParam(value = "groupId", required = false) String groupId,
@RequestParam("pageNumber") Integer pageNumber,
@RequestParam("pageSize") Integer pageSize,
Expand All @@ -215,7 +215,7 @@ public BaseResponse<ListPage<TbNode>> queryNodeList(@RequestParam(value = "group
/**
* query ContractContext.
*/
@GetMapping(path = "/getContractContext")
@RequestMapping(path = "/getContractContext")
public BaseResponse<ContractContext> getContractContext(@RequestParam(value = "groupId", required = false) String groupId) throws BrokerException {
log.info("groupId: {} ", groupId);

Expand All @@ -225,7 +225,7 @@ public BaseResponse<ContractContext> getContractContext(@RequestParam(value = "g
/**
* validateGroupId.
*/
@GetMapping(path = "/validateGroupId")
@RequestMapping(path = "/validateGroupId")
public BaseResponse<ErrorCode> validateGroupId(@RequestParam(value = "groupId") String groupId) throws BrokerException {
log.info("groupId: {} ", groupId);
this.consumer.validateGroupId(groupId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void setProducer(IProducer producer) {
this.producer = producer;
}

@GetMapping(path = "/publish")
@RequestMapping(path = "/publish")
public CompletableFuture<SendResult> publish(@RequestParam Map<String, String> eventData) throws BrokerException {
if (!eventData.containsKey(WeEventConstants.EVENT_TOPIC)
|| !eventData.containsKey(WeEventConstants.EVENT_CONTENT)) {
Expand All @@ -66,39 +66,39 @@ public CompletableFuture<SendResult> publish(@RequestParam Map<String, String> e
return this.producer.publish(event, groupId);
}

@GetMapping(path = "/getEvent")
@RequestMapping(path = "/getEvent")
public BaseResponse<WeEvent> getEvent(@RequestParam(name = "eventId") String eventId,
@RequestParam(name = "groupId", required = false) String groupId) throws BrokerException {
log.info("eventId:{} groupId:{}", eventId, groupId);

return BaseResponse.buildSuccess(this.producer.getEvent(eventId, groupId));
}

@GetMapping(path = "/open")
@RequestMapping(path = "/open")
public BaseResponse<Boolean> open(@RequestParam(name = "topic") String topic,
@RequestParam(name = "groupId", required = false) String groupId) throws BrokerException {
log.info("topic:{} groupId:{}", topic, groupId);

return BaseResponse.buildSuccess(this.producer.open(topic, groupId));
}

@GetMapping(path = "/close")
@RequestMapping(path = "/close")
public BaseResponse<Boolean> close(@RequestParam(name = "topic") String topic,
@RequestParam(name = "groupId", required = false) String groupId) throws BrokerException {
log.info("topic:{} groupId:{}", topic, groupId);

return BaseResponse.buildSuccess(this.producer.close(topic, groupId));
}

@GetMapping(path = "/exist")
@RequestMapping(path = "/exist")
public BaseResponse<Boolean> exist(@RequestParam(name = "topic") String topic,
@RequestParam(name = "groupId", required = false) String groupId) throws BrokerException {
log.info("topic:{} groupId:{}", topic, groupId);

return BaseResponse.buildSuccess(this.producer.exist(topic, groupId));
}

@GetMapping(path = "/list")
@RequestMapping(path = "/list")
public BaseResponse<TopicPage> list(@RequestParam(name = "pageIndex") Integer pageIndex,
@RequestParam(name = "pageSize") Integer pageSize,
@RequestParam(name = "groupId", required = false) String groupId) throws BrokerException {
Expand All @@ -107,7 +107,7 @@ public BaseResponse<TopicPage> list(@RequestParam(name = "pageIndex") Integer pa
return BaseResponse.buildSuccess(this.producer.list(pageIndex, pageSize, groupId));
}

@GetMapping(path = "/state")
@RequestMapping(path = "/state")
public BaseResponse<TopicInfo> state(@RequestParam(name = "topic") String topic,
@RequestParam(name = "groupId", required = false) String groupId) throws BrokerException {
log.info("topic:{} groupId:{}", topic, groupId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void setDiscoveryClient(DiscoveryClient discoveryClient) {
}

// get all services in register
@GetMapping("/list")
@RequestMapping("/list")
public Mono<Map<String, List<NamingService>>> list() {
Map<String, List<NamingService>> output = new HashMap<>();
List<String> services = this.discoveryClient.getServices();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public class AccountController {
@Autowired
private AccountService accountService;

@GetMapping("/check/{param}/{type}")
@RequestMapping("/check/{param}/{type}")
public GovernanceResult<Object> checkData(@PathVariable String param, @PathVariable Integer type) {
return accountService.checkData(param, type);
}

@PostMapping(value = "/register")
@RequestMapping("/register")
public GovernanceResult<Object> register(@Valid @RequestBody AccountEntity user, BindingResult result) throws GovernanceException {
return accountService.register(user);
}
Expand All @@ -58,15 +58,15 @@ public GovernanceResult<Object> getUserId(@RequestParam String username) {
return accountService.getUserId(username);
}

@GetMapping("/require")
@RequestMapping("/require")
public BaseResponse authRequire() {
return new BaseResponse(ConstantCode.USER_NOT_LOGGED_IN);
}

/**
* Query all account except themselves
*/
@GetMapping("/accountList")
@RequestMapping("/accountList")
public GovernanceResult<List<AccountEntity>> accountEntityList(AccountEntity accountEntity, HttpServletRequest request,
HttpServletResponse response) throws GovernanceException {
List<AccountEntity> accountEntities = accountService.accountEntityList(request, accountEntity, JwtUtils.getAccountId(request));
Expand All @@ -76,7 +76,7 @@ public GovernanceResult<List<AccountEntity>> accountEntityList(AccountEntity acc
/**
* delete user by id
*/
@PostMapping("/delete")
@RequestMapping("/delete")
public GovernanceResult<Boolean> deleteUser(@RequestBody AccountEntity accountEntity, HttpServletRequest request,
HttpServletResponse response) throws GovernanceException {
accountService.deleteUser(request, accountEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public GovernanceResult<List<Integer>> prepareUploadFile(@RequestParam(name = "g
return this.fileService.prepareUploadFile(fileId, filename, topicName, groupId, totalSize, chunkSize);
}

@GetMapping(path = "/download")
@RequestMapping(path = "/download")
public void download(@RequestParam(name = "groupId") String groupId,
@RequestParam(name = "topic") String topic,
@RequestParam(name = "fileName") String fileName,
Expand Down Expand Up @@ -129,7 +129,7 @@ public void download(@RequestParam(name = "groupId") String groupId,
}
}

@GetMapping(path = "/listFile")
@RequestMapping(path = "/listFile")
@ResponseBody
public GovernanceResult<List<FileChunksMeta>> listFile(@RequestParam(name = "groupId") String groupId,
@RequestParam(name = "brokerId") Integer brokerId,
Expand All @@ -140,7 +140,7 @@ public GovernanceResult<List<FileChunksMeta>> listFile(@RequestParam(name = "gro
return this.fileService.listFile(groupId, brokerId, topicName, nodeAddress);
}

@GetMapping(path = "/downLoadStatus")
@RequestMapping(path = "/downLoadStatus")
@ResponseBody
public GovernanceResult<List<FileChunksMetaEntity>> downLoadStatus(@RequestParam(name = "groupId") String groupId,
@RequestParam(name = "brokerId") Integer brokerId,
Expand All @@ -151,7 +151,7 @@ public GovernanceResult<List<FileChunksMetaEntity>> downLoadStatus(@RequestParam
return this.fileService.downLoadStatus(groupId, brokerId, topicName, nodeAddress);
}

@GetMapping(path = "/uploadStatus")
@RequestMapping(path = "/uploadStatus")
@ResponseBody
public GovernanceResult<List<FileTransportStatusEntity>> uploadStatus(@RequestParam(name = "groupId") String groupId,
@RequestParam(name = "brokerId") Integer brokerId,
Expand All @@ -161,7 +161,7 @@ public GovernanceResult<List<FileTransportStatusEntity>> uploadStatus(@RequestPa
return this.fileService.uploadStatus(groupId, brokerId, topicName, nodeAddress);
}

@GetMapping(path = "/listTransport")
@RequestMapping(path = "/listTransport")
@ResponseBody
public GovernanceResult<List<FileTransportChannelEntity>> listTransport(@RequestParam(name = "groupId") String groupId,
@RequestParam(name = "brokerId") Integer brokerId) {
Expand All @@ -177,7 +177,7 @@ public GovernanceResult<Boolean> closeTransport(@RequestBody FileTransportChanne
return fileService.closeTransport(fileTransport);
}

@GetMapping(path = "/genPemFile")
@RequestMapping(path = "/genPemFile")
public void genPemFile(@RequestParam(name = "groupId") String groupId,
@RequestParam(name = "brokerId") Integer brokerId,
@RequestParam(name = "encryptType") String encryptType,
Expand Down Expand Up @@ -222,7 +222,7 @@ public void genPemFile(@RequestParam(name = "groupId") String groupId,
}
}

@GetMapping(path = "/checkUploaded")
@RequestMapping(path = "/checkUploaded")
@ResponseBody
public GovernanceResult<Object> checkFileIsUploaded(@RequestParam(name = "groupId") String groupId,
@RequestParam(name = "brokerId") Integer brokerId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,30 @@ public class TopicController {
@Autowired
private TopicService topicService;

@GetMapping(value = "/close")
@RequestMapping(value = "/close")
public GovernanceResult<Boolean> close(@RequestParam("brokerId") Integer brokerId, @RequestParam String topic,
@RequestParam(required = false) String groupId, HttpServletRequest request, HttpServletResponse response)
throws GovernanceException {
log.info("close topic ,brokerId:{},topic:{},groupId:{}", brokerId, topic, groupId);
return new GovernanceResult<>(topicService.close(brokerId, topic, groupId, request, response));
}

@PostMapping(value = "/list")
@RequestMapping(value = "/list")
public GovernanceResult<TopicPage> getTopics(@Validated @RequestBody TopicPageEntity topicPageEntity,
HttpServletRequest request, HttpServletResponse response) throws GovernanceException {
log.info("get topic list,topicPageEntity:{}", topicPageEntity);
return new GovernanceResult<>(topicService.getTopics(topicPageEntity, request, response));
}

@PostMapping(value = "/openTopic")
@RequestMapping(value = "/openTopic")
public GovernanceResult<Object> open(@RequestBody TopicCreateEntity topicCreateEntity, HttpServletRequest request,
HttpServletResponse response) throws GovernanceException {
log.info("open topic creator:{} ,topic:{}", topicCreateEntity.getCreater(), topicCreateEntity.getTopic());
return topicService.open(topicCreateEntity.getBrokerId(), topicCreateEntity.getTopic(),
topicCreateEntity.getCreater(), topicCreateEntity.getGroupId(), request, response);
}

@GetMapping(value = "/topicInfo")
@RequestMapping(value = "/topicInfo")
public GovernanceResult<TopicEntity> getTopicInfo(@RequestParam(name = "brokerId") Integer brokerId,
@RequestParam(name = "topic") String topic,
@RequestParam(name = "groupId", required = false) String groupId, HttpServletRequest request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public BaseRspEntity startCEPRule(@Valid @RequestBody CEPRule rule) {
return resEntity;
}

@GetMapping(value = "/checkWhereCondition")
@RequestMapping(value = "/checkWhereCondition")
public BaseRspEntity checkWhereCondition(@RequestParam(name = "payload") String payload, @RequestParam(name = "condition") String condition) {
BaseRspEntity resEntity = new BaseRspEntity(ConstantsHelper.RET_SUCCESS);
RetCode ret = CEPRuleMQ.checkCondition(payload, condition);
Expand All @@ -137,7 +137,7 @@ public BaseRspEntity checkWhereCondition(@RequestParam(name = "payload") String
return resEntity;
}

@GetMapping(value = "/getJobDetail")
@RequestMapping(value = "/getJobDetail")
public BaseRspEntity getJobDetail(@RequestParam(name = "id") String id) {
BaseRspEntity resEntity = new BaseRspEntity(ConstantsHelper.RET_SUCCESS);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public TimerSchedulerController(TimerSchedulerService timerSchedulerService) {
this.timerSchedulerService = timerSchedulerService;
}

@PostMapping("/insert")
@RequestMapping("/insert")
public BaseRspEntity insertTimerScheduler(@Validated @RequestBody TimerScheduler timerScheduler) throws BrokerException {
BaseRspEntity resEntity = new BaseRspEntity(ConstantsHelper.RET_SUCCESS);
JobDataMap timerSchedulerMap = new JobDataMap();
Expand All @@ -50,7 +50,7 @@ public BaseRspEntity insertTimerScheduler(@Validated @RequestBody TimerScheduler
return resEntity;
}

@PostMapping("/update")
@RequestMapping("/update")
public BaseRspEntity updateTimerScheduler(@Validated @RequestBody TimerScheduler timerScheduler) throws BrokerException {
BaseRspEntity resEntity = new BaseRspEntity(ConstantsHelper.RET_SUCCESS);
JobDataMap timerSchedulerMap = new JobDataMap();
Expand All @@ -66,14 +66,14 @@ public BaseRspEntity updateTimerScheduler(@Validated @RequestBody TimerScheduler
return resEntity;
}

@PostMapping("/delete")
@RequestMapping("/delete")
public BaseRspEntity deleteTimerScheduler(@RequestBody TimerScheduler timerScheduler) throws BrokerException {
BaseRspEntity resEntity = new BaseRspEntity(ConstantsHelper.RET_SUCCESS);
this.timerSchedulerService.deleteTimerScheduler(timerScheduler);
return resEntity;
}

@GetMapping("/checkCorn")
@RequestMapping("/checkCorn")
public BaseRspEntity checkCorn(@RequestParam("corn") String corn) {
BaseRspEntity resEntity = new BaseRspEntity(ConstantsHelper.RET_SUCCESS);
boolean validExpression = CronExpression.isValidExpression(corn);
Expand Down

0 comments on commit f991f09

Please sign in to comment.