| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- package com.linkwechat.controller;
- import com.linkwechat.common.annotation.Log;
- import com.linkwechat.common.constant.HttpStatus;
- import com.linkwechat.common.core.controller.BaseController;
- import com.linkwechat.common.core.domain.AjaxResult;
- import com.linkwechat.common.core.page.TableDataInfo;
- import com.linkwechat.common.enums.BusinessType;
- import com.linkwechat.common.utils.poi.ExcelUtil;
- import com.linkwechat.domain.WeSensitiveAct;
- import com.linkwechat.domain.WeSensitiveActHit;
- import com.linkwechat.service.IWeSensitiveActHitService;
- import com.linkwechat.service.IWeSensitiveActService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import javax.validation.Valid;
- import java.util.Arrays;
- import java.util.List;
- import java.util.stream.Collectors;
- /**
- * 敏感行为管理接口
- *
- * @author leejoker <1056650571@qq.com>
- * @version 1.0
- * @date 2021/1/12 18:07
- */
- @Api(tags = "敏感行为管理接口")
- @RestController
- @RequestMapping("/sensitive/act")
- public class WeSensitiveActController extends BaseController {
- @Autowired
- private IWeSensitiveActService weSensitiveActService;
- @Autowired
- private IWeSensitiveActHitService weSensitiveActHitService;
- /**
- * 查询敏感行为列表
- */
- @ApiOperation(value = "查询敏感行为列表",httpMethod = "GET")
- @GetMapping("/list")
- public TableDataInfo<List<WeSensitiveAct>> list(WeSensitiveAct weSensitiveAct) {
- startPage();
- List<WeSensitiveAct> list = weSensitiveActService.selectWeSensitiveActList(weSensitiveAct);
- return getDataTable(list);
- }
- /**
- * 获取敏感行为详细信息
- */
- @ApiOperation(value = "获取敏感行为详细信息",httpMethod = "GET")
- @GetMapping(value = "/{id}")
- public AjaxResult<WeSensitiveAct> getInfo(@PathVariable("id") Long id) {
- return AjaxResult.success(weSensitiveActService.selectWeSensitiveActById(id));
- }
- /**
- * 新增敏感行为设置
- */
- @ApiOperation(value = "新增敏感行为设置",httpMethod = "POST")
- @Log(title = "新增敏感行为", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Valid @RequestBody WeSensitiveAct weSensitiveAct) {
- return weSensitiveActService.insertWeSensitiveAct(weSensitiveAct) ? AjaxResult.success() : AjaxResult.error();
- }
- /**
- * 修改敏感行为
- */
- @ApiOperation(value = "修改敏感行为",httpMethod = "PUT")
- @Log(title = "修改敏感行为", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody WeSensitiveAct weSensitiveAct) {
- Long id = weSensitiveAct.getId();
- WeSensitiveAct originData = weSensitiveActService.selectWeSensitiveActById(id);
- if (originData == null) {
- return AjaxResult.error(HttpStatus.NOT_FOUND, "数据不存在");
- }
- return weSensitiveActService.updateWeSensitiveAct(weSensitiveAct) ? AjaxResult.success() : AjaxResult.error();
- }
- /**
- * 删除敏感行为
- */
- @ApiOperation(value = "删除敏感行为",httpMethod = "DELETE")
- @Log(title = "删除敏感行为", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable("ids") String ids) {
- String[] id = ids.split(",");
- Long[] idArray = new Long[id.length];
- Arrays.stream(id).map(Long::parseLong).collect(Collectors.toList()).toArray(idArray);
- return weSensitiveActService.deleteWeSensitiveActByIds(idArray) ? AjaxResult.success() : AjaxResult.error();
- }
- /**
- * 敏感行为命中查询
- */
- @ApiOperation(value = "敏感行为命中查询(这个接口有问题)",httpMethod = "GET")
- @GetMapping("/hit/list")
- public TableDataInfo<List<WeSensitiveActHit>> hitList() {
- startPage();
- List<WeSensitiveActHit> list = weSensitiveActHitService.list();
- return getDataTable(list);
- }
- /**
- * 导出敏感行为记录
- */
- @ApiOperation(value = "导出敏感行为记录",httpMethod = "POST")
- @PostMapping("/hit/export")
- public AjaxResult export() {
- List<WeSensitiveActHit> list = weSensitiveActHitService.list();
- ExcelUtil<WeSensitiveActHit> util = new ExcelUtil<>(WeSensitiveActHit.class);
- return util.exportExcel(list, "敏感行为记录");
- }
- }
|