yusm 3 minggu lalu
induk
melakukan
fc76567925

+ 25 - 9
fhKeeper/formulahousekeeper/management-crm-qrcode/src/main/java/com/management/platform/controller/WechatCallbackController.java

@@ -3,14 +3,8 @@ package com.management.platform.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.management.platform.entity.Custom;
-import com.management.platform.entity.MiniBindUser;
-import com.management.platform.entity.User;
-import com.management.platform.entity.WechatAccount;
-import com.management.platform.service.CustomService;
-import com.management.platform.service.MiniBindUserService;
-import com.management.platform.service.UserService;
-import com.management.platform.service.WechatAccountService;
+import com.management.platform.entity.*;
+import com.management.platform.service.*;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -53,6 +47,9 @@ public class WechatCallbackController {
     @Resource
     private WechatAccountService wechatAccountService;
 
+    @Resource
+    private BusinessOpportunityService businessOpportunityService;
+
     @Value(value = "${wxqr.app_id}")
     private String appId;
 
@@ -151,7 +148,17 @@ public class WechatCallbackController {
                         custom.setCompanyId(user != null ? user.getCompanyId() : null);
                         customService.save(custom);
                         log.info("新增客户成功");
+
+                        BusinessOpportunity opportunity = new BusinessOpportunity();
+                        opportunity.setCompanyId(user != null ? user.getCompanyId() : null);
+                        opportunity.setIsDelete(0);
+                        opportunity.setCreateTime(new Date());
+                        opportunity.setInchargerId(miniBindUser.getUserId());
+                        opportunity.setName("扫码关注客户:"+unionid);
+                        businessOpportunityService.save(opportunity);
                     }
+
+
                 }else {
                     log.info(unionid+":系统中已存在对应的客户");
                 }
@@ -166,7 +173,16 @@ public class WechatCallbackController {
 
     private void handleUnsubscribe(String openId) {
         // 实现用户取消关注的业务逻辑
-        customService.remove(new QueryWrapper<Custom>().eq("custom_name", openId));
+//        customService.remove(new QueryWrapper<Custom>().eq("custom_name", openId));
+        // 实现用户关注的业务逻辑
+        log.info("处理用户取消关注逻辑: {}", openId);
+        Map<String, Object> userInfo = getUserInfo(openId, null);
+        log.info("返回的userInfo信息==>"+userInfo.toString());
+        if (userInfo.get("unionid") != null) {
+            String unionid = (String) userInfo.get("unionid");
+            customService.remove(new QueryWrapper<Custom>().eq("custom_name", unionid));
+            businessOpportunityService.remove(new QueryWrapper<BusinessOpportunity>().like("name", unionid));
+        }
         log.info("处理用户取消关注逻辑: {}", openId);
     }
 

+ 7 - 0
fhKeeper/formulahousekeeper/management-crm-qrcode/src/main/java/com/management/platform/mapper/BusinessOpportunityMapper.java

@@ -0,0 +1,7 @@
+package com.management.platform.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.management.platform.entity.BusinessOpportunity;
+
+public interface BusinessOpportunityMapper extends BaseMapper<BusinessOpportunity> {
+
+}

+ 6 - 0
fhKeeper/formulahousekeeper/management-crm-qrcode/src/main/java/com/management/platform/service/BusinessOpportunityService.java

@@ -0,0 +1,6 @@
+package com.management.platform.service;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.entity.BusinessOpportunity;
+public interface BusinessOpportunityService extends IService<BusinessOpportunity> {
+
+}

+ 20 - 0
fhKeeper/formulahousekeeper/management-crm-qrcode/src/main/java/com/management/platform/service/impl/BusinessOpportunityServiceImpl.java

@@ -0,0 +1,20 @@
+package com.management.platform.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.management.platform.entity.BusinessOpportunity;
+import com.management.platform.mapper.BusinessOpportunityMapper;
+import com.management.platform.service.BusinessOpportunityService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-02-28
+ */
+@Service
+public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportunityMapper, BusinessOpportunity> implements BusinessOpportunityService {
+
+}

+ 6 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/CustomServiceImpl.java

@@ -617,6 +617,12 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
         User user = userMapper.selectById(request.getHeader("token"));
         Integer companyId = user.getCompanyId();
         if (exportType == 1) {//员工
+            if (!StringUtils.isEmpty(startDate)){
+                startDate=startDate+" 00:00:00";
+            }
+            if (!StringUtils.isEmpty(endDate)){
+                endDate=endDate+" 23:59:59";
+            }
             List<UserVO> userVoList = userMapper.getCustomerTotalCount(startDate, endDate, userId, companyId);
             if (userVoList != null && !userVoList.isEmpty()) {
                 for (UserVO userVO : userVoList) {