+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.modules.act.controller;
+
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.AssertUtils;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.epmet.modules.act.service.ActCommentAttachmentService;
+import com.epmet.resi.group.dto.act.ActCommentAttachmentDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+
+/**
+ * 活动评论附件表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-09-06
+ */
+@RestController
+@RequestMapping("actcommentattachment")
+public class ActCommentAttachmentController {
+
+ @Autowired
+ private ActCommentAttachmentService actCommentAttachmentService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = actCommentAttachmentService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ ActCommentAttachmentDTO data = actCommentAttachmentService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody ActCommentAttachmentDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ actCommentAttachmentService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody ActCommentAttachmentDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ actCommentAttachmentService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ actCommentAttachmentService.delete(ids);
+ return new Result();
+ }
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentAttachmentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentAttachmentDao.java
new file mode 100644
index 0000000000..07f076a6f5
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentAttachmentDao.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.modules.act.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.modules.act.entity.ActCommentAttachmentEntity;
+import com.epmet.resi.group.dto.group.result.CommentFileDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 活动评论附件表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-09-06
+ */
+@Mapper
+public interface ActCommentAttachmentDao extends BaseDao {
+
+ /**
+ * @Author sun
+ * @Description 查询通知评论所有人员的附件信息
+ **/
+ List selectActComFile(@Param("groupActId") String groupActId);
+
+}
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActCommentAttachmentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActCommentAttachmentEntity.java
new file mode 100644
index 0000000000..1e290165ee
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActCommentAttachmentEntity.java
@@ -0,0 +1,93 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.modules.notice.controller;
+
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.AssertUtils;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.epmet.modules.notice.service.NoticeCommentAttachmentService;
+import com.epmet.resi.group.dto.notice.NoticeCommentAttachmentDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+
+/**
+ * 通知评论附件表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-09-06
+ */
+@RestController
+@RequestMapping("noticecommentattachment")
+public class NoticeCommentAttachmentController {
+
+ @Autowired
+ private NoticeCommentAttachmentService noticeCommentAttachmentService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = noticeCommentAttachmentService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ NoticeCommentAttachmentDTO data = noticeCommentAttachmentService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody NoticeCommentAttachmentDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ noticeCommentAttachmentService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody NoticeCommentAttachmentDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ noticeCommentAttachmentService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ noticeCommentAttachmentService.delete(ids);
+ return new Result();
+ }
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentAttachmentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentAttachmentDao.java
new file mode 100644
index 0000000000..2ad57a60cd
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentAttachmentDao.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.modules.notice.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.modules.notice.entity.NoticeCommentAttachmentEntity;
+import com.epmet.resi.group.dto.group.result.CommentFileDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 通知评论附件表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-09-06
+ */
+@Mapper
+public interface NoticeCommentAttachmentDao extends BaseDao {
+
+ /**
+ * @Author sun
+ * @Description 查询通知评论所有人员的附件信息
+ **/
+ List selectNoticeComFile(@Param("noticeId") String noticeId);
+
+}
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeCommentAttachmentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeCommentAttachmentEntity.java
new file mode 100644
index 0000000000..7ab97e6634
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeCommentAttachmentEntity.java
@@ -0,0 +1,93 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.modules.notice.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.FieldConstant;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ConvertUtils;
+import com.epmet.modules.notice.dao.NoticeCommentAttachmentDao;
+import com.epmet.modules.notice.entity.NoticeCommentAttachmentEntity;
+import com.epmet.modules.notice.service.NoticeCommentAttachmentService;
+import com.epmet.resi.group.dto.group.result.CommentFileDTO;
+import com.epmet.resi.group.dto.notice.NoticeCommentAttachmentDTO;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 通知评论附件表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-09-06
+ */
+@Service
+public class NoticeCommentAttachmentServiceImpl extends BaseServiceImpl implements NoticeCommentAttachmentService {
+
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, NoticeCommentAttachmentDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, NoticeCommentAttachmentDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public NoticeCommentAttachmentDTO get(String id) {
+ NoticeCommentAttachmentEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, NoticeCommentAttachmentDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(NoticeCommentAttachmentDTO dto) {
+ NoticeCommentAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentAttachmentEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(NoticeCommentAttachmentDTO dto) {
+ NoticeCommentAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentAttachmentEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+ /**
+ * @Author sun
+ * @Description 查询通知评论所有人员的附件信息
+ **/
+ @Override
+ public List getNoticeComFile(String noticeId) {
+ return baseDao.selectNoticeComFile(noticeId);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java
index 2ab3994891..a66e3869a5 100644
--- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java
@@ -17,10 +17,13 @@
package com.epmet.modules.notice.service.impl;
+import com.alibaba.fastjson.JSON;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
+import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
@@ -30,18 +33,23 @@ import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.modules.member.service.ResiGroupMemberService;
import com.epmet.modules.notice.dao.NoticeCommentDao;
+import com.epmet.modules.notice.entity.NoticeCommentAttachmentEntity;
import com.epmet.modules.notice.entity.NoticeCommentEntity;
import com.epmet.modules.notice.redis.NoticeCommentRedis;
+import com.epmet.modules.notice.service.NoticeCommentAttachmentService;
import com.epmet.modules.notice.service.NoticeCommentService;
import com.epmet.modules.notice.service.NoticeService;
import com.epmet.modules.utils.ModuleConstant;
import com.epmet.resi.group.constant.MemberStateConstant;
import com.epmet.resi.group.constant.TopicConstant;
+import com.epmet.resi.group.dto.group.result.CommentFileDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.notice.NoticeDTO;
import com.epmet.resi.group.dto.notice.form.NoticeCommentFormDTO;
import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO;
+import com.epmet.resi.group.dto.notice.form.NoticeFileDTO;
import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -53,6 +61,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@@ -70,12 +79,16 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl imageList = formDTO.getImageList().stream().map(NoticeFileDTO::getUrl).collect(Collectors.toList());
+ safetyCheck(new ArrayList<>(), imageList);
//2.判断当前用户是否被禁言、移除、非本组成员
NoticeDTO notice = noticeService.get(formDTO.getNoticeId());
@@ -139,6 +155,33 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl AttachmentEntityList = new ArrayList<>();
+ //图片
+ if (CollectionUtils.isNotEmpty(formDTO.getImageList())) {
+ AtomicInteger sort = new AtomicInteger();
+ formDTO.getImageList().forEach(img -> {
+ NoticeCommentAttachmentEntity attachment = new NoticeCommentAttachmentEntity();
+ attachment.setCustomerId(notice.getCustomerId());
+ attachment.setNoticeId(formDTO.getNoticeId());
+ attachment.setNoticeCommentId(entity.getId());
+ attachment.setFileName(img.getName());
+ attachment.setAttachmentName("");
+ attachment.setAttachmentSize(img.getSize());
+ attachment.setAttachmentFormat(img.getFormat());
+ attachment.setAttachmentType(img.getType());
+ attachment.setAttachmentUrl(img.getUrl());
+ attachment.setSort(sort.get());
+ attachment.setDuration(img.getDuration());
+ sort.getAndIncrement();
+ AttachmentEntityList.add(attachment);
+ });
+ }
+ if (AttachmentEntityList.size() > NumConstant.ZERO) {
+ noticeCommentAttachmentService.insertBatch(AttachmentEntityList);
+ }
+
}
/**
@@ -165,7 +208,10 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl resultDTOList = result.getData();
- //3.封装数据并返回
+ //3.查询通知评论所有人员的附件信息
+ List fileList = noticeCommentAttachmentService.getNoticeComFile(formDTO.getNoticeId());
+
+ //4.封装数据并返回
resultList.forEach(l -> {
StringBuffer name = new StringBuffer();
resultDTOList.forEach(user -> {
@@ -175,9 +221,64 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl imageList = new ArrayList<>();
+ for (CommentFileDTO f : fileList) {
+ if (l.getUserId().equals(f.getUserId())) {
+ imageList.add(f);
+ }
+ }
+ l.setImageList(imageList);
});
return resultList;
}
+ /**
+ * @Author sun
+ * @Description 文字、图片安全校验
+ **/
+ public void safetyCheck(List wordList, List imageList) {
+ if (imageList.size() != NumConstant.ZERO) {
+ wordList.forEach(word -> {
+ //创建话题内容审核
+ TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
+ TextTaskDTO taskDTO = new TextTaskDTO();
+ taskDTO.setContent(word);
+ taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
+ textScanParamDTO.getTasks().add(taskDTO);
+ Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
+ if (!textSyncScanResult.success()) {
+ logger.error("safetyCheck textScan return failed,result:"+ JSON.toJSONString(textSyncScanResult));
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
+ } else {
+ if (!textSyncScanResult.getData().isAllPass()) {
+ logger.warn(EpmetErrorCode.TEXT_SCAN_FAILED.getMsg().concat(String.format(TopicConstant.CREATE_TOPIC, word)));
+ throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
+ }
+ }
+ });
+ }
+ //创建话题图片审核
+ if (imageList.size() != NumConstant.ZERO) {
+ ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
+ imageList.forEach(url -> {
+ ImgTaskDTO task = new ImgTaskDTO();
+ task.setDataId(UUID.randomUUID().toString().replace("-", ""));
+ task.setUrl(url);
+ imgScanParamDTO.getTasks().add(task);
+ });
+ Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
+ if (!imgScanResult.success()) {
+ logger.error("safetyCheck imgScan return failed,result:"+ JSON.toJSONString(imgScanResult));
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
+ }
+ if (!imgScanResult.getData().isAllPass()) {
+ logger.warn(EpmetErrorCode.IMG_SCAN_FAILED.getMsg());
+ throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
+ }
+
+ }
+ }
+
}
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java
index b21c69a4ae..49f240ca3c 100644
--- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java
@@ -503,7 +503,7 @@ public class NoticeServiceImpl extends BaseServiceImpl
* @Description 文字、图片安全校验
**/
private void safetyCheck(List wordList, List imageList) {
- if (imageList.size() != NumConstant.ZERO) {
+ if (wordList.size() != NumConstant.ZERO) {
wordList.forEach(word -> {
//创建话题内容审核
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicCommentAttachmentController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicCommentAttachmentController.java
new file mode 100644
index 0000000000..9c5dd8f841
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicCommentAttachmentController.java
@@ -0,0 +1,85 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.modules.topic.controller;
+
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.AssertUtils;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.epmet.modules.topic.service.ResiTopicCommentAttachmentService;
+import com.epmet.resi.group.dto.topic.ResiTopicCommentAttachmentDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+
+/**
+ * 话题评论附件表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-09-06
+ */
+@RestController
+@RequestMapping("resitopiccommentattachment")
+public class ResiTopicCommentAttachmentController {
+
+ @Autowired
+ private ResiTopicCommentAttachmentService resiTopicCommentAttachmentService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = resiTopicCommentAttachmentService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ ResiTopicCommentAttachmentDTO data = resiTopicCommentAttachmentService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody ResiTopicCommentAttachmentDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ resiTopicCommentAttachmentService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody ResiTopicCommentAttachmentDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ resiTopicCommentAttachmentService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ resiTopicCommentAttachmentService.delete(ids);
+ return new Result();
+ }
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicCommentAttachmentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicCommentAttachmentDao.java
new file mode 100644
index 0000000000..ab917a7ba5
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicCommentAttachmentDao.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.modules.topic.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.modules.topic.entity.ResiTopicCommentAttachmentEntity;
+import com.epmet.resi.group.dto.group.result.CommentFileDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 话题评论附件表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-09-06
+ */
+@Mapper
+public interface ResiTopicCommentAttachmentDao extends BaseDao {
+
+ /**
+ * @Author sun
+ * @Description 查询通知评论所有人员的附件信息
+ **/
+ List selectTopicComFile(@Param("topicId") String topicId);
+
+}
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicCommentAttachmentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicCommentAttachmentEntity.java
new file mode 100644
index 0000000000..d4400a14df
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicCommentAttachmentEntity.java
@@ -0,0 +1,93 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.modules.topic.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.FieldConstant;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ConvertUtils;
+import com.epmet.modules.topic.dao.ResiTopicCommentAttachmentDao;
+import com.epmet.modules.topic.entity.ResiTopicCommentAttachmentEntity;
+import com.epmet.modules.topic.service.ResiTopicCommentAttachmentService;
+import com.epmet.resi.group.dto.group.result.CommentFileDTO;
+import com.epmet.resi.group.dto.topic.ResiTopicCommentAttachmentDTO;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 话题评论附件表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-09-06
+ */
+@Service
+public class ResiTopicCommentAttachmentServiceImpl extends BaseServiceImpl implements ResiTopicCommentAttachmentService {
+
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, ResiTopicCommentAttachmentDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, ResiTopicCommentAttachmentDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public ResiTopicCommentAttachmentDTO get(String id) {
+ ResiTopicCommentAttachmentEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, ResiTopicCommentAttachmentDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(ResiTopicCommentAttachmentDTO dto) {
+ ResiTopicCommentAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ResiTopicCommentAttachmentEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(ResiTopicCommentAttachmentDTO dto) {
+ ResiTopicCommentAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ResiTopicCommentAttachmentEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+ /**
+ * @Author sun
+ * @Description 查询通知评论所有人员的附件信息
+ **/
+ @Override
+ public List getTopicComFile(String topicId) {
+ return baseDao.selectTopicComFile(topicId);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java
index dd02ae9142..623338a5ec 100644
--- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java
@@ -41,22 +41,25 @@ import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
-import com.epmet.dto.result.UserInfoResultDTO;
import com.epmet.dto.result.CommonDataFilterResultDTO;
+import com.epmet.dto.result.UserInfoResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.comment.entity.ResiTopicCommentEntity;
import com.epmet.modules.constant.ResiGroupRedisKeys;
import com.epmet.modules.constant.WxmpSubscribeConstant;
import com.epmet.modules.feign.EpmetUserFeignClient;
+import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
-import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.group.redis.ResiGroupRedis;
import com.epmet.modules.member.dao.ResiGroupMemberDao;
import com.epmet.modules.member.redis.ResiGroupMemberRedis;
import com.epmet.modules.member.service.ResiGroupMemberService;
+import com.epmet.modules.notice.service.NoticeCommentService;
import com.epmet.modules.topic.dao.ResiTopicCommentDao;
import com.epmet.modules.topic.dao.ResiTopicDao;
+import com.epmet.modules.topic.entity.ResiTopicCommentAttachmentEntity;
+import com.epmet.modules.topic.service.ResiTopicCommentAttachmentService;
import com.epmet.modules.topic.service.ResiTopicCommentService;
import com.epmet.modules.topic.service.ResiTopicService;
import com.epmet.modules.utils.ModuleConstant;
@@ -64,11 +67,12 @@ import com.epmet.resi.group.constant.MemberStateConstant;
import com.epmet.resi.group.constant.TopicConstant;
import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO;
import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO;
-import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO;
+import com.epmet.resi.group.dto.group.result.CommentFileDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO;
import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO;
+import com.epmet.resi.group.dto.notice.form.NoticeFileDTO;
import com.epmet.resi.group.dto.topic.ResiTopicCommentDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.ResiPublishCommentFormDTO;
@@ -76,6 +80,7 @@ import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import com.google.common.base.CharMatcher;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -85,6 +90,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@@ -99,32 +105,28 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl imageList = resiCommentFormDTO.getImageList().stream().map(NoticeFileDTO::getUrl).collect(Collectors.toList());
+ noticeCommentService.safetyCheck(new ArrayList<>(), imageList);
+
//1.判断当前用户是否被禁言
ResiTopicDTO topic = resiTopicService.get(resiCommentFormDTO.getTopicId());
if(null == topic){
@@ -314,6 +320,32 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl AttachmentEntityList = new ArrayList<>();
+ //图片
+ if (CollectionUtils.isNotEmpty(resiCommentFormDTO.getImageList())) {
+ AtomicInteger sort = new AtomicInteger();
+ resiCommentFormDTO.getImageList().forEach(img -> {
+ ResiTopicCommentAttachmentEntity attachment = new ResiTopicCommentAttachmentEntity();
+ attachment.setCustomerId(comment.getCustomerId());
+ attachment.setTopicId(resiCommentFormDTO.getTopicId());
+ attachment.setTopicCommentId(comment.getId());
+ attachment.setFileName(img.getName());
+ attachment.setAttachmentName("");
+ attachment.setAttachmentSize(img.getSize());
+ attachment.setAttachmentFormat(img.getFormat());
+ attachment.setAttachmentType(img.getType());
+ attachment.setAttachmentUrl(img.getUrl());
+ attachment.setSort(sort.get());
+ attachment.setDuration(img.getDuration());
+ sort.getAndIncrement();
+ AttachmentEntityList.add(attachment);
+ });
+ }
+ if (AttachmentEntityList.size() > NumConstant.ZERO) {
+ resiTopicCommentAttachmentService.insertBatch(AttachmentEntityList);
+ }
+
//对所有关注这个话题的人发送微信订阅
resiTopicService.sendWxmpUpdateSubscribe(tokenDto,topic.getId(), WxmpSubscribeConstant.TYPE_COMMENT);
return new Result();
@@ -372,6 +404,20 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl fileList = resiTopicCommentAttachmentService.getTopicComFile(commentFormDTO.getTopicId());
+ //封装数据并返回
+ comments.forEach(l -> {
+ //每一条评论的附件信息
+ List imageList = new ArrayList<>();
+ for (CommentFileDTO f : fileList) {
+ if (l.getUserId().equals(f.getUserId())) {
+ imageList.add(f);
+ }
+ }
+ l.setImageList(imageList);
+ });
+
}
return new Result>().ok(comments);
diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentAttachmentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentAttachmentDao.xml
new file mode 100644
index 0000000000..88a1997484
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentAttachmentDao.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentAttachmentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentAttachmentDao.xml
new file mode 100644
index 0000000000..027cf9b729
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentAttachmentDao.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentAttachmentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentAttachmentDao.xml
new file mode 100644
index 0000000000..ff7fcc59e9
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentAttachmentDao.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
\ No newline at end of file