diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/TopicServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/TopicServiceImpl.java index 083a05e14..776672f3c 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/TopicServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/TopicServiceImpl.java @@ -2,16 +2,11 @@ package com.elink.esua.epdc.service.impl; import com.elink.esua.epdc.common.token.dto.TokenDto; import com.elink.esua.epdc.commons.tools.utils.Result; -import com.elink.esua.epdc.dto.CompleteDeptDTO; import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; -import com.elink.esua.epdc.dto.UploadDTO; import com.elink.esua.epdc.dto.UploadToOssDTO; import com.elink.esua.epdc.dto.enums.TopicStateEnum; import com.elink.esua.epdc.dto.group.result.TopicAuditRecordResultDTO; -import com.elink.esua.epdc.dto.topic.form.TopicChangeToIssueFormDTO; -import com.elink.esua.epdc.dto.topic.form.TopicListFormDTO; -import com.elink.esua.epdc.dto.topic.form.TopicCloseFormDTO; -import com.elink.esua.epdc.dto.topic.form.TopicSubmitFormDTO; +import com.elink.esua.epdc.dto.topic.form.*; import com.elink.esua.epdc.dto.topic.result.TopicDetailResultDTO; import com.elink.esua.epdc.dto.topic.result.TopicListResultDTO; import com.elink.esua.epdc.feign.AdminFeignClient; @@ -47,16 +42,6 @@ public class TopicServiceImpl implements TopicService { if (null == userDetail) { return new Result().error("获取用户信息失败"); } - - // 获取该网格所有上级机构 -// Result deptDTOResult = adminFeignClient.getCompleteDept(userDetail.getGridId()); -// CompleteDeptDTO deptDTO = deptDTOResult.getData(); -// formDto.setArea(deptDTO.getDistrict()); -// formDto.setAreaId(deptDTO.getDistrictId()); -// formDto.setStreet(deptDTO.getStreet()); -// formDto.setStreetId(deptDTO.getStreetId()); -// formDto.setCommunity(deptDTO.getCommunity()); -// formDto.setCommunityId(deptDTO.getCommunityId()); //获取所有上级机构名称和ID拼接 Result dtoResult = adminFeignClient.getParentAndAllDept(userDetail.getGridId()); ParentAndAllDeptDTO deptDTO = dtoResult.getData(); diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/GroupTopicUserReadDTO.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/GroupTopicUserReadDTO.java new file mode 100644 index 000000000..af33f0671 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/GroupTopicUserReadDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 社群话题用户阅读表 社群话题用户阅读表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-03 + */ +@Data +public class GroupTopicUserReadDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 友邻社群ID + */ + private String groupId; + + /** + * 话题ID + */ + private String topicId; + + /** + * 话题发布时间 + */ + private Date topicSubmitTime; + + /** + * 用户ID + */ + private String userId; + + /** + * 阅读标记 是否已读:0否;1是 + */ + private String readFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 删除标记 + */ + private String delFlag; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.java index 627b0a7aa..8161afd5b 100644 --- a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.java @@ -32,12 +32,14 @@ import com.elink.esua.epdc.dto.enums.GroupStateEnum; import com.elink.esua.epdc.dto.enums.GroupUserStateEnum; import com.elink.esua.epdc.dto.group.form.*; import com.elink.esua.epdc.dto.group.result.*; +import com.elink.esua.epdc.dto.topic.GroupTopicUserReadDTO; import com.elink.esua.epdc.modules.async.NewsTask; import com.elink.esua.epdc.modules.group.dao.GroupDao; import com.elink.esua.epdc.modules.group.entity.GroupEntity; import com.elink.esua.epdc.modules.group.entity.UserGroupEntity; import com.elink.esua.epdc.modules.group.service.GroupService; import com.elink.esua.epdc.modules.group.service.UserGroupService; +import com.elink.esua.epdc.modules.topic.service.GroupTopicUserReadService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -62,6 +64,9 @@ public class GroupServiceImpl extends BaseServiceImpl imp @Autowired private NewsTask newsTask; + @Autowired + private GroupTopicUserReadService groupTopicUserReadService; + @Override public PageData page(Map params) { IPage page = getPage(params); @@ -215,7 +220,15 @@ public class GroupServiceImpl extends BaseServiceImpl imp @Override public GroupDetailForMobileEndResultDTO getGroupDetailForMobileEnd(GroupDetailForMobileEndFormDTO formDto) { - return baseDao.selectOneOfGroupDetailForMobileEnd(formDto); + // 获取社群详情 + GroupDetailForMobileEndResultDTO resultDto = baseDao.selectOneOfGroupDetailForMobileEnd(formDto); + // 更新用户未读标识为已读 + GroupTopicUserReadDTO readDto = new GroupTopicUserReadDTO(); + readDto.setGroupId(resultDto.getId()); + readDto.setUserId(formDto.getUserId()); + readDto.setReadFlag(NumConstant.ONE_STR); + groupTopicUserReadService.modifyTopicReadFlag(readDto); + return resultDto; } @Override diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/controller/GroupTopicUserReadController.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/controller/GroupTopicUserReadController.java new file mode 100644 index 000000000..54ffb90f0 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/controller/GroupTopicUserReadController.java @@ -0,0 +1,87 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.topic.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.topic.GroupTopicUserReadDTO; +import com.elink.esua.epdc.modules.topic.service.GroupTopicUserReadService; +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; + + +/** + * 社群话题用户阅读表 社群话题用户阅读表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-03 + */ +@RestController +@RequestMapping("grouptopicuserread") +public class GroupTopicUserReadController { + + @Autowired + private GroupTopicUserReadService groupTopicUserReadService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = groupTopicUserReadService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + GroupTopicUserReadDTO data = groupTopicUserReadService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody GroupTopicUserReadDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + groupTopicUserReadService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody GroupTopicUserReadDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + groupTopicUserReadService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + groupTopicUserReadService.delete(ids); + return new Result(); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/GroupTopicUserReadDao.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/GroupTopicUserReadDao.java new file mode 100644 index 000000000..2dd7e62f6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/GroupTopicUserReadDao.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.topic.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.topic.GroupTopicUserReadDTO; +import com.elink.esua.epdc.modules.topic.entity.GroupTopicUserReadEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 社群话题用户阅读表 社群话题用户阅读表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-03 + */ +@Mapper +public interface GroupTopicUserReadDao extends BaseDao { + + /** + * + * 更新话题已读未读标识 + * + * @params [readDto] + * @return void + * @author liuchuang + * @since 2019/12/3 15:40 + */ + void updateTopicReadFlag(GroupTopicUserReadDTO readDto); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/entity/GroupTopicUserReadEntity.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/entity/GroupTopicUserReadEntity.java new file mode 100644 index 000000000..53bb39b7d --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/entity/GroupTopicUserReadEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.topic.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 社群话题用户阅读表 社群话题用户阅读表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-03 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_group_topic_user_read") +public class GroupTopicUserReadEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 友邻社群ID + */ + private String groupId; + + /** + * 话题ID + */ + private String topicId; + + /** + * 话题发布时间 + */ + private Date topicSubmitTime; + + /** + * 用户ID + */ + private String userId; + + /** + * 阅读标记 是否已读:0否;1是 + */ + private String readFlag; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/GroupTopicUserReadService.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/GroupTopicUserReadService.java new file mode 100644 index 000000000..139b2863a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/GroupTopicUserReadService.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.topic.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.topic.GroupTopicUserReadDTO; +import com.elink.esua.epdc.modules.topic.entity.GroupTopicUserReadEntity; + +import java.util.List; +import java.util.Map; + +/** + * 社群话题用户阅读表 社群话题用户阅读表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-03 + */ +public interface GroupTopicUserReadService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2019-12-03 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2019-12-03 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GroupTopicUserReadDTO + * @author generator + * @date 2019-12-03 + */ + GroupTopicUserReadDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2019-12-03 + */ + void save(GroupTopicUserReadDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2019-12-03 + */ + void update(GroupTopicUserReadDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2019-12-03 + */ + void delete(String[] ids); + + /** + * + * 更新话题已读未读标识 + * + * @params [readDto] + * @return void + * @author liuchuang + * @since 2019/12/3 15:40 + */ + void modifyTopicReadFlag(GroupTopicUserReadDTO readDto); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/GroupTopicUserReadServiceImpl.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/GroupTopicUserReadServiceImpl.java new file mode 100644 index 000000000..1f2a9e4fb --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/GroupTopicUserReadServiceImpl.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.topic.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.dto.topic.GroupTopicUserReadDTO; +import com.elink.esua.epdc.modules.topic.dao.GroupTopicUserReadDao; +import com.elink.esua.epdc.modules.topic.entity.GroupTopicUserReadEntity; +import com.elink.esua.epdc.modules.topic.service.GroupTopicUserReadService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 社群话题用户阅读表 社群话题用户阅读表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-03 + */ +@Service +public class GroupTopicUserReadServiceImpl extends BaseServiceImpl implements GroupTopicUserReadService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GroupTopicUserReadDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GroupTopicUserReadDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public GroupTopicUserReadDTO get(String id) { + GroupTopicUserReadEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GroupTopicUserReadDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GroupTopicUserReadDTO dto) { + GroupTopicUserReadEntity entity = ConvertUtils.sourceToTarget(dto, GroupTopicUserReadEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GroupTopicUserReadDTO dto) { + GroupTopicUserReadEntity entity = ConvertUtils.sourceToTarget(dto, GroupTopicUserReadEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void modifyTopicReadFlag(GroupTopicUserReadDTO readDto) { + baseDao.updateTopicReadFlag(readDto); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java index 246f52b26..ad59725ef 100644 --- a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java @@ -40,6 +40,7 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO; import com.elink.esua.epdc.dto.events.form.EpdcEventSubmitFormDTO; import com.elink.esua.epdc.dto.group.GroupDTO; import com.elink.esua.epdc.dto.group.UserGroupDTO; +import com.elink.esua.epdc.dto.group.result.GroupUserListResultDTO; import com.elink.esua.epdc.dto.group.result.TopicAuditRecordResultDTO; import com.elink.esua.epdc.dto.issue.IssueDTO; import com.elink.esua.epdc.dto.topic.TopicDTO; @@ -58,8 +59,10 @@ import com.elink.esua.epdc.modules.feign.EventFeignClient; import com.elink.esua.epdc.modules.group.service.GroupService; import com.elink.esua.epdc.modules.group.service.UserGroupService; import com.elink.esua.epdc.modules.topic.dao.TopicDao; +import com.elink.esua.epdc.modules.topic.entity.GroupTopicUserReadEntity; import com.elink.esua.epdc.modules.topic.entity.TopicAuditRecordEntity; import com.elink.esua.epdc.modules.topic.entity.TopicEntity; +import com.elink.esua.epdc.modules.topic.service.GroupTopicUserReadService; import com.elink.esua.epdc.modules.topic.service.TopicAuditRecordService; import com.elink.esua.epdc.modules.topic.service.TopicImgService; import com.elink.esua.epdc.modules.topic.service.TopicService; @@ -103,6 +106,9 @@ public class TopicServiceImpl extends BaseServiceImpl imp @Autowired private TopicChangeToIssueTask topicChangeToIssueTask; + @Autowired + private GroupTopicUserReadService groupTopicUserReadService; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -174,6 +180,25 @@ public class TopicServiceImpl extends BaseServiceImpl imp if (insert(entity)) { // 保存图片 topicImgService.saveImages(formDto.getImages(), entity.getId(), TopicImageConstant.TYPE_IMAGE_BIZ_TOPIC); + // 记录社群用户未读记录 + List groupUsers = userGroupService.listOfUserGroup(formDto.getGroupId(), GroupUserStateEnum.GROUP_USER_STATE_EXAMINATION_PASSED.getValue()); + List readEntities = new ArrayList<>(groupUsers.size()); + for (GroupUserListResultDTO userDto: + groupUsers) { + if (!formDto.getUserId().equals(userDto.getUserId())) { + GroupTopicUserReadEntity readEntity = new GroupTopicUserReadEntity(); + readEntity.setGroupId(formDto.getGroupId()); + readEntity.setTopicId(entity.getId()); + readEntity.setTopicSubmitTime(entity.getCreatedTime()); + readEntity.setUserId(userDto.getUserId()); + readEntity.setReadFlag(NumConstant.ZERO_STR); + + readEntities.add(readEntity); + } + } + + groupTopicUserReadService.insertBatch(readEntities); + return new Result(); } return new Result().error(); diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/GroupTopicUserReadDao.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/GroupTopicUserReadDao.xml new file mode 100644 index 000000000..e3d98a954 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/GroupTopicUserReadDao.xml @@ -0,0 +1,10 @@ + + + + + + + UPDATE epdc_group_topic_user_read SET READ_FLAG = #{readFlag} WHERE GROUP_ID = #{groupId} AND USER_ID = #{userId} + + + \ No newline at end of file