diff --git a/admin/src/main/resources/template/consumableDueEmailTemp.ftl b/admin/src/main/resources/template/consumableDueEmailTemp.ftl
new file mode 100644
index 0000000..4891644
--- /dev/null
+++ b/admin/src/main/resources/template/consumableDueEmailTemp.ftl
@@ -0,0 +1,57 @@
+
+
+
+
+ www.lingdaima.com(零代码excel转HTML)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | 设备 |
+ 设备序列号 |
+ 所在科室 |
+ 所在位置 |
+ 耗材名称 |
+ 耗材编号 |
+ 开始使用时间 |
+ 到期时间 |
+
+
+ | 减压沸腾式清洗机 |
+ 16811000131-2020-11 |
+ 供应室 |
+ |
+ 门密封圈(洁区) |
+ RN-80CSW L=2360 S=60 |
+ 2023/12/16 |
+ 2024/6/16 |
+
+
+ | 门密封圈(污区) |
+ RN-80CSW L=2360 S=60 |
+ 2023/7/15 |
+ 2024/1/15 |
+
+
+
+
+
diff --git a/common/pom.xml b/common/pom.xml
index 85e234b..b0b70ae 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -29,6 +29,11 @@
spring-web
+
+ org.springframework.boot
+ spring-boot-starter-freemarker
+
+
cn.dev33
diff --git a/system/src/main/java/com/eqc/system/service/impl/EquipmentConsumablesServiceImpl.java b/system/src/main/java/com/eqc/system/service/impl/EquipmentConsumablesServiceImpl.java
index cc95630..8882015 100644
--- a/system/src/main/java/com/eqc/system/service/impl/EquipmentConsumablesServiceImpl.java
+++ b/system/src/main/java/com/eqc/system/service/impl/EquipmentConsumablesServiceImpl.java
@@ -12,7 +12,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.eqc.common.utils.email.MailUtils;
import com.eqc.system.domain.dto.ConsumableNoticeDto;
+import freemarker.template.Configuration;
import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.eqc.system.domain.bo.EquipmentConsumablesBo;
import com.eqc.system.domain.vo.EquipmentConsumablesVo;
@@ -35,6 +37,9 @@ public class EquipmentConsumablesServiceImpl implements IEquipmentConsumablesSer
private final EquipmentConsumablesMapper baseMapper;
+ // 自动注入FreeMarker配置类,用户获取模板
+ private final Configuration configuration;
+
/**
* 查询设备耗材
*/
@@ -159,6 +164,13 @@ public class EquipmentConsumablesServiceImpl implements IEquipmentConsumablesSer
Date date = DateUtils.addDays(DateUtils.beginOfDay(DateUtils.getNowDate()), 7);
List consumableNotices = baseMapper.selectNoticeList(date);
Map> userNoticeMap = StreamUtils.groupByKey(consumableNotices, ConsumableNoticeDto::getChargeUser);
-
+ userNoticeMap.forEach((userId, notices) -> {
+ ConsumableNoticeDto notice = notices.get(0);
+ String email = notice.getChargeUserEmail();
+ String chargeNickName = notice.getChargeNickName();
+ //TODO 构建html
+ // 自动注入FreeMarker配置类,用户获取模板
+ MailUtils.sendHtml(email, subject, "");
+ });
}
}