但问题是这个任务有两次触发,一次在上午9点,另一次在下午2:30,下面是我的代码
@服务公共类notificationscheduler{
@Autowired
private UsersService userService;
@Autowired
private SendSMS sendSms;
@Scheduled(cron = "0 0 9 * * ?")
public void sendSmsNotifictaion() {
DecimalFormat deciFormat = new DecimalFormat();
deciFormat.setMaximumFractionDigits(4);
List<Users> userList=userService.getAllUserByIsNotSuAcc();
userList.forEach(obj -> {
String updatemsg="UPDATE:+Commission+Wallet+balance+for+"+obj.getName()+"+(AGENT+ID+"+obj.getId()+")+on+"+BaseDateUtil.getDateYYYYMMDD(new Date())+"+is+Rs.+"+deciFormat.format(BaseUtil.getDouble(obj.getBalance()))+".+Log+in+to+Spark+OMOB+to+view+and+transfer+balance.+Thank+you+for+your+trust+and+growth+with+us.+-+Spark+Team";
sendSms.sendSMS(updatemsg, obj.getAgentmobil(), "");
});
}
}
1条答案
按热度按时间4c8rllxm1#
你的亲信应该是这个
0 9 * * *
请参见此以获取解释