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 240bb7a199..5a8e9a43e6 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 @@ -169,8 +169,14 @@ public enum EpmetErrorCode { PLEASE_INPUT_ACT_CONTENT(8903,"请输入活动内容,或添加图片"), GROUP_ACT_CONTENT_MAX(8904,"活动内容至多输入1000字"), GROUP_ACT_IMG_MAX(8905,"最多可添加3张图片"), - PARTY_MEMBER_CREATE_BRANCH_GROUP(8906,"您不是党员,不能创建支部小组"); - + PARTY_MEMBER_CREATE_BRANCH_GROUP(8906,"您不是党员,不能创建支部小组"), + NOT_IN_GROUP_CAN_NOT_VIEW(8907,"当前内容仅允许组内成员查看"), + PARTY_MEMBER_JOIN_BRANCH_GROUP(8908,"您不是党员,不能加入支部小组"), + GROUP_ACT_CAN_NOT_CANCEL(8909,"活动%s,不能取消"), + //8910的msg动态赋值 + GROUP_ACT_CAN_NOT_COMMENT(8910,"当前活动,不能评论"), + SIGN_IN_TIME_NOT_START(8911,"未到签到时间,不允许签到"), + SIGN_IN_TIME_PASSED(8912,"当前时间已超过签到时间"); private int code; private String msg; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java index 78bbec055c..c9350d4716 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java @@ -17,9 +17,10 @@ package com.epmet.resi.group.dto.act; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -43,6 +44,16 @@ public class ActReadRecordDTO implements Serializable { */ private String customerId; + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 小组id + */ + private String groupId; + /** * group_act_info.id */ @@ -51,7 +62,7 @@ public class ActReadRecordDTO implements Serializable { /** * 已读: read未读:un_read;查看活动详情后修改此表,或者插入一条新的已读记录 */ - private String read; + private String readFlag; /** * 用户id diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/GroupActIdDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/GroupActIdDTO.java index c898920da1..a558bdc265 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/GroupActIdDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/GroupActIdDTO.java @@ -5,7 +5,7 @@ import lombok.Data; import java.io.Serializable; /** - * 描述一下 + * 组织活动id * * @author yinzuomei@elink-cn.com * @date 2021/4/19 15:11 diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActReadViewFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActReadViewFormDTO.java new file mode 100644 index 0000000000..dacf0fbb27 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActReadViewFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 016、活动已读未读列表 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/19 19:36 + */ +@Data +public class ActReadViewFormDTO implements Serializable { + private static final long serialVersionUID = -7382937811770356934L; + + public interface AddUserInternalGroup { + } + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + + /** + * 当前用户id + */ + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; +} + diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CancelActFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CancelActFormDTO.java new file mode 100644 index 0000000000..39283ef63a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CancelActFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.resi.group.dto.act.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 011、取消活动 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 12:04 + */ +@Data +public class CancelActFormDTO implements Serializable { + private static final long serialVersionUID = 6126854423030661426L; + + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + + @NotBlank(message = "取消原因不能为空", groups = AddUserShowGroup.class) + @Length(max = 300, message = "取消原因最多输入300字", groups = AddUserShowGroup.class) + private String reason; + + /** + * 当前用户id + */ + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java new file mode 100644 index 0000000000..92fce732ae --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.resi.group.dto.act.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 005、评论活动 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 12:35 + */ +@Data +public class CommentFormDTO implements Serializable { + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + + @NotBlank(message = "评论内容不能为空", groups = AddUserShowGroup.class) + @Length(max = 500, message = "评论内容最多输入500字", groups = AddUserShowGroup.class) + private String commentContent; + + /** + * 当前用户id + */ + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; + + @NotBlank(message = "tokenDto获取customerId为空", groups = AddUserInternalGroup.class) + private String customerId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentQueryFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentQueryFormDTO.java new file mode 100644 index 0000000000..109d6f387a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentQueryFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 006、活动评论列表查询 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 12:55 + */ +@Data +public class CommentQueryFormDTO implements Serializable { + private static final long serialVersionUID = 4013876445914100561L; + + public interface AddUserInternalGroup { + } + + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + private Integer pageNo; + private Integer pageSize; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SetSignTimeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SetSignTimeFormDTO.java new file mode 100644 index 0000000000..d4a04f82f1 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SetSignTimeFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 010、设置(修改)签到时间,生成签到码 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 13:34 + */ +@Data +public class SetSignTimeFormDTO implements Serializable { + private static final long serialVersionUID = 4134192208518833623L; + public interface AddUserInternalGroup { + } + /** + * 小组活动id + */ + @NotBlank(message = "groupActId不能为空",groups = AddUserInternalGroup.class) + private String groupActId; + + /** + * 签到开始时间:yyyy-MM-dd HH:mm + */ + @NotBlank(message = "开始时间不能为空",groups = AddUserInternalGroup.class) + private String signInStartTime; + + /** + * 签到截止时间:yyyy-MM-dd HH:mm + */ + @NotBlank(message = "截止时间不能为空",groups = AddUserInternalGroup.class) + private String signInEndTime; + + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInFormDTO.java new file mode 100644 index 0000000000..af00808a0f --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 007、签到 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 15:14 + */ +@Data +public class SignInFormDTO implements Serializable { + private static final long serialVersionUID = 3632452994910057034L; + + public interface AddUserInternalGroup { + } + + @NotBlank(message = "活动id不能为空",groups = AddUserInternalGroup.class) + private String groupActId; + + /** + * 签到地址 + */ + @NotBlank(message = "签到地址不能为空",groups = AddUserInternalGroup.class) + private String signInAddress; + /** + * 签到地点-经度 + */ + private BigDecimal longitude; + + /** + * 签到地点-纬度 + */ + private BigDecimal latitude; + + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; + + @NotBlank(message = "tokenDto获取customerId为空", groups = AddUserInternalGroup.class) + private String customerId; + +} + diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInRecFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInRecFormDTO.java new file mode 100644 index 0000000000..95af7d5f77 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInRecFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 009、签到记录列表 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 15:42 + */ +@Data +public class SignInRecFormDTO implements Serializable { + private static final long serialVersionUID = -144395799437468448L; + + public interface AddUserInternalGroup { + } + + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + private Integer pageNo; + private Integer pageSize; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActDetailResultDTO.java index 7b019f904d..37507b4009 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActDetailResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActDetailResultDTO.java @@ -1,10 +1,149 @@ package com.epmet.resi.group.dto.act.result; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + /** - * 描述一下 + * 004、活动详情 返参 * * @author yinzuomei@elink-cn.com * @date 2021/4/19 19:24 */ -public class ActDetailResultDTO { +@Data +public class ActDetailResultDTO implements Serializable { + private static final long serialVersionUID = 8912162789028312892L; + + + private String groupActId; + + /** + * 小组id + */ + private String groupId; + + /** + * 活动标题; + */ + private String title; + + /** + * 活动时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date startTime; + + /** + * 活动所属类别编码 + */ + private String categoryCode; + + /** + * 上级类别编码 + */ + private String parentCode; + + /** + * 活动类别名称;eg:支部建设-三会一课 + */ + private String allCategoryName; + + /** + * 活动地点 + */ + private String address; + + /** + * 活动地点-经度 + */ + private BigDecimal longitude; + + /** + * 活动地点-纬度 + */ + private BigDecimal latitude; + + /** + * 应参加人数组长填入;此列也是应签到人数; + */ + private Integer shouldAttend; + + /** + * 活动状态:已发布:published;已取消:canceled;已变更:changed;已关闭:closed + */ + private String status; + + /** + * 签到开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date signInStartTime; + + /** + * 签到截止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date signInEndTime; + /** + * 是否填写总结?1:已填写;0:未填写 + */ + private Integer summaryFlag; + + /** + * 取消时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date canceledTime; + + /** + * 关闭时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date closedTime; + + /** + * 活动发布人用户id + */ + private String publishUserId; + + /** + * 内容列表 + */ + private List textList; + + /** + * 图片列表 + */ + private List imgList; + + //以下字段需要单独赋值 + /** + * 取消原因 + */ + private String canceledReason; + + /** + * blank: 不显示; display:显示 + */ + private String signInButton; + + /** + * 未签到时的描述,可能是签到时间未开始,可能是签到时间已经过 + */ + private String signInDesc; + + /** + * member成员,leader群主 + */ + private String userRole; + + /** + * 有签到后不可以修改活动时间:true可以修改,false不可以, + */ + private Boolean startTimeEditFlag; + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java new file mode 100644 index 0000000000..efb8066f28 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.resi.group.dto.act.result; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 006、活动评论列表查询 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 12:58 + */ +@Data +public class CommentResultDTO implements Serializable { + private static final long serialVersionUID = 6487668038520643604L; + private String commentId; + + private String commentContent; + + private String commentUserHeadPhoto; + + private String commentUserName; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date commentTime; + + private String commentUserId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SetSignTimeResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SetSignTimeResultDTO.java new file mode 100644 index 0000000000..08e190e3da --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SetSignTimeResultDTO.java @@ -0,0 +1,22 @@ +package com.epmet.resi.group.dto.act.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 010、设置(修改)签到时间,生成签到码 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 13:46 + */ +@Data +public class SetSignTimeResultDTO implements Serializable { + private static final long serialVersionUID = -7444245554430563944L; + + private String groupActId; + private Date signInStartTime; + private Date signInEndTime; + private String signInCodeUrl; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SignInRecResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SignInRecResultDTO.java new file mode 100644 index 0000000000..0bdb2b17d0 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SignInRecResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.resi.group.dto.act.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 009、签到记录列表 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 15:43 + */ +@Data +public class SignInRecResultDTO implements Serializable { + private static final long serialVersionUID = -2847848186325667663L; + private Integer signedInNum; + private Integer shouldAttend; + private List list; + + @NoArgsConstructor + @Data + public static class SignInDetail { + private String signUserId; + private String signUserName; + private Date signInTime; + private String signInAddress; + } +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java index 2a2f287460..c28985e054 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.resi.group.dto.comment.result; import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -40,6 +41,7 @@ public class ResiCommentResultDTO implements Serializable { /** * 用户Id 评论者Id * */ + @JsonIgnore private String userId; /** diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupSetupDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupSetupDTO.java new file mode 100644 index 0000000000..9cad3f3f9a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupSetupDTO.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.group.dto.group; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@Data +public class ResiGroupSetupDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID,初始默认为default + */ + private String customerId; + + /** + * 默认小组头像 + */ + private String logo; + + /** + * 小组名称 + */ + private String name; + + /** + * 小组简介 + */ + private String describe; + + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + + /** + * 专用:dedicated;常用:common_used + */ + private String category; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java new file mode 100644 index 0000000000..32d4164244 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 所有小组查询-接口入参 + */ +@Data +public class AllGroupListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 网格Id + */ + @NotBlank(message = "网格Id不能为空", groups = {AllGroupListFormDTO.GroupList.class}) + private String gridId; + /** + * 请求页码 + */ + @Min(1) + private int pageNo; + /** + * 每页多少条数据 + */ + private int pageSize = 20; + + public interface GroupList { + } +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java new file mode 100644 index 0000000000..8ec0a07554 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 推荐小组查询返参 + * @Author yinzuomei + * @Date 2020/3/28 17:11 + */ +@Data +public class AllGroupListResultDTO implements Serializable { + + private static final long serialVersionUID = -155229599412911489L; + /** + * 群组id + */ + private String groupId; + + /** + * 群组头像 + */ + private String groupHeadPhoto; + + /** + * 群组名称 + */ + private String groupName; + + /** + * 成员总数 + */ + private Integer totalMember; + + /** + * 党员总数 + */ + private Integer totalPartyMember; + + /** + * under_auditting审核中、rejected已拒绝的前端显示加入 + */ + private String status=""; + + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReafdRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReadRecordDTO.java similarity index 96% rename from epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReafdRecordDTO.java rename to epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReadRecordDTO.java index 8574f2deb2..a93531c096 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReafdRecordDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReadRecordDTO.java @@ -29,7 +29,7 @@ import lombok.Data; * @since v1.0.0 2021-04-19 */ @Data -public class NoticeReafdRecordDTO implements Serializable { +public class NoticeReadRecordDTO implements Serializable { private static final long serialVersionUID = 1L; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java new file mode 100644 index 0000000000..b2f91f22f9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.resi.group.dto.notice.form; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; + +/** + * @Author sun + * @Description 小组通知编辑-接口入参 + */ +@Data +public class NoticeCommentFormDTO { + + /** + * 通知Id + */ + @NotBlank(message = "通知Id不能为空",groups = {NoticeCommentFormDTO.Comment.class}) + private String noticeId; + /** + * 评论内容300 + */ + @NotBlank(message = "评论内容不能为空",groups = {NoticeCommentFormDTO.Comment.class}) + @Length(max = 20, message = "评论内容不能超过300个字符") + private String commentContent; + + public interface Comment{} +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentListFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentListFormDTO.java new file mode 100644 index 0000000000..960ba374e5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentListFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.resi.group.dto.notice.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 通知评论列表查询-接口入参 + */ +@Data +public class NoticeCommentListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 通知Id + */ + @NotBlank(message = "通知Id不能为空",groups = {NoticeCommentListFormDTO.CommentList.class}) + private String noticeId; + /** + * 请求页码 + * */ + @Min(1) + private int pageNo; + /** + * 每页多少条数据 + * */ + private int pageSize = 20; + + public interface CommentList{} +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/ReadTypeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/ReadTypeFormDTO.java new file mode 100644 index 0000000000..f3170ebc9b --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/ReadTypeFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.resi.group.dto.notice.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Author sun + * @Description 通知已读未读列表查询-接口入参 + */ +@Data +public class ReadTypeFormDTO { + + /** + * 通知Id + */ + @NotBlank(message = "通知Id不能为空",groups = {ReadTypeFormDTO.Read.class}) + private String noticeId; + + public interface Read{} +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java new file mode 100644 index 0000000000..c086df0f94 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java @@ -0,0 +1,44 @@ +package com.epmet.resi.group.dto.notice.result; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author sun + * @Description 通知评论列表查询-接口返参 + */ +@Data +public class NoticeCommentListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 评论Id + * */ + private String noticeCommentId; + /** + * 评论内容 + * */ + private String commentContent; + /** + * 评论者头像 + * */ + private String commentUserHeadPhoto; + /** + * 评论者姓名 + * */ + private String commentUserName; + /** + * 评论时间 yyyy-MM-dd HH:mm + * */ + @JSONField(format="yyyy-MM-dd HH:mm") + private Date commentTime; + /** + * 用户Id 评论者Id + * */ + private String userId; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/GetLatestV2FormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/GetLatestV2FormDTO.java new file mode 100644 index 0000000000..19406e5a62 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/GetLatestV2FormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.resi.group.dto.topic.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/20 下午2:23 + * @DESC + */ +@Data +public class GetLatestV2FormDTO implements Serializable { + + private static final long serialVersionUID = -5212709032157867124L; + + public interface GetLatestV2Form{} + + @NotBlank(message = "小组ID不能为空",groups = GetLatestV2Form.class) + private String groupId; + + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/GetLatestV2ResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/GetLatestV2ResultDTO.java new file mode 100644 index 0000000000..ee37afd1bf --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/GetLatestV2ResultDTO.java @@ -0,0 +1,47 @@ +package com.epmet.resi.group.dto.topic.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/4/20 下午2:34 + * @DESC + */ +@Data +public class GetLatestV2ResultDTO implements Serializable { + + private static final long serialVersionUID = 1386600583326358070L; + + /** + * 当前人员组内角色(member成员,leader群主) + */ + private String userRole; + + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + + /** + * 是否显示通知按钮 + */ + private String noticeBut; + + /** + * 是否显示活动按钮 + */ + private String actBut; + + /** + * 是否存在未读消息 + */ + private Boolean unReadNews; + + /** + * 近十条数据 + */ + private List list; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/LatestTenResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/LatestTenResultDTO.java new file mode 100644 index 0000000000..0f8d7c3222 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/LatestTenResultDTO.java @@ -0,0 +1,104 @@ +package com.epmet.resi.group.dto.topic.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/20 下午2:45 + * @DESC + */ +@Data +public class LatestTenResultDTO implements Serializable { + + private static final long serialVersionUID = -8447212650446365613L; + + /** + * 话题、通知、活动Id + */ + private String id; + + /** + * 话题、通知、活动Id发布人的id + */ + private String userId; + + /** + * 发布者的全称(街道-姓氏先生/女士)【专项组显示真实名】 + */ + private String releaseUserName; + + /** + * 话题发布者的头像Url + */ + private String releaseUserHeadPhoto; + + /** + * 发布时间yyyy-MM-dd HH:mm + */ + private String releaseTimed; + + /** + * 内容 + */ + private String content; + + /** + * 话题状态(discussing进行中、closed已关闭) + */ + private String status; + + /** + * 是否本人 + */ + private String releaseUserFlag; + + /** + * 如果有图片,后台只返回第一张,没有图片此列为空 + */ + private String firstPhoto; + + /** + * 议题id + */ + private String issueId; + + /** + * 是否被转为议题true,false + */ + private Boolean shiftIssueFlag; + + /** + * 数据类型(topic:话题 notice:通知 act:活动) + */ + private String contentType; + + /** + * 本人已读未读状态(read已读 unread未读) + */ + private String readOrUnRead; + + /** + * 通知或活动未读人员数 + */ + private Integer unReadCount; + + public LatestTenResultDTO() { + this.id = ""; + this.userId = ""; + this.releaseUserName = ""; + this.releaseUserHeadPhoto = ""; + this.releaseTimed = ""; + this.content = ""; + this.status = ""; + this.releaseUserFlag = ""; + this.firstPhoto = ""; + this.issueId = ""; + this.shiftIssueFlag = false; + this.contentType = ""; + this.readOrUnRead = ""; + this.unReadCount = NumConstant.ZERO; + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentController.java index 331cf578ce..eff2910608 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentController.java @@ -17,11 +17,23 @@ package com.epmet.modules.act.controller; +import com.baomidou.mybatisplus.extension.api.R; +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.modules.act.service.ActCommentService; +import com.epmet.resi.group.dto.act.form.CommentFormDTO; +import com.epmet.resi.group.dto.act.form.CommentQueryFormDTO; +import com.epmet.resi.group.dto.act.result.CommentResultDTO; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 活动评论表 @@ -36,5 +48,33 @@ public class ActCommentController { @Autowired private ActCommentService actCommentService; + /** + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 005、评论活动 + * @Date 2021/4/20 12:38 + **/ + @PostMapping("submit") + public Result submitComment(@LoginUser TokenDto tokenDto, @RequestBody CommentFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCommentContent(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,CommentFormDTO.AddUserShowGroup.class,CommentFormDTO.AddUserInternalGroup.class); + actCommentService.submitComment(formDTO); + return new Result(); + } + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 006、活动评论列表查询 + * @Date 2021/4/20 13:01 + **/ + @PostMapping("comlist") + public Result> queryCommentList(@RequestBody CommentQueryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, CommentQueryFormDTO.AddUserInternalGroup.class); + return new Result>().ok(actCommentService.queryCommentList(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java index f315d843b5..3e8883dbd6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java @@ -17,8 +17,19 @@ package com.epmet.modules.act.controller; +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.modules.act.service.ActSignInRecordService; +import com.epmet.resi.group.dto.act.form.SetSignTimeFormDTO; +import com.epmet.resi.group.dto.act.form.SignInFormDTO; +import com.epmet.resi.group.dto.act.form.SignInRecFormDTO; +import com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO; +import com.epmet.resi.group.dto.act.result.SignInRecResultDTO; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -36,4 +47,49 @@ public class ActSignInRecordController { @Autowired private ActSignInRecordService actSignInRecordService; + + /** + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 010、设置(修改)签到时间,生成签到码 + * @Date 2021/4/20 13:50 + **/ + @PostMapping("setsigntime") + public Result setSignTime(@LoginUser TokenDto tokenDto, @RequestBody SetSignTimeFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, SetSignTimeFormDTO.AddUserInternalGroup.class); + return new Result().ok(actSignInRecordService.setSignTime(formDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param tokenDto + * @param formDTO + * @author yinzuomei + * @description 007、签到 + * @Date 2021/4/20 15:19 + **/ + @PostMapping("signin") + public Result signIn(@LoginUser TokenDto tokenDto, @RequestBody SignInFormDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,SignInFormDTO.AddUserInternalGroup.class); + actSignInRecordService.signIn(formDTO); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 009、签到记录列表 + * @Date 2021/4/20 15:46 + **/ + @PostMapping("reclist") + public Result querySignRecList(@RequestBody SignInRecFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,SignInRecFormDTO.AddUserInternalGroup.class); + return new Result().ok(actSignInRecordService.querySignRecList(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java index e063637bca..da9107f7c2 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java @@ -24,8 +24,11 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.modules.act.service.GroupActInfoService; import com.epmet.resi.group.dto.act.GroupActIdDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; +import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; +import com.epmet.resi.group.dto.act.form.CancelActFormDTO; import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO; import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; +import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -77,4 +80,32 @@ public class GroupActInfoController { return new Result().ok(groupActInfoService.queryActDetail(actDetailFormDTO)); } + /** + * @return com.epmet.commons.tools.utils.Result + * @param tokenDto + * @param actReadViewFormDTO + * @author yinzuomei + * @description 016、活动已读未读列表 + * @Date 2021/4/19 19:37 + **/ + @PostMapping("readlist") + public Result queryReadList(@RequestBody @LoginUser TokenDto tokenDto, @RequestBody ActReadViewFormDTO actReadViewFormDTO){ + actReadViewFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(actReadViewFormDTO,ActReadViewFormDTO.AddUserInternalGroup.class); + return new Result().ok(groupActInfoService.queryReadList(actReadViewFormDTO)); + } + + /** + * @return + * @param formDTO + * @author yinzuomei + * @description 011、取消活动 + * @Date 2021/4/20 12:09 + **/ + @PostMapping("cancel") + public Result cancelAct(@LoginUser TokenDto tokenDto,@RequestBody CancelActFormDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,CancelActFormDTO.AddUserShowGroup.class,CancelActFormDTO.AddUserInternalGroup.class); + return new Result().ok(groupActInfoService.cancelAct(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentDao.java index 93a72a4913..b70207027a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentDao.java @@ -19,8 +19,11 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.ActCommentEntity; +import com.epmet.resi.group.dto.act.result.CommentResultDTO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 活动评论表 * @@ -29,5 +32,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActCommentDao extends BaseDao { - + + List selectCommentList(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActOperationRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActOperationRecordDao.java index aa37d62b60..8c05a11e0f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActOperationRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActOperationRecordDao.java @@ -29,5 +29,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActOperationRecordDao extends BaseDao { - + + /** + * 查询活动取消的原因 + * + * @param groupActId + * @return int + */ + String selectCanceledReason(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActReadRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActReadRecordDao.java index 139c075655..1f41006683 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActReadRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActReadRecordDao.java @@ -20,6 +20,9 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.ActReadRecordEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 活动已读记录 @@ -30,5 +33,28 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ActReadRecordDao extends BaseDao { + /** + * 重新发布活动,删除原来的已读未读记录,重新插入应读记录 + * + * @param groupActId + * @return int + */ int deleteByActId(String groupActId); + + /** + * 查询当前活动,应读人员列表 + * + * @param groupActId + * @return com.epmet.modules.act.entity.ActReadRecordEntity + */ + List selectByGroupActId(String groupActId); + + /** + * 查询用户是否阅读过此活动 + * + * @param groupActId + * @param userId + * @return com.epmet.modules.act.entity.ActReadRecordEntity + */ + ActReadRecordEntity selectUserRec(@Param("groupActId") String groupActId, @Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInCodeDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInCodeDao.java index cc918ba292..3c50862d57 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInCodeDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInCodeDao.java @@ -19,6 +19,7 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.ActSignInCodeEntity; +import com.epmet.resi.group.dto.act.ActSignInCodeDTO; import org.apache.ibatis.annotations.Mapper; /** @@ -29,5 +30,11 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActSignInCodeDao extends BaseDao { - + /** + * 获取最后一次生成的签到码 + * + * @param groupActId + * @return com.epmet.resi.group.dto.act.ActSignInCodeDTO + */ + ActSignInCodeDTO selectLastRec(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java index 788ed87051..6e53fe6bef 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java @@ -20,6 +20,9 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.ActSignInRecordEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 组织活动签到记录 @@ -29,5 +32,21 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActSignInRecordDao extends BaseDao { - + + /** + * 查询当前用户是否签到 + * + * @param groupActId + * @param signUserId + * @return int + */ + int selectCountUserRec(@Param("groupActId")String groupActId, @Param("signUserId")String signUserId); + + /** + * 查询活动的签到记录 + * + * @param groupActId + * @return int + */ + List selectListByGroupActId(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActContentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActContentDao.java index 14402fbe3d..fbbb87774d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActContentDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActContentDao.java @@ -20,7 +20,9 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.GroupActContentEntity; import org.apache.ibatis.annotations.Mapper; -import org.springframework.data.repository.query.Param; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 组织活动内容 @@ -31,5 +33,21 @@ import org.springframework.data.repository.query.Param; @Mapper public interface GroupActContentDao extends BaseDao { + /** + * 重新编辑活动提交,将原来的内容置为已删除 + * + * @param groupActId 活动id + * @param userId 更新人 + * @return int + */ int updateToDel(@Param("groupActId") String groupActId, @Param("userId") String userId); + + /** + * 活动内容,升序返回 + * + * @param groupActId 活动id + * @param contentType 内容类型: 文字:text;图片:img + * @return String + */ + List selectContentList(@Param("groupActId")String groupActId, @Param("contentType") String contentType); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java index ad7809400d..4ffe1d4c5f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java @@ -40,6 +40,16 @@ public class ActReadRecordEntity extends BaseEpmetEntity { */ private String customerId; + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 小组id + */ + private String groupId; + /** * group_act_info.id */ @@ -48,7 +58,7 @@ public class ActReadRecordEntity extends BaseEpmetEntity { /** * 已读: read未读:un_read;查看活动详情后修改此表,或者插入一条新的已读记录 */ - private String read; + private String readFlag; /** * 用户id diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentService.java index e8da2bae21..57e3abf651 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentService.java @@ -19,6 +19,11 @@ package com.epmet.modules.act.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.ActCommentEntity; +import com.epmet.resi.group.dto.act.form.CommentFormDTO; +import com.epmet.resi.group.dto.act.form.CommentQueryFormDTO; +import com.epmet.resi.group.dto.act.result.CommentResultDTO; + +import java.util.List; /** * 活动评论表 @@ -28,4 +33,19 @@ import com.epmet.modules.act.entity.ActCommentEntity; */ public interface ActCommentService extends BaseService { + /** + * 005、评论活动 + * + * @param formDTO + * @return + */ + void submitComment(CommentFormDTO formDTO); + + /** + * 006、活动评论列表查询 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.CommentResultDTO + */ + List queryCommentList(CommentQueryFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInCodeService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInCodeService.java index a5d713dcb2..78bff472cd 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInCodeService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInCodeService.java @@ -19,6 +19,7 @@ package com.epmet.modules.act.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.ActSignInCodeEntity; +import com.epmet.resi.group.dto.act.ActSignInCodeDTO; /** * 组织活动签到码 @@ -28,4 +29,11 @@ import com.epmet.modules.act.entity.ActSignInCodeEntity; */ public interface ActSignInCodeService extends BaseService { + /** + * 获取最后一次生成的签到码 + * + * @param groupActId + * @return com.epmet.resi.group.dto.act.ActSignInCodeDTO + */ + ActSignInCodeDTO selectLastRec(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java index 279a72fd3a..da979840b0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java @@ -19,6 +19,11 @@ package com.epmet.modules.act.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.ActSignInRecordEntity; +import com.epmet.resi.group.dto.act.form.SetSignTimeFormDTO; +import com.epmet.resi.group.dto.act.form.SignInFormDTO; +import com.epmet.resi.group.dto.act.form.SignInRecFormDTO; +import com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO; +import com.epmet.resi.group.dto.act.result.SignInRecResultDTO; /** * 组织活动签到记录 @@ -28,4 +33,36 @@ import com.epmet.modules.act.entity.ActSignInRecordEntity; */ public interface ActSignInRecordService extends BaseService { + /** + * 查询当前用户是否签到 + * + * @param groupActId + * @param currentUserId + * @return boolean + */ + boolean queryUserSignInRec(String groupActId, String currentUserId); + + /** + * 010、设置(修改)签到时间,生成签到码 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO + */ + SetSignTimeResultDTO setSignTime(SetSignTimeFormDTO formDTO); + + /** + * 007、签到 + * + * @param formDTO + * @return + */ + void signIn(SignInFormDTO formDTO); + + /** + * 009、签到记录列表 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.SignInRecResultDTO + */ + SignInRecResultDTO querySignRecList(SignInRecFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java index 6bad0862fa..9c066628bf 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java @@ -20,9 +20,13 @@ package com.epmet.modules.act.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.GroupActInfoEntity; import com.epmet.resi.group.dto.act.GroupActIdDTO; +import com.epmet.resi.group.dto.act.GroupActInfoDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; +import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; +import com.epmet.resi.group.dto.act.form.CancelActFormDTO; import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO; import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; +import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; /** * 组织活动信息 @@ -47,4 +51,28 @@ public interface GroupActInfoService extends BaseService { * @return com.epmet.resi.group.dto.act.result.ActDetailResultDTO */ ActDetailResultDTO queryActDetail(ActDetailFormDTO actDetailFormDTO); + + /** + * 016、活动已读未读列表 + * + * @param actReadViewFormDTO + * @return com.epmet.resi.group.dto.act.result.ActDetailResultDTO + */ + NoticeReadListResultDTO queryReadList(ActReadViewFormDTO actReadViewFormDTO); + + /** + * 011、取消活动 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.GroupActIdDTO + */ + GroupActIdDTO cancelAct(CancelActFormDTO formDTO); + + /** + * 查询活动主信息 + * + * @param groupActId + * @return com.epmet.resi.group.dto.act.GroupActInfoDTO + */ + GroupActInfoDTO getGroupActInfoDTO(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java index 6f4ea05296..c249c4ec28 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java @@ -18,10 +18,34 @@ package com.epmet.modules.act.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +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.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.act.dao.ActCommentDao; import com.epmet.modules.act.entity.ActCommentEntity; import com.epmet.modules.act.service.ActCommentService; +import com.epmet.modules.act.service.GroupActInfoService; +import com.epmet.modules.constant.GroupActConstant; +import com.epmet.resi.group.dto.act.GroupActInfoDTO; +import com.epmet.resi.group.dto.act.form.CommentFormDTO; +import com.epmet.resi.group.dto.act.form.CommentQueryFormDTO; +import com.epmet.resi.group.dto.act.result.CommentResultDTO; +import com.github.pagehelper.PageHelper; +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.Collections; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; /** * 活动评论表 @@ -32,5 +56,88 @@ import org.springframework.stereotype.Service; @Service public class ActCommentServiceImpl extends BaseServiceImpl implements ActCommentService { + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; + + @Autowired + private GroupActInfoService groupActInfoService; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + + + /** + * 005、评论活动 + * + * @param formDTO + * @return + */ + @Override + public void submitComment(CommentFormDTO formDTO) { + //1、关闭和已取消不能评论 + GroupActInfoDTO groupActInfoDTO = groupActInfoService.getGroupActInfoDTO(formDTO.getGroupActId()); + if (GroupActConstant.CLOSED.equals(groupActInfoDTO.getStatus())) { + throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_COMMENT.getCode(), "当前活动已关闭,不能评论"); + } else if (GroupActConstant.CANCELED.equals(groupActInfoDTO.getStatus())) { + throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_COMMENT.getCode(), "当前活动已取消,不能评论"); + } + //2、评论内容审核 + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(formDTO.getCommentContent()); + 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()); + } + } + //3、插入记录 + ActCommentEntity actCommentEntity = new ActCommentEntity(); + actCommentEntity.setCustomerId(formDTO.getCustomerId()); + actCommentEntity.setCommentContent(formDTO.getCommentContent()); + actCommentEntity.setCommentUserId(formDTO.getUserId()); + actCommentEntity.setGroupActId(formDTO.getGroupActId()); + baseDao.insert(actCommentEntity); + } + + /** + * 006、活动评论列表查询 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.CommentResultDTO + */ + @Override + public List queryCommentList(CommentQueryFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list=baseDao.selectCommentList(formDTO.getGroupActId()); + if(CollectionUtils.isEmpty(list)){ + return Collections.EMPTY_LIST; + } + //2.调用user服务,查询人员基础数据 + List userIdList = list.stream().map(CommentResultDTO::getCommentUserId).collect(Collectors.toList()); + Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!result.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + if (!CollectionUtils.isEmpty(result.getData())) { + //3.遍历封装数据并返回 + list.forEach(l -> { + result.getData().forEach(user -> { + if (l.getCommentUserId().equals(user.getUserId())) { + l.setCommentUserHeadPhoto(user.getHeadImgUrl()); + l.setCommentUserName(user.getSurname().concat(user.getName())); + } + }); + }); + + } + return list; + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInCodeServiceImpl.java index 3ee20b3195..98ca39c3ea 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInCodeServiceImpl.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.modules.act.dao.ActSignInCodeDao; import com.epmet.modules.act.entity.ActSignInCodeEntity; import com.epmet.modules.act.service.ActSignInCodeService; +import com.epmet.resi.group.dto.act.ActSignInCodeDTO; import org.springframework.stereotype.Service; /** @@ -33,4 +34,14 @@ import org.springframework.stereotype.Service; public class ActSignInCodeServiceImpl extends BaseServiceImpl implements ActSignInCodeService { + /** + * 获取最后一次生成的签到码 + * + * @param groupActId + * @return com.epmet.resi.group.dto.act.ActSignInCodeDTO + */ + @Override + public ActSignInCodeDTO selectLastRec(String groupActId) { + return baseDao.selectLastRec(groupActId); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java index 3dd6e6e8e1..0794f097c4 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java @@ -18,10 +18,41 @@ package com.epmet.modules.act.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.act.dao.ActSignInRecordDao; +import com.epmet.modules.act.dao.GroupActInfoDao; import com.epmet.modules.act.entity.ActSignInRecordEntity; +import com.epmet.modules.act.entity.GroupActInfoEntity; +import com.epmet.modules.act.service.ActSignInCodeService; import com.epmet.modules.act.service.ActSignInRecordService; +import com.epmet.modules.act.service.GroupActInfoService; +import com.epmet.modules.constant.GroupActConstant; +import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.resi.group.dto.act.ActSignInCodeDTO; +import com.epmet.resi.group.dto.act.GroupActInfoDTO; +import com.epmet.resi.group.dto.act.form.SetSignTimeFormDTO; +import com.epmet.resi.group.dto.act.form.SignInFormDTO; +import com.epmet.resi.group.dto.act.form.SignInRecFormDTO; +import com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO; +import com.epmet.resi.group.dto.act.result.SignInRecResultDTO; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; /** * 组织活动签到记录 @@ -29,8 +60,170 @@ import org.springframework.stereotype.Service; * @author generator generator@elink-cn.com * @since v1.0.0 2021-04-16 */ +@Slf4j @Service public class ActSignInRecordServiceImpl extends BaseServiceImpl implements ActSignInRecordService { + @Autowired + private GroupActInfoService groupActInfoService; + @Autowired + private ResiGroupMemberService resiGroupMemberService; + @Autowired + private GroupActInfoDao groupActInfoDao; + @Autowired + private ActSignInCodeService actSignInCodeService; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + /** + * 查询当前用户是否签到 + * + * @param groupActId + * @param signUserId + * @return boolean + */ + @Override + public boolean queryUserSignInRec(String groupActId, String signUserId) { + if (baseDao.selectCountUserRec(groupActId, signUserId) > 0) { + return true; + } + return false; + } + + /** + * 010、设置(修改)签到时间,生成签到码 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO + */ + @Transactional(rollbackFor = Exception.class) + @Override + public SetSignTimeResultDTO setSignTime(SetSignTimeFormDTO formDTO) { + GroupActInfoDTO originalActInfo = groupActInfoService.getGroupActInfoDTO(formDTO.getGroupActId()); + // 1、只有组长才可以设置签到码 + ResiGroupMemberDTO groupMemberDTO = resiGroupMemberService.getLeaderMember(originalActInfo.getGroupId()); + if (!formDTO.getUserId().equals(groupMemberDTO.getCustomerUserId())) { + throw new RenException(EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getCode(), EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getMsg()); + } + //2、设置起止时间 + GroupActInfoEntity groupActInfoEntity = ConvertUtils.sourceToTarget(originalActInfo, GroupActInfoEntity.class); + try { + String startTimeStr = formDTO.getSignInStartTime().concat(":00"); + groupActInfoEntity.setSignInStartTime(DateUtils.parse(startTimeStr, DateUtils.DATE_TIME_PATTERN)); + String endTimeStr = formDTO.getSignInEndTime().concat(":00"); + groupActInfoEntity.setSignInStartTime(DateUtils.parse(endTimeStr, DateUtils.DATE_TIME_PATTERN)); + } catch (Exception e) { + throw new RenException("签到起止时间格式错误"); + } + groupActInfoDao.updateById(groupActInfoEntity); + SetSignTimeResultDTO result = new SetSignTimeResultDTO(); + //3、如果签到时间修改了,重新生成签到码 + result.setSignInCodeUrl(getSignInCodeUrl(groupActInfoEntity, originalActInfo)); + result.setGroupActId(formDTO.getGroupActId()); + result.setSignInStartTime(groupActInfoEntity.getSignInStartTime()); + result.setSignInEndTime(groupActInfoEntity.getSignInEndTime()); + return result; + } + + private String getSignInCodeUrl(GroupActInfoEntity actInfoEntity, GroupActInfoDTO groupActInfoDTO) { + ActSignInCodeDTO actSignInCodeDTO = actSignInCodeService.selectLastRec(actInfoEntity.getId()); + if (null != actSignInCodeDTO) { + if (actInfoEntity.getSignInStartTime().equals(groupActInfoDTO.getSignInStartTime()) + && actInfoEntity.getSignInEndTime().equals(groupActInfoDTO.getSignInEndTime())) { + log.info("签到开始时间、签到截止时间未变更,不需要重新生成签到码"); + return actSignInCodeDTO.getUrl(); + } + } + //todo + //别忘了插入数据库act_sign_in_code + return "重新生成新的url"; + } + + + + /** + * 007、签到 + * + * @param formDTO + * @return + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void signIn(SignInFormDTO formDTO) { + if(queryUserSignInRec(formDTO.getGroupActId(),formDTO.getUserId())){ + //已经签到无需重复签到 + log.warn(String.format("当前用户userId=%s,已经签到,groupActId=%s",formDTO.getUserId(),formDTO.getGroupActId())); + return; + } + GroupActInfoDTO originalActInfo = groupActInfoService.getGroupActInfoDTO(formDTO.getGroupActId()); + //关闭、已取消不能签到 + if (GroupActConstant.CLOSED.equals(originalActInfo.getStatus())) { + throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getCode(), "活动已关闭,不能签到"); + } else if (GroupActConstant.CANCELED.equals(originalActInfo.getStatus())) { + throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getCode(), "活动已取消,不能签到"); + } + Date nowDate=new Date(); + long nowTime=nowDate.getTime(); + long signInStartTime=originalActInfo.getSignInStartTime().getTime(); + long signInEndTime=originalActInfo.getSignInEndTime().getTime(); + if (nowTime < signInStartTime) { + //未到签到时间 + throw new RenException(EpmetErrorCode.SIGN_IN_TIME_NOT_START.getCode(),EpmetErrorCode.SIGN_IN_TIME_NOT_START.getMsg()); + } else if (nowTime > signInEndTime) { + //未签到、已经超过了签到时间 + throw new RenException(EpmetErrorCode.SIGN_IN_TIME_PASSED.getCode(),EpmetErrorCode.SIGN_IN_TIME_PASSED.getMsg()); + } + + //未签到、在签到时间范围内的,可以签到 + GroupActInfoEntity groupActInfoEntity = ConvertUtils.sourceToTarget(originalActInfo, GroupActInfoEntity.class); + groupActInfoEntity.setSignedInNum(originalActInfo.getSignedInNum() + NumConstant.ONE); + groupActInfoDao.updateById(groupActInfoEntity); + ActSignInRecordEntity insertEntity=new ActSignInRecordEntity(); + insertEntity.setCustomerId(formDTO.getCustomerId()); + insertEntity.setGroupActId(formDTO.getGroupActId()); + insertEntity.setSignUserId(formDTO.getUserId()); + insertEntity.setSignInAddress(formDTO.getSignInAddress()); + insertEntity.setLatitude(formDTO.getLatitude()); + insertEntity.setLongitude(formDTO.getLongitude()); + baseDao.insert(insertEntity); + } + /** + * 009、签到记录列表 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.SignInRecResultDTO + */ + @Override + public SignInRecResultDTO querySignRecList(SignInRecFormDTO formDTO) { + GroupActInfoDTO originalActInfo = groupActInfoService.getGroupActInfoDTO(formDTO.getGroupActId()); + SignInRecResultDTO resultDTO = new SignInRecResultDTO(); + resultDTO.setSignedInNum(originalActInfo.getSignedInNum()); + resultDTO.setShouldAttend(originalActInfo.getShouldAttend()); + List list = baseDao.selectListByGroupActId(formDTO.getGroupActId()); + if (!CollectionUtils.isEmpty(list)) { + //2.调用user服务,查询人员基础数据 + List userIdList = list.stream().map(ActSignInRecordEntity::getSignUserId).collect(Collectors.toList()); + Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!result.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + if (!CollectionUtils.isEmpty(result.getData())) { + List signInDetailList = new ArrayList<>(); + //3.遍历封装数据并返回 + list.forEach(l -> { + result.getData().forEach(user -> { + if (l.getSignUserId().equals(user.getUserId())) { + SignInRecResultDTO.SignInDetail signInDetail = new SignInRecResultDTO.SignInDetail(); + signInDetail.setSignInAddress(l.getSignInAddress()); + signInDetail.setSignInTime(l.getCreatedTime()); + signInDetail.setSignUserId(l.getSignUserId()); + signInDetail.setSignUserName(user.getSurname().concat(user.getName())); + } + }); + }); + resultDTO.setList(signInDetailList); + } + } + return resultDTO; + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java index 6db5b3551d..8fa5bfecd6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java @@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.param.ImgScanParamDTO; @@ -33,6 +34,8 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.dto.result.GridInfoResultDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.modules.act.dao.ActOperationRecordDao; import com.epmet.modules.act.dao.ActReadRecordDao; @@ -43,16 +46,21 @@ import com.epmet.modules.act.entity.ActReadRecordEntity; import com.epmet.modules.act.entity.GroupActContentEntity; import com.epmet.modules.act.entity.GroupActInfoEntity; import com.epmet.modules.act.service.ActCategoryDictService; +import com.epmet.modules.act.service.ActSignInRecordService; import com.epmet.modules.act.service.GroupActInfoService; import com.epmet.modules.constant.GroupActConstant; import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.resi.group.dto.act.GroupActIdDTO; +import com.epmet.resi.group.dto.act.GroupActInfoDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; +import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; +import com.epmet.resi.group.dto.act.form.CancelActFormDTO; import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO; import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -65,6 +73,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.UUID; +import java.util.stream.Collectors; /** * 组织活动信息 @@ -95,7 +104,10 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl readRecordEntityList=constructReadRec(groupActInfoEntity.getId(), formDTO.getCustomerId(), formDTO.getGroupId(), - formDTO.getPublishUserId()); + formDTO.getPublishUserId(), + groupDTO.getGridId()); //2、插入活动内容 contentList.forEach(textContentEntity->{ groupActContentDao.insert(textContentEntity); @@ -155,22 +168,21 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl constructReadRec(String groupActId, String customerId, String groupId,String publishUserId) { + private List constructReadRec(String groupActId, String customerId, String groupId,String publishUserId,String gridId) { List list=new ArrayList<>(); List memberDTOList=resiGroupMemberService.getMemberList(groupId); memberDTOList.forEach(memberDTO->{ ActReadRecordEntity actReadRecordEntity=new ActReadRecordEntity(); actReadRecordEntity.setCustomerId(customerId); actReadRecordEntity.setGroupActId(groupActId); - if(publishUserId.equals(memberDTO.getCustomerUserId())){ - //发布人默认是已读 - actReadRecordEntity.setRead(GroupActConstant.READ); - }else{ - actReadRecordEntity.setRead(GroupActConstant.UN_READ); - } + actReadRecordEntity.setReadFlag(GroupActConstant.UN_READ); actReadRecordEntity.setUserId(memberDTO.getCustomerUserId()); actReadRecordEntity.setShouldBeRead(Constant.YES); - list.add(actReadRecordEntity); + actReadRecordEntity.setGroupId(groupId); + actReadRecordEntity.setGridId(gridId); + if(!publishUserId.equals(memberDTO.getCustomerUserId())){ + list.add(actReadRecordEntity); + } }); return list; } @@ -239,7 +251,7 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl NumConstant.THREE) { + if (formDTO.getImgList().size() > NumConstant.THREE) { throw new RenException(EpmetErrorCode.GROUP_ACT_IMG_MAX.getCode(), EpmetErrorCode.GROUP_ACT_IMG_MAX.getMsg()); } } @@ -257,7 +269,6 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl textList, List imgList) { //活动标题 if (StringUtils.isNotBlank(title)) { - //创建话题内容审核 TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); TextTaskDTO taskDTO = new TextTaskDTO(); taskDTO.setContent(title); @@ -356,12 +367,239 @@ public class GroupActInfoServiceImpl extends BaseServiceImplNumConstant.ZERO?false:true); + //返回详情,并且已读状态 + ActReadRecordEntity actReadRecordEntity=actReadRecordDao.selectUserRec(formDTO.getGroupActId(),formDTO.getUserId()); + if(null== actReadRecordEntity){ + //插入 + ActReadRecordEntity insertEntity=new ActReadRecordEntity(); + insertEntity.setCustomerId(groupActInfoEntity.getCustomerId()); + insertEntity.setGroupActId(formDTO.getGroupActId()); + insertEntity.setReadFlag(GroupActConstant.READ); + insertEntity.setShouldBeRead(Constant.NO); + insertEntity.setUserId(formDTO.getUserId()); + insertEntity.setGridId(groupActInfoEntity.getGridId()); + insertEntity.setGroupId(groupActInfoEntity.getGroupId()); + actReadRecordDao.insert(insertEntity); + }else{ + if(GroupActConstant.UN_READ.equals(actReadRecordEntity.getReadFlag())){ + //未读->已读 + actReadRecordEntity.setReadFlag(GroupActConstant.READ); + actReadRecordEntity.setUpdatedTime(new Date()); + actReadRecordDao.updateById(actReadRecordEntity); + } + } + return resultDTO; + } + + private void handleSignInDesc(ActDetailResultDTO resultDTO,String currentUserId) { + if(GroupActConstant.CANCELED.equals(resultDTO.getStatus()) + ||GroupActConstant.CLOSED.equals(resultDTO.getStatus())){ + //活动已取消或者已关闭,不显示签到按钮,也不显示描述 + resultDTO.setSignInButton(GroupActConstant.BLANK); + resultDTO.setSignInDesc(StrConstant.EPMETY_STR); + return; + } + if (null == resultDTO.getSignInStartTime() || null == resultDTO.getSignInEndTime()) { + //未设置签到开始、截止时间,默认不显示签到按钮,也不显示描述 + resultDTO.setSignInButton(GroupActConstant.BLANK); + resultDTO.setSignInDesc(StrConstant.EPMETY_STR); + return; + } + //查询当前用户是否签到 + boolean signedInFlag=actSignInRecordService.queryUserSignInRec(resultDTO.getGroupActId(),currentUserId); + // 1、签到成功显示已签到 + if(signedInFlag){ + resultDTO.setSignInButton(GroupActConstant.BLANK); + resultDTO.setSignInDesc("已签到"); + return; + } + Date nowDate=new Date(); + long nowTime=nowDate.getTime(); + long signInStartTime=resultDTO.getSignInStartTime().getTime(); + long signInEndTime=resultDTO.getSignInEndTime().getTime(); + if (nowTime < signInStartTime) { + resultDTO.setSignInButton(GroupActConstant.DISPLAY); + // 2、未到签到时间显示距离签到时间还有多久 + //距离签到开始还有XX天4小时32分钟 + String remainStr=getDatePoor(resultDTO.getSignInStartTime(),nowDate); + resultDTO.setSignInDesc(String.format("距离签到开始还有%s",remainStr)); + return; + } else if (signInStartTime <= nowTime && nowTime <= signInEndTime) { + // 3、在签到时间范围内,并且未签到的,显示签到按钮,描述显示空字符串 + resultDTO.setSignInButton(GroupActConstant.DISPLAY); + resultDTO.setSignInDesc(StrConstant.EPMETY_STR); + return; + } else if (nowTime > signInEndTime) { + // 4、签到时间已过且未签到的,显示“当前时间已超过签到时间” + resultDTO.setSignInButton(GroupActConstant.BLANK); + resultDTO.setSignInDesc("当前时间已超过签到时间"); + } + } + + public static String getDatePoor(Date endDate, Date nowDate) { + + long nd = 1000 * 24 * 60 * 60; + long nh = 1000 * 60 * 60; + long nm = 1000 * 60; + // long ns = 1000; + // 获得两个时间的毫秒时间差异 + long diff = endDate.getTime() - nowDate.getTime(); + // 计算差多少天 + long day = diff / nd; + // 计算差多少小时 + long hour = diff % nd / nh; + // 计算差多少分钟 + long min = diff % nd % nh / nm; + // 计算差多少秒//输出结果 + // long sec = diff % nd % nh % nm / ns; + return day + "天" + hour + "小时" + min + "分钟"; + } + /** + * 016、活动已读未读列表 + * + * @param actReadViewFormDTO * @return com.epmet.resi.group.dto.act.result.ActDetailResultDTO */ @Override - public ActDetailResultDTO queryActDetail(ActDetailFormDTO actDetailFormDTO) { - //todo - return null; + public NoticeReadListResultDTO queryReadList(ActReadViewFormDTO actReadViewFormDTO) { + NoticeReadListResultDTO resultDTO = new NoticeReadListResultDTO(); + List readList = new ArrayList<>(); + List unReadList = new ArrayList<>(); + //1.根据活动id,查询应读人员列表 + List list = actReadRecordDao.selectByGroupActId(actReadViewFormDTO.getGroupActId()); + + //2.调用user服务,查询人员基础数据 + List userIdList = list.stream().map(ActReadRecordEntity::getUserId).collect(Collectors.toList()); + Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!result.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + List resultDTOList = result.getData(); + if (!CollectionUtils.isEmpty(resultDTOList)) { + //3.遍历封装数据并返回 + list.forEach(l -> { + StringBuffer name = new StringBuffer(); + StringBuffer url = new StringBuffer(); + resultDTOList.forEach(user -> { + if (l.getUserId().equals(user.getUserId())) { + name.append(user.getSurname()).append(user.getName()); + url.append(user.getHeadImgUrl()); + } + }); + if (GroupActConstant.READ.equals(l.getReadFlag())) { + //已读 + NoticeReadListResultDTO.NoticeReafdRecord read = new NoticeReadListResultDTO.NoticeReafdRecord(); + read.setUserId(l.getUserId()); + read.setUserName(name.toString()); + read.setUserHeadPhoto(url.toString()); + readList.add(read); + } else { + //未读 + NoticeReadListResultDTO.NoticeReafdRecord unRead = new NoticeReadListResultDTO.NoticeReafdRecord(); + unRead.setUserId(l.getUserId()); + unRead.setUserName(name.toString()); + unRead.setUserHeadPhoto(url.toString()); + unReadList.add(unRead); + } + }); + + } + //已读人数 + resultDTO.setReadCount(readList.size()); + //未读人数 + resultDTO.setUnReadCount(unReadList.size()); + //已读列表 + resultDTO.setReadList(readList); + //未读列表 + resultDTO.setUnReadList(unReadList); + return resultDTO; + } + + /** + * 011、取消活动 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.GroupActIdDTO + */ + @Transactional(rollbackFor = Exception.class) + @Override + public GroupActIdDTO cancelAct(CancelActFormDTO formDTO) { + GroupActInfoEntity actInfoEntity=baseDao.selectById(formDTO.getGroupActId()); + //1、只有组长才可以取消活动 + ResiGroupMemberDTO groupMemberDTO = resiGroupMemberService.getLeaderMember(actInfoEntity.getGroupId()); + if (!formDTO.getUserId().equals(groupMemberDTO.getCustomerUserId())) { + throw new RenException(EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getCode(), EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getMsg()); + } + //2、活动已关闭,不能取消 + if (GroupActConstant.CLOSED.equals(actInfoEntity.getStatus())) { + throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getCode(), String.format(EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getMsg(), "已关闭")); + } else if (GroupActConstant.CANCELED.equals(actInfoEntity.getStatus())) { + throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getCode(), "活动已取消"); + } + //3、取消原因审核 + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(formDTO.getReason()); + 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()); + } + } + //4、记录取消时间 + Date nowDate=new Date(); + actInfoEntity.setCanceledTime(nowDate); + actInfoEntity.setStatus(GroupActConstant.CANCELED); + baseDao.updateById(actInfoEntity); + + //5、插入一条操作日志 + ActOperationRecordEntity actOperationRecordEntity = new ActOperationRecordEntity(); + actOperationRecordEntity.setCustomerId(actInfoEntity.getCustomerId()); + actOperationRecordEntity.setOperateUserId(formDTO.getUserId()); + actOperationRecordEntity.setGroupActId(formDTO.getGroupActId()); + actOperationRecordEntity.setOperationType(GroupActConstant.CANCEL); + actOperationRecordEntity.setCreatedTime(nowDate); + actOperationRecordEntity.setUpdatedTime(nowDate); + actOperationRecordDao.insert(actOperationRecordEntity); + + baseDao.updateById(actInfoEntity); + GroupActIdDTO resultDTO=new GroupActIdDTO(); + resultDTO.setGroupActId(formDTO.getGroupActId()); + return resultDTO; + } + + /** + * 查询活动主信息 + * + * @param groupActId + * @return com.epmet.resi.group.dto.act.GroupActInfoDTO + */ + @Override + public GroupActInfoDTO getGroupActInfoDTO(String groupActId) { + return ConvertUtils.sourceToTarget(baseDao.selectById(groupActId), GroupActInfoDTO.class); } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupActConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupActConstant.java index f53850141e..03f127b29c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupActConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupActConstant.java @@ -33,4 +33,8 @@ public interface GroupActConstant { // 已读: read未读:un_read String READ="read"; String UN_READ="un_read"; + + // blank: 不显示; display:显示 + String BLANK="blank"; + String DISPLAY="display"; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index f390cf75a1..3a632ae84b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -31,6 +31,8 @@ import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO; import com.epmet.resi.group.dto.member.form.ResiIdentityFormDTO; +import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; +import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.PostMapping; @@ -497,4 +499,16 @@ public class ResiGroupController { return new Result(); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 所有小组查询 + **/ + @PostMapping(value = "allgrouplist") + public Result> allGroupList(@LoginUser TokenDto tokenDto, @RequestBody AllGroupListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AllGroupListFormDTO.GroupList.class); + return new Result>().ok(resiGroupService.allGroupList(tokenDto, formDTO)); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupSetupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupSetupController.java new file mode 100644 index 0000000000..6f21b623e3 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupSetupController.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.controller; + +import com.epmet.modules.group.service.ResiGroupSetupService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@RestController +@RequestMapping("resigroupsetup") +public class ResiGroupSetupController { + + @Autowired + private ResiGroupSetupService resiGroupSetupService; + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java index 13aa7585ba..7359f6d2a2 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java @@ -27,7 +27,6 @@ import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; - import java.util.List; /** @@ -237,4 +236,10 @@ public interface ResiGroupDao extends BaseDao { * @Date 2020/12/25 13:18 **/ List queryGroupProcessingCount(@Param("gridIdList") List gridIdList); + + /** + * @Author sun + * @Description 分页查询网格下所有小组列表 + **/ + List selectAllGroupList(AllGroupListFormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupSetupDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupSetupDao.java new file mode 100644 index 0000000000..1efca98aa2 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupSetupDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.group.entity.ResiGroupSetupEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@Mapper +public interface ResiGroupSetupDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupSetupEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupSetupEntity.java new file mode 100644 index 0000000000..77727f9fa3 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupSetupEntity.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("resi_group_setup") +public class ResiGroupSetupEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID,初始默认为default + */ + private String customerId; + + /** + * 默认小组头像 + */ + private String logo; + + /** + * 小组名称 + */ + private String name; + + /** + * 小组简介 + */ + private String describe; + + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + + /** + * 专用:dedicated;常用:common_used + */ + private String category; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupSetupRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupSetupRedis.java new file mode 100644 index 0000000000..fac89893ba --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupSetupRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@Component +public class ResiGroupSetupRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java index b4bccf14e9..a27d726fc8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java @@ -20,6 +20,7 @@ package com.epmet.modules.group.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.modules.group.entity.ResiGroupEntity; import com.epmet.resi.group.dto.UserRoleDTO; @@ -370,4 +371,12 @@ public interface ResiGroupService extends BaseService { * @return void */ void setVisitSwitch(ManageInitFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 所有小组查询 + **/ + List allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupSetupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupSetupService.java new file mode 100644 index 0000000000..180466d9ea --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupSetupService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.modules.group.entity.ResiGroupSetupEntity; + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +public interface ResiGroupSetupService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index a3770a028c..6cc56ca171 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -30,6 +30,7 @@ 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.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; @@ -87,6 +88,7 @@ import org.springframework.util.CollectionUtils; import java.text.SimpleDateFormat; import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; import java.util.stream.Collectors; @@ -1491,4 +1493,48 @@ public class ResiGroupServiceImpl extends BaseServiceImpl allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO) { + //1.分页查询网格下所有小组列表且是审核通过状态的,以组内人员数从多到少排序 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + List resultList = baseDao.selectAllGroupList(formDTO); + if (null == resultList || resultList.size() == 0) { + return new ArrayList<>(); + } + + //2.查询当前用户居民端角色列表 + AtomicBoolean isPartymember = new AtomicBoolean(false); + Result> resultDTOList = epmetUserOpenFeignClient.getUserRoleInfoByUserId(tokenDto.getUserId()); + if (!resultDTOList.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + List roleList = resultDTOList.getData(); + roleList.forEach(rl -> { + if ("partymember".equals(rl.getRoleKey())) { + isPartymember.set(true); + } + }); + + //3.调用已有方法赋值当前人员是否可以入组值 + for (AllGroupListResultDTO dto : resultList) { + //非党员角色不允许加入支部小组 + if ("branch".equals(dto.getGroupType()) && !isPartymember.get()) { + dto.setStatus("rejected"); + continue; + } + GroupMemeberOperationDTO operation = groupMemeberOperationService.selectLatestRecord(dto.getGroupId(), tokenDto.getUserId()); + if (null != operation) { + dto.setStatus(operation.getOperateStatus()); + } + } + return resultList; + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupSetupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupSetupServiceImpl.java new file mode 100644 index 0000000000..79ca65f419 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupSetupServiceImpl.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.modules.group.dao.ResiGroupSetupDao; +import com.epmet.modules.group.entity.ResiGroupSetupEntity; +import com.epmet.modules.group.redis.ResiGroupSetupRedis; +import com.epmet.modules.group.service.ResiGroupSetupService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@Service +public class ResiGroupSetupServiceImpl extends BaseServiceImpl implements ResiGroupSetupService { + + @Autowired + private ResiGroupSetupRedis resiGroupSetupRedis; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index 8e8e064936..93a3d454a6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java @@ -32,6 +32,7 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.UserInfoOnEnterGridResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.constant.UserMessageConstant; import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.ResiGuideFeignClient; @@ -46,6 +47,7 @@ import com.epmet.modules.member.dao.ResiGroupMemberDao; import com.epmet.modules.member.service.GroupMemeberOperationService; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.member.service.impl.ResiGroupMemberServiceImpl; +import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.constant.EnterGroupTypeConstant; import com.epmet.resi.group.constant.GroupStateConstant; import com.epmet.resi.group.constant.LeaderFlagConstant; @@ -106,6 +108,8 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl page(Map params) { @@ -455,6 +459,19 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl booleanResult = epmetUserOpenFeignClient.selectIsPartyMemberByUserId(formDTO.getUserId()); + if (!booleanResult.success()){ + throw new RenException(ModuleConstant.IS_PARTY_MEMBER_ERR); + } + // 不是党员直接抛出 + if (!booleanResult.getData()){ + throw new RenException(EpmetErrorCode.PARTY_MEMBER_JOIN_BRANCH_GROUP.getCode()); + } + } + //2020.11.26 sun start //先判断用户是否有在审核的入组申请,有的话直接给提示 GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.selectLatestRecord(groupInvitationDTO.getResiGroupId(), formDTO.getUserId()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/InvitationRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/InvitationRecordServiceImpl.java index f8a24b172d..2a7648e63d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/InvitationRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/InvitationRecordServiceImpl.java @@ -25,7 +25,6 @@ import com.epmet.modules.invitation.dao.InvitationRecordDao; import com.epmet.modules.invitation.entity.InvitationRecordEntity; import com.epmet.modules.invitation.service.InvitationRecordService; import com.epmet.modules.notice.dao.NoticeDao; -import com.epmet.modules.notice.dao.NoticeReafdRecordDao; import com.epmet.modules.notice.entity.NoticeEntity; import com.epmet.resi.group.dto.invitation.form.ShareFormDTO; import com.epmet.resi.group.dto.invitation.result.ShareResultDTO; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java index 11760b07b3..6813b2edbc 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.enums.EventEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; @@ -247,6 +248,18 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl booleanResult = userClient.selectIsPartyMemberByUserId(param.getUserId()); + if (!booleanResult.success()){ + throw new RenException(ModuleConstant.IS_PARTY_MEMBER_ERR); + } + // 不是党员直接抛出 + if (!booleanResult.getData()){ + throw new RenException(EpmetErrorCode.PARTY_MEMBER_JOIN_BRANCH_GROUP.getCode()); + } + } //先判断用户是否有在审核的入组申请,有的话直接给提示 GroupMemeberOperationDTO groupMemeberOperationDTO = operationDao.selectLatestRecord(groupId, param.getUserId()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index 9fbc039d40..5f7cd2eb5b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -218,6 +218,18 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl booleanResult = userOpenFeignClient.selectIsPartyMemberByUserId(applyJoinGroupFormDTO.getUserId()); + if (!booleanResult.success()){ + throw new RenException(ModuleConstant.IS_PARTY_MEMBER_ERR); + } + // 不是党员直接抛出 + if (!booleanResult.getData()){ + throw new RenException(EpmetErrorCode.PARTY_MEMBER_JOIN_BRANCH_GROUP.getCode()); + } + } + UserRoleDTO userRoleDTO = resiGroupService.checkPartyMemberOrWarmHeated(applyJoinGroupFormDTO.getApp(), applyJoinGroupFormDTO.getUserId(), resiGroupDTO.getCustomerId(), diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java index a7114f3834..f3972f4478 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java @@ -17,7 +17,9 @@ package com.epmet.modules.notice.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -28,6 +30,9 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.modules.notice.excel.NoticeCommentExcel; import com.epmet.modules.notice.service.NoticeCommentService; import com.epmet.resi.group.dto.notice.NoticeCommentDTO; +import com.epmet.resi.group.dto.notice.form.NoticeCommentFormDTO; +import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; +import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -91,4 +96,29 @@ public class NoticeCommentController { ExcelUtils.exportExcelToTarget(response, null, list, NoticeCommentExcel.class); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 发布通知评论 + **/ + @PostMapping(value = "noticecomment") + public Result noticeComment(@LoginUser TokenDto tokenDto, @RequestBody NoticeCommentFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, NoticeCommentFormDTO.Comment.class); + noticeCommentService.noticeComment(tokenDto, formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 通知评论列表查询 + **/ + @PostMapping(value = "noticecommentlist") + public Result> noticeCommentList(@LoginUser TokenDto tokenDto, @RequestBody NoticeCommentListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, NoticeCommentListFormDTO.CommentList.class); + return new Result>().ok(noticeCommentService.noticeCommentList(tokenDto, formDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java similarity index 68% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java index 902615a92b..dd865bfdf8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java @@ -27,10 +27,11 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; -import com.epmet.modules.notice.excel.NoticeReafdRecordExcel; -import com.epmet.modules.notice.service.NoticeReafdRecordService; -import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO; +import com.epmet.modules.notice.excel.NoticeReadRecordExcel; +import com.epmet.modules.notice.service.NoticeReadRecordService; +import com.epmet.resi.group.dto.notice.NoticeReadRecordDTO; import com.epmet.resi.group.dto.notice.form.NoticeReadListFormDTO; +import com.epmet.resi.group.dto.notice.form.ReadTypeFormDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -48,25 +49,25 @@ import java.util.Map; */ @RestController @RequestMapping("noticereafdrecord") -public class NoticeReafdRecordController { +public class NoticeReadRecordController { @Autowired - private NoticeReafdRecordService noticeReafdRecordService; + private NoticeReadRecordService noticeReafdRecordService; @GetMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = noticeReafdRecordService.page(params); - return new Result>().ok(page); + public Result> page(@RequestParam Map params){ + PageData page = noticeReafdRecordService.page(params); + return new Result>().ok(page); } @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ - NoticeReafdRecordDTO data = noticeReafdRecordService.get(id); - return new Result().ok(data); + public Result get(@PathVariable("id") String id){ + NoticeReadRecordDTO data = noticeReafdRecordService.get(id); + return new Result().ok(data); } @PostMapping - public Result save(@RequestBody NoticeReafdRecordDTO dto){ + public Result save(@RequestBody NoticeReadRecordDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); noticeReafdRecordService.save(dto); @@ -74,7 +75,7 @@ public class NoticeReafdRecordController { } @PutMapping - public Result update(@RequestBody NoticeReafdRecordDTO dto){ + public Result update(@RequestBody NoticeReadRecordDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); noticeReafdRecordService.update(dto); @@ -91,8 +92,8 @@ public class NoticeReafdRecordController { @GetMapping("export") public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { - List list = noticeReafdRecordService.list(params); - ExcelUtils.exportExcelToTarget(response, null, list, NoticeReafdRecordExcel.class); + List list = noticeReafdRecordService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, NoticeReadRecordExcel.class); } /** @@ -107,4 +108,17 @@ public class NoticeReafdRecordController { return new Result().ok(noticeReafdRecordService.noticeReadList(tokenDto, formDTO)); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 小组通知阅读状态修改 + **/ + @PostMapping(value = "readtype") + public Result readType(@LoginUser TokenDto tokenDto, @RequestBody ReadTypeFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ReadTypeFormDTO.Read.class); + noticeReafdRecordService.readType(tokenDto, formDTO); + return new Result(); + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentDao.java index db988edb81..308fc3ea0a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentDao.java @@ -19,8 +19,12 @@ package com.epmet.modules.notice.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.notice.entity.NoticeCommentEntity; +import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; +import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 小组通知评论表 * @@ -29,5 +33,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface NoticeCommentDao extends BaseDao { - + + /** + * @Author sun + * @Description 分页查询通知评论列表 + **/ + List getNoticeCommentList(NoticeCommentListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java index 2cab9440db..4ee6056a2b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java @@ -20,6 +20,7 @@ package com.epmet.modules.notice.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.notice.entity.NoticeEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 小组通知表 @@ -29,5 +30,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface NoticeDao extends BaseDao { - + + /** + * @Author sun + * @Description 查询通知对应的小组的组长Id + **/ + String selectNoticeGroupLeader(@Param("noticeId") String noticeId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java similarity index 72% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java index 9e767ed133..2375b63db6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java @@ -18,8 +18,8 @@ package com.epmet.modules.notice.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.modules.notice.entity.NoticeReafdRecordEntity; -import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO; +import com.epmet.modules.notice.entity.NoticeReadRecordEntity; +import com.epmet.resi.group.dto.notice.NoticeReadRecordDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -32,7 +32,7 @@ import java.util.List; * @since v1.0.0 2021-04-19 */ @Mapper -public interface NoticeReafdRecordDao extends BaseDao { +public interface NoticeReadRecordDao extends BaseDao { /** * @Author sun @@ -44,5 +44,11 @@ public interface NoticeReafdRecordDao extends BaseDao { * @Author sun * @Description 根据通知Id查询组成员已读未读数据 **/ - List getByNoticeId(@Param("noticeId") String noticeId); + List getByNoticeId(@Param("noticeId") String noticeId); + + /** + * @Author sun + * @Description 查询当前人员是否存在对通知已读未读数据 + **/ + NoticeReadRecordEntity selectByNoticeId(@Param("noticeId") String noticeId, @Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReafdRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReadRecordEntity.java similarity index 96% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReafdRecordEntity.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReadRecordEntity.java index e9a63804a1..0f1498b243 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReafdRecordEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReadRecordEntity.java @@ -34,7 +34,7 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper=false) @TableName("notice_reafd_record") -public class NoticeReafdRecordEntity extends BaseEpmetEntity { +public class NoticeReadRecordEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReafdRecordExcel.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReadRecordExcel.java similarity index 97% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReafdRecordExcel.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReadRecordExcel.java index 8f005770cd..3f58dbdef8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReafdRecordExcel.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReadRecordExcel.java @@ -29,7 +29,7 @@ import java.util.Date; * @since v1.0.0 2021-04-19 */ @Data -public class NoticeReafdRecordExcel { +public class NoticeReadRecordExcel { @Excel(name = "主键") private String id; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReafdRecordRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReadRecordRedis.java similarity index 96% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReafdRecordRedis.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReadRecordRedis.java index dc20469216..c45eff7e15 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReafdRecordRedis.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReadRecordRedis.java @@ -28,7 +28,7 @@ import org.springframework.stereotype.Component; * @since v1.0.0 2021-04-19 */ @Component -public class NoticeReafdRecordRedis { +public class NoticeReadRecordRedis { @Autowired private RedisUtils redisUtils; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java index 0204df5cc9..50b3beaa9d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java @@ -19,8 +19,12 @@ package com.epmet.modules.notice.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.modules.notice.entity.NoticeCommentEntity; import com.epmet.resi.group.dto.notice.NoticeCommentDTO; +import com.epmet.resi.group.dto.notice.form.NoticeCommentFormDTO; +import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; +import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO; import java.util.List; import java.util.Map; @@ -92,4 +96,20 @@ public interface NoticeCommentService extends BaseService { * @date 2021-04-19 */ void delete(String[] ids); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 发布通知评论 + **/ + void noticeComment(TokenDto tokenDto, NoticeCommentFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 通知评论列表查询 + **/ + List noticeCommentList(TokenDto tokenDto, NoticeCommentListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java similarity index 76% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java index c142fefcdc..f4d048055f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java @@ -20,9 +20,10 @@ package com.epmet.modules.notice.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.modules.notice.entity.NoticeReafdRecordEntity; -import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO; +import com.epmet.modules.notice.entity.NoticeReadRecordEntity; +import com.epmet.resi.group.dto.notice.NoticeReadRecordDTO; import com.epmet.resi.group.dto.notice.form.NoticeReadListFormDTO; +import com.epmet.resi.group.dto.notice.form.ReadTypeFormDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; import java.util.List; @@ -34,7 +35,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2021-04-19 */ -public interface NoticeReafdRecordService extends BaseService { +public interface NoticeReadRecordService extends BaseService { /** * 默认分页 @@ -44,7 +45,7 @@ public interface NoticeReafdRecordService extends BaseService page(Map params); + PageData page(Map params); /** * 默认查询 @@ -54,7 +55,7 @@ public interface NoticeReafdRecordService extends BaseService list(Map params); + List list(Map params); /** * 单条查询 @@ -64,7 +65,7 @@ public interface NoticeReafdRecordService extends BaseService implements NoticeCommentService { - + private final Log logger = LogFactory.getLog(getClass()); @Autowired private NoticeCommentRedis noticeCommentRedis; + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; + @Autowired + private NoticeService noticeService; + @Autowired + private ResiGroupMemberService resiGroupMemberService; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Override public PageData page(Map params) { @@ -65,8 +100,8 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -101,4 +136,105 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + logger.error(String.format(TopicConstant.REVIEW_TOPIC, commentContent)); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + } + + //2.判断当前用户是否被禁言、移除、非本组成员 + NoticeDTO notice = noticeService.get(formDTO.getNoticeId()); + if (null == notice) { + logger.error(ModuleConstant.NO_SUCH_TOPIC); + throw new RenException(ModuleConstant.NO_SUCH_TOPIC); + } + + ResiGroupMemberDTO resiGroupMemberDTO = + resiGroupMemberService.getResiGroupMember(notice.getGroupId(), tokenDto.getUserId()); + //查看当前用户是否被禁言或者被移除 + if (null != resiGroupMemberDTO) { + if (MemberStateConstant.SILENT.equals(resiGroupMemberDTO.getStatus())) { + //当前用户被禁言 + logger.error(ModuleConstant.SLIENT_MEMBER); + throw new RenException(ModuleConstant.SLIENT_MEMBER); + } else if (MemberStateConstant.REMOVED.equals(resiGroupMemberDTO.getStatus())) { + //当前用户已被移出群 + logger.error(ModuleConstant.REMOVED_MEMBER); + throw new RenException(ModuleConstant.REMOVED_MEMBER); + } + } else { + //当前用户非组内成员 + logger.error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP); + throw new RenException(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP); + } + + //3.通知评论表新增数据 + NoticeCommentEntity entity = new NoticeCommentEntity(); + entity.setCustomerId(notice.getCustomerId()); + entity.setNoticeId(formDTO.getNoticeId()); + entity.setCommentContent(formDTO.getCommentContent()); + insert(entity); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 通知评论列表查询 + **/ + @Override + public List noticeCommentList(TokenDto tokenDto, NoticeCommentListFormDTO formDTO) { + //1.分页查询通知评论列表 + formDTO.setPageNo((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize()); + List resultList = baseDao.getNoticeCommentList(formDTO); + if (resultList.size() < NumConstant.ONE) { + return new ArrayList<>(); + } + + //2.调用user服务,查询评论人员基础信息 + List userIdList = resultList.stream().map(NoticeCommentListResultDTO::getUserId).collect(Collectors.toList()); + Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!result.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + List resultDTOList = result.getData(); + + //3.封装数据并返回 + resultList.forEach(l -> { + StringBuffer name = new StringBuffer(); + resultDTOList.forEach(user -> { + if (l.getUserId().equals(user.getUserId())) { + name.append(null == user.getSurname() ? "" : user.getSurname()).append(null == user.getName() ? "" : user.getName()); + l.setCommentUserHeadPhoto(user.getHeadImgUrl()); + } + }); + l.setCommentUserName(name.toString()); + }); + + return resultList; + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java similarity index 58% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java index 11507e85ba..ab5182fbbb 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java @@ -26,14 +26,18 @@ import com.epmet.commons.tools.page.PageData; 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.constant.ReadFlagConstant; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.modules.notice.dao.NoticeReafdRecordDao; -import com.epmet.modules.notice.entity.NoticeReafdRecordEntity; -import com.epmet.modules.notice.redis.NoticeReafdRecordRedis; -import com.epmet.modules.notice.service.NoticeReafdRecordService; -import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO; +import com.epmet.modules.notice.dao.NoticeDao; +import com.epmet.modules.notice.dao.NoticeReadRecordDao; +import com.epmet.modules.notice.entity.NoticeEntity; +import com.epmet.modules.notice.entity.NoticeReadRecordEntity; +import com.epmet.modules.notice.redis.NoticeReadRecordRedis; +import com.epmet.modules.notice.service.NoticeReadRecordService; +import com.epmet.resi.group.dto.notice.NoticeReadRecordDTO; import com.epmet.resi.group.dto.notice.form.NoticeReadListFormDTO; +import com.epmet.resi.group.dto.notice.form.ReadTypeFormDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -44,7 +48,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; /** @@ -54,55 +57,57 @@ import java.util.stream.Collectors; * @since v1.0.0 2021-04-19 */ @Service -public class NoticeReafdRecordServiceImpl extends BaseServiceImpl implements NoticeReafdRecordService { +public class NoticeReadRecordServiceImpl extends BaseServiceImpl implements NoticeReadRecordService { @Autowired - private NoticeReafdRecordRedis noticeReafdRecordRedis; + private NoticeReadRecordRedis noticeReafdRecordRedis; @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private NoticeDao noticeDao; @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( + public PageData page(Map params) { + IPage page = baseDao.selectPage( getPage(params, FieldConstant.CREATED_TIME, false), getWrapper(params) ); - return getPageData(page, NoticeReafdRecordDTO.class); + return getPageData(page, NoticeReadRecordDTO.class); } @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); - return ConvertUtils.sourceToTarget(entityList, NoticeReafdRecordDTO.class); + return ConvertUtils.sourceToTarget(entityList, NoticeReadRecordDTO.class); } - private QueryWrapper getWrapper(Map params){ + private QueryWrapper getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); - QueryWrapper wrapper = new QueryWrapper<>(); + QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); return wrapper; } @Override - public NoticeReafdRecordDTO get(String id) { - NoticeReafdRecordEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, NoticeReafdRecordDTO.class); + public NoticeReadRecordDTO get(String id) { + NoticeReadRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, NoticeReadRecordDTO.class); } @Override @Transactional(rollbackFor = Exception.class) - public void save(NoticeReafdRecordDTO dto) { - NoticeReafdRecordEntity entity = ConvertUtils.sourceToTarget(dto, NoticeReafdRecordEntity.class); + public void save(NoticeReadRecordDTO dto) { + NoticeReadRecordEntity entity = ConvertUtils.sourceToTarget(dto, NoticeReadRecordEntity.class); insert(entity); } @Override @Transactional(rollbackFor = Exception.class) - public void update(NoticeReafdRecordDTO dto) { - NoticeReafdRecordEntity entity = ConvertUtils.sourceToTarget(dto, NoticeReafdRecordEntity.class); + public void update(NoticeReadRecordDTO dto) { + NoticeReadRecordEntity entity = ConvertUtils.sourceToTarget(dto, NoticeReadRecordEntity.class); updateById(entity); } @@ -124,11 +129,14 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl readList = new ArrayList<>(); List unReadList = new ArrayList<>(); + //0.查询通知对应的小组的组长Id + String leaderId = noticeDao.selectNoticeGroupLeader(formDTO.getNoticeId()); + //1.根据通知Id查询组成员已读未读数据 - List list = baseDao.getByNoticeId(formDTO.getNoticeId()); + List list = baseDao.getByNoticeId(formDTO.getNoticeId()); //2.调用user服务,查询人员基础数据 - List userIdList = list.stream().map(NoticeReafdRecordDTO::getUserId).collect(Collectors.toList()); + List userIdList = list.stream().map(NoticeReadRecordDTO::getUserId).collect(Collectors.toList()); Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); if (!result.success()){ throw new RenException("调用user服务,获取用户基础数据失败"); @@ -167,4 +175,39 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl @Autowired private NoticeAttachmentDao noticeAttachmentDao; @Autowired - private NoticeReafdRecordService noticeReafdRecordService; + private NoticeReadRecordService noticeReafdRecordService; @Autowired - private NoticeReafdRecordDao noticeReafdRecordDao; + private NoticeReadRecordDao noticeReafdRecordDao; @Override @@ -273,18 +272,20 @@ public class NoticeServiceImpl extends BaseServiceImpl } //6.通知已读未读表初始数据 - List reafdRecordList = new ArrayList<>(); + List reafdRecordList = new ArrayList<>(); memberList.forEach(m -> { - if (!"".equals(m.getGroupLeaderFlag())) { - NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); - reafdRecord.setCustomerId(resultDTO.getCustomerId()); - reafdRecord.setGridId(groupEntity.getGridId()); - reafdRecord.setGroupId(formDTO.getGroupId()); - reafdRecord.setNoticeId(entity.getId()); - reafdRecord.setUserId(m.getCustomerUserId()); + NoticeReadRecordEntity reafdRecord = new NoticeReadRecordEntity(); + reafdRecord.setCustomerId(resultDTO.getCustomerId()); + reafdRecord.setGridId(groupEntity.getGridId()); + reafdRecord.setGroupId(formDTO.getGroupId()); + reafdRecord.setNoticeId(entity.getId()); + reafdRecord.setUserId(m.getCustomerUserId()); + if ("leader".equals(m.getGroupLeaderFlag())) { + reafdRecord.setReadFlag(ReadFlagConstant.READ); + }else { reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); - reafdRecordList.add(reafdRecord); } + reafdRecordList.add(reafdRecord); }); if (reafdRecordList.size() > NumConstant.ZERO) { noticeReafdRecordService.insertBatch(reafdRecordList); @@ -392,18 +393,20 @@ public class NoticeServiceImpl extends BaseServiceImpl //6.通知已读未读消息表数据先删后增 noticeReafdRecordDao.delByNoticeId(formDTO.getNoticeId()); - List reafdRecordList = new ArrayList<>(); + List reafdRecordList = new ArrayList<>(); memberList.forEach(m -> { - if (!"".equals(m.getGroupLeaderFlag())) { - NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); - reafdRecord.setCustomerId(entity.getCustomerId()); - reafdRecord.setGridId(entity.getGridId()); - reafdRecord.setGroupId(entity.getGroupId()); - reafdRecord.setNoticeId(entity.getId()); - reafdRecord.setUserId(m.getCustomerUserId()); + NoticeReadRecordEntity reafdRecord = new NoticeReadRecordEntity(); + reafdRecord.setCustomerId(entity.getCustomerId()); + reafdRecord.setGridId(entity.getGridId()); + reafdRecord.setGroupId(entity.getGroupId()); + reafdRecord.setNoticeId(entity.getId()); + reafdRecord.setUserId(m.getCustomerUserId()); + if ("leader".equals(m.getGroupLeaderFlag())) { + reafdRecord.setReadFlag(ReadFlagConstant.READ); + }else { reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); - reafdRecordList.add(reafdRecord); } + reafdRecordList.add(reafdRecord); }); if (reafdRecordList.size() > NumConstant.ZERO) { noticeReafdRecordService.insertBatch(reafdRecordList); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java index 419f927f83..4e824c18ef 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java @@ -441,4 +441,18 @@ public class ResiTopicController { } return new Result<>(); } + + /** + * @Description 查询组内近十条数据 + * @Param tokenDto + * @Param formDTO + * @author zxc + * @date 2021/4/20 下午2:34 + */ + @PostMapping("getlatestv2") + public Result getLatestV2(@LoginUser TokenDto tokenDto,@RequestBody GetLatestV2FormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GetLatestV2FormDTO.GetLatestV2Form.class); + formDTO.setUserId(tokenDto.getUserId()); + return new Result().ok(topicService.getLatestV2(formDTO)); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java index 822b4c631a..27f9142337 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java @@ -354,4 +354,13 @@ public interface ResiTopicService extends BaseService { ResiTopicDTO queryTopicInfoByIssueId(String issueId); + + /** + * @Description 查询组内近十条数据 + * @Param tokenDto + * @Param formDTO + * @author zxc + * @date 2021/4/20 下午2:34 + */ + GetLatestV2ResultDTO getLatestV2(GetLatestV2FormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 319ef385b4..8224c34c33 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -2183,6 +2183,18 @@ public class ResiTopicServiceImpl extends BaseServiceImpl - + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml index aa2a3e7679..46f3194d11 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml @@ -3,6 +3,19 @@ - + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml index 9f55748033..2e1b70570d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml @@ -2,9 +2,33 @@ + + delete from act_read_record where GROUP_ACT_ID=#{groupActId} + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInCodeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInCodeDao.xml index 21072b30c4..a2bcffeb71 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInCodeDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInCodeDao.xml @@ -2,7 +2,14 @@ - + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInRecordDao.xml index cc6b2a0261..1c5179723f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInRecordDao.xml @@ -3,6 +3,27 @@ + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml index 7152cf67eb..b835f36889 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml @@ -2,7 +2,7 @@ - + UPDATE group_act_content SET DEL_FLAG = '1', @@ -12,4 +12,17 @@ GROUP_ACT_ID = #{groupActId} + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml index 7d1ea0a898..fc8a6280f1 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml @@ -527,4 +527,27 @@ GROUP BY temp.gridId + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupSetupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupSetupDao.xml new file mode 100644 index 0000000000..0c883e6bff --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupSetupDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml index 90c7baed49..a5612ddcbf 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml @@ -3,5 +3,20 @@ + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml index 7f7dc8e127..332dfa0b5c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml @@ -3,5 +3,19 @@ + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReafdRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml similarity index 56% rename from epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReafdRecordDao.xml rename to epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml index 2d0a934811..74b99c2e1b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReafdRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml @@ -1,9 +1,9 @@ - + - SELECT * FROM @@ -13,6 +13,17 @@ AND notice_id = #{noticeId} + + DELETE FROM