瀏覽代碼

企微看客分析 公司改为条件 时间超过7天报错提醒

xgb 3 周之前
父節點
當前提交
e28b525abc

+ 4 - 1
fs-service/src/main/java/com/fs/qw/mapper/QwWatchLogMapper.java

@@ -188,7 +188,10 @@ public interface QwWatchLogMapper extends BaseMapper<QwWatchLog>{
             "JOIN\n" +
             "    qw_user qu ON qec.qw_user_id = qu.id \n" +
             "WHERE\n" +
-            "    DATE(qec.create_time) &gt;= DATE(#{sTime}) and  DATE(qec.create_time) &lt;= DATE(#{eTime}) and qec.company_id =#{companyId} " +
+            "    DATE(qec.create_time) &gt;= DATE(#{sTime}) and  DATE(qec.create_time) &lt;= DATE(#{eTime}) " +
+            "<if test ='companyId !=null'>\n" +
+            "   and qec.company_id =#{companyId}" +
+            "</if>" +
             "<if test ='ids !=null and ids!=\"\"'>\n" +
             "   and qec.qw_user_id in (${ids})\n" +
             "</if>" +

+ 7 - 1
fs-service/src/main/java/com/fs/qw/service/impl/QwWatchLogServiceImpl.java

@@ -30,6 +30,8 @@ import com.fs.store.service.cache.IFsUserCacheService;
 import com.fs.store.service.cache.IFsUserCourseCacheService;
 import com.hc.openapi.tool.util.StringUtils;
 import org.apache.commons.collections4.CollectionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -44,6 +46,9 @@ import java.util.stream.Collectors;
  */
 @Service
 public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatchLog> implements IQwWatchLogService {
+
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
     @Autowired
     private QwUserMapper qwUserMapper;
     @Autowired
@@ -188,7 +193,8 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
         Date eTime = param.getETime();
         List<Date> datesBetween = getDatesBetween(sTime, eTime);
         if (datesBetween.size() > 7) {
-            return new ArrayList<>();
+            logger.error("时间间隔不能超过7天");
+            throw new RuntimeException("时间间隔不能超过7天");
         }
         if (param.getCompanyUserId()!=null){
             param.setIds(companyUserMapper.selectQwUserIdsByCompany(param.getCompanyUserId()));