Function Point used in the project

First, the base product provides excel sensitive words into a database, and the key code to achieve the following

1. Add dependence

<dependency>

            <groupId>net.sourceforge.jexcelapi</groupId>

            <ArtifactId> jxl </ artifactId>

            <version>2.6.10</version>

        </dependency>

2. The code is implemented as follows

try {

            File file = new File("/Users/suyanzhu/Downloads/word.xls");

            boolean exists = file.exists();

            Workbook workbook = Workbook.getWorkbook(file);

            Sheet sheet = workbook.getSheet(0);

            for (int i = 1;i < sheet.getRows();i++){

                Cell cell1 = sheet.getCell(0, i);

                Cell cell2 = sheet.getCell(1, i);


                Long typeId = 1L;

                if (cell1.getContents (). equals ( "Type 1 sensitive word")) {

                    typeId = 1L;

                } Else if (cell1.getContents (). Equals ( "sensitive words Type 2")) {

                    typeId = 2L;

                } Else if (cell1.getContents (). Equals ( "sensitive words Type 3")) {

                    typeId = 3L;

                } Else if (cell1.getContents (). Equals ( "sensitive words Type 4")) {

                    typeId = 4L;

                } Else if (cell1.getContents (). Equals ( "sensitive words Type 5")) {

                    typeId = 5L;

                }

                SensitiveWordParamDTO build = SensitiveWordParamDTO

                        .builder().addUserId(1L)

                        .expressionState(2)

                        .name(cell2.getContents())

                        .replaceWord("*")

                        .typeId(typeId)

                        .build();

                try {

                    sensitiveWordProvider.save(build);

                } catch (SsHoursException e) {

                    e.printStackTrace ();

                }

            }

            workbook.close();

        } catch (IOException e) {

            e.printStackTrace ();

        } catch (BiffException e) {

            e.printStackTrace ();

        }

Second, many data on a single line sql

SELECT

rrc.id,

cc.nickname,

cc.mobile,

rrc.update_time,

rrc.update_user_id,

  apa.optionIds

FROM

Table 1 rrc

LEFT JOIN (

SELECT

GROUP_CONCAT(

rrco.option_id

) optionIds,

risk_customer_id

FROM

Table 2 rrco

GROUP BY

rrco.risk_customer_id

) What apa.risk_customer_id ON = rrc.id

LEFT JOIN 表3 cc ON cc.id = rrc.customer_id

LEFT JOIN 表2 rrco ON rrc.id = rrco.risk_customer_id

WHERE

rrco.option_id = 3

GROUP BY

rrc.id

Third, given a list of numbers to generate a digital number specified

// start value

int start = 1;

// end value

int end = 100;

// generation 1, 2, 3, 4 ... 100

List<Integer> list = Stream.iterate(start, item -> item+1).limit(end).collect(Collectors.toList());



Guess you like

Origin blog.51cto.com/suyanzhu/2433006