|
|
@ -26,15 +26,18 @@ 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; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.modules.notice.dao.NoticeDao; |
|
|
|
import com.epmet.modules.notice.dao.NoticeReafdRecordDao; |
|
|
|
import com.epmet.modules.notice.entity.NoticeEntity; |
|
|
|
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.form.ReadTypeFormDTO; |
|
|
|
import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -45,7 +48,6 @@ 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; |
|
|
|
|
|
|
|
/** |
|
|
@ -173,4 +175,39 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl<NoticeReafdRec |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 小组通知阅读状态修改 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void readType(TokenDto tokenDto, ReadTypeFormDTO formDTO) { |
|
|
|
//1.根据通知Id和当前用户查询是否存在通知阅读记录
|
|
|
|
NoticeReafdRecordEntity entity = baseDao.selectByNoticeId(formDTO.getNoticeId(), tokenDto.getUserId()); |
|
|
|
|
|
|
|
//2.不存在记录时新增已读记录
|
|
|
|
if (null == entity || StringUtils.isEmpty(entity.getId())) { |
|
|
|
//查询通知详情
|
|
|
|
NoticeEntity notice = noticeDao.selectById(formDTO.getNoticeId()); |
|
|
|
//新增当前人员已读数据
|
|
|
|
NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); |
|
|
|
reafdRecord.setCustomerId(notice.getCustomerId()); |
|
|
|
reafdRecord.setGridId(notice.getGridId()); |
|
|
|
reafdRecord.setGroupId(notice.getGroupId()); |
|
|
|
reafdRecord.setNoticeId(notice.getId()); |
|
|
|
reafdRecord.setUserId(tokenDto.getUserId()); |
|
|
|
reafdRecord.setReadFlag(ReadFlagConstant.READ); |
|
|
|
insert(reafdRecord); |
|
|
|
} else { |
|
|
|
//3.已存在记录且是已读状态不在修改
|
|
|
|
if (ReadFlagConstant.UN_READ.equals(entity.getReadFlag())) { |
|
|
|
entity.setReadFlag(ReadFlagConstant.READ); |
|
|
|
baseDao.updateById(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |