| | |
| | | package com.java110.user.bmo.question.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.dto.room.RoomDto; |
| | |
| | | import com.java110.intf.community.IRoomV1InnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerRoomRelV1InnerServiceSMO; |
| | | import com.java110.intf.user.IUserQuestionAnswerV1InnerServiceSMO; |
| | | import com.java110.po.questionAnswer.QuestionAnswerPo; |
| | | import com.java110.po.question.QuestionAnswerPo; |
| | | import com.java110.po.user.UserQuestionAnswerPo; |
| | | import com.java110.user.bmo.question.IQuestionAnswerBMO; |
| | | import com.java110.utils.util.ListUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Async |
| | | @Override |
| | | public void saveUserQuestionAnswer(QuestionAnswerPo questionAnswerPo, String roomId) { |
| | | public void saveUserQuestionAnswer(QuestionAnswerPo questionAnswerPo, JSONArray roomIds) { |
| | | |
| | | String[] roomIds = roomId.split(","); |
| | | if (roomIds == null || roomIds.length < 1) { |
| | | if (ListUtil.isNull(roomIds)) { |
| | | return; |
| | | } |
| | | |
| | | List<String> roomIdStrs = new ArrayList<>(); |
| | | |
| | | for (int roomIndex = 0; roomIndex < roomIds.length; roomIndex++) { |
| | | roomIdStrs.add(roomIds[roomIndex]); |
| | | for (int roomIndex = 0; roomIndex < roomIds.size(); roomIndex++) { |
| | | roomIdStrs.add(roomIds.getString(roomIndex)); |
| | | if (roomIdStrs.size() == MAX_LENGTH) { |
| | | doData(roomIdStrs, questionAnswerPo); |
| | | roomIdStrs = new ArrayList<>(); |
| | |
| | | roomDto.setRoomIds(roomIdStrs.toArray(new String[roomIdStrs.size()])); |
| | | List<RoomDto> roomDtos = roomV1InnerServiceSMOImpl.queryRooms(roomDto); |
| | | |
| | | if (roomDtos == null || roomDtos.size() < 1) { |
| | | if (ListUtil.isNull(roomDtos)) { |
| | | return; |
| | | } |
| | | |
| | |
| | | ownerRoomRelDto.setRoomIds(roomIdStrs.toArray(new String[roomIdStrs.size()])); |
| | | List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelV1InnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); |
| | | |
| | | if (ownerRoomRelDtos == null || ownerRoomRelDtos.size() < 1) { |
| | | if (ListUtil.isNull(ownerRoomRelDtos)) { |
| | | return; |
| | | } |
| | | |
| | |
| | | List<UserQuestionAnswerPo> userQuestionAnswerPos = new ArrayList<>(); |
| | | UserQuestionAnswerPo userQuestionAnswerPo = null; |
| | | for (RoomDto tmpRoomDto : roomDtos) { |
| | | if(StringUtil.isEmpty(tmpRoomDto.getOwnerId())){ |
| | | continue; |
| | | } |
| | | if(StringUtil.isEmpty(tmpRoomDto.getLink())){ |
| | | continue; |
| | | } |
| | | if(StringUtil.isEmpty(tmpRoomDto.getOwnerName())){ |
| | | continue; |
| | | } |
| | | userQuestionAnswerPo = new UserQuestionAnswerPo(); |
| | | userQuestionAnswerPo.setLink(tmpRoomDto.getLink()); |
| | | userQuestionAnswerPo.setOwnerId(tmpRoomDto.getLink()); |
| | | userQuestionAnswerPo.setOwnerId(tmpRoomDto.getOwnerId()); |
| | | userQuestionAnswerPo.setCommunityId(tmpRoomDto.getCommunityId()); |
| | | userQuestionAnswerPo.setOwnerName(tmpRoomDto.getOwnerName()); |
| | | userQuestionAnswerPo.setQaId(questionAnswerPo.getQaId()); |