|
|||||||
Анализ арендодателей
Время создания: 06.07.2020 12:22
Раздел: INFO - JOB - rtneo - Выгрузки - УПД
Запись: wwwlir/Tetra/master/base/1594009357sin8r4cfrd/text.html на raw.githubusercontent.com
|
|||||||
|
|||||||
import java.util.* import com.haulmont.cuba.core.global.* import com.haulmont.cuba.core.entity.*; import com.groupstp.rtneo.entity.* import java.text.SimpleDateFormat import com.groupstp.rtneo.service.BillService BillService billService = AppBeans.get(BillService.NAME) SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd") SimpleDateFormat dateView = new SimpleDateFormat("dd-MM-yyyy") String period1 = '2019-01-01' String period2 = '2020-12-01' String period2020 = '2020-01-01' String paymentLimit = '2020-06-05' Date paymentLimitDate = df1.parse(paymentLimit) Calendar periodStart = Calendar.getInstance(); periodStart.setTime(df1.parse(period1)); Calendar periodEnd = Calendar.getInstance(); periodEnd.setTime(df1.parse(period2)); Calendar period20 = Calendar.getInstance(); period20.setTime(df1.parse(period2020)); Calendar beginYear = Calendar.getInstance(); def i = 0; List<Contragent> contragents = dataManager .loadValues('select distinct c.id, c.name, c.inn, c.kpp, c.personalAccount from rtneo$Payment e join rtneo$Contragent c on e.inn = c.inn where not e.inn is null and not c.personalAccount is null and size(c.contracts) > 0 and (select count(r) from rtneo$RealEstateRenter r where r.contragentRealEstate.contragent = c and r.payOwner = true)>0 order by c.inn') .properties("id", "name", "inn", "kpp", "pa") // .firstResult(i*100) // .maxResults(100) .list(); for(def contragent : contragents){ def isFact = dataManager.loadValue('select count(c) from rtneo$Contract c where c.contragent.id = :contragent and (c.isFactCalculation = true or c.isFactRecalculation = true)', Integer.class) .parameter("contragent", contragent.getValue('id')) .optional() .orElse(0) if(isFact > 0)continue Boolean isPay = false // _(contragent.getValue('inn')) beginYear.setTime(df1.parse("2019-01-01")); while(!beginYear.after(periodEnd)){ List<Accrual> accruals = billService.getBillsOnPeriod(UUID.fromString(contragent.getValue('id').toString()), beginYear.getTime()) def count = accruals.stream().filter{e -> !e.getDebugComment().equals('')}.count()
if(count == 0){ isPay = true // _(dateView.format(beginYear.getTime())) } beginYear.add(Calendar.MONTH, 1) } if(isPay)_(contragent.getValue('inn')) } /** * Логирование */ import com.haulmont.cuba.core.app.serialization.EntitySerializationAPI; import com.groupstp.rtneo.util.JsonUtil; import java.text.DateFormat; import java.text.SimpleDateFormat; private _(Object obj, String... options){ if(obj == null){log("LOG.ERROR: Object is null!!!");return} if(options.size() == 0){log(obj)} for(def option : options){ if(option.equals("str")){log(obj)} if(option.equals("for")){obj.each({_(it)})} if(option.equals("json")){ EntitySerializationAPI entitySerializationAPI = AppBeans.get(EntitySerializationAPI.NAME) try{log(entitySerializationAPI.toJson(obj))} catch(Exception e){log("LOG.ERROR: JSON entity serialization failed")} } if(option.equals("objJson")){ JsonUtil jsonUtil = AppBeans.get(JsonUtil.NAME) try{log.(jsonUtil.toJson(obj))} catch(Exception e){log("LOG.ERROR: JSON object serialization failed")} } if(option.equals("date")){ DateFormat df = new SimpleDateFormat("dd.MM.yyyy"); try{log(df.format(obj))} catch(Exception e){log("LOG.ERROR: Failed date format")} } } } private log(Object obj){log.debug(obj)} |
|||||||
Так же в этом разделе:
|
|||||||
|
|||||||
|