|
|||||||
Категоризация
Время создания: 18.09.2020 16:57
Раздел: INFO - JOB - rtneo - Работа над задачами - Категоризация
Запись: wwwlir/Tetra/master/base/1600419432cw0j5dzd2f/text.html на raw.githubusercontent.com
|
|||||||
|
|||||||
import com.groupstp.rtneo.entity.*; import com.haulmont.cuba.core.global.*; import com.groupstp.rtneo.service.*; import com.groupstp.rtneo.core.bean.*; import com.groupstp.rtneo.data.* import com.haulmont.cuba.core.global.ViewRepository; import com.groupstp.rtneo.core.bean.CategorizationWorker; import com.groupstp.rtneo.config.* import java.util.function.Consumer; CommitContext cctx = new CommitContext() StringBuilder queryBuilder = new StringBuilder(); Consumer<String> consumer = {e->queryBuilder.append(e).append(' ')}; consumer.accept('select c from rtneo$ContragentRealEstate c where c.category is null') consumer.accept('and lower(c.realEstate.name) like lower(\'%%гараж%%\')') List<ContragentRealEstate> listCRE = dataManager.load(ContragentRealEstate.class) .query(queryBuilder.toString()) .view("contragentRealEstate-contoller-interface") .list(); void setCategotyAndType(){
} listCRE.each{_(it)} /** * Логирование */ 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)} |
|||||||
Так же в этом разделе:
|
|||||||
|
|||||||
|