浏览代码

群发任务发送用户范围

zoujiajian 2 年之前
父节点
当前提交
bf4ed3d193

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/mapper/corp/CorpUserFollowRelationMapper.java

@@ -15,7 +15,7 @@ public interface CorpUserFollowRelationMapper extends BaseMapper<CorpUserFollowR
 
 	String selectCorpCustomers(@Param("unionid") String unionid, @Param("wxCorpId") Long wxCorpId);
 
-	List<CorpUserFollowRelationDto> selectCorpUserFollowRelationByTagIds(@Param("list") List<String> tagIds, @Param("wxCorpId") Long wxCorpId, @Param("followIds") List<String> followIds);
+	List<CorpUserFollowRelationDto> selectCorpUserFollowRelationByTagIds(@Param("list") List<String> tagIds, @Param("wxCorpId") Long wxCorpId, @Param("followIds") List<String> followIds, @Param("userScope") Integer userScope);
 
 	List<CorpUserFollowRelationDto> selectCorpUserFollowRelation(@Param("wxCorpId") Long wxCorpId, @Param("followIds") List<String> service_follow_ids);
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/CorpMsgBulkTask.java

@@ -120,6 +120,11 @@ public class CorpMsgBulkTask implements Serializable {
 	 */
 	private Boolean status;
 
+	/**
+	 * 1全部、2银河用户、3非银河用户
+	 */
+	private Integer userScope;
+
 	private Boolean deleted;
 
 	/**

+ 10 - 2
netflix-dao/src/main/resources/mapper/CorpUserFollowRelationMapper.xml

@@ -25,7 +25,15 @@
         </foreach>) cut left join `corp_user_follow_relation` cufr on cufr.id = cut.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 cufr.wx_corp_id = #{wxCorpId} and cu.user_id != 0
+        where cufr.wx_corp_id = #{wxCorpId}
+          <choose>
+              <when test="userScope == 2">
+                  and cu.user_id != 0
+              </when>
+              <when test="userScope == 3">
+                  and cu.user_id = 0
+              </when>
+          </choose>
         and ca.wx_corp_id = #{wxCorpId}
         <if test="followIds != null and followIds.size() > 0">
             and cufr.follow_id in
@@ -42,7 +50,7 @@
         any_value(cu.user_id) as user_id
         from `corp_user_follow_relation` cufr 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 cufr.wx_corp_id = #{wxCorpId} and cu.user_id != 0
+        where cufr.wx_corp_id = #{wxCorpId}
         and ca.wx_corp_id = #{wxCorpId}
         <if test="followIds != null and followIds.size() > 0">
             and cufr.follow_id in

+ 3 - 1
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpMsgBulkTaskServiceImpl.java

@@ -244,7 +244,9 @@ public class CorpMsgBulkTaskServiceImpl extends ServiceImpl<CorpMsgBulkTaskMappe
 			} catch (Exception e) {
 			}
 		}
-		List<CorpUserFollowRelationDto> corpUserFollowRelations = corpUserFollowRelationMapper.selectCorpUserFollowRelationByTagIds(tagIds, wxCorpApp.getId(), service_follow_ids);
+		Integer userScope = corpMsgBulkTask.getUserScope();
+
+		List<CorpUserFollowRelationDto> corpUserFollowRelations = corpUserFollowRelationMapper.selectCorpUserFollowRelationByTagIds(tagIds, wxCorpApp.getId(), service_follow_ids, userScope);
 		//将成员与客户相同关联聚合
 		Map<String, List<CorpUserFollowRelationDto>> userRelationMap = corpUserFollowRelations.stream().collect(Collectors.groupingBy(CorpUserFollowRelationDto::getFollowId));
 		//附件