package com.qianwen.smartman.modules.mdc.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import java.io.Serializable; import java.time.LocalDate; import java.util.List; import com.qianwen.smartman.common.constant.ExtCacheConstant; import com.qianwen.core.mp.support.Query; import com.qianwen.core.redis.lock.RedisLock; import com.qianwen.smartman.modules.mdc.dto.WorkstationEndAndStartImmediateFeedBackDTO; import com.qianwen.smartman.modules.mdc.dto.WorkstationEndImmediateFeedBackDTO; import com.qianwen.smartman.modules.mdc.dto.WorkstationImmediateFeedBackDTO; import com.qianwen.smartman.modules.mdc.dto.WorkstationNoImmediateFeedBackDTO; import com.qianwen.smartman.modules.mdc.entity.WorkstationFeedback; import com.qianwen.smartman.modules.mdc.vo.StatusRecordVO; import com.qianwen.smartman.modules.mdc.vo.WorkstationFeedbackInfoVO; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Caching; public interface IWorkstationFeedbackService extends IService { /** * 一天缓存 blade:feedback#86400 */ public static final String WORK_FEEDBACK_EXP = "blade:feedback#86400"; /** * 3天缓存 blade:feedback#259200 */ public static final String WORK_FEEDBACK_EXP3 = "blade:feedback#259200"; IPage workstationPage(Query query, boolean excludeImmediate); @Cacheable(cacheNames = {WORK_FEEDBACK_EXP}, key = "'immediate:list'") List getImmediateFeedback(); @Cacheable(cacheNames = {WORK_FEEDBACK_EXP}, key = "'immediate:workstationId:' + #workstationId") WorkstationFeedback getImmediateFeedback(final Serializable workstationId); @CacheEvict(cacheNames = {ExtCacheConstant.WORK_FEEDBACK}, key = "'immediate:list'") boolean startFeedbackByImmediate(WorkstationImmediateFeedBackDTO workstationImmediateFeedBackDTO); boolean startFeedbackByNoImmediate(WorkstationNoImmediateFeedBackDTO dto); @Caching(evict = {@CacheEvict(cacheNames = {ExtCacheConstant.WORK_FEEDBACK}, key = "'id:'.concat(#dto.feedbackId)"), @CacheEvict(cacheNames = {ExtCacheConstant.WORK_FEEDBACK}, key = "'immediate:list'"), @CacheEvict(cacheNames = {ExtCacheConstant.WORK_FEEDBACK}, key = "'immediate:workstationId:'.concat(#dto.workstationId)")}) @RedisLock(value = ExtCacheConstant.WORK_FEEDBACK, param = "#dto.workstationId") boolean endFeedback(WorkstationEndImmediateFeedBackDTO dto); @Caching(evict = {@CacheEvict(cacheNames = {ExtCacheConstant.WORK_FEEDBACK}, key = "'id:'.concat(#dto.endFeedbackId)"), @CacheEvict(cacheNames = {ExtCacheConstant.WORK_FEEDBACK}, key = "'immediate:list'"), @CacheEvict(cacheNames = {ExtCacheConstant.WORK_FEEDBACK}, key = "'immediate:workstationId:'.concat(#dto.workstationId)")}) @RedisLock(value = ExtCacheConstant.WORK_FEEDBACK, param = "#dto.workstationId") boolean endAndStartAgainFeedback(WorkstationEndAndStartImmediateFeedBackDTO dto); /** * 从反馈的redis缓存中获取状态记录的数据 * @param statusTime * @param workstationIds * @param statusRecordList * @return */ List groupStatusRecordWithFeedbackCache(final LocalDate statusTime, final Long workstationIds, final List statusRecordList); @Cacheable(cacheNames = {WORK_FEEDBACK_EXP}, key = "'id:'.concat(#id)") default WorkstationFeedback cachedById(Serializable id) { return (WorkstationFeedback) getById(id); } }