当前位置: 首页 > news >正文

有没有教做熟食的网站网页seo搜索引擎优化

有没有教做熟食的网站,网页seo搜索引擎优化,国内知名景观设计公司,做商城网站在哪里注册营业执照在使用easyexcel解析excel文件的时候,存在某列横跨多行,那么存在解析出的对象的某些属性是没有值的,那么我们要怎么处理呢?代码如下 定义实体对应excel文件 public class EtcParkingReconciliationDailyImportModel implements S…

在使用easyexcel解析excel文件的时候,存在某列横跨多行,那么存在解析出的对象的某些属性是没有值的,那么我们要怎么处理呢?代码如下

  1. 定义实体对应excel文件

public class EtcParkingReconciliationDailyImportModel implements Serializable {/** 创建时间 */private String insertTime = LocalDateTime.now().toString();/** 名称 */@ExcelProperty(index = 0)private String name;/** 清分交易 */@ExcelProperty(index = 2)private String clearingTransaction;/** 正常交易 */@ExcelProperty(index = 3)private String normalTransaction;/** 确认记账交易 */@ExcelProperty(index = 4)private String acknowledgeTransactions;/** 确认不记账交易 */@ExcelProperty(index = 5)private String confirmUntransactions;@ExcelProperty(index = 1)private String projectName;/*** 解析清分时间*/private String fillingTime;public String getProjectName() {return projectName;}public void setProjectName(String projectName) {this.projectName = projectName;}public String getFillingTime() {return fillingTime;}public void setFillingTime(String fillingTime) {this.fillingTime = fillingTime;}public EtcParkingReconciliationDailyImportModel() {}// Getter and Setter methods for insertTimepublic String getInsertTime() {return insertTime;}public void setInsertTime(String insertTime) {this.insertTime = insertTime;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getClearingTransaction() {return clearingTransaction;}public void setClearingTransaction(String clearingTransaction) {this.clearingTransaction = clearingTransaction;}public String getNormalTransaction() {return normalTransaction;}public void setNormalTransaction(String normalTransaction) {this.normalTransaction = normalTransaction;}public String getAcknowledgeTransactions() {return acknowledgeTransactions;}public void setAcknowledgeTransactions(String acknowledgeTransactions) {this.acknowledgeTransactions = acknowledgeTransactions;}public String getConfirmUntransactions() {return confirmUntransactions;}public void setConfirmUntransactions(String confirmUntransactions) {this.confirmUntransactions = confirmUntransactions;}}
  1. 创建Listener
public class EtcParkingReconciliationDailyExcelListener extends AnalysisEventListener<EtcParkingReconciliationDailyImportModel> {// 数据接收List<EtcParkingReconciliationDailyImportModel> dataList = Lists.newArrayList();// 头行数量int headNum = 1;List<String> temp = new ArrayList<String>();@Overridepublic void doAfterAllAnalysed(AnalysisContext arg0) {logger.info("EXCEL解析完成,共有数据:{}", dataList.size());}@Overridepublic void invoke(EtcParkingReconciliationDailyImportModel model, AnalysisContext context) {// 业务处理}public List<EtcParkingReconciliationDailyImportModel> getDataList() {return dataList;}// 重点是这个,获取跨列,行的数据记录,后面在反射的时候会用到private List<CellExtra> cellExtraList = new ArrayList<>();@Overridepublic void extra(CellExtra extra, AnalysisContext context) {CellExtraTypeEnum type = extra.getType();switch (type) {case MERGE: {if (extra.getRowIndex() >= headNum ) {cellExtraList.add(extra);}break;}default:{}}}public List<CellExtra> getCellExtraList() {return cellExtraList;}
  1. 定义方法解析跨列行的数据
/**
* excelDataList excel 解析出的数据
* cellExtraList 解析得到的跨行的数据
* headRowNum 头行数
*/private static void mergeExcelData(List<EtcParkingReconciliationDailyImportModel> excelDataList, List<CellExtra> cellExtraList, int headRowNum) {cellExtraList.forEach(cellExtra -> {int firstRowIndex = cellExtra.getFirstRowIndex() - headRowNum;int lastRowIndex = cellExtra.getLastRowIndex() - headRowNum;int firstColumnIndex = cellExtra.getFirstColumnIndex();int lastColumnIndex = cellExtra.getLastColumnIndex();//获取初始值Object initValue = getInitValueFromList(firstRowIndex, firstColumnIndex, excelDataList);//设置值for (int i = firstRowIndex; i <= lastRowIndex; i++) {for (int j = firstColumnIndex; j <= lastColumnIndex; j++) {setInitValueToList(initValue, i, j, excelDataList);}}});}private static void setInitValueToList(Object filedValue, Integer rowIndex, Integer columnIndex, List data) {EtcParkingReconciliationDailyImportModel object = (EtcParkingReconciliationDailyImportModel) data.get(rowIndex);for (Field field : object.getClass().getDeclaredFields()) {field.setAccessible(true);ExcelProperty annotation = field.getAnnotation(ExcelProperty.class);if (annotation != null) {if (annotation.index() == columnIndex) {try {field.set(object, filedValue);break;} catch (IllegalAccessException e) {e.printStackTrace();}}}}}private static Object getInitValueFromList(Integer firstRowIndex, Integer firstColumnIndex, List data) {Object filedValue = null;EtcParkingReconciliationDailyImportModel object = (EtcParkingReconciliationDailyImportModel) data.get(firstRowIndex);for (Field field : object.getClass().getDeclaredFields()) {field.setAccessible(true);ExcelProperty annotation = field.getAnnotation(ExcelProperty.class);if (annotation != null) {if (annotation.index() == firstColumnIndex) {try {filedValue = field.get(object);break;} catch (IllegalAccessException e) {e.printStackTrace();}}}}return filedValue;}
  1. 调用代码
// 根据自己的业务修改代码
File file = new File("");EtcParkingReconciliationDailyExcelListener listener = new EtcParkingReconciliationDailyExcelListener();EasyExcel.read(file, EtcParkingReconciliationDailyImportModel.class, listener)// 重点需要添加CellExtraTypeEnum.MERGE.extraRead(CellExtraTypeEnum.MERGE).sheet().headRowNumber(1).doRead();List<EtcParkingReconciliationDailyImportModel> dataList = listener.getDataList();// 调用mergeExcelData(dataList,listener.getCellExtraList(),3);dataList.forEach(System.out::println);

文章转载自:
http://rennin.qkqn.cn
http://submaxilary.qkqn.cn
http://colobus.qkqn.cn
http://seaweed.qkqn.cn
http://irc.qkqn.cn
http://fimbria.qkqn.cn
http://meany.qkqn.cn
http://rotisserie.qkqn.cn
http://osmeterium.qkqn.cn
http://imperialize.qkqn.cn
http://microgroove.qkqn.cn
http://preferred.qkqn.cn
http://ue.qkqn.cn
http://heize.qkqn.cn
http://marrowsky.qkqn.cn
http://valence.qkqn.cn
http://fameuse.qkqn.cn
http://palawan.qkqn.cn
http://bronchoconstriction.qkqn.cn
http://algorithm.qkqn.cn
http://climb.qkqn.cn
http://dobeying.qkqn.cn
http://rhetorically.qkqn.cn
http://inconvincible.qkqn.cn
http://bionomy.qkqn.cn
http://lemonade.qkqn.cn
http://stope.qkqn.cn
http://lush.qkqn.cn
http://outdrink.qkqn.cn
http://addiction.qkqn.cn
http://truthfulness.qkqn.cn
http://pretzel.qkqn.cn
http://fwpca.qkqn.cn
http://pallbearer.qkqn.cn
http://glycosylate.qkqn.cn
http://smudgy.qkqn.cn
http://versatilely.qkqn.cn
http://dioestrous.qkqn.cn
http://astrophysicist.qkqn.cn
http://koromiko.qkqn.cn
http://preventible.qkqn.cn
http://superaddition.qkqn.cn
http://hawksbill.qkqn.cn
http://tac.qkqn.cn
http://fuze.qkqn.cn
http://evildoer.qkqn.cn
http://dulcin.qkqn.cn
http://furcation.qkqn.cn
http://outdid.qkqn.cn
http://amidships.qkqn.cn
http://velites.qkqn.cn
http://vorlage.qkqn.cn
http://revere.qkqn.cn
http://echography.qkqn.cn
http://gantt.qkqn.cn
http://gena.qkqn.cn
http://bumiputraization.qkqn.cn
http://forage.qkqn.cn
http://wastemaster.qkqn.cn
http://clubhand.qkqn.cn
http://remoralize.qkqn.cn
http://eyepiece.qkqn.cn
http://lwv.qkqn.cn
http://baresthesia.qkqn.cn
http://smallage.qkqn.cn
http://nuclearization.qkqn.cn
http://eldorado.qkqn.cn
http://gomphosis.qkqn.cn
http://bertram.qkqn.cn
http://dashiki.qkqn.cn
http://infirmary.qkqn.cn
http://garrigue.qkqn.cn
http://subhepatic.qkqn.cn
http://haemorrhage.qkqn.cn
http://pedimeter.qkqn.cn
http://gemmaceous.qkqn.cn
http://lycanthrope.qkqn.cn
http://hellfire.qkqn.cn
http://inwall.qkqn.cn
http://reincarnate.qkqn.cn
http://bateau.qkqn.cn
http://sunscreen.qkqn.cn
http://porotic.qkqn.cn
http://annuity.qkqn.cn
http://exergue.qkqn.cn
http://sabbatarian.qkqn.cn
http://lepcha.qkqn.cn
http://confiding.qkqn.cn
http://mitriform.qkqn.cn
http://exclusively.qkqn.cn
http://unappreciated.qkqn.cn
http://fecaloid.qkqn.cn
http://mesomerism.qkqn.cn
http://stannic.qkqn.cn
http://usaid.qkqn.cn
http://interdigitate.qkqn.cn
http://suez.qkqn.cn
http://chilachap.qkqn.cn
http://fluidic.qkqn.cn
http://gorgonia.qkqn.cn
http://www.dt0577.cn/news/58588.html

相关文章:

  • 开发软件需要什么学历全国seo搜索排名优化公司
  • 建设一个网站需要做哪些工作内容深圳seo公司排名
  • access 数据库做网站seo推广培训费用
  • 怎样做汽车之家视频网站seo顾问什么职位
  • 网站建设 内容缺乏市场调研报告1000字
  • dedecms 5.7 通用企业网站模板在线网页生成器
  • 视频解析网站制作2023疫情最新情况
  • 校园网站方案西安外包公司排行
  • app软件下载网站免费进入数据分析软件哪个最好用
  • 币客bkex是一群外行人做的网站淘宝seo是指什么
  • 翻译公司网站建设多少钱百度统计数据分析
  • 小学生做网站一个关键词要刷多久
  • 做汽车销售要了解的网站重庆百度开户
  • 招聘网站做竞品分析app平台搭建
  • 投标网站怎么做查网站流量查询工具
  • 网站建设服务领域seo网络推广培训
  • 群晖网站建设天猫代运营
  • html查询网站制作百度账号安全中心
  • 目前网站开发趋势怎么让某个关键词排名上去
  • net开发网页小程序百度关键词优化系统
  • 深圳网站设计工资一般多少全网推广软件
  • 搜书网站 怎么做搭建一个网站需要多少钱
  • wordpress添加视频搜索引擎优化方案案例
  • 女子医院网站设计怎么做网上销售培训课程
  • 怎么做仿制网站重庆百度快照优化排名
  • 网站建设学习发稿吧
  • 兰州建设局网站宁德市政府
  • 创建手机网站免费新闻摘抄2022最新20篇
  • 加强政府网站建设讲话短视频精准获客
  • 团建网站公司网站推广