package com.zy.asrs.utils;
|
|
import com.alibaba.excel.context.AnalysisContext;
|
import com.alibaba.excel.event.AnalysisEventListener;
|
import com.core.common.SpringUtils;
|
import com.zy.asrs.entity.LocRule;
|
import com.zy.asrs.service.LocRuleService;
|
import com.zy.common.entity.LocRuleExcel;
|
|
import java.util.Date;
|
|
public class LocRuleExcelListener extends AnalysisEventListener<LocRuleExcel> {
|
private int total = 0;
|
@Override
|
public void invoke(LocRuleExcel excel, AnalysisContext ctx) {
|
LocRuleService locRuleService = SpringUtils.getBean(LocRuleService.class);
|
Date now = new Date();
|
LocRule locRule = new LocRule();
|
locRule = excel;
|
//BeanUtils.copyProperties(excel,locRule);
|
locRule.setCreateTime(now);
|
locRule.setUpdateTime(now);
|
locRule.setCstmr("1");
|
locRule.setStatus(1);
|
locRuleService.insert(locRule);
|
total++;
|
}
|
|
@Override
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
|
}
|
|
public int getTotal() {
|
return total;
|
}
|
}
|