|
@@ -12,6 +12,7 @@ import com.tourism.common.core.validator.UpdateGroup;
|
|
import com.tourism.webadmin.app.website.dto.TourismProjectTravelNotesWriteDetailPageDto;
|
|
import com.tourism.webadmin.app.website.dto.TourismProjectTravelNotesWriteDetailPageDto;
|
|
import com.tourism.webadmin.app.website.dto.TourismProjectTravelNotesWriteToWebDto;
|
|
import com.tourism.webadmin.app.website.dto.TourismProjectTravelNotesWriteToWebDto;
|
|
import com.tourism.webadmin.app.website.service.TourTravelNotesPublishService;
|
|
import com.tourism.webadmin.app.website.service.TourTravelNotesPublishService;
|
|
|
|
+import com.tourism.webadmin.back.dto.TourTourismProjectTravelNotesWriteContentDto;
|
|
import com.tourism.webadmin.back.dto.TourismTravelNotesContentWriteDto;
|
|
import com.tourism.webadmin.back.dto.TourismTravelNotesContentWriteDto;
|
|
import com.tourism.webadmin.back.model.*;
|
|
import com.tourism.webadmin.back.model.*;
|
|
import com.tourism.webadmin.back.model.constant.AuditState;
|
|
import com.tourism.webadmin.back.model.constant.AuditState;
|
|
@@ -44,6 +45,8 @@ public class TourTravelNotesPublishServiceImpl implements TourTravelNotesPublish
|
|
private HuaweiCloudModerationService huaweiCloudModerationService;
|
|
private HuaweiCloudModerationService huaweiCloudModerationService;
|
|
@Autowired
|
|
@Autowired
|
|
private TourTravelNotesImgService tourTravelNotesImgService;
|
|
private TourTravelNotesImgService tourTravelNotesImgService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private TourTourismProjectTravelNotesWriteContentService tourTourismProjectTravelNotesWriteContentService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -137,16 +140,16 @@ public class TourTravelNotesPublishServiceImpl implements TourTravelNotesPublish
|
|
tourTravelNotesImgService.saveNewBatch(tourTravelNotesImgList);
|
|
tourTravelNotesImgService.saveNewBatch(tourTravelNotesImgList);
|
|
|
|
|
|
//判断内容是否为空
|
|
//判断内容是否为空
|
|
- if (tourismProjectTravelNotesWriteDto.getTravelNotesContent() != null) {
|
|
|
|
- List<TourismTravelNotesContentWriteDto> travelNotesContentWriteList = tourismProjectTravelNotesWriteDto.getTravelNotesContent();
|
|
|
|
- List<TourismTravelNotesContentWrite> tourismTravelNotesContentWriteList = MyModelUtil.copyCollectionTo(travelNotesContentWriteList, TourismTravelNotesContentWrite.class);
|
|
|
|
- for (TourismTravelNotesContentWrite item : tourismTravelNotesContentWriteList) {
|
|
|
|
- item.setAssociationId(tourismProjectTravelNotesWriteSave.getId());
|
|
|
|
- item.setId(null);
|
|
|
|
- }
|
|
|
|
|
|
+ if (tourismProjectTravelNotesWriteDto.getTourTourismProjectTravelNotesWriteContentDto() != null) {
|
|
|
|
+ TourTourismProjectTravelNotesWriteContentDto tourTourismProjectTravelNotesWriteContentDto =
|
|
|
|
+ tourismProjectTravelNotesWriteDto.getTourTourismProjectTravelNotesWriteContentDto();
|
|
|
|
+ TourTourismProjectTravelNotesWriteContent tourTourismProjectTravelNotesWriteContent =
|
|
|
|
+ MyModelUtil.copyTo(tourTourismProjectTravelNotesWriteContentDto, TourTourismProjectTravelNotesWriteContent.class);
|
|
|
|
+ tourTourismProjectTravelNotesWriteContent.setAssociationId(tourismProjectTravelNotesWriteSave.getId());
|
|
|
|
+ tourTourismProjectTravelNotesWriteContent.setId(null);
|
|
tourismTravelNotesContentWriteService.removeByAssociationId(tourismProjectTravelNotesWriteSave.getId());
|
|
tourismTravelNotesContentWriteService.removeByAssociationId(tourismProjectTravelNotesWriteSave.getId());
|
|
//查询关联数据的id,根据id进行更新数据表的数据
|
|
//查询关联数据的id,根据id进行更新数据表的数据
|
|
- tourismTravelNotesContentWriteService.saveNewBatch(tourismTravelNotesContentWriteList);
|
|
|
|
|
|
+ tourTourismProjectTravelNotesWriteContentService.saveNew(tourTourismProjectTravelNotesWriteContent);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -211,57 +214,48 @@ public class TourTravelNotesPublishServiceImpl implements TourTravelNotesPublish
|
|
tourismProjectTravelNotesWriteService.getById(tourismProjectTravelNotesWriteDto.getId());
|
|
tourismProjectTravelNotesWriteService.getById(tourismProjectTravelNotesWriteDto.getId());
|
|
|
|
|
|
if(tourismProjectTravelNotesWriteVerify != null){
|
|
if(tourismProjectTravelNotesWriteVerify != null){
|
|
- if(tourismProjectTravelNotesWriteVerify.getState() .equals(AuditState.UNAUDITSTATE)) {
|
|
|
|
|
|
+ if(tourismProjectTravelNotesWriteVerify.getState().equals(AuditState.UNAUDITSTATE)) {
|
|
return ResponseResult.error(ErrorCodeEnum.INVALID_STATUS_ARGUMENT, "该游记状态为:正在审核中,请撤销后进行操作");
|
|
return ResponseResult.error(ErrorCodeEnum.INVALID_STATUS_ARGUMENT, "该游记状态为:正在审核中,请撤销后进行操作");
|
|
}else if(tourismProjectTravelNotesWriteVerify.getState() .equals(AuditState.SUCCEEDAUDIT)){
|
|
}else if(tourismProjectTravelNotesWriteVerify.getState() .equals(AuditState.SUCCEEDAUDIT)){
|
|
return ResponseResult.error(ErrorCodeEnum.INVALID_STATUS_ARGUMENT, "该游记状态为:已发布成功,请下架后进行操作");
|
|
return ResponseResult.error(ErrorCodeEnum.INVALID_STATUS_ARGUMENT, "该游记状态为:已发布成功,请下架后进行操作");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //将从表中的数据进行过滤,筛选出cover为1的图片为封面图,第一段落为项目简述
|
|
|
|
- List<TourismTravelNotesContentWriteDto> travelNotesContent = tourismProjectTravelNotesWriteDto.getTravelNotesContent();
|
|
|
|
-
|
|
|
|
- //循环遍历查询内容是否超过5000长度
|
|
|
|
- for(TourismTravelNotesContentWriteDto i:travelNotesContent){
|
|
|
|
- if(StringUtils.isNotBlank(i.getContent()) && i.getContent().length()>5000)
|
|
|
|
- return ResponseResult.error(ErrorCodeEnum.CONTENT_OUT_LIMIT);
|
|
|
|
- }
|
|
|
|
|
|
|
|
//判断imgUrls是否为空,不为空的话,则把第一张图作为列表图
|
|
//判断imgUrls是否为空,不为空的话,则把第一张图作为列表图
|
|
if (CollectionUtils.isNotEmpty(tourismProjectTravelNotesWriteDto.getImgUrls())) {
|
|
if (CollectionUtils.isNotEmpty(tourismProjectTravelNotesWriteDto.getImgUrls())) {
|
|
tourismProjectTravelNotesWrite.setTourismUrl(tourismProjectTravelNotesWriteDto.getImgUrls().get(0));
|
|
tourismProjectTravelNotesWrite.setTourismUrl(tourismProjectTravelNotesWriteDto.getImgUrls().get(0));
|
|
}
|
|
}
|
|
|
|
|
|
- List<TourismTravelNotesContentWriteDto> sectionContent = travelNotesContent.stream().filter(item -> item.getType().equals("sectionContent")).collect(Collectors.toList());
|
|
|
|
- if(CollectionUtils.isNotEmpty(sectionContent)){
|
|
|
|
- tourismProjectTravelNotesWrite.setRemarks(sectionContent.get(0).getContent());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 文案审核
|
|
|
|
- List<String> imageList = travelNotesContent.stream().filter(e -> e.getType().equals("image")).map(TourismTravelNotesContentWriteDto::getContent).collect(Collectors.toList());
|
|
|
|
|
|
+ // 图片审核
|
|
|
|
+ List<String> imageList = tourismProjectTravelNotesWriteDto.getImgUrls();
|
|
imageList.add(tourismProjectTravelNotesWrite.getTravelNotesBanner());
|
|
imageList.add(tourismProjectTravelNotesWrite.getTravelNotesBanner());
|
|
Boolean imageResult = huaweiCloudModerationService.runImageModeration(imageList);
|
|
Boolean imageResult = huaweiCloudModerationService.runImageModeration(imageList);
|
|
- // 图片审核
|
|
|
|
- List<String> titleList = travelNotesContent.stream().filter(e -> e.getType().equals("sectionTitle")).map(TourismTravelNotesContentWriteDto::getContent).collect(Collectors.toList());
|
|
|
|
- List<String> contentList = travelNotesContent.stream().filter(e -> e.getType().equals("sectionContent")).map(TourismTravelNotesContentWriteDto::getContent).collect(Collectors.toList());
|
|
|
|
- titleList.addAll(contentList);
|
|
|
|
- Boolean textResult = huaweiCloudModerationService.runTextModeration(titleList);
|
|
|
|
- String auditReson = "";
|
|
|
|
- if(imageResult && textResult){
|
|
|
|
- tourismProjectTravelNotesWrite.setAutoAuditStatus(1);
|
|
|
|
- auditReson = "图文审核通过";
|
|
|
|
- }else {
|
|
|
|
- tourismProjectTravelNotesWrite.setAutoAuditStatus(2);
|
|
|
|
- if(!imageResult){
|
|
|
|
- auditReson = "图片审核未通过:可能设计暴恐、色情、违禁、辱骂等内容;";
|
|
|
|
- }
|
|
|
|
- if(!textResult){
|
|
|
|
- auditReson += "文案审核未通过:可能设计暴恐、色情、违禁、辱骂等内容;";
|
|
|
|
|
|
+ // 文案审核
|
|
|
|
+ List<String> titleList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ //提取出从表内容
|
|
|
|
+ TourTourismProjectTravelNotesWriteContentDto tourTourismProjectTravelNotesWriteContentDto =
|
|
|
|
+ tourismProjectTravelNotesWriteDto.getTourTourismProjectTravelNotesWriteContentDto();
|
|
|
|
+ if(tourTourismProjectTravelNotesWriteContentDto != null && StringUtils.isNotBlank(tourTourismProjectTravelNotesWriteContentDto.getContent())) {
|
|
|
|
+ titleList.add(tourTourismProjectTravelNotesWriteContentDto.getContent());
|
|
|
|
+ Boolean textResult = huaweiCloudModerationService.runTextModeration(titleList);
|
|
|
|
+ String auditReson = "";
|
|
|
|
+ if (imageResult && textResult) {
|
|
|
|
+ tourismProjectTravelNotesWrite.setAutoAuditStatus(1);
|
|
|
|
+ auditReson = "图文审核通过";
|
|
|
|
+ } else {
|
|
|
|
+ tourismProjectTravelNotesWrite.setAutoAuditStatus(2);
|
|
|
|
+ if (!imageResult) {
|
|
|
|
+ auditReson = "图片审核未通过:可能设计暴恐、色情、违禁、辱骂等内容;";
|
|
|
|
+ }
|
|
|
|
+ if (!textResult) {
|
|
|
|
+ auditReson += "文案审核未通过:可能设计暴恐、色情、违禁、辱骂等内容;";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ tourismProjectTravelNotesWrite.setAutoRejectReason(auditReson);
|
|
}
|
|
}
|
|
- tourismProjectTravelNotesWrite.setAutoRejectReason(auditReson);
|
|
|
|
|
|
|
|
tourismProjectTravelNotesWrite.setState(AuditState.UNAUDITSTATE);
|
|
tourismProjectTravelNotesWrite.setState(AuditState.UNAUDITSTATE);
|
|
-
|
|
|
|
List<TourTravelNotesTopicRelation> tourTravelNotesTopicRelationList = new ArrayList<>();
|
|
List<TourTravelNotesTopicRelation> tourTravelNotesTopicRelationList = new ArrayList<>();
|
|
List<TourTravelNotesImg> tourTravelNotesImgList = new ArrayList<>();
|
|
List<TourTravelNotesImg> tourTravelNotesImgList = new ArrayList<>();
|
|
|
|
|
|
@@ -343,13 +337,12 @@ public class TourTravelNotesPublishServiceImpl implements TourTravelNotesPublish
|
|
tourTravelNotesImgService.saveNewBatch(tourTravelNotesImgList);
|
|
tourTravelNotesImgService.saveNewBatch(tourTravelNotesImgList);
|
|
|
|
|
|
tourismTravelNotesContentWriteService.removeByAssociationId(tourismProjectTravelNotesWriteDto.getId());
|
|
tourismTravelNotesContentWriteService.removeByAssociationId(tourismProjectTravelNotesWriteDto.getId());
|
|
- List<TourismTravelNotesContentWrite> tourismTravelNotesContentWriteList =
|
|
|
|
- MyModelUtil.copyCollectionTo(tourismProjectTravelNotesWriteDto.getTravelNotesContent(), TourismTravelNotesContentWrite.class);
|
|
|
|
- for (TourismTravelNotesContentWrite item : tourismTravelNotesContentWriteList) {
|
|
|
|
- item.setAssociationId(tourismProjectTravelNotesWrite.getId());
|
|
|
|
- item.setId(null);
|
|
|
|
- }
|
|
|
|
- tourismTravelNotesContentWriteService.saveNewBatch(tourismTravelNotesContentWriteList);
|
|
|
|
|
|
+
|
|
|
|
+ TourTourismProjectTravelNotesWriteContent tourTourismProjectTravelNotesWriteContent =
|
|
|
|
+ MyModelUtil.copyTo(tourismProjectTravelNotesWriteDto.getTourTourismProjectTravelNotesWriteContentDto(), TourTourismProjectTravelNotesWriteContent.class);
|
|
|
|
+ tourTourismProjectTravelNotesWriteContent.setAssociationId(tourismProjectTravelNotesWrite.getId());
|
|
|
|
+ tourTourismProjectTravelNotesWriteContent.setId(null);
|
|
|
|
+ tourTourismProjectTravelNotesWriteContentService.saveNew(tourTourismProjectTravelNotesWriteContent);
|
|
|
|
|
|
return ResponseResult.success();
|
|
return ResponseResult.success();
|
|
}
|
|
}
|