From 405622c0fba4078da61a2cd028984ed21dbb3977 Mon Sep 17 00:00:00 2001 From: liuchuang Date: Thu, 10 Oct 2019 16:03:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8B=E9=82=BB=E7=A4=BE=E7=BE=A4=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=20init?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- esua-epdc/epdc-gateway/pom.xml | 11 +- .../src/main/resources/application.yml | 6 +- .../epdc-group/epdc-group-client/pom.xml | 32 +++ .../dto/group/GroupDTO.java | 141 +++++++++++++ .../dto/topic/TopicDTO.java | 187 ++++++++++++++++++ .../epdc-group/epdc-group-server/pom.xml | 177 +++++++++++++++++ .../com.elink.esua.epdc/GroupApplication.java | 21 ++ .../config/ModuleConfigImpl.java | 18 ++ .../group/controller/GroupController.java | 94 +++++++++ .../modules/group/dao/GroupDao.java | 33 ++++ .../modules/group/entity/GroupEntity.java | 111 +++++++++++ .../modules/group/excel/GroupExcel.java | 98 +++++++++ .../modules/group/redis/GroupRedis.java | 47 +++++ .../modules/group/service/GroupService.java | 95 +++++++++ .../group/service/impl/GroupServiceImpl.java | 104 ++++++++++ .../topic/controller/TopicController.java | 94 +++++++++ .../modules/topic/dao/TopicDao.java | 33 ++++ .../modules/topic/entity/TopicEntity.java | 157 +++++++++++++++ .../modules/topic/excel/TopicExcel.java | 126 ++++++++++++ .../modules/topic/redis/TopicRedis.java | 47 +++++ .../modules/topic/service/TopicService.java | 95 +++++++++ .../topic/service/impl/TopicServiceImpl.java | 104 ++++++++++ .../src/main/resources/application.yml | 87 ++++++++ .../src/main/resources/logback-spring.xml | 159 +++++++++++++++ .../main/resources/mapper/group/GroupDao.xml | 7 + .../main/resources/mapper/topic/TopicDao.xml | 7 + .../src/main/resources/registry.conf | 21 ++ esua-epdc/epdc-module/epdc-group/pom.xml | 18 ++ esua-epdc/epdc-module/pom.xml | 1 + .../src/main/resources/application.yml | 2 +- 30 files changed, 2122 insertions(+), 11 deletions(-) create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-client/pom.xml create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/group/GroupDTO.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/TopicDTO.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/pom.xml create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/GroupApplication.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/config/ModuleConfigImpl.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/controller/GroupController.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/GroupDao.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/GroupEntity.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/excel/GroupExcel.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/redis/GroupRedis.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/GroupService.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/controller/TopicController.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicDao.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/entity/TopicEntity.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/excel/TopicExcel.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/redis/TopicRedis.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/TopicService.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/application.yml create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/logback-spring.xml create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/GroupDao.xml create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/registry.conf create mode 100644 esua-epdc/epdc-module/epdc-group/pom.xml diff --git a/esua-epdc/epdc-gateway/pom.xml b/esua-epdc/epdc-gateway/pom.xml index 67b2c43fb..7b1adf95f 100644 --- a/esua-epdc/epdc-gateway/pom.xml +++ b/esua-epdc/epdc-gateway/pom.xml @@ -106,9 +106,6 @@ lb://epdc-message-server - lb://epdc-neighbor-server - - http://127.0.0.1:9064 lb://epdc-oss-server @@ -120,6 +117,8 @@ http://127.0.0.1:9068 lb://epdc-demo-server + http://127.0.0.1:9064 + false 47.104.224.45:8848 @@ -149,8 +148,6 @@ lb://epdc-job-server lb://epdc-message-server - lb://epdc-neighbor-server - lb://epdc-news-server lb://epdc-oss-server lb://epdc-events-server @@ -158,6 +155,7 @@ lb://epdc-user-server lb://epdc-demo-server + lb://epdc-group-server true @@ -182,8 +180,6 @@ lb://epdc-job-server lb://epdc-message-server - lb://epdc-neighbor-server - lb://epdc-news-server lb://epdc-oss-server lb://epdc-events-server @@ -191,6 +187,7 @@ lb://epdc-user-server lb://epdc-demo-server + lb://epdc-group-server 8 121.42.149.50 diff --git a/esua-epdc/epdc-gateway/src/main/resources/application.yml b/esua-epdc/epdc-gateway/src/main/resources/application.yml index e866953cd..44f0fc0aa 100644 --- a/esua-epdc/epdc-gateway/src/main/resources/application.yml +++ b/esua-epdc/epdc-gateway/src/main/resources/application.yml @@ -81,11 +81,11 @@ spring: filters: - StripPrefix=0 #友邻社群模块 - - id: epdc-neighbor-server - uri: @gateway.routes.epdc-neighbor-server.uri@ + - id: epdc-group-server + uri: @gateway.routes.epdc-group-server.uri@ order: 9 predicates: - - Path=/neighbor/** + - Path=/group/** filters: - StripPrefix=0 #新闻公告模块 diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/pom.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-client/pom.xml new file mode 100644 index 000000000..dff1e822e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/pom.xml @@ -0,0 +1,32 @@ + + + + epdc-group + com.esua.epdc + 1.0.0 + + 4.0.0 + + epdc-group-client + jar + + + + com.esua.epdc + epdc-commons-tools + 1.0.0 + + + com.esua.epdc + epdc-admin-client + 1.0.0 + + + com.esua.epdc + epdc-news-client + 1.0.0 + + + + \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/group/GroupDTO.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/group/GroupDTO.java new file mode 100644 index 000000000..b887bd338 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/group/GroupDTO.java @@ -0,0 +1,141 @@ +/** + * 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.dto.group; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 社群表 社群表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Data +public class GroupDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 社群名称 + */ + private String groupName; + + /** + * 社群头像 + */ + private String groupAvatar; + + /** + * 社群介绍 + */ + private String groupIntroduction; + + /** + * 社群类别 0:党员群,1:自建群 + */ + private String groupCategory; + + /** + * 区 + */ + private String area; + + /** + * 区ID + */ + private String areaId; + + /** + * 街道 + */ + private String street; + + /** + * 街道ID + */ + private String streetId; + + /** + * 社区 + */ + private String community; + + /** + * 社区ID + */ + private String communityId; + + /** + * 网格 + */ + private String grid; + + /** + * 网格ID + */ + private String gridId; + + /** + * 状态 0:待审核,5:审核不通过,10:审核通过,15:禁言,20:已解散 + */ + private Integer state; + + /** + * 处理意见 + */ + private String processingOpinions; + + /** + * 删除标记 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/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/TopicDTO.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/TopicDTO.java new file mode 100644 index 000000000..de01e3e1f --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/TopicDTO.java @@ -0,0 +1,187 @@ +/** + * 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.dto.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 话题表 话题表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Data +public class TopicDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 用户ID + */ + private String userId; + + /** + * 用户昵称 + */ + private String nickname; + + /** + * 用户头像 + */ + private String userFace; + + /** + * 党员标识 0:否,1:是 + */ + private String partyMember; + + /** + * 话题内容 + */ + private String topicContent; + + /** + * 议题ID + */ + private String issueId; + + /** + * 项目ID + */ + private String itemId; + + /** + * 区 + */ + private String area; + + /** + * 区ID + */ + private Long areaId; + + /** + * 街道 + */ + private String street; + + /** + * 街道ID + */ + private Long streetId; + + /** + * 社区 + */ + private String community; + + /** + * 社区ID + */ + private Long communityId; + + /** + * 网格 + */ + private String grid; + + /** + * 网格ID + */ + private Long gridId; + + /** + * 话题地址 + */ + private String topicAddress; + + /** + * 话题位置纬度 + */ + private BigDecimal topicLatitude; + + /** + * 话题位置经度 + */ + private BigDecimal topicLongitude; + + /** + * 友邻社群 + */ + private String groupName; + + /** + * 友邻社群ID + */ + private String groupId; + + /** + * 状态 0:讨论中,5:转议题待审核,10:转议题审核不通过,15:已转议题,20:已转项目,25:已关闭 + */ + private Integer state; + + /** + * 评论数 + */ + private Integer commentNum; + + /** + * 浏览数 + */ + private Integer browseNum; + + /** + * 删除标记 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/esua-epdc/epdc-module/epdc-group/epdc-group-server/pom.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/pom.xml new file mode 100644 index 000000000..b34bada6e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/pom.xml @@ -0,0 +1,177 @@ + + + + epdc-group + com.esua.epdc + 1.0.0 + + 4.0.0 + + epdc-group-server + jar + + + + com.esua.epdc + epdc-group-client + 1.0.0 + + + com.esua.epdc + epdc-commons-tools + 1.0.0 + + + com.esua.epdc + epdc-commons-mybatis + 1.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + de.codecentric + spring-boot-admin-starter-client + ${spring.boot.admin.version} + + + + io.github.openfeign + feign-httpclient + 10.3.0 + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + com.spotify + docker-maven-plugin + + + + ${project.basedir}/src/main/java + + + + true + ${basedir}/src/main/resources + + **/application*.yml + **/*.properties + logback-spring.xml + registry.conf + + + + ${basedir}/src/main/resources + + **/application*.yml + **/*.properties + logback-spring.xml + registry.conf + + + + + + + + + dev + + true + + + dev + + 9064 + + 2 + 47.104.224.45 + 6379 + elink@888 + + + + + epdc + elink833066 + + false + 47.104.224.45:8848 + + + + + test + + test + + 9064 + + 2 + 47.104.224.45 + 6379 + elink@888 + + + + + epdc + elink833066 + + true + 47.104.224.45:8848 + + + + + prod + + prod + + 9064 + + + 8 + 121.42.149.50 + 9001 + elink888 + + + + + epdc + elink833066 + + true + 172.31.171.61:9300 + + + + + diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/GroupApplication.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/GroupApplication.java new file mode 100644 index 000000000..5bc8db4b4 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/GroupApplication.java @@ -0,0 +1,21 @@ +package com.elink.esua.epdc; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +/** + * 友邻社群模块 + * + * @author Mark sunlightcs@gmail.com + * @since 1.1.0 + */ +@SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients +public class GroupApplication { + public static void main(String[] args) { + SpringApplication.run(GroupApplication.class, args); + } +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/config/ModuleConfigImpl.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/config/ModuleConfigImpl.java new file mode 100644 index 000000000..852336743 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/config/ModuleConfigImpl.java @@ -0,0 +1,18 @@ +package com.elink.esua.epdc.config; + +import com.elink.esua.epdc.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息-友邻社群模块 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "group"; + } +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/controller/GroupController.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/controller/GroupController.java new file mode 100644 index 000000000..2a4f1159a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/controller/GroupController.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.group.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.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.group.GroupDTO; +import com.elink.esua.epdc.modules.group.excel.GroupExcel; +import com.elink.esua.epdc.modules.group.service.GroupService; +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-10 + */ +@RestController +@RequestMapping("group") +public class GroupController { + + @Autowired + private GroupService groupService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = groupService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + GroupDTO data = groupService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody GroupDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + groupService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody GroupDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + groupService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + groupService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = groupService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, GroupExcel.class); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/GroupDao.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/GroupDao.java new file mode 100644 index 000000000..fde2e1fa6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/GroupDao.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.elink.esua.epdc.modules.group.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.modules.group.entity.GroupEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 社群表 社群表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Mapper +public interface GroupDao extends BaseDao { + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/GroupEntity.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/GroupEntity.java new file mode 100644 index 000000000..b98616500 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/GroupEntity.java @@ -0,0 +1,111 @@ +/** + * 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.group.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 社群表 社群表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_group") +public class GroupEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 社群名称 + */ + private String groupName; + + /** + * 社群头像 + */ + private String groupAvatar; + + /** + * 社群介绍 + */ + private String groupIntroduction; + + /** + * 社群类别 0:党员群,1:自建群 + */ + private String groupCategory; + + /** + * 区 + */ + private String area; + + /** + * 区ID + */ + private String areaId; + + /** + * 街道 + */ + private String street; + + /** + * 街道ID + */ + private String streetId; + + /** + * 社区 + */ + private String community; + + /** + * 社区ID + */ + private String communityId; + + /** + * 网格 + */ + private String grid; + + /** + * 网格ID + */ + private String gridId; + + /** + * 状态 0:待审核,5:审核不通过,10:审核通过,15:禁言,20:已解散 + */ + private Integer state; + + /** + * 处理意见 + */ + private String processingOpinions; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/excel/GroupExcel.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/excel/GroupExcel.java new file mode 100644 index 000000000..bdd6912a6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/excel/GroupExcel.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.elink.esua.epdc.modules.group.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 社群表 社群表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Data +public class GroupExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "社群名称") + private String groupName; + + @Excel(name = "社群头像") + private String groupAvatar; + + @Excel(name = "社群介绍") + private String groupIntroduction; + + @Excel(name = "社群类别 0:党员群,1:自建群") + private String groupCategory; + + @Excel(name = "区") + private String area; + + @Excel(name = "区ID") + private String areaId; + + @Excel(name = "街道") + private String street; + + @Excel(name = "街道ID") + private String streetId; + + @Excel(name = "社区") + private String community; + + @Excel(name = "社区ID") + private String communityId; + + @Excel(name = "网格") + private String grid; + + @Excel(name = "网格ID") + private String gridId; + + @Excel(name = "状态 0:待审核,5:审核不通过,10:审核通过,15:禁言,20:已解散") + private Integer state; + + @Excel(name = "处理意见") + private String processingOpinions; + + @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/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/redis/GroupRedis.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/redis/GroupRedis.java new file mode 100644 index 000000000..49c78036a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/redis/GroupRedis.java @@ -0,0 +1,47 @@ +/** + * 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.group.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 社群表 社群表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Component +public class GroupRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/GroupService.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/GroupService.java new file mode 100644 index 000000000..ea62fdb1e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/GroupService.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.elink.esua.epdc.modules.group.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.group.GroupDTO; +import com.elink.esua.epdc.modules.group.entity.GroupEntity; + +import java.util.List; +import java.util.Map; + +/** + * 社群表 社群表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +public interface GroupService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2019-10-10 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2019-10-10 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GroupDTO + * @author generator + * @date 2019-10-10 + */ + GroupDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2019-10-10 + */ + void save(GroupDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2019-10-10 + */ + void update(GroupDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2019-10-10 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.java new file mode 100644 index 000000000..f0d718bfd --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.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.elink.esua.epdc.modules.group.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.dto.group.GroupDTO; +import com.elink.esua.epdc.modules.group.dao.GroupDao; +import com.elink.esua.epdc.modules.group.entity.GroupEntity; +import com.elink.esua.epdc.modules.group.redis.GroupRedis; +import com.elink.esua.epdc.modules.group.service.GroupService; +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 qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Service +public class GroupServiceImpl extends BaseServiceImpl implements GroupService { + + @Autowired + private GroupRedis groupRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GroupDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GroupDTO.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 GroupDTO get(String id) { + GroupEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GroupDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GroupDTO dto) { + GroupEntity entity = ConvertUtils.sourceToTarget(dto, GroupEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GroupDTO dto) { + GroupEntity entity = ConvertUtils.sourceToTarget(dto, GroupEntity.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/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/controller/TopicController.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/controller/TopicController.java new file mode 100644 index 000000000..301c7a695 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/controller/TopicController.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.topic.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.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.topic.TopicDTO; +import com.elink.esua.epdc.modules.topic.excel.TopicExcel; +import com.elink.esua.epdc.modules.topic.service.TopicService; +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-10 + */ +@RestController +@RequestMapping("topic") +public class TopicController { + + @Autowired + private TopicService topicService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = topicService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + TopicDTO data = topicService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody TopicDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + topicService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody TopicDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + topicService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + topicService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = topicService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, TopicExcel.class); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicDao.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicDao.java new file mode 100644 index 000000000..e6d7e9c43 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicDao.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.elink.esua.epdc.modules.topic.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.modules.topic.entity.TopicEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 话题表 话题表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Mapper +public interface TopicDao extends BaseDao { + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/entity/TopicEntity.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/entity/TopicEntity.java new file mode 100644 index 000000000..f3bfc712c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/entity/TopicEntity.java @@ -0,0 +1,157 @@ +/** + * 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.topic.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 话题表 话题表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_topic") +public class TopicEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private String userId; + + /** + * 用户昵称 + */ + private String nickname; + + /** + * 用户头像 + */ + private String userFace; + + /** + * 党员标识 0:否,1:是 + */ + private String partyMember; + + /** + * 话题内容 + */ + private String topicContent; + + /** + * 议题ID + */ + private String issueId; + + /** + * 项目ID + */ + private String itemId; + + /** + * 区 + */ + private String area; + + /** + * 区ID + */ + private Long areaId; + + /** + * 街道 + */ + private String street; + + /** + * 街道ID + */ + private Long streetId; + + /** + * 社区 + */ + private String community; + + /** + * 社区ID + */ + private Long communityId; + + /** + * 网格 + */ + private String grid; + + /** + * 网格ID + */ + private Long gridId; + + /** + * 话题地址 + */ + private String topicAddress; + + /** + * 话题位置纬度 + */ + private BigDecimal topicLatitude; + + /** + * 话题位置经度 + */ + private BigDecimal topicLongitude; + + /** + * 友邻社群 + */ + private String groupName; + + /** + * 友邻社群ID + */ + private String groupId; + + /** + * 状态 0:讨论中,5:转议题待审核,10:转议题审核不通过,15:已转议题,20:已转项目,25:已关闭 + */ + private Integer state; + + /** + * 评论数 + */ + private Integer commentNum; + + /** + * 浏览数 + */ + private Integer browseNum; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/excel/TopicExcel.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/excel/TopicExcel.java new file mode 100644 index 000000000..52b227dc7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/excel/TopicExcel.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.elink.esua.epdc.modules.topic.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 话题表 话题表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Data +public class TopicExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "用户ID") + private String userId; + + @Excel(name = "用户昵称") + private String nickname; + + @Excel(name = "用户头像") + private String userFace; + + @Excel(name = "党员标识 0:否,1:是") + private String partyMember; + + @Excel(name = "话题内容") + private String topicContent; + + @Excel(name = "议题ID") + private String issueId; + + @Excel(name = "项目ID") + private String itemId; + + @Excel(name = "区") + private String area; + + @Excel(name = "区ID") + private Long areaId; + + @Excel(name = "街道") + private String street; + + @Excel(name = "街道ID") + private Long streetId; + + @Excel(name = "社区") + private String community; + + @Excel(name = "社区ID") + private Long communityId; + + @Excel(name = "网格") + private String grid; + + @Excel(name = "网格ID") + private Long gridId; + + @Excel(name = "话题地址") + private String topicAddress; + + @Excel(name = "话题位置纬度") + private BigDecimal topicLatitude; + + @Excel(name = "话题位置经度") + private BigDecimal topicLongitude; + + @Excel(name = "友邻社群") + private String groupName; + + @Excel(name = "友邻社群ID") + private String groupId; + + @Excel(name = "状态 0:讨论中,5:转议题待审核,10:转议题审核不通过,15:已转议题,20:已转项目,25:已关闭") + private Integer state; + + @Excel(name = "评论数") + private Integer commentNum; + + @Excel(name = "浏览数") + private Integer browseNum; + + @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/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/redis/TopicRedis.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/redis/TopicRedis.java new file mode 100644 index 000000000..0dbf9cbbf --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/redis/TopicRedis.java @@ -0,0 +1,47 @@ +/** + * 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.topic.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 话题表 话题表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Component +public class TopicRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/TopicService.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/TopicService.java new file mode 100644 index 000000000..6e63b7df8 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/TopicService.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.elink.esua.epdc.modules.topic.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.topic.TopicDTO; +import com.elink.esua.epdc.modules.topic.entity.TopicEntity; + +import java.util.List; +import java.util.Map; + +/** + * 话题表 话题表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +public interface TopicService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2019-10-10 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2019-10-10 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TopicDTO + * @author generator + * @date 2019-10-10 + */ + TopicDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2019-10-10 + */ + void save(TopicDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2019-10-10 + */ + void update(TopicDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2019-10-10 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java new file mode 100644 index 000000000..388b99d45 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.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.elink.esua.epdc.modules.topic.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.dto.topic.TopicDTO; +import com.elink.esua.epdc.modules.topic.dao.TopicDao; +import com.elink.esua.epdc.modules.topic.entity.TopicEntity; +import com.elink.esua.epdc.modules.topic.redis.TopicRedis; +import com.elink.esua.epdc.modules.topic.service.TopicService; +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 qu qu@elink-cn.com + * @since v1.0.0 2019-10-10 + */ +@Service +public class TopicServiceImpl extends BaseServiceImpl implements TopicService { + + @Autowired + private TopicRedis topicRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicDTO.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 TopicDTO get(String id) { + TopicEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TopicDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TopicDTO dto) { + TopicEntity entity = ConvertUtils.sourceToTarget(dto, TopicEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TopicDTO dto) { + TopicEntity entity = ConvertUtils.sourceToTarget(dto, TopicEntity.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/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/application.yml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/application.yml new file mode 100644 index 000000000..ebf9e2d72 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/application.yml @@ -0,0 +1,87 @@ +server: + port: @server.port@ + servlet: + context-path: /group + +spring: + main: + allow-bean-definition-overriding: true + application: + name: epdc-group-server + # 环境 dev|test|prod + profiles: + active: @spring.profiles.active@ + messages: + encoding: UTF-8 + basename: i18n/messages,i18n/messages_common + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + timeout: 30s + port: @spring.redis.port@ + password: @spring.redis.password@ + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + register-enabled: @nacos.register-enabled@ + alibaba: + seata: + tx-service-group: epdc-group-server-fescar-service-group + datasource: + druid: + driver-class-name: com.mysql.jdbc.Driver + url: @spring.datasource.druid.url@ + username: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + +feign: + hystrix: + enabled: true + httpclient: + enabled: true + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 + +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.elink.esua.epdc.modules.*.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: UUID + #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" + field-strategy: NOT_NULL + #驼峰下划线转换 + column-underline: true + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/logback-spring.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/logback-spring.xml new file mode 100644 index 000000000..3375c4c54 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/logback-spring.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/GroupDao.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/GroupDao.xml new file mode 100644 index 000000000..842875dc5 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/GroupDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml new file mode 100644 index 000000000..a5b72af95 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/registry.conf b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/registry.conf new file mode 100644 index 000000000..fb64abd71 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/registry.conf @@ -0,0 +1,21 @@ +registry { + # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa + type = "nacos" + + nacos { + serverAddr = "@nacos.server-addr@" + namespace = "public" + cluster = "default" + } +} + +config { + # file、nacos 、apollo、zk、consul、etcd3 + type = "nacos" + + nacos { + serverAddr = "@nacos.server-addr@" + namespace = "public" + cluster = "default" + } +} diff --git a/esua-epdc/epdc-module/epdc-group/pom.xml b/esua-epdc/epdc-module/epdc-group/pom.xml new file mode 100644 index 000000000..882f9e411 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/pom.xml @@ -0,0 +1,18 @@ + + + + epdc-module + com.esua.epdc + 1.0.0 + + 4.0.0 + + epdc-group + pom + + epdc-group-client + epdc-group-server + + + diff --git a/esua-epdc/epdc-module/pom.xml b/esua-epdc/epdc-module/pom.xml index 4abd74cfe..8ac112caa 100644 --- a/esua-epdc/epdc-module/pom.xml +++ b/esua-epdc/epdc-module/pom.xml @@ -26,6 +26,7 @@ epdc-services epdc-user epdc-demo + epdc-group diff --git a/renren-cloud-generator/src/main/resources/application.yml b/renren-cloud-generator/src/main/resources/application.yml index f88851291..dc0f5909f 100644 --- a/renren-cloud-generator/src/main/resources/application.yml +++ b/renren-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://47.104.224.45:3308/esua_epdc_news?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://47.104.224.45:3308/esua_epdc_group?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: epdc password: elink833066 #oracle配置