|
|||||||
Общественные организации
Время создания: 06.07.2020 12:22
Раздел: INFO - JOB - rtneo - Выгрузки
Запись: wwwlir/Tetra/master/base/15940093572w9q7inj5k/text.html на raw.githubusercontent.com
|
|||||||
|
|||||||
import com.groupstp.rtneo.entity.* import com.haulmont.cuba.core.global.*; import com.groupstp.rtneo.service.BillService import java.text.SimpleDateFormat import org.apache.commons.collections.CollectionUtils DataManager dataManager = AppBeans.get(DataManager.NAME) BillService billService = AppBeans.get(BillService.NAME) def period1 = '2019-01-01' def period2 = '2019-12-01' def df1 = new SimpleDateFormat("yyyy-MM-dd") //def dateView = new SimpleDateFormat("dd-MM-yyyy") Calendar periodEnd = Calendar.getInstance(); Calendar periodStart = Calendar.getInstance(); periodStart.setTime(df1.parse(period1)); periodEnd.setTime(df1.parse(period2)); def res = [] def contragents = dataManager.loadValues('select c.id, c.inn, c.name, c.legalAddress from rtneo$Contragent c where not c.notDoingBusiness = true or c.notDoingBusiness is null and c.name like \'%общественная%\'') .properties("id", "inn", "name", "legalAddress") .list(); for(def contragent : contragents){ def item = new ArrayList() item.add(contragent.getValue("name")) item.add(contragent.getValue("inn")) item.add(contragent.getValue("legalAddress")) String contract = dataManager.loadValue('select c.number from rtneo$Contract c where c.mainContract is null and c.contragent.id = :id', String.class) .parameter('id', UUID.fromString(contragent.getValue('id').toString())) .optional() .orElse(""); item.add(contract) periodStart.set(Calendar.MONTH, 0); periodStart.set(Calendar.YEAR, 2019); def amount = 0; while(!periodStart.after(periodEnd)){ def accruals = billService.getBillsOnPeriod(UUID.fromString(contragent.getValue('id').toString()), periodStart.getTime())
for(def accrual : accruals){ amount += accrual["amountBase"] } periodStart.add(Calendar.MONTH, 1) } item.add(amount) res.add(item) } for(def item : res){ log.debug("!${item[0]}!${item[1]}!${item[2]}!${item[3]}!${item[4]}") } //========================================================================= def getNN(BigDecimal value) { return value == null ? BigDecimal.ZERO : value; } |
|||||||
Так же в этом разделе:
|
|||||||
|
|||||||
|