Эх сурвалжийг харах

fix 值班客服链接获取

zoujiajian 2 жил өмнө
parent
commit
a5dcf24313

+ 1 - 0
netflix-service/src/main/java/com/cyksj/service/corp/CorpCustomerAcquistionService.java

@@ -16,4 +16,5 @@ public interface CorpCustomerAcquistionService {
      */
     String saveClickid(String projectid, String clickid, String callback, Long linkId);
 
+    String getActiveCustomerAcquistionById(Long acLinkId) throws Exception;
 }

+ 34 - 24
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpCustomerAcquistionServiceImpl.java

@@ -53,10 +53,43 @@ public class CorpCustomerAcquistionServiceImpl implements CorpCustomerAcquistion
         CorpCustomerAcquisitionLinkPopularize corpCustomerAcquisitionLinkPopularize = corpCustomerAcquisitionLinkPopularizeMapper.selectById(linkId);
         Long customerAcquistionLinkId = corpCustomerAcquisitionLinkPopularize.getCustomerAcquistionLinkId();
         CorpCustomerAcquisitionLink corpCustomerAcquisitionLink = corpCustomerAcquisitionLinkMapper.selectById(customerAcquistionLinkId);
+        //更新值班获客链接
+        resetAcLinkConfigIfDuty(corpCustomerAcquisitionLink);
+        return corpCustomerAcquisitionLink.getUrl();
+    }
+
+    @Override
+    public String saveClickid(String projectid, String clickid, String callback, Long linkId) {
+        CorpCustomerAcquisitionLinkPopularize corpCustomerAcquisitionLinkPopularize = corpCustomerAcquisitionLinkPopularizeMapper.selectById(linkId);
+
+        if (corpCustomerAcquisitionLinkPopularize == null) {
+            throw BusinessRuntimeException.getInstance("系统出现异常.");
+        }
+        if(StringUtils.isBlank(callback) && StringUtils.isNotBlank(clickid)){
+            callback = "https://nf.video" + "?clickid=" + clickid + "&projectid=" + projectid;
+        }
+        JSONObject params = new JSONObject();
+        params.putOpt("linkId", linkId);
+        params.putOpt("callback", callback);
+        params.putOpt("postApp", "OE");
+        String key = SEQUENCE.nextId().toString();
+        redisService.set(String.format(RedisService.key.CORP_CUSTOMER_ACQUISTION_CLICKID.getName(), key), params.toString(), corpCustomerAcquisitionLinkPopularize.getTime() * 60 * 60);
+
+        return key;
+    }
+
+    @Override
+    public String getActiveCustomerAcquistionById(Long acLinkId) throws Exception {
+        CorpCustomerAcquisitionLink corpCustomerAcquisitionLink = corpCustomerAcquisitionLinkMapper.selectById(acLinkId);
+        resetAcLinkConfigIfDuty(corpCustomerAcquisitionLink);
+        return corpCustomerAcquisitionLink.getUrl();
+    }
+
+
+    public void resetAcLinkConfigIfDuty(CorpCustomerAcquisitionLink corpCustomerAcquisitionLink) throws Exception {
         if (corpCustomerAcquisitionLink == null) {
             throw BusinessRuntimeException.getInstance("获客链接不存在.");
         }
-
         //寻找值班客服
         if (corpCustomerAcquisitionLink.getIsDuty()) {
             String userList = corpCustomerAcquisitionLink.getUserList();
@@ -89,33 +122,10 @@ public class CorpCustomerAcquistionServiceImpl implements CorpCustomerAcquistion
                         corpOps.customerAcquisitionUpdateLink(null, wxCpLinkUpd);
 
                         corpCustomerAcquisitionLinkMapper.updateById(corpCustomerAcquisitionLink);
-
                     }
 
                 }
             }
         }
-        return corpCustomerAcquisitionLink.getUrl();
-    }
-
-    @Override
-    public String saveClickid(String projectid, String clickid, String callback, Long linkId) {
-        CorpCustomerAcquisitionLinkPopularize corpCustomerAcquisitionLinkPopularize = corpCustomerAcquisitionLinkPopularizeMapper.selectById(linkId);
-
-        if (corpCustomerAcquisitionLinkPopularize == null) {
-            throw BusinessRuntimeException.getInstance("系统出现异常.");
-        }
-        if(StringUtils.isBlank(callback) && StringUtils.isNotBlank(clickid)){
-            callback = "https://nf.video" + "?clickid=" + clickid + "&projectid=" + projectid;
-        }
-        JSONObject params = new JSONObject();
-        params.putOpt("linkId", linkId);
-        params.putOpt("callback", callback);
-        params.putOpt("postApp", "OE");
-        String key = SEQUENCE.nextId().toString();
-        redisService.set(String.format(RedisService.key.CORP_CUSTOMER_ACQUISTION_CLICKID.getName(), key), params.toString(), corpCustomerAcquisitionLinkPopularize.getTime() * 60 * 60);
-
-        return key;
     }
-
 }

+ 15 - 0
netflix-web/src/main/java/com/cyksj/web/controller/channel/ChannelController.java

@@ -110,4 +110,19 @@ public class ChannelController {
         log.info("橙子建站带参跳转获客链接 跳转路径:{}", redirect);
         response.sendRedirect(redirect);
     }
+
+    /**
+     * 动态客服 链接
+     * acLinkId 获客链接id
+     */
+    @GetMapping("/customerAcquistion/{acLinkId}")
+    public void getCustomerAcquistionById(@PathVariable Long acLinkId) throws Exception {
+        log.info("动态客服获客链接跳转 acLinkId:{}", acLinkId);
+
+        String url = corpCustomerAcquistionService.getActiveCustomerAcquistionById(acLinkId);
+
+        String redirect = url + "?customer_channel=" + "customer_" + acLinkId;
+        log.info("动态客服获客链接 跳转路径:{}", redirect);
+        response.sendRedirect(redirect);
+    }
 }