MyTetra Share
Делитесь знаниями!
Арендаторы с удаленными объектами
Время создания: 15.10.2019 16:13
Раздел: INFO - JOB - CUBA - GroovyScripts
Запись: wwwlir/Tetra/master/base/1571127187672jteymbv/text.html на raw.githubusercontent.com

import com.groupstp.rtneo.entity.*

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

import java.util.*

import com.haulmont.cuba.core.global.ViewRepository;



DataManager dataManager = AppBeans.get(DataManager.NAME)


ViewRepository vRep = AppBeans.get(ViewRepository.NAME)

View renterView = vRep.getView(RealEstateRenter.class, "_minimal");

renterView.addProperty("renterRecord", vRep.getView(ContragentRealEstate.class, "_minimal").addProperty("contragent", vRep.getView(Contragent.class, "_local")));

renterView.addProperty("contragent", vRep.getView(Contragent.class, "_local"));

renterView.addProperty("contragentRealEstate", vRep.getView(ContragentRealEstate.class, "contragentRealEstate-categorization").addProperty("contragent", vRep.getView(Contragent.class, "_local")));


List<RealEstateRenter> listRenters = dataManager.load(RealEstateRenter.class)

.query('select r from rtneo$RealEstateRenter r')

.view(renterView)

.list();


//List<RealEstateRenter> listRenters = dataManager.load(RealEstateRenter.class)

// .query('select r from rtneo$RealEstateRenter r where r.contragentRealEstate.id = :id')

// .parameter("id", UUID.fromString("1873a881-aaf8-cbc6-316a-74fbb0760c8b"))

// .view(renterView)

// .list();


def count = 0;

def countNull = 0;

def allNull = 0;


log.debug(listRenters.size());

for(RealEstateRenter renter:listRenters){


if(renter.getRenterRecord() != null && renter.getRenterRecord().isDeleted()){

count++;

log.debug("${renter.getContragentRealEstate().getRealEstate().getCadastralNumber()} Contragent - ${renter.getContragentRealEstate().getContragent().getInn()}(${renter.getContragentRealEstate().getContragent().getName()}), renter - ${renter.getContragent().getInn()}(${renter.getContragent().getName()})");

}

if(renter.getRenterRecord() == null){

allNull++;

if(renter.getContragentRealEstate() != null){

log.debug("${renter.getContragentRealEstate().getRealEstate().getCadastralNumber()} Contragent - ${renter.getContragentRealEstate().getContragent().getInn()}(${renter.getContragentRealEstate().getContragent().getName()}), renter - null)");

}else{

log.debug("RenterRecord and CRE is null - renter id = ${renter.getId()}");

}

}

if(renter.getContragentRealEstate() == null){

log.debug("CRE is null, renter - ${renter.getContragent().getInn()}(${renter.getContragent().getName()}), renter id = ${renter.getId()}");

countNull++;

}

}

log.debug("RESULT = ${count}, countNull = ${countNull}, allNull = ${allNull}")

Так же в этом разделе:
 
MyTetra Share v.0.65
Яндекс индекс цитирования