chenshudong 4 日 前
コミット
e64cbf72fa

+ 123 - 0
airport-admin/src/main/java/com/sundot/airport/web/controller/blocked/BlockedRateController.java

@@ -0,0 +1,123 @@
1
+package com.sundot.airport.web.controller.blocked;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+
6
+import org.springframework.security.access.prepost.PreAuthorize;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.web.bind.annotation.GetMapping;
9
+import org.springframework.web.bind.annotation.PostMapping;
10
+import org.springframework.web.bind.annotation.PutMapping;
11
+import org.springframework.web.bind.annotation.DeleteMapping;
12
+import org.springframework.web.bind.annotation.PathVariable;
13
+import org.springframework.web.bind.annotation.RequestBody;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+import com.sundot.airport.common.annotation.Log;
17
+import com.sundot.airport.common.core.controller.BaseController;
18
+import com.sundot.airport.common.core.domain.AjaxResult;
19
+import com.sundot.airport.common.enums.BusinessType;
20
+import com.sundot.airport.blocked.domain.BlockedRate;
21
+import com.sundot.airport.blocked.service.BlockedRateService;
22
+import com.sundot.airport.common.utils.poi.ExcelUtil;
23
+import com.sundot.airport.common.core.page.TableDataInfo;
24
+import org.springframework.web.multipart.MultipartFile;
25
+
26
+/**
27
+ * 速率Controller
28
+ *
29
+ * @author ruoyi
30
+ * @date 2026-04-13
31
+ */
32
+@RestController
33
+@RequestMapping("/blocked/rate")
34
+public class BlockedRateController extends BaseController {
35
+    @Autowired
36
+    private BlockedRateService blockedRateService;
37
+
38
+    /**
39
+     * 查询速率列表
40
+     */
41
+    @PreAuthorize("@ss.hasPermi('blocked:rate:list')")
42
+    @GetMapping("/list")
43
+    public TableDataInfo list(BlockedRate itemSeizureRate) {
44
+        startPage();
45
+        List<BlockedRate> list = blockedRateService.selectBlockedRateList(itemSeizureRate);
46
+        return getDataTable(list);
47
+    }
48
+
49
+    /**
50
+     * 导出速率列表
51
+     */
52
+    @PreAuthorize("@ss.hasPermi('blocked:rate:export')")
53
+    @Log(title = "速率", businessType = BusinessType.EXPORT)
54
+    @PostMapping("/export")
55
+    public void export(HttpServletResponse response, BlockedRate itemSeizureRate) {
56
+        List<BlockedRate> list = blockedRateService.selectBlockedRateList(itemSeizureRate);
57
+        ExcelUtil<BlockedRate> util = new ExcelUtil<>(BlockedRate.class);
58
+        util.exportExcel(response, list, "速率数据");
59
+    }
60
+
61
+    /**
62
+     * 导入速率列表
63
+     */
64
+    @PreAuthorize("@ss.hasPermi('blocked:rate:import')")
65
+    @Log(title = "导入速率列表", businessType = BusinessType.IMPORT)
66
+    @PostMapping("/importData")
67
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
68
+        ExcelUtil<BlockedRate> util = new ExcelUtil<>(BlockedRate.class);
69
+        List<BlockedRate> list = util.importExcel(file.getInputStream());
70
+        String message = blockedRateService.importData(list, updateSupport);
71
+        return success(message);
72
+    }
73
+
74
+    /**
75
+     * 获取导入模板
76
+     */
77
+    @PostMapping("/importTemplate")
78
+    public void importTemplate(HttpServletResponse response) {
79
+        ExcelUtil<BlockedRate> util = new ExcelUtil<>(BlockedRate.class);
80
+        util.importTemplateExcel(response, "速率数据导入模板");
81
+    }
82
+
83
+    /**
84
+     * 获取速率详细信息
85
+     */
86
+    @PreAuthorize("@ss.hasPermi('blocked:rate:query')")
87
+    @GetMapping(value = "/{id}")
88
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
89
+        return success(blockedRateService.selectBlockedRateById(id));
90
+    }
91
+
92
+    /**
93
+     * 新增速率
94
+     */
95
+    @PreAuthorize("@ss.hasPermi('blocked:rate:add')")
96
+    @Log(title = "速率", businessType = BusinessType.INSERT)
97
+    @PostMapping("/add")
98
+    public AjaxResult add(@RequestBody BlockedRate itemSeizureRate) {
99
+        itemSeizureRate.setCreateBy(getUsername());
100
+        return toAjax(blockedRateService.insertBlockedRate(itemSeizureRate));
101
+    }
102
+
103
+    /**
104
+     * 修改速率
105
+     */
106
+    @PreAuthorize("@ss.hasPermi('blocked:rate:edit')")
107
+    @Log(title = "速率", businessType = BusinessType.UPDATE)
108
+    @PostMapping("/edit")
109
+    public AjaxResult edit(@RequestBody BlockedRate itemSeizureRate) {
110
+        itemSeizureRate.setUpdateBy(getUsername());
111
+        return toAjax(blockedRateService.updateBlockedRate(itemSeizureRate));
112
+    }
113
+
114
+    /**
115
+     * 删除速率
116
+     */
117
+    @PreAuthorize("@ss.hasPermi('blocked:rate:remove')")
118
+    @Log(title = "速率", businessType = BusinessType.DELETE)
119
+    @DeleteMapping("/{ids}")
120
+    public AjaxResult remove(@PathVariable Long[] ids) {
121
+        return toAjax(blockedRateService.deleteBlockedRateByIds(ids));
122
+    }
123
+}

+ 264 - 0
airport-blocked/src/main/java/com/sundot/airport/blocked/domain/BlockedRate.java

@@ -0,0 +1,264 @@
1
+package com.sundot.airport.blocked.domain;
2
+
3
+import java.math.BigDecimal;
4
+import java.util.Date;
5
+
6
+import com.baomidou.mybatisplus.annotation.IdType;
7
+import com.baomidou.mybatisplus.annotation.TableId;
8
+import com.baomidou.mybatisplus.annotation.TableName;
9
+import com.fasterxml.jackson.annotation.JsonFormat;
10
+import org.apache.commons.lang3.builder.ToStringBuilder;
11
+import org.apache.commons.lang3.builder.ToStringStyle;
12
+import com.sundot.airport.common.annotation.Excel;
13
+import com.sundot.airport.common.annotation.Excel.Type;
14
+import com.sundot.airport.common.core.domain.BaseEntity;
15
+import org.springframework.format.annotation.DateTimeFormat;
16
+
17
+/**
18
+ * 速率对象 blocked_rate
19
+ *
20
+ * @author ruoyi
21
+ * @date 2026-04-13
22
+ */
23
+@TableName("blocked_rate")
24
+public class BlockedRate extends BaseEntity {
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    /**
28
+     * 租户号
29
+     */
30
+    private String tenantId;
31
+
32
+    /**
33
+     * 乐观锁
34
+     */
35
+    private Long revision;
36
+
37
+    /**
38
+     * 主键
39
+     */
40
+    @TableId(type = IdType.AUTO)
41
+    private Long id;
42
+
43
+    /**
44
+     * 日期(格式:yyyy-MM-dd)
45
+     */
46
+    @JsonFormat(pattern = "yyyy-MM-dd")
47
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
48
+    @Excel(name = "日期", dateFormat = "yyyy-MM-dd")
49
+    private Date statDate;
50
+
51
+    /**
52
+     * 旅检国内区域平均速率(高峰期时段)
53
+     */
54
+    @Excel(name = "旅检国内区域平均速率")
55
+    private BigDecimal travelInspectionDomesticAvgRatePeak;
56
+
57
+    /**
58
+     * 当班大队ID
59
+     */
60
+    private Long dutyBrigadeId;
61
+
62
+    /**
63
+     * 当班大队名称
64
+     */
65
+    @Excel(name = "当班大队")
66
+    private String dutyBrigadeName;
67
+
68
+    /**
69
+     * T1-A区速率(高峰期时段)
70
+     */
71
+    @Excel(name = "T1-A区速率")
72
+    private BigDecimal t1AAreaRatePeak;
73
+
74
+    /**
75
+     * T1-B区速率(高峰期时段)
76
+     */
77
+    @Excel(name = "T1-B区速率")
78
+    private BigDecimal t1BAreaRatePeak;
79
+
80
+    /**
81
+     * T2-国内速率(高峰期时段)
82
+     */
83
+    @Excel(name = "T2-国内速率")
84
+    private BigDecimal t2DomesticRatePeak;
85
+
86
+    /**
87
+     * T2-国际速率(高峰期时段)
88
+     */
89
+    @Excel(name = "T2-国际速率")
90
+    private BigDecimal t2InternationalRatePeak;
91
+
92
+    /**
93
+     * 班次(字典:shift【DAY=白班;NIGHT=夜班】)
94
+     */
95
+    @Excel(name = "班次",
96
+            readConverterExp = "DAY=白班," +
97
+                    "NIGHT=夜班,",
98
+            combo = "白班,夜班",
99
+            type = Type.EXPORT)
100
+    private String shift;
101
+
102
+    /**
103
+     * 班次描述
104
+     */
105
+    @Excel(name = "班次", type = Type.IMPORT)
106
+    private String shiftDesc;
107
+
108
+    /**
109
+     * T2-中转(高峰期时段)
110
+     */
111
+    @Excel(name = "T2-中转")
112
+    private BigDecimal t2TransferRatePeak;
113
+
114
+    /**
115
+     * 国际及中转区域平均速率(高峰期时段)
116
+     */
117
+    @Excel(name = "国际及中转区域平均速率")
118
+    private BigDecimal internationalTransferAvgRatePeak;
119
+
120
+    public void setTenantId(String tenantId) {
121
+        this.tenantId = tenantId;
122
+    }
123
+
124
+    public String getTenantId() {
125
+        return tenantId;
126
+    }
127
+
128
+    public void setRevision(Long revision) {
129
+        this.revision = revision;
130
+    }
131
+
132
+    public Long getRevision() {
133
+        return revision;
134
+    }
135
+
136
+    public void setId(Long id) {
137
+        this.id = id;
138
+    }
139
+
140
+    public Long getId() {
141
+        return id;
142
+    }
143
+
144
+    public void setStatDate(Date statDate) {
145
+        this.statDate = statDate;
146
+    }
147
+
148
+    public Date getStatDate() {
149
+        return statDate;
150
+    }
151
+
152
+    public void setTravelInspectionDomesticAvgRatePeak(BigDecimal travelInspectionDomesticAvgRatePeak) {
153
+        this.travelInspectionDomesticAvgRatePeak = travelInspectionDomesticAvgRatePeak;
154
+    }
155
+
156
+    public BigDecimal getTravelInspectionDomesticAvgRatePeak() {
157
+        return travelInspectionDomesticAvgRatePeak;
158
+    }
159
+
160
+    public void setDutyBrigadeId(Long dutyBrigadeId) {
161
+        this.dutyBrigadeId = dutyBrigadeId;
162
+    }
163
+
164
+    public Long getDutyBrigadeId() {
165
+        return dutyBrigadeId;
166
+    }
167
+
168
+    public void setDutyBrigadeName(String dutyBrigadeName) {
169
+        this.dutyBrigadeName = dutyBrigadeName;
170
+    }
171
+
172
+    public String getDutyBrigadeName() {
173
+        return dutyBrigadeName;
174
+    }
175
+
176
+    public void setT1AAreaRatePeak(BigDecimal t1AAreaRatePeak) {
177
+        this.t1AAreaRatePeak = t1AAreaRatePeak;
178
+    }
179
+
180
+    public BigDecimal getT1AAreaRatePeak() {
181
+        return t1AAreaRatePeak;
182
+    }
183
+
184
+    public void setT1BAreaRatePeak(BigDecimal t1BAreaRatePeak) {
185
+        this.t1BAreaRatePeak = t1BAreaRatePeak;
186
+    }
187
+
188
+    public BigDecimal getT1BAreaRatePeak() {
189
+        return t1BAreaRatePeak;
190
+    }
191
+
192
+    public void setT2DomesticRatePeak(BigDecimal t2DomesticRatePeak) {
193
+        this.t2DomesticRatePeak = t2DomesticRatePeak;
194
+    }
195
+
196
+    public BigDecimal getT2DomesticRatePeak() {
197
+        return t2DomesticRatePeak;
198
+    }
199
+
200
+    public void setT2InternationalRatePeak(BigDecimal t2InternationalRatePeak) {
201
+        this.t2InternationalRatePeak = t2InternationalRatePeak;
202
+    }
203
+
204
+    public BigDecimal getT2InternationalRatePeak() {
205
+        return t2InternationalRatePeak;
206
+    }
207
+
208
+    public void setShift(String shift) {
209
+        this.shift = shift;
210
+    }
211
+
212
+    public String getShift() {
213
+        return shift;
214
+    }
215
+
216
+    public String getShiftDesc() {
217
+        return shiftDesc;
218
+    }
219
+
220
+    public void setShiftDesc(String shiftDesc) {
221
+        this.shiftDesc = shiftDesc;
222
+    }
223
+
224
+    public void setT2TransferRatePeak(BigDecimal t2TransferRatePeak) {
225
+        this.t2TransferRatePeak = t2TransferRatePeak;
226
+    }
227
+
228
+    public BigDecimal getT2TransferRatePeak() {
229
+        return t2TransferRatePeak;
230
+    }
231
+
232
+    public void setInternationalTransferAvgRatePeak(BigDecimal internationalTransferAvgRatePeak) {
233
+        this.internationalTransferAvgRatePeak = internationalTransferAvgRatePeak;
234
+    }
235
+
236
+    public BigDecimal getInternationalTransferAvgRatePeak() {
237
+        return internationalTransferAvgRatePeak;
238
+    }
239
+
240
+    @Override
241
+    public String toString() {
242
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
243
+                .append("tenantId", getTenantId())
244
+                .append("revision", getRevision())
245
+                .append("createBy", getCreateBy())
246
+                .append("createTime", getCreateTime())
247
+                .append("updateBy", getUpdateBy())
248
+                .append("updateTime", getUpdateTime())
249
+                .append("remark", getRemark())
250
+                .append("id", getId())
251
+                .append("statDate", getStatDate())
252
+                .append("travelInspectionDomesticAvgRatePeak", getTravelInspectionDomesticAvgRatePeak())
253
+                .append("dutyBrigadeId", getDutyBrigadeId())
254
+                .append("dutyBrigadeName", getDutyBrigadeName())
255
+                .append("t1AAreaRatePeak", getT1AAreaRatePeak())
256
+                .append("t1BAreaRatePeak", getT1BAreaRatePeak())
257
+                .append("t2DomesticRatePeak", getT2DomesticRatePeak())
258
+                .append("t2InternationalRatePeak", getT2InternationalRatePeak())
259
+                .append("shift", getShift())
260
+                .append("t2TransferRatePeak", getT2TransferRatePeak())
261
+                .append("internationalTransferAvgRatePeak", getInternationalTransferAvgRatePeak())
262
+                .toString();
263
+    }
264
+}

+ 62 - 0
airport-blocked/src/main/java/com/sundot/airport/blocked/mapper/BlockedRateMapper.java

@@ -0,0 +1,62 @@
1
+package com.sundot.airport.blocked.mapper;
2
+
3
+import java.util.List;
4
+
5
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.sundot.airport.blocked.domain.BlockedRate;
7
+
8
+/**
9
+ * 速率Mapper接口
10
+ *
11
+ * @author ruoyi
12
+ * @date 2026-04-13
13
+ */
14
+public interface BlockedRateMapper extends BaseMapper<BlockedRate> {
15
+    /**
16
+     * 查询速率
17
+     *
18
+     * @param id 速率主键
19
+     * @return 速率
20
+     */
21
+    public BlockedRate selectBlockedRateById(Long id);
22
+
23
+    /**
24
+     * 查询速率列表
25
+     *
26
+     * @param blockedRate 速率
27
+     * @return 速率集合
28
+     */
29
+    public List<BlockedRate> selectBlockedRateList(BlockedRate blockedRate);
30
+
31
+    /**
32
+     * 新增速率
33
+     *
34
+     * @param blockedRate 速率
35
+     * @return 结果
36
+     */
37
+    public int insertBlockedRate(BlockedRate blockedRate);
38
+
39
+    /**
40
+     * 修改速率
41
+     *
42
+     * @param blockedRate 速率
43
+     * @return 结果
44
+     */
45
+    public int updateBlockedRate(BlockedRate blockedRate);
46
+
47
+    /**
48
+     * 删除速率
49
+     *
50
+     * @param id 速率主键
51
+     * @return 结果
52
+     */
53
+    public int deleteBlockedRateById(Long id);
54
+
55
+    /**
56
+     * 批量删除速率
57
+     *
58
+     * @param ids 需要删除的数据主键集合
59
+     * @return 结果
60
+     */
61
+    public int deleteBlockedRateByIds(Long[] ids);
62
+}

+ 71 - 0
airport-blocked/src/main/java/com/sundot/airport/blocked/service/BlockedRateService.java

@@ -0,0 +1,71 @@
1
+package com.sundot.airport.blocked.service;
2
+
3
+import java.util.List;
4
+
5
+import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.sundot.airport.blocked.domain.BlockedRate;
7
+
8
+/**
9
+ * 速率Service接口
10
+ *
11
+ * @author ruoyi
12
+ * @date 2026-04-13
13
+ */
14
+public interface BlockedRateService extends IService<BlockedRate> {
15
+    /**
16
+     * 查询速率
17
+     *
18
+     * @param id 速率主键
19
+     * @return 速率
20
+     */
21
+    public BlockedRate selectBlockedRateById(Long id);
22
+
23
+    /**
24
+     * 查询速率列表
25
+     *
26
+     * @param blockedRate 速率
27
+     * @return 速率集合
28
+     */
29
+    public List<BlockedRate> selectBlockedRateList(BlockedRate blockedRate);
30
+
31
+    /**
32
+     * 新增速率
33
+     *
34
+     * @param blockedRate 速率
35
+     * @return 结果
36
+     */
37
+    public int insertBlockedRate(BlockedRate blockedRate);
38
+
39
+    /**
40
+     * 修改速率
41
+     *
42
+     * @param blockedRate 速率
43
+     * @return 结果
44
+     */
45
+    public int updateBlockedRate(BlockedRate blockedRate);
46
+
47
+    /**
48
+     * 批量删除速率
49
+     *
50
+     * @param ids 需要删除的速率主键集合
51
+     * @return 结果
52
+     */
53
+    public int deleteBlockedRateByIds(Long[] ids);
54
+
55
+    /**
56
+     * 删除速率信息
57
+     *
58
+     * @param id 速率主键
59
+     * @return 结果
60
+     */
61
+    public int deleteBlockedRateById(Long id);
62
+
63
+    /**
64
+     * 导入速率列表
65
+     *
66
+     * @param list          数据列表
67
+     * @param updateSupport 是否更新支持
68
+     * @return 导入结果信息
69
+     */
70
+    public String importData(List<BlockedRate> list, boolean updateSupport);
71
+}

+ 214 - 0
airport-blocked/src/main/java/com/sundot/airport/blocked/service/impl/BlockedRateServiceImpl.java

@@ -0,0 +1,214 @@
1
+package com.sundot.airport.blocked.service.impl;
2
+
3
+import java.util.List;
4
+import java.util.Map;
5
+import java.util.stream.Collectors;
6
+
7
+import cn.hutool.core.collection.CollUtil;
8
+import cn.hutool.core.util.ObjUtil;
9
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
10
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
11
+import com.sundot.airport.common.core.domain.entity.SysDept;
12
+import com.sundot.airport.common.enums.ShiftEnum;
13
+import com.sundot.airport.common.exception.ServiceException;
14
+import com.sundot.airport.common.utils.DateUtils;
15
+import com.sundot.airport.system.service.ISysDeptService;
16
+import org.springframework.beans.factory.annotation.Autowired;
17
+import org.springframework.stereotype.Service;
18
+import com.sundot.airport.blocked.mapper.BlockedRateMapper;
19
+import com.sundot.airport.blocked.domain.BlockedRate;
20
+import com.sundot.airport.blocked.service.BlockedRateService;
21
+import org.springframework.transaction.annotation.Transactional;
22
+
23
+/**
24
+ * 速率Service业务层处理
25
+ *
26
+ * @author ruoyi
27
+ * @date 2026-04-13
28
+ */
29
+@Service
30
+public class BlockedRateServiceImpl extends ServiceImpl<BlockedRateMapper, BlockedRate> implements BlockedRateService {
31
+    @Autowired
32
+    private BlockedRateMapper blockedRateMapper;
33
+    @Autowired
34
+    private ISysDeptService sysDeptService;
35
+
36
+    /**
37
+     * 查询速率
38
+     *
39
+     * @param id 速率主键
40
+     * @return 速率
41
+     */
42
+    @Override
43
+    public BlockedRate selectBlockedRateById(Long id) {
44
+        return blockedRateMapper.selectBlockedRateById(id);
45
+    }
46
+
47
+    /**
48
+     * 查询速率列表
49
+     *
50
+     * @param blockedRate 速率
51
+     * @return 速率
52
+     */
53
+    @Override
54
+    public List<BlockedRate> selectBlockedRateList(BlockedRate blockedRate) {
55
+        return blockedRateMapper.selectBlockedRateList(blockedRate);
56
+    }
57
+
58
+    /**
59
+     * 新增速率
60
+     *
61
+     * @param blockedRate 速率
62
+     * @return 结果
63
+     */
64
+    @Override
65
+    public int insertBlockedRate(BlockedRate blockedRate) {
66
+        blockedRate.setCreateTime(DateUtils.getNowDate());
67
+        LambdaQueryWrapper<BlockedRate> queryWrapper = new LambdaQueryWrapper<>();
68
+        queryWrapper.eq(BlockedRate::getStatDate, blockedRate.getStatDate())
69
+                .eq(BlockedRate::getDutyBrigadeId, blockedRate.getDutyBrigadeId())
70
+                .eq(BlockedRate::getShift, blockedRate.getShift());
71
+        BlockedRate existingRate = blockedRateMapper.selectOne(queryWrapper);
72
+        if (ObjUtil.isNotNull(existingRate)) {
73
+            blockedRate.setId(existingRate.getId());
74
+            return blockedRateMapper.updateBlockedRate(blockedRate);
75
+        } else {
76
+            return blockedRateMapper.insertBlockedRate(blockedRate);
77
+        }
78
+    }
79
+
80
+    /**
81
+     * 修改速率
82
+     *
83
+     * @param blockedRate 速率
84
+     * @return 结果
85
+     */
86
+    @Override
87
+    public int updateBlockedRate(BlockedRate blockedRate) {
88
+        blockedRate.setUpdateTime(DateUtils.getNowDate());
89
+        return blockedRateMapper.updateBlockedRate(blockedRate);
90
+    }
91
+
92
+    /**
93
+     * 批量删除速率
94
+     *
95
+     * @param ids 需要删除的速率主键
96
+     * @return 结果
97
+     */
98
+    @Override
99
+    public int deleteBlockedRateByIds(Long[] ids) {
100
+        return blockedRateMapper.deleteBlockedRateByIds(ids);
101
+    }
102
+
103
+    /**
104
+     * 删除速率信息
105
+     *
106
+     * @param id 速率主键
107
+     * @return 结果
108
+     */
109
+    @Override
110
+    public int deleteBlockedRateById(Long id) {
111
+        return blockedRateMapper.deleteBlockedRateById(id);
112
+    }
113
+
114
+    /**
115
+     * 导入速率数据
116
+     *
117
+     * @param list            数据列表
118
+     * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
119
+     * @return 结果
120
+     */
121
+    @Transactional(rollbackFor = Exception.class)
122
+    @Override
123
+    public String importData(List<BlockedRate> list, boolean isUpdateSupport) {
124
+        if (CollUtil.isEmpty(list)) {
125
+            throw new ServiceException("导入速率数据不能为空!");
126
+        }
127
+
128
+        List<SysDept> deptListAll = sysDeptService.selectDeptInfoAll(new SysDept());
129
+        Map<String, Long> deptMap = deptListAll.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldValue, newValue) -> newValue));
130
+
131
+        int successNum = 0;
132
+        int failureNum = 0;
133
+        StringBuilder successMsg = new StringBuilder();
134
+        StringBuilder failureMsg = new StringBuilder();
135
+
136
+        for (BlockedRate data : list) {
137
+            // 根据名称填充ID字段
138
+            fillIdsByName(data, deptMap);
139
+            try {
140
+                if (ObjUtil.isNull(data.getStatDate())) {
141
+                    failureNum++;
142
+                    failureMsg.append("<br/>" + failureNum + "、日期不能为空");
143
+                    continue;
144
+                }
145
+                if (ObjUtil.isNull(data.getDutyBrigadeId()) || ObjUtil.isNull(data.getDutyBrigadeName())) {
146
+                    failureNum++;
147
+                    failureMsg.append("<br/>" + failureNum + "、当班大队不能为空");
148
+                    continue;
149
+                }
150
+                if (ObjUtil.isNull(data.getShift())) {
151
+                    failureNum++;
152
+                    failureMsg.append("<br/>" + failureNum + "、班次不能为空");
153
+                    continue;
154
+                }
155
+
156
+                // 查询是否已存在(根据【日期+当班大队+班次】唯一)
157
+                BlockedRate queryParam = new BlockedRate();
158
+                queryParam.setStatDate(data.getStatDate());
159
+                queryParam.setDutyBrigadeId(data.getDutyBrigadeId());
160
+                queryParam.setShift(data.getShift());
161
+                List<BlockedRate> existingList = blockedRateMapper.selectBlockedRateList(queryParam);
162
+
163
+                if (CollUtil.isEmpty(existingList)) {
164
+                    // 新增
165
+                    data.setCreateTime(DateUtils.getNowDate());
166
+                    blockedRateMapper.insertBlockedRate(data);
167
+                    successNum++;
168
+                    successMsg.append("<br/>" + successNum + "、日期【" + data.getStatDate() + "】、当班大队【" + data.getDutyBrigadeName() + "】、班次【" + data.getShift() + "】导入成功");
169
+                } else if (isUpdateSupport) {
170
+                    // 更新
171
+                    BlockedRate old = existingList.get(0);
172
+                    data.setId(old.getId());
173
+                    data.setUpdateTime(DateUtils.getNowDate());
174
+                    blockedRateMapper.updateBlockedRate(data);
175
+                    successNum++;
176
+                    successMsg.append("<br/>" + successNum + "、日期【" + data.getStatDate() + "】、当班大队【" + data.getDutyBrigadeName() + "】、班次【" + data.getShift() + "】更新成功");
177
+                } else {
178
+                    failureNum++;
179
+                    failureMsg.append("<br/>" + failureNum + "、日期【" + data.getStatDate() + "】、当班大队【" + data.getDutyBrigadeName() + "】、班次【" + data.getShift() + "】已存在");
180
+                }
181
+            } catch (Exception e) {
182
+                failureNum++;
183
+                String msg = "<br/>" + failureNum + "、日期【" + data.getStatDate() + "】、当班大队【" + data.getDutyBrigadeName() + "】、班次【" + data.getShift() + "】导入失败:";
184
+                failureMsg.append(msg + e.getMessage());
185
+            }
186
+        }
187
+
188
+        if (failureNum > 0) {
189
+            failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
190
+            throw new ServiceException(failureMsg.toString());
191
+        } else {
192
+            successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
193
+        }
194
+        return successMsg.toString();
195
+    }
196
+
197
+    /**
198
+     * 根据名称填充ID字段
199
+     *
200
+     * @param data 速率数据
201
+     */
202
+    private void fillIdsByName(BlockedRate data, Map<String, Long> deptMap) {
203
+        // 当班大队
204
+        if (ObjUtil.isNotNull(data.getDutyBrigadeName())) {
205
+            data.setDutyBrigadeId(deptMap.get(data.getDutyBrigadeName()));
206
+        }
207
+
208
+        // 班次
209
+        ShiftEnum shiftEnum = ShiftEnum.getByDesc(data.getShiftDesc());
210
+        if (ObjUtil.isNotNull(shiftEnum)) {
211
+            data.setShift(shiftEnum.getCode());
212
+        }
213
+    }
214
+}

+ 167 - 0
airport-blocked/src/main/resources/mapper/blocked/BlockedRateMapper.xml

@@ -0,0 +1,167 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.sundot.airport.blocked.mapper.BlockedRateMapper">
6
+
7
+    <resultMap type="BlockedRate" id="BlockedRateResult">
8
+        <result property="tenantId" column="tenant_id"/>
9
+        <result property="revision" column="revision"/>
10
+        <result property="createBy" column="create_by"/>
11
+        <result property="createTime" column="create_time"/>
12
+        <result property="updateBy" column="update_by"/>
13
+        <result property="updateTime" column="update_time"/>
14
+        <result property="remark" column="remark"/>
15
+        <result property="id" column="id"/>
16
+        <result property="statDate" column="stat_date"/>
17
+        <result property="travelInspectionDomesticAvgRatePeak" column="travel_inspection_domestic_avg_rate_peak"/>
18
+        <result property="dutyBrigadeId" column="duty_brigade_id"/>
19
+        <result property="dutyBrigadeName" column="duty_brigade_name"/>
20
+        <result property="t1AAreaRatePeak" column="t1_a_area_rate_peak"/>
21
+        <result property="t1BAreaRatePeak" column="t1_b_area_rate_peak"/>
22
+        <result property="t2DomesticRatePeak" column="t2_domestic_rate_peak"/>
23
+        <result property="t2InternationalRatePeak" column="t2_international_rate_peak"/>
24
+        <result property="shift" column="shift"/>
25
+        <result property="t2TransferRatePeak" column="t2_transfer_rate_peak"/>
26
+        <result property="internationalTransferAvgRatePeak" column="international_transfer_avg_rate_peak"/>
27
+    </resultMap>
28
+
29
+    <sql id="selectItemSeizureRateVo">
30
+        select tenant_id,
31
+               revision,
32
+               create_by,
33
+               create_time,
34
+               update_by,
35
+               update_time,
36
+               remark,
37
+               id,
38
+               stat_date,
39
+               travel_inspection_domestic_avg_rate_peak,
40
+               duty_brigade_id,
41
+               duty_brigade_name,
42
+               t1_a_area_rate_peak,
43
+               t1_b_area_rate_peak,
44
+               t2_domestic_rate_peak,
45
+               t2_international_rate_peak,
46
+               shift,
47
+               t2_transfer_rate_peak,
48
+               international_transfer_avg_rate_peak
49
+        from blocked_rate
50
+    </sql>
51
+
52
+    <select id="selectBlockedRateList" parameterType="BlockedRate" resultMap="BlockedRateResult">
53
+        <include refid="selectItemSeizureRateVo"/>
54
+        <where>
55
+            <if test="tenantId != null  and tenantId != ''">and tenant_id = #{tenantId}</if>
56
+            <if test="revision != null ">and revision = #{revision}</if>
57
+            <if test="statDate != null ">and stat_date = #{statDate}</if>
58
+            <if test="travelInspectionDomesticAvgRatePeak != null ">and travel_inspection_domestic_avg_rate_peak =
59
+                #{travelInspectionDomesticAvgRatePeak}
60
+            </if>
61
+            <if test="dutyBrigadeId != null ">and duty_brigade_id = #{dutyBrigadeId}</if>
62
+            <if test="dutyBrigadeName != null  and dutyBrigadeName != ''">and duty_brigade_name like concat('%',
63
+                #{dutyBrigadeName}, '%')
64
+            </if>
65
+            <if test="t1AAreaRatePeak != null ">and t1_a_area_rate_peak = #{t1AAreaRatePeak}</if>
66
+            <if test="t1BAreaRatePeak != null ">and t1_b_area_rate_peak = #{t1BAreaRatePeak}</if>
67
+            <if test="t2DomesticRatePeak != null ">and t2_domestic_rate_peak = #{t2DomesticRatePeak}</if>
68
+            <if test="t2InternationalRatePeak != null ">and t2_international_rate_peak = #{t2InternationalRatePeak}</if>
69
+            <if test="shift != null  and shift != ''">and shift = #{shift}</if>
70
+            <if test="t2TransferRatePeak != null ">and t2_transfer_rate_peak = #{t2TransferRatePeak}</if>
71
+            <if test="internationalTransferAvgRatePeak != null ">and international_transfer_avg_rate_peak =
72
+                #{internationalTransferAvgRatePeak}
73
+            </if>
74
+        </where>
75
+    </select>
76
+
77
+    <select id="selectBlockedRateById" parameterType="Long" resultMap="BlockedRateResult">
78
+        <include refid="selectItemSeizureRateVo"/>
79
+        where id = #{id}
80
+    </select>
81
+
82
+    <insert id="insertBlockedRate" parameterType="BlockedRate" useGeneratedKeys="true" keyProperty="id">
83
+        insert into blocked_rate
84
+        <trim prefix="(" suffix=")" suffixOverrides=",">
85
+            <if test="tenantId != null">tenant_id,</if>
86
+            <if test="revision != null">revision,</if>
87
+            <if test="createBy != null">create_by,</if>
88
+            <if test="createTime != null">create_time,</if>
89
+            <if test="updateBy != null">update_by,</if>
90
+            <if test="updateTime != null">update_time,</if>
91
+            <if test="remark != null">remark,</if>
92
+            <if test="statDate != null">stat_date,</if>
93
+            <if test="travelInspectionDomesticAvgRatePeak != null">travel_inspection_domestic_avg_rate_peak,</if>
94
+            <if test="dutyBrigadeId != null">duty_brigade_id,</if>
95
+            <if test="dutyBrigadeName != null and dutyBrigadeName != ''">duty_brigade_name,</if>
96
+            <if test="t1AAreaRatePeak != null">t1_a_area_rate_peak,</if>
97
+            <if test="t1BAreaRatePeak != null">t1_b_area_rate_peak,</if>
98
+            <if test="t2DomesticRatePeak != null">t2_domestic_rate_peak,</if>
99
+            <if test="t2InternationalRatePeak != null">t2_international_rate_peak,</if>
100
+            <if test="shift != null and shift != ''">shift,</if>
101
+            <if test="t2TransferRatePeak != null">t2_transfer_rate_peak,</if>
102
+            <if test="internationalTransferAvgRatePeak != null">international_transfer_avg_rate_peak,</if>
103
+        </trim>
104
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
105
+            <if test="tenantId != null">#{tenantId},</if>
106
+            <if test="revision != null">#{revision},</if>
107
+            <if test="createBy != null">#{createBy},</if>
108
+            <if test="createTime != null">#{createTime},</if>
109
+            <if test="updateBy != null">#{updateBy},</if>
110
+            <if test="updateTime != null">#{updateTime},</if>
111
+            <if test="remark != null">#{remark},</if>
112
+            <if test="statDate != null">#{statDate},</if>
113
+            <if test="travelInspectionDomesticAvgRatePeak != null">#{travelInspectionDomesticAvgRatePeak},</if>
114
+            <if test="dutyBrigadeId != null">#{dutyBrigadeId},</if>
115
+            <if test="dutyBrigadeName != null and dutyBrigadeName != ''">#{dutyBrigadeName},</if>
116
+            <if test="t1AAreaRatePeak != null">#{t1AAreaRatePeak},</if>
117
+            <if test="t1BAreaRatePeak != null">#{t1BAreaRatePeak},</if>
118
+            <if test="t2DomesticRatePeak != null">#{t2DomesticRatePeak},</if>
119
+            <if test="t2InternationalRatePeak != null">#{t2InternationalRatePeak},</if>
120
+            <if test="shift != null and shift != ''">#{shift},</if>
121
+            <if test="t2TransferRatePeak != null">#{t2TransferRatePeak},</if>
122
+            <if test="internationalTransferAvgRatePeak != null">#{internationalTransferAvgRatePeak},</if>
123
+        </trim>
124
+    </insert>
125
+
126
+    <update id="updateBlockedRate" parameterType="BlockedRate">
127
+        update blocked_rate
128
+        <trim prefix="SET" suffixOverrides=",">
129
+            <if test="tenantId != null">tenant_id = #{tenantId},</if>
130
+            <if test="revision != null">revision = #{revision},</if>
131
+            <if test="createBy != null">create_by = #{createBy},</if>
132
+            <if test="createTime != null">create_time = #{createTime},</if>
133
+            <if test="updateBy != null">update_by = #{updateBy},</if>
134
+            <if test="updateTime != null">update_time = #{updateTime},</if>
135
+            <if test="remark != null">remark = #{remark},</if>
136
+            <if test="statDate != null">stat_date = #{statDate},</if>
137
+            <if test="travelInspectionDomesticAvgRatePeak != null">travel_inspection_domestic_avg_rate_peak =
138
+                #{travelInspectionDomesticAvgRatePeak},
139
+            </if>
140
+            <if test="dutyBrigadeId != null">duty_brigade_id = #{dutyBrigadeId},</if>
141
+            <if test="dutyBrigadeName != null and dutyBrigadeName != ''">duty_brigade_name = #{dutyBrigadeName},</if>
142
+            <if test="t1AAreaRatePeak != null">t1_a_area_rate_peak = #{t1AAreaRatePeak},</if>
143
+            <if test="t1BAreaRatePeak != null">t1_b_area_rate_peak = #{t1BAreaRatePeak},</if>
144
+            <if test="t2DomesticRatePeak != null">t2_domestic_rate_peak = #{t2DomesticRatePeak},</if>
145
+            <if test="t2InternationalRatePeak != null">t2_international_rate_peak = #{t2InternationalRatePeak},</if>
146
+            <if test="shift != null and shift != ''">shift = #{shift},</if>
147
+            <if test="t2TransferRatePeak != null">t2_transfer_rate_peak = #{t2TransferRatePeak},</if>
148
+            <if test="internationalTransferAvgRatePeak != null">international_transfer_avg_rate_peak =
149
+                #{internationalTransferAvgRatePeak},
150
+            </if>
151
+        </trim>
152
+        where id = #{id}
153
+    </update>
154
+
155
+    <delete id="deleteBlockedRateById" parameterType="Long">
156
+        delete
157
+        from blocked_rate
158
+        where id = #{id}
159
+    </delete>
160
+
161
+    <delete id="deleteBlockedRateByIds" parameterType="String">
162
+        delete from blocked_rate where id in
163
+        <foreach item="id" collection="array" open="(" separator="," close=")">
164
+            #{id}
165
+        </foreach>
166
+    </delete>
167
+</mapper>

+ 37 - 0
airport-common/src/main/java/com/sundot/airport/common/enums/ShiftEnum.java

@@ -0,0 +1,37 @@
1
+package com.sundot.airport.common.enums;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Getter;
5
+
6
+/**
7
+ * 班次枚举
8
+ */
9
+@Getter
10
+@AllArgsConstructor
11
+public enum ShiftEnum {
12
+
13
+    DAY("DAY", "白班"),
14
+    NIGHT("NIGHT", "夜班");
15
+
16
+    private final String code;
17
+    private final String desc;
18
+
19
+    public static ShiftEnum getByCode(String code) {
20
+        for (ShiftEnum itemEnum : values()) {
21
+            if (itemEnum.getCode().equals(code)) {
22
+                return itemEnum;
23
+            }
24
+        }
25
+        return null;
26
+    }
27
+
28
+    public static ShiftEnum getByDesc(String desc) {
29
+        for (ShiftEnum itemEnum : values()) {
30
+            if (itemEnum.getDesc().equals(desc)) {
31
+                return itemEnum;
32
+            }
33
+        }
34
+        return null;
35
+    }
36
+
37
+}