1. import org.apache.commons.beanutils.PropertyUtils;
    import org.apache.commons.lang3.StringUtils;
    import org.apache.poi.hssf.usermodel.HSSFCell;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.poi.ss.usermodel.*;
    import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  2.  
  3. http://qiye.pingan.com.cn/group1/M00/00/36/CglIiV1yJCCECQzxAAAAAN3BiIc652.txt?attname=test.txt
  4.  
  5. import java.io.IOException;
    import java.io.InputStream;
    import java.lang.reflect.Field;
    import java.math.BigDecimal;
    import java.text.DecimalFormat;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.List;
    import java.util.Locale;
  6.  
  7. public class ImportExeclUtil {
  8.  
  9. private static int totalRows = 0;// 总行数
  10.  
  11. private static int totalCells = 0;// 总列数
  12.  
  13. private static String errorInfo;// 错误信息
  14.  
  15. /** 无参构造方法 */
    public ImportExeclUtil()
    {
    }
  16.  
  17. public static int getTotalRows()
    {
    return totalRows;
    }
  18.  
  19. public static int getTotalCells()
    {
    return totalCells;
    }
  20.  
  21. public static String getErrorInfo()
    {
    return errorInfo;
    }
  22.  
  23. /**
    *
    * 根据流读取Excel文件
    *
    *
    * @param inputStream
    * @param isExcel2003
    * @return
    * @see [类、类#方法、类#成员]
    */
    public List<List<String>> read(InputStream inputStream, boolean isExcel2003)
    throws IOException
    {
  24.  
  25. List<List<String>> dataLst = null;
  26.  
  27. /** 根据版本选择创建Workbook的方式 */
    Workbook wb = null;
  28.  
  29. if (isExcel2003)
    {
    wb = new HSSFWorkbook(inputStream);
    }
    else
    {
    wb = new XSSFWorkbook(inputStream);
    }
    dataLst = readDate(wb);
  30.  
  31. return dataLst;
    }
  32.  
  33. /**
    *
    * 读取数据
    *
    * @param wb
    * @return
    * @see [类、类#方法、类#成员]
    */
    private List<List<String>> readDate(Workbook wb)
    {
  34.  
  35. List<List<String>> dataLst = new ArrayList<List<String>>();
  36.  
  37. /** 得到第一个shell */
    Sheet sheet = wb.getSheetAt(0);
  38.  
  39. /** 得到Excel的行数 */
    totalRows = sheet.getPhysicalNumberOfRows();
  40.  
  41. /** 得到Excel的列数 */
    if (totalRows >= 1 && sheet.getRow(0) != null)
    {
    totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
    }
  42.  
  43. /** 循环Excel的行 */
    for (int r = 0; r < totalRows; r++)
    {
    Row row = sheet.getRow(r);
    if (row == null)
    {
    continue;
    }
  44.  
  45. List<String> rowLst = new ArrayList<>();
  46.  
  47. /** 循环Excel的列 */
    for (int c = 0; c < getTotalCells(); c++)
    {
  48.  
  49. Cell cell = row.getCell(c);
    String cellValue = "";
  50.  
  51. if (null != cell)
    {
    // 以下是判断数据的类型
    switch (cell.getCellType())
    {
    case HSSFCell.CELL_TYPE_NUMERIC: // 数字
    cellValue = cell.getNumericCellValue() + "";
    break;
  52.  
  53. case HSSFCell.CELL_TYPE_STRING: // 字符串
    cellValue = cell.getStringCellValue();
    break;
  54.  
  55. case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
    cellValue = cell.getBooleanCellValue() + "";
    break;
  56.  
  57. case HSSFCell.CELL_TYPE_FORMULA: // 公式
    cellValue = cell.getCellFormula() + "";
    break;
  58.  
  59. case HSSFCell.CELL_TYPE_BLANK: // 空值
    cellValue = "";
    break;
  60.  
  61. case HSSFCell.CELL_TYPE_ERROR: // 故障
    cellValue = "非法字符";
    break;
  62.  
  63. default:
    cellValue = "未知类型";
    break;
    }
    }
  64.  
  65. rowLst.add(cellValue);
    }
  66.  
  67. /** 保存第r行的第c列 */
    dataLst.add(rowLst);
    }
  68.  
  69. return dataLst;
    }
  70.  
  71. /**
    *
    * 按指定坐标读取实体数据
    * <按顺序放入带有注解的实体成员变量中>
    *
    * @param wb 工作簿
    * @param t 实体
    * @param in 输入流
    * @param integers 指定需要解析的坐标
    * @return T 相应实体
    * @throws IOException
    * @throws Exception
    * @see [类、类#方法、类#成员]
    */
    @SuppressWarnings("unused")
    public static <T> T readDateT(Workbook wb, T t, InputStream in, Integer[]... integers)
    throws IOException, Exception
    {
    // 获取该工作表中的第一个工作表
    Sheet sheet = wb.getSheetAt(0);
  72.  
  73. // 成员变量的值
    Object entityMemberValue = "";
  74.  
  75. // 所有成员变量
    Field[] fields = t.getClass().getDeclaredFields();
    // 列开始下标
    int startCell = 0;
  76.  
  77. /** 循环出需要的成员 */
    for (int f = 0; f < fields.length; f++)
    {
  78.  
  79. fields[f].setAccessible(true);
    String fieldName = fields[f].getName();
    boolean fieldHasAnno = fields[f].isAnnotationPresent(IsNeeded.class);
    // 有注解
    if (fieldHasAnno)
    {
    IsNeeded annotation = fields[f].getAnnotation(IsNeeded.class);
    boolean isNeeded = annotation.isNeeded();
  80.  
  81. // Excel需要赋值的列
    if (isNeeded)
    {
  82.  
  83. // 获取行和列
    int x = integers[startCell][0] - 1;
    int y = integers[startCell][1] - 1;
  84.  
  85. Row row = sheet.getRow(x);
    Cell cell = row.getCell(y);
  86.  
  87. if (row == null)
    {
    continue;
    }
  88.  
  89. // Excel中解析的值
    String cellValue = getCellValue(cell);
    // 需要赋给成员变量的值
    entityMemberValue = getEntityMemberValue(entityMemberValue, fields, f, cellValue);
    // 赋值
    PropertyUtils.setProperty(t, fieldName, entityMemberValue);
    // 列的下标加1
    startCell++;
    }
    }
  90.  
  91. }
  92.  
  93. return t;
    }
  94.  
  95. /**
    *
    * 读取列表数据
    * <按顺序放入带有注解的实体成员变量中>
    *
    * @param wb 工作簿
    * @param t 实体
    * @param beginLine 开始行数
    * @param totalcut 结束行数减去相应行数
    * @return List<T> 实体列表
    * @throws Exception
    * @see [类、类#方法、类#成员]
    */
    @SuppressWarnings("unchecked")
    public static <T> List<T> readDateListT(Workbook wb, T t, int beginLine, int totalcut)
    throws Exception
    {
    List<T> listt = new ArrayList<T>();
  96.  
  97. /** 得到第一个shell */
    Sheet sheet = wb.getSheetAt(0);
  98.  
  99. /** 得到Excel的行数 */
    totalRows = sheet.getPhysicalNumberOfRows();
  100.  
  101. /** 得到Excel的列数 */
    if (totalRows >= 1 && sheet.getRow(0) != null)
    {
    totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
    }
  102.  
  103. /** 循环Excel的行 */
    for (int r = beginLine - 1; r < totalRows - totalcut; r++)
    {
    Object newInstance = t.getClass().newInstance();
    Row row = sheet.getRow(r);
    if (row == null)
    {
    continue;
    }
  104.  
  105. // 成员变量的值
    Object entityMemberValue = "";
  106.  
  107. // 所有成员变量
    Field[] fields = t.getClass().getDeclaredFields();
    // 列开始下标
    int startCell = 1;
  108.  
  109. for (int f = 1; f < fields.length; f++)
    {
  110.  
  111. fields[f].setAccessible(true);
    String fieldName = fields[f].getName();
    boolean fieldHasAnno = fields[f].isAnnotationPresent(IsNeeded.class);
    // 有注解
    if (fieldHasAnno)
    {
    IsNeeded annotation = fields[f].getAnnotation(IsNeeded.class);
    boolean isNeeded = annotation.isNeeded();
    // Excel需要赋值的列
    if (isNeeded)
    {
    Cell cell = row.getCell(startCell);
    String cellValue = getCellValue(cell);
    entityMemberValue = getEntityMemberValue(entityMemberValue, fields, f, cellValue);
    // 赋值
    PropertyUtils.setProperty(newInstance, fieldName, entityMemberValue);
    // 列的下标加1
    startCell++;
    }
    }
  112.  
  113. }
  114.  
  115. listt.add((T)newInstance);
    }
  116.  
  117. return listt;
    }
  118.  
  119. public static <T> List<T> readDateListTFormat(Workbook wb, T t, int beginLine, int totalcut)
    throws Exception
    {
    List<T> listt = new ArrayList<T>();
  120.  
  121. /** 得到第一个shell */
    Sheet sheet = wb.getSheetAt(0);
  122.  
  123. /** 得到Excel的行数 */
    totalRows = sheet.getPhysicalNumberOfRows();
  124.  
  125. /** 得到Excel的列数 */
    if (totalRows >= 1 && sheet.getRow(0) != null)
    {
    totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
    }
  126.  
  127. /** 循环Excel的行 */
    for (int r = beginLine - 1; r < totalRows - totalcut; r++)
    {
    Object newInstance = t.getClass().newInstance();
    Row row = sheet.getRow(r);
    if (row == null)
    {
    continue;
    }
  128.  
  129. // 成员变量的值
    Object entityMemberValue = "";
  130.  
  131. // 所有成员变量
    Field[] fields = t.getClass().getDeclaredFields();
    // 列开始下标
    int startCell = 1;
  132.  
  133. for (int f = 1; f < fields.length; f++)
    {
  134.  
  135. fields[f].setAccessible(true);
    String fieldName = fields[f].getName();
    boolean fieldHasAnno = fields[f].isAnnotationPresent(IsNeeded.class);
    // 有注解
    if (fieldHasAnno)
    {
    IsNeeded annotation = fields[f].getAnnotation(IsNeeded.class);
    boolean isNeeded = annotation.isNeeded();
    // Excel需要赋值的列
    if (isNeeded)
    {
    Cell cell = row.getCell(startCell);
    String cellValue = getCellValue(cell);
    entityMemberValue = getEntityMemberValueFormat(entityMemberValue, fields, f, cellValue);
    // 赋值
    PropertyUtils.setProperty(newInstance, fieldName, entityMemberValue);
    // 列的下标加1
    startCell++;
    }
    }
  136.  
  137. }
  138.  
  139. listt.add((T)newInstance);
    }
  140.  
  141. return listt;
    }
  142.  
  143. /**
    *
    * 根据Excel表格中的数据判断类型得到值
    *
    * @param cell
    * @return
    * @see [类、类#方法、类#成员]
    */
    private static String getCellValue(Cell cell)
    {
    String cellValue = "";
  144.  
  145. if (null != cell)
    {
    // 以下是判断数据的类型
    switch (cell.getCellType())
    {
    case HSSFCell.CELL_TYPE_NUMERIC: // 数字
    if (org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(cell))
    {
    Date theDate = cell.getDateCellValue();
    SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd");
    cellValue = dff.format(theDate);
    }
    else
    {
    DecimalFormat df = new DecimalFormat("0");
    cellValue = df.format(cell.getNumericCellValue());
    }
    break;
    case HSSFCell.CELL_TYPE_STRING: // 字符串
    cellValue = cell.getStringCellValue();
    break;
  146.  
  147. case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
    cellValue = cell.getBooleanCellValue() + "";
    break;
  148.  
  149. case HSSFCell.CELL_TYPE_FORMULA: // 公式
    cellValue = cell.getCellFormula() + "";
    break;
  150.  
  151. case HSSFCell.CELL_TYPE_BLANK: // 空值
    cellValue = "";
    break;
  152.  
  153. case HSSFCell.CELL_TYPE_ERROR: // 故障
    cellValue = "非法字符";
    break;
  154.  
  155. default:
    cellValue = "未知类型";
    break;
    }
  156.  
  157. }
    return cellValue;
    }
  158.  
  159. /**
    *
    * 根据实体成员变量的类型得到成员变量的值
    *
    * @param realValue
    * @param fields
    * @param f
    * @param cellValue
    * @return
    * @see [类、类#方法、类#成员]
    */
    private static Object getEntityMemberValue(Object realValue, Field[] fields, int f, String cellValue)
    {
    Field field= fields[f];
    String type = field.getType().getName();
    switch (type)
    {
    case "char":
    case "java.lang.Character":
    case "java.lang.String":
    realValue = cellValue;
    break;
    case "java.util.Date":
    realValue = StringUtils.isBlank(cellValue) ? null : DateUtil.strToDate(cellValue, DateUtil.YYYY_MM_DD);
    break;
    case "java.lang.Integer":
    realValue = StringUtils.isBlank(cellValue) ? null : Integer.valueOf(cellValue);
    break;
    case "int":
    case "float":
    case "double":
    case "java.lang.Double":
    case "java.lang.Float":
    case "java.lang.Long":
    case "java.lang.Short":
    case "java.math.BigDecimal":
    realValue = StringUtils.isBlank(cellValue) ? null : new BigDecimal(cellValue);
    break;
    default:
    break;
    }
    return realValue;
    }
  160.  
  161. private static Object getEntityMemberValueFormat(Object realValue, Field[] fields, int f, String cellValue)
    {
    Field field= fields[f];
    String type = field.getType().getName();
    switch (type)
    {
    case "char":
    case "java.lang.Character":
    case "java.lang.String":
    realValue = cellValue;
    break;
    case "java.util.Date":
    realValue = StringUtils.isBlank(cellValue) ? null : DateUtil.strToDate(cellValue, DateUtil.YYYYMMDD);
    break;
    case "java.lang.Integer":
    realValue = StringUtils.isBlank(cellValue) ? null : Integer.valueOf(cellValue);
    break;
    case "int":
    case "float":
    case "double":
    case "java.lang.Double":
    case "java.lang.Float":
    case "java.lang.Long":
    case "java.lang.Short":
    case "java.math.BigDecimal":
    realValue = StringUtils.isBlank(cellValue) ? null : new BigDecimal(cellValue);
    break;
    default:
    break;
    }
    return realValue;
    }
  162.  
  163. /**
    *
    * 根据路径或文件名选择Excel版本
    *
    *
    * @param filePathOrName
    * @param in
    * @return
    * @throws IOException
    * @see [类、类#方法、类#成员]
    */
    public static Workbook chooseWorkbook(String filePathOrName, InputStream in)
    throws IOException
    {
    /** 根据版本选择创建Workbook的方式 */
    Workbook wb = null;
    boolean isExcel2003 = ExcelVersionUtil.isExcel2003(filePathOrName);
  164.  
  165. if (isExcel2003)
    {
    wb = new HSSFWorkbook(in);
    }
    else
    {
    wb = new XSSFWorkbook(in);
    }
  166.  
  167. return wb;
    }
  168.  
  169. static class ExcelVersionUtil
    {
  170.  
  171. /**
    *
    * 是否是2003的excel,返回true是2003
    *
    *
    * @param filePath
    * @return
    * @see [类、类#方法、类#成员]
    */
    public static boolean isExcel2003(String filePath)
    {
    return filePath.matches("^.+\\.(?i)(xls)$");
  172.  
  173. }
  174.  
  175. /**
    *
    * 是否是2007的excel,返回true是2007
    *
    *
    * @param filePath
    * @return
    * @see [类、类#方法、类#成员]
    */
    public static boolean isExcel2007(String filePath)
    {
    return filePath.matches("^.+\\.(?i)(xlsx)$");
  176.  
  177. }
    }
  178.  
  179. public static class DateUtil
    {
  180.  
  181. // ======================日期格式化常量=====================//
  182.  
  183. public static final String YYYY_MM_DDHHMMSS = "yyyy-MM-dd HH:mm:ss";
  184.  
  185. public static final String YYYY_MM_DD = "yyyy-MM-dd";
  186.  
  187. public static final String YYYY_MM = "yyyy-MM";
  188.  
  189. public static final String YYYY = "yyyy";
  190.  
  191. public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
  192.  
  193. public static final String YYYYMMDD = "yyyyMMdd";
  194.  
  195. public static final String YYYYMM = "yyyyMM";
  196.  
  197. public static final String YYYYMMDDHHMMSS_1 = "yyyy/MM/dd HH:mm:ss";
  198.  
  199. public static final String YYYY_MM_DD_1 = "yyyy/MM/dd";
  200.  
  201. public static final String YYYY_MM_1 = "yyyy/MM";
  202.  
  203. /**
    *
    * 自定义取值,Date类型转为String类型
    *
    * @param date 日期
    * @param pattern 格式化常量
    * @return
    * @see [类、类#方法、类#成员]
    */
    public static String dateToStr(Date date, String pattern)
    {
    SimpleDateFormat format = null;
  204.  
  205. if (null == date) {
    return null;
    }
    format = new SimpleDateFormat(pattern, Locale.getDefault());
  206.  
  207. return format.format(date);
    }
  208.  
  209. /**
    * 将字符串转换成Date类型的时间
    * <hr>
    *
    * @param s 日期类型的字符串<br>
    * datePattern :YYYY_MM_DD<br>
    * @return java.util.Date
    */
    public static Date strToDate(String s, String pattern)
    {
    if (s == null)
    {
    return null;
    }
    Date date = null;
    SimpleDateFormat sdf = new SimpleDateFormat(pattern);
    try
    {
    date = sdf.parse(s);
    }
    catch (ParseException e)
    {
    e.printStackTrace();
    }
    return date;
    }
    }
  210.  
  211. }
  212.  
  213. 导入 filename
  1. String fileName = res.getFileOrigName();
    Workbook wb = ImportExeclUtil.chooseWorkbook(fileName, new ByteArrayInputStream(res.getContent()));
    if (res.getExpressType().equals(ExpressEnum.sf.getShortName())) {
    Sheet sheet = wb.getSheetAt(0);
    Row row = sheet.getRow(sheet.getFirstRowNum());
    int physicalNumberOfCells = row.getPhysicalNumberOfCells();
    //校验标题列是否正确
    if(physicalNumberOfCells!=14){
    return ResultUtil.forCheck("标题列不正确,请严格按模板导入");
    }
    for (int i = 0; i < physicalNumberOfCells; i++) {
    Cell cell = row.getCell(i);
    if(cell!=null){
    if(!sfHead.get(i).equals(cell.getStringCellValue())){
    return ResultUtil.forCheck("标题列不正确,请严格按模板导入");
    }
    }
  2.  
  3. }
  4.  
  5. ExpressSfBill expressSfBill = new ExpressSfBill();
    //get list
    List<ExpressSfBill> list = ImportExeclUtil.readDateListT(wb, expressSfBill, 2, 0);
  6.  
  7. //insert db
    return expressBillService.importSFBill(list);
  8.  
  9. }
  1. @Retention(value = RetentionPolicy.RUNTIME)
    @Target(value = {ElementType.FIELD})
    public @interface IsNeeded {
  2.  
  3. boolean isNeeded() default true;
  4.  
  5. }
  6.  
  7. 导出
  1. @GetMapping("billTemplate")
    public ResponseVO billTemplate(@RequestParam(value = "expressType") String expressType, HttpServletResponse response) {
    InputStream excelFileInputStream = null;
    XSSFWorkbook workbook = null;
    OutputStream os = null;
    try {
    response.reset();
    if ("sf".equals(expressType)) {
    String name="ShunFeng.xlsx";
    ClassPathResource resource = new ClassPathResource("template" + File.separator +name);
    //web浏览通过MIME类型判断文件是excel类型
    response.setContentType("application/vnd.ms-excel;charset=utf-8");
    response.setCharacterEncoding("utf-8");
  2.  
  3. // 对文件名进行处理。防止文件名乱码
    // Content-disposition属性设置成以附件方式进行下载
    response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(name,"utf-8"));
    excelFileInputStream = resource.getInputStream();
    workbook = new XSSFWorkbook(excelFileInputStream);
    os = response.getOutputStream();
    workbook.write(os);
    os.flush();
    return null;
    } else if ("ems".equals(expressType)) {
    String name="EMS.xlsx";
    ClassPathResource resource = new ClassPathResource("template" + File.separator + name);
    //web浏览通过MIME类型判断文件是excel类型
    response.setContentType("application/vnd.ms-excel;charset=utf-8");
    response.setCharacterEncoding("utf-8");
    // 对文件名进行处理。防止文件名乱码
    // Content-disposition属性设置成以附件方式进行下载
    response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(name,"utf-8"));
    excelFileInputStream = resource.getInputStream();
    workbook = new XSSFWorkbook(excelFileInputStream);
    os = response.getOutputStream();
    workbook.write(os);
    os.flush();
    return null;
    }else {
    return ResultUtil.forError("下载模板参数不正确");
    }
    } catch (Exception e) {
    log.error("下载模板发生异常", e);
    return ResultUtil.forError("下载模板发生异常");
    } finally {
    try {
    if (os != null) {
    os.close();
    }
    if (workbook != null) {
    workbook.close();
    }
    if (excelFileInputStream != null) {
    excelFileInputStream.close();
    }
    } catch (IOException e) {
    log.error(e.getMessage());
    }
  4.  
  5. }
  6.  
  7. }
  8.  
  9. ps 工具类,感谢网友的思路及部分代码。

excel 导入 下载模板 demo的更多相关文章

  1. docker 导入下载模板

    <pre name="code" class="ruby">docker:/root# cat centos-6-x86.tar.gz | dock ...

  2. excel导入、下载功能

    1.excel导入.下载功能 2.首先,我们是居于maven项目进行开发引入poi,如果不是那就手动下载相应的jar包引入项目就可以了 <!-- poi --> <dependenc ...

  3. spring boot + easypoi两行代码excel导入导出

    easypoi封装了poi让我们能够非常简单的实现Excel导出,Excel模板导出,Excel导入,Word模板导出等,具体可见官网:http://www.afterturn.cn/. 我这边实现了 ...

  4. Excel 导入时如何下载模板信息(Java)

    大家知道,我们在实现 Excel 上传的时候,会让我们去下载个模板,然后实现导入功能.在此我在这里记录下来,以便后续的使用... 首先思考一个问题是 这个模板这么给前台,还有这个模板是这么来的,刚开始 ...

  5. vue Excel导入,下载Excel模板,导出Excel

    vue  Excel导入,下载Excel模板,导出Excel vue  Excel导入,下载Excel模板 <template> <div style="display: ...

  6. 下载模板、Excel导入、导出

    下载模板 /// <summary> /// 下载模板 /// </summary> /// <returns></returns> public Ac ...

  7. C#实现Excel模板导出和从Excel导入数据

    午休时间写了一个Demo关于Excel导入导出的简单练习 1.窗体 2.引用office命名空间 添加引用-程序集-扩展-Microsoft.Office.Interop.Excel 3.封装的Exc ...

  8. 通用的高度可扩展的Excel导入实现(附Demo)

    Demo源码 背景 通过程序将excel导入到数据库中是一项非常常见的功能.通常的做法是:先将excel转成DataTable,然后将DataTable转换成List<T>,最终通过Lis ...

  9. java动态生成带下拉框的Excel导入模板

    在实际开发中,由于业务需要,常常需要进行Excel导入导出操作.以前做一些简单的导入时,先准备一个模板,再进行导入,单有十几. 二十几个导入模板时,往往要做十几.二十几个模板.而且,当在模板中需要有下 ...

随机推荐

  1. ORA-06502:at "WMSYS.WM_CONCAT_IMPL",line 30 解决方法整理

    之前数据量少的时候,用:select wm_concat(字段) from 表 拼接数据量小的话,没有问题,数据量超出4000个就会爆以下错误信息: 解决方法(Oracle 函数xmlagg拼接): ...

  2. 001-python3 初识

    一.python的起源 python是一门 解释型弱类型编程语言. 特点: 简单.明确.优雅 二.python的解释器 CPython. 官方提供的. 内部使用c语言来实现 PyPy. 一次性把我们的 ...

  3. kafka入门(三)备份

    一.相关概念 备份相关的角色 Kafka消息备份分三个角色:分别是Leader副本.Follower副本.ISR集合 Leader副本 负责直接响应client端的读写请求,即和生产者和消费者直接对接 ...

  4. web前端css(一)

    一  css的引入方式: 1)    行内样式:     <p style=”color: green”>我是一个段落</p> 2)    内接样式: <style ty ...

  5. kuangbin专题 专题二 搜索进阶 哈密顿绕行世界问题 HDU - 2181

    题目链接:https://vjudge.net/problem/HDU-2181 题意:一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发 ...

  6. 2050编程赛 冰水挑战 HDU 6495

    题目地址:https://vjudge.net/problem/HDU-6495 思路:我们需要维护的是挑战了n个之后剩余体力值,剩余体力值越大越好dp[N(i)][N(j)],第一个维度,记录当前是 ...

  7. SQL SERVER 活动监视-sys.dm_exec_requests

    sys.dm_exec_requests (Transact-SQL)应用: 针对 SQL Server 内正在执行的每个请求返回一行.sys.dm_exec_connections.sys.dm_e ...

  8. liunx某台服务器无法访问其他服务器!!!!!!!!

    针对于可以ping通ip地址,但是无法访问端口!!! 访问端口卡死,未响应, 例如mysql出现当前主机无法远程连接数据库,而其他主机都可以 前提条件:防火墙,mysql账号ip限制问题已经解决 问题 ...

  9. Excel催化剂开源第1波-自定义函数的源代码全公开

    Excel催化剂插件从2018年1月1日开始运营,到今天刚好一周年,在过去一年时间里,感谢社区里的许多友人们的关心和鼓励,得以坚持下来,并收获一定的用户量和粉丝数和少量的经济收入回报和个人知名度的提升 ...

  10. springboot序

    springboot序 1.写在前面 (1) 前段时间把文章分了下类(说的是专栏,谈不上),分了三类:springboot.springcloud.mpp数据库greenplum,后来给springc ...