package com.rongwei.bsentity.vo;

import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * 落实行动计划及时完成率
 * @author Trj
 * @date 2023-05-12
 */
@Data
public class TimelyCompletionVo implements Serializable {
    public static final Long serialVersionUID = 1L;

    /**
     * ID
     */
    private String id;

    /**
     *  部门
     */
    private String fullName;

    /**
     *  总数
     */
    private Integer count;

    /**
     * 完成数
     */
    private Integer okCount;


    /**
     * 完成率
     */
    private BigDecimal okRate;




    public void init (){

        if (this.okCount == null ){
            this.okCount = 0;
        }

        if ( this.count == null ){
            this.count = 0 ;
        }

        if (this.count == 0 || this.okCount == 0){
            this.okRate = BigDecimal.ZERO;
        }else{
            this.okRate = new BigDecimal(this.okCount.toString()).divide(new BigDecimal(this.count.toString()),2, RoundingMode.UP);
            this.okRate = this.okRate.multiply(new BigDecimal("100"));
        }

    }
}
