zhouyy 5 mēneši atpakaļ
vecāks
revīzija
eb88060c2b

+ 4 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/BusinessOpportunityServiceImpl.java

@@ -463,7 +463,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
         Integer companyId = user.getCompanyId();
         WxCorpInfo wxCorpInfo = wxCorpInfoService.getOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
         List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, companyId));
-        List<Stage> stage = stageMapper.selectList(null);
+        List<Stage> stage = stageMapper.selectList(new LambdaQueryWrapper<Stage>().eq(Stage::getCompanyId,companyId));
         List<Contacts> contacts = contactsMapper.selectList(new LambdaQueryWrapper<Contacts>().eq(Contacts::getCompanyId, user.getCompanyId()).eq(Contacts::getIsDelete, 0).orderByDesc(Contacts::getId));
         List<Custom> customs = customMapper.selectList(new LambdaQueryWrapper<Custom>().eq(Custom::getCompanyId, user.getCompanyId()).eq(Custom::getIsDelete, 0).orderByDesc(Custom::getId));
 
@@ -660,7 +660,9 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
             if(importProductList.size()>0){
                 List<Integer> stageIds = importProductList.stream().map(BusinessOpportunity::getStageId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
                 for (Integer stageId : stageIds) {
-                    List<BusinessOpportunity> list = bOMapper.selectList(new QueryWrapper<BusinessOpportunity>().eq("stage_id", stageId).eq("is_delete", 0).orderByDesc("seq").last(" limit 1"));
+                    List<BusinessOpportunity> list = bOMapper.selectList(new QueryWrapper<BusinessOpportunity>().eq("stage_id", stageId).eq("is_delete", 0)
+                            .eq("company_id",companyId)
+                            .orderByDesc("seq").last(" limit 1"));
                     AtomicInteger seq = new AtomicInteger(0); // 使用 AtomicInteger
                     if (!list.isEmpty()){
                         seq.set(list.get(0).getSeq());

+ 20 - 10
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/time/VisitPlanTask.java

@@ -59,17 +59,27 @@ public class VisitPlanTask {
                 if(CollectionUtils.isEmpty(planList)){
                     continue;
                 }
-                List<String> wxIds = planList.stream().filter(t -> StringUtils.isNotBlank(t.getCorpwxUserid())).map(VisitPlan::getCorpwxUserid)
-                        .collect(Collectors.toList());
-                if(CollectionUtils.isEmpty(wxIds)){
-                    continue;
-                }
-                String join = StringUtils.join(wxIds, '|');
-                if (wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&StringUtils.isNotBlank(join)){
-                    // getCorpwxUserid  以 | 隔开 可分割开放
-                    System.out.println("公司:"+companyId+"在时刻"+sdf.format(now)+"的访客ids=== "+entry.getValue().stream().map(VisitPlan::getId).collect(Collectors.toList()));
-                    wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,join,"访客计划提醒",null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_VISIT_PLAN);
+                if (wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                    //客户和拜访时间
+                    for (VisitPlan visitPlan : planList) {
+                        if(StringUtils.isNotBlank(visitPlan.getCorpwxUserid())){
+                            String msg = "访客计划提醒:"+visitPlan.getCustomName()+"将于"+sdf.format(visitPlan.getVisitTime())+"拜访";
+                            wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,visitPlan.getCorpwxUserid(),msg,null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_VISIT_PLAN);
+                        }
+                    }
+
                 }
+//                List<String> wxIds = planList.stream().filter(t -> StringUtils.isNotBlank(t.getCorpwxUserid())).map(VisitPlan::getCorpwxUserid)
+//                        .collect(Collectors.toList());
+//                if(CollectionUtils.isEmpty(wxIds)){
+//                    continue;
+//                }
+//                String join = StringUtils.join(wxIds, '|');
+//                if (wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&StringUtils.isNotBlank(join)){
+//                    // getCorpwxUserid  以 | 隔开 可分割开放
+//                    System.out.println("公司:"+companyId+"在时刻"+sdf.format(now)+"的访客ids=== "+entry.getValue().stream().map(VisitPlan::getId).collect(Collectors.toList()));
+//                    wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,join,"访客计划提醒",null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_VISIT_PLAN);
+//                }
 
             }
         }