Compare commits

..

No commits in common. "cfac8740024a3285e71a71a9b9c582fa5f2d011b" and "69cb3803fb5652901ac498b32f1c9f14ea9dbf73" have entirely different histories.

5 changed files with 7 additions and 75 deletions

View File

@ -5,14 +5,14 @@ import com.bonus.canteen.core.kitchen.domain.KitchenSampleDishesRecord;
/**
* 留样机留样清单Mapper接口
*
*
* @author xsheng
* @date 2025-06-16
*/
public interface KitchenSampleDishesRecordMapper {
/**
* 查询留样机留样清单
*
*
* @param recordId 留样机留样清单主键
* @return 留样机留样清单
*/
@ -20,7 +20,7 @@ public interface KitchenSampleDishesRecordMapper {
/**
* 查询留样机留样清单列表
*
*
* @param kitchenSampleDishesRecord 留样机留样清单
* @return 留样机留样清单集合
*/
@ -28,7 +28,7 @@ public interface KitchenSampleDishesRecordMapper {
/**
* 新增留样机留样清单
*
*
* @param kitchenSampleDishesRecord 留样机留样清单
* @return 结果
*/
@ -36,7 +36,7 @@ public interface KitchenSampleDishesRecordMapper {
/**
* 修改留样机留样清单
*
*
* @param kitchenSampleDishesRecord 留样机留样清单
* @return 结果
*/
@ -44,7 +44,7 @@ public interface KitchenSampleDishesRecordMapper {
/**
* 删除留样机留样清单
*
*
* @param recordId 留样机留样清单主键
* @return 结果
*/
@ -52,16 +52,9 @@ public interface KitchenSampleDishesRecordMapper {
/**
* 批量删除留样机留样清单
*
*
* @param recordIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteKitchenSampleDishesRecordByRecordIds(Long[] recordIds);
/**
* 判断留样是否超时
*
* @return 结果
*/
public int handleKitchenSampleDishesTimeOut();
}

View File

@ -57,11 +57,4 @@ public interface IKitchenSampleDishesRecordService {
* @return 结果
*/
public int deleteKitchenSampleDishesRecordByRecordId(Long recordId);
/**
* 判断留样是否超时
*
* @return 结果
*/
public int handleKitchenSampleDishesTimeOut();
}

View File

@ -19,7 +19,6 @@ import org.springframework.stereotype.Service;
import com.bonus.canteen.core.kitchen.mapper.KitchenSampleDishesRecordMapper;
import com.bonus.canteen.core.kitchen.domain.KitchenSampleDishesRecord;
import com.bonus.canteen.core.kitchen.service.IKitchenSampleDishesRecordService;
import org.springframework.transaction.annotation.Transactional;
/**
* 留样机留样清单Service业务层处理
@ -139,10 +138,4 @@ public class KitchenSampleDishesRecordServiceImpl implements IKitchenSampleDishe
public int deleteKitchenSampleDishesRecordByRecordId(Long recordId) {
return kitchenSampleDishesRecordMapper.deleteKitchenSampleDishesRecordByRecordId(recordId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int handleKitchenSampleDishesTimeOut() {
return kitchenSampleDishesRecordMapper.handleKitchenSampleDishesTimeOut();
}
}

View File

@ -1,37 +0,0 @@
package com.bonus.canteen.core.kitchen.task;
import com.bonus.canteen.core.common.utils.RedisUtil;
import com.bonus.canteen.core.cook.task.CookRecipeTask;
import com.bonus.canteen.core.kitchen.service.IKitchenSampleDishesRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
@Component
public class SampleDishesStateTask {
private static final Logger logger = LoggerFactory.getLogger(CookRecipeTask.class);
@Autowired
private IKitchenSampleDishesRecordService kitchenSampleDishesRecordService;
@Scheduled(fixedDelay = 60 * 60 * 1000)
public void cookRecipeHandler() {
boolean lock = RedisUtil.setNx("kitchen:sampleDishesState", "1", 3600);
if (lock) {
logger.info("[定时更新留样菜品状态]开始:{}", LocalDateTime.now());
try {
kitchenSampleDishesRecordService.handleKitchenSampleDishesTimeOut();
logger.info("[定时更新留样菜品状态]结束:{}", LocalDateTime.now());
}catch (Exception ex) {
logger.error("[定时更新留样菜品状态]异常", ex);
}finally {
RedisUtil.delete("kitchen:sampleDishesState");
}
}
}
}

View File

@ -209,14 +209,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{recordId}
</foreach>
</delete>
<update id="handleKitchenSampleDishesTimeOut">
update kitchen_sample_dishes_record
set save_status = 4 ,
leave_cabinet_time = now(),
update_time = now()
where enter_cabinet_time is not null and leave_cabinet_time is null
and enter_cabinet_time <![CDATA[ < ]]> NOW() - INTERVAL 48 HOUR
and enter_cabinet_time <![CDATA[ > ]]> NOW() - INTERVAL 72 HOUR
</update>
</mapper>