longz
2026-07-24 5b23c1a87779c9e7f17d56a5566dba7eac46d81a
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package com.ruoyi.chargingPile.dto;
 
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.common.core.annotation.Excel;
import lombok.Data;
import org.springframework.beans.BeanUtils;
 
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
 
@Data
public class SiteExcelDTO {
 
    @Excel(name = "*归属合作商/服务商", width = 28)
    private String partnerName;
    @Excel(name = "场地方", width = 25)
    private String venuePartnerName;
    @Excel(name = "*站点编号", width = 22)
    private String code;
    @Excel(name = "*站点名称", width = 30)
    private String name;
    @Excel(name = "*站点类型", width = 20, readConverterExp = "0=其他,1=公共,2=个人,3=公交(专用),4=环卫(专用),5=物流(专用),6=出租车(专用)")
    private Integer siteType;
    @Excel(name = "*经营类别", width = 15, readConverterExp = "1=直营,2=非直营")
    private Integer businessCategory;
    @Excel(name = "*站点状态", width = 18, readConverterExp = "1=正常使用,2=维护中,3=关闭下线")
    private Integer status;
    @Excel(name = "*建设场所", width = 24, readConverterExp = "0=其他,1=居民区,2=公共机构,3=企事业单位,4=写字楼,5=工业园区,6=交通枢纽,7=大型文体设施,8=城市绿地,9=大型建筑配建停车场,10=路边停车位,11=城际高速服务区,12=风景区,13=公交场站,14=加油加气站,15=出租车")
    private Integer constructionSite;
    @Excel(name = "*变压器功率", width = 18)
    private BigDecimal transformerPower;
    @Excel(name = "*是否参与会员折扣", width = 22, readConverterExp = "0=否,1=是")
    private Integer memberDiscountFlag;
    @Excel(name = "*所在区域", width = 20, prompt = "填写区县行政区划代码,如510903")
    private String areaCode;
    @Excel(name = "*详细地址", width = 35)
    private String address;
    @Excel(name = "*经度", width = 18)
    private String lon;
    @Excel(name = "*纬度", width = 18)
    private String lat;
    @Excel(name = "*充电站国家代码", width = 20)
    private String countryCode;
    @Excel(name = "*站点电话", width = 22)
    private String phone;
    @Excel(name = "*服务电话", width = 22)
    private String servicePhone;
    @Excel(name = "站点引导", width = 30)
    private String guide;
    @Excel(name = "运营时间", width = 30)
    private String startServiceTime;
    @Excel(name = "站内提供服务", width = 30)
    private String serviceDescription;
    @Excel(name = "车型描述", width = 30)
    private String vehicleDescription;
    @Excel(name = "*车位数量", width = 15)
    private Integer parkingSpace;
    @Excel(name = "*充电电费描述", width = 35)
    private String rateDescription;
    @Excel(name = "超时占位费描述", width = 35)
    private String spaceChargeExplain;
    @Excel(name = "计费模板", width = 25)
    private String accountingStrategyName;
    @Excel(name = "建站时间", width = 22, prompt = "格式:yyyy-MM-dd HH:mm:ss")
    private String establishmentTime;
    @Excel(name = "*排序", width = 12)
    private Integer sort;
    @Excel(name = "备注", width = 30)
    private String remark;
    @Excel(name = "*电站分类", width = 22, readConverterExp = "1=充电站,2=换电站,3=充换电一体站")
    private Integer stationClassification;
    @Excel(name = "通用类型", width = 18, readConverterExp = "1=通用类型,2=非通用")
    private Integer generalApplicationType;
    @Excel(name = "充换电站所在县以下行政区划代码", width = 34)
    private String areaCodeCountryside;
    @Excel(name = "*7*24小时营业", width = 20, readConverterExp = "0=否,1=是")
    private Integer roundTheClock;
    @Excel(name = "*停车费类型", width = 22, readConverterExp = "0=免费,1=不免费,2=限时免费停车,3=充电限时减免,4=参考场地实际收费标准")
    private Integer parkType;
    @Excel(name = "停车费描述", width = 35)
    private String parkFee;
    @Excel(name = "服务车型描述", width = 30)
    private String swapMatchCars;
    @Excel(name = "支付方式", width = 18, readConverterExp = "1=刷卡,2=线上,3=现金")
    private Integer payment;
    @Excel(name = "是否支持预约", width = 20, readConverterExp = "1=支持,2=不支持")
    private Integer supportOrder;
    @Excel(name = "*电费类型", width = 22, readConverterExp = "0=其他用电,1=商业用电,2=普通工业用电,3=大工业用电")
    private Integer electricityType;
    @Excel(name = "*报装类型", width = 20, readConverterExp = "1=独立报装,2=非独立报装",
            prompt = "填写:独立报装或非独立报装")
    private Integer businessExpandType;
    @Excel(name = "*报装电源容量", width = 20)
    private BigDecimal capacity;
    @Excel(name = "*站点额定总功率", width = 22)
    private BigDecimal ratedPower;
    @Excel(name = "*是否峰谷分时", width = 20, readConverterExp = "0=否,1=是")
    private Integer periodFee;
    @Excel(name = "*正式投运时间", width = 22, prompt = "格式:yyyy-MM-dd")
    private String officialRunTime;
    @Excel(name = "充换电站方位", width = 24, readConverterExp = "1=地面-停车场,2=地面-路侧,3=地下停车,4=立体式停车楼")
    private Integer stationOrientation;
    @Excel(name = "充换电站建设面积", width = 24)
    private BigDecimal stationArea;
    @Excel(name = "充换电站人工值守", width = 24, readConverterExp = "0=无,1=有")
    private Integer havePerson;
    @Excel(name = "*视频监控配套情况", width = 24, readConverterExp = "0=无,1=有")
    private Integer videoMonitor;
    @Excel(name = "周边配套设施", width = 30)
    private String supportingFacilities;
    @Excel(name = "是否有小票机", width = 20, readConverterExp = "0=无,1=有")
    private Integer printerFlag;
    @Excel(name = "是否有道闸", width = 18, readConverterExp = "0=无,1=有")
    private Integer barrierFlag;
    @Excel(name = "是否有地锁", width = 18, readConverterExp = "0=无,1=有")
    private Integer parkingLockFlag;
    @Excel(name = "*设备所属方名称", width = 28)
    private String equipmentOwnerName;
    @Excel(name = "*供电局用户编号", width = 25)
    private String residentNo;
    @Excel(name = "*供电类型", width = 18, readConverterExp = "1=直供电,2=转供电")
    private Integer supplyType;
    @Excel(name = "*表号", width = 20)
    private String wattHourMeterNo;
    @Excel(name = "*外电功率", width = 18)
    private BigDecimal forwardPower;
    @Excel(name = "*服务费描述", width = 35)
    private String serviceFee;
    @Excel(name = "*充电站全省唯一备案号", width = 32)
    private String recordUniqueNo;
 
    public static SiteExcelDTO from(Site site, String partnerName, String venuePartnerName, String strategyName) {
        SiteExcelDTO dto = new SiteExcelDTO();
        BeanUtils.copyProperties(site, dto);
        dto.setPartnerName(partnerName);
        dto.setVenuePartnerName(venuePartnerName);
        dto.setAccountingStrategyName(strategyName);
        dto.setAreaCode(site.getDistrictsCode());
        if (site.getEstablishmentTime() != null) {
            dto.setEstablishmentTime(site.getEstablishmentTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        }
        dto.setOfficialRunTime(formatDateOnly(site.getOfficialRunTime()));
        return dto;
    }
 
    static String formatDateOnly(String value) {
        if (value == null || value.trim().isEmpty()) {
            return value;
        }
        String text = value.trim();
        try {
            return LocalDate.parse(text, DateTimeFormatter.ISO_LOCAL_DATE).toString();
        } catch (DateTimeParseException ignored) {
            // Continue with timestamp formats used by historical site data.
        }
        try {
            return OffsetDateTime.parse(text, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
                    .atZoneSameInstant(ZoneId.of("Asia/Shanghai")).toLocalDate().toString();
        } catch (DateTimeParseException ignored) {
            // Some records use an instant with millisecond precision and a trailing Z.
        }
        try {
            return Instant.parse(text).atZone(ZoneId.of("Asia/Shanghai")).toLocalDate().toString();
        } catch (DateTimeParseException ignored) {
            return text;
        }
    }
}