From 05683f2b2bdbdbe21cf17ad523c21ab338bd1c54 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 19 七月 2022 21:49:55 +0800
Subject: [PATCH] 优化添加设备 功能

---
 service-user/src/main/java/com/java110/user/api/StaffApi.java |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/service-user/src/main/java/com/java110/user/api/StaffApi.java b/service-user/src/main/java/com/java110/user/api/StaffApi.java
old mode 100644
new mode 100755
index 39480c4..edc240a
--- a/service-user/src/main/java/com/java110/user/api/StaffApi.java
+++ b/service-user/src/main/java/com/java110/user/api/StaffApi.java
@@ -2,7 +2,9 @@
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.dto.app.AppDto;
+import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.dto.staffAppAuth.StaffAppAuthDto;
+import com.java110.intf.store.ISmallWeChatInnerServiceSMO;
 import com.java110.po.staffAppAuth.StaffAppAuthPo;
 import com.java110.user.bmo.staffAppAuth.IDeleteStaffAppAuthBMO;
 import com.java110.user.bmo.staffAppAuth.IGetStaffAppAuthBMO;
@@ -14,7 +16,14 @@
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
 
 
 @RestController
@@ -30,6 +39,9 @@
 
     @Autowired
     private IGetStaffAppAuthBMO getStaffAppAuthBMOImpl;
+
+    @Autowired
+    private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl;
 
     /**
      * 寰俊淇濆瓨娑堟伅妯℃澘
@@ -66,7 +78,7 @@
         Assert.hasKeyAndValue(reqJson, "staffId", "璇锋眰鎶ユ枃涓湭鍖呭惈staffId");
         Assert.hasKeyAndValue(reqJson, "appType", "璇锋眰鎶ユ枃涓湭鍖呭惈appType");
         Assert.hasKeyAndValue(reqJson, "openId", "璇锋眰鎶ユ枃涓湭鍖呭惈openId");
-        Assert.hasKeyAndValue(reqJson, "state", "璇锋眰鎶ユ枃涓湭鍖呭惈openId");
+        Assert.hasKeyAndValue(reqJson, "state", "璇锋眰鎶ユ枃涓湭鍖呭惈state");
 
         StaffAppAuthPo staffAppAuthPo = BeanConvertUtil.covertBean(reqJson, StaffAppAuthPo.class);
         return updateStaffAppAuthBMOImpl.update(staffAppAuthPo);
@@ -125,9 +137,18 @@
                                                   @RequestHeader(value = "user-id") String userId,
                                                   @RequestParam(value = "communityId") String communityId) {
 
+        SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
+        smallWeChatDto.setObjId(communityId);
+        smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY);
+        smallWeChatDto.setWechatType(SmallWeChatDto.WECHAT_TYPE_PUBLIC);
+        List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto);
         String ownerUrl = MappingCache.getValue("OWNER_WECHAT_URL")
                 + "/app/staffAuth?storeId=" + storeId + "&staffId=" + userId
                 + "&communityId=" + communityId + "&appId=" + AppDto.WECHAT_OWNER_APP_ID;
+
+        if (smallWeChatDtos != null && smallWeChatDtos.size() > 0) {
+            ownerUrl += ("&wAppId=" + smallWeChatDtos.get(0).getAppId());
+        }
         return ResultVo.createResponseEntity(ownerUrl);
     }
 }

--
Gitblit v1.8.0