Bläddra i källkod

获客链接客服值班;订单ip信息记录

zoujiajian 2 år sedan
förälder
incheckning
7180592ef4
36 ändrade filer med 438 tillägg och 437 borttagningar
  1. 6 2
      netflix-common/src/main/java/com/cyksj/common/util/StringUtil.java
  2. 3 4
      netflix-dao/src/main/java/com/cyksj/mapper/OrderDonMapper.java
  3. 0 19
      netflix-dao/src/main/java/com/cyksj/mapper/corp/CorpFollowDutyRelateMapper.java
  4. 0 13
      netflix-dao/src/main/java/com/cyksj/mapper/corp/CorpFollowServiceRelateMapper.java
  5. 19 0
      netflix-dao/src/main/java/com/cyksj/model/dto/CorpFollowServiceDto.java
  6. 2 0
      netflix-dao/src/main/java/com/cyksj/model/dto/YhServiceDto.java
  7. 19 0
      netflix-dao/src/main/java/com/cyksj/model/entity/CorpCustomerAcquisitionLink.java
  8. 0 42
      netflix-dao/src/main/java/com/cyksj/model/entity/CorpFollowDutyRelate.java
  9. 0 27
      netflix-dao/src/main/java/com/cyksj/model/entity/CorpFollowServiceRelate.java
  10. 4 0
      netflix-dao/src/main/java/com/cyksj/model/entity/OrderDon.java
  11. 4 0
      netflix-dao/src/main/java/com/cyksj/model/request/OrderPayRequest.java
  12. 20 0
      netflix-dao/src/main/java/com/cyksj/model/views/UserOrderDetailView.java
  13. 0 21
      netflix-dao/src/main/resources/mapper/CorpFollowDutyRelateMapper.xml
  14. 21 0
      netflix-dao/src/main/resources/mapper/OrderDonMapper.xml
  15. 1 1
      netflix-service/src/main/java/com/cyksj/service/corp/CorpCustomerAcquistionService.java
  16. 0 2
      netflix-service/src/main/java/com/cyksj/service/corp/CorpFollowService.java
  17. 3 4
      netflix-service/src/main/java/com/cyksj/service/corp/CorpTagService.java
  18. 13 0
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpCustomerAcquisitionLinkServiceImpl.java
  19. 55 5
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpCustomerAcquistionServiceImpl.java
  20. 10 1
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpEventActionServiceImpl.java
  21. 28 202
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowActiveCodeFrontServiceImpl.java
  22. 22 13
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowDynamicConfigServiceImpl.java
  23. 7 47
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowServiceImpl.java
  24. 14 4
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpTagServiceImpl.java
  25. 0 3
      netflix-service/src/main/java/com/cyksj/service/mange/cms/CmsUserManager.java
  26. 6 0
      netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java
  27. 4 0
      netflix-service/src/main/java/com/cyksj/service/sys/SysConfigService.java
  28. 96 3
      netflix-service/src/main/java/com/cyksj/service/sys/impl/SysConfigServiceImpl.java
  29. 1 2
      netflix-web/src/main/java/com/cyksj/web/controller/channel/ChannelController.java
  30. 9 3
      netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java
  31. 14 3
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CmsCorpFollowActiveCodeController.java
  32. 18 6
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpCustomerAcquistionLinkController.java
  33. 13 4
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpTagController.java
  34. 8 0
      netflix-web/src/main/java/com/cyksj/web/controller/payment/OrderController.java
  35. 18 1
      netflix-web/src/main/java/com/cyksj/web/controller/register/RegisterController.java
  36. 0 5
      netflix-web/src/main/java/com/cyksj/web/controller/sys/SysConfigController.java

+ 6 - 2
netflix-common/src/main/java/com/cyksj/common/util/StringUtil.java

@@ -2,12 +2,12 @@ package com.cyksj.common.util;
 
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.net.http.HttpResponse;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
@@ -482,7 +482,11 @@ public final class StringUtil {
 			return "unknown";
 		}
 		try {
-			String rspStr = HttpUtil.get("http://whois.pconline.com.cn/ipJson.jsp?ip=" + ip + "&json=true");
+			String url = String.format("http://whois.pconline.com.cn/ipJson.jsp?ip=%s" + "&json=true", ip);
+			HttpResponse<String> send = J11HttpC
+					.custom().ofGet().url(url)
+					.send(HttpResponse.BodyHandlers.ofString());
+			String rspStr = send.body();
 			if (StrUtil.isEmpty(rspStr)) {
 				return "unknown";
 			}

+ 3 - 4
netflix-dao/src/main/java/com/cyksj/mapper/OrderDonMapper.java

@@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.cyksj.model.entity.OrderDon;
 import com.cyksj.model.entity.RealGoodsInterestUser;
 import com.cyksj.model.excel.ExcelOrderDonInfo;
-import com.cyksj.model.views.BackgroundDataView;
-import com.cyksj.model.views.BrokenLineObjView;
-import com.cyksj.model.views.ChannelPopularizeView;
-import com.cyksj.model.views.ChannelStatisticsView;
+import com.cyksj.model.views.*;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
@@ -66,4 +63,6 @@ public interface OrderDonMapper extends BaseMapper<OrderDon> {
 	BigDecimal getClearRenewOrderMoney(@Param("startDate") String startDate, @Param("endDate") String endDate);
 
 	BrokenLineObjView selectDsPlatBrokenLineMoney(@Param("sharedId") Long sharedId, @Param("first") String first, @Param("end") String end);
+
+	UserOrderDetailView getTagUserData(@Param("tagName") String tagName, @Param("startTime") String startTime, @Param("endTime") String endTime);
 }

+ 0 - 19
netflix-dao/src/main/java/com/cyksj/mapper/corp/CorpFollowDutyRelateMapper.java

@@ -1,19 +0,0 @@
-package com.cyksj.mapper.corp;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.cyksj.model.entity.CorpFollowDutyRelate;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 项目名: yhlxj2
- * 文件名: CorpFollowDutyRelateMapper
- * 创建者: JavaZou
- * 创建时间:2023/10/9 17:20
- */
-public interface CorpFollowDutyRelateMapper extends BaseMapper<CorpFollowDutyRelate> {
-	List<CorpFollowDutyRelate> selectCorpFollowRelate(@Param("list") List<String> followIds, @Param("isWeekend") Boolean isWeekend);
-
-	List<CorpFollowDutyRelate> selectTodayDutyRelate(@Param("list") List<String> followIds, @Param("type") Integer type);
-}

+ 0 - 13
netflix-dao/src/main/java/com/cyksj/mapper/corp/CorpFollowServiceRelateMapper.java

@@ -1,13 +0,0 @@
-package com.cyksj.mapper.corp;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.cyksj.model.entity.CorpFollowServiceRelate;
-
-/**
- * 项目名: yhlxj
- * 文件名: CorpFollowServiceRelateMapper
- * 创建者: JavaZou
- * 创建时间:2023/10/11 9:49
- */
-public interface CorpFollowServiceRelateMapper extends BaseMapper<CorpFollowServiceRelate> {
-}

+ 19 - 0
netflix-dao/src/main/java/com/cyksj/model/dto/CorpFollowServiceDto.java

@@ -0,0 +1,19 @@
+package com.cyksj.model.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 项目名: yhlxj
+ * 文件名: CorpFollowServiceDto
+ * 创建者: JavaZou
+ * 创建时间:2023/12/21 10:15
+ */
+@Getter
+@Setter
+public class CorpFollowServiceDto {
+
+	private String name;
+
+	private String followId;
+}

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/dto/YhServiceDto.java

@@ -47,6 +47,8 @@ public class YhServiceDto {
 		private Integer index;
 
 		private String url;
+
+		private String followId;
 	}
 
 	public Boolean isBetween(LocalTime currentTime) {

+ 19 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/CorpCustomerAcquisitionLink.java

@@ -1,5 +1,6 @@
 package com.cyksj.model.entity;
 
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.ejlchina.searcher.bean.DbIgnore;
 import lombok.Data;
@@ -32,11 +33,22 @@ public class CorpCustomerAcquisitionLink extends BaseEntity {
      */
     private Long createTime;
 
+    /**
+     * 是否值班 默认不值班false
+     */
+    private Boolean isDuty;
+
     /**
      * 用户列表
      */
     private String userList;
 
+    /**
+     * 客服选择
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private String chooseDutyUsers;
+
 
     /**
      * 是否为无验证
@@ -57,6 +69,13 @@ public class CorpCustomerAcquisitionLink extends BaseEntity {
     @DbIgnore
     private List<String> userStrList;
 
+    /**
+     * 客服选择
+     */
+    @TableField(exist = false)
+    @DbIgnore
+    private List<String> chooseDutyUserList;
+
     /**
      *  标签名称
      */

+ 0 - 42
netflix-dao/src/main/java/com/cyksj/model/entity/CorpFollowDutyRelate.java

@@ -1,42 +0,0 @@
-package com.cyksj.model.entity;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * 项目名: yhlxj2
- * 文件名: CorpFollowDutyRelate
- * 创建者: JavaZou
- * 创建时间:2023/10/9 17:19
- */
-@Getter
-@Setter
-public class CorpFollowDutyRelate extends BaseEntity{
-
-	/**
-	 * 企业微信客服id
-	 */
-	private String followId;
-
-
-	/**
-	 * 企业微信客服名称
-	 */
-	private String followName;
-
-	/**
-	 * 值班客服名称
-	 */
-	private String serviceName;
-
-	private Integer st;
-
-	private Integer et;
-
-	private Integer indexTag;
-
-	/**
-	 * 1工作日,2.周六,3周末
-	 */
-	private Integer type;
-}

+ 0 - 27
netflix-dao/src/main/java/com/cyksj/model/entity/CorpFollowServiceRelate.java

@@ -1,27 +0,0 @@
-package com.cyksj.model.entity;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * 项目名: yhlxj
- * 文件名: CorpFollowServiceRelate
- * 创建者: JavaZou
- * 创建时间:2023/10/11 9:48
- */
-@Getter
-@Setter
-public class CorpFollowServiceRelate extends BaseEntity{
-
-	/**
-	 * 企业微信客服id
-	 */
-	private String followId;
-
-	private String followName;
-
-	/**
-	 * 值班客服名称
-	 */
-	private String serviceName;
-}

+ 4 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/OrderDon.java

@@ -280,6 +280,10 @@ public class OrderDon extends BaseEntity implements Serializable {
      */
     private String phone;
 
+    private String ip;
+
+    private String location;
+
     public enum Status {
         /**
          * 订单状态

+ 4 - 0
netflix-dao/src/main/java/com/cyksj/model/request/OrderPayRequest.java

@@ -146,4 +146,8 @@ public class OrderPayRequest {
      * 下单手机号
      */
     private String phone;
+
+    private String ip;
+
+    private String location;
 }

+ 20 - 0
netflix-dao/src/main/java/com/cyksj/model/views/UserOrderDetailView.java

@@ -0,0 +1,20 @@
+package com.cyksj.model.views;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 项目名: yhlxj
+ * 文件名: UserOrderDetailView
+ * 创建者: JavaZou
+ * 创建时间:2023/12/22 11:41
+ */
+@Getter
+@Setter
+public class UserOrderDetailView {
+	private Integer numOfOrder;
+
+	private BigDecimal orderMoney;
+}

+ 0 - 21
netflix-dao/src/main/resources/mapper/CorpFollowDutyRelateMapper.xml

@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.cyksj.mapper.corp.CorpFollowDutyRelateMapper">
-
-
-    <select id="selectCorpFollowRelate" resultType="com.cyksj.model.entity.CorpFollowDutyRelate">
-        select st,et,index from corp_follow_duty_relate where follow_id in
-        <foreach collection="list" item="item" open="(" separator="," close=")">
-            #{item}
-        </foreach> and is_weekend is ${isWeekend} group by st,et,index
-    </select>
-
-    <select id="selectTodayDutyRelate" resultType="com.cyksj.model.entity.CorpFollowDutyRelate">
-        select st,et from corp_follow_duty_relate where follow_id in
-        <foreach collection="list" item="item" open="(" separator="," close=")">
-            #{item}
-        </foreach>
-        and type = #{type} group by st,et order by st
-    </select>
-</mapper>

+ 21 - 0
netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

@@ -312,4 +312,25 @@
             and curdate &lt; #{end}
         </if>
     </select>
+
+    <select id="getTagUserData" resultType="com.cyksj.model.views.UserOrderDetailView">
+        select count(if(status != 'refund', 1, NULL)) as numOfOrder, (sum(money) - sum(ifnull(refund_money, 0))) / 100 as orderMoney
+        from `order_don` o
+        where exists (select cu.user_id
+        from (select relation_id
+        from `corp_user_tag`
+        where tag_name = #{tagName}) s
+        left join corp_user_follow_relation cufr on cufr.id = s.relation_id
+        left join corp_user_auth ca on ca.external_userid = cufr.corp_user_id
+        left join corp_user cu on cu.id = ca.corp_user_id
+        where cu.user_id != 0 and cu.user_id = o.user_id )
+        and status not in ('close', 'noPayment')
+        <if test="startTime != null">
+            and o.created_time >= #{startTime}
+        </if>
+        <if test="endTime != null">
+            and o.created_time &lt; #{endTime}
+        </if>
+        and money > 0
+    </select>
 </mapper>

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

@@ -9,7 +9,7 @@ public interface CorpCustomerAcquistionService {
     /**
      * 获取获客链接
      */
-    String getUrlByLinkId(Long linkId);
+    String getUrlByLinkId(Long linkId) throws Exception;
 
     /**
      * 存储广告平台标识

+ 0 - 2
netflix-service/src/main/java/com/cyksj/service/corp/CorpFollowService.java

@@ -14,6 +14,4 @@ public interface CorpFollowService{
 	void upActiveCode(CorpFollowActiveCode activeCode) throws Exception;
 
 	void deleteActiveCodeById(Long id) throws Exception;
-
-	void syncActiveCodeFollowRelate(String config) throws Exception;
 }

+ 3 - 4
netflix-service/src/main/java/com/cyksj/service/corp/CorpTagService.java

@@ -6,10 +6,7 @@ import com.cyksj.model.entity.CorpTagRule;
 import com.cyksj.model.entity.CorpTagRuleRelation;
 import com.cyksj.model.excel.CorpUserTagExcelData;
 import com.cyksj.model.request.CorpDelTagReq;
-import com.cyksj.model.views.CorpTagBackView;
-import com.cyksj.model.views.CorpTagGroupView;
-import com.cyksj.model.views.CorpTagHeadDataView;
-import com.cyksj.model.views.CorpUserView;
+import com.cyksj.model.views.*;
 
 import java.util.List;
 
@@ -47,4 +44,6 @@ public interface CorpTagService {
 	 * 新增标签组
 	 */
 	CorpTagGroupView addGroup(CorpTagGroupView tagGroup) throws Exception;
+
+	UserOrderDetailView getTagUserData(String tagName, String startTime, String endTime);
 }

+ 13 - 0
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpCustomerAcquisitionLinkServiceImpl.java

@@ -1,5 +1,6 @@
 package com.cyksj.service.corp.impl;
 
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -18,6 +19,8 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.util.Optional;
+
 /**
  * @author chan
  * @date 2023/11/10 10:08
@@ -42,6 +45,8 @@ public class CorpCustomerAcquisitionLinkServiceImpl extends ServiceImpl<CorpCust
         WxCpLinkAddResp wxCpLinkAddResp = corpOps.customerAcquisitionCreateLink(null, wxCpLinkAdd);
         corpCustomerAcquisitionLink.setUrl(wxCpLinkAddResp.getLink().getUrl());
         corpCustomerAcquisitionLink.setLinkId(wxCpLinkAddResp.getLink().getLinkId());
+
+        corpCustomerAcquisitionLink.setChooseDutyUsers(corpCustomerAcquisitionLink.getUserList());
         this.save(corpCustomerAcquisitionLink);
     }
 
@@ -64,6 +69,14 @@ public class CorpCustomerAcquisitionLinkServiceImpl extends ServiceImpl<CorpCust
         if (corpCustomerAcquisitionLink.getMsgId() == null) {
             corpCustomerAcquisitionLink.setMsgId(0l);
         }
+        Boolean isDuty = Optional.ofNullable(corpCustomerAcquisitionLink.getIsDuty()).orElse(false);
+        if (!isDuty) {
+            corpCustomerAcquisitionLink.setChooseDutyUsers(null);
+        } else {
+            if (StrUtil.isEmpty(corpCustomerAcquisitionLink.getChooseDutyUsers())) {
+                corpCustomerAcquisitionLink.setChooseDutyUsers(corpCustomerAcquisitionLink.getUserList());
+            }
+        }
 
         this.updateById(corpCustomerAcquisitionLink);
     }

+ 55 - 5
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpCustomerAcquistionServiceImpl.java

@@ -1,23 +1,30 @@
 package com.cyksj.service.corp.impl;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.json.JSONObject;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import cn.hutool.json.JSONUtil;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.snowflake.Sequence;
-import com.cyksj.common.util.StringUtil;
-import com.cyksj.mapper.channel.ChannelPopularizeMapper;
+import com.cyksj.common.util.Jsons;
 import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkMapper;
 import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkPopularizeMapper;
 import com.cyksj.model.entity.CorpCustomerAcquisitionLink;
 import com.cyksj.model.entity.CorpCustomerAcquisitionLinkPopularize;
+import com.cyksj.model.request.corp.link.Range;
+import com.cyksj.model.request.corp.link.WxCpLinkUpd;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.corp.CorpCustomerAcquistionService;
+import com.cyksj.service.corp.WxCorpOps;
+import com.cyksj.service.sys.SysConfigService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
 /**
  * @author chan
  * @date 2023/11/28 14:59
@@ -36,15 +43,58 @@ public class CorpCustomerAcquistionServiceImpl implements CorpCustomerAcquistion
 
     private final CorpCustomerAcquisitionLinkMapper corpCustomerAcquisitionLinkMapper;
 
+    private final SysConfigService sysConfigService;
+
+    private final WxCorpOps corpOps;
+
 
     @Override
-    public String getUrlByLinkId(Long linkId) {
+    public String getUrlByLinkId(Long linkId) throws Exception {
         CorpCustomerAcquisitionLinkPopularize corpCustomerAcquisitionLinkPopularize = corpCustomerAcquisitionLinkPopularizeMapper.selectById(linkId);
         Long customerAcquistionLinkId = corpCustomerAcquisitionLinkPopularize.getCustomerAcquistionLinkId();
         CorpCustomerAcquisitionLink corpCustomerAcquisitionLink = corpCustomerAcquisitionLinkMapper.selectById(customerAcquistionLinkId);
         if (corpCustomerAcquisitionLink == null) {
             throw BusinessRuntimeException.getInstance("获客链接不存在.");
         }
+
+        //寻找值班客服
+        if (corpCustomerAcquisitionLink.getIsDuty()) {
+            String userList = corpCustomerAcquisitionLink.getUserList();
+
+            List<String> users = Jsons.parseList(userList, String.class);
+            if (users.size() > 1) {
+                List<String> dutyServices = sysConfigService.getDutyServices();
+                //值班
+                if (CollUtil.isNotEmpty(dutyServices)) {
+
+                    String chooseDutyUsers = corpCustomerAcquisitionLink.getChooseDutyUsers();
+                    if (chooseDutyUsers == null) {
+                        chooseDutyUsers = userList;
+                    }
+                    List<String> chooseUserList = Jsons.parseList(chooseDutyUsers, String.class);
+
+                    Set<String> fitUsers = dutyServices.stream().filter(e -> users.contains(e)).collect(Collectors.toSet());
+                    if (CollUtil.isNotEmpty(fitUsers) && (fitUsers.size() != chooseUserList.size() || !chooseUserList.containsAll(fitUsers))) {
+
+                        corpCustomerAcquisitionLink.setChooseDutyUsers(Jsons.toJson(fitUsers));
+
+                        //更新获客链接
+                        WxCpLinkUpd wxCpLinkUpd = new WxCpLinkUpd();
+                        wxCpLinkUpd.setLinkName(corpCustomerAcquisitionLink.getLinkName());
+                        wxCpLinkUpd.setLinkId(corpCustomerAcquisitionLink.getLinkId());
+                        wxCpLinkUpd.setSkipVerify(corpCustomerAcquisitionLink.getSkipVerify());
+                        Range range = new Range();
+                        range.setUserList(JSONUtil.parseArray(corpCustomerAcquisitionLink.getChooseDutyUsers()).toList(String.class));
+                        wxCpLinkUpd.setRange(range);
+                        corpOps.customerAcquisitionUpdateLink(null, wxCpLinkUpd);
+
+                        corpCustomerAcquisitionLinkMapper.updateById(corpCustomerAcquisitionLink);
+
+                    }
+
+                }
+            }
+        }
         return corpCustomerAcquisitionLink.getUrl();
     }
 

+ 10 - 1
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpEventActionServiceImpl.java

@@ -1018,7 +1018,16 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
 		String userId = message.getUserId();
 		//获客链接
 		Long linkId = customerAcquisitionSaveClickId(customer, corpUser.getUnionid());
-		CorpCustomerAcquisitionLink customerAcquisitionLink = corpCustomerAcquisitionLinkMapper.getByLinkPopularizeId(linkId);
+		CorpCustomerAcquisitionLink customerAcquisitionLink;
+		if (linkId != null) {
+			customerAcquisitionLink = corpCustomerAcquisitionLinkMapper.getByLinkPopularizeId(linkId);
+		} else {
+			//直接使用获客链接
+			customerAcquisitionLink = corpCustomerAcquisitionLinkMapper.selectById(customer);
+		}
+		if (customerAcquisitionLink == null) {
+			return;
+		}
 		corpUser.setCustomerAcquisitionLinkId(customerAcquisitionLink.getId());
 		if (StringUtils.isNotBlank(customerAcquisitionLink.getTags())){
 			try {

+ 28 - 202
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowActiveCodeFrontServiceImpl.java

@@ -5,30 +5,22 @@ import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.constant.Constant;
+import cn.hutool.json.JSONUtil;
 import com.cyksj.common.util.Jsons;
-import com.cyksj.mapper.SysConfigMapper;
 import com.cyksj.mapper.corp.CorpFollowActiveCodeClickRecordMapper;
 import com.cyksj.mapper.corp.CorpFollowActiveCodeMapper;
-import com.cyksj.mapper.corp.CorpFollowDutyRelateMapper;
 import com.cyksj.model.dto.CorpFollowActiveCodeDto;
-import com.cyksj.model.dto.YhServiceDto;
 import com.cyksj.model.entity.CorpFollowActiveCode;
 import com.cyksj.model.entity.CorpFollowActiveCodeClickRecord;
-import com.cyksj.model.entity.SysConfig;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.corp.CorpFollowActiveCodeFrontService;
+import com.cyksj.service.sys.SysConfigService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
-import java.time.DayOfWeek;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
+import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
-import java.util.Optional;
 import java.util.stream.Collectors;
 
 /**
@@ -44,13 +36,11 @@ public class CorpFollowActiveCodeFrontServiceImpl implements CorpFollowActiveCod
 
 	private final CorpFollowActiveCodeMapper corpFollowActiveCodeMapper;
 
-	private final CorpFollowDutyRelateMapper corpFollowDutyRelateMapper;
-
 	private final CorpFollowActiveCodeClickRecordMapper corpFollowActiveCodeClickRecordMapper;
 
 	private final RedisService redisService;
 
-	private final SysConfigMapper sysConfigMapper;
+	private final SysConfigService sysConfigService;
 
 	@Override
 	public String getCorpActiveQrCode(Long acId) throws Exception {
@@ -88,169 +78,44 @@ public class CorpFollowActiveCodeFrontServiceImpl implements CorpFollowActiveCod
 		//星期五-->星期六 星期六--->星期天 星期天-->星期一
 		//值班
 		if (corpFollowActiveCode.getIsDuty()) {
-//			if (activeCodeDtos.size() == 1) {
-//				CorpFollowActiveCodeDto corpFollowActiveCodeDto = activeCodeDtos.get(0);
-//				qrCode = corpFollowActiveCodeDto.getQrCode();
-//				redisService.set(activeCodeKey, qrCode, RedisService.key.CORP_FOLLOW_ACTIVE_CODE_KEY.getTimeout());
-//				return qrCode;
-//			}
-//			List<CorpFollowDutyRelate> corpFollowDutyRelates = corpFollowDutyRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowDutyRelate.class)
-//					.le(CorpFollowDutyRelate::getSt, hour)
-//					.ge(CorpFollowDutyRelate::getEt, hour)
-//					.eq(CorpFollowDutyRelate::getType, type));
-//			if (CollUtil.isNotEmpty(corpFollowDutyRelates)) {
-//				qrCode = getActiveQrCode(corpFollowDutyRelates, activeCodeDtos);
-//				redisService.set(activeCodeKey, qrCode, RedisService.key.CORP_FOLLOW_ACTIVE_CODE_KEY.getTimeout());
-//				return qrCode;
-//			}
-//			Integer index;
-//			//未在时间期间
-//			//若在当天之前
-//			//若在当天之后 寻找下日值班客服
-//			List<CorpFollowDutyRelate> todayCorpFollowDuty = corpFollowDutyRelateMapper.selectTodayDutyRelate(followIds, type);
-//			if (CollUtil.isEmpty(todayCorpFollowDuty)) {
-//				List<CorpFollowDutyRelate> dutyRelateList = corpFollowDutyRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowDutyRelate.class)
-//						.ne(CorpFollowDutyRelate::getType, type));
-//				Integer fType = type;
-//				//优化获取下一个工作日 客服
-//				List<CorpFollowDutyRelate> collect = dutyRelateList.stream().filter(data -> data.getType() > fType).collect(Collectors.toList());
-//				if (CollUtil.isEmpty(collect)) {
-//					collect = dutyRelateList;
-//				}
-//				collect.sort(Comparator.comparing(CorpFollowDutyRelate::getSt));
-//				qrCode = getActiveQrCode(collect, activeCodeDtos);
-//				redisService.set(activeCodeKey, qrCode, RedisService.key.CORP_FOLLOW_ACTIVE_CODE_KEY.getTimeout());
-//				return qrCode;
-//			}
-//			CorpFollowDutyRelate relate = todayCorpFollowDuty.get(0);
-//			Integer st = relate.getSt();
-//			Integer et = relate.getEt();
-//			//当天
-//			if (hour < st) {
-//				qrCode = getActiveQrCode(corpFollowDutyRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowDutyRelate.class)
-//						.eq(CorpFollowDutyRelate::getSt, st)
-//						.eq(CorpFollowDutyRelate::getEt, et)
-//						.eq(CorpFollowDutyRelate::getType, type)), activeCodeDtos);
-//				redisService.set(activeCodeKey, qrCode, RedisService.key.CORP_FOLLOW_ACTIVE_CODE_KEY.getTimeout());
-//				return qrCode;
-//			}
-//			//下一天
-//			CorpFollowDutyRelate corpFollowDutyRelate = todayCorpFollowDuty.get(todayCorpFollowDuty.size() - 1);
-//			Integer f_et = corpFollowDutyRelate.getEt();
-//			//如果是周五-->周六 周六下午-->周日 周日下午-->周一
-//			if (hour > f_et) {
-//				if (week == Week.FRIDAY) {
-//					index = 3;
-//					corpFollowDutyRelates = corpFollowDutyRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowDutyRelate.class)
-//							.eq(CorpFollowDutyRelate::getIndexTag, index)
-//							.in(CorpFollowDutyRelate::getFollowId, followIds));
-//					if (CollUtil.isEmpty(corpFollowDutyRelates)) {
-//						index = 4;
-//						corpFollowDutyRelates = corpFollowDutyRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowDutyRelate.class)
-//								.eq(CorpFollowDutyRelate::getIndexTag, index)
-//								.in(CorpFollowDutyRelate::getFollowId, followIds));
-//					}
-//					qrCode = getActiveQrCode(corpFollowDutyRelates, activeCodeDtos);
-//				} else if (week == Week.SATURDAY) {
-//					index = 5;
-//					corpFollowDutyRelates = corpFollowDutyRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowDutyRelate.class)
-//							.eq(CorpFollowDutyRelate::getIndexTag, index)
-//							.in(CorpFollowDutyRelate::getFollowId, followIds));
-//					if (CollUtil.isEmpty(corpFollowDutyRelates)) {
-//						index = 6;
-//						corpFollowDutyRelates = corpFollowDutyRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowDutyRelate.class)
-//								.eq(CorpFollowDutyRelate::getIndexTag, index)
-//								.in(CorpFollowDutyRelate::getFollowId, followIds));
-//					}
-//					qrCode = getActiveQrCode(corpFollowDutyRelates, activeCodeDtos);
-//				}else {
-//					index = 1;
-//					corpFollowDutyRelates = corpFollowDutyRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowDutyRelate.class)
-//							.eq(CorpFollowDutyRelate::getIndexTag, index)
-//							.in(CorpFollowDutyRelate::getFollowId, followIds));
-//					if (CollUtil.isEmpty(corpFollowDutyRelates)) {
-//						index = 2;
-//						corpFollowDutyRelates = corpFollowDutyRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowDutyRelate.class)
-//								.eq(CorpFollowDutyRelate::getIndexTag, index)
-//								.in(CorpFollowDutyRelate::getFollowId, followIds));
-//					}
-//					qrCode = getActiveQrCode(corpFollowDutyRelates, activeCodeDtos);
-//				}
-//				redisService.set(activeCodeKey, qrCode, RedisService.key.CORP_FOLLOW_ACTIVE_CODE_KEY.getTimeout());
-//				return qrCode;
-//			}
-//			//兜底
-//			log.info("当前时间:{}客户通过活动acId:{}未到获取客服活码,进行兜底", DateTime.now(), acId);
-//			corpFollowDutyRelates = corpFollowDutyRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowDutyRelate.class)
-//					.in(CorpFollowDutyRelate::getFollowId, followIds));
-//			qrCode = getActiveQrCode(corpFollowDutyRelates, activeCodeDtos);
-//			redisService.set(activeCodeKey, qrCode, RedisService.key.CORP_FOLLOW_ACTIVE_CODE_KEY.getTimeout());
-//			return qrCode;
 			qrCode = getDutyServiceCode(activeCodeDtos);
 			return qrCode;
 		}
 		return null;
 	}
 
-
-//	public String getActiveQrCode(List<CorpFollowDutyRelate> corpFollowDutyRelates, List<CorpFollowActiveCodeDto> activeCodeDtos) {
-//		Integer randNum = 0;
-//		if (corpFollowDutyRelates.size() > 1) {
-//			randNum = RandomUtil.randomInt(corpFollowDutyRelates.size());
-//		}
-//		for (CorpFollowActiveCodeDto activeCodeDto : activeCodeDtos) {
-//			if (activeCodeDto.getFollowIds().contains(corpFollowDutyRelates.get(randNum).getFollowId())) {
-//				return activeCodeDto.getQrCode();
-//			}
-//		}
-//		//兜底
-//		randNum = RandomUtil.randomInt(activeCodeDtos.size());
-//		CorpFollowActiveCodeDto activeCodeDto = activeCodeDtos.get(randNum);
-//		return activeCodeDto.getQrCode();
-//	}
-
 	/**
 	 * 获取对应值班客服的二维码
 	 */
 	public String getDutyServiceCode(List<CorpFollowActiveCodeDto> activeCodeDtos) {
-		SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
-				.eq(SysConfig::getSysKey, Constant.serviceKeys.get(0))
-				.last("limit 1"));
-		// 用当前日期时间创建一个 LocalDateTime 对象
-		LocalDateTime now = LocalDateTime.now();
-
-		// 获取当前时间
-		LocalTime currentTime = now.toLocalTime();
-		CorpFollowActiveCodeDto activeCodeDto = null;
-
-		if (sysConfig != null) {
-			String sysValue = sysConfig.getSysValue();
-			if (StrUtil.isNotEmpty(sysValue)) {
+		if (activeCodeDtos.size() == 1) {
+			return activeCodeDtos.get(0).getQrCode();
+		}
+		List<String> dutyServices = sysConfigService.getDutyServices();
+		String chooseFollowId = null;
+		//值班
+		if (CollUtil.isNotEmpty(dutyServices)) {
+			List<String> collectFollow = new ArrayList<>();
+			activeCodeDtos.stream().forEach(e -> {
 				try {
-					List<YhServiceDto> yhServiceDtos = Jsons.parseList(sysValue, YhServiceDto.class);
-					Map<String, List<YhServiceDto>> dutyServices = yhServiceDtos.stream().collect(Collectors.groupingBy(YhServiceDto::getSign));
-					DayOfWeek currentDayOfWeek = now.getDayOfWeek();
-					List<YhServiceDto> workdayService = dutyServices.get("workday");
-
-					if (CollUtil.isNotEmpty(workdayService)) {
-						List<YhServiceDto> saturdayService = dutyServices.get("Saturday");
-						List<YhServiceDto> sundayServices = dutyServices.get("Sunday");
-
-						List<YhServiceDto> carryServices = getDutyService(currentDayOfWeek, workdayService, saturdayService, sundayServices);
-						//获取值班客服
-						YhServiceDto dutyServiceCode = getDutyServiceCode(carryServices, workdayService, saturdayService, sundayServices, currentDayOfWeek, currentTime);
-						if (CollUtil.isNotEmpty(dutyServiceCode.getSelect())) {
-							List<String> collect_follow = activeCodeDtos.stream().map(CorpFollowActiveCodeDto::getServiceNames).collect(Collectors.toList());
-							YhServiceDto.CustomerServiceDto customerServiceDto = dutyServiceCode.getSelect().parallelStream().filter(select -> collect_follow.contains(select.getName())).findAny().get();
-							if (customerServiceDto != null) {
-								activeCodeDto = activeCodeDtos.stream().filter(active -> active.getServiceNames().equals(customerServiceDto.getName())).findFirst().get();
-							}
-						}
-					}
-				} catch (Exception e) {
+					collectFollow.addAll(JSONUtil.parseArray(e.getFollowIds()).toList(String.class));
+				} catch (Exception ex) {
+					System.out.println(ex.getMessage());
 				}
+			});
+			List<String> collect = dutyServices.stream().filter(fid -> collectFollow.contains(fid)).collect(Collectors.toList());
+			if (CollUtil.isNotEmpty(collect)) {
+				chooseFollowId = collect.get(RandomUtil.randomInt(collect.size()));
 			}
 		}
+
+		CorpFollowActiveCodeDto activeCodeDto = null;
+		if (chooseFollowId != null) {
+			log.info("寻找合适值班客服:{}", chooseFollowId);
+			final String csFollowId = chooseFollowId;
+			activeCodeDto = activeCodeDtos.stream().filter(active -> active.getFollowIds().contains(csFollowId)).findFirst().get();
+		}
+
 		if (activeCodeDto == null) {
 			//兜底
 			Integer randNum = RandomUtil.randomInt(activeCodeDtos.size());
@@ -259,43 +124,4 @@ public class CorpFollowActiveCodeFrontServiceImpl implements CorpFollowActiveCod
 		}
 		return activeCodeDto.getQrCode();
 	}
-
-	/**
-	 * 获取工作日
-	 */
-	public YhServiceDto getDutyServiceCode(List<YhServiceDto> carryServices, List<YhServiceDto> workday, List<YhServiceDto> saturday, List<YhServiceDto> sunday, DayOfWeek currentDayOfWeek, LocalTime currentTime) {
-		return carryServices.parallelStream().filter(time -> time.isBetween(currentTime)).findAny().orElseGet(() -> {
-			return carryServices.stream().filter(time -> time.isAfter(currentTime)).findAny().orElseGet(() -> {
-				// 如果没有下一个时间段,获取下一个工作时间段的开始时间
-				DayOfWeek nextWorkDay = getNextWorkDay(currentDayOfWeek);
-				List<YhServiceDto> nextServices = getDutyService(nextWorkDay, workday, saturday, sunday);
-				//获取下一天的早时
-				return nextServices.get(0);
-			});
-		});
-	}
-
-	/**
-	 * 返回明天星期几 用户获取对应周期工作客服
-	 */
-	private static DayOfWeek getNextWorkDay(DayOfWeek currentDay) {
-		// 如果当前是周五,下一个工作日是周一;否则,是当前星期的下一天
-		if (currentDay == java.time.DayOfWeek.FRIDAY) {
-			return java.time.DayOfWeek.SATURDAY;
-		}
-		if (currentDay == DayOfWeek.SATURDAY) {
-			return DayOfWeek.SUNDAY;
-		}
-		return DayOfWeek.MONDAY;
-	}
-
-	private List<YhServiceDto> getDutyService(DayOfWeek nextWorkDay, List<YhServiceDto> workday, List<YhServiceDto> saturday, List<YhServiceDto> sunday) {
-		if (nextWorkDay == DayOfWeek.SATURDAY) {
-			return Optional.ofNullable(saturday).orElse(Optional.ofNullable(sunday).orElse(workday));
-		}
-		if (nextWorkDay == DayOfWeek.SUNDAY) {
-			return Optional.ofNullable(sunday).orElse(workday);
-		}
-		return workday;
-	}
 }

+ 22 - 13
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowDynamicConfigServiceImpl.java

@@ -3,16 +3,17 @@ package com.cyksj.service.corp.impl;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.cyksj.common.constant.Constant;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.util.Jsons;
+import com.cyksj.mapper.SysConfigMapper;
 import com.cyksj.mapper.corp.CorpFollowConfigMapper;
-import com.cyksj.mapper.corp.CorpFollowDutyRelateMapper;
-import com.cyksj.mapper.corp.CorpFollowServiceRelateMapper;
 import com.cyksj.mapper.corp.CorpTagMapper;
 import com.cyksj.model.dto.CorpFollowActiveCodeDto;
+import com.cyksj.model.dto.CorpFollowServiceDto;
 import com.cyksj.model.entity.CorpFollowConfig;
-import com.cyksj.model.entity.CorpFollowServiceRelate;
 import com.cyksj.model.entity.CorpTag;
+import com.cyksj.model.entity.SysConfig;
 import com.cyksj.model.request.corp.CorpFollowContact;
 import com.cyksj.service.corp.CorpFollowDynamicConfigService;
 import com.cyksj.service.corp.WxCorpOps;
@@ -39,12 +40,10 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
 
 	private final CorpFollowConfigMapper corpFollowConfigMapper;
 
-	private final CorpFollowDutyRelateMapper corpFollowDutyRelateMapper;
-
-	private final CorpFollowServiceRelateMapper serviceRelateMapper;
-
 	private final CorpTagMapper corpTagMapper;
 
+	private final SysConfigMapper sysConfigMapper;
+
 	@Override
 	public String corpFollowContactConfig(CorpFollowContact corpFollowContact) throws Exception {
 		String body = wxCorpOps.corpFollowContactConfig(corpFollowContact);
@@ -65,6 +64,12 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
 	@Override
 	public String createCorpFollowActiveCode(List<String> followIds, String state, Boolean isDuty) throws Exception {
 		List<CorpFollowActiveCodeDto> codeList = new ArrayList<>();
+		SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
+				.eq(SysConfig::getSysKey, Constant.serviceKeys.get(1)).last("limit 1"));
+		List<CorpFollowServiceDto> corpFollowServiceDtos = null;
+		if (sysConfig != null && StrUtil.isNotBlank(sysConfig.getSysValue())) {
+			corpFollowServiceDtos = Jsons.parseList(sysConfig.getSysValue(), CorpFollowServiceDto.class);
+		}
 		Integer type = 1;
 		if (!isDuty) {
 			//不是值班 多人生成一个二维码
@@ -72,21 +77,25 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
 			if (followIds.size() > 1) {
 				type = 2;
 			}
-			String serviceNames = serviceRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowServiceRelate.class)
-					.in(CorpFollowServiceRelate::getFollowId, followIds)).stream().map(CorpFollowServiceRelate::getServiceName).collect(Collectors.joining(","));
+			String serviceNames = null;
+			if (corpFollowServiceDtos != null) {
+				serviceNames = corpFollowServiceDtos.stream().filter(cs -> followIds.contains(cs.getFollowId())).map(CorpFollowServiceDto::getName).collect(Collectors.joining(","));
+			}
 			if (StrUtil.isEmpty(serviceNames)) {
 				throw BusinessRuntimeException.getInstance("存在被删除的客服,请刷新页面重试");
 			}
 			CorpFollowActiveCodeDto corpFollowActiveCodeDto = createCorpFollowActiveCode(followIds, state, type, serviceNames);
 			codeList.add(corpFollowActiveCodeDto);
 		} else {
-			Map<String, List<CorpFollowServiceRelate>> collect = serviceRelateMapper.selectList(Wrappers.lambdaQuery(CorpFollowServiceRelate.class)
-					.in(CorpFollowServiceRelate::getFollowId, followIds)).stream().collect(Collectors.groupingBy(CorpFollowServiceRelate::getFollowId));
-			if (collect.keySet().size() != followIds.size()) {
+			Map<String, List<CorpFollowServiceDto>> csMap = null;
+			if (corpFollowServiceDtos != null) {
+				csMap = corpFollowServiceDtos.stream().filter(cs -> followIds.contains(cs.getFollowId())).collect(Collectors.groupingBy(CorpFollowServiceDto::getFollowId));
+			}
+			if (csMap == null || csMap.keySet().size() != followIds.size()) {
 				throw BusinessRuntimeException.getInstance("存在被删除的客服,请刷新页面重试");
 			}
 			for (String followId : followIds) {
-				CorpFollowActiveCodeDto corpFollowActiveCodeDto = createCorpFollowActiveCode(List.of(followId), state, type, collect.get(followId).get(0).getServiceName());
+				CorpFollowActiveCodeDto corpFollowActiveCodeDto = createCorpFollowActiveCode(List.of(followId), state, type, csMap.get(followId).get(0).getName());
 				codeList.add(corpFollowActiveCodeDto);
 			}
 		}

+ 7 - 47
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowServiceImpl.java

@@ -1,16 +1,18 @@
 package com.cyksj.service.corp.impl;
 
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.common.constant.Constant;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.util.Jsons;
-import com.cyksj.mapper.corp.*;
-import com.cyksj.model.dto.YhServiceDto;
-import com.cyksj.model.entity.*;
+import com.cyksj.mapper.corp.CorpFollowActiveCodeMapper;
+import com.cyksj.mapper.corp.CorpTagGroupMapper;
+import com.cyksj.mapper.corp.CorpTagMapper;
+import com.cyksj.model.entity.CmsUser;
+import com.cyksj.model.entity.CorpFollowActiveCode;
+import com.cyksj.model.entity.CorpTag;
+import com.cyksj.model.entity.CorpTagGroup;
 import com.cyksj.model.request.corp.Attachments;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.corp.CorpFollowDynamicConfigService;
@@ -41,10 +43,6 @@ public class CorpFollowServiceImpl implements CorpFollowService {
 
 	private final CorpFollowDynamicConfigService corpFollowDynamicConfigService;
 
-	private final CorpFollowDutyRelateMapper corpFollowDutyRelateMapper;
-
-	private final CorpFollowServiceRelateMapper corpFollowServiceRelateMapper;
-
 	private final WxCorpOps wxCorpOps;
 
 	private final CorpTagMapper corpTagMapper;
@@ -184,42 +182,4 @@ public class CorpFollowServiceImpl implements CorpFollowService {
 					.eq(CorpTagGroup::getGroupId, corpTag.getGroupId()));
 		}
 	}
-
-	@Override
-	public void syncActiveCodeFollowRelate(String config) throws Exception {
-		if (StrUtil.isEmpty(config)) {
-			return;
-		}
-		corpFollowDutyRelateMapper.delete(null);
-		List<YhServiceDto> yhServiceDtos = Jsons.parseList(config, YhServiceDto.class);
-		yhServiceDtos.forEach(data -> {
-			DateTime stTime = DateUtil.parse(data.getStartTime(), "HH:mm");
-			int st = stTime.hour(true);
-			DateTime etTime = DateUtil.parse(data.getEndTime(), "HH:mm");
-			int et = etTime.hour(true);
-			List<YhServiceDto.CustomerServiceDto> select = data.getSelect();
-			select.forEach(cs -> {
-				String name = cs.getName();
-				CorpFollowDutyRelate relate = new CorpFollowDutyRelate();
-				CorpFollowServiceRelate corpFollowServiceRelate = corpFollowServiceRelateMapper.selectOne(Wrappers.lambdaQuery(CorpFollowServiceRelate.class)
-						.eq(CorpFollowServiceRelate::getServiceName, name).last("limit 1"));
-				if (corpFollowServiceRelate != null) {
-					relate.setFollowId(corpFollowServiceRelate.getFollowId());
-					relate.setFollowName(corpFollowServiceRelate.getFollowName());
-					relate.setServiceName(name);
-					relate.setSt(st);
-					relate.setEt(et);
-					Integer index = data.getIndex();
-					relate.setIndexTag(index);
-					//1工作日,2.周六,3周末
-					Integer type = index <= 2 ? 1 : index <= 4 ? 2 : 3;
-					relate.setType(type);
-					corpFollowDutyRelateMapper.insert(relate);
-				}
-			});
-		});
-		//清除客服活码缓存
-		Set<String> keys = redisService.keys(RedisService.key.CORP_FOLLOW_ACTIVE_CODE_CLEAN_KEY.getNameFormat("*"));
-		redisService.del(keys.toArray(String[]::new));
-	}
 }

+ 14 - 4
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpTagServiceImpl.java

@@ -7,16 +7,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.util.Jsons;
+import com.cyksj.mapper.OrderDonMapper;
 import com.cyksj.mapper.UserMapper;
 import com.cyksj.mapper.corp.*;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.excel.CorpUserTagExcelData;
 import com.cyksj.model.request.CorpDelTagReq;
 import com.cyksj.model.response.corp.CorpUserExternalTagGroupInfo;
-import com.cyksj.model.views.CorpTagBackView;
-import com.cyksj.model.views.CorpTagGroupView;
-import com.cyksj.model.views.CorpTagHeadDataView;
-import com.cyksj.model.views.CorpUserView;
+import com.cyksj.model.views.*;
 import com.cyksj.service.corp.CorpTagService;
 import com.cyksj.service.corp.WxCorpOps;
 import com.google.common.collect.Maps;
@@ -57,6 +55,8 @@ public class CorpTagServiceImpl implements CorpTagService {
 
 	private final CorpUserTagMapper corpUserTagMapper;
 
+	private final OrderDonMapper orderDonMapper;
+
 	@Override
 	@Transactional(rollbackFor = Throwable.class)
 	public CorpTagGroupView addCorpTagGroup(CorpTagGroupView tagGroup) throws Exception {
@@ -143,6 +143,10 @@ public class CorpTagServiceImpl implements CorpTagService {
 			params.putOpt("id", tagGroup.getGroupId());
 			params.putOpt("name", tagGroup.getGroupName());
 			wxCorpOps.editCorpTag(params);
+
+			corpTagMapper.update(null, Wrappers.lambdaUpdate(CorpTag.class)
+					.set(CorpTag::getGroupName, tagGroup.getGroupName())
+					.eq(CorpTag::getGroupId, tagGroup.getGroupId()));
 		}
 		corpTagGroup.setGroupName(tagGroup.getGroupName());
 		corpTagGroup.setRemark(tagGroup.getRemark());
@@ -410,4 +414,10 @@ public class CorpTagServiceImpl implements CorpTagService {
 		CorpTagGroupView corpTagGroupView = corpTagGroupMapper.getOneCorpGroupTag(tagGroup.getGroupId(), tagGroup.getGroupName());
 		return corpTagGroupView;
 	}
+
+	@Override
+	public UserOrderDetailView getTagUserData(String tagName, String startTime, String endTime) {
+		UserOrderDetailView u = orderDonMapper.getTagUserData(tagName, startTime, endTime);
+		return u;
+	}
 }

+ 0 - 3
netflix-service/src/main/java/com/cyksj/service/mange/cms/CmsUserManager.java

@@ -7,7 +7,6 @@ import com.cyksj.mapper.manage.cms.CmsMenuMapper;
 import com.cyksj.mapper.manage.cms.CmsRoleMapper;
 import com.cyksj.mapper.manage.cms.CmsUserMapper;
 import com.cyksj.mapper.manage.cms.CmsUserRoleMapper;
-import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
 import com.cyksj.model.entity.CmsMenu;
 import com.cyksj.model.entity.CmsRole;
 import com.cyksj.model.entity.CmsUser;
@@ -44,8 +43,6 @@ public class CmsUserManager {
 
 	private final CmsUserRoleMapper cmsUserRoleMapper;
 
-	private final UserDistributeMapper userDistributeMapper;
-
 	private final UserBusinessRateService userBusinessRateService;
 
 	private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();

+ 6 - 0
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -346,6 +346,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		/* 生成订单 */
 		String donNo = SEQUENCE.nextId().toString();
 		OrderDon orderDon = new OrderDon();
+		orderDon.setIp(payRequest.getIp());
+		orderDon.setLocation(payRequest.getLocation());
+
 		orderDon.setIsDp(false);
 		if (isNoLogin != null && isNoLogin) {
 			orderDon.setIsNoLogin(true);
@@ -918,6 +921,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		/* 生成订单 */
 		String donNo = SEQUENCE.nextId().toString();
 		OrderDon orderDon = new OrderDon();
+		orderDon.setIp(payRequest.getIp());
+		orderDon.setLocation(payRequest.getLocation());
+
 		orderDon.setOrderNo(donNo);
 		orderDon.setOpenId(payOpenId);
 		orderDon.setYhsId(yhsId);

+ 4 - 0
netflix-service/src/main/java/com/cyksj/service/sys/SysConfigService.java

@@ -3,6 +3,8 @@ package com.cyksj.service.sys;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.cyksj.model.entity.SysConfig;
 
+import java.util.List;
+
 /**
  * @author chan
  * @date 2022/10/20 10:07 AM
@@ -14,4 +16,6 @@ public interface SysConfigService extends IService<SysConfig> {
 	 * @param type wx\zfb
 	 */
 	String getDefaultShopConfigByType(String type);
+
+	List<String> getDutyServices();
 }

+ 96 - 3
netflix-service/src/main/java/com/cyksj/service/sys/impl/SysConfigServiceImpl.java

@@ -1,18 +1,25 @@
 package com.cyksj.service.sys.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.cyksj.common.constant.Constant;
 import com.cyksj.common.util.Jsons;
 import com.cyksj.mapper.SysConfigMapper;
 import com.cyksj.model.dto.DefaultShopConfig;
+import com.cyksj.model.dto.YhServiceDto;
 import com.cyksj.model.entity.ShopConfig;
 import com.cyksj.model.entity.SysConfig;
 import com.cyksj.service.sys.SysConfigService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
-import java.util.Optional;
+import java.time.DayOfWeek;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author chan
@@ -43,12 +50,98 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper,SysConfig>
 		}
 		return getShopIdByType(type);
 	}
-
-
 	public String getShopIdByType(String type) {
 		if ("wx".equals(type)) {
 			return ShopConfig.WX_DEFAULT_APP_ID;
 		}
 		return ShopConfig.ZFB_DEFAULT_APP_ID;
 	}
+
+
+	@Override
+	public List<String> getDutyServices() {
+		SysConfig sysConfig = this.getOne(Wrappers.lambdaQuery(SysConfig.class)
+				.eq(SysConfig::getSysKey, Constant.serviceKeys.get(0))
+				.last("limit 1"));
+		// 用当前日期时间创建一个 LocalDateTime 对象
+		LocalDateTime now = LocalDateTime.now();
+
+		// 获取当前时间
+		LocalTime currentTime = now.toLocalTime();
+
+		if (sysConfig != null) {
+			String sysValue = sysConfig.getSysValue();
+			if (StrUtil.isNotEmpty(sysValue)) {
+				try {
+					List<YhServiceDto> yhServiceDtos = Jsons.parseList(sysValue, YhServiceDto.class);
+					Map<String, List<YhServiceDto>> dutyServices = yhServiceDtos.stream().collect(Collectors.groupingBy(YhServiceDto::getSign));
+					DayOfWeek currentDayOfWeek = now.getDayOfWeek();
+					List<YhServiceDto> workdayService = dutyServices.get("workday");
+
+					if (CollUtil.isNotEmpty(workdayService)) {
+						List<YhServiceDto> saturdayService = dutyServices.get("Saturday");
+						List<YhServiceDto> sundayServices = dutyServices.get("Sunday");
+
+						List<YhServiceDto> carryServices = getDutyService(currentDayOfWeek, workdayService, saturdayService, sundayServices);
+						//获取值班客服
+						List<YhServiceDto> dutyServiceCodes = getDutyServiceCode(carryServices, workdayService, saturdayService, sundayServices, currentDayOfWeek, currentTime);
+						if (CollUtil.isNotEmpty(dutyServiceCodes)) {
+							Set<String> collectFollow = new HashSet<>();
+							for (YhServiceDto dutyServiceCode : dutyServiceCodes) {
+								dutyServiceCode.getSelect().stream().filter(e -> StrUtil.isNotBlank(e.getFollowId())).forEach(cs -> collectFollow.add(cs.getFollowId()));
+							}
+							return new ArrayList<>(collectFollow);
+						}
+					}
+				} catch (Exception e) {
+				}
+			}
+		}
+		return null;
+	}
+
+
+
+	/**
+	 * 返回明天星期几 用户获取对应周期工作客服
+	 */
+	private static DayOfWeek getNextWorkDay(DayOfWeek currentDay) {
+		// 如果当前是周五,下一个工作日是周一;否则,是当前星期的下一天
+		if (currentDay == java.time.DayOfWeek.FRIDAY) {
+			return java.time.DayOfWeek.SATURDAY;
+		}
+		if (currentDay == DayOfWeek.SATURDAY) {
+			return DayOfWeek.SUNDAY;
+		}
+		return DayOfWeek.MONDAY;
+	}
+
+	private List<YhServiceDto> getDutyService(DayOfWeek nextWorkDay, List<YhServiceDto> workday, List<YhServiceDto> saturday, List<YhServiceDto> sunday) {
+		if (nextWorkDay == DayOfWeek.SATURDAY) {
+			return Optional.ofNullable(saturday).orElse(Optional.ofNullable(sunday).orElse(workday));
+		}
+		if (nextWorkDay == DayOfWeek.SUNDAY) {
+			return Optional.ofNullable(sunday).orElse(workday);
+		}
+		return workday;
+	}
+
+
+	/**
+	 * 获取工作日
+	 */
+	public List<YhServiceDto> getDutyServiceCode(List<YhServiceDto> carryServices, List<YhServiceDto> workday, List<YhServiceDto> saturday, List<YhServiceDto> sunday, DayOfWeek currentDayOfWeek, LocalTime currentTime) {
+		List<YhServiceDto> collect = carryServices.stream().filter(time -> time.isBetween(currentTime)).collect(Collectors.toList());
+		if (CollUtil.isEmpty(collect)) {
+			collect = carryServices.stream().filter(time -> time.isAfter(currentTime)).collect(Collectors.toList());
+			if (CollUtil.isEmpty(collect)) {
+				// 如果没有下一个时间段,获取下一个工作时间段的开始时间
+				DayOfWeek nextWorkDay = getNextWorkDay(currentDayOfWeek);
+				List<YhServiceDto> nextServices = getDutyService(nextWorkDay, workday, saturday, sunday);
+				//获取下一天的早时
+				return List.of(nextServices.get(0));
+			}
+		}
+		return collect;
+	}
 }

+ 1 - 2
netflix-web/src/main/java/com/cyksj/web/controller/channel/ChannelController.java

@@ -24,7 +24,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 import java.util.List;
 
 /**
@@ -101,7 +100,7 @@ public class ChannelController {
      * 橙子建站带参跳转获客链接
      */
     @GetMapping("/customerAcquistion")
-    public void customerAcquistion(String projectid, String clickid, String callback, Long linkId) throws IOException {
+    public void customerAcquistion(String projectid, String clickid, String callback, Long linkId) throws Exception {
         log.info("橙子建站带参跳转获客链接 projectid:{} clickid:{},callback:{}",projectid, clickid, callback);
 
         String key = corpCustomerAcquistionService.saveClickid(projectid, clickid, callback, linkId);

+ 9 - 3
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -121,11 +121,17 @@ public class GroupRelationController {
     }
 
     @PostMapping("/post/renewal")
-    public Result<OrderDon> renewal(@RequestBody OrderPayRequest request) throws Exception {
+    public Result<OrderDon> renewal(@RequestBody OrderPayRequest payRequest) throws Exception {
         long userId = StpUserUtil.getLoginIdAsLong();
-        request.setUserId(userId);
+        payRequest.setUserId(userId);
+
+        String ip = ServletUtil.getClientIP(request);
+        String location = StringUtil.getRealAddressByIP(ip);
+
+        payRequest.setIp(ip);
+        payRequest.setLocation(location);
 
-        OrderDon orderDon = orderDonService.renewal(request);
+        OrderDon orderDon = orderDonService.renewal(payRequest);
         return GatewayResponse.SUCCESS.newBuilder().toResult(orderDon);
     }
 

+ 14 - 3
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CmsCorpFollowActiveCodeController.java

@@ -3,6 +3,7 @@ package com.cyksj.web.controller.manage.corp;
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.cyksj.common.constant.Constant;
 import com.cyksj.common.util.Jsons;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
@@ -10,6 +11,7 @@ import com.cyksj.mapper.OrderDonMapper;
 import com.cyksj.mapper.corp.CorpUserMapper;
 import com.cyksj.mapper.corp.CorpWelcomeTemplateMapper;
 import com.cyksj.mapper.manage.coupon.CouponMapper;
+import com.cyksj.model.dto.CorpFollowServiceDto;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.request.corp.Attachments;
 import com.cyksj.model.request.corp.CorpFollowContact;
@@ -20,6 +22,7 @@ import com.cyksj.model.views.CorpFollowActiveCodeView;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.corp.CorpFollowDynamicConfigService;
 import com.cyksj.service.corp.CorpFollowService;
+import com.cyksj.service.sys.SysConfigService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.param.Operator;
@@ -64,6 +67,8 @@ public class CmsCorpFollowActiveCodeController {
 
 	private final CorpWelcomeTemplateMapper corpWelcomeTemplateMapper;
 
+	private final SysConfigService sysConfigService;
+
 	private final HttpServletRequest request;
 
 	/**
@@ -91,9 +96,15 @@ public class CmsCorpFollowActiveCodeController {
 	 * 可选客服配置
 	 */
 	@GetMapping("/get/available/follow")
-	public Result<List<CorpFollowServiceRelate>> getAvailableFollow() {
-		List<CorpFollowServiceRelate> corpFollowServiceRelates = beanSearcher.searchAll(CorpFollowServiceRelate.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpFollowServiceRelates);
+	public Result<List<CorpFollowServiceDto>> getAvailableFollow() throws Exception {
+		SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+				.eq(SysConfig::getSysKey, Constant.serviceKeys.get(1)).last("limit 1"));
+		if (config == null || StrUtil.isEmpty(config.getSysValue())) {
+			return GatewayResponse.SUCCESS.newBuilder().toResult();
+		}
+		String sysValue = config.getSysValue();
+		List<CorpFollowServiceDto> corpFollowServiceDtos = Jsons.parseList(sysValue, CorpFollowServiceDto.class);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(corpFollowServiceDtos);
 	}
 
 	/**

+ 18 - 6
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpCustomerAcquistionLinkController.java

@@ -1,17 +1,18 @@
 package com.cyksj.web.controller.manage.corp;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.cyksj.common.constant.Constant;
 import com.cyksj.common.util.Jsons;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.corp.CorpFollowMapper;
 import com.cyksj.mapper.corp.CorpTagMapper;
 import com.cyksj.mapper.corp.CorpWelcomeTemplateMapper;
-import com.cyksj.model.entity.CorpCustomerAcquisitionLink;
-import com.cyksj.model.entity.CorpFollow;
-import com.cyksj.model.entity.CorpTag;
-import com.cyksj.model.entity.CorpWelcomeTemplate;
+import com.cyksj.model.dto.CorpFollowServiceDto;
+import com.cyksj.model.entity.*;
 import com.cyksj.service.corp.CorpCustomerAcquisitionLinkService;
+import com.cyksj.service.sys.SysConfigService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.util.MapUtils;
@@ -44,6 +45,8 @@ public class CorpCustomerAcquistionLinkController {
 
     private final HttpServletRequest request;
 
+    private final SysConfigService sysConfigService;
+
     /**
      * 新增获客助手链接
      */
@@ -79,12 +82,21 @@ public class CorpCustomerAcquistionLinkController {
     public Result<SearchResult<CorpCustomerAcquisitionLink>> get() throws Exception {
         SearchResult<CorpCustomerAcquisitionLink> search = beanSearcher.search(CorpCustomerAcquisitionLink.class, MapUtils.flatBuilder(request.getParameterMap()).build());
 
+        SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+                .eq(SysConfig::getSysKey, Constant.serviceKeys.get(1)).last("limit 1"));
+        List<CorpFollowServiceDto> corpFollowServiceDtos = Jsons.parseList(config.getSysValue(), CorpFollowServiceDto.class);
+
         search.getDataList().forEach(e->{
             try {
-                List<String> userStrList = corpFollowMapper.selectList(Wrappers.lambdaQuery(CorpFollow.class)
-                        .in(CorpFollow::getUserid, Jsons.parseList(e.getUserList(),String.class))).stream().map(CorpFollow::getName).collect(Collectors.toList());
+                List<String> userStrList = corpFollowServiceDtos.stream().filter(cf -> e.getUserList().contains(cf.getFollowId())).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
                 e.setUserStrList(userStrList);
 
+                if (StrUtil.isNotEmpty(e.getChooseDutyUsers())) {
+                    List<String> dutyUserList = corpFollowServiceDtos.stream().filter(cf -> e.getChooseDutyUsers().contains(cf.getFollowId())).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
+
+                    e.setChooseDutyUserList(dutyUserList);
+                }
+
                 List<String> tagStrList = corpTagMapper.selectList(Wrappers.lambdaQuery(CorpTag.class)
                         .in(CorpTag::getId, Jsons.parseList(e.getTags(),Long.class))).stream().map(CorpTag::getName).collect(Collectors.toList());
                 e.setTagStrList(tagStrList);

+ 13 - 4
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpTagController.java

@@ -1,5 +1,6 @@
 package com.cyksj.web.controller.manage.corp;
 
+import cn.hutool.core.lang.Assert;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cyksj.dto.Result;
@@ -9,10 +10,7 @@ import com.cyksj.model.entity.CorpTagRule;
 import com.cyksj.model.entity.CorpTagRuleRelation;
 import com.cyksj.model.excel.CorpUserTagExcelData;
 import com.cyksj.model.request.CorpDelTagReq;
-import com.cyksj.model.views.CorpTagBackView;
-import com.cyksj.model.views.CorpTagGroupView;
-import com.cyksj.model.views.CorpTagHeadDataView;
-import com.cyksj.model.views.CorpUserView;
+import com.cyksj.model.views.*;
 import com.cyksj.service.corp.CorpTagService;
 import com.cyksj.web.util.EasyExcelUtils;
 import com.ejlchina.searcher.BeanSearcher;
@@ -171,4 +169,15 @@ public class CorpTagController {
 		return GatewayResponse.SUCCESS.newBuilder().toResult(corpTagHeadDataView);
 	}
 
+	/**
+	 * 通过标签 查找对应用户订单数据
+	 */
+	@GetMapping("/get/tagUser/data")
+	public Result<UserOrderDetailView> getTagUserData(@RequestParam(required = true) String tagName, String startTime, String endTime) {
+		Assert.notEmpty(tagName, "请输入对应标签");
+		UserOrderDetailView userOrderDetailView = corpTagService.getTagUserData(tagName, startTime, endTime);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(userOrderDetailView);
+	}
+
+
 }

+ 8 - 0
netflix-web/src/main/java/com/cyksj/web/controller/payment/OrderController.java

@@ -4,6 +4,7 @@ import cn.hutool.core.codec.Base64;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.qrcode.QrCodeUtil;
 import cn.hutool.extra.qrcode.QrConfig;
+import cn.hutool.extra.servlet.ServletUtil;
 import cn.hutool.json.JSONObject;
 import com.alipay.api.response.AlipayFundTransCommonQueryResponse;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -11,6 +12,7 @@ import com.cyksj.common.constant.Constant;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.util.IoKit;
 import com.cyksj.common.util.Jsons;
+import com.cyksj.common.util.StringUtil;
 import com.cyksj.common.util.Xmls;
 import com.cyksj.config.zfb.BaseZfbConfig;
 import com.cyksj.config.zfb.ZfbProductCode;
@@ -133,6 +135,12 @@ public class OrderController {
         payRequest.setUserId(userId);
         log.info("{}[start] params:{}", methodName, payRequest);
 
+        String ip = ServletUtil.getClientIP(request);
+        String location = StringUtil.getRealAddressByIP(ip);
+
+        payRequest.setIp(ip);
+        payRequest.setLocation(location);
+
         OrderDon orderDon = orderDonService.submit(payRequest);
 
         //无登录订单 预留手机号免登录

+ 18 - 1
netflix-web/src/main/java/com/cyksj/web/controller/register/RegisterController.java

@@ -22,6 +22,7 @@ import com.cyksj.model.response.AliPayTradeStatus;
 import com.cyksj.model.views.AppleIdCountryOrAreaDataView;
 import com.cyksj.model.views.CouponUserView;
 import com.cyksj.service.register.RegisterOrderDonService;
+import com.cyksj.service.user.UserBindRelationService;
 import com.cyksj.web.util.StpUserUtil;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
@@ -37,6 +38,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.OutputStream;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -62,6 +64,8 @@ public class RegisterController {
 
     private final CouponSkuMapper couponSkuMapper;
 
+    private final UserBindRelationService userBindRelationService;
+
     @PostMapping
     public Result<RegisterOrderDon> register(@RequestBody RegisterReq req) throws Exception {
         long userId = StpUserUtil.getLoginIdAsLong();
@@ -163,8 +167,9 @@ public class RegisterController {
     @GetMapping("/get")
     public Result<SearchResult<RegisterOrderDon>> get(){
         long userId = StpUserUtil.getLoginIdAsLong();
+        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
         SearchResult<RegisterOrderDon> search = beanSearcher.search(RegisterOrderDon.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(RegisterOrderDon::getUserId,userId).op(Operator.Equal)
+                .field(RegisterOrderDon::getUserId, userIdList).op(Operator.InList)
                 .build());
         search.getDataList().forEach(data->{
             if (data.getAppleIsAutoType() && (data.getStatus() == RegisterOrderDon.Status.noPayment || data.getStatus() == RegisterOrderDon.Status.close)) {
@@ -176,6 +181,18 @@ public class RegisterController {
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
     }
 
+    @GetMapping("/get/status/{orderId}")
+    public Result<RegisterOrderDon> getOrderStatusById(@PathVariable Long orderId) {
+        long userId = StpUserUtil.getLoginIdAsLong();
+        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
+        RegisterOrderDon registerOrderDon = beanSearcher.searchFirst(RegisterOrderDon.class, MapUtils.flatBuilder(request.getParameterMap())
+                .field(RegisterOrderDon::getUserId, userIdList).op(Operator.InList)
+                .field(RegisterOrderDon::getId, orderId)
+                .selectExclude(RegisterOrderDon::getApplePwdId, RegisterOrderDon::getCountryOrArea, RegisterOrderDon::getRemark)
+                .build());
+        return GatewayResponse.SUCCESS.newBuilder().toResult(registerOrderDon);
+    }
+
     @PutMapping("/put")
     public Result<String> update(@RequestBody RegisterOrderDon req){
         if (req.getId() == null) {

+ 0 - 5
netflix-web/src/main/java/com/cyksj/web/controller/sys/SysConfigController.java

@@ -89,11 +89,6 @@ public class SysConfigController {
 			}
 		}
 
-		if (Constant.serviceKeys.get(0).equals(sysConfig.getSysKey())) {
-			//同步活码客服关联配置
-			corpFollowService.syncActiveCodeFollowRelate(sysConfig.getSysValue());
-		}
-
 		sysConfigChangeRecordService.changeRecord(adminId, sysConfig.getSysKey(), byId.getSysValue(), sysConfig.getSysValue());
 
 		sysConfigService.updateById(sysConfig);