Browse Source

添加医生手机号重复时逻辑

半月无霜 4 years ago
parent
commit
7c31c8390a

+ 5 - 0
UI/src/pages/ymall/Doctor.js

@@ -354,6 +354,7 @@ class Doctor extends React.Component {
                     {
                         name: "未通过原因",
                         tips: "请输入审核不通过的理由",
+                        isRequired: true,
                         key: "cause",
                         fieldType: "textarea",
                     }
@@ -550,6 +551,10 @@ class Doctor extends React.Component {
     checkMsg(){
         let cause = this.refs.checkMsgFrom.state.initValue.cause;
         this.refs.checkForm.state.initValue.cause = cause;
+        if(cause==null || cause==""){
+            message.error("请输入审核未通过原因!")
+            return
+        }
         this.setState({
             checkMsgVisible: false
         })

+ 6 - 3
ymall/src/main/java/com/liangjian11/ymall/service/impl/DoctorServiceImpl.java

@@ -348,7 +348,7 @@ public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> impleme
     UpdateWrapper<UserAccount> wrapper = new UpdateWrapper<>();
     wrapper.eq("wxopenid", openid);
     UserAccount userAccount = userAccountMapper.selectOne(wrapper);
-    QueryWrapper wrapperD = new QueryWrapper() {{
+    QueryWrapper<Doctor> wrapperD = new QueryWrapper() {{
       eq("phone", enPhone);
     }};
     QueryWrapper wrapperP = new QueryWrapper() {{
@@ -356,8 +356,8 @@ public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> impleme
     }};
     // 默认是医生的用户手机号绑定
     if (StringUtils.isBlank(redirectCode) || "personalInfo".equals(redirectCode)) {
-      List list = doctorMapper.selectList(wrapperD);
-      if (list.size() > 0) {
+      List<Doctor> doctorList = doctorMapper.selectList(wrapperD);
+      if (doctorList.size() > 0) {
         UpdateWrapper<UserAccount> wp = new UpdateWrapper<>();
         wp.setSql("mobile = null ");
         wp.eq("mobile", enPhone);
@@ -371,6 +371,9 @@ public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> impleme
         doctor.setUnionid(userAccount.getUnionid());
         doctor.setPhone(enPhone);
         doctorMapper.updateOne(doctor);
+  
+        userRoleService.addUserRole(userAccount, userAccount.getNickname(),
+                userAccount.getHeadimg(), doctorList.get(0).getId(), 1, 1);
       }
     }
     Partner countPart = partnerMapper.selectOne(wrapperP);