| 
					
				 | 
			
			
				@@ -16,6 +16,7 @@ import com.tzld.piaoquan.growth.common.dao.mapper.CorpMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.growth.common.model.po.Corp; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.growth.common.model.po.CorpExample; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.growth.common.utils.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.piaoquan.growth.common.utils.LarkRobotUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.growth.common.utils.RedisUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections4.CollectionUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -319,6 +320,14 @@ public class WeComThirdPartyServiceImpl implements WeComThirdPartyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 JSONObject.parseObject(response, new TypeReference<CommonResponse<CreateRoomWxResponse>>() {}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (commonResponse.getErrcode() != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.error("create room failed, response: {}", response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ThirdPartWeComStaff staff = getStaffByUuid(request.getUuid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LarkRobotUtil.sendWeComThirdPartMessage( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    "【建群失败通知】\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "账号UUID:" + request.getUuid() + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "账号名称:" + (Objects.nonNull(staff) ? staff.getName() : "") + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "群名称:" + request.getRoomName() + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "邀请用户:" + request.getVids() + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "错误信息:" + response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return commonResponse.getData(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -386,4 +395,46 @@ public class WeComThirdPartyServiceImpl implements WeComThirdPartyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return thirdPartWeComRoomMapper.countByExample(example); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public CommonResponse<String> invitationToRoom(InvitationToRoomRequest request) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String res = apiClient.invitationToRoom(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        CommonResponse<String> commonResponse = JSONObject.parseObject(res, new TypeReference<CommonResponse<String>>() {}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (commonResponse.getErrcode() != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.error("invitationToRoom error, roomId: {}, vids: {}, errMsg: {}", request.getRoomid(), request.getVids(), commonResponse.getErrmsg()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ThirdPartWeComStaff staff = getStaffByUuid(request.getUuid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ThirdPartWeComRoom room = getRoomByRoomId(request.getRoomid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LarkRobotUtil.sendWeComThirdPartMessage( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    "【邀请群成员失败通知】\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "账号UUID:" + request.getUuid() + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "账号名称:" + (Objects.nonNull(staff) ? staff.getName() : "") + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "群ID:" + request.getRoomid() + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "群名称:" + (Objects.nonNull(room) ? room.getName() : "") + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "邀请用户:" + request.getVids() + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "错误信息:" + res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return commonResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ThirdPartWeComRoom getRoomByRoomId(Long roomid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ThirdPartWeComRoomExample example = new ThirdPartWeComRoomExample(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        example.createCriteria().andThirdRoomIdEqualTo(String.valueOf(roomid)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ThirdPartWeComRoom> roomList = thirdPartWeComRoomMapper.selectByExample(example); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isEmpty(roomList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return roomList.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ThirdPartWeComStaff getStaffByUuid(String uuid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ThirdPartWeComStaffExample example = new ThirdPartWeComStaffExample(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        example.createCriteria().andThirdUuidEqualTo(uuid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ThirdPartWeComStaff> staffList = thirdPartWeComStaffMapper.selectByExample(example); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isEmpty(staffList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return staffList.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |