From 03b81a4df70e6c7728365c6d655b516205fcaab5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9B=B2=E6=A0=91=E9=80=9A?= <1976590620@qq.com>
Date: Thu, 14 May 2020 16:55:29 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E7=9B=B8=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 .../controller/AppTopicCommentController.java |  70 ++++++++++
 .../controller/TopicCommentController.java    | 125 ++++++++++++++++++
 .../TopicCommentUserAttitudeController.java   |  94 +++++++++++++
 3 files changed, 289 insertions(+)
 create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/AppTopicCommentController.java
 create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/TopicCommentController.java
 create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/TopicCommentUserAttitudeController.java
diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/AppTopicCommentController.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/AppTopicCommentController.java
new file mode 100644
index 0000000..2ef2aa2
--- /dev/null
+++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/AppTopicCommentController.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.elink.esua.epdc.modules.comment.controller;
+
+import com.elink.esua.epdc.commons.tools.constant.Constant;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
+import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO;
+import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO;
+import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO;
+import com.elink.esua.epdc.dto.comment.TopicCommentsResultDTO;
+import com.elink.esua.epdc.modules.comment.service.TopicCommentService;
+import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+@RestController
+@RequestMapping(Constant.EPDC_APP + "comment")
+public class AppTopicCommentController {
+
+    @Autowired
+    private TopicCommentService topicCommentService;
+
+    @Autowired
+    private TopicCommentUserAttitudeService topicCommentUserAttitudeService;
+
+    /**
+     * 提交评论或回复接口
+     */
+    @PostMapping("submit")
+    public Result submit(@RequestBody TopicCommentFormDTO commentFormDTO){
+        ValidatorUtils.validateEntity(commentFormDTO);
+        return topicCommentService.submit(commentFormDTO);
+    }
+
+    /**
+     * 评论列表
+     */
+    @GetMapping("list")
+    public Result listOfComments(@RequestBody TopicCommentsFormDTO formDto) {
+        return topicCommentService.listOfComments(formDto);
+    }
+
+    /**
+     * 评论(赞/踩)接口
+     * @param formDto
+     * @return
+     */
+    @PostMapping("statement")
+    public Result statement(@RequestBody TopicCommentStatementFormDTO formDto) {
+        topicCommentUserAttitudeService.statement(formDto);
+        return new Result();
+    }
+}
diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/TopicCommentController.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/TopicCommentController.java
new file mode 100644
index 0000000..3a8c877
--- /dev/null
+++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/TopicCommentController.java
@@ -0,0 +1,125 @@
+/**
+ * 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.elink.esua.epdc.modules.comment.controller;
+
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
+import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
+import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
+import com.elink.esua.epdc.dto.comment.TopicCommentDTO;
+import com.elink.esua.epdc.dto.comment.TopicCommentListDTO;
+import com.elink.esua.epdc.dto.comment.TopicDeleteCommentsFormDTO;
+import com.elink.esua.epdc.modules.comment.excel.TopicCommentExcel;
+import com.elink.esua.epdc.modules.comment.service.TopicCommentService;
+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 qu qu@elink-cn.com
+ * @since v1.0.0 2019-10-23
+ */
+@RestController
+@RequestMapping("topiccomment")
+public class TopicCommentController {
+
+    @Autowired
+    private TopicCommentService topicCommentService;
+
+    @GetMapping("page")
+    public Result> page(@RequestParam Map params){
+        PageData page = topicCommentService.page(params);
+        return new Result>().ok(page);
+    }
+
+    @GetMapping("{id}")
+    public Result get(@PathVariable("id") String id){
+        TopicCommentDTO data = topicCommentService.get(id);
+        return new Result().ok(data);
+    }
+
+    @PostMapping
+    public Result save(@RequestBody TopicCommentDTO dto){
+        //效验数据
+        ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+        topicCommentService.save(dto);
+        return new Result();
+    }
+
+    @PutMapping
+    public Result update(@RequestBody TopicCommentDTO dto){
+        //效验数据
+        ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+        topicCommentService.update(dto);
+        return new Result();
+    }
+
+    @DeleteMapping
+    public Result delete(@RequestBody String[] ids){
+        //效验数据
+        AssertUtils.isArrayEmpty(ids, "id");
+        topicCommentService.delete(ids);
+        return new Result();
+    }
+
+    @GetMapping("export")
+    public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+        List list = topicCommentService.list(params);
+        ExcelUtils.exportExcelToTarget(response, null, list, TopicCommentExcel.class);
+    }
+
+    /**
+     *
+     * 评论列表
+     *
+     * @params [params]
+     * @return com.elink.esua.epdc.commons.tools.utils.Result>
+     * @author liuchuang
+     * @since 2019/11/12 10:37
+     */
+    @GetMapping("comments")
+    public Result> commentsList(@RequestParam Map params) {
+        PageData page = topicCommentService.listComments(params);
+        return new Result>().ok(page);
+    }
+
+    /**
+     *
+     * 屏蔽评论
+     *
+     * @params [formDto]
+     * @return com.elink.esua.epdc.commons.tools.utils.Result
+     * @author liuchuang
+     * @since 2019/11/12 11:07
+     */
+    @PostMapping("deleteComment")
+    public Result deleteComment(@RequestBody TopicDeleteCommentsFormDTO formDto) {
+        return topicCommentService.modifyCommentById(formDto.getCommentIds());
+    }
+
+}
diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/TopicCommentUserAttitudeController.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/TopicCommentUserAttitudeController.java
new file mode 100644
index 0000000..4c80d8a
--- /dev/null
+++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/comment/controller/TopicCommentUserAttitudeController.java
@@ -0,0 +1,94 @@
+/**
+ * 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.elink.esua.epdc.modules.comment.controller;
+
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
+import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
+import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
+import com.elink.esua.epdc.dto.comment.TopicCommentUserAttitudeDTO;
+import com.elink.esua.epdc.modules.comment.excel.TopicCommentUserAttitudeExcel;
+import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService;
+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 qu qu@elink-cn.com
+ * @since v1.0.0 2019-10-23
+ */
+@RestController
+@RequestMapping("topiccommentuserattitude")
+public class TopicCommentUserAttitudeController {
+
+    @Autowired
+    private TopicCommentUserAttitudeService topicCommentUserAttitudeService;
+
+    @GetMapping("page")
+    public Result> page(@RequestParam Map params){
+        PageData page = topicCommentUserAttitudeService.page(params);
+        return new Result>().ok(page);
+    }
+
+    @GetMapping("{id}")
+    public Result get(@PathVariable("id") String id){
+        TopicCommentUserAttitudeDTO data = topicCommentUserAttitudeService.get(id);
+        return new Result().ok(data);
+    }
+
+    @PostMapping
+    public Result save(@RequestBody TopicCommentUserAttitudeDTO dto){
+        //效验数据
+        ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+        topicCommentUserAttitudeService.save(dto);
+        return new Result();
+    }
+
+    @PutMapping
+    public Result update(@RequestBody TopicCommentUserAttitudeDTO dto){
+        //效验数据
+        ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+        topicCommentUserAttitudeService.update(dto);
+        return new Result();
+    }
+
+    @DeleteMapping
+    public Result delete(@RequestBody String[] ids){
+        //效验数据
+        AssertUtils.isArrayEmpty(ids, "id");
+        topicCommentUserAttitudeService.delete(ids);
+        return new Result();
+    }
+
+    @GetMapping("export")
+    public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+        List list = topicCommentUserAttitudeService.list(params);
+        ExcelUtils.exportExcelToTarget(response, null, list, TopicCommentUserAttitudeExcel.class);
+    }
+
+}