Browse Source

统计库存数据

master
liupopo 3 years ago
parent
commit
5c016ff999
  1. 54
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageRest.java
  2. 30
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLog.java
  3. 18
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLogErr.java
  4. 8
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLogErrMapper.java
  5. 8
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLogErrService.java
  6. 8
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLogMapper.java
  7. 8
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLogService.java
  8. 20
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkMapper.java
  9. 16
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkService.java
  10. 17
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryRest.java
  11. 59
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryService.java

54
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageRest.java

@ -6,19 +6,19 @@
*** o8888888o *** *** o8888888o ***
* 88" . "88 * * 88" . "88 *
* (| -_- |) * * (| -_- |) *
* 0\ = /0 * * 0/ = /0 *
* ___/`---'\___ * * ___/`---'/___ *
* .' /| |// '. * * .' /| |// '. *
* / /||| : |||// \ * * / /||| : |||// / *
* / _||||| -:- |||||- \ * * / _||||| -:- |||||- / *
* | | /\ - /// | | * * | | // - /// | | *
* | \_| ''\---/'' |_/ | * * | /_| ''/---/'' |_/ | *
* \ .-\__ '-' ___/-. / * * / .-/__ '-' ___/-. / *
* ___'. .' /--.--\ `. .'___ * * ___'. .' /--.--/ `. .'___ *
* ."" '< `.___\_<|>_/___.' >' "". * * ."" '< `.___/_<|>_/___.' >' "". *
* | | : `- \`.;`\ _ /`;.`/ - ` : | | * * | | : `- /`.;`/ _ /`;.`/ - ` : | | *
* \ \ `_. \_ __\ /__ _/ .-` / / * * / / `_. /_ __/ /__ _/ .-` / / *
* =====`-.____`.___ \_____/___.-`___.-'===== * * =====`-.____`.___ /_____/___.-`___.-'===== *
* `=---=' * * `=---=' *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
*********__佛祖保佑__永无BUG__验收通过__钞票多多__********* *********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
@ -53,21 +53,21 @@ public class GdInstorageRest {
@GetMapping("/test") @GetMapping("/test")
public ResultBean test() { public ResultBean test() {
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/23汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/23汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/24汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/24汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/25汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/25汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/26汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/26汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/27汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/27汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/28汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/28汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/29汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/29汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/30汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/30汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/12-1汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221202/23/12-1汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221204/2汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221204/2汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221204/3汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221204/3汇融银行_入库明细表.xlsx");
// // gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221204/4汇融银行_入库明细表.xlsx"); // gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221204/4汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221206/4汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221206/4汇融银行_入库明细表.xlsx");
// gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221206/05汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221206/05汇融银行_入库明细表.xlsx");
gdInstorageService.doimp("D:/works/projects/javaee/lzh/niejinyi/yunyan/docs/sheji/wx20221207/06汇融银行_入库明细表.xlsx"); gdInstorageService.doimp("D:/works/projects/idea/lzh/niejinyi/yunyan/docs/sheji/wx20221207/06汇融银行_入库明细表.xlsx");
return ResultBean.fireSuccess(); return ResultBean.fireSuccess();
} }

30
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLog.java

@ -0,0 +1,30 @@
package com.yxt.supervise.portal.biz.gdinventory;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yxt.common.core.domain.EntityWithId;
import lombok.Data;
import java.util.Date;
@Data
@TableName("gd_inventory_log")
public class GdInventoryLog extends EntityWithId {
public GdInventoryLog() {
}
public GdInventoryLog(String fileFullPath) {
this.fileFullPath = fileFullPath;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime = new Date(); // 记录创建时间/
private String remarks; // 备注说明/
private String fileFullPath; // 文件完整路径/
// private String outfile; //输出文件名
private int allNum; // 总记录数/
private int validNum; // 有效记录数/
private long durations; // 程序运行时长/
private int errRowNum; // 出错的条数/
}

18
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLogErr.java

@ -0,0 +1,18 @@
package com.yxt.supervise.portal.biz.gdinventory;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yxt.common.core.domain.EntityWithId;
import lombok.Data;
import java.util.Date;
@Data
@TableName("gd_inventory_log_err")
public class GdInventoryLogErr extends EntityWithId {
private Date createTime = new Date(); // 记录创建时间',
private String remarks; // 备注说明',
private String fileFullPath; // 文件完整路径',
private String errInfo; // 异常信息',
private String rowContent; // 原记录内容',
private int rowNum; // 出错行数',
}

8
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLogErrMapper.java

@ -0,0 +1,8 @@
package com.yxt.supervise.portal.biz.gdinventory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GdInventoryLogErrMapper extends BaseMapper<GdInventoryLogErr> {
}

8
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLogErrService.java

@ -0,0 +1,8 @@
package com.yxt.supervise.portal.biz.gdinventory;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class GdInventoryLogErrService extends ServiceImpl<GdInventoryLogErrMapper,GdInventoryLogErr> {
}

8
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLogMapper.java

@ -0,0 +1,8 @@
package com.yxt.supervise.portal.biz.gdinventory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GdInventoryLogMapper extends BaseMapper<GdInventoryLog> {
}

8
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryLogService.java

@ -0,0 +1,8 @@
package com.yxt.supervise.portal.biz.gdinventory;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class GdInventoryLogService extends ServiceImpl<GdInventoryLogMapper, GdInventoryLog> {
}

20
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkMapper.java

@ -26,7 +26,9 @@
package com.yxt.supervise.portal.biz.gdinventory; package com.yxt.supervise.portal.biz.gdinventory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
/** /**
* Project: yxt_supervise <br/> * Project: yxt_supervise <br/>
@ -43,4 +45,22 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface GdInventoryOkMapper extends BaseMapper<GdInventoryOk> { public interface GdInventoryOkMapper extends BaseMapper<GdInventoryOk> {
@Delete("delete from gd_inventory_ok where 1=1")
void clearData();
@Select("select count(1) from (select warehouseCode from gd_inventory_ok where warehouseType='1' and warehouseCode<>'112' group by warehouseCode) t ")
int countWarehouseType1Not112();
@Select("select count(1) from (select warehouseCode from gd_inventory_ok where warehouseType='2' group by warehouseCode) t ")
int countWarehouseType2();
@Select("select count(1) from gd_inventory_ok where warehouseCode='112'")
int countProd112();
@Select("select count(1) from gd_inventory_ok where warehouseType='1' and warehouseCode<>'112'")
int countProd1Not112();
@Select("select count(1) from gd_inventory_ok where warehouseType='2'")
int countProd2();
} }

16
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkService.java

@ -26,6 +26,7 @@
package com.yxt.supervise.portal.biz.gdinventory; package com.yxt.supervise.portal.biz.gdinventory;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yxt.common.core.result.ResultBean;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -42,5 +43,18 @@ import org.springframework.stereotype.Service;
* @since 1.0 * @since 1.0
*/ */
@Service @Service
public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper,GdInventoryOk> { public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInventoryOk> {
public void clearData() {
baseMapper.clearData();
}
public ResultBean kchz() {
int type1 = baseMapper.countWarehouseType1Not112();
int type2 = baseMapper.countWarehouseType2();
int prod112 = baseMapper.countProd112();
int prod1Not112 = baseMapper.countProd1Not112();
int prod2 = baseMapper.countProd2();
return ResultBean.fireSuccess();
}
} }

17
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryRest.java

@ -25,14 +25,11 @@
*********************************************************/ *********************************************************/
package com.yxt.supervise.portal.biz.gdinventory; package com.yxt.supervise.portal.biz.gdinventory;
import com.yxt.common.base.config.component.FileUploadComponent;
import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.result.ResultBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.Console;
/** /**
* Project: yxt_supervise <br/> * Project: yxt_supervise <br/>
* File: GdInventoryRest.java <br/> * File: GdInventoryRest.java <br/>
@ -52,6 +49,8 @@ public class GdInventoryRest {
@Autowired @Autowired
private GdInventoryService gdInventoryService; private GdInventoryService gdInventoryService;
@Autowired
private GdInventoryOkService gdInventoryOkService;
@GetMapping("/implgd") @GetMapping("/implgd")
public ResultBean implInventory() { public ResultBean implInventory() {
@ -64,10 +63,14 @@ public class GdInventoryRest {
return ResultBean.fireSuccess(); return ResultBean.fireSuccess();
} }
@PostMapping("/upToCount") @PostMapping("/uploadGdData")
public ResultBean upToCount(@RequestParam("file") MultipartFile file) { public ResultBean<GdInventoryLog> uploadGdData(@RequestParam("file") MultipartFile file) {
ResultBean rb = gdInventoryService.importAndCount(file); return gdInventoryService.uploadAndResetData(file);
return ResultBean.fireSuccess(); }
@GetMapping("/kchz")
public ResultBean kchz() {
return gdInventoryOkService.kchz();
} }
} }

59
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryService.java

@ -27,9 +27,8 @@ package com.yxt.supervise.portal.biz.gdinventory;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.text.csv.*; import cn.hutool.core.text.csv.*;
import cn.hutool.poi.excel.ExcelReader; import cn.hutool.json.JSONUtil;
import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.sax.handler.RowHandler; import cn.hutool.poi.excel.sax.handler.RowHandler;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -38,7 +37,6 @@ import com.yxt.common.core.result.FileUploadResult;
import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.result.ResultBean;
import com.yxt.supervise.portal.biz.storeindex.StoreIndexService; import com.yxt.supervise.portal.biz.storeindex.StoreIndexService;
import com.yxt.supervise.portal.extexcel.CsvTool; import com.yxt.supervise.portal.extexcel.CsvTool;
import com.yxt.supervise.portal.extexcel.ExcelTool;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -46,7 +44,6 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.*; import java.util.*;
@ -74,6 +71,10 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
private StoreIndexService storeIndexService; private StoreIndexService storeIndexService;
@Autowired @Autowired
private FileUploadComponent fileUploadComponent; private FileUploadComponent fileUploadComponent;
@Autowired
private GdInventoryLogService gdInventoryLogService;
@Autowired
private GdInventoryLogErrService gdInventoryLogErrService;
public void doCheck() { public void doCheck() {
@ -278,20 +279,22 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
public void importFromXlsx(String filePath) { public void importFromXlsx(String filePath) {
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
ExcelUtil.readBySax(filePath, 0, createRowHandler()); GdInventoryLog gdlog = new GdInventoryLog(filePath);
ExcelUtil.readBySax(filePath, 0, createRowHandler(gdlog));
System.out.println("用时:" + (System.currentTimeMillis() - millis)); System.out.println("用时:" + (System.currentTimeMillis() - millis));
} }
private RowHandler createRowHandler() { private RowHandler createRowHandler(GdInventoryLog gdlog) {
return new RowHandler() { return new RowHandler() {
private List<GdInventoryOk> toInsertList = new ArrayList<>(); private List<GdInventoryOk> toInsertList = new ArrayList<>();
private int x = 0, y = 0; private List<GdInventoryLogErr> errList = new ArrayList<>();
private int x = 0, y = 0, errnum = 0;
private int num = 0; private int num = 0;
@Override @Override
public void handle(int i, long l, List<Object> r) { public void handle(int sheetIndex, long rowIndex, List<Object> r) {
if (l > 0) { if (rowIndex > 0) {
String prodCode = "" + r.get(3); String prodCode = "" + r.get(3);
String warehouseCode = "" + r.get(1); String warehouseCode = "" + r.get(1);
@ -309,9 +312,21 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
map.put("prodValue", r.get(8)); // 商品货值 map.put("prodValue", r.get(8)); // 商品货值
map.put("suppliderName", r.get(9)); // 供应商 map.put("suppliderName", r.get(9)); // 供应商
map.put("datadate", r.get(10)); // 数据日期 map.put("datadate", r.get(10)); // 数据日期
BeanUtil.fillBeanWithMap(map, ok, true);
try {
BeanUtil.fillBeanWithMap(map, ok, true);
toInsertList.add(ok); toInsertList.add(ok);
y++;
} catch (Exception e) {
errnum++;
GdInventoryLogErr gile = new GdInventoryLogErr();
gile.setRowNum(x + 1);
gile.setErrInfo(e.getMessage());
gile.setFileFullPath(gdlog.getFileFullPath());
gile.setRowContent(JSONUtil.toJsonStr(r));
errList.add(gile);
}
if (999 == num) { if (999 == num) {
gdInventoryOkService.saveBatch(toInsertList); gdInventoryOkService.saveBatch(toInsertList);
num = 0; num = 0;
@ -319,10 +334,9 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
} else { } else {
num++; num++;
} }
y++;
} }
x++; x++;
System.out.println(",X:" + x + ",Y:" + y); // System.out.println(",X:" + x + ",Y:" + y);
} }
} }
@ -336,20 +350,33 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
if (toInsertList != null && !toInsertList.isEmpty()) { if (toInsertList != null && !toInsertList.isEmpty()) {
gdInventoryOkService.saveBatch(toInsertList); gdInventoryOkService.saveBatch(toInsertList);
} }
if (errList != null && !errList.isEmpty()) {
gdInventoryLogErrService.saveBatch(errList);
}
gdlog.setAllNum(x);
gdlog.setValidNum(y);
gdlog.setErrRowNum(errnum);
RowHandler.super.doAfterAllAnalysed(); RowHandler.super.doAfterAllAnalysed();
} }
}; };
} }
public ResultBean importAndCount(MultipartFile file) { public ResultBean<GdInventoryLog> uploadAndResetData(MultipartFile file) {
ResultBean rb = ResultBean.fireFail();
ResultBean<FileUploadResult> fub = fileUploadComponent.uploadFile(file, "kcxxcx"); ResultBean<FileUploadResult> fub = fileUploadComponent.uploadFile(file, "kcxxcx");
String filePath = fub.getData().getFilePath(); String filePath = fub.getData().getFilePath();
String fp = fileUploadComponent.getUploadPath() + filePath; String fp = fileUploadComponent.getUploadPath() + filePath;
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
ExcelUtil.read07BySax(fp, -1, createRowHandler()); gdInventoryOkService.clearData();
System.out.println("用时:" + (System.currentTimeMillis() - millis)); GdInventoryLog gdlog = new GdInventoryLog(fp);
return ResultBean.fireSuccess(); ExcelUtil.read07BySax(fp, -1, createRowHandler(gdlog));
// System.out.println("用时:" + (System.currentTimeMillis() - millis));
gdlog.setDurations(System.currentTimeMillis() - millis);
gdInventoryLogService.save(gdlog);
return rb.success().setData(gdlog);
} }
} }

Loading…
Cancel
Save