diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 9ea21fc..01b082f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -3,12 +3,15 @@ package com.ruoyi.web.controller.system; import java.util.List; import java.util.Set; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.system.domain.req.AppRegisterReq; import io.swagger.annotations.ApiOperation; import com.ruoyi.system.domain.TDoctor; import com.ruoyi.system.domain.THospital; import com.ruoyi.system.service.ITDoctorService; import com.ruoyi.system.service.ITHospitalService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.ObjectUtils; import org.springframework.validation.annotation.Validated; @@ -34,6 +37,7 @@ import com.ruoyi.system.service.ISysMenuService; @RestController public class SysLoginController { + private static final Logger logger = LoggerFactory.getLogger(SysLoginController.class); @Autowired private SysLoginService loginService; @@ -69,12 +73,16 @@ public class SysLoginController @ApiOperation("app医生登录") @PostMapping("/login/app") public AjaxResult loginForApp(@RequestBody LoginBody loginBody) { + if (!"123456".equals(loginBody.getPassword())) { + throw new ServiceException("密码错误!"); + } return loginService.loginForApp(loginBody.getUsername(), loginBody.getPassword()); } @ApiOperation("app医生完善信息") @PostMapping("/login/app/fill/info") public AjaxResult fillInfoForDoctor(@RequestBody @Validated AppRegisterReq req) { + logger.info("fillInfoForDoctor:{}", req); return loginService.loginForAppFillInfo(req); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/WechatLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/WechatLoginController.java index 694e4b0..01c5fee 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/WechatLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/WechatLoginController.java @@ -37,9 +37,8 @@ public class WechatLoginController extends BaseController { * @return */ @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); - GetOpenidResp resp = iWechatService.getOpenid(getOpenidReq, request); return AjaxResult.success(resp); } @@ -51,4 +50,9 @@ public class WechatLoginController extends BaseController { map.put(Constants.TOKEN, token); return AjaxResult.success(map); } + + @PostMapping("/get/unionid") + public AjaxResult getWechatUnionInfo(@RequestBody @Validated GetOpenidReq getOpenidReq, HttpServletRequest request) { + return AjaxResult.success(); + } } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 805e540..095d274 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -124,4 +124,6 @@ xss: wx: mpAppId: wxcf05e06d4ab81582 - mpSecret: 252594e6b980bc2bfc74bbaad92b5e7b \ No newline at end of file + mpSecret: 252594e6b980bc2bfc74bbaad92b5e7b + wechatAppId: wxcf05e06d4ab81582 + wechatSecret: 252594e6b980bc2bfc74bbaad92b5e7b \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Phone.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Phone.java index 647ca80..6694bdf 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Phone.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Phone.java @@ -10,7 +10,7 @@ import javax.validation.constraints.Pattern; import java.lang.annotation.*; @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 @Constraint(validatedBy = {}) @Target({ElementType.METHOD,ElementType.FIELD,ElementType.CONSTRUCTOR,ElementType.PARAMETER}) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppRegisterReq.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppRegisterReq.java index 80ef715..12f027e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppRegisterReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppRegisterReq.java @@ -71,4 +71,15 @@ public class AppRegisterReq implements Serializable { public void setMedicalLicense(String medicalLicense) { this.medicalLicense = medicalLicense; } + + @Override + public String toString() { + return "AppRegisterReq{" + + "name='" + name + '\'' + + ", phone='" + phone + '\'' + + ", hospitalId=" + hospitalId + + ", speciality='" + speciality + '\'' + + ", medicalLicense='" + medicalLicense + '\'' + + '}'; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/GetOpenidReq.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/GetOpenidReq.java index b009936..061046e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/GetOpenidReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/GetOpenidReq.java @@ -1,5 +1,6 @@ package com.ruoyi.system.domain.req; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -13,6 +14,7 @@ public class GetOpenidReq implements Serializable { private String nickName; private String avatarUrl; + @NotBlank private String code; public String getNickName() {