zxy16305 / Blog

bak for hexo
3 stars 1 forks source link

Java-other #18

Open zxy16305 opened 6 years ago

zxy16305 commented 6 years ago

Apache POI

简单地东西就跳过了,在官方的demo上都找得到 1.poi-excel插入图片的坑

excel官方提供了两种,HSSFWorkbook和XSSFWorkbook 这里这个只试出了HSSFWorkbook的简单操作(注解和demo少得可怜。。)

    Workbook wb = new HSSFWorkbook();
    Sheet sheet = wb.createSheet("new");
    //画笔,一个sheet创建一个就行了
    Drawing<?> drawingPatriarch = sheet.createDrawingPatriarch();
    int pictureIndex1 = wb.addPicture(data1, Workbook.PICTURE_TYPE_JPEG);
    //这个初始化参数决定插入的图片的参数
    ClientAnchor xssfClientAnchor1 = new HSSFClientAnchor(0,0,1023,127,(short)0,0,(short)0,0);
    drawingPatriarch.createPicture(xssfClientAnchor1,pictureIndex1);
    //保存
    wb.write(outputStream);

这里讲一下这个构造函数 new HSSFClientAnchor(int dx1, int dy1, int dx2, int dy2, short col1, int row1, short col2, int row2)

 * @param dx1  the x coordinate within the first cell.
 * @param dy1  the y coordinate within the first cell.
 * @param dx2  the x coordinate within the second cell.
 * @param dy2  the y coordinate within the second cell.
 * @param col1 the column (0 based) of the first cell.
 * @param row1 the row (0 based) of the first cell.
 * @param col2 the column (0 based) of the second cell.
 * @param row2 the row (0 based) of the second cell.

其中dx的取值是0-1023,dy的取值是0-255. 他会把下一格分成这么多份,然后去规范图片的大小 (但同时会失去拉伸性能)

zxy16305 commented 6 years ago

Flowable

流程框架 概念:

BPM:( Business Process Management) 业务流程管理
BPMN:(Business Process Model and Notation)业务流程模型标注法
DMN:( Decision Model Notation)决策模型表示法
CMMN:(Case Management Model and Notation)案例管理模式与表示法

( BPMN for process management, CMMN for case management and DMN for decision rules.)

创建ProcessEngine实例

ProcessEngine pe = new StandaloneProcessEngineConfiguration()
                .setJdbcUrl("jdbc:mysql:///flowable")
                .setJdbcUsername("showclear")
                .setJdbcPassword("showclear")
                .setJdbcDriver("com.mysql.jdbc.Driver")
                .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
                .buildProcessEngine();

比如例子中的mysql数据库,只需指定一个数据库即可,会自动创建所需要的表。

zxy16305 commented 6 years ago

Apache MINA / NETTY