医生账号登录接口

master
heminjian502 2 years ago
parent 4d61868bbf
commit 8cc76b2fff

@ -3,12 +3,15 @@ package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.system.domain.req.AppRegisterReq; import com.ruoyi.system.domain.req.AppRegisterReq;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import com.ruoyi.system.domain.TDoctor; import com.ruoyi.system.domain.TDoctor;
import com.ruoyi.system.domain.THospital; import com.ruoyi.system.domain.THospital;
import com.ruoyi.system.service.ITDoctorService; import com.ruoyi.system.service.ITDoctorService;
import com.ruoyi.system.service.ITHospitalService; import com.ruoyi.system.service.ITHospitalService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -34,6 +37,7 @@ import com.ruoyi.system.service.ISysMenuService;
@RestController @RestController
public class SysLoginController public class SysLoginController
{ {
private static final Logger logger = LoggerFactory.getLogger(SysLoginController.class);
@Autowired @Autowired
private SysLoginService loginService; private SysLoginService loginService;
@ -69,12 +73,16 @@ public class SysLoginController
@ApiOperation("app医生登录") @ApiOperation("app医生登录")
@PostMapping("/login/app") @PostMapping("/login/app")
public AjaxResult loginForApp(@RequestBody LoginBody loginBody) { public AjaxResult loginForApp(@RequestBody LoginBody loginBody) {
if (!"123456".equals(loginBody.getPassword())) {
throw new ServiceException("密码错误!");
}
return loginService.loginForApp(loginBody.getUsername(), loginBody.getPassword()); return loginService.loginForApp(loginBody.getUsername(), loginBody.getPassword());
} }
@ApiOperation("app医生完善信息") @ApiOperation("app医生完善信息")
@PostMapping("/login/app/fill/info") @PostMapping("/login/app/fill/info")
public AjaxResult fillInfoForDoctor(@RequestBody @Validated AppRegisterReq req) { public AjaxResult fillInfoForDoctor(@RequestBody @Validated AppRegisterReq req) {
logger.info("fillInfoForDoctor:{}", req);
return loginService.loginForAppFillInfo(req); return loginService.loginForAppFillInfo(req);
} }

@ -37,9 +37,8 @@ public class WechatLoginController extends BaseController {
* @return * @return
*/ */
@PostMapping("/get/openid") @PostMapping("/get/openid")
public AjaxResult getWechatLoginInfo(@RequestBody GetOpenidReq getOpenidReq, HttpServletRequest request) { public AjaxResult getWechatLoginInfo(@RequestBody @Validated GetOpenidReq getOpenidReq, HttpServletRequest request) {
logger.info("mp获取openid, req = [{}]", getOpenidReq); logger.info("mp获取openid, req = [{}]", getOpenidReq);
GetOpenidResp resp = iWechatService.getOpenid(getOpenidReq, request); GetOpenidResp resp = iWechatService.getOpenid(getOpenidReq, request);
return AjaxResult.success(resp); return AjaxResult.success(resp);
} }
@ -51,4 +50,9 @@ public class WechatLoginController extends BaseController {
map.put(Constants.TOKEN, token); map.put(Constants.TOKEN, token);
return AjaxResult.success(map); return AjaxResult.success(map);
} }
@PostMapping("/get/unionid")
public AjaxResult getWechatUnionInfo(@RequestBody @Validated GetOpenidReq getOpenidReq, HttpServletRequest request) {
return AjaxResult.success();
}
} }

@ -124,4 +124,6 @@ xss:
wx: wx:
mpAppId: wxcf05e06d4ab81582 mpAppId: wxcf05e06d4ab81582
mpSecret: 252594e6b980bc2bfc74bbaad92b5e7b mpSecret: 252594e6b980bc2bfc74bbaad92b5e7b
wechatAppId: wxcf05e06d4ab81582
wechatSecret: 252594e6b980bc2bfc74bbaad92b5e7b

@ -10,7 +10,7 @@ import javax.validation.constraints.Pattern;
import java.lang.annotation.*; import java.lang.annotation.*;
@ConstraintComposition(CompositionType.OR) @ConstraintComposition(CompositionType.OR)
@Pattern(regexp = "1[3|4|5|7|8][0-9]\\d{8}") @Pattern(regexp = "1[3|4|5|6|7|8|9][0-9]\\d{8}")
@Documented @Documented
@Constraint(validatedBy = {}) @Constraint(validatedBy = {})
@Target({ElementType.METHOD,ElementType.FIELD,ElementType.CONSTRUCTOR,ElementType.PARAMETER}) @Target({ElementType.METHOD,ElementType.FIELD,ElementType.CONSTRUCTOR,ElementType.PARAMETER})

@ -71,4 +71,15 @@ public class AppRegisterReq implements Serializable {
public void setMedicalLicense(String medicalLicense) { public void setMedicalLicense(String medicalLicense) {
this.medicalLicense = medicalLicense; this.medicalLicense = medicalLicense;
} }
@Override
public String toString() {
return "AppRegisterReq{" +
"name='" + name + '\'' +
", phone='" + phone + '\'' +
", hospitalId=" + hospitalId +
", speciality='" + speciality + '\'' +
", medicalLicense='" + medicalLicense + '\'' +
'}';
}
} }

@ -1,5 +1,6 @@
package com.ruoyi.system.domain.req; package com.ruoyi.system.domain.req;
import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -13,6 +14,7 @@ public class GetOpenidReq implements Serializable {
private String nickName; private String nickName;
private String avatarUrl; private String avatarUrl;
@NotBlank
private String code; private String code;
public String getNickName() { public String getNickName() {

Loading…
Cancel
Save