Browse Source

+ 设计文件解析

chen.cheng 5 tháng trước cách đây
mục cha
commit
bcbc089a9e
16 tập tin đã thay đổi với 254 bổ sung71 xóa
  1. 13 0
      bd-park/park-backend/park-application/src/main/java/com/huashe/park/application/web/controller/cons/ConsUnitInfoController.java
  2. 31 30
      bd-park/park-backend/park-application/src/main/resources/i18n/messages_en.properties
  3. 1 0
      bd-park/park-backend/park-application/src/main/resources/i18n/messages_zh.properties
  4. 34 18
      bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/mapper/ConsPileHoleInfoMapper.java
  5. 5 4
      bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/IConsPileHoleInfoService.java
  6. 3 0
      bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/IConsUnitInfoService.java
  7. 15 16
      bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/impl/ConsPileHoleInfoServiceImpl.java
  8. 22 0
      bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/impl/ConsUnitInfoServiceImpl.java
  9. 69 2
      bd-park/park-backend/park-core/src/main/resources/mapper/cons/ConsPileHoleInfoMapper.xml
  10. 0 1
      bd-park/park-backend/park-core/src/main/resources/mapper/cons/ConsUnitInfoMapper.xml
  11. 17 0
      bd-park/park-backend/park-domain/src/main/java/com/huashe/park/domain/dto/cons/ConsUnitHole.java
  12. 10 0
      bd-park/park-backend/park-domain/src/main/java/com/huashe/park/domain/entity/ConsPileHoleInfo.java
  13. 4 0
      bd-park/park-backend/park-infrastructure/pom.xml
  14. 15 0
      bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/excel/ExcelHandle.java
  15. 7 0
      bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/excel/IPageDataConsumer.java
  16. 8 0
      bd-park/park-backend/pom.xml

+ 13 - 0
bd-park/park-backend/park-application/src/main/java/com/huashe/park/application/web/controller/cons/ConsUnitInfoController.java

@@ -5,6 +5,7 @@ import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -16,7 +17,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.huashe.common.domain.AjaxResult;
+import com.huashe.common.exception.ServiceException;
+import com.huashe.park.common.i18n.MessageUtils;
 import com.huashe.park.core.service.IConsUnitInfoService;
+import com.huashe.park.domain.dto.cons.ConsUnitHole;
 import com.huashe.park.domain.dto.cons.ConsUnitMachine;
 import com.huashe.park.domain.entity.ConsUnitInfo;
 import com.ruoyi.common.annotation.Log;
@@ -58,6 +62,15 @@ public class ConsUnitInfoController extends BaseController {
         util.exportExcel(response, list, "施工单元数据");
     }
 
+    @Log(title = "施工单元", businessType = BusinessType.EXPORT)
+    @PostMapping("/import/cad")
+    public void importCad(ConsUnitHole consUnitInfo) {
+        if (StringUtils.isEmpty(consUnitInfo.getFileId())) {
+            throw new ServiceException(MessageUtils.message("common.not.null", "file id"));
+        }
+        consUnitInfoService.importConsUnitHole(consUnitInfo);
+    }
+
     /**
      * 获取施工单元详细信息
      */

+ 31 - 30
bd-park/park-backend/park-application/src/main/resources/i18n/messages_en.properties

@@ -1,36 +1,37 @@
 #错误消息
-not.null=* 必须填写
-user.jcaptcha.error=验证码错误
-user.jcaptcha.expire=验证码已失效
-user.not.exists=用户不存在/密码错误
-user.password.not.match=用户不存在/密码错误
-user.password.retry.limit.count=密码输入错误{0}次
-user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
-user.password.delete=对不起,您的账号已被删除
-user.blocked=用户已封禁,请联系管理员
-role.blocked=角色已封禁,请联系管理员
-login.blocked=很遗憾,访问IP已被列入系统黑名单
-user.logout.success=退出成功
-length.not.valid=长度必须在{min}到{max}个字符之间
-user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
-user.password.not.valid=* 5-50个字符
-user.email.not.valid=邮箱格式错误
-user.mobile.phone.number.not.valid=手机号格式错误
-user.login.success=登录成功
-user.register.success=注册成功
-user.notfound=请重新登录
-user.forcelogout=管理员强制退出,请重新登录
-user.unknown.error=未知错误,请重新登录
+not.null=* Required field
+common.not.null={0} cannot be empty
+user.jcaptcha.error=Invalid jCaptcha
+user.jcaptcha.expire=jCaptcha has expired
+user.not.exists=User does not exist/Incorrect password
+user.password.not.match=User does not exist/Incorrect password
+user.password.retry.limit.count=Password entered incorrectly {0} times
+user.password.retry.limit.exceed=Password entered incorrectly {0} times. Account locked for {1} minutes
+user.password.delete=Your account has been deleted
+user.blocked=User is blocked. Please contact the administrator
+role.blocked=Role is blocked. Please contact the administrator
+login.blocked=Access denied: Your IP has been blacklisted
+user.logout.success=Logout successful
+length.not.valid=Length must be between {min} and {max} characters
+user.username.not.valid=* 2-20 Chinese characters, letters, numbers, or underscores, and must start with a non-digit
+user.password.not.valid=* 5-50 characters
+user.email.not.valid=Invalid email format
+user.mobile.phone.number.not.valid=Invalid phone number format
+user.login.success=Login successful
+user.register.success=Registration successful
+user.notfound=Please log in again
+user.forcelogout=Forced logout by administrator. Please log in again
+user.unknown.error=Unknown error. Please log in again
 ##文件上传消息
-upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
-upload.filename.exceed.length=上传的文件名最长{0}个字符
+upload.exceed.maxSize=Uploaded file exceeds maximum size limit!<br/>Maximum allowed size: {0}MB!
+upload.filename.exceed.length=Filename exceeds maximum length of {0} characters
 ##权限
-no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
-no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
-no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
-no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
-no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
-no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
+no.permission=You do not have data permissions. Contact administrator to add permissions [{0}]
+no.create.permission=You do not have permission to create data. Contact administrator to add permissions [{0}]
+no.update.permission=You do not have permission to modify data. Contact administrator to add permissions [{0}]
+no.delete.permission=You do not have permission to delete data. Contact administrator to add permissions [{0}]
+no.export.permission=You do not have permission to export data. Contact administrator to add permissions [{0}]
+no.view.permission=You do not have permission to view data. Contact administrator to add permissions [{0}]
 ##cons
 cons.unit.modify.not.self=Failed to modify the construction unit {0}. The upper construction unit cannot be yourself.
 cons.unit.delete.no.child=There are lower-level construction units and deletion is not allowed.

+ 1 - 0
bd-park/park-backend/park-application/src/main/resources/i18n/messages_zh.properties

@@ -1,5 +1,6 @@
 #错误消息
 not.null=* 必须填写
+common.not.null={0}不能为空
 user.jcaptcha.error=验证码错误
 user.jcaptcha.expire=验证码已失效
 user.not.exists=用户不存在/密码错误

+ 34 - 18
bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/mapper/ConsPileHoleInfoMapper.java

@@ -1,62 +1,78 @@
 package com.huashe.park.core.mapper;
 
-import com.huashe.park.domain.entity.ConsPileHoleInfo;
-
 import java.util.List;
 
+import org.apache.ibatis.annotations.Param;
+
+import com.huashe.park.domain.entity.ConsPileHoleInfo;
+
 /**
  * 施工桩点信息Mapper接口
- * 
+ *
  * @author ruoyi
- * @date 2025-02-13
+ * @date 2025 -02-13
  */
-public interface ConsPileHoleInfoMapper 
-{
+public interface ConsPileHoleInfoMapper {
     /**
      * 查询施工桩点信息
-     * 
+     *
      * @param id 施工桩点信息主键
-     * @return 施工桩点信息
+     * @return 施工桩点信息 cons pile hole info
      */
     public ConsPileHoleInfo selectConsPileHoleInfoById(Long id);
 
     /**
      * 查询施工桩点信息列表
-     * 
+     *
      * @param consPileHoleInfo 施工桩点信息
-     * @return 施工桩点信息集合
+     * @return 施工桩点信息集合 list
      */
     public List<ConsPileHoleInfo> selectConsPileHoleInfoList(ConsPileHoleInfo consPileHoleInfo);
 
     /**
      * 新增施工桩点信息
-     * 
+     *
      * @param consPileHoleInfo 施工桩点信息
-     * @return 结果
+     * @return 结果 int
      */
     public int insertConsPileHoleInfo(ConsPileHoleInfo consPileHoleInfo);
 
     /**
+     * Batch insert cons pile hole info int.
+     *
+     * @param consPileHoleInfos the cons pile hole infos
+     * @return the int
+     */
+    public int batchInsertConsPileHoleInfo(@Param("list") List<ConsPileHoleInfo> consPileHoleInfos);
+
+    /**
      * 修改施工桩点信息
-     * 
+     *
      * @param consPileHoleInfo 施工桩点信息
-     * @return 结果
+     * @return 结果 int
      */
     public int updateConsPileHoleInfo(ConsPileHoleInfo consPileHoleInfo);
 
     /**
      * 删除施工桩点信息
-     * 
+     *
      * @param id 施工桩点信息主键
-     * @return 结果
+     * @return 结果 int
      */
     public int deleteConsPileHoleInfoById(Long id);
 
     /**
      * 批量删除施工桩点信息
-     * 
+     *
      * @param ids 需要删除的数据主键集合
-     * @return 结果
+     * @return 结果 int
      */
     public int deleteConsPileHoleInfoByIds(Long[] ids);
+
+    /**
+     * Delete cons pile hole info by cons unit id.
+     *
+     * @param consUnitId the cons unit id
+     */
+    void deleteConsPileHoleInfoByConsUnitId(Long consUnitId);
 }

+ 5 - 4
bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/IConsPileHoleInfoService.java

@@ -1,17 +1,16 @@
 package com.huashe.park.core.service;
 
-import com.huashe.park.domain.entity.ConsPileHoleInfo;
-
 import java.util.List;
 
+import com.huashe.park.domain.entity.ConsPileHoleInfo;
+
 /**
  * 施工桩点信息Service接口
  * 
  * @author ruoyi
  * @date 2025-02-13
  */
-public interface IConsPileHoleInfoService 
-{
+public interface IConsPileHoleInfoService {
     /**
      * 查询施工桩点信息
      * 
@@ -59,4 +58,6 @@ public interface IConsPileHoleInfoService
      * @return 结果
      */
     public int deleteConsPileHoleInfoById(Long id);
+
+    public void importConsPileHole(List<ConsPileHoleInfo> consPileHoleInfo);
 }

+ 3 - 0
bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/IConsUnitInfoService.java

@@ -2,6 +2,7 @@ package com.huashe.park.core.service;
 
 import java.util.List;
 
+import com.huashe.park.domain.dto.cons.ConsUnitHole;
 import com.huashe.park.domain.dto.cons.ConsUnitMachine;
 import com.huashe.park.domain.entity.ConsUnitInfo;
 
@@ -63,4 +64,6 @@ public interface IConsUnitInfoService {
      * @return 结果
      */
     int deleteConsUnitInfoById(Long id);
+
+    void importConsUnitHole(ConsUnitHole consUnitHole);
 }

+ 15 - 16
bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/impl/ConsPileHoleInfoServiceImpl.java

@@ -2,11 +2,12 @@ package com.huashe.park.core.service.impl;
 
 import java.util.List;
 
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
 import com.huashe.park.core.mapper.ConsPileHoleInfoMapper;
 import com.huashe.park.core.service.IConsPileHoleInfoService;
 import com.huashe.park.domain.entity.ConsPileHoleInfo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
 
 /**
  * 施工桩点信息Service业务层处理
@@ -15,8 +16,7 @@ import org.springframework.stereotype.Service;
  * @date 2025-02-13
  */
 @Service
-public class ConsPileHoleInfoServiceImpl implements IConsPileHoleInfoService
-{
+public class ConsPileHoleInfoServiceImpl implements IConsPileHoleInfoService {
     @Autowired
     private ConsPileHoleInfoMapper consPileHoleInfoMapper;
 
@@ -27,8 +27,7 @@ public class ConsPileHoleInfoServiceImpl implements IConsPileHoleInfoService
      * @return 施工桩点信息
      */
     @Override
-    public ConsPileHoleInfo selectConsPileHoleInfoById(Long id)
-    {
+    public ConsPileHoleInfo selectConsPileHoleInfoById(Long id) {
         return consPileHoleInfoMapper.selectConsPileHoleInfoById(id);
     }
 
@@ -39,8 +38,7 @@ public class ConsPileHoleInfoServiceImpl implements IConsPileHoleInfoService
      * @return 施工桩点信息
      */
     @Override
-    public List<ConsPileHoleInfo> selectConsPileHoleInfoList(ConsPileHoleInfo consPileHoleInfo)
-    {
+    public List<ConsPileHoleInfo> selectConsPileHoleInfoList(ConsPileHoleInfo consPileHoleInfo) {
         return consPileHoleInfoMapper.selectConsPileHoleInfoList(consPileHoleInfo);
     }
 
@@ -51,8 +49,7 @@ public class ConsPileHoleInfoServiceImpl implements IConsPileHoleInfoService
      * @return 结果
      */
     @Override
-    public int insertConsPileHoleInfo(ConsPileHoleInfo consPileHoleInfo)
-    {
+    public int insertConsPileHoleInfo(ConsPileHoleInfo consPileHoleInfo) {
         return consPileHoleInfoMapper.insertConsPileHoleInfo(consPileHoleInfo);
     }
 
@@ -63,8 +60,7 @@ public class ConsPileHoleInfoServiceImpl implements IConsPileHoleInfoService
      * @return 结果
      */
     @Override
-    public int updateConsPileHoleInfo(ConsPileHoleInfo consPileHoleInfo)
-    {
+    public int updateConsPileHoleInfo(ConsPileHoleInfo consPileHoleInfo) {
         return consPileHoleInfoMapper.updateConsPileHoleInfo(consPileHoleInfo);
     }
 
@@ -75,8 +71,7 @@ public class ConsPileHoleInfoServiceImpl implements IConsPileHoleInfoService
      * @return 结果
      */
     @Override
-    public int deleteConsPileHoleInfoByIds(Long[] ids)
-    {
+    public int deleteConsPileHoleInfoByIds(Long[] ids) {
         return consPileHoleInfoMapper.deleteConsPileHoleInfoByIds(ids);
     }
 
@@ -87,8 +82,12 @@ public class ConsPileHoleInfoServiceImpl implements IConsPileHoleInfoService
      * @return 结果
      */
     @Override
-    public int deleteConsPileHoleInfoById(Long id)
-    {
+    public int deleteConsPileHoleInfoById(Long id) {
         return consPileHoleInfoMapper.deleteConsPileHoleInfoById(id);
     }
+
+    @Override
+    public void importConsPileHole(List<ConsPileHoleInfo> consPileHoleInfo) {
+        consPileHoleInfoMapper.batchInsertConsPileHoleInfo(consPileHoleInfo);
+    }
 }

+ 22 - 0
bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/impl/ConsUnitInfoServiceImpl.java

@@ -12,11 +12,16 @@ import org.springframework.util.CollectionUtils;
 import com.huashe.common.exception.ServiceException;
 import com.huashe.park.common.i18n.MessageUtils;
 import com.huashe.park.core.mapper.ConsUnitInfoMapper;
+import com.huashe.park.core.service.IConsPileHoleInfoService;
 import com.huashe.park.core.service.IConsUnitInfoService;
 import com.huashe.park.core.service.IConsUnitMachineRelService;
+import com.huashe.park.domain.dto.cons.ConsUnitHole;
 import com.huashe.park.domain.dto.cons.ConsUnitMachine;
+import com.huashe.park.domain.entity.ConsPileHoleInfo;
 import com.huashe.park.domain.entity.ConsUnitInfo;
 import com.huashe.park.domain.entity.ConsUnitMachineRel;
+import com.huashe.park.infrastructure.excel.ExcelHandle;
+import com.ruoyi.common.config.RuoYiConfig;
 
 /**
  * 施工单元Service业务层处理
@@ -33,6 +38,12 @@ public class ConsUnitInfoServiceImpl implements IConsUnitInfoService {
     @Autowired
     private IConsUnitMachineRelService consUnitMachineRelService;
 
+    @Autowired
+    private IConsPileHoleInfoService pileHoleInfoService;
+
+    @Autowired
+    private ExcelHandle excelHandle;
+
     /**
      * 查询施工单元
      * 
@@ -156,6 +167,17 @@ public class ConsUnitInfoServiceImpl implements IConsUnitInfoService {
         return consUnitInfoMapper.deleteConsUnitInfoById(id);
     }
 
+    @Override
+    public void importConsUnitHole(ConsUnitHole consUnitHole) {
+        String filePath = consUnitHole.getFileId().replaceFirst(RuoYiConfig.getProfile(), RuoYiConfig.getUploadPath());
+        excelHandle.importExcel(filePath, ConsPileHoleInfo.class, (data) -> {
+            data.forEach((d) -> {
+                d.setConsUnitId(consUnitHole.getId());
+            });
+            pileHoleInfoService.importConsPileHole(data);
+        });
+    }
+
     private void updateConsUnitChildren(Long id, String newAncestors, String oldAncestors) {
         List<ConsUnitInfo> children = consUnitInfoMapper.selectChildrenById(id);
         if (CollectionUtils.isEmpty(children)) {

+ 69 - 2
bd-park/park-backend/park-core/src/main/resources/mapper/cons/ConsPileHoleInfoMapper.xml

@@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="endTime"    column="end_time"    />
         <result property="desDept"    column="des_dept"    />
         <result property="diameter"    column="diameter"    />
+        <result property="consUnitId" column="cons_unit_id"/>
         <result property="updateTime"    column="update_time"    />
         <result property="createTime"    column="create_time"    />
         <result property="createBy"    column="create_by"    />
@@ -23,7 +24,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectConsPileHoleInfoVo">
-        select id, hole_num, delta_x, delta_y, lng, lat, cons_status, start_time, end_time, des_dept, diameter, update_time, create_time, create_by, update_by from cons_pile_hole_info
+        select id,
+               hole_num,
+               delta_x,
+               delta_y,
+               lng,
+               lat,
+               cons_status,
+               start_time,
+               end_time,
+               des_dept,
+               diameter,
+               cons_unit_id,
+               update_time,
+               create_time,
+               create_by,
+               update_by
+        from cons_pile_hole_info
     </sql>
 
     <select id="selectConsPileHoleInfoList" parameterType="ConsPileHoleInfo" resultMap="ConsPileHoleInfoResult">
@@ -74,7 +91,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">#{updateBy},</if>
          </trim>
     </insert>
-
+    <insert id="batchInsertConsPileHoleInfo" parameterType="List" useGeneratedKeys="true" keyProperty="id">
+        insert into cons_pile_hole_info
+        (
+        hole_num,
+        delta_x,
+        delta_y,
+        lng,
+        lat,
+        cons_status,
+        start_time,
+        end_time,
+        des_dept,
+        diameter,
+        cons_unit_id,
+        update_time,
+        create_time,
+        create_by,
+        update_by
+        )
+        values
+        <foreach collection="list" item="item" open="(" close=")" separator=",">
+            #{hole_num},
+            #{delta_x},
+            #{delta_y},
+            #{lng},
+            #{lat},
+            #{cons_status},
+            #{start_time},
+            #{end_time},
+            #{des_dept},
+            #{diameter},
+            #{cons_unit_id},
+            now(),
+            now()
+        </foreach>
+        on duplicate key update
+        delta_x= values(delta_x),
+        delta_y= values(delta_y),
+        lng= values(lng),
+        lat= values(lat),
+        des_dept= values(des_dept),
+        diameter= values(diameter),
+        update_time = now()
+    </insert>
     <update id="updateConsPileHoleInfo" parameterType="ConsPileHoleInfo">
         update cons_pile_hole_info
         <trim prefix="SET" suffixOverrides=",">
@@ -106,4 +166,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <delete id="deleteConsPileHoleInfoByConsUnitId" parameterType="Long">
+        delete
+        from cons_pile_hole_info
+        where cons_unit_id = #{consUnitId}
+          and cons_status != '00'
+    </delete>
 </mapper>

+ 0 - 1
bd-park/park-backend/park-core/src/main/resources/mapper/cons/ConsUnitInfoMapper.xml

@@ -80,7 +80,6 @@
             <if test="updateBy != null">#{updateBy},</if>
         </trim>
     </insert>
-
     <update id="updateConsUnitInfo" parameterType="ConsUnitInfo">
         update cons_cons_unit_info
         <trim prefix="SET" suffixOverrides=",">

+ 17 - 0
bd-park/park-backend/park-domain/src/main/java/com/huashe/park/domain/dto/cons/ConsUnitHole.java

@@ -0,0 +1,17 @@
+package com.huashe.park.domain.dto.cons;
+
+import com.huashe.park.domain.entity.ConsUnitInfo;
+
+public class ConsUnitHole extends ConsUnitInfo {
+    private static final long serialVersionUID = 1L;
+
+    private String fileId;
+
+    public void setFileId(String fileId) {
+        this.fileId = fileId;
+    }
+
+    public String getFileId() {
+        return fileId;
+    }
+}

+ 10 - 0
bd-park/park-backend/park-domain/src/main/java/com/huashe/park/domain/entity/ConsPileHoleInfo.java

@@ -76,6 +76,8 @@ public class ConsPileHoleInfo extends BaseEntity {
     @Excel(name = "桩径")
     private Long diameter;
 
+    private Long consUnitId;
+
     public void setId(Long id) {
         this.id = id;
     }
@@ -180,6 +182,14 @@ public class ConsPileHoleInfo extends BaseEntity {
         this.deltaZ = deltaZ;
     }
 
+    public Long getConsUnitId() {
+        return consUnitId;
+    }
+
+    public void setConsUnitId(Long consUnitId) {
+        this.consUnitId = consUnitId;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())

+ 4 - 0
bd-park/park-backend/park-infrastructure/pom.xml

@@ -49,6 +49,10 @@
             <groupId>cn.hutool</groupId>
             <artifactId>hutool-core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>cn.idev.excel</groupId>
+            <artifactId>fastexcel</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 15 - 0
bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/excel/ExcelHandle.java

@@ -0,0 +1,15 @@
+package com.huashe.park.infrastructure.excel;
+
+import org.springframework.stereotype.Service;
+
+import cn.idev.excel.FastExcel;
+import cn.idev.excel.read.listener.PageReadListener;
+
+@Service
+public class ExcelHandle {
+    public <T> void importExcel(String filePath, Class<T> clz, IPageDataConsumer<T> pageDataHandle) {
+        // 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
+        // 具体需要返回多少行可以在`PageReadListener`的构造函数设置
+        FastExcel.read(filePath, clz, new PageReadListener<T>(pageDataHandle::accept)).sheet().doRead();
+    }
+}

+ 7 - 0
bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/excel/IPageDataConsumer.java

@@ -0,0 +1,7 @@
+package com.huashe.park.infrastructure.excel;
+
+import java.util.List;
+
+public interface IPageDataConsumer<T> {
+    void accept(List<T> data);
+}

+ 8 - 0
bd-park/park-backend/pom.xml

@@ -54,6 +54,7 @@
         <swagger.fox.version>3.0.0</swagger.fox.version>
         <prod-commons.version>1.0-SNAPSHOT</prod-commons.version>
         <transmittable-thread-local.version>2.14.4</transmittable-thread-local.version>
+        <fastexcel.version>1.1.0</fastexcel.version>
     </properties>
 
     <!-- 依赖声明 -->
@@ -351,6 +352,13 @@
                 <artifactId>ruoyi-common-quartz</artifactId>
                 <version>${ruoyi.cloud.version}</version>
             </dependency>
+            <!-- https://mvnrepository.com/artifact/cn.idev.excel/fastexcel -->
+            <dependency>
+                <groupId>cn.idev.excel</groupId>
+                <artifactId>fastexcel</artifactId>
+                <version>${fastexcel.version}</version>
+            </dependency>
+
         </dependencies>
     </dependencyManagement>
     <repositories>