|
@@ -27,6 +27,7 @@ import com.tourism.webadmin.back.model.constant.AuditState;
|
|
import com.tourism.webadmin.back.model.constant.UnmountState;
|
|
import com.tourism.webadmin.back.model.constant.UnmountState;
|
|
import com.tourism.webadmin.back.service.*;
|
|
import com.tourism.webadmin.back.service.*;
|
|
import com.tourism.webadmin.back.vo.TourTravelNotesMentionUserVo;
|
|
import com.tourism.webadmin.back.vo.TourTravelNotesMentionUserVo;
|
|
|
|
+import com.tourism.webadmin.back.vo.TourTravelNotesTopicVo;
|
|
import com.tourism.webadmin.back.vo.TourismProjectTravelNotesWriteVo;
|
|
import com.tourism.webadmin.back.vo.TourismProjectTravelNotesWriteVo;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -96,21 +97,25 @@ public class WebSiteTourismTravelNotesPublishController {
|
|
@PostMapping("/saveDraft")
|
|
@PostMapping("/saveDraft")
|
|
public ResponseResult<Void> saveDraft(@RequestBody TourismProjectTravelNotesWriteToWebDto tourismProjectTravelNotesWriteDto) {
|
|
public ResponseResult<Void> saveDraft(@RequestBody TourismProjectTravelNotesWriteToWebDto tourismProjectTravelNotesWriteDto) {
|
|
|
|
|
|
- //先校验提及的用户id是否符合互关的状态
|
|
|
|
- List<TourTravelNotesMentionUserDto> mentions = tourismProjectTravelNotesWriteDto.getMentions();
|
|
|
|
- List<TourTravelNotesMentionUserDto> mentionsUserIdList = mentions.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
|
|
|
|
Long userId = TokenData.takeFromRequest().getUserId();
|
|
Long userId = TokenData.takeFromRequest().getUserId();
|
|
- List<TourShortUser> fouceEachFriendsByName = tourFansService.getFouceEachFriendsByName(userId, "");
|
|
|
|
- List<TourShortUser> fouceEachFriedsUserIdList = fouceEachFriendsByName.stream().filter(i -> i.getUserId() != null).collect(Collectors.toList());
|
|
|
|
- if(!(fouceEachFriedsUserIdList).containsAll(mentionsUserIdList)){
|
|
|
|
- return ResponseResult.error(ErrorCodeEnum.MENTION_USER_ERROR,"提及的用户与本人不符合互关的状态");
|
|
|
|
|
|
+ //先校验提及的用户id是否符合互关的状态
|
|
|
|
+ if(CollectionUtils.isNotEmpty(tourismProjectTravelNotesWriteDto.getMentions())) {
|
|
|
|
+ List<TourTravelNotesMentionUserDto> mentions = tourismProjectTravelNotesWriteDto.getMentions();
|
|
|
|
+ List<TourTravelNotesMentionUserDto> mentionsUserIdList = mentions.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
|
|
|
|
+ List<TourShortUser> fouceEachFriendsByName = tourFansService.getFouceEachFriendsByName(userId, "");
|
|
|
|
+ List<TourShortUser> fouceEachFriedsUserIdList = fouceEachFriendsByName.stream().filter(i -> i.getUserId() != null).collect(Collectors.toList());
|
|
|
|
+ if (!(fouceEachFriedsUserIdList).containsAll(mentionsUserIdList)) {
|
|
|
|
+ return ResponseResult.error(ErrorCodeEnum.MENTION_USER_ERROR, "提及的用户与本人不符合互关的状态");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//校验dto中的群聊是否为本人参与的群聊
|
|
//校验dto中的群聊是否为本人参与的群聊
|
|
- List<TourShortImGroup> takePartImGroupListByName = tourImGroupService.getTakePartImGroupListByName(userId, "");
|
|
|
|
- List<Long> takePartImGroupIdList = takePartImGroupListByName.stream().mapToLong(TourShortImGroup::getId).boxed().collect(Collectors.toList());
|
|
|
|
- if(!takePartImGroupIdList.contains(tourismProjectTravelNotesWriteDto.getTourImGroupId())){
|
|
|
|
- return ResponseResult.error(ErrorCodeEnum.MENTION_GROUP_ERROR,"本人未参与到关联的群聊中");
|
|
|
|
|
|
+ if(tourismProjectTravelNotesWriteDto.getTourImGroupId() != null) {
|
|
|
|
+ List<TourShortImGroup> takePartImGroupListByName = tourImGroupService.getTakePartImGroupListByName(userId, "");
|
|
|
|
+ List<Long> takePartImGroupIdList = takePartImGroupListByName.stream().mapToLong(TourShortImGroup::getId).boxed().collect(Collectors.toList());
|
|
|
|
+ if (!takePartImGroupIdList.contains(tourismProjectTravelNotesWriteDto.getTourImGroupId())) {
|
|
|
|
+ return ResponseResult.error(ErrorCodeEnum.MENTION_GROUP_ERROR, "本人未参与到关联的群聊中");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//循环遍历查询内容是否超过5000长度
|
|
//循环遍历查询内容是否超过5000长度
|
|
@@ -227,23 +232,25 @@ public class WebSiteTourismTravelNotesPublishController {
|
|
@Transactional
|
|
@Transactional
|
|
public ResponseResult<Void> publishDraft(@RequestBody TourismProjectTravelNotesWriteToWebDto tourismProjectTravelNotesWriteDto) {
|
|
public ResponseResult<Void> publishDraft(@RequestBody TourismProjectTravelNotesWriteToWebDto tourismProjectTravelNotesWriteDto) {
|
|
|
|
|
|
- //先校验提及的用户id是否符合互关的状态
|
|
|
|
- List<TourTravelNotesMentionUserDto> mentions = tourismProjectTravelNotesWriteDto.getMentions();
|
|
|
|
- List<TourTravelNotesMentionUserDto> mentionsUserIdList = mentions.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
|
|
|
|
Long userId = TokenData.takeFromRequest().getUserId();
|
|
Long userId = TokenData.takeFromRequest().getUserId();
|
|
- List<TourShortUser> fouceEachFriendsByName = tourFansService.getFouceEachFriendsByName(userId, "");
|
|
|
|
- List<TourShortUser> fouceEachFriedsUserIdList = fouceEachFriendsByName.stream().filter(i -> i.getUserId() != null).collect(Collectors.toList());
|
|
|
|
- if(!(fouceEachFriedsUserIdList).containsAll(mentionsUserIdList)){
|
|
|
|
- return ResponseResult.error(ErrorCodeEnum.MENTION_USER_ERROR,"提及的用户与本人不符合互关的状态");
|
|
|
|
|
|
+ //先校验提及的用户id是否符合互关的状态
|
|
|
|
+ if(CollectionUtils.isNotEmpty(tourismProjectTravelNotesWriteDto.getMentions())) {
|
|
|
|
+ List<TourTravelNotesMentionUserDto> mentions = tourismProjectTravelNotesWriteDto.getMentions();
|
|
|
|
+ List<TourTravelNotesMentionUserDto> mentionsUserIdList = mentions.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
|
|
|
|
+ List<TourShortUser> fouceEachFriendsByName = tourFansService.getFouceEachFriendsByName(userId, "");
|
|
|
|
+ List<TourShortUser> fouceEachFriedsUserIdList = fouceEachFriendsByName.stream().filter(i -> i.getUserId() != null).collect(Collectors.toList());
|
|
|
|
+ if (!(fouceEachFriedsUserIdList).containsAll(mentionsUserIdList)) {
|
|
|
|
+ return ResponseResult.error(ErrorCodeEnum.MENTION_USER_ERROR, "提及的用户与本人不符合互关的状态");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
//校验dto中的群聊是否为本人参与的群聊
|
|
//校验dto中的群聊是否为本人参与的群聊
|
|
- List<TourShortImGroup> takePartImGroupListByName = tourImGroupService.getTakePartImGroupListByName(userId, "");
|
|
|
|
- List<Long> takePartImGroupIdList = takePartImGroupListByName.stream().mapToLong(TourShortImGroup::getId).boxed().collect(Collectors.toList());
|
|
|
|
- if(!takePartImGroupIdList.contains(tourismProjectTravelNotesWriteDto.getTourImGroupId())){
|
|
|
|
- return ResponseResult.error(ErrorCodeEnum.MENTION_GROUP_ERROR,"本人未参与到关联的群聊中");
|
|
|
|
|
|
+ if(tourismProjectTravelNotesWriteDto.getTourImGroupId() != null) {
|
|
|
|
+ List<TourShortImGroup> takePartImGroupListByName = tourImGroupService.getTakePartImGroupListByName(userId, "");
|
|
|
|
+ List<Long> takePartImGroupIdList = takePartImGroupListByName.stream().mapToLong(TourShortImGroup::getId).boxed().collect(Collectors.toList());
|
|
|
|
+ if (!takePartImGroupIdList.contains(tourismProjectTravelNotesWriteDto.getTourImGroupId())) {
|
|
|
|
+ return ResponseResult.error(ErrorCodeEnum.MENTION_GROUP_ERROR, "本人未参与到关联的群聊中");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
tourTravelNotesPublishService.publishDraft(tourismProjectTravelNotesWriteDto);
|
|
tourTravelNotesPublishService.publishDraft(tourismProjectTravelNotesWriteDto);
|
|
return ResponseResult.success();
|
|
return ResponseResult.success();
|
|
}
|
|
}
|
|
@@ -435,7 +442,7 @@ public class WebSiteTourismTravelNotesPublishController {
|
|
*/
|
|
*/
|
|
@OperationLog(type = SysOperationLogType.LIST)
|
|
@OperationLog(type = SysOperationLogType.LIST)
|
|
@GetMapping("/getTopicListByName")
|
|
@GetMapping("/getTopicListByName")
|
|
- public ResponseResult<List<TourTravelNotesTopic>> getTopicListByName(@Validated TourTravelNotesTopicByNameDto tourTravelNotesTopicByNameDto) {
|
|
|
|
|
|
+ public ResponseResult<List<TourTravelNotesTopicVo>> getTopicListByName(@Validated TourTravelNotesTopicByNameDto tourTravelNotesTopicByNameDto) {
|
|
//limit20
|
|
//limit20
|
|
PageMethod.startPage(tourTravelNotesTopicByNameDto.getPageNum(), tourTravelNotesTopicByNameDto.getPageSize(), true);
|
|
PageMethod.startPage(tourTravelNotesTopicByNameDto.getPageNum(), tourTravelNotesTopicByNameDto.getPageSize(), true);
|
|
TourTravelNotesTopic tourTravelNotesTopic = new TourTravelNotesTopic();
|
|
TourTravelNotesTopic tourTravelNotesTopic = new TourTravelNotesTopic();
|
|
@@ -444,7 +451,7 @@ public class WebSiteTourismTravelNotesPublishController {
|
|
String orderBy = MyOrderParam.buildOrderBy(myOrderParam, TourTravelNotesTopic.class);
|
|
String orderBy = MyOrderParam.buildOrderBy(myOrderParam, TourTravelNotesTopic.class);
|
|
myOrderParam.add(new MyOrderParam.OrderInfo("hotValue", false, null));
|
|
myOrderParam.add(new MyOrderParam.OrderInfo("hotValue", false, null));
|
|
List<TourTravelNotesTopic> tourTravelNotesTopicList = tourTravelNotesTopicService.getTourTravelNotesTopicList(tourTravelNotesTopic,orderBy);
|
|
List<TourTravelNotesTopic> tourTravelNotesTopicList = tourTravelNotesTopicService.getTourTravelNotesTopicList(tourTravelNotesTopic,orderBy);
|
|
- List<TourTravelNotesTopic> tourTravelNotesTopicVoList = MyModelUtil.copyCollectionTo(tourTravelNotesTopicList, TourTravelNotesTopic.class);
|
|
|
|
|
|
+ List<TourTravelNotesTopicVo> tourTravelNotesTopicVoList = MyModelUtil.copyCollectionTo(tourTravelNotesTopicList, TourTravelNotesTopicVo.class);
|
|
return ResponseResult.success(tourTravelNotesTopicVoList);
|
|
return ResponseResult.success(tourTravelNotesTopicVoList);
|
|
}
|
|
}
|
|
|
|
|