package com.ruoyi.demo.entity.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.demo.entity.BrandProvince;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class BrandProvinceBo implements Serializable {
    private String brandId;
    private String code;
    private String name;
    private String location;
    private Integer count;
    private String ratio;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    public BrandProvinceBo() {
    }

    public BrandProvinceBo(BrandProvince province, Integer total) {
        // this.brandId = province.getBrandId();
        this.code = province.getAddrCode();
        this.name = province.getProvince();
        this.location = province.getLat().toString() + "," + province.getLng().toString();
        this.count = province.getDisCount();
        float ratio = (float) province.getDisCount() / total;
        this.ratio = (ratio * 100) + "%";
        this.updateTime = province.getUpdateTime();
    }
}
