Commit 84724514 authored by chenzhao's avatar chenzhao

设备提醒功能

parent a79b4b6f
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.util.*;
@EnableScheduling
public class EquipRegularlyRemindServicelmpl {
@Autowired
private UseInfoMapper useInfoMapper;
@Scheduled(cron = "0 0 8 * * * ?")
public void sendReminderMessage(){
//获取当前日期
String currentDate = DateUtils.getDateNowShortStr();
Date date = DateUtils.dateAddDays(new Date(), 31);
List<String> types = new ArrayList<>();
List<String> status = new ArrayList<>();
//查询需要发送消息的设备
LambdaQueryWrapper<UseInfo> query = new LambdaQueryWrapper<>();
query.in(UseInfo::getLastInspectType,types);
query.in(UseInfo::getStatus,status);
query.le(UseInfo::getNextInspectDate,date).or().ge(UseInfo::getNextInspectDate,currentDate);
List<UseInfo> equips = useInfoMapper.selectList(query);
//查询符合发送规则的人员电话
//组装短信内容
HashMap<String,String> params = new HashMap<>();
//发送短信
Systemctl.smsClient.sendCommonSms(params);
}
}
...@@ -6,6 +6,8 @@ import lombok.Data; ...@@ -6,6 +6,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.Date;
/** /**
* 使用信息表 * 使用信息表
* *
...@@ -183,4 +185,13 @@ public class UseInfo extends AbstractEquipBaseEntity { ...@@ -183,4 +185,13 @@ public class UseInfo extends AbstractEquipBaseEntity {
*/ */
@TableField(value ="\"IS_NOT_ES\"") @TableField(value ="\"IS_NOT_ES\"")
private Integer isNotEs; private Integer isNotEs;
@TableField(value = "NEXT_INSPECT_DATE")
private Date nextInspectDate;
@TableField(value = "LAST_INSPECT_REPORT_NO")
private String lastInspectReportNo;
@TableField(value = "LAST_INSPECT_TYPE")
private String lastInspectType;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment