package com.qunzhixinxi.hnqz.admin.entity.input;

import com.qunzhixinxi.hnqz.common.ding.enums.DingEnum;
import lombok.Data;
import lombok.ToString;

/**
 *
 * @author zhangwt
 * @since 1.0
 */
@Data
@ToString
public class SettleNoteStatusOutput {

    /**
     * 成功数
     */
    private Integer successCount;

    /**
     * 失败数
     */
    private Integer failCount;

	/**
	 * 已提交数
	 */
    private Integer submitCount;

	/**
	 * 总数量
	 */
    private Integer totalCount;


    /**
     * 是否完成
     * 转为发放状态
     *
     * @param
     * @return
     * @author zhangwt
     * @since 1.0
     */
    public Integer toSettleStatus() {

    	if(null == totalCount || totalCount == 0){
			return DingEnum.SETTLE_STATUS_FAIL.getType();
		}
    	if(submitCount.equals(totalCount)){
			return DingEnum.SETTLE_STATUS_SUBMIT.getType();
		}
		if(failCount.equals(totalCount)){
			return DingEnum.SETTLE_STATUS_FAIL.getType();
		}
		if(successCount.equals(totalCount)){
			return DingEnum.SETTLE_STATUS_SUCCESS.getType();
		}

    	return DingEnum.SETTLE_STATUS_PART.getType();
    }
}
