| | |
| | | package com.vincent.rsf.server.system.controller; |
| | | |
| | | import com.vincent.rsf.common.enums.SystemModeType; |
| | | import com.vincent.rsf.common.utils.Utils; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.config.ConfigProperties; |
| | | import com.vincent.rsf.server.common.security.JwtSubject; |
| | | import com.vincent.rsf.server.common.service.EmailService; |
| | | import com.vincent.rsf.server.common.utils.JwtUtil; |
| | | import com.vincent.rsf.server.system.controller.param.LoginParam; |
| | | import com.vincent.rsf.server.system.controller.param.UpdatePasswordParam; |
| | | import com.vincent.rsf.server.system.controller.result.LoginResult; |
| | | import com.vincent.rsf.server.system.controller.result.MenuVo; |
| | | import com.vincent.rsf.server.system.controller.result.SystemInfoVo; |
| | | import com.vincent.rsf.server.system.entity.Menu; |
| | | import com.vincent.rsf.server.system.entity.Tenant; |
| | | import com.vincent.rsf.server.system.entity.User; |
| | |
| | | import com.vincent.rsf.server.system.service.TenantService; |
| | | import com.vincent.rsf.server.system.service.UserLoginService; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | private RoleMenuService roleMenuService; |
| | | @Resource |
| | | private TenantService tenantService; |
| | | @Autowired |
| | | private EmailService emailService; |
| | | |
| | | @PostMapping("/login") |
| | | public R login(@RequestBody LoginParam param, HttpServletRequest request) { |
| | | // System.out.println(userService.encodePassword("123456")); |
| | | // emailService.sendVerificationEmail("t1341870251@gmail.com", "123456"); |
| | | |
| | | String username = param.getUsername(); |
| | | Long tenantId = param.getTenantId(); |
| | | User user = userService.getByUsername(username, tenantId); |
| | |
| | | return R.ok("Sign In Success").add(new LoginResult(accessToken, user, tenant.getName())); |
| | | } |
| | | |
| | | @GetMapping("/system/info") |
| | | public R systemInfo() { |
| | | SystemModeType systemMode = configProperties.getSystemMode(); |
| | | SystemInfoVo infoVo = new SystemInfoVo(); |
| | | infoVo.setName(configProperties.getSystemName()); |
| | | infoVo.setVersion(configProperties.getSystemVersion()); |
| | | infoVo.setMode(systemMode.toString()); |
| | | return R.ok(infoVo); |
| | | } |
| | | |
| | | @GetMapping("/tenant/list") |
| | | public R tenantList() { |
| | | return R.ok().add(tenantService.list()); |