+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.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.IssueSuggestionDTO;
+import com.epmet.dto.form.UserIssueSuggestionFormDTO;
+import com.epmet.service.IssueSuggestionService;
+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-11-18
+ */
+@RestController
+@RequestMapping("issuesuggestion")
+public class IssueSuggestionController {
+
+ @Autowired
+ private IssueSuggestionService issueSuggestionService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = issueSuggestionService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ IssueSuggestionDTO data = issueSuggestionService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody IssueSuggestionDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ issueSuggestionService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody IssueSuggestionDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ issueSuggestionService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ issueSuggestionService.delete(ids);
+ return new Result();
+ }
+
+ /**
+ * @param formDTO
+ * @author yinzuomei
+ * @description 查询用户对于某个议题的想法 返回一条记录
+ * @Date 2020/11/18 10:12
+ **/
+ @PostMapping("queryuserissuesuggestion")
+ public Result queryUserIssueSuggestion(@RequestBody UserIssueSuggestionFormDTO formDTO){
+ ValidatorUtils.validateEntity(formDTO);
+ IssueSuggestionDTO issueSuggestionDTO=issueSuggestionService.queryUserIssueSuggestion(formDTO);
+ return new Result().ok(issueSuggestionDTO);
+ }
+}
\ No newline at end of file
diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueSuggestionDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueSuggestionDao.java
new file mode 100644
index 0000000000..c3989ae403
--- /dev/null
+++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueSuggestionDao.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.IssueSuggestionDTO;
+import com.epmet.dto.form.UserIssueSuggestionFormDTO;
+import com.epmet.entity.IssueSuggestionEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 居民端用户对议题建议或意见表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-11-18
+ */
+@Mapper
+public interface IssueSuggestionDao extends BaseDao {
+
+ /**
+ * @return com.epmet.dto.IssueSuggestionDTO
+ * @param formDTO
+ * @author yinzuomei
+ * @description 查询用户对于某个议题的想法 返回一条记录
+ * @Date 2020/11/18 10:12
+ **/
+ IssueSuggestionDTO selectUserIssueSuggestion(UserIssueSuggestionFormDTO formDTO);
+}
\ No newline at end of file
diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSuggestionEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSuggestionEntity.java
new file mode 100644
index 0000000000..2d160030ab
--- /dev/null
+++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSuggestionEntity.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.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-11-18
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("issue_suggestion")
+public class IssueSuggestionEntity extends BaseEpmetEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 客户Id customer.id
+ */
+ private String customerId;
+
+ /**
+ * 议题id
+ */
+ private String issueId;
+
+ /**
+ * 议题所属网格id
+ */
+ private String gridId;
+
+ /**
+ * 对议题的想法
+ */
+ private String suggestion;
+
+ /**
+ * 1公开; 0匿名
+ */
+ private Integer publicFlag;
+
+}
diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueSuggestionService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueSuggestionService.java
new file mode 100644
index 0000000000..0c320c08d4
--- /dev/null
+++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueSuggestionService.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.
+ *
+ * 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.IssueSuggestionDao;
+import com.epmet.dto.IssueSuggestionDTO;
+import com.epmet.dto.form.UserIssueSuggestionFormDTO;
+import com.epmet.entity.IssueSuggestionEntity;
+import com.epmet.service.IssueSuggestionService;
+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-11-18
+ */
+@Service
+public class IssueSuggestionServiceImpl extends BaseServiceImpl implements IssueSuggestionService {
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, IssueSuggestionDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, IssueSuggestionDTO.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 IssueSuggestionDTO get(String id) {
+ IssueSuggestionEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, IssueSuggestionDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(IssueSuggestionDTO dto) {
+ IssueSuggestionEntity entity = ConvertUtils.sourceToTarget(dto, IssueSuggestionEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(IssueSuggestionDTO dto) {
+ IssueSuggestionEntity entity = ConvertUtils.sourceToTarget(dto, IssueSuggestionEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+ /**
+ * @param formDTO
+ * @author yinzuomei
+ * @description 查询用户对于某个议题的想法 返回一条记录
+ * @Date 2020/11/18 10:12
+ **/
+ @Override
+ public IssueSuggestionDTO queryUserIssueSuggestion(UserIssueSuggestionFormDTO formDTO) {
+ return baseDao.selectUserIssueSuggestion(formDTO);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.2__issue_audit_tables.sql b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.2__issue_audit_tables.sql
new file mode 100644
index 0000000000..93f8c2338e
--- /dev/null
+++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.2__issue_audit_tables.sql
@@ -0,0 +1,37 @@
+drop table if exists issue_application;
+CREATE TABLE `issue_application` (
+ `ID` varchar(64) NOT NULL COMMENT '主键',
+ `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID',
+ `ISSUE_TITLE` varchar(128) NOT NULL COMMENT '议题名称 ',
+ `SUGGESTION` varchar(1024) NOT NULL COMMENT '建议',
+ `APPLY_STATUS` varchar(32) NOT NULL COMMENT '审核状态:under_auditing:待审核;approved:通过;rejected:驳回',
+ `TOPIC_ID` varchar(32) NOT NULL COMMENT '话题id',
+ `GROUP_ID` varchar(64) NOT NULL COMMENT '小组id',
+ `GRID_ID` varchar(32) NOT NULL COMMENT '网格ID 居民端议题对应一个网格Id',
+ `ISSUE_ID` varchar(64) DEFAULT NULL COMMENT '审核通过后对应的 议题id',
+ `PASSED_REASON` varchar(1024) DEFAULT NULL COMMENT '审核通过时填写的理由',
+ `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除',
+ `REVISION` int(11) NOT NULL DEFAULT '0' 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_application_history;
+CREATE TABLE `issue_application_history` (
+ `ID` varchar(64) NOT NULL COMMENT '主键',
+ `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID',
+ `ISSUE_APPLICATION_ID` varchar(64) NOT NULL COMMENT '话题转议题申请表 issue_application.id',
+ `ACTION_TYPE` varchar(32) NOT NULL COMMENT 'under_auditing:提交审核;\r\napproved:审核通过,\r\nrejected:驳回',
+ `REASON` varchar(1024) DEFAULT NULL COMMENT '审核时的说明',
+ `STAFF_NAME` varchar(255) DEFAULT NULL COMMENT '工作端人员姓名',
+ `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识:0 未删除 1已删除',
+ `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
+ `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人 提交人',
+ `CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
+ `UPDATED_BY` varchar(64) NOT NULL COMMENT '修改人ID',
+ `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/db/migration/V0.0.3__issue_sugg_tables.sql b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.3__issue_sugg_tables.sql
new file mode 100644
index 0000000000..0ee88d49d5
--- /dev/null
+++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.3__issue_sugg_tables.sql
@@ -0,0 +1,16 @@
+drop table if exists issue_suggestion;
+CREATE TABLE `issue_suggestion` (
+ `ID` varchar(64) NOT NULL COMMENT '主键',
+ `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id customer.id',
+ `ISSUE_ID` varchar(64) NOT NULL COMMENT '议题id',
+ `GRID_ID` varchar(64) NOT NULL COMMENT '议题所属网格id',
+ `SUGGESTION` varchar(512) NOT NULL COMMENT '对议题的想法',
+ `PUBLIC_FLAG` tinyint(1) NOT NULL COMMENT '1公开; 0匿名',
+ `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识:0 未删除 1已删除',
+ `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
+ `CREATED_BY` varchar(64) NOT NULL COMMENT '提建议的人',
+ `CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
+ `UPDATED_BY` varchar(64) NOT NULL COMMENT '修改人ID',
+ `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/IssueSuggestionDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueSuggestionDao.xml
new file mode 100644
index 0000000000..1c3ca8ce0a
--- /dev/null
+++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueSuggestionDao.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueDetailResultDTO.java b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueDetailResultDTO.java
index 0d95ff6c84..f1c2ee1f83 100644
--- a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueDetailResultDTO.java
+++ b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueDetailResultDTO.java
@@ -60,5 +60,13 @@ public class IssueDetailResultDTO implements Serializable {
*/
private String projectId = "";
+ /**
+ * 对议题的想法
+ */
+ private String issueIdea;
+ /**
+ * true已发表过想法,false未发表想法
+ */
+ private Boolean publishIdeaFlag;
}
diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
index 0551eb8423..015ae25e0c 100644
--- a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
+++ b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
@@ -1,11 +1,14 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
+import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constat.HallConstat;
+import com.epmet.dto.IssueSuggestionDTO;
import com.epmet.dto.form.CheckVoteFormDTO;
import com.epmet.dto.TopicInfoDTO;
import com.epmet.dto.form.*;
@@ -38,6 +41,10 @@ public class IssueServiceImpl implements IssueService {
private GovIssueFeignClient govIssueFeignClient;
@Autowired
private GovProjectFeignClient govProjectFeignClient;
+ @Autowired
+ private GovIssueOpenFeignClient govIssueOpenFeignClient;
+ @Autowired
+ private LoginUserUtil loginUserUtil;
/**
* @param issueDetail
@@ -96,6 +103,14 @@ public class IssueServiceImpl implements IssueService {
//已关闭议题,无需判断
issueDetailResult.setProjectStatus(true);
}
+ Result issueSuggestionDTOResult=govIssueOpenFeignClient.queryIssueSuggestion(new UserIssueSuggestionFormDTO(loginUserUtil.getLoginUserId(),issueDetail.getIssueId()));
+ if(!issueSuggestionDTOResult.success()||null==issueSuggestionDTOResult.getData()){
+ issueDetailResult.setPublishIdeaFlag(false);
+ issueDetailResult.setIssueIdea(StrConstant.EPMETY_STR);
+ }else{
+ issueDetailResult.setPublishIdeaFlag(true);
+ issueDetailResult.setIssueIdea(issueSuggestionDTOResult.getData().getSuggestion());
+ }
return issueDetailResult;
}