MyTetra Share
Делитесь знаниями!
Обновление начислений
Время создания: 18.04.2021 15:24
Раздел: INFO - JOB - rtneo
Запись: wwwlir/Tetra/master/base/16187306963922fkmk0q/text.html на raw.githubusercontent.com

import com.groupstp.rtneo.data.ContainerYardSearchData

import com.groupstp.rtneo.to.ResultCreateContract

import com.haulmont.cuba.core.global.*

import com.groupstp.rtneo.entity.*

import com.groupstp.rtneo.service.*

import com.groupstp.rtneo.core.bean.*

import org.apache.commons.collections.CollectionUtils


import java.util.*

import java.util.concurrent.Callable

import java.util.concurrent.Executors

import java.util.concurrent.TimeUnit

import java.util.stream.*

import java.util.function.*;

import java.util.function.Predicate

import groovy.transform.InheritConstructors;

import java.text.SimpleDateFormat;

import com.haulmont.cuba.core.sys.AppContext


BillService billService = AppBeans.get(BillService.class)


List<Contragent> contragents =

dataManager.load(Contragent.class)

.query('select c from rtneo$Contragent c join rtneo$EntityesTemporarySet t on c.id = t.entityId where t.setName = \'ContragentRecalc-4-16-04-21\'')

//.id(UUID.fromString('2e342061-9244-1234-a648-362d1736f6e4'))

.view("_local")

.list()


def securityContext = AppContext.getSecurityContext()

def pool = Executors.newFixedThreadPool(20)

def futureList = []


contragents.each { contragent ->

futureList << pool.submit({

AppContext.setSecurityContext(securityContext);

try{

billService.removeAndCreateBills(contragent)

}catch(Exception e){

log.debug(e.getMessage())

}

} as Callable)

}

pool.awaitTermination(30, TimeUnit.MINUTES)

log.debug('-------------------Result----------------')

futureList.each {log.debug(it.get())}

log.debug(pool)


//billService.removeAndCreateBills(contragent)

log.debug(contragents.size())

 
MyTetra Share v.0.65
Яндекс индекс цитирования