ソースを参照

fix 标签客户详情列表重复客服

zoujiajian 3 年 前
コミット
30d90122b4

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

@@ -17,5 +17,5 @@ import java.util.List;
 public interface CorpUserTagMapper extends BaseMapper<CorpUserTag> {
 	Page<CorpUserView> selectCorpUserDetailByCondition(@Param("page") Page<CorpUserView> page, @Param("groupId") String groupId, @Param("tagId") String tagId, @Param("wxCorpId") Long wxCorpId);
 
-	List<CorpUserTagExcelData> exportUserTagDetail(@Param("tagIds") String[] tagIds, @Param("groupIds") String[] groupIds);
+	List<CorpUserTagExcelData> exportUserTagDetail(@Param("tagIds") String[] tagIds, @Param("groupIds") String[] groupIds, @Param("wxCorpId") Long wxCorpId);
 }

+ 17 - 15
netflix-dao/src/main/resources/mapper/CorpUserTagMapper.xml

@@ -6,10 +6,12 @@
     <select id="selectCorpUserDetailByCondition" resultType="com.cyksj.model.views.CorpUserView">
         select * from (select cu.id,
         cu.unionid,
-        any_value(remark) as nickname,
         group_concat(ct.tag_name) as tagNames,
         group_concat(cf.name) as customers,
-        any_value(ct.created_time) as createdTime
+        any_value(ct.created_time) as createdTime,
+        u.id as userId,
+        u.nickname,
+        u.headimgurl
         from (select * from corp_user_tag where
         <choose>
             <when test="groupId!=null and groupId != ''">
@@ -20,17 +22,17 @@
             </otherwise>
         </choose>
         ) ct
-        inner join corp_user_follow_relation cfr on cfr.id = ct.relation_id and wx_corp_id = #{wxCorpId}
-        left join corp_follow cf on cf.userid = cfr.follow_id
-        left join corp_user_auth cua on cua.external_userid = cfr.corp_user_id
-        left join corp_user cu on cu.id = cua.corp_user_id and cu.unionid != ''
-        group by cu.id, cu.unionid) s order by s.createdTime desc
+        inner join corp_user_follow_relation cfr on cfr.id = ct.relation_id and cfr.wx_corp_id = #{wxCorpId}
+        inner join corp_follow cf on cf.userid = cfr.follow_id and cf.wx_corp_id = #{wxCorpId}
+        inner join corp_user_auth cua on cua.external_userid = cfr.corp_user_id and cua.wx_corp_id = #{wxCorpId}
+        inner join corp_user cu on cu.id = cua.corp_user_id and cu.unionid != ''
+        inner join user u on u.id = cu.user_id
+        group by cu.id, cu.unionid) s order by s.createdTime desc, s.userId asc
     </select>
 
     <select id="exportUserTagDetail" resultType="com.cyksj.model.excel.CorpUserTagExcelData">
-        select cu.id,
+        select * from (select cu.id,
         cu.unionid,
-        any_value(remark) as nickname,
         group_concat(ct.tag_name) as tagNames,
         group_concat(cf.name) as customers,
         any_value(ct.created_time) as tagTime,
@@ -54,11 +56,11 @@
             </when>
         </choose>
         ) ct
-        inner join corp_user_follow_relation cfr on cfr.id = ct.relation_id
-        left join corp_follow cf on cf.userid = cfr.follow_id
-        left join corp_user_auth cua on cua.external_userid = cfr.corp_user_id
-        left join corp_user cu on cu.id = cua.corp_user_id and cu.unionid != ''
-        left join user u on u.id = cu.user_id
-        group by cu.id, cu.unionid
+        inner join corp_user_follow_relation cfr on cfr.id = ct.relation_id and cfr.wx_corp_id = #{wxCorpId}
+        inner join corp_follow cf on cf.userid = cfr.follow_id and cf.wx_corp_id = #{wxCorpId}
+        inner join corp_user_auth cua on cua.external_userid = cfr.corp_user_id and cua.wx_corp_id = #{wxCorpId}
+        inner join corp_user cu on cu.id = cua.corp_user_id and cu.unionid != ''
+        inner join user u on u.id = cu.user_id
+        group by cu.id, cu.unionid)s order by s.tagTime desc, s.userId asc
     </select>
 </mapper>

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

@@ -126,6 +126,7 @@ public class CorpMsgBulkTaskServiceImpl extends ServiceImpl<CorpMsgBulkTaskMappe
 		CorpMsgBulkTaskRecord corpMsgBulkTaskRecord = corpMsgBulkTaskRecordMapper.selectOne(Wrappers.lambdaQuery(CorpMsgBulkTaskRecord.class)
 				.eq(CorpMsgBulkTaskRecord::getMsgid, msgid).last("limit 1"));
 		if (corpMsgBulkTaskRecord == null) return;
+		if (corpMsgBulkTaskRecord.getStatus()) return;
 		WxCorpApp wxCorpApp = wxCorpAppMapper.selectById(corpMsgBulkTaskRecord.getCorpId());
 		try {
 			corpOps.remindBulkTask(msgid, wxCorpApp.getCorpId());

+ 2 - 11
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpTagServiceImpl.java

@@ -310,22 +310,13 @@ public class CorpTagServiceImpl implements CorpTagService {
 	public Page<CorpUserView> getCorpUserDetail(String tagId, String groupId, Integer start, Integer limit) {
 		Long wxCorpId = 2l;
 		Page<CorpUserView> page = corpUserTagMapper.selectCorpUserDetailByCondition(new Page<>(start, limit), groupId, tagId, wxCorpId);
-		page.getRecords().forEach(data -> {
-			Optional.ofNullable(userMapper.selectOne(Wrappers.lambdaQuery(User.class)
-					.eq(User::getUnionid, data.getUnionId())
-					.last("limit 1")))
-					.ifPresent(user -> {
-						data.setUserId(user.getId());
-						data.setNickname(user.getNickname());
-						data.setHeadimgurl(user.getHeadimgurl());
-					});
-		});
 		return page;
 	}
 
 	@Override
 	public List<CorpUserTagExcelData> exportUserTagDetail(String[] tagIds, String[] groupIds) {
-		return corpUserTagMapper.exportUserTagDetail(tagIds, groupIds);
+		Long wxCorpId = 2l;
+		return corpUserTagMapper.exportUserTagDetail(tagIds, groupIds, wxCorpId);
 	}
 
 	@Override