Search in sources :

Example 1 with EcReptileDataFieldDTO

use of com.easy.cloud.core.reptile.datafield.pojo.dto.EcReptileDataFieldDTO in project dq-easy-cloud by dq-open-cloud.

the class EcReptileUtils method buildDynamicField.

/**
 * <p>
 * 构建动态bean的动态数据属性
 * </p>
 * <p>
 * <pre>
 *     所需参数示例及其说明
 *     参数名称 : 示例值 : 说明 : 是否必须
 * </pre>
 *
 * @param dynamicBean
 * @param dynamicBeanDTO
 * @author daiqi
 * @创建时间 2018年6月7日 下午8:13:04
 */
private static void buildDynamicField(JavassistDynamicBean dynamicBean, EcReptileDynamicBeanDTO dynamicBeanDTO) {
    for (EcReptileDataFieldDTO dataFieldDTO : dynamicBeanDTO.getReptileDataFieldDTOs()) {
        if (EcBaseUtils.equals(dataFieldDTO.getAvailable(), EcAvailableEnum.YES.type())) {
            DynamicField dynamicField = buildDynamicFieldName(dynamicBean, dataFieldDTO);
            dynamicField = buildDynamicValueSourceType(dynamicField, dynamicBean, dataFieldDTO);
            dynamicField = buildDynamicValueSource(dynamicField, dynamicBean, dataFieldDTO);
            dynamicField.build();
        }
    }
}
Also used : DynamicField(com.geccocrawler.gecco.dynamic.DynamicField) EcReptileDataFieldDTO(com.easy.cloud.core.reptile.datafield.pojo.dto.EcReptileDataFieldDTO)

Example 2 with EcReptileDataFieldDTO

use of com.easy.cloud.core.reptile.datafield.pojo.dto.EcReptileDataFieldDTO in project dq-easy-cloud by dq-open-cloud.

the class EcReptileDynamicBeanServiceImpl method buildDynamicBeanDTOs.

/**
 * <p>
 * 根据dynamicBeanEntities列表构建EcReptileDynamicBeanDTO列表
 * </p>
 *
 * <pre>
 *     所需参数示例及其说明
 *     参数名称 : 示例值 : 说明 : 是否必须
 * </pre>
 *
 * @param dynamicBeanEntities
 * @return
 * @author daiqi
 * @创建时间 2018年6月7日 下午8:59:01
 */
private List<EcReptileDynamicBeanDTO> buildDynamicBeanDTOs(List<EcReptileDynamicBeanEntity> dynamicBeanEntities) {
    // 1 entity转换为dto
    List<EcReptileDynamicBeanDTO> dynamicBeanDTOs = EcJSONUtils.parseArray(dynamicBeanEntities, EcReptileDynamicBeanDTO.class);
    // 2 构建dynamicBeanIds
    Set<Integer> dynamicBeanNos = new HashSet<>();
    for (EcReptileDynamicBeanEntity dynamicBean : dynamicBeanEntities) {
        dynamicBeanNos.add(dynamicBean.getDynamicBeanNo());
    }
    // 3 根据dynamicBeanIds获取数据属性数据传输对象列表
    List<EcReptileDataFieldDTO> dataFieldDTOs = reptileDynamicBeanService.findDataFieldsByDynamicBeanNos(dynamicBeanNos);
    EcLogUtils.info("buildDynamicBeanDTOs获取到的属性数据为", dataFieldDTOs, logger);
    EcAssert.verifyListEmpty(dataFieldDTOs, "reptileDataField");
    // 4 将数据属性对象列表放置到对应的dynamicBeanDTO中
    for (EcReptileDynamicBeanDTO dynamicBeanDTO : dynamicBeanDTOs) {
        List<EcReptileDataFieldDTO> dataFieldDTOsTemp = new ArrayList<>();
        for (EcReptileDataFieldDTO dataFieldDTO : dataFieldDTOs) {
            if (EcBaseUtils.equals(dynamicBeanDTO.getDynamicBeanNo(), dataFieldDTO.getDynamicBeanNo())) {
                dataFieldDTOsTemp.add(dataFieldDTO);
            }
        }
        dynamicBeanDTO.setReptileDataFieldDTOs(dataFieldDTOsTemp);
    }
    // 5 返回列表
    return dynamicBeanDTOs;
}
Also used : EcReptileDynamicBeanDTO(com.easy.cloud.core.reptile.dynamicbean.pojo.dto.EcReptileDynamicBeanDTO) EcReptileDynamicBeanEntity(com.easy.cloud.core.reptile.dynamicbean.pojo.entity.EcReptileDynamicBeanEntity) EcReptileDataFieldDTO(com.easy.cloud.core.reptile.datafield.pojo.dto.EcReptileDataFieldDTO)

Aggregations

EcReptileDataFieldDTO (com.easy.cloud.core.reptile.datafield.pojo.dto.EcReptileDataFieldDTO)2 EcReptileDynamicBeanDTO (com.easy.cloud.core.reptile.dynamicbean.pojo.dto.EcReptileDynamicBeanDTO)1 EcReptileDynamicBeanEntity (com.easy.cloud.core.reptile.dynamicbean.pojo.entity.EcReptileDynamicBeanEntity)1 DynamicField (com.geccocrawler.gecco.dynamic.DynamicField)1