|
|
|
@ -29,12 +29,14 @@ import com.epmet.commons.tools.scan.param.ImgTaskDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.TextScanParamDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.TextTaskDTO; |
|
|
|
import com.epmet.commons.tools.scan.result.SyncScanResult; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.constant.EventConstant; |
|
|
|
import com.epmet.constant.ResiEventAction; |
|
|
|
import com.epmet.dao.*; |
|
|
|
import com.epmet.dto.EventProjectInfoDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.*; |
|
|
|
@ -48,6 +50,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
@ -82,6 +85,10 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
private ResiEventMentionDao resiEventMentionDao; |
|
|
|
@Autowired |
|
|
|
private ResiEventOperationLogDao resiEventOperationLogDao; |
|
|
|
@Autowired |
|
|
|
private ProjectDao projectDao; |
|
|
|
@Autowired |
|
|
|
private ResiEventReplyDao resiEventReplyDao; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 群众直报(待处理、处理中、已办结)列表 |
|
|
|
@ -102,14 +109,46 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 查看报事时,更新时间操作 |
|
|
|
* @Description 报事-首次查看事件-两端通用 |
|
|
|
* @Param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2021/8/3 11:01 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void updateViewTime(UpdateViewTimeFormDTO formDTO) { |
|
|
|
|
|
|
|
ResiEventEntity eventEntity=baseDao.selectById(formDTO.getEventId()); |
|
|
|
if (null == eventEntity) { |
|
|
|
throw new RenException(String.format("没有找到事件记录,eventId:%s",formDTO.getEventId())); |
|
|
|
} |
|
|
|
if(formDTO.getUserId().equals(eventEntity.getReportUserId())){ |
|
|
|
log.warn("报事人查看详情不需要调用此接口"); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 这个事件已经被查看了
|
|
|
|
eventEntity.setReadFlag(true); |
|
|
|
baseDao.updateById(eventEntity); |
|
|
|
// 居民端:resi_user;工作端:staff
|
|
|
|
if(EventConstant.RESI_USER.equals(formDTO.getViewType())){ |
|
|
|
//被@的人置为已读
|
|
|
|
resiEventMentionDao.updateReadFlag(formDTO.getEventId(),formDTO.getUserId()); |
|
|
|
}else if(EventConstant.STAFF.equals(formDTO.getViewType())){ |
|
|
|
// 当前组织置为已读
|
|
|
|
resiEventReportOrgDao.updateReadFlag(formDTO.getEventId(),formDTO.getOrgId(),formDTO.getUserId()); |
|
|
|
} |
|
|
|
// 插入首次查看日志
|
|
|
|
List<ResiEventOperationLogEntity> logEntityList = resiEventOperationLogDao.selectByUserAction(formDTO.getEventId(), formDTO.getUserId(), ResiEventAction.READ_FIRST.getCode()); |
|
|
|
if (CollectionUtils.isEmpty(logEntityList)) { |
|
|
|
ResiEventOperationLogEntity publishLog=new ResiEventOperationLogEntity(); |
|
|
|
publishLog.setCustomerId(formDTO.getCustomerId()); |
|
|
|
publishLog.setResiEventId(formDTO.getEventId()); |
|
|
|
publishLog.setUserId(formDTO.getUserId()); |
|
|
|
publishLog.setUserIdentity(formDTO.getViewType()); |
|
|
|
publishLog.setActionCode(ResiEventAction.READ_FIRST.getCode()); |
|
|
|
publishLog.setActionDesc(ResiEventAction.READ_FIRST.getDesc()); |
|
|
|
publishLog.setOperateTime(new Date()); |
|
|
|
publishLog.setCreatedTime(publishLog.getOperateTime()); |
|
|
|
resiEventOperationLogDao.insert(publishLog); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -119,9 +158,60 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
* @date 2021/8/3 1:47 下午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public EventDetailResultDTO eventDetail(EventDetailFormDTO formDTO) { |
|
|
|
return null; |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public EventDetailResultDTO eventDetail(EventDetailFormDTO formDTO, TokenDto tokenDto) { |
|
|
|
EventDetailResultDTO dto = baseDao.selectEventDetail(formDTO.getEventId()); |
|
|
|
if (null == dto){ |
|
|
|
return new EventDetailResultDTO(); |
|
|
|
} |
|
|
|
// 已转项目
|
|
|
|
if (dto.getIsProject()){ |
|
|
|
// 查询项目信息
|
|
|
|
EventProjectInfoDTO eventProjectInfo = projectDao.selectEventProjectInfo(dto.getProjectId()); |
|
|
|
// 查询操作人的名字
|
|
|
|
Result<String> staffName = govOrgOpenFeignClient.staffName(eventProjectInfo.getUserId()); |
|
|
|
if (!staffName.success()){ |
|
|
|
throw new RenException("查询工作人员名字失败"); |
|
|
|
} |
|
|
|
eventProjectInfo.setOperationName(staffName.getData()); |
|
|
|
dto.setProjectInfo(eventProjectInfo); |
|
|
|
} |
|
|
|
// 查询报事人名字
|
|
|
|
List<String> userIdList = new ArrayList<>(); |
|
|
|
userIdList.add(dto.getEventUserId()); |
|
|
|
Result<List<UserBaseInfoResultDTO>> userResult=epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); |
|
|
|
if(!userResult.success()|| CollectionUtils.isEmpty(userResult.getData())){ |
|
|
|
throw new RenException("查询当前用户信息异常"); |
|
|
|
} |
|
|
|
userResult.getData().forEach(u -> { |
|
|
|
if (u.getUserId().equals(dto.getEventUserId())){ |
|
|
|
dto.setEventPeopleName(u.getShowName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 查询所属网格
|
|
|
|
Result<String> gridNameResult = govOrgOpenFeignClient.gridName(dto.getGridId()); |
|
|
|
if (!gridNameResult.success()){ |
|
|
|
throw new RenException("查询所属网格失败"); |
|
|
|
} |
|
|
|
dto.setGridName(gridNameResult.getData()); |
|
|
|
// 查询报事的org
|
|
|
|
List<String> orgNameList = dto.getOrgNameList(); |
|
|
|
Result<List<String>> orgResult = govOrgOpenFeignClient.selectOrgNameByType(orgNameList); |
|
|
|
if (!orgResult.success()){ |
|
|
|
throw new RenException("查询组织名称失败"); |
|
|
|
} |
|
|
|
List<String> data = orgResult.getData(); |
|
|
|
dto.setEventOrg(data); |
|
|
|
// 更改已读状态 报事人的红点:resi_event,艾特人的:resi_event_mention,所代表的组织的:resi_event_report_org
|
|
|
|
if (tokenDto.getApp().equals(EventConstant.TYPE_RESI)){ |
|
|
|
baseDao.updateResiEvent(tokenDto.getUserId(),formDTO.getEventId()); |
|
|
|
baseDao.updateEventMention(tokenDto.getUserId(),formDTO.getEventId()); |
|
|
|
}else if (tokenDto.getApp().equals(EventConstant.TYPE_GOV)){ |
|
|
|
resiEventReportOrgDao.updateEventOrg(formDTO.getEventId(), formDTO.getOrgId()); |
|
|
|
} |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 我要报事-提交(尹) |
|
|
|
* |
|
|
|
@ -185,6 +275,7 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
publishLog.setActionCode(ResiEventAction.PUBLISH.getCode()); |
|
|
|
publishLog.setActionDesc(ResiEventAction.PUBLISH.getDesc()); |
|
|
|
publishLog.setOperateTime(resiEventEntity.getCreatedTime()); |
|
|
|
publishLog.setCreatedTime(resiEventEntity.getCreatedTime()); |
|
|
|
resiEventOperationLogDao.insert(publishLog); |
|
|
|
//9、返回事件id
|
|
|
|
ResiEventIdDTO resiEventIdDTO=new ResiEventIdDTO(); |
|
|
|
@ -199,12 +290,14 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
mentionEntity.setCustomerId(customerId); |
|
|
|
mentionEntity.setResiEventId(resiEventId); |
|
|
|
mentionEntity.setUserType(EventConstant.NPC_USER); |
|
|
|
mentionEntity.setUserShowName(npc.getUserShowName()); |
|
|
|
mentionEntity.setUserId(npc.getUserId()); |
|
|
|
mentionEntity.setGridId(npc.getGridId()); |
|
|
|
mentionEntity.setAgencyId(npc.getAgencyId()); |
|
|
|
mentionEntity.setPids(npc.getPids()); |
|
|
|
mentionEntity.setReadFlag(EventConstant.UN_READ); |
|
|
|
mentionEntity.setRedDot(true); |
|
|
|
//默认不展示,因为此时在未读列表中
|
|
|
|
mentionEntity.setRedDot(false); |
|
|
|
list.add(mentionEntity); |
|
|
|
}); |
|
|
|
return list; |
|
|
|
@ -219,7 +312,8 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
entity.setOrgType(org.getOrgLevel()); |
|
|
|
//默认是未读
|
|
|
|
entity.setOrgRead(EventConstant.UN_READ); |
|
|
|
entity.setRedDot(true); |
|
|
|
//默认是不展示红点,因为此时在待处理中。
|
|
|
|
entity.setRedDot(false); |
|
|
|
list.add(entity); |
|
|
|
}); |
|
|
|
return list; |
|
|
|
@ -324,6 +418,7 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
reCallLog.setActionCode(ResiEventAction.RECALL.getCode()); |
|
|
|
reCallLog.setActionDesc(ResiEventAction.RECALL.getDesc()); |
|
|
|
reCallLog.setOperateTime(resiEventEntity.getLatestOperatedTime()); |
|
|
|
reCallLog.setCreatedTime(resiEventEntity.getLatestOperatedTime()); |
|
|
|
resiEventOperationLogDao.insert(reCallLog); |
|
|
|
|
|
|
|
} |
|
|
|
@ -374,9 +469,27 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<MyReportedResultDTO> queryMyReported(MyReportedFormDTO formDTO) { |
|
|
|
// 未处理: 发了没有人看过的时间
|
|
|
|
// 处理中: 有人看,正在处理中的
|
|
|
|
// 已办结:有人看,已经办结了的
|
|
|
|
PageInfo<MyReportedResultDTO> result = PageHelper.startPage(formDTO.getPageNo(), |
|
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.queryMyReported(formDTO.getUserId(), |
|
|
|
formDTO.getStatusCondition())); |
|
|
|
result.getList().forEach(resultDTO->{ |
|
|
|
if(EventConstant.EVENT_STATUS_CLOSED_CASE.equals(resultDTO.getStatus())){ |
|
|
|
// 已办结的不显示回复按钮
|
|
|
|
resultDTO.setReplyButtonFlag("false"); |
|
|
|
}else{ |
|
|
|
// 处理中的事件
|
|
|
|
if(resultDTO.getReadFlag()){ |
|
|
|
// 被别人看过了就显示回复
|
|
|
|
resultDTO.setReplyButtonFlag("true"); |
|
|
|
}else{ |
|
|
|
//别人没看过
|
|
|
|
resultDTO.setReplyButtonFlag("false"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
return result.getList(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -396,5 +509,68 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
return result.getList(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 最新直报 |
|
|
|
* @Param userId |
|
|
|
* @author zxc |
|
|
|
* @date 2021/8/5 9:55 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<NewEventsResultDTO> newEvents(String userId) { |
|
|
|
Result<List<String>> listResult = govOrgOpenFeignClient.selectOrgsByUserId(userId); |
|
|
|
if (!listResult.success()){ |
|
|
|
throw new RenException("查询userId:"+userId+",所在org失败"); |
|
|
|
} |
|
|
|
List<String> orgIds = listResult.getData(); |
|
|
|
if (!CollectionUtils.isEmpty(orgIds)){ |
|
|
|
List<NewEventsResultDTO> result = baseDao.newEvents(orgIds); |
|
|
|
return result; |
|
|
|
} |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 报事办结:没有回复或立项不可办结 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @date 2021/8/5 10:48 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void closeResiEvent(CloseResiEventFormDTO formDTO) { |
|
|
|
ResiEventEntity resiEventEntity=baseDao.selectById(formDTO.getEventId()); |
|
|
|
if(null==resiEventEntity){ |
|
|
|
throw new RenException(String.format("根据事件id没有找到记录",formDTO.getEventId())); |
|
|
|
} |
|
|
|
List<ReplyListResultDTO> replyList=resiEventReplyDao.selectReplyList(formDTO.getEventId()); |
|
|
|
//如果未转项目,也没有回复,不允许办结
|
|
|
|
if(!resiEventEntity.getShiftProject()&&CollectionUtils.isEmpty(replyList)){ |
|
|
|
throw new RenException(EpmetErrorCode.RESI_EVENT_CAN_NOT_CLOSE_CASE.getCode(),EpmetErrorCode.RESI_EVENT_CAN_NOT_CLOSE_CASE.getMsg()); |
|
|
|
} |
|
|
|
// 1、修改事件状态
|
|
|
|
resiEventEntity.setRedDot(true); |
|
|
|
resiEventEntity.setStatus(EventConstant.EVENT_STATUS_CLOSED_CASE); |
|
|
|
resiEventEntity.setCloseCaseTime(new Date()); |
|
|
|
resiEventEntity.setLatestOperatedTime(resiEventEntity.getCloseCaseTime()); |
|
|
|
baseDao.updateById(resiEventEntity); |
|
|
|
// 2、记录操作日志
|
|
|
|
ResiEventOperationLogEntity reCallLog=new ResiEventOperationLogEntity(); |
|
|
|
reCallLog.setCustomerId(resiEventEntity.getCustomerId()); |
|
|
|
reCallLog.setResiEventId(resiEventEntity.getId()); |
|
|
|
reCallLog.setUserId(formDTO.getUserId()); |
|
|
|
reCallLog.setUserIdentity(EventConstant.STAFF); |
|
|
|
reCallLog.setActionCode(ResiEventAction.CLOSE_CASE.getCode()); |
|
|
|
reCallLog.setActionDesc(ResiEventAction.CLOSE_CASE.getDesc()); |
|
|
|
reCallLog.setOperateTime(resiEventEntity.getCloseCaseTime()); |
|
|
|
resiEventOperationLogDao.insert(reCallLog); |
|
|
|
// 3、红点:
|
|
|
|
// 当前工作人员办结后:
|
|
|
|
// 3.1、报事人在已办结列表中展示红点:上面已经更新
|
|
|
|
// 3.2、人大代表在未读/已读列表中展示红点
|
|
|
|
resiEventMentionDao.updateRedDotShow(formDTO.getEventId(),null); |
|
|
|
// 3.3、目前Db设计支持报给多个层级(组织或网格),按理说应该更新非当前组织外,其他的组织,显示红点,先不做了吧 todo
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |