咨询bug

This commit is contained in:
DESKTOP-BLB5287\FP
2025-07-09 16:57:07 +08:00
parent ec897c0567
commit 7c69912296
6 changed files with 25 additions and 35 deletions
@@ -112,7 +112,7 @@ public class ConNotice implements Serializable {
* 咨询类型 * 咨询类型
*/ */
@Excel(name = "咨询类型", width = 15, dicCode = "notice_type") @Excel(name = "咨询类型", width = 15, dicCode = "notice_type")
@Schema(title = "咨询类型(notice_type 0:图文咨询 1:音视频咨询)") @Schema(title = "咨询类型(notice_type 0:视屏咨询 1:图文频咨询)")
@Dict(dicCode = "notice_type") @Dict(dicCode = "notice_type")
private String noticeType; private String noticeType;
@@ -34,5 +34,5 @@ public class ConNoticeVO {
@Dict(dicCode = "notice_type") @Dict(dicCode = "notice_type")
@Schema(title = "咨询类型(notice_type 0:图文咨询 1:音视频咨询)") @Schema(title = "咨询类型(notice_type 0:图文咨询 1:音视频咨询)")
private String type; private String noticeType;
} }
@@ -1,73 +1,63 @@
package com.renkang.consultation.api.service.impl; package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.renkang.consultation.api.RedisConstants;
import com.renkang.consultation.api.service.ConNoticeApiService; import com.renkang.consultation.api.service.ConNoticeApiService;
import com.renkang.consultation.dto.NoticeOnOrOff; import com.renkang.consultation.dto.NoticeOnOrOff;
import com.renkang.consultation.entity.ConNotice; import com.renkang.consultation.entity.ConNotice;
import com.renkang.consultation.entity.ConNoticeDO; import com.renkang.consultation.entity.ConNoticeDO;
import com.renkang.consultation.mapper.ConNoticeMapper; import com.renkang.consultation.mapper.ConNoticeMapper;
import org.apache.shiro.SecurityUtils; import lombok.RequiredArgsConstructor;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.global.GlobalUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.jeecg.util.RedisClientUtil;
import org.springframework.data.redis.core.RedisTemplate; import org.jeecg.util.RedisKeyPrefix;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Service("conNoticeApiService") @Service("conNoticeApiService")
@RequiredArgsConstructor
public class ConNoticeServiceApiImpl implements ConNoticeApiService { public class ConNoticeServiceApiImpl implements ConNoticeApiService {
private final ConNoticeMapper conNoticeMapper;
private final String NOTICE_KEY_1 = "consultation:notice:1:";
@Autowired private final String NOTICE_KEY_0 = "consultation:notice:0:";
private ConNoticeMapper conNoticeMapper; private final RedisClientUtil redisClientUtil;
@Autowired
private RedisTemplate redisTemplate;
@Override @Override
public Result<ConNoticeDO> selectUserNotice(String type) { public Result<ConNoticeDO> selectUserNotice(String type) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userId = GlobalUtils.getLoginUser().getId();
String userId = sysUser.getId(); String keyPrefix = "0".equals(type)? NOTICE_KEY_0 : NOTICE_KEY_1;
String flag = redisClientUtil.get(new RedisKeyPrefix(keyPrefix), userId, String.class);
if (redisTemplate.hasKey(RedisConstants.NOTICE_USER_TF.getKey(userId, type))) { if (StrUtil.isNotEmpty(flag)) {
return Result.ok(); return Result.ok();
} }
ConNotice conNotice = conNoticeMapper.selectNoticeByType(type); ConNotice conNotice = conNoticeMapper.selectNoticeByType(type);
if (conNotice != null) { if (conNotice != null) {
return Result.ok(BeanUtil.copyProperties(conNotice, ConNoticeDO.class)); return Result.ok(BeanUtil.copyProperties(conNotice, ConNoticeDO.class));
} }
return Result.ok(); return Result.ok();
} }
@Override @Override
public Result<String> chooseToDontShowUp(String id, String notShow) { public Result<String> chooseToDontShowUp(String id, String notShow) {
RedisConstants redisKey = RedisConstants.NOTICE_USER_TF; String userId = GlobalUtils.getLoginUser().getId();
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = sysUser.getId();
ConNotice conNotice = conNoticeMapper.selectById(id); ConNotice conNotice = conNoticeMapper.selectById(id);
if (conNotice == null) { if (conNotice == null) {
return Result.error("信息不存在"); return Result.error("信息不存在");
} }
String keyPrefix = "0".equals(conNotice.getNoticeType())? NOTICE_KEY_0 : NOTICE_KEY_1;
redisTemplate.opsForValue().set(redisKey.getKey(userId, conNotice.getType()), "1"); //2-不在提醒,1-一个月,0-7天
if ("0".equals(notShow)) { if ("0".equals(notShow)) {
redisTemplate.expire(redisKey.getKey(userId, conNotice.getType()), 7, redisKey.getTimeUnit()); redisClientUtil.set(new RedisKeyPrefix(604800,keyPrefix), userId,String.valueOf(1));
} }
if ("1".equals(notShow)) { if ("1".equals(notShow)) {
redisTemplate.expire(redisKey.getKey(userId, conNotice.getType()), 30, redisKey.getTimeUnit()); redisClientUtil.set(new RedisKeyPrefix(2592000,keyPrefix), userId,String.valueOf(1));
} }
if ("2".equals(notShow)) { if ("2".equals(notShow)) {
redisTemplate.expire(redisKey.getKey(userId, conNotice.getType()), 180, redisKey.getTimeUnit()); redisClientUtil.set(new RedisKeyPrefix(-1,keyPrefix), userId,String.valueOf(1));
} }
return Result.ok(); return Result.ok();
@@ -1873,7 +1873,7 @@ public class ConSessionApiServiceImpl implements ConSessionApiService {
}*/ }*/
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
com.baomidou.mybatisplus.extension.plugins.pagination.Page<ConSessionDO> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<ConSessionDO>(pageNo, pageSize); Page<ConSessionDO> page = new Page<ConSessionDO>(pageNo, pageSize);
List<ConSessionDO> list = conSessionMapper.selectSessionListByUserIdHelperAnother(page, null, null, sysUser.getId()); List<ConSessionDO> list = conSessionMapper.selectSessionListByUserIdHelperAnother(page, null, null, sysUser.getId());
@@ -24,7 +24,7 @@ public interface ConNoticeMapper extends BaseMapper<ConNotice> {
*/ */
IPage<ConNotice> queryPageList(IPage<ConNotice> page, @Param("conNotice") ConNotice conNotice); IPage<ConNotice> queryPageList(IPage<ConNotice> page, @Param("conNotice") ConNotice conNotice);
@Select("SELECT * FROM con_notice WHERE status = '1' and del_flag = '0' and type = #{type} order by create_time desc limit 1") @Select("SELECT * FROM con_notice WHERE status = '1' and del_flag = '0' and type = #{noticeType} order by create_time desc limit 1")
public ConNotice selectNoticeByType(String type); public ConNotice selectNoticeByType(String type);
} }
@@ -1079,7 +1079,7 @@
<if test="state != null and state != '' and state == '5'.toString()"> <if test="state != null and state != '' and state == '5'.toString()">
and (content_status = 5 or content_status = 6 or content_status = 7 or content_status = 8) and (content_status = 5 or content_status = 6 or content_status = 7 or content_status = 8)
</if> </if>
order by create_time desc order by content_status asc ,create_time desc
</select> </select>