|
|
@@ -0,0 +1,36 @@
|
|
|
+package com.ktg.quartz.task;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.ktg.iscs.domain.IsMaterialsLoan;
|
|
|
+import com.ktg.iscs.service.IIsMaterialsLoanService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 定时发送检查物资柜提醒邮件
|
|
|
+ *
|
|
|
+ * @author CGJ
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@Component("materialsLoanTask")
|
|
|
+public class MaterialsLoanTask {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IIsMaterialsLoanService iIsMaterialsLoanService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 扫描is_materials_loan,更新借取记录的超时未归还状态
|
|
|
+ */
|
|
|
+ public void checkMaterialsLoan() {
|
|
|
+ // 未归还 需要归还 已经过了告警事件
|
|
|
+ iIsMaterialsLoanService.update(Wrappers.<IsMaterialsLoan>lambdaUpdate()
|
|
|
+ .eq(IsMaterialsLoan::getStatus, "0")
|
|
|
+ .eq(IsMaterialsLoan::getRestitutionRequired, 1)
|
|
|
+ .lt(IsMaterialsLoan::getTimeoutAlarm, new Date())
|
|
|
+ .set(IsMaterialsLoan::getStatus, "2"));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|