From 10648a4aa398cc2e2bf7810cb8f60184535c456f Mon Sep 17 00:00:00 2001 From: "0.0" <1092404103.qq.com> Date: Fri, 27 Oct 2023 11:18:17 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=8F=B8=E6=9C=BA=E5=AF=BC=E5=87=BA=E5=AF=BC?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BasicdataDriverArteryController.java | 16 ++ .../excel/BasicdataDriverArteryImporter.java | 30 +++ .../BasicdataDriverArteryImproterExcel.java | 177 ++++++++++++++++++ .../IBasicdataDriverArteryService.java | 2 + .../BasicdataDriverArteryServiceImpl.java | 19 +- 5 files changed, 240 insertions(+), 4 deletions(-) create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataDriverArteryImporter.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataDriverArteryImproterExcel.java diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java index a9a3065d6..b4647e291 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java @@ -23,6 +23,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.basicdata.dto.BasicdataDriverArteryDTO; import com.logpm.basicdata.entity.BasicdataDriverArteryEntity; import com.logpm.basicdata.excel.BasicdataDriverArteryExcel; +import com.logpm.basicdata.excel.BasicdataDriverArteryImporter; +import com.logpm.basicdata.excel.BasicdataDriverArteryImproterExcel; import com.logpm.basicdata.service.IBasicdataDriverArteryService; import com.logpm.basicdata.service.IBasicdataVehicleService; import com.logpm.basicdata.vo.BasicdataDriverArteryVO; @@ -45,6 +47,7 @@ import org.springblade.system.entity.User; import org.springblade.system.feign.IUserClient; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; @@ -207,4 +210,17 @@ public class BasicdataDriverArteryController extends BladeController { ExcelUtil.export(response, "司机信息表数据" + DateUtil.time(), "司机信息表数据表", list, BasicdataDriverArteryExcel.class); } + /** + * 导入司机信息 + */ + @PostMapping("import-stockArticle") + @ApiOperationSupport(order = 12) + @ApiOperation(value = "导入司机信息", notes = "传入excel") + public R importDriverArteryEntry(MultipartFile file) { + log.info("传入>>>>>>>{}",file); + BasicdataDriverArteryImporter basicdataDriverArteryImporter = new BasicdataDriverArteryImporter(basicdataDriverArteryService); + ExcelUtil.save(file,basicdataDriverArteryImporter, BasicdataDriverArteryImproterExcel.class); + return R.success("操作成功"); + } + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataDriverArteryImporter.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataDriverArteryImporter.java new file mode 100644 index 000000000..84986e543 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataDriverArteryImporter.java @@ -0,0 +1,30 @@ +package com.logpm.basicdata.excel; + + + +import com.logpm.basicdata.service.IBasicdataDriverArteryService; +import lombok.RequiredArgsConstructor; +import org.springblade.core.excel.support.ExcelImporter; + +import java.util.List; + + +/** + * @program: LogisticsPlatform-Service + * @description: + * @author: lmy + * @create: 2023-08-09 10:26 + **/ +@RequiredArgsConstructor +public class BasicdataDriverArteryImporter implements ExcelImporter { + + private final IBasicdataDriverArteryService service; + + + + + @Override + public void save(List data) { + service.importDriverArtery(data); + } +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataDriverArteryImproterExcel.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataDriverArteryImproterExcel.java new file mode 100644 index 000000000..7d105de72 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataDriverArteryImproterExcel.java @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.basicdata.excel; + + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; + +import java.io.Serializable; + + +/** + * 司机信息表 Excel实体类 + * + * @author lmy + * @since 2023-05-15 + */ +@Data +@ColumnWidth(25) +@HeadRowHeight(20) +@ContentRowHeight(18) +public class BasicdataDriverArteryImproterExcel implements Serializable { + + private static final long serialVersionUID = 1L; + + + + /** + * 司机姓名 + */ + @ColumnWidth(40) + @ExcelProperty("司机姓名") + private String name; + /** + * 司机手机号码 + */ + @ColumnWidth(40) + @ExcelProperty("司机手机号码") + private String phone; + + /** + * 车辆信息 + */ + @ColumnWidth(40) + @ExcelProperty("车辆信息") + private String bindVehicles; + /** + * 司机类型;1-自有,2-加盟,3-外调,4-临调 + */ + @ColumnWidth(40) + @ExcelProperty("司机类型;1-自有,2-加盟,3-外调,4-临调") + private Integer type; + /** + * 职务类型;1-干线,2-配送 + */ + @ColumnWidth(40) + @ExcelProperty("职务类型;1-干线,2-配送") + private Integer jobType; + /** + * 准驾车型;1-A1,2-A2,3-A3,4-B1,5-B2,6-C1,7-C2 + */ + @ColumnWidth(40) + @ExcelProperty("准驾车型;1-A1,2-A2,3-A3,4-B1,5-B2,6-C1,7-C2") + private Integer drivingType; + + /** + * 合同开始时间 + */ + @ColumnWidth(40) + @ExcelProperty("合同开始时间") + private String contractStartTime; + /** + * 合同结束时间 + */ + @ColumnWidth(40) + @ExcelProperty("合同结束时间") + private String contractEndTime; + /** + * 身份证号 + */ + @ColumnWidth(40) + @ExcelProperty("身份证号") + private String idCard; + /** + * 性别 + */ + @ColumnWidth(40) + @ExcelProperty("性别") + private Integer gender; + /** + * 居住地址 + */ + @ColumnWidth(40) + @ExcelProperty("居住地址") + private String residentialAddress; + /** + * 银行类型;1-工商银行,2-建设银行,3-农业银行,4-邮政银行,5-中国银行,6-交通银行,7-其他 + */ + @ColumnWidth(40) + @ExcelProperty("银行类型;1-工商银行,2-建设银行,3-农业银行,4-邮政银行,5-中国银行,6-交通银行,7-其他") + private Integer bankType; + /** + * 银行卡号 + */ + @ColumnWidth(40) + @ExcelProperty("银行卡号") + private String bankCardNub; + /** + * 驾驶证号 + */ + @ColumnWidth(40) + @ExcelProperty("驾驶证号") + private String driverLicenseNub; + /** + * 驾驶证发证机关 + */ + @ColumnWidth(40) + @ExcelProperty("驾驶证发证机关") + private String driverLicenseOrgan; + /** + * 驾驶证起始日期 + */ + @ColumnWidth(40) + @ExcelProperty("驾驶证起始日期") + private String driverLicenseStartTime; + /** + * 驾驶证到期日期 + */ + @ColumnWidth(40) + @ExcelProperty("驾驶证到期日期") + private String driverLicenseEndTime; + /** + * 从业资格证编号 + */ + @ColumnWidth(40) + @ExcelProperty("从业资格证编号") + private String employeeQualificationNub; + /** + * 道路经营许可证号 + */ + @ColumnWidth(40) + @ExcelProperty("道路经营许可证号") + private String roadOperationLicenseNub; + + /** + * 运输协议 + */ + @ColumnWidth(40) + @ExcelProperty("运输协议") + private String transportationAgreement; + + /** + * 备注 + */ + @ColumnWidth(40) + @ExcelProperty("备注") + private String notes; + + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataDriverArteryService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataDriverArteryService.java index 9528b9cc1..f0b30131d 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataDriverArteryService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataDriverArteryService.java @@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.basicdata.dto.BasicdataDriverArteryDTO; import com.logpm.basicdata.entity.BasicdataDriverArteryEntity; import com.logpm.basicdata.excel.BasicdataDriverArteryExcel; +import com.logpm.basicdata.excel.BasicdataDriverArteryImproterExcel; import com.logpm.basicdata.vo.BasicdataDriverArteryVO; import org.springblade.core.mp.base.BaseService; @@ -68,4 +69,5 @@ public interface IBasicdataDriverArteryService extends BaseService getDriverList(); + void importDriverArtery(List data); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java index 826f78bc1..4f6686d6f 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java @@ -22,11 +22,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basic.entity.BasicDelineMiddleEntity; import com.logpm.basicdata.dto.BasicdataDriverArteryDTO; -import com.logpm.basicdata.entity.BasicdataDriverArteryEntity; -import com.logpm.basicdata.entity.BasicdataDrivermiddleEntity; -import com.logpm.basicdata.entity.BasicdataVehicleEntity; -import com.logpm.basicdata.entity.BasicdataWarehouseEntity; +import com.logpm.basicdata.entity.*; import com.logpm.basicdata.excel.BasicdataDriverArteryExcel; +import com.logpm.basicdata.excel.BasicdataDriverArteryImproterExcel; +import com.logpm.basicdata.excel.BasicdataGoodsAreaExcel; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.basicdata.mapper.BasicdataDriverArteryMapper; import com.logpm.basicdata.mapper.BasicdataDrivermiddleMapper; @@ -45,6 +44,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -131,4 +131,15 @@ public class BasicdataDriverArteryServiceImpl extends BaseServiceImpl data) { + ArrayList arrayList = new ArrayList<>(); + for (BasicdataDriverArteryImproterExcel datum : data) { + BasicdataDriverArteryEntity copy = Func.copy(datum, BasicdataDriverArteryEntity.class); + log.info("复制后>>>>>>>>>>>>{}",copy); + arrayList.add(copy); + } + this.saveBatch(arrayList); + } }