jinpengyong
2023-10-23 d26d1fba7d3f8db6eb87f9da6c25b8a98de6e1ea
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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;
 
    @ApiModelProperty(value = "能否审批")
    private Integer isApprove;
 
    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;
    }
}