diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java index ec14e7c812..6f371a1e09 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java @@ -3,6 +3,7 @@ package com.epmet.commons.tools.dto.form.mq.eventmsg; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** * desc:积分相关事件消息体 @@ -57,4 +58,15 @@ public class BasePointEventMsg implements Serializable { * 业务id eg:活动id */ private String sourceId; -} + + /** + * 计算积分上限时的计算日期,可以为空 + * 场景: 通过分享链接申请入组,在组长审核完成后要给邀请人添加积分,若被邀请人是已注册居民, + * 给邀请人添加积分有上限,计算上限的日期不能是组长审核的日期,而是被邀请人发送入组审核的日期 + * 对应的事件编码为:invite_resident_into_group + * 只针对[邀请已注册的用户入组]事件生效 + */ + private Date targetDate; + + private String eventTag; + } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java index 68347c29f9..c1409342d6 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java @@ -10,6 +10,13 @@ public enum EventEnum { ACTIVE_SEND_POINT("active_send_point", "epmet_heart", "活动发放积分"), REGISTER_VOLUNTEER("register_volunteer", "epmet_heart", "认证志愿者"), ACTIVE_INSERT_LIVE("active_insert_live", "epmet_heart", "添加活动实况"), + INVITE_NEW_RESIDENT_INTO_GROUP("invite_new_into_group","resi_group","拉新用户入组"), + INVITE_RESIDENT_INTO_GROUP("invite_resi_into_group","resi_group","邀请已注册的用户入组"), + PUBLISH_ONE_TOPIC("publish_one_topic","resi_group","发布话题"), + PARTICIPATE_ONE_TOPIC("participate_one_topic","resi_group","对小组内话题进行15字以上评论"), + TOPIC_SHIFTED_TO_ISSUE("topic_to_issue","resi_group","话题被转为议题(小组中发布的话题被组长转为议题)"), + SHIFT_TOPIC_TO_ISSUE("shift_topic_to_issue","resi_group","转话题为议题(将自建小组中话题转为议题)"), + TOPIC_SHIFTED_TO_PROJECT("topic_to_project","resi_group","话题被转为项目"), ; private String eventClass; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java index de481f10fd..2fcabf5d57 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java @@ -50,6 +50,10 @@ public class RedisUtils { * 过期时长为1小时,单位:秒 */ public final static long HOUR_ONE_EXPIRE = 60 * 60 * 1L; + /** + * 过期时长为4小时,单位:秒 + */ + public final static long HOUR_FOUR_EXPIRE = 60 * 60 * 4L; /** * 过期时长为6小时,单位:秒 */ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VoiceScanParamDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VoiceScanParamDTO.java new file mode 100644 index 0000000000..e315848ec1 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VoiceScanParamDTO.java @@ -0,0 +1,35 @@ +package com.epmet.commons.tools.scan.param; + +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + * 语音检测入参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/18 10:15 + */ +@Data +public class VoiceScanParamDTO implements Serializable { + + /** + * 是否开启回调 + */ + @NotNull(message = "openCallBack必填,true开启;false不开启") + private Boolean openCallBack; + + /** + * 异步检测结果回调地址,执行异步审查内容时 必填 + * openCallBack=true时,callback必填 + */ + private String callback; + + @Valid + @NotEmpty(message = "任务列表不能为空") + private List tasks; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VoiceTaskDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VoiceTaskDTO.java new file mode 100644 index 0000000000..a0abe2303a --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VoiceTaskDTO.java @@ -0,0 +1,31 @@ +package com.epmet.commons.tools.scan.param; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 语音异步检测对象 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/18 10:21 + */ +@Data +public class VoiceTaskDTO implements Serializable { + /** + * 不必填 + * 要检测的数据id 非必填 + * 检测对象对应的数据ID。 + * 由大小写英文字母、数字、下划线(_)、短划线(-)、英文句号(.)组成,不超过128个字符,可以用于唯一标识您的业务数据。 + * */ + @NotBlank(message = "dataId不能为空") + private String dataId; + + /** + * 必填 + * 需要检测的音频文件或语音流的下载地址。 + */ + @NotBlank(message = "音频URL不能为空") + private String url; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanResult.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanResult.java new file mode 100644 index 0000000000..77cabbfed7 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanResult.java @@ -0,0 +1,49 @@ +package com.epmet.commons.tools.scan.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 语音异步检测 返参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/18 10:09 + */ +@Data +public class AsyncScanResult implements Serializable { + private static final long serialVersionUID = -939433332419948118L; + + /** + * 随机字符串,该值用于回调通知请求中的签名。 + */ + private String seed; + + /** + * 提交成功的失败对象 + */ + private List successTasks=new ArrayList<>(); + + /** + * 提交失败的检测对象 + */ + private List failTasks=new ArrayList<>(); + + /** + * 是否全部提交成功 + */ + private boolean isAllSuccess; + + public boolean isAllSuccess() { + if (failTasks.isEmpty() && !successTasks.isEmpty()) { + return true; + } + return isAllSuccess; + } + + public void setAllSuccess(boolean allSuccess) { + isAllSuccess = allSuccess; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanTaskDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanTaskDTO.java new file mode 100644 index 0000000000..e09ed9ae5d --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanTaskDTO.java @@ -0,0 +1,25 @@ +package com.epmet.commons.tools.scan.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 语音异步检测 -返回的task集合 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/18 10:31 + */ +@Data +public class AsyncScanTaskDTO implements Serializable { + /** + * 检测对象对应的数据ID。 + * 由大小写英文字母、数字、下划线(_)、短划线(-)、英文句号(.)组成,不超过128个字符,可以用于唯一标识您的业务数据。 + */ + private String dataId; + + /** + * 任务id + */ + private String taskId; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VoiceResultDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VoiceResultDTO.java new file mode 100644 index 0000000000..a826f5b66d --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VoiceResultDTO.java @@ -0,0 +1,56 @@ +package com.epmet.commons.tools.scan.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 检测成功(检测成功+检测失败的)的任务详情 + * 处理中的该接口不返回,继续轮询即可 + * @author yinzuomei@elink-cn.com + * @date 2020/12/18 13:10 + */ +@Data +public class VoiceResultDTO implements Serializable { + private static final long serialVersionUID = 8006827312407034344L; + /** + * 检测对象对应的数据ID。 + */ + private String dataId; + + /** + * 检测任务的ID + */ + private String taskId; + + /** + * 建议您执行的后续操作。取值: + * pass:结果正常,无需进行其余操作。 + * review:结果不确定,需要进行人工审核。 + * block:结果违规,建议直接删除或者限制公开。 + */ + private String suggestion; + + /** + * 检测结果的分类。取值: + * normal:正常文本 + * spam:含垃圾信息 + * ad:广告 + * politics:涉政 + * terrorism:暴恐 + * abuse:辱骂 + * porn:色情 + * flood:灌水 + * contraband:违禁 + * meaningless:无意义 + * customized:自定义(例如命中自定义关键词) + */ + private String label; + + /** + * labelDesc是对label的说明,包含两种特殊说明: + * (1)如果检测任务失败labelDesc:智能检测任务失败,结果已失效,需要人工审核 + * (2)如果检测结果失效labelDesc:智能检测任务失败,需要人工审核 + */ + private String labelDesc; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java index ef7a3257a6..effd25ccd6 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java @@ -2,14 +2,16 @@ package com.epmet.commons.tools.utils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; +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.TextScanParamDTO; -import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.param.*; +import com.epmet.commons.tools.scan.result.AsyncScanResult; import com.epmet.commons.tools.scan.result.SyncScanResult; +import com.epmet.commons.tools.scan.result.VoiceResultDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; @@ -75,7 +77,76 @@ public class ScanContentUtils { } } + /** + * desc:语音异步检测任务提交 + * + * @return 返回检测对象对应的任务id + */ + public static Result voiceAsyncScan(String url, VoiceScanParamDTO param){ + log.debug("voiceAsyncScan param:{}", JSON.toJSONString(param)); + if (StringUtils.isBlank(url) || param == null) { + throw new RenException("参数错误"); + } + if (param.getOpenCallBack() && StringUtils.isBlank(param.getCallback())) { + throw new RenException("参数错误,开启回调,callback必填"); + } + try { + Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param)); + log.debug("voiceAsyncScan result:{}", JSON.toJSONString(result)); + if (result.success()) { + return JSON.parseObject(result.getData(),new TypeReference>(){}); + } + Result resultResult = new Result<>(); + resultResult.error(result.getCode(),result.getMsg()); + resultResult.setInternalMsg(result.getInternalMsg()); + return resultResult; + } catch (Exception e) { + log.error("voiceAsyncScan exception:", e); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + } + } + + /** + * desc:语音异步检测结果查询 + * + * @param taskIds 数组中的元素个数不超过100个。 + * @return 注意该接口只返回检测任务完成的(即检测成功或失败的);任务正在处理中的不返回,继续轮询即可。 + */ + public static Result> voiceResults(String url, List taskIds) { + if (StringUtils.isBlank(url) || CollectionUtils.isEmpty(taskIds)) { + throw new RenException("参数错误"); + } + if (taskIds.size() > NumConstant.ONE_HUNDRED) { + throw new RenException("参数错误,查询检测任务最大不能超过100"); + } + try { + Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(taskIds)); + log.debug("voiceResults result:{}", JSON.toJSONString(result)); + if (result.success()) { + return JSON.parseObject(result.getData(), new TypeReference>>() { + }); + } + Result> resultResult = new Result<>(); + resultResult.error(result.getCode(), result.getMsg()); + resultResult.setInternalMsg(result.getInternalMsg()); + return resultResult; + } catch (Exception e) { + log.error("voiceResults exception:", e); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + } + } + + public static void main(String[] args) { + //测试文本检测 + // testTextSyncScan(); + //测试语音检测 + // testVoiceAsyncScan(); + //语音检测结果 + testVoiceResults(); + } + + public static void testTextSyncScan(){ String url = "http://localhost:8107/epmetscan/api/textSyncScan"; TextTaskDTO p = new TextTaskDTO(); p.setDataId("1"); @@ -95,6 +166,38 @@ public class ScanContentUtils { result.getFailDataIds().addAll(imgSyncScanResultData.getFailDataIds()); System.out.println("================"+JSON.toJSONString(result)); } + } + } + + public static void testVoiceAsyncScan(){ + String url = "http://localhost:8107/epmetscan/api/voiceAsyncScan"; + VoiceTaskDTO p = new VoiceTaskDTO(); + p.setDataId("1"); + p.setUrl("https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20201208/6480bd6be9f14a458162218cea84dfa5.aac"); + List list = new ArrayList<>(); + list.add(p); + VoiceScanParamDTO param = new VoiceScanParamDTO(); + param.setTasks(list); + param.setOpenCallBack(false); + Result asyncScanResultResult = ScanContentUtils.voiceAsyncScan(url, param); + System.out.println(JSON.toJSONString(asyncScanResultResult)); + AsyncScanResult result = new AsyncScanResult(); + if (asyncScanResultResult != null) { + AsyncScanResult asyncScanResult = asyncScanResultResult.getData(); + if (asyncScanResultResult.success()) { + result.setAllSuccess(asyncScanResult.isAllSuccess()); + result.getSuccessTasks().addAll(asyncScanResult.getSuccessTasks()); + result.getFailTasks().addAll(asyncScanResult.getFailTasks()); + System.out.println("================" + JSON.toJSONString(result)); } } + } + + public static void testVoiceResults(){ + String url = "http://localhost:8107/epmetscan/api/voiceResults"; + List taskIds=new ArrayList<>(); + taskIds.add("vc_f_6CXRk1VcAwM6u0FMA@CfoW-1tDgIp"); + Result> asyncScanResultResult = ScanContentUtils.voiceResults(url, taskIds); + System.out.println("================" + JSON.toJSONString(asyncScanResultResult)); + } } diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 53ec286911..25155b37ea 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -442,6 +442,7 @@ epmet: # 内部认证url白名单(在白名单中的,就不会再校验登录了) internalAuthUrlsWhiteList: - /epmetuser/customerstaff/customerlist + - /resi/group/topic/callBackPublishTopic # 外部应用认证,使用AccessToken等头进行认证 externalOpenUrls: diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 4773af928c..542d4a8281 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -305,4 +305,21 @@ public class OssController { return ossService.uploadVariedFile(file); } + /** + * @param file + * @Description 上传语音文件 + * @Author sun + **/ + @PostMapping("uploadvoice") + public Result uploadVoice(@RequestParam("file") MultipartFile file) { + // 校验文件体积,不超过20M + long maxSize = 20 * 1024 * 1024; + long size = file.getSize(); + if (size > maxSize) { + throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode(), + EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg()); + } + return ossService.uploadVoice(file); + } + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java index c9abc33326..e0952420df 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java @@ -33,4 +33,6 @@ public interface OssService extends BaseService { Result extUpload(MultipartFile file, String fileName); Result uploadVariedFile(MultipartFile file); + + Result uploadVoice(MultipartFile file); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java index 5b657665d5..e98b9d7b88 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java @@ -130,4 +130,36 @@ public class OssServiceImpl extends BaseServiceImpl implement return new Result().ok(dto); } + + /** + * @param file + * @Description 上传语音 + * @Author sun + **/ + @Override + public Result uploadVoice(MultipartFile file) { + if (file.isEmpty()) { + return new Result().error(ModuleErrorCode.UPLOAD_FILE_EMPTY); + } + //上传文件 + String extension = FilenameUtils.getExtension(file.getOriginalFilename()); + String url = null; + try { + url = OssFactory.build().uploadSuffix(file.getBytes(), extension); + } catch (IOException e) { + e.printStackTrace(); + logger.error("语音上传异常"); + throw new RenException("语音上传异常"); + + } + //保存文件信息 + OssEntity ossEntity = new OssEntity(); + ossEntity.setUrl(url); + baseDao.insert(ossEntity); + //文件信息 + UploadImgResultDTO dto = new UploadImgResultDTO(); + dto.setUrl(url); + return new Result().ok(dto); + } + } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java index df85fc7a91..ed6f5c05e6 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java @@ -117,5 +117,35 @@ public class MqPointCallbackController { log.info("pubActiveLive consumer success,formDTO:{}", JSON.toJSONString(formList)); return new Result().ok(true); } + + /** + * @Description 楼院小组积分事件统一回调入口 + * @param mqMsg + * @return com.epmet.commons.tools.utils.Result + * @author wangc + * @date 2020.12.23 09:33 + */ + @RequestMapping("resigrouppointcallback") + public Result resiGroupPointCallback(@RequestBody ReceiveMqMsg mqMsg){ + log.debug("resi_group point event callback receive mqMsg:{}", JSON.toJSONString(mqMsg)); + if (mqMsg == null || StringUtils.isBlank(mqMsg.getMsg())) { + log.warn("resi_group point event mqMsg is empty"); + return new Result().ok(true); + } + List formList = JSON.parseArray(mqMsg.getMsg(), BasePointEventMsg.class); + + try { + + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(obj.getEventTag(),obj); + }); + + } catch (Exception e) { + logger.error("resi_group point event callback fail", e); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); + } + log.info("resi_group point event callback success,formDTO:{}", JSON.toJSONString(formList)); + return new Result().ok(true); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java index 42d7cb404b..40c3277d6d 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java @@ -52,5 +52,5 @@ public interface UserPointActionLogDao extends BaseDao * @author wangc * @date 2020.07.31 15:11 **/ - Integer selectSumByEvent(@Param("userId") String userId, @Param("eventId") String eventId, @Param("sourceId") String sourceId, @Param("customerId") String customerId, @Param("dateCheck") Date dateCheck); + Integer selectSumByEvent(@Param("userId") String userId, @Param("eventId") String eventId, @Param("sourceId") String sourceId, @Param("customerId") String customerId, @Param("dateCheck") Date dateCheck,@Param("right")Date right); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java index 543fd72ad3..3fce5f3edd 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java @@ -189,8 +189,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl【%s】", JSON.toJSON(event))); throw new RenException("无法识别事件类型与积分规则"); } @@ -198,10 +197,13 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl NumConstant.ZERO){ //不按照sourceId查询,查询指定日期内的相关积分规则的总和 - Integer sum = baseDao.selectSumByEvent(event.getUserId(),eventCode,null,event.getCustomerId(),dateCheck); + Integer sum = baseDao.selectSumByEvent(event.getUserId(),eventCode,null,event.getCustomerId(),dateCheck,right); if(null == sum) sum = NumConstant.ZERO; if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_PLUS,ruleInfo.getOperateType())){ if(ruleInfo.getPoint() < NumConstant.ZERO){ @@ -270,7 +281,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl【%s】", JSON.toJSON(event))); + log.warn(String.format("该用户获取此类事件的积分已达上限,详细数据->【%s】", JSON.toJSON(event))); return ; } } @@ -290,7 +301,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl AND CREATED_TIME = ]]> #{dateCheck} - + + AND CREATED_TIME #{right} + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/constant/IssueShareConstant.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/constant/IssueShareConstant.java new file mode 100644 index 0000000000..620411cafd --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/constant/IssueShareConstant.java @@ -0,0 +1,17 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2020/12/18 下午1:59 + */ +public interface IssueShareConstant { + + String NOT_EXIST_ISSUE_INFO = "未查询到此议题相关信息"; + + String TOPIC_BELONG_GROUP_FAILURE = "查询话题所属小组失败......"; + + String TOPIC_BELONG_GROUP_NULL = "查询话题所属小组为空......"; + + String NOT_EXIST_INVITE_ISSUE_RECORD = "未查询到该邀请记录【议题】......"; + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueShareLinkRecordDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueShareLinkRecordDTO.java new file mode 100644 index 0000000000..a6d4a20ec2 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueShareLinkRecordDTO.java @@ -0,0 +1,97 @@ +/** + * 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.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 议题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Data +public class IssueShareLinkRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 议题所属网格ID + */ + private String gridId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 分享人(当前用户id) + */ + private String shareUserId; + + /** + * 邀请内容 + */ + private String inviteContent; + + /** + * 删除状态 0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueShareLinkVisitRecordDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueShareLinkVisitRecordDTO.java new file mode 100644 index 0000000000..3ed4db4260 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueShareLinkVisitRecordDTO.java @@ -0,0 +1,101 @@ +/** + * 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.dto; + +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 IssueShareLinkVisitRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 分享人【邀请人】ID + */ + private String shareUserId; + + /** + * 被邀请人ID + */ + private String inviteeUserId; + + /** + * 议题分享链接表.id + */ + private String shareLinkRecId; + + /** + * 是否邀请注册:0:是,1:不是 + */ + private Integer isInviteRegister; + + /** + * 是否同意进组,1是0否,在注册完居民之后,是否同意入组,如果同意发送入组申请,不同意此项默认为0 + */ + private Boolean ifJoinGroup; + + /** + * 删除状态,0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCreateUrlFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCreateUrlFormDTO.java new file mode 100644 index 0000000000..5bc984ee80 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCreateUrlFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/18 下午1:23 + */ +@Data +public class IssueCreateUrlFormDTO implements Serializable { + + private static final long serialVersionUID = -7269328640568283013L; + + public interface IssueCreateUrlForm{} + + @NotBlank(message = "议题ID不能为空",groups = {IssueCreateUrlForm.class}) + private String issueId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueVisitFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueVisitFormDTO.java new file mode 100644 index 0000000000..853d3b5b03 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueVisitFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/18 下午3:12 + */ +@Data +public class IssueVisitFormDTO implements Serializable { + + private static final long serialVersionUID = -7901684507046042401L; + + public interface IssueVisitForm{} + + /** + * 分享ID + */ + @NotBlank(message = "分享ID不能为空",groups = {IssueVisitForm.class}) + private String shareLinkId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SharableIssueAndInviteeFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SharableIssueAndInviteeFormDTO.java new file mode 100644 index 0000000000..9b1180cd61 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SharableIssueAndInviteeFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 议题分享链接和被邀请人传参DTO + * @ClassName SharableIssueAndInviteeFormDTO + * @Auth wangc + * @Date 2020-12-18 15:10 + */ +@Data +public class SharableIssueAndInviteeFormDTO implements Serializable { + private static final long serialVersionUID = -2777459178190245842L; + + /** + * 议题分享链接 + */ + @NotBlank(message = "分享链接不能为空") + private String shareLinkId; + + /** + * 通过链接进入议题页面用户的Id + */ + @NotBlank(message = "用户Id不能为空") + private String inviteeId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCreateUrlResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCreateUrlResultDTO.java new file mode 100644 index 0000000000..450f0cec5b --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCreateUrlResultDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/18 下午1:30 + */ +@Data +@AllArgsConstructor +public class IssueCreateUrlResultDTO implements Serializable { + + private static final long serialVersionUID = 552194128388715353L; + + /** + * 议题分享链接ID + */ + private String shareLinkId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueVisitResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueVisitResultDTO.java new file mode 100644 index 0000000000..864a155d11 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueVisitResultDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/18 下午5:13 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class IssueVisitResultDTO implements Serializable { + + private static final long serialVersionUID = -5079228371448105954L; + + /** + * 议题ID + */ + private String issueId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 客户ID + */ + private String customerId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java index 283207c1b5..c8e1118b77 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IssueApplicationDTO; import com.epmet.dto.IssueDTO; import com.epmet.dto.IssueSuggestionDTO; +import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.fallback.GovIssueOpenFeignClientFallBack; @@ -234,4 +235,38 @@ public interface GovIssueOpenFeignClient { @PostMapping("/gov/issue/issueprojecttagdict/updatecitations") Result updateCitations(@RequestBody TagDifferentSetFormDTO param); + + /** + * @Description 检查邀请关系,如果确实存在邀请关系则返回邀请人Id + * 符合条件: + * ① 链接Id对应 + * ② 邀请人Id对应 + * ③ 邀请人在被邀请时的状态为陌生人 + * @param param + * @return com.epmet.commons.tools.utils.Result + * @author wangc + * @date 2020.12.18 14:53 + */ + @PostMapping("/gov/issue/issuesharelinkvisitrecord/checkinviterelationship") + Result checkInviteRelationship(@RequestBody SharableIssueAndInviteeFormDTO param); + + /** + * @Description 通过链接Id查询分享人和被邀请人的信息 + * @param + * @return + * @author wangc + * @date 2020.12.21 16:27 + */ + @PostMapping("/gov/issue/issuesharelinkvisitrecord/visitrecord") + Result visitRecord(@RequestParam("linkId")String linkId,@RequestParam("invitee")String invitee); + + /** + * @Description 根据议题分享链接Id查询链接详情 + * @param shareLinkId + * @return com.epmet.commons.tools.utils.Result + * @author wangc + * @date 2020.12.22 10:53 + */ + @PostMapping("/gov/issue/issuesharelink/sharelinkinfo") + Result shareLinkInfo(@RequestParam String shareLinkId); } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java index 3eacd247d8..2a00463fa8 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IssueApplicationDTO; import com.epmet.dto.IssueDTO; import com.epmet.dto.IssueSuggestionDTO; +import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.GovIssueOpenFeignClient; @@ -20,6 +21,7 @@ import com.epmet.resi.group.dto.group.result.*; import com.epmet.resi.mine.dto.from.MyShiftIssueTopicsFormDTO; import com.epmet.resi.mine.dto.result.MyShiftIssueTopicsResultDTO; import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; import java.util.Map; @@ -216,4 +218,19 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient public Result updateCitations(TagDifferentSetFormDTO param) { return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "updateCitations", param); } + + @Override + public Result checkInviteRelationship(SharableIssueAndInviteeFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "checkInviteRelationship", param); + } + + @Override + public Result visitRecord(String linkId,String invitee) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "visitRecord", linkId,invitee); + } + + @Override + public Result shareLinkInfo(String shareLinkId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "shareLinkInfo", shareLinkId); + } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueShareLinkRecordController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueShareLinkRecordController.java new file mode 100644 index 0000000000..180c745b20 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueShareLinkRecordController.java @@ -0,0 +1,128 @@ +/** + * 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.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +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.dto.IssueShareLinkRecordDTO; +import com.epmet.dto.form.IssueCreateUrlFormDTO; +import com.epmet.dto.form.IssueVisitFormDTO; +import com.epmet.dto.result.IssueCreateUrlResultDTO; +import com.epmet.dto.result.IssueVisitResultDTO; +import com.epmet.service.IssueShareLinkRecordService; +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 2020-12-18 + */ +@RestController +@RequestMapping("issuesharelink") +public class IssueShareLinkRecordController { + + @Autowired + private IssueShareLinkRecordService issueShareLinkRecordService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = issueShareLinkRecordService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + IssueShareLinkRecordDTO data = issueShareLinkRecordService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IssueShareLinkRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + issueShareLinkRecordService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IssueShareLinkRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + issueShareLinkRecordService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + issueShareLinkRecordService.delete(ids); + return new Result(); + } + + /** + * @Description 议题分享链接ID + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2020/12/18 下午1:36 + */ + @PostMapping("createurl") + public Result getIssueShareLinkId(@RequestBody IssueCreateUrlFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, IssueCreateUrlFormDTO.IssueCreateUrlForm.class); + return new Result().ok(issueShareLinkRecordService.getIssueShareLinkId(formDTO,tokenDto)); + } + + /** + * @Description 分享议题id获取信息 + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2020/12/18 下午5:22 + */ + @PostMapping("visit") + public Result issueVisit(@RequestBody IssueVisitFormDTO formDTO,@LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, IssueVisitFormDTO.IssueVisitForm.class); + return new Result().ok(issueShareLinkRecordService.issueVisit(formDTO,tokenDto)); + } + + /** + * @Description 根据议题分享链接Id查询链接详情 + * @param shareLinkId + * @return com.epmet.commons.tools.utils.Result + * @author wangc + * @date 2020.12.22 10:53 + */ + @PostMapping("sharelinkinfo") + public Result shareLinkInfo(@RequestParam String shareLinkId){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueShareLinkVisitRecordController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueShareLinkVisitRecordController.java new file mode 100644 index 0000000000..64f90774fb --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueShareLinkVisitRecordController.java @@ -0,0 +1,98 @@ +package com.epmet.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.dto.IssueShareLinkVisitRecordDTO; +import com.epmet.dto.form.SharableIssueAndInviteeFormDTO; +import com.epmet.service.IssueShareLinkVisitRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + + +/** + * 议题分享链接访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@RestController +@RequestMapping("issuesharelinkvisitrecord") +public class IssueShareLinkVisitRecordController { + + @Autowired + private IssueShareLinkVisitRecordService issueShareLinkVisitRecordService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = issueShareLinkVisitRecordService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + IssueShareLinkVisitRecordDTO data = issueShareLinkVisitRecordService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IssueShareLinkVisitRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + issueShareLinkVisitRecordService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IssueShareLinkVisitRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + issueShareLinkVisitRecordService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + issueShareLinkVisitRecordService.delete(ids); + return new Result(); + } + + + /** + * @Description 检查邀请关系,如果确实存在邀请关系则返回邀请人Id + * 符合条件: + * ① 链接Id对应 + * ② 邀请人Id对应 + * ③ 邀请人在被邀请时的状态为陌生人 + * @param param + * @return com.epmet.commons.tools.utils.Result + * @author wangc + * @date 2020.12.18 14:53 + */ + @PostMapping("checkinviterelationship") + public Result checkInviteRelationship(@RequestBody SharableIssueAndInviteeFormDTO param){ + ValidatorUtils.validateEntity(param); + return new Result().ok(issueShareLinkVisitRecordService.checkInviteRelationship(param)); + } + + /** + * @Description 通过链接Id查询分享人和被邀请人的信息 + * @param + * @return + * @author wangc + * @date 2020.12.21 16:27 + */ + @PostMapping("visitrecord") + public Result visitRecord(@RequestParam("linkId")String linkId,@RequestParam("invitee")String invitee){ + return new Result().ok(issueShareLinkVisitRecordService.getVisitRecord(linkId,invitee)); + } +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueShareLinkRecordDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueShareLinkRecordDao.java new file mode 100644 index 0000000000..94c6b7e61f --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueShareLinkRecordDao.java @@ -0,0 +1,51 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IssueShareLinkRecordEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 议题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Mapper +public interface IssueShareLinkRecordDao extends BaseDao { + + /** + * @Description 校验此人此议题是否存在分享记录 + * @Param issueId + * @Param userId + * @author zxc + * @date 2020/12/18 下午1:47 + */ + String checkIssueRecord(@Param("issueId") String issueId, @Param("userId") String userId); + + /** + * @Description 根据issueId查询议题信息 + * @Param issueId + * @author zxc + * @date 2020/12/18 下午1:55 + */ + IssueShareLinkRecordEntity selectIssueInfoById(@Param("issueId") String issueId); + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueShareLinkVisitRecordDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueShareLinkVisitRecordDao.java new file mode 100644 index 0000000000..a23b73a03c --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueShareLinkVisitRecordDao.java @@ -0,0 +1,65 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IssueShareLinkVisitRecordDTO; +import com.epmet.entity.IssueShareLinkVisitRecordEntity; +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 2020-12-18 + */ +@Mapper +public interface IssueShareLinkVisitRecordDao extends BaseDao { + + /** + * @Description 根据邀请Id和邀请人Id查询邀请人的Id + * @param linkId + * @param invitee + * @return java.lang.String + * @author wangc + * @date 2020.12.18 15:50 + */ + String selectInviterIdByLinkIdAndInvitee(@Param("linkId") String linkId, @Param("invitee") String invitee); + + /** + * @Description 修改是否通过链接注册居民由0改为1 + * @param linkId + * @param invitee + * @return int + * @author wangc + * @date 2020.12.18 15:50 + */ + int updateInviteRegister(@Param("linkId") String linkId, @Param("invitee") String invitee); + + /** + * @Description 根据邀请Id和被邀请人Id查询查询链接浏览记录 + * @param + * @return com.epmet.dto.IssueShareLinkVisitRecordDTO + * @author wangc + * @date 2020.12.22 09:53 + */ + IssueShareLinkVisitRecordDTO selectRecordByLinkIdAndInvitee(@Param("linkId") String linkId, @Param("invitee") String invitee); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueShareLinkRecordEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueShareLinkRecordEntity.java new file mode 100644 index 0000000000..0c654926e4 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueShareLinkRecordEntity.java @@ -0,0 +1,70 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 议题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_share_link_record") +public class IssueShareLinkRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 议题所属网格ID + */ + private String gridId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 分享人(当前用户id) + */ + private String shareUserId; + + /** + * 邀请内容 + */ + private String inviteContent; + + /** + * 话题ID + */ + @TableField(exist = false) + private String topicId; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueShareLinkVisitRecordEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueShareLinkVisitRecordEntity.java new file mode 100644 index 0000000000..b4cea0c628 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueShareLinkVisitRecordEntity.java @@ -0,0 +1,70 @@ +/** + * 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.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("issue_share_link_visit_record") +public class IssueShareLinkVisitRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 分享人【邀请人】ID + */ + private String shareUserId; + + /** + * 被邀请人ID + */ + private String inviteeUserId; + + /** + * 议题分享链接表.id + */ + private String shareLinkRecId; + + /** + * 是否邀请注册:0:是,1:不是 + */ + private Integer isInviteRegister; + + /** + * 是否同意进组,1是0否,在注册完居民之后,是否同意入组,如果同意发送入组申请,不同意此项默认为0 + */ + private Boolean ifJoinGroup; +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueShareLinkRecordService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueShareLinkRecordService.java new file mode 100644 index 0000000000..cd3ff90811 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueShareLinkRecordService.java @@ -0,0 +1,118 @@ +/** + * 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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.IssueShareLinkRecordDTO; +import com.epmet.dto.form.IssueCreateUrlFormDTO; +import com.epmet.dto.form.IssueVisitFormDTO; +import com.epmet.dto.result.IssueCreateUrlResultDTO; +import com.epmet.dto.result.IssueVisitResultDTO; +import com.epmet.entity.IssueShareLinkRecordEntity; + +import java.util.List; +import java.util.Map; + +/** + * 议题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +public interface IssueShareLinkRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueShareLinkRecordDTO + * @author generator + * @date 2020-12-18 + */ + IssueShareLinkRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void save(IssueShareLinkRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void update(IssueShareLinkRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-18 + */ + void delete(String[] ids); + + /** + * @Description 议题分享链接ID + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2020/12/18 下午1:36 + */ + IssueCreateUrlResultDTO getIssueShareLinkId(IssueCreateUrlFormDTO formDTO, TokenDto tokenDto); + + /** + * @Description 分享议题id获取信息 + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2020/12/18 下午5:22 + */ + IssueVisitResultDTO issueVisit( IssueVisitFormDTO formDTO, TokenDto tokenDto); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueShareLinkVisitRecordService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueShareLinkVisitRecordService.java new file mode 100644 index 0000000000..2f1becfbe2 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueShareLinkVisitRecordService.java @@ -0,0 +1,113 @@ +/** + * 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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IssueShareLinkVisitRecordDTO; +import com.epmet.dto.form.SharableIssueAndInviteeFormDTO; +import com.epmet.entity.IssueShareLinkVisitRecordEntity; +import java.util.List; +import java.util.Map; + +/** + * 议题分享链接访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +public interface IssueShareLinkVisitRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueShareLinkVisitRecordDTO + * @author generator + * @date 2020-12-18 + */ + IssueShareLinkVisitRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void save(IssueShareLinkVisitRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void update(IssueShareLinkVisitRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-18 + */ + void delete(String[] ids); + + /** + * @Description + * @param param + * @return java.lang.String + * @author wangc + * @date 2020.12.18 15:24 + */ + String checkInviteRelationship(SharableIssueAndInviteeFormDTO param); + + /** + * @Description 通过链接Id查询分享人和被邀请人的信息 + * @param + * @return + * @author wangc + * @date 2020.12.21 16:27 + */ + IssueShareLinkVisitRecordDTO getVisitRecord(String linkId,String invitee); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueShareLinkRecordServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueShareLinkRecordServiceImpl.java new file mode 100644 index 0000000000..f0880749fb --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueShareLinkRecordServiceImpl.java @@ -0,0 +1,167 @@ +package com.epmet.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.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.IssueShareConstant; +import com.epmet.dao.IssueShareLinkRecordDao; +import com.epmet.dao.IssueShareLinkVisitRecordDao; +import com.epmet.dto.IssueShareLinkRecordDTO; +import com.epmet.dto.form.IssueCreateUrlFormDTO; +import com.epmet.dto.form.IssueVisitFormDTO; +import com.epmet.dto.result.IssueCreateUrlResultDTO; +import com.epmet.dto.result.IssueVisitResultDTO; +import com.epmet.entity.IssueShareLinkRecordEntity; +import com.epmet.entity.IssueShareLinkVisitRecordEntity; +import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; +import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; +import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; +import com.epmet.service.IssueShareLinkRecordService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +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 IssueShareLinkRecordServiceImpl extends BaseServiceImpl implements IssueShareLinkRecordService { + + @Autowired + private ResiGroupOpenFeignClient resiGroupOpenFeignClient; + @Autowired + private IssueShareLinkVisitRecordDao visitRecordDao; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueShareLinkRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueShareLinkRecordDTO.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 IssueShareLinkRecordDTO get(String id) { + IssueShareLinkRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueShareLinkRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueShareLinkRecordDTO dto) { + IssueShareLinkRecordEntity entity = ConvertUtils.sourceToTarget(dto, IssueShareLinkRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueShareLinkRecordDTO dto) { + IssueShareLinkRecordEntity entity = ConvertUtils.sourceToTarget(dto, IssueShareLinkRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Description 议题分享链接ID + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2020/12/18 下午1:36 + */ + @Override + public IssueCreateUrlResultDTO getIssueShareLinkId(IssueCreateUrlFormDTO formDTO, TokenDto tokenDto) { + // 校验此人此议题是否存在分享记录 + String shareLinkId = baseDao.checkIssueRecord(formDTO.getIssueId(), tokenDto.getUserId()); + if (StringUtils.isNotBlank(shareLinkId)){ + return new IssueCreateUrlResultDTO(shareLinkId); + } + // 查询议题信息 + IssueShareLinkRecordEntity issueInfo = baseDao.selectIssueInfoById(formDTO.getIssueId()); + if (null == issueInfo){ + throw new RenException(IssueShareConstant.NOT_EXIST_ISSUE_INFO); + } + TopicBelongGroupFormDTO topicBelongGroupFormDTO = new TopicBelongGroupFormDTO(); + topicBelongGroupFormDTO.setTopicId(issueInfo.getTopicId()); + // 查询议题来源所属小组【话题所属小组】 + Result topicInfo = resiGroupOpenFeignClient.selectTopicBelongGroup(topicBelongGroupFormDTO); + if (!topicInfo.success()){ + throw new RenException(IssueShareConstant.TOPIC_BELONG_GROUP_FAILURE); + } + IssueShareLinkRecordEntity entity = new IssueShareLinkRecordEntity(); + entity.setCustomerId(issueInfo.getCustomerId()); + if (StringUtils.isBlank(topicInfo.getData().getGroupId())){ + throw new RenException(IssueShareConstant.TOPIC_BELONG_GROUP_NULL); + } + entity.setGridId(topicInfo.getData().getGroupId()); + entity.setIssueId(formDTO.getIssueId()); + entity.setShareUserId(tokenDto.getUserId()); + entity.setInviteContent(null); + // 插入分享记录 + baseDao.insert(entity); + return new IssueCreateUrlResultDTO(entity.getId()); + } + + /** + * @Description 分享议题id获取信息 + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2020/12/18 下午5:22 + */ + @Override + public IssueVisitResultDTO issueVisit(IssueVisitFormDTO formDTO, TokenDto tokenDto) { + // 查询记录信息 + IssueShareLinkRecordEntity linkRecord = baseDao.selectById(formDTO.getShareLinkId()); + if (null == linkRecord){ + throw new RenException(IssueShareConstant.NOT_EXIST_INVITE_ISSUE_RECORD); + } + IssueShareLinkVisitRecordEntity entity = new IssueShareLinkVisitRecordEntity(); + entity.setCustomerId(linkRecord.getCustomerId()); + entity.setShareUserId(linkRecord.getShareUserId()); + entity.setInviteeUserId(tokenDto.getUserId()); + entity.setShareLinkRecId(formDTO.getShareLinkId()); + entity.setIsInviteRegister(NumConstant.ONE); + // 插入访问记录 + visitRecordDao.insert(entity); + return new IssueVisitResultDTO(linkRecord.getIssueId(),linkRecord.getGridId(),linkRecord.getCustomerId()); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueShareLinkVisitRecordServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueShareLinkVisitRecordServiceImpl.java new file mode 100644 index 0000000000..cbefa389e9 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueShareLinkVisitRecordServiceImpl.java @@ -0,0 +1,126 @@ +/** + * 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.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.dao.IssueShareLinkVisitRecordDao; +import com.epmet.dto.IssueShareLinkVisitRecordDTO; +import com.epmet.dto.form.SharableIssueAndInviteeFormDTO; +import com.epmet.entity.IssueShareLinkVisitRecordEntity; +import com.epmet.service.IssueShareLinkVisitRecordService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 议题分享链接访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Service +public class IssueShareLinkVisitRecordServiceImpl extends BaseServiceImpl implements IssueShareLinkVisitRecordService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueShareLinkVisitRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueShareLinkVisitRecordDTO.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 IssueShareLinkVisitRecordDTO get(String id) { + IssueShareLinkVisitRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueShareLinkVisitRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueShareLinkVisitRecordDTO dto) { + IssueShareLinkVisitRecordEntity entity = ConvertUtils.sourceToTarget(dto, IssueShareLinkVisitRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueShareLinkVisitRecordDTO dto) { + IssueShareLinkVisitRecordEntity entity = ConvertUtils.sourceToTarget(dto, IssueShareLinkVisitRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Description + * @param param + * @return java.lang.String + * @author wangc + * @date 2020.12.18 15:18 + */ + @Override + public String checkInviteRelationship(SharableIssueAndInviteeFormDTO param) { + String inviterId = baseDao.selectInviterIdByLinkIdAndInvitee(param.getShareLinkId(),param.getInviteeId()); + if(StringUtils.isNotBlank(inviterId)) baseDao.updateInviteRegister(param.getShareLinkId(),param.getInviteeId()); + return inviterId; + } + + /** + * @Description 通过链接Id查询分享人和被邀请人的信息 + * @param + * @return + * @author wangc + * @date 2020.12.21 16:27 + */ + @Override + public IssueShareLinkVisitRecordDTO getVisitRecord(String linkId, String invitee) { + return baseDao.selectRecordByLinkIdAndInvitee(linkId, invitee); + } +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.7__issue_share.sql b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.7__issue_share.sql new file mode 100644 index 0000000000..f99b63c830 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.7__issue_share.sql @@ -0,0 +1,39 @@ +DROP TABLE IF EXISTS `issue_share_link_record`; +CREATE TABLE `issue_share_link_record` +( + `ID` varchar(64) NOT NULL, + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `GRID_ID` varchar(64) NOT NULL COMMENT '议题所属网格ID', + `ISSUE_ID` varchar(64) NOT NULL COMMENT '议题ID', + `SHARE_USER_ID` varchar(64) NOT NULL COMMENT '分享人(当前用户id)', + `INVITE_CONTENT` varchar(255) DEFAULT NULL COMMENT '邀请内容', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除状态 0:正常,1:删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='议题分享链接表'; + +#================================================================================= + +DROP TABLE IF EXISTS `issue_share_link_visit_record`; +CREATE TABLE `issue_share_link_visit_record` +( + `ID` varchar(64) NOT NULL, + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `SHARE_USER_ID` varchar(64) NOT NULL COMMENT '分享人【邀请人】ID', + `INVITEE_USER_ID` varchar(64) NOT NULL COMMENT '被邀请人ID', + `SHARE_LINK_REC_ID` varchar(64) NOT NULL COMMENT '议题分享链接表.id', + `IS_INVITE_REGISTER` int(11) NOT NULL COMMENT '是否邀请注册:0:是,1:不是', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除状态,0:正常,1:删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='议题分享链接访问记录表 '; \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueShareLinkRecordDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueShareLinkRecordDao.xml new file mode 100644 index 0000000000..99bbe9d7e4 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueShareLinkRecordDao.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueShareLinkVisitRecordDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueShareLinkVisitRecordDao.xml new file mode 100644 index 0000000000..b91f65bba4 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueShareLinkVisitRecordDao.xml @@ -0,0 +1,47 @@ + + + + + + + + + UPDATE + issue_share_link_visit_record + SET + is_invite_register = 0 + WHERE + del_flag = '0' + AND + share_link_rec_id = #{linkId} + AND + invitee_user_id = #{invitee} + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java index 8a96cc23b4..5f0f1d1aa4 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java @@ -78,4 +78,29 @@ public interface TopicConstant { String CREATE_TOPIC = "创建话题失败,话题内容为:%s"; String SHIFT_ISSUE = "转议题失败,标题为:%s , 建议为:%s"; + + /** + * 附件文件类型 + * 图片 - image、文档 - doc、语音 - voice、视频 - video + */ + String FILE_IMAGE = "image"; + String FILE_DOC = "doc"; + String FILE_VOICE = "voice"; + 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"; + + String GROUP_INFO_FAILURE = "根据groupId未查询到组信息......"; + + String CREATE_TOPIC_FAILURE = "发布话题加分失败......"; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicShareConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicShareConstant.java new file mode 100644 index 0000000000..affeac1fe2 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicShareConstant.java @@ -0,0 +1,15 @@ +package com.epmet.resi.group.constant; + +/** + * @Author zxc + * @DateTime 2020/12/18 上午10:53 + */ +public interface TopicShareConstant { + + String NOT_EXIST_TOPIC_INFO = "未查到该话题信息......"; + + String NOT_EXIST_TOPIC_BELONG_GROUP = "未查询到话题所属小组......"; + + String NOT_EXIST_INVITE_RECORD = "未查询到该邀请记录......"; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java index 751153861a..78f7c8fe77 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java @@ -62,7 +62,7 @@ public class GroupMemeberOperationDTO implements Serializable { private String operateStatus; /** - * 入群方式:(受邀请入群 - invited 、 主动加入 - join、created群主创建群自动进入群、扫码入群 - scancode) + * 入群方式:(受邀请入群 - invited 、 主动加入 - join、created群主创建群自动进入群、扫码入群 - scancode、话题分享链接 - topic_share_link、议题分享链接 - issue_share_link) */ private String enterGroupType; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java index c6cd651968..f1832f7958 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java @@ -54,7 +54,7 @@ public class ResiGroupMemberDTO implements Serializable { private String groupLeaderFlag; /** - * 入群方式:(受邀请入群 - invited 、 主动加入 - join、created群主创建群自动进入群、扫码入群 - scancode) + * 入群方式:(受邀请入群 - invited 、 主动加入 - join、created群主创建群自动进入群、扫码入群 - scancode、话题分享链接 - topic_share_link、议题分享链接 - issue_share_link) */ private String enterGroupType; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/JoinGroupByShareLinkFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/JoinGroupByShareLinkFormDTO.java new file mode 100644 index 0000000000..86740bcb0e --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/JoinGroupByShareLinkFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.resi.group.dto.member.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 通过链接入组申请传参DTO + * @ClassName JoinGroupByShareLinkFormDTO + * @Auth wangc + * @Date 2020-12-22 10:34 + */ +@Data +public class JoinGroupByShareLinkFormDTO implements Serializable { + private static final long serialVersionUID = -4402483318595770636L; + + /** + * 分享链接Id + */ + @NotBlank(message = "分享链接Id不能为空") + private String shareLinkId; + + /** + * topic | issue + */ + @NotBlank(message = "链接类型不能为空") + private String shareLinkType; + + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java index 915523354b..352499d9a4 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java @@ -48,7 +48,7 @@ public class ApplyingMemberResultDTO implements Serializable { private String status; /** - * invited:通过链接加入 ; join:申请加入;scancode通过扫码加入 + * invited:通过链接加入 ; join:申请加入;scancode通过扫码加入;话题分享链接 - topic_share_link、议题分享链接 - issue_share_link */ private String enterGroupType; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/JoinGroupApplyRealTimeResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/JoinGroupApplyRealTimeResultDTO.java new file mode 100644 index 0000000000..986372b1c0 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/JoinGroupApplyRealTimeResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.resi.group.dto.member.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 申请入群实时结果 + * @ClassName JoinGroupApplyRealTimeResultDTO + * @Auth wangc + * @Date 2020-12-22 10:32 + */ +@Data +public class JoinGroupApplyRealTimeResultDTO implements Serializable { + private static final long serialVersionUID = 6251288539242747659L; + + /** + * entered(已入组) auditing(审核中) + */ + private String status; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/scanapicallback/VoiceScanCallBackContentFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/scanapicallback/VoiceScanCallBackContentFormDTO.java new file mode 100644 index 0000000000..1907cbb8cf --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/scanapicallback/VoiceScanCallBackContentFormDTO.java @@ -0,0 +1,97 @@ +package com.epmet.resi.group.dto.scanapicallback; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 语音检测callBack入参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/10 10:47 + */ +@Data +public class VoiceScanCallBackContentFormDTO implements Serializable { + + /** + * 错误码,和HTTP状态码一致。 + * 200:表示检测成功。 + * 280:表示处理中,需要继续轮询。 + * 其他:表示任务失败。 + * 更多信息,请参见公共错误码。 + * + * 说明 只有返回280表示任务还在进行,需要继续轮询该任务的检测结果。返回其他值均表示该语音检测任务已结束。如果实际上该语音检测没有结束,而是因为网络异常等原因异常结束,您可以重新提交语音异步检测任务。 + */ + private Integer code; + + /** + * 请求参数的响应信息。 + */ + private String msg; + + /** + * 检测对象对应的数据ID。 + * 说明 如果在检测请求参数中传入了dataId,则此处返回对应的dataId。 + */ + private String dataId; + + /** + * 该检测任务的ID。 + */ + private String taskId; + + /** + * 检测对象的URL。 + */ + private String url; + + /** + * 检测成功(code=200)时,返回的检测结果。该结果包含一个或多个元素,每个元素是个结构体,对应一个场景。关于每个元素的结构描述,请参见result。 + */ + private List results; + + + @Data + private static class ResultDTO{ + /** + * 检测结果的分类。取值: + * normal:正常文本 + * spam:含垃圾信息 + * ad:广告 + * politics:涉政 + * terrorism:暴恐 + * abuse:辱骂 + * porn:色情 + * flood:灌水 + * contraband:违禁 + * meaningless:无意义 + * customized:自定义(例如命中自定义关键词) + */ + private String label; + + /** + * 检测场景,和调用请求中的场景对应。唯一取值:antispam。 + */ + private String scene; + + /** + * 建议您执行的后续操作。取值: + * pass:结果正常,无需进行其余操作。 + * review:结果不确定,需要进行人工审核。 + * block:结果违规,建议直接删除或者限制公开。 + */ + private String suggestion; + + /** + * 置信度分数,取值范围:0(表示置信度最低)~100(表示置信度最高)。 + * 如果suggestion为pass,则置信度越高,表示内容正常的可能性越高;如果suggestion为review或block,则置信度越高,表示内容违规的可能性越高。 + * 注意 该值仅作为参考,强烈建议您不要在业务中使用。建议您参考suggestion和label(或者部分接口返回的sublabel)结果用于内容违规判定。 + */ + private Float rate; + //下面还有个details 语音对应的文本详情。每一句文本对应一个元素,包含一个或者多个元素。关于每个元素的结构描述,请参见detail。 + //暂时不解析了。 + } + + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicAttachmentDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicAttachmentDTO.java index 1b57a93f72..60d086d6fc 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicAttachmentDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicAttachmentDTO.java @@ -63,6 +63,16 @@ public class ResiTopicAttachmentDTO implements Serializable { */ private String attachmentUrl; + /** + * 排序字段,解决多张图片的createdTime相同时的排序问题 + * */ + private Integer sort; + + /** + * 语音或视频时长,秒 + * */ + private Integer duration; + /** * 删除标记 0:未删除,1:已删除 */ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftAttachmentDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftAttachmentDTO.java new file mode 100644 index 0000000000..d6e3337904 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftAttachmentDTO.java @@ -0,0 +1,122 @@ +/** + * 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.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-17 + */ +@Data +public class TopicDraftAttachmentDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 附件id + */ + private String id; + + /** + * 话题草稿id + */ + private String topicDraftId; + + /** + * 客户id + */ + private String customerId; + + /** + * 附件名(uuid随机生成) + */ + private String attachmentName; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String attachmentFormat; + + /** + * 附件类型((图片 - image、视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * 附件地址url + */ + private String attachmentUrl; + + /** + * 排序字段(按附件类型分组排序) + */ + private Integer sort; + + /** + * 附件状态(审核中:auditing; + auto_passed: 自动通过; + review:结果不确定,需要人工审核; + block: 结果违规; + rejected:人工审核驳回; + approved:人工审核通过) + 现在图片是同步审核的,所以图片只有auto_passed一种状态 + */ + private String status; + + /** + * 语音或视频时长,秒 + * */ + private Integer duration; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftDTO.java new file mode 100644 index 0000000000..80fcc43105 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftDTO.java @@ -0,0 +1,146 @@ +/** + * 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.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-17 + */ +@Data +public class TopicDraftDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 话题草稿id + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 小组Id + */ + private String groupId; + + /** + * 话题内容 + */ + private String topicContent; + + /** + * 话题草稿状态(审核中:auditing; + auto_passed: 自动通过; + review:结果不确定,需要人工审核; + block: 结果违规; + rejected:人工审核驳回; + approved:人工审核通过) + */ + private String draftStatus; + + /** + * 草稿审核理由 + */ + private String draftReason; + + /** + * 省 + */ + private String province; + + /** + * 市 + */ + private String city; + + /** + * 区 + */ + private String area; + + /** + * 地址 + */ + private String address; + + /** + * 经度 + */ + private String longitude; + + /** + * 维度 + */ + private String dimension; + + /** + * 发布成功后的话题id + */ + private String topicId; + + /** + * 创建者是否可见(0是 1否) + */ + private String isSee; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 话题发布人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftOperationDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftOperationDTO.java new file mode 100644 index 0000000000..b0629f991a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftOperationDTO.java @@ -0,0 +1,96 @@ +/** + * 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.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-17 + */ +@Data +public class TopicDraftOperationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 话题草稿操作日志id + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 话题草稿id + */ + private String topicDraftId; + + /** + * 操作类型:submit:提交发布; + auto_passed: 自动审核-通过; + review:自动审核-结果不确定,需要人工审核; + block: 自动审核-结果违规; + rejected:人工审核驳回; + approved:人工审核通过 + */ + private String operateType; + + /** + * 操作时的备注,比如驳回理由 + */ + private String remark; + + /** + * 删除标记 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; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftScanTaskDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicDraftScanTaskDTO.java new file mode 100644 index 0000000000..620f56d7ec --- /dev/null +++ b/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 + *

+ * 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.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; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkRecordDTO.java new file mode 100644 index 0000000000..a7a0923715 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkRecordDTO.java @@ -0,0 +1,102 @@ +/** + * 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.resi.group.dto.topic; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 话题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Data +public class TopicShareLinkRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 邀请ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 话题所属网格ID + */ + private String gridId; + + /** + * 小组ID + */ + private String groupId; + + /** + * 话题ID + */ + private String topicId; + + /** + * 分享人ID(当前登录用户) + */ + private String shareUserId; + + /** + * 邀请内容 + */ + private String inviteContent; + + /** + * 删除状态 0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkVisitRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkVisitRecordDTO.java new file mode 100644 index 0000000000..572160d9ee --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkVisitRecordDTO.java @@ -0,0 +1,96 @@ +/** + * 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.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 TopicShareLinkVisitRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 分享人【邀请人】ID + */ + private String shareUserId; + + /** + * 被邀请人ID + */ + private String inviteeUserId; + + /** + * 话题分享链接表id + */ + private String shareLinkRecId; + + /** + * 是否邀请注册:0:是,1:不是 + */ + private Integer isInviteRegister; + + /** + * 删除状态,0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/AuditDraftTopicFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/AuditDraftTopicFormDTO.java new file mode 100644 index 0000000000..0605d39acb --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CreateTopicFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CreateTopicFormDTO.java new file mode 100644 index 0000000000..a53a8f36db --- /dev/null +++ b/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 imageList; + /** + * 文件附件 + */ + private List docList; + /** + * 语音附件 + */ + private List voiceList; + /** + * 视频附件 + */ + private List videoList; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CreateUrlFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CreateUrlFormDTO.java new file mode 100644 index 0000000000..905f0208e3 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CreateUrlFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.resi.group.dto.topic.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/18 上午10:02 + */ +@Data +public class CreateUrlFormDTO implements Serializable { + + private static final long serialVersionUID = -7661839148530902018L; + + public interface CreateUrlForm{} + + /** + * 话题ID + */ + @NotBlank(message = "话题ID不能为空",groups = {CreateUrlForm.class}) + private String topicId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/DraftDetailFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/DraftDetailFormDTO.java new file mode 100644 index 0000000000..e57f420d19 --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingListFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingListFormDTO.java new file mode 100644 index 0000000000..dc4a989bed --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingListFormDTO.java @@ -0,0 +1,37 @@ +package com.epmet.resi.group.dto.topic.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; + +/** + * @Author sun + * @Description 个人中心-我发表的话题-审核中列表-接口入参 + */ +@Data +public class MyAuditingListFormDTO { + + /** + * 客户Id + */ + @NotBlank(message = "客户ID不能为空",groups = {MyAuditingListFormDTO.AuditingTopicForm.class}) + private String customerId; + /** + * 页码,从1开始 + */ + @Min(value = 1, message = "页码必须大于0", groups = { MyAuditingListFormDTO.AuditingTopicForm.class }) + private Integer pageNo; + /** + * 页容量,默认10页 + */ + @Min(value = 1, message = "每页条数必须大于0", groups = { MyAuditingListFormDTO.AuditingTopicForm.class }) + private Integer pageSize; + /** + * token中用户Id + */ + private String userId; + + public interface AuditingTopicForm{} + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingTopicFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingTopicFormDTO.java new file mode 100644 index 0000000000..47f2d7dd83 --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/SharableTopicAndInviteeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/SharableTopicAndInviteeFormDTO.java new file mode 100644 index 0000000000..18d54716e0 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/SharableTopicAndInviteeFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.resi.group.dto.topic.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 话题分享链接和被邀请人入参Dto + * @ClassName SharableTopicAndInviteeFormDTO + * @Auth wangc + * @Date 2020-12-18 13:43 + */ +@Data +public class SharableTopicAndInviteeFormDTO implements Serializable { + + private static final long serialVersionUID = 4943940805360726855L; + + /** + * 话题分享链接 + */ + private String shareLinkId; + + /** + * 通过链接进入话题页面用户的Id + */ + private String inviteeId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicAttachmentFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicAttachmentFormDTO.java new file mode 100644 index 0000000000..24ab83af6e --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicAttachmentFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.resi.group.dto.topic.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 获取话题附件信息-接口入参 + */ +@Data +public class TopicAttachmentFormDTO implements Serializable { + + private static final long serialVersionUID = -7661839148530902018L; + /** + * 话题ID + */ + @NotBlank(message = "话题ID不能为空",groups = {TopicForm.class}) + private String topicId; + + public interface TopicForm{} +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicAuditFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicAuditFormDTO.java new file mode 100644 index 0000000000..ba57670521 --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicBelongGroupFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicBelongGroupFormDTO.java new file mode 100644 index 0000000000..b749fd3c73 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicBelongGroupFormDTO.java @@ -0,0 +1,17 @@ +package com.epmet.resi.group.dto.topic.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/18 下午2:06 + */ +@Data +public class TopicBelongGroupFormDTO implements Serializable { + + private static final long serialVersionUID = -1257699096393262959L; + + private String topicId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicVisitFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicVisitFormDTO.java new file mode 100644 index 0000000000..359d4be674 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicVisitFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.resi.group.dto.topic.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/18 下午3:12 + */ +@Data +public class TopicVisitFormDTO implements Serializable { + + private static final long serialVersionUID = -7231684507046042401L; + + public interface TopicVisitForm{} + + /** + * 分享ID + */ + @NotBlank(message = "分享ID不能为空",groups = {TopicVisitForm.class}) + private String shareLinkId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/CreateUrlResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/CreateUrlResultDTO.java new file mode 100644 index 0000000000..7ec576aee5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/CreateUrlResultDTO.java @@ -0,0 +1,22 @@ +package com.epmet.resi.group.dto.topic.result; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/18 上午10:01 + */ +@Data +@AllArgsConstructor +public class CreateUrlResultDTO implements Serializable { + + private static final long serialVersionUID = -8606257390921799432L; + + /** + * 分享链接ID + */ + private String shareLinkId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/DraftDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/DraftDetailResultDTO.java new file mode 100644 index 0000000000..cd0772719d --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/DraftDetailResultDTO.java @@ -0,0 +1,59 @@ +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 String status; + private String topicId; + /** + * 图片附件集合 + */ + private List imageList; + private List docList; + /** + * 音频附件集合 + */ + private List voiceList; + private List videoList; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingListResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingListResultDTO.java new file mode 100644 index 0000000000..14b35755ec --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingListResultDTO.java @@ -0,0 +1,49 @@ +package com.epmet.resi.group.dto.topic.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 个人中心-我发表的话题-审核中列表-接口返参 + */ +@Data +public class MyAuditingListResultDTO implements Serializable { + + private static final long serialVersionUID = -703102629653169023L; + + /** + * 话题草稿id + */ + private String topicDraftId; + + /** + * 话题来源网格名称 + */ + private String releaseGridName; + @JsonIgnore + private String gridId; + + /** + * 发布时间戳 + */ + private Long releaseTime; + + /** + * 话题内容 + */ + private String topicContent; + + /** + * 小组名称 + */ + private String releaseGroupName; + + /** + * 状态 + */ + private String status; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingTopicResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingTopicResultDTO.java new file mode 100644 index 0000000000..efdb157adf --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicAttachmentResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicAttachmentResultDTO.java new file mode 100644 index 0000000000..0b28664ce0 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicAttachmentResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.resi.group.dto.topic.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.LinkedList; + +/** + * @Author sun + * @Description 获取话题附件信息-接口返参 + */ +@Data +public class TopicAttachmentResultDTO implements Serializable { + + private static final long serialVersionUID = -8606257390921799432L; + + /** + * 文件附件Url集合 + */ + private LinkedList docList; + /** + * 语音附件Url集合 + */ + private LinkedList voiceList; + /** + * 视频附件Url集合 + */ + private LinkedList videoList; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicAuditResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicAuditResultDTO.java new file mode 100644 index 0000000000..d18a8ab0d5 --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicBelongGroupResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicBelongGroupResultDTO.java new file mode 100644 index 0000000000..275813b5c6 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicBelongGroupResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.resi.group.dto.topic.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/18 下午2:12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class TopicBelongGroupResultDTO implements Serializable { + + private static final long serialVersionUID = 8180287697221964032L; + + private String groupId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicVisitResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicVisitResultDTO.java new file mode 100644 index 0000000000..6191a5b6b9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicVisitResultDTO.java @@ -0,0 +1,50 @@ +package com.epmet.resi.group.dto.topic.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/18 下午3:15 + */ +@Data +public class TopicVisitResultDTO implements Serializable { + + private static final long serialVersionUID = -8053248999188056579L; + + /** + * 是否存在入组待审核记录,true:存在,false:不存在 + */ + private Boolean awaitAudit; + + /** + * 是否在群内标志,已经在群内:true, 不在群内:false + */ + private Boolean inGroup; + + /** + * 小组ID + */ + private String groupId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 话题ID + */ + private String topicId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 话题屏蔽状态,true:已屏蔽,false:未屏蔽 + */ + private Boolean shieldStatus; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java index b0115d17ea..a6b7c3291c 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java @@ -12,24 +12,17 @@ import com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO; import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO; import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO; import com.epmet.resi.group.dto.topic.form.*; -import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO; -import com.epmet.resi.group.dto.topic.result.MyCreateTopicsResultDTO; -import com.epmet.resi.group.dto.topic.result.MyPartIssueResultDTO; -import com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO; +import com.epmet.resi.group.dto.topic.result.*; import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; -import com.epmet.commons.tools.utils.Result; -import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import java.util.HashMap; import java.util.List; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -149,4 +142,27 @@ public interface ResiGroupOpenFeignClient { */ @PostMapping("resi/group/topic/fetchtopicinfowhenauditissue") Result fetchTopicInfoWhenAuditIssue(@RequestBody ResiTopicTurnIssueFromDTO param); + + /** + * @Description 查询话题所属小组 + * @Param formDTO + * @author zxc + * @date 2020/12/18 下午2:08 + */ + @PostMapping("resi/group/topicsharelink/topicbelonggroup") + Result selectTopicBelongGroup(@RequestBody TopicBelongGroupFormDTO formDTO); + + /** + * @Description 检查邀请关系,如果确实存在邀请关系则返回邀请人Id + * 符合条件: + * ① 链接Id对应 + * ② 邀请人Id对应 + * ③ 邀请人在被邀请时的状态为陌生人 + * @param param + * @return com.epmet.commons.tools.utils.Result + * @author wangc + * @date 2020.12.18 14:53 + */ + @PostMapping("resi/group/topicsharelinkvisitrecord/checkinviterelationship") + Result checkInviteRelationship(@RequestBody SharableTopicAndInviteeFormDTO param); } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java index 730388e44a..61125db98f 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java @@ -17,6 +17,7 @@ import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO; import com.epmet.resi.group.dto.topic.result.MyPartIssueResultDTO; import com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO; import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; +import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; import org.springframework.stereotype.Component; @@ -102,4 +103,14 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien public Result fetchTopicInfoWhenAuditIssue(ResiTopicTurnIssueFromDTO param) { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "fetchTopicInfoWhenAuditIssue",param); } + + @Override + public Result selectTopicBelongGroup(TopicBelongGroupFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "selectTopicBelongGroup",formDTO); + } + + @Override + public Result checkInviteRelationship(SharableTopicAndInviteeFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "selectTopicBelongGroup", param); + } } diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index 84a771af59..a2003e0dd8 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -159,6 +159,13 @@ false + + + https://epmet-dev.elinkservice.cn/estos/ + producerService/producer/sendMsg + 202007161443499985fa2d397436d10356542134c8f008c48 + 52d9d9b0e7d0eb5b8b81c205b579e07c + https://epmet-dev.elinkservice.cn/api/epmetscan/api 5 @@ -204,6 +211,13 @@ false + + + https://epmet-dev.elinkservice.cn/estos/ + producerService/producer/sendMsg + 202007161443499985fa2d397436d10356542134c8f008c48 + 52d9d9b0e7d0eb5b8b81c205b579e07c + https://epmet-dev.elinkservice.cn/api/epmetscan/api 5 @@ -248,6 +262,13 @@ false true + + + https://epmet-dev.elinkservice.cn/estos/ + producerService/producer/sendMsg + 20200804181646184507453a2e9aab76edc550405f80920af + 96d788191a10ff57a125157183413004 + https://epmet-dev.elinkservice.cn/api/epmetscan/api 5 @@ -289,6 +310,13 @@ false true + + + https://estos.elinkservice.cn:7519/estos/ + producerService/producer/sendMsg + 202008141820598348026098a1b5dd0bc63a1e2418e275d1b + 7ce17f65826539ff3e8616dccd4b70fc + https://epmet-open.elinkservice.cn/api/epmetscan/api 5 diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java index 44f61b26ec..4c8897c5f1 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.modules.invitation.entity.GroupInvitationEntity; +import com.epmet.resi.group.dto.UserRoleDTO; import com.epmet.resi.group.dto.invitation.GroupInvitationDTO; import com.epmet.resi.group.dto.invitation.form.AccetInvitationFormDTO; import com.epmet.resi.group.dto.invitation.form.CreateGroupInvitationFormDTO; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index 39ab49fd00..e577907d89 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java @@ -602,6 +602,10 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl().ok(resiGroupMemberService.votableCount(gridList)); } + /** + * @Description 通过话题/议题分享链接申请入组 + * @param param + * @return com.epmet.resi.group.dto.member.result.JoinGroupApplyRealTimeResultDTO + * @author wangc + * @date 2020.12.22 10:36 + */ + @PostMapping("applyenterbylink") + public Result applyEnterByLink(@LoginUser TokenDto token,@RequestBody JoinGroupByShareLinkFormDTO param){ + param.setUserId(token.getUserId()); + ValidatorUtils.validateEntity(param); + return new Result().ok(operationService.applyEnterByLink(param)); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java index 8d56bd49af..49ecf7fbbe 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java @@ -50,4 +50,13 @@ public interface GroupMemeberOperationDao extends BaseDao { * @date 2020.05.26 14:22 **/ List getGroupIdByUserIdAndGridId(@Param("gridId")String gridId,@Param("userId")String userId,@Param("roleFlag")String roleFlag); + + /** + * @Description 校验此人是不是在组内 + * @Param userId + * @Param groupId + * @author zxc + * @date 2020/12/18 下午4:33 + */ + Integer checkUserInGroup(@Param("userId")String userId,@Param("groupId")String groupId); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java index fd7537370c..8483de6627 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java @@ -62,7 +62,7 @@ Ps: 1) 入群被拒绝之后,如果再申请是插入一条新的审核中的 private String operateStatus; /** - * 入群方式:(受邀请入群 - invited 、 主动加入 - join、扫码入群 - scancode) + * 入群方式:(受邀请入群 - invited 、 主动加入 - join、扫码入群 - scancode、话题分享链接 - topic_share_link、议题分享链接 - issue_share_link) */ private String enterGroupType; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java index 6dc7d21ad2..ebcceb9566 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java @@ -54,7 +54,7 @@ public class ResiGroupMemberEntity extends BaseEpmetEntity { private String groupLeaderFlag; /** - * 入群方式:(受邀请入群 - invited 、 主动加入 - join、扫码入群 - scancode) + * 入群方式:(受邀请入群 - invited 、 主动加入 - join、扫码入群 - scancode、话题分享链接 - topic_share_link、议题分享链接 - issue_share_link) */ private String enterGroupType; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupMemeberOperationService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupMemeberOperationService.java index ac04cf0742..32906be649 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupMemeberOperationService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupMemeberOperationService.java @@ -23,7 +23,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.modules.member.entity.GroupMemeberOperationEntity; import com.epmet.modules.member.entity.ResiGroupMemberEntity; import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; +import com.epmet.resi.group.dto.member.form.JoinGroupByShareLinkFormDTO; import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO; +import com.epmet.resi.group.dto.member.result.JoinGroupApplyRealTimeResultDTO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -122,4 +124,13 @@ public interface GroupMemeberOperationService extends BaseService implements GroupMemeberOperationService { @Autowired private GroupMemeberOperationRedis groupMemeberOperationRedis; + @Autowired + private ResiGroupMemberDao resiGroupMemberDao; + @Autowired + private TopicShareLinkRecordDao topicShareLinkRecordDao; + @Autowired + private GovIssueOpenFeignClient issueOpenFeignClient; + @Autowired + private ResiTopicDao topicDao; + @Autowired + private GroupMemeberOperationDao operationDao; + @Autowired + private ResiGroupService groupService; + @Autowired + private ResiGroupMemberService memberService; + @Autowired + private ResiGroupRedis groupRedis; + @Autowired + private EpmetUserOpenFeignClient userClient; + @Autowired + private TopicShareLinkVisitRecordDao topicShareLinkVisitRecordDao; @Override public PageData page(Map params) { @@ -143,4 +200,200 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl response = issueOpenFeignClient.shareLinkInfo(param.getShareLinkId()); + if(response.success() && null != response.getData()){ + groupId = topicDao.selectGroupIdByIssueId(response.getData().getIssueId()); + inviter = response.getData().getShareUserId(); + } + } + if(StringUtils.isBlank(groupId)){ + throw new RenException("没有找到分享链接对应的组Id"); + } + if(StringUtils.isBlank(inviter)){ + throw new RenException("没有找到邀请人Id"); + } + //查询是否在群内 + ResiGroupMemberDTO groupMember = resiGroupMemberDao.selectGroupMemberInfo(groupId, param.getUserId()); + if (null != groupMember && !MemberStateConstant.REMOVED.equals(groupMember.getStatus())) { + log.info("已经在群内,直接返回成功,但是不发送积分事件"); + result.setStatus("entered"); + return result; + } + + //先判断用户是否有在审核的入组申请,有的话直接给提示 + GroupMemeberOperationDTO groupMemeberOperationDTO = operationDao.selectLatestRecord(groupId, param.getUserId()); + if (null != groupMemeberOperationDTO && MemberStateConstant.UNDER_AUDITTING.equals(groupMemeberOperationDTO.getOperateStatus())) { + log.info("已存在待审核入组申请,不能重复审核"); + result.setStatus("auditing"); + return result; + } + + ResiGroupDTO resiGroupDTO = groupService.get(groupId); + if(null == resiGroupDTO){ + log.error("没有找到对应的组,组Id:{}",groupId); + throw new RenException("没有找到对应的组"); + } + GetRoleKeyListFormDTO roleParam = new GetRoleKeyListFormDTO(); + roleParam.setFromApp("resi"); + roleParam.setUserId(param.getUserId()); + roleParam.setGridId(resiGroupDTO.getGridId()); + Result> userRoleResponse = userClient.getUserRoleKeyList(roleParam); + if(!userRoleResponse.success() || CollectionUtils.isEmpty(userRoleResponse.getData())){ + throw new RenException("未找到当前用户的有效身份信息"); + } + + + //进组是否需要审核的逻辑 + GroupMemeberOperationDTO groupMemeberOperation = new GroupMemeberOperationDTO(); + groupMemeberOperation.setGroupId(groupId); + groupMemeberOperation.setCustomerUserId(param.getUserId()); + groupMemeberOperation.setEnterGroupType(StringUtils.equals("topic",param.getShareLinkType()) ? ModuleConstant.ENTER_GROUP_TYPE_TOPIC_LINK : ModuleConstant.ENTER_GROUP_TYPE_ISSUE_LINK); + groupMemeberOperation.setGroupInvitationId(param.getShareLinkId()); + groupMemeberOperation.setOperateUserId(param.getUserId()); + groupMemeberOperation.setOperateDes(StringUtils.equals("topic",param.getShareLinkType()) ? "通过话题分享链接申请入组" : "通过议题分享链接申请入组"); + + //入组审核开关是开启状态则需要组长审核 + if (StringUtils.equals(GroupStateConstant.AUDIT_SWITCH_OPEN , resiGroupDTO.getAuditSwitch())) { + groupMemeberOperation.setOperateStatus(MemberStateConstant.UNDER_AUDITTING); + save(groupMemeberOperation); + //给组长推送站内信 + //memberService.sendMessageToGroupLeader(resiGroupDTO, param.getUserId()); + result.setStatus("auditing"); + return result; + } + + UserRoleDTO userRoleDTO = getUserRoleDTO(userRoleResponse.getData()); + //新增一条邀请入群、直接审核通过的入群记录 + groupMemeberOperation.setOperateStatus(MemberStateConstant.APPROVED); + groupMemeberOperation.setOperateDes("通过分享链接入组,入组审核开关关闭,直接入组"); + save(groupMemeberOperation); + result.setStatus("entered"); + //发送积分事件 + boolean isNew = false; + + if(StringUtils.equals("topic",param.getShareLinkType())){ + TopicShareLinkVisitRecordEntity record = topicShareLinkVisitRecordDao.selectRecordByLinkIdAndInvitee(param.getShareLinkId(), param.getUserId()); + if(null == record){ + log.error("【{}】该用户入组方式为话题分享链接入组,但未查询到链接访问记录,链接Id【{}】",param.getUserId(),param.getShareLinkId()); + throw new RenException("未找到链接访问记录"); + } + if(NumConstant.ZERO == record.getIsInviteRegister()) isNew = true; + }else{ + Result visitRecordResult = issueOpenFeignClient.visitRecord(param.getShareLinkId(), param.getUserId()); + if(!visitRecordResult.success() || null == visitRecordResult.getData()){ + log.error("【{}】该用户入组方式为议题分享链接入组,但未查询到链接访问记录,链接Id【{}】",param.getUserId(),param.getShareLinkId()); + throw new RenException("未找到链接访问记录"); + } + if(!visitRecordResult.getData().getIfJoinGroup()){ + log.error("【{}】该用户入组方式为议题分享链接入组,但并不是通过该链接发起的入群申请,链接Id【{}】",param.getUserId(),param.getShareLinkId()); + throw new RenException("用户并非通过当前链接申请入组"); + } + if(NumConstant.ZERO == visitRecordResult.getData().getIsInviteRegister()) isNew = true; + } + + if(StringUtils.isNotBlank(inviter)){ + //mq的事件类型 + MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO(); + //事件code + mqBaseMsgDTO.setEventTag(isNew ? EventEnum.INVITE_NEW_RESIDENT_INTO_GROUP.getEventTag() : EventEnum.INVITE_RESIDENT_INTO_GROUP.getEventTag()); + mqBaseMsgDTO.setEventClass("resi_group"); + List pointEventMsgList = new ArrayList<>(); + BasePointEventMsg pointEventMsg = new BasePointEventMsg(); + pointEventMsg.setCustomerId(resiGroupDTO.getCustomerId()); + pointEventMsg.setUserId(inviter); + pointEventMsg.setActionFlag(MqConstant.PLUS); + pointEventMsg.setIsCommon(false); + pointEventMsg.setTargetDate(current); + pointEventMsg.setEventTag(mqBaseMsgDTO.getEventTag()); + pointEventMsg.setRemark("通过".concat(StringUtils.equals(param.getShareLinkType(),"topic") + ? "话题":"议题").concat("分享链接邀请").concat(isNew ? "新" : "").concat("用户进组")); + pointEventMsgList.add(pointEventMsg); + + mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); + Result sendResult = SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + if(!sendResult.success()){ + log.error((isNew ? "拉新用户入组事件发送失败" : "邀请已注册用户入组事件发送失败").concat(",参数:{}"),JSON.toJSONString(param)); + } + } + + //直接加入群成员关系表 + //如果是之前被移除的,则修改resi_group_member记录 + ResiGroupMemberDTO resiGroupMemberDTO = new ResiGroupMemberDTO(); + ResiGroupMemberDTO resiGroupMember = resiGroupMemberDao.selectGroupMemberInfo(groupId, param.getUserId()); + if (null != resiGroupMember) { + resiGroupMemberDTO.setId(resiGroupMember.getId()); + } + resiGroupMemberDTO.setCustomerUserId(groupMemeberOperation.getCustomerUserId()); + resiGroupMemberDTO.setResiGroupId(groupMemeberOperation.getGroupId()); + resiGroupMemberDTO.setGroupLeaderFlag(LeaderFlagConstant.GROUP_MEMBER); + resiGroupMemberDTO.setEnterGroupType(groupMemeberOperation.getEnterGroupType()); + resiGroupMemberDTO.setStatus(MemberStateConstant.APPROVED); + resiGroupMemberDTO.setCreatedBy(groupMemeberOperation.getCustomerUserId()); + memberService.saveOrUpdate(resiGroupMemberDTO); + //修改群统计值 + resiGroupMemberDao.updateResiGroupStatistical(groupMemeberOperation.getGroupId(), userRoleDTO); + ResiGroupInfoRedisDTO groupCache = + groupRedis.get(groupId); + if(null != groupCache && null != groupCache.getGroupStatisticalInfo()){ + groupCache.getGroupStatisticalInfo().setTotalMembers( + null == groupCache.getGroupStatisticalInfo().getTotalMembers() ? NumConstant.TWO : groupCache.getGroupStatisticalInfo().getTotalMembers() +NumConstant.ONE + ); + if(StringUtils.equals(userRoleDTO.getPartymemberFlag(),NumConstant.ONE_STR)) groupCache.getGroupStatisticalInfo().setTotalPartyMembers( + null == groupCache.getGroupStatisticalInfo().getTotalPartyMembers() ? NumConstant.ONE : groupCache.getGroupStatisticalInfo().getTotalPartyMembers()+NumConstant.ONE + ); + if(StringUtils.equals(userRoleDTO.getRegisteredResiFlag(),NumConstant.ONE_STR)) groupCache.getGroupStatisticalInfo().setTotalNormalMembers( + null == groupCache.getGroupStatisticalInfo().getTotalNormalMembers() ? NumConstant.TWO : groupCache.getGroupStatisticalInfo().getTotalNormalMembers()+NumConstant.ONE + ); + if(StringUtils.equals(userRoleDTO.getWarmHeartedFlag(),NumConstant.ONE_STR)) groupCache.getGroupStatisticalInfo().setTotalEarnestMembers( + null == groupCache.getGroupStatisticalInfo().getTotalEarnestMembers() ? NumConstant.ONE : groupCache.getGroupStatisticalInfo().getTotalEarnestMembers()+NumConstant.ONE + ); + groupRedis.set(groupCache); + } + //发送消息 + //this.sendMessageToLeader(formDTO, resiGroupDTO,groupInvitationDTO); + + return result; + } + + + private UserRoleDTO getUserRoleDTO(List userRoleList) { + UserRoleDTO userRoleDTO=new UserRoleDTO(); + for (String roleKey : userRoleList) { + if (EpmetRoleKeyConstant.PARTYMEMBER.equals(roleKey)) { + userRoleDTO.setPartymemberFlag(NumConstant.ONE_STR); + } + if (EpmetRoleKeyConstant.WARMHEARTED.equals(roleKey)) { + userRoleDTO.setWarmHeartedFlag(NumConstant.ONE_STR); + } + if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(roleKey)) { + userRoleDTO.setRegisteredResiFlag(NumConstant.ONE_STR); + } + } + return userRoleDTO; + } + + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index 76ec2024c2..0597db2951 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -21,20 +21,23 @@ import com.alibaba.fastjson.JSON; 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.AppClientConstant; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.constant.*; +import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; +import com.epmet.commons.tools.enums.EventEnum; 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.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SendMqMsgUtils; import com.epmet.constant.ReadFlagConstant; +import com.epmet.dto.IssueShareLinkVisitRecordDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.modules.constant.GroupMemberConstant; import com.epmet.modules.constant.UserMessageConstant; import com.epmet.modules.feign.EpmetUserFeignClient; @@ -48,7 +51,10 @@ import com.epmet.modules.member.entity.ResiGroupMemberEntity; import com.epmet.modules.member.redis.ResiGroupMemberRedis; import com.epmet.modules.member.service.GroupMemeberOperationService; import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.modules.topic.dao.ResiTopicDao; +import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; import com.epmet.modules.topic.service.ResiTopicService; +import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService; import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.constant.EnterGroupTypeConstant; import com.epmet.resi.group.constant.LeaderFlagConstant; @@ -111,7 +117,6 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl page(Map params) { @@ -245,6 +254,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl response = issueClient.visitRecord(groupMemeberOperationDTO.getGroupInvitationId(), groupMemeberOperationDTO.getCustomerUserId()); + if(response.success() && null != response){ + if(!response.getData().getIfJoinGroup()){ + logger.error("【{}】该用户入组方式为议题分享链接入组,但并不是通过该链接发起的入群申请,链接Id【{}】",groupMemeberOperationDTO.getCustomerUserId(),groupMemeberOperationDTO.getGroupInvitationId()); + return; + } + if(NumConstant.ZERO == response.getData().getIsInviteRegister()) isNew = true; + inviter = response.getData().getShareUserId(); + }else{ + logger.error("【{}】该用户入组方式为议题分享链接入组,但未查询到链接访问记录,链接Id【{}】",groupMemeberOperationDTO.getCustomerUserId(),groupMemeberOperationDTO.getGroupInvitationId()); + return; + } + } + if(StringUtils.isNotBlank(inviter)){ + //mq的事件类型 + MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO(); + mqBaseMsgDTO.setEventClass("resi_group"); + //事件code + mqBaseMsgDTO.setEventTag(isNew ? EventEnum.INVITE_NEW_RESIDENT_INTO_GROUP.getEventTag() : EventEnum.INVITE_RESIDENT_INTO_GROUP.getEventTag()); + List pointEventMsgList = new ArrayList<>(); + BasePointEventMsg pointEventMsg = new BasePointEventMsg(); + pointEventMsg.setCustomerId(groupCache.getCustomerId()); + pointEventMsg.setUserId(inviter); + pointEventMsg.setActionFlag(MqConstant.PLUS); + pointEventMsg.setIsCommon(false); + pointEventMsg.setTargetDate(groupMemeberOperationDTO.getCreatedTime()); + pointEventMsg.setEventTag(mqBaseMsgDTO.getEventTag()); + pointEventMsg.setRemark("通过".concat(StringUtils.equals(groupMemeberOperationDTO.getEnterGroupType(),ModuleConstant.ENTER_GROUP_TYPE_TOPIC_LINK) + ? "话题":"议题").concat("分享链接邀请").concat(isNew ? "新" : "").concat("用户进组")); + pointEventMsgList.add(pointEventMsg); + + mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); + Result result= SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + if(!result.success()){ + logger.error((isNew ? "拉新用户入组事件发送失败" : "邀请已注册用户入组事件发送失败").concat(",参数:{}"),JSON.toJSONString(agreeApplyFormDTO)); + } + } } /** diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java index 820dbc5821..d6e3bf75a6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java @@ -1,19 +1,27 @@ package com.epmet.modules.topic.controller; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.result.FirstTopicShiftedToIssueApplicationResultDTO; import com.epmet.modules.topic.service.ResiTopicService; +import com.epmet.resi.group.dto.scanapicallback.VoiceScanCallBackContentFormDTO; import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.TopicInfoDTO; import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.result.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpStatus; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.List; /** @@ -22,7 +30,7 @@ import java.util.List; * @Author wangc * @date 2020.03.31 13:03 */ - +@Slf4j @RestController @RequestMapping("topic") public class ResiTopicController { @@ -350,4 +358,48 @@ public class ResiTopicController { } + /** + * @return com.epmet.commons.tools.utils.Result + * @param checksum 字符串格式,由用户uid + seed + content拼成字符串,通过SHA256算法生成。用户UID即阿里云账号ID,可以在阿里云控制台查询。为防篡改,您可以在获取到推送结果时,按上述算法生成字符串,与checksum做一次校验。说明 用户UID必须是阿里云账号的UID,而不是RAM用户的UID。 + * @param content content:JSON字符串格式,请自行解析反转成JSON对象。关于content结果的示例,请参见查询异步检测结果的返回示例。 + * @author yinzuomei + * @description 测试语音异步检测回调方法 + * @Date 2020/12/11 9:07 + **/ + @PostMapping("callBackPublishTopic") + public Result callBackPublishTopic(@RequestParam("checksum") String checksum, @RequestParam("content") String content, HttpServletResponse response){ + // 原因是因为传参的关系,使字符串中保留这"\"线,可以使用String.replaceAll("\\\\","");将所有的"\"线替换为空串 + String contentStr=content.replaceAll("\\\\",""); + List formDTOList=new ArrayList<>(); + if(contentStr.startsWith("[")){ + log.info("入参content为数组:"+ JSON.toJSONString(contentStr,true)); + List list= JSONArray.parseArray(content.replaceAll("\\\\",""), VoiceScanCallBackContentFormDTO.class); + if(!CollectionUtils.isEmpty(list)){ + formDTOList.addAll(list); + } + }else if(contentStr.startsWith("{")){ + VoiceScanCallBackContentFormDTO formDTO= JSON.parseObject(contentStr, VoiceScanCallBackContentFormDTO.class); + log.info("入参content为对象:"+JSON.toJSONString(formDTO,true)); + formDTOList.add(formDTO); + } + formDTOList.forEach(dto->{ + log.info(dto.toString()); + }); + //TODO 判断检测任务结果,执行后续任务 + response.setStatus(HttpStatus.SC_OK); + return new Result<>(); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取话题附件信息 + **/ + @PostMapping(value = "topicattachmentlist") + public Result topicAttachmentList(@RequestBody TopicAttachmentFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, TopicAttachmentFormDTO.TopicForm.class); + return new Result().ok(topicService.topicAttachmentList(formDTO)); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java new file mode 100644 index 0000000000..89081680fd --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java @@ -0,0 +1,183 @@ +/** + * 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.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ExcelUtils; +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.excel.TopicDraftExcel; +import com.epmet.modules.topic.service.TopicDraftService; +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.MyAuditingListResultDTO; +import com.epmet.resi.group.dto.topic.result.TopicAuditResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 话题草稿内容表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +@RestController +@RequestMapping("topicdraft") +public class TopicDraftController { + + @Autowired + private TopicDraftService topicDraftService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = topicDraftService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + TopicDraftDTO data = topicDraftService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody TopicDraftDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + topicDraftService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody TopicDraftDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + topicDraftService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + topicDraftService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = topicDraftService.list(params); + 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 + */ + @PostMapping("auditlist") + public Result> auditList(@RequestBody TopicAuditFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + List result = topicDraftService.auditList(formDTO); + return new Result>().ok(result); + } + + /** + * 话题草稿详情 + * @author zhaoqifeng + * @date 2020/12/18 14:55 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("detail") + public Result detail(@RequestBody DraftDetailFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + DraftDetailResultDTO result = topicDraftService.detail(formDTO); + return new Result().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(@LoginUser TokenDto tokenDto, @RequestBody AuditDraftTopicFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + topicDraftService.audit(tokenDto, formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 个人中心-我发表的话题-审核中列表 + **/ + @PostMapping(value = "myauditinglist") + public Result> myAuditingList(@LoginUser TokenDto tokenDto, @RequestBody MyAuditingListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MyAuditingListFormDTO.AuditingTopicForm.class); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(topicDraftService.myAuditingList(formDTO)); + } +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java new file mode 100644 index 0000000000..d8e9614ff2 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java @@ -0,0 +1,111 @@ +package com.epmet.modules.topic.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +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.TopicShareLinkRecordService; +import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; +import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; +import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; +import com.epmet.resi.group.dto.topic.form.TopicVisitFormDTO; +import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; +import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; +import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; +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 2020-12-18 + */ +@RestController +@RequestMapping("topicsharelink") +public class TopicShareLinkRecordController { + + @Autowired + private TopicShareLinkRecordService topicShareLinkRecordService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = topicShareLinkRecordService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + TopicShareLinkRecordDTO data = topicShareLinkRecordService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody TopicShareLinkRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + topicShareLinkRecordService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody TopicShareLinkRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + topicShareLinkRecordService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + topicShareLinkRecordService.delete(ids); + return new Result(); + } + + /** + * @Description 分享话题邀请ID + * @Param createUrlFormDTO + * @author zxc + * @date 2020/12/18 上午10:14 + */ + @PostMapping("createurl") + public Result getCreateUrlId(@RequestBody CreateUrlFormDTO createUrlFormDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(createUrlFormDTO, CreateUrlFormDTO.CreateUrlForm.class); + return new Result().ok(topicShareLinkRecordService.getCreateUrlId(createUrlFormDTO,tokenDto)); + } + + /** + * @Description 查询话题所属小组 + * @Param formDTO + * @author zxc + * @date 2020/12/18 下午2:08 + */ + @PostMapping("topicbelonggroup") + public Result selectTopicBelongGroup(@RequestBody TopicBelongGroupFormDTO formDTO){ + return new Result().ok(topicShareLinkRecordService.selectTopicBelongGroup(formDTO)); + } + + /** + * @Description 分享话题id获取信息 + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2020/12/18 下午3:34 + */ + @PostMapping("visit") + public Result topicVisit(@RequestBody TopicVisitFormDTO formDTO,@LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, TopicVisitFormDTO.TopicVisitForm.class); + return new Result().ok(topicShareLinkRecordService.topicVisit(formDTO,tokenDto)); + } + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkVisitRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkVisitRecordController.java new file mode 100644 index 0000000000..cf134cfea6 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkVisitRecordController.java @@ -0,0 +1,83 @@ +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.TopicShareLinkVisitRecordService; +import com.epmet.resi.group.dto.topic.TopicShareLinkVisitRecordDTO; +import com.epmet.resi.group.dto.topic.form.SharableTopicAndInviteeFormDTO; +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 2020-12-18 + */ +@RestController +@RequestMapping("topicsharelinkvisitrecord") +public class TopicShareLinkVisitRecordController { + + @Autowired + private TopicShareLinkVisitRecordService topicShareLinkVisitRecordService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = topicShareLinkVisitRecordService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + TopicShareLinkVisitRecordDTO data = topicShareLinkVisitRecordService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody TopicShareLinkVisitRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + topicShareLinkVisitRecordService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody TopicShareLinkVisitRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + topicShareLinkVisitRecordService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + topicShareLinkVisitRecordService.delete(ids); + return new Result(); + } + + /** + * @Description 检查邀请关系,如果确实存在邀请关系则返回邀请人Id + * 符合条件: + * ① 链接Id对应 + * ② 邀请人Id对应 + * ③ 邀请人在被邀请时的状态为陌生人 + * @param param + * @return com.epmet.commons.tools.utils.Result + * @author wangc + * @date 2020.12.18 14:53 + */ + @PostMapping("checkinviterelationship") + public Result checkInviteRelationship(@RequestBody SharableTopicAndInviteeFormDTO param){ + return new Result().ok(topicShareLinkVisitRecordService.checkInviteRelationship(param)); + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicAttachmentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicAttachmentDao.java index c58c7e59db..ae67648e60 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicAttachmentDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicAttachmentDao.java @@ -20,7 +20,9 @@ package com.epmet.modules.topic.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.topic.entity.ResiTopicAttachmentEntity; +import com.epmet.resi.group.dto.topic.ResiTopicAttachmentDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -51,4 +53,10 @@ public interface ResiTopicAttachmentDao extends BaseDao selectTopicAttachmentList(@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/dao/ResiTopicDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java index 6590732567..5a89917fa2 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java @@ -193,4 +193,13 @@ public interface ResiTopicDao extends BaseDao { */ List selectTopicIdsByGroup(@Param("groupId") String groupId); + String selectGroupIdByIssueId(@Param("issueId") String issueId); + + /** + * @Description 查询此人今日发表话题数量 + * @Param userId + * @author zxc + * @date 2020/12/23 上午10:02 + */ + Integer selectPublishTopicCountByUserId(@Param("userId")String userId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftAttachmentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftAttachmentDao.java new file mode 100644 index 0000000000..2cf15e3aff --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftAttachmentDao.java @@ -0,0 +1,45 @@ +/** + * 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.TopicDraftAttachmentEntity; +import com.epmet.resi.group.dto.topic.TopicDraftAttachmentDTO; +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 2020-12-17 + */ +@Mapper +public interface TopicDraftAttachmentDao extends BaseDao { + /** + * 获取附件列表 + * @author zhaoqifeng + * @date 2020/12/18 16:44 + * @param topicDraftId + * @param type + * @return java.util.List + */ + List selectFileList(@Param("topicDraftId") String topicDraftId, @Param("type") String type); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftDao.java new file mode 100644 index 0000000000..099a93ffe7 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftDao.java @@ -0,0 +1,68 @@ +/** + * 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.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.result.MyAuditingListResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +import java.util.List; + +/** + * 话题草稿内容表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +@Mapper +public interface TopicDraftDao extends BaseDao { + /** + * 获取小组待审核/已驳回列表 + * @author zhaoqifeng + * @date 2020/12/18 15:47 + * @param groupId + * @param status + * @return com.epmet.resi.group.dto.topic.TopicDraftDTO + */ + List 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 + * @return + * @Author sun + * @Description 个人中心-我发表的话题-审核中列表 + **/ + List selectAuditingList(MyAuditingListFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftOperationDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftOperationDao.java new file mode 100644 index 0000000000..83350cea13 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftOperationDao.java @@ -0,0 +1,33 @@ +/** + * 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.TopicDraftOperationEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 话题草稿操作日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +@Mapper +public interface TopicDraftOperationDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftScanTaskDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftScanTaskDao.java new file mode 100644 index 0000000000..7181ae4308 --- /dev/null +++ b/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 + *

+ * 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.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 { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkRecordDao.java new file mode 100644 index 0000000000..1f3a2ea96e --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkRecordDao.java @@ -0,0 +1,35 @@ +package com.epmet.modules.topic.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; +import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 话题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Mapper +public interface TopicShareLinkRecordDao extends BaseDao { + + /** + * @Description 根据话题ID查询对应信息 + * @Param topicId + * @author zxc + * @date 2020/12/18 上午10:28 + */ + TopicVisitResultDTO selectTopicInfoById(@Param("topicId") String topicId); + + /** + * @Description 校验此人此话题是否存在邀请记录 + * @Param topicId + * @Param userId + * @author zxc + * @date 2020/12/18 上午11:10 + */ + String checkRecord(@Param("topicId") String topicId,@Param("userId") String userId); + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkVisitRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkVisitRecordDao.java new file mode 100644 index 0000000000..a59d4427a0 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkVisitRecordDao.java @@ -0,0 +1,46 @@ +package com.epmet.modules.topic.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 话题分享链接访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Mapper +public interface TopicShareLinkVisitRecordDao extends BaseDao { + + /** + * @Description 根据邀请Id和邀请人Id查询邀请人的Id + * @param linkId + * @param invitee + * @return String + * @author wangc + * @date 2020.12.18 14:00 + */ + String selectByLinkIdAndInvitee(@Param("linkId") String linkId, @Param("invitee") String invitee); + + /** + * @Description 根据邀请Id和邀请人Id查询邀请人的Id + * @param linkId + * @param invitee + * @return String + * @author wangc + * @date 2020.12.18 14:00 + */ + TopicShareLinkVisitRecordEntity selectRecordByLinkIdAndInvitee(@Param("linkId") String linkId, @Param("invitee") String invitee); + + /** + * @Description 修改是否通过链接注册居民由0改为1 + * @param linkId + * @param invitee + * @return int + * @author wangc + * @date 2020.12.18 15:46 + */ + int updateInviteRegister(@Param("linkId") String linkId, @Param("invitee") String invitee); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicAttachmentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicAttachmentEntity.java index ca5980cffc..6b63177921 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicAttachmentEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicAttachmentEntity.java @@ -68,4 +68,9 @@ public class ResiTopicAttachmentEntity extends BaseEpmetEntity { * */ private Integer sort; + /** + * 语音或视频时长,秒 + * */ + private Integer duration; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftAttachmentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftAttachmentEntity.java new file mode 100644 index 0000000000..f29df3c174 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftAttachmentEntity.java @@ -0,0 +1,92 @@ +/** + * 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.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-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("topic_draft_attachment") +public class TopicDraftAttachmentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 话题草稿id + */ + private String topicDraftId; + + /** + * 客户id + */ + private String customerId; + + /** + * 附件名(uuid随机生成) + */ + private String attachmentName; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String attachmentFormat; + + /** + * 附件类型((图片 - image、视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * 附件地址url + */ + private String attachmentUrl; + + /** + * 排序字段(按附件类型分组排序) + */ + private Integer sort; + + /** + * 附件状态(审核中:auditing; + auto_passed: 自动通过; + review:结果不确定,需要人工审核; + block: 结果违规; + rejected:人工审核驳回; + approved:人工审核通过) + 现在图片是同步审核的,所以图片只有auto_passed一种状态 + */ + private String status; + + /** + * 语音或视频时长,秒 + * */ + private Integer duration; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftEntity.java new file mode 100644 index 0000000000..513e03c4cf --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftEntity.java @@ -0,0 +1,116 @@ +/** + * 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.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-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("topic_draft") +public class TopicDraftEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 小组Id + */ + private String groupId; + + /** + * 话题内容 + */ + private String topicContent; + + /** + * 话题草稿状态(审核中:auditing; + auto_passed: 自动通过; + review:结果不确定,需要人工审核; + block: 结果违规; + rejected:人工审核驳回; + approved:人工审核通过) + */ + private String draftStatus; + + /** + * 草稿审核理由 + */ + private String draftReason; + + /** + * 省 + */ + private String province; + + /** + * 市 + */ + private String city; + + /** + * 区 + */ + private String area; + + /** + * 地址 + */ + private String address; + + /** + * 经度 + */ + private String longitude; + + /** + * 维度 + */ + private String dimension; + + /** + * 发布成功后的话题id + */ + private String topicId; + + /** + * 创建者是否可见(0是 1否) + */ + private String isSee; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftOperationEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftOperationEntity.java new file mode 100644 index 0000000000..e1092bbaf5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftOperationEntity.java @@ -0,0 +1,66 @@ +/** + * 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.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-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("topic_draft_operation") +public class TopicDraftOperationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 话题草稿id + */ + private String topicDraftId; + + /** + * 操作类型:submit:提交发布; + auto_passed: 自动审核-通过; + review:自动审核-结果不确定,需要人工审核; + block: 自动审核-结果违规; + rejected:人工审核驳回; + approved:人工审核通过 + */ + private String operateType; + + /** + * 操作时的备注,比如驳回理由 + */ + private String remark; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftScanTaskEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicDraftScanTaskEntity.java new file mode 100644 index 0000000000..9e0cdbbaea --- /dev/null +++ b/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 + *

+ * 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.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; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkRecordEntity.java new file mode 100644 index 0000000000..e7dd0448c4 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkRecordEntity.java @@ -0,0 +1,68 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 话题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("topic_share_link_record") +public class TopicShareLinkRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 话题所属网格ID + */ + private String gridId; + + /** + * 小组ID + */ + private String groupId; + + /** + * 话题ID + */ + private String topicId; + + /** + * 分享人ID(当前登录用户) + */ + private String shareUserId; + + /** + * 邀请内容 + */ + private String inviteContent; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkVisitRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkVisitRecordEntity.java new file mode 100644 index 0000000000..44edb3624a --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkVisitRecordEntity.java @@ -0,0 +1,66 @@ +/** + * 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.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_share_link_visit_record") +public class TopicShareLinkVisitRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 分享人【邀请人】ID + */ + private String shareUserId; + + /** + * 被邀请人ID + */ + private String inviteeUserId; + + /** + * 话题分享链接表id + */ + private String shareLinkRecId; + + /** + * 是否邀请注册:0:是,1:不是 + */ + private Integer isInviteRegister; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/.gitkeep b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/TopicDraftAttachmentExcel.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/TopicDraftAttachmentExcel.java new file mode 100644 index 0000000000..f16f960fb4 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/TopicDraftAttachmentExcel.java @@ -0,0 +1,83 @@ +/** + * 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.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 话题草稿附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +@Data +public class TopicDraftAttachmentExcel { + + @Excel(name = "附件id") + private String id; + + @Excel(name = "话题草稿id") + private String topicDraftId; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "附件名(uuid随机生成)") + private String attachmentName; + + @Excel(name = "文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)") + private String attachmentFormat; + + @Excel(name = "附件类型((图片 - image、视频 - video、 语音 - voice、 文档 - doc))") + private String attachmentType; + + @Excel(name = "附件地址url") + private String attachmentUrl; + + @Excel(name = "排序字段(按附件类型分组排序)") + private Integer sort; + + @Excel(name = "附件状态(审核中:auditing;auto_passed: 自动通过;review:结果不确定,需要人工审核;"+ +"block: 结果违规;rejected:人工审核驳回;approved:人工审核通过)现在图片是同步审核的,所以图片只有auto_passed一种状态") + private String status; + + @Excel(name = "语音或视频时长,秒") + private Integer duration; + + @Excel(name = "删除标记 0:未删除,1:已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/TopicDraftExcel.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/TopicDraftExcel.java new file mode 100644 index 0000000000..2a7d97c8b9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/TopicDraftExcel.java @@ -0,0 +1,98 @@ +/** + * 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.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 话题草稿内容表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +@Data +public class TopicDraftExcel { + + @Excel(name = "话题草稿id") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "网格ID") + private String gridId; + + @Excel(name = "小组Id") + private String groupId; + + @Excel(name = "话题内容") + private String topicContent; + + @Excel(name = "话题草稿状态(审核中:auditing; auto_passed: 自动通过;review:结果不确定,需要人工审核;"+ +"block: 结果违规;rejected:人工审核驳回;approved:人工审核通过)") + private String draftStatus; + + @Excel(name = "草稿审核理由") + private String draftReason; + + @Excel(name = "省") + private String province; + + @Excel(name = "市") + private String city; + + @Excel(name = "区 ") + private String area; + + @Excel(name = "地址") + private String address; + + @Excel(name = "经度") + private String longitude; + + @Excel(name = "维度") + private String dimension; + + @Excel(name = "发布成功后的话题id") + private String topicId; + + @Excel(name = "创建者是否可见(0是 1否)") + private String isSee; + + @Excel(name = "删除标记 0:未删除,1:已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "话题发布人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/TopicDraftOperationExcel.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/TopicDraftOperationExcel.java new file mode 100644 index 0000000000..428b9c4140 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/excel/TopicDraftOperationExcel.java @@ -0,0 +1,68 @@ +/** + * 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.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 话题草稿操作日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +@Data +public class TopicDraftOperationExcel { + + @Excel(name = "话题草稿操作日志id") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "话题草稿id") + private String topicDraftId; + + @Excel(name = "操作类型:submit:提交发布; auto_passed: 自动审核-通过;review:自动审核-结果不确定,需要人工审核;"+ +"block: 自动审核-结果违规;rejected:人工审核驳回;approved:人工审核通过") + private String operateType; + + @Excel(name = "操作时的备注,比如驳回理由") + private String remark; + + @Excel(name = "删除标记 0:未删除,1:已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "操作人,API审核结果,存储为SCAN_USER或者APP_USER") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java index 53140e4fef..347f960f6e 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java @@ -324,4 +324,11 @@ public interface ResiTopicService extends BaseService { */ List getTopicIdsByGroup(String groupId); + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取话题附件信息 + **/ + TopicAttachmentResultDTO topicAttachmentList(TopicAttachmentFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftAttachmentService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftAttachmentService.java new file mode 100644 index 0000000000..193ee4ee09 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftAttachmentService.java @@ -0,0 +1,105 @@ +/** + * 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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.topic.entity.TopicDraftAttachmentEntity; +import com.epmet.resi.group.dto.topic.TopicDraftAttachmentDTO; + +import java.util.List; +import java.util.Map; + +/** + * 话题草稿附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +public interface TopicDraftAttachmentService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TopicDraftAttachmentDTO + * @author generator + * @date 2020-12-17 + */ + TopicDraftAttachmentDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-17 + */ + void save(TopicDraftAttachmentDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-17 + */ + void update(TopicDraftAttachmentDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-17 + */ + void delete(String[] ids); + + /** + * 获取附件列表 + * @author zhaoqifeng + * @date 2020/12/18 16:42 + * @param topicDraftId + * @param type + * @return java.util.List + */ + List getFileList(String topicDraftId, String type); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftOperationService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftOperationService.java new file mode 100644 index 0000000000..f118236a8d --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftOperationService.java @@ -0,0 +1,95 @@ +/** + * 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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.topic.entity.TopicDraftOperationEntity; +import com.epmet.resi.group.dto.topic.TopicDraftOperationDTO; + +import java.util.List; +import java.util.Map; + +/** + * 话题草稿操作日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +public interface TopicDraftOperationService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TopicDraftOperationDTO + * @author generator + * @date 2020-12-17 + */ + TopicDraftOperationDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-17 + */ + void save(TopicDraftOperationDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-17 + */ + void update(TopicDraftOperationDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-17 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftScanTaskService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftScanTaskService.java new file mode 100644 index 0000000000..795b939b90 --- /dev/null +++ b/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 + *

+ * 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; + +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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-18 + */ + List list(Map 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); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java new file mode 100644 index 0000000000..87b99bc51c --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java @@ -0,0 +1,156 @@ +/** + * 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.service; + +import com.epmet.commons.mybatis.service.BaseService; +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.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.result.MyAuditingListResultDTO; + +import java.util.List; +import java.util.Map; + +/** + * 话题草稿内容表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +public interface TopicDraftService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TopicDraftDTO + * @author generator + * @date 2020-12-17 + */ + TopicDraftDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-17 + */ + void save(TopicDraftDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-17 + */ + void update(TopicDraftDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-17 + */ + 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 + */ + List 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(TokenDto tokenDto, AuditDraftTopicFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 个人中心-我发表的话题-审核中列表 + **/ + List myAuditingList(MyAuditingListFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java new file mode 100644 index 0000000000..c52f23d862 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java @@ -0,0 +1,110 @@ +package com.epmet.modules.topic.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; +import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; +import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; +import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; +import com.epmet.resi.group.dto.topic.form.TopicVisitFormDTO; +import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; +import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; +import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; + +import java.util.List; +import java.util.Map; + +/** + * 话题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +public interface TopicShareLinkRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TopicShareLinkRecordDTO + * @author generator + * @date 2020-12-18 + */ + TopicShareLinkRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void save(TopicShareLinkRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void update(TopicShareLinkRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-18 + */ + void delete(String[] ids); + + /** + * @Description 分享话题邀请ID + * @Param createUrlFormDTO + * @author zxc + * @date 2020/12/18 上午10:14 + */ + CreateUrlResultDTO getCreateUrlId(CreateUrlFormDTO createUrlFormDTO, TokenDto tokenDto); + + /** + * @Description 查询话题所属小组 + * @Param formDTO + * @author zxc + * @date 2020/12/18 下午2:08 + */ + TopicBelongGroupResultDTO selectTopicBelongGroup(TopicBelongGroupFormDTO formDTO); + + /** + * @Description 分享话题id获取信息 + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2020/12/18 下午3:34 + */ + TopicVisitResultDTO topicVisit(TopicVisitFormDTO formDTO,TokenDto tokenDto); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkVisitRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkVisitRecordService.java new file mode 100644 index 0000000000..c07eabcc6c --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkVisitRecordService.java @@ -0,0 +1,98 @@ +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.TopicShareLinkVisitRecordEntity; +import com.epmet.resi.group.dto.topic.TopicShareLinkVisitRecordDTO; +import com.epmet.resi.group.dto.topic.form.SharableTopicAndInviteeFormDTO; + +import java.util.List; +import java.util.Map; + +/** + * 话题分享链接访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +public interface TopicShareLinkVisitRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TopicShareLinkVisitRecordDTO + * @author generator + * @date 2020-12-18 + */ + TopicShareLinkVisitRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void save(TopicShareLinkVisitRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void update(TopicShareLinkVisitRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-18 + */ + void delete(String[] ids); + + /** + * @Description 校验邀请人与被邀请人是否存在邀请关系,如果存在则返回邀请人Id,否则返回空 + * @param param + * @return java.lang.String + * @author wangc + * @date 2020.12.18 13:56 + */ + String checkInviteRelationship(SharableTopicAndInviteeFormDTO param); + + /** + * @Description 通过邀请链接Id和被邀请人Id查询出访问记录 + * @param linkId + * @param invitee + * @return com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity + * @author wangc + * @date 2020.12.22 09:20 + */ + TopicShareLinkVisitRecordEntity getByLinkIdAndInvitee(String linkId,String invitee); +} \ 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/.gitkeep b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 9b0d2cf52f..9c8955199b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -18,12 +18,17 @@ package com.epmet.modules.topic.service.impl; +import com.alibaba.fastjson.JSON; 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.constant.MqConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; +import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; @@ -33,10 +38,7 @@ 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.DateUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.ScanContentUtils; +import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.OrgInfoConstant; import com.epmet.dto.CustomerGridDTO; @@ -44,11 +46,8 @@ import com.epmet.dto.IssueApplicationDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.dto.result.CommonDataFilterResultDTO; -import com.epmet.dto.result.IssueInitiatorResultDTO; -import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.feign.GovIssueOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.modules.constant.GroupMemberConstant; import com.epmet.modules.constant.ResiGroupRedisKeys; import com.epmet.modules.feign.EpmetUserFeignClient; @@ -80,12 +79,13 @@ import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO; import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO; +import com.epmet.resi.group.dto.topic.ResiTopicAttachmentDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.TopicInfoDTO; import com.epmet.resi.group.dto.topic.form.CheckTopicPublisherFormDTO; import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO; -import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.form.IssueShiftedFromTopicFormDTO; +import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.result.CheckTopicPublisherResultDTO; import com.epmet.resi.group.dto.topic.result.GovTopicIssueInfoResultDTO; import com.epmet.resi.group.dto.topic.result.*; @@ -101,7 +101,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import javax.swing.text.html.Option; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -357,6 +356,39 @@ public class ResiTopicServiceImpl extends BaseServiceImpl pointEventMsgList = new ArrayList<>(); + BasePointEventMsg pointEventMsg = new BasePointEventMsg(); + ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(resiTopicPublishFormDTO.getGroupId()); + if (null == resiGroupInfoRedisDTO){ + ResiGroupEntity resiGroupEntity = resiGroupDao.selectById(resiTopicPublishFormDTO.getGroupId()); + if (null == resiGroupEntity){ + throw new RenException(TopicConstant.GROUP_INFO_FAILURE); + } + pointEventMsg.setCustomerId(resiGroupInfoRedisDTO.getCustomerId()); + } + pointEventMsg.setUserId(tokenDto.getUserId()); + // 加分 + pointEventMsg.setActionFlag(MqConstant.PLUS); + pointEventMsg.setIsCommon(false); + pointEventMsg.setEventTag(mqBaseMsgDTO.getEventTag()); + pointEventMsgList.add(pointEventMsg); + + mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); + Result msgResult= SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + if(!msgResult.success()){ + logger.error(TopicConstant.CREATE_TOPIC_FAILURE); + } + } return new Result(); } @@ -1822,6 +1854,41 @@ public class ResiTopicServiceImpl extends BaseServiceImpl list = resiTopicAttachmentDao.selectTopicAttachmentList(formDTO.getTopicId()); + if(list.size() docList = new LinkedList<>(); + LinkedList voiceList = new LinkedList<>(); + LinkedList videoList = new LinkedList<>(); + list.forEach(l->{ + if(TopicConstant.FILE_DOC.equals(l.getAttachmentType())){ + docList.add(l.getAttachmentUrl()); + } + if(TopicConstant.FILE_VOICE.equals(l.getAttachmentType())){ + voiceList.add(l.getAttachmentUrl()); + } + if(TopicConstant.FILE_VIDEO.equals(l.getAttachmentType())){ + videoList.add(l.getAttachmentUrl()); + } + }); + resultDTO.setDocList(docList); + resultDTO.setVoiceList(voiceList); + resultDTO.setVideoList(videoList); + return resultDTO; + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftAttachmentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftAttachmentServiceImpl.java new file mode 100644 index 0000000000..6a2550bfa2 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftAttachmentServiceImpl.java @@ -0,0 +1,120 @@ +/** + * 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.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.TopicDraftAttachmentDao; +import com.epmet.modules.topic.entity.TopicDraftAttachmentEntity; +import com.epmet.modules.topic.service.TopicDraftAttachmentService; +import com.epmet.resi.group.dto.topic.TopicDraftAttachmentDTO; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 话题草稿附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +@Service +public class TopicDraftAttachmentServiceImpl extends BaseServiceImpl implements TopicDraftAttachmentService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicDraftAttachmentDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicDraftAttachmentDTO.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 TopicDraftAttachmentDTO get(String id) { + TopicDraftAttachmentEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TopicDraftAttachmentDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TopicDraftAttachmentDTO dto) { + TopicDraftAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, TopicDraftAttachmentEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TopicDraftAttachmentDTO dto) { + TopicDraftAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, TopicDraftAttachmentEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 获取附件列表 + * + * @param topicDraftId + * @param type + * @return java.util.List + * @author zhaoqifeng + * @date 2020/12/18 16:42 + */ + @Override + public List getFileList(String topicDraftId, String type) { + List list = baseDao.selectFileList(topicDraftId, type); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list; + } + +} \ 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/TopicDraftOperationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftOperationServiceImpl.java new file mode 100644 index 0000000000..1fcf022738 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftOperationServiceImpl.java @@ -0,0 +1,99 @@ +/** + * 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.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.TopicDraftOperationDao; +import com.epmet.modules.topic.entity.TopicDraftOperationEntity; +import com.epmet.modules.topic.service.TopicDraftOperationService; +import com.epmet.resi.group.dto.topic.TopicDraftOperationDTO; +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-17 + */ +@Service +public class TopicDraftOperationServiceImpl extends BaseServiceImpl implements TopicDraftOperationService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicDraftOperationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicDraftOperationDTO.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 TopicDraftOperationDTO get(String id) { + TopicDraftOperationEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TopicDraftOperationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TopicDraftOperationDTO dto) { + TopicDraftOperationEntity entity = ConvertUtils.sourceToTarget(dto, TopicDraftOperationEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TopicDraftOperationDTO dto) { + TopicDraftOperationEntity entity = ConvertUtils.sourceToTarget(dto, TopicDraftOperationEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ 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/TopicDraftScanTaskServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftScanTaskServiceImpl.java new file mode 100644 index 0000000000..8fbe37abcb --- /dev/null +++ b/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 + *

+ * 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.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 implements TopicDraftScanTaskService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicDraftScanTaskDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicDraftScanTaskDTO.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 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)); + } + +} \ 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/TopicDraftServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java new file mode 100644 index 0000000000..f8cf0892da --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java @@ -0,0 +1,675 @@ +/** + * 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.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.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.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.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; +import com.epmet.dto.result.AllGridsByUserIdResultDTO; +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.entity.*; +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.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.ResiTopicDTO; +import com.epmet.resi.group.dto.topic.TopicDraftAttachmentDTO; +import com.epmet.resi.group.dto.topic.TopicDraftDTO; +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.TopicAuditResultDTO; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.*; +import java.util.stream.Collectors; + +/** + * 话题草稿内容表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-17 + */ +@Service +@Slf4j +public class TopicDraftServiceImpl extends BaseServiceImpl implements TopicDraftService { + private static Logger logger = LoggerFactory.getLogger(TopicDraftServiceImpl.class); + + @Autowired + 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 + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicDraftDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicDraftDTO.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 TopicDraftDTO get(String id) { + TopicDraftEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TopicDraftDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TopicDraftDTO dto) { + TopicDraftEntity entity = ConvertUtils.sourceToTarget(dto, TopicDraftEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TopicDraftDTO dto) { + TopicDraftEntity entity = ConvertUtils.sourceToTarget(dto, TopicDraftEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 个人中心-我发表的话题-审核中列表 + **/ + @Override + public List myAuditingList(MyAuditingListFormDTO formDTO) { + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + //1.获取当前用户创建的还未成为话题的话题草稿数据 + List list = baseDao.selectAuditingList(formDTO); + if(list.size()(); + } + + //2.获取网格名称,封装数据并返回 【组织-网格】 + List gridIds = list.stream().map(l -> l.getGridId()).collect(Collectors.toList()); + Result> rst = govOrgOpenFeignClient.getGridListByGridIds(gridIds); + if (!rst.success()) { + logger.error("查询【个人中心-我发表的话题-审核中列表】,根据网格id查询网格名称失败, InternalMsg:{},Msg:{}", rst.getInternalMsg(), rst.getMsg()); + } else { + List gridList = rst.getData(); + if (CollectionUtils.isNotEmpty(gridList)) { + HashMap gridIdAndNames = new HashMap<>(); + gridList.stream().forEach(g -> gridIdAndNames.put(g.getGridId(), g.getGridName())); + list.stream().forEach(pt -> pt.setReleaseGridName(gridIdAndNames.get(pt.getGridId()))); + } + } + 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 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 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 + * @author zhaoqifeng + * @date 2020/12/18 14:34 + */ + @Override + public List auditList(TopicAuditFormDTO formDTO) { + List 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()); + if (TopicConstant.AUDITING.equals(entity.getDraftStatus()) || TopicConstant.REVIEW.equals(entity.getDraftStatus())) { + result.setStatus(TopicConstant.AUDITING); + } else if (TopicConstant.BLOCK.equals(entity.getDraftStatus()) || TopicConstant.REJECTED.equals(entity.getDraftStatus())) { + result.setStatus(TopicConstant.REJECTED); + } + //2.查询话题图片附件 + List imageUrls = + topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), TopicConstant.IMAGE).stream().map(TopicDraftAttachmentDTO::getAttachmentUrl).collect(Collectors.toList()); + result.setImageList(imageUrls); + + //3.查询话题音频附件 + List voiceUrls = topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), TopicConstant.VOICE).stream().map(TopicDraftAttachmentDTO::getAttachmentUrl).collect(Collectors.toList()); + 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(TokenDto tokenDto, AuditDraftTopicFormDTO formDTO) { + TopicDraftEntity entity = new TopicDraftEntity(); + entity.setId(formDTO.getTopicDraftId()); + entity.setDraftReason(formDTO.getReason()); + entity.setDraftStatus(formDTO.getAuditType()); + baseDao.updateById(entity); + if (TopicConstant.APPROVED.equals(formDTO.getAuditType())) { + TopicDraftEntity draft = baseDao.selectById(formDTO.getTopicDraftId()); + //将草稿存入话题表 + ResiTopicEntity resiTopic = ConvertUtils.sourceToTarget(entity, ResiTopicEntity.class); + resiTopic.setId(null); + resiTopic.setStatus(TopicConstant.PUBLISHMENT); + resiTopicDao.insert(resiTopic); + //将草稿附件存入附件表 + List attachmentList = topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), null); + List topicAttachments = ConvertUtils.sourceToTarget(attachmentList, ResiTopicAttachmentEntity.class); + topicAttachments.forEach(item -> { + item.setId(null); + }); + resiTopicAttachmentDao.insertBatch(topicAttachments); + //将音频状态改为approved + List voiceList = + attachmentList.stream().filter(item -> TopicConstant.VOICE.equals(item.getAttachmentType()) && TopicConstant.REVIEW.equals(item.getStatus())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(voiceList)) { + voiceList.forEach(item -> item.setStatus(TopicConstant.APPROVED)); + topicDraftAttachmentService.updateBatchById(ConvertUtils.sourceToTarget(voiceList, TopicDraftAttachmentEntity.class)); + } + } + //记录操作记录 + TopicDraftOperationDTO operationDTO = new TopicDraftOperationDTO(); + operationDTO.setTopicDraftId(formDTO.getTopicDraftId()); + operationDTO.setOperateType(formDTO.getAuditType()); + operationDTO.setCreatedBy(tokenDto.getUserId()); + topicDraftOperationService.save(operationDTO); + } + + /** + * 保存话题 + * @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 wrapper = new QueryWrapper<>(); + wrapper.eq(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); + wrapper.eq(TopicConstant.RESI_GROUP_ID,formDTO.getGroupId()); + List 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{ + //没有相应的群组缓存信息 + } + + } + +} \ 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/TopicShareLinkRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java new file mode 100644 index 0000000000..9d88bc7896 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java @@ -0,0 +1,194 @@ +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.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.member.dao.GroupMemeberOperationDao; +import com.epmet.modules.member.dao.ResiGroupMemberDao; +import com.epmet.modules.topic.dao.TopicShareLinkRecordDao; +import com.epmet.modules.topic.dao.TopicShareLinkVisitRecordDao; +import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; +import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; +import com.epmet.modules.topic.service.TopicShareLinkRecordService; +import com.epmet.resi.group.constant.TopicShareConstant; +import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; +import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; +import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; +import com.epmet.resi.group.dto.topic.form.TopicVisitFormDTO; +import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; +import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; +import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +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 TopicShareLinkRecordServiceImpl extends BaseServiceImpl implements TopicShareLinkRecordService { + + @Autowired + private TopicShareLinkVisitRecordDao visitRecordDao; + @Autowired + private ResiGroupMemberDao resiGroupMemberDao; + @Autowired + private GroupMemeberOperationDao groupMemeberOperationDao; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicShareLinkRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicShareLinkRecordDTO.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 TopicShareLinkRecordDTO get(String id) { + TopicShareLinkRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TopicShareLinkRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TopicShareLinkRecordDTO dto) { + TopicShareLinkRecordEntity entity = ConvertUtils.sourceToTarget(dto, TopicShareLinkRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TopicShareLinkRecordDTO dto) { + TopicShareLinkRecordEntity entity = ConvertUtils.sourceToTarget(dto, TopicShareLinkRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Description 分享话题邀请ID + * @Param createUrlFormDTO + * @author zxc + * @date 2020/12/18 上午10:14 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public CreateUrlResultDTO getCreateUrlId(CreateUrlFormDTO form, TokenDto tokenDto) { + // 校验此人此话题是否存在邀请记录 存在直接返回 + String shareLinkId = baseDao.checkRecord(form.getTopicId(), tokenDto.getUserId()); + if (StringUtils.isNotBlank(shareLinkId)){ + return new CreateUrlResultDTO(shareLinkId); + } + // 查询话题信息 + TopicVisitResultDTO topicInfo = baseDao.selectTopicInfoById(form.getTopicId()); + if (null == topicInfo){ + throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_INFO); + } + TopicShareLinkRecordEntity entity = new TopicShareLinkRecordEntity(); + entity.setCustomerId(topicInfo.getCustomerId()); + entity.setGridId(topicInfo.getGridId()); + entity.setGroupId(topicInfo.getGroupId()); + entity.setTopicId(form.getTopicId()); + entity.setShareUserId(tokenDto.getUserId()); + entity.setInviteContent(null); + // 插入链接记录 + baseDao.insert(entity); + return new CreateUrlResultDTO(entity.getId()); + } + + /** + * @Description 查询话题所属小组 + * @Param formDTO + * @author zxc + * @date 2020/12/18 下午2:08 + */ + @Override + public TopicBelongGroupResultDTO selectTopicBelongGroup(TopicBelongGroupFormDTO formDTO) { + TopicVisitResultDTO topicInfo = baseDao.selectTopicInfoById(formDTO.getTopicId()); + if (null == topicInfo){ + throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_BELONG_GROUP); + } + TopicBelongGroupResultDTO resultDTO = new TopicBelongGroupResultDTO(); + resultDTO.setGroupId(topicInfo.getGroupId()); + return resultDTO; + } + + /** + * @Description 分享话题id获取信息 + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2020/12/18 下午3:34 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public TopicVisitResultDTO topicVisit(TopicVisitFormDTO formDTO, TokenDto tokenDto) { + // 根据分享ID查询分享信息 + TopicShareLinkRecordEntity linkRecord = baseDao.selectById(formDTO.getShareLinkId()); + if (null == linkRecord){ + throw new RenException(TopicShareConstant.NOT_EXIST_INVITE_RECORD); + } + TopicShareLinkVisitRecordEntity entity = new TopicShareLinkVisitRecordEntity(); + entity.setCustomerId(linkRecord.getCustomerId()); + entity.setShareUserId(linkRecord.getShareUserId()); + entity.setInviteeUserId(tokenDto.getUserId()); + entity.setShareLinkRecId(formDTO.getShareLinkId()); + entity.setIsInviteRegister(NumConstant.ONE); + // 插入访问记录 + visitRecordDao.insert(entity); + // 查询记录对应的话题信息 + TopicVisitResultDTO result = baseDao.selectTopicInfoById(linkRecord.getTopicId()); + if (null == result){ + throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_INFO); + } + // 查询是否在组内,在组内的话,是否存在入组审核的状态为false + Integer userInGroup = resiGroupMemberDao.checkUserInGroup(tokenDto.getUserId(), result.getGroupId()); + if (userInGroup > NumConstant.ZERO){ + result.setAwaitAudit(false); + result.setInGroup(true); + }else { + result.setInGroup(false); + // 查询是否存在入组审核记录 + Integer awaitAudit = groupMemeberOperationDao.checkAwaitAudit(tokenDto.getUserId(), result.getGroupId()); + result.setAwaitAudit(awaitAudit > NumConstant.ZERO ? true : false); + } + return result; + } + +} \ 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/TopicShareLinkVisitRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java new file mode 100644 index 0000000000..34d9be5bb5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java @@ -0,0 +1,111 @@ +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.TopicShareLinkVisitRecordDao; +import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; +import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService; +import com.epmet.resi.group.dto.topic.TopicShareLinkVisitRecordDTO; +import com.epmet.resi.group.dto.topic.form.SharableTopicAndInviteeFormDTO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 话题分享链接访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Service +public class TopicShareLinkVisitRecordServiceImpl extends BaseServiceImpl implements TopicShareLinkVisitRecordService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicShareLinkVisitRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicShareLinkVisitRecordDTO.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 TopicShareLinkVisitRecordDTO get(String id) { + TopicShareLinkVisitRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TopicShareLinkVisitRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TopicShareLinkVisitRecordDTO dto) { + TopicShareLinkVisitRecordEntity entity = ConvertUtils.sourceToTarget(dto, TopicShareLinkVisitRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TopicShareLinkVisitRecordDTO dto) { + TopicShareLinkVisitRecordEntity entity = ConvertUtils.sourceToTarget(dto, TopicShareLinkVisitRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Description 校验邀请人与被邀请人是否存在邀请关系,如果存在则返回邀请人Id,否则返回空 + * @param param + * @return java.lang.String + * @author wangc + * @date 2020.12.18 13:56 + */ + @Override + public String checkInviteRelationship(SharableTopicAndInviteeFormDTO param) { + String inviterId = baseDao.selectByLinkIdAndInvitee(param.getShareLinkId(),param.getInviteeId()); + if(StringUtils.isNotBlank(inviterId)) baseDao.updateInviteRegister(param.getShareLinkId(),param.getInviteeId()); + return inviterId; + } + + /** + * @Description 通过邀请链接Id和被邀请人Id查询出访问记录 + * @param linkId + * @param invitee + * @return com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity + * @author wangc + * @date 2020.12.22 09:20 + */ + @Override + public TopicShareLinkVisitRecordEntity getByLinkIdAndInvitee(String linkId, String invitee) { + return baseDao.selectRecordByLinkIdAndInvitee(linkId,invitee); + } + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java index 118ed1f5a7..37f1a3b290 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java @@ -368,4 +368,16 @@ public interface ModuleConstant extends Constant { * 群邀请二维码跳转页面 */ String CODE_INVITE_PAGE = "pages/group/group/invitation/invitation"; + + String TOPIC_CONTENT_AND_VOICE_IS_NULL = "请输入话题内容或语音"; + + /** + * 通过话题分享链接进组 + */ + String ENTER_GROUP_TYPE_TOPIC_LINK = "topic_share_link"; + + /** + * 通过议题分享链接进组 + */ + String ENTER_GROUP_TYPE_ISSUE_LINK = "issue_share_link"; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml b/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml index 42cd377706..c1f88e4b85 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml @@ -126,6 +126,8 @@ openapi: method: imgSyncScan: /imgSyncScan textSyncScan: /textSyncScan + voiceAsyncScan: /voiceAsyncScan + voiceResults: /voiceResults thread: # 线程池配置 @@ -145,4 +147,12 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,每超过30秒,打印一次错误日志 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,每超过30秒,打印一次错误日志 + +#亿联云消息网关 +elink: + mq: + appId: @elink.mq.appId@ #项目接入亿联云的应用Id + token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret + host: @elink.mq.host@ #亿联云消息网关服务地址 + sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径 \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.10__createDraft.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.10__createDraft.sql new file mode 100644 index 0000000000..fb1b48fa46 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.10__createDraft.sql @@ -0,0 +1,76 @@ +CREATE TABLE `topic_draft` ( + `ID` varchar(64) NOT NULL COMMENT '话题草稿id', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `GRID_ID` varchar(64) NOT NULL COMMENT '网格ID', + `GROUP_ID` varchar(64) NOT NULL COMMENT '小组Id', + `TOPIC_CONTENT` varchar(3000) DEFAULT NULL COMMENT '话题内容', + `DRAFT_STATUS` varchar(32) NOT NULL COMMENT '话题草稿状态(审核中:auditing; \r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;\r\nrejected:人工审核驳回;\r\napproved:人工审核通过)', + `DRAFT_REASON` varchar(128) DEFAULT NULL COMMENT '草稿审核理由', + `PROVINCE` varchar(32) DEFAULT NULL COMMENT '省', + `CITY` varchar(32) DEFAULT NULL COMMENT '市', + `AREA` varchar(32) DEFAULT NULL COMMENT '区 ', + `ADDRESS` varchar(255) NOT NULL COMMENT '地址', + `LONGITUDE` varchar(32) DEFAULT NULL COMMENT '经度', + `DIMENSION` varchar(32) DEFAULT NULL COMMENT '维度', + `TOPIC_ID` varchar(64) DEFAULT NULL COMMENT '发布成功后的话题id', + `IS_SEE` varchar(1) NOT NULL COMMENT '创建者是否可见(0是 1否)', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '话题发布人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='话题草稿内容表'; + +CREATE TABLE `topic_draft_attachment` ( + `ID` varchar(64) NOT NULL COMMENT '附件id', + `TOPIC_DRAFT_ID` varchar(64) NOT NULL COMMENT '话题草稿id', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `ATTACHMENT_NAME` varchar(64) DEFAULT NULL COMMENT '附件名(uuid随机生成)', + `ATTACHMENT_FORMAT` varchar(64) DEFAULT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)', + `ATTACHMENT_TYPE` varchar(64) NOT NULL COMMENT '附件类型((图片 - image、视频 - video、 语音 - voice、 文档 - doc))', + `ATTACHMENT_URL` varchar(255) NOT NULL COMMENT '附件地址url', + `SORT` int(1) NOT NULL COMMENT '排序字段(按附件类型分组排序)', + `STATUS` varchar(32) NOT NULL COMMENT '附件状态(审核中:auditing; \r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;\r\nrejected:人工审核驳回;\r\napproved:人工审核通过)\r\n现在图片是同步审核的,所以图片只有auto_passed一种状态', + `DURATION` int(11) DEFAULT NULL COMMENT '语音或视频时长,秒', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='话题草稿附件表'; + +CREATE TABLE `topic_draft_operation` ( + `ID` varchar(64) NOT NULL COMMENT '话题草稿操作日志id', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `TOPIC_DRAFT_ID` varchar(64) NOT NULL COMMENT '话题草稿id', + `OPERATE_TYPE` varchar(64) NOT NULL COMMENT '操作类型:submit:提交发布;\r\nauto_passed: 自动审核-通过;\r\nreview:自动审核-结果不确定,需要人工审核;\r\nblock: 自动审核-结果违规;\r\nrejected:人工审核驳回;\r\napproved:人工审核通过', + `REMARK` varchar(255) DEFAULT NULL COMMENT '操作时的备注,比如驳回理由', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '操作人,API审核结果,存储为SCAN_USER或者APP_USER', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='话题草稿操作日志表'; + +CREATE TABLE `topic_draft_scan_task` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `TOPIC_DRAFT_ID` varchar(64) NOT NULL COMMENT '话题草稿Id', + `TOPIC_DRAFT_ATTACHMENT_ID` varchar(64) NOT NULL COMMENT '话题草稿附件表Id,对应dataId', + `TASK_ID` varchar(64) NOT NULL COMMENT '阿里云审核任务Id', + `STATUS` varchar(32) NOT NULL COMMENT '审核状态【auditing: 审核中;\r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;】', + `ATTACHMENT_TYPE` varchar(64) NOT NULL COMMENT '附件类型(视频 - video、 语音 - voice)', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '操作人,API审核结果,存储为SCAN_USER或者APP_USER', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='话题附件检测任务表'; \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.11__topicShare.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.11__topicShare.sql new file mode 100644 index 0000000000..7fef4d7c45 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.11__topicShare.sql @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS `topic_share_link_record`; +CREATE TABLE `topic_share_link_record` +( + `ID` varchar(64) NOT NULL COMMENT '邀请ID', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `GRID_ID` varchar(64) NOT NULL COMMENT '话题所属网格ID', + `GROUP_ID` varchar(64) NOT NULL COMMENT '小组ID', + `TOPIC_ID` varchar(64) NOT NULL COMMENT '话题ID', + `SHARE_USER_ID` varchar(64) NOT NULL COMMENT '分享人ID(当前登录用户)', + `INVITE_CONTENT` varchar(255) DEFAULT NULL COMMENT '邀请内容', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除状态 0:正常,1:删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='话题分享链接表'; + +#================================================================================= + +DROP TABLE IF EXISTS `topic_share_link_visit_record`; +CREATE TABLE `topic_share_link_visit_record` +( + `ID` varchar(64) NOT NULL, + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `SHARE_USER_ID` varchar(64) NOT NULL COMMENT '分享人【邀请人】ID', + `INVITEE_USER_ID` varchar(64) NOT NULL COMMENT '被邀请人ID', + `SHARE_LINK_REC_ID` varchar(64) NOT NULL COMMENT '话题分享链接表id', + `IS_INVITE_REGISTER` int(11) NOT NULL COMMENT '是否邀请注册:0:是,1:不是;\n默认为1,完成注册后,回填此字段', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除状态,0:正常,1:删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='话题分享链接访问记录表'; \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.9__alter_resi_topic_attachment.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.9__alter_resi_topic_attachment.sql new file mode 100644 index 0000000000..938161ca0e --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.9__alter_resi_topic_attachment.sql @@ -0,0 +1,3 @@ +ALTER TABLE `resi_topic_attachment` +MODIFY COLUMN `SORT` int(1) NOT NULL COMMENT '排序字段' AFTER `ATTACHMENT_URL`, +ADD COLUMN `DURATION` int(11) UNSIGNED ZEROFILL NULL DEFAULT 0 COMMENT '语音或视频时长,秒' AFTER `SORT`; diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupMemeberOperationDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupMemeberOperationDao.xml index 0205d7e5c5..c47f80f4d3 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupMemeberOperationDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupMemeberOperationDao.xml @@ -28,4 +28,15 @@ gmo.CREATED_TIME DESC LIMIT 1 + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml index f125ebb551..92408b540b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml @@ -154,4 +154,15 @@ + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/.gitkeep b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml index 56744b02de..9ec26817f1 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml @@ -108,5 +108,23 @@ + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml index f51b0f7216..8ddcf2ffe0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml @@ -527,5 +527,29 @@ AND GROUP_ID = #{groupId} AND STATUS != 'hidden' + + + + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftAttachmentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftAttachmentDao.xml new file mode 100644 index 0000000000..cf72d88a8d --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftAttachmentDao.xml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftDao.xml new file mode 100644 index 0000000000..a956df46d7 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftDao.xml @@ -0,0 +1,48 @@ + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftOperationDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftOperationDao.xml new file mode 100644 index 0000000000..c25307d1c7 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftOperationDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftScanTaskDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftScanTaskDao.xml new file mode 100644 index 0000000000..1623b9f5a1 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftScanTaskDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkRecordDao.xml new file mode 100644 index 0000000000..cd75277141 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkRecordDao.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkVisitRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkVisitRecordDao.xml new file mode 100644 index 0000000000..01343324ee --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkVisitRecordDao.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + UPDATE + topic_share_link_visit_record + SET + is_invite_register = 0 + WHERE + del_flag = '0' + AND + share_link_rec_id = #{linkId} + AND + invitee_user_id = #{invitee} + + \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java index 8d7aa5d4d0..387294c23b 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java @@ -21,4 +21,10 @@ public class SysConstant { public static final String CODE = "code"; public static final String DATA = "data"; + + + /** + * 任务正在执行中,建议您等待一段时间(例如5s)后再查询结果。 + */ + public static final int PROCESSING=280; } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java new file mode 100644 index 0000000000..7ad96f3171 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java @@ -0,0 +1,66 @@ +package com.epmet.openapi.scan.common.enu; + +import java.util.ArrayList; +import java.util.List; + +/** + * 阿里检测结果的分类字典 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/18 14:04 + */ +public enum LabelEnum { + NORMAL("normal", "正常文本"), + SPAM("spam", "含垃圾信息"), + AD("ad", "广告"), + POLITICS("politics","涉政"), + TERRORISM("terrorism","暴恐"), + ABUSE("abuse","辱骂"), + PORN("porn","色情"), + FLOOD("flood","灌水"), + CONTRABAND("contraband","违禁"), + MEANINGLESS("meaningless","无意义"), + CUSTOMIZED("customized","自定义"); + + private String code; + private String desc; + + LabelEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static List getLabelEnumList() { + List result = new ArrayList<>(); + LabelEnum[] values = LabelEnum.values(); + for (LabelEnum v : values) { + result.add(v.getCode()); + } + return result; + } + + public static String getDesc(String code) { + LabelEnum[] businessModeEnums = values(); + for (LabelEnum labelEnum : businessModeEnums) { + if (labelEnum.getCode().equals(code)) { + return labelEnum.getDesc(); + } + } + return ""; + } + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java new file mode 100644 index 0000000000..777b92f0d7 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java @@ -0,0 +1,47 @@ +package com.epmet.openapi.scan.common.enu; + +import java.util.ArrayList; +import java.util.List; + +/** + * 语音异步检测场景 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 10:12 + */ +public enum VoiceSceneEnum { + ANTISPAM("antispam", "检测场景,取值:antispam"); + + private String code; + private String desc; + + VoiceSceneEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static List getVoiceSceneList() { + List result = new ArrayList<>(); + VoiceSceneEnum[] values = VoiceSceneEnum.values(); + for (VoiceSceneEnum v : values) { + result.add(v.getCode()); + } + return result; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java index 3904011b00..2939bd62eb 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java @@ -26,4 +26,13 @@ public class RedisKeys { public static String getWhiteList () { return rootPrefix.concat("openapi:scan:whitelist"); } + + /** + * desc: 语音检测任务,异步回调,需要根据taskId获取存储seed的Key + * @param taskId 提交检测任务API接口返回的taskId eg:1001 + * @return epmet:openapi:scan:voice:seed:1001 + */ + public static String getVoiceScanSeedKey(String taskId){ + return rootPrefix.concat("openapi:scan:voice:seed:").concat(taskId); + } } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java index 8a0b268e50..27965201ac 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java @@ -5,13 +5,19 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.openapi.scan.service.impl.ScanService; import com.epmet.openapi.scan.support.param.ImgScanParam; import com.epmet.openapi.scan.support.param.TextScanParam; +import com.epmet.openapi.scan.support.param.VoiceAsyncScanParam; import com.epmet.openapi.scan.support.result.ImgAsyncScanResult; import com.epmet.openapi.scan.support.result.SyncScanResult; +import com.epmet.openapi.scan.support.result.VoiceAsyncScanResult; +import com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * @author jianjun liu * @email liujianjun@yunzongnet.com @@ -52,4 +58,27 @@ public class ScanController { public Result ImgAsyncScan(@RequestBody ImgScanParam param) { return null;//scanService.sendASyncImgScan(param); } + + + /** + * @description 语音异步检测 + * @Date 2020/12/9 9:14 + **/ + @PostMapping("voiceAsyncScan") + public Result voiceAsyncScan(@RequestBody VoiceAsyncScanParam param){ + ValidatorUtils.validateEntity(param); + return scanService.sendVoiceAsyncScan(param); + } + + /** + * @param taskIds 要查询的异步检测任务的taskId列表。数组中的元素个数不超过100个 + * @author yinzuomei + * @description 语音异步检测结果查询 + * @Date 2020/12/9 11:16 + **/ + @PostMapping("voiceResults") + public Result> voiceResults(@RequestBody List taskIds){ + return scanService.voiceResults(taskIds); + } + } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java index f48937bc42..d238ef95e5 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java @@ -3,7 +3,12 @@ package com.epmet.openapi.scan.service.impl; import com.epmet.commons.tools.utils.Result; import com.epmet.openapi.scan.support.param.ImgScanParam; import com.epmet.openapi.scan.support.param.TextScanParam; +import com.epmet.openapi.scan.support.param.VoiceAsyncScanParam; import com.epmet.openapi.scan.support.result.SyncScanResult; +import com.epmet.openapi.scan.support.result.VoiceAsyncScanResult; +import com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult; + +import java.util.List; /** * desc:内容扫描接口 @@ -27,4 +32,20 @@ public interface ScanService { * @return */ public Result sendSyncImgScan(ImgScanParam imgScanParam); + + /** + * 语音异步检测 + * + * @param param + * @return com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult + */ + Result sendVoiceAsyncScan(VoiceAsyncScanParam param); + + /** + * 语音异步检测结果查询 + * + * @param taskIds 要查询的异步检测任务的taskId列表。数组中的元素个数不超过100个 + * @return com.epmet.openapi.scan.support.result.VoiceAsyncScanResult + */ + Result> voiceResults(List taskIds); } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java index 2a5db725e2..6bd9caf156 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -6,32 +6,35 @@ import com.alibaba.fastjson.JSONObject; import com.aliyuncs.AcsRequest; import com.aliyuncs.green.model.v20180509.ImageSyncScanRequest; import com.aliyuncs.green.model.v20180509.TextScanRequest; +import com.aliyuncs.green.model.v20180509.VoiceAsyncScanRequest; +import com.aliyuncs.green.model.v20180509.VoiceAsyncScanResultsRequest; import com.aliyuncs.http.FormatType; import com.aliyuncs.http.HttpResponse; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.openapi.scan.common.constant.SysConstant; -import com.epmet.openapi.scan.common.enu.ImgSceneEnum; -import com.epmet.openapi.scan.common.enu.SuggestionEnum; -import com.epmet.openapi.scan.common.enu.SysResponseEnum; -import com.epmet.openapi.scan.common.enu.TextSceneEnum; +import com.epmet.openapi.scan.common.enu.*; import com.epmet.openapi.scan.common.exception.ExecuteHttpException; +import com.epmet.openapi.scan.common.redis.RedisKeys; import com.epmet.openapi.scan.common.util.IAcsClientUtil; -import com.epmet.openapi.scan.support.param.ImgScanParam; -import com.epmet.openapi.scan.support.param.ImgTask; -import com.epmet.openapi.scan.support.param.TextScanParam; -import com.epmet.openapi.scan.support.param.TextTask; -import com.epmet.openapi.scan.support.result.ScanTaskResult; -import com.epmet.openapi.scan.support.result.SceneDetailResult; -import com.epmet.openapi.scan.support.result.SyncScanResult; +import com.epmet.openapi.scan.support.param.*; +import com.epmet.openapi.scan.support.result.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.ListUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.io.UnsupportedEncodingException; +import java.util.ArrayList; import java.util.List; +import java.util.UUID; /** * @author jianjun liu @@ -45,7 +48,8 @@ public class ScanServiceImpl implements ScanService { private String regionId; @Value("${aliyun.green.bizType}") private String bizType; - + @Autowired + private RedisTemplate redisTemplate; @Override public Result sendTextScan(TextScanParam textScanParam) { //默认参数 @@ -263,4 +267,240 @@ public class ScanServiceImpl implements ScanService { throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); } } + + /** + * @author yinzuomei + * @description 语音异步检测 + * @Date 2020/12/9 10:02 + */ + @Override + public Result sendVoiceAsyncScan(VoiceAsyncScanParam voiceAsyncScanParam) { + //检测对象不能为空,且最多支持100个元素 + List voiceTasks = voiceAsyncScanParam.getTasks(); + if (CollectionUtils.isEmpty(voiceTasks) || voiceTasks.size() > SysConstant.MAX_TASK_SIZE) { + return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), + SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg().concat(SysConstant.MAX_TASK_SIZE.toString())); + } + + //默认参数 + voiceAsyncScanParam.setScenes(VoiceSceneEnum.getVoiceSceneList()); + voiceAsyncScanParam.setBizType(bizType); + // 如果是语音流检测,则修改为true。现在默认为音频文件检测false + voiceAsyncScanParam.setLive(false); + voiceAsyncScanParam.setSeed(UUID.randomUUID().toString().replace("-", "")); + + VoiceAsyncScanRequest voiceAsyncScanRequest=getVoiceAsyncScanRequest(); + + try { + voiceAsyncScanRequest.setHttpContent(JSON.toJSONString(voiceAsyncScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); + } catch (UnsupportedEncodingException e) { + log.error("sendVoiceAsyncScan parse param exception", e); + return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); + } + log.info("语音异步检测入参:"+JSON.toJSONString(voiceAsyncScanParam,true)); + List taskList; + try { + taskList = executeSyncVoice(voiceAsyncScanRequest); + log.info("语音异步检测返参taskList:"+JSON.toJSONString(taskList,true)); + } catch (ExecuteHttpException e) { + log.error("sendVoiceAsyncScan execute Exception", e); + return new Result().error(e.getCode(), e.getMsg()); + } + //成功返回 + VoiceAsyncScanTaskResult resultDto=new VoiceAsyncScanTaskResult(); + resultDto.setSeed(voiceAsyncScanParam.getSeed()); + List successList = new ArrayList<>(); + List failedList = new ArrayList<>(); + taskList.forEach(taskDetail -> { + if (HttpStatus.SC_OK == taskDetail.getCode()) { + successList.add(taskDetail); + } else { + failedList.add(taskDetail); + } + }); + resultDto.setSuccessTasks(successList); + resultDto.setFailTasks(failedList); + resultDto.setAllSuccess(resultDto.isAllSuccess()); + if (StringUtils.isNotBlank(voiceAsyncScanParam.getCallback())) { + // 存储seed和 任务id、dataId的关系 用于回调鉴权 + log.info("need to save seed and taskId、dataId的关系"); + ValueOperations valueOperations=redisTemplate.opsForValue(); + taskList.forEach(task -> { + String seedKey = RedisKeys.getVoiceScanSeedKey(task.getTaskId()); + valueOperations.set(seedKey,voiceAsyncScanParam.getSeed()); + }); + } + return new Result().ok(resultDto); + } + + /** + * @param + * @author yinzuomei + * @description 构造语音异步检测请求对象 + * @Date 2020/12/9 10:44 + **/ + private VoiceAsyncScanRequest getVoiceAsyncScanRequest() { + VoiceAsyncScanRequest voiceAsyncScanRequest = new VoiceAsyncScanRequest(); + // 指定api返回格式 + voiceAsyncScanRequest.setAcceptFormat(FormatType.JSON); + // 指定请求方法 + voiceAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); + voiceAsyncScanRequest.setEncoding(SysConstant.UTF8); + voiceAsyncScanRequest.setRegionId(regionId); + voiceAsyncScanRequest.setConnectTimeout(3000); + voiceAsyncScanRequest.setReadTimeout(6000); + return voiceAsyncScanRequest; + } + + /** + * @param voiceAsyncScanRequest + * @author yinzuomei + * @description 解析返参 + * @Date 2020/12/9 10:44 + **/ + private List executeSyncVoice(AcsRequest voiceAsyncScanRequest) { + try { + HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(voiceAsyncScanRequest); + + if (httpResponse.isSuccess()) { + + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + //后面注释掉此日志 + log.info("VoiceAsyncScanRequest原生接口返参:" + JSON.toJSONString(scrResponse, true)); + + if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { + + //获取data列表 + JSONArray dataResults = scrResponse.getJSONArray(SysConstant.DATA); + List resultList = dataResults.toJavaList(VoiceAsyncScanTaskDataDTO.class); + //成功返回 + return resultList; + + } else { + + log.warn("executeSyncVoice detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + + } else { + log.warn("executeSyncVoice response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + + } catch (Exception e) { + log.error("executeSyncVoice exception IAcsClientUtil do action exception", e); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); + } + } + + + /** + * @param taskIds 要查询的异步检测任务的taskId列表。数组中的元素个数不超过100个 + * @author yinzuomei + * @description 语音异步检测结果查询 + * @Date 2020/12/9 11:17 + **/ + @Override + public Result> voiceResults(List taskIds) { + //检测对象不能为空,且最多支持100个元素 + if (CollectionUtils.isEmpty(taskIds) || taskIds.size() > SysConstant.MAX_TASK_SIZE) { + return new Result>().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), + SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg().concat(SysConstant.MAX_TASK_SIZE.toString())); + } + + VoiceAsyncScanResultsRequest request=getVoiceAsyncScanResultsRequest(); + try { + request.setHttpContent(JSON.toJSONString(taskIds).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); + } catch (UnsupportedEncodingException e) { + log.error("voiceResults parse param exception", e); + return new Result>().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); + } + + // log.info("语音异步检测结果查询入参:"+JSON.toJSONString(taskIds,true)); + + try { + HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(request); + if (httpResponse.isSuccess()) { + + JSONObject scrResponse=JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + //后面注释掉此返参 + log.info("VoiceAsyncScanResultsRequest原生接口返参:"+JSON.toJSONString(scrResponse, true)); + if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { + //获取data列表 + JSONArray dataResults = scrResponse.getJSONArray(SysConstant.DATA); + List resultList = dataResults.toJavaList(VoiceAsyncScanResult.class); + List resultData=processVoiceAsyncScanResult(resultList); + //成功返回 + return new Result>().ok(resultData); + + }else{ + + log.warn("voiceResults detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + + } else { + log.warn("语音异步检测结果查询预警 getVoiceAsyncScanResult response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } catch (Exception e) { + log.error("voiceResults exception IAcsClientUtil do action exception", e); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); + } + + } + + private List processVoiceAsyncScanResult(List resultList) { + List list = new ArrayList<>(); + for (VoiceAsyncScanResult voiceAsyncScanResult : resultList) { + if (SysConstant.PROCESSING == voiceAsyncScanResult.getCode()) { + //280:表示处理中,需要继续轮询 + continue; + } + VoiceAsyncScanResult dto = ConvertUtils.sourceToTarget(voiceAsyncScanResult, VoiceAsyncScanResult.class); + if (HttpStatus.SC_OK == voiceAsyncScanResult.getCode()) { + if (!CollectionUtils.isEmpty(voiceAsyncScanResult.getResults()) && voiceAsyncScanResult.getResults().size() > NumConstant.ZERO) { + //目前只有一个检测场景,所以只判断返回来的第一个场景 + VoiceAsyncScanResultDTO voiceAsyncScanResultDTO = voiceAsyncScanResult.getResults().get(NumConstant.ZERO); + if (null != voiceAsyncScanResultDTO) { + dto.setLabel(voiceAsyncScanResultDTO.getLabel()); + dto.setLabelDesc(LabelEnum.getDesc(voiceAsyncScanResultDTO.getLabel())); + dto.setSuggestion(voiceAsyncScanResultDTO.getSuggestion()); + } + } + } else if(HttpStatus.SC_NOT_FOUND == voiceAsyncScanResult.getCode()) { + dto.setSuggestion(SuggestionEnum.REVIEW.getCode()); + dto.setLabel(NumConstant.EMPTY_STR); + dto.setLabelDesc("智能检测任务失败,结果已失效," + SuggestionEnum.REVIEW.getDesc()); + }else{ + //其他:表示任务失败 + dto.setSuggestion(SuggestionEnum.REVIEW.getCode()); + dto.setLabel(NumConstant.EMPTY_STR); + dto.setLabelDesc("智能检测任务失败," + SuggestionEnum.REVIEW.getDesc()); + } + list.add(dto); + } + return list; + } + + private VoiceAsyncScanResultsRequest getVoiceAsyncScanResultsRequest(){ + VoiceAsyncScanResultsRequest getResultsRequest = new VoiceAsyncScanResultsRequest(); + // 指定API返回格式。 + getResultsRequest.setAcceptFormat(FormatType.JSON); + // 指定请求方法。 + getResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); + getResultsRequest.setEncoding(SysConstant.UTF8); + getResultsRequest.setRegionId(regionId); + /** + * 请务必设置超时时间。 + */ + getResultsRequest.setConnectTimeout(3000); + getResultsRequest.setReadTimeout(6000); + return getResultsRequest; + } + } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java new file mode 100644 index 0000000000..baa8e51be0 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java @@ -0,0 +1,68 @@ +package com.epmet.openapi.scan.support.param; + +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * 音频审查 入参 + * 参考文档:https://help.aliyun.com/document_detail/89630.html?spm=a2c4g.11186623.2.12.51a32dbfW6AdqV#reference-bcf-3nk-z2b + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 9:07 + */ +@Data +public class VoiceAsyncScanParam implements Serializable { + private static final long serialVersionUID = 3408043673247901184L; + + /** + * 是否开启回调 + */ + private Boolean openCallBack; + + /** + * 不必填 + * 该字段用于标识您的业务场景。您可以通过内容安全控制台创建业务场景(具体操作,请参见自定义机审标准),或者提交工单联系我们帮助您创建业务场景。 + */ + private String bizType; + + /** + * 必填 + * 检测场景,取值:antispam。 + */ + private List scenes; + + /** + * 不必填 + * 是否为语音流(例如直播流)检测。取值: + * true:表示语音流检测。 + * false(默认):表示音频文件检测。 + */ + private Boolean live; + + /** + * 不必填 + * 是否为近线检测模式。 取值: + * true:表示近线检测模式。近线检测模式下,您提交的任务不保证能够实时处理,但是可以排队并在24小时内开始检测。 + * false(默认):表示实时检测模式。对于超过了并发路数限制的检测请求会直接拒绝。 + * 说明 该参数仅适用于音频文件检测,不适用于语音流检测。 + */ + private Boolean offline; + + /** + * 异步检测结果回调地址,执行异步审查内容时 必填 + */ + private String callback; + + /** + * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填 + */ + private String seed; + + @Valid + @NotEmpty(message = "任务列表不能为空") + private List tasks; + +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java new file mode 100644 index 0000000000..89f4333bba --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java @@ -0,0 +1,31 @@ +package com.epmet.openapi.scan.support.param; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 语音异步检测 对象 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 10:16 + */ +@Data +public class VoiceTask implements Serializable { + /** + * 不必填 + * 要检测的数据id 非必填 + * 检测对象对应的数据ID。 + * 由大小写英文字母、数字、下划线(_)、短划线(-)、英文句号(.)组成,不超过128个字符,可以用于唯一标识您的业务数据。 + * */ + @NotBlank(message = "dataId不能为空") + private String dataId; + + /** + * 必填 + * 需要检测的音频文件或语音流的下载地址。 + */ + @NotBlank(message = "音频URL不能为空") + private String url; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java new file mode 100644 index 0000000000..7e74caf5a6 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java @@ -0,0 +1,47 @@ +package com.epmet.openapi.scan.support.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 语音异步检测结果查询结果返参 -data-result-detail详情 + * 语音对应的文本详情。每一句文本对应一个元素,包含一个或者多个元素。关于每个元素的结构描述 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 11:11 + */ +@Data +public class VoiceAsyncScanDetailDTO implements Serializable { + private static final long serialVersionUID = -2664219492371705160L; + /** + * 句子开始的时间,单位:秒。 + */ + private Integer startTime; + + /** + * 句子结束的时间,单位:秒。 + */ + private Integer endTime; + + /** + * 语音转换成文本的结果。 + */ + private String text; + + /** + * 检测结果的分类。取值: + * normal:正常文本 + * spam:含垃圾信息 + * ad:广告 + * politics:涉政 + * terrorism:暴恐 + * abuse:辱骂 + * porn:色情 + * flood:灌水 + * contraband:违禁 + * meaningless:无意义 + * customized:自定义(例如命中自定义关键词) + */ + private String label; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java new file mode 100644 index 0000000000..1cbf3dab4a --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java @@ -0,0 +1,89 @@ +package com.epmet.openapi.scan.support.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 语音异步检测结果查询结果返参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 10:56 + */ +@Data +public class VoiceAsyncScanResult implements Serializable { + private static final long serialVersionUID = 8702129292884498023L; + + /** + * 检测对象对应的数据ID。 + */ + private String dataId; + + /** + * 检测任务的ID + */ + private String taskId; + + /** + * 检测结果的分类。取值: + * normal:正常文本 + * spam:含垃圾信息 + * ad:广告 + * politics:涉政 + * terrorism:暴恐 + * abuse:辱骂 + * porn:色情 + * flood:灌水 + * contraband:违禁 + * meaningless:无意义 + * customized:自定义(例如命中自定义关键词) + */ + private String label; + + /** + * labelDesc是对label的说明,包含两种特殊说明: + * (1)如果检测任务失败labelDesc:智能检测任务失败,结果已失效,需要人工审核 + * (2)如果检测结果失效labelDesc:智能检测任务失败,需要人工审核 + */ + private String labelDesc; + + /** + * 建议您执行的后续操作。取值: + * pass:结果正常,无需进行其余操作。 + * review:结果不确定,需要进行人工审核。 + * block:结果违规,建议直接删除或者限制公开。 + */ + private String suggestion; + + + /** + * 错误码,和HTTP状态码一致。 + * 200:表示检测成功。 + * 280:表示处理中,需要继续轮询。 + * 其他:表示任务失败。 + * 更多信息,请参见公共错误码。 + */ + @JsonIgnore + private Integer code; + /** + * 错误描述信息。 + */ + @JsonIgnore + private String msg; + + /** + * 暂时没用,所以返回忽略 + */ + @JsonIgnore + private String url; + + /** + * 检测成功(code=200)时,返回的检测结果。该结果包含一个或多个元素,每个元素是个结构体,对应一个场景。关于每个元素的结构描述,请参见result。 + * 暂时不展示审核结果明细 + */ + @JsonIgnore + private List results; + +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java new file mode 100644 index 0000000000..34f3280a6f --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java @@ -0,0 +1,57 @@ +package com.epmet.openapi.scan.support.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 语音异步检测结果查询结果返参 -data-result详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 11:07 + */ +@Data +public class VoiceAsyncScanResultDTO implements Serializable { + private static final long serialVersionUID = 4602226363259983753L; + /** + * 检测场景,和调用请求中的场景对应。取值:antispam。 + */ + private String scene; + + /** + * 检测结果的分类。取值: + * normal:正常文本 + * spam:含垃圾信息 + * ad:广告 + * politics:涉政 + * terrorism:暴恐 + * abuse:辱骂 + * porn:色情 + * flood:灌水 + * contraband:违禁 + * meaningless:无意义 + * customized:自定义(例如命中自定义关键词) + */ + private String label; + + /** + * 建议您执行的后续操作。取值: + * pass:结果正常,无需进行其余操作。 + * review:结果不确定,需要进行人工审核。 + * block:结果违规,建议直接删除或者限制公开。 + */ + private String suggestion; + + /** + * 置信度分数,取值范围:0(表示置信度最低)~100(表示置信度最高)。 + * 如果suggestion为pass,则置信度越高,表示内容正常的可能性越高;如果suggestion为review或block,则置信度越高,表示内容违规的可能性越高。 + * 注意 该值仅作为参考,强烈建议您不要在业务中使用。建议您参考suggestion和label(或者部分接口返回的sublabel)结果用于内容违规判定。 + */ + private Float rate; + + /** + * 语音对应的文本详情。每一句文本对应一个元素,包含一个或者多个元素。关于每个元素的结构描述, + */ + private List details; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java new file mode 100644 index 0000000000..ce43fec932 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java @@ -0,0 +1,40 @@ +package com.epmet.openapi.scan.support.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * 语音异步检测,返回检测对象列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 16:38 + */ +@Data +public class VoiceAsyncScanTaskDataDTO implements Serializable { + /** + * 错误码,和HTTP状态码一致。 + * 更多信息,请参见公共错误码。 + */ + private Integer code; + /** + * 错误描述信息。 + */ + private String msg; + /** + * 检测对象对应的数据ID。 + */ + private String dataId; + + /** + * 检测任务的ID + */ + private String taskId; + + /** + * 暂时没用,所以返回忽略 + */ + @JsonIgnore + private String url; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java new file mode 100644 index 0000000000..2dcbecc398 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java @@ -0,0 +1,46 @@ +package com.epmet.openapi.scan.support.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 语音异步检测,返参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 9:23 + */ +@Data +public class VoiceAsyncScanTaskResult implements Serializable { + private static final long serialVersionUID = 8702129292884498023L; + /** + * 随机字符串,该值用于回调通知请求中的签名。 + */ + private String seed; + + /** + * 提交成功的失败对象 + */ + private List successTasks=new ArrayList<>(); + + /** + * 提交失败的检测对象 + */ + private List failTasks=new ArrayList<>(); + + /** + * 是否全部提交成功 + */ + private boolean isAllSuccess; + + public boolean isAllSuccess() { + if (failTasks.isEmpty() && !successTasks.isEmpty()) { + return true; + } + return isAllSuccess; + } + + +} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java new file mode 100644 index 0000000000..617e6246d1 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java @@ -0,0 +1,90 @@ +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.green.model.v20180509.VoiceAsyncScanRequest; +import com.aliyuncs.http.FormatType; +import com.aliyuncs.http.HttpResponse; +import com.aliyuncs.profile.DefaultProfile; +import com.aliyuncs.profile.IClientProfile; + +import java.util.*; + +/** + * 提交语音异步检测任务 demo + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/8 21:51 + */ +public class VoiceAsyncScanRequestSample extends BaseSample { + + + + public static void main(String[] args) throws Exception { + + //请替换成您自己的AccessKey ID、AccessKey Secret。 + IClientProfile profile = DefaultProfile.getProfile("cn-shanghai", + "LTAI4G6Fv6uTzQbpsayATHq4", //您自己的AccessKey ID + "QevMw1RYCwQUG3RSMPq1J6EAfmSblo");//您自己的AccessKey Secret + final IAcsClient client = new DefaultAcsClient(profile); + + VoiceAsyncScanRequest asyncScanRequest = new VoiceAsyncScanRequest(); //class different vs common + asyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。 + asyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。 + asyncScanRequest.setRegionId("cn-shanghai"); + asyncScanRequest.setConnectTimeout(3000); + asyncScanRequest.setReadTimeout(6000); + + List> tasks = new ArrayList>(); + Map task1 = new LinkedHashMap(); + // 请将下面的地址修改为要检测的语音文件的地址。 + task1.put("dataId","voice1"); + task1.put("url", "https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20201208/6480bd6be9f14a458162218cea84dfa5.aac"); + + Map task2 = new LinkedHashMap(); + task2.put("dataId","voice2"); + task2.put("url", "https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20201208/b566d94fd7114ffb9a203e80c22ebb96.aac"); + + tasks.add(task1); + tasks.add(task2); + + JSONObject data = new JSONObject(); + + System.out.println("==========Task count:" + tasks.size()); + data.put("scenes", Arrays.asList("antispam")); + data.put("tasks", tasks); + // 如果是语音流检测,则修改为true。 + data.put("live", false); + asyncScanRequest.setHttpContent(data.toJSONString().getBytes("UTF-8"), "UTF-8", FormatType.JSON); + System.out.println("接口入参:"+JSON.toJSONString(data, true)); + + try { + HttpResponse httpResponse = client.doAction(asyncScanRequest); + + if (httpResponse.isSuccess()) { + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + System.out.println("接口返参:"+JSON.toJSONString(scrResponse, true)); + if (200 == scrResponse.getInteger("code")) { + JSONArray taskResults = scrResponse.getJSONArray("data"); + for (Object taskResult : taskResults) { + Integer code = ((JSONObject) taskResult).getInteger("code"); + if (200 == code) { + final String taskId = ((JSONObject) taskResult).getString("taskId"); + System.out.println("submit async task success, taskId = [" + taskId + "]"); + } else { + System.out.println("task process fail: " + code); + } + } + } else { + System.out.println("detect not success. code: " + scrResponse.getInteger("code")); + } + } else { + System.out.println("response not success. status: " + httpResponse.getStatus()); + } + } catch (Exception e) { + e.printStackTrace(); + } + + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java new file mode 100644 index 0000000000..85d268f175 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java @@ -0,0 +1,113 @@ +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.green.model.v20180509.VoiceAsyncScanResultsRequest; +import com.aliyuncs.http.FormatType; +import com.aliyuncs.http.HttpResponse; +import com.aliyuncs.profile.DefaultProfile; +import com.aliyuncs.profile.IClientProfile; + +import java.util.*; + +/** + * 查询异步语音检测结果。 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/8 22:08 + */ +public class VoiceAsyncScanResultsRequestSample extends BaseSample { + + + public static void main(String[] args) throws Exception { + // 请替换成您自己的AccessKey ID、AccessKey Secret。 + IClientProfile profile = DefaultProfile + .getProfile("cn-shanghai", + "LTAI4G6Fv6uTzQbpsayATHq4", + "QevMw1RYCwQUG3RSMPq1J6EAfmSblo"); + final IAcsClient client = new DefaultAcsClient(profile); + //提交语音异步检测任务后返回的taskId + pollingScanResult(client, Arrays.asList("vc_f_7WZZ01BCH0q6ZnM3g1OKGG-1tAaZ7", "vc_f_6AKaBxy4HdG5bruQ0JwweV-1tAaJi")); + // pollingScanResult(client, "vc_f_6AKaBxy4HdG5bruQ0JwweV-1tAaJi"); + } + + public static void pollingScanResult(IAcsClient client, List taskIdList) throws InterruptedException { + int failCount = 0; + boolean stop = false; + do { + // 设置每10秒查询一次。 + Thread.sleep(10 * 1000); + JSONObject scanResult = getScanResult(client, taskIdList); + System.out.println("接口完整返参:"+JSON.toJSONString(scanResult, true)); + if (scanResult == null || 200 != scanResult.getInteger("code")) { + failCount++; + System.out.println("请求失败,get result fail, failCount=" + failCount); + if (scanResult != null) { + System.out.println("请求失败,错误信息errorMsg:" + scanResult.getString("msg")); + } + if (failCount > 20) { + break; + } + continue; + } + + JSONArray taskResults = scanResult.getJSONArray("data"); + if (taskResults.isEmpty()) { + System.out.println("请求成功,but data is empty"); + break; + } + System.out.println("data.size=" + taskResults.size()); + for (Object taskResult : taskResults) { + JSONObject result = (JSONObject) taskResult; + Integer code = result.getInteger("code"); + String taskId = result.getString("taskId"); + if (280 == code) { + System.out.println("taskId=" + taskId + ": processing status: " + result.getString("msg")); + } else if (200 == code) { + System.out.println("taskId=" + taskId + "请求成功,返参:" + JSON.toJSONString(taskResult, true)); + stop = true; + } else { + System.out.println("taskId=" + taskId + "请求失败,返参:" + JSON.toJSONString(taskResult, true)); + stop = true; + } + } + } while (!stop); + } + + private static JSONObject getScanResult(IAcsClient client, List taskIdList) { + VoiceAsyncScanResultsRequest getResultsRequest = new VoiceAsyncScanResultsRequest(); + getResultsRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。 + getResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。 + getResultsRequest.setEncoding("utf-8"); + getResultsRequest.setRegionId("cn-shanghai"); + + + List> tasks = new ArrayList>(); + for (String taskId : taskIdList) { + Map task1 = new LinkedHashMap(); + task1.put("taskId", taskId); + tasks.add(task1); + } + + /** + * 请务必设置超时时间。 + */ + getResultsRequest.setConnectTimeout(3000); + getResultsRequest.setReadTimeout(6000); + + try { + getResultsRequest.setHttpContent(JSON.toJSONString(tasks).getBytes("UTF-8"), "UTF-8", FormatType.JSON); + + HttpResponse httpResponse = client.doAction(getResultsRequest); + if (httpResponse.isSuccess()) { + return JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + } else { + System.out.println("response not success. status: " + httpResponse.getStatus()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AfterRegisterResidentInSharableLinkFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AfterRegisterResidentInSharableLinkFormDTO.java new file mode 100644 index 0000000000..24c5735440 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AfterRegisterResidentInSharableLinkFormDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 在链接中完成了注册居民之后的入参DTO 主要是为了给邀请人发送积分事件,并更改邀请关系中的"是否通过邀请注册的居民"标识 + * @ClassName AfterRegisterResidentInSharableLinkFormDTO + * @Auth wangc + * @Date 2020-12-18 16:25 + */ +@Data +public class AfterRegisterResidentInSharableLinkFormDTO implements Serializable { + private static final long serialVersionUID = 6921156923900693361L; + + /** + * 分享链接 + */ + @NotBlank(message = "链接Id不能为空") + private String shareLinkId; + + /** + * 链接类型 issue议题 topic话题 + */ + @NotBlank(message = "链接类型不能为空") + private String linkType; + + /** + * 受邀人Id + */ + @NotBlank(message = "用户Id不能为空") + private String inviteeId; +} diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index d3d04f835d..67888acc41 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -100,6 +100,18 @@ 2.0.0 compile + + com.epmet + resi-group-client + 2.0.0 + compile + + + com.epmet + gov-issue-client + 2.0.0 + compile + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java index 604c8ac22b..e4f54f6aa7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java @@ -17,7 +17,9 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -31,6 +33,7 @@ import com.epmet.dto.result.IssueInitiatorResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.excel.UserResiInfoExcel; import com.epmet.service.UserResiInfoService; +import jdk.nashorn.internal.parser.Token; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -198,4 +201,12 @@ public class UserResiInfoController { userResiInfoService.editMobile(formDTO); return new Result(); } + + @PostMapping("submitinlink") + public Result submitInLink(@RequestBody AfterRegisterResidentInSharableLinkFormDTO param, @LoginUser TokenDto token){ + param.setInviteeId(token.getUserId()); + ValidatorUtils.validateEntity(param); + userResiInfoService.submitInLink(param); + return new Result(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserCustomerDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserCustomerDao.java index 04473a7b88..5eed213440 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserCustomerDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserCustomerDao.java @@ -22,4 +22,13 @@ public interface UserCustomerDao extends BaseDao { * @return */ int updateRegistered(@Param("customerId") String customerId, @Param("userId") String userId); + + /** + * @Description 根据用户Id查询用户-客户关系 + * @param userId + * @return com.epmet.entity.UserCustomerEntity + * @author wangc + * @date 2020.12.18 18:05 + */ + UserCustomerEntity selectByUserId(@Param("userId") String userId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java index f0281dae5c..30b73bd794 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java @@ -175,4 +175,16 @@ public interface UserResiInfoService extends BaseService { * @return void */ void editMobile(EditMobileFormDTO formDTO); + + /** + * @Description 在分享链接之后完成注册居民之后调用的接口 + * 作用 + * + * 更改邀请浏览记录里"是否通过邀请链接注册居民" + * @param param + * @return void + * @author wangc + * @date 2020.12.18 16:34 + */ + void submitInLink(AfterRegisterResidentInSharableLinkFormDTO param); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java index e8efe9816d..9c973e7b78 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java @@ -24,12 +24,17 @@ import com.epmet.common.token.util.UserUtil; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; +import com.epmet.commons.tools.enums.EventEnum; 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.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SendMqMsgUtils; import com.epmet.constant.SmsTemplateConstant; import com.epmet.constant.UserRoleConstant; import com.epmet.dao.UserCustomerDao; @@ -46,8 +51,12 @@ import com.epmet.entity.UserBaseInfoEntity; import com.epmet.entity.UserResiInfoEntity; import com.epmet.entity.UserWechatEntity; import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.redis.UserResiInfoRedis; +import com.epmet.resi.group.dto.topic.form.SharableTopicAndInviteeFormDTO; +import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.service.*; +import com.epmet.util.ModuleConstant; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,6 +97,10 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl page(Map params) { @@ -396,4 +409,23 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl + + \ No newline at end of file