Browse Source

修改社群列表话题消息数量显示错误问题

dev
liuchuang 6 years ago
parent
commit
1805484a82
  1. 17
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/TopicServiceImpl.java
  2. 96
      esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/GroupTopicUserReadDTO.java
  3. 15
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.java
  4. 87
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/controller/GroupTopicUserReadController.java
  5. 44
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/GroupTopicUserReadDao.java
  6. 66
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/entity/GroupTopicUserReadEntity.java
  7. 106
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/GroupTopicUserReadService.java
  8. 106
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/GroupTopicUserReadServiceImpl.java
  9. 25
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java
  10. 10
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/GroupTopicUserReadDao.xml

17
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<CompleteDeptDTO> 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<ParentAndAllDeptDTO> dtoResult = adminFeignClient.getParentAndAllDept(userDetail.getGridId());
ParentAndAllDeptDTO deptDTO = dtoResult.getData();

96
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

15
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<GroupDao, GroupEntity> imp
@Autowired
private NewsTask newsTask;
@Autowired
private GroupTopicUserReadService groupTopicUserReadService;
@Override
public PageData<GroupManagementDTO> page(Map<String, Object> params) {
IPage<GroupManagementDTO> page = getPage(params);
@ -215,7 +220,15 @@ public class GroupServiceImpl extends BaseServiceImpl<GroupDao, GroupEntity> 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

87
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<PageData<GroupTopicUserReadDTO>> page(@RequestParam Map<String, Object> params){
PageData<GroupTopicUserReadDTO> page = groupTopicUserReadService.page(params);
return new Result<PageData<GroupTopicUserReadDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<GroupTopicUserReadDTO> get(@PathVariable("id") String id){
GroupTopicUserReadDTO data = groupTopicUserReadService.get(id);
return new Result<GroupTopicUserReadDTO>().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();
}
}

44
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<GroupTopicUserReadEntity> {
/**
*
* 更新话题已读未读标识
*
* @params [readDto]
* @return void
* @author liuchuang
* @since 2019/12/3 15:40
*/
void updateTopicReadFlag(GroupTopicUserReadDTO readDto);
}

66
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

106
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<GroupTopicUserReadEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<GroupTopicUserReadDTO>
* @author generator
* @date 2019-12-03
*/
PageData<GroupTopicUserReadDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<GroupTopicUserReadDTO>
* @author generator
* @date 2019-12-03
*/
List<GroupTopicUserReadDTO> list(Map<String, Object> 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);
}

106
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<GroupTopicUserReadDao, GroupTopicUserReadEntity> implements GroupTopicUserReadService {
@Override
public PageData<GroupTopicUserReadDTO> page(Map<String, Object> params) {
IPage<GroupTopicUserReadEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, GroupTopicUserReadDTO.class);
}
@Override
public List<GroupTopicUserReadDTO> list(Map<String, Object> params) {
List<GroupTopicUserReadEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, GroupTopicUserReadDTO.class);
}
private QueryWrapper<GroupTopicUserReadEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<GroupTopicUserReadEntity> 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);
}
}

25
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<TopicDao, TopicEntity> imp
@Autowired
private TopicChangeToIssueTask topicChangeToIssueTask;
@Autowired
private GroupTopicUserReadService groupTopicUserReadService;
@Override
public PageData<TopicDTO> page(Map<String, Object> params) {
IPage<TopicEntity> page = baseDao.selectPage(
@ -174,6 +180,25 @@ public class TopicServiceImpl extends BaseServiceImpl<TopicDao, TopicEntity> imp
if (insert(entity)) {
// 保存图片
topicImgService.saveImages(formDto.getImages(), entity.getId(), TopicImageConstant.TYPE_IMAGE_BIZ_TOPIC);
// 记录社群用户未读记录
List<GroupUserListResultDTO> groupUsers = userGroupService.listOfUserGroup(formDto.getGroupId(), GroupUserStateEnum.GROUP_USER_STATE_EXAMINATION_PASSED.getValue());
List<GroupTopicUserReadEntity> 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();

10
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/GroupTopicUserReadDao.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.modules.topic.dao.GroupTopicUserReadDao">
<update id="updateTopicReadFlag">
UPDATE epdc_group_topic_user_read SET READ_FLAG = #{readFlag} WHERE GROUP_ID = #{groupId} AND USER_ID = #{userId}
</update>
</mapper>
Loading…
Cancel
Save