Kaynağa Gözat

开机人员年限分布表

chenshudong 2 gün önce
ebeveyn
işleme
b2ff0a4cd9

+ 132 - 0
airport-admin/src/main/java/com/sundot/airport/web/controller/blocked/BlockedBootPersonnelTenureController.java

@@ -0,0 +1,132 @@
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.DeleteMapping;
11
+import org.springframework.web.bind.annotation.PathVariable;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+import com.sundot.airport.common.annotation.Log;
16
+import com.sundot.airport.common.core.controller.BaseController;
17
+import com.sundot.airport.common.core.domain.AjaxResult;
18
+import com.sundot.airport.common.enums.BusinessType;
19
+import com.sundot.airport.blocked.domain.BlockedBootPersonnelTenure;
20
+import com.sundot.airport.blocked.service.IBlockedBootPersonnelTenureService;
21
+import com.sundot.airport.common.utils.poi.ExcelUtil;
22
+import com.sundot.airport.common.core.page.TableDataInfo;
23
+import org.springframework.web.multipart.MultipartFile;
24
+
25
+/**
26
+ * 开机人员年限分布Controller
27
+ *
28
+ * @author ruoyi
29
+ * @date 2026-04-16
30
+ */
31
+@RestController
32
+@RequestMapping("/blocked/tenure")
33
+public class BlockedBootPersonnelTenureController extends BaseController {
34
+    @Autowired
35
+    private IBlockedBootPersonnelTenureService blockedBootPersonnelTenureService;
36
+
37
+    /**
38
+     * 查询开机人员年限分布列表
39
+     */
40
+    @PreAuthorize("@ss.hasPermi('blocked:tenure:list')")
41
+    @GetMapping("/list")
42
+    public TableDataInfo list(BlockedBootPersonnelTenure blockedBootPersonnelTenure) {
43
+        startPage();
44
+        List<BlockedBootPersonnelTenure> list = blockedBootPersonnelTenureService.selectBlockedBootPersonnelTenureList(blockedBootPersonnelTenure);
45
+        return getDataTable(list);
46
+    }
47
+
48
+    /**
49
+     * 导出开机人员年限分布列表
50
+     */
51
+    @PreAuthorize("@ss.hasPermi('blocked:tenure:export')")
52
+    @Log(title = "导出开机人员年限分布列表", businessType = BusinessType.EXPORT)
53
+    @PostMapping("/export")
54
+    public void export(HttpServletResponse response, BlockedBootPersonnelTenure blockedBootPersonnelTenure) {
55
+        List<BlockedBootPersonnelTenure> list = blockedBootPersonnelTenureService.selectBlockedBootPersonnelTenureList(blockedBootPersonnelTenure);
56
+        ExcelUtil<BlockedBootPersonnelTenure> util = new ExcelUtil<BlockedBootPersonnelTenure>(BlockedBootPersonnelTenure.class);
57
+        util.exportExcel(response, list, "开机人员年限分布数据");
58
+    }
59
+
60
+    /**
61
+     * 导入开机人员年限分布列表
62
+     */
63
+    @PreAuthorize("@ss.hasPermi('blocked:rate:import')")
64
+    @Log(title = "导入开机人员年限分布列表", businessType = BusinessType.IMPORT)
65
+    @PostMapping("/importData")
66
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
67
+        ExcelUtil<BlockedBootPersonnelTenure> util = new ExcelUtil<>(BlockedBootPersonnelTenure.class);
68
+        List<BlockedBootPersonnelTenure> list = util.importExcel(file.getInputStream());
69
+        String message = blockedBootPersonnelTenureService.importData(list, updateSupport);
70
+        return success(message);
71
+    }
72
+
73
+    /**
74
+     * 获取导入模板
75
+     */
76
+    @PostMapping("/importTemplate")
77
+    public void importTemplate(HttpServletResponse response) {
78
+        ExcelUtil<BlockedBootPersonnelTenure> util = new ExcelUtil<>(BlockedBootPersonnelTenure.class);
79
+        util.importTemplateExcel(response, "开机人员年限分布数据导入模板");
80
+    }
81
+
82
+    /**
83
+     * 获取开机人员年限分布详细信息
84
+     */
85
+    @PreAuthorize("@ss.hasPermi('blocked:tenure:query')")
86
+    @GetMapping(value = "/{id}")
87
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
88
+        return success(blockedBootPersonnelTenureService.selectBlockedBootPersonnelTenureById(id));
89
+    }
90
+
91
+    /**
92
+     * 新增开机人员年限分布
93
+     */
94
+    @PreAuthorize("@ss.hasPermi('blocked:tenure:add')")
95
+    @Log(title = "开机人员年限分布", businessType = BusinessType.INSERT)
96
+    @PostMapping("/add")
97
+    public AjaxResult add(@RequestBody BlockedBootPersonnelTenure blockedBootPersonnelTenure) {
98
+        blockedBootPersonnelTenure.setCreateBy(getUsername());
99
+        return toAjax(blockedBootPersonnelTenureService.insertBlockedBootPersonnelTenure(blockedBootPersonnelTenure));
100
+    }
101
+
102
+    /**
103
+     * 修改开机人员年限分布
104
+     */
105
+    @PreAuthorize("@ss.hasPermi('blocked:tenure:edit')")
106
+    @Log(title = "开机人员年限分布", businessType = BusinessType.UPDATE)
107
+    @PostMapping("/edit")
108
+    public AjaxResult edit(@RequestBody BlockedBootPersonnelTenure blockedBootPersonnelTenure) {
109
+        blockedBootPersonnelTenure.setUpdateBy(getUsername());
110
+        return toAjax(blockedBootPersonnelTenureService.updateBlockedBootPersonnelTenure(blockedBootPersonnelTenure));
111
+    }
112
+
113
+    /**
114
+     * 删除开机人员年限分布
115
+     */
116
+    @PreAuthorize("@ss.hasPermi('blocked:tenure:remove')")
117
+    @Log(title = "开机人员年限分布", businessType = BusinessType.DELETE)
118
+    @DeleteMapping("/{ids}")
119
+    public AjaxResult remove(@PathVariable Long[] ids) {
120
+        return toAjax(blockedBootPersonnelTenureService.deleteBlockedBootPersonnelTenureByIds(ids));
121
+    }
122
+
123
+    /**
124
+     * 查询开机人员年限分布列表全量
125
+     */
126
+    @PreAuthorize("@ss.hasPermi('blocked:tenure:list')")
127
+    @GetMapping("/listAll")
128
+    public AjaxResult listAll(BlockedBootPersonnelTenure blockedBootPersonnelTenure) {
129
+        List<BlockedBootPersonnelTenure> list = blockedBootPersonnelTenureService.selectBlockedBootPersonnelTenureList(blockedBootPersonnelTenure);
130
+        return success(list);
131
+    }
132
+}

+ 171 - 0
airport-blocked/src/main/java/com/sundot/airport/blocked/domain/BlockedBootPersonnelTenure.java

@@ -0,0 +1,171 @@
1
+package com.sundot.airport.blocked.domain;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import org.apache.commons.lang3.builder.ToStringBuilder;
7
+import org.apache.commons.lang3.builder.ToStringStyle;
8
+import com.sundot.airport.common.annotation.Excel;
9
+import com.sundot.airport.common.core.domain.BaseEntity;
10
+
11
+/**
12
+ * 开机人员年限分布对象 blocked_boot_personnel_tenure
13
+ *
14
+ * @author ruoyi
15
+ * @date 2026-04-16
16
+ */
17
+@TableName("blocked_boot_personnel_tenure")
18
+public class BlockedBootPersonnelTenure extends BaseEntity {
19
+    private static final long serialVersionUID = 1L;
20
+
21
+    /** 租户号 */
22
+    private String tenantId;
23
+
24
+    /** 乐观锁 */
25
+    private Long revision;
26
+
27
+    /** 主键 */
28
+    @TableId(type = IdType.AUTO)
29
+    private Long id;
30
+
31
+    /** 业务大队id */
32
+    private Long brigadeId;
33
+
34
+    /** 业务大队名称 */
35
+    @Excel(name = "业务大队")
36
+    private String brigadeName;
37
+
38
+    /** 5年及5年以上人员数 */
39
+    @Excel(name = "5年及5年以上人员数")
40
+    private Integer cntGe5Year;
41
+
42
+    /** 4年人员数 */
43
+    @Excel(name = "4年人员数")
44
+    private Integer cnt4Years;
45
+
46
+    /** 3年人员数 */
47
+    @Excel(name = "3年人员数")
48
+    private Integer cnt3Years;
49
+
50
+    /** 2年人员数 */
51
+    @Excel(name = "2年人员数")
52
+    private Integer cnt2Years;
53
+
54
+    /** 1年人员数 */
55
+    @Excel(name = "1年人员数")
56
+    private Integer cnt1Years;
57
+
58
+    /** 不足1年人员数 */
59
+    @Excel(name = "不足1年人员数")
60
+    private Integer cntLt1Year;
61
+
62
+    public void setTenantId(String tenantId) {
63
+        this.tenantId = tenantId;
64
+    }
65
+
66
+    public String getTenantId() {
67
+        return tenantId;
68
+    }
69
+
70
+    public void setRevision(Long revision) {
71
+        this.revision = revision;
72
+    }
73
+
74
+    public Long getRevision() {
75
+        return revision;
76
+    }
77
+
78
+    public void setId(Long id) {
79
+        this.id = id;
80
+    }
81
+
82
+    public Long getId() {
83
+        return id;
84
+    }
85
+
86
+    public void setBrigadeId(Long brigadeId) {
87
+        this.brigadeId = brigadeId;
88
+    }
89
+
90
+    public Long getBrigadeId() {
91
+        return brigadeId;
92
+    }
93
+
94
+    public void setBrigadeName(String brigadeName) {
95
+        this.brigadeName = brigadeName;
96
+    }
97
+
98
+    public String getBrigadeName() {
99
+        return brigadeName;
100
+    }
101
+
102
+    public void setCntGe5Year(Integer cntGe5Year) {
103
+        this.cntGe5Year = cntGe5Year;
104
+    }
105
+
106
+    public Integer getCntGe5Year() {
107
+        return cntGe5Year;
108
+    }
109
+
110
+    public void setCnt4Years(Integer cnt4Years) {
111
+        this.cnt4Years = cnt4Years;
112
+    }
113
+
114
+    public Integer getCnt4Years() {
115
+        return cnt4Years;
116
+    }
117
+
118
+    public void setCnt3Years(Integer cnt3Years) {
119
+        this.cnt3Years = cnt3Years;
120
+    }
121
+
122
+    public Integer getCnt3Years() {
123
+        return cnt3Years;
124
+    }
125
+
126
+    public void setCnt2Years(Integer cnt2Years) {
127
+        this.cnt2Years = cnt2Years;
128
+    }
129
+
130
+    public Integer getCnt2Years() {
131
+        return cnt2Years;
132
+    }
133
+
134
+    public void setCnt1Years(Integer cnt1Years) {
135
+        this.cnt1Years = cnt1Years;
136
+    }
137
+
138
+    public Integer getCnt1Years() {
139
+        return cnt1Years;
140
+    }
141
+
142
+    public void setCntLt1Year(Integer cntLt1Year) {
143
+        this.cntLt1Year = cntLt1Year;
144
+    }
145
+
146
+    public Integer getCntLt1Year() {
147
+        return cntLt1Year;
148
+    }
149
+
150
+    @Override
151
+    public String toString() {
152
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
153
+                .append("tenantId", getTenantId())
154
+                .append("revision", getRevision())
155
+                .append("createBy", getCreateBy())
156
+                .append("createTime", getCreateTime())
157
+                .append("updateBy", getUpdateBy())
158
+                .append("updateTime", getUpdateTime())
159
+                .append("remark", getRemark())
160
+                .append("id", getId())
161
+                .append("brigadeId", getBrigadeId())
162
+                .append("brigadeName", getBrigadeName())
163
+                .append("cntGe5Year", getCntGe5Year())
164
+                .append("cnt4Years", getCnt4Years())
165
+                .append("cnt3Years", getCnt3Years())
166
+                .append("cnt2Years", getCnt2Years())
167
+                .append("cnt1Years", getCnt1Years())
168
+                .append("cntLt1Year", getCntLt1Year())
169
+                .toString();
170
+    }
171
+}

+ 62 - 0
airport-blocked/src/main/java/com/sundot/airport/blocked/mapper/BlockedBootPersonnelTenureMapper.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.BlockedBootPersonnelTenure;
7
+
8
+/**
9
+ * 开机人员年限分布Mapper接口
10
+ *
11
+ * @author ruoyi
12
+ * @date 2026-04-16
13
+ */
14
+public interface BlockedBootPersonnelTenureMapper extends BaseMapper<BlockedBootPersonnelTenure> {
15
+    /**
16
+     * 查询开机人员年限分布
17
+     *
18
+     * @param id 开机人员年限分布主键
19
+     * @return 开机人员年限分布
20
+     */
21
+    public BlockedBootPersonnelTenure selectBlockedBootPersonnelTenureById(Long id);
22
+
23
+    /**
24
+     * 查询开机人员年限分布列表
25
+     *
26
+     * @param blockedBootPersonnelTenure 开机人员年限分布
27
+     * @return 开机人员年限分布集合
28
+     */
29
+    public List<BlockedBootPersonnelTenure> selectBlockedBootPersonnelTenureList(BlockedBootPersonnelTenure blockedBootPersonnelTenure);
30
+
31
+    /**
32
+     * 新增开机人员年限分布
33
+     *
34
+     * @param blockedBootPersonnelTenure 开机人员年限分布
35
+     * @return 结果
36
+     */
37
+    public int insertBlockedBootPersonnelTenure(BlockedBootPersonnelTenure blockedBootPersonnelTenure);
38
+
39
+    /**
40
+     * 修改开机人员年限分布
41
+     *
42
+     * @param blockedBootPersonnelTenure 开机人员年限分布
43
+     * @return 结果
44
+     */
45
+    public int updateBlockedBootPersonnelTenure(BlockedBootPersonnelTenure blockedBootPersonnelTenure);
46
+
47
+    /**
48
+     * 删除开机人员年限分布
49
+     *
50
+     * @param id 开机人员年限分布主键
51
+     * @return 结果
52
+     */
53
+    public int deleteBlockedBootPersonnelTenureById(Long id);
54
+
55
+    /**
56
+     * 批量删除开机人员年限分布
57
+     *
58
+     * @param ids 需要删除的数据主键集合
59
+     * @return 结果
60
+     */
61
+    public int deleteBlockedBootPersonnelTenureByIds(Long[] ids);
62
+}

+ 71 - 0
airport-blocked/src/main/java/com/sundot/airport/blocked/service/IBlockedBootPersonnelTenureService.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.BlockedBootPersonnelTenure;
7
+
8
+/**
9
+ * 开机人员年限分布Service接口
10
+ *
11
+ * @author ruoyi
12
+ * @date 2026-04-16
13
+ */
14
+public interface IBlockedBootPersonnelTenureService extends IService<BlockedBootPersonnelTenure> {
15
+    /**
16
+     * 查询开机人员年限分布
17
+     *
18
+     * @param id 开机人员年限分布主键
19
+     * @return 开机人员年限分布
20
+     */
21
+    public BlockedBootPersonnelTenure selectBlockedBootPersonnelTenureById(Long id);
22
+
23
+    /**
24
+     * 查询开机人员年限分布列表
25
+     *
26
+     * @param blockedBootPersonnelTenure 开机人员年限分布
27
+     * @return 开机人员年限分布集合
28
+     */
29
+    public List<BlockedBootPersonnelTenure> selectBlockedBootPersonnelTenureList(BlockedBootPersonnelTenure blockedBootPersonnelTenure);
30
+
31
+    /**
32
+     * 新增开机人员年限分布
33
+     *
34
+     * @param blockedBootPersonnelTenure 开机人员年限分布
35
+     * @return 结果
36
+     */
37
+    public int insertBlockedBootPersonnelTenure(BlockedBootPersonnelTenure blockedBootPersonnelTenure);
38
+
39
+    /**
40
+     * 修改开机人员年限分布
41
+     *
42
+     * @param blockedBootPersonnelTenure 开机人员年限分布
43
+     * @return 结果
44
+     */
45
+    public int updateBlockedBootPersonnelTenure(BlockedBootPersonnelTenure blockedBootPersonnelTenure);
46
+
47
+    /**
48
+     * 批量删除开机人员年限分布
49
+     *
50
+     * @param ids 需要删除的开机人员年限分布主键集合
51
+     * @return 结果
52
+     */
53
+    public int deleteBlockedBootPersonnelTenureByIds(Long[] ids);
54
+
55
+    /**
56
+     * 删除开机人员年限分布信息
57
+     *
58
+     * @param id 开机人员年限分布主键
59
+     * @return 结果
60
+     */
61
+    public int deleteBlockedBootPersonnelTenureById(Long id);
62
+
63
+    /**
64
+     * 导入开机人员年限分布列表
65
+     *
66
+     * @param list          数据列表
67
+     * @param updateSupport 是否更新支持
68
+     * @return 导入结果信息
69
+     */
70
+    public String importData(List<BlockedBootPersonnelTenure> list, boolean updateSupport);
71
+}

+ 193 - 0
airport-blocked/src/main/java/com/sundot/airport/blocked/service/impl/BlockedBootPersonnelTenureServiceImpl.java

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

+ 143 - 0
airport-blocked/src/main/resources/mapper/blocked/BlockedBootPersonnelTenureMapper.xml

@@ -0,0 +1,143 @@
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.BlockedBootPersonnelTenureMapper">
6
+
7
+    <resultMap type="BlockedBootPersonnelTenure" id="BlockedBootPersonnelTenureResult">
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="brigadeId" column="brigade_id"/>
17
+        <result property="brigadeName" column="brigade_name"/>
18
+        <result property="cntGe5Year" column="cnt_ge_5_year"/>
19
+        <result property="cnt4Years" column="cnt_4_years"/>
20
+        <result property="cnt3Years" column="cnt_3_years"/>
21
+        <result property="cnt2Years" column="cnt_2_years"/>
22
+        <result property="cnt1Years" column="cnt_1_years"/>
23
+        <result property="cntLt1Year" column="cnt_lt_1_year"/>
24
+    </resultMap>
25
+
26
+    <sql id="selectBlockedBootPersonnelTenureVo">
27
+        select tenant_id,
28
+               revision,
29
+               create_by,
30
+               create_time,
31
+               update_by,
32
+               update_time,
33
+               remark,
34
+               id,
35
+               brigade_id,
36
+               brigade_name,
37
+               cnt_ge_5_year,
38
+               cnt_4_years,
39
+               cnt_3_years,
40
+               cnt_2_years,
41
+               cnt_1_years,
42
+               cnt_lt_1_year
43
+        from blocked_boot_personnel_tenure
44
+    </sql>
45
+
46
+    <select id="selectBlockedBootPersonnelTenureList" parameterType="BlockedBootPersonnelTenure"
47
+            resultMap="BlockedBootPersonnelTenureResult">
48
+        <include refid="selectBlockedBootPersonnelTenureVo"/>
49
+        <where>
50
+            <if test="tenantId != null  and tenantId != ''">and tenant_id = #{tenantId}</if>
51
+            <if test="revision != null ">and revision = #{revision}</if>
52
+            <if test="brigadeId != null ">and brigade_id = #{brigadeId}</if>
53
+            <if test="brigadeName != null  and brigadeName != ''">and brigade_name like concat('%', #{brigadeName},
54
+                '%')
55
+            </if>
56
+            <if test="cntGe5Year != null ">and cnt_ge_5_year = #{cntGe5Year}</if>
57
+            <if test="cnt4Years != null ">and cnt_4_years = #{cnt4Years}</if>
58
+            <if test="cnt3Years != null ">and cnt_3_years = #{cnt3Years}</if>
59
+            <if test="cnt2Years != null ">and cnt_2_years = #{cnt2Years}</if>
60
+            <if test="cnt1Years != null ">and cnt_1_years = #{cnt1Years}</if>
61
+            <if test="cntLt1Year != null ">and cnt_lt_1_year = #{cntLt1Year}</if>
62
+        </where>
63
+    </select>
64
+
65
+    <select id="selectBlockedBootPersonnelTenureById" parameterType="Long" resultMap="BlockedBootPersonnelTenureResult">
66
+        <include refid="selectBlockedBootPersonnelTenureVo"/>
67
+        where id = #{id}
68
+    </select>
69
+
70
+    <insert id="insertBlockedBootPersonnelTenure" parameterType="BlockedBootPersonnelTenure" useGeneratedKeys="true"
71
+            keyProperty="id">
72
+        insert into blocked_boot_personnel_tenure
73
+        <trim prefix="(" suffix=")" suffixOverrides=",">
74
+            <if test="tenantId != null">tenant_id,</if>
75
+            <if test="revision != null">revision,</if>
76
+            <if test="createBy != null">create_by,</if>
77
+            <if test="createTime != null">create_time,</if>
78
+            <if test="updateBy != null">update_by,</if>
79
+            <if test="updateTime != null">update_time,</if>
80
+            <if test="remark != null">remark,</if>
81
+            <if test="brigadeId != null">brigade_id,</if>
82
+            <if test="brigadeName != null and brigadeName != ''">brigade_name,</if>
83
+            <if test="cntGe5Year != null">cnt_ge_5_year,</if>
84
+            <if test="cnt4Years != null">cnt_4_years,</if>
85
+            <if test="cnt3Years != null">cnt_3_years,</if>
86
+            <if test="cnt2Years != null">cnt_2_years,</if>
87
+            <if test="cnt1Years != null">cnt_1_years,</if>
88
+            <if test="cntLt1Year != null">cnt_lt_1_year,</if>
89
+        </trim>
90
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
91
+            <if test="tenantId != null">#{tenantId},</if>
92
+            <if test="revision != null">#{revision},</if>
93
+            <if test="createBy != null">#{createBy},</if>
94
+            <if test="createTime != null">#{createTime},</if>
95
+            <if test="updateBy != null">#{updateBy},</if>
96
+            <if test="updateTime != null">#{updateTime},</if>
97
+            <if test="remark != null">#{remark},</if>
98
+            <if test="brigadeId != null">#{brigadeId},</if>
99
+            <if test="brigadeName != null and brigadeName != ''">#{brigadeName},</if>
100
+            <if test="cntGe5Year != null">#{cntGe5Year},</if>
101
+            <if test="cnt4Years != null">#{cnt4Years},</if>
102
+            <if test="cnt3Years != null">#{cnt3Years},</if>
103
+            <if test="cnt2Years != null">#{cnt2Years},</if>
104
+            <if test="cnt1Years != null">#{cnt1Years},</if>
105
+            <if test="cntLt1Year != null">#{cntLt1Year},</if>
106
+        </trim>
107
+    </insert>
108
+
109
+    <update id="updateBlockedBootPersonnelTenure" parameterType="BlockedBootPersonnelTenure">
110
+        update blocked_boot_personnel_tenure
111
+        <trim prefix="SET" suffixOverrides=",">
112
+            <if test="tenantId != null">tenant_id = #{tenantId},</if>
113
+            <if test="revision != null">revision = #{revision},</if>
114
+            <if test="createBy != null">create_by = #{createBy},</if>
115
+            <if test="createTime != null">create_time = #{createTime},</if>
116
+            <if test="updateBy != null">update_by = #{updateBy},</if>
117
+            <if test="updateTime != null">update_time = #{updateTime},</if>
118
+            <if test="remark != null">remark = #{remark},</if>
119
+            <if test="brigadeId != null">brigade_id = #{brigadeId},</if>
120
+            <if test="brigadeName != null and brigadeName != ''">brigade_name = #{brigadeName},</if>
121
+            <if test="cntGe5Year != null">cnt_ge_5_year = #{cntGe5Year},</if>
122
+            <if test="cnt4Years != null">cnt_4_years = #{cnt4Years},</if>
123
+            <if test="cnt3Years != null">cnt_3_years = #{cnt3Years},</if>
124
+            <if test="cnt2Years != null">cnt_2_years = #{cnt2Years},</if>
125
+            <if test="cnt1Years != null">cnt_1_years = #{cnt1Years},</if>
126
+            <if test="cntLt1Year != null">cnt_lt_1_year = #{cntLt1Year},</if>
127
+        </trim>
128
+        where id = #{id}
129
+    </update>
130
+
131
+    <delete id="deleteBlockedBootPersonnelTenureById" parameterType="Long">
132
+        delete
133
+        from blocked_boot_personnel_tenure
134
+        where id = #{id}
135
+    </delete>
136
+
137
+    <delete id="deleteBlockedBootPersonnelTenureByIds" parameterType="String">
138
+        delete from blocked_boot_personnel_tenure where id in
139
+        <foreach item="id" collection="array" open="(" separator="," close=")">
140
+            #{id}
141
+        </foreach>
142
+    </delete>
143
+</mapper>