Explorar o código

企业微信非通讯录同步的用户增加企业微信解绑功能,手机端。

seyason hai 6 meses
pai
achega
e59793fee6

+ 5 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java

@@ -1022,5 +1022,10 @@ public class UserController {
         return msg;
     }
 
+    @RequestMapping("/unbindCorpWX")
+    public HttpRespMsg unbindCorpWX(String userId){
+        return userService.unbindCorpWX(userId, request);
+    }
+
 }
 

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/UserMapper.java

@@ -57,4 +57,6 @@ public interface UserMapper extends BaseMapper<User> {
     List<User> getInActiveBewttenStartAndEndList(ArrayList<Integer> deptIds, String startDate, String endDate);
 
     void updateActiveByIds(List<String> array, int isActive);
+
+    void unbindCorpWX(String id);
 }

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java

@@ -106,4 +106,6 @@ public interface UserService extends IService<User> {
     HttpRespMsg deleteUserSalaryById(String id);
 
     HttpRespMsg getSimpleActiveUserListPage(Integer pageIndex, Integer pageSize, Integer departmentId, HttpServletRequest request, String keyword, String cursor, String userIds) throws Exception;
+
+    HttpRespMsg unbindCorpWX(String userId, HttpServletRequest request);
 }

+ 7 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -2523,6 +2523,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         }
     }
 
+    @Override
+    public HttpRespMsg unbindCorpWX(String userId, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+        userMapper.unbindCorpWX(userId);
+        return respMsg;
+    }
+
     @Override
     public HttpRespMsg getUserListByRole(HttpServletRequest request,String tableName) {
         HttpRespMsg httpRespMsg=new HttpRespMsg();

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/UserMapper.xml

@@ -292,4 +292,8 @@
             #{id}
         </foreach>
     </update>
+    <update id="unbindCorpWX">
+        update user set corpwx_userid=null, corpwx_real_userid=null WHERE id = #{id}
+    </update>
+
 </mapper>

+ 21 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/my/children/center.vue

@@ -43,6 +43,8 @@
                 </template>
             </van-cell>
             <van-button class="logout" @click="logout" block round type="danger" v-if="!isCorpWX">退出登录</van-button>
+
+            <van-button class="logout" @click="unbindCorpWX" block round type="danger" v-if="isCorpWX && userInfo.corpwxUserid != null && userInfo.userNameNeedTranslate != '1'">解除绑定</van-button>
             <!-- <van-button class="logout" @click="logout" block round type="danger" >退出登录</van-button> -->
         </main>
 
@@ -81,6 +83,25 @@
                 localStorage.removeItem("userInfo");
                 this.$router.push("/login");
             },
+            unbindCorpWX() {
+                this.$dialog.confirm({
+                    title: '',
+                    message: '解除绑定后只能通过账号密码登录,您确定吗?'
+                }).then(() => {
+                    this.$axios.post("/user/unbindCorpWX", {userId: this.userInfo.id})
+                    .then(res => {
+                        if(res.code == "ok") {
+                            this.$store.commit("updateLogin", false);
+                            localStorage.removeItem("userInfo");
+                            this.$router.push("/login");
+                        } else {
+                            this.$toast.clear();
+                            this.$toast.fail(res.msg);
+                        }
+                    }).catch(err=> {this.$toast.clear();});
+                }).catch(() => {
+                });
+            },
             bindWeiXin(){
                 //企业微信
                 if (this.isCorpWX && this.userInfo.corpwxUserid != null) {