Browse Source

Merge remote-tracking branch 'origin/dev_resi_event' into develop

master
yinzuomei 4 years ago
parent
commit
f88cfb1908
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 35
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MentionUserFormDTO.java
  3. 34
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ReportOrgFormDTO.java
  4. 51
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ResiEventFormDTO.java
  5. 44
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/UserMentionFormDTO.java
  6. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventListResultDTO.java
  7. 55
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UserMentionResultDTO.java
  8. 29
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/EventConstant.java
  9. 61
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ResiEventAction.java
  10. 31
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java
  11. 26
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventDao.java
  12. 16
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventMentionDao.java
  13. 7
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ResiEventEntity.java
  14. 15
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventService.java
  15. 309
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java
  16. 3
      epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.16__create_resievent_tables.sql
  17. 82
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml
  18. 49
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventMentionDao.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,"图片审核失败,请重新上传"),
PROJECT_IS_CLOSED(8601,"项目已结案"),
VOTE_ISSUE_PLEASE(8602,"请先选择支持或反对,再发表您的想法"),
RESI_EVENT_READ(8603,"当前事件正在处理中,不能撤回"),
RESI_EVENT_NOT_MY_REPORTED(8604,"当前事件不是您发布的,无权操作"),
// 爱心互助 居民端
NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"),
// 活动报名失败,弹窗:志愿者认证

35
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MentionUserFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* 被艾特的人
*
* @author yinzuomei@elink-cn.com
* @date 2021/8/3 15:51
*/
@Data
public class MentionUserFormDTO implements Serializable {
/**
* 人大代表用户id
*/
private String npcUserId;
/**
* 人大代表注册网格id
*/
private String gridId;
/**
* 人大代表注册网格所属社区id
*/
private String agencyId;
/**
* 注册网格的所有上级
*/
private String pids;
}

34
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ReportOrgFormDTO.java

@ -0,0 +1,34 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* 报给谁
*
* @author yinzuomei@elink-cn.com
* @date 2021/8/3 15:51
*/
@Data
public class ReportOrgFormDTO implements Serializable {
/**
* 报给 网格grid 社区community 街道:street 区县级: district 市级: city 省级:province
*/
private String orgType;
/**
* 报给的组织或者网格id
*/
private String orgId;
/**
* org_id的上级组织idorg_id是跟组织此列为0
*/
private String orgPid;
/**
* org_id的所有上级组织idorg_id是跟组织此列为0
*/
private String orgPids;
}

51
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ResiEventFormDTO.java

@ -1,9 +1,14 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.FileCommonDTO;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
/**
* 我要报事-提交
@ -17,6 +22,52 @@ public class ResiEventFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
/**
* 用户所在网格id
*/
@NotBlank(message = "不能为空",groups = AddUserInternalGroup.class)
private String gridId;
/**
* 事件内容最多1000
*/
@Length(min = 1, max = 1000, message = "请填写内容,最多输入1000字", groups = AddUserShowGroup.class)
private String eventContent;
/**
* 纬度
*/
private String latitude;
/**
* 经度
*/
private String longitude;
/**
* 地址
*/
@NotBlank(message = "地址不能为空",groups = AddUserShowGroup.class)
private String address;
/**
* 附件列表
*/
private List<FileCommonDTO> attachmentList;
/**
* @的人
*/
private List<MentionUserFormDTO> npcUserList;
/**
* 报给谁
*/
@NotEmpty(message = "不能为空",groups = AddUserInternalGroup.class)
private List<ReportOrgFormDTO> orgList;
//以下参数从token中获取

44
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/UserMentionFormDTO.java

@ -0,0 +1,44 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 我要报事-人大代表未读/已读列表入参
*
* @author yinzuomei@elink-cn.com
* @date 2021/8/4 9:34
*/
@Data
public class UserMentionFormDTO implements Serializable {
private static final long serialVersionUID = 7548058964554418080L;
public interface AddUserInternalGroup {
}
/**
* 未读un_read;已读read
*/
@NotBlank(message = "readFlag不能为空", groups = AddUserInternalGroup.class)
private String readFlag;
@NotNull(message = "pageNo不能为空", groups = AddUserInternalGroup.class)
private Integer pageNo;
@NotNull(message = "pageSize不能为空", groups = AddUserInternalGroup.class)
private Integer pageSize;
//以下参数从token中获取
/**
* 当前用户id
*/
@NotBlank(message = "userId不能为空", groups = AddUserInternalGroup.class)
private String userId;
/**
* 当前客户id
*/
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
}

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventListResultDTO.java

@ -18,7 +18,7 @@ public class EventListResultDTO implements Serializable {
/**
* 报事标题
*/
private String eventTitle;
private String eventContent;
/**
* 报事时间

55
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UserMentionResultDTO.java

@ -0,0 +1,55 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 我要报事-人大代表未读/已读列表返参
*
* @author yinzuomei@elink-cn.com
* @date 2021/8/4 9:44
*/
@Data
public class UserMentionResultDTO implements Serializable {
private static final long serialVersionUID = 8171079006237395425L;
/**
* 事件id
*/
private String resiEventId;
/**
* 事件内容
*/
private String eventContent;
/**
* 图片列表可为空
*/
private List<String> imgList;
/**
* true展示false不展示
*/
private Boolean redDot;
/**
* 处理中processing已办结closed_case
*/
private String status;
/**
* true:已转项目false未立项
*/
private Boolean shiftProject;
/**
* 列表显示时间用此列yyyy-MM-dd HH:mm:ss处理中上报事件时间处理中最新一次处理事件已办结办结时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date showTime;
}

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

@ -14,4 +14,33 @@ public interface EventConstant {
String EVENT_UN_DISPOSED = "undisposed";
String EVENT_TRANSFERRED = "transferred";
/**
* 事件状态resi_event.status:处理中processing已办结closed_case
*/
String EVENT_STATUS_PROCESSING="processing";
String EVENT_STATUS_CLOSED_CASE="closed_case";
String READ="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";
}

61
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ResiEventAction.java

@ -0,0 +1,61 @@
package com.epmet.constant;
import com.epmet.commons.tools.constant.StrConstant;
/**
* resi_event_operation_log事件操作日志枚举类
*
* @author yinzuomei@elink-cn.com
* @date 2021/8/3 16:38
*/
public enum ResiEventAction {
// 1、发布事件:publish;
// 2、撤回事件:recall;
// 3、复:reply;
// 4、立项:shift_project;
// 5、办结:close_case;
// 6、选择是否已解决:choose_resolve;
// 7、查看阅读事件:read:人大代表未读=>已读;工作人员待处理=>处理中;
PUBLISH ( "publish",""),
RECALL( "recall",""),
REPLY ("reply",""),
SHIFIT_PROJECT ( "shift_project",""),
CLOSE_CASE ( "close_case",""),
CHOOSE_RESOLVE ( "choose_resolve",""),
READ( "read","");
private String code;
private String desc;
ResiEventAction(String code, String desc) {
this.code = code;
this.desc = desc;
}
public static String getDesc(String code) {
ResiEventAction[] businessModeEnums = values();
for (ResiEventAction resiEventAction : businessModeEnums) {
if (resiEventAction.getCode()==code) {
return resiEventAction.getDesc();
}
}
return StrConstant.EPMETY_STR;
}
public String getCode(){
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getDesc(){
return this.desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

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

@ -17,17 +17,12 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.*;
import com.epmet.dto.result.EventDetailResultDTO;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.result.EventListResultDTO;
import com.epmet.dto.result.MyReportedResultDTO;
import com.epmet.dto.result.ResiEventIdDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.service.ResiEventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -70,11 +65,11 @@ public class ResiEventController {
* @author yinzuomei
* @date 2021/8/3 10:46
*/
@PostMapping("report")
public Result<ResiEventIdDTO> report(@LoginUser TokenDto tokenDto, @RequestBody ResiEventFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
//校验参数
//todo
ValidatorUtils.validateEntity(formDTO,ResiEventFormDTO.AddUserShowGroup.class,ResiEventFormDTO.AddUserInternalGroup.class);
return new Result<ResiEventIdDTO>().ok(resiEventService.report(formDTO));
}
@ -155,4 +150,22 @@ public class ResiEventController {
resiEventService.updateViewTime(formDTO);
return new Result();
}
/**
* 我要报事-人大代表未读/已读列表
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.MyReportedResultDTO>>
* @author yinzuomei
* @date 2021/8/4 9:40
*/
@PostMapping("mentionlist")
public Result<List<UserMentionResultDTO>> mentionList(@LoginUser TokenDto tokenDto, @RequestBody UserMentionFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,UserMentionFormDTO.AddUserInternalGroup.class);
return new Result<List<UserMentionResultDTO>>().ok(resiEventService.mentionList(formDTO));
}
}

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

@ -18,8 +18,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.EventListResultDTO;
import com.epmet.dto.result.MyReportedResultDTO;
import com.epmet.entity.ResiEventEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 居民报事表
@ -29,5 +34,24 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ResiEventDao extends BaseDao<ResiEventEntity> {
/**
* @Description 查询报事列表
* @Param orgId
* @Param eventType
* @author zxc
* @date 2021/8/3 4:21 下午
*/
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);
}

16
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventMentionDao.java

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.UserMentionResultDTO;
import com.epmet.entity.ResiEventMentionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 事件被@人表
@ -29,5 +33,15 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ResiEventMentionDao extends BaseDao<ResiEventMentionEntity> {
/**
* 人大代表未读已读列表
*
* @param userId
* @param readFlag
* @return java.util.List<com.epmet.dto.result.UserMentionResultDTO>
* @author yinzuomei
* @date 2021/8/4 9:54
*/
List<UserMentionResultDTO> selectMentionList(@Param("userId")String userId, @Param("readFlag")String readFlag);
}

7
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ResiEventEntity.java

@ -66,7 +66,7 @@ public class ResiEventEntity extends BaseEpmetEntity {
/**
* 1党员0不是党员默认0
*/
private String isParty;
private Boolean isParty;
/**
* 事件内容
@ -93,6 +93,11 @@ public class ResiEventEntity extends BaseEpmetEntity {
*/
private String status;
/**
* 办结时间
*/
private Date closeCaseTime;
/**
* 1已转项目0未转项目默认0
*/

15
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventService.java

@ -2,11 +2,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.form.*;
import com.epmet.dto.result.EventDetailResultDTO;
import com.epmet.dto.result.EventListResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.ResiEventEntity;
import com.epmet.dto.result.MyReportedResultDTO;
import com.epmet.dto.result.ResiEventIdDTO;
import java.util.List;
@ -81,4 +78,14 @@ public interface ResiEventService extends BaseService<ResiEventEntity> {
* @date 2021/8/3 14:28
*/
List<MyReportedResultDTO> queryMyReported(MyReportedFormDTO formDTO);
/**
* 我要报事-人大代表未读/已读列表
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.UserMentionResultDTO>
* @author yinzuomei
* @date 2021/8/4 9:41
*/
List<UserMentionResultDTO> mentionList(UserMentionFormDTO formDTO);
}

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

@ -17,26 +17,43 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
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.dto.form.FileCommonDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
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.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.constant.EventConstant;
import com.epmet.dao.ResiEventDao;
import com.epmet.dto.form.EventDetailFormDTO;
import com.epmet.dto.form.EventListFormDTO;
import com.epmet.dto.form.UpdateViewTimeFormDTO;
import com.epmet.dto.result.EventDetailResultDTO;
import com.epmet.dto.result.EventListResultDTO;
import com.epmet.dto.form.ChooseResolveFormDTO;
import com.epmet.dto.form.MyReportedFormDTO;
import com.epmet.dto.form.ReCallEventFormDTO;
import com.epmet.dto.form.ResiEventFormDTO;
import com.epmet.dto.result.MyReportedResultDTO;
import com.epmet.dto.result.ResiEventIdDTO;
import com.epmet.entity.ResiEventEntity;
import com.epmet.constant.ResiEventAction;
import com.epmet.dao.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.ResiEventService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
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.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* 居民报事表
@ -44,8 +61,27 @@ import java.util.List;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-03
*/
@Slf4j
@Service
public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEventEntity> implements ResiEventService {
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private ResiEventAttachmentDao resiEventAttachmentDao;
@Autowired
private ResiEventReportOrgDao resiEventReportOrgDao;
@Autowired
private ResiEventMentionDao resiEventMentionDao;
@Autowired
private ResiEventOperationLogDao resiEventOperationLogDao;
/**
* @Description 群众直报待处理处理中已办结列表
@ -58,15 +94,9 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
*/
@Override
public List<EventListResultDTO> eventList(EventListFormDTO formDTO) {
// 处理中
if (formDTO.getEventType().equals(EventConstant.EVENT_PROCESSED)){
// 待处理
}else if (formDTO.getEventType().equals(EventConstant.EVENT_UN_DISPOSED)){
// 已办结
}else if (formDTO.getEventType().equals(EventConstant.EVENT_TRANSFERRED)){
List<EventListResultDTO> result = baseDao.eventUnDisposedList(formDTO.getOrgId(), formDTO.getEventType());
if (!CollectionUtils.isEmpty(result)){
return result;
}
return new ArrayList<>();
}
@ -102,18 +132,163 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
*/
@Override
public ResiEventIdDTO report(ResiEventFormDTO formDTO) {
//todo
//1、事件内容审核
//2、图片审核
this.scanContent(formDTO.getEventContent(), formDTO.getAttachmentList());
//3、查询当前所在网格的信息
Result<GridInfoResultDTO> gridInfoRes=govOrgOpenFeignClient.queryGridInfo(formDTO.getGridId());
if(!gridInfoRes.success()||null==gridInfoRes.getData()){
throw new RenException("网格信息查询异常");
}
ResiEventEntity resiEventEntity= ConvertUtils.sourceToTarget(formDTO,ResiEventEntity.class);
resiEventEntity.setAgencyId(gridInfoRes.getData().getParentAgencyId());
resiEventEntity.setPids(gridInfoRes.getData().getPids());
resiEventEntity.setReportUserId(formDTO.getUserId());
Result<Boolean> partyRes=epmetUserOpenFeignClient.selectIsPartyMemberByUserId(formDTO.getUserId());
if(!partyRes.success()||null==partyRes.getData()){
throw new RenException("查询用户是否是党员异常");
}
resiEventEntity.setIsParty(partyRes.getData());
resiEventEntity.setStatus(EventConstant.EVENT_STATUS_PROCESSING);
resiEventEntity.setShiftProject(false);
resiEventEntity.setProjectId(StrConstant.EPMETY_STR);
resiEventEntity.setRecallFlag(false);
resiEventEntity.setReadFlag(false);
resiEventEntity.setRedDot(false);
resiEventEntity.setLatestOperatedTime(new Date());
resiEventEntity.setCreatedTime(resiEventEntity.getLatestOperatedTime());
resiEventEntity.setUpdatedTime(resiEventEntity.getLatestOperatedTime());
//4、插入主表resi_event
baseDao.insert(resiEventEntity);
//5、插入附件表
List<ResiEventAttachmentEntity> attachmentEntityList=getAttList(formDTO.getCustomerId(),resiEventEntity.getId(),formDTO.getAttachmentList());
attachmentEntityList.forEach(attachmentEntity->{
resiEventAttachmentDao.insert(attachmentEntity);
});
//6、插入组织表
List<ResiEventReportOrgEntity> orgEntityList=getOrgList(formDTO.getCustomerId(),resiEventEntity.getId(),formDTO.getOrgList());
orgEntityList.forEach(orgEntity->{
resiEventReportOrgDao.insert(orgEntity);
});
//7、插入艾特人表
List<ResiEventMentionEntity> npcList=getNpcList(formDTO.getCustomerId(),resiEventEntity.getId(),formDTO.getNpcUserList());
npcList.forEach(npc->{
resiEventMentionDao.insert(npc);
});
//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;
}
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) {
List<ResiEventAttachmentEntity> list=new ArrayList<>();
int sort= NumConstant.ONE;
for(FileCommonDTO img:attachmentList){
ResiEventAttachmentEntity entity=new ResiEventAttachmentEntity();
entity.setCustomerId(customerId);
entity.setResiEventId(resiEventId);
entity.setAttachmentName(img.getName());
entity.setAttachmentFormat(img.getFormat());
entity.setAttachmentType(img.getType());
entity.setAttachmentUrl(img.getUrl());
entity.setSort(sort);
sort++;
list.add(entity);
}
return list;
}
return null;
private void scanContent(String eventContent, List<FileCommonDTO> attachmentList) {
//事件内容
if (StringUtils.isNotBlank(eventContent)) {
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(eventContent);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg());
}
}
}
List<String> imgList=new ArrayList<>();
for(FileCommonDTO fileCommonDTO:attachmentList){
if("image".equals(fileCommonDTO.getType())){
imgList.add(fileCommonDTO.getUrl());
}
}
//事件图片
if (!CollectionUtils.isEmpty(imgList)) {
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
imgList.forEach(imgUrl -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(imgUrl);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg());
}
}
}
}
/**
* 撤回事件
*
* 需求描述:未处理状态中可撤回上报事件撤回后不在展示列表内@的人大代表或组织已读后按钮消失
* @param formDTO
* @return void
* @author yinzuomei
@ -121,9 +296,34 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
*/
@Override
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);
}
@ -137,13 +337,30 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
*/
@Override
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);
}
/**
@ -156,11 +373,27 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
*/
@Override
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();
}
/**
* 我要报事-人大代表未读/已读列表
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.UserMentionResultDTO>
* @author yinzuomei
* @date 2021/8/4 9:41
*/
@Override
public List<UserMentionResultDTO> mentionList(UserMentionFormDTO formDTO) {
PageInfo<UserMentionResultDTO> result = PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> resiEventMentionDao.selectMentionList(formDTO.getUserId(),
formDTO.getReadFlag()));
return result.getList();
}
return null;
}
}

3
epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.16__create_resievent_tables.sql

@ -5,12 +5,13 @@ CREATE TABLE `resi_event` (
`AGENCY_ID` varchar(64) NOT NULL COMMENT '居民端用户所在网格的所属组织',
`PIDS` varchar(64) NOT NULL COMMENT '居民端用户所在网格的所有上级组织,包含AGENCY_ID',
`REPORT_USER_ID` varchar(64) NOT NULL COMMENT '报事的人',
`IS_PARTY` varchar(1) NOT NULL DEFAULT '0' COMMENT '1:党员;0:不是党员;默认0',
`IS_PARTY` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1:党员;0:不是党员;默认0',
`EVENT_CONTENT` varchar(1024) NOT NULL COMMENT '事件内容',
`LATITUDE` varchar(32) DEFAULT NULL COMMENT '纬度',
`LONGITUDE` varchar(32) DEFAULT NULL COMMENT '经度',
`ADDRESS` varchar(255) NOT NULL COMMENT '地址',
`STATUS` varchar(32) NOT NULL COMMENT '处理中:processing;已办结:closed_case',
`close_case_time` datetime DEFAULT NULL COMMENT '办结时间',
`SHIFT_PROJECT` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1:已转项目;0:未转项目;默认0',
`PROJECT_ID` varchar(64) DEFAULT NULL COMMENT '项目id;shift_project=1时,此列有值',
`RECALL_FLAG` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1:已撤回;0:未撤回正常展示;默认0',

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

@ -3,6 +3,88 @@
<mapper namespace="com.epmet.dao.ResiEventDao">
<!-- 查询报事列表 -->
<resultMap id="eventUnDisposedListMap" type="com.epmet.dto.result.EventListResultDTO">
<result property="eventContent" column="eventContent"/>
<result property="eventId" column="eventId"/>
<result property="eventTime" column="eventTime"/>
<result property="isProject" column="isProject"/>
<result property="redDot" column="redDot"/>
<collection property="eventImgs" ofType="java.lang.String">
<result column="img"/>
</collection>
</resultMap>
<select id="eventUnDisposedList" resultMap="eventUnDisposedListMap">
SELECT IFNULL(rea.ATTACHMENT_URL,'') AS img,t.* FROM
(SELECT
re.EVENT_CONTENT AS eventContent,
IFNULL(DATE_FORMAT(re.CREATED_TIME,'%Y-%m-%d %H:%i:%s'),'') AS eventTime,
re.ID AS eventId,
(CASE WHEN re.SHIFT_PROJECT = 1 THEN TRUE ELSE FALSE END) AS isProject,
(CASE WHEN ro.RED_DOT = 1 THEN TRUE ELSE FALSE END) AS redDot
FROM resi_event_report_org ro
INNER JOIN resi_event re ON (ro.RESI_EVENT_ID = re.ID AND re.DEL_FLAG = '0')
AND ro.DEL_FLAG = '0'
<if test='eventType == "undisposed" '>
AND ro.ORG_READ = 'un_read'
ORDER BY re.CREATED_TIME
</if>
<if test='eventType == "processed" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'processing'
ORDER BY re.LATEST_OPERATED_TIME
</if>
<if test='eventType == "transferred" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'closed_case'
ORDER BY re.CLOSE_CASE_TIME
</if>
)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))
</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'
and rea.ATTACHMENT_TYPE='image')
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>

49
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventMentionDao.xml

@ -3,6 +3,55 @@
<mapper namespace="com.epmet.dao.ResiEventMentionDao">
<resultMap id="UserMentionResultDTOMap" type="com.epmet.dto.result.UserMentionResultDTO">
<id property="resiEventId" column="RESI_EVENT_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="selectMentionList" parameterType="map" resultMap="UserMentionResultDTOMap">
SELECT
rem.RESI_EVENT_ID,
re.EVENT_CONTENT,
(
case when #{readFlag} ='un_read' then '0'
else rem.RED_DOT
end
)as RED_DOT,
re.`STATUS`,
re.SHIFT_PROJECT,
re.LATEST_OPERATED_TIME,
rea.ATTACHMENT_URL as img_url
FROM
resi_event_mention rem
LEFT JOIN resi_event re
ON ( rem.RESI_EVENT_ID = re.id )
LEFT JOIN resi_event_attachment rea
ON ( re.id = rea.RESI_EVENT_ID
AND rea.DEL_FLAG = '0'
AND rea.ATTACHMENT_TYPE = 'image')
WHERE
rem.DEL_FLAG = '0'
AND re.DEL_FLAG = '0'
AND re.RECALL_FLAG = '0'
AND rem.USER_ID = #{userId}
AND rem.READ_FLAG =#{readFlag}
<if test='readFlag == "un_read" '>
ORDER BY
re.CREATED_TIME ASC
</if>
<if test='readFlag == "read" '>
ORDER BY
re.LATEST_OPERATED_TIME DESC
</if>
</select>
</mapper>
Loading…
Cancel
Save