jpz
zmyYYDS 2024-01-11 22:13:11 +08:00
parent 326b56485f
commit 062364aca8
19 changed files with 27 additions and 105 deletions

View File

@ -22,6 +22,10 @@
<groupId>doctor</groupId>
<artifactId>doctor-common-core</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>

View File

@ -1,7 +1,10 @@
package doctor.system.api.model;
import doctor.system.api.domain.Doctor;
import java.io.Serializable;
import java.util.Set;
import doctor.system.api.domain.Doctor;
import doctor.system.api.domain.SysUser;
import doctor.system.api.domain.User;

View File

@ -1,35 +0,0 @@
package doctor.auth.controller;
import doctor.auth.service.HealthService;
import doctor.auth.vo.DoctorUserVo;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.common.security.service.TokenService;
import doctor.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/doctor/v1")
public class HealthController {
@Autowired
private HealthService healthService;
@PostMapping("/login")
public HealthR<?> login(@RequestParam String email, @RequestParam String pwd) {
DoctorUserVo userInfo = healthService.login(email,pwd);
if (userInfo!=null){
return HealthR.ok(userInfo);
}else {
return HealthR.fail();
}
}
}

View File

@ -1,50 +0,0 @@
package doctor.auth.service;
import doctor.auth.util.RSAUtils;
import doctor.auth.util.RsaKey;
import doctor.auth.vo.DoctorUserVo;
import doctor.common.core.domain.R;
import doctor.common.security.service.TokenService;
import doctor.system.api.RemoteDoctorService;
import doctor.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class HealthService {
@Autowired
private RemoteDoctorService remoteDoctorService;
@Autowired
private TokenService tokenService;
public DoctorUserVo login(String email, String pwd) {
DoctorUserVo doctorUserVo = new DoctorUserVo();
R<LoginUser> userResult = remoteDoctorService.getDoctorUserInfo(email);
LoginUser data = userResult.getData();
String s="";
try {
s = RSAUtils.rsaDecrypt(pwd, RsaKey.PRIVATE_KEY);
} catch (Exception e) {
throw new RuntimeException(e);
}
if (s.equals(data.getSysUser().getPassword())){
Map<String, Object> token = tokenService.createToken(data);
String accessToken = (String) token.get("access_token");
doctorUserVo.setSessionId(accessToken);
doctorUserVo.setEmail(data.getSysUser().getEmail());
doctorUserVo.setUserId(data.getSysUser().getUserId().intValue());
doctorUserVo.setUserName(data.getSysUser().getUserName());
doctorUserVo.setNickName(data.getSysUser().getNickName());
doctorUserVo.setJiGuangPwd(s);
if (data.getSysUser().getSex()=="男"){
doctorUserVo.setSex(0);
}else {
doctorUserVo.setSex(1);
}
return doctorUserVo;
}
return null;
}
}

View File

@ -1,9 +1,9 @@
# Tomcat
server:
server:
port: 9200
# Spring
spring:
spring:
application:
# 应用名称
name: doctor-auth

View File

@ -43,9 +43,9 @@ public class BaseController
/**
*
*/
protected void startPage(Integer page, Integer count)
protected void startPage()
{
PageUtils.startPage(page,count);
PageUtils.startPage();
}
/**

View File

@ -50,7 +50,7 @@ public class GenController extends BaseController
@GetMapping("/list")
public TableDataInfo genList(GenTable genTable)
{
startPage(page, count);
startPage();
List<GenTable> list = genTableService.selectGenTableList(genTable);
return getDataTable(list);
}
@ -79,7 +79,7 @@ public class GenController extends BaseController
@GetMapping("/db/list")
public TableDataInfo dataList(GenTable genTable)
{
startPage(page, count);
startPage();
List<GenTable> list = genTableService.selectDbTableList(genTable);
return getDataTable(list);
}

View File

@ -45,7 +45,7 @@ public class ${ClassName}Controller extends BaseController
#if($table.crud || $table.sub)
public TableDataInfo list(${ClassName} ${className})
{
startPage(page, count);
startPage();
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return getDataTable(list);
}

View File

@ -47,7 +47,7 @@ public class SysJobController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysJob sysJob)
{
startPage(page, count);
startPage();
List<SysJob> list = jobService.selectJobList(sysJob);
return getDataTable(list);
}

View File

@ -38,7 +38,7 @@ public class SysJobLogController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysJobLog sysJobLog)
{
startPage(page, count);
startPage();
List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
return getDataTable(list);
}

View File

@ -42,7 +42,7 @@ public class SysConfigController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysConfig config)
{
startPage(page, count);
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}

View File

@ -45,7 +45,7 @@ public class SysDictDataController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
{
startPage(page, count);
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}

View File

@ -39,7 +39,7 @@ public class SysDictTypeController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysDictType dictType)
{
startPage(page, count);
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}

View File

@ -42,7 +42,7 @@ public class SysLogininforController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor)
{
startPage(page, count);
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}

View File

@ -40,7 +40,7 @@ public class SysNoticeController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysNotice notice)
{
startPage(page, count);
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}

View File

@ -37,7 +37,7 @@ public class SysOperlogController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog)
{
startPage(page, count);
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}

View File

@ -42,7 +42,7 @@ public class SysPostController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysPost post)
{
startPage(page, count);
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
}

View File

@ -50,7 +50,7 @@ public class SysRoleController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysRole role)
{
startPage(page, count);
startPage();
List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list);
}
@ -173,7 +173,7 @@ public class SysRoleController extends BaseController
@GetMapping("/authUser/allocatedList")
public TableDataInfo allocatedList(SysUser user)
{
startPage(page, count);
startPage();
List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list);
}
@ -185,7 +185,7 @@ public class SysRoleController extends BaseController
@GetMapping("/authUser/unallocatedList")
public TableDataInfo unallocatedList(SysUser user)
{
startPage(page, count);
startPage();
List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list);
}

View File

@ -68,7 +68,7 @@ public class SysUserController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysUser user)
{
startPage(page, count);
startPage();
List<SysUser> list = userService.selectUserList(user);
return getDataTable(list);
}