|
|
|
@ -37,12 +37,18 @@ import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
import com.epmet.constant.OrgInfoConstant; |
|
|
|
import com.epmet.dto.CustomerGridDTO; |
|
|
|
import com.epmet.dto.IssueApplicationDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.dto.result.CommonDataFilterResultDTO; |
|
|
|
import com.epmet.dto.result.IssueInitiatorResultDTO; |
|
|
|
import com.epmet.dto.result.UserResiInfoResultDTO; |
|
|
|
import com.epmet.feign.GovIssueOpenFeignClient; |
|
|
|
import com.epmet.modules.constant.GroupMemberConstant; |
|
|
|
import com.epmet.modules.constant.ResiGroupRedisKeys; |
|
|
|
import com.epmet.modules.feign.EpmetUserFeignClient; |
|
|
|
@ -79,6 +85,7 @@ import com.epmet.resi.group.dto.topic.TopicInfoDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.form.CheckTopicPublisherFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.form.*; |
|
|
|
import com.epmet.resi.group.dto.topic.form.IssueShiftedFromTopicFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.CheckTopicPublisherResultDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.GovTopicIssueInfoResultDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.*; |
|
|
|
@ -94,6 +101,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import javax.swing.text.html.Option; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
@ -153,6 +161,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovIssueOpenFeignClient issueOpenFeignClient; |
|
|
|
|
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
|
private String scanApiUrl; |
|
|
|
@Value("${openapi.scan.method.textSyncScan}") |
|
|
|
@ -707,7 +718,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
List<ResiTopicOperationEntity> records = |
|
|
|
resiTopicOperationDao.selectList(queryWrapper); |
|
|
|
if(null != records && records.size() > NumConstant.ZERO){ |
|
|
|
hiddenDetailDTO.setHiddenReason(records.get(0).getOperationReason()); |
|
|
|
hiddenDetailDTO.setHiddenReason(String.format("%s%s",ModuleConstant.HIDDEN_TOPIC_REASON_PREFIX,records.get(0).getOperationReason())); |
|
|
|
hiddenDetailDTO.setHiddenDateTime(records.get(0).getCreatedTime().getTime()/NumConstant.ONE_THOUSAND); |
|
|
|
ResiGroupMemberInfoRedisDTO hiddenBy = |
|
|
|
resiGroupMemberRedis.get(topicDetail.getGroupId(),records.get(0).getCreatedBy()); |
|
|
|
@ -1276,7 +1287,24 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
logger.error(ModuleConstant.NO_SUCH_GROUP); |
|
|
|
result.setBelongGridName(ModuleConstant.EMPTY_STR); |
|
|
|
} |
|
|
|
return result; |
|
|
|
|
|
|
|
//4.查询议题申请信息,因为审核中的议题在话题中无法体现是否被转为议题,所以需要查询一下当前话题是否已经提交申请
|
|
|
|
Map<String,Object> param = new HashMap<>(); param.put(ModuleConstant.FILED_TOPIC_ID_HUMP,topicIdFormDTO.getTopicId()); |
|
|
|
Result<List<IssueApplicationDTO>> record = issueOpenFeignClient.list(param); |
|
|
|
if(!record.success()){ |
|
|
|
log.error("com.epmet.modules.topic.service.impl.ResiTopicServiceImpl.initTopicInfoWhenShift,,话题Id:{}",topicIdFormDTO.getTopicId()); |
|
|
|
throw new RenException(ModuleConstant.FAILED_QUERY_ISSUE_APPLICATION_RECORD); |
|
|
|
} |
|
|
|
result.setIssueApplicationId(ModuleConstant.EMPTY_STR); |
|
|
|
result.setApplyStatus(ModuleConstant.EMPTY_STR); |
|
|
|
if(!CollectionUtils.isEmpty(record.getData())){ |
|
|
|
if(record.getData().size() > NumConstant.ONE){ |
|
|
|
log.error("com.epmet.modules.topic.service.impl.ResiTopicServiceImpl.initTopicInfoWhenShift,查出多条转移提提交记录,话题Id:{}",topicIdFormDTO.getTopicId()); |
|
|
|
} |
|
|
|
result.setIssueApplicationId(Optional.ofNullable(record.getData().get(NumConstant.ZERO).getId()).orElse(ModuleConstant.EMPTY_STR)); |
|
|
|
result.setApplyStatus(Optional.ofNullable(record.getData().get(NumConstant.ZERO).getApplyStatus()).orElse(ModuleConstant.EMPTY_STR)); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
throw new RenException(ModuleConstant.FAILED_QUERY_TOPIC_INFO); |
|
|
|
} |
|
|
|
@ -1315,6 +1343,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//1.统一时间(群组服务 -> 议题服务)
|
|
|
|
Date now = new Date(); |
|
|
|
//2.调用gov-org获取数据权限
|
|
|
|
@ -1334,7 +1363,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
Result<CommonDataFilterResultDTO> dataFilterResult = |
|
|
|
govOrgFeignClient.gridDataFilter(dataFilterParam); |
|
|
|
if(dataFilterResult.success() && null != dataFilterResult.getData()){ |
|
|
|
IssueShiftedFromTopicFormDTO issueInfo = ConvertUtils.sourceToTarget(topicTurnIssueFromDTO,IssueShiftedFromTopicFormDTO.class); |
|
|
|
com.epmet.dto.form.IssueShiftedFromTopicFormDTO issueInfo = ConvertUtils.sourceToTarget(topicTurnIssueFromDTO, com.epmet.dto.form.IssueShiftedFromTopicFormDTO .class); |
|
|
|
issueInfo.setCreatedTime(now); |
|
|
|
issueInfo.setGridId(group.getGridId()); |
|
|
|
issueInfo.setCustomerId(group.getCustomerId()); |
|
|
|
@ -1388,6 +1417,202 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 话题转议题 添加内容审核 |
|
|
|
* @param topicTurnIssueFromDTO |
|
|
|
* @return com.epmet.dto.result.FirstTopicShiftedToIssueApplicationResultDTO |
|
|
|
* @author wangc |
|
|
|
* @date 2020.11.20 10:26 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public FirstTopicShiftedToIssueApplicationResultDTO shiftIssueV2(ResiTopicTurnIssueFromDTO topicTurnIssueFromDTO) { |
|
|
|
//话题转议题审核:标题、建议
|
|
|
|
String issueTitle = topicTurnIssueFromDTO.getIssueTitle(); |
|
|
|
String suggestion = topicTurnIssueFromDTO.getSuggestion(); |
|
|
|
if (StringUtils.isNotBlank(issueTitle) || StringUtils.isNotBlank(suggestion)) { |
|
|
|
TextScanParamDTO textScan = new TextScanParamDTO(); |
|
|
|
//标题
|
|
|
|
TextTaskDTO taskTitle = new TextTaskDTO(); |
|
|
|
taskTitle.setContent(issueTitle); |
|
|
|
taskTitle.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
textScan.getTasks().add(taskTitle); |
|
|
|
//建议
|
|
|
|
TextTaskDTO taskSuggestion = new TextTaskDTO(); |
|
|
|
taskSuggestion.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
taskSuggestion.setContent(suggestion); |
|
|
|
textScan.getTasks().add(taskSuggestion); |
|
|
|
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScan); |
|
|
|
if (!textSyncScanResult.success()) { |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!textSyncScanResult.getData().isAllPass()) { |
|
|
|
log.error(String.format(TopicConstant.SHIFT_ISSUE, issueTitle, suggestion)); |
|
|
|
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
FirstTopicShiftedToIssueApplicationResultDTO result = null; |
|
|
|
|
|
|
|
//1.统一时间(群组服务 -> 议题服务)
|
|
|
|
Date now = new Date(); |
|
|
|
//2.调用gov-org获取数据权限
|
|
|
|
ResiTopicAndGroupResultDTO group = baseDao.getGroupInfoByTopicId(topicTurnIssueFromDTO.getTopicId()); |
|
|
|
if(null == group) { |
|
|
|
throw new RenException(ModuleConstant.FAILURE_TO_TURN_ISSUE); |
|
|
|
} |
|
|
|
TopicInfoFormDTO topicId = new TopicInfoFormDTO(); |
|
|
|
topicId.setTopicId(topicTurnIssueFromDTO.getTopicId()); |
|
|
|
Integer issueCount = govIssueFeignClient.checkTopicShiftIssue(topicId).getData(); |
|
|
|
if (issueCount != NumConstant.ZERO){ |
|
|
|
throw new RenException(ModuleConstant.ALREADY_SHIFT_ISSUE); |
|
|
|
} |
|
|
|
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO(); |
|
|
|
dataFilterParam.setUserId(topicTurnIssueFromDTO.getUserId()); |
|
|
|
dataFilterParam.setGridId(group.getGridId()); |
|
|
|
Result<CommonDataFilterResultDTO> dataFilterResult = |
|
|
|
govOrgFeignClient.gridDataFilter(dataFilterParam); |
|
|
|
if(dataFilterResult.success() && null != dataFilterResult.getData()){ |
|
|
|
com.epmet.dto.form.IssueShiftedFromTopicFormDTO issueInfo = ConvertUtils.sourceToTarget(topicTurnIssueFromDTO, com.epmet.dto.form.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())); |
|
|
|
issueInfo.setGroupId(group.getGroupId()); |
|
|
|
//4.调用gov-issue新增议题
|
|
|
|
Result<FirstTopicShiftedToIssueApplicationResultDTO> issueResult = issueOpenFeignClient.topicShiftedToIssueV2(issueInfo); |
|
|
|
if (issueResult == null || !issueResult.success() || null == issueResult.getData()) { |
|
|
|
throw new RenException(ModuleConstant.CREATE_ISSUE_ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
result = issueResult.getData(); |
|
|
|
ValidatorUtils.validateEntity(result, FirstTopicShiftedToIssueApplicationResultDTO.SwitchRequiredGroup.class); |
|
|
|
if(StringUtils.equals("close",result.getAuditSwitch())) { |
|
|
|
ValidatorUtils.validateEntity(result, FirstTopicShiftedToIssueApplicationResultDTO.ForbidAuditionGroup.class); |
|
|
|
//5.修改话题shiftIssue字段
|
|
|
|
ResiTopicEntity topic2Upd = new ResiTopicEntity(); |
|
|
|
topic2Upd.setId(topicTurnIssueFromDTO.getTopicId()); |
|
|
|
topic2Upd.setUpdatedBy(topicTurnIssueFromDTO.getUserId()); |
|
|
|
topic2Upd.setShiftIssue(Boolean.TRUE); |
|
|
|
topic2Upd.setIssueId(issueResult.getData().getIssueId()); |
|
|
|
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); |
|
|
|
} |
|
|
|
} else logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC); |
|
|
|
//7.更新组统计信息 议题数量+1
|
|
|
|
resiGroupStatisticalDao.incryTotalIssues(group.getGroupId()); |
|
|
|
if (null != groupCache && null != groupCache.getGroupStatisticalInfo()) { |
|
|
|
groupCache.getGroupStatisticalInfo().setTotalIssues( |
|
|
|
null == groupCache.getGroupStatisticalInfo().getTotalIssues() ? NumConstant.ONE |
|
|
|
: groupCache.getGroupStatisticalInfo().getTotalIssues() + NumConstant.ONE |
|
|
|
); |
|
|
|
resiGroupRedis.set(groupCache); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
ValidatorUtils.validateEntity(result, FirstTopicShiftedToIssueApplicationResultDTO.AllowAuditionGroup.class); |
|
|
|
} |
|
|
|
|
|
|
|
}else throw new RenException(dataFilterResult.getMsg()); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 工作端审核议题通过时获取一些议题相关信息 |
|
|
|
* @param param |
|
|
|
* @return com.epmet.resi.group.dto.topic.form.ResiTopicTurnIssueFromDTO |
|
|
|
* @author wangc |
|
|
|
* @date 2020.11.20 18:09 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public IssueShiftedFromTopicFormDTO getIssueInfoWhenAudit(ResiTopicTurnIssueFromDTO param) { |
|
|
|
|
|
|
|
ResiTopicAndGroupResultDTO group = baseDao.getGroupInfoByTopicId(param.getTopicId()); |
|
|
|
if (null == group) throw new RenException(ModuleConstant.QUERY_GROUPINFO_FAILED); |
|
|
|
|
|
|
|
ResiTopicEntity topic = resiTopicDao.selectById(param.getTopicId()); |
|
|
|
if (null == topic) throw new RenException(ModuleConstant.NO_SUCH_TOPIC); |
|
|
|
|
|
|
|
if (topic.getShiftIssue()) throw new RenException(ModuleConstant.ALREADY_SHIFT_ISSUE); |
|
|
|
|
|
|
|
IssueShiftedFromTopicFormDTO issueInfo = ConvertUtils.sourceToTarget(param, IssueShiftedFromTopicFormDTO.class); |
|
|
|
|
|
|
|
issueInfo.setCreatedTime(param.getUnifiedDate()); |
|
|
|
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()); |
|
|
|
//参数里的userId并不是工作端审核人的Id 而是转议题人的Id
|
|
|
|
ResiGroupMemberInfoRedisDTO issueAuthor = resiGroupMemberRedis.get(group.getGroupId(), param.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())); |
|
|
|
issueInfo.setGroupId(group.getGroupId()); |
|
|
|
issueInfo.setCustomerId(group.getCustomerId()); |
|
|
|
issueInfo.setIssueAuthorId(issueAuthor.getUserId()); |
|
|
|
|
|
|
|
if(StringUtils.equals(ModuleConstant.AUDITING_OPERATION_APPROVAL,param.getActionType())){ |
|
|
|
//5.修改话题shiftIssue字段
|
|
|
|
ResiTopicEntity topic2Upd = new ResiTopicEntity(); |
|
|
|
topic2Upd.setId(param.getTopicId()); |
|
|
|
topic2Upd.setUpdatedBy(param.getUserId()); |
|
|
|
topic2Upd.setShiftIssue(Boolean.TRUE); |
|
|
|
topic2Upd.setIssueId(param.getIssueId()); |
|
|
|
topic2Upd.setUpdatedTime(param.getUnifiedDate()); |
|
|
|
|
|
|
|
int topicResult = baseDao.updateOne(topic2Upd); |
|
|
|
//6.新增话题操作记录
|
|
|
|
if (topicResult == NumConstant.ONE) { |
|
|
|
ResiTopicOperationEntity operation = new ResiTopicOperationEntity(); |
|
|
|
operation.setCreatedTime(param.getUnifiedDate()); |
|
|
|
operation.setCreatedBy(param.getUserId()); |
|
|
|
operation.setTopicId(param.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); |
|
|
|
} |
|
|
|
} else logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC); |
|
|
|
//7.更新组统计信息 议题数量+1
|
|
|
|
resiGroupStatisticalDao.incryTotalIssues(group.getGroupId()); |
|
|
|
if (null != groupCache && null != groupCache.getGroupStatisticalInfo()) { |
|
|
|
groupCache.getGroupStatisticalInfo().setTotalIssues( |
|
|
|
null == groupCache.getGroupStatisticalInfo().getTotalIssues() ? NumConstant.ONE |
|
|
|
: groupCache.getGroupStatisticalInfo().getTotalIssues() + NumConstant.ONE |
|
|
|
); |
|
|
|
resiGroupRedis.set(groupCache); |
|
|
|
} |
|
|
|
} |
|
|
|
return issueInfo; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 政府端查看议题详情时的话题相关信息 |
|
|
|
* @param govTopicIssueInfoFormDTO |
|
|
|
|