|
@@ -3,8 +3,10 @@ package com.hw.admin.model.service.impl;
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.hw.admin.model.domain.WorkPacker;
|
|
import com.hw.admin.model.domain.WorkPacker;
|
|
|
|
+import com.hw.admin.model.domain.WorkPackerExcel;
|
|
import com.hw.admin.model.mapper.WorkPackerMapper;
|
|
import com.hw.admin.model.mapper.WorkPackerMapper;
|
|
import com.hw.admin.model.service.WorkPackerService;
|
|
import com.hw.admin.model.service.WorkPackerService;
|
|
|
|
+import com.hw.admin.system.listener.WorkPackerListener;
|
|
import com.hw.admin.system.utils.Sequence;
|
|
import com.hw.admin.system.utils.Sequence;
|
|
import javafx.scene.input.InputMethodTextRun;
|
|
import javafx.scene.input.InputMethodTextRun;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -37,6 +39,15 @@ public class WorkPackerServiceImpl implements WorkPackerService {
|
|
return workPackerMapper.inserList(list);
|
|
return workPackerMapper.inserList(list);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void task(String time) {
|
|
|
|
+ // 有个很重要的点 DemoDataListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去
|
|
|
|
+ // 写法3:
|
|
|
|
+ String fileName = "D:\\project\\delivery_project\\远程制药\\后台\\ycpharmacy_excel_service\\excel\\包装机数据测试表.xlsx";
|
|
|
|
+ // 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
|
|
|
|
+ EasyExcel.read(fileName, WorkPackerExcel.class, new WorkPackerListener(workPackerMapper)).sheet().doRead();
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<WorkPacker> list(WorkPacker workPacker) {
|
|
public List<WorkPacker> list(WorkPacker workPacker) {
|
|
QueryWrapper<WorkPacker> queryWrapper = new QueryWrapper<WorkPacker>();
|
|
QueryWrapper<WorkPacker> queryWrapper = new QueryWrapper<WorkPacker>();
|