diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/BuildSignInCodeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/BuildSignInCodeFormDTO.java new file mode 100644 index 0000000000..655005efec --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/BuildSignInCodeFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 018、获取签到码图片 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/21 18:01 + */ +@Data +public class BuildSignInCodeFormDTO implements Serializable { + private static final long serialVersionUID = -2806512125925383053L; + + public interface AddUserInternalGroup { + } + + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + + /** + * 当前用户id + */ + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; + + private String customerId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/BuildSignInCodeResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/BuildSignInCodeResultDTO.java new file mode 100644 index 0000000000..77b474470e --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/BuildSignInCodeResultDTO.java @@ -0,0 +1,14 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +/** + * 018、获取签到码图片 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/21 18:13 + */ +@Data +public class BuildSignInCodeResultDTO { + private String signInCodeUrl; +} 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 index 08e190e3da..028377add9 100644 --- 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 @@ -18,5 +18,4 @@ public class SetSignTimeResultDTO implements Serializable { 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/notice/form/UnReadListFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/UnReadListFormDTO.java new file mode 100644 index 0000000000..129e63989f --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/UnReadListFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.resi.group.dto.notice.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/21 下午4:17 + * @DESC + */ +@Data +public class UnReadListFormDTO implements Serializable { + + private static final long serialVersionUID = 2312033892813352767L; + + public interface UnReadListForm{} + + @NotBlank(message = "小组ID不能为空",groups = UnReadListForm.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/notice/result/UnReadListResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/UnReadListResultDTO.java new file mode 100644 index 0000000000..404e74a5d8 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/UnReadListResultDTO.java @@ -0,0 +1,55 @@ +package com.epmet.resi.group.dto.notice.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/21 下午4:21 + * @DESC + */ +@Data +public class UnReadListResultDTO implements Serializable { + + private static final long serialVersionUID = -2614612434488988741L; + + /** + * 话题、通知、活动Id + */ + private String id; + + /** + * 发布者的全称(街道-姓氏先生/女士)【专项组显示真实名】 + */ + private String releaseUserName; + + /** + * 话题发布者的头像Url + */ + private String releaseUserHeadPhoto; + + /** + * 发布时间yyyy-MM-dd HH:mm + */ + private String releaseTime; + + /** + * 内容 + */ + private String content; + + /** + * 如果有图片,后台只返回第一张,没有图片此列为空 + */ + private String firstPhoto; + + /** + * 数据类型(topic:话题 notice:通知 act:活动) + */ + private String contentType; + + @JsonIgnore + private String userId; +} 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 3e8883dbd6..cb2ed021e4 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 @@ -22,9 +22,7 @@ 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.form.*; 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; @@ -92,4 +90,19 @@ public class ActSignInRecordController { ValidatorUtils.validateEntity(formDTO,SignInRecFormDTO.AddUserInternalGroup.class); return new Result().ok(actSignInRecordService.querySignRecList(formDTO)); } + + /** + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 018、获取签到码图片 + * @Date 2021/4/21 18:05 + **/ + @PostMapping("geturl") + public Result getSignInUrl(@LoginUser TokenDto tokenDto, @RequestBody BuildSignInCodeFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, BuildSignInCodeFormDTO.AddUserInternalGroup.class); + return new Result().ok(actSignInRecordService.getSignInUrl(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 78bff472cd..469aad289d 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 @@ -36,4 +36,7 @@ public interface ActSignInCodeService extends BaseService { * @return com.epmet.resi.group.dto.act.ActSignInCodeDTO */ ActSignInCodeDTO selectLastRec(String groupActId); + + + int saveActSignInCodeEntity(ActSignInCodeEntity actSignInCodeEntity); } \ 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 da979840b0..26d1d08743 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,9 +19,7 @@ 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.form.*; import com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO; import com.epmet.resi.group.dto.act.result.SignInRecResultDTO; @@ -65,4 +63,12 @@ public interface ActSignInRecordService extends BaseService uploadResult = ossFeignClient.uploadQrCode(qrCodeMultipartFile); + if (!uploadResult.success()) { + throw new RenException("调用oss服务上传活动签到码失败"); + } + //别忘了插入数据库act_sign_in_code + ActSignInCodeEntity actSignInCodeEntity = new ActSignInCodeEntity(); + actSignInCodeEntity.setCustomerId(formDTO.getCustomerId()); + actSignInCodeEntity.setGroupActId(formDTO.getGroupActId()); + actSignInCodeEntity.setUrl(uploadResult.getData().getUrl()); + actSignInCodeService.saveActSignInCodeEntity(actSignInCodeEntity); + resultDTO.setSignInCodeUrl(uploadResult.getData().getUrl()); + } + return resultDTO; + } } \ 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 f30db7560e..0de7adf07e 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.notice.result.UnReadListResultDTO; import com.epmet.resi.group.dto.topic.result.LatestTenResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -278,4 +279,21 @@ public interface ResiGroupDao extends BaseDao { * @date 2021/4/21 上午10:22 */ List selectUserUnReadById(@Param("groupId")String groupId,@Param("ids")List ids); + + /** + * @Description 根据用户ID查询小组下未读的 通知、活动 + * @Param groupId + * @Param userId + * @author zxc + * @date 2021/4/21 下午4:39 + */ + List selectUnReadByUserId(@Param("groupId")String groupId,@Param("userId")String userId); + + /** + * @Description 查询未读的通知和活动信息 + * @Param ids + * @author zxc + * @date 2021/4/21 下午5:08 + */ + List selectUnReadInfos(@Param("ids")List ids); } 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 a4b992fd0f..7be5648a82 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 @@ -24,13 +24,17 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.modules.notice.service.NoticeReadRecordService; 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.form.UnReadListFormDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; +import com.epmet.resi.group.dto.notice.result.UnReadListResultDTO; 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; + /** * 小组通知组成员阅读记录表 @@ -71,4 +75,18 @@ public class NoticeReadRecordController { return new Result(); } + /** + * @Description 当前人员未读(通知、活动)列表查询 + * @Param tokenDto + * @Param formDTO + * @author zxc + * @date 2021/4/21 下午4:23 + */ + @PostMapping("unreadlist") + public Result> unReadList(@LoginUser TokenDto tokenDto, @RequestBody UnReadListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, UnReadListFormDTO.UnReadListForm.class); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(noticeReafdRecordService.unReadList(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 fd4a4d6d4b..3d1fe6af33 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 @@ -21,7 +21,11 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.notice.entity.NoticeReadRecordEntity; 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.form.UnReadListFormDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; +import com.epmet.resi.group.dto.notice.result.UnReadListResultDTO; + +import java.util.List; /** * 小组通知组成员阅读记录表 @@ -46,4 +50,13 @@ public interface NoticeReadRecordService extends BaseService unReadList(UnReadListFormDTO 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/NoticeReadRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java index eac1b1b18d..93b728bcfb 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 @@ -22,21 +22,30 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ReadFlagConstant; import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.UserInfoResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.modules.group.dao.ResiGroupDao; +import com.epmet.modules.group.entity.ResiGroupEntity; 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.modules.topic.service.impl.ResiTopicServiceImpl; +import com.epmet.resi.group.dto.group.result.UserReadFlagResultDTO; 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.form.UnReadListFormDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; +import com.epmet.resi.group.dto.notice.result.UnReadListResultDTO; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; 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.List; @@ -49,6 +58,7 @@ import java.util.stream.Collectors; * @since v1.0.0 2021-04-19 */ @Service +@Slf4j public class NoticeReadRecordServiceImpl extends BaseServiceImpl implements NoticeReadRecordService { @Autowired @@ -57,6 +67,10 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl unReadList(UnReadListFormDTO formDTO) { + // 查询用户小组内未读的 通知 和 活动 + List userUnRead = resiGroupDao.selectUnReadByUserId(formDTO.getGroupId(), formDTO.getUserId()); + if (CollectionUtils.isEmpty(userUnRead)){ + return new ArrayList<>(); + } + // 活动 通知ID集合 + List ids = userUnRead.stream().map(m -> m.getId()).collect(Collectors.toList()); + // 查询未读的通知和活动信息 + List result = resiGroupDao.selectUnReadInfos(ids); + if (CollectionUtils.isEmpty(result)){ + log.debug("用户存在未读消息,但是查询未读的通知和活动信息的时候失败了"); + return new ArrayList<>(); + } + // 查询小组信息 + ResiGroupEntity resiGroup = resiGroupDao.selectById(formDTO.getGroupId()); + List userIds = result.stream().map(m -> m.getUserId()).collect(Collectors.toList()); + List userInfos = topicServiceImpl.disPoseUserInfo(resiGroup.getGroupType(), userIds); + if (!CollectionUtils.isEmpty(userInfos)){ + result.forEach(r -> { + userInfos.forEach(u -> { + if (r.getUserId().equals(u.getUserId())){ + r.setReleaseUserName(u.getReleaseUserName()); + r.setReleaseUserHeadPhoto(u.getReleaseUserHeadPhoto()); + } + }); + }); + } + return result; + } + } \ No newline at end of file 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 8cc9e38973..90217f5790 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 @@ -2286,6 +2286,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl disPoseUserInfo(String groupType,List userIds){ + if (CollectionUtils.isEmpty(userIds)){ + return new ArrayList<>(); + } List result = new ArrayList<>(); Result> userInfo = userOpenFeignClient.queryUserBaseInfo(userIds); if (!userInfo.success()){ 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 15334f14e9..fa0f11c3c1 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 @@ -369,6 +369,11 @@ public interface ModuleConstant extends Constant { */ String CODE_INVITE_PAGE = "pages/group/group/invitation/invitation"; + /** + * 活动扫码签到,对应的跳转到 活动详情页面 + */ + String GROUP_ACT_DETAIL_PAGE = "XXXXXXXXXXXXXXXXXXXXX找莹姐要路径"; + String TOPIC_CONTENT_AND_VOICE_IS_NULL = "请输入话题内容或语音"; /** 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 5847e40ee0..ea0dd3fac9 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 @@ -703,4 +703,68 @@ ) + + + + + +