| | |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.company.api.RemoteCompanyUserService; |
| | | import com.ruoyi.company.api.domain.User; |
| | | import com.ruoyi.company.api.domain.dto.MgtCompanyDTO; |
| | | import com.ruoyi.company.api.model.RegisterUser; |
| | | import com.ruoyi.system.api.model.AppUser; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | } |
| | | |
| | | @Operation(summary = "管理端-修改密码") |
| | | @GetMapping("/modify-pwd") |
| | | @PostMapping("/modify-pwd") |
| | | public R<?> modifyPwd(@Valid @RequestBody MgtPasswordDTO dto) { |
| | | try { |
| | | sysLoginService.modifyPwd(dto); |
| | |
| | | |
| | | @PostMapping("companyRegister") |
| | | @Operation(summary = "用户注册接口",description = "用户注册接口") |
| | | public R<?> companyRegister(@RequestBody RegisterUser registerUser) |
| | | public R<?> companyRegister(@RequestBody MgtCompanyDTO registerUser) |
| | | { |
| | | // 用户注册 |
| | | sysLoginService.companyRegister(registerUser); |
| | |
| | | appUser.setAccountName(user.getAccountName()); |
| | | appUser.setPhone(user.getPhone()); |
| | | appUser.setLoginTime(System.currentTimeMillis()); |
| | | appUser.setExpireTime(appUser.getLoginTime() + CacheConstants.EXPIRATION * 60 * 1000L); |
| | | appUser.setToken(token); |
| | | |
| | | // 根据uuid将loginUser缓存 |
| | |
| | | return "login_tokens:" + token; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 公司校验 |
| | | */ |
| | | @PostMapping("check") |
| | | @Operation(summary = "公司校验",description = "公司校验") |
| | | public R<?> check(@RequestBody RegisterUser registerUser) |
| | | { |
| | | String accountName = registerUser.getAccountName(); |
| | | R<User> userByPhoneR = remoteCompanyUserService.getUserByPhone(accountName, SecurityConstants.INNER); |
| | | if (R.isError(userByPhoneR)) { |
| | | throw new RuntimeException(userByPhoneR.getMsg()); |
| | | } |
| | | boolean check = false; |
| | | R<User> userR = new R<>(); |
| | | if (userByPhoneR.getData() != null) { |
| | | check = sysLoginService.check(userByPhoneR.getData(), registerUser.getCompanyName(), registerUser.getIdCardNumber()); |
| | | } |
| | | if (!check){ |
| | | userR = remoteCompanyUserService.getUserByAccountName(accountName, SecurityConstants.INNER); |
| | | if (R.isError(userR)) { |
| | | return R.fail("账号不存在"); |
| | | } |
| | | if (userR.getData() == null) { |
| | | return R.fail("账号不存在"); |
| | | } |
| | | check = sysLoginService.check(userR.getData(), registerUser.getCompanyName(), registerUser.getIdCardNumber()); |
| | | } |
| | | if (!check) { |
| | | return R.fail("账号不存在"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 重置密码 |
| | | */ |