diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 3a213b5191..015095cc83 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/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, "您还未进入指定的签到范围~"), // 活动报名失败,弹窗:志愿者认证 diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MentionUserFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MentionUserFormDTO.java new file mode 100644 index 0000000000..b142456c3d --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ReportOrgFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ReportOrgFormDTO.java new file mode 100644 index 0000000000..453ce8d382 --- /dev/null +++ b/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的上级组织id,org_id是跟组织,此列为0 + */ + private String orgPid; + + /** + * org_id的所有上级组织id,org_id是跟组织,此列为0 + */ + private String orgPids; +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ResiEventFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ResiEventFormDTO.java index 83d96502ae..b0d1f4ff99 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ResiEventFormDTO.java +++ b/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 attachmentList; + /** + * @的人 + */ + private List npcUserList; + + /** + * 报给谁? + */ + @NotEmpty(message = "不能为空",groups = AddUserInternalGroup.class) + private List orgList; + //以下参数从token中获取 diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/UserMentionFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/UserMentionFormDTO.java new file mode 100644 index 0000000000..861abebb95 --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventListResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventListResultDTO.java index 94853b80d1..23ecd11982 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventListResultDTO.java +++ b/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; /** * 报事时间 diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UserMentionResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UserMentionResultDTO.java new file mode 100644 index 0000000000..95ac2e2527 --- /dev/null +++ b/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 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; +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/EventConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/EventConstant.java index 8a63bba97b..2608de1e9f 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/EventConstant.java +++ b/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"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ResiEventAction.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ResiEventAction.java new file mode 100644 index 0000000000..f525143772 --- /dev/null +++ b/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; + } +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java index 4622d74927..98bfe74b10 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java +++ b/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 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().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> + * @author yinzuomei + * @date 2021/8/4 9:40 + */ + @PostMapping("mentionlist") + public Result> mentionList(@LoginUser TokenDto tokenDto, @RequestBody UserMentionFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,UserMentionFormDTO.AddUserInternalGroup.class); + return new Result>().ok(resiEventService.mentionList(formDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventDao.java index c1312cb0d9..95f95f4959 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventDao.java +++ b/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 { - + + /** + * @Description 查询报事列表 + * @Param orgId + * @Param eventType + * @author zxc + * @date 2021/8/3 4:21 下午 + */ + List eventUnDisposedList(@Param("orgId")String orgId,@Param("eventType")String eventType); + + /** + * 居民端我的报事列表查询 + * + * @param userId 报事人 + * @param statusCondition 未处理:un_read;处理中:processing;已办结:closed_case + * @return java.util.List + * @author yinzuomei + * @date 2021/8/3 23:21 + */ + List queryMyReported(@Param("userId") String userId, @Param("statusCondition")String statusCondition); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventMentionDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventMentionDao.java index 270500ae05..981cee667a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ResiEventMentionDao.java +++ b/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 { - + + /** + * 人大代表未读、已读列表 + * + * @param userId + * @param readFlag + * @return java.util.List + * @author yinzuomei + * @date 2021/8/4 9:54 + */ + List selectMentionList(@Param("userId")String userId, @Param("readFlag")String readFlag); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ResiEventEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ResiEventEntity.java index 34ae10cd86..f00dab5a06 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ResiEventEntity.java +++ b/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 */ diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventService.java index 82dabf69fc..604375b0fb 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventService.java +++ b/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 { * @date 2021/8/3 14:28 */ List queryMyReported(MyReportedFormDTO formDTO); + + /** + * 我要报事-人大代表未读/已读列表 + * + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @date 2021/8/4 9:41 + */ + List mentionList(UserMentionFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java index 321decec81..c002ad983a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java +++ b/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 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 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 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 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 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 attachmentEntityList=getAttList(formDTO.getCustomerId(),resiEventEntity.getId(),formDTO.getAttachmentList()); + attachmentEntityList.forEach(attachmentEntity->{ + resiEventAttachmentDao.insert(attachmentEntity); + }); + //6、插入组织表 + List orgEntityList=getOrgList(formDTO.getCustomerId(),resiEventEntity.getId(),formDTO.getOrgList()); + orgEntityList.forEach(orgEntity->{ + resiEventReportOrgDao.insert(orgEntity); + }); + //7、插入艾特人表 + List 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 getNpcList(String customerId, String resiEventId, List npcUserList) { + List 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 getOrgList(String customerId, String resiEventId, List orgList) { + List 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 getAttList(String customerId,String resiEventId, List attachmentList) { + List 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 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 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 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 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 queryMyReported(MyReportedFormDTO formDTO) { - // todo - + PageInfo result = PageHelper.startPage(formDTO.getPageNo(), + formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.queryMyReported(formDTO.getUserId(), + formDTO.getStatusCondition())); + return result.getList(); + } + /** + * 我要报事-人大代表未读/已读列表 + * + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @date 2021/8/4 9:41 + */ + @Override + public List mentionList(UserMentionFormDTO formDTO) { + PageInfo result = PageHelper.startPage(formDTO.getPageNo(), + formDTO.getPageSize()).doSelectPageInfo(() -> resiEventMentionDao.selectMentionList(formDTO.getUserId(), + formDTO.getReadFlag())); + return result.getList(); + } - return null; - } } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.16__create_resievent_tables.sql b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.16__create_resievent_tables.sql index f753c01e22..90cc434e75 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.16__create_resievent_tables.sql +++ b/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', diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml index 21c7a902d7..b1576f605e 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml @@ -3,6 +3,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventMentionDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventMentionDao.xml index 98064a416f..7a4f145c75 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventMentionDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventMentionDao.xml @@ -3,6 +3,55 @@ + + + + + + + + + + + + + + \ No newline at end of file