|
@@ -1,5 +1,6 @@
|
|
|
package com.ruoyi.web.controller.qdtl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
@@ -9,6 +10,7 @@ import com.ruoyi.common.enums.BusinessType;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.qdtl.domain.TlInspectionLocationLog;
|
|
|
import com.ruoyi.qdtl.service.ITlInspectionLocationLogService;
|
|
|
+import com.ruoyi.system.service.ISysRoleService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -20,7 +22,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
/**
|
|
|
* 巡检记录管理Controller
|
|
@@ -33,16 +37,27 @@ import java.util.List;
|
|
|
public class TlInspectionLocationLogController extends BaseController {
|
|
|
@Autowired
|
|
|
private ITlInspectionLocationLogService tlInspectionLocationLogService;
|
|
|
+ @Autowired
|
|
|
+ private ISysRoleService sysRoleService;
|
|
|
|
|
|
/**
|
|
|
* 查询巡检记录管理列表
|
|
|
*/
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(TlInspectionLocationLog tlInspectionLocationLog) {
|
|
|
+ Set<String> roleSet = sysRoleService.selectRolePermissionByUserId(getUserId());
|
|
|
startPage();
|
|
|
if (StrUtil.isNotBlank(tlInspectionLocationLog.getAreaId())) {
|
|
|
- tlInspectionLocationLog.setAreaIds(StrUtil.split(tlInspectionLocationLog.getAreaId(), ','));
|
|
|
+ Set<String> split = new HashSet<>(StrUtil.split(tlInspectionLocationLog.getAreaId(), ','));
|
|
|
+ if (!roleSet.contains("admin")) {
|
|
|
+ split = CollUtil.intersectionDistinct(roleSet, split);
|
|
|
+ }
|
|
|
+ tlInspectionLocationLog.setAreaIds(split);
|
|
|
tlInspectionLocationLog.setAreaId("");
|
|
|
+ } else {
|
|
|
+ if (!roleSet.contains("admin")) {
|
|
|
+ tlInspectionLocationLog.setAreaIds(roleSet);
|
|
|
+ }
|
|
|
}
|
|
|
List<TlInspectionLocationLog> list = tlInspectionLocationLogService.selectTlInspectionLocationLogList(tlInspectionLocationLog);
|
|
|
return getDataTable(list);
|
|
@@ -57,7 +72,7 @@ public class TlInspectionLocationLogController extends BaseController {
|
|
|
@GetMapping("/trail/list")
|
|
|
public AjaxResult trailList(TlInspectionLocationLog tlInspectionLocationLog) {
|
|
|
if (StrUtil.isNotBlank(tlInspectionLocationLog.getAreaId())) {
|
|
|
- tlInspectionLocationLog.setAreaIds(StrUtil.split(tlInspectionLocationLog.getAreaId(), ','));
|
|
|
+ tlInspectionLocationLog.setAreaIds(new HashSet<>(StrUtil.split(tlInspectionLocationLog.getAreaId(), ',')));
|
|
|
tlInspectionLocationLog.setAreaId("");
|
|
|
}
|
|
|
List<TlInspectionLocationLog> list = tlInspectionLocationLogService.selectTlInspectionLocationLogTrailList(tlInspectionLocationLog);
|
|
@@ -70,9 +85,18 @@ public class TlInspectionLocationLogController extends BaseController {
|
|
|
@Log(title = "巡检记录管理", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
public void export(HttpServletResponse response, TlInspectionLocationLog tlInspectionLocationLog) {
|
|
|
+ Set<String> roleSet = sysRoleService.selectRolePermissionByUserId(getUserId());
|
|
|
if (StrUtil.isNotBlank(tlInspectionLocationLog.getAreaId())) {
|
|
|
- tlInspectionLocationLog.setAreaIds(StrUtil.split(tlInspectionLocationLog.getAreaId(), ','));
|
|
|
+ Set<String> split = new HashSet<>(StrUtil.split(tlInspectionLocationLog.getAreaId(), ','));
|
|
|
+ if (!roleSet.contains("admin")) {
|
|
|
+ split = CollUtil.intersectionDistinct(roleSet, split);
|
|
|
+ }
|
|
|
+ tlInspectionLocationLog.setAreaIds(split);
|
|
|
tlInspectionLocationLog.setAreaId("");
|
|
|
+ } else {
|
|
|
+ if (!roleSet.contains("admin")) {
|
|
|
+ tlInspectionLocationLog.setAreaIds(roleSet);
|
|
|
+ }
|
|
|
}
|
|
|
List<TlInspectionLocationLog> list = tlInspectionLocationLogService.selectTlInspectionLocationLogList(tlInspectionLocationLog);
|
|
|
ExcelUtil<TlInspectionLocationLog> util = new ExcelUtil<TlInspectionLocationLog>(TlInspectionLocationLog.class);
|