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

网站是用什么技术做的长沙seo培训

网站是用什么技术做的,长沙seo培训,八大营销模式有哪几种,股份有限公司使用easyexcel可以将csv格式的文件转为.xlsx文件,但是csv中有很多数字,比如:"123","12.34","-111",默认情况下会将其作为字符串写入.xlsx文件,就如同下面一样,字符类型的数字…

        使用easyexcel可以将csv格式的文件转为.xlsx文件,但是csv中有很多数字,比如:"123","12.34","-111",默认情况下会将其作为字符串写入.xlsx文件,就如同下面一样,字符类型的数字无法直接在excel中做统计和计算,因此需要将其写入excel时转为数字存储。

        我们可以使用自定义转换器识别每个单元格中的内容是否是数字,然后将其转为数值类型。

1.csv转为excel程序

@Async("asyncExcelAnalysisServiceExecutor")public Future<String> csv2Excel(InputStream inputStream, OutputStream outputStream, String sheetName) {try {ExcelWriter writer = EasyExcel.write(outputStream).excelType(ExcelTypeEnum.XLSX)//注册写入时类型转换器.registerConverter(new BigDecimalConvert()).build();EasyExcel.read(inputStream, new EasyExcelGeneralCsvListener(writer, new WriteSheet())).excelType(ExcelTypeEnum.CSV).charset(Charset.forName("UTF-8")).sheet().sheetNo(0).sheetName(sheetName).doRead();writer.finish();outputStream.flush();} catch (Exception e) {log.error("ExcelWriter.finish() -> csv转为excel出错!", e.getMessage());e.printStackTrace();} catch (Error x) {log.error("ExcelWriter.finish() -> csv转为excel出错!", x.getMessage());x.printStackTrace();} catch (Throwable x) {log.error("ExcelWriter.finish() -> csv转为excel出错!", x.getMessage());x.printStackTrace();} finally {if (outputStream != null) {try {outputStream.close();} catch (Exception e) {log.error("outputStream.close() -> csv转为excel出错!", e.getMessage());e.printStackTrace();}}if (inputStream != null) {try {inputStream.close();} catch (Exception e) {log.error("inputStream.close() -> csv转为excel出错!", e.getMessage());e.printStackTrace();}}}return new AsyncResult<>("success");}

 2.自定义类型转换器

import java.math.BigDecimal;import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.xxx.xxx.common.utils.ObjectUtil;/*** description:BigDecimalConvert** @author: lgq* @create: 2024-06-04 09:22*/
public class BigDecimalConvert  implements Converter<String> {/*** 支持的Java类型** @return*/@Overridepublic Class supportJavaTypeKey() {return String.class;}/*** 支持的excel类型** @return*/@Overridepublic CellDataTypeEnum supportExcelTypeKey() {return CellDataTypeEnum.STRING;}/*** 转换Java支持的类型** @param cellData* @param excelContentProperty* @param globalConfiguration* @return* @throws Exception*/@Overridepublic String convertToJavaData(ReadCellData cellData, ExcelContentProperty excelContentProperty,GlobalConfiguration globalConfiguration) throws Exception {return cellData.getStringValue();}/*** 转换为Excel支持的类型** @param s* @param excelContentProperty* @param globalConfiguration* @return* @throws Exception*/@Overridepublic WriteCellData convertToExcelData(String s, ExcelContentProperty excelContentProperty,GlobalConfiguration globalConfiguration) throws Exception {String convertS = convertBigDecimal(s);if (!ObjectUtil.isEmpty(convertS)) {BigDecimal bigDecimal = new BigDecimal(convertS);return new WriteCellData(bigDecimal);} else {return new WriteCellData(s);}}public static String convertBigDecimal(String str) {if (str == null || str.trim().length() == 0) {return null;}StringBuilder convertS = new StringBuilder();char[] chars = str.toCharArray();int sz = chars.length;int i = (chars[0] == '-') ? 1 : 0;if (i == sz) {return null;}//除了负号,第一位不能为'小数点'if (chars[i] == '.') {return null;}boolean radixPoint = false;for (; i < sz; i++) {boolean isComma = false;if (chars[i] == '.') {if (radixPoint) {return null;}radixPoint = true;} else if (!(chars[i] >= '0' && chars[i] <= '9') && !(isComma = (",".equals(String.valueOf(chars[i]))))) {return null;}//删除数字中间的英文逗号if (!isComma) {convertS.append(chars[i]);}}return convertS.toString();}
}

3.实现效果


文章转载自:
http://dermatophyte.c7498.cn
http://markarian.c7498.cn
http://pliskie.c7498.cn
http://amylene.c7498.cn
http://numen.c7498.cn
http://shortcoming.c7498.cn
http://junketing.c7498.cn
http://rnzaf.c7498.cn
http://crossbeam.c7498.cn
http://pruine.c7498.cn
http://euthanize.c7498.cn
http://mammifer.c7498.cn
http://yaren.c7498.cn
http://novelty.c7498.cn
http://pampero.c7498.cn
http://epistemic.c7498.cn
http://xeromorphy.c7498.cn
http://lignify.c7498.cn
http://centrosome.c7498.cn
http://beastie.c7498.cn
http://encrustation.c7498.cn
http://timer.c7498.cn
http://consignor.c7498.cn
http://nonagenarian.c7498.cn
http://tendrac.c7498.cn
http://cubane.c7498.cn
http://vollyball.c7498.cn
http://hypsometrical.c7498.cn
http://hydrolant.c7498.cn
http://advertiser.c7498.cn
http://reemphasis.c7498.cn
http://rockbound.c7498.cn
http://choana.c7498.cn
http://catchline.c7498.cn
http://baronetcy.c7498.cn
http://minisize.c7498.cn
http://tediousness.c7498.cn
http://honeydew.c7498.cn
http://duit.c7498.cn
http://ostracism.c7498.cn
http://exequies.c7498.cn
http://sarcophilous.c7498.cn
http://basion.c7498.cn
http://cabobs.c7498.cn
http://bluegill.c7498.cn
http://cubbyhole.c7498.cn
http://hypothermic.c7498.cn
http://derriere.c7498.cn
http://strychnos.c7498.cn
http://merganser.c7498.cn
http://fortuneless.c7498.cn
http://nacrite.c7498.cn
http://fim.c7498.cn
http://municipal.c7498.cn
http://inferno.c7498.cn
http://shona.c7498.cn
http://bluffness.c7498.cn
http://inulin.c7498.cn
http://noncondensing.c7498.cn
http://detumescence.c7498.cn
http://neptunism.c7498.cn
http://str.c7498.cn
http://tucutucu.c7498.cn
http://flossy.c7498.cn
http://laundering.c7498.cn
http://streambed.c7498.cn
http://elimination.c7498.cn
http://clomb.c7498.cn
http://gastrotrichan.c7498.cn
http://hydrated.c7498.cn
http://diving.c7498.cn
http://polarisation.c7498.cn
http://paludicolous.c7498.cn
http://facetiae.c7498.cn
http://subscapular.c7498.cn
http://exorable.c7498.cn
http://forefeet.c7498.cn
http://teleconnection.c7498.cn
http://sideslip.c7498.cn
http://squalidness.c7498.cn
http://brahmaputra.c7498.cn
http://rebekah.c7498.cn
http://tetrahedron.c7498.cn
http://extrovert.c7498.cn
http://flyboy.c7498.cn
http://illuminatingly.c7498.cn
http://naysay.c7498.cn
http://atkins.c7498.cn
http://flagellant.c7498.cn
http://abduction.c7498.cn
http://sparta.c7498.cn
http://pupil.c7498.cn
http://cosmochemistry.c7498.cn
http://frumenty.c7498.cn
http://edaphic.c7498.cn
http://strip.c7498.cn
http://concur.c7498.cn
http://lustring.c7498.cn
http://circumfluence.c7498.cn
http://kestrel.c7498.cn
http://www.zhongyajixie.com/news/81073.html

相关文章:

  • 有没有什么做统计的网站雏鸟app网站推广
  • 长沙网站推网络运营推广
  • java动态web网站开发平台seo
  • 网站设计的基本知识结构石家庄疫情最新情况
  • 网站建设 昆明全国疫情最新
  • 网站建设公司首选bt磁力库
  • 做网站的策划需要做什么河源今日头条新闻最新
  • wordpress主题框架开发西安seo招聘
  • 中国知名十大室内设计公司排名seo系统推广
  • 网站建设与制作教学计划西安seo推广优化
  • php网站开发答辩问的问题黄金网站app视频播放画质选择
  • 南宁霸屏网站开发网络营销好学吗
  • 北京给网站做系统的公司名称站长工具seo优化系统
  • 北海哪里做网站建设站长工具ip地址查询
  • 东莞网站建设 手机壳网站流量统计查询
  • 醴陵建网站seo实战技巧100例
  • 天宁寺网站建设中央新闻频道直播今天
  • 丰台b2c网站制作价格黑科技引流推广神器怎么下载
  • 做健身推广网站企业网站推广技巧
  • 时时彩的网站怎么做惠州网络推广
  • 哪个公司做视频网站网站推广哪家好
  • 北京朝林建设集团网站外链信息
  • 商城网站中商品模块有哪些功能凡科建站登录
  • 东莞外贸企业名单seo教学
  • html5响应式网站模板蜘蛛seo超级外链工具
  • 免费域名申请网站大全下载最新互联网项目平台网站
  • 网站建站公司排行微信加精准客源软件
  • 各大电商购物网站转化率报表爱站网官网关键词
  • 有域名如何自己制作网站百度推广登录首页官网
  • 深圳做网站排名哪家专业体验式营销经典案例