登录完结撒花

cbx
chenbingxuan 2024-01-11 16:53:15 +08:00
parent f51a92ea03
commit 9d9d3aa146
8 changed files with 52 additions and 52 deletions

View File

@ -1,6 +1,7 @@
package doctor.system.api;
import doctor.common.core.constant.ServiceNameConstants;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.system.api.factory.RemoteDoctorFallbackFactory;
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.RequestParam;
@FeignClient(contextId = "remoteDoctorService", value = ServiceNameConstants.FILE_DOCTOR, fallback = RemoteDoctorFallbackFactory.class)
@FeignClient(contextId = "remoteDoctorService", value = ServiceNameConstants.FILE_DOCTOR, fallbackFactory = RemoteDoctorFallbackFactory.class)
public interface RemoteDoctorService {
@PostMapping("/doctor/getDoctor")
public R<LoginUser> getDoctorInfo(@RequestParam("email") String email);
public R<LoginUser> getDoctorInfo(@RequestParam("email") String email);
@PostMapping("/doctor/getUser")
public R<LoginUser> getUser(@RequestParam("email") String email);

View File

@ -12,7 +12,7 @@ public class Doctor {
private String userName;
private Integer reviewStatus;
private String phone;
private String password;
private String pwd;
private String name;
private String imagePic;
private String jobTitle;
@ -20,6 +20,10 @@ public class Doctor {
private String personalProfile;
private String goodField;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime;
private Department department;
public Department getDepartment() {
@ -30,10 +34,6 @@ public class Doctor {
this.department = department;
}
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime;
public Integer getId() {
return id;
}
@ -82,12 +82,12 @@ public class Doctor {
this.phone = phone;
}
public String getPassword() {
return password;
public String getPwd() {
return pwd;
}
public void setPassword(String password) {
this.password = password;
public void setPwd(String password) {
this.pwd = password;
}
public String getName() {

View File

@ -1,7 +1,5 @@
package doctor.system.api.domain;
import java.security.Timestamp;
public class User {
private int id;
@ -16,8 +14,8 @@ public class User {
private int height;
private int weight;
private String invitationCode;
private Timestamp updateTime;
private Timestamp createTime;
private long updateTime;
private long createTime;
public int getId() {
return id;
@ -115,19 +113,19 @@ public class User {
this.invitationCode = invitationCode;
}
public Timestamp getUpdateTime() {
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Timestamp updateTime) {
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
public Timestamp getCreateTime() {
public long getCreateTime() {
return createTime;
}
public void setCreateTime(Timestamp createTime) {
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
}

View File

@ -1,45 +1,34 @@
package doctor.system.api.factory;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.system.api.RemoteDoctorService;
import doctor.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
@Component
public class RemoteDoctorFallbackFactory implements RemoteDoctorService {
public class RemoteDoctorFallbackFactory implements FallbackFactory<RemoteDoctorService> {
private static final Logger log = LoggerFactory.getLogger(RemoteDoctorFallbackFactory.class);
@Override
public R<LoginUser> getDoctorInfo(String email) {
log.error("文件服务调用失败");
return R.fail("登录超时");
}
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) {
log.error("文件服务调用失败");
return R.fail("登录超时");
}
@Override
public R<LoginUser> getUser(String email) {
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("登录失败");
// }
//
//
// };
// }
};
}
}

View File

@ -3,7 +3,7 @@ package doctor.auth.service;
import doctor.auth.util.RSAUtils;
import doctor.auth.util.RsaKey;
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.security.service.TokenService;
import doctor.system.api.RemoteDoctorService;
@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.UUID;
@Component
public class HealthDoctorService {
@ -31,7 +30,7 @@ public class HealthDoctorService {
} catch (Exception e) {
throw new RuntimeException(e);
}
if (s.equals(data.getSysUser().getPassword())){
if (s.equals(data.getDoctor().getPwd())){
Map<String, Object> token = tokenService.createToken(data);
String accessToken = (String) token.get("access_token");
doctorVo.setSessionId(accessToken);

View File

@ -3,6 +3,7 @@ package doctor.auth.service;
import doctor.auth.util.RSAUtils;
import doctor.auth.util.RsaKey;
import doctor.auth.vo.UserVo;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.common.security.service.TokenService;
import doctor.system.api.RemoteDoctorService;
@ -32,7 +33,7 @@ public class HealthUserService {
} catch (Exception e) {
throw new RuntimeException(e);
}
if (s.equals(data.getSysUser().getPassword())){
if (s.equals(data.getUser().getPwd())){
Map<String, Object> token = tokenService.createToken(data);
String accessToken = (String) token.get("access_token");
doctorUserVo.setSessionId(accessToken);
@ -55,4 +56,15 @@ public class HealthUserService {
}
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);
}
}
}

View File

@ -1,6 +1,7 @@
package doctor.controller;
import com.baomidou.dynamic.datasource.annotation.DS;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.system.api.domain.Doctor;
import doctor.system.api.domain.User;
@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/doctor")
@DS("master")
public class HealthLoginController {
@Autowired

View File

@ -26,4 +26,5 @@ public class DoctorUserServiceImpl implements DoctorUserService {
doctor.setDepartment(department);
return doctor;
}
}