[feat]设备耗材到期提醒

This commit is contained in:
yunpeng.zhang 2024-01-05 17:33:41 +08:00
parent 342271520f
commit 52bc59241a
3 changed files with 75 additions and 1 deletions

View File

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>www.lingdaima.com零代码excel转HTML</title>
<style>
table{border-top:1px solid #333;border-left:1px solid #333;border-spacing:0;background-color:#fff;width:100%}
table td{border-bottom:1px solid #333;border-right:1px solid #333;font-size:13px;padding:5px}
.font5{color:windowtext;}
.xl69{text-align:left;background:red;}
.xl66{text-align:left ;}
.xl68{background:red;}
</style>
</head>
<body>
<table style="width:833pt"> <!--StartFragment-->
<colgroup>
<col width="162" style="mso-width-source:userset;mso-width-alt:5774;width:122pt">
<col width="206" style="mso-width-source:userset;mso-width-alt:7338;width:155pt">
<col width="114" style="mso-width-source:userset;mso-width-alt:4067;width:86pt">
<col width="78" style="mso-width-source:userset;mso-width-alt:2787;width:59pt">
<col width="159" style="mso-width-source:userset;mso-width-alt:5660;width:119pt">
<col width="178" style="mso-width-source:userset;mso-width-alt:6314;width:133pt">
<col width="106" style="mso-width-source:userset;mso-width-alt:3754;width:79pt">
<col width="106" style="mso-width-source:userset;mso-width-alt:3783;width:80pt">
</colgroup>
<tbody>
<tr height="18">
<td class>设备</td>
<td class>设备序列号</td>
<td class>所在科室</td>
<td class>所在位置</td>
<td class>耗材名称</td>
<td class>耗材编号</td>
<td class>开始使用时间</td>
<td class="xl68">到期时间</td>
</tr>
<tr height="18">
<td rowspan="2" class="xl66">减压沸腾式清洗机</td>
<td rowspan="2" class="xl66">16811000131-2020-11</td>
<td rowspan="2" class="xl66">供应室</td>
<td rowspan="2" class="xl66"></td>
<td class="xl66">门密封圈(洁区)</td>
<td class="xl66">RN-80CSW L=2360 S=60</td>
<td class="xl66">2023/12/16</td>
<td class="xl69">2024/6/16</td>
</tr>
<tr height="18">
<td class="xl66">门密封圈(污区)</td>
<td class="xl66">RN-80CSW L=2360 S=60</td>
<td class="xl66">2023/7/15</td>
<td class="xl69">2024/1/15</td>
</tr> <!--EndFragment-->
</tbody>
</table>
</body>
</html>

View File

@ -29,6 +29,11 @@
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<!-- Sa-Token 权限认证, 在线文档http://sa-token.dev33.cn/ -->
<dependency>
<groupId>cn.dev33</groupId>

View File

@ -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<ConsumableNoticeDto> consumableNotices = baseMapper.selectNoticeList(date);
Map<Long, List<ConsumableNoticeDto>> 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, "");
});
}
}