PAYAPI基板
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..63177e3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,30 @@
+HELP.md
+.gradle
+/build/
+!gradle/wrapper/gradle-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+/out/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..dc115a2
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,47 @@
+plugins {
+    id 'org.jetbrains.kotlin.plugin.jpa' version '1.2.41'
+    id 'org.springframework.boot' version '2.1.3.RELEASE'
+    id 'war'
+    id 'org.jetbrains.kotlin.jvm' version '1.2.41'
+    id 'org.jetbrains.kotlin.plugin.spring' version '1.2.41'
+}
+
+apply plugin: 'io.spring.dependency-management'
+
+group = 'com.supwisdom'
+version = '0.0.1-SNAPSHOT'
+sourceCompatibility = '1.8'
+
+repositories {
+    mavenCentral()
+}
+
+dependencies {
+    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
+    implementation 'org.springframework.boot:spring-boot-starter-web'
+    implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
+    implementation 'org.jetbrains.kotlin:kotlin-reflect'
+    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
+    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
+    testImplementation 'org.springframework.boot:spring-boot-starter-test'
+
+    compile group: 'javax.servlet', name: 'jstl', version: '1.2'
+    compile group: 'taglibs', name: 'standard', version: '1.1.2'
+    compile group: 'javax.servlet.jsp', name: 'jsp-api', version: '2.1'
+    compile group: 'log4j', name: 'log4j', version: '1.2.16'
+    compile files ('libs/ojdbc6.jar')
+}
+
+compileKotlin {
+    kotlinOptions {
+        freeCompilerArgs = ['-Xjsr305=strict']
+        jvmTarget = '1.8'
+    }
+}
+
+compileTestKotlin {
+    kotlinOptions {
+        freeCompilerArgs = ['-Xjsr305=strict']
+        jvmTarget = '1.8'
+    }
+}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..87b738c
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..7e5d2a8
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue Mar 26 15:30:49 CST 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..af6708f
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..0f8d593
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off

+@rem ##########################################################################

+@rem

+@rem  Gradle startup script for Windows

+@rem

+@rem ##########################################################################

+

+@rem Set local scope for the variables with windows NT shell

+if "%OS%"=="Windows_NT" setlocal

+

+set DIRNAME=%~dp0

+if "%DIRNAME%" == "" set DIRNAME=.

+set APP_BASE_NAME=%~n0

+set APP_HOME=%DIRNAME%

+

+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.

+set DEFAULT_JVM_OPTS="-Xmx64m"

+

+@rem Find java.exe

+if defined JAVA_HOME goto findJavaFromJavaHome

+

+set JAVA_EXE=java.exe

+%JAVA_EXE% -version >NUL 2>&1

+if "%ERRORLEVEL%" == "0" goto init

+

+echo.

+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

+echo.

+echo Please set the JAVA_HOME variable in your environment to match the

+echo location of your Java installation.

+

+goto fail

+

+:findJavaFromJavaHome

+set JAVA_HOME=%JAVA_HOME:"=%

+set JAVA_EXE=%JAVA_HOME%/bin/java.exe

+

+if exist "%JAVA_EXE%" goto init

+

+echo.

+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%

+echo.

+echo Please set the JAVA_HOME variable in your environment to match the

+echo location of your Java installation.

+

+goto fail

+

+:init

+@rem Get command-line arguments, handling Windows variants

+

+if not "%OS%" == "Windows_NT" goto win9xME_args

+

+:win9xME_args

+@rem Slurp the command line arguments.

+set CMD_LINE_ARGS=

+set _SKIP=2

+

+:win9xME_args_slurp

+if "x%~1" == "x" goto execute

+

+set CMD_LINE_ARGS=%*

+

+:execute

+@rem Setup the command line

+

+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

+

+@rem Execute Gradle

+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

+

+:end

+@rem End local scope for the variables with windows NT shell

+if "%ERRORLEVEL%"=="0" goto mainEnd

+

+:fail

+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of

+rem the _cmd.exe /c_ return code!

+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1

+exit /b 1

+

+:mainEnd

+if "%OS%"=="Windows_NT" endlocal

+

+:omega

diff --git a/libs/ojdbc6.jar b/libs/ojdbc6.jar
new file mode 100644
index 0000000..767eba7
--- /dev/null
+++ b/libs/ojdbc6.jar
Binary files differ
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..cbac435
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,6 @@
+pluginManagement {
+    repositories {
+        gradlePluginPortal()
+    }
+}
+rootProject.name = 'dlpay'
diff --git a/src/main/kotlin/com/supwisdom/dlpay/DlpayApplication.kt b/src/main/kotlin/com/supwisdom/dlpay/DlpayApplication.kt
new file mode 100644
index 0000000..a9cea45
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/DlpayApplication.kt
@@ -0,0 +1,16 @@
+package com.supwisdom.dlpay
+
+import org.springframework.boot.autoconfigure.SpringBootApplication
+import org.springframework.boot.runApplication
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.PropertySource
+
+
+@ComponentScan("com.supwisdom.dlpay")
+@SpringBootApplication
+@PropertySource("file:\${catalina.home}/conf/dlpay_config.properties")
+class DlpayApplication
+
+fun main(args: Array<String>) {
+	runApplication<DlpayApplication>(*args)
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/ServletInitializer.kt b/src/main/kotlin/com/supwisdom/dlpay/ServletInitializer.kt
new file mode 100644
index 0000000..65545c7
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/ServletInitializer.kt
@@ -0,0 +1,12 @@
+package com.supwisdom.dlpay
+
+import org.springframework.boot.builder.SpringApplicationBuilder
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
+
+class ServletInitializer : SpringBootServletInitializer() {
+
+	override fun configure(application: SpringApplicationBuilder): SpringApplicationBuilder {
+		return application.sources(DlpayApplication::class.java)
+	}
+
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/consume/bean/BaseResp.java b/src/main/kotlin/com/supwisdom/dlpay/consume/bean/BaseResp.java
new file mode 100644
index 0000000..8c4c8a1
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/consume/bean/BaseResp.java
@@ -0,0 +1,31 @@
+package com.supwisdom.dlpay.consume.bean;
+
+public class BaseResp {
+  private String retcode;
+  private String retmsg;
+  private Object data;
+
+  public String getRetcode() {
+    return retcode;
+  }
+
+  public void setRetcode(String retcode) {
+    this.retcode = retcode;
+  }
+
+  public String getRetmsg() {
+    return retmsg;
+  }
+
+  public void setRetmsg(String retmsg) {
+    this.retmsg = retmsg;
+  }
+
+  public Object getData() {
+    return data;
+  }
+
+  public void setData(Object data) {
+    this.data = data;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/consume/controller/TestAction.java b/src/main/kotlin/com/supwisdom/dlpay/consume/controller/TestAction.java
new file mode 100644
index 0000000..4883502
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/consume/controller/TestAction.java
@@ -0,0 +1,26 @@
+package com.supwisdom.dlpay.consume.controller;
+
+import com.supwisdom.dlpay.consume.bean.BaseResp;
+import com.supwisdom.dlpay.framework.data.SystemDateTime;
+import com.supwisdom.dlpay.framework.service.SystemUtilService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController //将所有方法标识@ResponseBody注解
+@RequestMapping("/test")
+public class TestAction {
+  @Autowired
+  private SystemUtilService systemUtilService;
+
+  @RequestMapping("/demo")
+  public BaseResp test() {
+    SystemDateTime dt = systemUtilService.getSysdatetime();
+
+    BaseResp resp = new BaseResp();
+    resp.setRetcode("0");
+    resp.setRetmsg("OK");
+    resp.setData("hostdate=["+dt.getHostdate()+"],hosttime=["+dt.getHosttime()+"],hostdatetime=["+dt.getHostdatetime()+"],date=["+dt.getSysdate()+"]");
+    return resp;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/consume/dao/DpsdtlDao.java b/src/main/kotlin/com/supwisdom/dlpay/consume/dao/DpsdtlDao.java
new file mode 100644
index 0000000..0f59ce8
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/consume/dao/DpsdtlDao.java
@@ -0,0 +1,26 @@
+package com.supwisdom.dlpay.consume.dao;
+
+import com.supwisdom.dlpay.consume.domain.TDpsdtl;
+import com.supwisdom.dlpay.framework.data.VoucherTemp;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@Repository
+public interface DpsdtlDao extends JpaRepository<TDpsdtl, String> {
+
+  @Query(value = "select a.drsubjno,a.crsubjno,a.summary,count(t.refno) as transcnt,sum(t.dpsamt) as transamt " +
+      "from tb_dpsdtl t left join tb_transtype a on t.transtype=a.transtype " +
+      "where t.status='success' and t.accdate=:settledate " +
+      "group by a.drsubjno,a.crsubjno,a.summary ", nativeQuery = true)
+  List<VoucherTemp> getVoucherData(@RequestParam("settledate") String settledate);
+
+  @Query(value = "select a.drsubjno,a.crsubjno,a.summary,count(t.refno) as transcnt,sum(t.feeamt) as transamt " +
+      "from tb_dpsdtl t left join tb_feetype_config a on t.feetype=a.feetype and t.paytype=a.paytype " +
+      "where t.status='success' and t.feetype!='none' and t.accdate=:settledate " +
+      "group by a.drsubjno,a.crsubjno,a.summary ", nativeQuery = true)
+  List<VoucherTemp> getFeeVoucherData(@RequestParam("settledate") String settledate);
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/consume/dao/TransdtlDao.java b/src/main/kotlin/com/supwisdom/dlpay/consume/dao/TransdtlDao.java
new file mode 100644
index 0000000..a7c2c4f
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/consume/dao/TransdtlDao.java
@@ -0,0 +1,25 @@
+package com.supwisdom.dlpay.consume.dao;
+
+import com.supwisdom.dlpay.consume.domain.TTransdtl;
+import com.supwisdom.dlpay.framework.data.VoucherTemp;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@Repository
+public interface TransdtlDao extends JpaRepository<TTransdtl, String> {
+  @Query(value="select a.drsubjno,a.crsubjno,a.summary,t.shopaccno,count(t.refno) as transcnt,sum(t.paidamt) as transamt " +
+      "from tb_transdtl t left join tb_transtype a on t.transtype=a.transtype " +
+      "where t.status='success' and t.accdate=:settledate " +
+      "group by a.drsubjno,a.crsubjno,a.summary,t.shopaccno ", nativeQuery = true)
+  List<VoucherTemp> getVouhcerData(@RequestParam("settledate") String settledate);
+
+  @Query(value="select a.drsubjno,a.crsubjno,a.summary,t.shopaccno,count(t.refno) as transcnt,sum(t.feeamt) as transamt " +
+      "from tb_transdtl t left join tb_feetype_config a on t.feetype=a.feetype and t.paytype=a.paytype " +
+      "where t.status='success' and t.feetype!='none' and t.accdate=:settledate " +
+      "group by a.drsubjno,a.crsubjno,a.summary,t.shopaccno ", nativeQuery = true)
+  List<VoucherTemp> getFeeVoucherData(@RequestParam("settledate") String settledate);
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TAccount.java b/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TAccount.java
new file mode 100644
index 0000000..cdb9cab
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TAccount.java
@@ -0,0 +1,233 @@
+package com.supwisdom.dlpay.consume.domain;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_ACCOUNT")
+public class TAccount {
+  @Id
+  @GenericGenerator(name = "idGenerator", strategy = "uuid")
+  @GeneratedValue(generator = "idGenerator")
+  @Column(name = "ACCNO", nullable = false, length = 32)
+  private String accno; //账号
+
+  @Column(name="ACCNAME", length = 100)
+  private String accname; //账户名
+
+  @Column(name="SUBJNO", length = 10)
+  private String subjno; //科目号
+
+  @Column(name="USERID", nullable = false, length = 32)
+  private String userid; //用户ID
+
+  @Column(name="STATUS", nullable = false, length = 20)
+  private String status; //状态:normal-正常;closed-注销;locked-冻结
+
+  @Column(name="BALANCE", nullable = false, precision = 15, scale = 2)
+  private Double balance; //总余额
+
+  @Column(name="AVAILBAL", nullable = false, precision = 15, scale = 2)
+  private Double availbal; //可用余额
+
+  @Column(name="FROZEBAL", nullable = false, precision = 15, scale = 2)
+  private Double frozebal; //冻结金额
+
+  @Column(name="LOWFREE_FLAG", nullable = false, precision = 1, scale = 0)
+  private Boolean lowfreeFlag; //低额免密开关
+
+  @Column(name="LOWFREE_LIMIT", precision = 9, scale = 2)
+  private Double lowfreeLimit; //免密额度
+
+  @Column(name="DAYLIMIT", precision = 9, scale = 2)
+  private Double daylimit; // 日累计消费额度
+
+  @Column(name="MAXBAL",  precision = 15, scale = 2)
+  private Double maxbal; // 最大余额限制
+
+  @Column(name = "LASTTRANSDATE", length = 8)
+  private String lasttransdate; //最后交易日期
+
+  @Column(name="LASTDAY_TRANSAMT",  precision = 9, scale = 2)
+  private Double lastdayTransamt; //最后一天消费金额
+
+  @Column(name="LASTDAY_DPSAMT",  precision = 9, scale = 2)
+  private Double lastdayDpsamt; //最后一天充值金额
+
+  @Column(name="TAC",  length = 32)
+  private String tac; //校验
+
+  @Column(name="OPENDATE", nullable = false, length = 8)
+  private String opendate;
+
+  @Column(name = "CLOSEDATE", length = 8)
+  private String closedate;
+
+  public TAccount() {
+  }
+
+  public TAccount(String accname, String subjno, String userid, String status, Double balance, Double availbal, Double frozebal, Boolean lowfreeFlag, Double lowfreeLimit, Double daylimit, Double maxbal, String lasttransdate, Double lastdayTransamt, Double lastdayDpsamt, String tac, String opendate, String closedate) {
+    this.accname = accname;
+    this.subjno = subjno;
+    this.userid = userid;
+    this.status = status;
+    this.balance = balance;
+    this.availbal = availbal;
+    this.frozebal = frozebal;
+    this.lowfreeFlag = lowfreeFlag;
+    this.lowfreeLimit = lowfreeLimit;
+    this.daylimit = daylimit;
+    this.maxbal = maxbal;
+    this.lasttransdate = lasttransdate;
+    this.lastdayTransamt = lastdayTransamt;
+    this.lastdayDpsamt = lastdayDpsamt;
+    this.tac = tac;
+    this.opendate = opendate;
+    this.closedate = closedate;
+  }
+
+  public String getAccno() {
+    return accno;
+  }
+
+  public void setAccno(String accno) {
+    this.accno = accno;
+  }
+
+  public String getAccname() {
+    return accname;
+  }
+
+  public void setAccname(String accname) {
+    this.accname = accname;
+  }
+
+  public String getSubjno() {
+    return subjno;
+  }
+
+  public void setSubjno(String subjno) {
+    this.subjno = subjno;
+  }
+
+  public String getUserid() {
+    return userid;
+  }
+
+  public void setUserid(String userid) {
+    this.userid = userid;
+  }
+
+  public String getStatus() {
+    return status;
+  }
+
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  public Double getBalance() {
+    return balance;
+  }
+
+  public void setBalance(Double balance) {
+    this.balance = balance;
+  }
+
+  public Double getAvailbal() {
+    return availbal;
+  }
+
+  public void setAvailbal(Double availbal) {
+    this.availbal = availbal;
+  }
+
+  public Double getFrozebal() {
+    return frozebal;
+  }
+
+  public void setFrozebal(Double frozebal) {
+    this.frozebal = frozebal;
+  }
+
+  public Boolean getLowfreeFlag() {
+    return lowfreeFlag;
+  }
+
+  public void setLowfreeFlag(Boolean lowfreeFlag) {
+    this.lowfreeFlag = lowfreeFlag;
+  }
+
+  public Double getLowfreeLimit() {
+    return lowfreeLimit;
+  }
+
+  public void setLowfreeLimit(Double lowfreeLimit) {
+    this.lowfreeLimit = lowfreeLimit;
+  }
+
+  public Double getDaylimit() {
+    return daylimit;
+  }
+
+  public void setDaylimit(Double daylimit) {
+    this.daylimit = daylimit;
+  }
+
+  public Double getMaxbal() {
+    return maxbal;
+  }
+
+  public void setMaxbal(Double maxbal) {
+    this.maxbal = maxbal;
+  }
+
+  public String getLasttransdate() {
+    return lasttransdate;
+  }
+
+  public void setLasttransdate(String lasttransdate) {
+    this.lasttransdate = lasttransdate;
+  }
+
+  public Double getLastdayTransamt() {
+    return lastdayTransamt;
+  }
+
+  public void setLastdayTransamt(Double lastdayTransamt) {
+    this.lastdayTransamt = lastdayTransamt;
+  }
+
+  public Double getLastdayDpsamt() {
+    return lastdayDpsamt;
+  }
+
+  public void setLastdayDpsamt(Double lastdayDpsamt) {
+    this.lastdayDpsamt = lastdayDpsamt;
+  }
+
+  public String getTac() {
+    return tac;
+  }
+
+  public void setTac(String tac) {
+    this.tac = tac;
+  }
+
+  public String getOpendate() {
+    return opendate;
+  }
+
+  public void setOpendate(String opendate) {
+    this.opendate = opendate;
+  }
+
+  public String getClosedate() {
+    return closedate;
+  }
+
+  public void setClosedate(String closedate) {
+    this.closedate = closedate;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TDpsdtl.java b/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TDpsdtl.java
new file mode 100644
index 0000000..958a44d
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TDpsdtl.java
@@ -0,0 +1,264 @@
+package com.supwisdom.dlpay.consume.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_DPSDTL")
+public class TDpsdtl {
+  @Id
+  @Column(name="REFNO", nullable = false, length = 32)
+  private String refno;
+
+  @Column(name="ACCDATE", length = 8)
+  private String accdate;
+
+  @Column(name="ACCNO", length = 32)
+  private String accno;
+
+  @Column(name="PAYTYPE", length = 20)
+  private String paytype; //充值类型 cash;alipay;wechat;等
+
+  @Column(name="PAYINFO", length = 200)
+  private String payinfo; //记录支付信息备用字段
+
+  @Column(name="AMOUNT", precision = 9, scale = 2)
+  private Double amount; //订单金额
+
+  @Column(name="DPSAMT", precision = 9, scale = 2)
+  private Double dpsamt; //实际充值金额
+
+  @Column(name = "FEETYPE", length = 20)
+  private String feetype = "none"; //费用类型
+
+  @Column(name = "FEEAMT", precision = 9, scale = 2)
+  private Double feeamt = 0D; //费用
+
+  @Column(name="STATUS", length = 20)
+  private String status;
+
+  @Column(name="BEFBAL", precision = 9, scale = 2)
+  private Double befbal;
+
+  @Column(name="AFTBAL", precision = 9, scale = 2)
+  private Double aftbal;
+
+  @Column(name = "TRANSCODE", precision = 4)
+  private Integer transcode;
+
+  @Column(name="TRANSTYPE", precision = 4)
+  private Integer transtype;
+
+  @Column(name="TRANSDESC", length = 240)
+  private String transdesc;
+
+  @Column(name="CREATETIME", length = 14)
+  private String createtime; //创建时间
+
+  @Column(name="ENDTIME", length = 14)
+  private String endtime; //支付时间
+
+  @Column(name="REMARK", length = 200)
+  private String remark;
+
+  @Column(name="OPERID", precision = 9)
+  private Integer operid;
+
+  @Column(name="OUTTRADENO", length = 60)
+  private String outtradeno; //外部流水号
+
+  @Column(name = "TRANSDATE", length = 8)
+  private String transdate;
+
+  @Column(name = "TRANSTIME", length = 6)
+  private String transtime;
+
+  @Column(name="REVFLAG", precision = 1)
+  private Integer revflag=0;
+
+  public String getRefno() {
+    return refno;
+  }
+
+  public void setRefno(String refno) {
+    this.refno = refno;
+  }
+
+  public String getAccdate() {
+    return accdate;
+  }
+
+  public void setAccdate(String accdate) {
+    this.accdate = accdate;
+  }
+
+  public String getAccno() {
+    return accno;
+  }
+
+  public void setAccno(String accno) {
+    this.accno = accno;
+  }
+
+  public String getPaytype() {
+    return paytype;
+  }
+
+  public void setPaytype(String paytype) {
+    this.paytype = paytype;
+  }
+
+  public String getPayinfo() {
+    return payinfo;
+  }
+
+  public void setPayinfo(String payinfo) {
+    this.payinfo = payinfo;
+  }
+
+  public Double getAmount() {
+    return amount;
+  }
+
+  public void setAmount(Double amount) {
+    this.amount = amount;
+  }
+
+  public Double getDpsamt() {
+    return dpsamt;
+  }
+
+  public void setDpsamt(Double dpsamt) {
+    this.dpsamt = dpsamt;
+  }
+
+  public String getFeetype() {
+    return feetype;
+  }
+
+  public void setFeetype(String feetype) {
+    this.feetype = feetype;
+  }
+
+  public Double getFeeamt() {
+    return feeamt;
+  }
+
+  public void setFeeamt(Double feeamt) {
+    this.feeamt = feeamt;
+  }
+
+  public Double getBefbal() {
+    return befbal;
+  }
+
+  public void setBefbal(Double befbal) {
+    this.befbal = befbal;
+  }
+
+  public Double getAftbal() {
+    return aftbal;
+  }
+
+  public void setAftbal(Double aftbal) {
+    this.aftbal = aftbal;
+  }
+
+  public String getStatus() {
+    return status;
+  }
+
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  public Integer getTranscode() {
+    return transcode;
+  }
+
+  public void setTranscode(Integer transcode) {
+    this.transcode = transcode;
+  }
+
+  public Integer getTranstype() {
+    return transtype;
+  }
+
+  public void setTranstype(Integer transtype) {
+    this.transtype = transtype;
+  }
+
+  public String getTransdesc() {
+    return transdesc;
+  }
+
+  public void setTransdesc(String transdesc) {
+    this.transdesc = transdesc;
+  }
+
+  public String getCreatetime() {
+    return createtime;
+  }
+
+  public void setCreatetime(String createtime) {
+    this.createtime = createtime;
+  }
+
+  public String getEndtime() {
+    return endtime;
+  }
+
+  public void setEndtime(String endtime) {
+    this.endtime = endtime;
+  }
+
+  public String getRemark() {
+    return remark;
+  }
+
+  public void setRemark(String remark) {
+    this.remark = remark;
+  }
+
+  public Integer getOperid() {
+    return operid;
+  }
+
+  public void setOperid(Integer operid) {
+    this.operid = operid;
+  }
+
+  public String getOuttradeno() {
+    return outtradeno;
+  }
+
+  public void setOuttradeno(String outtradeno) {
+    this.outtradeno = outtradeno;
+  }
+
+  public String getTransdate() {
+    return transdate;
+  }
+
+  public void setTransdate(String transdate) {
+    this.transdate = transdate;
+  }
+
+  public String getTranstime() {
+    return transtime;
+  }
+
+  public void setTranstime(String transtime) {
+    this.transtime = transtime;
+  }
+
+  public Integer getRevflag() {
+    return revflag;
+  }
+
+  public void setRevflag(Integer revflag) {
+    this.revflag = revflag;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TPerson.java b/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TPerson.java
new file mode 100644
index 0000000..bc08331
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TPerson.java
@@ -0,0 +1,174 @@
+package com.supwisdom.dlpay.consume.domain;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_PERSON")
+public class TPerson {
+  @Id
+  @GenericGenerator(name = "idGenerator", strategy = "uuid")
+  @GeneratedValue(generator = "idGenerator")
+  @Column(name = "USERID", nullable = false, length = 32)
+  private String userid;
+
+  @Column(name = "NAME", length = 200)
+  private String name;
+
+  @Column(name = "SEX", length = 10)
+  private String sex;
+
+  @Column(name = "IDTYPE", length = 20)
+  private String idtype;
+
+  @Column(name = "IDNO", length = 30)
+  private String idno;
+
+  @Column(name = "COUNTRY", length = 3)
+  private String country;
+
+  @Column(name = "NATION", length = 3)
+  private String nation;
+
+  @Column(name = "EMAIL", length = 60)
+  private String email;
+
+  @Column(name = "TEL", length = 20)
+  private String tel;
+
+  @Column(name = "MOBILE", length = 30)
+  private String mobile;
+
+  @Column(name = "ADDR", length = 240)
+  private String addr;
+
+  @Column(name = "ZIPCODE", length = 10)
+  private String zipcode;
+
+  @Column(name = "LASTSAVED", length = 14)
+  private String lastsaved;
+
+  public TPerson() {
+  }
+
+  public TPerson(String userid, String name, String sex, String idtype, String idno, String country, String nation, String email, String tel, String mobile, String addr, String zipcode, String lastsaved) {
+    this.userid = userid;
+    this.name = name;
+    this.sex = sex;
+    this.idtype = idtype;
+    this.idno = idno;
+    this.country = country;
+    this.nation = nation;
+    this.email = email;
+    this.tel = tel;
+    this.mobile = mobile;
+    this.addr = addr;
+    this.zipcode = zipcode;
+    this.lastsaved = lastsaved;
+  }
+
+  public String getUserid() {
+    return userid;
+  }
+
+  public void setUserid(String userid) {
+    this.userid = userid;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getSex() {
+    return sex;
+  }
+
+  public void setSex(String sex) {
+    this.sex = sex;
+  }
+
+  public String getIdtype() {
+    return idtype;
+  }
+
+  public void setIdtype(String idtype) {
+    this.idtype = idtype;
+  }
+
+  public String getIdno() {
+    return idno;
+  }
+
+  public void setIdno(String idno) {
+    this.idno = idno;
+  }
+
+  public String getCountry() {
+    return country;
+  }
+
+  public void setCountry(String country) {
+    this.country = country;
+  }
+
+  public String getNation() {
+    return nation;
+  }
+
+  public void setNation(String nation) {
+    this.nation = nation;
+  }
+
+  public String getEmail() {
+    return email;
+  }
+
+  public void setEmail(String email) {
+    this.email = email;
+  }
+
+  public String getTel() {
+    return tel;
+  }
+
+  public void setTel(String tel) {
+    this.tel = tel;
+  }
+
+  public String getMobile() {
+    return mobile;
+  }
+
+  public void setMobile(String mobile) {
+    this.mobile = mobile;
+  }
+
+  public String getAddr() {
+    return addr;
+  }
+
+  public void setAddr(String addr) {
+    this.addr = addr;
+  }
+
+  public String getZipcode() {
+    return zipcode;
+  }
+
+  public void setZipcode(String zipcode) {
+    this.zipcode = zipcode;
+  }
+
+  public String getLastsaved() {
+    return lastsaved;
+  }
+
+  public void setLastsaved(String lastsaved) {
+    this.lastsaved = lastsaved;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TTransdtl.java b/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TTransdtl.java
new file mode 100644
index 0000000..309a122
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/consume/domain/TTransdtl.java
@@ -0,0 +1,264 @@
+package com.supwisdom.dlpay.consume.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_TRANSDTL")
+public class TTransdtl {
+  @Id
+  @Column(name = "REFNO", nullable = false, length = 32)
+  private String refno;
+
+  @Column(name = "ACCDATE", length = 8)
+  private String accdate;
+
+  @Column(name = "ACCNO", length = 32)
+  private String accno;
+
+  @Column(name = "PAYTYPE", length = 20)
+  private String paytype; //支付方式 balance,wechat,alipay
+
+  @Column(name = "PAYINFO", length = 200)
+  private String payinfo; //记录支付信息备用字段
+
+  @Column(name = "AMOUNT", precision = 9, scale = 2)
+  private Double amount;
+
+  @Column(name = "PAIDAMT", precision = 9, scale = 2)
+  private Double paidamt;
+
+  @Column(name = "FEETYPE", length = 20)
+  private String feetype="none"; //费用类型
+
+  @Column(name = "FEEAMT", precision = 9, scale = 2)
+  private Double feeamt=0D;  //费用金额
+
+  @Column(name = "STATUS", length = 20)
+  private String status;
+
+  @Column(name = "BEFBAL", precision = 9, scale = 2)
+  private Double befbal;
+
+  @Column(name = "AFTBAL", precision = 9, scale = 2)
+  private Double aftbal;
+
+  @Column(name = "SHOPACCNO", length = 32)
+  private String shopaccno;
+
+  @Column(name = "TRANSCODE", precision = 4)
+  private Integer transcode; //指定交易类型
+
+  @Column(name = "TRANSTYPE", precision = 4)
+  private Integer transtype; //指定借贷双方
+
+  @Column(name = "TRANSDESC", length = 240)
+  private String transdesc;
+
+  @Column(name = "CREATETIME", length = 14)
+  private String createtime;
+
+  @Column(name = "ENDTIME", length = 14)
+  private String endtime;
+
+  @Column(name = "OUTTRADENO", length = 60)
+  private String outtradeno;
+
+  @Column(name = "TRANSDATE", length = 8)
+  private String transdate;
+
+  @Column(name = "TRANSTIME", length = 6)
+  private String transtime;
+
+  @Column(name = "REVFLAG", nullable = false, precision = 1)
+  private Integer revflag = 0;
+
+  @Column(name="REMARK", length = 240)
+  private String remark;
+
+  public String getRefno() {
+    return refno;
+  }
+
+  public void setRefno(String refno) {
+    this.refno = refno;
+  }
+
+  public String getAccdate() {
+    return accdate;
+  }
+
+  public void setAccdate(String accdate) {
+    this.accdate = accdate;
+  }
+
+  public String getAccno() {
+    return accno;
+  }
+
+  public void setAccno(String accno) {
+    this.accno = accno;
+  }
+
+  public String getPaytype() {
+    return paytype;
+  }
+
+  public void setPaytype(String paytype) {
+    this.paytype = paytype;
+  }
+
+  public String getPayinfo() {
+    return payinfo;
+  }
+
+  public void setPayinfo(String payinfo) {
+    this.payinfo = payinfo;
+  }
+
+  public Double getAmount() {
+    return amount;
+  }
+
+  public void setAmount(Double amount) {
+    this.amount = amount;
+  }
+
+  public Double getPaidamt() {
+    return paidamt;
+  }
+
+  public void setPaidamt(Double paidamt) {
+    this.paidamt = paidamt;
+  }
+
+  public String getFeetype() {
+    return feetype;
+  }
+
+  public void setFeetype(String feetype) {
+    this.feetype = feetype;
+  }
+
+  public Double getFeeamt() {
+    return feeamt;
+  }
+
+  public void setFeeamt(Double feeamt) {
+    this.feeamt = feeamt;
+  }
+
+  public String getStatus() {
+    return status;
+  }
+
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  public Double getBefbal() {
+    return befbal;
+  }
+
+  public void setBefbal(Double befbal) {
+    this.befbal = befbal;
+  }
+
+  public Double getAftbal() {
+    return aftbal;
+  }
+
+  public void setAftbal(Double aftbal) {
+    this.aftbal = aftbal;
+  }
+
+  public String getShopaccno() {
+    return shopaccno;
+  }
+
+  public void setShopaccno(String shopaccno) {
+    this.shopaccno = shopaccno;
+  }
+
+  public Integer getTranscode() {
+    return transcode;
+  }
+
+  public void setTranscode(Integer transcode) {
+    this.transcode = transcode;
+  }
+
+  public Integer getTranstype() {
+    return transtype;
+  }
+
+  public void setTranstype(Integer transtype) {
+    this.transtype = transtype;
+  }
+
+  public String getTransdesc() {
+    return transdesc;
+  }
+
+  public void setTransdesc(String transdesc) {
+    this.transdesc = transdesc;
+  }
+
+  public String getCreatetime() {
+    return createtime;
+  }
+
+  public void setCreatetime(String createtime) {
+    this.createtime = createtime;
+  }
+
+  public String getEndtime() {
+    return endtime;
+  }
+
+  public void setEndtime(String endtime) {
+    this.endtime = endtime;
+  }
+
+  public String getOuttradeno() {
+    return outtradeno;
+  }
+
+  public void setOuttradeno(String outtradeno) {
+    this.outtradeno = outtradeno;
+  }
+
+  public String getTransdate() {
+    return transdate;
+  }
+
+  public void setTransdate(String transdate) {
+    this.transdate = transdate;
+  }
+
+  public String getTranstime() {
+    return transtime;
+  }
+
+  public void setTranstime(String transtime) {
+    this.transtime = transtime;
+  }
+
+  public Integer getRevflag() {
+    return revflag;
+  }
+
+  public void setRevflag(Integer revflag) {
+    this.revflag = revflag;
+  }
+
+  public String getRemark() {
+    return remark;
+  }
+
+  public void setRemark(String remark) {
+    this.remark = remark;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/core/DayendSettleTask.java b/src/main/kotlin/com/supwisdom/dlpay/framework/core/DayendSettleTask.java
new file mode 100644
index 0000000..313b5aa
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/core/DayendSettleTask.java
@@ -0,0 +1,106 @@
+package com.supwisdom.dlpay.framework.core;
+
+import com.supwisdom.dlpay.framework.domain.TSettleLog;
+import com.supwisdom.dlpay.framework.domain.TTaskLock;
+import com.supwisdom.dlpay.framework.service.DayendSettleService;
+import com.supwisdom.dlpay.framework.service.SystemUtilService;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class DayendSettleTask {
+  @Autowired
+  private SystemUtilService systemUtilService;
+  @Autowired
+  private DayendSettleService dayendSettleService;
+
+  private TSettleLog settleLog;
+
+  private static final Logger logger = Logger.getLogger(DayendSettleTask.class);
+
+
+  public void doSettleTask() {
+    if (logger.isDebugEnabled()) logger.debug("进入日结算任务!");
+
+    TTaskLock lock = null;
+    try {
+      try {
+        lock = systemUtilService.doLockTask("DAYENDSETTLETASK", 30, "日终结算");
+        if (lock == null) {
+          if (logger.isDebugEnabled()) logger.debug("日终结算正在其他服务器上执行");
+          return;
+        }
+      } catch (Exception e) {
+        return;
+      }
+
+      settleLog = dayendSettleService.doCreateSettleLog(); //记录日志
+
+      //step1: 账户校验
+      long t1 = System.currentTimeMillis();
+      if (!checkAccounts()) {
+        logger.error("账户余额校验出错,退出结算!");
+        return;
+      }
+      long t2 = System.currentTimeMillis();
+      logger.info("===== step1: 日终结算【账户校验】耗时 " + (t2 - t1) + " ms");
+
+      //step2: 对账判断
+      long t3 = System.currentTimeMillis();
+      if(!checkChkfiles()){
+        logger.error("对账未完成,退出结算!");
+        return;
+      }
+      long t4 = System.currentTimeMillis();
+      logger.info("===== step2: 日终结算【对账判断】耗时 " + (t4 - t3) + " ms");
+
+      //step3: 日结
+      long t5 = System.currentTimeMillis();
+      if (!doSettleProcess()) {
+        logger.error("日结出错:" + settleLog.getErrmsg());
+        return;
+      }
+      long t6 = System.currentTimeMillis();
+      logger.info("===== step3: 日终结算【日结】耗时 " + (t6 - t5) + " ms");
+
+
+    } catch (Exception e) {
+      logger.error("日终结算报错:" + (!StringUtil.isEmpty(e.getMessage()) ? e.getMessage() : e.getClass().getName()));
+      e.printStackTrace();
+    } finally {
+      if (null != lock) {
+        lock.setTaskstatus(0);
+        lock.setTasktime(systemUtilService.getSysdatetime().getHostdatetime());
+        systemUtilService.updateTaskLock(lock);
+      }
+    }
+  }
+
+  private boolean checkAccounts(){
+    //TODO: 账户余额校验,生成账户日结表数据
+    return true;
+  }
+
+  private boolean checkChkfiles(){
+    //TODO: 结算前是否要求所有对账完成
+    return true;
+  }
+
+  private boolean doSettleProcess() {
+    try {
+      boolean ret = dayendSettleService.doDayendSettle();
+      if (ret) {
+        dayendSettleService.doUpdateSettleLog(settleLog.update("0", "成功结算"));
+      }
+      return ret;
+    } catch (Exception e) {
+      if (!StringUtil.isEmpty(e.getMessage())) {
+        dayendSettleService.doUpdateSettleLog(settleLog.update("-9", e.getMessage()));
+      } else {
+        e.printStackTrace();
+        dayendSettleService.doUpdateSettleLog(settleLog.update("-8", e.getClass().getName()));
+      }
+      return false;
+    }
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/PeriodDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/PeriodDao.java
new file mode 100644
index 0000000..688df2e
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/PeriodDao.java
@@ -0,0 +1,21 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.domain.TPeriod;
+import com.supwisdom.dlpay.framework.domain.TPeriodPK;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Lock;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.persistence.LockModeType;
+
+@Repository
+public interface PeriodDao extends JpaRepository<TPeriod, TPeriodPK> {
+  @Query(value = "from TPeriod t where t.periodYear=:periodyear and t.periodMonth=:periodmonth ")
+  TPeriod getPeriod(@RequestParam("periodyear") Integer periodyear, @RequestParam("periodmonth") Integer periodmonth);
+
+  @Lock(LockModeType.PESSIMISTIC_FORCE_INCREMENT)
+  @Query(value = "from TPeriod t where t.periodYear=:periodyear and t.periodMonth=:periodmonth ")
+  TPeriod getTPeriodWithLock(@RequestParam("periodyear") Integer periodyear, @RequestParam("periodmonth") Integer periodmonth);
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java
new file mode 100644
index 0000000..b6d95e8
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java
@@ -0,0 +1,20 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.domain.TSettlectl;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Lock;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.persistence.LockModeType;
+
+@Repository
+public interface SettleCtlDao extends JpaRepository<TSettlectl, Integer> {
+  @Lock(value = LockModeType.PESSIMISTIC_FORCE_INCREMENT)
+  TSettlectl findByBooksetno(Integer booksetno);
+
+  @Query(value = "update TB_SETTLECTL set PERIOD_YEAR=:peridyear,PERIOD_MONTH=:peridmonth where BOOKSETNO=1 ", nativeQuery = true)
+  void updateSettlePeriod(@RequestParam("peridyear") int peridyear, @RequestParam("peridmonth") int peridmonth);
+
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SettleLogDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SettleLogDao.java
new file mode 100644
index 0000000..30de1ae
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SettleLogDao.java
@@ -0,0 +1,9 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.domain.TSettleLog;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface SettleLogDao extends JpaRepository<TSettleLog, String> {
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/ShopaccDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
new file mode 100644
index 0000000..e218b13
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
@@ -0,0 +1,25 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.data.AccnameBean;
+import com.supwisdom.dlpay.framework.data.AccnoBean;
+import com.supwisdom.dlpay.framework.data.ExistBean;
+import com.supwisdom.dlpay.framework.domain.TShopacc;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@Repository
+public interface ShopaccDao extends JpaRepository<TShopacc, String> {
+
+  @Query(value = "select t.SHOPACCNO as accno from TB_SHOPACC t left join TB_SHOPACCBAL a on t.SHOPACCNO=a.SHOPACCNO where a.SHOPACCNO is null ", nativeQuery = true)
+  List<AccnoBean> getNewShopacc();
+
+  @Query(value = "select count(t.*) as existed from TB_SHOPACCBAL t left join TB_SHOPACCBAL a on t.SHOPACCNO=a.SHOPACCNO where a.SHOPACCNO is null and t.STATUS='normal' ", nativeQuery = true)
+  ExistBean checkSettleShopacc();
+
+  @Query(value = "select shopname from TShopacc where shopaccno=:shopaccno ")
+  AccnameBean getShopname(@RequestParam("shopaccno") String shopaccno);
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/ShopaccbalDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/ShopaccbalDao.java
new file mode 100644
index 0000000..7010d29
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/ShopaccbalDao.java
@@ -0,0 +1,17 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.domain.TShopaccbal;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@Repository
+public interface ShopaccbalDao extends JpaRepository<TShopaccbal, String> {
+
+  @Query(value = "select t.* from TB_SHOPACCBAL t left join (select shopaccno from TB_SHOPACCDAY where accdate=:lastsettday ) a on t.shopaccno=a.shopaccno where a.shopaccno is null ", nativeQuery = true)
+  List<TShopaccbal> getUnsettleShopacc(@RequestParam("lastsettday") String lastsettday);
+
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/ShopaccdayDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/ShopaccdayDao.java
new file mode 100644
index 0000000..7ea21f6
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/ShopaccdayDao.java
@@ -0,0 +1,28 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.data.AmountBean;
+import com.supwisdom.dlpay.framework.domain.TShopaccday;
+import com.supwisdom.dlpay.framework.domain.TShopaccdayPK;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@Repository
+public interface ShopaccdayDao extends JpaRepository<TShopaccday, TShopaccdayPK> {
+
+  @Query(value = "from TShopaccday t where t.accdate=:accdate ")
+  List<TShopaccday> getShopaccdayByAccdate(@RequestParam("accdate") String accdate);
+
+  @Query(value = "from TShopaccday t where t.accdate=:accdate and t.shopaccno=:shopaccno ")
+  TShopaccday getTShopaccdayById(@RequestParam("accdate") String accdate, @RequestParam("shopaccno") String shopaccno);
+
+  @Query(value = "update TShopaccday set balance=beginbal-dramt+cramt,updtime=:updtime where accdate=:accdate ")
+  void updateShopaccdayBalance(@RequestParam("accdate") String accdate,@RequestParam("updtime")String updtime);
+
+  @Query(value = "select sum(balance) as amount from TShopaccday where accdate=:accdate ")
+  AmountBean getSumBalance(@RequestParam("accdate") String accdate);
+
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SubjectDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SubjectDao.java
new file mode 100644
index 0000000..480750b
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SubjectDao.java
@@ -0,0 +1,28 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.data.AccnameBean;
+import com.supwisdom.dlpay.framework.data.AccnoBean;
+import com.supwisdom.dlpay.framework.data.ExistBean;
+import com.supwisdom.dlpay.framework.domain.TSubject;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@Repository
+public interface SubjectDao extends JpaRepository<TSubject, String> {
+
+  @Query(value = "select t.SUBJNO as accno from TB_SUBJECT t left join TB_SUBJECTBAL a on t.SUBJNO=a.SUBJNO where t.ENDFLAG=1 and a.SUBJNO is null ", nativeQuery = true)
+  List<AccnoBean> getNewSubject();
+
+  @Query(value = "select count(t.*) as existed from TB_SUBJECT t left join TB_SUBJECTBAL a on t.SUBJNO=a.SUBJNO where t.ENDFLAG=1 and a.SUBJNO is null ", nativeQuery = true)
+  ExistBean checkSettleSubject();
+
+  @Query(value = "select a.subjno as accno from TB_SUBJECT a left join (select subjno from TB_SUBJECTDAY where accdate =:accdate ) b on a.subjno=b.subjno where a.subjlevel=1 and b.subjno is null ", nativeQuery = true)
+  List<AccnoBean> getNewSubjnos(@RequestParam("accdate") String accdate);
+
+  @Query(value = "select subjname from TSubject where subjno=:subjno ")
+  AccnameBean getSubjectname(@RequestParam("subjno") String subjno);
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SubjectbalDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SubjectbalDao.java
new file mode 100644
index 0000000..02d9e16
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SubjectbalDao.java
@@ -0,0 +1,28 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.data.AmountBean;
+import com.supwisdom.dlpay.framework.data.MerchBean;
+import com.supwisdom.dlpay.framework.data.SubjectInfoBean;
+import com.supwisdom.dlpay.framework.domain.TSubjectbal;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@Repository
+public interface SubjectbalDao extends JpaRepository<TSubjectbal, String> {
+
+  @Query(value = "select t.* from TB_SUBJECTBAL t left join ( select subjno from TB_SUBJECTDAY where accdate =:lastsettday) a on t.subjno=a.subjno where a.subjno is null ", nativeQuery = true)
+  List<TSubjectbal> getUnsettleSubjectbal(@RequestParam("lastsettday") String lastsettday);
+
+  @Query(value = "select sum(BEGINDRBAL) as dramt,sum(BEGINCRBAL) as cramt from TB_SUBJECTBAL where SUBJNO in (select SUBJNO from TB_SUBJECT where fsubjno=:fsubjno) ", nativeQuery = true)
+  MerchBean getSubjectInfo(@RequestParam("fsubjno") String fsubjno);
+
+  @Query(value = "select sa.subjno,sa.drbal,crbal,sb.subjtype,sb.balflag from TB_SUBJECTBAL sa,TB_SUBJECT sb where sa.subjno=sb.subjno and sb.endflag=1  order by sa.subjno ", nativeQuery = true)
+  List<SubjectInfoBean> getSubjectbalAndFlag();
+
+  @Query(value = "select case when :balflag=1 then sum(drbal) else sum(crbal) end as amount from tb_subjectbal where subjno in (select subjno from tb_subject where endflag=1 and balflag=:balflag )",nativeQuery = true)
+  AmountBean getSumEndsubjectBalByEndflag(@RequestParam("balflag")Integer balflag);
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SubjectdayDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SubjectdayDao.java
new file mode 100644
index 0000000..bd0f311
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/SubjectdayDao.java
@@ -0,0 +1,37 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.data.FSubjectInfoBean;
+import com.supwisdom.dlpay.framework.data.MerchBean;
+import com.supwisdom.dlpay.framework.domain.TSubjectday;
+import com.supwisdom.dlpay.framework.domain.TSubjectdayPK;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@Repository
+public interface SubjectdayDao extends JpaRepository<TSubjectday, TSubjectdayPK> {
+
+  @Query(value = "from TSubjectday where accdate=:accdate ")
+  List<TSubjectday> getAllByAccdate(@RequestParam("accdate") String accdate);
+
+  @Query(value = "select a.subjno as shopaccno,a.begindrbal as dramt,a.begincrbal as cramt from TB_SUBJECTDAY a left join (select subjno from TB_SUBJECT where endflag=1) b on a.subjno=b.subjno where a.accdate=:accdate and b.subjno is not null ", nativeQuery = true)
+  List<MerchBean> getEndSubjectbalInfos(@RequestParam("accdate") String accdate);
+
+  @Query(value = "from TSubjectday where accdate=:accdate and subjno=:subjno")
+  TSubjectday getSubjectDayById(@RequestParam("accdate") String accdate, @RequestParam("subjno") String subjno);
+
+  @Query(value = "from TSubjectday t where t.accdate=:accdate and t.subjno in (select subjno from TSubject where subjlevel=1 and endflag=0 ) ")
+  List<TSubjectday> getParentSubjectday(@RequestParam("accdate") String accdate);
+
+  @Query(value = "select sum(sb.begindrbal) as begindrbal,sum(sb.begincrbal) as begincrbal,sum(sb.dramt) as dramt,sum(sb.cramt) as cramt,sum(sb.drbal) as drbal,sum(sb.crbal) as crbal  " +
+      "from TB_SUBJECTDAY sb, TB_SUBJECT s " +
+      "where sb.accdate =:accdate and sb.subjno=s.subjno and s.subjlevel=2 and s.fsubjno=:fsubjno ",nativeQuery = true)
+  FSubjectInfoBean getParentSumInfo(@RequestParam("accdate") String accdate, @RequestParam("fsubjno") String fsubjno);
+
+  @Query(value = "select sum(begindrbal) as begindrbal,sum(begincrbal) as begincrbal,sum(dramt) as dramt,sum(cramt) as cramt,sum(drbal) as drbal,sum(crbal) as crbal " +
+      "from tb_subjectday where accdate=:accdate and subjno in (select subjno from tb_subject where subjlevel=1) ", nativeQuery = true)
+  FSubjectInfoBean getAllParentSubjectSumInfo(@RequestParam("accdate") String accdate);
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/TaskLockDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/TaskLockDao.java
new file mode 100644
index 0000000..782e1b5
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/TaskLockDao.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.data.SystemDateTime;
+import com.supwisdom.dlpay.framework.domain.TTaskLock;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Lock;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.persistence.LockModeType;
+
+@Repository
+public interface TaskLockDao extends JpaRepository<TTaskLock, String> {
+
+  @Lock(LockModeType.PESSIMISTIC_FORCE_INCREMENT)
+  @Query("select a from TTaskLock a where a.taskcode=:taskcode")
+  TTaskLock getTaskLockWithLock(@RequestParam("taskcode") String taskcode);
+
+  @Query(value = "select  to_char(sysdate,'yyyymmdd') as hostdate,to_char(sysdate,'hh24miss') as hosttime,to_char(sysdate,'yyyymmddhh24miss') as hostdatetime, sysdate from dual", nativeQuery = true)
+  SystemDateTime getOracleDatetime();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/TranscodeDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/TranscodeDao.java
new file mode 100644
index 0000000..d40f266
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/TranscodeDao.java
@@ -0,0 +1,9 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.domain.TTranscode;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface TranscodeDao extends JpaRepository<TTranscode, Integer> {
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/VoucherDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/VoucherDao.java
new file mode 100644
index 0000000..b670572
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/VoucherDao.java
@@ -0,0 +1,34 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.data.ExistBean;
+import com.supwisdom.dlpay.framework.data.MerchBean;
+import com.supwisdom.dlpay.framework.domain.TVoucher;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Lock;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.persistence.LockModeType;
+import java.util.List;
+
+public interface VoucherDao extends JpaRepository<TVoucher, String> {
+
+  @Query(value = "select count(t.*) as existed from TB_VOUCHER t where t.POSTFLAG=0 and t.SOURCETYPE!='auto' ", nativeQuery = true)
+  ExistBean checkExistUnpostVouhcer();
+
+  @Query(value="delete from TB_VOUCHER where POSTFLAG=0 ",nativeQuery = true)
+  void deleteUnpostVoucher();
+
+  @Lock(LockModeType.PESSIMISTIC_FORCE_INCREMENT)
+  @Query(value = "from TVoucher where postflag=0 order by voucherid ")
+  List<TVoucher> getSettleVouchers();
+
+  @Query(value="select va.accno as shopaccno,sum(va.dramt) as dramt,sum(va.cramt) as cramt " +
+      "from tb_voucherentry va,tb_voucher vb " +
+      "where va.voucherid=vb.voucherid and vb.voucherdate=:settledate and va.subjno='2004' and va.accno is not null " +
+      "group by va.accno order by va.accno ", nativeQuery = true)
+  List<MerchBean> getShopVoucherByAccdate(@RequestParam("settledate")Integer settledate);
+
+  @Query(value = "select sum(va.dramt) as dramt, sum(va.cramt) as cramt  from TB_VOUCHERENTRY va,TB_VOUCHER vb where va.voucherid=vb.voucherid and vb.voucherdate=:voucherdate and va.subjno=:subjno ", nativeQuery = true)
+  MerchBean getSettleSuminfo(@RequestParam("voucherdate") Integer voucherdate, @RequestParam("subjno") String subjno);
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/VoucherEntryDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/VoucherEntryDao.java
new file mode 100644
index 0000000..37e9c1e
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/VoucherEntryDao.java
@@ -0,0 +1,19 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.domain.TVoucherEntry;
+import com.supwisdom.dlpay.framework.domain.TVoucherEntryPK;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@Repository
+public interface VoucherEntryDao extends JpaRepository<TVoucherEntry,TVoucherEntryPK> {
+  @Query(value = "delete from TB_VOUCHERENTRY where VOUCHERID in (select VOUCHERID from TB_VOUCHER where POSTFLAG=0)", nativeQuery = true)
+  void deleteUnpostVoucherentry();
+
+  @Query(value = "from TVoucherEntry where voucherid in (select voucherid from TVoucher where voucherdate=:voucherdate) order by subjno,accno,voucherid ")
+  List<TVoucherEntry> getVoucherEntryByVoucherdate(@RequestParam("voucherdate") Integer voucherdate);
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/dao/VouchernoCtlDao.java b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/VouchernoCtlDao.java
new file mode 100644
index 0000000..51d3194
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/dao/VouchernoCtlDao.java
@@ -0,0 +1,20 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.domain.TVouchernoCtl;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Lock;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.persistence.LockModeType;
+
+@Repository
+public interface VouchernoCtlDao extends JpaRepository<TVouchernoCtl, Integer> {
+  @Query(value = "update TB_VOUCHERNOCTL set PERIOD_MONTH=:peridmonth,VOUCHERNO=:voucherno where VOUCHERTYPE=1 ", nativeQuery = true)
+  void updateVoucherno(@RequestParam("peridmonth") int peridmonth, @RequestParam("voucherno") int voucherno);
+
+  @Lock(LockModeType.PESSIMISTIC_FORCE_INCREMENT)
+  @Query(value = "from TVouchernoCtl where vouchertype=1 ")
+  TVouchernoCtl getVoucherno();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/data/AccnameBean.java b/src/main/kotlin/com/supwisdom/dlpay/framework/data/AccnameBean.java
new file mode 100644
index 0000000..6e0a312
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/data/AccnameBean.java
@@ -0,0 +1,5 @@
+package com.supwisdom.dlpay.framework.data;
+
+public interface AccnameBean {
+  String getAccname();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/data/AccnoBean.java b/src/main/kotlin/com/supwisdom/dlpay/framework/data/AccnoBean.java
new file mode 100644
index 0000000..c086926
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/data/AccnoBean.java
@@ -0,0 +1,5 @@
+package com.supwisdom.dlpay.framework.data;
+
+public interface AccnoBean {
+  String getAccno();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/data/AmountBean.java b/src/main/kotlin/com/supwisdom/dlpay/framework/data/AmountBean.java
new file mode 100644
index 0000000..c079755
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/data/AmountBean.java
@@ -0,0 +1,5 @@
+package com.supwisdom.dlpay.framework.data;
+
+public interface AmountBean {
+  Double getAmount();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/data/ExistBean.java b/src/main/kotlin/com/supwisdom/dlpay/framework/data/ExistBean.java
new file mode 100644
index 0000000..d4f695a
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/data/ExistBean.java
@@ -0,0 +1,5 @@
+package com.supwisdom.dlpay.framework.data;
+
+public interface ExistBean {
+  public int getExisted();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/data/FSubjectInfoBean.java b/src/main/kotlin/com/supwisdom/dlpay/framework/data/FSubjectInfoBean.java
new file mode 100644
index 0000000..9de8cfd
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/data/FSubjectInfoBean.java
@@ -0,0 +1,15 @@
+package com.supwisdom.dlpay.framework.data;
+
+public interface FSubjectInfoBean {
+  Double getBegindrbal();
+
+  Double getBegincrbal();
+
+  Double getDramt();
+
+  Double getCramt();
+
+  Double getDrbal();
+
+  Double getCrbal();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/data/MerchBean.java b/src/main/kotlin/com/supwisdom/dlpay/framework/data/MerchBean.java
new file mode 100644
index 0000000..daa74f1
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/data/MerchBean.java
@@ -0,0 +1,10 @@
+package com.supwisdom.dlpay.framework.data;
+
+public interface MerchBean {
+
+  String getShopaccno();
+
+  Double getDramt();
+
+  Double getCramt();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/data/SubjectInfoBean.java b/src/main/kotlin/com/supwisdom/dlpay/framework/data/SubjectInfoBean.java
new file mode 100644
index 0000000..aab4056
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/data/SubjectInfoBean.java
@@ -0,0 +1,13 @@
+package com.supwisdom.dlpay.framework.data;
+
+public interface SubjectInfoBean {
+  String getSubjno();
+
+  Double getDrbal();
+
+  Double getCrbal();
+
+  Integer getSubjtype();
+
+  Integer getBalflag();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/data/SystemDateTime.java b/src/main/kotlin/com/supwisdom/dlpay/framework/data/SystemDateTime.java
new file mode 100644
index 0000000..baaa274
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/data/SystemDateTime.java
@@ -0,0 +1,13 @@
+package com.supwisdom.dlpay.framework.data;
+
+import java.util.Date;
+
+public interface SystemDateTime {
+  String getHostdate();
+
+  String getHosttime();
+
+  String getHostdatetime();
+
+  Date getSysdate();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/data/VoucherTemp.java b/src/main/kotlin/com/supwisdom/dlpay/framework/data/VoucherTemp.java
new file mode 100644
index 0000000..8454059
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/data/VoucherTemp.java
@@ -0,0 +1,15 @@
+package com.supwisdom.dlpay.framework.data;
+
+public interface VoucherTemp {
+  String getDrsubjno();
+
+  String getCrsubjno();
+
+  String getSummary();
+
+  String getShopaccno();
+
+  Integer getTranscnt();
+
+  Double getTransamt();
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TFeetypeConfig.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TFeetypeConfig.java
new file mode 100644
index 0000000..beb3489
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TFeetypeConfig.java
@@ -0,0 +1,65 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_FEETYPE_CONFIG")
+@IdClass(TFeetypeConfigPK.class)
+public class TFeetypeConfig {
+  @Id
+  @Column(name = "FEETYPE", nullable = false, length = 20)
+  private String feetype;
+
+  @Id
+  @Column(name = "PAYTYPE", nullable = false, length = 20)
+  private String paytype;
+
+  @Column(name="DRSUBJNO", length = 10)
+  private String drsubjno;
+
+  @Column(name="CRSUBJNO", length = 10)
+  private String crsubjno;
+
+  @Column(name="SUMMARY", length = 200)
+  private String summary;
+
+  public String getFeetype() {
+    return feetype;
+  }
+
+  public void setFeetype(String feetype) {
+    this.feetype = feetype;
+  }
+
+  public String getPaytype() {
+    return paytype;
+  }
+
+  public void setPaytype(String paytype) {
+    this.paytype = paytype;
+  }
+
+  public String getDrsubjno() {
+    return drsubjno;
+  }
+
+  public void setDrsubjno(String drsubjno) {
+    this.drsubjno = drsubjno;
+  }
+
+  public String getCrsubjno() {
+    return crsubjno;
+  }
+
+  public void setCrsubjno(String crsubjno) {
+    this.crsubjno = crsubjno;
+  }
+
+  public String getSummary() {
+    return summary;
+  }
+
+  public void setSummary(String summary) {
+    this.summary = summary;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TFeetypeConfigPK.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TFeetypeConfigPK.java
new file mode 100644
index 0000000..92fbf6a
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TFeetypeConfigPK.java
@@ -0,0 +1,51 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class TFeetypeConfigPK implements Serializable {
+  @Id
+  @Column(name = "FEETYPE", nullable = false, length = 20)
+  private String feetype;
+
+  @Id
+  @Column(name = "PAYTYPE", nullable = false, length = 20)
+  private String paytype;
+
+  public String getFeetype() {
+    return feetype;
+  }
+
+  public void setFeetype(String feetype) {
+    this.feetype = feetype;
+  }
+
+  public String getPaytype() {
+    return paytype;
+  }
+
+  public void setPaytype(String paytype) {
+    this.paytype = paytype;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+    TFeetypeConfigPK tFeetypeConfigPK = (TFeetypeConfigPK) o;
+    if (feetype != null ? !feetype.equals(tFeetypeConfigPK.getFeetype()) : feetype != null)
+      return false;
+    if (paytype != null ? !paytype.equals(tFeetypeConfigPK.getPaytype()) : paytype != null)
+      return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int result = feetype != null ? feetype.hashCode() : 0;
+    result = 31 * result + (paytype != null ? paytype.hashCode() : 0);
+    return result;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TPeriod.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TPeriod.java
new file mode 100644
index 0000000..4334eae
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TPeriod.java
@@ -0,0 +1,65 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_PERIOD")
+@IdClass(TPeriodPK.class)
+public class TPeriod {
+  @Id
+  @Column(name="PERIOD_YEAR", nullable = false, precision = 4)
+  private Integer periodYear;
+
+  @Id
+  @Column(name="PERIOD_MONTH", nullable = false, precision = 2)
+  private Integer periodMonth;
+
+  @Column(name="STARTDATE", nullable = false, length = 8)
+  private String startdate;
+
+  @Column(name="ENDDATE", nullable = false, length = 8)
+  private String enddate;
+
+  @Column(name="SETTLEFLAG", nullable = false, precision = 1)
+  private Integer settleflag=0;
+
+  public Integer getPeriodYear() {
+    return periodYear;
+  }
+
+  public void setPeriodYear(Integer periodYear) {
+    this.periodYear = periodYear;
+  }
+
+  public Integer getPeriodMonth() {
+    return periodMonth;
+  }
+
+  public void setPeriodMonth(Integer periodMonth) {
+    this.periodMonth = periodMonth;
+  }
+
+  public String getStartdate() {
+    return startdate;
+  }
+
+  public void setStartdate(String startdate) {
+    this.startdate = startdate;
+  }
+
+  public String getEnddate() {
+    return enddate;
+  }
+
+  public void setEnddate(String enddate) {
+    this.enddate = enddate;
+  }
+
+  public Integer getSettleflag() {
+    return settleflag;
+  }
+
+  public void setSettleflag(Integer settleflag) {
+    this.settleflag = settleflag;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TPeriodPK.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TPeriodPK.java
new file mode 100644
index 0000000..e307db3
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TPeriodPK.java
@@ -0,0 +1,52 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class TPeriodPK implements Serializable {
+
+  @Id
+  @Column(name="PERIOD_YEAR", nullable = false, precision = 4)
+  private Integer periodYear;
+
+  @Id
+  @Column(name="PERIOD_MONTH", nullable = false, precision = 2)
+  private Integer periodMonth;
+
+  public Integer getPeriodYear() {
+    return periodYear;
+  }
+
+  public void setPeriodYear(Integer periodYear) {
+    this.periodYear = periodYear;
+  }
+
+  public Integer getPeriodMonth() {
+    return periodMonth;
+  }
+
+  public void setPeriodMonth(Integer periodMonth) {
+    this.periodMonth = periodMonth;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+    TPeriodPK tPeriodPK = (TPeriodPK) o;
+    if (periodYear != null ? !periodYear.equals(tPeriodPK.getPeriodYear()) : periodYear != null)
+      return false;
+    if (periodMonth != null ? !periodMonth.equals(tPeriodPK.getPeriodMonth()) : periodMonth != null)
+      return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int result = periodYear != null ? periodYear.hashCode() : 0;
+    result = 31 * result + (periodMonth != null ? periodMonth.hashCode() : 0);
+    return result;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSettleLog.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSettleLog.java
new file mode 100644
index 0000000..abdd5e7
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSettleLog.java
@@ -0,0 +1,73 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_SETTLE_LOG")
+public class TSettleLog {
+  @Id
+  @GenericGenerator(name = "idGenerator", strategy = "uuid")
+  @GeneratedValue(generator = "idGenerator")
+  @Column(name = "ID", nullable = false, length = 32)
+  private String id;
+
+  @Column(name = "STARTTIME", length = 14)
+  private String starttime;
+
+  @Column(name = "ENDTIME", length = 14)
+  private String endtime;
+
+  @Column(name = "ERRCODE", length = 10)
+  private String errcode;
+
+  @Column(name = "ERRMSG", length = 600)
+  private String errmsg;
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  public String getStarttime() {
+    return starttime;
+  }
+
+  public void setStarttime(String starttime) {
+    this.starttime = starttime;
+  }
+
+  public String getEndtime() {
+    return endtime;
+  }
+
+  public void setEndtime(String endtime) {
+    this.endtime = endtime;
+  }
+
+  public String getErrcode() {
+    return errcode;
+  }
+
+  public void setErrcode(String errcode) {
+    this.errcode = errcode;
+  }
+
+  public String getErrmsg() {
+    return errmsg;
+  }
+
+  public void setErrmsg(String errmsg) {
+    this.errmsg = errmsg;
+  }
+
+  public TSettleLog update(String errcode, String errmsg) {
+    this.errcode = errcode;
+    this.errmsg = errmsg;
+    return this;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSettlectl.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSettlectl.java
new file mode 100644
index 0000000..80895c6
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSettlectl.java
@@ -0,0 +1,88 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_SETTLECTL")
+public class TSettlectl {
+  @Id
+  @Column(name="BOOKSETNO", nullable = false, precision = 2)
+  private Integer booksetno;
+
+  @Column(name="PERIOD_YEAR", nullable = false, precision = 4)
+  private Integer periodYear;
+
+  @Column(name="PERIOD_MONTH", nullable = false, precision = 2)
+  private Integer periodMonth;
+
+  @Column(name="STATDATE", precision = 8)
+  private Integer statdate;
+
+  @Column(name="SETTLEDATE",nullable = false, precision = 8)
+  private Integer settledate;
+
+  @Column(name="STATUS", nullable = false, precision = 1)
+  private Integer status;
+
+  @Column(name="UPDTIME", length = 14)
+  private String updtime;
+
+  public Integer getBooksetno() {
+    return booksetno;
+  }
+
+  public void setBooksetno(Integer booksetno) {
+    this.booksetno = booksetno;
+  }
+
+  public Integer getPeriodYear() {
+    return periodYear;
+  }
+
+  public void setPeriodYear(Integer periodYear) {
+    this.periodYear = periodYear;
+  }
+
+  public Integer getPeriodMonth() {
+    return periodMonth;
+  }
+
+  public void setPeriodMonth(Integer periodMonth) {
+    this.periodMonth = periodMonth;
+  }
+
+  public Integer getStatdate() {
+    return statdate;
+  }
+
+  public void setStatdate(Integer statdate) {
+    this.statdate = statdate;
+  }
+
+  public Integer getSettledate() {
+    return settledate;
+  }
+
+  public void setSettledate(Integer settledate) {
+    this.settledate = settledate;
+  }
+
+  public Integer getStatus() {
+    return status;
+  }
+
+  public void setStatus(Integer status) {
+    this.status = status;
+  }
+
+  public String getUpdtime() {
+    return updtime;
+  }
+
+  public void setUpdtime(String updtime) {
+    this.updtime = updtime;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShop.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShop.java
new file mode 100644
index 0000000..978f8be
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShop.java
@@ -0,0 +1,187 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_SHOP")
+public class TShop {
+  @Id
+  @Column(name="SHOPID", nullable = false, precision = 9)
+  private Integer shopid;
+
+  @Column(name="FSHOPID", precision = 9)
+  private Integer fshopid;
+
+  @Column(name="SHOPNAME", length = 200)
+  private String shopname;
+
+  @Column(name = "SHOPTYPE", precision = 1)
+  private Integer shoptype;
+
+  @Column(name="STATUS", length = 20)
+  private String status;
+
+  @Column(name="SHOPACCNO", length = 20)
+  private String shopaccno;
+
+  @Column(name="CONTACTMAN", length = 60)
+  private String contactman;
+
+  @Column(name="IDTYPE", length = 1)
+  private String idtype;
+
+  @Column(name="IDNO", length = 60)
+  private String idno;
+
+  @Column(name="TEL", length = 20)
+  private String tel;
+
+  @Column(name="MOBILE", length = 30)
+  private String mobile;
+
+  @Column(name="EMAIL", length = 60)
+  private String email;
+
+  @Column(name="ADDR", length = 240)
+  private String addr;
+
+  @Column(name="ZIPCODE", length = 10)
+  private String zipcode;
+
+  @Column(name="OPENDATE", length = 8)
+  private String opendate;
+
+  @Column(name="CLOSEDATE", length = 8)
+  private String closedate;
+
+  public Integer getShopid() {
+    return shopid;
+  }
+
+  public void setShopid(Integer shopid) {
+    this.shopid = shopid;
+  }
+
+  public Integer getFshopid() {
+    return fshopid;
+  }
+
+  public void setFshopid(Integer fshopid) {
+    this.fshopid = fshopid;
+  }
+
+  public String getShopname() {
+    return shopname;
+  }
+
+  public void setShopname(String shopname) {
+    this.shopname = shopname;
+  }
+
+  public Integer getShoptype() {
+    return shoptype;
+  }
+
+  public void setShoptype(Integer shoptype) {
+    this.shoptype = shoptype;
+  }
+
+  public String getStatus() {
+    return status;
+  }
+
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  public String getShopaccno() {
+    return shopaccno;
+  }
+
+  public void setShopaccno(String shopaccno) {
+    this.shopaccno = shopaccno;
+  }
+
+  public String getContactman() {
+    return contactman;
+  }
+
+  public void setContactman(String contactman) {
+    this.contactman = contactman;
+  }
+
+  public String getIdtype() {
+    return idtype;
+  }
+
+  public void setIdtype(String idtype) {
+    this.idtype = idtype;
+  }
+
+  public String getIdno() {
+    return idno;
+  }
+
+  public void setIdno(String idno) {
+    this.idno = idno;
+  }
+
+  public String getTel() {
+    return tel;
+  }
+
+  public void setTel(String tel) {
+    this.tel = tel;
+  }
+
+  public String getMobile() {
+    return mobile;
+  }
+
+  public void setMobile(String mobile) {
+    this.mobile = mobile;
+  }
+
+  public String getEmail() {
+    return email;
+  }
+
+  public void setEmail(String email) {
+    this.email = email;
+  }
+
+  public String getAddr() {
+    return addr;
+  }
+
+  public void setAddr(String addr) {
+    this.addr = addr;
+  }
+
+  public String getZipcode() {
+    return zipcode;
+  }
+
+  public void setZipcode(String zipcode) {
+    this.zipcode = zipcode;
+  }
+
+  public String getOpendate() {
+    return opendate;
+  }
+
+  public void setOpendate(String opendate) {
+    this.opendate = opendate;
+  }
+
+  public String getClosedate() {
+    return closedate;
+  }
+
+  public void setClosedate(String closedate) {
+    this.closedate = closedate;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopacc.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopacc.java
new file mode 100644
index 0000000..a92690f
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopacc.java
@@ -0,0 +1,88 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_SHOPACC")
+public class TShopacc {
+  @Id
+  @Column(name="SHOPACCNO", length = 10)
+  private String shopaccno;
+
+  @Column(name="SHOPID", precision = 9)
+  private Integer shopid;
+
+  @Column(name="SHOPNAME", length = 200)
+  private String shopname;
+
+  @Column(name="SUBJNO", length = 10)
+  private String subjno;
+
+  @Column(name="STATUS", length = 20)
+  private String status;
+
+  @Column(name="OPENDATE", length = 8)
+  private String opendate;
+
+  @Column(name="CLOSEDATE", length = 8)
+  private String closedate;
+
+  public String getShopaccno() {
+    return shopaccno;
+  }
+
+  public void setShopaccno(String shopaccno) {
+    this.shopaccno = shopaccno;
+  }
+
+  public Integer getShopid() {
+    return shopid;
+  }
+
+  public void setShopid(Integer shopid) {
+    this.shopid = shopid;
+  }
+
+  public String getShopname() {
+    return shopname;
+  }
+
+  public void setShopname(String shopname) {
+    this.shopname = shopname;
+  }
+
+  public String getSubjno() {
+    return subjno;
+  }
+
+  public void setSubjno(String subjno) {
+    this.subjno = subjno;
+  }
+
+  public String getStatus() {
+    return status;
+  }
+
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  public String getOpendate() {
+    return opendate;
+  }
+
+  public void setOpendate(String opendate) {
+    this.opendate = opendate;
+  }
+
+  public String getClosedate() {
+    return closedate;
+  }
+
+  public void setClosedate(String closedate) {
+    this.closedate = closedate;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopaccbal.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopaccbal.java
new file mode 100644
index 0000000..d64608e
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopaccbal.java
@@ -0,0 +1,147 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_SHOPACCBAL")
+public class TShopaccbal {
+  @Id
+  @Column(name="SHOPACCNO", length = 10)
+  private String shopaccno;
+
+  @Column(name="ACCUMDRAMT", precision = 15, scale = 2)
+  private Double accumdramt;
+
+  @Column(name="ACCUMCRAMT", precision = 15, scale = 2)
+  private Double accumcramt;
+
+  @Column(name="BEGINBAL", precision = 15, scale = 2)
+  private Double beginbal;
+
+  @Column(name="DRAMT", precision = 15, scale = 2)
+  private Double dramt;
+
+  @Column(name="CRAMT", precision = 15, scale = 2)
+  private Double cramt;
+
+  @Column(name="BALANCE", precision = 15, scale = 2)
+  private Double balance;
+
+  @Column(name="UPDTIME", precision = 15, scale = 2)
+  private String updtime;
+
+  @Column(name="LASTSETTLEDAY", length = 8)
+  private String lastsettleday;
+
+  @Column(name="SETTLETOTALAMT", precision = 15, scale = 2)
+  private Double settletotalamt;
+
+  public TShopaccbal() {
+  }
+
+  public TShopaccbal(String shopaccno) {
+    this.shopaccno = shopaccno;
+    this.accumdramt = 0D;
+    this.accumcramt = 0D;
+    this.beginbal = 0D;
+    this.dramt = 0D;
+    this.cramt = 0D;
+    this.balance = 0D;
+  }
+
+  public TShopaccbal(String shopaccno, Double accumdramt, Double accumcramt, Double beginbal, Double dramt, Double cramt, Double balance, String updtime, String lastsettleday, Double settletotalamt) {
+    this.shopaccno = shopaccno;
+    this.accumdramt = accumdramt;
+    this.accumcramt = accumcramt;
+    this.beginbal = beginbal;
+    this.dramt = dramt;
+    this.cramt = cramt;
+    this.balance = balance;
+    this.updtime = updtime;
+    this.lastsettleday = lastsettleday;
+    this.settletotalamt = settletotalamt;
+  }
+
+  public String getShopaccno() {
+    return shopaccno;
+  }
+
+  public void setShopaccno(String shopaccno) {
+    this.shopaccno = shopaccno;
+  }
+
+  public Double getAccumdramt() {
+    return accumdramt;
+  }
+
+  public void setAccumdramt(Double accumdramt) {
+    this.accumdramt = accumdramt;
+  }
+
+  public Double getAccumcramt() {
+    return accumcramt;
+  }
+
+  public void setAccumcramt(Double accumcramt) {
+    this.accumcramt = accumcramt;
+  }
+
+  public Double getBeginbal() {
+    return beginbal;
+  }
+
+  public void setBeginbal(Double beginbal) {
+    this.beginbal = beginbal;
+  }
+
+  public Double getDramt() {
+    return dramt;
+  }
+
+  public void setDramt(Double dramt) {
+    this.dramt = dramt;
+  }
+
+  public Double getCramt() {
+    return cramt;
+  }
+
+  public void setCramt(Double cramt) {
+    this.cramt = cramt;
+  }
+
+  public Double getBalance() {
+    return balance;
+  }
+
+  public void setBalance(Double balance) {
+    this.balance = balance;
+  }
+
+  public String getUpdtime() {
+    return updtime;
+  }
+
+  public void setUpdtime(String updtime) {
+    this.updtime = updtime;
+  }
+
+  public String getLastsettleday() {
+    return lastsettleday;
+  }
+
+  public void setLastsettleday(String lastsettleday) {
+    this.lastsettleday = lastsettleday;
+  }
+
+  public Double getSettletotalamt() {
+    return settletotalamt;
+  }
+
+  public void setSettletotalamt(Double settletotalamt) {
+    this.settletotalamt = settletotalamt;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopaccday.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopaccday.java
new file mode 100644
index 0000000..90671b8
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopaccday.java
@@ -0,0 +1,135 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_SHOPACCDAY")
+@IdClass(TShopaccdayPK.class)
+public class TShopaccday {
+  @Id
+  @Column(name="ACCDATE", nullable = false, length = 8)
+  private String accdate;
+
+  @Id
+  @Column(name="SHOPACCNO", nullable = false, length = 10)
+  private String shopaccno;
+
+  @Column(name="PERIOD_YEAR", precision = 8)
+  private Integer periodYear;
+
+  @Column(name="PERIOD_MONTH", precision = 2)
+  private Integer periodMonth;
+
+  @Column(name="BEGINBAL", precision = 15, scale = 2)
+  private Double beginbal;
+
+  @Column(name="DRAMT", precision = 15, scale = 2)
+  private Double dramt;
+
+  @Column(name="CRAMT", precision = 15, scale = 2)
+  private Double cramt;
+
+  @Column(name="BALANCE", precision = 15, scale = 2)
+  private Double balance;
+
+  @Column(name="UPDTIME", precision = 15, scale = 2)
+  private String updtime;
+
+  public TShopaccday() {
+  }
+
+  public TShopaccday(String accdate, String shopaccno, Integer periodYear, Integer periodMonth, Double beginbal, Double dramt, Double cramt, Double balance) {
+    this.accdate = accdate;
+    this.shopaccno = shopaccno;
+    this.periodYear = periodYear;
+    this.periodMonth = periodMonth;
+    this.beginbal = beginbal;
+    this.dramt = dramt;
+    this.cramt = cramt;
+    this.balance = balance;
+  }
+
+  public TShopaccday(String accdate, String shopaccno, Integer periodYear, Integer periodMonth, Double beginbal, Double dramt, Double cramt, Double balance, String updtime) {
+    this.accdate = accdate;
+    this.shopaccno = shopaccno;
+    this.periodYear = periodYear;
+    this.periodMonth = periodMonth;
+    this.beginbal = beginbal;
+    this.dramt = dramt;
+    this.cramt = cramt;
+    this.balance = balance;
+    this.updtime = updtime;
+  }
+
+  public String getAccdate() {
+    return accdate;
+  }
+
+  public void setAccdate(String accdate) {
+    this.accdate = accdate;
+  }
+
+  public String getShopaccno() {
+    return shopaccno;
+  }
+
+  public void setShopaccno(String shopaccno) {
+    this.shopaccno = shopaccno;
+  }
+
+  public Integer getPeriodYear() {
+    return periodYear;
+  }
+
+  public void setPeriodYear(Integer periodYear) {
+    this.periodYear = periodYear;
+  }
+
+  public Integer getPeriodMonth() {
+    return periodMonth;
+  }
+
+  public void setPeriodMonth(Integer periodMonth) {
+    this.periodMonth = periodMonth;
+  }
+
+  public Double getBeginbal() {
+    return beginbal;
+  }
+
+  public void setBeginbal(Double beginbal) {
+    this.beginbal = beginbal;
+  }
+
+  public Double getDramt() {
+    return dramt;
+  }
+
+  public void setDramt(Double dramt) {
+    this.dramt = dramt;
+  }
+
+  public Double getCramt() {
+    return cramt;
+  }
+
+  public void setCramt(Double cramt) {
+    this.cramt = cramt;
+  }
+
+  public Double getBalance() {
+    return balance;
+  }
+
+  public void setBalance(Double balance) {
+    this.balance = balance;
+  }
+
+  public String getUpdtime() {
+    return updtime;
+  }
+
+  public void setUpdtime(String updtime) {
+    this.updtime = updtime;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopaccdayPK.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopaccdayPK.java
new file mode 100644
index 0000000..8ebf93b
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TShopaccdayPK.java
@@ -0,0 +1,51 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class TShopaccdayPK implements Serializable {
+  @Id
+  @Column(name="ACCDATE", nullable = false, length = 8)
+  private String accdate;
+
+  @Id
+  @Column(name="SHOPACCNO", nullable = false, length = 10)
+  private String shopaccno;
+
+  public String getAccdate() {
+    return accdate;
+  }
+
+  public void setAccdate(String accdate) {
+    this.accdate = accdate;
+  }
+
+  public String getShopaccno() {
+    return shopaccno;
+  }
+
+  public void setShopaccno(String shopaccno) {
+    this.shopaccno = shopaccno;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+    TShopaccdayPK tShopaccdayPK = (TShopaccdayPK) o;
+    if (accdate != null ? !accdate.equals(tShopaccdayPK.getAccdate()) : accdate != null)
+      return false;
+    if (shopaccno != null ? !shopaccno.equals(tShopaccdayPK.getShopaccno()) : shopaccno != null)
+      return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int result = accdate != null ? accdate.hashCode() : 0;
+    result = 31 * result + (shopaccno != null ? shopaccno.hashCode() : 0);
+    return result;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubject.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubject.java
new file mode 100644
index 0000000..2e48915
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubject.java
@@ -0,0 +1,110 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_SUBJECT")
+public class TSubject {
+  @Id
+  @Column(name = "SUBJNO", nullable = false, length = 10)
+  private String subjno;
+
+  @Column(name = "SUBJNAME", nullable = false, length = 60)
+  private String subjname;
+
+  @Column(name = "SUBJTYPE", precision = 1)
+  private Integer subjtype;
+
+  @Column(name="BALFLAG", precision = 1)
+  private Integer balflag;
+
+  @Column(name="FSUBJNO", length = 10)
+  private String fsubjno;
+
+  @Column(name="SUBJLEVEL", precision = 1)
+  private Integer subjlevel;
+
+  @Column(name="ENDFLAG", precision = 1)
+  private Integer endflag;
+
+  @Column(name="OPENDATE", precision = 8)
+  private Integer opendate;
+
+  @Column(name="DISPLAYFLAG", length = 1)
+  private String displayflag;
+
+  public String getSubjno() {
+    return subjno;
+  }
+
+  public void setSubjno(String subjno) {
+    this.subjno = subjno;
+  }
+
+  public String getSubjname() {
+    return subjname;
+  }
+
+  public void setSubjname(String subjname) {
+    this.subjname = subjname;
+  }
+
+  public Integer getSubjtype() {
+    return subjtype;
+  }
+
+  public void setSubjtype(Integer subjtype) {
+    this.subjtype = subjtype;
+  }
+
+  public Integer getBalflag() {
+    return balflag;
+  }
+
+  public void setBalflag(Integer balflag) {
+    this.balflag = balflag;
+  }
+
+  public String getFsubjno() {
+    return fsubjno;
+  }
+
+  public void setFsubjno(String fsubjno) {
+    this.fsubjno = fsubjno;
+  }
+
+  public Integer getSubjlevel() {
+    return subjlevel;
+  }
+
+  public void setSubjlevel(Integer subjlevel) {
+    this.subjlevel = subjlevel;
+  }
+
+  public Integer getEndflag() {
+    return endflag;
+  }
+
+  public void setEndflag(Integer endflag) {
+    this.endflag = endflag;
+  }
+
+  public Integer getOpendate() {
+    return opendate;
+  }
+
+  public void setOpendate(Integer opendate) {
+    this.opendate = opendate;
+  }
+
+  public String getDisplayflag() {
+    return displayflag;
+  }
+
+  public void setDisplayflag(String displayflag) {
+    this.displayflag = displayflag;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubjectbal.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubjectbal.java
new file mode 100644
index 0000000..4f19413
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubjectbal.java
@@ -0,0 +1,173 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_SUBJECTBAL")
+public class TSubjectbal {
+  @Id
+  @Column(name = "SUBJNO", nullable = false, length = 10)
+  private String subjno;
+
+  @Column(name = "ACCUMDRAMT", precision = 15, scale = 2)
+  private Double accumdramt;
+
+  @Column(name = "ACCUMCRAMT", precision = 15, scale = 2)
+  private Double accumcramt;
+
+  @Column(name = "BEGINDRBAL", precision = 15, scale = 2)
+  private Double begindrbal;
+
+  @Column(name = "BEGINCRBAL", precision = 15, scale = 2)
+  private Double begincrbal;
+
+  @Column(name = "DRAMT", precision = 15, scale = 2)
+  private Double dramt;
+
+  @Column(name = "CRAMT", precision = 15, scale = 2)
+  private Double cramt;
+
+  @Column(name = "DRBAL", precision = 15, scale = 2)
+  private Double drbal;
+
+  @Column(name = "CRBAL", precision = 15, scale = 2)
+  private Double crbal;
+
+  @Column(name = "UPDTIME", length = 14)
+  private String updtime;
+
+  @Column(name = "LASTSETTLEDAY", length = 8)
+  private Integer lastsettleday;
+
+  @Column(name = "ACCUMSETTLEAMT", precision = 15, scale = 2)
+  private Double accumsettleamt;
+
+  public TSubjectbal() {
+  }
+
+  public TSubjectbal(String subjno) {
+    this.subjno = subjno;
+    this.accumdramt = 0D;
+    this.accumcramt = 0D;
+    this.begindrbal = 0D;
+    this.begincrbal = 0D;
+    this.dramt = 0D;
+    this.cramt = 0D;
+    this.drbal = 0D;
+    this.crbal = 0D;
+  }
+
+  public TSubjectbal(String subjno, Double accumdramt, Double accumcramt, Double begindrbal, Double begincrbal, Double dramt, Double cramt, Double drbal, Double crbal, String updtime, Integer lastsettleday, Double accumsettleamt) {
+    this.subjno = subjno;
+    this.accumdramt = accumdramt;
+    this.accumcramt = accumcramt;
+    this.begindrbal = begindrbal;
+    this.begincrbal = begincrbal;
+    this.dramt = dramt;
+    this.cramt = cramt;
+    this.drbal = drbal;
+    this.crbal = crbal;
+    this.updtime = updtime;
+    this.lastsettleday = lastsettleday;
+    this.accumsettleamt = accumsettleamt;
+  }
+
+  public String getSubjno() {
+    return subjno;
+  }
+
+  public void setSubjno(String subjno) {
+    this.subjno = subjno;
+  }
+
+  public Double getAccumdramt() {
+    return accumdramt;
+  }
+
+  public void setAccumdramt(Double accumdramt) {
+    this.accumdramt = accumdramt;
+  }
+
+  public Double getAccumcramt() {
+    return accumcramt;
+  }
+
+  public void setAccumcramt(Double accumcramt) {
+    this.accumcramt = accumcramt;
+  }
+
+  public Double getBegindrbal() {
+    return begindrbal;
+  }
+
+  public void setBegindrbal(Double begindrbal) {
+    this.begindrbal = begindrbal;
+  }
+
+  public Double getBegincrbal() {
+    return begincrbal;
+  }
+
+  public void setBegincrbal(Double begincrbal) {
+    this.begincrbal = begincrbal;
+  }
+
+  public Double getDramt() {
+    return dramt;
+  }
+
+  public void setDramt(Double dramt) {
+    this.dramt = dramt;
+  }
+
+  public Double getCramt() {
+    return cramt;
+  }
+
+  public void setCramt(Double cramt) {
+    this.cramt = cramt;
+  }
+
+  public Double getDrbal() {
+    return drbal;
+  }
+
+  public void setDrbal(Double drbal) {
+    this.drbal = drbal;
+  }
+
+  public Double getCrbal() {
+    return crbal;
+  }
+
+  public void setCrbal(Double crbal) {
+    this.crbal = crbal;
+  }
+
+  public String getUpdtime() {
+    return updtime;
+  }
+
+  public void setUpdtime(String updtime) {
+    this.updtime = updtime;
+  }
+
+  public Integer getLastsettleday() {
+    return lastsettleday;
+  }
+
+  public void setLastsettleday(Integer lastsettleday) {
+    this.lastsettleday = lastsettleday;
+  }
+
+  public Double getAccumsettleamt() {
+    return accumsettleamt;
+  }
+
+  public void setAccumsettleamt(Double accumsettleamt) {
+    this.accumsettleamt = accumsettleamt;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubjectday.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubjectday.java
new file mode 100644
index 0000000..57abe7a
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubjectday.java
@@ -0,0 +1,161 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_SUBJECTDAY")
+@IdClass(TSubjectdayPK.class)
+public class TSubjectday {
+  @Id
+  @Column(name="ACCDATE", nullable = false, length = 8)
+  private String accdate;
+
+  @Id
+  @Column(name="SUBJNO", nullable = false, length = 10)
+  private String subjno;
+
+  @Column(name="PERIOD_YEAR", precision = 4)
+  private Integer periodYear;
+
+  @Column(name="PERIOD_MONTH", precision = 2)
+  private Integer periodMonth;
+
+  @Column(name="BEGINDRBAL", precision = 15, scale = 2)
+  private Double begindrbal;
+
+  @Column(name="BEGINCRBAL", precision = 15, scale = 2)
+  private Double begincrbal;
+
+  @Column(name="DRAMT", precision = 15, scale = 2)
+  private Double dramt;
+
+  @Column(name="CRAMT", precision = 15, scale = 2)
+  private Double cramt;
+
+  @Column(name="DRBAL", precision = 15, scale = 2)
+  private Double drbal;
+
+  @Column(name="CRBAL", precision = 15, scale = 2)
+  private Double crbal;
+
+  @Column(name="UPDTIME", precision = 15, scale = 2)
+  private String updtime;
+
+  public TSubjectday() {
+  }
+
+  public TSubjectday(String accdate, String subjno, Integer periodYear, Integer periodMonth, Double begindrbal, Double begincrbal, Double dramt, Double cramt, Double drbal, Double crbal) {
+    this.accdate = accdate;
+    this.subjno = subjno;
+    this.periodYear = periodYear;
+    this.periodMonth = periodMonth;
+    this.begindrbal = begindrbal;
+    this.begincrbal = begincrbal;
+    this.dramt = dramt;
+    this.cramt = cramt;
+    this.drbal = drbal;
+    this.crbal = crbal;
+  }
+
+  public TSubjectday(String accdate, String subjno, Integer periodYear, Integer periodMonth, Double begindrbal, Double begincrbal, Double dramt, Double cramt, Double drbal, Double crbal, String updtime) {
+    this.accdate = accdate;
+    this.subjno = subjno;
+    this.periodYear = periodYear;
+    this.periodMonth = periodMonth;
+    this.begindrbal = begindrbal;
+    this.begincrbal = begincrbal;
+    this.dramt = dramt;
+    this.cramt = cramt;
+    this.drbal = drbal;
+    this.crbal = crbal;
+    this.updtime = updtime;
+  }
+
+  public String getAccdate() {
+    return accdate;
+  }
+
+  public void setAccdate(String accdate) {
+    this.accdate = accdate;
+  }
+
+  public String getSubjno() {
+    return subjno;
+  }
+
+  public void setSubjno(String subjno) {
+    this.subjno = subjno;
+  }
+
+  public Integer getPeriodYear() {
+    return periodYear;
+  }
+
+  public void setPeriodYear(Integer periodYear) {
+    this.periodYear = periodYear;
+  }
+
+  public Integer getPeriodMonth() {
+    return periodMonth;
+  }
+
+  public void setPeriodMonth(Integer periodMonth) {
+    this.periodMonth = periodMonth;
+  }
+
+  public Double getBegindrbal() {
+    return begindrbal;
+  }
+
+  public void setBegindrbal(Double begindrbal) {
+    this.begindrbal = begindrbal;
+  }
+
+  public Double getBegincrbal() {
+    return begincrbal;
+  }
+
+  public void setBegincrbal(Double begincrbal) {
+    this.begincrbal = begincrbal;
+  }
+
+  public Double getDramt() {
+    return dramt;
+  }
+
+  public void setDramt(Double dramt) {
+    this.dramt = dramt;
+  }
+
+  public Double getCramt() {
+    return cramt;
+  }
+
+  public void setCramt(Double cramt) {
+    this.cramt = cramt;
+  }
+
+  public Double getDrbal() {
+    return drbal;
+  }
+
+  public void setDrbal(Double drbal) {
+    this.drbal = drbal;
+  }
+
+  public Double getCrbal() {
+    return crbal;
+  }
+
+  public void setCrbal(Double crbal) {
+    this.crbal = crbal;
+  }
+
+  public String getUpdtime() {
+    return updtime;
+  }
+
+  public void setUpdtime(String updtime) {
+    this.updtime = updtime;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubjectdayPK.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubjectdayPK.java
new file mode 100644
index 0000000..a3fdd45
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TSubjectdayPK.java
@@ -0,0 +1,51 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class TSubjectdayPK implements Serializable {
+  @Id
+  @Column(name = "ACCDATE", nullable = false, length = 8)
+  private String accdate;
+
+  @Id
+  @Column(name = "SUBJNO", nullable = false, length = 10)
+  private String subjno;
+
+  public String getAccdate() {
+    return accdate;
+  }
+
+  public void setAccdate(String accdate) {
+    this.accdate = accdate;
+  }
+
+  public String getSubjno() {
+    return subjno;
+  }
+
+  public void setSubjno(String subjno) {
+    this.subjno = subjno;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+    TSubjectdayPK tSubjectdayPK = (TSubjectdayPK) o;
+    if (accdate != null ? !accdate.equals(tSubjectdayPK.getAccdate()) : accdate != null)
+      return false;
+    if (subjno != null ? !subjno.equals(tSubjectdayPK.getSubjno()) : subjno != null)
+      return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int result = accdate != null ? accdate.hashCode() : 0;
+    result = 31 * result + (subjno != null ? subjno.hashCode() : 0);
+    return result;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TTaskLock.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TTaskLock.java
new file mode 100644
index 0000000..72912c7
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TTaskLock.java
@@ -0,0 +1,56 @@
+package com.supwisdom.dlpay.framework.domain;
+
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_TASK_LOCK")
+public class TTaskLock {
+  @Id
+  @Column(name="TASKCODE", nullable = false, length = 30)
+  private String taskcode;
+
+  @Column(name="TASKSTATUS", nullable = false, precision = 1)
+  private Integer taskstatus;
+
+  @Column(name="TASKTIME", length = 20)
+  private String tasktime;
+
+  @Column(name="REMARK", length = 600)
+  private String remark;
+
+  public String getTaskcode() {
+    return taskcode;
+  }
+
+  public void setTaskcode(String taskcode) {
+    this.taskcode = taskcode;
+  }
+
+  public Integer getTaskstatus() {
+    return taskstatus;
+  }
+
+  public void setTaskstatus(Integer taskstatus) {
+    this.taskstatus = taskstatus;
+  }
+
+  public String getTasktime() {
+    return tasktime;
+  }
+
+  public void setTasktime(String tasktime) {
+    this.tasktime = tasktime;
+  }
+
+  public String getRemark() {
+    return remark;
+  }
+
+  public void setRemark(String remark) {
+    this.remark = remark;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TTranscode.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TTranscode.java
new file mode 100644
index 0000000..f4bb2f0
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TTranscode.java
@@ -0,0 +1,33 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_TRANSCODE")
+public class TTranscode {
+  @Id
+  @Column(name="TRANSCODE", nullable = false, precision = 4)
+  private Integer transcode;
+
+  @Column(name="TRANSNAME", nullable = false, length = 100)
+  private String transname;
+
+  public Integer getTranscode() {
+    return transcode;
+  }
+
+  public void setTranscode(Integer transcode) {
+    this.transcode = transcode;
+  }
+
+  public String getTransname() {
+    return transname;
+  }
+
+  public void setTransname(String transname) {
+    this.transname = transname;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TTranstype.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TTranstype.java
new file mode 100644
index 0000000..b098ce3
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TTranstype.java
@@ -0,0 +1,55 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_TRANSTYPE")
+public class TTranstype {
+  @Id
+  @Column(name = "TRANSTYPE", nullable = false, precision = 4)
+  private Integer TRANSTYPE;
+
+  @Column(name = "DRSUBJNO", length = 10)
+  private String DRSUBJNO;
+
+  @Column(name = "CRSUBJNO", length = 10)
+  private String CRSUBJNO;
+
+  @Column(name = "SUMMARY", length = 200)
+  private String SUMMARY;
+
+  public Integer getTRANSTYPE() {
+    return TRANSTYPE;
+  }
+
+  public void setTRANSTYPE(Integer TRANSTYPE) {
+    this.TRANSTYPE = TRANSTYPE;
+  }
+
+  public String getDRSUBJNO() {
+    return DRSUBJNO;
+  }
+
+  public void setDRSUBJNO(String DRSUBJNO) {
+    this.DRSUBJNO = DRSUBJNO;
+  }
+
+  public String getCRSUBJNO() {
+    return CRSUBJNO;
+  }
+
+  public void setCRSUBJNO(String CRSUBJNO) {
+    this.CRSUBJNO = CRSUBJNO;
+  }
+
+  public String getSUMMARY() {
+    return SUMMARY;
+  }
+
+  public void setSUMMARY(String SUMMARY) {
+    this.SUMMARY = SUMMARY;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVoucher.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVoucher.java
new file mode 100644
index 0000000..d2faa89
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVoucher.java
@@ -0,0 +1,298 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_VOUCHER")
+public class TVoucher {
+  @Id
+  @GenericGenerator(name = "idGenerator", strategy = "uuid")
+  @GeneratedValue(generator = "idGenerator")
+  @Column(name="VOUCHERID", nullable = false, length = 32)
+  private String voucherid;
+
+  @Column(name="PERIOD_YEAR", precision = 8)
+  private Integer periodYear;
+
+  @Column(name="PERIOD_MONTH", precision = 2)
+  private Integer periodMonth;
+
+  @Column(name="VOUCHERNO", precision = 9)
+  private Integer voucherno;
+
+  @Column(name="VOUCHERDATE", precision = 8)
+  private Integer voucherdate;
+
+  @Column(name="TRANSDATE", precision = 8)
+  private Integer transdate;
+
+  @Column(name="TRANSCNT", precision = 9)
+  private Integer transcnt;
+
+  @Column(name="AMOUNT", precision = 15, scale = 2)
+  private Double amount;
+
+  @Column(name="SUMMARY", length = 200)
+  private String summary;
+
+  @Column(name="ENTRYCNT", precision = 2)
+  private Integer entrycnt=2;
+
+  @Column(name="ATTACHMENTS", precision = 1)
+  private Integer attachments;
+
+  @Column(name="SOURCETYPE", length = 20)
+  private String sourcetype;
+
+  @Column(name="SIGNFLAG", precision = 1)
+  private Integer signflag;
+
+  @Column(name="CHECKFLAG", precision =1)
+  private Integer checkflag;
+
+  @Column(name="POSTFLAG", precision = 1)
+  private Integer postflag;
+
+  @Column(name="INVALIDFLAG", precision =1)
+  private Integer invalidflag;
+
+  @Column(name="EDITFLAG", precision =1)
+  private Integer editflag;
+
+  @Column(name="PREPARER", length = 32)
+  private String preparer;
+
+  @Column(name="CASHIER", length = 32)
+  private String cashier;
+
+  @Column(name="CHECKER", length = 32)
+  private String checker;
+
+  @Column(name="POSTER", length = 32)
+  private String poster;
+
+  @Column(name="CREATEDATE", precision =8)
+  private Integer createdate;
+
+  public TVoucher(Integer periodYear, Integer periodMonth, Integer voucherno, Integer voucherdate, Integer transdate, Integer transcnt, Double amount, String summary, String sourcetype, Integer createdate) {
+    this.periodYear = periodYear;
+    this.periodMonth = periodMonth;
+    this.voucherno = voucherno;
+    this.voucherdate = voucherdate;
+    this.transdate = transdate;
+    this.transcnt = transcnt;
+    this.amount = amount;
+    this.summary = summary;
+    this.entrycnt = 2;
+    this.attachments = 0;
+    this.sourcetype = sourcetype;
+    this.signflag = 0;
+    this.checkflag = 1;
+    this.postflag = 0;
+    this.invalidflag = 0;
+    this.editflag = 0;
+    this.createdate = createdate;
+  }
+
+  public TVoucher(Integer periodYear, Integer periodMonth, Integer voucherno, Integer voucherdate, Integer transdate, Integer transcnt, Double amount, String summary, Integer entrycnt, Integer attachments, String sourcetype, Integer signflag, Integer checkflag, Integer postflag, Integer invalidflag, Integer editflag, String preparer, String cashier, String checker, String poster, Integer createdate) {
+    this.periodYear = periodYear;
+    this.periodMonth = periodMonth;
+    this.voucherno = voucherno;
+    this.voucherdate = voucherdate;
+    this.transdate = transdate;
+    this.transcnt = transcnt;
+    this.amount = amount;
+    this.summary = summary;
+    this.entrycnt = entrycnt;
+    this.attachments = attachments;
+    this.sourcetype = sourcetype;
+    this.signflag = signflag;
+    this.checkflag = checkflag;
+    this.postflag = postflag;
+    this.invalidflag = invalidflag;
+    this.editflag = editflag;
+    this.preparer = preparer;
+    this.cashier = cashier;
+    this.checker = checker;
+    this.poster = poster;
+    this.createdate = createdate;
+  }
+
+  public String getVoucherid() {
+    return voucherid;
+  }
+
+  public void setVoucherid(String voucherid) {
+    this.voucherid = voucherid;
+  }
+
+  public Integer getPeriodYear() {
+    return periodYear;
+  }
+
+  public void setPeriodYear(Integer periodYear) {
+    this.periodYear = periodYear;
+  }
+
+  public Integer getPeriodMonth() {
+    return periodMonth;
+  }
+
+  public void setPeriodMonth(Integer periodMonth) {
+    this.periodMonth = periodMonth;
+  }
+
+  public Integer getVoucherno() {
+    return voucherno;
+  }
+
+  public void setVoucherno(Integer voucherno) {
+    this.voucherno = voucherno;
+  }
+
+  public Integer getVoucherdate() {
+    return voucherdate;
+  }
+
+  public void setVoucherdate(Integer voucherdate) {
+    this.voucherdate = voucherdate;
+  }
+
+  public Integer getTransdate() {
+    return transdate;
+  }
+
+  public void setTransdate(Integer transdate) {
+    this.transdate = transdate;
+  }
+
+  public Integer getTranscnt() {
+    return transcnt;
+  }
+
+  public void setTranscnt(Integer transcnt) {
+    this.transcnt = transcnt;
+  }
+
+  public Double getAmount() {
+    return amount;
+  }
+
+  public void setAmount(Double amount) {
+    this.amount = amount;
+  }
+
+  public String getSummary() {
+    return summary;
+  }
+
+  public void setSummary(String summary) {
+    this.summary = summary;
+  }
+
+  public Integer getEntrycnt() {
+    return entrycnt;
+  }
+
+  public void setEntrycnt(Integer entrycnt) {
+    this.entrycnt = entrycnt;
+  }
+
+  public Integer getAttachments() {
+    return attachments;
+  }
+
+  public void setAttachments(Integer attachments) {
+    this.attachments = attachments;
+  }
+
+  public String getSourcetype() {
+    return sourcetype;
+  }
+
+  public void setSourcetype(String sourcetype) {
+    this.sourcetype = sourcetype;
+  }
+
+  public Integer getSignflag() {
+    return signflag;
+  }
+
+  public void setSignflag(Integer signflag) {
+    this.signflag = signflag;
+  }
+
+  public Integer getCheckflag() {
+    return checkflag;
+  }
+
+  public void setCheckflag(Integer checkflag) {
+    this.checkflag = checkflag;
+  }
+
+  public Integer getPostflag() {
+    return postflag;
+  }
+
+  public void setPostflag(Integer postflag) {
+    this.postflag = postflag;
+  }
+
+  public Integer getInvalidflag() {
+    return invalidflag;
+  }
+
+  public void setInvalidflag(Integer invalidflag) {
+    this.invalidflag = invalidflag;
+  }
+
+  public Integer getEditflag() {
+    return editflag;
+  }
+
+  public void setEditflag(Integer editflag) {
+    this.editflag = editflag;
+  }
+
+  public String getPreparer() {
+    return preparer;
+  }
+
+  public void setPreparer(String preparer) {
+    this.preparer = preparer;
+  }
+
+  public String getCashier() {
+    return cashier;
+  }
+
+  public void setCashier(String cashier) {
+    this.cashier = cashier;
+  }
+
+  public String getChecker() {
+    return checker;
+  }
+
+  public void setChecker(String checker) {
+    this.checker = checker;
+  }
+
+  public String getPoster() {
+    return poster;
+  }
+
+  public void setPoster(String poster) {
+    this.poster = poster;
+  }
+
+  public Integer getCreatedate() {
+    return createdate;
+  }
+
+  public void setCreatedate(Integer createdate) {
+    this.createdate = createdate;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVoucherEntry.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVoucherEntry.java
new file mode 100644
index 0000000..a0d08c7
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVoucherEntry.java
@@ -0,0 +1,172 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_VOUCHERENTRY")
+@IdClass(TVoucherEntryPK.class)
+public class TVoucherEntry {
+  @Id
+  @Column(name = "VOUCHERID",nullable = false, length = 32)
+  private String voucherid;
+
+  @Id
+  @Column(name = "ENTRYID", precision = 2)
+  private Integer entryid;
+
+  @Column(name="SUBJNO", length = 10)
+  private String subjno;
+
+  @Column(name="ACCNO", length = 32)
+  private String accno;
+
+  @Column(name="DRAMT", precision = 15, scale = 2)
+  private Double dramt;
+
+  @Column(name="CRAMT", precision = 15, scale = 2)
+  private Double cramt;
+
+  @Column(name="BALANCE", precision = 15, scale = 2)
+  private Double balance;
+
+  @Column(name="BALFLAG", precision = 1)
+  private Integer balflag;
+
+  @Column(name="SUMMARY", length = 240)
+  private String summary;
+
+  @Column(name="OPPSUBJNO", length = 10)
+  private String oppsubjno;
+
+  @Column(name="OPPACCNO", length = 32)
+  private String oppaccno;
+
+  @Column(name = "OPPNAME", length = 240)
+  private String oppname;
+
+  public TVoucherEntry() {
+  }
+
+  public TVoucherEntry(String voucherid, Integer entryid, String subjno, String accno, Double dramt, Double cramt, String summary, String oppsubjno, String oppaccno) {
+    this.voucherid = voucherid;
+    this.entryid = entryid;
+    this.subjno = subjno;
+    this.accno = accno;
+    this.dramt = dramt;
+    this.cramt = cramt;
+    this.summary = summary;
+    this.oppsubjno = oppsubjno;
+    this.oppaccno = oppaccno;
+  }
+
+  public TVoucherEntry(String voucherid, Integer entryid, String subjno, String accno, Double dramt, Double cramt, Double balance, Integer balflag, String summary, String oppsubjno, String oppaccno, String oppname) {
+    this.voucherid = voucherid;
+    this.entryid = entryid;
+    this.subjno = subjno;
+    this.accno = accno;
+    this.dramt = dramt;
+    this.cramt = cramt;
+    this.balance = balance;
+    this.balflag = balflag;
+    this.summary = summary;
+    this.oppsubjno = oppsubjno;
+    this.oppaccno = oppaccno;
+    this.oppname = oppname;
+  }
+
+  public String getVoucherid() {
+    return voucherid;
+  }
+
+  public void setVoucherid(String voucherid) {
+    this.voucherid = voucherid;
+  }
+
+  public Integer getEntryid() {
+    return entryid;
+  }
+
+  public void setEntryid(Integer entryid) {
+    this.entryid = entryid;
+  }
+
+  public String getSubjno() {
+    return subjno;
+  }
+
+  public void setSubjno(String subjno) {
+    this.subjno = subjno;
+  }
+
+  public String getAccno() {
+    return accno;
+  }
+
+  public void setAccno(String accno) {
+    this.accno = accno;
+  }
+
+  public Double getDramt() {
+    return dramt;
+  }
+
+  public void setDramt(Double dramt) {
+    this.dramt = dramt;
+  }
+
+  public Double getCramt() {
+    return cramt;
+  }
+
+  public void setCramt(Double cramt) {
+    this.cramt = cramt;
+  }
+
+  public Double getBalance() {
+    return balance;
+  }
+
+  public void setBalance(Double balance) {
+    this.balance = balance;
+  }
+
+  public Integer getBalflag() {
+    return balflag;
+  }
+
+  public void setBalflag(Integer balflag) {
+    this.balflag = balflag;
+  }
+
+  public String getSummary() {
+    return summary;
+  }
+
+  public void setSummary(String summary) {
+    this.summary = summary;
+  }
+
+  public String getOppsubjno() {
+    return oppsubjno;
+  }
+
+  public void setOppsubjno(String oppsubjno) {
+    this.oppsubjno = oppsubjno;
+  }
+
+  public String getOppaccno() {
+    return oppaccno;
+  }
+
+  public void setOppaccno(String oppaccno) {
+    this.oppaccno = oppaccno;
+  }
+
+  public String getOppname() {
+    return oppname;
+  }
+
+  public void setOppname(String oppname) {
+    this.oppname = oppname;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVoucherEntryPK.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVoucherEntryPK.java
new file mode 100644
index 0000000..751af0f
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVoucherEntryPK.java
@@ -0,0 +1,51 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class TVoucherEntryPK implements Serializable {
+  @Id
+  @Column(name = "VOUCHERID", nullable = false, length = 32)
+  private String voucherid;
+
+  @Id
+  @Column(name = "ENTRYID", precision = 2)
+  private Integer entryid;
+
+  public String getVoucherid() {
+    return voucherid;
+  }
+
+  public void setVoucherid(String voucherid) {
+    this.voucherid = voucherid;
+  }
+
+  public Integer getEntryid() {
+    return entryid;
+  }
+
+  public void setEntryid(Integer entryid) {
+    this.entryid = entryid;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+    TVoucherEntryPK tVoucherEntryPK = (TVoucherEntryPK) o;
+    if (voucherid != null ? !voucherid.equals(tVoucherEntryPK.getVoucherid()) : voucherid != null)
+      return false;
+    if (entryid != null ? !entryid.equals(tVoucherEntryPK.getEntryid()) : entryid != null)
+      return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int result = voucherid != null ? voucherid.hashCode() : 0;
+    result = 31 * result + (entryid != null ? entryid.hashCode() : 0);
+    return result;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVouchernoCtl.java b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVouchernoCtl.java
new file mode 100644
index 0000000..44757b7
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/domain/TVouchernoCtl.java
@@ -0,0 +1,44 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_VOUCHERNOCTL")
+public class TVouchernoCtl {
+  @Id
+  @Column(name="VOUCHERTYPE", nullable = false, precision = 2)
+  private Integer vouchertype;
+
+  @Column(name="PERIOD_MONTH", nullable = false, precision = 2)
+  private Integer periodMonth;
+
+  @Column(name = "VOUCHERNO", nullable = false, precision = 9)
+  private Integer voucherno;
+
+  public Integer getVouchertype() {
+    return vouchertype;
+  }
+
+  public void setVouchertype(Integer vouchertype) {
+    this.vouchertype = vouchertype;
+  }
+
+  public Integer getPeriodMonth() {
+    return periodMonth;
+  }
+
+  public void setPeriodMonth(Integer periodMonth) {
+    this.periodMonth = periodMonth;
+  }
+
+  public Integer getVoucherno() {
+    return voucherno;
+  }
+
+  public void setVoucherno(Integer voucherno) {
+    this.voucherno = voucherno;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/service/DayendSettleService.java b/src/main/kotlin/com/supwisdom/dlpay/framework/service/DayendSettleService.java
new file mode 100644
index 0000000..3891fc2
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/service/DayendSettleService.java
@@ -0,0 +1,13 @@
+package com.supwisdom.dlpay.framework.service;
+
+import com.supwisdom.dlpay.framework.domain.TSettleLog;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+public interface DayendSettleService {
+  TSettleLog doCreateSettleLog();
+  TSettleLog doUpdateSettleLog(TSettleLog log);
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  boolean doDayendSettle() throws Exception;
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/service/SystemUtilService.java b/src/main/kotlin/com/supwisdom/dlpay/framework/service/SystemUtilService.java
new file mode 100644
index 0000000..ede550b
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/service/SystemUtilService.java
@@ -0,0 +1,19 @@
+package com.supwisdom.dlpay.framework.service;
+
+import com.supwisdom.dlpay.framework.data.SystemDateTime;
+import com.supwisdom.dlpay.framework.domain.TTaskLock;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+public interface SystemUtilService {
+
+  SystemDateTime getSysdatetime();
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  TTaskLock updateTaskLock(TTaskLock lock);
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  TTaskLock doLockTask(String taskcode, Integer minRecover, String remark);
+
+
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java b/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java
new file mode 100644
index 0000000..1129259
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java
@@ -0,0 +1,457 @@
+package com.supwisdom.dlpay.framework.service.impl;
+
+import com.supwisdom.dlpay.consume.dao.DpsdtlDao;
+import com.supwisdom.dlpay.consume.dao.TransdtlDao;
+import com.supwisdom.dlpay.framework.dao.*;
+import com.supwisdom.dlpay.framework.data.*;
+import com.supwisdom.dlpay.framework.domain.*;
+import com.supwisdom.dlpay.framework.service.DayendSettleService;
+import com.supwisdom.dlpay.framework.service.SystemUtilService;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.framework.util.MoneyUtil;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.framework.util.TradeDict;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class DayendSettleServiceImpl implements DayendSettleService {
+  @Autowired
+  private SystemUtilService systemUtilService;
+  @Autowired
+  private SettleLogDao settleLogDao;
+  @Autowired
+  private SettleCtlDao settleCtlDao;
+  @Autowired
+  private PeriodDao periodDao;
+  @Autowired
+  private VouchernoCtlDao vouchernoCtlDao;
+  @Autowired
+  private ShopaccDao shopaccDao;
+  @Autowired
+  private ShopaccbalDao shopaccbalDao;
+  @Autowired
+  private SubjectDao subjectDao;
+  @Autowired
+  private SubjectbalDao subjectbalDao;
+  @Autowired
+  private VoucherDao voucherDao;
+  @Autowired
+  private VoucherEntryDao voucherEntryDao;
+  @Autowired
+  private DpsdtlDao dpsdtlDao;
+  @Autowired
+  private TransdtlDao transdtlDao;
+  @Autowired
+  private ShopaccdayDao shopaccdayDao;
+  @Autowired
+  private SubjectdayDao subjectdayDao;
+
+
+  private static final Logger logger = Logger.getLogger(DayendSettleServiceImpl.class);
+
+  private int hostdate;
+  private int periodYear; // 记账年份
+  private int periodMonth; // 记账月份
+  private int settledate; //结算日期
+  private int lastsettday; //结算前一天
+
+  @Override
+  public TSettleLog doCreateSettleLog() {
+    TSettleLog log = new TSettleLog();
+    log.setStarttime(systemUtilService.getSysdatetime().getHostdatetime());
+    return settleLogDao.save(log);
+  }
+
+  @Override
+  public TSettleLog doUpdateSettleLog(TSettleLog log) {
+    if (null == log) return null;
+    log.setEndtime(systemUtilService.getSysdatetime().getHostdatetime());
+    return settleLogDao.save(log);
+  }
+
+  private boolean doSwitchPeriod() throws Exception {
+    TPeriod period = periodDao.getTPeriodWithLock(periodYear, periodMonth);
+    if (period.getSettleflag() == 1) {
+      throw new Exception("月末结转已完成");
+    }
+    period.setSettleflag(1);
+    periodDao.save(period); //已结
+
+    if (periodMonth >= 12) {
+      periodMonth = 1;
+      periodYear = periodYear + 1; //年份加一
+    } else {
+      periodMonth = periodMonth + 1; //year不变
+    }
+
+    TPeriod nextPerid = periodDao.getPeriod(periodYear, periodMonth);
+    if (null != nextPerid) {
+      if (settledate != Integer.valueOf(nextPerid.getStartdate())) {
+        throw new Exception("下一个会计期间的开始日期不正确");
+      } else if (nextPerid.getSettleflag() == 1) {
+        throw new Exception("下一个会计期间的月末结转已完成");
+      }
+    } else {
+      Integer startdate = periodYear * 10000 + periodMonth * 100 + 1;
+      Integer enddate = DateUtil.getLastDayOfMonth(periodYear, periodMonth);
+      if (settledate != startdate) {
+        throw new Exception("下一个会计期间的开始日期不正确");
+      }
+      nextPerid = new TPeriod();
+      nextPerid.setPeriodYear(periodYear);
+      nextPerid.setPeriodMonth(periodMonth);
+      nextPerid.setStartdate(startdate.toString());
+      nextPerid.setEnddate(enddate.toString());
+      nextPerid.setSettleflag(0);
+      periodDao.save(nextPerid); //保存下个会计期间
+    }
+
+    settleCtlDao.updateSettlePeriod(periodYear, periodMonth);
+    vouchernoCtlDao.updateVoucherno(periodMonth, 0);
+    return true;
+  }
+
+  private void saveVoucher(VoucherTemp voucherTemp) {
+    TVoucher voucher = new TVoucher(periodYear, periodMonth, 0, settledate, settledate, voucherTemp.getTranscnt(), Math.abs(voucherTemp.getTransamt()), voucherTemp.getSummary(), "auto", hostdate);
+    voucher = voucherDao.save(voucher);
+    TVoucherEntry entry1;
+    TVoucherEntry entry2;
+    if (voucherTemp.getTransamt() >= 0) {
+      entry1 = new TVoucherEntry(voucher.getVoucherid(), 1, voucherTemp.getDrsubjno(), null, Math.abs(voucherTemp.getTransamt()), 0D, voucherTemp.getSummary(), voucherTemp.getCrsubjno(), voucherTemp.getShopaccno());
+      entry2 = new TVoucherEntry(voucher.getVoucherid(), 2, voucherTemp.getCrsubjno(), voucherTemp.getShopaccno(), 0D, Math.abs(voucherTemp.getTransamt()), voucherTemp.getSummary(), voucherTemp.getDrsubjno(), null);
+    } else {
+      entry1 = new TVoucherEntry(voucher.getVoucherid(), 1, voucherTemp.getCrsubjno(), voucherTemp.getShopaccno(), 0D, Math.abs(voucherTemp.getTransamt()), voucherTemp.getSummary(), voucherTemp.getDrsubjno(), null);
+      entry2 = new TVoucherEntry(voucher.getVoucherid(), 2, voucherTemp.getDrsubjno(), null, Math.abs(voucherTemp.getTransamt()), 0D, voucherTemp.getSummary(), voucherTemp.getCrsubjno(), voucherTemp.getShopaccno());
+    }
+    voucherEntryDao.save(entry1);
+    voucherEntryDao.save(entry2);
+  }
+
+  @Override
+  public boolean doDayendSettle() throws Exception {
+    TSettlectl tSettlectl = settleCtlDao.findByBooksetno(1);
+    if (null == tSettlectl) {
+      throw new Exception("初始化错误,T_SETTLECTL 无初始化数据");
+    }
+    tSettlectl.setStatus(1); //结算标记
+    settleCtlDao.save(tSettlectl);
+
+    hostdate = Integer.valueOf(systemUtilService.getSysdatetime().getHostdate());
+    periodYear = tSettlectl.getPeriodYear();
+    periodMonth = tSettlectl.getPeriodMonth();
+    settledate = tSettlectl.getSettledate();
+    lastsettday = Integer.valueOf(DateUtil.getNewDay(tSettlectl.getSettledate().toString(), -1));
+
+    if (settledate >= hostdate) {
+      throw new Exception("日终结算已完成");
+    }
+
+    TPeriod period = periodDao.getPeriod(periodYear, periodMonth);
+    if (null == period) throw new Exception("year=[" + periodYear + "],month=[" + periodMonth + "] t_period not find ");
+    if (settledate > Integer.valueOf(period.getEnddate())) {
+      //月切
+      if (!doSwitchPeriod()) {
+        throw new Exception("月切失败");
+      }
+    }
+
+    //新增商户插入商户余额表
+    List<AccnoBean> newShopaccList = shopaccDao.getNewShopacc();
+    if (!StringUtil.isEmpty(newShopaccList)) {
+      for (AccnoBean bean : newShopaccList) {
+        TShopaccbal shopaccbal = new TShopaccbal(bean.getAccno());
+        shopaccbalDao.save(shopaccbal);
+      }
+    }
+    if (shopaccDao.checkSettleShopacc().getExisted() > 0) {
+      throw new Exception("初始化数据错误:商户余额表数据没有包含所有有效的商户账户余额");
+    }
+
+    //新增科目插入科目余额表(末级科目)
+    List<AccnoBean> newEndsubjectList = subjectDao.getNewSubject();
+    if (!StringUtil.isEmpty(newEndsubjectList)) {
+      for (AccnoBean bean : newEndsubjectList) {
+        TSubjectbal subjectbal = new TSubjectbal(bean.getAccno());
+        subjectbalDao.save(subjectbal);
+      }
+    }
+    if (subjectDao.checkSettleSubject().getExisted() > 0) {
+      throw new Exception("初始化数据错误:科目余额表数据没有包含所有的科目余额");
+    }
+
+    //删除未入账凭证
+    if (voucherDao.checkExistUnpostVouhcer().getExisted() > 0) {
+      voucherEntryDao.deleteUnpostVoucherentry();
+      voucherDao.deleteUnpostVoucher();
+    }
+
+    //充值凭证
+    List<VoucherTemp> dpsList = dpsdtlDao.getVoucherData(String.valueOf(settledate));
+    if (!StringUtil.isEmpty(dpsList)) {
+      for (VoucherTemp dps : dpsList) {
+        saveVoucher(dps);
+      }
+    }
+
+    List<VoucherTemp> dpsfeeList = dpsdtlDao.getFeeVoucherData(String.valueOf(settledate));
+    if (!StringUtil.isEmpty(dpsfeeList)) {
+      for (VoucherTemp dpsfee : dpsfeeList) {
+        saveVoucher(dpsfee);
+      }
+    }
+
+    //消费凭证
+    List<VoucherTemp> payList = transdtlDao.getFeeVoucherData(String.valueOf(settledate));
+    if (!StringUtil.isEmpty(payList)) {
+      for (VoucherTemp pay : payList) {
+        saveVoucher(pay);
+      }
+    }
+
+    List<VoucherTemp> payfeeList = transdtlDao.getFeeVoucherData(String.valueOf(settledate));
+    if (!StringUtil.isEmpty(payfeeList)) {
+      for (VoucherTemp payfee : payfeeList) {
+        saveVoucher(payfee);
+      }
+    }
+
+    //凭证号
+    TVouchernoCtl vouchernoCtl = vouchernoCtlDao.getVoucherno();
+    if (null == vouchernoCtl) {
+      vouchernoCtl = new TVouchernoCtl();
+      vouchernoCtl.setVouchertype(1);
+      vouchernoCtl.setPeriodMonth(periodMonth);
+      vouchernoCtl.setVoucherno(0);
+      vouchernoCtlDao.save(vouchernoCtl);
+    }
+    int voucherno = vouchernoCtl.getVoucherno();
+    List<TVoucher> voucherList = voucherDao.getSettleVouchers();
+    if (StringUtil.isEmpty(voucherList)) {
+      for (TVoucher voucher : voucherList) {
+        voucherno++;
+        voucher.setVoucherno(voucherno);
+        voucher.setPostflag(1);
+        voucherDao.save(voucher);
+      }
+      vouchernoCtl.setVoucherno(voucherno);
+      vouchernoCtlDao.save(vouchernoCtl);
+    }
+
+    Map<String, Double> v_merchbaldict = new HashMap<String, Double>(0);
+    //根据商户昨天日结表生成当天日结表(交易前余额), 新增商户添加记录(交易前余额为商户余额)
+    List<TShopaccday> lastShopaccdays = shopaccdayDao.getShopaccdayByAccdate(String.valueOf(lastsettday));
+    if (StringUtil.isEmpty(lastShopaccdays)) {
+      for (TShopaccday lastday : lastShopaccdays) {
+        TShopaccday today = new TShopaccday(String.valueOf(settledate), lastday.getShopaccno(), periodYear, periodMonth, lastday.getBalance(), 0D, 0D, 0D);
+        shopaccdayDao.save(today);
+        v_merchbaldict.put(lastday.getShopaccno(), lastday.getBalance());
+      }
+    }
+    List<TShopaccbal> newShopbals = shopaccbalDao.getUnsettleShopacc(String.valueOf(lastsettday));
+    if (!StringUtil.isEmpty(newShopbals)) {
+      for (TShopaccbal newShopbal : newShopbals) {
+        TShopaccday today = new TShopaccday(String.valueOf(settledate), newShopbal.getShopaccno(), periodYear, periodMonth, newShopbal.getBeginbal(), 0D, 0D, 0D);
+        shopaccdayDao.save(today);
+        v_merchbaldict.put(newShopbal.getShopaccno(), newShopbal.getBeginbal());
+      }
+    }
+    List<MerchBean> merchBeanList = voucherDao.getShopVoucherByAccdate(settledate);
+    if (!StringUtil.isEmpty(merchBeanList)) {
+      for (MerchBean merch : merchBeanList) {
+        TShopaccday merchday = shopaccdayDao.getTShopaccdayById(String.valueOf(settledate), merch.getShopaccno());
+        if (null == merchday) {
+          throw new Exception("商户余额表无此商户账号[" + merch.getShopaccno() + "]");
+        }
+        merchday.setDramt(merch.getDramt() == null ? 0D : merch.getDramt());
+        merchday.setCramt(merch.getCramt() == null ? 0D : merch.getCramt());
+        shopaccdayDao.save(merchday);
+      }
+    }
+    shopaccdayDao.updateShopaccdayBalance(String.valueOf(settledate), systemUtilService.getSysdatetime().getHostdatetime()); //批量更新余额,商户日结表生成
+
+    //根据科目昨天日结表生成当天日结表(交易前借贷方余额),新增末级科目插入记录(交易前余额为科目贷方余额)
+    List<TSubjectday> lastSubjectDays = subjectdayDao.getAllByAccdate(String.valueOf(lastsettday));
+    if (!StringUtil.isEmpty(lastSubjectDays)) {
+      for (TSubjectday lastday : lastSubjectDays) {
+        TSubjectday today = new TSubjectday(String.valueOf(settledate), lastday.getSubjno(), periodYear, periodMonth, lastday.getDrbal(), lastday.getCrbal(), 0D, 0D, 0D, 0D);
+        subjectdayDao.save(today);
+      }
+    }
+    List<TSubjectbal> newSubjectBals = subjectbalDao.getUnsettleSubjectbal(String.valueOf(lastsettday));
+    if (StringUtil.isEmpty(newSubjectBals)) {
+      for (TSubjectbal newSubject : newSubjectBals) {
+        TSubjectday today = new TSubjectday(String.valueOf(settledate), newSubject.getSubjno(), periodYear, periodMonth, newSubject.getBegindrbal(), newSubject.getBegincrbal(), 0D, 0D, 0D, 0D);
+        subjectdayDao.save(today);
+      }
+    }
+    List<AccnoBean> newFSubjnos = subjectDao.getNewSubjnos(String.valueOf(settledate)); //新增非末级科目
+    if (!StringUtil.isEmpty(newFSubjnos)) {
+      for (AccnoBean bean : newFSubjnos) {
+        double beginDrbal = 0;
+        double beginCrbal = 0;
+        MerchBean balInfo = subjectbalDao.getSubjectInfo(bean.getAccno()); //统计下级所有科目的交易前余额
+        if (null != balInfo) {
+          beginDrbal = (balInfo.getDramt() == null ? 0 : balInfo.getDramt().doubleValue());
+          beginCrbal = (balInfo.getCramt() == null ? 0 : balInfo.getCramt().doubleValue());
+        }
+        TSubjectday today = new TSubjectday(String.valueOf(settledate), bean.getAccno(), periodYear, periodMonth, beginDrbal, beginCrbal, 0D, 0D, 0D, 0D);
+        subjectdayDao.save(today);
+      }
+    }
+
+    //初始化末级科目期初余额(包含商户科目)
+    Map<String, Double> v_subjbaldict = new HashMap<String, Double>(0);
+    Map<String, Integer> v_subjbalflagdict = new HashMap<String, Integer>(0);
+    List<MerchBean> subjectList = subjectdayDao.getEndSubjectbalInfos(String.valueOf(settledate));
+    if (StringUtil.isEmpty(subjectList)) {
+      for (MerchBean bean : subjectList) {
+        v_subjbaldict.put(bean.getShopaccno(), MoneyUtil.formatYuan(bean.getDramt() + bean.getCramt()));
+      }
+    }
+
+    List<SubjectInfoBean> subjInfoList = subjectbalDao.getSubjectbalAndFlag();
+    for (SubjectInfoBean subj : subjInfoList) {
+      TSubjectday tSubjectday = subjectdayDao.getSubjectDayById(String.valueOf(settledate), subj.getSubjno());
+      if (null == tSubjectday) {
+        throw new Exception("科目日结表无此科目记录[" + subj.getSubjno() + "]");
+      }
+
+      v_subjbalflagdict.put(subj.getSubjno(), subj.getBalflag());
+      MerchBean suminfo = voucherDao.getSettleSuminfo(settledate, subj.getSubjno());
+      double sumDramt = ((null == suminfo || null == suminfo.getDramt()) ? 0 : suminfo.getDramt().doubleValue());
+      double sumCramt = ((null == suminfo || null == suminfo.getCramt()) ? 0 : suminfo.getCramt().doubleValue());
+      tSubjectday.setDramt(sumDramt);
+      tSubjectday.setCramt(sumCramt);
+      tSubjectday.setUpdtime(systemUtilService.getSysdatetime().getHostdatetime());
+      if (subj.getBalflag() == 1) {
+        tSubjectday.setDrbal(MoneyUtil.formatYuan(tSubjectday.getBegindrbal() + sumDramt - sumCramt));
+      } else {
+        tSubjectday.setCrbal(MoneyUtil.formatYuan(tSubjectday.getBegincrbal() - sumDramt + sumCramt));
+      }
+      subjectdayDao.save(tSubjectday);
+    }
+    //根据二级更新一级科目日结
+    List<TSubjectday> parentSubject = subjectdayDao.getParentSubjectday(String.valueOf(settledate));
+    for (TSubjectday fsub : parentSubject) {
+      FSubjectInfoBean sumInfo = subjectdayDao.getParentSumInfo(String.valueOf(settledate), fsub.getSubjno());
+      fsub.setBegindrbal((null == sumInfo || null == sumInfo.getBegindrbal()) ? 0D : sumInfo.getBegindrbal());
+      fsub.setBegincrbal((null == sumInfo || null == sumInfo.getBegincrbal()) ? 0D : sumInfo.getBegincrbal());
+      fsub.setDramt((null == sumInfo || null == sumInfo.getDramt()) ? 0D : sumInfo.getDramt());
+      fsub.setCramt((null == sumInfo || null == sumInfo.getCramt()) ? 0D : sumInfo.getCramt());
+      fsub.setDrbal((null == sumInfo || null == sumInfo.getDrbal()) ? 0D : sumInfo.getDrbal());
+      fsub.setCrbal((null == sumInfo || null == sumInfo.getCrbal()) ? 0D : sumInfo.getCrbal());
+      fsub.setUpdtime(systemUtilService.getSysdatetime().getHostdatetime());
+      subjectdayDao.save(fsub);
+    }
+
+    //批量更新凭证明细中商户或科目账户的余额
+    List<TVoucherEntry> entryList = voucherEntryDao.getVoucherEntryByVoucherdate(settledate);
+    if (!StringUtil.isEmpty(entryList)) {
+      for (TVoucherEntry vce : entryList) {
+        if (TradeDict.SUBJNO_SHOP.equals(vce.getSubjno())) {
+          //商户科目
+          Double befbal = v_merchbaldict.get(vce.getAccno());
+          if (null == befbal) throw new Exception("商户表商户账号[" + vce.getAccno() + "]不存在");
+          v_merchbaldict.put(vce.getAccno(), MoneyUtil.formatYuan(befbal + vce.getCramt() - vce.getDramt())); //更新余额
+          vce.setBalflag(2);
+          vce.setBalance(v_merchbaldict.get(vce.getAccno()));
+          if (!StringUtil.isEmpty(vce.getOppaccno())) {
+            vce.setOppname(shopaccDao.getShopname(vce.getOppaccno()).getAccname());
+          } else {
+            vce.setOppname(subjectDao.getSubjectname(vce.getOppsubjno()).getAccname());
+          }
+          voucherEntryDao.save(vce);
+          Double befMerchbal = v_subjbaldict.get(vce.getSubjno());
+          if (null == befMerchbal) throw new Exception("商户科目号[" + vce.getSubjno() + "]不存在");
+          v_subjbaldict.put(vce.getSubjno(), MoneyUtil.formatYuan(befMerchbal - vce.getDramt() + vce.getCramt())); //商户科目总余额更新
+        } else {
+          //其他科目
+          Integer balflag = v_subjbalflagdict.get(vce.getSubjno());
+          Double befbal = v_subjbaldict.get(vce.getSubjno());
+          if (null == balflag || null == befbal) throw new Exception("科目表科目号[" + vce.getSubjno() + "]不存在");
+          if (balflag == 1) {
+            v_subjbaldict.put(vce.getSubjno(), MoneyUtil.formatYuan(befbal + vce.getDramt() - vce.getCramt()));
+          } else {
+            v_subjbaldict.put(vce.getSubjno(), MoneyUtil.formatYuan(befbal - vce.getDramt() + vce.getCramt()));
+          }
+          vce.setBalflag(balflag);
+          vce.setBalance(v_subjbaldict.get(vce.getSubjno()));
+          if (!StringUtil.isEmpty(vce.getOppaccno())) {
+            vce.setOppname(shopaccDao.getShopname(vce.getOppaccno()).getAccname());
+          } else {
+            vce.setOppname(subjectDao.getSubjectname(vce.getOppsubjno()).getAccname());
+          }
+          voucherEntryDao.save(vce);
+        }
+      }
+    }
+
+    //开始校验
+    //核算商户日结表商户余额 和凭证明细余额是否一致
+    for (String shopaccno : v_merchbaldict.keySet()) {
+      TShopaccday tShopaccday = shopaccdayDao.getTShopaccdayById(String.valueOf(settledate), shopaccno);
+      if (!MoneyUtil.moneyEqual(v_merchbaldict.get(shopaccno), tShopaccday.getBalance())) {
+        throw new Exception("结算后检查失败:商户余额不等,商户余额[" + tShopaccday.getBalance() + "]凭证商户余额[" + v_merchbaldict.get(shopaccno) + "]");
+      }
+      TShopaccbal tShopaccbal = shopaccbalDao.getOne(shopaccno);
+      tShopaccbal.setBalance(tShopaccday.getBalance());
+      tShopaccbal.setUpdtime(systemUtilService.getSysdatetime().getHostdatetime());
+      shopaccbalDao.save(tShopaccbal);
+    }
+    //核算科目日结表科目余额和凭证明细余额是否一致
+    for (String subjno : v_subjbaldict.keySet()) {
+      TSubjectday tSubjectday = subjectdayDao.getSubjectDayById(String.valueOf(settledate), subjno);
+      if (!MoneyUtil.moneyEqual(v_subjbaldict.get(subjno), tSubjectday.getDrbal() + tSubjectday.getCrbal())) {
+        throw new Exception("结算后检查失败:科目日结表期末余额不等,科目号[" + subjno + "],科目余额[" + (tSubjectday.getDrbal() + tSubjectday.getCrbal()) + "],凭证科目余额[" + v_subjbaldict.get(subjno) + "]");
+      }
+      TSubjectbal tSubjectbal = subjectbalDao.getOne(subjno);
+      tSubjectbal.setBegindrbal(tSubjectday.getBegindrbal());
+      tSubjectbal.setBegincrbal(tSubjectday.getBegincrbal());
+      tSubjectbal.setDramt(tSubjectday.getDramt());
+      tSubjectbal.setCramt(tSubjectday.getCramt());
+      tSubjectbal.setDrbal(tSubjectday.getDrbal());
+      tSubjectbal.setCrbal(tSubjectday.getCrbal());
+      tSubjectbal.setUpdtime(systemUtilService.getSysdatetime().getHostdatetime());
+      subjectbalDao.save(tSubjectbal);
+    }
+    //核对商户日结表余额表和科目日结表商户余额是否一致
+    TSubjectday shopSubjectday = subjectdayDao.getSubjectDayById(String.valueOf(settledate), TradeDict.SUBJNO_SHOP);
+    AmountBean merchbal = shopaccdayDao.getSumBalance(String.valueOf(settledate));
+    double shopSubbal = (shopSubjectday == null ? 0 : shopSubjectday.getCrbal());
+    double shopMerchbal = ((null == merchbal || null == merchbal.getAmount()) ? 0 : merchbal.getAmount());
+    if (!MoneyUtil.moneyEqual(shopSubbal, shopMerchbal)) {
+      throw new Exception("结算后检查失败:商户日结表和科目日结表期末余额不平衡,商户[" + shopMerchbal + "] 科目[" + shopSubbal + "]");
+    }
+    //核算一级科目余额是否平衡
+    FSubjectInfoBean allParentSubjbal = subjectdayDao.getAllParentSubjectSumInfo(String.valueOf(settledate));
+    if (!MoneyUtil.moneyEqual(allParentSubjbal.getBegindrbal(), allParentSubjbal.getBegincrbal())) {
+      throw new Exception("结算后检查失败:一级科目余额表期初余额不平衡,借方[" + allParentSubjbal.getBegindrbal() + "],贷方[" + allParentSubjbal.getBegincrbal() + "]");
+    }
+    if (!MoneyUtil.moneyEqual(allParentSubjbal.getDramt(), allParentSubjbal.getCramt())) {
+      throw new Exception("结算后检查失败:一级科目余额表发生额不平衡,借方[" + allParentSubjbal.getDramt() + "],贷方[" + allParentSubjbal.getCramt() + "]");
+    }
+    if (!MoneyUtil.moneyEqual(allParentSubjbal.getDrbal(), allParentSubjbal.getCrbal())) {
+      throw new Exception("结算后检查失败:一级科目余额表期末额不平衡,借方[" + allParentSubjbal.getDrbal() + "]贷方[" + allParentSubjbal.getCrbal() + "]");
+    }
+    //校验科目余额表的balflag=1的总期末余额和balflag=2的总期末余额是否一致
+    AmountBean balflag_1_sumbal = subjectbalDao.getSumEndsubjectBalByEndflag(1);
+    AmountBean balflag_2_sumbal = subjectbalDao.getSumEndsubjectBalByEndflag(2);
+    if (null == balflag_1_sumbal || null == balflag_1_sumbal) throw new Exception("结算后检查失败:科目余额表无数据");
+    if (!MoneyUtil.moneyEqual(balflag_1_sumbal.getAmount(), balflag_2_sumbal.getAmount())) {
+      throw new Exception("结算后检查失败:科目余额表期末余额不平衡,借方[" + balflag_1_sumbal.getAmount() + "],贷方[" + balflag_2_sumbal.getAmount() + "]");
+    }
+    //TODO: 校验 账户余额汇总值和科目日结表值是否一致
+
+    //日切
+    tSettlectl.setStatus(0); //清标记
+    tSettlectl.setSettledate(Integer.valueOf(DateUtil.getNewDay(String.valueOf(settledate),1)));
+    tSettlectl.setUpdtime(systemUtilService.getSysdatetime().getHostdatetime());
+    return true;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java b/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
new file mode 100644
index 0000000..863b206
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
@@ -0,0 +1,64 @@
+package com.supwisdom.dlpay.framework.service.impl;
+
+import com.supwisdom.dlpay.framework.dao.TaskLockDao;
+import com.supwisdom.dlpay.framework.data.SystemDateTime;
+import com.supwisdom.dlpay.framework.domain.TTaskLock;
+import com.supwisdom.dlpay.framework.service.SystemUtilService;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+@Service
+public class SystemUtilServiceImpl implements SystemUtilService {
+  @PersistenceContext
+  private EntityManager entityManager;
+  @Autowired
+  private TaskLockDao taskLockDao;
+
+  /**
+   * 获取oracle数据库时间
+   */
+  private SystemDateTime getOracleDatetime() {
+    SystemDateTime systemDateTime = taskLockDao.getOracleDatetime();
+    return systemDateTime;
+  }
+
+  @Override
+  public SystemDateTime getSysdatetime() {
+    return getOracleDatetime();
+  }
+
+  @Override
+  public TTaskLock updateTaskLock(TTaskLock lock){
+    return taskLockDao.save(lock);
+  }
+
+  @Override
+  public TTaskLock doLockTask(String taskcode, Integer minRecover, String remark) {
+    if (null == minRecover) minRecover = 10; //默认10分钟
+    String hostdatetime = getSysdatetime().getHostdatetime(); //yyyyMMddHHmmss
+    TTaskLock lock = taskLockDao.getTaskLockWithLock(taskcode);
+    if (lock != null) {
+      if (lock.getTaskstatus().intValue() == 1 && DateUtil.compareDatetime(DateUtil.getNewTime(hostdatetime, -60 * minRecover), lock.getTasktime()) < 0) {
+        // 被锁,正在执行操作
+        return null;
+      } else {
+        lock.setTaskstatus(1);
+        lock.setTasktime(hostdatetime);
+        taskLockDao.save(lock);
+        return lock;
+      }
+    } else {
+      lock = new TTaskLock();
+      lock.setTaskcode(taskcode);
+      lock.setTaskstatus(1);
+      lock.setTasktime(hostdatetime);
+      lock.setRemark(remark);
+      taskLockDao.save(lock);
+    }
+    return lock;
+  }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/util/DateUtil.java b/src/main/kotlin/com/supwisdom/dlpay/framework/util/DateUtil.java
new file mode 100644
index 0000000..90ff6bc
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/util/DateUtil.java
@@ -0,0 +1,291 @@
+package com.supwisdom.dlpay.framework.util;
+
+import org.apache.log4j.Logger;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+public class DateUtil {
+  private static final Logger logger = Logger.getLogger(DateUtil.class);
+
+  private static final DateFormat dateTimeFormat = new SimpleDateFormat("yyyyMMddHHmmss");
+
+  private static final DateFormat dayFormat = new SimpleDateFormat("yyyyMMdd");
+
+  /**
+   * Description: 返回一个当前时间 @return String 格式:yyyyMMddHHmmss @exception Modify
+   * History:
+   */
+  public static String getNow() {
+    return dateTimeFormat.format(new Date());
+  }
+
+
+  /**
+   * Description: 根据类型返回一个当前时间 @param partten String @return String 格式:partten
+   */
+  public static String getNow(String partten) {
+    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(partten);
+    return sdf.format(new Date());
+  }
+
+  /**
+   * Description: 得到一个特殊的时间 @param startTime String 格式:yyyyMMddHHmmss @param
+   * interval int 秒 @return String 格式:partten @exception Modify History:
+   */
+  public static String getNewTime(String startTime, int interval) {
+    try {
+      Date d = dateTimeFormat.parse(startTime);
+      Calendar calendar = Calendar.getInstance();
+      calendar.setTimeInMillis(d.getTime());
+      calendar.add(Calendar.SECOND, interval);
+      return dateTimeFormat.format(calendar.getTime());
+    } catch (ParseException e) {
+      return startTime;
+    }
+  }
+
+  /**
+   * Description: 得到一个特殊的时间 @param startTime String 格式:partten @param
+   * interval int 秒 @return String 格式:partten @exception Modify History:
+   */
+  public static String getNewTime(String startTime, int interval, String partten) {
+    try {
+      java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(partten);
+      Date d = sdf.parse(startTime);
+      Calendar calendar = Calendar.getInstance();
+      calendar.setTimeInMillis(d.getTime());
+      calendar.add(Calendar.SECOND, interval);
+      return sdf.format(calendar.getTime());
+    } catch (ParseException e) {
+      return startTime;
+    }
+  }
+
+  public static String getNewDay(String startDay, int intervalday) {
+    try {
+      Date d = dayFormat.parse(startDay);
+      Calendar calendar = Calendar.getInstance();
+      calendar.setTimeInMillis(d.getTime());
+      calendar.add(Calendar.DATE, intervalday);
+      return dayFormat.format(calendar.getTime());
+    } catch (ParseException e) {
+      return startDay;
+    }
+  }
+
+  /**
+   * 得到两个日期相差的天数 格式 yyyyMMdd @return diffdays = secondDay - firstDay
+   */
+  public static long getIntervalDay(String firstDay, String secondDay) {
+    try {
+      Date f = dayFormat.parse(firstDay);
+      Date s = dayFormat.parse(secondDay);
+      long time = s.getTime() - f.getTime();
+      return time / (24 * 60 * 60 * 1000);
+    } catch (ParseException e) {
+      return 0;
+    }
+  }
+
+  /**
+   * Description: 比较两个时间字符串的前后关系 @param firstTime String 格式:yyyyMMddHHmmss
+   *
+   * @param secondTime String 格式: yyyyMMddHHmmss @return int |
+   * firstTime=second int=0 | firstTime>secondTime int>0 |
+   * firstTime<secondTime int<0 @exception Modify History:
+   */
+  public static int compareDatetime(String firstTime, String secondTime) {
+    try {
+      Date f = dateTimeFormat.parse(firstTime);
+      Date s = dateTimeFormat.parse(secondTime);
+      return f.compareTo(s);
+    } catch (ParseException e) {
+      return 0;
+    }
+  }
+
+  /**
+   * Description: 比较两个时间字符串的前后关系 @param firstTime String 格式:pattern
+   * @param secondTime String 格式: yyyyMMddHHmmss @return int |
+   * firstTime=second int=0 | firstTime>secondTime int>0 |
+   * firstTime<secondTime int<0 @exception Modify History:
+   */
+  public static int compareDatetime(String firstTime, String secondTime, String pattern) {
+    try {
+      java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+      Date f = sdf.parse(firstTime);
+      Date s = sdf.parse(secondTime);
+      return f.compareTo(s);
+    } catch (ParseException e) {
+      return 0;
+    }
+  }
+
+  /**
+   * Description: 比较两个时间字符串的时间差 @param firstTime String 格式:yyyyMMddHHmmss
+   *
+   * @param secondTime String 格式: yyyyMMddHHmmss @param second int 格式 @return
+   * int | firstTime+seconds=secondTime int=0 | firstTime+seconds>secondTime
+   * int>0 | firstTime+seconds<secondTime int<0 @exception Modify History:
+   */
+  public static int compareDatetime(String firstTime, String secondTime, int seconds) {
+    try {
+      Date f = dateTimeFormat.parse(firstTime);
+      Date s = dateTimeFormat.parse(secondTime);
+      Calendar calendar = Calendar.getInstance();
+      calendar.setTimeInMillis(f.getTime());
+      calendar.add(Calendar.SECOND, seconds);
+      Date temp = calendar.getTime();
+      return temp.compareTo(s);
+    } catch (Exception e) {
+      return 0;
+    }
+  }
+
+  /**
+   * Description: 对time重新格式化
+   */
+  public static String reformatDatetime(String time, String fromPattern, String toPattern) {
+    try {
+      java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(fromPattern);
+      Date d = sdf.parse(time);
+      Calendar calendar = Calendar.getInstance();
+      calendar.setTimeInMillis(d.getTime());
+      sdf = new SimpleDateFormat(toPattern);
+      return sdf.format(calendar.getTime());
+    } catch (Exception e) {
+      e.printStackTrace();
+      return time;
+    }
+  }
+
+  /**
+   * 获得两个字符串日期之间的时间差(单位毫秒) 格式 yyyyMMddHHmmss
+   */
+  public static long getInterval(String startTime, String endTime) {
+    long duration = 0;
+    try {
+      duration = dateTimeFormat.parse(endTime).getTime() - dateTimeFormat.parse(startTime).getTime();
+    } catch (ParseException e) {
+      logger.error("Hi guys,there is an error when you try to parse the date string");
+    }
+    return duration;
+  }
+
+  /**
+   * 获得两个字符串日期之间的时间差(单位毫秒)
+   * */
+  public static long getIntervalTime(String startTime, String endTime, String pattern) {
+    long duration = 0;
+    try {
+      java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+      duration = sdf.parse(endTime).getTime() - sdf.parse(startTime).getTime();
+    } catch (ParseException e) {
+      logger.error("Hi guys,there is an error when you try to parse the date string");
+    }
+    return duration;
+  }
+
+  /**
+   * 转换成日期格式
+   * 短格式:20140401 -> 2014-04-01
+   * 中格式:201404011200 -> 2014-04-01 12:00
+   * 长格式:20140401123025 -> 2014-04-01 12:30:25
+   * **/
+  public static String parseToDateFormat(String str){
+    switch(str.length()){
+      case 8:
+        str = str.substring(0, 4)+"-"+str.substring(4, 6)+"-"+str.substring(6, 8);
+        break;
+      case 12:
+        str = str.substring(0, 4)+"-"+str.substring(4, 6)+"-"+str.substring(6, 8)+" "+str.substring(8, 10)+":"+str.substring(10, 12);
+        break;
+      case 14:
+        str = str.substring(0, 4)+"-"+str.substring(4, 6)+"-"+str.substring(6, 8)+" "+str.substring(8, 10)+":"+str.substring(10, 12)+":"+str.substring(12, 14);
+        break;
+      default:
+        break;
+    }
+    return str;
+  }
+
+  /**
+   * 解日期格式
+   * 短格式:2014-04-01 -> 20140401
+   * 中格式:2014-04-01 12:00 -> 201404011200
+   * 长格式:2014-04-01 12:30:25 -> 20140401123025
+   * **/
+  public static String unParseToDateFormat(String str){
+    return str.replaceAll("-", "").replaceAll(" ", "").replaceAll(":", "");
+  }
+
+  /**
+   * 检验时间格式
+   * */
+  public static boolean checkDatetimeValid(String datetime, String pattern) {
+    if (null == datetime) return false;
+    try {
+      java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+      Date d = sdf.parse(datetime);
+      return true;
+    } catch (Exception e) {
+    }
+    return false;
+  }
+
+  /**
+   * 获取指定日期是星期几 格式 yyyyMMdd
+   * MON|TUE|WED|THU|FRI|SAT|SUN
+   * 	1		2		3		4		5		6		7
+   * */
+  public static int getWeekday(String datestr) {
+    try {
+      Calendar calendar = Calendar.getInstance();
+      boolean isFirstSunday = (calendar.getFirstDayOfWeek() == Calendar.SUNDAY); //一周第一天是否为星期天
+      Date d = dayFormat.parse(datestr);
+      calendar.setTimeInMillis(d.getTime());
+      int weekDay = calendar.get(calendar.DAY_OF_WEEK);
+      if (isFirstSunday) {
+        weekDay = weekDay - 1;
+        if (weekDay == 0) {
+          weekDay = 7;
+        }
+      }
+      return weekDay;
+    } catch (Exception e) {
+      return -1;
+    }
+  }
+
+  /**
+   * 获取指定日期
+   */
+  public static Date getSpecifyDate(String datestr, String pattern) {
+    try {
+      java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+      Date result = sdf.parse(datestr);
+      return result;
+    } catch (Exception e) {
+      return new Date();
+    }
+  }
+
+  public static Integer getLastDayOfMonth(Integer year,Integer month){
+    Calendar cal = Calendar.getInstance();
+    cal.set(Calendar.YEAR, year);
+    cal.set(Calendar.MONTH, month-1);
+    cal.set(Calendar.DAY_OF_MONTH,cal.getActualMaximum(Calendar.DATE));
+    String str = new SimpleDateFormat( "yyyyMMdd ").format(cal.getTime()).toString();
+    Integer result = Integer.parseInt(str.substring(0,4) + str.substring(4,6) + str.substring(6,8));
+    return result;
+  }
+
+
+
+
+
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/util/MoneyUtil.java b/src/main/kotlin/com/supwisdom/dlpay/framework/util/MoneyUtil.java
new file mode 100644
index 0000000..0ac1b7b
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/util/MoneyUtil.java
@@ -0,0 +1,32 @@
+package com.supwisdom.dlpay.framework.util;
+
+import java.text.DecimalFormat;
+
+public class MoneyUtil {
+
+  public static int YuanToFen(double yuan) {
+    return (int) (Math.round(yuan * 100));
+  }
+
+  public static boolean moneyEqual(double x1, double x2) {
+    return YuanToFen(x1) == YuanToFen(x2);
+  }
+
+  public static int moneyCompare(double x1, double x2) {
+    return YuanToFen(x1) - YuanToFen(x2);
+  }
+
+  public static double formatYuan(double yuan) {
+    DecimalFormat df = new DecimalFormat("##0.00");
+    double money = ((double) YuanToFen(yuan)) / 100;
+    return Double.valueOf(df.format(money));
+  }
+
+  public static String formatYuanToString(Double yuan) {
+    if (null == yuan) return "0.00";
+    DecimalFormat df = new DecimalFormat("##0.00");
+    double money = ((double) YuanToFen(yuan)) / 100;
+    return df.format(money);
+  }
+
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/util/StringUtil.java b/src/main/kotlin/com/supwisdom/dlpay/framework/util/StringUtil.java
new file mode 100644
index 0000000..ec46c63
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/util/StringUtil.java
@@ -0,0 +1,27 @@
+package com.supwisdom.dlpay.framework.util;
+
+import java.util.List;
+
+public class StringUtil {
+  /**
+   * 判断字符串是否为空
+   */
+  public static boolean isEmpty(String str) {
+    if (null == str || "".equals(str) || "".equals(str.trim())) {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * 判断List是否为空
+   */
+  public static boolean isEmpty(List list) {
+    if (null == list || list.size() <= 0) {
+      return true;
+    }
+    return false;
+  }
+
+
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/util/TradeCode.java b/src/main/kotlin/com/supwisdom/dlpay/framework/util/TradeCode.java
new file mode 100644
index 0000000..b206704
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/util/TradeCode.java
@@ -0,0 +1,9 @@
+package com.supwisdom.dlpay.framework.util;
+
+/**
+ * 交易码、交易类型
+ * */
+public class TradeCode {
+  public static final int TRANSCODE_PAY = 6630;
+  public static final int TRANSTYPE_PAY = 311;
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/util/TradeDict.java b/src/main/kotlin/com/supwisdom/dlpay/framework/util/TradeDict.java
new file mode 100644
index 0000000..685ad9f
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/util/TradeDict.java
@@ -0,0 +1,36 @@
+package com.supwisdom.dlpay.framework.util;
+
+public class TradeDict {
+  /**
+   * 状态:
+   * normal -- 正常
+   * closed -- 注销
+   * locked -- 锁定、冻结
+   */
+  public static final String STATUS_NORMAL = "normal";
+  public static final String STATUS_CLOSED = "closed";
+  public static final String STATUS_LOCKED = "locked";
+
+  /**
+   * 流水状态
+   * temp -- 临时流水
+   * init -- 初始化流水
+   * success -- 交易成功
+   * fail -- 交易失败
+   * cancel -- 交易取消
+   */
+  public static final String DTL_STATUS_TEMP = "temp";
+  public static final String DTL_STATUS_INIT = "init";
+  public static final String DTL_STATUS_SUCCESS = "success";
+  public static final String DTL_STATUS_FAIL = "fail";
+  public static final String DTL_STATUS_CANCEL = "cancel";
+
+  /**
+   * 科目定义 subjno
+   * 2004 - 商户科目
+   * 220201 - 个人存款
+   * */
+  public static final String SUBJNO_SHOP = "2004";
+  public static final String SUBJNO_ACCOUNT = "220201";
+
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/main/resources/application.properties
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..bdc24e9
--- /dev/null
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
+         version="4.0">
+
+</web-app>
\ No newline at end of file
diff --git a/src/main/webapp/pages/index.jsp b/src/main/webapp/pages/index.jsp
new file mode 100644
index 0000000..ee21225
--- /dev/null
+++ b/src/main/webapp/pages/index.jsp
@@ -0,0 +1,9 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+<head>
+    <title>支付平台页面</title>
+</head>
+<body>
+    欢迎访问支付平台!
+</body>
+</html>
diff --git a/src/test/kotlin/com/supwisdom/dlpay/DlpayApplicationTests.kt b/src/test/kotlin/com/supwisdom/dlpay/DlpayApplicationTests.kt
new file mode 100644
index 0000000..625cdbd
--- /dev/null
+++ b/src/test/kotlin/com/supwisdom/dlpay/DlpayApplicationTests.kt
@@ -0,0 +1,16 @@
+package com.supwisdom.dlpay
+
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.springframework.boot.test.context.SpringBootTest
+import org.springframework.test.context.junit4.SpringRunner
+
+@RunWith(SpringRunner::class)
+@SpringBootTest
+class DlpayApplicationTests {
+
+    @Test
+    fun contextLoads() {
+    }
+
+}