Browse Source

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

dev_shibei_match
yinzuomei 4 years ago
parent
commit
470d742651
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 5
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupResultDTO.java
  3. 31
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/form/ShareFormDTO.java
  4. 19
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/ShareResultDTO.java
  5. 3
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java
  6. 3
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java
  7. 21
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeReadListFormDTO.java
  8. 51
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeReadListResultDTO.java
  9. 14
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  10. 21
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/InvitationRecordController.java
  11. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/InvitationRecordService.java
  12. 56
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/InvitationRecordServiceImpl.java
  13. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java
  14. 16
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java
  15. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java
  16. 11
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java
  17. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeService.java
  18. 66
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java
  19. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java
  20. 7
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  21. 1
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml
  22. 10
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReafdRecordDao.xml
  23. 9
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  24. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  25. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java
  26. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java
  27. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java
  28. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java
  29. 12
      epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -165,7 +165,8 @@ public enum EpmetErrorCode {
GROUP_ACT_CLOSED_CAN_NOT_EDIT(8902,"活动已关闭,不能编辑"),
PLEASE_INPUT_ACT_CONTENT(8903,"请输入活动内容,或添加图片"),
GROUP_ACT_CONTENT_MAX(8904,"活动内容至多输入1000字"),
GROUP_ACT_IMG_MAX(8905,"最多可添加3张图片");
GROUP_ACT_IMG_MAX(8905,"最多可添加3张图片"),
PARTY_MEMBER_CREATE_BRANCH_GROUP(8906,"您不是党员,不能创建支部小组");
private int code;

5
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupResultDTO.java

@ -45,6 +45,9 @@ public class ApplyingGroupResultDTO implements Serializable{
* */
private String messageText;
/**
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
}

31
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/form/ShareFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.resi.group.dto.invitation.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author sun
* @Description 小组通知活动分享-接口入参
*/
@Data
public class ShareFormDTO implements Serializable {
private static final long serialVersionUID = 7069116393380944951L;
/**
* 通知或活动Id
*/
@NotBlank(message="通知或活动Id不能为空",groups = {ShareFormDTO.Add.class})
private String id;
/**
* 类型(notice:通知 act:活动)
*/
@NotBlank(message = "类型(notice:通知 act:活动)不能为空",groups = {ShareFormDTO.Add.class})
private String type;
/**
* token中用户Id
*/
private String userId;
public interface Add{}
}

19
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/ShareResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.resi.group.dto.invitation.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author sun
* @Description 小组通知活动分享-接口返参
*/
@Data
public class ShareResultDTO implements Serializable {
private static final long serialVersionUID = 6136787210623326830L;
/**
* 分享Id
*/
private String invitationRecordId;
}

3
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/AddNoticeFormDTO.java → epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java

@ -1,5 +1,6 @@
package com.epmet.resi.group.dto.topic.form;
package com.epmet.resi.group.dto.notice.form;
import com.epmet.resi.group.dto.topic.form.FileDTO;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

3
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/EditNoticeFormDTO.java → epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java

@ -1,5 +1,6 @@
package com.epmet.resi.group.dto.topic.form;
package com.epmet.resi.group.dto.notice.form;
import com.epmet.resi.group.dto.topic.form.FileDTO;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

21
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeReadListFormDTO.java

@ -0,0 +1,21 @@
package com.epmet.resi.group.dto.notice.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Author sun
* @Description 通知已读未读列表查询-接口入参
*/
@Data
public class NoticeReadListFormDTO {
/**
* 通知Id
*/
@NotBlank(message = "通知Id不能为空",groups = {NoticeReadListFormDTO.List.class})
private String noticeId;
public interface List{}
}

51
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeReadListResultDTO.java

@ -0,0 +1,51 @@
package com.epmet.resi.group.dto.notice.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author sun
* @Description 通知已读未读列表查询-接口返参
*/
@Data
public class NoticeReadListResultDTO implements Serializable {
private static final long serialVersionUID = 6136787210623326830L;
/**
* 已读人员数
*/
private Integer readCount;
/**
* 未读人员数
*/
private Integer unReadCount;
/**
* 已读列表
*/
private List<NoticeReafdRecord> readList = new ArrayList<>();
/**
* 未读列表
*/
private List<NoticeReafdRecord> unReadList = new ArrayList<>();
@NoArgsConstructor
@Data
public static class NoticeReafdRecord {
/**
* 用户Id
*/
private String userId;
/**
* 用户姓名(真实姓名)
*/
private String userName;
/**
* 用户头像
*/
private String userHeadPhoto;
}
}

14
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -40,6 +40,7 @@ import com.epmet.dto.form.*;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.modules.constant.UserMessageConstant;
import com.epmet.modules.feign.EpmetMessageFeignClient;
import com.epmet.modules.feign.EpmetUserFeignClient;
@ -147,6 +148,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Autowired
private LoginUserUtil loginUserUtil;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@ -365,6 +369,16 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Transactional(rollbackFor = Exception.class)
@Override
public void applyCreateGroup(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) {
// 查看是不是支部小组,在查询创建者是不是党员,不是党员就不走下面逻辑了
if (applyCreateGroupFormDTO.getGroupType().equals(ModuleConstant.GROUP_TYPE_BRANCH)){
Result<Boolean> booleanResult = epmetUserOpenFeignClient.selectIsPartyMemberByUserId(applyCreateGroupFormDTO.getUserId());
if (!booleanResult.success()){
throw new RenException(ModuleConstant.IS_PARTY_MEMBER_ERR);
}
if (!booleanResult.getData()){
throw new RenException(EpmetErrorCode.PARTY_MEMBER_CREATE_BRANCH_GROUP.getCode());
}
}
//1、校验是否同名
List<ResiGroupEntity> resiGroupEntityList = this.getResiGroupEntityList(applyCreateGroupFormDTO);
if (null != resiGroupEntityList && resiGroupEntityList.size() > 0) {

21
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/InvitationRecordController.java

@ -17,8 +17,16 @@
package com.epmet.modules.invitation.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.invitation.service.InvitationRecordService;
import com.epmet.resi.group.dto.invitation.form.ShareFormDTO;
import com.epmet.resi.group.dto.invitation.result.ShareResultDTO;
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;
@ -37,4 +45,17 @@ public class InvitationRecordController {
private InvitationRecordService invitationRecordService;
/**
* @param formDTO
* @return
* @Author sun
* @Description 小组通知活动分享
**/
@PostMapping(value = "share")
public Result<ShareResultDTO> share(@LoginUser TokenDto tokenDto, @RequestBody ShareFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, ShareFormDTO.Add.class);
formDTO.setUserId(tokenDto.getUserId());
return new Result<ShareResultDTO>().ok(invitationRecordService.share(formDTO));
}
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/InvitationRecordService.java

@ -19,6 +19,8 @@ package com.epmet.modules.invitation.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.modules.invitation.entity.InvitationRecordEntity;
import com.epmet.resi.group.dto.invitation.form.ShareFormDTO;
import com.epmet.resi.group.dto.invitation.result.ShareResultDTO;
/**
* 分享记录(话题通知...后续支持增加)
@ -28,4 +30,11 @@ import com.epmet.modules.invitation.entity.InvitationRecordEntity;
*/
public interface InvitationRecordService extends BaseService<InvitationRecordEntity> {
/**
* @param formDTO
* @return
* @Author sun
* @Description 小组通知活动分享
**/
ShareResultDTO share(ShareFormDTO formDTO);
}

56
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/InvitationRecordServiceImpl.java

@ -18,9 +18,18 @@
package com.epmet.modules.invitation.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.modules.act.dao.GroupActInfoDao;
import com.epmet.modules.act.entity.GroupActInfoEntity;
import com.epmet.modules.invitation.dao.InvitationRecordDao;
import com.epmet.modules.invitation.entity.InvitationRecordEntity;
import com.epmet.modules.invitation.service.InvitationRecordService;
import com.epmet.modules.notice.dao.NoticeDao;
import com.epmet.modules.notice.dao.NoticeReafdRecordDao;
import com.epmet.modules.notice.entity.NoticeEntity;
import com.epmet.resi.group.dto.invitation.form.ShareFormDTO;
import com.epmet.resi.group.dto.invitation.result.ShareResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -32,5 +41,52 @@ import org.springframework.stereotype.Service;
@Service
public class InvitationRecordServiceImpl extends BaseServiceImpl<InvitationRecordDao, InvitationRecordEntity> implements InvitationRecordService {
@Autowired
private NoticeDao noticeDao;
@Autowired
private GroupActInfoDao groupActInfoDao;
/**
* @param formDTO
* @return
* @Author sun
* @Description 小组通知活动分享
**/
@Override
public ShareResultDTO share(ShareFormDTO formDTO) {
ShareResultDTO resultDTO = new ShareResultDTO();
//1.按类型查询通知或活动数据
InvitationRecordEntity entity = new InvitationRecordEntity();
NoticeEntity notice = null;
GroupActInfoEntity act = null;
if ("notice".equals(formDTO.getType())) {
notice = noticeDao.selectById(formDTO.getId());
if (null == notice) {
throw new RenException(String.format("通知分享,根据通知Id查询通知数据失败,通知Id->", formDTO.getId()));
}
entity.setCustomerId(notice.getCustomerId());
entity.setGridId(notice.getGridId());
entity.setGroupId(notice.getGroupId());
entity.setSourceId(formDTO.getId());
entity.setSourceType(formDTO.getType());
entity.setShareUserId(formDTO.getUserId());
} else if ("act".equals(formDTO.getType())) {
act = groupActInfoDao.selectById(formDTO.getId());
if (null == act) {
throw new RenException(String.format("活动分享,根据活动Id查询活动数据失败,活动Id->", formDTO.getId()));
}
entity.setCustomerId(act.getCustomerId());
entity.setGridId(act.getGridId());
entity.setGroupId(act.getGroupId());
entity.setSourceId(formDTO.getId());
entity.setSourceType(formDTO.getType());
entity.setShareUserId(formDTO.getUserId());
}
//2.新增分享数据,生成分享Id
baseDao.insert(entity);
resultDTO.setInvitationRecordId(entity.getId());
return resultDTO;
}
}

4
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java

@ -30,8 +30,8 @@ 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.topic.form.AddNoticeFormDTO;
import com.epmet.resi.group.dto.topic.form.EditNoticeFormDTO;
import com.epmet.resi.group.dto.notice.form.AddNoticeFormDTO;
import com.epmet.resi.group.dto.notice.form.EditNoticeFormDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

16
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java

@ -17,7 +17,9 @@
package com.epmet.modules.notice.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -28,6 +30,8 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.modules.notice.excel.NoticeReafdRecordExcel;
import com.epmet.modules.notice.service.NoticeReafdRecordService;
import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO;
import com.epmet.resi.group.dto.notice.form.NoticeReadListFormDTO;
import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -91,4 +95,16 @@ public class NoticeReafdRecordController {
ExcelUtils.exportExcelToTarget(response, null, list, NoticeReafdRecordExcel.class);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 通知已读未读列表查询
**/
@PostMapping(value = "noticereadlist")
public Result<NoticeReadListResultDTO> noticeReadList(@LoginUser TokenDto tokenDto, @RequestBody NoticeReadListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, NoticeReadListFormDTO.List.class);
return new Result<NoticeReadListResultDTO>().ok(noticeReafdRecordService.noticeReadList(tokenDto, formDTO));
}
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java

@ -19,9 +19,12 @@ package com.epmet.modules.notice.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.notice.entity.NoticeReafdRecordEntity;
import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 小组通知组成员阅读记录表
*
@ -36,4 +39,10 @@ public interface NoticeReafdRecordDao extends BaseDao<NoticeReafdRecordEntity> {
* @Description 删除通知已读未读数据-物理删除
**/
void delByNoticeId(@Param("noticeId") String noticeId);
/**
* @Author sun
* @Description 根据通知Id查询组成员已读未读数据
**/
List<NoticeReafdRecordDTO> getByNoticeId(@Param("noticeId") String noticeId);
}

11
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java

@ -19,8 +19,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.NoticeReafdRecordEntity;
import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO;
import com.epmet.resi.group.dto.notice.form.NoticeReadListFormDTO;
import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO;
import java.util.List;
import java.util.Map;
@ -92,4 +95,12 @@ public interface NoticeReafdRecordService extends BaseService<NoticeReafdRecordE
* @date 2021-04-19
*/
void delete(String[] ids);
/**
* @param formDTO
* @return
* @Author sun
* @Description 通知已读未读列表查询
**/
NoticeReadListResultDTO noticeReadList(TokenDto tokenDto, NoticeReadListFormDTO formDTO);
}

4
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeService.java

@ -22,8 +22,8 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.modules.notice.entity.NoticeEntity;
import com.epmet.resi.group.dto.notice.NoticeDTO;
import com.epmet.resi.group.dto.topic.form.AddNoticeFormDTO;
import com.epmet.resi.group.dto.topic.form.EditNoticeFormDTO;
import com.epmet.resi.group.dto.notice.form.AddNoticeFormDTO;
import com.epmet.resi.group.dto.notice.form.EditNoticeFormDTO;
import java.util.List;
import java.util.Map;

66
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java

@ -21,21 +21,31 @@ 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.dto.result.UserBaseInfoResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.modules.notice.dao.NoticeReafdRecordDao;
import com.epmet.modules.notice.entity.NoticeReafdRecordEntity;
import com.epmet.modules.notice.redis.NoticeReafdRecordRedis;
import com.epmet.modules.notice.service.NoticeReafdRecordService;
import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO;
import com.epmet.resi.group.dto.notice.form.NoticeReadListFormDTO;
import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO;
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 java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
* 小组通知组成员阅读记录表
@ -48,6 +58,8 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl<NoticeReafdRec
@Autowired
private NoticeReafdRecordRedis noticeReafdRecordRedis;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
public PageData<NoticeReafdRecordDTO> page(Map<String, Object> params) {
@ -101,4 +113,58 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl<NoticeReafdRec
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 通知已读未读列表查询
**/
@Override
public NoticeReadListResultDTO noticeReadList(TokenDto tokenDto, NoticeReadListFormDTO formDTO) {
NoticeReadListResultDTO resultDTO = new NoticeReadListResultDTO();
List<NoticeReadListResultDTO.NoticeReafdRecord> readList = new ArrayList<>();
List<NoticeReadListResultDTO.NoticeReafdRecord> unReadList = new ArrayList<>();
//1.根据通知Id查询组成员已读未读数据
List<NoticeReafdRecordDTO> list = baseDao.getByNoticeId(formDTO.getNoticeId());
//2.调用user服务,查询人员基础数据
List<String> userIdList = list.stream().map(NoticeReafdRecordDTO::getUserId).collect(Collectors.toList());
Result<List<UserBaseInfoResultDTO>> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList);
if (!result.success()){
throw new RenException("调用user服务,获取用户基础数据失败");
}
List<UserBaseInfoResultDTO> resultDTOList = result.getData();
//3.遍历封装数据并返回
list.forEach(l->{
StringBuffer name = new StringBuffer();
StringBuffer url = new StringBuffer();
resultDTOList.forEach(user->{
if(l.getUserId().equals(user.getUserId())){
name.append(user.getSurname()).append(user.getName());
url.append(user.getHeadImgUrl());
}
});
if("read".equals(l.getReadFlag())){
NoticeReadListResultDTO.NoticeReafdRecord read = new NoticeReadListResultDTO.NoticeReafdRecord();
read.setUserId(l.getUserId());
read.setUserName(name.toString());
read.setUserHeadPhoto(url.toString());
readList.add(read);
}else{
NoticeReadListResultDTO.NoticeReafdRecord unRead = new NoticeReadListResultDTO.NoticeReafdRecord();
unRead.setUserId(l.getUserId());
unRead.setUserName(name.toString());
unRead.setUserHeadPhoto(url.toString());
unReadList.add(unRead);
}
});
resultDTO.setReadCount(readList.size());
resultDTO.setUnReadCount(unReadList.size());
resultDTO.setReadList(readList);
resultDTO.setUnReadList(unReadList);
return resultDTO;
}
}

4
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java

@ -59,8 +59,8 @@ import com.epmet.modules.notice.service.NoticeService;
import com.epmet.resi.group.constant.TopicConstant;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.notice.NoticeDTO;
import com.epmet.resi.group.dto.topic.form.AddNoticeFormDTO;
import com.epmet.resi.group.dto.topic.form.EditNoticeFormDTO;
import com.epmet.resi.group.dto.notice.form.AddNoticeFormDTO;
import com.epmet.resi.group.dto.notice.form.EditNoticeFormDTO;
import com.epmet.resi.group.dto.topic.form.FileDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

7
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java

@ -380,4 +380,11 @@ public interface ModuleConstant extends Constant {
* 通过议题分享链接进组
*/
String ENTER_GROUP_TYPE_ISSUE_LINK = "issue_share_link";
/**
* 小组类型支部小组
*/
String GROUP_TYPE_BRANCH = "branch";
String IS_PARTY_MEMBER_ERR = "查询此人是不是党员失败了";
}

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

@ -245,6 +245,7 @@
<select id="getApplyingGroupsByCustIdAndGridId" parameterType="com.epmet.resi.group.dto.group.form.ApplyingGroupsFormDTO" resultType="com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO">
SELECT
gro.ID AS groupId,
gro.GROUP_TYPE AS groupType,
gro.GROUP_NAME AS groupName,
gro.GROUP_HEAD_PHOTO AS groupHeadPhoto,
oper.READ_FLAG AS readFlag,

10
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReafdRecordDao.xml

@ -3,6 +3,16 @@
<mapper namespace="com.epmet.modules.notice.dao.NoticeReafdRecordDao">
<select id="getByNoticeId" resultType="com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO">
SELECT
*
FROM
notice_reafd_record
WHERE
del_flag = '0'
AND notice_id = #{noticeId}
</select>
<delete id="delByNoticeId">
DELETE
FROM

9
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -505,4 +505,13 @@ public interface EpmetUserOpenFeignClient {
**/
@PostMapping(value = "/epmetuser/userrole/getuserroleinfo")
Result<List<UserRoleResultDTO>> getUserRoleInfo(@RequestBody UserRoleFormDTO userRoleFormDTO);
/**
* @Description 查询此人是不是党员true是党员false不是党员
* @Param userId
* @author zxc
* @date 2021/4/19 下午4:34
*/
@GetMapping(value = "/epmetuser/userrole/ispartymember")
Result<Boolean> selectIsPartyMemberByUserId(@RequestParam("userId") String userId);
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -358,4 +358,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<List<UserRoleResultDTO>> getUserRoleInfo(UserRoleFormDTO userRoleFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfo", userRoleFormDTO);
}
@Override
public Result<Boolean> selectIsPartyMemberByUserId(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectIsPartyMemberByUserId", userId);
}
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java

@ -132,4 +132,15 @@ public class UserRoleController {
public Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(@PathVariable("userId") String userId) {
return userRoleService.getUserRoleInfoByUserId(userId);
}
/**
* @Description 查询此人是不是党员true是党员false不是党员
* @Param userId
* @author zxc
* @date 2021/4/19 下午4:34
*/
@GetMapping("ispartymember")
public Result<Boolean> selectIsPartyMemberByUserId(@RequestParam("userId") String userId){
return new Result<Boolean>().ok(userRoleService.selectIsPartyMemberByUserId(userId));
}
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java

@ -81,4 +81,12 @@ public interface UserRoleDao extends BaseDao<UserRoleEntity> {
* @date 2020/11/18 上午10:50
*/
List<PartyMemberUserIdsResultDTO> selectPartyMemberUserIds();
/**
* @Description 查询此人是不是党员
* @Param userId
* @author zxc
* @date 2021/4/19 下午4:29
*/
Integer selectIsPartyMemberByUserId(@Param("userId")String userId);
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java

@ -122,4 +122,12 @@ public interface UserRoleService extends BaseService<UserRoleEntity> {
* @Date 14:24 2020-07-23
**/
Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(String userId);
/**
* @Description 查询此人是不是党员true是党员false不是党员
* @Param userId
* @author zxc
* @date 2021/4/19 下午4:34
*/
Boolean selectIsPartyMemberByUserId(String userId);
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java

@ -21,6 +21,7 @@ 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.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -138,4 +139,19 @@ public class UserRoleServiceImpl extends BaseServiceImpl<UserRoleDao, UserRoleEn
return new Result<List<UserRoleResultDTO>>().ok(list);
}
/**
* @Description 查询此人是不是党员true是党员false不是党员
* @Param userId
* @author zxc
* @date 2021/4/19 下午4:34
*/
@Override
public Boolean selectIsPartyMemberByUserId(String userId) {
Integer num = baseDao.selectIsPartyMemberByUserId(userId);
if (null != num && num > NumConstant.ZERO){
return true;
}
return false;
}
}

12
epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml

@ -112,4 +112,16 @@
AND er.ROLE_KEY = 'partymember'
</select>
<!-- 查询此人是不是党员 -->
<select id="selectIsPartyMemberByUserId" resultType="java.lang.Integer">
SELECT
COUNT(ur.USER_ID)
FROM user_role ur
LEFT JOIN epmet_role er ON er.ID = ur.ROLE_ID
WHERE ur.DEL_FLAG = 0
AND er.DEL_FLAG = 0
AND er.ROLE_KEY = 'partymember'
AND ur.USER_ID = #{userId}
</select>
</mapper>

Loading…
Cancel
Save