‘linchangsheng’ 2 weeks ago
parent
commit
6bf764b171

+ 11 - 0
src/main/java/com/gree/mall/miniapp/controller/user/UserController.java

@@ -209,6 +209,17 @@ public class UserController {
     }
 
 
+    @PostMapping("/getWebsitId")
+    @ApiOperation(value = "用户选择得网点")
+    public ResponseHelper<List<AdminWebsit>> getWebsitId(
+            @ApiParam(required = true, value = "网点") @RequestParam(required = true) String websitId
+            ,     HttpServletRequest request
+    ) throws RemoteServiceException {
+       userLogic.getWebsitId(websitId,request);
+        return ResponseHelper.success();
+    }
+
+
     @PostMapping("/websitUrl")
     @ApiOperation(value = "返回营业执照")
     public ResponseHelper<String> websitUrl(

+ 22 - 0
src/main/java/com/gree/mall/miniapp/logic/user/UserLogic.java

@@ -627,4 +627,26 @@ public class UserLogic {
         }
     }
 
+    public void getWebsitId(String websitId,HttpServletRequest request) {
+
+        CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat(request);
+        User user = userService.getById(currentCompanyWechat.getUserId());
+        if (!StringUtil.isEmpty(user.getServiceId())) {
+            AdminWebsit adminWebsit = adminWebsitService.getById(user.getWebsitId());
+            return;
+        }
+
+        AdminWebsit adminWebsit = adminWebsitService.getById(websitId);
+
+        if (adminWebsit == null)
+            return;
+
+        user.setWebsitId(adminWebsit.getWebsitId());
+        user.setWebsitName(adminWebsit.getName());
+        user.setCompanyName(adminWebsit.getCompanyName());
+        user.setCompanyWechatId(adminWebsit.getCompanyWechatId());
+        user.updateById();
+        return ;
+
+    }
 }