Bladeren bron

修改分组发送特征

xueyiming 2 weken geleden
bovenliggende
commit
9975aa8612

+ 1 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/dao/mapper/crawler/ArticleUseGroupMapper.java

@@ -30,7 +30,7 @@ public interface ArticleUseGroupMapper {
 
     int updateByPrimaryKey(ArticleUseGroup record);
 
-    int selectRemainingCountByGzhId(@Param("ghId") String ghId, @Param("excludeRemainingCount") Integer excludeRemainingCount);
+    Integer selectRemainingCountByGzhId(@Param("ghId") String ghId, @Param("excludeRemainingCount") Integer excludeRemainingCount);
 
     List<String> selectOpenIds(@Param("ghId") String ghId, @Param("count") Integer count);
 

+ 3 - 3
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java

@@ -808,16 +808,16 @@ public class CoreServiceImpl implements CoreService {
             }
         }
         int remainingDaysInCurrentMonth = DateUtil.getRemainingDaysInCurrentMonth();
-        int remainingCount;
+        Integer remainingCount;
         List<String> sendOpenIds = new ArrayList<>();
         if (remainingDaysInCurrentMonth <= 4) {
             remainingCount = articleUseGroupMapper.selectRemainingCountByGzhId(planAccount.getGhId(), remainingDaysInCurrentMonth);
-            List<String> remainingCountOpenIds = articleUseGroupMapper.selectOpenIdsByRemainingCount(planAccount.getGhId(), remainingCount);
+            List<String> remainingCountOpenIds = articleUseGroupMapper.selectOpenIdsByRemainingCount(planAccount.getGhId(), remainingDaysInCurrentMonth);
             sendOpenIds.addAll(remainingCountOpenIds);
         } else {
             remainingCount = articleUseGroupMapper.selectRemainingCountByGzhId(planAccount.getGhId(), null);
         }
-        if (remainingDaysInCurrentMonth > 0 && remainingCount / remainingDaysInCurrentMonth > 0) {
+        if (remainingDaysInCurrentMonth > 0 && remainingCount != null && remainingCount / remainingDaysInCurrentMonth > 0) {
             List<String> needSendOpenIds = articleUseGroupMapper.selectOpenIds(planAccount.getGhId(), remainingCount / remainingDaysInCurrentMonth);
             sendOpenIds.addAll(needSendOpenIds);
         }

+ 5 - 5
long-article-server/src/main/resources/mapper/crawler/ArticleUseGroupMapper.xml

@@ -230,9 +230,9 @@
   </update>
 
   <select id="selectRemainingCountByGzhId" resultType="java.lang.Integer">
-      select count(remaining_count)
+      select sum(remaining_count)
       from article_user_group
-      where gzh_id = #{ghId,jdbcType=VARCHAR}
+      where is_delete = 0 and gzh_id = #{ghId,jdbcType=VARCHAR}
       <if test="excludeRemainingCount != null">
           and remaining_count &lt; #{excludeRemainingCount,jdbcType=INTEGER}
       </if>
@@ -241,9 +241,9 @@
   <select id="selectOpenIds" resultType="java.lang.String">
     select open_id
     from article_user_group
-    where gzh_id = #{ghId,jdbcType=VARCHAR}
-    order by remaining_count desc id asc
-    limit #{count,jdbcType=Integer}
+    where is_delete = 0 and gzh_id = #{ghId,jdbcType=VARCHAR}
+    order by remaining_count desc, id asc
+    limit #{count,jdbcType=INTEGER}
   </select>
 
   <select id="selectOpenIdsByRemainingCount" resultType="java.lang.String">