| 
														
															@@ -2,8 +2,6 @@ package com.tzld.longarticle.recommend.server.service; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.tzld.longarticle.recommend.server.model.WxUserGetResponse; 
														 | 
														
														 | 
														
															 import com.tzld.longarticle.recommend.server.model.WxUserGetResponse; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.tzld.longarticle.recommend.server.remote.WxUserManagementRemoteService; 
														 | 
														
														 | 
														
															 import com.tzld.longarticle.recommend.server.remote.WxUserManagementRemoteService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.tzld.longarticle.recommend.server.repository.crawler.ArticleUserGroupRepository; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.tzld.longarticle.recommend.server.repository.entity.crawler.ArticleUserGroupNew; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.tzld.longarticle.recommend.server.repository.mapper.crawler.ArticleUserGroupMapper; 
														 | 
														
														 | 
														
															 import com.tzld.longarticle.recommend.server.repository.mapper.crawler.ArticleUserGroupMapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup; 
														 | 
														
														 | 
														
															 import com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils; 
														 | 
														
														 | 
														
															 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -27,8 +25,6 @@ import java.util.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 public class UserManagementService { 
														 | 
														
														 | 
														
															 public class UserManagementService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private WxUserManagementRemoteService wxUserManagementRemoteService; 
														 | 
														
														 | 
														
															     private WxUserManagementRemoteService wxUserManagementRemoteService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    @Autowired 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    private ArticleUserGroupRepository articleUserGroupRepository; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private ArticleUserGroupMapper articleUserGroupMapper; 
														 | 
														
														 | 
														
															     private ArticleUserGroupMapper articleUserGroupMapper; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -168,36 +164,37 @@ public class UserManagementService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private void handleSubscribe(String gzhId, String openId) { 
														 | 
														
														 | 
														
															     private void handleSubscribe(String gzhId, String openId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        // 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        ArticleUserGroupNew group = articleUserGroupRepository.findFirstByGzhIdAndOpenId(gzhId, openId); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ArticleUserGroup group = articleUserGroupMapper.selectByGzhIdAndOpenId(gzhId, openId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (group == null) { 
														 | 
														
														 | 
														
															         if (group == null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // insert 
														 | 
														
														 | 
														
															             // insert 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 查库,知道所有分组 
														 | 
														
														 | 
														
															             // 查库,知道所有分组 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<Integer> ugIds = articleUserGroupRepository.findAllUserGroupId(gzhId); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            List<Integer> ugIds = articleUserGroupMapper.selectUserGroupIdByGzhId(gzhId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 随机选一个组 
														 | 
														
														 | 
														
															             // 随机选一个组 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             int ugId = ugIds.get(RandomUtils.nextInt(ugIds.size())); 
														 | 
														
														 | 
														
															             int ugId = ugIds.get(RandomUtils.nextInt(ugIds.size())); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            group = new ArticleUserGroupNew(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            group = new ArticleUserGroup(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             group.setGzhId(gzhId); 
														 | 
														
														 | 
														
															             group.setGzhId(gzhId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             group.setOpenId(openId); 
														 | 
														
														 | 
														
															             group.setOpenId(openId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             group.setUserGroupId(ugId); 
														 | 
														
														 | 
														
															             group.setUserGroupId(ugId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            articleUserGroupRepository.save(group); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            group.setIsDelete(0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            articleUserGroupMapper.insert(group); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } else { 
														 | 
														
														 | 
														
															         } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // update 
														 | 
														
														 | 
														
															             // update 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             group.setIsDelete(0); 
														 | 
														
														 | 
														
															             group.setIsDelete(0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            articleUserGroupRepository.save(group); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            articleUserGroupMapper.updateByPrimaryKey(group); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private void handleUnsubscribe(String gzhId, String openId) { 
														 | 
														
														 | 
														
															     private void handleUnsubscribe(String gzhId, String openId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        ArticleUserGroupNew group = articleUserGroupRepository.findFirstByGzhIdAndOpenId(gzhId, openId); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ArticleUserGroup group = articleUserGroupMapper.selectByGzhIdAndOpenId(gzhId, openId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (group != null) { 
														 | 
														
														 | 
														
															         if (group != null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             group.setIsDelete(1); 
														 | 
														
														 | 
														
															             group.setIsDelete(1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            articleUserGroupRepository.save(group); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            articleUserGroupMapper.updateByPrimaryKey(group); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public List<String> listByUserGroupId(String gzhId, int userGroupId) { 
														 | 
														
														 | 
														
															     public List<String> listByUserGroupId(String gzhId, int userGroupId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return articleUserGroupRepository.findAllOpenId(gzhId, userGroupId); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return articleUserGroupMapper.selectOpenIdByGzhIdAndUserGroupId(gzhId, userGroupId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |