ソースを参照

合伙人收益管理迁移

liaoyongfei 4 年 前
コミット
cf1439133a

+ 1 - 1
ymall/src/main/java/com/liangjian11/ymall/controller/PartnerAPIController.java

@@ -218,7 +218,7 @@ public class PartnerAPIController {
       JSONArray messageList = new JSONArray();
       JSONObject messageJson = new JSONObject();
       messageJson.put("msgType", "text");
-      StringBuilder contentSB = new StringBuilder("注册链接<a href=\"").append(redirectPathSource.getFrontHost()).append("/#selectRoles?SuperiorPartnerID=")
+      StringBuilder contentSB = new StringBuilder("注册链接<a href=\"").append(redirectPathSource.getFrontHost()).append("/#/selectRoles?SuperiorPartnerID=")
         .append(partner.getId()).append("\">请点这里</a>");
       messageJson.put("content", contentSB.toString());
       messageList.add(messageJson);

+ 12 - 20
ymall/src/main/java/com/liangjian11/ymall/service/impl/DoctorServiceImpl.java

@@ -148,10 +148,9 @@ public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> impleme
       }
     }
 
+    userRoleService.addUserRole(user, user.getNickname(), user.getHeadimg(), doctor.getId(), 1, 99); //添加userRole
     //绑定合伙人
     if (!StringUtils.isEmpty(doctor.getPartnerID())) {
-      userRoleService.addUserRole(user, user.getNickname(), user.getHeadimg(), doctor.getId(), 1, 1); //添加userRole
-
       QueryWrapper<PartnerRecommend> recQuery = new QueryWrapper<>();
       recQuery.eq("subordinate_id", doctor.getId());
       int reci = partnerRecommendService.count(recQuery);
@@ -169,18 +168,6 @@ public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> impleme
   public ResultInfo update(Doctor doctor) {
     String msg = "修改成功";
     Integer checkStatus = doctor.getCheckStatus() != null ? doctor.getCheckStatus() : 1;
-    QueryWrapper<UserRole> userRoleQuery = new QueryWrapper<>();
-    userRoleQuery.eq("user_role_type", 1);
-    userRoleQuery.eq("user_role_id", doctor.getId());
-    UserRole userRole = userRoleMapper.selectOne(userRoleQuery);
-    Integer userRoleStatus = checkStatus.equals(2) ? 1 : checkStatus.equals(1) ? 99 : 98;
-    if (userRole == null) {
-      userRole = new UserRole(1, doctor.getId(), doctor.getUnionid(), doctor.getAccountID(), doctor.getPhone(), doctor.getDoctorName(), userRoleStatus);
-      userRoleMapper.insert(userRole);
-    } else {
-      userRole.setUserRoleStatus(userRoleStatus);
-      userRoleMapper.updateById(userRole);
-    }
     if (2 == checkStatus) A:{
       JSONObject result = otherInsertDoctor(doctor);
       msg = "认证成功";
@@ -190,9 +177,6 @@ public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> impleme
         return ResultUtil.createFail("互联网医院:" + result.getString("errmsg"));
     }
     if (0 == checkStatus) {
-      if (userRole != null)
-        userRoleMapper.deleteById(userRole.getId());
-
       DoctorCheckCause cause = new DoctorCheckCause(doctor);
       dCCMapper.insertOne(cause);
     }
@@ -205,12 +189,20 @@ public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> impleme
     UserAccount account = new UserAccount();
     account.setGender(doctor.getGender());
     userAccountMapper.update(account, wrapper);
-    UserAccount user = userAccountMapper.selectOne(wrapper);
+
+    if(StringUtils.isNotBlank(doctor.getId())){
+      QueryWrapper<UserRole> userRoleQuery = new QueryWrapper<>();
+      userRoleQuery.eq("user_role_type", 1);
+      userRoleQuery.eq("user_role_id", doctor.getId());
+      Integer userRoleStatus = checkStatus.equals(2) ? 1 : checkStatus.equals(1) ? 99 : 98;
+      UserRole userRole = new UserRole();
+      userRole.setUserRoleStatus(userRoleStatus);
+      userRoleMapper.update(userRole,userRoleQuery);
+    }
 
     //绑定合伙人
+    UserAccount user = userAccountMapper.selectOne(wrapper);
     if (StringUtils.isNotBlank(doctor.getPartnerID()) && user != null) {
-      userRoleService.addUserRole(user, user.getNickname(), user.getHeadimg(), doctor.getId(), 1, 1); //添加userRole
-
       QueryWrapper<PartnerRecommend> recQuery = new QueryWrapper<>();
       recQuery.eq("subordinate_id", doctor.getId());
       int reci = partnerRecommendService.count(recQuery);