|  |  |  | @ -2,13 +2,16 @@ package cn.estsh.i3plus.core.apiservice.controller.base; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.core.api.iservice.base.ISysUserService; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.core.api.iservice.base.ISystemLoginService; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.core.api.iservice.busi.ICoreTreeService; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.core.apiservice.controller.DemoAuthController; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.pojo.platform.bean.Department; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.pojo.platform.bean.SessionUser; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.boot.auth.AuthUtil; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.boot.exception.ImppBusiException; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.boot.util.ImppRedis; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.boot.util.ResultBean; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.boot.util.ValidatorBean; | 
		
	
		
			
				|  |  |  |  | import io.swagger.annotations.Api; | 
		
	
		
			
				|  |  |  |  | import io.swagger.annotations.ApiOperation; | 
		
	
		
			
				|  |  |  |  | import org.slf4j.Logger; | 
		
	
	
		
			
				
					|  |  |  | @ -18,7 +21,6 @@ import org.springframework.web.bind.annotation.GetMapping; | 
		
	
		
			
				|  |  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
		
	
		
			
				|  |  |  |  | import org.springframework.web.bind.annotation.RestController; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import javax.annotation.Resource; | 
		
	
		
			
				|  |  |  |  | import javax.servlet.http.HttpServletRequest; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /** | 
		
	
	
		
			
				
					|  |  |  | @ -47,12 +49,17 @@ public class AuthController { | 
		
	
		
			
				|  |  |  |  |     public ResultBean login(HttpServletRequest request, String loginName, String loginPwd, String languageCode){ | 
		
	
		
			
				|  |  |  |  |         LOGGER.info("用户登陆 loginName:{} loginPwd:{} languageCode:{}",loginName,loginPwd,languageCode); | 
		
	
		
			
				|  |  |  |  |         try { | 
		
	
		
			
				|  |  |  |  |             ValidatorBean.checkNotNull(loginName,"用户名不能为空"); | 
		
	
		
			
				|  |  |  |  |             ValidatorBean.checkNotNull(loginPwd,"密码不能为空"); | 
		
	
		
			
				|  |  |  |  |             ValidatorBean.checkNotNull(languageCode,"语言不能为空"); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             SessionUser user = userService.queryUserLogin(loginName,loginPwd,languageCode); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             LOGGER.info("会员登陆:{}",user); | 
		
	
		
			
				|  |  |  |  |             AuthUtil.setSessionObject("languageCode",languageCode); | 
		
	
		
			
				|  |  |  |  |             String sessionId = request.getSession().getId(); | 
		
	
		
			
				|  |  |  |  |             String token = "{accessToken:'"+sessionId+"',expiresIn:1800}"; | 
		
	
		
			
				|  |  |  |  |             return new ResultBean(true,"",token); | 
		
	
		
			
				|  |  |  |  |             return new ResultBean(true,token,AuthUtil.getSessionUser()); | 
		
	
		
			
				|  |  |  |  |         } catch (ImppBusiException e) { | 
		
	
		
			
				|  |  |  |  |             return new ResultBean(false,e.getErrorDetail() + ",so:" + e.getErrorSolution()); | 
		
	
		
			
				|  |  |  |  |         }catch (Exception e){ | 
		
	
	
		
			
				
					|  |  |  | @ -94,4 +101,39 @@ public class AuthController { | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
		
			
				|  |  |  |  |      * @Description : 系统资源服务demo | 
		
	
		
			
				|  |  |  |  |      * @Reference : | 
		
	
		
			
				|  |  |  |  |      * @Author : alwaysfrin | 
		
	
		
			
				|  |  |  |  |      * @CreateDate : 2018-09-26 10:34 | 
		
	
		
			
				|  |  |  |  |      * @Modify: | 
		
	
		
			
				|  |  |  |  |      **/ | 
		
	
		
			
				|  |  |  |  |     @RestController | 
		
	
		
			
				|  |  |  |  |     @RequestMapping("/core/tree") | 
		
	
		
			
				|  |  |  |  |     @Api(description="系统服务demo") | 
		
	
		
			
				|  |  |  |  |     public static class CoreTreeController { | 
		
	
		
			
				|  |  |  |  |         private static final Logger LOGGER = LoggerFactory.getLogger(CoreTreeController.class); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         @Autowired | 
		
	
		
			
				|  |  |  |  |         private ICoreTreeService coreTreeService; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         @GetMapping(value="/department") | 
		
	
		
			
				|  |  |  |  |         @ApiOperation(value="查询部门树",notes="通过部门主键获取部门树,-1为根节点") | 
		
	
		
			
				|  |  |  |  |         public ResultBean listDepartmentTree(long depParentId) { | 
		
	
		
			
				|  |  |  |  |             try { | 
		
	
		
			
				|  |  |  |  |                 Department department = coreTreeService.getDepartmentTreeByParentId(depParentId); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |                 return ResultBean.success("查询部门树成功") | 
		
	
		
			
				|  |  |  |  |                         .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()) | 
		
	
		
			
				|  |  |  |  |                         .setResultObject(department); | 
		
	
		
			
				|  |  |  |  |             }catch(ImppBusiException busExcep){ | 
		
	
		
			
				|  |  |  |  |                 LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep); | 
		
	
		
			
				|  |  |  |  |                 return ResultBean.fail(busExcep.getErrorShow()); | 
		
	
		
			
				|  |  |  |  |             }catch(Exception e){ | 
		
	
		
			
				|  |  |  |  |                 LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + ":{}",e.getMessage(),e); | 
		
	
		
			
				|  |  |  |  |                 return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode()); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |