diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActSummaryContentDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActSummaryContentDTO.java index eca0cc8fc2..1696ac3555 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActSummaryContentDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActSummaryContentDTO.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,11 @@ public class ActSummaryContentDTO implements Serializable { */ private String customerId; + /** + * act_summary.id + */ + private String actSummaryId; + /** * group_act_info.id */ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActSummaryDetailFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActSummaryDetailFormDTO.java new file mode 100644 index 0000000000..2bab9daf98 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActSummaryDetailFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 014、查看活动总结详情 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/21 14:14 + */ +@Data +public class ActSummaryDetailFormDTO implements Serializable { + private static final long serialVersionUID = 3937952227893070145L; + + public interface AddUserInternalGroup { + } + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + + /** + * 当前用户id + */ + @NotBlank(message = "tokenDto获取userId为空", groups = ActReadViewFormDTO.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/ActSummaryFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActSummaryFormDTO.java new file mode 100644 index 0000000000..a48606b4df --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActSummaryFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.resi.group.dto.act.form; + +import com.epmet.resi.group.dto.topic.form.FileDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 013、提交活动总结 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/21 12:58 + */ +@Data +public class ActSummaryFormDTO implements Serializable { + private static final long serialVersionUID = 6068480003626532767L; + + public interface AddUserInternalGroup { + } + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + + /** + * 补充内容,限制1000字, + */ + private List textList; + + /** + * 补充图片列表 + */ + private List imgList; + + + /** + * 当前用户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/PublishGroupActFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/PublishGroupActFormDTO.java index bef66ba14b..276bcebd0f 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/PublishGroupActFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/PublishGroupActFormDTO.java @@ -1,6 +1,7 @@ package com.epmet.resi.group.dto.act.form; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.epmet.resi.group.dto.topic.form.FileDTO; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -98,7 +99,7 @@ public class PublishGroupActFormDTO implements Serializable { /** * 图片列表,最多3张 */ - private List imgList; + private List imgList; private String gridId; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActSummaryDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActSummaryDetailResultDTO.java new file mode 100644 index 0000000000..6d1887208e --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActSummaryDetailResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.resi.group.dto.act.result; + +import lombok.Data; + +import java.util.List; + +/** + * 014、查看活动总结详情 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/21 14:17 + */ +@Data +public class ActSummaryDetailResultDTO extends ActSummaryTemplateResultDTO{ + private static final long serialVersionUID = -6918035750154831223L; + + + /** + * 活动总结id + */ + private String actSummaryId; + + /** + * 补充内容列表 + */ + private List extraTextList; + + /** + * 补充图片列表 + */ + private List extraImgList; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActSummaryTemplateResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActSummaryTemplateResultDTO.java index dbfa28b178..5f3a176fa0 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActSummaryTemplateResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActSummaryTemplateResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.resi.group.dto.act.result; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; @@ -14,16 +15,65 @@ import java.util.List; */ @Data public class ActSummaryTemplateResultDTO implements Serializable { + + /** + * 小组活动id + */ private String groupActId; + + /** + * 活动标题 + */ private String title; + + /** + * 标签名称: 支部建设-三会一课 + */ private String allCategoryName; + + /** + * 活动时间:yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date startTime; + + /** + * 活动地点 + */ private String address; + + /** + * 应参加人数 + */ private Integer shouldAttend; + + /** + * 已签到人数 + */ private Integer signedInNum; + + /** + * 签到人员名单,、分隔开 + */ private String signedInUsers; + + /** + * 活动内容 + */ private List textList; + + /** + * 活动图片 + */ private List imgList; + + /** + * 是否填写总结:1:已填写;0:未填写 + */ private Integer summaryFlag; + + /** + * 签到用户id + */ private List signedInUserIds; } 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 index 32d4164244..232d6b647e 100644 --- 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 @@ -23,12 +23,17 @@ public class AllGroupListFormDTO implements Serializable { * 请求页码 */ @Min(1) - private int pageNo; + private int pageNo = 1; /** * 每页多少条数据 */ private int pageSize = 20; + /** + * token中用户Id + */ + private String userId; + public interface GroupList { } } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/UserReadFlagResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/UserReadFlagResultDTO.java new file mode 100644 index 0000000000..aec2c9f63f --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/UserReadFlagResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/21 上午9:43 + * @DESC + */ +@Data +public class UserReadFlagResultDTO implements Serializable { + + private static final long serialVersionUID = -5727870985731706332L; + + /** + * 活动,通知 ID + */ + private String id; + + private String userId; + + /** + * 阅读状态,read:已读,un_read:未读 + */ + private String readFlag; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/UserUnReadResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/UserUnReadResultDTO.java new file mode 100644 index 0000000000..cf602385ea --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/UserUnReadResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/21 上午9:43 + * @DESC + */ +@Data +public class UserUnReadResultDTO implements Serializable { + + private static final long serialVersionUID = -5727870085731706332L; + + /** + * 活动,通知 ID + */ + private String id; + + /** + * 未读数量 + */ + private Integer unRead; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java index d9345790fe..2344e94898 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java @@ -1,7 +1,6 @@ package com.epmet.resi.group.dto.notice.form; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; -import com.epmet.resi.group.dto.topic.form.FileDTO; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -35,12 +34,19 @@ public class AddNoticeFormDTO { /** * 图片附件集合 */ - private List imageList; + private List imageList; /** * 文件附件url集合 */ - private List docList; + private List docList; + + /** + * token中用户Id + */ + private String userId; public interface Add{} public interface AddUserShow extends CustomerClientShowGroup {} + + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java index 08573cae19..940077459f 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java @@ -1,7 +1,6 @@ package com.epmet.resi.group.dto.notice.form; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; -import com.epmet.resi.group.dto.topic.form.FileDTO; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -23,22 +22,30 @@ public class EditNoticeFormDTO { /** * 通知标题 */ + @NotBlank(message = "通知标题不能为空",groups = {EditNoticeFormDTO.EditUserShow.class}) @Length(max = 20, message = "通知标题不能超过20个字符",groups = {EditNoticeFormDTO.EditUserShow.class}) private String title; /** * 通知内容 */ + @NotBlank(message = "通知内容不能为空",groups = {EditNoticeFormDTO.EditUserShow.class}) @Length(max = 1000, message = "通知内容不能超过1000个字符",groups = {EditNoticeFormDTO.EditUserShow.class}) private String content; /** * 图片附件集合 */ - private List imageList; + private List imageList; /** * 文件附件url集合 */ - private List docList; + private List docList; + + /** + * token中用户Id + */ + private String userId; public interface Edit{} public interface EditUserShow extends CustomerClientShowGroup {} + } 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 index 5fc28f52ef..c543bf7222 100644 --- 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 @@ -25,6 +25,11 @@ public class NoticeCommentFormDTO { @Length(max = 20, message = "评论内容不能超过300个字符",groups = {NoticeCommentFormDTO.UserShow.class}) private String commentContent; + /** + * token中用户Id + */ + private String userId; + public interface Comment{} public interface UserShow extends CustomerClientShowGroup {} } 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 index 960ba374e5..8d9ad97476 100644 --- 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 @@ -23,7 +23,7 @@ public class NoticeCommentListFormDTO implements Serializable { * 请求页码 * */ @Min(1) - private int pageNo; + private int pageNo = 1; /** * 每页多少条数据 * */ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeFileDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeFileDTO.java new file mode 100644 index 0000000000..a71ac3d509 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeFileDTO.java @@ -0,0 +1,23 @@ +package com.epmet.resi.group.dto.notice.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 小组通知保存、变更-接口入参 + */ +@NoArgsConstructor +@Data +public class NoticeFileDTO implements Serializable { + + private static final long serialVersionUID = -3930520724652521552L; + private String name; + private String url; + private String type; + private String format; + private Integer size; + private Integer duration; +} 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 index f3170ebc9b..6477c87fb8 100644 --- 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 @@ -17,5 +17,10 @@ public class ReadTypeFormDTO { @NotBlank(message = "通知Id不能为空",groups = {ReadTypeFormDTO.Read.class}) private String noticeId; + /** + * token中用户Id + */ + private String userId; + public interface Read{} } 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 index ee37afd1bf..5a5e707f73 100644 --- 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 @@ -26,19 +26,19 @@ public class GetLatestV2ResultDTO implements Serializable { private String groupType; /** - * 是否显示通知按钮 + * 是否显示通知按钮(当前人员是否为组长) */ - private String noticeBut; + private Boolean noticeBut = false; /** - * 是否显示活动按钮 + * 是否显示活动按钮(当前组为支部组且当前人是组长) */ - private String actBut; + private Boolean actBut = false; /** * 是否存在未读消息 */ - private Boolean unReadNews; + private Boolean unReadNews = false; /** * 近十条数据 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 index 0f8d7c3222..e5346ab703 100644 --- 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 @@ -38,7 +38,7 @@ public class LatestTenResultDTO implements Serializable { /** * 发布时间yyyy-MM-dd HH:mm */ - private String releaseTimed; + private String releaseTime; /** * 内容 @@ -53,7 +53,7 @@ public class LatestTenResultDTO implements Serializable { /** * 是否本人 */ - private String releaseUserFlag; + private Boolean releaseUserFlag; /** * 如果有图片,后台只返回第一张,没有图片此列为空 @@ -90,10 +90,10 @@ public class LatestTenResultDTO implements Serializable { this.userId = ""; this.releaseUserName = ""; this.releaseUserHeadPhoto = ""; - this.releaseTimed = ""; + this.releaseTime = ""; this.content = ""; this.status = ""; - this.releaseUserFlag = ""; + this.releaseUserFlag = false; this.firstPhoto = ""; this.issueId = ""; this.shiftIssueFlag = false; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSummaryController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSummaryController.java index 01bcde1ed5..dd12563508 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSummaryController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSummaryController.java @@ -17,10 +17,16 @@ 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.ActSummaryService; +import com.epmet.resi.group.dto.act.GroupActIdDTO; +import com.epmet.resi.group.dto.act.form.ActSummaryDetailFormDTO; +import com.epmet.resi.group.dto.act.form.ActSummaryFormDTO; import com.epmet.resi.group.dto.act.form.InitTemplateFormDTO; +import com.epmet.resi.group.dto.act.result.ActSummaryDetailResultDTO; import com.epmet.resi.group.dto.act.result.ActSummaryTemplateResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -54,4 +60,33 @@ public class ActSummaryController { ValidatorUtils.validateEntity(formDTO, InitTemplateFormDTO.AddUserInternalGroup.class); return new Result().ok(actSummaryService.initTemplate(formDTO)); } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 013、提交活动总结 + * @Date 2021/4/21 13:06 + **/ + @PostMapping("submit") + public Result submitActSummary(@LoginUser TokenDto tokenDto, @RequestBody ActSummaryFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, ActSummaryFormDTO.AddUserInternalGroup.class); + return new Result().ok(actSummaryService.submitActSummary(formDTO)); + } + + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 014、查看活动总结详情 + * @Date 2021/4/21 14:20 + **/ + @PostMapping("detail") + public Result queryActSummaryDetail(@LoginUser TokenDto tokenDto,@RequestBody ActSummaryDetailFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, ActSummaryFormDTO.AddUserInternalGroup.class); + return new Result().ok(actSummaryService.queryActSummaryDetail(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/ActSummaryContentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSummaryContentDao.java index 146c31c225..78e8b2cb68 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSummaryContentDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSummaryContentDao.java @@ -20,6 +20,9 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.ActSummaryContentEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 活动总结内容 @@ -29,5 +32,16 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActSummaryContentDao extends BaseDao { - + + /** + * 查询总结补充内容 + * + * @param groupActId + * @param actSummaryId + * @param contentType + * @return + */ + List selectContentList(@Param("actSummaryId")String actSummaryId, + @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/dao/ActSummaryDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSummaryDao.java index 315c124d3f..51478340a0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSummaryDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSummaryDao.java @@ -20,6 +20,7 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.ActSummaryEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 活动总结 @@ -29,5 +30,7 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActSummaryDao extends BaseDao { - + + + ActSummaryEntity selectUserSummary(@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/entity/ActSummaryContentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActSummaryContentEntity.java index 74855472f6..98c19e2d02 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActSummaryContentEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActSummaryContentEntity.java @@ -40,6 +40,11 @@ public class ActSummaryContentEntity extends BaseEpmetEntity { */ private String customerId; + /** + * act_summary.id + */ + private String actSummaryId; + /** * group_act_info.id */ diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSummaryService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSummaryService.java index e2665a6a8a..815ebad816 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSummaryService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSummaryService.java @@ -19,7 +19,11 @@ package com.epmet.modules.act.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.ActSummaryEntity; +import com.epmet.resi.group.dto.act.GroupActIdDTO; +import com.epmet.resi.group.dto.act.form.ActSummaryDetailFormDTO; +import com.epmet.resi.group.dto.act.form.ActSummaryFormDTO; import com.epmet.resi.group.dto.act.form.InitTemplateFormDTO; +import com.epmet.resi.group.dto.act.result.ActSummaryDetailResultDTO; import com.epmet.resi.group.dto.act.result.ActSummaryTemplateResultDTO; /** @@ -37,4 +41,22 @@ public interface ActSummaryService extends BaseService { * @return com.epmet.resi.group.dto.act.result.ActSummaryTemplateResultDTO */ ActSummaryTemplateResultDTO initTemplate(InitTemplateFormDTO formDTO); + + + /** + * 013、提交活动总结 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.GroupActIdDTO + */ + GroupActIdDTO submitActSummary(ActSummaryFormDTO formDTO); + + + /** + * 014、查看活动总结详情 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.ActSummaryDetailResultDTO + */ + ActSummaryDetailResultDTO queryActSummaryDetail(ActSummaryDetailFormDTO 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/impl/ActSummaryServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSummaryServiceImpl.java index ab3ee238d0..e5537fe340 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSummaryServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSummaryServiceImpl.java @@ -17,30 +17,48 @@ package com.epmet.modules.act.service.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.scan.param.ImgScanParamDTO; +import com.epmet.commons.tools.scan.param.ImgTaskDTO; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.modules.act.dao.ActSignInRecordDao; -import com.epmet.modules.act.dao.ActSummaryDao; -import com.epmet.modules.act.dao.GroupActContentDao; -import com.epmet.modules.act.dao.GroupActInfoDao; +import com.epmet.modules.act.dao.*; +import com.epmet.modules.act.entity.ActSummaryContentEntity; import com.epmet.modules.act.entity.ActSummaryEntity; import com.epmet.modules.act.entity.GroupActInfoEntity; import com.epmet.modules.act.service.ActSummaryService; import com.epmet.modules.constant.GroupActConstant; +import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.resi.group.dto.act.GroupActIdDTO; +import com.epmet.resi.group.dto.act.form.ActSummaryDetailFormDTO; +import com.epmet.resi.group.dto.act.form.ActSummaryFormDTO; import com.epmet.resi.group.dto.act.form.InitTemplateFormDTO; +import com.epmet.resi.group.dto.act.result.ActSummaryDetailResultDTO; import com.epmet.resi.group.dto.act.result.ActSummaryTemplateResultDTO; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import com.epmet.resi.group.dto.topic.form.FileDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; +import java.util.UUID; /** * 活动总结 @@ -51,6 +69,13 @@ import java.util.List; @Slf4j @Service public class ActSummaryServiceImpl extends BaseServiceImpl implements ActSummaryService { + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; + @Value("${openapi.scan.method.imgSyncScan}") + private String imgSyncScanMethod; + @Autowired private GroupActInfoDao groupActInfoDao; @Autowired @@ -59,6 +84,11 @@ public class ActSummaryServiceImpl extends BaseServiceImpl signedInUserIds=actSignInRecordDao.selectUserIds(formDTO.getGroupActId()); + resultDTO.setImgList(groupActContentDao.selectContentList(formDTO.getGroupActId(), GroupActConstant.IMG)); + + //签到人员姓名集合 + List signedInUserIds = actSignInRecordDao.selectUserIds(formDTO.getGroupActId()); resultDTO.setSignedInUserIds(signedInUserIds); - if(CollectionUtils.isNotEmpty(signedInUserIds)){ - Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(signedInUserIds); - if (!result.success()) { + List signedInUsers = querySignedInUsers(signedInUserIds); + resultDTO.setSignedInUsers(StringUtils.strip(signedInUsers.toString(), "[]").replace(", ", StrConstant.COMMA_ZH)); + + resultDTO.setGroupActId(formDTO.getGroupActId()); + return resultDTO; + } + + + /** + * 013、提交活动总结 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.GroupActIdDTO + */ + @Transactional(rollbackFor = Exception.class) + @Override + public GroupActIdDTO submitActSummary(ActSummaryFormDTO formDTO) { + GroupActIdDTO result = new GroupActIdDTO(); + result.setGroupActId(formDTO.getGroupActId()); + //已经提交,无需重复提交 + GroupActInfoEntity groupActInfoEntity = groupActInfoDao.selectById(formDTO.getGroupActId()); + if (null == groupActInfoEntity) { + throw new RenException(String.format("根据groupActId:%s,查询活动信息为null", formDTO.getGroupActId())); + } + if (groupActInfoEntity.getSummaryFlag() == NumConstant.ONE) { + log.warn("已填写活动总结,无需重复提交"); + return result; + } + checkActSummaryFormDTO(formDTO, groupActInfoEntity.getGroupId()); + + + //插入总结主表 + ActSummaryEntity insertEntity = new ActSummaryEntity(); + insertEntity.setCustomerId(groupActInfoEntity.getCustomerId()); + insertEntity.setGroupActId(formDTO.getGroupActId()); + insertEntity.setShouldAttend(groupActInfoEntity.getShouldAttend()); + insertEntity.setUserId(formDTO.getUserId()); + + //签到人员姓名集合 + List signedInUserIds = actSignInRecordDao.selectUserIds(formDTO.getGroupActId()); + List signedInUsers = querySignedInUsers(signedInUserIds); + insertEntity.setSignedInUsers(StringUtils.strip(signedInUsers.toString(), "[]").replace(", ", StrConstant.COMMA_ZH)); + insertEntity.setSignedInNum(signedInUsers.size()); + baseDao.insert(insertEntity); + //插入补充内容表 + int textNum = NumConstant.ONE; + for (String content : formDTO.getTextList()) { + ActSummaryContentEntity insert = new ActSummaryContentEntity(); + insert.setCustomerId(groupActInfoEntity.getCustomerId()); + insert.setContent(content); + insert.setContentType(GroupActConstant.TEXT); + insert.setGroupActId(groupActInfoEntity.getId()); + insert.setSort(textNum); + insert.setActSummaryId(insertEntity.getId()); + actSummaryContentDao.insert(insert); + textNum++; + } + int imgNum = NumConstant.ONE; + for (FileDTO fileDTO : formDTO.getImgList()) { + ActSummaryContentEntity insert = new ActSummaryContentEntity(); + insert.setCustomerId(groupActInfoEntity.getCustomerId()); + insert.setContent(fileDTO.getUrl()); + insert.setContentType(GroupActConstant.IMG); + insert.setGroupActId(groupActInfoEntity.getId()); + insert.setSort(imgNum); + insert.setActSummaryId(insertEntity.getId()); + actSummaryContentDao.insert(insert); + imgNum++; + } + //更新总结标识 + groupActInfoEntity.setSummaryFlag(NumConstant.ONE); + groupActInfoDao.updateById(groupActInfoEntity); + return result; + } + + + private List querySignedInUsers(List signedInUserIds) { + List nameList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(signedInUserIds)) { + Result> userResult = epmetUserOpenFeignClient.queryUserBaseInfo(signedInUserIds); + if (!userResult.success()) { throw new RenException("调用user服务,获取用户基础数据失败"); } - result.getData().forEach(userBaseInfo->{ - resultDTO.setSignedInUsers(userBaseInfo.getSurname().concat(userBaseInfo.getName())); + for (String signedInUserId : signedInUserIds) { + for (UserBaseInfoResultDTO userBaseInfo : userResult.getData()) { + if (signedInUserId.equals(userBaseInfo.getUserId())) { + nameList.add(userBaseInfo.getSurname().concat(userBaseInfo.getName())); + break; + } + } + } + } + return nameList; + } + + private void checkActSummaryFormDTO(ActSummaryFormDTO formDTO, String groupId) { + //只有组长才可以填写活动总结 + ResiGroupMemberDTO groupMemberDTO = resiGroupMemberService.getLeaderMember(groupId); + 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()); + } + + if (!org.springframework.util.CollectionUtils.isEmpty(formDTO.getTextList())) { + //活动文本内容,目前只有一段,限制1000字 + if (formDTO.getTextList().get(NumConstant.ZERO).length() > 1000) { + throw new RenException(EpmetErrorCode.GROUP_ACT_CONTENT_MAX.getCode(), EpmetErrorCode.GROUP_ACT_CONTENT_MAX.getMsg()); + } + } + if (!org.springframework.util.CollectionUtils.isEmpty(formDTO.getImgList())) { + //最多选择3张图片 + if (formDTO.getImgList().size() > NumConstant.THREE) { + throw new RenException(EpmetErrorCode.GROUP_ACT_IMG_MAX.getCode(), EpmetErrorCode.GROUP_ACT_IMG_MAX.getMsg()); + } + } + + //内容审核 + //补充内容 + if (!org.springframework.util.CollectionUtils.isEmpty(formDTO.getTextList())) { + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + formDTO.getTextList().forEach(content -> { + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(content); + 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()) { + log.warn(String.format("补充内容审核失败【%s】", JSON.toJSONString(formDTO.getTextList()))); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); + } + } + } + //补充图片 + if (!org.springframework.util.CollectionUtils.isEmpty(formDTO.getImgList())) { + ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); + formDTO.getImgList().forEach(fileDTO -> { + ImgTaskDTO task = new ImgTaskDTO(); + task.setDataId(UUID.randomUUID().toString().replace("-", "")); + task.setUrl(fileDTO.getUrl()); + imgScanParamDTO.getTasks().add(task); }); - }else{ - resultDTO.setSignedInUserIds(new ArrayList<>()); - resultDTO.setSignedInUsers(StrConstant.EPMETY_STR); + Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); + if (!imgScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!imgScanResult.getData().isAllPass()) { + log.warn("补充图片审核失败"); + throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg()); + } + } } + } + + + /** + * 014、查看活动总结详情 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.ActSummaryDetailResultDTO + */ + @Override + public ActSummaryDetailResultDTO queryActSummaryDetail(ActSummaryDetailFormDTO formDTO) { + + GroupActInfoEntity groupActInfoEntity = groupActInfoDao.selectById(formDTO.getGroupActId()); + if (null == groupActInfoEntity) { + throw new RenException(String.format("根据groupActId:%s,查询活动信息为null", formDTO.getGroupActId())); + } + ActSummaryEntity actSummaryEntity = baseDao.selectUserSummary(formDTO.getGroupActId(),formDTO.getUserId()); + if (null == actSummaryEntity || groupActInfoEntity.getSummaryFlag() == NumConstant.ZERO) { + throw new RenException(String.format("根据groupActId:%s,查询活动总结信息为null", formDTO.getGroupActId())); + } + ActSummaryDetailResultDTO resultDTO = ConvertUtils.sourceToTarget(groupActInfoEntity, ActSummaryDetailResultDTO.class); + resultDTO.setTextList(groupActContentDao.selectContentList(formDTO.getGroupActId(), GroupActConstant.TEXT)); + resultDTO.setImgList(groupActContentDao.selectContentList(formDTO.getGroupActId(), GroupActConstant.IMG)); + resultDTO.setActSummaryId(actSummaryEntity.getId()); + resultDTO.setSignedInUsers(actSummaryEntity.getSignedInUsers()); + //按签到顺序 + resultDTO.setSignedInUserIds(actSignInRecordDao.selectUserIds(formDTO.getGroupActId())); + + resultDTO.setGroupActId(formDTO.getGroupActId()); + resultDTO.setExtraImgList(actSummaryContentDao.selectContentList(actSummaryEntity.getId(), formDTO.getGroupActId(), GroupActConstant.IMG)); + resultDTO.setExtraTextList(actSummaryContentDao.selectContentList(actSummaryEntity.getId(), formDTO.getGroupActId(), GroupActConstant.TEXT)); 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 6b8c29a263..d8feb925e4 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 @@ -66,6 +66,7 @@ import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.invitation.InvitationRecordDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; +import com.epmet.resi.group.dto.topic.form.FileDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -308,7 +309,7 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl textList, List imgList) { + private void scanActContent(String title, List textList, List imgList) { //活动标题 if (StringUtils.isNotBlank(title)) { TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); @@ -348,10 +349,10 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl { + imgList.forEach(fileDTO -> { ImgTaskDTO task = new ImgTaskDTO(); task.setDataId(UUID.randomUUID().toString().replace("-", "")); - task.setUrl(url); + task.setUrl(fileDTO.getUrl()); imgScanParamDTO.getTasks().add(task); }); Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); @@ -375,13 +376,13 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl constructImg(String groupActId, String customerId, List imgList) { + private List constructImg(String groupActId, String customerId, List imgList) { List list = new ArrayList<>(); int imgSort = NumConstant.ONE; - for (String img : imgList) { + for (FileDTO img : imgList) { GroupActContentEntity entity = new GroupActContentEntity(); entity.setGroupActId(groupActId); - entity.setContent(img); + entity.setContent(img.getUrl()); entity.setContentType(GroupActConstant.IMG); entity.setCustomerId(customerId); entity.setSort(imgSort); 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 3a632ae84b..9166995266 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,8 +31,6 @@ 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; @@ -508,7 +506,8 @@ public class ResiGroupController { @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)); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(resiGroupService.allGroupList(formDTO)); } } 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 7359f6d2a2..f30db7560e 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 @@ -24,6 +24,7 @@ import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import com.epmet.resi.group.dto.topic.result.LatestTenResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -242,4 +243,39 @@ public interface ResiGroupDao extends BaseDao { * @Description 分页查询网格下所有小组列表 **/ List selectAllGroupList(AllGroupListFormDTO formDTO); + + /** + * @Description 查询 话题、通知、活动最近10条数据 + * @Param groupId + * @author zxc + * @date 2021/4/20 下午4:14 + */ + List selectLatestTen(@Param("groupId")String groupId); + + /** + * @Description 查询此人在小组内未读数量 + * @Param groupId + * @Param userId + * @author zxc + * @date 2021/4/20 下午5:23 + */ + Integer selectUserUnRead(@Param("groupId")String groupId,@Param("userId")String userId); + + /** + * @Description 查询阅读状态 + * @Param groupId + * @Param userId + * @author zxc + * @date 2021/4/21 上午9:45 + */ + List selectUserReadFlag(@Param("groupId")String groupId,@Param("userIds")List userIds,@Param("ids")List ids); + + /** + * @Description 根据 活动或通知查询 未读人数 + * @Param groupId + * @Param ids + * @author zxc + * @date 2021/4/21 上午10:22 + */ + List selectUserUnReadById(@Param("groupId")String groupId,@Param("ids")List ids); } 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 a27d726fc8..c2073a7952 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,7 +20,6 @@ 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; @@ -378,5 +377,5 @@ public interface ResiGroupService extends BaseService { * @Author sun * @Description 所有小组查询 **/ - List allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO); + List allGroupList(AllGroupListFormDTO formDTO); } 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 6cc56ca171..5a54c45f06 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,7 +30,6 @@ 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; @@ -1500,7 +1499,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO) { + public List allGroupList(AllGroupListFormDTO formDTO) { //1.分页查询网格下所有小组列表且是审核通过状态的,以组内人员数从多到少排序 int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); formDTO.setPageNo(pageIndex); @@ -1511,7 +1510,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl> resultDTOList = epmetUserOpenFeignClient.getUserRoleInfoByUserId(tokenDto.getUserId()); + Result> resultDTOList = epmetUserOpenFeignClient.getUserRoleInfoByUserId(formDTO.getUserId()); if (!resultDTOList.success()) { throw new RenException("调用user服务,获取用户基础数据失败"); } @@ -1529,7 +1528,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl { * @Date 2021/4/19 13:54 **/ Integer selectCountMember(String groupId); + + /** + * @Description 查询此人组内身份 + * @Param groupId + * @Param userId + * @author zxc + * @date 2021/4/20 下午4:03 + */ + String selectUserRole(@Param("groupId")String groupId, @Param("userId")String userId); } 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 854f3c26a6..c3457db943 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 @@ -18,27 +18,20 @@ 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; 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.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.*; +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 javax.servlet.http.HttpServletResponse; import java.util.List; -import java.util.Map; /** @@ -64,7 +57,8 @@ public class NoticeCommentController { @PostMapping(value = "noticecomment") public Result noticeComment(@LoginUser TokenDto tokenDto, @RequestBody NoticeCommentFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, NoticeCommentFormDTO.Comment.class, NoticeCommentFormDTO.UserShow.class); - noticeCommentService.noticeComment(tokenDto, formDTO); + formDTO.setUserId(tokenDto.getUserId()); + noticeCommentService.noticeComment(formDTO); return new Result(); } @@ -75,9 +69,9 @@ public class NoticeCommentController { * @Description 通知评论列表查询 **/ @PostMapping(value = "noticecommentlist") - public Result> noticeCommentList(@LoginUser TokenDto tokenDto, @RequestBody NoticeCommentListFormDTO formDTO){ + public Result> noticeCommentList(@RequestBody NoticeCommentListFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, NoticeCommentListFormDTO.CommentList.class); - return new Result>().ok(noticeCommentService.noticeCommentList(tokenDto, formDTO)); + return new Result>().ok(noticeCommentService.noticeCommentList(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/NoticeController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java index 02d6bf79ec..ad2a0dd9dc 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java @@ -18,16 +18,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; 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.NoticeExcel; import com.epmet.modules.notice.service.NoticeService; import com.epmet.resi.group.dto.notice.NoticeDTO; import com.epmet.resi.group.dto.notice.form.AddNoticeFormDTO; @@ -37,10 +30,6 @@ import com.epmet.resi.group.dto.notice.result.NoticeDetailResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletResponse; -import java.util.List; -import java.util.Map; - /** * 小组通知表 @@ -70,7 +59,8 @@ public class NoticeController { @PostMapping(value = "add") public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddNoticeFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, AddNoticeFormDTO.Add.class, AddNoticeFormDTO.AddUserShow.class); - noticeService.add(tokenDto, formDTO); + formDTO.setUserId(tokenDto.getUserId()); + noticeService.add(formDTO); return new Result(); } @@ -83,7 +73,8 @@ public class NoticeController { @PostMapping(value = "edit") public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditNoticeFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, EditNoticeFormDTO.Edit.class, EditNoticeFormDTO.EditUserShow.class); - noticeService.edit(tokenDto, formDTO); + formDTO.setUserId(tokenDto.getUserId()); + noticeService.edit(formDTO); return new Result(); } @@ -94,9 +85,9 @@ public class NoticeController { * @Description 小组通知详情 **/ @PostMapping(value = "noticedetail") - public Result noticeDetail(@LoginUser TokenDto tokenDto, @RequestBody NoticeDetailFormDTO formDTO){ + public Result noticeDetail(@RequestBody NoticeDetailFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, NoticeDetailFormDTO.Detail.class); - return new Result().ok(noticeService.noticeDetail(tokenDto, formDTO)); + return new Result().ok(noticeService.noticeDetail(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/NoticeReadRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java index ca1dcf86b2..a4b992fd0f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java @@ -18,27 +18,18 @@ 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; 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.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.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; -import java.util.Map; +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; /** @@ -61,9 +52,9 @@ public class NoticeReadRecordController { * @Description 通知已读未读列表查询 **/ @PostMapping(value = "noticereadlist") - public Result noticeReadList(@LoginUser TokenDto tokenDto, @RequestBody NoticeReadListFormDTO formDTO){ + public Result noticeReadList(@RequestBody NoticeReadListFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, NoticeReadListFormDTO.List.class); - return new Result().ok(noticeReafdRecordService.noticeReadList(tokenDto, formDTO)); + return new Result().ok(noticeReafdRecordService.noticeReadList(formDTO)); } /** @@ -75,7 +66,8 @@ public class NoticeReadRecordController { @PostMapping(value = "readtype") public Result readType(@LoginUser TokenDto tokenDto, @RequestBody ReadTypeFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, ReadTypeFormDTO.Read.class); - noticeReafdRecordService.readType(tokenDto, formDTO); + formDTO.setUserId(tokenDto.getUserId()); + noticeReafdRecordService.readType(formDTO); return new Result(); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java index 2375b63db6..3842c4fd98 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java @@ -42,9 +42,9 @@ public interface NoticeReadRecordDao extends BaseDao { /** * @Author sun - * @Description 根据通知Id查询组成员已读未读数据 + * @Description 根据通知Id查询组成员已读未读数据,抛去组长数据 **/ - List getByNoticeId(@Param("noticeId") String noticeId); + List getByNoticeId(@Param("noticeId") String noticeId, @Param("leaderId") String leaderId); /** * @Author sun 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 6e3a82690d..0ac50c21e7 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 @@ -18,16 +18,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; /** * 小组通知评论表 @@ -43,7 +39,7 @@ public interface NoticeCommentService extends BaseService { * @Author sun * @Description 发布通知评论 **/ - void noticeComment(TokenDto tokenDto, NoticeCommentFormDTO formDTO); + void noticeComment(NoticeCommentFormDTO formDTO); /** * @param formDTO @@ -51,5 +47,5 @@ public interface NoticeCommentService extends BaseService { * @Author sun * @Description 通知评论列表查询 **/ - List noticeCommentList(TokenDto tokenDto, NoticeCommentListFormDTO formDTO); + List noticeCommentList(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/NoticeReadRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java index 17d41252c0..fd4a4d6d4b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java @@ -18,17 +18,11 @@ 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.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; -import java.util.Map; - /** * 小组通知组成员阅读记录表 * @@ -43,7 +37,7 @@ public interface NoticeReadRecordService extends BaseService { * @Author sun * @Description 小组通知保存 **/ - void add(TokenDto tokenDto, AddNoticeFormDTO formDTO); + void add(AddNoticeFormDTO formDTO); /** * @param formDTO @@ -62,7 +57,7 @@ public interface NoticeService extends BaseService { * @Author sun * @Description 小组通知变更 **/ - void edit(TokenDto tokenDto, EditNoticeFormDTO formDTO); + void edit(EditNoticeFormDTO formDTO); /** * @param formDTO @@ -70,5 +65,5 @@ public interface NoticeService extends BaseService { * @Author sun * @Description 小组通知详情 **/ - NoticeDetailResultDTO noticeDetail(TokenDto tokenDto, NoticeDetailFormDTO formDTO); + NoticeDetailResultDTO noticeDetail(NoticeDetailFormDTO 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/impl/NoticeCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java index 4bd79318c2..b4ee53de76 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java @@ -17,19 +17,13 @@ package com.epmet.modules.notice.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; 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.page.PageData; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; -import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.dto.result.UserBaseInfoResultDTO; @@ -43,9 +37,7 @@ import com.epmet.modules.notice.service.NoticeService; import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.constant.MemberStateConstant; import com.epmet.resi.group.constant.TopicConstant; -import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; -import com.epmet.resi.group.dto.notice.NoticeCommentDTO; import com.epmet.resi.group.dto.notice.NoticeDTO; import com.epmet.resi.group.dto.notice.form.NoticeCommentFormDTO; import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; @@ -58,7 +50,9 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import java.util.stream.Collectors; /** @@ -92,7 +86,7 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl", formDTO.getNoticeId())); } ResiGroupMemberDTO resiGroupMemberDTO = - resiGroupMemberService.getResiGroupMember(notice.getGroupId(), tokenDto.getUserId()); + resiGroupMemberService.getResiGroupMember(notice.getGroupId(), formDTO.getUserId()); //查看当前用户是否被禁言或者被移除 if (null != resiGroupMemberDTO) { if (MemberStateConstant.SILENT.equals(resiGroupMemberDTO.getStatus())) { @@ -154,7 +148,7 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl noticeCommentList(TokenDto tokenDto, NoticeCommentListFormDTO formDTO) { + public List noticeCommentList(NoticeCommentListFormDTO formDTO) { //1.分页查询通知评论列表 formDTO.setPageNo((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize()); List resultList = baseDao.getNoticeCommentList(formDTO); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java index ad26bc805e..eac1b1b18d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java @@ -17,14 +17,8 @@ package com.epmet.modules.notice.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.exception.RenException; -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; @@ -45,9 +39,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; /** @@ -66,7 +58,6 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl readList = new ArrayList<>(); List unReadList = new ArrayList<>(); @@ -82,7 +73,7 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl list = baseDao.getByNoticeId(formDTO.getNoticeId()); + List list = baseDao.getByNoticeId(formDTO.getNoticeId(), leaderId); //2.调用user服务,查询人员基础数据 List userIdList = list.stream().map(NoticeReadRecordDTO::getUserId).collect(Collectors.toList()); @@ -132,9 +123,9 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @Autowired private NoticeAttachmentService noticeAttachmentService; @@ -111,7 +110,7 @@ public class NoticeServiceImpl extends BaseServiceImpl @Autowired private NoticeReadRecordService noticeReafdRecordService; @Autowired - private NoticeReadRecordDao noticeReafdRecordDao; + private NoticeReadRecordDao noticeReadRecordDao; @Override @@ -128,7 +127,7 @@ public class NoticeServiceImpl extends BaseServiceImpl **/ @Override @Transactional(rollbackFor = Exception.class) - public void add(TokenDto tokenDto, AddNoticeFormDTO formDTO) { + public void add(AddNoticeFormDTO formDTO) { //1.查询组内成员数据 List memberList = resiGroupMemberDao.getMemberList(formDTO.getGroupId()); if (CollUtil.isEmpty(memberList)) { @@ -138,7 +137,7 @@ public class NoticeServiceImpl extends BaseServiceImpl //2.校验当前操作人员是否为组长 AtomicReference bl = new AtomicReference<>(true); memberList.forEach(m -> { - if (m.getCustomerUserId().equals(tokenDto.getUserId()) && "leader".equals(m.getGroupLeaderFlag())) { + if (m.getCustomerUserId().equals(formDTO.getUserId()) && "leader".equals(m.getGroupLeaderFlag())) { bl.set(false); } }); @@ -150,30 +149,27 @@ public class NoticeServiceImpl extends BaseServiceImpl List wordList = new ArrayList<>(); wordList.add(formDTO.getTitle()); wordList.add(formDTO.getContent()); - List imageList = formDTO.getImageList().stream().map(FileDTO::getUrl).collect(Collectors.toList()); + List imageList = formDTO.getImageList().stream().map(NoticeFileDTO::getUrl).collect(Collectors.toList()); safetyCheck(wordList, imageList); //4.保存小组通知基础数据 //4-1.获取小组信息 ResiGroupEntity groupEntity = resiGroupDao.selectById(formDTO.getGroupId()); if (null == groupEntity) { - throw new RenException(String.format("保存小组通知,获取小组数据失败,小组Id->", tokenDto.getUserId())); + throw new RenException(String.format("保存小组通知,获取小组数据失败,小组Id->", formDTO.getUserId())); } //4-2.获取token用户所属组织信息 - LoginUserDetailsFormDTO dto = new LoginUserDetailsFormDTO(); - dto.setApp(tokenDto.getApp()); - dto.setClient(tokenDto.getClient()); - dto.setUserId(tokenDto.getUserId()); - Result result = epmetUserOpenFeignClient.getLoginUserDetails(dto); - if (!result.success() || org.springframework.util.StringUtils.isEmpty(result.getData().getAgencyId())) { - throw new RenException(String.format("调用user服务查询用户数据失败,userId->", tokenDto.getUserId())); + Result result = govOrgOpenFeignClient.queryGridInfo(groupEntity.getGridId()); + if (!result.success() || org.springframework.util.StringUtils.isEmpty(result.getData().getParentAgencyId())) { + throw new RenException(String.format("调用user服务查询用户数据失败,userId->", formDTO.getUserId())); } - LoginUserDetailsResultDTO resultDTO = result.getData(); + GridInfoResultDTO resultDTO = result.getData(); + //4-3.保存通知数据 NoticeEntity entity = new NoticeEntity(); entity.setCustomerId(resultDTO.getCustomerId()); - entity.setAgencyId(resultDTO.getAgencyId()); + entity.setAgencyId(resultDTO.getParentAgencyId()); entity.setGridId(groupEntity.getGridId()); entity.setGroupId(formDTO.getGroupId()); entity.setTitle(formDTO.getTitle()); @@ -237,7 +233,7 @@ public class NoticeServiceImpl extends BaseServiceImpl if ("leader".equals(m.getGroupLeaderFlag())) { reafdRecord.setReadFlag(ReadFlagConstant.READ); }else { - reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); + reafdRecord.setReadFlag("un_read"); } reafdRecordList.add(reafdRecord); }); @@ -274,7 +270,7 @@ public class NoticeServiceImpl extends BaseServiceImpl * @Description 小组通知变更 **/ @Override - public void edit(TokenDto tokenDto, EditNoticeFormDTO formDTO) { + public void edit(EditNoticeFormDTO formDTO) { //1.查询通知是否存在 NoticeEntity entity = baseDao.selectById(formDTO.getNoticeId()); if (null == entity) { @@ -284,7 +280,7 @@ public class NoticeServiceImpl extends BaseServiceImpl List wordList = new ArrayList<>(); wordList.add(formDTO.getTitle()); wordList.add(formDTO.getContent()); - List imageList = formDTO.getImageList().stream().map(FileDTO::getUrl).collect(Collectors.toList()); + List imageList = formDTO.getImageList().stream().map(NoticeFileDTO::getUrl).collect(Collectors.toList()); safetyCheck(wordList, imageList); //3.查询组成员列表数据 @@ -346,7 +342,7 @@ public class NoticeServiceImpl extends BaseServiceImpl } //6.通知已读未读消息表数据先删后增 - noticeReafdRecordDao.delByNoticeId(formDTO.getNoticeId()); + noticeReadRecordDao.delByNoticeId(formDTO.getNoticeId()); List reafdRecordList = new ArrayList<>(); memberList.forEach(m -> { NoticeReadRecordEntity reafdRecord = new NoticeReadRecordEntity(); @@ -358,7 +354,7 @@ public class NoticeServiceImpl extends BaseServiceImpl if ("leader".equals(m.getGroupLeaderFlag())) { reafdRecord.setReadFlag(ReadFlagConstant.READ); }else { - reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); + reafdRecord.setReadFlag("un_read"); } reafdRecordList.add(reafdRecord); }); @@ -370,7 +366,7 @@ public class NoticeServiceImpl extends BaseServiceImpl //7-1.获取小组信息 ResiGroupEntity groupEntity = resiGroupDao.selectById(entity.getGroupId()); if (null == groupEntity) { - throw new RenException(String.format("保存小组通知,获取小组数据失败,小组Id->", tokenDto.getUserId())); + throw new RenException(String.format("保存小组通知,获取小组数据失败,小组Id->", formDTO.getUserId())); } //7-2.推送站内信信息 List userMessageFormDTOS = new ArrayList<>(); @@ -400,7 +396,7 @@ public class NoticeServiceImpl extends BaseServiceImpl * @Description 小组通知详情 **/ @Override - public NoticeDetailResultDTO noticeDetail(TokenDto tokenDto, NoticeDetailFormDTO formDTO) { + public NoticeDetailResultDTO noticeDetail(NoticeDetailFormDTO formDTO) { NoticeDetailResultDTO resultDTO = new NoticeDetailResultDTO(); List imageList = new ArrayList<>(); List docList = new ArrayList<>(); 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 8224c34c33..42c6928927 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 @@ -82,6 +82,8 @@ import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO; import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO; import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO; import com.epmet.resi.group.dto.group.ResiGroupStatisticalInfoRedisDTO; +import com.epmet.resi.group.dto.group.result.UserReadFlagResultDTO; +import com.epmet.resi.group.dto.group.result.UserUnReadResultDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO; @@ -109,6 +111,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import javax.validation.constraints.NotBlank; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -2192,7 +2195,109 @@ public class ResiTopicServiceImpl extends BaseServiceImpl NumConstant.ZERO){ + // 存在未读消息 + result.setUnReadNews(true); + } + // 查询 话题、通知、活动最近10条记录 + List latestTenData = resiGroupDao.selectLatestTen(groupId); + if (CollectionUtils.isEmpty(latestTenData)){ + result.setList(new ArrayList<>()); + return result; + } + // 活动、通知、话题 创建者ID集合 + List userIds = latestTenData.stream().map(m -> m.getUserId()).collect(Collectors.toList()); + // 活动、通知、话题 ID集合 + List ids = latestTenData.stream().map(m -> m.getId()).collect(Collectors.toList()); + List userInfos = disPoseUserInfo(result.getGroupType(), userIds); + // 查询用户的 活动或通知的 阅读状态 + List userReadFlag = resiGroupDao.selectUserReadFlag(groupId, userIds, ids); + // 查询小组下的 通知或活动 未读人数 + List userUnReadCount = resiGroupDao.selectUserUnReadById(groupId, ids); + latestTenData.forEach(l -> { + // 是否转议题,true:是,false:不是 + l.setShiftIssueFlag(StringUtils.isNotEmpty(l.getIssueId())); + // 是不是本人,true:是,false:不是 + l.setReleaseUserFlag(userId.equals(l.getUserId())); + // 用户的名字,头像赋值 + if (!CollectionUtils.isEmpty(userIds)){ + userInfos.forEach(u -> { + if (l.getUserId().equals(u.getUserId())){ + l.setReleaseUserName(u.getReleaseUserName()); + l.setReleaseUserHeadPhoto(u.getReleaseUserHeadPhoto()); + } + }); + } + // 用户已读,未读 + if (!CollectionUtils.isEmpty(userReadFlag)){ + userReadFlag.forEach(u -> { + if (l.getUserId().equals(u.getUserId()) && l.getId().equals(u.getId())){ + l.setReadOrUnRead(u.getReadFlag()); + } + }); + } + // 活动,通知未读人数 + if (!CollectionUtils.isEmpty(userUnReadCount)){ + userUnReadCount.forEach(u -> { + if (l.getId().equals(u.getId())){ + l.setUnReadCount(u.getUnRead()); + } + }); + } + }); + result.setList(latestTenData); + return result; + } + + /** + * @Description 查询用户信息【头像,名字】 + * @Param groupType + * @Param userIds + * @author zxc + * @date 2021/4/20 下午5:54 + */ + public List disPoseUserInfo(String groupType,List userIds){ + List result = new ArrayList<>(); + Result> userInfo = userOpenFeignClient.queryUserBaseInfo(userIds); + if (!userInfo.success()){ + throw new RenException(ModuleConstant.GET_USER_INFO_ERR); + } + List userInfos = userInfo.getData(); + if (CollectionUtils.isEmpty(userInfos)){ + return new ArrayList<>(); + } + userInfos.forEach(u -> { + UserInfoResultDTO ui = new UserInfoResultDTO(); + ui.setUserId(u.getUserId()); + ui.setReleaseUserHeadPhoto(u.getHeadImgUrl()); + if (groupType.equals(ModuleConstant.GROUP_TYPE_BRANCH)){ + ui.setReleaseUserName(u.getStreet() + "-" + u.getRealName()); + }else { + ui.setReleaseUserName(u.getShowName()); + } + result.add(ui); + }); + if (CollectionUtils.isEmpty(result)){ + return new ArrayList<>(); + } + return result; } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java index 1d77920606..15334f14e9 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java @@ -387,4 +387,9 @@ public interface ModuleConstant extends Constant { String GROUP_TYPE_BRANCH = "branch"; String IS_PARTY_MEMBER_ERR = "查询此人是不是党员失败了"; + + String GROUP_MEMBER_FLAG = "leader"; + + String GET_USER_INFO_ERR = "查询用户信息失败了"; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryContentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryContentDao.xml index 1ec609cbdb..50ca8f4ece 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryContentDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryContentDao.xml @@ -3,6 +3,17 @@ - - + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryDao.xml index 936bc6df1b..3782a2104c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryDao.xml @@ -3,6 +3,14 @@ - + \ 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 fc8a6280f1..5847e40ee0 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 @@ -550,4 +550,157 @@ #{pageNo}, #{pageSize} + + + + + + + + + + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml index ac0217c6fe..7cf0ffb00a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml @@ -215,4 +215,15 @@ rgm.RESI_GROUP_ID = #{groupId} AND rgm.DEL_FLAG = '0' + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml index 74b99c2e1b..3848b66959 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml @@ -7,17 +7,18 @@ SELECT * FROM - notice_reafd_record + notice_read_record WHERE del_flag = '0' AND notice_id = #{noticeId} + AND user_id != #{leaderId}