zoujiajian 3 tahun lalu
induk
melakukan
a356256427

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

@@ -17,5 +17,5 @@ public interface CorpUserFollowRelationMapper extends BaseMapper<CorpUserFollowR
 
 	List<CorpUserFollowRelationDto> selectCorpUserFollowRelationByTagIds(@Param("list") List<String> tagIds, @Param("wxCorpId") Long wxCorpId, @Param("followIds") List<String> followIds);
 
-	List<CorpUserFollowRelationDto> selectCorpUserFollowRelationB(@Param("wxCorpId") Long wxCorpId, @Param("followIds") List<String> service_follow_ids);
+	List<CorpUserFollowRelationDto> selectCorpUserFollowRelation(@Param("wxCorpId") Long wxCorpId, @Param("followIds") List<String> service_follow_ids);
 }

+ 7 - 8
netflix-dao/src/main/resources/mapper/CorpUserFollowRelationMapper.xml

@@ -36,7 +36,7 @@
         group by cufr.corp_user_id
     </select>
 
-    <select id="selectCorpUserFollowRelationB" resultType="com.cyksj.model.dto.CorpUserFollowRelationDto">
+    <select id="selectCorpUserFollowRelation" resultType="com.cyksj.model.dto.CorpUserFollowRelationDto">
         select cufr.corp_user_id,
         any_value(cufr.follow_id) as follow_id,
         any_value(cu.user_id) as user_id
@@ -44,13 +44,12 @@
         left join `corp_user` cu on cu.id = ca.corp_user_id
         where cufr.wx_corp_id = #{wxCorpId} and cu.user_id != 0
         and ca.wx_corp_id = #{wxCorpId}
-<!--        <if test="followIds != null and followIds.size() > 0">-->
-<!--            and cufr.follow_id in-->
-<!--            <foreach collection="followIds" item="item" open="(" separator="," close=")">-->
-<!--                #{item}-->
-<!--            </foreach>-->
-<!--        </if>-->
-        and cufr.follow_id = 'NianFeng'
+        <if test="followIds != null and followIds.size() > 0">
+            and cufr.follow_id in
+            <foreach collection="followIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         group by cufr.corp_user_id
     </select>
 </mapper>

+ 5 - 2
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpMsgBulkTaskServiceImpl.java

@@ -165,6 +165,9 @@ public class CorpMsgBulkTaskServiceImpl extends ServiceImpl<CorpMsgBulkTaskMappe
 	@Override
 	public void sendActiveCorpBulkMsg(CorpActiveBulkMsg msg) {
 		String content = msg.getContent();
+		if (StrUtil.isEmpty(content)) {
+			throw BusinessRuntimeException.getInstance("群发内容为空");
+		}
 		String img = msg.getImg();
 		Long wxCorpId = Optional.ofNullable(msg.getWxCorpId()).orElse(2l);
 		WxCorpApp wxCorpApp = wxCorpAppMapper.selectById(wxCorpId);
@@ -179,7 +182,7 @@ public class CorpMsgBulkTaskServiceImpl extends ServiceImpl<CorpMsgBulkTaskMappe
 			} catch (Exception e) {
 			}
 		}
-		List<CorpUserFollowRelationDto> corpUserFollowRelations = corpUserFollowRelationMapper.selectCorpUserFollowRelationB(wxCorpApp.getId(), service_follow_ids);
+		List<CorpUserFollowRelationDto> corpUserFollowRelations = corpUserFollowRelationMapper.selectCorpUserFollowRelation(wxCorpApp.getId(), service_follow_ids);
 		//将成员与客户相同关联聚合
 		Map<String, List<CorpUserFollowRelationDto>> collect = corpUserFollowRelations.stream().collect(Collectors.groupingBy(CorpUserFollowRelationDto::getFollowId));
 		//附件
@@ -215,9 +218,9 @@ public class CorpMsgBulkTaskServiceImpl extends ServiceImpl<CorpMsgBulkTaskMappe
 					corpMsgTemplate.setSender(followId);
 					corpMsgTemplate.setExternalUserid(corpUserIdList);
 					CorpMsgTemplateAddResult result = corpOps.addMsgTemplate(wxCorpApp.getCorpId(), corpMsgTemplate);
-					System.out.println(result.getErrMsg());
 				}
 			} catch (Exception e) {
+				log.error("发送企业微信失败:{}", StringUtil.getErrorText(e));
 			}
 		});
 	}