Commit 8da7cb8bff452de0b7a8e847ad102c29a35fe741

Authored by Sumate Kongpui
0 parents
Exists in master

init app

.classpath 0 → 100644
  1 +++ a/.classpath
... ... @@ -0,0 +1,25 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="src" output="target/classes" path="src/main/java">
  4 + <attributes>
  5 + <attribute name="optional" value="true"/>
  6 + <attribute name="maven.pomderived" value="true"/>
  7 + </attributes>
  8 + </classpathentry>
  9 + <classpathentry kind="src" output="target/test-classes" path="src/test/java">
  10 + <attributes>
  11 + <attribute name="test" value="true"/>
  12 + <attribute name="optional" value="true"/>
  13 + <attribute name="maven.pomderived" value="true"/>
  14 + </attributes>
  15 + </classpathentry>
  16 + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
  17 + <attributes>
  18 + <attribute name="maven.pomderived" value="true"/>
  19 + </attributes>
  20 + </classpathentry>
  21 + <classpathentry kind="lib" path="lib/mssql-jdbc-6.2.2.jre8.jar"/>
  22 + <classpathentry kind="lib" path="/Finger/lib/gson-2.2.2.jar"/>
  23 + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_191"/>
  24 + <classpathentry kind="output" path="target/classes"/>
  25 +</classpath>
... ...
.project 0 → 100644
  1 +++ a/.project
... ... @@ -0,0 +1,23 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>diaryFinger</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>org.eclipse.jdt.core.javabuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + <buildCommand>
  14 + <name>org.eclipse.m2e.core.maven2Builder</name>
  15 + <arguments>
  16 + </arguments>
  17 + </buildCommand>
  18 + </buildSpec>
  19 + <natures>
  20 + <nature>org.eclipse.jdt.core.javanature</nature>
  21 + <nature>org.eclipse.m2e.core.maven2Nature</nature>
  22 + </natures>
  23 +</projectDescription>
... ...
.settings/org.eclipse.core.resources.prefs 0 → 100644
  1 +++ a/.settings/org.eclipse.core.resources.prefs
... ... @@ -0,0 +1,4 @@
  1 +eclipse.preferences.version=1
  2 +encoding//src/main/java=UTF-8
  3 +encoding//src/test/java=UTF-8
  4 +encoding/<project>=UTF-8
... ...
.settings/org.eclipse.jdt.core.prefs 0 → 100644
  1 +++ a/.settings/org.eclipse.jdt.core.prefs
... ... @@ -0,0 +1,14 @@
  1 +eclipse.preferences.version=1
  2 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
  3 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
  4 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
  5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
  6 +org.eclipse.jdt.core.compiler.compliance=1.5
  7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate
  8 +org.eclipse.jdt.core.compiler.debug.localVariable=generate
  9 +org.eclipse.jdt.core.compiler.debug.sourceFile=generate
  10 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
  11 +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
  12 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
  13 +org.eclipse.jdt.core.compiler.release=disabled
  14 +org.eclipse.jdt.core.compiler.source=1.5
... ...
.settings/org.eclipse.m2e.core.prefs 0 → 100644
  1 +++ a/.settings/org.eclipse.m2e.core.prefs
... ... @@ -0,0 +1,4 @@
  1 +activeProfiles=
  2 +eclipse.preferences.version=1
  3 +resolveWorkspaceProjects=true
  4 +version=1
... ...
conf/config 0 → 100644
  1 +++ a/conf/config
... ... @@ -0,0 +1,17 @@
  1 +<?xml version="1.0" encoding="tis-620"?>
  2 +<configuration>
  3 + <connection value="jdbc:sqlserver://171.100.30.162\\SQLEXPRESS:1433;databaseName=Pm2014_SU;user=sa;password=Wvhlyf123"/>
  4 + <mode value="in"/>
  5 + <token="Account" value="" />
  6 + <token="Admin" value="" />
  7 + <token="CS CallCenter" value="" />
  8 + <token="DEV" value="" />
  9 + <token="IT9.00" value="" />
  10 + <token="IT9.30" value="" />
  11 + <token="Sale" value="" />
  12 + <token="Service" value="" />
  13 + <token="Setup" value="" />
  14 + <token="TSD" value="" />
  15 + <token="SmartContactCenter" value="" />
  16 + <token="default" value="EJ7PLl1sQlCVjsPYLt0TfnfK5u26atCiXImhifOlJEM" />
  17 +</configuration>
0 18 \ No newline at end of file
... ...
lib/mssql-jdbc-6.2.2.jre8.jar 0 → 100644
No preview for this file type
new.csv 0 → 100644
  1 +++ a/new.csv
... ... @@ -0,0 +1,281 @@
  1 +SC-62157,11/03/2020 00:26
  2 +SC-62157,11/03/2020 00:27
  3 +SC-59041,11/03/2020 00:50
  4 +SC-59041,11/03/2020 00:50
  5 +SC-59041,11/03/2020 00:56
  6 +SC-58020,11/03/2020 01:04
  7 +SC-57019,11/03/2020 01:05
  8 +TSD-61003,11/03/2020 05:01
  9 +TSD-61003,11/03/2020 05:13
  10 +SC-60065,11/03/2020 07:38
  11 +SC-60065,11/03/2020 07:38
  12 +SC-60060,11/03/2020 07:39
  13 +SC-62147,11/03/2020 07:44
  14 +SC-62148,11/03/2020 07:49
  15 +SC-62148,11/03/2020 07:49
  16 +SC-61124,11/03/2020 07:54
  17 +SC-61124,11/03/2020 07:54
  18 +SC-61124,11/03/2020 07:54
  19 +SC-58024,11/03/2020 08:03
  20 +SC-55014,11/03/2020 08:14
  21 +SC-62154,11/03/2020 08:17
  22 +SC-62153,11/03/2020 08:18
  23 +SC-60070,11/03/2020 08:20
  24 +SC-62129,11/03/2020 08:22
  25 +SC-59031,11/03/2020 08:24
  26 +SC-55014,11/03/2020 08:24
  27 +SC-55014,11/03/2020 08:24
  28 +SC-58024,11/03/2020 08:26
  29 +SC-62143,11/03/2020 08:30
  30 +SC-62151,11/03/2020 08:32
  31 +SC-62143,11/03/2020 08:33
  32 +SC-62128,11/03/2020 08:36
  33 +SC-60074,11/03/2020 08:37
  34 +SC-61122,11/03/2020 08:39
  35 +SC-62159,11/03/2020 08:40
  36 +SC-62142,11/03/2020 08:40
  37 +SC-63160,11/03/2020 08:40
  38 +SC-62143,11/03/2020 08:41
  39 +SC-62154,11/03/2020 08:42
  40 +SC-62132,11/03/2020 08:43
  41 +SC-62158,11/03/2020 08:44
  42 +SC-62133,11/03/2020 08:45
  43 +SC-62134,11/03/2020 08:45
  44 +SC-50006,11/03/2020 08:45
  45 +SC-62133,11/03/2020 08:46
  46 +SC-62144,11/03/2020 08:46
  47 +SC-59049,11/03/2020 08:46
  48 +SC-55014,11/03/2020 08:46
  49 +SC-58024,11/03/2020 08:47
  50 +SC-62150,11/03/2020 08:47
  51 +SC-62130,11/03/2020 08:48
  52 +SC-59035,11/03/2020 08:49
  53 +SC-61092,11/03/2020 08:49
  54 +SC-59036,11/03/2020 08:49
  55 +SC-62136,11/03/2020 08:49
  56 +SC-61112,11/03/2020 08:49
  57 +SC-62155,11/03/2020 08:50
  58 +SC-59036,11/03/2020 08:51
  59 +SC-59044,11/03/2020 08:51
  60 +SC-61102,11/03/2020 08:51
  61 +SC-62145,11/03/2020 08:52
  62 +SC-62145,11/03/2020 08:52
  63 +SC-56016,11/03/2020 08:52
  64 +SC-59036,11/03/2020 08:53
  65 +SC-59033,11/03/2020 08:53
  66 +SC-58027,11/03/2020 08:53
  67 +SC-62137,11/03/2020 08:54
  68 +SC-50005,11/03/2020 08:54
  69 +SC-50005,11/03/2020 08:55
  70 +SC-60073,11/03/2020 08:56
  71 +SC-59037,11/03/2020 08:56
  72 +SC-55015,11/03/2020 08:56
  73 +SC-59043,11/03/2020 08:57
  74 +SC-62128,11/03/2020 08:57
  75 +SC-60067,11/03/2020 08:57
  76 +SC-61098,11/03/2020 08:57
  77 +SC-58025,11/03/2020 08:57
  78 +SC-59029,11/03/2020 08:58
  79 +SC-50004,11/03/2020 08:58
  80 +SC-60076,11/03/2020 08:58
  81 +SC-58026,11/03/2020 08:59
  82 +SC-60069,11/03/2020 08:59
  83 +SC-61125,11/03/2020 08:59
  84 +SC-61125,11/03/2020 08:59
  85 +SC-62131,11/03/2020 08:59
  86 +SC-59034,11/03/2020 08:59
  87 +SC-62149,11/03/2020 08:59
  88 +SC-53011,11/03/2020 08:59
  89 +SC-60055,11/03/2020 08:59
  90 +SC-60068,11/03/2020 08:59
  91 +SC-61079,11/03/2020 08:59
  92 +SC-53011,11/03/2020 08:59
  93 +SC-60064,11/03/2020 09:00
  94 +SC-60068,11/03/2020 09:00
  95 +SC-60070,11/03/2020 09:00
  96 +SC-63163,11/03/2020 09:00
  97 +SC-62149,11/03/2020 09:00
  98 +SC-61092,11/03/2020 09:03
  99 +SC-62136,11/03/2020 09:03
  100 +SC-62141,11/03/2020 09:04
  101 +SC-60058,11/03/2020 09:05
  102 +SC-61096,11/03/2020 09:05
  103 +SC-60073,11/03/2020 09:05
  104 +SC-60064,11/03/2020 09:05
  105 +SC-62159,11/03/2020 09:05
  106 +SC-59038,11/03/2020 09:06
  107 +SC-62155,11/03/2020 09:06
  108 +SC-59037,11/03/2020 09:07
  109 +SC-61088,11/03/2020 09:07
  110 +SC-62130,11/03/2020 09:07
  111 +SC-62138,11/03/2020 09:08
  112 +SC-62144,11/03/2020 09:09
  113 +SC-60061,11/03/2020 09:10
  114 +SC-60061,11/03/2020 09:10
  115 +SC-59037,11/03/2020 09:10
  116 +SC-57019,11/03/2020 09:11
  117 +SC-50005,11/03/2020 09:12
  118 +SC-63162,11/03/2020 09:12
  119 +SC-61118,11/03/2020 09:13
  120 +SC-61118,11/03/2020 09:13
  121 +SC-61123,11/03/2020 09:14
  122 +SC-55015,11/03/2020 09:16
  123 +SC-60071,11/03/2020 09:17
  124 +SC-62126,11/03/2020 09:19
  125 +SC-61123,11/03/2020 09:19
  126 +SC-60061,11/03/2020 09:20
  127 +SC-62146,11/03/2020 09:20
  128 +SC-50003,11/03/2020 09:21
  129 +SC-50001,11/03/2020 09:21
  130 +SC-58022,11/03/2020 09:23
  131 +SC-56018,11/03/2020 09:23
  132 +SC-59042,11/03/2020 09:24
  133 +SC-59042,11/03/2020 09:24
  134 +SC-61114,11/03/2020 09:24
  135 +SC-56018,11/03/2020 09:25
  136 +SC-63164,11/03/2020 09:25
  137 +SC-50002,11/03/2020 09:25
  138 +SC-50002,11/03/2020 09:26
  139 +SC-61114,11/03/2020 09:26
  140 +SC-55013,11/03/2020 09:26
  141 +SC-61116,11/03/2020 09:27
  142 +SC-58024,11/03/2020 09:27
  143 +SC-62146,11/03/2020 09:27
  144 +SC-59031,11/03/2020 09:29
  145 +SC-59037,11/03/2020 09:29
  146 +SC-59042,11/03/2020 09:29
  147 +SC-62139,11/03/2020 09:29
  148 +SC-59037,11/03/2020 09:30
  149 +SC-58022,11/03/2020 09:30
  150 +SC-62136,11/03/2020 09:30
  151 +SC-62136,11/03/2020 09:31
  152 +SC-58022,11/03/2020 09:31
  153 +SC-58022,11/03/2020 09:31
  154 +SC-62136,11/03/2020 09:32
  155 +SC-62137,11/03/2020 09:36
  156 +SC-59037,11/03/2020 09:36
  157 +SC-59041,11/03/2020 09:37
  158 +SC-59037,11/03/2020 09:38
  159 +SC-59041,11/03/2020 09:38
  160 +SC-60058,11/03/2020 09:39
  161 +SC-60074,11/03/2020 09:39
  162 +SC-61092,11/03/2020 09:40
  163 +SC-62136,11/03/2020 09:40
  164 +SC-61092,11/03/2020 09:40
  165 +SC-50002,11/03/2020 09:40
  166 +SC-62142,11/03/2020 09:43
  167 +SC-62159,11/03/2020 09:49
  168 +SC-62130,11/03/2020 09:51
  169 +SC-59034,11/03/2020 09:51
  170 +SC-61092,11/03/2020 09:53
  171 +SC-62136,11/03/2020 09:53
  172 +SC-59034,11/03/2020 09:54
  173 +SC-61092,11/03/2020 09:54
  174 +SC-61114,11/03/2020 09:55
  175 +SC-57019,11/03/2020 09:57
  176 +SC-62127,11/03/2020 09:59
  177 +SC-59051,11/03/2020 10:06
  178 +SC-62139,11/03/2020 10:08
  179 +SC-50005,11/03/2020 10:08
  180 +SC-50005,11/03/2020 10:08
  181 +SC-59042,11/03/2020 10:10
  182 +SC-59042,11/03/2020 10:10
  183 +SC-59042,11/03/2020 10:12
  184 +SC-59042,11/03/2020 10:13
  185 +SC-62153,11/03/2020 10:19
  186 +SC-58024,11/03/2020 10:20
  187 +SC-62151,11/03/2020 10:20
  188 +SC-61092,11/03/2020 10:20
  189 +SC-60058,11/03/2020 10:24
  190 +SC-58024,11/03/2020 10:25
  191 +SC-50001,11/03/2020 10:39
  192 +SC-50001,11/03/2020 10:39
  193 +SC-50001,11/03/2020 10:39
  194 +SC-62145,11/03/2020 10:40
  195 +TSD-60002,11/03/2020 10:41
  196 +SC-59038,11/03/2020 10:42
  197 +SC-56018,11/03/2020 10:42
  198 +SC-59038,11/03/2020 10:43
  199 +SC-55013,11/03/2020 11:01
  200 +SC-56018,11/03/2020 11:08
  201 +SC-61122,11/03/2020 11:14
  202 +SC-60071,11/03/2020 11:16
  203 +TSD-61003,11/03/2020 11:28
  204 +SC-63163,11/03/2020 11:44
  205 +SC-61092,11/03/2020 11:45
  206 +SC-61088,11/03/2020 11:48
  207 +SC-59033,11/03/2020 11:49
  208 +SC-61088,11/03/2020 11:50
  209 +SC-50006,11/03/2020 11:50
  210 +SC-50001,11/03/2020 11:51
  211 +SC-61122,11/03/2020 11:51
  212 +SC-50004,11/03/2020 11:54
  213 +SC-56018,11/03/2020 11:55
  214 +SC-58022,11/03/2020 11:56
  215 +SC-61116,11/03/2020 11:56
  216 +SC-62131,11/03/2020 11:56
  217 +SC-59037,11/03/2020 11:57
  218 +SC-61118,11/03/2020 11:57
  219 +SC-60073,11/03/2020 11:58
  220 +SC-59043,11/03/2020 12:02
  221 +SC-61092,11/03/2020 12:02
  222 +SC-60070,11/03/2020 12:03
  223 +SC-59038,11/03/2020 12:03
  224 +SC-62151,11/03/2020 12:03
  225 +SC-62149,11/03/2020 12:04
  226 +SC-59038,11/03/2020 12:04
  227 +SC-60076,11/03/2020 12:06
  228 +SC-58027,11/03/2020 12:06
  229 +SC-61102,11/03/2020 12:08
  230 +SC-60076,11/03/2020 12:09
  231 +SC-53011,11/03/2020 12:13
  232 +SC-50005,11/03/2020 12:25
  233 +SC-62151,11/03/2020 12:33
  234 +SC-50001,11/03/2020 12:35
  235 +SC-50006,11/03/2020 12:36
  236 +SC-62129,11/03/2020 12:37
  237 +SC-61088,11/03/2020 12:37
  238 +SC-58025,11/03/2020 12:37
  239 +SC-59034,11/03/2020 12:38
  240 +SC-62136,11/03/2020 12:39
  241 +SC-58027,11/03/2020 12:40
  242 +SC-61088,11/03/2020 12:41
  243 +SC-62136,11/03/2020 12:44
  244 +SC-59037,11/03/2020 12:46
  245 +SC-62149,11/03/2020 12:47
  246 +SC-60076,11/03/2020 12:48
  247 +SC-61092,11/03/2020 12:49
  248 +SC-61102,11/03/2020 12:49
  249 +SC-60070,11/03/2020 12:54
  250 +SC-62154,11/03/2020 12:54
  251 +SC-61096,11/03/2020 12:55
  252 +SC-60055,11/03/2020 12:57
  253 +SC-61096,11/03/2020 13:01
  254 +SC-60071,11/03/2020 13:01
  255 +SC-61098,11/03/2020 13:02
  256 +SC-59038,11/03/2020 13:02
  257 +SC-60067,11/03/2020 13:02
  258 +SC-60076,11/03/2020 13:05
  259 +SC-59043,11/03/2020 13:07
  260 +SC-62143,11/03/2020 13:08
  261 +SC-61118,11/03/2020 13:08
  262 +SC-58026,11/03/2020 13:08
  263 +SC-61102,11/03/2020 13:09
  264 +SC-59035,11/03/2020 13:10
  265 +SC-50004,11/03/2020 13:11
  266 +SC-60071,11/03/2020 13:14
  267 +SC-61123,11/03/2020 13:16
  268 +SC-59037,11/03/2020 13:18
  269 +SC-59037,11/03/2020 13:19
  270 +SC-50005,11/03/2020 13:22
  271 +SC-50005,11/03/2020 13:24
  272 +SC-63162,11/03/2020 13:25
  273 +SC-55015,11/03/2020 13:26
  274 +SC-56018,11/03/2020 13:32
  275 +SC-61123,11/03/2020 13:34
  276 +SC-56018,11/03/2020 13:39
  277 +SC-60069,11/03/2020 13:40
  278 +SC-62128,11/03/2020 13:46
  279 +TSD-61003,11/03/2020 13:47
  280 +SC-60076,11/03/2020 13:58
  281 +TSD-60002,11/03/2020 13:59
... ...
pom.xml 0 → 100644
  1 +++ a/pom.xml
... ... @@ -0,0 +1,25 @@
  1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3 + <modelVersion>4.0.0</modelVersion>
  4 +
  5 + <groupId>sc</groupId>
  6 + <artifactId>diaryFinger</artifactId>
  7 + <version>0.0.1-SNAPSHOT</version>
  8 + <packaging>jar</packaging>
  9 +
  10 + <name>diaryFinger</name>
  11 + <url>http://maven.apache.org</url>
  12 +
  13 + <properties>
  14 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  15 + </properties>
  16 +
  17 + <dependencies>
  18 + <dependency>
  19 + <groupId>junit</groupId>
  20 + <artifactId>junit</artifactId>
  21 + <version>3.8.1</version>
  22 + <scope>test</scope>
  23 + </dependency>
  24 + </dependencies>
  25 +</project>
... ...
src/main/java/sc/diaryFinger/App.java 0 → 100644
  1 +++ a/src/main/java/sc/diaryFinger/App.java
... ... @@ -0,0 +1,202 @@
  1 +package sc.diaryFinger;
  2 +
  3 +import java.io.BufferedReader;
  4 +import java.io.File;
  5 +import java.io.FileReader;
  6 +import java.io.FileWriter;
  7 +import java.io.IOException;
  8 +import java.sql.Connection;
  9 +import java.sql.DriverManager;
  10 +import java.sql.ResultSet;
  11 +import java.sql.SQLException;
  12 +import java.sql.Statement;
  13 +import java.text.SimpleDateFormat;
  14 +import java.util.ArrayList;
  15 +import java.util.Arrays;
  16 +import java.util.Date;
  17 +import java.util.List;
  18 +
  19 +
  20 +/**
  21 + * Hello world!
  22 + *
  23 + */
  24 +public class App
  25 +{
  26 + public static void main( String[] args )
  27 + {
  28 +// System.out.println( "Hello World!" );
  29 +
  30 +
  31 + String connection = "jdbc:sqlserver://10.1.2.9:1443;integratedSecurity=true;databaseName=Pm2014_SU;user=sa;password=";
  32 + List<ArrayList<String>> data = new ArrayList();
  33 +
  34 +
  35 +// String formatDate = "dd-MM-yyyy_HHmm";
  36 +// String formatQuery = "MM-dd-yyyy";
  37 +// String checkDay = "DAY(GETDATE())";
  38 +// String checkMonth = "MONTH(GETDATE())";
  39 +// String checkYear = "YEAR(GETDATE())";
  40 + String checkDay = "dd";
  41 + String checkMonth = "MM";
  42 + String checkYear = "yyyy";
  43 + switch (args.length) {
  44 + case 1:
  45 + checkDay = args[0];
  46 +// formatDate = checkDay+"-MM-yyyy_HHmm";
  47 +// formatQuery = "MM-dd-yyyy";
  48 + break;
  49 + case 2:
  50 + checkDay = args[0];
  51 + checkMonth = args[1];
  52 +// formatDate = checkDay+"-"+checkMonth+"-yyyy_HHmm";
  53 +// formatQuery = "MM-dd-yyyy";
  54 + break;
  55 + case 3:
  56 + checkDay = args[0];
  57 + checkMonth = args[1];
  58 + checkYear = args[2];
  59 +// formatDate = checkDay+"-"+checkMonth+"-"+checkYear+"_HHmm";
  60 +// formatQuery = "MM-dd-yyyy";
  61 + break;
  62 + }
  63 +
  64 + String formatDate = checkDay+"-"+checkMonth+"-"+checkYear+"_HHmm";
  65 + String formatQuery = checkMonth+"-"+checkDay+"-"+checkYear;
  66 +
  67 + Date date = new Date();
  68 + SimpleDateFormat formatter = new SimpleDateFormat(formatDate);
  69 + SimpleDateFormat formatterQuery = new SimpleDateFormat(formatQuery);
  70 + String fileName = "c:/empeoTime/"+formatter.format(date)+".csv";
  71 + System.out.println(fileName);
  72 +
  73 + try {
  74 + //readconfig
  75 + connection = readconfig();
  76 +
  77 + //connect db and query
  78 +// data = connectFinger(connection,checkDay,checkMonth,checkYear);
  79 + data = connectFinger(connection,formatterQuery.format(date));
  80 +
  81 + //write file
  82 + writeFile(data,fileName);
  83 +
  84 + } catch (IOException e) {
  85 + // TODO Auto-generated catch block
  86 + e.printStackTrace();
  87 + }
  88 +
  89 + }
  90 +
  91 +// private static ArrayList<ArrayList<String>> connectFinger(String connection,String checkDay,String checkMonth,String checkYear)
  92 + private static ArrayList<ArrayList<String>> connectFinger(String connection,String formatQuery)
  93 + {
  94 + System.out.println("Try Database Connected.");
  95 + ArrayList<ArrayList<String>> rows = new ArrayList<ArrayList<String>>();
  96 + Connection connect = null;
  97 + Statement s = null;
  98 +
  99 +
  100 + try {
  101 + Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  102 + connect = DriverManager.getConnection(connection);
  103 +// connect = DriverManager.getConnection("jdbc:sqlserver://localhost:1443;integratedSecurity=true;databaseName=Pm2014_SU;user=sa;password=");
  104 +
  105 + if(connect != null){
  106 + System.out.println("Database Connected.");
  107 +
  108 + s = connect.createStatement();
  109 +
  110 + //query
  111 + String sql = "select u.SSN,convert(varchar, CHECKTIME, 103) + ' ' + convert(varchar(5),CHECKTIME,14) as time ";
  112 + sql += "from USERINFO u ";
  113 + sql += "join CHECKINOUT c on c.Badgenumber = u.Badgenumber ";
  114 + sql += "where CHECKTIME between DATEADD(day, -10, convert(datetime, '"+formatQuery+"', 121)) and DATEADD(day, 1, convert(datetime, '"+formatQuery+"', 121))";
  115 +// sql += "where "+checkDay+" = DAY(CHECKTIME) ";
  116 +// sql += "AND "+checkMonth+" = MONTH(CHECKTIME) ";
  117 +// sql += "AND "+checkYear+" = YEAR(CHECKTIME) ";
  118 + sql += "AND (u.SSN LIKE 'TSD%' or u.SSN LIKE 'SC%' ) ";
  119 + sql += "order by CHECKTIME asc ";
  120 +
  121 + System.out.println(sql);
  122 + ResultSet rec = s.executeQuery(sql);
  123 +
  124 +
  125 + while((rec!=null) && (rec.next()))
  126 + {
  127 + System.out.println(rec.getString("SSN")+ " : "+rec.getString("time"));
  128 + ArrayList<String> rowData = new ArrayList<String>();
  129 + rowData.add(rec.getString("SSN"));
  130 + rowData.add(rec.getString("time"));
  131 + rows.add(rowData);
  132 + }
  133 +
  134 +
  135 +
  136 + }
  137 + } catch (Exception e) {
  138 + // TODO Auto-generated catch block
  139 + e.printStackTrace();
  140 + }
  141 +
  142 + try {
  143 + connect.close();
  144 + } catch (SQLException e) {
  145 + // TODO Auto-generated catch block
  146 + e.printStackTrace();
  147 + }
  148 +
  149 + return rows;
  150 + }
  151 +
  152 + private static void writeFile(List<ArrayList<String>> data,String fileName) throws IOException {
  153 + // Our example data
  154 +// List<List<String>> rows = Arrays.asList(
  155 +// Arrays.asList("Jean", "Java"),
  156 +// Arrays.asList("David","Python"),
  157 +// Arrays.asList("Scott", "Node.js")
  158 +// );
  159 +
  160 + FileWriter csvWriter = new FileWriter(fileName);
  161 +// csvWriter.append("Name");
  162 +// csvWriter.append(",");
  163 +// csvWriter.append("Role");
  164 +// csvWriter.append(",");
  165 +// csvWriter.append("Topic");
  166 +// csvWriter.append("\n");
  167 +
  168 + for (List<String> rowData : data) {
  169 + csvWriter.append(String.join(",", rowData));
  170 + csvWriter.append("\n");
  171 + }
  172 +
  173 + csvWriter.flush();
  174 + csvWriter.close();
  175 +
  176 + }
  177 +
  178 + private static String readconfig()
  179 + {
  180 + String connection = "";
  181 + File file = new File("conf/config");
  182 +// File file = new File("conf/config");
  183 + try {
  184 + BufferedReader br = new BufferedReader(new FileReader(file));
  185 + String line;
  186 + //cross 1 line
  187 + br.readLine();
  188 + while ((line = br.readLine()) != null) {
  189 + if(line.contains("connection"))
  190 + connection = (line.substring(line.indexOf("\"")+1, line.lastIndexOf("\"")));
  191 +
  192 + }
  193 + br.close();
  194 + } catch (IOException e) {
  195 + // TODO Auto-generated catch block
  196 + e.printStackTrace();
  197 + }
  198 +
  199 + return connection;
  200 + }
  201 +
  202 +}
... ...
src/test/java/sc/diaryFinger/AppTest.java 0 → 100644
  1 +++ a/src/test/java/sc/diaryFinger/AppTest.java
... ... @@ -0,0 +1,38 @@
  1 +package sc.diaryFinger;
  2 +
  3 +import junit.framework.Test;
  4 +import junit.framework.TestCase;
  5 +import junit.framework.TestSuite;
  6 +
  7 +/**
  8 + * Unit test for simple App.
  9 + */
  10 +public class AppTest
  11 + extends TestCase
  12 +{
  13 + /**
  14 + * Create the test case
  15 + *
  16 + * @param testName name of the test case
  17 + */
  18 + public AppTest( String testName )
  19 + {
  20 + super( testName );
  21 + }
  22 +
  23 + /**
  24 + * @return the suite of tests being tested
  25 + */
  26 + public static Test suite()
  27 + {
  28 + return new TestSuite( AppTest.class );
  29 + }
  30 +
  31 + /**
  32 + * Rigourous Test :-)
  33 + */
  34 + public void testApp()
  35 + {
  36 + assertTrue( true );
  37 + }
  38 +}
... ...
target/classes/META-INF/MANIFEST.MF 0 → 100644
  1 +++ a/target/classes/META-INF/MANIFEST.MF
... ... @@ -0,0 +1,5 @@
  1 +Manifest-Version: 1.0
  2 +Built-By: Sc
  3 +Build-Jdk: 1.8.0_241
  4 +Created-By: Maven Integration for Eclipse
  5 +
... ...
target/classes/META-INF/maven/sc/diaryFinger/pom.properties 0 → 100644
  1 +++ a/target/classes/META-INF/maven/sc/diaryFinger/pom.properties
... ... @@ -0,0 +1,7 @@
  1 +#Generated by Maven Integration for Eclipse
  2 +#Fri Mar 20 10:28:56 ICT 2020
  3 +version=0.0.1-SNAPSHOT
  4 +groupId=sc
  5 +m2e.projectName=diaryFinger
  6 +m2e.projectLocation=C\:\\Users\\Sc\\eclipse-workspace\\diaryFinger
  7 +artifactId=diaryFinger
... ...
target/classes/META-INF/maven/sc/diaryFinger/pom.xml 0 → 100644
  1 +++ a/target/classes/META-INF/maven/sc/diaryFinger/pom.xml
... ... @@ -0,0 +1,25 @@
  1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3 + <modelVersion>4.0.0</modelVersion>
  4 +
  5 + <groupId>sc</groupId>
  6 + <artifactId>diaryFinger</artifactId>
  7 + <version>0.0.1-SNAPSHOT</version>
  8 + <packaging>jar</packaging>
  9 +
  10 + <name>diaryFinger</name>
  11 + <url>http://maven.apache.org</url>
  12 +
  13 + <properties>
  14 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  15 + </properties>
  16 +
  17 + <dependencies>
  18 + <dependency>
  19 + <groupId>junit</groupId>
  20 + <artifactId>junit</artifactId>
  21 + <version>3.8.1</version>
  22 + <scope>test</scope>
  23 + </dependency>
  24 + </dependencies>
  25 +</project>
... ...
target/classes/sc/diaryFinger/App.class 0 → 100644
No preview for this file type
target/test-classes/sc/diaryFinger/AppTest.class 0 → 100644
No preview for this file type