|
@@ -1,14 +1,10 @@
|
|
|
package cn.com.taiji.duty.controller;
|
|
|
|
|
|
|
|
|
-import cn.com.taiji.duty.model.DutyLoginLog;
|
|
|
-import cn.com.taiji.duty.model.DutyLoginLogVo;
|
|
|
-import cn.com.taiji.duty.model.DutyOperLog;
|
|
|
-import cn.com.taiji.duty.model.DutyOperLogVo;
|
|
|
+import cn.com.taiji.duty.model.*;
|
|
|
+import cn.com.taiji.duty.service.IDutyAccountService;
|
|
|
import cn.com.taiji.duty.service.IDutyOperLogService;
|
|
|
-import cn.com.taiji.duty.utils.AjaxResult;
|
|
|
-import cn.com.taiji.duty.utils.HttpStatus;
|
|
|
-import cn.com.taiji.duty.utils.TableDataInfo;
|
|
|
+import cn.com.taiji.duty.utils.*;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
@@ -17,13 +13,17 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -42,6 +42,12 @@ public class DutyOperLogController {
|
|
|
@Autowired
|
|
|
private IDutyOperLogService operLogService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ protected StringRedisTemplate redisTemplate;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IDutyAccountService accountService;
|
|
|
+
|
|
|
@ApiOperation("操作日志查询")
|
|
|
@GetMapping("search")
|
|
|
public AjaxResult search(Long id) {
|
|
@@ -53,7 +59,18 @@ public class DutyOperLogController {
|
|
|
|
|
|
@ApiOperation("操作日志列表")
|
|
|
@PostMapping("list")
|
|
|
- public TableDataInfo list(@RequestBody DutyOperLogVo vo) {
|
|
|
+ public TableDataInfo list(HttpServletRequest request, @RequestBody DutyOperLogVo vo) {
|
|
|
+ String token = JwtUtils.getToken(request);
|
|
|
+ String username = redisTemplate.opsForValue().get(token);
|
|
|
+ DutyAccount account = accountService.findByUsername(username);
|
|
|
+ if (account != null) {
|
|
|
+ List<DutyRole> roles = account.getRoles();
|
|
|
+ List<String> stringList = roles.parallelStream().map(DutyRole::getPermissionValue).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ String join = StringUtils.join(stringList, ",");
|
|
|
+ if (join.contains("ZBY")) {
|
|
|
+ vo.setDeptId(account.getDept().getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
|
|
|
List<DutyOperLog> list = operLogService.queryList(vo);
|
|
|
TableDataInfo rspData = new TableDataInfo();
|