|
|||||||
Тестирование рефакторинга создания начислений
Время создания: 19.03.2020 10:24
Раздел: INFO - JOB - rtneo - Рефакторинг - Доп
Запись: wwwlir/Tetra/master/base/1584584692v8h8qyvukj/text.html на raw.githubusercontent.com
|
|||||||
|
|||||||
import com.haulmont.cuba.core.global.* import com.groupstp.rtneo.entity.* import com.groupstp.rtneo.core.bean.calculationBill.*; import com.groupstp.rtneo.core.bean.calculation.*; import java.text.SimpleDateFormat; CalculationBillTools tools = AppBeans.get(CalculationBillTools.NAME) CalculationWorkerBean calculationWorker = AppBeans.get(CalculationWorkerBean.class); Calculation calc = tools.getCalculationRealEstate() ContractPosition position = dataManager.load(ContractPosition.class).id(UUID.fromString('d37c8be4-1178-88e7-3382-fbd5774eb135')).view("contractPosition-calc").one(); SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy") Date period = format.parse("01.01.2020") Date dateBill = format.parse("31.01.2020") Accrual accrual = calc.makeAccrual(position, period, 111, dateBill) Accrual accrualOld = calculationWorker.calculateRealEstate(position, period, 111, dateBill) _("accrual") _(accrual, "json") _("accrualOld") _(accrualOld, "json") /** * Логирование */ 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)} |
|||||||
Так же в этом разделе:
|
|||||||
|
|||||||
|