Browse Source

话题语音相关接口

master
zhaoqifeng 5 years ago
parent
commit
361a2bf8d1
  1. 12
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java
  2. 104
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftScanTaskDTO.java
  3. 33
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/AuditDraftTopicFormDTO.java
  4. 78
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CreateTopicFormDTO.java
  5. 18
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/DraftDetailFormDTO.java
  6. 22
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingTopicFormDTO.java
  7. 30
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicAuditFormDTO.java
  8. 57
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/DraftDetailResultDTO.java
  9. 22
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingTopicResultDTO.java
  10. 31
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicAuditResultDTO.java
  11. 75
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java
  12. 13
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftAttachmentDao.java
  13. 24
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftDao.java
  14. 33
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftScanTaskDao.java
  15. 74
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftScanTaskEntity.java
  16. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftAttachmentService.java
  17. 95
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftScanTaskService.java
  18. 51
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java
  19. 20
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftAttachmentServiceImpl.java
  20. 99
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftScanTaskServiceImpl.java
  21. 498
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java
  22. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  23. 2
      epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml
  24. 8
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftAttachmentDao.xml
  25. 20
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftDao.xml
  26. 23
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftScanTaskDao.xml

12
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java

@ -87,4 +87,16 @@ public interface TopicConstant {
String FILE_DOC = "doc"; String FILE_DOC = "doc";
String FILE_VOICE = "voice"; String FILE_VOICE = "voice";
String FILE_VIDEO = "video"; String FILE_VIDEO = "video";
String AUDITING = "auditing";
String AUTO_PASSED = "auto_passed";
String REVIEW = "review";
String BLOCK = "block";
String REJECTED = "rejected";
String APPROVED = "approved";
String SUBMIT = "submit";
String IMAGE = " image";
String VIDEO = " video";
String VOICE = " voice";
String DOC = " doc";
} }

104
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftScanTaskDTO.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.resi.group.dto.topic;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 话题附件检测任务表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-18
*/
@Data
public class TopicDraftScanTaskDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 话题草稿Id
*/
private String topicDraftId;
/**
* 话题草稿附件表Id对应dataId
*/
private String topicDraftAttachmentId;
/**
* 阿里云审核任务Id
*/
private String taskId;
/**
* 审核状态auditing: 审核中
auto_passed: 自动通过
review结果不确定需要人工审核
block: 结果违规
*/
private String status;
/**
* 附件类型视频 - video 语音 - voice
*/
private String attachmentType;
/**
* 删除标记 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 操作人API审核结果存储为SCAN_USER或者APP_USER
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

33
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/AuditDraftTopicFormDTO.java

@ -0,0 +1,33 @@
package com.epmet.resi.group.dto.topic.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/12/18 15:03
*/
@NoArgsConstructor
@Data
public class AuditDraftTopicFormDTO implements Serializable {
private static final long serialVersionUID = -4766725540339231386L;
/**
* 草稿话题Id
*/
@NotBlank(message = "话题id不能为空")
private String topicDraftId;
/**
* 审核状态(通过:approved 驳回:rejected)
*/
@NotBlank(message = "审核状态不能为空")
private String auditType;
/**
* 审核原因
*/
private String reason;
}

78
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CreateTopicFormDTO.java

@ -0,0 +1,78 @@
package com.epmet.resi.group.dto.topic.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/12/17 15:08
*/
@Data
public class CreateTopicFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String customerId;
private String gridId;
/**
* 小组Id
* */
@NotBlank(message = "小组Id不能为空")
private String groupId;
private String topicDraftId;
private String topicContent;
/**
* 经度
* */
private String longitude;
/**
* 纬度
* */
private String dimension;
/**
* 地址
* */
@NotBlank(message = "地址信息不能为空")
private String address;
/**
* 省份
* */
private String province;
/**
* 城市
* */
private String city;
/**
* 地区
* */
private String area;
/**
* 图片附件
*/
private List<String> imageList;
/**
* 文件附件
*/
private List<String> docList;
/**
* 语音附件
*/
private List<String> voiceList;
/**
* 视频附件
*/
private List<String> videoList;
}

18
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/DraftDetailFormDTO.java

@ -0,0 +1,18 @@
package com.epmet.resi.group.dto.topic.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/12/18 14:53
*/
@Data
public class DraftDetailFormDTO implements Serializable {
private static final long serialVersionUID = -240658534604688292L;
@NotBlank(message = "话题id不能为空")
private String topicDraftId;
}

22
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingTopicFormDTO.java

@ -0,0 +1,22 @@
package com.epmet.resi.group.dto.topic.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/12/18 14:44
*/
@NoArgsConstructor
@Data
public class MyAuditingTopicFormDTO implements Serializable {
private static final long serialVersionUID = 9154103669944393282L;
private String customerId;
private String userId;
private Integer pageNo = 1;
private Integer pageSize = 20;
}

30
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicAuditFormDTO.java

@ -0,0 +1,30 @@
package com.epmet.resi.group.dto.topic.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/12/18 14:22
*/
@NoArgsConstructor
@Data
public class TopicAuditFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = 2013373278734345918L;
/**
* 小组ID
*/
@NotBlank(message = "小组id不能为空")
private String groupId;
/**
* 审核状态(待审核:review 已驳回:rejected)
*/
@NotBlank(message = "审核状态不能为空")
private String status;
}

57
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/DraftDetailResultDTO.java

@ -0,0 +1,57 @@
package com.epmet.resi.group.dto.topic.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/12/18 14:50
*/
@NoArgsConstructor
@Data
public class DraftDetailResultDTO implements Serializable {
private static final long serialVersionUID = -7445417689558651158L;
/**
* 话题草稿id
*/
private String topicDraftId;
/**
* 话题内容
*/
private String topicContent;
/**
* 发布时间yyyy-MM-dd HH:mm
*/
private String releaseTime;
/**
* 发布人头像
*/
private String releaseUserHeadPhoto;
/**
* 发布人名称
*/
private String releaseUserName;
/**
* 发布地址
*/
private String releaseAddress;
/**
* 驳回理由
*/
private String reason;
/**
* 图片附件集合
*/
private List<String> imageList;
private List<String> docList;
/**
* 音频附件集合
*/
private List<String> voiceList;
private List<String> videoList;
}

22
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingTopicResultDTO.java

@ -0,0 +1,22 @@
package com.epmet.resi.group.dto.topic.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/12/18 14:41
*/
@Data
public class MyAuditingTopicResultDTO implements Serializable {
private static final long serialVersionUID = -2876904175308968430L;
private String topicDraftId;
private String groupId;
private Long releaseTime;
private String topicContent;
private String releaseGroupName;
private String releaseGridId;
private String releaseGridName;
}

31
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicAuditResultDTO.java

@ -0,0 +1,31 @@
package com.epmet.resi.group.dto.topic.result;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/12/18 14:28
*/
@NoArgsConstructor
@Data
public class TopicAuditResultDTO {
/**
* 话题草稿id
*/
private String topicDraftId;
/**
* 话题内容
*/
private String topicContent;
/**
* 组成员显示名称
*/
private String userName;
/**
* 话题草稿的发布时间戳
*/
private Long releaseTime;
}

75
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java

@ -30,8 +30,10 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.modules.topic.excel.TopicDraftExcel; import com.epmet.modules.topic.excel.TopicDraftExcel;
import com.epmet.modules.topic.service.TopicDraftService; import com.epmet.modules.topic.service.TopicDraftService;
import com.epmet.resi.group.dto.topic.TopicDraftDTO; import com.epmet.resi.group.dto.topic.TopicDraftDTO;
import com.epmet.resi.group.dto.topic.form.MyAuditingListFormDTO; import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO; import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicAuditResultDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -95,6 +97,77 @@ public class TopicDraftController {
ExcelUtils.exportExcelToTarget(response, null, list, TopicDraftExcel.class); ExcelUtils.exportExcelToTarget(response, null, list, TopicDraftExcel.class);
} }
/**
* 发布话题
* @author zhaoqifeng
* @date 2020/12/17 15:49
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("createtopic")
public Result createTopic(@LoginUser TokenDto tokenDto, @RequestBody CreateTopicFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
topicDraftService.createTopic(tokenDto, formDTO);
return new Result();
}
/**
* 组管理界面-待审核/已驳回列表
* @author zhaoqifeng
* @date 2020/12/18 14:32
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.topic.result.TopicAuditResultDTO>
*/
@PostMapping("auditlist")
public Result<List<TopicAuditResultDTO>> auditList(@RequestBody TopicAuditFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
List<TopicAuditResultDTO> result = topicDraftService.auditList(formDTO);
return new Result<List<TopicAuditResultDTO>>().ok(result);
}
/**
* 话题草稿详情
* @author zhaoqifeng
* @date 2020/12/18 14:55
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO>
*/
@PostMapping("detail")
public Result<DraftDetailResultDTO> detail(@RequestBody DraftDetailFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
DraftDetailResultDTO result = topicDraftService.detail(formDTO);
return new Result<DraftDetailResultDTO>().ok(result);
}
/**
* 删除已驳回话题
* @author zhaoqifeng
* @date 2020/12/18 14:57
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("del")
public Result deleteDraft(@RequestBody DraftDetailFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
topicDraftService.deleteDraft(formDTO);
return new Result();
}
/**
* 组长审核
* @author zhaoqifeng
* @date 2020/12/18 15:06
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("audit")
public Result audit(@RequestBody AuditDraftTopicFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
topicDraftService.audit(formDTO);
return new Result();
}
/** /**
* @param formDTO * @param formDTO
* @return * @return

13
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftAttachmentDao.java

@ -20,6 +20,9 @@ package com.epmet.modules.topic.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.topic.entity.TopicDraftAttachmentEntity; import com.epmet.modules.topic.entity.TopicDraftAttachmentEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 话题草稿附件表 * 话题草稿附件表
@ -29,5 +32,13 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface TopicDraftAttachmentDao extends BaseDao<TopicDraftAttachmentEntity> { public interface TopicDraftAttachmentDao extends BaseDao<TopicDraftAttachmentEntity> {
/**
* 获取附件列表
* @author zhaoqifeng
* @date 2020/12/18 16:44
* @param topicDraftId
* @param type
* @return java.util.List<java.lang.String>
*/
List<String> selectFileUrls(@Param("topicDraftId") String topicDraftId, @Param("type") String type);
} }

24
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftDao.java

@ -19,9 +19,15 @@ package com.epmet.modules.topic.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.topic.entity.TopicDraftEntity; import com.epmet.modules.topic.entity.TopicDraftEntity;
import com.epmet.resi.group.dto.topic.TopicDraftDTO;
import com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicAuditResultDTO;
import com.epmet.resi.group.dto.topic.form.MyAuditingListFormDTO; import com.epmet.resi.group.dto.topic.form.MyAuditingListFormDTO;
import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO; import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.List; import java.util.List;
@ -33,6 +39,24 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface TopicDraftDao extends BaseDao<TopicDraftEntity> { public interface TopicDraftDao extends BaseDao<TopicDraftEntity> {
/**
* 获取小组待审核/已驳回列表
* @author zhaoqifeng
* @date 2020/12/18 15:47
* @param groupId
* @param status
* @return com.epmet.resi.group.dto.topic.TopicDraftDTO
*/
List<TopicAuditResultDTO> selectTopicDraftByGroup(@Param("groupId") String groupId, @Param("status") String status);
/**
* 话题草稿详情
* @author zhaoqifeng
* @date 2020/12/18 16:19
* @param topicDraftId
* @return com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO
*/
DraftDetailResultDTO selectTopicDraftDetail(@Param("topicDraftId") String topicDraftId);
/** /**
* @param formDTO * @param formDTO

33
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftScanTaskDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.modules.topic.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.topic.entity.TopicDraftScanTaskEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 话题附件检测任务表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-18
*/
@Mapper
public interface TopicDraftScanTaskDao extends BaseDao<TopicDraftScanTaskEntity> {
}

74
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftScanTaskEntity.java

@ -0,0 +1,74 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.modules.topic.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 话题附件检测任务表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("topic_draft_scan_task")
public class TopicDraftScanTaskEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 话题草稿Id
*/
private String topicDraftId;
/**
* 话题草稿附件表Id对应dataId
*/
private String topicDraftAttachmentId;
/**
* 阿里云审核任务Id
*/
private String taskId;
/**
* 审核状态auditing: 审核中
auto_passed: 自动通过
review结果不确定需要人工审核
block: 结果违规
*/
private String status;
/**
* 附件类型视频 - video 语音 - voice
*/
private String attachmentType;
}

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftAttachmentService.java

@ -92,4 +92,14 @@ public interface TopicDraftAttachmentService extends BaseService<TopicDraftAttac
* @date 2020-12-17 * @date 2020-12-17
*/ */
void delete(String[] ids); void delete(String[] ids);
/**
* 获取附件列表
* @author zhaoqifeng
* @date 2020/12/18 16:42
* @param topicDraftId
* @param type
* @return java.util.List<java.lang.String>
*/
List<String> getFileList(String topicDraftId, String type);
} }

95
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftScanTaskService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.modules.topic.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.modules.topic.entity.TopicDraftScanTaskEntity;
import com.epmet.resi.group.dto.topic.TopicDraftScanTaskDTO;
import java.util.List;
import java.util.Map;
/**
* 话题附件检测任务表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-18
*/
public interface TopicDraftScanTaskService extends BaseService<TopicDraftScanTaskEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<TopicDraftScanTaskDTO>
* @author generator
* @date 2020-12-18
*/
PageData<TopicDraftScanTaskDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<TopicDraftScanTaskDTO>
* @author generator
* @date 2020-12-18
*/
List<TopicDraftScanTaskDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return TopicDraftScanTaskDTO
* @author generator
* @date 2020-12-18
*/
TopicDraftScanTaskDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-12-18
*/
void save(TopicDraftScanTaskDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-12-18
*/
void update(TopicDraftScanTaskDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-12-18
*/
void delete(String[] ids);
}

51
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java

@ -19,8 +19,13 @@ package com.epmet.modules.topic.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.modules.topic.entity.TopicDraftEntity; import com.epmet.modules.topic.entity.TopicDraftEntity;
import com.epmet.resi.group.dto.topic.TopicDraftDTO; import com.epmet.resi.group.dto.topic.TopicDraftDTO;
import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.MyAuditingTopicResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicAuditResultDTO;
import com.epmet.resi.group.dto.topic.form.MyAuditingListFormDTO; import com.epmet.resi.group.dto.topic.form.MyAuditingListFormDTO;
import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO; import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO;
@ -95,6 +100,52 @@ public interface TopicDraftService extends BaseService<TopicDraftEntity> {
*/ */
void delete(String[] ids); void delete(String[] ids);
/**
* 发布话题
* @author zhaoqifeng
* @date 2020/12/17 15:49
* @param tokenDto
* @param formDTO
* @return void
*/
void createTopic(TokenDto tokenDto, CreateTopicFormDTO formDTO);
/**
* 组管理界面-待审核/已驳回列表
* @author zhaoqifeng
* @date 2020/12/18 14:34
* @param formDTO
* @return java.util.List<com.epmet.resi.group.dto.topic.result.TopicAuditResultDTO>
*/
List<TopicAuditResultDTO> auditList(TopicAuditFormDTO formDTO);
/**
* 话题草稿详情
* @author zhaoqifeng
* @date 2020/12/18 14:55
* @param formDTO
* @return com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO
*/
DraftDetailResultDTO detail(DraftDetailFormDTO formDTO);
/**
* 删除已驳回话题
* @author zhaoqifeng
* @date 2020/12/18 14:58
* @param formDTO
* @return void
*/
void deleteDraft(DraftDetailFormDTO formDTO);
/**
* 组长审核
* @author zhaoqifeng
* @date 2020/12/18 15:06
* @param formDTO
* @return void
*/
void audit(AuditDraftTopicFormDTO formDTO);
/** /**
* @param formDTO * @param formDTO
* @return * @return

20
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftAttachmentServiceImpl.java

@ -27,11 +27,13 @@ import com.epmet.modules.topic.dao.TopicDraftAttachmentDao;
import com.epmet.modules.topic.entity.TopicDraftAttachmentEntity; import com.epmet.modules.topic.entity.TopicDraftAttachmentEntity;
import com.epmet.modules.topic.service.TopicDraftAttachmentService; import com.epmet.modules.topic.service.TopicDraftAttachmentService;
import com.epmet.resi.group.dto.topic.TopicDraftAttachmentDTO; import com.epmet.resi.group.dto.topic.TopicDraftAttachmentDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -96,4 +98,22 @@ public class TopicDraftAttachmentServiceImpl extends BaseServiceImpl<TopicDraftA
baseDao.deleteBatchIds(Arrays.asList(ids)); baseDao.deleteBatchIds(Arrays.asList(ids));
} }
/**
* 获取附件列表
*
* @param topicDraftId
* @param type
* @return java.util.List<java.lang.String>
* @author zhaoqifeng
* @date 2020/12/18 16:42
*/
@Override
public List<String> getFileList(String topicDraftId, String type) {
List<String> list = baseDao.selectFileUrls(topicDraftId, type);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list;
}
} }

99
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftScanTaskServiceImpl.java

@ -0,0 +1,99 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.modules.topic.dao.TopicDraftScanTaskDao;
import com.epmet.modules.topic.entity.TopicDraftScanTaskEntity;
import com.epmet.modules.topic.service.TopicDraftScanTaskService;
import com.epmet.resi.group.dto.topic.TopicDraftScanTaskDTO;
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 2020-12-18
*/
@Service
public class TopicDraftScanTaskServiceImpl extends BaseServiceImpl<TopicDraftScanTaskDao, TopicDraftScanTaskEntity> implements TopicDraftScanTaskService {
@Override
public PageData<TopicDraftScanTaskDTO> page(Map<String, Object> params) {
IPage<TopicDraftScanTaskEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, TopicDraftScanTaskDTO.class);
}
@Override
public List<TopicDraftScanTaskDTO> list(Map<String, Object> params) {
List<TopicDraftScanTaskEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, TopicDraftScanTaskDTO.class);
}
private QueryWrapper<TopicDraftScanTaskEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<TopicDraftScanTaskEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public TopicDraftScanTaskDTO get(String id) {
TopicDraftScanTaskEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, TopicDraftScanTaskDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(TopicDraftScanTaskDTO dto) {
TopicDraftScanTaskEntity entity = ConvertUtils.sourceToTarget(dto, TopicDraftScanTaskEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TopicDraftScanTaskDTO dto) {
TopicDraftScanTaskEntity entity = ConvertUtils.sourceToTarget(dto, TopicDraftScanTaskEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

498
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java

@ -22,27 +22,69 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant; 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.page.PageData; import com.epmet.commons.tools.page.PageData;
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;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.dto.result.AllGridsByUserIdResultDTO; import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.dao.ResiGroupStatisticalDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.entity.ResiGroupStatisticalEntity;
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.topic.dao.ResiTopicAttachmentDao;
import com.epmet.modules.topic.dao.ResiTopicDao;
import com.epmet.modules.topic.dao.ResiTopicOperationDao;
import com.epmet.modules.topic.dao.TopicDraftDao; import com.epmet.modules.topic.dao.TopicDraftDao;
import com.epmet.modules.topic.entity.ResiTopicAttachmentEntity;
import com.epmet.modules.topic.entity.ResiTopicEntity;
import com.epmet.modules.topic.entity.ResiTopicOperationEntity;
import com.epmet.modules.topic.entity.TopicDraftEntity; import com.epmet.modules.topic.entity.TopicDraftEntity;
import com.epmet.modules.topic.service.TopicDraftAttachmentService;
import com.epmet.modules.topic.service.TopicDraftOperationService;
import com.epmet.modules.topic.service.TopicDraftService; import com.epmet.modules.topic.service.TopicDraftService;
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.ResiGroupInfoRedisDTO;
import com.epmet.resi.group.dto.group.ResiGroupStatisticalInfoRedisDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO;
import com.epmet.resi.group.dto.topic.TopicDraftAttachmentDTO;
import com.epmet.resi.group.dto.topic.TopicDraftDTO; import com.epmet.resi.group.dto.topic.TopicDraftDTO;
import com.epmet.resi.group.dto.topic.form.MyAuditingListFormDTO; import com.epmet.resi.group.dto.topic.TopicDraftOperationDTO;
import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO; import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.resi.group.dto.topic.result.TopicAuditResultDTO;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -52,12 +94,54 @@ import java.util.stream.Collectors;
* @since v1.0.0 2020-12-17 * @since v1.0.0 2020-12-17
*/ */
@Service @Service
@Slf4j
public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicDraftEntity> implements TopicDraftService { public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicDraftEntity> implements TopicDraftService {
private static Logger logger = LoggerFactory.getLogger(TopicDraftServiceImpl.class); private static Logger logger = LoggerFactory.getLogger(TopicDraftServiceImpl.class);
@Autowired @Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient; private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private ResiGroupMemberService resiGroupMemberService;
@Autowired
private ResiTopicAttachmentDao resiTopicAttachmentDao;
@Autowired
private ResiTopicOperationDao resiTopicOperationDao;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private ResiGroupDao resiGroupDao;
@Autowired
private ResiGroupMemberDao resiGroupMemberDao;
@Autowired
private ResiGroupStatisticalDao resiGroupStatisticalDao;
@Autowired
private ResiTopicDao resiTopicDao;
@Autowired
private ResiGroupRedis resiGroupRedis;
@Autowired
private TopicDraftAttachmentService topicDraftAttachmentService;
@Autowired
private TopicDraftOperationService topicDraftOperationService;
@Autowired
private ResiGroupMemberRedis resiGroupMemberRedis;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
@Override @Override
public PageData<TopicDraftDTO> page(Map<String, Object> params) { public PageData<TopicDraftDTO> page(Map<String, Object> params) {
IPage<TopicDraftEntity> page = baseDao.selectPage( IPage<TopicDraftEntity> page = baseDao.selectPage(
@ -142,4 +226,414 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
return list; return list;
} }
/**
* 发布话题
*
* @param tokenDto
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/12/17 15:49
*/
@Override
public void createTopic(TokenDto tokenDto, CreateTopicFormDTO formDTO) {
if(StringUtils.isEmpty(formDTO.getTopicContent()) && CollectionUtils.isEmpty(formDTO.getVideoList())) {
//话题内容和语音不能同时为空
log.error(ModuleConstant.TOPIC_CONTENT_AND_VOICE_IS_NULL);
throw new RenException(ModuleConstant.TOPIC_CONTENT_AND_VOICE_IS_NULL);
}
//1.保存话题草稿
if(formDTO.getTopicContent().length() > TopicConstant.MAX_NUMBER_OF_CONTENT){
//内容超过最大限制
log.error(ModuleConstant.TOPIC_CONTENT_NUMBER_OF_WORDS_EXCEEDED);
throw new RenException(ModuleConstant.TOPIC_CONTENT_NUMBER_OF_WORDS_EXCEEDED);
}
TopicDraftEntity topic = ConvertUtils.sourceToTarget(formDTO,TopicDraftEntity.class);
topic.setCreatedBy(tokenDto.getUserId());
topic.setDraftStatus(TopicConstant.AUDITING);
baseDao.insert(topic);
if (StringUtils.isNotEmpty(formDTO.getTopicDraftId())) {
//隐藏旧话题草稿
TopicDraftEntity old = new TopicDraftEntity();
old.setId(formDTO.getTopicDraftId());
old.setIsSee(NumConstant.ONE_STR);
baseDao.updateById(old);
}
if(CollectionUtils.isNotEmpty(formDTO.getImageList())){
TopicDraftAttachmentDTO attachment = new TopicDraftAttachmentDTO();
int sort = 0;
for(String url : formDTO.getImageList()){
attachment.setAttachmentUrl(url);
attachment.setTopicDraftId(topic.getId());
attachment.setCreatedBy(tokenDto.getUserId());
attachment.setAttachmentFormat(url.substring(url.lastIndexOf(".") + NumConstant.ONE).toLowerCase());
attachment.setSort(sort++);
attachment.setAttachmentType("image");
topicDraftAttachmentService.save(attachment);
}
}
if(CollectionUtils.isNotEmpty(formDTO.getVideoList())){
TopicDraftAttachmentDTO attachment = new TopicDraftAttachmentDTO();
int sort = 0;
for(String url : formDTO.getVideoList()){
attachment.setAttachmentUrl(url);
attachment.setTopicDraftId(topic.getId());
attachment.setCreatedBy(tokenDto.getUserId());
attachment.setAttachmentFormat(url.substring(url.lastIndexOf(".") + NumConstant.ONE).toLowerCase());
attachment.setSort(sort++);
attachment.setAttachmentType("image");
topicDraftAttachmentService.save(attachment);
}
}
//话题操作记录
TopicDraftOperationDTO operation = new TopicDraftOperationDTO();
operation.setTopicDraftId(topic.getId());
operation.setOperateType(TopicConstant.SUBMIT);
operation.setCreatedBy(tokenDto.getUserId());
topicDraftOperationService.save(operation);
//2.话题内容审核
String topicContent = formDTO.getTopicContent();
if (StringUtils.isNotBlank(topicContent)) {
//创建话题内容审核
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(topicContent);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
//更新话题状态block
TopicDraftEntity draftEntity = new TopicDraftEntity();
draftEntity.setId(topic.getId());
draftEntity.setDraftStatus(TopicConstant.BLOCK);
draftEntity.setDraftReason("内容审核失败");
baseDao.updateById(draftEntity);
//话题操作记录
TopicDraftOperationDTO operationDTO = new TopicDraftOperationDTO();
operationDTO.setTopicDraftId(topic.getId());
operationDTO.setOperateType(TopicConstant.BLOCK);
operationDTO.setCreatedBy(tokenDto.getUserId());
topicDraftOperationService.save(operationDTO);
log.error(String.format(TopicConstant.CREATE_TOPIC, topicContent));
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
}
//创建话题图片审核
if (CollectionUtils.isNotEmpty(formDTO.getImageList())){
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
formDTO.getImageList().forEach(url -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(url);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
//更新话题状态block
TopicDraftEntity draftEntity = new TopicDraftEntity();
draftEntity.setId(topic.getId());
draftEntity.setDraftStatus(TopicConstant.BLOCK);
draftEntity.setDraftReason("图片审核失败");
baseDao.updateById(draftEntity);
//话题操作记录
TopicDraftOperationDTO operationDTO = new TopicDraftOperationDTO();
operationDTO.setTopicDraftId(topic.getId());
operationDTO.setOperateType(TopicConstant.BLOCK);
operationDTO.setCreatedBy(tokenDto.getUserId());
topicDraftOperationService.save(operationDTO);
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
}
}
}
//TODO 创建话题语音审核
if (CollectionUtils.isNotEmpty(formDTO.getVideoList())){
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
formDTO.getVideoList().forEach(url -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(url);
imgScanParamDTO.getTasks().add(task);
//TODO 根据返回值,
});
} else {
//TODO 话题草稿状态为 auto_passed: 自动通过
//更新话题状态block
TopicDraftEntity draftEntity = new TopicDraftEntity();
draftEntity.setId(topic.getId());
draftEntity.setDraftStatus(TopicConstant.AUTO_PASSED);
baseDao.updateById(draftEntity);
//话题操作记录
TopicDraftOperationDTO operationDTO = new TopicDraftOperationDTO();
operationDTO.setTopicDraftId(topic.getId());
operationDTO.setOperateType(TopicConstant.AUTO_PASSED);
operationDTO.setCreatedBy(tokenDto.getUserId());
topicDraftOperationService.save(operationDTO);
//3.保存话题
saveTopic(tokenDto, formDTO, topic.getId());
}
}
/**
* 组管理界面-待审核/已驳回列表
*
* @param formDTO
* @return java.util.List<com.epmet.resi.group.dto.topic.result.TopicAuditResultDTO>
* @author zhaoqifeng
* @date 2020/12/18 14:34
*/
@Override
public List<TopicAuditResultDTO> auditList(TopicAuditFormDTO formDTO) {
List<TopicAuditResultDTO> result;
if (TopicConstant.REVIEW.equals(formDTO.getStatus())) {
result = baseDao.selectTopicDraftByGroup(formDTO.getGroupId(), formDTO.getStatus());
} else {
result = baseDao.selectTopicDraftByGroup(formDTO.getGroupId(), formDTO.getStatus());
}
result.forEach(item -> {
ResiGroupMemberInfoRedisDTO memberRedis =
resiGroupMemberRedis.get(formDTO.getGroupId(),item.getUserName());
if(null != memberRedis && StringUtils.isNotBlank(memberRedis.getUserId())){
item.setUserName(StringUtils.isBlank(memberRedis.getUserShowName()) ? "" : memberRedis.getUserShowName());
}
});
return result;
}
/**
* 话题草稿详情
*
* @param formDTO
* @return com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO
* @author zhaoqifeng
* @date 2020/12/18 14:55
*/
@Override
public DraftDetailResultDTO detail(DraftDetailFormDTO formDTO) {
TopicDraftEntity entity = baseDao.selectById(formDTO.getTopicDraftId());
if(null == entity){
log.error(ModuleConstant.NO_SUCH_TOPIC);
throw new RenException(ModuleConstant.NO_SUCH_TOPIC);
}
DraftDetailResultDTO result = ConvertUtils.sourceToTarget(entity,DraftDetailResultDTO.class);
result.setTopicDraftId(formDTO.getTopicDraftId());
result.setReleaseTime(new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE).format(entity.getCreatedTime()));
result.setTopicContent(entity.getTopicContent());
result.setReleaseAddress(entity.getAddress());
//2.查询话题图片附件
List<String> imageUrls = topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), TopicConstant.IMAGE);
result.setImageList(imageUrls);
//3.查询话题音频附件
List<String> voiceUrls = topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), TopicConstant.VOICE);
result.setVoiceList(voiceUrls);
//3.拿取用户信息
ResiGroupMemberInfoRedisDTO memberRedis =
resiGroupMemberRedis.get(entity.getGroupId(),entity.getCreatedBy());
if(null != memberRedis && StringUtils.isNotBlank(memberRedis.getUserId())){
result.setReleaseUserName(StringUtils.isBlank(memberRedis.getUserShowName()) ? "" : memberRedis.getUserShowName());
result.setReleaseUserHeadPhoto(StringUtils.isBlank(memberRedis.getUserHeadPhoto()) ? "" : memberRedis.getUserHeadPhoto());
}
return result;
}
/**
* 删除已驳回话题
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/12/18 14:58
*/
@Override
public void deleteDraft(DraftDetailFormDTO formDTO) {
TopicDraftEntity entity = new TopicDraftEntity();
entity.setId(formDTO.getTopicDraftId());
entity.setIsSee(NumConstant.ONE_STR);
baseDao.updateById(entity);
}
/**
* 组长审核
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/12/18 15:06
*/
@Override
public void audit(AuditDraftTopicFormDTO formDTO) {
}
/**
* 保存话题
* @author zhaoqifeng
* @date 2020/12/18 10:38
* @param tokenDto
* @param formDTO
* @return void
*/
private void saveTopic(TokenDto tokenDto, CreateTopicFormDTO formDTO, String draftId) {
//1.身份校验,查看当前用户是否是组内成员,当前用户是否被禁言
ResiGroupMemberDTO resiGroupMemberDTO =
resiGroupMemberService.getResiGroupMember(formDTO.getGroupId(),tokenDto.getUserId() );
Result result = verifySilentOrRemoved(resiGroupMemberDTO);
if(!result.success()){
throw new RenException(result.getCode(), result.getMsg());
}
Date currentTime = new Date();
//2.创建话题
ResiTopicEntity topic = ConvertUtils.sourceToTarget(formDTO,ResiTopicEntity.class);
topic.setCreatedBy(tokenDto.getUserId());
topic.setStatus(TopicConstant.PUBLISHMENT);
resiTopicDao.insertOne(topic);
if(StringUtils.isBlank(topic.getId())){
//没有返回主键
log.error(ModuleConstant.NO_PRIMARY_KEY_RETURNED);
throw new RenException(ModuleConstant.NO_PRIMARY_KEY_RETURNED);
}
if(CollectionUtils.isNotEmpty(formDTO.getImageList())){
ResiTopicAttachmentEntity attachment = new ResiTopicAttachmentEntity();
int sort = 0;
for(String url : formDTO.getImageList()){
attachment.setAttachmentUrl(url);
attachment.setTopicId(topic.getId());
attachment.setCreatedBy(tokenDto.getUserId());
attachment.setAttachmentFormat(url.substring(url.lastIndexOf(".") + NumConstant.ONE).toLowerCase());
attachment.setSort(sort++);
attachment.setAttachmentType("image");
resiTopicAttachmentDao.insertOne(attachment);
}
}
//3.话题操作记录
ResiTopicOperationEntity operation = new ResiTopicOperationEntity();
operation.setTopicId(topic.getId());
operation.setOperationType(TopicConstant.PUBLISHMENT);
operation.setCreatedBy(tokenDto.getUserId());
resiTopicOperationDao.insertOne(operation);
//4.小组统计信息,话题数+1
QueryWrapper<ResiGroupStatisticalEntity> wrapper = new QueryWrapper<>();
wrapper.eq(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR);
wrapper.eq(TopicConstant.RESI_GROUP_ID,formDTO.getGroupId());
List<ResiGroupStatisticalEntity> statistical = resiGroupStatisticalDao.selectList(wrapper);
if(null != statistical && statistical.size() >= NumConstant.ONE){
if(statistical.size() != NumConstant.ONE){
log.error(ModuleConstant.GROUP_STASTICAL_NOT_SINGLE);
throw new RenException(ModuleConstant.GROUP_STASTICAL_NOT_SINGLE);
}else{
ResiGroupStatisticalEntity statistical2Update = new ResiGroupStatisticalEntity();
statistical2Update.setId(statistical.get(NumConstant.ZERO).getId());
statistical2Update.setTotalTopics(null == statistical.get(NumConstant.ZERO).getTotalTopics() ? NumConstant.ONE : statistical.get(NumConstant.ZERO).getTotalTopics() + NumConstant.ONE);
statistical2Update.setUpdatedBy(tokenDto.getUserId());
statistical2Update.setUpdatedTime(currentTime);
resiGroupStatisticalDao.updateById(statistical2Update);
}
}else{
log.error(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO);
throw new RenException(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO);
}
//5.更新群缓存信息,话题数量+1
updCacheGroupStatisticalInfo(formDTO.getGroupId(),ModuleConstant.PLUS_OPERATION,NumConstant.ONE);
//6.群组信息,更新latestTopicPublishDate字段
ResiGroupEntity group2Update = new ResiGroupEntity();
group2Update.setId(formDTO.getGroupId());
group2Update.setLatestTopicPublishDate(currentTime);
resiGroupDao.updateById(group2Update);
TopicDraftEntity draftEntity = new TopicDraftEntity();
draftEntity.setId(draftId);
draftEntity.setTopicId(topic.getId());
baseDao.updateById(draftEntity);
}
/**
* 查询当前组员在组内是否被禁言或已被移除
* @Param resiGroupMemberDTO
* @return Result.class
* @Author zhaoqf
* @Date 2020.04.01 15:00
**/
private Result verifySilentOrRemoved(ResiGroupMemberDTO resiGroupMemberDTO){
if(null != resiGroupMemberDTO){
if(MemberStateConstant.SILENT.equals(resiGroupMemberDTO.getStatus())){
//当前用户被禁言
log.error(ModuleConstant.SLIENT_MEMBER);
throw new RenException(ModuleConstant.SLIENT_MEMBER);
}else if(MemberStateConstant.REMOVED.equals(resiGroupMemberDTO.getStatus())){
//当前用户已被移出群
log.error(ModuleConstant.REMOVED_MEMBER);
throw new RenException(ModuleConstant.REMOVED_MEMBER);
}else{
return new Result();
}
}else{
//当前用户非组内成员
log.error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
throw new RenException(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
}
}
/**
* 更新组统计缓存信息
* @Param groupId
* @Param operation "+":plus "-":minus
* @return
* @Author zhaoqf
* @Date 2020.04.14 23:31
**/
private void updCacheGroupStatisticalInfo(String groupId,String operation,Integer quantity){
//ResiGroupRedis在get()时已经校验缓存中是否有数据,如果没有数据则从数据库中拉取并重新放入缓存
ResiGroupInfoRedisDTO groupCache =
resiGroupRedis.get(groupId);
if(groupCache != null && StringUtils.isNotBlank(groupCache.getGroupId())){
ResiGroupStatisticalInfoRedisDTO statisticalCache = groupCache.getGroupStatisticalInfo();
if(null != statisticalCache){
if(StringUtils.equals(ModuleConstant.PLUS_OPERATION,operation)){
statisticalCache.setTotalTopics(
null == statisticalCache.getTotalTopics() ? quantity : statisticalCache.getTotalTopics() + quantity
);
}else if(StringUtils.equals(ModuleConstant.MINUS_OPERATION,operation)){
statisticalCache.setTotalTopics(
null == statisticalCache.getTotalTopics() ? quantity : statisticalCache.getTotalTopics() - quantity
);
}
groupCache.setGroupStatisticalInfo(statisticalCache);
}else{
//没有相应的群组统计缓存信息
}
resiGroupRedis.set(groupCache);
}else{
//没有相应的群组缓存信息
}
}
} }

2
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java

@ -368,4 +368,6 @@ public interface ModuleConstant extends Constant {
* 群邀请二维码跳转页面 * 群邀请二维码跳转页面
*/ */
String CODE_INVITE_PAGE = "pages/group/group/invitation/invitation"; String CODE_INVITE_PAGE = "pages/group/group/invitation/invitation";
String TOPIC_CONTENT_AND_VOICE_IS_NULL = "请输入话题内容或语音";
} }

2
epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml

@ -126,6 +126,8 @@ openapi:
method: method:
imgSyncScan: /imgSyncScan imgSyncScan: /imgSyncScan
textSyncScan: /textSyncScan textSyncScan: /textSyncScan
voiceAsyncScan: /voiceAsyncScan
voiceResults: /voiceResults
thread: thread:
# 线程池配置 # 线程池配置

8
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftAttachmentDao.xml

@ -4,5 +4,11 @@
<mapper namespace="com.epmet.modules.topic.dao.TopicDraftAttachmentDao"> <mapper namespace="com.epmet.modules.topic.dao.TopicDraftAttachmentDao">
<select id="selectFileUrls" resultType="java.lang.String">
SELECT ATTACHMENT_URL FROM topic_draft_attachment
WHERE DEL_FLAG = '0'
AND TOPIC_DRAFT_ID = #{topicDraftId}
AND ATTACHMENT_TYPE = #{type}
ORDER BY SORT
</select>
</mapper> </mapper>

20
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftDao.xml

@ -25,4 +25,24 @@
LIMIT #{pageNo}, #{pageSize} LIMIT #{pageNo}, #{pageSize}
</select> </select>
<select id="selectTopicDraftByGroup" resultType="com.epmet.resi.group.dto.topic.result.TopicAuditResultDTO">
SELECT ID AS topicDraftId,
TOPIC_CONTENT AS topicContent,
CREATED_BY AS userName,
UNIX_TIMESTAMP(CREATED_TIME) AS releaseTime
FROM
topic_draft
WHERE
1=1
AND GROUP_ID = #{groupId}
<if test="status == 'review'">
AND DRAFT_STATUS = 'review'
</if>
<if test="status == 'rejected'">
AND (DRAFT_STATUS = 'block' OR DRAFT_STATUS = 'rejected')
</if>
</select>
<select id="selectTopicDraftDetail" resultType="com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO">
</select>
</mapper> </mapper>

23
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftScanTaskDao.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.modules.topic.dao.TopicDraftScanTaskDao">
<resultMap type="com.epmet.modules.topic.entity.TopicDraftScanTaskEntity" id="topicDraftScanTaskMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="topicDraftId" column="TOPIC_DRAFT_ID"/>
<result property="topicDraftAttachmentId" column="TOPIC_DRAFT_ATTACHMENT_ID"/>
<result property="taskId" column="TASK_ID"/>
<result property="status" column="STATUS"/>
<result property="attachmentType" column="ATTACHMENT_TYPE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>
Loading…
Cancel
Save