Initial commit
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
package com.oneone.alert.controller;
|
||||
|
||||
import com.oneone.alert.common.AlertConstant;
|
||||
import com.oneone.alert.pojo.entity.ActionData;
|
||||
import com.oneone.alert.service.ActionDataService;
|
||||
import com.oneone.common.result.Result;
|
||||
import com.oneone.common.util.JsonUtils;
|
||||
import com.oneone.common.web.util.UserContext;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 数据收集表
|
||||
* @author mice
|
||||
* @date 2023-05-09 16:58:58
|
||||
* @version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("app-api/v1/actiondata")
|
||||
@Tag(name = "数据收集表管理")
|
||||
public class ActionDataController {
|
||||
|
||||
@Autowired
|
||||
private ActionDataService actionDataService;
|
||||
|
||||
@Autowired
|
||||
private KafkaTemplate<String, Object> kafkaTemplate;
|
||||
|
||||
|
||||
@Operation(summary = "新增数据收集表")
|
||||
@PostMapping("/save")
|
||||
public Result<Boolean> save(@RequestBody ActionData actionData) {
|
||||
actionData.setMemberId(UserContext.getUserIdIfPresentDefault());
|
||||
|
||||
kafkaTemplate.send(AlertConstant.ACTION_DATA_TOPIC, JsonUtils.toJSONString(actionData));
|
||||
// actionDataService.save(actionData)
|
||||
return Result.success(true);
|
||||
}
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.oneone.alert.controller;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.oneone.alert.common.AlertConstant;
|
||||
import com.oneone.alert.pojo.entity.ActionData;
|
||||
import com.oneone.alert.service.ActionDataService;
|
||||
import com.oneone.common.result.Result;
|
||||
import com.oneone.common.util.JsonUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 数据收集表
|
||||
* @author mice
|
||||
* @date 2023-05-09 16:58:58
|
||||
* @version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api/v1/actiondata")
|
||||
@Tag(name = "admin-数据收集表管理")
|
||||
public class AdminActionDataController {
|
||||
|
||||
@Autowired
|
||||
private ActionDataService actionDataService;
|
||||
|
||||
@Autowired
|
||||
private KafkaTemplate<String, Object> kafkaTemplate;
|
||||
|
||||
|
||||
@Operation(summary = "新增数据收集表")
|
||||
@PostMapping("/save")
|
||||
public Result<Boolean> save(@RequestBody ActionData actionData) {
|
||||
kafkaTemplate.send(AlertConstant.ACTION_DATA_TOPIC, JsonUtils.toJSONString(actionData));
|
||||
kafkaTemplate.send("user-behavior", JsonUtils.toJSONString(ImmutableMap.of("action", actionData.getBusinessType())));
|
||||
return Result.success(true);
|
||||
}
|
||||
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package com.oneone.alert.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.oneone.alert.pojo.entity.AlertStage;
|
||||
import com.oneone.alert.service.AlertStageService;
|
||||
import com.oneone.common.result.Result;
|
||||
import com.oneone.common.web.security.annotation.RequiresPermissions;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通知策略
|
||||
* @author mice
|
||||
* @date 2023-03-13 12:03:18
|
||||
* @version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api/v1/alertstage")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "通知策略管理")
|
||||
public class AlertStageController {
|
||||
|
||||
private final AlertStageService alertStageService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param alertStage 通知策略
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@RequiresPermissions("alert:alertstage:list")
|
||||
public Result<IPage<AlertStage>> getAlertStagePage(Page page, AlertStage alertStage) {
|
||||
return Result.success(alertStageService.page(page, Wrappers.query(alertStage)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询通知策略
|
||||
* @param id id
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "通过id查询")
|
||||
@GetMapping("/{id}" )
|
||||
@RequiresPermissions("alert:alertstage:getById")
|
||||
public Result<AlertStage> getById(@PathVariable("id" ) Long id) {
|
||||
return Result.success(alertStageService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知策略
|
||||
* @param alertStage 通知策略
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "新增通知策略")
|
||||
@PostMapping
|
||||
@RequiresPermissions("alert:alertstage:add")
|
||||
public Result<Boolean> save(@RequestBody AlertStage alertStage) {
|
||||
return Result.success(alertStageService.save(alertStage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知策略
|
||||
* @param alertStage 通知策略
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "修改通知策略")
|
||||
@PutMapping
|
||||
@RequiresPermissions("alert:alertstage:edit")
|
||||
public Result<Boolean> updateById(@RequestBody AlertStage alertStage) {
|
||||
return Result.success(alertStageService.updateById(alertStage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除通知策略
|
||||
* @param id id
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "通过id删除通知策略")
|
||||
@DeleteMapping("/{id}" )
|
||||
@RequiresPermissions("alert:alertstage:delete")
|
||||
public Result<Boolean> removeById(@PathVariable Long id) {
|
||||
return Result.success(alertStageService.removeById(id));
|
||||
}
|
||||
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package com.oneone.alert.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.oneone.alert.pojo.entity.CodeStageRel;
|
||||
import com.oneone.alert.service.CodeStageRelService;
|
||||
import com.oneone.common.result.Result;
|
||||
import com.oneone.common.web.security.annotation.RequiresPermissions;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通知策略-事件
|
||||
* @author mice
|
||||
* @date 2023-03-13 12:03:18
|
||||
* @version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("alert/codestagerel")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "通知策略-事件管理")
|
||||
public class CodeStageRelController {
|
||||
|
||||
private final CodeStageRelService codeStageRelService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param codeStageRel 通知策略-事件
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@RequiresPermissions("alert:codestagerel:list")
|
||||
public Result<IPage<CodeStageRel>> getCodeStageRelPage(Page page, CodeStageRel codeStageRel) {
|
||||
return Result.success(codeStageRelService.page(page, Wrappers.query(codeStageRel)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询通知策略-事件
|
||||
* @param id id
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "通过id查询")
|
||||
@GetMapping("/{id}" )
|
||||
@RequiresPermissions("alert:codestagerel:getById")
|
||||
public Result<CodeStageRel> getById(@PathVariable("id" ) Long id) {
|
||||
return Result.success(codeStageRelService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知策略-事件
|
||||
* @param codeStageRel 通知策略-事件
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "新增通知策略-事件")
|
||||
@PostMapping
|
||||
@RequiresPermissions("alert:codestagerel:add")
|
||||
public Result<Boolean> save(@RequestBody CodeStageRel codeStageRel) {
|
||||
return Result.success(codeStageRelService.save(codeStageRel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知策略-事件
|
||||
* @param codeStageRel 通知策略-事件
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "修改通知策略-事件")
|
||||
@PutMapping
|
||||
@RequiresPermissions("alert:codestagerel:edit")
|
||||
public Result<Boolean> updateById(@RequestBody CodeStageRel codeStageRel) {
|
||||
return Result.success(codeStageRelService.updateById(codeStageRel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除通知策略-事件
|
||||
* @param id id
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "通过id删除通知策略-事件")
|
||||
@DeleteMapping("/{id}" )
|
||||
@RequiresPermissions("alert:codestagerel:delete")
|
||||
public Result<Boolean> removeById(@PathVariable Long id) {
|
||||
return Result.success(codeStageRelService.removeById(id));
|
||||
}
|
||||
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
package com.oneone.alert.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.oneone.alert.api.common.AlterConstant;
|
||||
import com.oneone.alert.api.param.EventParam;
|
||||
import com.oneone.alert.pojo.entity.Event;
|
||||
import com.oneone.alert.service.EventLogService;
|
||||
import com.oneone.alert.service.EventService;
|
||||
import com.oneone.common.result.Result;
|
||||
import com.oneone.common.util.Func;
|
||||
import com.oneone.common.web.security.annotation.RequiresPermissions;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 事件
|
||||
* @author mice
|
||||
* @date 2022-04-20 12:10:02
|
||||
* @version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api/v1/event")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "事件管理")
|
||||
public class EventController {
|
||||
|
||||
private final EventService eventService;
|
||||
|
||||
private final EventLogService eventLogService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param event 事件
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@RequiresPermissions("alert:event:list")
|
||||
public Result<IPage<Event>> getEventPage(Page page, Event event) {
|
||||
return Result.success(eventService.page(page, Wrappers.query(event)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询事件
|
||||
* @param id id
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "通过id查询")
|
||||
@GetMapping("/{id}" )
|
||||
@RequiresPermissions("alert:event:getById")
|
||||
public Result<Event> getById(@PathVariable("id" ) Long id) {
|
||||
return Result.success(eventService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
* @param event 事件
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "新增事件")
|
||||
@PostMapping
|
||||
@RequiresPermissions("alert:event:add")
|
||||
public Result<Boolean> save(@RequestBody Event event) {
|
||||
return Result.success(eventService.save(event));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改事件
|
||||
* @param event 事件
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "修改事件")
|
||||
@PutMapping
|
||||
@RequiresPermissions("alert:event:edit")
|
||||
public Result<Boolean> updateById(@RequestBody Event event) {
|
||||
return Result.success(eventService.updateById(event));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除事件
|
||||
* @param id id
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "通过id删除事件")
|
||||
@DeleteMapping("/{id}" )
|
||||
@RequiresPermissions("alert:event:delete")
|
||||
public Result<Boolean> removeById(@PathVariable Long id) {
|
||||
return Result.success(eventService.removeById(id));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "事件推送")
|
||||
@PostMapping("pushEvent")
|
||||
@RequiresPermissions("alert:event:pushEvent")
|
||||
public Result<Boolean> pushEvent(@RequestBody EventParam param) {
|
||||
// eventService.pushEvent(param);
|
||||
if(Func.isEmpty(param.getCode())){
|
||||
param.setCode(AlterConstant.BusyCode.UNKNOWN.getCode());
|
||||
}
|
||||
eventLogService.saveLog(param);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "事件推送")
|
||||
@PostMapping("pushEventLog")
|
||||
@RequiresPermissions("alert:event:pushEventLog")
|
||||
public Result<Boolean> pushEventLog(@RequestBody EventParam param) {
|
||||
eventLogService.saveLog(param);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package com.oneone.alert.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.oneone.alert.pojo.entity.EventLog;
|
||||
import com.oneone.alert.service.EventLogService;
|
||||
import com.oneone.common.result.Result;
|
||||
import com.oneone.common.web.security.annotation.RequiresPermissions;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 事件
|
||||
* @author mice
|
||||
* @date 2023-03-13 12:03:18
|
||||
* @version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("alert/eventlog")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "事件管理")
|
||||
public class EventLogController {
|
||||
|
||||
private final EventLogService eventLogService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param eventLog 事件
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@RequiresPermissions("alert:eventlog:list")
|
||||
public Result<IPage<EventLog>> getEventLogPage(Page page, EventLog eventLog) {
|
||||
return Result.success(eventLogService.page(page, Wrappers.query(eventLog)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询事件
|
||||
* @param id id
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "通过id查询")
|
||||
@GetMapping("/{id}" )
|
||||
@RequiresPermissions("alert:eventlog:getById")
|
||||
public Result<EventLog> getById(@PathVariable("id" ) Long id) {
|
||||
return Result.success(eventLogService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
* @param eventLog 事件
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "新增事件")
|
||||
@PostMapping
|
||||
@RequiresPermissions("alert:eventlog:add")
|
||||
public Result<Boolean> save(@RequestBody EventLog eventLog) {
|
||||
return Result.success(eventLogService.save(eventLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改事件
|
||||
* @param eventLog 事件
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "修改事件")
|
||||
@PutMapping
|
||||
@RequiresPermissions("alert:eventlog:edit")
|
||||
public Result<Boolean> updateById(@RequestBody EventLog eventLog) {
|
||||
return Result.success(eventLogService.updateById(eventLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除事件
|
||||
* @param id id
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "通过id删除事件")
|
||||
@DeleteMapping("/{id}" )
|
||||
@RequiresPermissions("alert:eventlog:delete")
|
||||
public Result<Boolean> removeById(@PathVariable Long id) {
|
||||
return Result.success(eventLogService.removeById(id));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user