Browse Source

报事

dev_shibei_match
yinzuomei 4 years ago
parent
commit
30807755a4
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 26
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/EventConstant.java
  3. 3
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java
  4. 13
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventDao.java
  5. 146
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java
  6. 44
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -95,6 +95,9 @@ public enum EpmetErrorCode {
IMG_SCAN_FAILED(8504,"图片审核失败,请重新上传"), IMG_SCAN_FAILED(8504,"图片审核失败,请重新上传"),
PROJECT_IS_CLOSED(8601,"项目已结案"), PROJECT_IS_CLOSED(8601,"项目已结案"),
VOTE_ISSUE_PLEASE(8602,"请先选择支持或反对,再发表您的想法"), VOTE_ISSUE_PLEASE(8602,"请先选择支持或反对,再发表您的想法"),
RESI_EVENT_READ(8603,"当前事件正在处理中,不能撤回"),
RESI_EVENT_NOT_MY_REPORTED(8604,"当前事件不是您发布的,无权操作"),
// 爱心互助 居民端 // 爱心互助 居民端
NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"), NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"),
// 活动报名失败,弹窗:志愿者认证 // 活动报名失败,弹窗:志愿者认证

26
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/EventConstant.java

@ -14,7 +14,33 @@ public interface EventConstant {
String EVENT_UN_DISPOSED = "undisposed"; String EVENT_UN_DISPOSED = "undisposed";
String EVENT_TRANSFERRED = "transferred"; String EVENT_TRANSFERRED = "transferred";
/**
* 事件状态resi_event.status:处理中processing已办结closed_case
*/
String EVENT_STATUS_PROCESSING="processing"; String EVENT_STATUS_PROCESSING="processing";
String EVENT_STATUS_CLOSED_CASE="closed_case";
String READ="read"; String READ="read";
String UN_READ="un_read"; String UN_READ="un_read";
/**
* 事件@人员表用户身份
* resi_event_mention.user_type
*/
String NPC_USER="npc_user";
/**
* 操作日志表用户来源resi_event_operation_log.userIdentity
* 居民端用户:resi_user工作人员:staff报事人:report_user
*/
String RESI_USER="resi_user";
String STAFF="staff";
String REPORT_USER="report_user";
/**
* 事件是否解决已解决 resolved未解决 un_solved
*/
String RESOLVED="resolved";
String UN_SOLVED="un_solved";
} }

3
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java

@ -153,4 +153,7 @@ public class ResiEventController {
resiEventService.updateViewTime(formDTO); resiEventService.updateViewTime(formDTO);
return new Result(); return new Result();
} }
} }

13
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventDao.java

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.EventListResultDTO; import com.epmet.dto.result.EventListResultDTO;
import com.epmet.dto.result.MyReportedResultDTO;
import com.epmet.entity.ResiEventEntity; import com.epmet.entity.ResiEventEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -42,5 +43,15 @@ public interface ResiEventDao extends BaseDao<ResiEventEntity> {
* @date 2021/8/3 4:21 下午 * @date 2021/8/3 4:21 下午
*/ */
List<EventListResultDTO> eventUnDisposedList(@Param("orgId")String orgId,@Param("eventType")String eventType); List<EventListResultDTO> eventUnDisposedList(@Param("orgId")String orgId,@Param("eventType")String eventType);
/**
* 居民端我的报事列表查询
*
* @param userId 报事人
* @param statusCondition 未处理:un_read处理中processing已办结closed_case
* @return java.util.List<com.epmet.dto.result.MyReportedResultDTO>
* @author yinzuomei
* @date 2021/8/3 23:21
*/
List<MyReportedResultDTO> queryMyReported(@Param("userId") String userId, @Param("statusCondition")String statusCondition);
} }

146
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java

@ -17,7 +17,9 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.FileCommonDTO; import com.epmet.commons.tools.dto.form.FileCommonDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -31,15 +33,16 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.constant.EventConstant; import com.epmet.constant.EventConstant;
import com.epmet.dao.ResiEventAttachmentDao; import com.epmet.constant.ResiEventAction;
import com.epmet.dao.ResiEventDao; import com.epmet.dao.*;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.entity.ResiEventAttachmentEntity; import com.epmet.entity.*;
import com.epmet.entity.ResiEventEntity;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.ResiEventService; import com.epmet.service.ResiEventService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -73,6 +76,12 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired @Autowired
private ResiEventAttachmentDao resiEventAttachmentDao; private ResiEventAttachmentDao resiEventAttachmentDao;
@Autowired
private ResiEventReportOrgDao resiEventReportOrgDao;
@Autowired
private ResiEventMentionDao resiEventMentionDao;
@Autowired
private ResiEventOperationLogDao resiEventOperationLogDao;
/** /**
* @Description 群众直报待处理处理中已办结列表 * @Description 群众直报待处理处理中已办结列表
@ -131,6 +140,7 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
if(!gridInfoRes.success()||null==gridInfoRes.getData()){ if(!gridInfoRes.success()||null==gridInfoRes.getData()){
throw new RenException("网格信息查询异常"); throw new RenException("网格信息查询异常");
} }
ResiEventEntity resiEventEntity= ConvertUtils.sourceToTarget(formDTO,ResiEventEntity.class); ResiEventEntity resiEventEntity= ConvertUtils.sourceToTarget(formDTO,ResiEventEntity.class);
resiEventEntity.setAgencyId(gridInfoRes.getData().getParentAgencyId()); resiEventEntity.setAgencyId(gridInfoRes.getData().getParentAgencyId());
resiEventEntity.setPids(gridInfoRes.getData().getPids()); resiEventEntity.setPids(gridInfoRes.getData().getPids());
@ -157,16 +167,66 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
resiEventAttachmentDao.insert(attachmentEntity); resiEventAttachmentDao.insert(attachmentEntity);
}); });
//6、插入组织表 //6、插入组织表
List<ResiEventReportOrgEntity> orgEntityList=getOrgList(formDTO.getCustomerId(),resiEventEntity.getId(),formDTO.getOrgList());
orgEntityList.forEach(orgEntity->{
resiEventReportOrgDao.insert(orgEntity);
});
//7、插入艾特人表 //7、插入艾特人表
List<ResiEventMentionEntity> npcList=getNpcList(formDTO.getCustomerId(),resiEventEntity.getId(),formDTO.getNpcUserList());
npcList.forEach(npc->{
resiEventMentionDao.insert(npc);
});
//8、插入log日志 //8、插入log日志
ResiEventOperationLogEntity publishLog=new ResiEventOperationLogEntity();
publishLog.setCustomerId(formDTO.getCustomerId());
publishLog.setResiEventId(resiEventEntity.getId());
publishLog.setUserId(formDTO.getUserId());
publishLog.setUserIdentity(EventConstant.REPORT_USER);
publishLog.setActionCode(ResiEventAction.PUBLISH.getCode());
publishLog.setActionDesc(ResiEventAction.PUBLISH.getDesc());
publishLog.setOperateTime(resiEventEntity.getCreatedTime());
resiEventOperationLogDao.insert(publishLog);
//9、返回事件id
ResiEventIdDTO resiEventIdDTO=new ResiEventIdDTO();
resiEventIdDTO.setResiEventId(resiEventEntity.getId());
return resiEventIdDTO;
}
private List<ResiEventMentionEntity> getNpcList(String customerId, String resiEventId, List<MentionUserFormDTO> npcUserList) {
List<ResiEventMentionEntity> list=new ArrayList<>();
npcUserList.forEach(npc->{
ResiEventMentionEntity mentionEntity=new ResiEventMentionEntity();
mentionEntity.setCustomerId(customerId);
mentionEntity.setResiEventId(resiEventId);
mentionEntity.setUserType(EventConstant.NPC_USER);
mentionEntity.setUserId(npc.getNpcUserId());
mentionEntity.setGridId(npc.getGridId());
mentionEntity.setAgencyId(npc.getAgencyId());
mentionEntity.setPids(npc.getPids());
mentionEntity.setReadFlag(EventConstant.UN_READ);
mentionEntity.setRedDot(true);
list.add(mentionEntity);
});
return list;
}
return null; private List<ResiEventReportOrgEntity> getOrgList(String customerId, String resiEventId, List<ReportOrgFormDTO> orgList) {
List<ResiEventReportOrgEntity> list=new ArrayList<>();
orgList.forEach(org->{
ResiEventReportOrgEntity entity=ConvertUtils.sourceToTarget(org,ResiEventReportOrgEntity.class);
entity.setCustomerId(customerId);
entity.setResiEventId(resiEventId);
//默认是未读
entity.setOrgRead(EventConstant.UN_READ);
entity.setRedDot(true);
list.add(entity);
});
return list;
} }
private List<ResiEventAttachmentEntity> getAttList(String customerId,String resiEventId, List<FileCommonDTO> attachmentList) { private List<ResiEventAttachmentEntity> getAttList(String customerId,String resiEventId, List<FileCommonDTO> attachmentList) {
List<ResiEventAttachmentEntity> list=new ArrayList<>(); List<ResiEventAttachmentEntity> list=new ArrayList<>();
int sort=1; int sort= NumConstant.ONE;
for(FileCommonDTO img:attachmentList){ for(FileCommonDTO img:attachmentList){
ResiEventAttachmentEntity entity=new ResiEventAttachmentEntity(); ResiEventAttachmentEntity entity=new ResiEventAttachmentEntity();
entity.setCustomerId(customerId); entity.setCustomerId(customerId);
@ -177,6 +237,7 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
entity.setAttachmentUrl(img.getUrl()); entity.setAttachmentUrl(img.getUrl());
entity.setSort(sort); entity.setSort(sort);
sort++; sort++;
list.add(entity);
} }
return list; return list;
} }
@ -227,6 +288,7 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
/** /**
* 撤回事件 * 撤回事件
* *
* 需求描述:未处理状态中可撤回上报事件撤回后不在展示列表内@的人大代表或组织已读后按钮消失
* @param formDTO * @param formDTO
* @return void * @return void
* @author yinzuomei * @author yinzuomei
@ -234,9 +296,34 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
*/ */
@Override @Override
public void reCall(ReCallEventFormDTO formDTO) { public void reCall(ReCallEventFormDTO formDTO) {
// todo ResiEventEntity resiEventEntity=baseDao.selectById(formDTO.getResiEventId());
if(null==resiEventEntity){
throw new RenException(String.format("根据事件id没有找到记录",formDTO.getResiEventId()));
}
// 我自己的发布的才可以删除
if(!formDTO.getUserId().equals(resiEventEntity.getReportUserId())){
log.warn("撤回事件入参:"+JSON.toJSONString(formDTO));
throw new RenException(EpmetErrorCode.RESI_EVENT_NOT_MY_REPORTED.getCode(),EpmetErrorCode.RESI_EVENT_NOT_MY_REPORTED.getMsg());
}
// 没有人看到过,才可以删除
if(resiEventEntity.getReadFlag()){
throw new RenException(EpmetErrorCode.RESI_EVENT_READ.getCode(),EpmetErrorCode.RESI_EVENT_READ.getMsg());
}
resiEventEntity.setLatestOperatedTime(new Date());
resiEventEntity.setRecallFlag(true);
resiEventEntity.setRecallTime(resiEventEntity.getLatestOperatedTime());
//1、更新主表标记已撤回
baseDao.updateById(resiEventEntity);
//2、插入log日志
ResiEventOperationLogEntity reCallLog=new ResiEventOperationLogEntity();
reCallLog.setCustomerId(formDTO.getCustomerId());
reCallLog.setResiEventId(resiEventEntity.getId());
reCallLog.setUserId(formDTO.getUserId());
reCallLog.setUserIdentity(EventConstant.REPORT_USER);
reCallLog.setActionCode(ResiEventAction.RECALL.getCode());
reCallLog.setActionDesc(ResiEventAction.RECALL.getDesc());
reCallLog.setOperateTime(resiEventEntity.getLatestOperatedTime());
resiEventOperationLogDao.insert(reCallLog);
} }
@ -250,13 +337,30 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
*/ */
@Override @Override
public void chooseResolve(ChooseResolveFormDTO formDTO) { public void chooseResolve(ChooseResolveFormDTO formDTO) {
// todo ResiEventEntity resiEventEntity=baseDao.selectById(formDTO.getResiEventId());
if(null==resiEventEntity){
throw new RenException(String.format("根据事件id没有找到记录",formDTO.getResiEventId()));
}
// 我自己的发布的才可以
if(!formDTO.getUserId().equals(resiEventEntity.getReportUserId())){
throw new RenException(EpmetErrorCode.RESI_EVENT_NOT_MY_REPORTED.getCode(),EpmetErrorCode.RESI_EVENT_NOT_MY_REPORTED.getMsg());
}
if(!EventConstant.EVENT_STATUS_CLOSED_CASE.equals(resiEventEntity.getStatus())){
throw new RenException("事件办结后,才可以选择是否解决,当前状态为:"+resiEventEntity.getStatus());
}
resiEventEntity.setResolveStatus(formDTO.getResolveStatus());
resiEventEntity.setUpdatedTime(new Date());
baseDao.updateById(resiEventEntity);
//2、插入log日志
ResiEventOperationLogEntity reCallLog=new ResiEventOperationLogEntity();
reCallLog.setCustomerId(formDTO.getCustomerId());
reCallLog.setResiEventId(resiEventEntity.getId());
reCallLog.setUserId(formDTO.getUserId());
reCallLog.setUserIdentity(EventConstant.REPORT_USER);
reCallLog.setActionCode(ResiEventAction.CHOOSE_RESOLVE.getCode());
reCallLog.setActionDesc(ResiEventAction.CHOOSE_RESOLVE.getDesc());
reCallLog.setOperateTime(resiEventEntity.getUpdatedTime());
resiEventOperationLogDao.insert(reCallLog);
} }
/** /**
@ -269,11 +373,11 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
*/ */
@Override @Override
public List<MyReportedResultDTO> queryMyReported(MyReportedFormDTO formDTO) { public List<MyReportedResultDTO> queryMyReported(MyReportedFormDTO formDTO) {
// todo PageInfo<MyReportedResultDTO> result = PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.queryMyReported(formDTO.getUserId(),
formDTO.getStatusCondition()));
return result.getList();
}
return null;
}
} }

44
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml

@ -42,4 +42,48 @@
)t )t
LEFT JOIN resi_event_attachment rea ON (rea.RESI_EVENT_ID = t.eventId AND rea.DEL_FLAG = '0' AND rea.ATTACHMENT_TYPE = 'image' AND (rea.SORT = 0 OR rea.SORT = 1 OR rea.SORT = 2)) LEFT JOIN resi_event_attachment rea ON (rea.RESI_EVENT_ID = t.eventId AND rea.DEL_FLAG = '0' AND rea.ATTACHMENT_TYPE = 'image' AND (rea.SORT = 0 OR rea.SORT = 1 OR rea.SORT = 2))
</select> </select>
<resultMap id="MyReportedResultDTOMap" type="com.epmet.dto.result.MyReportedResultDTO">
<id property="resiEventId" column="id"/>
<result property="eventContent" column="EVENT_CONTENT"/>
<result property="redDot" column="RED_DOT" />
<result property="status" column="STATUS" />
<result property="shiftProject" column="SHIFT_PROJECT" />
<result property="showTime" column="LATEST_OPERATED_TIME" />
<collection property="imgList" ofType="java.lang.String">
<constructor>
<arg column="img_url"/>
</constructor>
</collection>
</resultMap>
<select id="queryMyReported" parameterType="map" resultMap="MyReportedResultDTOMap">
select
re.id,
re.EVENT_CONTENT,
(
case when #{statusCondition} ='un_read' then '0'
else re.RED_DOT
end
)as RED_DOT,
re.`STATUS`,
re.SHIFT_PROJECT,
re.LATEST_OPERATED_TIME,
rea.ATTACHMENT_URL as img_url
from resi_event re
left join resi_event_attachment rea
on(re.id=rea.RESI_EVENT_ID
and rea.DEL_FLAG='0')
where re.DEL_FLAG='0'
and re.RECALL_FLAG='0'
and re.REPORT_USER_ID=#{userId}
<if test='statusCondition == "un_read" '>
and re.READ_FLAG='0'
</if>
<if test='statusCondition != "un_read" '>
and re.`STATUS`=#{statusCondition}
</if>
order by re.LATEST_OPERATED_TIME desc
</select>
</mapper> </mapper>
Loading…
Cancel
Save