Browse Source

Merge remote-tracking branch 'origin/dev_group_act_notice' into dev_temp

dev_shibei_match
yinzuomei 4 years ago
parent
commit
d7b6d94d1b
  1. 31
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/BuildSignInCodeFormDTO.java
  2. 14
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/BuildSignInCodeResultDTO.java
  3. 1
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SetSignTimeResultDTO.java
  4. 24
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/UnReadListFormDTO.java
  5. 55
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/UnReadListResultDTO.java
  6. 19
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java
  7. 3
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInCodeService.java
  8. 12
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java
  9. 5
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInCodeServiceImpl.java
  10. 98
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java
  11. 18
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java
  12. 18
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java
  13. 13
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java
  14. 53
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java
  15. 3
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  16. 5
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  17. 64
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml

31
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;
}

14
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;
}

1
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;
}

24
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;
}

55
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;
}

19
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<SignInRecResultDTO>().ok(actSignInRecordService.querySignRecList(formDTO));
}
/**
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.act.ActSignInCodeDTO>
* @author yinzuomei
* @description 018获取签到码图片
* @Date 2021/4/21 18:05
**/
@PostMapping("geturl")
public Result<BuildSignInCodeResultDTO> getSignInUrl(@LoginUser TokenDto tokenDto, @RequestBody BuildSignInCodeFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO, BuildSignInCodeFormDTO.AddUserInternalGroup.class);
return new Result<BuildSignInCodeResultDTO>().ok(actSignInRecordService.getSignInUrl(formDTO));
}
}

3
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<ActSignInCodeEntity> {
* @return com.epmet.resi.group.dto.act.ActSignInCodeDTO
*/
ActSignInCodeDTO selectLastRec(String groupActId);
int saveActSignInCodeEntity(ActSignInCodeEntity actSignInCodeEntity);
}

12
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<ActSignInRecordEntit
* @return com.epmet.resi.group.dto.act.result.SignInRecResultDTO
*/
SignInRecResultDTO querySignRecList(SignInRecFormDTO formDTO);
/**
* 018获取签到码图片
*
* @param formDTO
* @return com.epmet.resi.group.dto.act.result.SignInRecResultDTO
*/
BuildSignInCodeResultDTO getSignInUrl(BuildSignInCodeFormDTO formDTO);
}

5
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInCodeServiceImpl.java

@ -44,4 +44,9 @@ public class ActSignInCodeServiceImpl extends BaseServiceImpl<ActSignInCodeDao,
public ActSignInCodeDTO selectLastRec(String groupActId) {
return baseDao.selectLastRec(groupActId);
}
@Override
public int saveActSignInCodeEntity(ActSignInCodeEntity actSignInCodeEntity) {
return baseDao.insert(actSignInCodeEntity);
}
}

98
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java

@ -17,17 +17,23 @@
package com.epmet.modules.act.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.modules.act.dao.ActSignInRecordDao;
import com.epmet.modules.act.dao.GroupActInfoDao;
import com.epmet.modules.act.entity.ActSignInCodeEntity;
import com.epmet.modules.act.entity.ActSignInRecordEntity;
import com.epmet.modules.act.entity.GroupActInfoEntity;
import com.epmet.modules.act.service.ActSignInCodeService;
@ -35,20 +41,23 @@ import com.epmet.modules.act.service.ActSignInRecordService;
import com.epmet.modules.act.service.GroupActInfoService;
import com.epmet.modules.constant.GroupActConstant;
import com.epmet.modules.member.service.ResiGroupMemberService;
import com.epmet.modules.utils.ModuleConstant;
import com.epmet.resi.group.dto.QRCodeMultipartFileDTO;
import com.epmet.resi.group.dto.act.ActSignInCodeDTO;
import com.epmet.resi.group.dto.act.GroupActInfoDTO;
import com.epmet.resi.group.dto.act.form.SetSignTimeFormDTO;
import com.epmet.resi.group.dto.act.form.SignInFormDTO;
import com.epmet.resi.group.dto.act.form.SignInRecFormDTO;
import com.epmet.resi.group.dto.act.form.*;
import com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO;
import com.epmet.resi.group.dto.act.result.SignInRecResultDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.utils.ThirdUtils;
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.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -73,6 +82,9 @@ public class ActSignInRecordServiceImpl extends BaseServiceImpl<ActSignInRecordD
private ActSignInCodeService actSignInCodeService;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private OssFeignClient ossFeignClient;
/**
* 查询当前用户是否签到
*
@ -115,30 +127,12 @@ public class ActSignInRecordServiceImpl extends BaseServiceImpl<ActSignInRecordD
}
groupActInfoDao.updateById(groupActInfoEntity);
SetSignTimeResultDTO result = new SetSignTimeResultDTO();
//3、如果签到时间修改了,重新生成签到码
result.setSignInCodeUrl(getSignInCodeUrl(groupActInfoEntity, originalActInfo));
result.setGroupActId(formDTO.getGroupActId());
result.setSignInStartTime(groupActInfoEntity.getSignInStartTime());
result.setSignInEndTime(groupActInfoEntity.getSignInEndTime());
return result;
}
private String getSignInCodeUrl(GroupActInfoEntity actInfoEntity, GroupActInfoDTO groupActInfoDTO) {
ActSignInCodeDTO actSignInCodeDTO = actSignInCodeService.selectLastRec(actInfoEntity.getId());
if (null != actSignInCodeDTO) {
if (actInfoEntity.getSignInStartTime().equals(groupActInfoDTO.getSignInStartTime())
&& actInfoEntity.getSignInEndTime().equals(groupActInfoDTO.getSignInEndTime())) {
log.info("签到开始时间、签到截止时间未变更,不需要重新生成签到码");
return actSignInCodeDTO.getUrl();
}
}
//todo
//别忘了插入数据库act_sign_in_code
return "重新生成新的url";
}
/**
* 007签到
*
@ -242,4 +236,66 @@ public class ActSignInRecordServiceImpl extends BaseServiceImpl<ActSignInRecordD
}
return resultDTO;
}
/**
* 018获取签到码图片
*
* @param formDTO
* @return com.epmet.resi.group.dto.act.result.SignInRecResultDTO
*/
@Override
public BuildSignInCodeResultDTO getSignInUrl(BuildSignInCodeFormDTO formDTO) {
BuildSignInCodeResultDTO resultDTO = new BuildSignInCodeResultDTO();
ActSignInCodeDTO actSignInCodeDTO = actSignInCodeService.selectLastRec(formDTO.getGroupActId());
if (null != actSignInCodeDTO) {
resultDTO.setSignInCodeUrl(actSignInCodeDTO.getUrl());
} else {
//获取AccessToken
String accessToken = ThirdUtils.getAccessToken(formDTO.getCustomerId()).getResiToken();
if (StringUtils.isBlank(accessToken)) {
log.warn("获取accessToken失败,customerId:{}", formDTO.getCustomerId());
throw new RenException("获取accessToken失败,customerId:{}", formDTO.getCustomerId());
}
//跳转的页面
//todo
StringBuilder path = new StringBuilder(ModuleConstant.GROUP_ACT_DETAIL_PAGE);
path.append("?groupActId=").append(formDTO.getGroupActId());
//需要发送的Json
JSONObject data = new JSONObject();
data.put("path", path.toString());
data.put("width", 400);
//发送
byte[] buffer = HttpClientManager.getInstance().getMediaByteArray(ModuleConstant.GET_CODE_URL + accessToken, JSON.toJSONString(data)).getData();
if (buffer != null && buffer.length < 500) {
String wxResult = "";
try {
wxResult = new String(buffer, "UTF-8");
if (-1 != wxResult.indexOf("errcode")) {
log.error("获取二维码接口返回错误:{}", wxResult);
throw new RenException("获取二维码失败");
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
//上传
QRCodeMultipartFileDTO qrCodeMultipartFile = new QRCodeMultipartFileDTO();
qrCodeMultipartFile.setBytes(buffer);
String originalFilename = formDTO.getGroupActId().concat(".jpg");
qrCodeMultipartFile.setOriginalFilename(originalFilename);
Result<UploadImgResultDTO> 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;
}
}

18
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<ResiGroupEntity> {
* @date 2021/4/21 上午10:22
*/
List<UserUnReadResultDTO> selectUserUnReadById(@Param("groupId")String groupId,@Param("ids")List<String> ids);
/**
* @Description 根据用户ID查询小组下未读的 通知活动
* @Param groupId
* @Param userId
* @author zxc
* @date 2021/4/21 下午4:39
*/
List<UserReadFlagResultDTO> selectUnReadByUserId(@Param("groupId")String groupId,@Param("userId")String userId);
/**
* @Description 查询未读的通知和活动信息
* @Param ids
* @author zxc
* @date 2021/4/21 下午5:08
*/
List<UnReadListResultDTO> selectUnReadInfos(@Param("ids")List<String> ids);
}

18
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<List<UnReadListResultDTO>> unReadList(@LoginUser TokenDto tokenDto, @RequestBody UnReadListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, UnReadListFormDTO.UnReadListForm.class);
formDTO.setUserId(tokenDto.getUserId());
return new Result<List<UnReadListResultDTO>>().ok(noticeReafdRecordService.unReadList(formDTO));
}
}

13
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<NoticeReadRecordEnt
* @Description 小组通知阅读状态修改
**/
void readType(ReadTypeFormDTO formDTO);
/**
* @Description 当前人员未读(通知活动)列表查询
* @Param tokenDto
* @Param formDTO
* @author zxc
* @date 2021/4/21 下午4:23
*/
List<UnReadListResultDTO> unReadList(UnReadListFormDTO formDTO);
}

53
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<NoticeReadRecordDao, NoticeReadRecordEntity> implements NoticeReadRecordService {
@Autowired
@ -57,6 +67,10 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl<NoticeReadRecor
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private NoticeDao noticeDao;
@Autowired
private ResiGroupDao resiGroupDao;
@Autowired
private ResiTopicServiceImpl topicServiceImpl;
/**
* @param formDTO
@ -150,4 +164,43 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl<NoticeReadRecor
}
/**
* @Description 当前人员未读(通知活动)列表查询
* @Param tokenDto
* @Param formDTO
* @author zxc
* @date 2021/4/21 下午4:23
*/
@Override
public List<UnReadListResultDTO> unReadList(UnReadListFormDTO formDTO) {
// 查询用户小组内未读的 通知 和 活动
List<UserReadFlagResultDTO> userUnRead = resiGroupDao.selectUnReadByUserId(formDTO.getGroupId(), formDTO.getUserId());
if (CollectionUtils.isEmpty(userUnRead)){
return new ArrayList<>();
}
// 活动 通知ID集合
List<String> ids = userUnRead.stream().map(m -> m.getId()).collect(Collectors.toList());
// 查询未读的通知和活动信息
List<UnReadListResultDTO> result = resiGroupDao.selectUnReadInfos(ids);
if (CollectionUtils.isEmpty(result)){
log.debug("用户存在未读消息,但是查询未读的通知和活动信息的时候失败了");
return new ArrayList<>();
}
// 查询小组信息
ResiGroupEntity resiGroup = resiGroupDao.selectById(formDTO.getGroupId());
List<String> userIds = result.stream().map(m -> m.getUserId()).collect(Collectors.toList());
List<UserInfoResultDTO> 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;
}
}

3
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<ResiTopicDao, ResiTopi
* @date 2021/4/20 下午5:54
*/
public List<UserInfoResultDTO> disPoseUserInfo(String groupType,List<String> userIds){
if (CollectionUtils.isEmpty(userIds)){
return new ArrayList<>();
}
List<UserInfoResultDTO> result = new ArrayList<>();
Result<List<UserBaseInfoResultDTO>> userInfo = userOpenFeignClient.queryUserBaseInfo(userIds);
if (!userInfo.success()){

5
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 = "请输入话题内容或语音";
/**

64
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml

@ -703,4 +703,68 @@
)
</select>
<!-- 根据用户ID查询小组下未读的 通知、活动 -->
<select id="selectUnReadByUserId" resultType="com.epmet.resi.group.dto.group.result.UserReadFlagResultDTO">
(SELECT
USER_ID,
GROUP_ACT_ID AS id
FROM act_read_record
WHERE DEL_FLAG = 0
AND READ_FLAG = 'un_read'
AND USER_ID = #{userId}
AND GROUP_ID = #{groupId}
)
UNION ALL
(SELECT
USER_ID,
NOTICE_ID AS id
FROM notice_read_record
WHERE DEL_FLAG = 0
AND READ_FLAG = 'un_read'
AND USER_ID = #{userId}
AND GROUP_ID = #{groupId}
)
</select>
<!-- 查询未读的通知和活动信息 -->
<select id="selectUnReadInfos" resultType="com.epmet.resi.group.dto.notice.result.UnReadListResultDTO">
SELECT id,userId,releaseTime,content,contentType,firstPhoto FROM
(
(SELECT
ai.ID,
ai.CREATED_BY AS userId,
DATE_FORMAT(ai.CREATED_TIME,'%Y-%m-%d %H:%m:%s') AS releaseTime,
IFNULL(ac.CONTENT,'') AS content,
'act' AS contentType,
IFNULL(ac2.CONTENT,'') AS firstPhoto
FROM group_act_info ai
LEFT JOIN group_act_content ac ON ac.GROUP_ACT_ID = ai.ID AND ac.CONTENT_TYPE = 'text'
LEFT JOIN group_act_content ac2 ON ac2.GROUP_ACT_ID = ai.ID AND ac2.CONTENT_TYPE = 'img' AND ac2.SORT = 1
WHERE ai.DEL_FLAG = '0'
AND (
<foreach collection="ids" item="id" separator=" OR ">
ai.id = #{id}
</foreach>
)
)
UNION ALL
(SELECT
n.ID,
n.CREATED_BY AS userId,
DATE_FORMAT(n.CREATED_TIME,'%Y-%m-%d %H:%m:%s') AS releaseTime,
n.CONTENT AS content,
'notice' AS contentType,
IFNULL(na.ATTACHMENT_URL,'') AS firstPhoto
FROM notice n
LEFT JOIN notice_attachment na ON na.NOTICE_ID = n.ID AND na.DEL_FLAG = '0' AND na.ATTACHMENT_TYPE = 'image' AND na.SORT = 0
WHERE n.DEL_FLAG = '0'
AND (
<foreach collection="ids" item="id" separator=" OR ">
n.id = #{id}
</foreach>
)
)
)temp
</select>
</mapper>

Loading…
Cancel
Save