登录完结撒花
parent
f51a92ea03
commit
9d9d3aa146
|
@ -1,6 +1,7 @@
|
||||||
package doctor.system.api;
|
package doctor.system.api;
|
||||||
|
|
||||||
import doctor.common.core.constant.ServiceNameConstants;
|
import doctor.common.core.constant.ServiceNameConstants;
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
import doctor.common.core.domain.R;
|
import doctor.common.core.domain.R;
|
||||||
import doctor.system.api.factory.RemoteDoctorFallbackFactory;
|
import doctor.system.api.factory.RemoteDoctorFallbackFactory;
|
||||||
import doctor.system.api.model.LoginUser;
|
import doctor.system.api.model.LoginUser;
|
||||||
|
@ -8,11 +9,11 @@ import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@FeignClient(contextId = "remoteDoctorService", value = ServiceNameConstants.FILE_DOCTOR, fallback = RemoteDoctorFallbackFactory.class)
|
@FeignClient(contextId = "remoteDoctorService", value = ServiceNameConstants.FILE_DOCTOR, fallbackFactory = RemoteDoctorFallbackFactory.class)
|
||||||
public interface RemoteDoctorService {
|
public interface RemoteDoctorService {
|
||||||
|
|
||||||
@PostMapping("/doctor/getDoctor")
|
@PostMapping("/doctor/getDoctor")
|
||||||
public R<LoginUser> getDoctorInfo(@RequestParam("email") String email);
|
public R<LoginUser> getDoctorInfo(@RequestParam("email") String email);
|
||||||
|
|
||||||
@PostMapping("/doctor/getUser")
|
@PostMapping("/doctor/getUser")
|
||||||
public R<LoginUser> getUser(@RequestParam("email") String email);
|
public R<LoginUser> getUser(@RequestParam("email") String email);
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class Doctor {
|
||||||
private String userName;
|
private String userName;
|
||||||
private Integer reviewStatus;
|
private Integer reviewStatus;
|
||||||
private String phone;
|
private String phone;
|
||||||
private String password;
|
private String pwd;
|
||||||
private String name;
|
private String name;
|
||||||
private String imagePic;
|
private String imagePic;
|
||||||
private String jobTitle;
|
private String jobTitle;
|
||||||
|
@ -20,6 +20,10 @@ public class Doctor {
|
||||||
private String personalProfile;
|
private String personalProfile;
|
||||||
private String goodField;
|
private String goodField;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
private Department department;
|
private Department department;
|
||||||
|
|
||||||
public Department getDepartment() {
|
public Department getDepartment() {
|
||||||
|
@ -30,10 +34,6 @@ public class Doctor {
|
||||||
this.department = department;
|
this.department = department;
|
||||||
}
|
}
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -82,12 +82,12 @@ public class Doctor {
|
||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPwd() {
|
||||||
return password;
|
return pwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassword(String password) {
|
public void setPwd(String password) {
|
||||||
this.password = password;
|
this.pwd = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package doctor.system.api.domain;
|
package doctor.system.api.domain;
|
||||||
|
|
||||||
import java.security.Timestamp;
|
|
||||||
|
|
||||||
public class User {
|
public class User {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
@ -16,8 +14,8 @@ public class User {
|
||||||
private int height;
|
private int height;
|
||||||
private int weight;
|
private int weight;
|
||||||
private String invitationCode;
|
private String invitationCode;
|
||||||
private Timestamp updateTime;
|
private long updateTime;
|
||||||
private Timestamp createTime;
|
private long createTime;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -115,19 +113,19 @@ public class User {
|
||||||
this.invitationCode = invitationCode;
|
this.invitationCode = invitationCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Timestamp getUpdateTime() {
|
public long getUpdateTime() {
|
||||||
return updateTime;
|
return updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdateTime(Timestamp updateTime) {
|
public void setUpdateTime(long updateTime) {
|
||||||
this.updateTime = updateTime;
|
this.updateTime = updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Timestamp getCreateTime() {
|
public long getCreateTime() {
|
||||||
return createTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(Timestamp createTime) {
|
public void setCreateTime(long createTime) {
|
||||||
this.createTime = createTime;
|
this.createTime = createTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +1,34 @@
|
||||||
package doctor.system.api.factory;
|
package doctor.system.api.factory;
|
||||||
|
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
import doctor.common.core.domain.R;
|
import doctor.common.core.domain.R;
|
||||||
import doctor.system.api.RemoteDoctorService;
|
import doctor.system.api.RemoteDoctorService;
|
||||||
import doctor.system.api.model.LoginUser;
|
import doctor.system.api.model.LoginUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class RemoteDoctorFallbackFactory implements RemoteDoctorService {
|
public class RemoteDoctorFallbackFactory implements FallbackFactory<RemoteDoctorService> {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(RemoteDoctorFallbackFactory.class);
|
private static final Logger log = LoggerFactory.getLogger(RemoteDoctorFallbackFactory.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<LoginUser> getDoctorInfo(String email) {
|
public RemoteDoctorService create(Throwable throwable)
|
||||||
log.error("文件服务调用失败");
|
{
|
||||||
return R.fail("登录超时");
|
log.error("文件服务调用失败:{}", throwable.getMessage());
|
||||||
}
|
return new RemoteDoctorService() {
|
||||||
|
@Override
|
||||||
|
public R<LoginUser> getDoctorInfo(String email) {
|
||||||
|
return R.fail("登录失败");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<LoginUser> getUser(String email) {
|
public R<LoginUser> getUser(String email) {
|
||||||
log.error("文件服务调用失败");
|
return R.fail("登录失败");
|
||||||
return R.fail("登录超时");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
};
|
||||||
// public RemoteDoctorService create(Throwable throwable)
|
}
|
||||||
// {
|
|
||||||
// log.error("文件服务调用失败:{}", throwable.getMessage());
|
|
||||||
// return new RemoteDoctorService() {
|
|
||||||
// @Override
|
|
||||||
// public R<LoginUser> getDoctorInfo(String email) {
|
|
||||||
// return R.fail("登录超时");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public R<LoginUser> getUser(String email) {
|
|
||||||
// return R.fail("登录失败");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package doctor.auth.service;
|
||||||
import doctor.auth.util.RSAUtils;
|
import doctor.auth.util.RSAUtils;
|
||||||
import doctor.auth.util.RsaKey;
|
import doctor.auth.util.RsaKey;
|
||||||
import doctor.auth.vo.DoctorVo;
|
import doctor.auth.vo.DoctorVo;
|
||||||
import doctor.auth.vo.UserVo;
|
import doctor.common.core.domain.HealthR;
|
||||||
import doctor.common.core.domain.R;
|
import doctor.common.core.domain.R;
|
||||||
import doctor.common.security.service.TokenService;
|
import doctor.common.security.service.TokenService;
|
||||||
import doctor.system.api.RemoteDoctorService;
|
import doctor.system.api.RemoteDoctorService;
|
||||||
|
@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class HealthDoctorService {
|
public class HealthDoctorService {
|
||||||
|
@ -31,7 +30,7 @@ public class HealthDoctorService {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
if (s.equals(data.getSysUser().getPassword())){
|
if (s.equals(data.getDoctor().getPwd())){
|
||||||
Map<String, Object> token = tokenService.createToken(data);
|
Map<String, Object> token = tokenService.createToken(data);
|
||||||
String accessToken = (String) token.get("access_token");
|
String accessToken = (String) token.get("access_token");
|
||||||
doctorVo.setSessionId(accessToken);
|
doctorVo.setSessionId(accessToken);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package doctor.auth.service;
|
||||||
import doctor.auth.util.RSAUtils;
|
import doctor.auth.util.RSAUtils;
|
||||||
import doctor.auth.util.RsaKey;
|
import doctor.auth.util.RsaKey;
|
||||||
import doctor.auth.vo.UserVo;
|
import doctor.auth.vo.UserVo;
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
import doctor.common.core.domain.R;
|
import doctor.common.core.domain.R;
|
||||||
import doctor.common.security.service.TokenService;
|
import doctor.common.security.service.TokenService;
|
||||||
import doctor.system.api.RemoteDoctorService;
|
import doctor.system.api.RemoteDoctorService;
|
||||||
|
@ -32,7 +33,7 @@ public class HealthUserService {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
if (s.equals(data.getSysUser().getPassword())){
|
if (s.equals(data.getUser().getPwd())){
|
||||||
Map<String, Object> token = tokenService.createToken(data);
|
Map<String, Object> token = tokenService.createToken(data);
|
||||||
String accessToken = (String) token.get("access_token");
|
String accessToken = (String) token.get("access_token");
|
||||||
doctorUserVo.setSessionId(accessToken);
|
doctorUserVo.setSessionId(accessToken);
|
||||||
|
@ -55,4 +56,15 @@ public class HealthUserService {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String pwd = "byMycC4k7TflJmrDH/mGQTF7sJa47DQD9E9dk1js5deJ5i9BKVw4YwIF1e9d6dd3G2poWMuTwS5lxEWU1vP2QfuGC2L54b4BsMw7A3IzWs5aOHtuAr3yQAPhcFLrjFdjlXFucIXJ165iPZB1WE1EtusPvb8cE8nnwkM8g2KrP0I=";
|
||||||
|
|
||||||
|
try {
|
||||||
|
String s = RSAUtils.rsaDecrypt(pwd, RsaKey.PRIVATE_KEY);
|
||||||
|
System.out.printf("明文为:"+s);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package doctor.controller;
|
package doctor.controller;
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
import doctor.common.core.domain.R;
|
import doctor.common.core.domain.R;
|
||||||
import doctor.system.api.domain.Doctor;
|
import doctor.system.api.domain.Doctor;
|
||||||
import doctor.system.api.domain.User;
|
import doctor.system.api.domain.User;
|
||||||
|
@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/doctor")
|
@RequestMapping("/doctor")
|
||||||
@DS("master")
|
|
||||||
public class HealthLoginController {
|
public class HealthLoginController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -26,4 +26,5 @@ public class DoctorUserServiceImpl implements DoctorUserService {
|
||||||
doctor.setDepartment(department);
|
doctor.setDepartment(department);
|
||||||
return doctor;
|
return doctor;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue