cjl
2023-09-26 346288bc38bdab442721d7609caed86d03b9d2d4
screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationPageVo.java
New file
@@ -0,0 +1,122 @@
package com.moral.api.pojo.vo.allocation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.moral.api.pojo.enums.AllocationApproveEnum;
import com.moral.api.pojo.ext.allocation.AllocationPageExt;
import com.moral.api.utils.BeanConverts;
import com.moral.util.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
 * <p>
 * 交办单
 * </p>
 * deyt template generate
 * @author JI
 * @since 2023-09-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="Allocation - 分页VO对象", description="Allocation - 分页VO对象")
public class AllocationPageVo implements Serializable {
    @ApiModelProperty(value = "主键id")
    private Integer allocationId;
    @ApiModelProperty(value = "交办单号")
    private String allocationNum;
    @ApiModelProperty(value = "上报时间")
    @JsonFormat(pattern="yyyy-MM-dd")
    private Date escalationTime;
    @ApiModelProperty(value = "责任单位id")
    private Integer unitId;
    @ApiModelProperty(value = "污染分类id")
    private Integer polluteType;
    @ApiModelProperty(value = "整改类型id")
    private Integer changeType;
    @ApiModelProperty(value = "期限天数")
    private Integer changeDay;
    @ApiModelProperty(value = "剩余天数")
    private Integer residueDay;
    @ApiModelProperty(value = "上报单位id")
    private Integer escalationUnitId;
    @ApiModelProperty(value = "上报人")
    private String escalationName;
    @ApiModelProperty(value = "排查方式id")
    private Integer investigationType;
    @ApiModelProperty(value = "状态")
    private Integer state;
    @ApiModelProperty(value = "是否作废")
    private Integer isInvalid;
    @ApiModelProperty(value = "创建人id")
    private Integer createId;
    @ApiModelProperty(value = "创建人姓名")
    private String createName;
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date createTime;
    @ApiModelProperty(value = "更新人id")
    private Integer updateId;
    @ApiModelProperty(value = "更新人姓名")
    private String updateName;
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date updateTime;
    @ApiModelProperty(value = "能否申请延期")
    private Integer applyState;
    public static AllocationPageVo convert(AllocationPageExt allocationPageExt) {
        AllocationPageVo allocationPageVo = BeanConverts.convert(allocationPageExt, AllocationPageVo.class);
        return allocationPageVo;
    }
    public static List<AllocationPageVo> convert(List<AllocationPageExt> allocationPageExtList) {
        return allocationPageExtList.stream().map(AllocationPageVo::convert).collect(Collectors.toList());
    }
    public Integer getResidueDay() {
        int day = this.changeDay;
        if(AllocationApproveEnum.UNDER_RECTIFICATION.value.equals(state)){
            Date date = new Date();
            int days = DateUtils.getDays(escalationTime, date);
            return day-days;
        }
        return day;
    }
    public Integer getApplyState() {
        return Objects.isNull(applyState)?0:applyState;
    }
}