Browse Source

科研报工由采集改成导入

丁治程 1 year ago
parent
commit
20f59438e7

+ 201 - 0
module_kzks/src/main/java/org/jeecg/modules/kyBgInfoNew/controller/KyBgInfoNewController.java

@@ -0,0 +1,201 @@
+package org.jeecg.modules.kyBgInfoNew.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.kyBgInfo.vo.KyBgInfoDetailListVO;
+import org.jeecg.modules.kyBgInfoNew.entity.KyBgInfoNew;
+import org.jeecg.modules.kyBgInfoNew.service.IKyBgInfoNewService;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.aspect.annotation.AutoLog;
+
+ /**
+ * @Description: ky_bg_info_new
+ * @Author: jeecg-boot
+ * @Date:   2024-05-13
+ * @Version: V1.0
+ */
+@Api(tags="ky_bg_info_new")
+@RestController
+@RequestMapping("/kyBgInfoNew/kyBgInfoNew")
+@Slf4j
+public class KyBgInfoNewController extends JeecgController<KyBgInfoNew, IKyBgInfoNewService> {
+	@Autowired
+	private IKyBgInfoNewService kyBgInfoNewService;
+
+
+
+	 /**
+	  * 导出工时详情excel
+	  *
+	  */
+	 @ApiOperation(value="项目成本——导出工时详情excel")
+	 @RequestMapping(value = "/exportGSDetail")
+	 public ModelAndView exportGSDetail(String taskno) {
+		 List<KyBgInfoNew> list = getGSDeatilList(taskno);
+		 return kyBgInfoNewService.exportGSDetail(list,KyBgInfoNew.class, "工时详情");
+	 }
+
+
+
+	 /**项目成本——工时详情*/
+	 @ApiOperation(value="项目成本——工时详情", notes="项目成本——工时详情")
+	 @GetMapping(value = "/getGSDeatilList")
+	 public List<KyBgInfoNew> getGSDeatilList(String taskno) {
+		 return kyBgInfoNewService.getGSDeatilList(taskno);
+	 }
+
+	
+	/**
+	 * 分页列表查询
+	 *
+	 * @param kyBgInfoNew
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "ky_bg_info_new-分页列表查询")
+	@ApiOperation(value="ky_bg_info_new-分页列表查询", notes="ky_bg_info_new-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<KyBgInfoNew>> queryPageList(KyBgInfoNew kyBgInfoNew,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<KyBgInfoNew> queryWrapper = QueryGenerator.initQueryWrapper(kyBgInfoNew, req.getParameterMap());
+		Page<KyBgInfoNew> page = new Page<KyBgInfoNew>(pageNo, pageSize);
+		IPage<KyBgInfoNew> pageList = kyBgInfoNewService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 *   添加
+	 *
+	 * @param kyBgInfoNew
+	 * @return
+	 */
+	@AutoLog(value = "ky_bg_info_new-添加")
+	@ApiOperation(value="ky_bg_info_new-添加", notes="ky_bg_info_new-添加")
+	//@RequiresPermissions("org.jeecg.modules:ky_bg_info_new:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody KyBgInfoNew kyBgInfoNew) {
+		kyBgInfoNewService.save(kyBgInfoNew);
+		return Result.OK("添加成功!");
+	}
+	
+	/**
+	 *  编辑
+	 *
+	 * @param kyBgInfoNew
+	 * @return
+	 */
+	@AutoLog(value = "ky_bg_info_new-编辑")
+	@ApiOperation(value="ky_bg_info_new-编辑", notes="ky_bg_info_new-编辑")
+	//@RequiresPermissions("org.jeecg.modules:ky_bg_info_new:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody KyBgInfoNew kyBgInfoNew) {
+		kyBgInfoNewService.updateById(kyBgInfoNew);
+		return Result.OK("编辑成功!");
+	}
+	
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "ky_bg_info_new-通过id删除")
+	@ApiOperation(value="ky_bg_info_new-通过id删除", notes="ky_bg_info_new-通过id删除")
+	//@RequiresPermissions("org.jeecg.modules:ky_bg_info_new:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		kyBgInfoNewService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+	
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "ky_bg_info_new-批量删除")
+	@ApiOperation(value="ky_bg_info_new-批量删除", notes="ky_bg_info_new-批量删除")
+	//@RequiresPermissions("org.jeecg.modules:ky_bg_info_new:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.kyBgInfoNewService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+	
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "ky_bg_info_new-通过id查询")
+	@ApiOperation(value="ky_bg_info_new-通过id查询", notes="ky_bg_info_new-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<KyBgInfoNew> queryById(@RequestParam(name="id",required=true) String id) {
+		KyBgInfoNew kyBgInfoNew = kyBgInfoNewService.getById(id);
+		if(kyBgInfoNew==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(kyBgInfoNew);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param kyBgInfoNew
+    */
+    //@RequiresPermissions("org.jeecg.modules:ky_bg_info_new:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, KyBgInfoNew kyBgInfoNew) {
+        return super.exportXls(request, kyBgInfoNew, KyBgInfoNew.class, "ky_bg_info_new");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    //@RequiresPermissions("ky_bg_info_new:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, KyBgInfoNew.class);
+    }
+
+}

+ 126 - 0
module_kzks/src/main/java/org/jeecg/modules/kyBgInfoNew/entity/KyBgInfoNew.java

@@ -0,0 +1,126 @@
+package org.jeecg.modules.kyBgInfoNew.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.math.BigDecimal;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecg.common.aspect.annotation.Dict;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Description: ky_bg_info_new
+ * @Author: jeecg-boot
+ * @Date:   2024-05-13
+ * @Version: V1.0
+ */
+@Data
+@TableName("ky_bg_info_new")
+@Accessors(chain = false)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="ky_bg_info_new对象", description="ky_bg_info_new")
+public class KyBgInfoNew implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**key*/
+	@Excel(name = "key", width = 15)
+    @ExcelIgnore
+    @ApiModelProperty(value = "key")
+    private java.lang.Integer key;
+	/**序号*/
+	@Excel(name = "序号", width = 15)
+    @ApiModelProperty(value = "序号")
+    private java.lang.String xh;
+	/**所属部门*/
+	@Excel(name = "所属部门", width = 15)
+    @ApiModelProperty(value = "所属部门")
+    private java.lang.String userdept;
+	/**填写人*/
+	@Excel(name = "填写人", width = 15)
+    @ApiModelProperty(value = "填写人")
+    private java.lang.String username;
+	/**填写时间*/
+	@Excel(name = "填写时间", width = 15)
+    @ApiModelProperty(value = "填写时间")
+    private java.lang.String txtime;
+	/**工作日期*/
+	@Excel(name = "工作日期", width = 15)
+    @ApiModelProperty(value = "工作日期")
+    private java.lang.String worktime;
+	/**报工任务号*/
+	@Excel(name = "报工任务号", width = 15)
+    @ApiModelProperty(value = "报工任务号")
+    private java.lang.String taskno;
+	/**任务名称*/
+	@Excel(name = "任务名称", width = 15)
+    @ApiModelProperty(value = "任务名称")
+    private java.lang.String taskname;
+	/**工作内容*/
+	@Excel(name = "工作内容", width = 15)
+    @ApiModelProperty(value = "工作内容")
+    private java.lang.String workcontent;
+	/**当日用时(小时)*/
+	@Excel(name = "当日用时(小时)", width = 15)
+    @ApiModelProperty(value = "当日用时(小时)")
+    private java.math.BigDecimal workhour;
+	/**报销任务号*/
+	@Excel(name = "报销任务号", width = 15)
+    @ApiModelProperty(value = "报销任务号")
+    private java.lang.String bxtaskno;
+	/**报销任务工时*/
+	@Excel(name = "报销任务工时", width = 15)
+    @ApiModelProperty(value = "报销任务工时")
+    private java.lang.String bxrwhour;
+	/**备注*/
+	@Excel(name = "备注", width = 15)
+    @ApiModelProperty(value = "备注")
+    private java.lang.String memo;
+	/**审核人*/
+	@Excel(name = "审核人", width = 15)
+    @ApiModelProperty(value = "审核人")
+    private java.lang.String shusername;
+	/**审批人*/
+	@Excel(name = "审批人", width = 15)
+    @ApiModelProperty(value = "审批人")
+    private java.lang.String spr;
+	/**型号*/
+	@Excel(name = "型号", width = 15)
+    @ApiModelProperty(value = "型号")
+    private java.lang.String xhname;
+	/**研制阶段*/
+	@Excel(name = "研制阶段", width = 15)
+    @ApiModelProperty(value = "研制阶段")
+    private java.lang.String yzjdname;
+	/**研制数量*/
+	@Excel(name = "研制数量", width = 15)
+    @ApiModelProperty(value = "研制数量")
+    private java.lang.String yzsl;
+	/**用户名称*/
+	@Excel(name = "用户名称", width = 15)
+    @ApiModelProperty(value = "用户名称")
+    private java.lang.String yhname;
+	/**计划开始时间*/
+	@Excel(name = "计划开始时间", width = 15)
+    @ApiModelProperty(value = "计划开始时间")
+    private java.lang.String jhkssj;
+	/**计划完成时间*/
+	@Excel(name = "计划完成时间", width = 15)
+    @ApiModelProperty(value = "计划完成时间")
+    private java.lang.String jhwcsj;
+	/**状态*/
+	@Excel(name = "状态", width = 15)
+    @ApiModelProperty(value = "状态")
+    private java.lang.String status;
+}

+ 122 - 0
module_kzks/src/main/java/org/jeecg/modules/kyBgInfoNew/listener/KyBgInfoNewListener.java

@@ -0,0 +1,122 @@
+package org.jeecg.modules.kyBgInfoNew.listener;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.kyBgInfo.entity.KyBgInfo;
+import org.jeecg.modules.kyBgInfoNew.entity.KyBgInfoNew;
+import org.jeecg.modules.kyBgInfoNew.service.IKyBgInfoNewService;
+import org.jeecg.modules.kyTaskInfoNew.entity.KyTaskInfoNew;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author dzc
+ * @date 2024/5/13 15:03
+ * @package org.jeecg.modules.kyBgInfoNew.listener
+ * @project yecai_server
+ * @des
+ */
+@Slf4j
+public class KyBgInfoNewListener extends AnalysisEventListener<KyBgInfoNew> {
+
+    private static final List<KyBgInfoNew> kyBgList = new CopyOnWriteArrayList<>(); //用于存放科研报工数据的集合
+
+    private final IKyBgInfoNewService kyBgInfoNewService;
+
+    private static final int BIG_SIZE = 3000;  // 批量添加最大数量
+
+    public KyBgInfoNewListener(IKyBgInfoNewService kyBgInfoNewService) {
+        this.kyBgInfoNewService = kyBgInfoNewService;
+    }
+
+    @Override
+    public void invoke(KyBgInfoNew kyBgInfoNew, AnalysisContext analysisContext) {
+        kyBgList.add(kyBgInfoNew);
+        if (kyBgList.size() == BIG_SIZE){
+            batchSaveBgInfo(kyBgList);
+        }
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+        batchSaveBgInfo(kyBgList);
+    }
+
+    private void batchSaveBgInfo(List<KyBgInfoNew> kyBgList) {
+        ExecutorService threadPoolExecutors = Executors.newFixedThreadPool(8);
+        try {
+            log.info("{}条数据,开始存储数据库!", kyBgList.size());
+            int sonListSize = kyBgList.size() / 8;  // 计算将kyList分成8份之后每个子集合的大小
+
+            List<List<KyBgInfoNew>> sonList = new ArrayList<>(); // 用于存放 子集合 的list
+            for (int i = 0; i < 8; i++) {
+                int startIndex = i * sonListSize;
+                int endIndex = (i + 1) * sonListSize;
+                if (i == 7){  // 避免遗漏数据,最后一个集合取全部数据
+                    endIndex = kyBgList.size();
+                }
+                // 根据起始索引、终止索引进行截取
+                List<KyBgInfoNew> list = kyBgList.subList(startIndex, endIndex);
+                sonList.add(list);
+            }
+            // 八个线程同步保存数据
+            if (!sonList.isEmpty()){
+                if (!sonList.get(0).isEmpty()){
+                    threadPoolExecutors.submit(() -> {
+                        kyBgInfoNewService.saveBatch(sonList.get(0));
+                    });
+                }
+                if (!sonList.get(1).isEmpty()){
+                    threadPoolExecutors.submit(() -> {
+                        kyBgInfoNewService.saveBatch(sonList.get(1));
+                    });
+                }
+                if (!sonList.get(2).isEmpty()){
+                    threadPoolExecutors.submit(() -> {
+                        kyBgInfoNewService.saveBatch(sonList.get(2));
+                    });
+                }
+                if (!sonList.get(3).isEmpty()){
+                    threadPoolExecutors.submit(() -> {
+                        kyBgInfoNewService.saveBatch(sonList.get(3));
+                    });
+                }
+                if (!sonList.get(4).isEmpty()){
+                    threadPoolExecutors.submit(() -> {
+                        kyBgInfoNewService.saveBatch(sonList.get(4));
+                    });
+                }
+                if (!sonList.get(5).isEmpty()){
+                    threadPoolExecutors.submit(() -> {
+                        kyBgInfoNewService.saveBatch(sonList.get(5));
+                    });
+                }
+                if (!sonList.get(6).isEmpty()){
+                    threadPoolExecutors.submit(() -> {
+                        kyBgInfoNewService.saveBatch(sonList.get(6));
+                    });
+                }
+                if (!sonList.get(7).isEmpty()){
+                    threadPoolExecutors.submit(() -> {
+                        kyBgInfoNewService.saveBatch(sonList.get(7));
+                    });
+                }
+            }
+            threadPoolExecutors.shutdown();
+            boolean b = threadPoolExecutors.awaitTermination(5, TimeUnit.HOURS);
+            log.info("数据成功入库");
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        } finally {
+            threadPoolExecutors.shutdown();
+            kyBgList.clear();
+        }
+    }
+
+}

+ 26 - 0
module_kzks/src/main/java/org/jeecg/modules/kyBgInfoNew/mapper/KyBgInfoNewMapper.java

@@ -0,0 +1,26 @@
+package org.jeecg.modules.kyBgInfoNew.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import org.jeecg.modules.kyBgInfoNew.entity.KyBgInfoNew;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: ky_bg_info_new
+ * @Author: jeecg-boot
+ * @Date:   2024-05-13
+ * @Version: V1.0
+ */
+public interface KyBgInfoNewMapper extends BaseMapper<KyBgInfoNew> {
+
+    /** 清空表中数据 */
+    @Update("truncate table ky_bg_info_new")
+    void truncateTable();
+
+    /**项目成本——工时详情*/
+    @Select("select * from ky_bg_info_new where taskno = #{taskno}")
+    List<KyBgInfoNew> getGSDeatilList(String taskno);
+}

+ 5 - 0
module_kzks/src/main/java/org/jeecg/modules/kyBgInfoNew/mapper/xml/KyBgInfoNewMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.kyBgInfoNew.mapper.KyBgInfoNewMapper">
+
+</mapper>

+ 26 - 0
module_kzks/src/main/java/org/jeecg/modules/kyBgInfoNew/service/IKyBgInfoNewService.java

@@ -0,0 +1,26 @@
+package org.jeecg.modules.kyBgInfoNew.service;
+
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.kpiProjectMonth.entity.KpiProjectMonth;
+import org.jeecg.modules.kyBgInfo.entity.KyBgInfo;
+import org.jeecg.modules.kyBgInfo.vo.KyBgInfoDetailListVO;
+import org.jeecg.modules.kyBgInfoNew.entity.KyBgInfoNew;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.util.List;
+
+/**
+ * @Description: ky_bg_info_new
+ * @Author: jeecg-boot
+ * @Date:   2024-05-13
+ * @Version: V1.0
+ */
+public interface IKyBgInfoNewService extends IService<KyBgInfoNew> {
+
+    Result<?> importExcel1(String strUrl, Class<KyBgInfoNew> clazz);
+
+    List<KyBgInfoNew> getGSDeatilList(String taskno);
+
+    public ModelAndView exportGSDetail(List<KyBgInfoNew>  exportList, Class<KyBgInfoNew> clazz, String title);
+}

+ 85 - 0
module_kzks/src/main/java/org/jeecg/modules/kyBgInfoNew/service/impl/KyBgInfoNewServiceImpl.java

@@ -0,0 +1,85 @@
+package org.jeecg.modules.kyBgInfoNew.service.impl;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelReader;
+import com.alibaba.excel.read.metadata.ReadSheet;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.kyBgInfo.entity.KyBgInfo;
+import org.jeecg.modules.kyBgInfoNew.entity.KyBgInfoNew;
+import org.jeecg.modules.kyBgInfoNew.listener.KyBgInfoNewListener;
+import org.jeecg.modules.kyBgInfoNew.mapper.KyBgInfoNewMapper;
+import org.jeecg.modules.kyBgInfoNew.service.IKyBgInfoNewService;
+import org.jeecg.modules.kyTaskInfoNew.listener.KyTaskInfoNewListener;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * @Description: ky_bg_info_new
+ * @Author: jeecg-boot
+ * @Date:   2024-05-13
+ * @Version: V1.0
+ */
+@Service
+@Slf4j
+public class KyBgInfoNewServiceImpl extends ServiceImpl<KyBgInfoNewMapper, KyBgInfoNew> implements IKyBgInfoNewService {
+
+    @Autowired
+    @SuppressWarnings("all")
+    private KyBgInfoNewMapper mapper;
+
+    @Value("${jeecg.path.upload}")
+    private String upLoadPath;
+
+    @Override
+    public Result<?> importExcel1(String strUrl, Class<KyBgInfoNew> clazz) {
+        // 清空表中的数据
+        mapper.truncateTable();
+        long startTime = System.currentTimeMillis();
+        ExcelReader excelReader = EasyExcel.read(new File(strUrl), clazz, new KyBgInfoNewListener(this)).build();
+        ReadSheet readSheet = EasyExcel.readSheet(0).build();
+        excelReader.read(readSheet);
+        //这里千万别忘记关闭,读的时候会创建临时文件,到时磁盘会崩的
+        excelReader.finish();
+        long endTime = System.currentTimeMillis();
+        log.info("导入科研报工数据花费时间:{}毫秒 | {}分钟", (endTime - startTime), ((endTime - startTime) / 1000 / 60));
+
+        return Result.ok();
+    }
+
+    @Override
+    public List<KyBgInfoNew> getGSDeatilList(String taskno) {
+        return mapper.getGSDeatilList(taskno);
+    }
+
+    @Override
+    public ModelAndView exportGSDetail(List<KyBgInfoNew> exportList, Class<KyBgInfoNew> clazz, String title) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        // Step.3 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        //此处设置的filename无效 ,前端会重更新设置一下
+        mv.addObject(NormalExcelConstants.FILE_NAME, title);
+        mv.addObject(NormalExcelConstants.CLASS, clazz);
+        //update-begin--Author:liusq  Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
+//        ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + "admin111", title);
+
+        ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
+        exportParams.setImageBasePath(upLoadPath);
+        //update-end--Author:liusq  Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
+        mv.addObject(NormalExcelConstants.PARAMS,exportParams);
+        mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
+        return mv;
+    }
+}

+ 9 - 0
module_kzks/src/main/java/org/jeecg/modules/projectImportList/controller/ProjectImportListController.java

@@ -19,6 +19,9 @@ import org.jeecg.modules.kpiImportList.entity.KpiImportList;
 import org.jeecg.modules.kpiImportList.service.IKpiImportListService;
 import org.jeecg.modules.kpiProjectMonth.entity.KpiProjectMonth;
 import org.jeecg.modules.kpiProjectMonth.service.IKpiProjectMonthService;
+import org.jeecg.modules.kyBgInfo.entity.KyBgInfo;
+import org.jeecg.modules.kyBgInfoNew.entity.KyBgInfoNew;
+import org.jeecg.modules.kyBgInfoNew.service.IKyBgInfoNewService;
 import org.jeecg.modules.kyTaskInfoNew.entity.KyTaskInfoNew;
 import org.jeecg.modules.kyTaskInfoNew.service.IKyTaskInfoNewService;
 import org.jeecg.modules.kyTaskTemp.entity.KyTaskTemp;
@@ -96,6 +99,10 @@ public class ProjectImportListController extends JeecgController<ProjectImportLi
     @SuppressWarnings("all")
     private IKpiProjectMonthService kpiProjectMonthService;
 
+    @Autowired
+    @SuppressWarnings("all")
+    private IKyBgInfoNewService kyBgInfoNewService;
+
 
     /**
      * 通过excel导入其他表的数据
@@ -148,6 +155,8 @@ public class ProjectImportListController extends JeecgController<ProjectImportLi
             return kyTaskInfoNewService.importExcel1(url, KyTaskInfoNew.class);
         } else if (projectImportList.getFileType().equals("18")){//每月进度导入
             return kpiProjectMonthService.importExcel1(url, KpiProjectMonth.class);
+        } else if (projectImportList.getFileType().equals("19")){//科研报工数据导入
+            return kyBgInfoNewService.importExcel1(url, KyBgInfoNew.class);
         } else {
             result.setCode(500);
             result.setMessage("请选择正确的导入类型!");