|
|
@ -12,6 +12,7 @@ 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.dao.IssueProjectRelationDao; |
|
|
|
import com.epmet.dto.IssueDTO; |
|
|
|
import com.epmet.dto.IssueProcessDTO; |
|
|
|
import com.epmet.dto.IssueVoteStatisticalDTO; |
|
|
@ -28,6 +29,7 @@ import com.epmet.dto.result.*; |
|
|
|
import com.epmet.dto.form.UserMessageFormDTO; |
|
|
|
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; |
|
|
@ -77,6 +79,8 @@ 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); |
|
|
|
|
|
|
@ -106,6 +110,7 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
* @Author sun |
|
|
|
* @Description 议题管理-关闭议题 |
|
|
|
**/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void closeIssue(CloseIssueFormDTO formDTO) { |
|
|
@ -123,12 +128,14 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
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()); |
|
|
@ -138,36 +145,35 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
processEntity.setOperationExplain(formDTO.getCloseReason()); |
|
|
|
processEntity.setOrgName(agencyGridResultDTO.getAgencyName() + "-" + agencyGridResultDTO.getGridName()); |
|
|
|
issueProcessDao.insert(processEntity); |
|
|
|
|
|
|
|
//4:调用epmet-message服务,给居民端话题创建人和议题发起人发送消息
|
|
|
|
if (!saveUserMessageList(formDTO, entity).success()) { |
|
|
|
//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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<GridVotingIssueCountResultDTO> queryVotingIssueCount(List<String> gridIdList) { |
|
|
|
List<GridVotingIssueCountResultDTO> list = new ArrayList<>(); |
|
|
|
for (String gridId : gridIdList) { |
|
|
|
GridVotingIssueCountResultDTO gridVotingIssueCountResultDTO = new GridVotingIssueCountResultDTO(); |
|
|
|
gridVotingIssueCountResultDTO.setGridId(gridId); |
|
|
|
Long auditingCount = govIssueRedis.queryVotingIssueCount(gridId); |
|
|
|
gridVotingIssueCountResultDTO.setCount(auditingCount); |
|
|
|
list.add(gridVotingIssueCountResultDTO); |
|
|
|
} |
|
|
|
return list; |
|
|
|
//5:缓存中网格下表决中的议题总数减1
|
|
|
|
govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 关闭议题给话题创建人和议题发起人发送消息 |
|
|
|
* @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(); |
|
|
|
private Result saveUserMessageList(ResiTopicDTO topicDTO, String messageContent, IssueEntity entity) { |
|
|
|
//2:分别给话题创建人、议题发起人发送消息
|
|
|
|
List<UserMessageFormDTO> msgList = new ArrayList<>(); |
|
|
|
UserMessageFormDTO msgDTO = new UserMessageFormDTO(); |
|
|
@ -175,12 +181,6 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
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()); |
|
|
@ -190,6 +190,19 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
return messageFeignClient.saveUserMessageList(msgList); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<GridVotingIssueCountResultDTO> queryVotingIssueCount(List<String> gridIdList) { |
|
|
|
List<GridVotingIssueCountResultDTO> list = new ArrayList<>(); |
|
|
|
for (String gridId : gridIdList) { |
|
|
|
GridVotingIssueCountResultDTO gridVotingIssueCountResultDTO = new GridVotingIssueCountResultDTO(); |
|
|
|
gridVotingIssueCountResultDTO.setGridId(gridId); |
|
|
|
Long auditingCount = govIssueRedis.queryVotingIssueCount(gridId); |
|
|
|
gridVotingIssueCountResultDTO.setCount(auditingCount); |
|
|
|
list.add(gridVotingIssueCountResultDTO); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
@ -377,4 +390,61 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 议题管理-议题转项目 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void shiftProject(ShiftProjectFormDTO formDTO) { |
|
|
|
//因需要保证议题表中的转项目时间与创建项目时间一致 因此先新增项目数据再更新议题数据
|
|
|
|
//1:查询议题数据
|
|
|
|
IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); |
|
|
|
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); |
|
|
|
} |
|
|
|
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()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|