From e52ddfe8caf7d0027950033a5aff2a1fd3482e9d Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 01 六月 2022 17:50:25 +0800
Subject: [PATCH] 优化装修 跟踪记录 回显

---
 service-user/src/main/java/com/java110/user/api/StaffApi.java |   55 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 48 insertions(+), 7 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 d1dfd79..c66f537
--- a/service-user/src/main/java/com/java110/user/api/StaffApi.java
+++ b/service-user/src/main/java/com/java110/user/api/StaffApi.java
@@ -1,21 +1,29 @@
 package com.java110.user.api;
 
 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;
 import com.java110.user.bmo.staffAppAuth.ISaveStaffAppAuthBMO;
 import com.java110.user.bmo.staffAppAuth.IUpdateStaffAppAuthBMO;
+import com.java110.utils.cache.MappingCache;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 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
@@ -31,6 +39,9 @@
 
     @Autowired
     private IGetStaffAppAuthBMO getStaffAppAuthBMOImpl;
+
+    @Autowired
+    private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl;
 
     /**
      * 寰俊淇濆瓨娑堟伅妯℃澘
@@ -54,18 +65,20 @@
     /**
      * 寰俊淇敼娑堟伅妯℃澘
      *
-     * @param reqJson
+     * @param param
      * @return
      * @serviceCode /staff/updateStaffAppAuth
      * @path /app/staff/updateStaffAppAuth
+     * <p>
+     * {"openId":"oxeFbwJzDG8t87dVDcmrlRoPsTfM","appType":"WECHAT","state":"2002","storeId":"402019032924930007","staffId":"30518940136629616640"}
      */
     @RequestMapping(value = "/updateStaffAppAuth", method = RequestMethod.POST)
-    public ResponseEntity<String> updateStaffAppAuth(@RequestBody JSONObject reqJson) {
-
+    public ResponseEntity<String> updateStaffAppAuth(@RequestBody String param) {
+        JSONObject reqJson = JSONObject.parseObject(param);
         Assert.hasKeyAndValue(reqJson, "staffId", "璇锋眰鎶ユ枃涓湭鍖呭惈staffId");
         Assert.hasKeyAndValue(reqJson, "appType", "璇锋眰鎶ユ枃涓湭鍖呭惈appType");
-        Assert.hasKeyAndValue(reqJson, "auId", "auId涓嶈兘涓虹┖");
-
+        Assert.hasKeyAndValue(reqJson, "openId", "璇锋眰鎶ユ枃涓湭鍖呭惈openId");
+        Assert.hasKeyAndValue(reqJson, "state", "璇锋眰鎶ユ枃涓湭鍖呭惈state");
 
         StaffAppAuthPo staffAppAuthPo = BeanConvertUtil.covertBean(reqJson, StaffAppAuthPo.class);
         return updateStaffAppAuthBMOImpl.update(staffAppAuthPo);
@@ -99,8 +112,8 @@
      * @path /app/staff/queryStaffAppAuth
      */
     @RequestMapping(value = "/queryStaffAppAuth", method = RequestMethod.GET)
-    public ResponseEntity<String> queryStaffAppAuth(@RequestParam(value = "store-id") String storeId,
-                                                    @RequestParam(value = "user-id") String userId,
+    public ResponseEntity<String> queryStaffAppAuth(@RequestHeader(value = "store-id") String storeId,
+                                                    @RequestHeader(value = "user-id") String userId,
                                                     @RequestParam(value = "page") int page,
                                                     @RequestParam(value = "row") int row) {
         StaffAppAuthDto staffAppAuthDto = new StaffAppAuthDto();
@@ -110,4 +123,32 @@
         staffAppAuthDto.setStaffId(userId);
         return getStaffAppAuthBMOImpl.get(staffAppAuthDto);
     }
+
+    /**
+     * 寰俊鍒犻櫎娑堟伅妯℃澘
+     *
+     * @param storeId 灏忓尯ID
+     * @return
+     * @serviceCode /staff/generatorQrCode
+     * @path /app/staff/generatorQrCode
+     */
+    @RequestMapping(value = "/generatorQrCode", method = RequestMethod.GET)
+    public ResponseEntity<String> generatorQrCode(@RequestHeader(value = "store-id") String storeId,
+                                                  @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