@Scheduled(cron
= "0 */1 * * * ?")
public void automaticUrging() throws Exception
{
log
.info("自动催办===");
List
<UrgingConfig> list
= urgingConfigService
.automaticUrging();
if (list
!= null
&& list
.size() > 0) {
log
.info("未应答:" + list
.size());
UrgingRecord urgingRecord
= null
;
for (int i
= 0; i
< list
.size(); i
++) {
UrgingConfig config
= list
.get(i
);
Duration dur
= Duration
.between(config
.getLastTime(), LocalDateTime
.now());
if (dur
.toMinutes() >= config
.getAveTimes()) {
log
.info("间隔分钟:" + dur
.toMinutes() + " 每隔多少分钟催办一次:" + config
.getAveTimes());
log
.info("推送:" + config
.getId());
urgingRecord
= new UrgingRecord();
urgingRecord
.setUrgingConfigId(config
.getId());
urgingRecord
.setRollCallId(config
.getRollCallId());
urgingRecord
.setCreateTime(new Date());
urgingRecord
.setUpdateTime(new Date());
boolean res
= urgingRecordService
.save(urgingRecord
);
if (res
) {
Integer alreadyTimes
= config
.getAlreadyTimes() + 1;
config
.setAlreadyTimes(alreadyTimes
);
config
.setLastTime(LocalDateTime
.now());
urgingConfigService
.updateById(config
);
}
}
}
}
log
.info("自动===");
}
转载请注明原文地址:https://tech.qufami.com/read-5814.html