|
|
@ -15,19 +15,13 @@ 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.dao.IssueProjectRelationDao; |
|
|
|
import com.epmet.dto.IssueDTO; |
|
|
|
import com.epmet.dto.IssueProcessDTO; |
|
|
|
import com.epmet.dto.IssueVoteStatisticalDTO; |
|
|
|
import com.epmet.dto.form.CommonIssueListFormDTO; |
|
|
|
import com.epmet.dao.IssueProcessDao; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.dto.form.CloseIssueFormDTO; |
|
|
|
import com.epmet.dto.form.DepartmentStaffListFormDTO; |
|
|
|
import com.epmet.dto.form.IssueDetailFormDTO; |
|
|
|
import com.epmet.dto.form.IssueShiftedFromTopicFormDTO; |
|
|
|
import com.epmet.dto.form.UserMessageFormDTO; |
|
|
|
import com.epmet.entity.IssueEntity; |
|
|
|
import com.epmet.entity.IssueProcessEntity; |
|
|
|
import com.epmet.entity.IssueProjectRelationEntity; |
|
|
@ -51,9 +45,6 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -153,71 +144,6 @@ 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服务,给居民端话题创建人和议题发起人发送消息
|
|
|
|
//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 根据issueId查询gridId |
|
|
|
* @param issueId |
|
|
@ -231,27 +157,6 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
return gridIdResult; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @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); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<GridVotingIssueCountResultDTO> queryVotingIssueCount(List<String> gridIdList) { |
|
|
|
List<GridVotingIssueCountResultDTO> list = new ArrayList<>(); |
|
|
@ -269,19 +174,6 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @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<>(); |
|
|
@ -310,24 +202,6 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @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(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 话题转为议题入口 返回生成的议题Id |
|
|
|
* @param issueShiftedFromTopicFormDTO IssueShiftedFromTopicFormDTO.class |
|
|
@ -457,6 +331,125 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
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 |
|
|
|