Browse Source

修改权限管理功能模块

shilin 3 years ago
parent
commit
1cf5a6f6b3

+ 3 - 0
src/main/java/com/gyee/frame/common/cache/RedisConfig.java

@@ -33,6 +33,7 @@ public class RedisConfig {
     @ConfigurationProperties(prefix = "spring.redis.pool")
     public JedisPoolConfig jedisPoolConfig() {
         JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
+
         jedisPoolConfig.setMaxWaitMillis(10000);
         return jedisPoolConfig;
     }
@@ -44,6 +45,7 @@ public class RedisConfig {
         redisStandaloneConfiguration.setDatabase(database);
         redisStandaloneConfiguration.setPassword(pwd);
         redisStandaloneConfiguration.setPort(port);
+        redisStandaloneConfiguration.setDatabase(2);
         JedisClientConfiguration.JedisPoolingClientConfigurationBuilder jpcb = (JedisClientConfiguration.JedisPoolingClientConfigurationBuilder) JedisClientConfiguration.builder();
         jpcb.poolConfig(jedisPoolConfig);
         JedisClientConfiguration jedisClientConfiguration = jpcb.build();
@@ -68,6 +70,7 @@ public class RedisConfig {
         template.setValueSerializer(redisSerializer);
         template.setHashValueSerializer(redisSerializer);
         template.afterPropertiesSet();
+
         return template;
     }
 

+ 92 - 6
src/main/java/com/gyee/frame/controller/AdminController.java

@@ -7,6 +7,7 @@ import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.model.auto.SysNotice;
 import com.gyee.frame.model.auto.TsysUser;
 import com.gyee.frame.model.custom.BootstrapTree;
+import com.gyee.frame.model.custom.ElementNode;
 import com.gyee.frame.model.custom.TitleVo;
 import com.gyee.frame.shiro.util.ShiroUtils;
 import com.gyee.frame.util.StringUtils;
@@ -69,7 +70,6 @@ public class AdminController extends BaseController {
 	/**
 	 * 请求到登陆界面
 	 * 
-	 * @param request
 	 * @return
 	 */
 	@ApiOperation(value = "请求到登陆界面", notes = "请求到登陆界面")
@@ -103,7 +103,7 @@ public class AdminController extends BaseController {
 	 * @param request
 	 * @return
 	 */
-	@ApiOperation(value = "用户登陆验证", notes = "用户登陆验证")
+//	@ApiOperation(value = "用户登陆验证", notes = "用户登陆验证")
 	@PostMapping("/login")
 	@ResponseBody
 	public AjaxResult login(TsysUser user, String code, RedirectAttributes redirectAttributes, boolean rememberMe,
@@ -171,12 +171,86 @@ public class AdminController extends BaseController {
 		}
 
 	}
-	
-	
+
+
+	/**
+	 * 用户登陆验证
+	 *
+	 * @param user
+	 * @param request
+	 * @return
+	 */
+	@ApiOperation(value = "用户登陆验证", notes = "用户登陆验证")
+	@PostMapping("/loginvue")
+	@ResponseBody
+	public AjaxResult loginvue(TsysUser user,
+							HttpServletRequest request) {
+		// ModelAndView view =new ModelAndView();
+
+			String userName = user.getUsername();
+			Subject currentUser = SecurityUtils.getSubject();
+
+			// 是否验证通过
+			if (!currentUser.isAuthenticated()) {
+				UsernamePasswordToken token = new UsernamePasswordToken(userName, user.getPassword());
+				try {
+//					if (rememberMe) {
+					if (true) {
+						token.setRememberMe(true);
+					}
+					// 存入用户
+					currentUser.login(token);
+					if (StringUtils.isNotNull(ShiroUtils.getUser())) {
+						// 若为前后端分离版本,则可把sessionId返回,作为分离版本的请求头authToken
+						 String authToken = ShiroUtils.getSessionId();
+						 return AjaxResult.successData(200, authToken);
+//						return AjaxResult.success();
+					} else {
+						return AjaxResult.error(500, "未知账户");
+					}
+				} catch (UnknownAccountException uae) {
+					logger.info("对用户[" + userName + "]进行登录验证..验证未通过,未知账户");
+					return AjaxResult.error(500, "未知账户");
+				} catch (IncorrectCredentialsException ice) {
+					logger.info("对用户[" + userName + "]进行登录验证..验证未通过,错误的凭证");
+					return AjaxResult.error(500, "用户名或密码不正确");
+				} catch (LockedAccountException lae) {
+					logger.info("对用户[" + userName + "]进行登录验证..验证未通过,账户已锁定");
+					return AjaxResult.error(500, "账户已锁定");
+				} catch (ExcessiveAttemptsException eae) {
+					logger.info("对用户[" + userName + "]进行登录验证..验证未通过,错误次数过多");
+					return AjaxResult.error(500, "用户名或密码错误次数过多");
+				} catch (AuthenticationException ae) {
+					// 通过处理Shiro的运行时AuthenticationException就可以控制用户登录失败或密码错误时的情景
+					logger.info("对用户[" + userName + "]进行登录验证..验证未通过,堆栈轨迹如下");
+					ae.printStackTrace();
+					return AjaxResult.error(500, "用户名或密码不正确");
+				}
+			} else {
+				if (StringUtils.isNotNull(ShiroUtils.getUser())) {
+					// 跳转到 get请求的登陆方法
+					// view.setViewName("redirect:/"+prefix+"/index");
+					return AjaxResult.success();
+				} else {
+					return AjaxResult.error(500, "未知账户");
+				}
+			}
+
+
+	}
+
+
+	@ApiOperation(value = "获取用户菜单", notes = "获取用户菜单")
+	@GetMapping("/usermenu")
+	public AjaxResult usermenu(HttpServletRequest request) {
+		// 获取菜单栏
+		List<ElementNode> menuTree = sysPermissionService.getTreePerm(ShiroUtils.getUserId());
+
+		return AjaxResult.successData(200, menuTree);
+	}
 	/**
 	 * 手机登录
 	 * @param user
-	 * @param redirectAttributes
 	 * @param rememberMe
 	 * @param request
 	 * @return
@@ -256,8 +330,9 @@ public class AdminController extends BaseController {
 	 * 
 	 * @return
 	 */
-	@ApiOperation(value = "退出登陆", notes = "退出登陆")
+//	@ApiOperation(value = "退出登陆", notes = "退出登陆")
 	@GetMapping("/Loginout")
+
 	public String LoginOut(HttpServletRequest request, HttpServletResponse response) {
 		// 在这里执行退出系统前需要清空的数据
 		Subject subject = SecurityUtils.getSubject();
@@ -266,6 +341,17 @@ public class AdminController extends BaseController {
 		return "redirect:/" + prefix + "/login";
 	}
 
+	@ApiOperation(value = "退出登陆", notes = "退出登陆")
+	@PostMapping("/Loginoutvue")
+	@ResponseBody
+	public AjaxResult Loginoutvue(HttpServletRequest request, HttpServletResponse response) {
+		// 在这里执行退出系统前需要清空的数据
+		Subject subject = SecurityUtils.getSubject();
+		// 注销
+		subject.logout();
+		return AjaxResult.success();
+	}
+
 	/**** 页面测试 ****/
 	@ApiOperation(value = "404页面", notes = "404页面")
 	@GetMapping("Out404")

+ 132 - 0
src/main/java/com/gyee/frame/controller/health/EarlyWarnKnowledgeController.java

@@ -0,0 +1,132 @@
+package com.gyee.frame.controller.health;
+
+import com.github.pagehelper.PageInfo;
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.model.auto.Alertrule2;
+import com.gyee.frame.model.custom.Tablepar;
+import com.gyee.frame.service.Alertrule2ervice;
+import com.gyee.frame.util.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+
+@Controller
+@RequestMapping("/earlyWarnKnowledge")
+@Api(value = "预警知识" ,tags =  "预警知识")
+public class EarlyWarnKnowledgeController {
+
+    @Resource
+    private Alertrule2ervice alertrule2ervice;
+
+
+    @PostMapping("/earlyWarnKnowledgeList")
+    @ResponseBody
+    @ApiOperation(value = "预警知识列表", notes = "预警知识列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "tablepar", value = "分页排序对象", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "name", value = "预警名称", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "category", value = "预警类型", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "rank", value = "预警级别", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult earlyWarnKnowledgeList(Tablepar tablepar, String name, String category, String rank) {
+
+
+        PageInfo<Alertrule2> pageInfo = new PageInfo<>();
+
+
+        pageInfo = alertrule2ervice.getAlertruleList(tablepar, name, category, rank);
+
+        if (null!=pageInfo) {
+            return AjaxResult.successData(AjaxStatus.success.code, pageInfo);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, pageInfo);
+        }
+
+    }
+
+    @PostMapping("/findFaultknowledge")
+    @ResponseBody
+    @ApiOperation(value = "通过主键查询预警知识", notes = "通过主键查询预警知识")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "编号", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult findFaultknowledge(String id) {
+
+
+        Alertrule2  po = new Alertrule2();
+
+        po = alertrule2ervice.findAlertrule2ById(id);
+
+        if (null!=po) {
+            return AjaxResult.successData(AjaxStatus.success.code, po);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, po);
+        }
+
+    }
+    @PostMapping("/updateFaultknowledge")
+    @ResponseBody
+    @ApiOperation(value = "修改预警知识", notes = "修改预警知识")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "po", value = "预警知识对象", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult updateFaultknowledge(Alertrule2 po) {
+
+        int result =-1;
+        if(StringUtils.notEmp(po) && StringUtils.notEmp(po.getId()))
+        {
+            result =alertrule2ervice.updateAlertrule2(po);
+        }
+        if (result!=-1) {
+            return AjaxResult.successData(AjaxStatus.success.code, result);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, result);
+        }
+    }
+    @PostMapping("/insertFaultknowledge")
+    @ResponseBody
+    @ApiOperation(value = "新增预警知识", notes = "新增预警知识")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "po", value = "预警知识对象", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult insertFaultknowledge(Alertrule2 po) {
+
+        int result =-1;
+        if(StringUtils.notEmp(po) )
+        {
+            result = alertrule2ervice.insertAlertrule2(po);
+        }
+        if (result!=-1) {
+            return AjaxResult.successData(AjaxStatus.success.code, result);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, result);
+        }
+
+    }
+    @PostMapping("/deleteFaultknowledge")
+    @ResponseBody
+    @ApiOperation(value = "删除预警知识", notes = "删除预警知识")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "预警知识编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult deleteFaultknowledge(String id) {
+
+        int result =-1;
+        if(StringUtils.notEmp(id))
+        {
+            result =alertrule2ervice.deleteAlertrule2(id);
+        }
+        if (result!=-1) {
+            return AjaxResult.successData(AjaxStatus.success.code, result);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, result);
+        }
+    }
+
+
+}

+ 5 - 6
src/main/java/com/gyee/frame/controller/recommen/RecommenController.java

@@ -1,6 +1,5 @@
 package com.gyee.frame.controller.recommen;
 
-import com.github.pagehelper.PageInfo;
 import com.gyee.frame.common.conf.AjaxStatus;
 import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.model.auto.Recommenmain;
@@ -466,7 +465,7 @@ public class RecommenController {
     })
     public AjaxResult findWobugeqByLocation(Tablepar tablepar, String location) throws Exception {
 
-        PageInfo<Wobugeq> pageInfo=new PageInfo<>();
+        List<Wobugeq> vos=new ArrayList<>();
 
         if(StringUtils.notEmp(tablepar) && StringUtils.notEmp(location))
         {
@@ -481,13 +480,13 @@ public class RecommenController {
             Date beginDate = DateUtils.truncate(c.getTime());
             c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
             Date endDate = DateUtils.truncate(c.getTime());
-            pageInfo=recommenService.findWobugeqByLocation(tablepar,location, beginDate, endDate);
+            vos=recommenService.findWobugeqByLocation(tablepar,location, beginDate, endDate);
         }
 
-        if (null!=pageInfo) {
-            return AjaxResult.successData(AjaxStatus.success.code, pageInfo);
+        if (null!=vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
         } else {
-            return AjaxResult.successData(AjaxStatus.success.code, pageInfo);
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
         }
 
     }

+ 7 - 0
src/main/java/com/gyee/frame/mapper/auto/TvuePermissionMapper.java

@@ -29,4 +29,11 @@ public interface TvuePermissionMapper {
         int updateByPrimaryKeySelective(TvuePermission record);
 
         int updateByPrimaryKey(TvuePermission record);
+
+        /**
+         * 根据用户id查询出用户的所有权限
+         * @param userId
+         * @return
+         */
+        List<TvuePermission> findByAdminUserId(String userId);
     }

+ 172 - 68
src/main/java/com/gyee/frame/service/Alertrule2ervice.java

@@ -1,11 +1,15 @@
 package com.gyee.frame.service;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.gyee.frame.common.base.BaseService;
 import com.gyee.frame.common.support.Convert;
 import com.gyee.frame.mapper.auto.Alertrule2Mapper;
 import com.gyee.frame.model.auto.Alertrule2;
 import com.gyee.frame.model.auto.Alertrule2Example;
+import com.gyee.frame.model.custom.Tablepar;
 import com.gyee.frame.util.SnowflakeIdWorker;
+import com.gyee.frame.util.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -14,82 +18,182 @@ import java.util.List;
 
 @Service
 public class Alertrule2ervice implements BaseService<Alertrule2, Alertrule2Example> {
-	@Resource
-	private Alertrule2Mapper alertrule2Mapper;
-	
-
-	@Override
-	public int deleteByPrimaryKey(String ids) {
-				
-			List<String> lista=Convert.toListStrArray(ids);
-			Alertrule2Example example=new Alertrule2Example();
-			example.createCriteria().andIdIn(lista);
-			return alertrule2Mapper.deleteByExample(example);
-			
-				
-	}
-	
-	
-	@Override
-	public Alertrule2 selectByPrimaryKey(String id) {
-				
-			return alertrule2Mapper.selectByPrimaryKey(id);
-				
-	}
+    @Resource
+    private Alertrule2Mapper alertrule2Mapper;
 
-	
-	@Override
-	public int updateByPrimaryKeySelective(Alertrule2 record) {
-		return alertrule2Mapper.updateByPrimaryKeySelective(record);
-	}
-	
-	
-	/**
-	 * 添加
-	 */
-	@Override
-	public int insertSelective(Alertrule2 record) {
-				
-		//添加雪花主键id
-		record.setId(SnowflakeIdWorker.getUUID());
-			
-				
-		return alertrule2Mapper.insertSelective(record);
-	}
-	
-	
-	@Override
-	public int updateByExampleSelective(Alertrule2 record, Alertrule2Example example) {
-		
-		return alertrule2Mapper.updateByExampleSelective(record, example);
-	}
 
-	
-	@Override
-	public int updateByExample(Alertrule2 record, Alertrule2Example example) {
-		
-		return alertrule2Mapper.updateByExample(record, example);
+    @Override
+    public int deleteByPrimaryKey(String ids) {
+
+        List<String> lista = Convert.toListStrArray(ids);
+        Alertrule2Example example = new Alertrule2Example();
+        example.createCriteria().andIdIn(lista);
+        return alertrule2Mapper.deleteByExample(example);
+
+
+    }
+
+
+    @Override
+    public Alertrule2 selectByPrimaryKey(String id) {
+
+        return alertrule2Mapper.selectByPrimaryKey(id);
+
+    }
+
+
+    @Override
+    public int updateByPrimaryKeySelective(Alertrule2 record) {
+        return alertrule2Mapper.updateByPrimaryKeySelective(record);
+    }
+
+
+    /**
+     * 添加
+     */
+    @Override
+    public int insertSelective(Alertrule2 record) {
+
+        //添加雪花主键id
+        record.setId(SnowflakeIdWorker.getUUID());
+
+
+        return alertrule2Mapper.insertSelective(record);
+    }
+
+
+    @Override
+    public int updateByExampleSelective(Alertrule2 record, Alertrule2Example example) {
+
+        return alertrule2Mapper.updateByExampleSelective(record, example);
+    }
+
+
+    @Override
+    public int updateByExample(Alertrule2 record, Alertrule2Example example) {
+
+        return alertrule2Mapper.updateByExample(record, example);
+    }
+
+    @Override
+    public List<Alertrule2> selectByExample(Alertrule2Example example) {
+
+        return alertrule2Mapper.selectByExample(example);
+    }
+
+
+    @Override
+    public long countByExample(Alertrule2Example example) {
+
+        return alertrule2Mapper.countByExample(example);
+    }
+
+
+    @Override
+    public int deleteByExample(Alertrule2Example example) {
+
+        return alertrule2Mapper.deleteByExample(example);
+    }
+
+
+    public  PageInfo<Alertrule2> getAlertruleList(Tablepar tablepar, String name, String category, String rank) {
+
+
+        PageInfo<Alertrule2> pageInfo = new PageInfo<>();
+
+
+        Alertrule2Example example = new Alertrule2Example();
+        example.setOrderByClause("name DESC");
+
+        if (StringUtils.isNotEmpty(tablepar.getOrderByColumn())) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(" ").append(tablepar.getOrderByColumn());
+            if (StringUtils.isNotEmpty(tablepar.getIsAsc())) {
+                sb.append(" ").append(tablepar.getIsAsc());
+            } else {
+                sb.append(" asc ");
+            }
+            example.setOrderByClause(String.valueOf(sb));
+        } else {
+            example.setOrderByClause("name ASC");
+        }
+
+        Alertrule2Example.Criteria criteia = example.createCriteria();
+
+        if (StringUtils.notEmp(name)) {
+
+            StringBuilder sb = new StringBuilder();
+            sb.append("%").append(name).append("%");
+            criteia.andNameLike(String.valueOf(name));
+        }
+
+		if (StringUtils.notEmp(category)) {
+
+			StringBuilder sb = new StringBuilder();
+			sb.append("%").append(category).append("%");
+			criteia.andCategoryLike(String.valueOf(category));
+		}
+
+		if (StringUtils.notEmp(rank)) {
+
+			StringBuilder sb = new StringBuilder();
+			sb.append("%").append(rank).append("%");
+			criteia.andRankLike(String.valueOf(rank));
+		}
+
+        PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
+        List<Alertrule2> vos = alertrule2Mapper.selectByExample(example);
+        pageInfo = new PageInfo<Alertrule2>(vos);
+
+        return pageInfo;
+
+    }
+
+
+	public Alertrule2 findAlertrule2ById(String id) {
+
+
+		Alertrule2  po = new Alertrule2();
+
+		po = alertrule2Mapper.selectByPrimaryKey(id);
+
+		return po;
+
 	}
 
-	@Override
-	public List<Alertrule2> selectByExample(Alertrule2Example example) {
-		
-		return alertrule2Mapper.selectByExample(example);
+	public int updateAlertrule2(Alertrule2 po) {
+
+		int result =-1;
+		if(StringUtils.notEmp(po) && StringUtils.notEmp(po.getId()))
+		{
+			result =alertrule2Mapper.updateByPrimaryKeySelective(po);
+		}
+		return result;
+
 	}
 
-	
-	@Override
-	public long countByExample(Alertrule2Example example) {
-		
-		return alertrule2Mapper.countByExample(example);
+	public int insertAlertrule2(Alertrule2 po) {
+
+		int result =-1;
+		if(StringUtils.notEmp(po) )
+		{
+			result = alertrule2Mapper.insertSelective(po);
+		}
+
+
+		return result;
+
 	}
 
-	
-	@Override
-	public int deleteByExample(Alertrule2Example example) {
-		
-		return alertrule2Mapper.deleteByExample(example);
+	public int deleteAlertrule2(String id) {
+
+		int result =-1;
+		if(StringUtils.notEmp(id))
+		{
+			result =alertrule2Mapper.deleteByPrimaryKey(id);
+		}
+		return result;
+
 	}
-	
 
 }

+ 50 - 12
src/main/java/com/gyee/frame/service/SysPermissionService.java

@@ -6,15 +6,15 @@ import com.gyee.frame.common.base.BaseService;
 import com.gyee.frame.common.support.ConvertUtil;
 import com.gyee.frame.mapper.auto.TsysPermissionMapper;
 import com.gyee.frame.mapper.auto.TsysPermissionRoleMapper;
+import com.gyee.frame.mapper.auto.TvuePermissionMapper;
 import com.gyee.frame.mapper.custom.PermissionDao;
-import com.gyee.frame.model.auto.TsysPermission;
-import com.gyee.frame.model.auto.TsysPermissionExample;
-import com.gyee.frame.model.auto.TsysPermissionRole;
-import com.gyee.frame.model.auto.TsysPermissionRoleExample;
+import com.gyee.frame.model.auto.*;
 import com.gyee.frame.model.custom.BootstrapTree;
+import com.gyee.frame.model.custom.ElementNode;
 import com.gyee.frame.model.custom.Tablepar;
 import com.gyee.frame.util.SnowflakeIdWorker;
 import com.gyee.frame.util.StringUtils;
+import com.gyee.frame.util.TreeUtil;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -29,6 +29,11 @@ public class SysPermissionService implements BaseService<TsysPermission, TsysPer
 	//权限mapper
 	@Resource
 	private TsysPermissionMapper tsysPermissionMapper;
+
+
+	//Vue权限mapper
+	@Resource
+	private TvuePermissionMapper tvuePermissionMapper;
 	
 	//权限自定义dao
 	@Resource
@@ -39,8 +44,6 @@ public class SysPermissionService implements BaseService<TsysPermission, TsysPer
 	
 	/**
 	 * 分页查询
-	 * @param pageNum
-	 * @param pageSize
 	 * @return
 	 */
 	 public PageInfo<TsysPermission> list(Tablepar tablepar, String searchText){
@@ -187,7 +190,6 @@ public class SysPermissionService implements BaseService<TsysPermission, TsysPer
 	
 	/**
 	 * 检查权限名字
-	 * @param tsysUser
 	 * @return
 	 */
 	public int checkNameUnique(TsysPermission tsysPermission){
@@ -199,7 +201,6 @@ public class SysPermissionService implements BaseService<TsysPermission, TsysPer
 
 	/**
 	 * 检查权限URL
-	 * @param tsysUser
 	 * @return
 	 */
 	public int checkURLUnique(TsysPermission tsysPermission){
@@ -211,7 +212,6 @@ public class SysPermissionService implements BaseService<TsysPermission, TsysPer
 
 	/**
 	 * 检查权限perms字段
-	 * @param tsysUser
 	 * @return
 	 */
 	public int checkPermsUnique(TsysPermission tsysPermission){
@@ -246,7 +246,32 @@ public class SysPermissionService implements BaseService<TsysPermission, TsysPer
 		}
 		return new BootstrapTree("菜单", "fa fa-home", "", "-1","###",0,treeList,"",0);
 	}
-	
+
+
+	/**
+	 * 获取权限树
+	 * @return
+	 */
+	public List<ElementNode> getTreePerm(String userid){
+		List<ElementNode> treeList = new ArrayList<ElementNode>();
+		List<TvuePermission> menuList =  getallTvuePermission(userid);
+		if(!menuList.isEmpty())
+		{
+			for(TvuePermission eq:menuList)
+			{
+				ElementNode node=new ElementNode();
+				node.setId(eq.getId());
+				node.setPid(eq.getPid());
+				node.setLabel(eq.getName());
+				//	node.setOpen(true);
+				treeList.add(node);
+			}
+
+			TreeUtil treeUtil=new TreeUtil(treeList);
+			treeList=treeUtil.buildJSONTree();
+		}
+		return treeList;
+	}
 	
 	
 	/**
@@ -284,8 +309,21 @@ public class SysPermissionService implements BaseService<TsysPermission, TsysPer
 		}
 		return  permissionDao.findByAdminUserId(userid);
 	}
-	
-	
+
+	/**
+	 * 根据用户id获取用户角色如果用户为null 获取所有权限
+	 * @return
+	 */
+	public List<TvuePermission> getallTvuePermission(String userid){
+		List<TvuePermission> list=new ArrayList<>();
+
+		if(StringUtils.notEmp(userid))
+		{
+			list = tvuePermissionMapper.findByAdminUserId(userid);
+		}
+
+		return  list;
+	}
 	
 	
 	

+ 7 - 9
src/main/java/com/gyee/frame/service/WobugeqService.java

@@ -1,7 +1,5 @@
 package com.gyee.frame.service;
 
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
 import com.gyee.frame.common.base.BaseService;
 import com.gyee.frame.common.dataSources.DataSource;
 import com.gyee.frame.common.dataSources.DataSourceType;
@@ -12,9 +10,9 @@ import com.gyee.frame.model.auto.WobugeqExample;
 import com.gyee.frame.model.custom.MainTrackVo;
 import com.gyee.frame.model.custom.Tablepar;
 import com.gyee.frame.util.StringUtils;
-import javax.annotation.Resource;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -185,10 +183,10 @@ public class WobugeqService implements BaseService<Wobugeq, WobugeqExample> {
 
 
 	@DataSource(value = DataSourceType.TICKET)
-	public PageInfo<Wobugeq> findWobugeqByLocation(Tablepar tablepar,String location, Date beginDate, Date endDate) {
+	public List<Wobugeq> findWobugeqByLocation(Tablepar tablepar,String location, Date beginDate, Date endDate) {
 
 
-		PageInfo<Wobugeq> pageInfo=new PageInfo<>();
+		List<Wobugeq> vos=new ArrayList<>();
 
 		if(StringUtils.notEmp(location) )
 		{
@@ -216,14 +214,14 @@ public class WobugeqService implements BaseService<Wobugeq, WobugeqExample> {
 			}else {
 				example.setOrderByClause("transmittime ASC");
 			}
-			PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
-			List<Wobugeq> vos= wobugeqMapper.selectByExample(example);
-			pageInfo = new PageInfo<Wobugeq>(vos);
+
+			vos= wobugeqMapper.selectByExample(example);
+
 
 
 		}
 
-		return pageInfo;
+		return vos;
 
 	}
 

+ 4 - 5
src/main/java/com/gyee/frame/service/recommen/RecommenService.java

@@ -1,6 +1,5 @@
 package com.gyee.frame.service.recommen;
 
-import com.github.pagehelper.PageInfo;
 import com.gyee.frame.common.spring.Constant;
 import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.*;
@@ -623,14 +622,14 @@ public class RecommenService {
 	 * 通过位置编号获得缺陷单信息
 	 * @return
 	 */
-	public PageInfo<Wobugeq> findWobugeqByLocation(Tablepar tablepar,String location, Date beginDate, Date endDate) {
+	public List<Wobugeq> findWobugeqByLocation(Tablepar tablepar,String location, Date beginDate, Date endDate) {
 
-		PageInfo<Wobugeq> pageInfo=new PageInfo<>();
+		List<Wobugeq> vos=new ArrayList<>();
 		if (StringUtils.notEmp(tablepar) && StringUtils.notEmp(location) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate) ) {
 
-			pageInfo=wobugeqService.findWobugeqByLocation(tablepar,location, beginDate, endDate);
+			vos=wobugeqService.findWobugeqByLocation(tablepar,location, beginDate, endDate);
 		}
-		return pageInfo;
+		return vos;
 	}
 
 

+ 1 - 1
src/main/resources/application.yml

@@ -88,7 +88,7 @@ spring :
     date-format: yyyy-MM-dd HH:mm:ss
   redis:
     database: 0
-    host: 127.0.0.1
+    host: 10.155.32.4
     password: gdnxfd123
     pool:
       max-active: 8

+ 7 - 7
src/main/resources/mybatis/auto/Alertrule2Mapper.xml

@@ -16,7 +16,7 @@
     <result column="MODELID" jdbcType="VARCHAR" property="modelid" />
     <result column="EDNAVALUE" jdbcType="DECIMAL" property="ednavalue" />
     <result column="CATEGORY" jdbcType="VARCHAR" property="category" />
-    <result column="`RANGE`" jdbcType="VARCHAR" property="range" />
+    <result column="RANGE" jdbcType="VARCHAR" property="range" />
     <result column="STATION" jdbcType="VARCHAR" property="station" />
     <result column="WINDTURBINE" jdbcType="VARCHAR" property="windturbine" />
     <result column="LINE" jdbcType="VARCHAR" property="line" />
@@ -97,7 +97,7 @@
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
     ID, NAME, DESCRIPTION, EXPRESSION, TAG, RANK, ENABLED, MODELID, EDNAVALUE, CATEGORY,
-    `RANGE`, STATION, WINDTURBINE, LINE, PROJECT, ELECTRICAL, TASKSTART, RELATEDPARTS
+    RANGE, STATION, WINDTURBINE, LINE, PROJECT, ELECTRICAL, TASKSTART, RELATEDPARTS
   </sql>
   <select id="selectByExample" parameterType="com.gyee.frame.model.auto.Alertrule2Example" resultMap="BaseResultMap">
     <!--
@@ -153,7 +153,7 @@
     insert into ALERTRULE2 (ID, NAME, DESCRIPTION, 
       EXPRESSION, TAG, RANK, 
       ENABLED, MODELID, EDNAVALUE, 
-      CATEGORY, `RANGE`, STATION,
+      CATEGORY, RANGE, STATION,
       WINDTURBINE, LINE, PROJECT, 
       ELECTRICAL, TASKSTART, RELATEDPARTS
       )
@@ -203,7 +203,7 @@
         CATEGORY,
       </if>
       <if test="range != null">
-        `RANGE`,
+        RANGE,
       </if>
       <if test="station != null">
         STATION,
@@ -376,7 +376,7 @@
       MODELID = #{record.modelid,jdbcType=VARCHAR},
       EDNAVALUE = #{record.ednavalue,jdbcType=DECIMAL},
       CATEGORY = #{record.category,jdbcType=VARCHAR},
-    `RANGE` = #{record.range,jdbcType=VARCHAR},
+    RANGE = #{record.range,jdbcType=VARCHAR},
       STATION = #{record.station,jdbcType=VARCHAR},
       WINDTURBINE = #{record.windturbine,jdbcType=VARCHAR},
       LINE = #{record.line,jdbcType=VARCHAR},
@@ -423,7 +423,7 @@
         CATEGORY = #{category,jdbcType=VARCHAR},
       </if>
       <if test="range != null">
-        `RANGE` = #{range,jdbcType=VARCHAR},
+        RANGE = #{range,jdbcType=VARCHAR},
       </if>
       <if test="station != null">
         STATION = #{station,jdbcType=VARCHAR},
@@ -464,7 +464,7 @@
       MODELID = #{modelid,jdbcType=VARCHAR},
       EDNAVALUE = #{ednavalue,jdbcType=DECIMAL},
       CATEGORY = #{category,jdbcType=VARCHAR},
-    `RANGE` = #{range,jdbcType=VARCHAR},
+    RANGE = #{range,jdbcType=VARCHAR},
       STATION = #{station,jdbcType=VARCHAR},
       WINDTURBINE = #{windturbine,jdbcType=VARCHAR},
       LINE = #{line,jdbcType=VARCHAR},

+ 8 - 0
src/main/resources/mybatis/auto/TvuePermissionMapper.xml

@@ -305,4 +305,12 @@
       visible = #{visible,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>
+
+  <select id="findByAdminUserId" parameterType="String" resultMap="BaseResultMap">
+        select distinct p.*,(select count(1) from t_vue_permission where pid=p.id) childcount
+        from t_vue_permission_role spr,t_sys_role_user sru,t_vue_permission p
+        where 	spr.role_id = sru.sys_role_id AND spr.permission_id = p.id AND sru.sys_user_id=#{userId} 
+
+		ORDER BY order_num   ASC,order_num  ASC
+ </select>
 </mapper>

+ 84 - 0
src/test/java/test/EarlyWarnKnowledgeTest.java

@@ -0,0 +1,84 @@
+package test;
+
+import com.github.pagehelper.PageInfo;
+import com.gyee.SpringbootStart;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.common.spring.SpringUtils;
+import com.gyee.frame.controller.health.EarlyWarnKnowledgeController;
+import com.gyee.frame.model.auto.Alertrule2;
+import com.gyee.frame.model.custom.Tablepar;
+import com.gyee.frame.util.StringUtils;
+import lombok.SneakyThrows;
+import org.springframework.boot.SpringApplication;
+
+public class EarlyWarnKnowledgeTest {
+
+    @SneakyThrows
+    public static void main(String[] args) {
+
+        SpringApplication.run(SpringbootStart.class, args);
+
+
+
+        String wtId="MG01_03";
+        String wpId="MHS_FDC";
+        String year="2021";
+        String month="1";
+        String category="bbb";
+        String name="故障";
+
+        String expression="";
+        Integer enabled=0;
+
+
+        EarlyWarnKnowledgeController earlyWarnKnowledgeController= SpringUtils.getBean("earlyWarnKnowledgeController");
+
+        Tablepar tablepar=new Tablepar();
+        tablepar.setPageNum(1);
+        tablepar.setPageSize(10);
+        tablepar.setOrderByColumn("name");
+        tablepar.setIsAsc("asc");
+
+
+        Alertrule2 po=new Alertrule2();
+
+        po.setId(StringUtils.getUUID());
+        po.setCategory("ccc");
+        po.setRank("3");
+        po.setName("test1");
+        po.setExpression("111");
+        po.setEnabled(0);
+
+
+        earlyWarnKnowledgeController.insertFaultknowledge(po);
+
+
+        AjaxResult result=earlyWarnKnowledgeController.findFaultknowledge(po.getId());
+
+        Alertrule2 po2=(Alertrule2)result.get("data");
+
+        if(StringUtils.notEmp(po2))
+        {
+            po.setCategory("bbb");
+            po.setRank("6");
+            po.setName("test2");
+            po.setExpression("222");
+            po.setEnabled(1);
+            earlyWarnKnowledgeController.updateFaultknowledge(po2);
+        }
+        AjaxResult ar = earlyWarnKnowledgeController.earlyWarnKnowledgeList(tablepar,null,category,null);
+
+        PageInfo<Alertrule2> vos=(PageInfo<Alertrule2>)ar.get("data");
+
+
+        for(Alertrule2 wtd:vos.getList())
+        {
+            System.out.println(wtd.getName()+"----------------"+wtd.getCategory()
+                   +"----------------"+wtd.getRank()+"----------------"+wtd.getExpression()+"----------------"+wtd.getEnabled());
+        }
+
+
+        earlyWarnKnowledgeController.deleteFaultknowledge(po2.getId());
+
+    }
+}

+ 28 - 0
src/test/java/test/GlobalCacheTest.java

@@ -0,0 +1,28 @@
+package test;
+
+import com.gyee.SpringbootStart;
+import com.gyee.frame.common.cache.IGlobalCache;
+import com.gyee.frame.common.spring.SpringUtils;
+import lombok.SneakyThrows;
+import org.springframework.boot.SpringApplication;
+
+public class GlobalCacheTest {
+
+    @SneakyThrows
+    public static void main(String[] args) {
+
+        SpringApplication.run(SpringbootStart.class, args);
+
+
+
+        IGlobalCache globalCache= SpringUtils.getBean("globalCache");
+
+        globalCache.set("test",11111);
+
+
+    }
+
+
+
+
+}

+ 16 - 14
src/test/java/test/RecommenTest.java

@@ -4,12 +4,14 @@ import com.gyee.SpringbootStart;
 import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.common.spring.SpringUtils;
 import com.gyee.frame.controller.recommen.RecommenController;
+import com.gyee.frame.model.auto.Wobugeq;
 import com.gyee.frame.model.custom.Tablepar;
 import lombok.SneakyThrows;
 import org.springframework.boot.SpringApplication;
 
 import java.util.Calendar;
 import java.util.Date;
+import java.util.List;
 
 public class RecommenTest {
 
@@ -141,25 +143,25 @@ public class RecommenTest {
 //        }
 //        System.out.println("**********************************************************************************");
 //
-        AjaxResult ajaxResult = recommenController.findLocationTreeByWtId("MG01_01");
-
-        String test = (String) ajaxResult.get("data");
-
-        System.out.println(test);
+//        AjaxResult ajaxResult = recommenController.findLocationTreeByWtId("MG01_01");
+//
+//        String test = (String) ajaxResult.get("data");
+//
+//        System.out.println(test);
 //
 //        System.out.println("**********************************************************************************");
         Tablepar tablepar = new Tablepar();
         tablepar.setPageNum(1);
         tablepar.setPageSize(10);
-//       AjaxResult ajaxResult2 = recommenController.findWobugeqByLocation(tablepar,"010101020101");
-////
-////        PageInfo<Wobugeq> value=(PageInfo<Wobugeq>)ajaxResult2.get("data");
-////        List<Wobugeq> test2=value.getList();
-////        for(Wobugeq wtd:test2)
-////        {
-////            System.out.println(wtd.getBugnum()+"----------------"+wtd.getArrivaltime()+"----------------"+wtd.getProdtdeptopinion());
-////        }
-////        System.out.println("**********************************************************************************");
+       AjaxResult ajaxResult2 = recommenController.findWobugeqByLocation(tablepar,"02055002");
+
+        List<Wobugeq> test2=(List<Wobugeq>)ajaxResult2.get("data");
+
+        for(Wobugeq wtd:test2)
+        {
+            System.out.println(wtd.getBugnum()+"----------------"+wtd.getArrivaltime()+"----------------"+wtd.getProdtdeptopinion());
+        }
+        System.out.println("**********************************************************************************");
 //
 //        AjaxResult ajaxResult2 = recommenController.unfinishedList(null,null,"2016-08-22","2020-08-22");
 //