| | |
| | | import com.iailab.module.data.common.enums.IndStatFuncEnum; |
| | | import com.iailab.module.data.common.enums.IndTimeLimitEnum; |
| | | import com.iailab.module.data.ind.data.dto.IndDataSetDTO; |
| | | import com.iailab.module.data.ind.data.service.IndDataSetFieldService; |
| | | import com.iailab.module.data.ind.data.service.IndDataSetService; |
| | | import com.iailab.module.data.ind.item.service.IndItemAtomService; |
| | | import com.iailab.module.data.ind.item.service.IndItemDerService; |
| | | import com.iailab.module.data.ind.item.vo.IndItemAtomVO; |
| | | import com.iailab.module.data.ind.item.vo.IndItemDerVO; |
| | | import com.iailab.module.data.ind.value.dto.QuerySourceValueDTO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IndDataSetService indDataSetService; |
| | | |
| | | @Autowired |
| | | private IndDataSetFieldService indDataSetFieldService; |
| | | |
| | | @Autowired |
| | | private IndItemDerService indItemDerService; |
| | |
| | | } |
| | | result.setDataSource(indItem.getDataSource()); |
| | | StringBuilder selectSql = new StringBuilder(); |
| | | IndStatFuncEnum statFun = IndStatFuncEnum.getEumByCode(indItem.getStatFunc()); |
| | | IndStatFuncEnum statFun = IndStatFuncEnum.getEumByCode(StringUtils.isBlank(indItem.getStatFunc())? IndStatFuncEnum.DEFAULT.getCode() : indItem.getStatFunc()); |
| | | switch (statFun) { |
| | | case AVG: |
| | | selectSql.append("AVG("); |
| | |
| | | case SUM: |
| | | selectSql.append("SUM("); |
| | | break; |
| | | default: |
| | | case DEFAULT: |
| | | selectSql.append("("); |
| | | break; |
| | | } |
| | |
| | | |
| | | // 拼接SELECT |
| | | StringBuilder selectSql = new StringBuilder(); |
| | | if (StringUtils.isNotBlank(indItem.getDimension())){ |
| | | selectSql.append(indItem.getDimension()); |
| | | selectSql.append(", "); |
| | | } |
| | | selectSql.append(result.getSelectSql()); |
| | | selectSql.append(", "); |
| | | selectSql.append(indItem.getTimeLabel()); |
| | |
| | | whereSql.append("'"); |
| | | break; |
| | | case CUSTOM: |
| | | whereSql.append(indItem.getTimeLabel()); |
| | | whereSql.append(" <= '"); |
| | | whereSql.append(DateUtils.format(indItem.getTimeEnd(), PATTERN_MON)); |
| | | whereSql.append("' AND >= '"); |
| | | whereSql.append("' AND '"); |
| | | whereSql.append(indItem.getTimeLabel()); |
| | | whereSql.append("' >= '"); |
| | | whereSql.append(DateUtils.format(indItem.getTimeStart(), PATTERN_MON)); |
| | | whereSql.append("'"); |
| | | break; |