|
|
@ -1,34 +1,50 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.nacos.client.utils.StringUtils; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.IssueConstant; |
|
|
|
import com.epmet.constant.ReadFlagConstant; |
|
|
|
import com.epmet.constant.UserMessageConstant; |
|
|
|
import com.epmet.dao.IssueDao; |
|
|
|
import com.epmet.dao.IssueProcessDao; |
|
|
|
import com.epmet.dto.ProjectDTO; |
|
|
|
import com.epmet.dao.IssueProjectRelationDao; |
|
|
|
import com.epmet.dto.IssueDTO; |
|
|
|
import com.epmet.dto.IssueProcessDTO; |
|
|
|
import com.epmet.dto.IssueVoteStatisticalDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.IssueEntity; |
|
|
|
import com.epmet.entity.IssueProcessEntity; |
|
|
|
import com.epmet.entity.IssueProjectRelationEntity; |
|
|
|
import com.epmet.feign.GovOrgFeignClient; |
|
|
|
import com.epmet.feign.GovProjectFeignClient; |
|
|
|
import com.epmet.feign.MessageFeignClient; |
|
|
|
import com.epmet.feign.ResiGroupFeignClient; |
|
|
|
import com.epmet.redis.GovIssueRedis; |
|
|
|
import com.epmet.resi.group.dto.topic.ResiTopicDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.GovTopicIssueInfoResultDTO; |
|
|
|
import com.epmet.service.IssueProcessService; |
|
|
|
import com.epmet.service.IssueProjectRelationService; |
|
|
|
import com.epmet.service.IssueService; |
|
|
|
import com.epmet.service.IssueVoteStatisticalService; |
|
|
|
import com.epmet.utils.ModuleConstants; |
|
|
|
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.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -52,7 +68,69 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
private GovIssueRedis govIssueRedis; |
|
|
|
@Autowired |
|
|
|
private GovProjectFeignClient govProjectFeignClient; |
|
|
|
@Autowired |
|
|
|
private IssueProjectRelationDao issueProjectRelationDao; |
|
|
|
|
|
|
|
protected static final Logger logger = LoggerFactory.getLogger(IssueServiceImpl.class); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IssueProcessService issueProcessService; |
|
|
|
@Autowired |
|
|
|
private IssueVoteStatisticalService issueVoteStatisticalService; |
|
|
|
@Autowired |
|
|
|
private IssueProjectRelationService issueProjectRelationService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IssueDTO> page(Map<String, Object> params) { |
|
|
|
IPage<IssueEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
getWrapper(params) |
|
|
|
); |
|
|
|
return getPageData(page, IssueDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IssueDTO> list(Map<String, Object> params) { |
|
|
|
List<IssueEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entityList, IssueDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<IssueEntity> getWrapper(Map<String, Object> params){ |
|
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
QueryWrapper<IssueEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public IssueDTO get(String id) { |
|
|
|
IssueEntity entity = baseDao.selectById(id); |
|
|
|
return ConvertUtils.sourceToTarget(entity, IssueDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(IssueDTO dto) { |
|
|
|
IssueEntity entity = ConvertUtils.sourceToTarget(dto, IssueEntity.class); |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(IssueDTO dto) { |
|
|
|
IssueEntity entity = ConvertUtils.sourceToTarget(dto, IssueEntity.class); |
|
|
|
updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
/** |
|
|
|
* @param issueDetail |
|
|
|
* @Description 议题详情 |
|
|
@ -66,49 +144,18 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
return issueResult; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 议题管理-关闭议题 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void closeIssue(CloseIssueFormDTO formDTO) { |
|
|
|
Date date = new Date(); |
|
|
|
//1:更新议题详情表数据
|
|
|
|
IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); |
|
|
|
if (null == entity) { |
|
|
|
throw new RenException(IssueConstant.SELECT_EXCEPTION); |
|
|
|
} |
|
|
|
entity.setIssueStatus(IssueConstant.ISSUE_CLOSED); |
|
|
|
entity.setCloseReason(formDTO.getCloseReason()); |
|
|
|
entity.setResolveType(formDTO.getResolveType()); |
|
|
|
entity.setVotingDeadline(date); |
|
|
|
entity.setClosedTime(date); |
|
|
|
if (baseDao.updateById(entity) < NumConstant.ONE) { |
|
|
|
throw new RenException(IssueConstant.UPPDATE_EXCEPTION); |
|
|
|
} |
|
|
|
//2:调用gov-org服务,查询组织网格名称
|
|
|
|
AgencyGridResultDTO agencyGridResultDTO = new AgencyGridResultDTO(); |
|
|
|
agencyGridResultDTO.setAgencyId(entity.getOrgId()); |
|
|
|
agencyGridResultDTO.setGridId(entity.getGridId()); |
|
|
|
Result<AgencyGridResultDTO> resultDTO = govOrgFeignClient.getAgencyAndGrid(agencyGridResultDTO); |
|
|
|
agencyGridResultDTO = resultDTO.getData(); |
|
|
|
//3:议题进展记录表新增数据
|
|
|
|
IssueProcessEntity processEntity = new IssueProcessEntity(); |
|
|
|
processEntity.setIssueId(formDTO.getIssueId()); |
|
|
|
processEntity.setIssueStatus(IssueConstant.ISSUE_CLOSED); |
|
|
|
processEntity.setOrgType(IssueConstant.ISSUE_GRID); |
|
|
|
processEntity.setOrgId(entity.getOrgId()); |
|
|
|
processEntity.setOperationExplain(formDTO.getCloseReason()); |
|
|
|
processEntity.setOrgName(agencyGridResultDTO.getAgencyName() + "-" + agencyGridResultDTO.getGridName()); |
|
|
|
issueProcessDao.insert(processEntity); |
|
|
|
//4:调用epmet-message服务,给居民端话题创建人和议题发起人发送消息
|
|
|
|
if (!saveUserMessageList(formDTO, entity).success()) { |
|
|
|
throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); |
|
|
|
} |
|
|
|
} |
|
|
|
/** |
|
|
|
* @Description 根据issueId查询gridId |
|
|
|
* @param issueId |
|
|
|
* @author zxc |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public GridIdResultDTO selectGridIdByIssueId(IssueIdFormDTO issueId) { |
|
|
|
GridIdResultDTO gridIdResult = new GridIdResultDTO(); |
|
|
|
IssueDTO issueDTO = get(issueId.getIssueId()); |
|
|
|
gridIdResult.setGridId(issueDTO.getGridId()); |
|
|
|
return gridIdResult; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<GridVotingIssueCountResultDTO> queryVotingIssueCount(List<String> gridIdList) { |
|
|
@ -116,59 +163,17 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
for (String gridId : gridIdList) { |
|
|
|
GridVotingIssueCountResultDTO gridVotingIssueCountResultDTO = new GridVotingIssueCountResultDTO(); |
|
|
|
gridVotingIssueCountResultDTO.setGridId(gridId); |
|
|
|
Long auditingCount = govIssueRedis.queryVotingIssueCount(gridId); |
|
|
|
gridVotingIssueCountResultDTO.setCount(auditingCount); |
|
|
|
Integer auditingCount = govIssueRedis.queryVotingIssueCount(gridId); |
|
|
|
if (null == auditingCount) { |
|
|
|
gridVotingIssueCountResultDTO.setCount(0); |
|
|
|
} else { |
|
|
|
gridVotingIssueCountResultDTO.setCount(auditingCount); |
|
|
|
} |
|
|
|
list.add(gridVotingIssueCountResultDTO); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 关闭议题给话题创建人和议题发起人发送消息 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
private Result saveUserMessageList(CloseIssueFormDTO formDTO, IssueEntity entity) { |
|
|
|
//1:调用resi-group查询话题创建人数据(目前议题来源只有来自话题)
|
|
|
|
Result<ResiTopicDTO> resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); |
|
|
|
if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { |
|
|
|
throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); |
|
|
|
} |
|
|
|
ResiTopicDTO topicDTO = resultTopicDTO.getData(); |
|
|
|
//2:分别给话题创建人、议题发起人发送消息
|
|
|
|
List<UserMessageFormDTO> msgList = new ArrayList<>(); |
|
|
|
UserMessageFormDTO msgDTO = new UserMessageFormDTO(); |
|
|
|
msgDTO.setCustomerId(entity.getCustomerId()); |
|
|
|
msgDTO.setGridId(entity.getGridId()); |
|
|
|
msgDTO.setApp(AppClientConstant.APP_RESI); |
|
|
|
msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE); |
|
|
|
String messageContent = ""; |
|
|
|
if (IssueConstant.ISSUE_RESLOVED.equals(formDTO.getResolveType())) { |
|
|
|
messageContent = String.format(UserMessageConstant.ISSUE_RESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); |
|
|
|
} else if (IssueConstant.ISSUE_UNRESLOVED.equals(formDTO.getResolveType())) { |
|
|
|
messageContent = String.format(UserMessageConstant.ISSUE_UNRESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); |
|
|
|
} |
|
|
|
msgDTO.setMessageContent(messageContent); |
|
|
|
msgDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
msgDTO.setUserId(topicDTO.getCreatedBy()); |
|
|
|
msgList.add(msgDTO); |
|
|
|
msgDTO.setUserId(entity.getCreatedBy()); |
|
|
|
msgList.add(msgDTO); |
|
|
|
return messageFeignClient.saveUserMessageList(msgList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 议题管理-部门人员选择 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public DepartmentStaffListResultDTO departmentStaffList(DepartmentStaffListFormDTO formDTO) { |
|
|
|
//1:调用gov-org服务,分别查询组织下人员,组织下部门人员,组织下网格人员列表信息
|
|
|
|
Result<DepartmentStaffListResultDTO> resultDTOResult = govOrgFeignClient.departmentStaffList(formDTO.getAgencyId()); |
|
|
|
return resultDTOResult.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ShiftProjectListResultDTO> getShiftProjectList(ShiftProjectListFromDTO fromDTO) { |
|
|
|
List<ShiftProjectListResultDTO> resultList = new ArrayList<>(); |
|
|
@ -197,21 +202,309 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @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 == NumConstant.ONE && 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
|
|
|
|
govIssueRedis.addWorkGrassrootsIssueRedDotValue(issueShiftedFromTopicFormDTO.getGridId()); |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 表决中列表 |
|
|
|
* @param issueListForm |
|
|
|
* @return List<VotingIssueListResultDTO> |
|
|
|
* @author wangc |
|
|
|
* @date 2020.05.14 10:13 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public List<VotingIssueListResultDTO> votingList(CommonIssueListFormDTO issueListForm) { |
|
|
|
issueListForm.setPageNo(null == issueListForm.getPageNo() ? NumConstant.ZERO : |
|
|
|
(issueListForm.getPageNo() - NumConstant.ONE)*issueListForm.getPageSize() |
|
|
|
); |
|
|
|
return baseDao.selectVotingList(issueListForm); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 已关闭列表 |
|
|
|
* @param issueListForm |
|
|
|
* @return List<ClosedIssueListResultDTO> |
|
|
|
* @author wangc |
|
|
|
* @date 2020.05.14 10:33 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public List<ClosedIssueListResultDTO> closedList(CommonIssueListFormDTO issueListForm) { |
|
|
|
issueListForm.setPageNo(null == issueListForm.getPageNo() ? NumConstant.ZERO : |
|
|
|
(issueListForm.getPageNo() - NumConstant.ONE)*issueListForm.getPageSize() |
|
|
|
); |
|
|
|
return baseDao.selectClosedList(issueListForm); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 政府端查看议题详情 |
|
|
|
* @param issueParam |
|
|
|
* @return GovIssueDetailResultDTO |
|
|
|
* @author wangc |
|
|
|
* @date 2020.05.14 16:08 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public GovIssueDetailResultDTO issueDetailGov(IssueDetailFormDTO issueParam) { |
|
|
|
//1.得到议题信息
|
|
|
|
IssueEntity issueDetail = selectById(issueParam.getIssueId()); |
|
|
|
|
|
|
|
//2.1如果此条议题来源自话题
|
|
|
|
if(StringUtils.equals(ModuleConstants.ISSUE_FROM_TOPIC,issueDetail.getSourceType())){ |
|
|
|
GovTopicIssueInfoFormDTO topicParam = new GovTopicIssueInfoFormDTO(); |
|
|
|
topicParam.setGridId(issueDetail.getGridId()); |
|
|
|
topicParam.setTopicId(issueDetail.getSourceId()); |
|
|
|
topicParam.setIssueCreatorId(issueDetail.getCreatedBy()); |
|
|
|
//2.2查询话题相关信息
|
|
|
|
Result<GovTopicIssueInfoResultDTO> topicResult = |
|
|
|
resiGroupFeignClient.topicInfoForIssueDetailGov(topicParam); |
|
|
|
if(topicResult.success() || null != topicResult.getData()){ |
|
|
|
GovTopicOfIssueInfoResultDTO topicInfo = ConvertUtils.sourceToTarget(topicResult.getData(),GovTopicOfIssueInfoResultDTO.class); |
|
|
|
GovIssueDetailResultDTO issueInfo = ConvertUtils.sourceToTarget(topicResult.getData(),GovIssueDetailResultDTO.class); |
|
|
|
issueInfo.setIssueStatus(issueDetail.getIssueStatus()); |
|
|
|
issueInfo.setIssueSuggestion(issueDetail.getSuggestion()); |
|
|
|
issueInfo.setIssueTitle(issueDetail.getIssueTitle()); |
|
|
|
issueInfo.setVotingDeadline(null == issueDetail.getVotingDeadline() |
|
|
|
? NumConstant.ZERO_L : issueDetail.getVotingDeadline().getTime()/NumConstant.ONE_THOUSAND); |
|
|
|
issueInfo.setTopicInfo(topicInfo); |
|
|
|
|
|
|
|
//2.3查询项目Id
|
|
|
|
String projectId = issueProjectRelationService.getProjectByIssueId(issueParam.getIssueId()); |
|
|
|
issueInfo.setProjectId( StringUtils.isBlank(projectId) ? ModuleConstants.EMPTY_STR : projectId ); |
|
|
|
|
|
|
|
return issueInfo; |
|
|
|
} |
|
|
|
//查询话题失败异常
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 议题管理-关闭议题 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void closeIssue(CloseIssueFormDTO formDTO) { |
|
|
|
Date date = new Date(); |
|
|
|
//1:更新议题详情表数据
|
|
|
|
IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); |
|
|
|
if (null == entity) { |
|
|
|
throw new RenException(IssueConstant.SELECT_EXCEPTION); |
|
|
|
} |
|
|
|
entity.setIssueStatus(IssueConstant.ISSUE_CLOSED); |
|
|
|
entity.setCloseReason(formDTO.getCloseReason()); |
|
|
|
entity.setResolveType(formDTO.getResolveType()); |
|
|
|
entity.setVotingDeadline(date); |
|
|
|
entity.setClosedTime(date); |
|
|
|
if (baseDao.updateById(entity) < NumConstant.ONE) { |
|
|
|
throw new RenException(IssueConstant.UPPDATE_EXCEPTION); |
|
|
|
} |
|
|
|
|
|
|
|
//2:调用gov-org服务,查询组织网格名称
|
|
|
|
AgencyGridResultDTO agencyGridResultDTO = new AgencyGridResultDTO(); |
|
|
|
agencyGridResultDTO.setAgencyId(entity.getOrgId()); |
|
|
|
agencyGridResultDTO.setGridId(entity.getGridId()); |
|
|
|
Result<AgencyGridResultDTO> resultDTO = govOrgFeignClient.getAgencyAndGrid(agencyGridResultDTO); |
|
|
|
agencyGridResultDTO = resultDTO.getData(); |
|
|
|
|
|
|
|
//3:议题进展记录表新增数据
|
|
|
|
IssueProcessEntity processEntity = new IssueProcessEntity(); |
|
|
|
processEntity.setIssueId(formDTO.getIssueId()); |
|
|
|
processEntity.setIssueStatus(IssueConstant.ISSUE_CLOSED); |
|
|
|
processEntity.setOrgType(IssueConstant.ISSUE_GRID); |
|
|
|
processEntity.setOrgId(entity.getOrgId()); |
|
|
|
processEntity.setOperationExplain(formDTO.getCloseReason()); |
|
|
|
processEntity.setOrgName(agencyGridResultDTO.getAgencyName() + "-" + agencyGridResultDTO.getGridName()); |
|
|
|
issueProcessDao.insert(processEntity); |
|
|
|
|
|
|
|
//4:调用epmet-message服务,给居民端话题创建人和议题发起人发送消息
|
|
|
|
//4.1:调用resi-group查询话题创建人数据(目前议题来源只有来自话题)
|
|
|
|
Result<ResiTopicDTO> resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); |
|
|
|
if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { |
|
|
|
throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); |
|
|
|
} |
|
|
|
ResiTopicDTO topicDTO = resultTopicDTO.getData(); |
|
|
|
//4.2:创建消息模板
|
|
|
|
String messageContent = ""; |
|
|
|
if (IssueConstant.ISSUE_RESLOVED.equals(formDTO.getResolveType())) { |
|
|
|
messageContent = String.format(UserMessageConstant.ISSUE_RESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); |
|
|
|
} else if (IssueConstant.ISSUE_UNRESLOVED.equals(formDTO.getResolveType())) { |
|
|
|
messageContent = String.format(UserMessageConstant.ISSUE_UNRESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); |
|
|
|
} |
|
|
|
//4.3:调用服务,发送消息
|
|
|
|
if (!saveUserMessageList(topicDTO, messageContent, entity).success()) { |
|
|
|
throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); |
|
|
|
} |
|
|
|
|
|
|
|
//5:缓存中网格下表决中的议题总数减1
|
|
|
|
govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 关闭议题、议题转项目时给话题创建人和议题发起人发送消息 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
private Result saveUserMessageList(ResiTopicDTO topicDTO, String messageContent, IssueEntity entity) { |
|
|
|
//2:分别给话题创建人、议题发起人发送消息
|
|
|
|
List<UserMessageFormDTO> msgList = new ArrayList<>(); |
|
|
|
UserMessageFormDTO msgDTO = new UserMessageFormDTO(); |
|
|
|
msgDTO.setCustomerId(entity.getCustomerId()); |
|
|
|
msgDTO.setGridId(entity.getGridId()); |
|
|
|
msgDTO.setApp(AppClientConstant.APP_RESI); |
|
|
|
msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE); |
|
|
|
msgDTO.setMessageContent(messageContent); |
|
|
|
msgDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
msgDTO.setUserId(topicDTO.getCreatedBy()); |
|
|
|
msgList.add(msgDTO); |
|
|
|
msgDTO.setUserId(entity.getCreatedBy()); |
|
|
|
msgList.add(msgDTO); |
|
|
|
return messageFeignClient.saveUserMessageList(msgList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 议题管理-部门人员选择 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public DepartmentStaffListResultDTO departmentStaffList(DepartmentStaffListFormDTO formDTO) { |
|
|
|
//1:调用gov-org服务,分别查询组织下人员,组织下部门人员,组织下网格人员列表信息
|
|
|
|
CanTickStaffListFormDTO canTick = new CanTickStaffListFormDTO(); |
|
|
|
canTick.setAgencyId(formDTO.getAgencyId()); |
|
|
|
canTick.setType("issue"); |
|
|
|
Result<DepartmentStaffListResultDTO> resultDTOResult = govOrgFeignClient.departmentStaffList(canTick); |
|
|
|
return resultDTOResult.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 议题管理-议题人员选择 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public ProcessorListResultDTO processorList(ProcessorListFormDTO formDTO) { |
|
|
|
//1:查询当前议题工作人员所属组织Id
|
|
|
|
IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); |
|
|
|
if (null == entity) { |
|
|
|
throw new RenException(IssueConstant.SELECT_EXCEPTION); |
|
|
|
} |
|
|
|
//2:调用gov-org服务,查询组织树
|
|
|
|
Result<ProcessorListResultDTO> resultDTOResult = govOrgFeignClient.getProcessorList(entity.getOrgId()); |
|
|
|
return resultDTOResult.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 议题管理-议题人员选择 |
|
|
|
* @Description 议题管理-议题转项目 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public ProcessorListResultDTO processorList(ProcessorListFormDTO formDTO) { |
|
|
|
//1:查询当前议题工作人员所属组织Id
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void shiftProject(ShiftProjectFormDTO formDTO) { |
|
|
|
//因需要保证议题表中的转项目时间与创建项目时间一致 因此先新增项目数据再更新议题数据
|
|
|
|
//1:查询议题数据
|
|
|
|
IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); |
|
|
|
if (null == entity) { |
|
|
|
throw new RenException(IssueConstant.SELECT_EXCEPTION); |
|
|
|
formDTO.setIssueDTO(ConvertUtils.sourceToTarget(entity, IssueDTO.class)); |
|
|
|
|
|
|
|
//2:调用gov-project服务,新增项目各业务表初始数据
|
|
|
|
Result<IssueProjectResultDTO> resultDTO = govProjectFeignClient.issueShiftProject(formDTO); |
|
|
|
IssueProjectResultDTO issueProjectResultDTO = resultDTO.getData(); |
|
|
|
|
|
|
|
//3:更新议题相关业务表数据
|
|
|
|
//3.1:更新议题表数据
|
|
|
|
entity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); |
|
|
|
entity.setShiftedTime(issueProjectResultDTO.getShiftedTime()); |
|
|
|
baseDao.updateById(entity); |
|
|
|
|
|
|
|
//3.2:议题处理进展表新增数据
|
|
|
|
IssueProcessEntity processEntity = new IssueProcessEntity(); |
|
|
|
processEntity.setIssueId(entity.getId()); |
|
|
|
processEntity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); |
|
|
|
processEntity.setOrgType(IssueConstant.ISSUE_GRID); |
|
|
|
processEntity.setOrgId(entity.getGridId()); |
|
|
|
processEntity.setOrgName(issueProjectResultDTO.getOrgName()); |
|
|
|
issueProcessDao.insert(processEntity); |
|
|
|
|
|
|
|
//3.3:议题项目关系表新增数据
|
|
|
|
IssueProjectRelationEntity relationEntity = new IssueProjectRelationEntity(); |
|
|
|
relationEntity.setIssueId(entity.getId()); |
|
|
|
relationEntity.setProjectId(issueProjectResultDTO.getProjectId()); |
|
|
|
issueProjectRelationDao.insert(relationEntity); |
|
|
|
|
|
|
|
//4:调用epmet-message服务,给居民端话题创建人和议题发起人发送消息
|
|
|
|
//4.1:调用resi-group查询话题创建人数据(目前议题来源只有来自话题)
|
|
|
|
Result<ResiTopicDTO> resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); |
|
|
|
if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { |
|
|
|
throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); |
|
|
|
} |
|
|
|
//2:调用gov-org服务,查询组织树
|
|
|
|
Result<ProcessorListResultDTO> resultDTOResult = govOrgFeignClient.getProcessorList(entity.getOrgId()); |
|
|
|
return resultDTOResult.getData(); |
|
|
|
ResiTopicDTO topicDTO = resultTopicDTO.getData(); |
|
|
|
//4.2:创建消息模板
|
|
|
|
String messageContent = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, topicDTO.getTopicContent(), issueProjectResultDTO.getOrgName()); |
|
|
|
//4.3:调用服务,发送消息
|
|
|
|
if (!saveUserMessageList(topicDTO, messageContent, entity).success()) { |
|
|
|
throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); |
|
|
|
} |
|
|
|
|
|
|
|
//5:缓存中网格下表决中的议题总数减1
|
|
|
|
govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|