package com.ho.business.service.impl;

import com.ho.datacollect.api.constant.DataCollectConstant;
import com.ho.datacollect.api.vo.req.add.TdBase;
import com.ho.business.service.JoinTbSuffixService;
import org.springframework.stereotype.Service;

/**
 * @author fancl
 * @desc:
 * @date 2022/9/7
 */
@Service
public class JoinTbSuffixServiceImpl implements JoinTbSuffixService {

    //包pack后缀拼接
    @Override
    public String getTdPackSuffix(TdBase tdAddBase) {
        StringBuilder sb = new StringBuilder();
        StringBuilder append = sb.append(tdAddBase.getGroupId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getDeptId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getStationId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getPackId());
        return append.toString();
    }

    //簇后缀拼接
    @Override
    public String getTdClusterSuffix(TdBase tdAddBase) {
        StringBuilder sb = new StringBuilder();
        StringBuilder append = sb.append(tdAddBase.getGroupId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getDeptId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getStationId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getClusterId());
        return append.toString();
    }

    //堆后缀拼接
    @Override
    public String getTdStackSuffix(TdBase tdAddBase) {
        StringBuilder sb = new StringBuilder();
        StringBuilder append = sb.append(tdAddBase.getGroupId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getDeptId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getStationId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getStackId());
        return append.toString();
    }


    //遥测后缀拼接
    @Override
    public String getStationYcSuffix(TdBase tdAddBase) {
        StringBuilder sb = new StringBuilder();
        StringBuilder append = sb.append(tdAddBase.getGroupId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getDeptId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getStationId());
        return  append.toString();
    }

    @Override
    public String getTdWarehouseSuffix(TdBase tdAddBase) {
        StringBuilder sb = new StringBuilder();
        StringBuilder append = sb.append(tdAddBase.getGroupId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getDeptId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getStationId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getWarehouseId());
        return append.toString();
    }

    @Override
    public String getPvEnergySuffix(TdBase tdAddBase) {
        StringBuilder sb = new StringBuilder();
        StringBuilder append = sb.append(tdAddBase.getGroupId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getDeptId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getStationId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getBayId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getSrcId());
        return append.toString();
    }

    //逆变器后缀拼接
    @Override
    public String getTdInverterSuffix(TdBase tdAddBase) {
        StringBuilder sb = new StringBuilder();
        StringBuilder append = sb.append(tdAddBase.getGroupId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getStationId()).append(DataCollectConstant.TABLE_LINK)
                .append(tdAddBase.getSrcId());
        return append.toString();
    }
}
