Browse Source

群组相关接口、议题相关接口

dev_shibei_match
wangchao 5 years ago
parent
commit
b294d386b1
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  2. 41
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CommonIssueListFormDTO.java
  3. 101
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueShiftedFromTopicFormDTO.java
  4. 36
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ClosedIssueListResultDTO.java
  5. 36
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/VotingIssueListResultDTO.java
  6. 16
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java
  7. 8
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java
  8. 11
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProcessDao.java
  9. 8
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProcessService.java
  10. 31
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java
  11. 12
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProcessServiceImpl.java
  12. 94
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  13. 70
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/utils/ModuleConstants.java
  14. 133
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml
  15. 79
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProcessDao.xml
  16. 41
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommonDataFilterResultDTO.java
  17. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  18. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  19. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  20. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  21. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java
  22. 15
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  23. 23
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CommonTopicIdFormDTO.java
  24. 41
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicTurnIssueFromDTO.java
  25. 36
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/ResiTopicAndGroupResultDTO.java
  26. 47
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/ResiTopicShiftIssueInitResultDTO.java
  27. 6
      epmet-module/resi-group/resi-group-server/pom.xml
  28. 29
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/GovIssueFeignClient.java
  29. 18
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java
  30. 23
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/GovIssueFeignClientFallBack.java
  31. 12
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java
  32. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java
  33. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  34. 14
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  35. 23
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java
  36. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java
  37. 27
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java
  38. 35
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java
  39. 18
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java
  40. 8
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicOperationDao.java
  41. 27
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java
  42. 95
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java
  43. 152
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  44. 49
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  45. 12
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml
  46. 46
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml
  47. 62
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicOperationDao.xml

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -31,6 +31,7 @@ public interface NumConstant {
int FORTY = 40;
int FIFTY = 50;
int ONE_HUNDRED = 100;
int ONE_THOUSAND = 1000;
int MAX = 99999999;
long ZERO_L = 0L;

41
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CommonIssueListFormDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 政府端/居民段查看表决中议题列表传参
* @ClassName CommonIssueListFormDTO
* @Auth wangc
* @Date 2020-05-14 09:51
*/
@Data
public class CommonIssueListFormDTO implements Serializable {
private static final long serialVersionUID = -436147374473316845L;
/**
* 网格Id
* */
@NotBlank(message = "网格Id不能为空")
private String gridId;
/**
* 页码
* */
@Min(1)
private Integer pageNo;
/**
* 每页多少条
* */
private Integer pageSize = 20;
/**
* 用户Id
* */
@NotBlank(message = "用户Id不能为空")
private String userId;
}

101
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueShiftedFromTopicFormDTO.java

@ -0,0 +1,101 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* @Description 话题转议题时的参数
* @ClassName IssueShiftedFromTopicFormDTO
* @Auth wangc
* @Date 2020-05-13 09:27
*/
@Data
public class IssueShiftedFromTopicFormDTO implements Serializable {
private static final long serialVersionUID = -5744319584210140289L;
/**
* 话题Id
* */
@NotBlank(message = "话题Id不能为空")
private String topicId;
/**
* 议题名称
* */
@NotBlank(message = "议题名称不能为空")
private String issueTitle;
/**
* 建议
* */
@NotBlank(message = "议题建议不能为空")
private String suggestion;
/**
* 议题发起人Id
* */
@NotBlank(message = "议题发起人Id不能为空")
private String userId;
/**
* 客户Id
* */
@NotBlank(message = "客户不能为空")
private String customerId;
/**
* 网格Id
* */
@NotBlank(message = "网格Id不能为空")
private String gridId;
/**
* AgencyId当前话题所在机构Id
* */
@NotBlank(message = "机关Id不能为空")
private String orgId;
/**
* 所属机关 eg:11:22:33(本机关以及上级所有机关ID)
* */
@NotBlank(message = "所属机关全路径不能为空")
private String orgIdPath;
/**
* 当前话题所在网格名称 - 对应议题流程的处理部门
* */
@NotBlank(message = "网格名称不能为空")
private String orgName;
/**
* 议题创建时间
* */
@NotBlank(message = "议题创建时间不能为空")
private Date createdTime;
/**
* 小组名称 - 对应议题流程的小组名称(文案)
* */
@NotBlank(message = "小组名称不能为空")
private String groupName;
/**
* 话题发起人名称 -对应议题流程的话题发起人(文案)
* */
@NotBlank(message = "话题发起人不能为空")
private String topicAuthor;
/**
* 议题发起人(组长)名称 - 对应议题流程的组长名称(文案)
* */
@NotBlank(message = "组长不能为空")
private String issueAuthor;
/**
* 应表决数
* */
private Integer votableCount;
}

36
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ClosedIssueListResultDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @ClassName ClosedIssueListResultDTO
* @Auth wangc
* @Date 2020-05-14 10:13
*/
@Data
public class ClosedIssueListResultDTO implements Serializable {
private static final long serialVersionUID = -132155225850638716L;
/**
* 议题id
* */
private String issueId;
/**
* 议题标题
* */
private String issueTitle;
/**
* 议题关闭时间 时间戳
* */
private Long issueClosedTime;
/**
* 解决方案
* */
private String solution;
}

36
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/VotingIssueListResultDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 政府端/居民段查看表决中议题列表返参
* @ClassName VotingIssueListResultDTO
* @Auth wangc
* @Date 2020-05-14 10:04
*/
@Data
public class VotingIssueListResultDTO implements Serializable {
private static final long serialVersionUID = -7134055957167447949L;
/**
* 议题发布时间
* */
private Long issuePublishTime;
/**
* 议题Id
* */
private String issueId;
/**
* 议题标题
* */
private String issueTitle;
/**
* 议题处理方式建议展示在列表中
* */
private String suggestion;
}

16
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java

@ -1,9 +1,13 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
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.form.IssueDetailFormDTO;
import com.epmet.dto.form.IssueShiftedFromTopicFormDTO;
import com.epmet.dto.result.IssueResultDTO;
import com.epmet.service.IssueService;
import org.springframework.beans.factory.annotation.Autowired;
@ -36,5 +40,17 @@ public class IssueController {
return new Result<IssueResultDTO>().ok(issueService.detail(issueDetail));
}
/**
* @Description 话题转议题 供群组话题服务调用
* @param issueShiftedFromTopicFormDTO
* @author wangc
* @date 2020.05.13 17:19
**/
@PostMapping(value = "topicshiftissue")
public Result<String> issueShiftedToTopic(@RequestBody IssueShiftedFromTopicFormDTO issueShiftedFromTopicFormDTO){
ValidatorUtils.validateEntity(issueShiftedFromTopicFormDTO);
return new Result<String>().ok(issueService.issueShiftedToTopic(issueShiftedFromTopicFormDTO));
}
}

8
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IssueDTO;
import com.epmet.dto.form.IssueDetailFormDTO;
import com.epmet.dto.result.IssueResultDTO;
import com.epmet.entity.IssueEntity;
@ -40,4 +41,11 @@ public interface IssueDao extends BaseDao<IssueEntity> {
*/
IssueResultDTO issueDetail(IssueDetailFormDTO formDTO);
/**
* @Description 新增一条议题
* @param issueDTO
* @author wangc
* @date 2020.05.13 15:46
**/
int insertOne(IssueDTO issueDTO);
}

11
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProcessDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IssueProcessDTO;
import com.epmet.entity.IssueProcessEntity;
import org.apache.ibatis.annotations.Mapper;
@ -29,5 +30,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IssueProcessDao extends BaseDao<IssueProcessEntity> {
/**
* @Description 新增议题流程 议题发声状态变更都要新增一条流程记录
* @param issueProcessDTO
* @author wangc
* @date 2020.05.13 15:55
**/
int insertOne(IssueProcessDTO issueProcessDTO);
}

8
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProcessService.java

@ -92,4 +92,12 @@ public interface IssueProcessService extends BaseService<IssueProcessEntity> {
* @date 2020-05-11
*/
void delete(String[] ids);
/**
* @Description 议题流程新增记录
* @param issueProcessDTO
* @author wangc
* @date 2020.05.13 16:42
**/
int insertOne(IssueProcessDTO issueProcessDTO);
}

31
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java

@ -1,10 +1,16 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.form.CommonIssueListFormDTO;
import com.epmet.dto.form.IssueDetailFormDTO;
import com.epmet.dto.form.IssueShiftedFromTopicFormDTO;
import com.epmet.dto.result.ClosedIssueListResultDTO;
import com.epmet.dto.result.IssueResultDTO;
import com.epmet.dto.result.VotingIssueListResultDTO;
import com.epmet.entity.IssueEntity;
import java.util.List;
/**
* @Author zxc
* @CreateTime 2020/5/11 9:44
@ -19,4 +25,29 @@ public interface IssueService extends BaseService<IssueEntity> {
*/
IssueResultDTO detail(IssueDetailFormDTO issueDetail);
/**
* @Description 话题转为议题入口 返回生成的议题Id
* @param issueShiftedFromTopicFormDTO IssueShiftedFromTopicFormDTO.class
* @author wangc
* @date 2020.05.13 16:08
**/
String issueShiftedToTopic(IssueShiftedFromTopicFormDTO issueShiftedFromTopicFormDTO);
/**
* @Description 表决中列表
* @param issueListForm
* @return List<VotingIssueListResultDTO>
* @author wangc
* @date 2020.05.14 10:13
**/
List<VotingIssueListResultDTO> votingList(CommonIssueListFormDTO issueListForm);
/**
* @Description 已关闭列表
* @param issueListForm
* @return List<ClosedIssueListResultDTO>
* @author wangc
* @date 2020.05.14 10:33
**/
List<ClosedIssueListResultDTO> closedList(CommonIssueListFormDTO issueListForm);
}

12
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProcessServiceImpl.java

@ -101,4 +101,16 @@ public class IssueProcessServiceImpl extends BaseServiceImpl<IssueProcessDao, Is
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Description 议题流程新增记录
* @param issueProcessDTO
* @author wangc
* @date 2020.05.13 16:42
**/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertOne(IssueProcessDTO issueProcessDTO) {
return baseDao.insertOne(issueProcessDTO);
}
}

94
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java

@ -1,13 +1,32 @@
package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IssueDao;
import com.epmet.dto.IssueDTO;
import com.epmet.dto.IssueProcessDTO;
import com.epmet.dto.IssueVoteStatisticalDTO;
import com.epmet.dto.form.CommonIssueListFormDTO;
import com.epmet.dto.form.IssueDetailFormDTO;
import com.epmet.dto.form.IssueShiftedFromTopicFormDTO;
import com.epmet.dto.result.ClosedIssueListResultDTO;
import com.epmet.dto.result.IssueResultDTO;
import com.epmet.dto.result.VotingIssueListResultDTO;
import com.epmet.entity.IssueEntity;
import com.epmet.service.IssueProcessService;
import com.epmet.service.IssueService;
import com.epmet.service.IssueVoteStatisticalService;
import com.epmet.utils.ModuleConstants;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @Author zxc
@ -16,9 +35,17 @@ import org.springframework.stereotype.Service;
@Service
public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> implements IssueService {
protected static final Logger logger = LoggerFactory.getLogger(IssueServiceImpl.class);
@Autowired
private IssueDao issueDao;
@Autowired
private IssueProcessService issueProcessService;
@Autowired
private IssueVoteStatisticalService issueVoteStatisticalService;
/**
* @Description 议题详情
* @param issueDetail
@ -31,4 +58,71 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
IssueResultDTO issueResult = issueDao.issueDetail(issueDetail);
return issueResult;
}
/**
* @Description 话题转为议题入口 返回生成的议题Id
* @param issueShiftedFromTopicFormDTO IssueShiftedFromTopicFormDTO.class
* @author wangc
* @date 2020.05.13 16:08
**/
@Override
@Transactional(rollbackFor = Exception.class)
public String issueShiftedToTopic(IssueShiftedFromTopicFormDTO issueShiftedFromTopicFormDTO) {
//1.新增议题
IssueDTO issueDTO = ConvertUtils.sourceToTarget(issueShiftedFromTopicFormDTO,IssueDTO.class);
issueDTO.setCreatedBy(issueShiftedFromTopicFormDTO.getUserId());
issueDTO.setSourceType(ModuleConstants.ISSUE_FROM_TOPIC);
issueDTO.setSourceId(issueShiftedFromTopicFormDTO.getTopicId());
issueDTO.setIssueStatus(ModuleConstants.ISSUE_STATUS_VOTING);
issueDTO.setDecidedTime(issueShiftedFromTopicFormDTO.getCreatedTime());
int issueAffectedRow = baseDao.insertOne(issueDTO);
if(issueAffectedRow == 1 && StringUtils.isNotBlank(issueDTO.getId())){
//2.新增议题流程
IssueProcessDTO issueProcessDTO = new IssueProcessDTO();
issueProcessDTO.setIssueId(issueDTO.getId());
issueProcessDTO.setIssueStatus(ModuleConstants.ISSUE_STATUS_VOTING);
issueProcessDTO.setOrgType(ModuleConstants.ISSUE_PROCESS_ORG_TYPE_GRID);
issueProcessDTO.setOrgId(issueShiftedFromTopicFormDTO.getGridId());
issueProcessDTO.setOrgName(issueShiftedFromTopicFormDTO.getOrgName());
issueProcessDTO.setCreatedBy(issueDTO.getCreatedBy());
issueProcessDTO.setCreatedTime(issueDTO.getCreatedTime());
issueProcessDTO.setOperationExplain(String.format(ModuleConstants.ISSUE_PROCESS_VOTING_OPERATION_EXPLAIN_TEMPLATE,
issueShiftedFromTopicFormDTO.getGroupName(),
issueShiftedFromTopicFormDTO.getTopicAuthor(),
issueShiftedFromTopicFormDTO.getIssueAuthor(),
issueShiftedFromTopicFormDTO.getIssueTitle()
));
int issueProcessAffectedRow = issueProcessService.insertOne(issueProcessDTO);
if(issueProcessAffectedRow != NumConstant.ONE || StringUtils.isBlank(issueProcessDTO.getId())){
logger.warn(String.format(
ModuleConstants.FAILURE_TO_ADD_ISSUE_PROCESS_LOG_TEMPLATE,issueDTO.getId()));
throw new RenException(ModuleConstants.FAILURE_TO_ADD_ISSUE_PROCESS);
}
//3.新增议题表决统计表
IssueVoteStatisticalDTO voteStatistical = new IssueVoteStatisticalDTO();
voteStatistical.setIssueId(issueDTO.getId());
//应表决数,该网格下所有的居民
voteStatistical.setVotableCount(issueShiftedFromTopicFormDTO.getVotableCount());
issueVoteStatisticalService.save(voteStatistical);
//4.该网格下表决中议题总数量+1
return issueDTO.getId();
}
logger.warn(String.format(
ModuleConstants.FAILURE_TO_ADD_ISSUE_LOG_TEMPLATE,issueDTO.getId(),
issueDTO.getSourceType(),
issueDTO.getSourceId()));
throw new RenException(ModuleConstants.FAILURE_TO_ADD_ISSUE);
}
@Override
public List<VotingIssueListResultDTO> votingList(CommonIssueListFormDTO issueListForm) {
return null;
}
@Override
public List<ClosedIssueListResultDTO> closedList(CommonIssueListFormDTO issueListForm) {
return null;
}
}

70
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/utils/ModuleConstants.java

@ -0,0 +1,70 @@
package com.epmet.utils;
/**
* @Author wangc
* @CreateTime 2020/5/11 9:46
*/
public interface ModuleConstants {
/**
* 议题状态表决中
* */
String ISSUE_STATUS_VOTING = "voting";
/**
* 议题状态已转项目
* */
String ISSUE_STATUS_SHIFT_PROJECT = "shift_project";
/**
* 议题状态已关闭
* */
String ISSUE_STATUS_CLOSED = "closed";
/**
* 议题来源居民段话题
* */
String ISSUE_FROM_TOPIC = "resi_topic";
/**
* 议题进展-当前操作组织类型-机构 不要与数据权限混淆
* */
String ISSUE_PROCESS_ORG_TYPE_AGENCY = "agency";
/**
* 议题进展-当前操作组织类型-部门 不要与数据权限混淆
* */
String ISSUE_PROCESS_ORG_TYPE_DEPT = "dept";
/**
* 议题进展-当前操作组织类型-网格 不要与数据权限混淆
* */
String ISSUE_PROCESS_ORG_TYPE_GRID = "grid";
/**
* 话题转议题流程的操作文案模板
* */
String ISSUE_PROCESS_VOTING_OPERATION_EXPLAIN_TEMPLATE = "【%s】%s发表的话题被组长%s转为议题:【%s】";
/**
* 新增议题流程记录失败日志模板
* */
String FAILURE_TO_ADD_ISSUE_PROCESS_LOG_TEMPLATE = "新增议题流程记录失败,议题Id:【%s】";
/**
* 新增议题记录失败日志模板
* */
String FAILURE_TO_ADD_ISSUE_LOG_TEMPLATE = "新增议题记录失败,议题来源:【%s】,议题来源Id:【%s】";
/**
* 新增议题流程记录失败日志模板
* */
String FAILURE_TO_ADD_ISSUE_PROCESS = "新增议题流程记录失败】";
/**
* 新增议题记录失败日志模板
* */
String FAILURE_TO_ADD_ISSUE = "新增议题记录失败,议题来源";
}

133
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml

@ -43,4 +43,137 @@
AND del_flag = 0
</select>
<!-- 新增议题 -->
<insert id="insertOne" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.epmet.dto.IssueDTO">
<selectKey keyProperty="id" resultType="java.lang.String" order="BEFORE">
SELECT replace(uuid(),'-','') AS ID
</selectKey>
INSERT INTO issue
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test ='null != issueStatus'>
issue_status,
</if>
<if test ='null != sourceType'>
source_type,
</if>
<if test ='null != sourceId'>
source_id,
</if>
<if test ='null != closeReason'>
close_reason,
</if>
<if test ='null != resolveType'>
resolve_type,
</if>
<if test ='null != issueTitle'>
issue_title,
</if>
<if test ='null != suggestion'>
suggestion,
</if>
<if test ='null != customerId'>
customer_id,
</if>
<if test ='null != gridId'>
grid_id,
</if>
<if test ='null != orgIdPath'>
org_id_path,
</if>
<if test ='null != orgId'>
org_id,
</if>
<if test ='null != votingDeadline'>
voting_deadline,
</if>
<if test ='null != decidedTime'>
decided_time,
</if>
<if test ='null != shiftedTime'>
shifted_time,
</if>
<if test ='null != closedTime'>
closed_time,
</if>
<if test ='null != createdBy'>
created_by,
</if>
<if test ='null != createdTime'>
created_time,
</if>
<if test ='null != createdBy'>
updated_by,
</if>
<if test ='null != createdTime'>
updated_time,
</if>
del_flag,
revision
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id},
<if test ='null != issueStatus'>
#{issueStatus},
</if>
<if test ='null != sourceType'>
#{sourceType},
</if>
<if test ='null != sourceId'>
#{sourceId},
</if>
<if test ='null != closeReason'>
#{closeReason},
</if>
<if test ='null != resolveType'>
#{resolveType},
</if>
<if test ='null != issueTitle'>
#{issueTitle},
</if>
<if test ='null != suggestion'>
#{suggestion},
</if>
<if test ='null != customerId'>
#{customerId},
</if>
<if test ='null != gridId'>
#{gridId},
</if>
<if test ='null != orgIdPath'>
#{orgIdPath},
</if>
<if test ='null != orgId'>
#{orgId},
</if>
<if test ='null != votingDeadline'>
#{votingDeadline},
</if>
<if test ='null != decidedTime'>
#{decidedTime},
</if>
<if test ='null != shiftedTime'>
#{shiftedTime},
</if>
<if test ='null != closedTime'>
#{closedTime},
</if>
<if test ='null != createdBy'>
#{createdBy},
</if>
<if test ='null != createdTime'>
#{createdTime},
</if>
<if test ='null != createdBy'>
#{createdBy},
</if>
<if test ='null != createdTime'>
#{createdTime},
</if>
'0',
0
</trim>
</insert>
</mapper>

79
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProcessDao.xml

@ -19,5 +19,84 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 新增议题流程 议题发声状态变更,都要新增一条流程记录 -->
<insert id="insertOne" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.epmet.dto.IssueProcessDTO">
<selectKey keyProperty="id" resultType="java.lang.String" order="BEFORE">
SELECT replace(uuid(),'-','') AS ID
</selectKey>
INSERT INTO issue_process
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test ='null != issueId'>
issue_id,
</if>
<if test ='null != issueStatus'>
issue_status,
</if>
<if test ='null != orgType'>
org_type,
</if>
<if test ='null != orgId'>
org_id,
</if>
<if test ='null != operationExplain'>
operation_explain,
</if>
<if test ='null != createdBy'>
created_by,
</if>
<if test ='null != createdTime'>
created_time,
</if>
<if test ='null != createdBy'>
updated_by,
</if>
<if test ='null != createdTime'>
updated_time,
</if>
<if test ='null != orgName'>
org_name,
</if>
del_flag,
revision
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id},
<if test ='null != issueId'>
#{issueId},
</if>
<if test ='null != issueStatus'>
#{issueStatus},
</if>
<if test ='null != orgType'>
#{orgType},
</if>
<if test ='null != orgId'>
#{orgId},
</if>
<if test ='null != operationExplain'>
#{operationExplain},
</if>
<if test ='null != createdBy'>
#{createdBy},
</if>
<if test ='null != createdTime'>
#{createdTime},
</if>
<if test ='null != updatedBy'>
#{createdBy},
</if>
<if test ='null != updatedTime'>
#{createdTime},
</if>
<if test ='null != orgName'>
#{orgName},
</if>
'0',
0
</trim>
</insert>
</mapper>

41
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommonDataFilterResultDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 数据权限信息
* @ClassName CommonDataFilterResultDTO
* @Auth wangc
* @Date 2020-05-13 10:49
*/
@Data
public class CommonDataFilterResultDTO implements Serializable {
private static final long serialVersionUID = 4574851766448601457L;
/**
* 所属机构Id全路径 agencyId
* */
private String orgIdPath;
/**
* 当前组织所属机关Id
* */
private String agencyId;
/**
* 当前组织名称 eg:agencyName | agencyName-deptName | agencyName-gridName
* */
private String orgName;
/**
* 当前组织的类型 agency | grid | dept
* */
private String orgType;
/**
* 当前组织Id
* */
private String orgId;
}

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -26,11 +26,8 @@ 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.CustomerGridDTO;
import com.epmet.dto.form.BelongGridNameFormDTO;
import com.epmet.dto.form.SelectGridNameByGridIdFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.excel.CustomerGridExcel;
import com.epmet.service.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
@ -194,4 +191,17 @@ public class CustomerGridController {
return new Result<BelongGridNameResultDTO>().ok(customerGridService.getGridNameByGridId(formDTO));
}
/**
* @Description 得到网格的数据权限信息 开放给各个服务使用
* @param gridForm
* @return Result<CommonDataFilterResultDTO>
* @author wangc
* @date 2020.05.13 11:14
**/
@PostMapping("griddatafilter")
public Result<CommonDataFilterResultDTO> gridDataFilter(@RequestBody CommonGridIdFormDTO gridForm){
ValidatorUtils.validateEntity(gridForm);
return new Result<CommonDataFilterResultDTO>().ok(customerGridService.getGridDataFilterMsg(gridForm));
}
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -160,4 +160,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @date 2020/5/11 18:50
*/
BelongGridNameResultDTO getGridNameByGridId(BelongGridNameFormDTO formDTO);
/**
* @Description 通过网格Id获取网格所需要的数据权限信息
* @param gridId
* @author wangc
* @date 2020.05.13 11:01
**/
CommonDataFilterResultDTO getGridDataFilterMsg(@Param("gridId")String gridId);
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -236,4 +236,11 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
*/
BelongGridNameResultDTO getGridNameByGridId(BelongGridNameFormDTO formDTO);
/**
* @Description 通过网格Id获取网格所需要的数据权限信息
* @param gridIdFormDTO
* @author wangc
* @date 2020.05.13 11:01
**/
CommonDataFilterResultDTO getGridDataFilterMsg(CommonGridIdFormDTO gridIdFormDTO);
}

16
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -27,6 +27,7 @@ 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.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerGridConstant;
import com.epmet.dao.CustomerAgencyDao;
@ -547,4 +548,19 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
public BelongGridNameResultDTO getGridNameByGridId(BelongGridNameFormDTO formDTO) {
return baseDao.getGridNameByGridId(formDTO);
}
/**
* @Description 通过网格Id获取网格所需要的数据权限信息
* @param gridIdFormDTO
* @author wangc
* @date 2020.05.13 11:01
**/
@Override
public CommonDataFilterResultDTO getGridDataFilterMsg(CommonGridIdFormDTO gridIdFormDTO) {
CommonDataFilterResultDTO dataFilterMsg = baseDao.getGridDataFilterMsg(gridIdFormDTO.getGridId());
if(null != dataFilterMsg){
dataFilterMsg.setOrgType(ModuleConstant.ORG_TYPE_GRID);
}
return dataFilterMsg;
}
}

15
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java

@ -56,4 +56,19 @@ public interface ModuleConstant {
* 没有可添加的人员
* */
String NO_APPROPRIATE_STAFF_TO_ADD = "没有可添加的人员(可能原因:选中人员已在网格内),终止操作。";
/**
* 组织类型机关
* */
String ORG_TYPE_AGENCY = "agency";
/**
* 组织类型部门
* */
String ORG_TYPE_DEPT = "dept";
/**
* 组织类型网格
* */
String ORG_TYPE_GRID = "grid";
}

15
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -285,4 +285,19 @@
AND cg.del_flag = 0
</select>
<!-- 通过网格Id获取网格所需要的数据权限信息 -->
<select id="getGridDataFilterMsg" resultType="com.epmet.dto.result.CommonDataFilterResultDTO">
SELECT
IFNULL(grid.PID,'') AS agencyId,
IFNULL(grid.PIDS,'') AS orgIdPath,
IFNULL(grid.ID,'') AS orgId,
IFNULL(CONCAT( agency.ORGANIZATION_NAME, '-', grid.GRID_NAME ),'') AS ORG_NAME
FROM
CUSTOMER_GRID grid
INNER JOIN CUSTOMER_AGENCY agency ON grid.PID = agency.ID
WHERE
grid.DEL_FLAG = '0'
AND agency.DEL_FLAG = '0'
AND grid.ID = #{gridId}
</select>
</mapper>

23
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CommonTopicIdFormDTO.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;
/**
* @Description 通用的话题Id传参DTO包含话题Id和用户Id
* @ClassName CommonTopicIdFormDTO
* @Auth wangc
* @Date 2020-05-12 11:14
*/
@Data
public class CommonTopicIdFormDTO implements Serializable {
private static final long serialVersionUID = -6867868118191947074L;
@NotBlank(message = "话题Id不能为空")
private String topicId;
@NotBlank(message = "用户Id不能为空")
private String userId;
}

41
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicTurnIssueFromDTO.java

@ -0,0 +1,41 @@
package com.epmet.resi.group.dto.topic.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 话题转议题时前端传参
* @ClassName ResiTopicTurnIssueFromDTO
* @Auth wangc
* @Date 2020-05-13 10:19
*/
@Data
public class ResiTopicTurnIssueFromDTO implements Serializable {
private static final long serialVersionUID = -534799870823111781L;
/**
* 议题名称
* */
@NotBlank(message = "议题名称")
private String issueTitle;
/**
* 话题Id
* */
@NotBlank(message = "话题Id")
private String topicId;
/**
* 建议
* */
@NotBlank(message = "建议")
private String suggestion;
/**
* 用户Id
* */
@NotBlank(message = "用户Id不能为空")
private String userId;
}

36
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/ResiTopicAndGroupResultDTO.java

@ -0,0 +1,36 @@
package com.epmet.resi.group.dto.topic.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 话题所在小组相关信息DTO
* @ClassName ResiTopicAndGroupResultDTO
* @Auth wangc
* @Date 2020-05-13 14:54
*/
@Data
public class ResiTopicAndGroupResultDTO implements Serializable {
private static final long serialVersionUID = -2247558008863128347L;
/**
* 组Id
* */
private String groupId;
/**
* 话题作者Id
* */
private String topicAuthorId;
/**
* 网格Id
* */
private String gridId;
/**
* 客户Id
* */
private String customerId;
}

47
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/ResiTopicShiftIssueInitResultDTO.java

@ -0,0 +1,47 @@
package com.epmet.resi.group.dto.topic.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @ClassName ResiTopicShiftIssueInitResultDTO
* @Auth wangc
* @Date 2020-05-12 10:57
*/
@Data
public class ResiTopicShiftIssueInitResultDTO implements Serializable {
private static final long serialVersionUID = 4798036194688707074L;
/**
* 话题Id
* */
private String topicId;
/**
* 话题内容
* */
private String topicContent;
/**
* 话题图片
* */
private List<String> topicImgs;
/**
* 所属网格名称
* */
private String belongGridName;
/**
* 话题发布人昵称
* */
private String releaseUserName;
/**
* 话题发布时间
* */
private Long releaseTime;
}

6
epmet-module/resi-group/resi-group-server/pom.xml

@ -76,6 +76,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-issue-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

29
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/GovIssueFeignClient.java

@ -0,0 +1,29 @@
package com.epmet.modules.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.IssueShiftedFromTopicFormDTO;
import com.epmet.modules.feign.fallback.GovIssueFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @Description gov-issue服务fegin
* @Author wangc
* @Date 2020/5/12 10:00
* url = "localhost:8101"
*/
@FeignClient(name = ServiceConstant.GOV_ISSUE_SERVER , fallback = GovIssueFeignClientFallBack.class)
public interface GovIssueFeignClient {
/**
* @Description 话题转议题
* @param issueShiftedFromTopicFormDTO
* @author wangc
* @date 2020.05.13 18:19
**/
@PostMapping(value = "gov/issue/issue/topicshiftissue", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<String> issueShiftedToTopic(IssueShiftedFromTopicFormDTO issueShiftedFromTopicFormDTO);
}

18
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java

@ -5,6 +5,8 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDepartmentDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.result.CommonDataFilterResultDTO;
import com.epmet.modules.feign.fallback.GovOrgFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@ -22,14 +24,14 @@ import java.util.List;
public interface GovOrgFeignClient {
/**
* @param id - gridId
* @param customerGridFormDTO
* @return Result<CustomerGridDTO>
* @Author wangc
* @Description 查询网格信息
* @Date 2020/3/30 10:45
**/
@GetMapping("/gov/org/customergrid/{id}")
Result<CustomerGridDTO> getGrid(String id);
@GetMapping("/gov/org/customergrid/getcustomergridbygridid")
Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO);
/**
* @Description 查询部门信息
@ -49,4 +51,14 @@ public interface GovOrgFeignClient {
**/
@PostMapping("/gov/org/customerstaffgrid/getgridstaffs")
Result<List<String>> getGridStaffs(@RequestBody CommonGridIdFormDTO gridIdFormDTO);
/**
* @param gridForm
* @return Result<CommonDataFilterResultDTO>
* @Author wangc
* @Description 获取网格所需要的数据权限内容
* @Date 2020/3/30 10:45
**/
@GetMapping("/gov/org/customergrid/griddatafilter")
Result<CommonDataFilterResultDTO> gridDataFilter(CommonGridIdFormDTO gridForm);
}

23
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/GovIssueFeignClientFallBack.java

@ -0,0 +1,23 @@
package com.epmet.modules.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.IssueShiftedFromTopicFormDTO;
import com.epmet.modules.feign.GovIssueFeignClient;
import org.springframework.stereotype.Component;
/**
* @Description gov-issue服务fegin服务降级
* @ClassName GovIssueFeignClientFallBack
* @Auth wangc
* @Date 2020-05-12 10:02
*/
@Component
public class GovIssueFeignClientFallBack implements GovIssueFeignClient {
@Override
public Result<String> issueShiftedToTopic(IssueShiftedFromTopicFormDTO issueShiftedFromTopicFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "issueShiftedToTopic", issueShiftedFromTopicFormDTO);
}
}

12
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java

@ -7,7 +7,10 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDepartmentDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.result.CommonDataFilterResultDTO;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.utils.ModuleConstant;
import org.springframework.stereotype.Component;
import java.util.List;
@ -18,8 +21,8 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
@Override
public Result<CustomerGridDTO> getGrid(String id) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGrid", id);
public Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER,"getCustomerGridByGridId",customerGridFormDTO);
}
@Override
@ -31,4 +34,9 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
public Result<List<String>> getGridStaffs(CommonGridIdFormDTO gridIdFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridStaffs", gridIdFormDTO);
}
@Override
public Result<CommonDataFilterResultDTO> gridDataFilter(CommonGridIdFormDTO gridForm) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "gridDataFilter", gridForm);
}
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java

@ -139,4 +139,13 @@ public interface ResiGroupDao extends BaseDao<ResiGroupEntity> {
* @Date 2020.04.20 11:17
**/
ApplyingGroupDetailResultDTO getApplyingGroupDetailByGroupId(@Param("groupId") String groupId);
/**
* @Description 查询一个网格下面所有组Id
* @param gridId
* @return List<String>
* @author wangc
* @date 2020.05.14 10:54
**/
List<String> getGroupIdByGridId(@Param("gridId") String gridId);
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java

@ -241,4 +241,13 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
* @Date 2020.04.19 23:32
**/
Result<ApplyingGroupDetailResult2DTO> getApplyingGroupDetail(CommonGroupIdFromDTO groupId);
/**
* @Description 查询一个网格下面所有组Id
* @param gridId
* @return List<String>
* @author wangc
* @date 2020.05.14 10:54
**/
List<String> getGroupIdByGridId(String gridId);
}

14
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -786,6 +786,20 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
return new Result<ApplyingGroupDetailResult2DTO>().ok(ConvertUtils.sourceToTarget(detail, ApplyingGroupDetailResult2DTO.class));
}
/**
* @Description 查询一个网格下面所有组Id
* @param gridId
* @return List<String>
* @author wangc
* @date 2020.05.14 10:54
**/
@Override
public List<String> getGroupIdByGridId(String gridId) {
if(StringUtils.isBlank(gridId)) return null;
return baseDao.getGroupIdByGridId(gridId);
}
/**
* @Description 给加入此网格的网格长发送消息
* @param msg

23
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java

@ -165,4 +165,27 @@ public class ResiGroupMemberRedis {
result.setMemberMap(memberMap);
return result;
}
/**
* @Description 得到这个组下所有的成员Id
* @param groupId
* @return List<String>
* @author wangc
* @date 2020.05.14 11:03
**/
public Set<String> getGroupMemberIds(String groupId){
Set<String> groupMemberKeys =
redisUtils.keys(RedisKeys.getResiGroupMemberInfoKey(groupId,"*"));
if(null != groupMemberKeys && groupMemberKeys.size() > NumConstant.ZERO){
StringBuilder keyPrefix = new StringBuilder("resi:group:member:");
keyPrefix.append(groupId);
Set<String> memberIds = new HashSet<>();
groupMemberKeys.forEach(key -> {
memberIds.add(key.replace(keyPrefix.toString(),""));
});
return memberIds;
}
return null;
}
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java

@ -176,4 +176,13 @@ public interface ResiGroupMemberService extends BaseService<ResiGroupMemberEntit
* @Description 楼院小组--禁言组成员
**/
Result slientMember(SlientMemberFormDTO slientMemberFormDTO);
/**
* @Description 得到所在网格下所有的居民数 去重
* @param gridId
* @return
* @author wangc
* @date 2020.05.14 10:48
**/
Integer gridResiCount(String gridId);
}

27
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java

@ -552,7 +552,32 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
return result;
}
/**
/**
* @Description 得到所在网格下所有的居民数 去重
* @param gridId
* @return
* @author wangc
* @date 2020.05.14 10:48
**/
@Override
public Integer gridResiCount(String gridId) {
//1.查询网格下有多少组
List<String> groupIds = resiGroupService.getGroupIdByGridId(gridId);
//2.去缓存中拿取这些组的信息
if(null != groupIds && groupIds.size() > NumConstant.ZERO){
Set<String> set = new HashSet<>();
groupIds.forEach( id -> {
Set<String> members = resiGroupMemberRedis.getGroupMemberIds(id);
if(null != members && members.size() > NumConstant.ZERO){
set.addAll(members);
}
});
return set.size();
}
return NumConstant.ZERO;
}
/**
* @Description 将ResiGroupMemberDTO转换成ResiGroupMemberInfoRedisDTO
* @Param
* @return

35
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java

@ -7,10 +7,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.modules.topic.service.ResiTopicService;
import com.epmet.resi.group.dto.topic.TopicInfoDTO;
import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicIncludeIssueDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicIncludeIssueInfoResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO;
import com.epmet.resi.group.dto.topic.result.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -199,4 +196,34 @@ public class ResiTopicController {
return new Result<TopicInfoDTO>().ok(topicService.selectDetail(topicInfo));
}
/**
* @Description 话题转议题初始化如果不符合转议题的条件会抛异常
* @param tokenDto
* @param topicIdFormDTO
* @author wangc
* @date 2020.05.12 16:28
**/
@PostMapping("initturnissue")
public Result<ResiTopicShiftIssueInitResultDTO> initTurnIssue(@LoginUser TokenDto tokenDto,@RequestBody CommonTopicIdFormDTO topicIdFormDTO){
topicIdFormDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(topicIdFormDTO);
return new Result<ResiTopicShiftIssueInitResultDTO>().ok(topicService.initTopicInfoWhenShift(topicIdFormDTO));
}
/**
* @Description 话题转议题
* @param topicTurnIssueFromDTO
* @param tokenDto
* @author wangc
* @date 2020.05.13 19:08
**/
@PostMapping("turnintoissue")
public Result turnIntoIssue(@LoginUser TokenDto tokenDto,@RequestBody ResiTopicTurnIssueFromDTO topicTurnIssueFromDTO){
topicTurnIssueFromDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(topicTurnIssueFromDTO);
topicService.shiftIssue(topicTurnIssueFromDTO);
return new Result();
}
}

18
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java

@ -20,9 +20,11 @@ package com.epmet.modules.topic.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.topic.entity.ResiTopicEntity;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.TopicInfoDTO;
import com.epmet.resi.group.dto.topic.form.ResiTopicPageFormDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicAndGroupResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicIncludeIssueInfoResultDTO;
import com.epmet.resi.group.dto.topic.form.TopicInfoFormDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO;
@ -120,4 +122,20 @@ public interface ResiTopicDao extends BaseDao<ResiTopicEntity> {
* @date 2020/5/11 15:28
*/
TopicInfoDTO selectDetail(TopicInfoFormDTO formDTO);
/**
* @Description 根据话题Id获取小组的信息
* @param topicId
* @author wangc
* @date 2020.05.13 13:50
**/
ResiTopicAndGroupResultDTO getGroupInfoByTopicId(@Param("topicId")String topicId);
/**
* @Description
* @param topic ResiTopicEntity.class
* @author wangc
* @date 2020.05.13 18:52
**/
int updateOne(ResiTopicEntity topic);
}

8
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicOperationDao.java

@ -40,4 +40,12 @@ public interface ResiTopicOperationDao extends BaseDao<ResiTopicOperationEntity>
**/
int insertOne(ResiTopicOperationEntity topicOperationEntity);
/**
* @Description 按传参进行新增操作
* @param topicOperationEntity
* @return int 受影响的行数
* @author wangc
* @date 2020.05.14 09:16
**/
int insertOneByParams(ResiTopicOperationEntity topicOperationEntity);
}

27
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java

@ -26,15 +26,10 @@ import com.epmet.modules.topic.entity.ResiTopicEntity;
import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.TopicInfoDTO;
import com.epmet.resi.group.dto.topic.form.ResiTopicOperationFormDTO;
import com.epmet.resi.group.dto.topic.form.ResiTopicPageFormDTO;
import com.epmet.resi.group.dto.topic.form.ResiTopicPublishFormDTO;
import com.epmet.resi.group.dto.topic.form.TopicInfoFormDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicIncludeIssueDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicIncludeIssueInfoResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO;
import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.result.*;
import java.util.List;
@ -229,4 +224,20 @@ public interface ResiTopicService extends BaseService<ResiTopicEntity> {
*/
TopicInfoDTO selectDetail(TopicInfoFormDTO formDTO);
/**
* @Description 话题转议题时初始化数据
* @param topicIdFormDTO
* @author wangc
* @date 2020.05.12 13:53
**/
ResiTopicShiftIssueInitResultDTO initTopicInfoWhenShift(CommonTopicIdFormDTO topicIdFormDTO);
/**
* @Description 话题转议题
* @param topicTurnIssueFromDTO
* @author wangc
* @date 2020.05.13 10:28
**/
void shiftIssue(ResiTopicTurnIssueFromDTO topicTurnIssueFromDTO);
}

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

@ -23,6 +23,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
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.redis.RedisKeys;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
@ -32,6 +33,8 @@ import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.comment.entity.ResiTopicCommentEntity;
import com.epmet.modules.feign.EpmetUserFeignClient;
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.ResiTopicCommentDao;
import com.epmet.modules.topic.service.ResiTopicCommentService;
@ -42,9 +45,12 @@ import com.epmet.resi.group.constant.TopicConstant;
import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO;
import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO;
import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO;
import com.epmet.resi.group.dto.topic.ResiTopicCommentDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.ResiPublishCommentFormDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -52,10 +58,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 话题评论表
@ -75,6 +79,12 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
@Autowired
EpmetUserFeignClient epmetUserFeignClient;
@Autowired
ResiGroupMemberRedis resiGroupMemberRedis;
@Autowired
ResiGroupMemberDao resiGroupMemberDao;
private final Log logger = LogFactory.getLog(getClass());
@Override
@ -192,8 +202,10 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
commentFormDTO.setPageNo((commentFormDTO.getPageNo() - NumConstant.ONE) * commentFormDTO.getPageSize());
List<ResiCommentResultDTO> comments = baseDao.getCommentList(commentFormDTO);
if (null != comments && comments.size() > 0) {
List<String> userIdList = new ArrayList<>();
//获取groupId
ResiTopicDTO topic =
resiTopicService.get(commentFormDTO.getTopicId());
/*List<String> userIdList = new ArrayList<>();
for (ResiCommentResultDTO comment : comments) {
userIdList.add(comment.getUserId());
}
@ -214,7 +226,8 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
}
}else{
logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND);
}
}*/
setCacheUserInfo(topic.getGroupId(),comments);
}
return new Result<List<ResiCommentResultDTO>>().ok(comments);
@ -232,5 +245,73 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
return getCommentList(null,commentFormDTO);
}
/**
* @Description 在评论列表中放入用户头像和昵称信息
* @param groupId
* @param comments - List<ResiCommentResultDTO>
* @author wangc
* @date 2020.05.12 17:12
**/
private void setCacheUserInfo(String groupId,List<ResiCommentResultDTO> comments){
//1.初始化存储缺失缓存信息的组员Id的容器,默认去重
Set<String> usersNotInCache = new HashSet<>();
//2.读取用户缓存信息
ResiGroupMemberInfoRedisResultDTO memberRedis = resiGroupMemberRedis.getKeys(groupId);
if (null != memberRedis && null != memberRedis.getMemberKeys() && null != memberRedis.getMemberMap()) {
String keyPrefix = RedisKeys.getResiGroupMemberInfoKey(groupId, "");
for (ResiCommentResultDTO comment : comments)
{
//缓存中有该用户的key
if (memberRedis.getMemberKeys().contains(keyPrefix.concat(comment.getUserId()))) {
ResiGroupMemberInfoRedisDTO memberInfoCache = memberRedis.getMemberMap().get(comment.getUserId());
if (null != memberInfoCache) {
//缓存中有该用户信息
comment.setCommentUserName(memberInfoCache.getUserShowName());
comment.setCommentUserHeadPhoto(memberInfoCache.getUserHeadPhoto());
} else {
//缓存中没有该用户信息
usersNotInCache.add(comment.getUserId());
}
} else {
//缓存中没有该用户的key
usersNotInCache.add(comment.getUserId());
}
}
}
//3.如果存在缺失缓存的组员,去数据库中查找,并存入缓存
if (usersNotInCache.size() > 0) {
Map<String, List<ResiCommentResultDTO>> commentMap
= comments.stream().collect(Collectors.groupingBy(ResiCommentResultDTO::getUserId));
List<String> userIds = new ArrayList<>(usersNotInCache);
Result<List<UserResiInfoResultDTO>> result =
epmetUserFeignClient.getUserResiInfoList(new UserResiInfoListFormDTO(userIds));
if (result.success() && null != result.getData() && result.getData().size() > 0) {
for (UserResiInfoResultDTO user : result.getData()) {
ResiCommentResultDTO comment =
commentMap.get(user.getUserId()).get(0);
comment.setCommentUserName(user.getShowName());
comment.setCommentUserHeadPhoto(user.getHeadPhoto());
//存入缓存
ResiGroupMemberInfoRedisDTO memberRedisDTO = new ResiGroupMemberInfoRedisDTO();
ResiGroupMemberDTO memberMySql = resiGroupMemberDao.selectGroupMemberInfo(groupId, user.getUserId());
memberRedisDTO.setMemberStatus(memberMySql.getStatus());
memberRedisDTO.setUserId(user.getUserId());
memberRedisDTO.setUserShowName(user.getShowName());
memberRedisDTO.setEnterGroupType(memberMySql.getEnterGroupType());
memberRedisDTO.setGroupLeaderFlag(memberMySql.getGroupLeaderFlag());
memberRedisDTO.setUserHeadPhoto(user.getHeadPhoto());
memberRedisDTO.setGroupId(groupId);
resiGroupMemberRedis.set(memberRedisDTO);
}
} else {
logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND);
}
}
}
}

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

@ -28,13 +28,17 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisKeys;
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.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CommonDataFilterResultDTO;
import com.epmet.dto.result.IssueInitiatorResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.constant.GroupMemberConstant;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.feign.GovIssueFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.dao.ResiGroupStatisticalDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
@ -63,14 +67,8 @@ 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.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.TopicInfoDTO;
import com.epmet.resi.group.dto.topic.form.ResiTopicOperationFormDTO;
import com.epmet.resi.group.dto.topic.form.ResiTopicPageFormDTO;
import com.epmet.resi.group.dto.topic.form.ResiTopicPublishFormDTO;
import com.epmet.resi.group.dto.topic.form.TopicInfoFormDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicIncludeIssueDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicIncludeIssueInfoResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO;
import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.result.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -124,6 +122,12 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
@Autowired
private ResiTopicDao resiTopicDao;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Autowired
private GovIssueFeignClient govIssueFeignClient;
private final Log logger = LogFactory.getLog(getClass());
@Override
@ -495,7 +499,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
ResiTopicIncludeIssueDetailResultDTO resultDTO =
ConvertUtils.sourceToTarget(topicDetail,ResiTopicIncludeIssueDetailResultDTO.class);
resultDTO.setTopicId(topicId);
resultDTO.setReleaseTime(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(topicDetail.getCreatedTime()));
resultDTO.setReleaseTime(new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE).format(topicDetail.getCreatedTime()));
resultDTO.setTopicContent(topicDetail.getTopicContent());
resultDTO.setReleaseAddress(topicDetail.getAddress());
resultDTO.setTopicStatus(topicDetail.getStatus());
@ -931,6 +935,132 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
topicInfo.setPublishedUser(issueInitiatorResult.getData().getIssueInitiator());
return topicInfo;
}
/**
* @Description 首先需要查看当前用户是不是组长权限然后检查该话题是否符合转议题标准
* @param topicIdFormDTO::getTopicId topicIdFormDTO::getUserId
* @author wangc
* @date 2020.05.12 13:56
**/
@Override
public ResiTopicShiftIssueInitResultDTO initTopicInfoWhenShift(CommonTopicIdFormDTO topicIdFormDTO) {
//1.查看话题是否符合转议题
ResiTopicEntity topic = baseDao.selectById(topicIdFormDTO.getTopicId());
if(null == topic || StringUtils.isBlank(topic.getId())){
//没有相应的话题
logger.error(ModuleConstant.NO_SUCH_TOPIC);
throw new RenException(ModuleConstant.NO_SUCH_TOPIC);
}else if(topic.getShiftIssue() || StringUtils.isNotBlank(topic.getIssueId()) || StringUtils.equals(ModuleConstant.TOPIC_STATUS_DISCUSSING,topic.getStatus())){
logger.error(ModuleConstant.CURRENT_TOPIC_COULD_NOT_TURN_TO_ISSUE);
throw new RenException(ModuleConstant.CURRENT_TOPIC_COULD_NOT_TURN_TO_ISSUE);
}
//2.通过话题找组信息,得到该组组长信息与当前用户进行
ResiGroupMemberInfoRedisDTO member =
resiGroupMemberRedis.get(topic.getGroupId(),topicIdFormDTO.getUserId());
if(null == member || StringUtils.isBlank(member.getUserId()) ){
logger.error(ModuleConstant.GROUO_MEMBER_INFO_NOT_FOUND);
throw new RenException(ModuleConstant.GROUO_MEMBER_INFO_NOT_FOUND);
}else if(!StringUtils.equals(ModuleConstant.GROUP_LEADER,member.getGroupLeaderFlag())){
logger.error(ModuleConstant.NO_TEAMLEADER_AUTH);
throw new RenException(ModuleConstant.NO_TEAMLEADER_AUTH);
}
//3.获取话题信息
Result<ResiTopicIncludeIssueDetailResultDTO> topicDetailResult =
getTopicDetail(null,topicIdFormDTO.getTopicId());
if(topicDetailResult.success() && null != topicDetailResult.getData()){
ResiTopicShiftIssueInitResultDTO result = ConvertUtils.sourceToTarget(topicDetailResult.getData(),ResiTopicShiftIssueInitResultDTO.class);
try {
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE);
result.setReleaseTime(format.parse(topicDetailResult.getData().getReleaseTime()).getTime()/NumConstant.ONE_THOUSAND);
}catch (Exception e){
result.setReleaseTime(NumConstant.ZERO_L);
logger.warn(String.format(ModuleConstant.DATE_FORMAT_PARSE_FAILURE,e.getMessage()));
}
ResiGroupInfoRedisDTO group = resiGroupRedis.get(topic.getGroupId());
if(null == group && StringUtils.isNotBlank(group.getGroupId())){
CustomerGridFormDTO gridForm = new CustomerGridFormDTO();
gridForm.setGridId(group.getGridId());
Result<CustomerGridDTO> gridInfoResult = govOrgFeignClient.getCustomerGridByGridId(gridForm);
if(gridInfoResult.success() && null != gridInfoResult.getData() && StringUtils.isNotBlank(gridInfoResult.getData().getId())) {
result.setBelongGridName(gridInfoResult.getData().getGridName());
}
}
logger.error(ModuleConstant.NO_SUCH_GROUP);
result.setBelongGridName(ModuleConstant.EMPTY_STR);
return result;
}
throw new RenException(ModuleConstant.FAILED_QUERY_TOPIC_INFO);
}
/**
* @Description 话题转议题 1.统一时间 2.调用gov-org服务拿到数据权限的信息 3.调用gov-issue服务新增议题信息
* @param topicTurnIssueFromDTO
* @author wangc
* @date 2020.05.13 10:28
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void shiftIssue(ResiTopicTurnIssueFromDTO topicTurnIssueFromDTO) {
//1.统一时间(群组服务 -> 议题服务)
Date now = new Date();
//2.调用gov-org获取数据权限
ResiTopicAndGroupResultDTO group = baseDao.getGroupInfoByTopicId(topicTurnIssueFromDTO.getTopicId());
if(null != group){
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO();
dataFilterParam.setUserId(topicTurnIssueFromDTO.getUserId());
dataFilterParam.setGridId(group.getGridId());
Result<CommonDataFilterResultDTO> dataFilterResult =
govOrgFeignClient.gridDataFilter(dataFilterParam);
if(dataFilterResult.success() && null != dataFilterResult.getData()){
IssueShiftedFromTopicFormDTO issueInfo = ConvertUtils.sourceToTarget(topicTurnIssueFromDTO,IssueShiftedFromTopicFormDTO.class);
issueInfo.setCreatedTime(now);
issueInfo.setGridId(group.getGridId());
issueInfo.setCustomerId(group.getCustomerId());
issueInfo.setOrgId(dataFilterResult.getData().getAgencyId());
issueInfo.setOrgIdPath(dataFilterResult.getData().getOrgIdPath());
issueInfo.setOrgName(dataFilterResult.getData().getOrgName());
//3.获取小组名称、话题作者、议题发起人
ResiGroupMemberInfoRedisDTO topicAuthor = resiGroupMemberRedis.get(group.getGroupId(), group.getTopicAuthorId());
issueInfo.setTopicAuthor(null == topicAuthor ? ModuleConstant.EMPTY_STR : topicAuthor.getUserShowName());
ResiGroupMemberInfoRedisDTO issueAuthor = resiGroupMemberRedis.get(group.getGroupId(),topicTurnIssueFromDTO.getUserId());
issueInfo.setIssueAuthor(null == issueAuthor ? ModuleConstant.EMPTY_STR : issueAuthor.getUserShowName());
ResiGroupInfoRedisDTO groupCache = resiGroupRedis.get(group.getGroupId());
issueInfo.setGroupName(null == groupCache ? ModuleConstant.EMPTY_STR : groupCache.getGroupName());
issueInfo.setVotableCount(resiGroupMemberService.gridResiCount(group.getGridId()));
//4.调用gov-issue新增议题
Result<String> issueResult = govIssueFeignClient.issueShiftedToTopic(issueInfo);
//5.修改话题shiftIssue字段
if(issueResult.success() && StringUtils.isNotBlank(issueResult.getData())){
ResiTopicEntity topic2Upd = new ResiTopicEntity();
topic2Upd.setId(topicTurnIssueFromDTO.getTopicId());
topic2Upd.setUpdatedBy(topicTurnIssueFromDTO.getUserId());
topic2Upd.setShiftIssue(Boolean.TRUE);
topic2Upd.setIssueId(issueResult.getData());
topic2Upd.setUpdatedTime(now);
int topicResult = baseDao.updateOne(topic2Upd);
//6.新增话题操作记录
if(topicResult == NumConstant.ONE) {
ResiTopicOperationEntity operation = new ResiTopicOperationEntity();
operation.setCreatedTime(now);
operation.setCreatedBy(topicTurnIssueFromDTO.getUserId());
operation.setTopicId(topicTurnIssueFromDTO.getTopicId());
operation.setOperationType(ModuleConstant.TOPIC_OPERATION_TYPE_SHIFT_ISSUE);
int operationResult = resiTopicOperationDao.insertOneByParams(operation);
if(operationResult != NumConstant.ONE){
logger.warn(ModuleConstant.FAILURE_TO_ADD_TOPIC_OPERATION);
}
return;
}
logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC);
}
}
}
throw new RenException(ModuleConstant.FAILURE_TO_TURN_ISSUE);
}
}

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

@ -118,6 +118,11 @@ public interface ModuleConstant extends Constant {
* */
String NO_SUCH_TOPIC = "没有找到所在话题";
/**
* 没有找到所在的群组
* */
String NO_SUCH_GROUP = "没有找到所在的群组";
/**
* 当前用户被禁言
* */
@ -245,4 +250,48 @@ public interface ModuleConstant extends Constant {
*/
String FAILED_SEND_MESSAGE = "消息发送失败,消息内容:【%s】";
/**
* 该话题不能转为议题
* */
String CURRENT_TOPIC_COULD_NOT_TURN_TO_ISSUE = "该话题不能转为议题,可能原因:当前话题已转项目或当前话题不是在【讨论中】状态";
/**
* 议题状态讨论中
* */
String TOPIC_STATUS_DISCUSSING = "discussing";
/**
* 话题操作记录状态- 转议题
* */
String TOPIC_OPERATION_TYPE_SHIFT_ISSUE = "shift_issue";
/**
* 空字符串
* */
String EMPTY_STR = "";
/**
* 话题查询失败
* */
String FAILED_QUERY_TOPIC_INFO = "话题查询失败";
/**
* 日期格式转换失败
* */
String DATE_FORMAT_PARSE_FAILURE = "日期格式转换失败,异常信息:%s";
/**
* 话题转议题失败
* */
String FAILURE_TO_TURN_ISSUE = "话题转议题失败";
/**
* 话题状态修改失败
* */
String FAILURE_TO_UPDATE_TOPIC = "话题状态修改失败";
/**
* 新增话题操作记录失败
* */
String FAILURE_TO_ADD_TOPIC_OPERATION = "新增话题操作记录失败";
}

12
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml

@ -277,4 +277,16 @@
AND gro.ID = #{groupId}
AND oper.STATE IN ('under_auditting','approved','rejected')
</select>
<!-- 查询一个网格下面所有组Id -->
<select id="getGroupIdByGridId" resultType="java.lang.String">
SELECT
DISTINCT
ID
FROM RESI_GROUP
WHERE
DEL_FLAG = '0'
AND
GRID_ID = #{gridId}
</select>
</mapper>

46
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml

@ -102,7 +102,7 @@
</if>
'APP_USER',
'0',
'0',
0,
now(),
now()
</trim>
@ -259,6 +259,35 @@
</if>
</select>
<!-- 单条更新 全部条件判断 -->
<update id="updateOne" parameterType="com.epmet.modules.topic.entity.ResiTopicEntity">
UPDATE
RESI_TOPIC
<set>
<if test ='null != groupId and "" != groupId'>group_id = #{groupId},</if>
<if test ='null != topicContent and "" != topicContent'>topic_content = #{topicContent},</if>
<if test ='null != status and "" != status'>status = #{status},</if>
<if test ='null != province and "" != province'>province = #{province},</if>
<if test ='null != city and "" != city'>city = #{city},</if>
<if test ='null != area and "" != area'>area = #{area},</if>
<if test ='null != address and "" != address'>address = #{address},</if>
<if test ='null != longitude and "" != longitude'>longitude = #{longitude},</if>
<if test ='null != dimension and "" != dimension'>dimension = #{dimension},</if>
<if test ='null != delFlag and "" != delFlag'>del_flag = #{delFlag},</if>
<if test ='null != revision'>revision = #{revision},</if>
<if test ='null != createdBy and "" != createdBy'>created_by = #{createdBy},</if>
<if test ='null != createdTime'>created_time = #{createdTime},</if>
<if test ='null != updatedBy and "" != updatedBy'>updated_by = #{updatedBy},</if>
<if test ='null != updatedTime'>updated_time = #{updatedTime},</if>
<if test ='null != shiftIssue'>shift_issue = #{shiftIssue},</if>
<if test ='null != issueId and "" != issueId'>issue_id = #{issueId}</if>
</set>
WHERE
ID = #{id}
AND DEL_FLAG = '0'
</update>
<!-- 单条更新 -->
<update id="update" parameterType="com.epmet.modules.topic.entity.ResiTopicEntity">
@ -351,4 +380,19 @@
AND del_flag = 0
</select>
<!-- 通过topicId查询话题所在组的网格Id和客户Id -->
<select id="getGroupInfoByTopicId" resultType="com.epmet.resi.group.dto.topic.result.ResiTopicAndGroupResultDTO">
SELECT
groupp.ID AS groupId,
IFNULL(groupp.GRID_ID,'') AS gridId,
IFNULL(groupp.CUSTOMER_ID,'') AS customerId,
topic.CREATED_BY AS topicAuthorId
FROM
RESI_TOPIC topic
INNER JOIN RESI_GROUP groupp ON topic.GROUP_ID = groupp.ID
WHERE
topic.DEL_FLAG = '0'
AND groupp.DEL_FLAG = '0'
AND topic.ID = #{topicId}
</select>
</mapper>

62
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicOperationDao.xml

@ -53,5 +53,67 @@
</trim>
</insert>
<!-- 按传参进行新增操作 -->
<insert id="insertOneByParams" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.epmet.modules.topic.entity.ResiTopicOperationEntity">
<selectKey keyProperty="id" resultType="java.lang.String" order="BEFORE">
select replace(uuid(),'-','') AS ID
</selectKey>
INSERT INTO resi_topic_operation
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test ='null != topicId'>
topic_id,
</if>
<if test ='null != operationType'>
operation_type,
</if>
<if test='null != operationReason'>
operation_reason,
</if>
<if test ='null != createdBy'>
created_by,
</if>
<if test ='null != createdTime'>
created_time,
</if>
<if test ='null != createdBy'>
updated_by,
</if>
<if test ='null != createdTime'>
updated_time,
</if>
del_flag,
revision
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id},
<if test ='null != topicId'>
#{topicId},
</if>
<if test ='null != operationType'>
#{operationType},
</if>
<if test='null != operationReason'>
#{operationReason},
</if>
<if test ='null != createdBy'>
#{createdBy},
</if>
<if test ='null != createdTime'>
#{createdTime},
</if>
<if test ='null != createdBy'>
#{createdBy},
</if>
<if test ='null != createdTime'>
#{createdTime},
</if>
'0',
0
</trim>
</insert>
</mapper>

Loading…
Cancel
Save