job
package club.newepoch.admin.job import club.newepoch.admin.service.BizPayComfirmInfoJobService import club.newepoch.iweb.jfinal.plugins.quartz.AbstractJob import org.quartz.JobExecutionContext import club.newepoch.utils.TaskExecuteUtils import club.newepoch.utils.a /** * 获取付款确认书信息的job * */ class BizPayComfirmInfoJob : AbstractJob() { /** * 执行job任务 */ override fun doJob(p0: JobExecutionContext?) { try { // 获取保理系统中,付款确认书总数(以1000条为一页) var num = BizPayComfirmInfoJobService().getBizPayComfirmInfoTotalPages() // 总数据数 var total = ( num as Int ) // 总页数(即循环的次数) var time=0 if(total%1000 == 0){ time = total/1000 }else{ time = total/1000+1 } // 每次循环的2个参数,起始位置,获取的条数 var startIndex = 0 var totalNumber = 1000 // 开始异步获取信息 TaskExecuteUtils.callMethod { for (i in 1..time){ try { BizPayComfirmInfoJobService().getBizPayComfirmInfo(startIndex,totalNumber) startIndex += 1000 totalNumber += 1000 } catch (e: Exception) { e.printStackTrace() } } } }catch (e:Exception){ logger.error("获取付款确认书信息失败",e) } } }