Browse Source

代码优化调整

master
sunyuchao 4 years ago
parent
commit
b665709ee0
  1. 7
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java
  2. 12
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java
  3. 13
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java
  4. 5
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java
  5. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentListFormDTO.java
  6. 23
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeFileDTO.java
  7. 5
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/ReadTypeFormDTO.java
  8. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  9. 3
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  10. 7
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  11. 22
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java
  12. 21
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java
  13. 24
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java
  14. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java
  15. 8
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java
  16. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java
  17. 11
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeService.java
  18. 22
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java
  19. 19
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java
  20. 58
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java
  21. 7
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml

7
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 {
}
}

12
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<FileDTO> imageList;
private List<NoticeFileDTO> imageList;
/**
* 文件附件url集合
*/
private List<FileDTO> docList;
private List<NoticeFileDTO> docList;
/**
* token中用户Id
*/
private String userId;
public interface Add{}
public interface AddUserShow extends CustomerClientShowGroup {}
}

13
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<FileDTO> imageList;
private List<NoticeFileDTO> imageList;
/**
* 文件附件url集合
*/
private List<FileDTO> docList;
private List<NoticeFileDTO> docList;
/**
* token中用户Id
*/
private String userId;
public interface Edit{}
public interface EditUserShow extends CustomerClientShowGroup {}
}

5
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 {}
}

2
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;
/**
* 每页多少条数据
* */

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

5
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{}
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java

@ -31,18 +31,12 @@ 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;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.HashMap;
import java.util.List;
@ -513,7 +507,8 @@ public class ResiGroupController {
@PostMapping(value = "allgrouplist")
public Result<List<AllGroupListResultDTO>> allGroupList(@LoginUser TokenDto tokenDto, @RequestBody AllGroupListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AllGroupListFormDTO.GroupList.class);
return new Result<List<AllGroupListResultDTO>>().ok(resiGroupService.allGroupList(tokenDto, formDTO));
formDTO.setUserId(tokenDto.getUserId());
return new Result<List<AllGroupListResultDTO>>().ok(resiGroupService.allGroupList(formDTO));
}
}

3
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<ResiGroupEntity> {
* @Author sun
* @Description 所有小组查询
**/
List<AllGroupListResultDTO> allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO);
List<AllGroupListResultDTO> allGroupList(AllGroupListFormDTO formDTO);
}

7
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<ResiGroupDao, ResiGrou
* @Description 所有小组查询
**/
@Override
public List<AllGroupListResultDTO> allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO) {
public List<AllGroupListResultDTO> allGroupList(AllGroupListFormDTO formDTO) {
//1.分页查询网格下所有小组列表且是审核通过状态的,以组内人员数从多到少排序
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
formDTO.setPageNo(pageIndex);
@ -1511,7 +1510,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
//2.查询当前用户居民端角色列表
AtomicBoolean isPartymember = new AtomicBoolean(false);
Result<List<UserRoleResultDTO>> resultDTOList = epmetUserOpenFeignClient.getUserRoleInfoByUserId(tokenDto.getUserId());
Result<List<UserRoleResultDTO>> resultDTOList = epmetUserOpenFeignClient.getUserRoleInfoByUserId(formDTO.getUserId());
if (!resultDTOList.success()) {
throw new RenException("调用user服务,获取用户基础数据失败");
}
@ -1529,7 +1528,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
dto.setStatus("rejected");
continue;
}
GroupMemeberOperationDTO operation = groupMemeberOperationService.selectLatestRecord(dto.getGroupId(), tokenDto.getUserId());
GroupMemeberOperationDTO operation = groupMemeberOperationService.selectLatestRecord(dto.getGroupId(), formDTO.getUserId());
if (null != operation) {
dto.setStatus(operation.getOperateStatus());
}

22
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<List<NoticeCommentListResultDTO>> noticeCommentList(@LoginUser TokenDto tokenDto, @RequestBody NoticeCommentListFormDTO formDTO){
public Result<List<NoticeCommentListResultDTO>> noticeCommentList(@RequestBody NoticeCommentListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, NoticeCommentListFormDTO.CommentList.class);
return new Result<List<NoticeCommentListResultDTO>>().ok(noticeCommentService.noticeCommentList(tokenDto, formDTO));
return new Result<List<NoticeCommentListResultDTO>>().ok(noticeCommentService.noticeCommentList(formDTO));
}
}

21
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<NoticeDetailResultDTO> noticeDetail(@LoginUser TokenDto tokenDto, @RequestBody NoticeDetailFormDTO formDTO){
public Result<NoticeDetailResultDTO> noticeDetail(@RequestBody NoticeDetailFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, NoticeDetailFormDTO.Detail.class);
return new Result<NoticeDetailResultDTO>().ok(noticeService.noticeDetail(tokenDto, formDTO));
return new Result<NoticeDetailResultDTO>().ok(noticeService.noticeDetail(formDTO));
}
}

24
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<NoticeReadListResultDTO> noticeReadList(@LoginUser TokenDto tokenDto, @RequestBody NoticeReadListFormDTO formDTO){
public Result<NoticeReadListResultDTO> noticeReadList(@RequestBody NoticeReadListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, NoticeReadListFormDTO.List.class);
return new Result<NoticeReadListResultDTO>().ok(noticeReafdRecordService.noticeReadList(tokenDto, formDTO));
return new Result<NoticeReadListResultDTO>().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();
}

4
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<NoticeReadRecordEntity> {
/**
* @Author sun
* @Description 根据通知Id查询组成员已读未读数据
* @Description 根据通知Id查询组成员已读未读数据,抛去组长数据
**/
List<NoticeReadRecordDTO> getByNoticeId(@Param("noticeId") String noticeId);
List<NoticeReadRecordDTO> getByNoticeId(@Param("noticeId") String noticeId, @Param("leaderId") String leaderId);
/**
* @Author sun

8
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<NoticeCommentEntity> {
* @Author sun
* @Description 发布通知评论
**/
void noticeComment(TokenDto tokenDto, NoticeCommentFormDTO formDTO);
void noticeComment(NoticeCommentFormDTO formDTO);
/**
* @param formDTO
@ -51,5 +47,5 @@ public interface NoticeCommentService extends BaseService<NoticeCommentEntity> {
* @Author sun
* @Description 通知评论列表查询
**/
List<NoticeCommentListResultDTO> noticeCommentList(TokenDto tokenDto, NoticeCommentListFormDTO formDTO);
List<NoticeCommentListResultDTO> noticeCommentList(NoticeCommentListFormDTO formDTO);
}

10
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<NoticeReadRecordEnt
* @Author sun
* @Description 通知已读未读列表查询
**/
NoticeReadListResultDTO noticeReadList(TokenDto tokenDto, NoticeReadListFormDTO formDTO);
NoticeReadListResultDTO noticeReadList(NoticeReadListFormDTO formDTO);
/**
* @param formDTO
@ -51,5 +45,5 @@ public interface NoticeReadRecordService extends BaseService<NoticeReadRecordEnt
* @Author sun
* @Description 小组通知阅读状态修改
**/
void readType(TokenDto tokenDto, ReadTypeFormDTO formDTO);
void readType(ReadTypeFormDTO formDTO);
}

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

@ -18,8 +18,6 @@
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.NoticeEntity;
import com.epmet.resi.group.dto.notice.NoticeDTO;
import com.epmet.resi.group.dto.notice.form.AddNoticeFormDTO;
@ -27,9 +25,6 @@ import com.epmet.resi.group.dto.notice.form.EditNoticeFormDTO;
import com.epmet.resi.group.dto.notice.form.NoticeDetailFormDTO;
import com.epmet.resi.group.dto.notice.result.NoticeDetailResultDTO;
import java.util.List;
import java.util.Map;
/**
* 小组通知表
*
@ -54,7 +49,7 @@ public interface NoticeService extends BaseService<NoticeEntity> {
* @Author sun
* @Description 小组通知保存
**/
void add(TokenDto tokenDto, AddNoticeFormDTO formDTO);
void add(AddNoticeFormDTO formDTO);
/**
* @param formDTO
@ -62,7 +57,7 @@ public interface NoticeService extends BaseService<NoticeEntity> {
* @Author sun
* @Description 小组通知变更
**/
void edit(TokenDto tokenDto, EditNoticeFormDTO formDTO);
void edit(EditNoticeFormDTO formDTO);
/**
* @param formDTO
@ -70,5 +65,5 @@ public interface NoticeService extends BaseService<NoticeEntity> {
* @Author sun
* @Description 小组通知详情
**/
NoticeDetailResultDTO noticeDetail(TokenDto tokenDto, NoticeDetailFormDTO formDTO);
NoticeDetailResultDTO noticeDetail(NoticeDetailFormDTO formDTO);
}

22
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<NoticeCommentDao,
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void noticeComment(TokenDto tokenDto, NoticeCommentFormDTO formDTO) {
public void noticeComment(NoticeCommentFormDTO formDTO) {
//1.内容安全校验
String commentContent = formDTO.getCommentContent();
if (StringUtils.isNotBlank(commentContent)) {
@ -116,12 +110,12 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl<NoticeCommentDao,
//2.判断当前用户是否被禁言、移除、非本组成员
NoticeDTO notice = noticeService.get(formDTO.getNoticeId());
if (null == notice) {
logger.error(ModuleConstant.NO_SUCH_TOPIC);
throw new RenException(ModuleConstant.NO_SUCH_TOPIC);
logger.error("通知评论,未查询到通知数据");
throw new RenException(String.format("通知评论,未查询到通知数据,通知Id->", 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<NoticeCommentDao,
* @Description 通知评论列表查询
**/
@Override
public List<NoticeCommentListResultDTO> noticeCommentList(TokenDto tokenDto, NoticeCommentListFormDTO formDTO) {
public List<NoticeCommentListResultDTO> noticeCommentList(NoticeCommentListFormDTO formDTO) {
//1.分页查询通知评论列表
formDTO.setPageNo((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize());
List<NoticeCommentListResultDTO> resultList = baseDao.getNoticeCommentList(formDTO);

19
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<NoticeReadRecor
@Autowired
private NoticeDao noticeDao;
/**
* @param formDTO
* @return
@ -74,7 +65,7 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl<NoticeReadRecor
* @Description 通知已读未读列表查询
**/
@Override
public NoticeReadListResultDTO noticeReadList(TokenDto tokenDto, NoticeReadListFormDTO formDTO) {
public NoticeReadListResultDTO noticeReadList(NoticeReadListFormDTO formDTO) {
NoticeReadListResultDTO resultDTO = new NoticeReadListResultDTO();
List<NoticeReadListResultDTO.NoticeReafdRecord> readList = new ArrayList<>();
List<NoticeReadListResultDTO.NoticeReafdRecord> unReadList = new ArrayList<>();
@ -82,7 +73,7 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl<NoticeReadRecor
String leaderId = noticeDao.selectNoticeGroupLeader(formDTO.getNoticeId());
//1.根据通知Id查询组成员已读未读数据
List<NoticeReadRecordDTO> list = baseDao.getByNoticeId(formDTO.getNoticeId());
List<NoticeReadRecordDTO> list = baseDao.getByNoticeId(formDTO.getNoticeId(), leaderId);
//2.调用user服务,查询人员基础数据
List<String> userIdList = list.stream().map(NoticeReadRecordDTO::getUserId).collect(Collectors.toList());
@ -132,9 +123,9 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl<NoticeReadRecor
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void readType(TokenDto tokenDto, ReadTypeFormDTO formDTO) {
public void readType(ReadTypeFormDTO formDTO) {
//1.根据通知Id和当前用户查询是否存在通知阅读记录
NoticeReadRecordEntity entity = baseDao.selectByNoticeId(formDTO.getNoticeId(), tokenDto.getUserId());
NoticeReadRecordEntity entity = baseDao.selectByNoticeId(formDTO.getNoticeId(), formDTO.getUserId());
//2.不存在记录时新增已读记录
if (null == entity || StringUtils.isEmpty(entity.getId())) {
@ -146,7 +137,7 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl<NoticeReadRecor
reafdRecord.setGridId(notice.getGridId());
reafdRecord.setGroupId(notice.getGroupId());
reafdRecord.setNoticeId(notice.getId());
reafdRecord.setUserId(tokenDto.getUserId());
reafdRecord.setUserId(formDTO.getUserId());
reafdRecord.setReadFlag(ReadFlagConstant.READ);
insert(reafdRecord);
} else {

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

@ -18,31 +18,26 @@
package com.epmet.modules.notice.service.impl;
import cn.hutool.core.collection.CollUtil;
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.AppClientConstant;
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.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.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.constant.ReadFlagConstant;
import com.epmet.dto.form.LoginUserDetailsFormDTO;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.result.GridInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.modules.constant.UserMessageConstant;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
@ -63,10 +58,9 @@ import com.epmet.resi.group.dto.notice.NoticeDTO;
import com.epmet.resi.group.dto.notice.form.AddNoticeFormDTO;
import com.epmet.resi.group.dto.notice.form.EditNoticeFormDTO;
import com.epmet.resi.group.dto.notice.form.NoticeDetailFormDTO;
import com.epmet.resi.group.dto.notice.form.NoticeFileDTO;
import com.epmet.resi.group.dto.notice.result.NoticeDetailResultDTO;
import com.epmet.resi.group.dto.topic.form.FileDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -74,7 +68,10 @@ 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.Date;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@ -103,6 +100,8 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
@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<NoticeDao, NoticeEntity>
@Autowired
private NoticeReadRecordService noticeReafdRecordService;
@Autowired
private NoticeReadRecordDao noticeReafdRecordDao;
private NoticeReadRecordDao noticeReadRecordDao;
@Override
@ -128,7 +127,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void add(TokenDto tokenDto, AddNoticeFormDTO formDTO) {
public void add(AddNoticeFormDTO formDTO) {
//1.查询组内成员数据
List<ResiGroupMemberDTO> memberList = resiGroupMemberDao.getMemberList(formDTO.getGroupId());
if (CollUtil.isEmpty(memberList)) {
@ -138,7 +137,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
//2.校验当前操作人员是否为组长
AtomicReference<Boolean> 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<NoticeDao, NoticeEntity>
List<String> wordList = new ArrayList<>();
wordList.add(formDTO.getTitle());
wordList.add(formDTO.getContent());
List<String> imageList = formDTO.getImageList().stream().map(FileDTO::getUrl).collect(Collectors.toList());
List<String> 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<LoginUserDetailsResultDTO> 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<GridInfoResultDTO> 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<NoticeDao, NoticeEntity>
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<NoticeDao, NoticeEntity>
* @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<NoticeDao, NoticeEntity>
List<String> wordList = new ArrayList<>();
wordList.add(formDTO.getTitle());
wordList.add(formDTO.getContent());
List<String> imageList = formDTO.getImageList().stream().map(FileDTO::getUrl).collect(Collectors.toList());
List<String> imageList = formDTO.getImageList().stream().map(NoticeFileDTO::getUrl).collect(Collectors.toList());
safetyCheck(wordList, imageList);
//3.查询组成员列表数据
@ -346,7 +342,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
}
//6.通知已读未读消息表数据先删后增
noticeReafdRecordDao.delByNoticeId(formDTO.getNoticeId());
noticeReadRecordDao.delByNoticeId(formDTO.getNoticeId());
List<NoticeReadRecordEntity> reafdRecordList = new ArrayList<>();
memberList.forEach(m -> {
NoticeReadRecordEntity reafdRecord = new NoticeReadRecordEntity();
@ -358,7 +354,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
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<NoticeDao, NoticeEntity>
//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<UserMessageFormDTO> userMessageFormDTOS = new ArrayList<>();
@ -400,7 +396,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
* @Description 小组通知详情
**/
@Override
public NoticeDetailResultDTO noticeDetail(TokenDto tokenDto, NoticeDetailFormDTO formDTO) {
public NoticeDetailResultDTO noticeDetail(NoticeDetailFormDTO formDTO) {
NoticeDetailResultDTO resultDTO = new NoticeDetailResultDTO();
List<NoticeDetailResultDTO.File> imageList = new ArrayList<>();
List<NoticeDetailResultDTO.File> docList = new ArrayList<>();

7
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}
</select>
<select id="selectByNoticeId" resultType="com.epmet.modules.notice.entity.NoticeReadRecordEntity">
SELECT
*
FROM
notice_reafd_record
notice_read_record
WHERE
del_flag = '0'
AND notice_id = #{noticeId}
@ -27,7 +28,7 @@
<delete id="delByNoticeId">
DELETE
FROM
notice_reafd_record
notice_read_record
WHERE
notice_id = #{noticeId}
</delete>

Loading…
Cancel
Save