Ver código fonte

--换表新增用户表数据

wangbo 4 meses atrás
pai
commit
abb6accc91

+ 11 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/WeChatUnbindService.java

@@ -0,0 +1,11 @@
+package com.rongwei.zhsw.system.service;
+
+import com.rongwei.rwcommon.base.R;
+
+import java.util.Map;
+
+public interface WeChatUnbindService {
+
+    R unbingWechat(Map<String, String> refreshPara, String swUserManagementDo);
+
+}

+ 55 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/WeChatUnbindServiceImpl.java

@@ -0,0 +1,55 @@
+package com.rongwei.zhsw.system.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.rongwe.zhsw.system.domain.SwUserManagementDo;
+import com.rongwe.zhsw.system.domain.SwUserWechatDo;
+import com.rongwe.zhsw.system.dto.UnbindWechatRequest;
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.zhsw.system.service.SwUserManagementService;
+import com.rongwei.zhsw.system.service.SwUserWechatService;
+import com.rongwei.zhsw.system.service.WeChatUnbindService;
+import com.rongwei.zhsw.system.wechat.OwnerService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.Map;
+@Service
+public class WeChatUnbindServiceImpl implements WeChatUnbindService {
+    @Autowired
+    SwUserManagementService swUserManagementService;
+    @Autowired
+    SwUserWechatService swUserWechatService;
+    @Autowired
+    OwnerService ownerService;
+
+    private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
+
+    @Override
+    public R unbingWechat(Map<String, String> refreshPara, String userid) {
+
+        try{
+            UpdateWrapper<SwUserWechatDo> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.eq("deleted", "0");
+            updateWrapper.eq("userid",userid);
+            updateWrapper.set("deleted", "1");
+            swUserWechatService.update(null,updateWrapper);
+
+            UpdateWrapper<SwUserManagementDo> updateWrapper1 =new UpdateWrapper<>();
+            updateWrapper1.eq("id",userid);
+            updateWrapper1.set("wechatbindstatus","0");
+            swUserManagementService.update(null, updateWrapper1);
+
+            ownerService.refreshOwner(refreshPara);
+
+        }catch (Exception e){
+            log.error("解绑微信失败,错误信息:{}", e.getMessage(), e);
+            return R.error("微信解绑失败");
+        }
+
+        return R.ok();
+    }
+
+
+}

+ 12 - 0
zhsw-entity/src/main/java/com/rongwe/zhsw/system/dto/UnbindWechatRequest.java

@@ -0,0 +1,12 @@
+package com.rongwe.zhsw.system.dto;
+
+import com.rongwe.zhsw.system.domain.SwUserManagementDo;
+import lombok.Data;
+
+import java.util.Map;
+
+@Data
+public class UnbindWechatRequest {
+    private Map<String, String> refreshPara;
+    String userid;
+}

+ 27 - 0
zhsw-server/src/main/java/com/rongwei/zhsw/system/controller/WeChatUnbindController.java

@@ -0,0 +1,27 @@
+package com.rongwei.zhsw.system.controller;
+
+import com.rongwe.zhsw.system.domain.SwUserManagementDo;
+import com.rongwe.zhsw.system.dto.UnbindWechatRequest;
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.zhsw.system.service.WeChatUnbindService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+@RestController
+@RequestMapping("/UnbindWechat")
+public class WeChatUnbindController {
+
+    @Autowired
+    WeChatUnbindService weChatUnbindService;
+    /*   解绑*/
+    @PostMapping("/pcunbind")
+    public R unbindWechat(@RequestBody UnbindWechatRequest request){
+        return      weChatUnbindService.unbingWechat(request.getRefreshPara(),request.getUserid());
+
+    }
+}