加上必要的注释
This commit is contained in:
parent
9b5c05fec0
commit
16d38beea2
|
@ -36,17 +36,26 @@ public class NotificationController {
|
|||
* @param receiver
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/{type}")
|
||||
public ResponseData index(@PathVariable(name = "type", required = true) String type,
|
||||
@GetMapping(value = "/{platform}/{type}")
|
||||
public ResponseData index(@PathVariable(name = "platform", required = true) String platform,
|
||||
@PathVariable(name = "type", required = true) String type,
|
||||
@RequestParam(name = "receiver", required = true) Integer receiver,
|
||||
@RequestParam(name = "page", required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "size", required = false, defaultValue = "20") Integer pageSize) {
|
||||
|
||||
//验证 {platform} 参数合法性,以判断请求来源
|
||||
if (!platform.trim().toLowerCase().equals(PLATFORM_CODE_GITLINK)) {
|
||||
logger.debug("------>输入参数 {platform} 的值 {" + platform + "} 无效");
|
||||
DataPacketUtil.jsonFailResult("参数 {platform} 非法");
|
||||
}
|
||||
|
||||
//验证 {receiver} 参数合法性
|
||||
if (receiver <= 0 || receiver >= Integer.MAX_VALUE) {
|
||||
logger.debug("------>输入参数 {receiver} 的值 {" + receiver + "} 超出约定范围");
|
||||
DataPacketUtil.jsonFailResult("参数 {receiver} 非法");
|
||||
}
|
||||
|
||||
//判断 {type} 参数合法性,正确的值只能是 list、count
|
||||
if (type.trim().toLowerCase().equals("list")) {
|
||||
//用户请求的是 list
|
||||
logger.debug("------>{type} 参数是 list");
|
||||
|
@ -54,7 +63,7 @@ public class NotificationController {
|
|||
//TODO: 获取约定的必要参数
|
||||
|
||||
//调用业务逻辑获取数据结果
|
||||
List<SysNotification> foundList = notificationService.getUnreadSysNotificationsList(PLATFORM_CODE_GITLINK, receiver, pageSize);
|
||||
List<SysNotification> foundList = notificationService.getUnreadSysNotificationsList(platform, receiver, pageSize);
|
||||
|
||||
//拼装约定的 json 格式并返回
|
||||
return DataPacketUtil.jsonSuccessResult(foundList);
|
||||
|
@ -65,7 +74,7 @@ public class NotificationController {
|
|||
//TODO: 获取必要的参数
|
||||
|
||||
//调用业务逻辑获取数据结果
|
||||
Integer foundCount = notificationService.getSysNotificationNumberByType(PLATFORM_CODE_GITLINK, receiver, 1);
|
||||
Integer foundCount = notificationService.getSysNotificationNumberByType(platform, receiver, 1);
|
||||
|
||||
//拼装约定的 json 格式并返回
|
||||
return DataPacketUtil.jsonSuccessResult(foundCount);
|
||||
|
|
Loading…
Reference in New Issue