Merge tag '1.0.0' into develop
发布 1.0.0 版本
diff --git a/.gitignore b/.gitignore
index 317f857..54c6516 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,8 @@
*.iml
*.ipr
/out/
+/**/out/
+/**/build/
### NetBeans ###
/nbproject/private/
@@ -30,3 +32,19 @@
### VS Code ###
.vscode/
+### Gradle template
+.gradle
+/build/
+
+# Ignore Gradle GUI config
+gradle-app.setting
+
+# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
+!gradle-wrapper.jar
+
+# Cache of project
+.gradletasknamecache
+
+# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
+# gradle/wrapper/gradle-wrapper.properties
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f9357b8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,23 @@
+GRADLE=./gradlew
+
+.PHONY: clean build
+
+build:
+ $(GRADLE) build -x test
+
+clean:
+ $(GRADLE) clean
+
+test:
+ $(GRADLE) test
+
+docker: build
+ $(GRADLE) payapi:docker
+ $(GRADLE) ynrcc-agent:docker
+
+push: docker
+ docker push harbor.supwisdom.com/dali/payapi
+ docker push harbor.supwisdom.com/dali/ynrcc
+
+publish: build
+ $(GRADLE) publish
diff --git a/build.gradle b/build.gradle
index 4c26d8a..5892649 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,87 +1,26 @@
plugins {
- id 'war'
- id 'org.springframework.boot'
- id 'org.jetbrains.kotlin.jvm'
- id 'org.jetbrains.kotlin.plugin.jpa'
- id 'org.jetbrains.kotlin.plugin.spring'
+ id 'java'
+ id 'org.springframework.boot' version '2.1.6.RELEASE'
+ id 'org.jetbrains.kotlin.jvm' version '1.3.31'
+ id 'org.jetbrains.kotlin.plugin.spring' version '1.3.31'
id "com.palantir.git-version" version "0.12.0-rc2"
+ id 'com.palantir.docker' version '0.22.1'
}
-apply plugin: 'io.spring.dependency-management'
-
-payapiVersion = gitVersion()
-
-group = 'com.supwisdom'
-version = payapiVersion
-sourceCompatibility = jdkVersion
-
-println("Build version: $version")
-repositories {
- mavenCentral()
-}
-
-war {
- manifest {
- attributes('Payapi-Version': rootProject.version)
- writeTo(project.buildDir.toString() + "/classes/MATE-INF.MF")
+allprojects {
+ repositories {
+ jcenter()
+ mavenCentral()
}
+
}
-dependencies {
- implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
- implementation 'org.springframework.boot:spring-boot-starter-data-redis'
- implementation 'org.springframework.boot:spring-boot-starter-web'
- implementation 'org.springframework.boot:spring-boot-starter-security'
- implementation 'org.springframework.boot:spring-boot-starter-cache'
- implementation 'org.springframework.security:spring-security-oauth2-client'
- implementation 'org.springframework.security:spring-security-oauth2-jose'
- implementation 'org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.1.5.RELEASE'
- implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
- implementation 'org.springframework.session:spring-session-data-redis'
- implementation 'org.springframework.boot:spring-boot-starter-cache'
- implementation 'org.springframework.social:spring-social-web:1.1.6.RELEASE'
- implementation 'org.jetbrains.kotlin:kotlin-reflect'
- implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
-
- implementation 'org.springframework.cloud:spring-cloud-starter-consul-discovery:2.1.2.RELEASE'
-
- implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
-
- implementation 'org.postgresql:postgresql:42.2.5'
- implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
- implementation 'com.jcabi:jcabi-manifests:1.1'
- implementation 'org.bitbucket.b_c:jose4j:0.6.3'
- implementation 'io.github.microutils:kotlin-logging:1.6.26'
- implementation 'org.slf4j:slf4j-parent:1.7.26'
- implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
- implementation group: 'com.sun.jersey', name: 'jersey-client', version: '1.19'
- implementation group: 'javax.servlet', name: 'jstl', version: '1.2'
- implementation group: 'taglibs', name: 'standard', version: '1.1.2'
- implementation group: 'commons-codec', name: 'commons-codec', version: '1.6'
- implementation files('libs/ojdbc6.jar')
- implementation 'commons-dbcp:commons-dbcp:1.4'
-
- annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
- annotationProcessor 'org.projectlombok:lombok:1.18.8'
- compileOnly 'org.projectlombok:lombok:1.18.8'
-
- providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
- testImplementation 'org.springframework.boot:spring-boot-starter-test'
- testImplementation 'io.rest-assured:rest-assured:3.3.0'
- testImplementation 'io.rest-assured:spring-mock-mvc:3.3.0'
- testImplementation 'org.hamcrest:hamcrest:2.1'
+subprojects {
+ version = '1.0'
}
-compileKotlin {
- kotlinOptions {
- freeCompilerArgs = ['-Xjsr305=strict']
- jvmTarget = jdkVersion
- }
+bootJar {
+ enabled = false
}
-compileTestKotlin {
- kotlinOptions {
- freeCompilerArgs = ['-Xjsr305=strict']
- jvmTarget = jdkVersion
- }
-}
+group = 'com.supwisdom'
\ No newline at end of file
diff --git a/config/application-devel-agent.properties b/config/application-devel-agent.properties
new file mode 100644
index 0000000..8b266dd
--- /dev/null
+++ b/config/application-devel-agent.properties
@@ -0,0 +1,6 @@
+############# YNRCC SOCKET ###############
+ynrcc.socket.ip=127.0.0.1
+ynrcc.socket.port=8089
+## 超时时间(分钟)
+ynrcc.socket.timeout = 10
+ynrcc.md5.key=80816b7947ed016bff8079557735006e
\ No newline at end of file
diff --git a/config/application-devel-pg-local.properties b/config/application-devel-pg-local.properties
index 3e4a318..3b2dd4a 100644
--- a/config/application-devel-pg-local.properties
+++ b/config/application-devel-pg-local.properties
@@ -12,10 +12,9 @@
spring.datasource.password=123456
database.dbtype=postgresql
# Redis settings
-redis.server=localhost
-redis.port=6379
-redis.password=
-redis.database=0
+spring.redis.host=localhost
+spring.redis.port=6379
+spring.redis.password=
# jwt settings
jwt.secret=Zj5taLomEbrM0lk+NMQZbHfSxaDU1wekjT+kiC3YzDw=
# timeout seconds
@@ -30,3 +29,6 @@
spring.cloud.consul.enabled=false
spring.cloud.consul.host=172.28.201.70
spring.cloud.consul.port=8500
+resttemplate.proxy.type=http
+resttemplate.proxy.host=127.0.0.1
+resttemplate.proxy.port=1087
diff --git a/config/application-devel-pg-xkx.properties b/config/application-devel-pg-xkx.properties
new file mode 100644
index 0000000..bd19698
--- /dev/null
+++ b/config/application-devel-pg-xkx.properties
@@ -0,0 +1,31 @@
+spring.main.banner-mode=off
+# create and drop tables and sequences, loads import.sql
+spring.jpa.hibernate.ddl-auto=update
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
+spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
+spring.datasource.continue-on-error=true
+spring.datasource.initialization-mode=always
+# Postgresql settings
+spring.datasource.platform=postgresql
+spring.datasource.url=jdbc:postgresql://localhost:15432/payapi
+spring.datasource.username=admin
+spring.datasource.password=123456
+database.dbtype=postgresql
+# Redis settings
+spring.redis.host=localhost
+spring.redis.port=16379
+spring.redis.password=kingstar
+# jwt settings
+jwt.secret=Zj5taLomEbrM0lk+NMQZbHfSxaDU1wekjT+kiC3YzDw=
+# timeout seconds
+jwt.expiration=3600
+# user password
+auth.password.bcrypt.seed=
+security.request.sign=false
+##################################################
+## quartz task scheduler
+shopbalance.updater.cron=-
+#############################################
+spring.cloud.consul.enabled=false
+spring.cloud.consul.host=172.28.201.70
+spring.cloud.consul.port=8500
diff --git a/config/application-devel-pg.properties b/config/application-devel-pg.properties
index 11d486d..8e2b45e 100644
--- a/config/application-devel-pg.properties
+++ b/config/application-devel-pg.properties
@@ -5,14 +5,17 @@
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
# Postgresql settings
spring.datasource.platform=postgresql
-spring.datasource.url=jdbc:postgresql://172.28.201.70:15432/payapi
+#spring.datasource.url=jdbc:postgresql://ykt.supwisdom.com:15432/payapidev
+spring.datasource.url=jdbc:postgresql://172.28.201.70:15432/payapidev
spring.datasource.username=payapi
spring.datasource.password=123456
+spring.datasource.continue-on-error=true
+spring.datasource.initialization-mode=always
# Redis settings
-redis.server=172.28.201.101
-redis.port=16379
-redis.password=kingstar
-redis.database=0
+#spring.redis.host=ykt.supwisdom.com
+spring.redis.host=172.28.201.101
+spring.redis.port=16379
+spring.redis.password=kingstar
# jwt settings
jwt.secret=Zj5taLomEbrM0lk+NMQZbHfSxaDU1wekjT+kiC3YzDw=
# timeout seconds
@@ -25,7 +28,6 @@
## quartz task scheduler
shopbalance.updater.cron=-
##################多租户配置 end################################
-
#############################################
spring.cloud.consul.enabled=false
spring.cloud.consul.host=172.28.201.70
diff --git a/gradle.properties b/gradle.properties
index f72e65c..acf8d17 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-springbootVersion = 2.1.3.RELEASE
-kotlinVersion = 1.3.31
payapiVersion = 1.0
-jdkVersion = 1.8
\ No newline at end of file
+jdkVersion = 1.8
+nxUser=ecard
+nxPassword=Ecard4SUP
\ No newline at end of file
diff --git a/payapi-common/build.gradle b/payapi-common/build.gradle
new file mode 100644
index 0000000..d0cdb6d
--- /dev/null
+++ b/payapi-common/build.gradle
@@ -0,0 +1,51 @@
+plugins {
+ id 'java-library'
+ id 'maven-publish'
+ id "com.palantir.git-version"
+}
+
+group = rootProject.group
+version = gitVersion()
+
+publishing {
+ publications {
+ mavenJava(MavenPublication) {
+ groupId = project.group
+ artifactId = project.name
+ version = version
+ from components.java
+ }
+ }
+ repositories {
+ maven {
+ // change URLs to point to your repos, e.g. http://my.org/repo
+ def releasesRepoUrl = "http://ykt-nx.supwisdom.com/repository/ecard-repo/"
+ def snapshotsRepoUrl = "http://ykt-nx.supwisdom.com/repository/ecard-repo/snapshot/"
+ url = version.endsWith('dirty') ? snapshotsRepoUrl : releasesRepoUrl
+ credentials(PasswordCredentials) {
+ username = nxUser
+ password = nxPassword
+ }
+ }
+ }
+}
+
+dependencies {
+ implementation 'org.slf4j:slf4j-parent:1.7.26'
+ implementation 'org.slf4j:slf4j-api:1.7.26'
+ implementation 'javax.validation:validation-api:2.0.1.Final'
+ implementation 'javax.servlet:javax.servlet-api:4.0.1'
+ implementation 'commons-beanutils:commons-beanutils:1.9.3'
+ implementation('org.springframework.boot:spring-boot-starter-validation:2.1.6.RELEASE')
+
+ implementation 'org.hibernate:hibernate-validator:6.0.2.Final'
+ compile 'javax.el:javax.el-api:3.0.0'
+ compile 'org.glassfish.web:javax.el:2.2.6'
+
+ compileOnly 'org.projectlombok:lombok:1.18.8'
+ annotationProcessor 'org.projectlombok:lombok:1.18.8'
+
+ implementation 'org.apache.commons:commons-lang3:3.9'
+
+ testImplementation 'junit:junit:4.12'
+}
\ No newline at end of file
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/APIRequestParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/APIRequestParam.java
new file mode 100644
index 0000000..5c89d17
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/APIRequestParam.java
@@ -0,0 +1,182 @@
+package com.supwisdom.dlpay.api;
+
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.beans.Introspector;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.*;
+
+public abstract class APIRequestParam {
+ @Sign
+ private String sign;
+ @Sign
+ private String sign_type;
+ @Sign
+ private String version;
+ @Sign
+ private String tenantid;
+
+ private static final Logger logger = LoggerFactory.getLogger(APIRequestParam.class);
+
+ public String getTenantid() {
+ return tenantid;
+ }
+
+ public void setTenantid(String tenantid) {
+ this.tenantid = tenantid;
+ }
+
+ public String getSign() {
+ return sign;
+ }
+
+ public void setSign(String sign) {
+ this.sign = sign;
+ }
+
+ public String getSign_type() {
+ return sign_type;
+ }
+
+ public void setSign_type(String sign_type) {
+ this.sign_type = sign_type;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ private String createLinkString(Map<String, String> params) {
+
+ List<String> keys = new ArrayList<String>(params.keySet());
+ Collections.sort(keys);
+
+ String prestr = "";
+
+ for (int i = 0; i < keys.size(); i++) {
+ String key = keys.get(i);
+ String value = params.get(key);
+
+ if (i == keys.size() - 1) {//拼接时,不包括最后一个&字符
+ prestr = prestr + key + "=" + value;
+ } else {
+ prestr = prestr + key + "=" + value + "&";
+ }
+ }
+
+ return prestr;
+ }
+
+ private Map<String, String> paraFilter(Map<String, String> sArray) {
+ Map<String, String> result = new HashMap<String, String>();
+ if (sArray == null || sArray.size() <= 0) {
+ return result;
+ }
+ for (String key : sArray.keySet()) {
+ String value = sArray.get(key);
+ if (null == value || "".equals(value.trim())
+ || "null".equalsIgnoreCase(value.trim())
+ || key.equalsIgnoreCase("sign")
+ || key.equalsIgnoreCase("sign_type")) {
+ continue;
+ }
+ result.put(key, value);
+ }
+ return result;
+ }
+
+ private String md5(String plainText) {
+ //定义一个字节数组
+ byte[] secretBytes = null;
+ try {
+ // 生成一个MD5加密计算摘要
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ //对字符串进行加密
+ md.update(plainText.getBytes());
+ //获得加密后的数据
+ secretBytes = md.digest();
+ } catch (NoSuchAlgorithmException e) {
+ throw new RuntimeException("没有md5这个算法!");
+ }
+ StringBuilder builder = new StringBuilder();
+ for (byte secretByte : secretBytes) {
+ builder.append(String.format("%02X", ((int) secretByte) & 0xFF));
+ }
+ return builder.toString();
+ }
+
+ private boolean calcSignAndCheck(Map<String, String> map, String key) {
+ String sign = map.get("sign");
+ String signType = map.get("sign_type") == null ? "MD5" : map.get("sign_type");
+ if (StringUtils.isEmpty(sign)) return false;
+
+ String signdata = createLinkString(paraFilter(map));
+ logger.info("signdata=[" + signdata + "]");
+
+ String calcSign = null;
+ //fixme: 根据 signType 计算签名
+ if ("MD5".equalsIgnoreCase(signType)) {
+ calcSign = md5(signdata + key); //默认MD5
+ }
+ if (sign.equalsIgnoreCase(calcSign)) {
+ return true;
+ }
+ return false;
+ }
+ private Map getParam(){
+ Class clazz = this.getClass();
+ Map<String, String> paramMap = new HashMap<>();
+ Method[] allGetter = clazz.getMethods();
+
+ for (Method meth : allGetter) {
+ if (meth.getName().startsWith("get") || meth.getName().startsWith("is")) {
+ String fieldName = Introspector.decapitalize(meth.getName().substring(meth.getName().startsWith("get") ? 3 : 2));
+ Field field;
+ try {
+ field = clazz.getDeclaredField(fieldName);
+ } catch (NoSuchFieldException e) {
+ try {
+ field = clazz.getSuperclass().getDeclaredField(fieldName);
+ } catch (NoSuchFieldException e1) {
+ continue;
+ }
+ }
+
+ if (field.isAnnotationPresent(Sign.class)) {
+ Object value;
+ try {
+ value = meth.invoke(this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ continue;
+ }
+ paramMap.put(fieldName, value == null ? null : value.toString());
+ }
+ }
+ }
+ return paramMap;
+ }
+
+ public boolean checkSign(String key) {
+ return calcSignAndCheck(getParam(), key);
+ }
+ public void generalSign(String key){
+ String signdata = createLinkString(paraFilter(getParam()));
+ String sign = md5(signdata + key);
+ this.sign = sign;
+ }
+
+ public abstract boolean checkParam() throws RequestParamCheckException;
+}
+
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/agent/Constant.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/agent/Constant.java
new file mode 100644
index 0000000..c135d58
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/agent/Constant.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.api.agent;
+
+public class Constant {
+ public static final String FLAG_PAY = "pay";
+ public static final String FLAG_REFUND = "refund";
+ public static final String STATUS_SUCCESS = "success";
+ public static final String STATUS_FAIL = "fail";
+
+ public static final String CHKFILE_DELIMITER = ",";
+
+
+ /////////////////////////////////////////////////////////////////
+ public static final String COL_REFNO = "refno";
+ public static final String COL_AGENT_REFNO = "agentrefno";
+ public static final String COL_AMOUNT = "amount";
+ public static final String COL_PAYERID = "payerid";
+ public static final String COL_PAYEEID = "payeeid";
+ public static final String COL_SUMMARY = "summary";
+ public static final String COL_AGENT_DATE = "agentdate";
+ public static final String COL_STATUS = "status";
+ public static final String COL_FLAG = "flag";
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/IDNoCheck.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/IDNoCheck.java
new file mode 100644
index 0000000..69f8007
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/IDNoCheck.java
@@ -0,0 +1,37 @@
+package com.supwisdom.dlpay.api.annotation;
+
+import com.supwisdom.dlpay.api.types.IDTypes;
+import com.supwisdom.dlpay.api.validator.IDNoCheckValidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = IDNoCheckValidator.class)
+@Documented
+public @interface IDNoCheck {
+ String message() default "{constraintdescriptor.fieldmatch}";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+
+ /**
+ * @return The idno field
+ */
+ String idno();
+
+ /**
+ * @return The idtype field
+ */
+ String idtype();
+
+ /**
+ * 证件类型字典
+ *
+ * @return
+ */
+ IDTypes value() default IDTypes.IDTYPE_LIST;
+}
\ No newline at end of file
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/IntegerList.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/IntegerList.java
new file mode 100644
index 0000000..8487906
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/IntegerList.java
@@ -0,0 +1,21 @@
+package com.supwisdom.dlpay.api.annotation;
+
+import com.supwisdom.dlpay.api.validator.StringListValidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+@Constraint(validatedBy = {StringListValidator.class})
+@Documented
+@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface IntegerList {
+ String message() default "{validator.message.integerlist}";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+
+ String[] value();
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/MobileNumber.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/MobileNumber.java
new file mode 100644
index 0000000..8558151
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/MobileNumber.java
@@ -0,0 +1,19 @@
+package com.supwisdom.dlpay.api.annotation;
+
+import com.supwisdom.dlpay.api.validator.MobileNumberValidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+@Constraint(validatedBy = {MobileNumberValidator.class})
+@Documented
+@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MobileNumber {
+ String message() default "手机号码不合法";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+}
\ No newline at end of file
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/Sex.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/Sex.java
new file mode 100644
index 0000000..5d7699c
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/Sex.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.api.annotation;
+
+import com.supwisdom.dlpay.api.types.SexTypes;
+import com.supwisdom.dlpay.api.validator.SexValidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+@Constraint(validatedBy = {SexValidator.class})
+@Documented
+@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Sex {
+ String message() default "不正确的性别 , 应该是 'male', 'female','unknown' 其中之一";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+
+ SexTypes value() default SexTypes.ALL;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/ShopType.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/ShopType.java
new file mode 100644
index 0000000..bcbd918
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/ShopType.java
@@ -0,0 +1,23 @@
+package com.supwisdom.dlpay.api.annotation;
+
+import com.supwisdom.dlpay.api.types.ShopTypes;
+import com.supwisdom.dlpay.api.validator.ShopTypeValidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+
+@Constraint(validatedBy = {ShopTypeValidator.class})
+@Documented
+@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ShopType {
+ String message() default "不正确的商户类型 ";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+
+ ShopTypes value() default ShopTypes.ALL;
+}
\ No newline at end of file
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/Sign.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/Sign.java
new file mode 100644
index 0000000..1c9d9ca
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/Sign.java
@@ -0,0 +1,12 @@
+package com.supwisdom.dlpay.api.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Sign {
+ int order() default 0;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/StringList.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/StringList.java
new file mode 100644
index 0000000..9b58839
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/StringList.java
@@ -0,0 +1,23 @@
+package com.supwisdom.dlpay.api.annotation;
+
+import com.supwisdom.dlpay.api.validator.StringListValidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+@Constraint(validatedBy = {StringListValidator.class})
+@Documented
+@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface StringList {
+ String message() default "{validator.message.stringlist}";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+
+ String[] value() default {};
+
+ String expr() default "";
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/UserStatus.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/UserStatus.java
new file mode 100644
index 0000000..bbfbc6d
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/UserStatus.java
@@ -0,0 +1,20 @@
+package com.supwisdom.dlpay.api.annotation;
+
+
+import com.supwisdom.dlpay.api.validator.UserStatusValidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+@Constraint(validatedBy = {UserStatusValidator.class})
+@Documented
+@Target({ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface UserStatus {
+ String message() default "不正确的状态 , 应该是 'open', 'closed', 'losed' 其中之一";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiLoginInitResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiLoginInitResponse.java
new file mode 100644
index 0000000..5eb21d4
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiLoginInitResponse.java
@@ -0,0 +1,16 @@
+package com.supwisdom.dlpay.api.bean;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+public class ApiLoginInitResponse extends ApiResponse {
+ private String timestamp;
+ private String token;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiLoginResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiLoginResponse.java
new file mode 100644
index 0000000..1499408
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiLoginResponse.java
@@ -0,0 +1,17 @@
+package com.supwisdom.dlpay.api.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class ApiLoginResponse extends ApiResponse {
+ private String jwt;
+ private String appid;
+ private String expiredAt;
+
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiResponse.java
new file mode 100644
index 0000000..1f34e8c
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiResponse.java
@@ -0,0 +1,13 @@
+package com.supwisdom.dlpay.api.bean;
+
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class ApiResponse {
+ private Integer retcode;
+ private String retmsg;
+ private String exception;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiVersionResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiVersionResponse.java
new file mode 100644
index 0000000..911777c
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ApiVersionResponse.java
@@ -0,0 +1,14 @@
+package com.supwisdom.dlpay.api.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+public class ApiVersionResponse extends ApiResponse {
+ private String version;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CitizenCardPayfinishParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CitizenCardPayfinishParam.java
new file mode 100644
index 0000000..5a997b2
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CitizenCardPayfinishParam.java
@@ -0,0 +1,23 @@
+package com.supwisdom.dlpay.api.bean;
+
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+public class CitizenCardPayfinishParam extends APIRequestParam {
+ @Sign
+ @NotNull(message = "交易参考号不能为空")
+ private String refno;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CitizenCardPayinitParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CitizenCardPayinitParam.java
new file mode 100644
index 0000000..175bdbc
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CitizenCardPayinitParam.java
@@ -0,0 +1,55 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import com.supwisdom.dlpay.api.util.DateUtil;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Positive;
+import java.util.List;
+
+@Getter
+@Setter
+public class CitizenCardPayinitParam extends APIRequestParam {
+ @Sign
+ @NotNull(message = "卡唯一号不能为空")
+ private String cardNo;
+
+ @Sign
+ @NotNull(message = "请指定交易商户")
+ private String shopaccno;
+
+ @Sign
+ @NotNull(message = "交易金额不能为空")
+ @Positive(message = "交易金额必须大于零")
+ private Integer amount;
+
+ private List<ConsumeFeetype> feelist;
+
+ @Sign
+ @NotNull(message = "对接系统唯一订单号不能为空")
+ private String billno;
+
+ @Sign
+ @NotNull(message = "交易日期不能为空")
+ private String transdate;
+ @Sign
+ @NotNull(message = "交易时间不能为空")
+ private String transtime;
+
+ @Sign
+ @NotNull(message = "流水类型不能为空")
+ private String dtltype;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT))
+ throw new RequestParamCheckException("交易日期错误[yyyyMMdd]");
+ if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT))
+ throw new RequestParamCheckException("交易时间错误[HHmmss]");
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CitizenPayResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CitizenPayResponse.java
new file mode 100644
index 0000000..c0b92e5
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CitizenPayResponse.java
@@ -0,0 +1,16 @@
+package com.supwisdom.dlpay.api.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class CitizenPayResponse extends ApiResponse {
+ private String refno;
+ private String billno;
+ private Double amount;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CommonQueryRechargeResultParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CommonQueryRechargeResultParam.java
new file mode 100644
index 0000000..e18d41e
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CommonQueryRechargeResultParam.java
@@ -0,0 +1,26 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
+
+
+@Getter
+@Setter
+public class CommonQueryRechargeResultParam extends APIRequestParam {
+ @Sign
+ private String refno;
+ @Sign
+ private String billno;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (StringUtils.isEmpty(refno) && StringUtils.isEmpty(billno)) {
+ throw new RequestParamCheckException("流水号不能为空");
+ }
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CommonRechargeConfirmParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CommonRechargeConfirmParam.java
new file mode 100644
index 0000000..17a2d10
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CommonRechargeConfirmParam.java
@@ -0,0 +1,23 @@
+package com.supwisdom.dlpay.api.bean;
+
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotEmpty;
+
+@Getter
+@Setter
+public class CommonRechargeConfirmParam extends APIRequestParam {
+ @Sign
+ @NotEmpty(message = "流水号不能为空")
+ private String refno;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CommonRechargeInitParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CommonRechargeInitParam.java
new file mode 100644
index 0000000..39099d2
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/CommonRechargeInitParam.java
@@ -0,0 +1,53 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import com.supwisdom.dlpay.api.util.DateUtil;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+@Getter
+@Setter
+public class CommonRechargeInitParam extends APIRequestParam {
+ @Sign
+ @NotNull(message = "请指定充值用户")
+ private String userid;
+
+ @Sign
+ @NotNull(message = "充值金额必须大于零")
+ @Min(value = 0L, message = "充值金额必须大于零")
+ private Integer amount;
+
+ private List<ConsumeFeetype> feelist;
+
+ @Sign
+ @NotEmpty(message = "请指定充值的支付方式")
+ private String sourcetype;
+
+ @Sign
+ @NotEmpty(message = "对接系统唯一订单号不能为空")
+ private String billno;
+
+ @Sign
+ @NotNull(message = "交易日期不能为空")
+ private String transdate;
+ @Sign
+ @NotNull(message = "交易时间不能为空")
+ private String transtime;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT))
+ throw new RequestParamCheckException("交易日期错误[yyyyMMdd]");
+ if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT))
+ throw new RequestParamCheckException("交易时间错误[HHmmss]");
+
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ConsumeFeetype.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ConsumeFeetype.java
new file mode 100644
index 0000000..c880685
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ConsumeFeetype.java
@@ -0,0 +1,16 @@
+package com.supwisdom.dlpay.api.bean;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class ConsumeFeetype {
+ private String feetype;
+ private Integer amount;
+
+ @Override
+ public String toString() {
+ return String.format("feetype='%s', amount=%d", feetype, amount);
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ConsumePayCancelParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ConsumePayCancelParam.java
new file mode 100644
index 0000000..3f1091d
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ConsumePayCancelParam.java
@@ -0,0 +1,45 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import com.supwisdom.dlpay.api.util.DateUtil;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+public class ConsumePayCancelParam extends APIRequestParam {
+ @Sign
+ @NotNull
+ private String refno;
+ @Sign
+ private String billno;
+ @Sign
+ private String shopaccno;
+ @Sign
+ @NotNull(message = "撤销或退款流水号不能为空")
+ private String requestbillno;
+ @Sign
+ @NotNull(message = "交易日期不能为空")
+ private String transdate;
+ @Sign
+ @NotNull(message = "交易时间不能为空")
+ private String transtime;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (StringUtils.isEmpty(refno) && (StringUtils.isEmpty(billno) || StringUtils.isEmpty(shopaccno)))
+ throw new RequestParamCheckException("原流水唯一号不能为空");
+ if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT)) {
+ throw new RequestParamCheckException("交易日期错误[yyyyMMdd]");
+ }
+ if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT)) {
+ throw new RequestParamCheckException("交易时间错误[HHmmss]");
+ }
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ConsumePayRefundParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ConsumePayRefundParam.java
new file mode 100644
index 0000000..1dc46f2
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ConsumePayRefundParam.java
@@ -0,0 +1,51 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import com.supwisdom.dlpay.api.util.DateUtil;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+public class ConsumePayRefundParam extends APIRequestParam {
+ @Sign
+ private String refno;
+ @Sign
+ private String billno;
+ @Sign
+ private String shopaccno;
+
+ @Sign
+ @Min(value = 0L, message = "错误的退款金额")
+ private Integer refundAmount;
+
+ @Sign
+ @NotNull(message = "撤销或退款流水号不能为空")
+ private String requestbillno;
+ @Sign
+ @NotNull(message = "交易日期不能为空")
+ private String transdate;
+ @Sign
+ @NotNull(message = "交易时间不能为空")
+ private String transtime;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (StringUtils.isEmpty(refno) && (StringUtils.isEmpty(billno) || StringUtils.isEmpty(shopaccno))) {
+ throw new RequestParamCheckException("原流水唯一号不能为空");
+ }
+ if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT)) {
+ throw new RequestParamCheckException("交易日期错误[yyyyMMdd]");
+ }
+ if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT)) {
+ throw new RequestParamCheckException("交易时间错误[HHmmss]");
+ }
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ModifyUserParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ModifyUserParam.java
new file mode 100644
index 0000000..37a5b84
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ModifyUserParam.java
@@ -0,0 +1,63 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import com.supwisdom.dlpay.api.util.Constants;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.validation.constraints.NotEmpty;
+
+@Getter
+@Setter
+public class ModifyUserParam extends APIRequestParam {
+ @Sign
+ @NotEmpty(message = "用户唯一号不能为空")
+ private String userid;
+ @Sign
+ private String uid;
+ @Sign
+ private String name;
+ @Sign
+ private String sex;
+ @Sign
+ private String idtype;
+ @Sign
+ private String idno;
+ @Sign
+ private String mobile;
+ @Sign
+ private String tel;
+ @Sign
+ private String email;
+ @Sign
+ private String address;
+ @Sign
+ private String zipcode;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (!StringUtils.isEmpty(sex) && !Constants.SEX_MALE.equals(sex) && !Constants.SEX_FEMALE.equals(sex)) {
+ throw new RequestParamCheckException("性别非法[male|female]");
+ }
+ if (!StringUtils.isEmpty(idtype)) {
+ throw new RequestParamCheckException("证件类型非法");
+ }
+ if (!StringUtils.isEmpty(idno) && !StringUtils.isAlphanumeric(idno)) {
+ throw new RequestParamCheckException("证件号不能为空,且仅支持数字和字母");
+ }
+ if (!StringUtils.isEmpty(idno) && StringUtils.isEmpty(idtype)) {
+ throw new RequestParamCheckException("证件号不能为空时,请指定证件类型");
+ }
+ if (!StringUtils.isEmpty(mobile) && !StringUtils.isNumeric(mobile)) {
+ throw new RequestParamCheckException("手机号格式错误");
+ }
+ if (!StringUtils.isEmpty(email)) {
+ throw new RequestParamCheckException("邮箱格式错误");
+ }
+ return true;
+ }
+}
+
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/NewUserCheck.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/NewUserCheck.java
new file mode 100644
index 0000000..08ec2f4
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/NewUserCheck.java
@@ -0,0 +1,4 @@
+package com.supwisdom.dlpay.api.bean;
+
+public interface NewUserCheck {
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/OpenShopParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/OpenShopParam.java
new file mode 100644
index 0000000..9f02dd4
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/OpenShopParam.java
@@ -0,0 +1,54 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.IDNoCheck;
+import com.supwisdom.dlpay.api.annotation.MobileNumber;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import com.supwisdom.dlpay.api.annotation.ShopType;
+import com.supwisdom.dlpay.api.types.IDTypes;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.Email;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+@IDNoCheck(value = IDTypes.IDTYPE_LIST, idno = "idno", idtype = "idtype", message = "证件类型错误")
+public class OpenShopParam extends APIRequestParam {
+ @Sign
+ @NotEmpty(message = "商户唯一号不能为空")
+ private String shopUniqueId;
+ @Sign
+ @ShopType
+ @NotNull(message = "商户类型不能为空")
+ private String shoptype;
+ @Sign
+ private Integer fshopid;
+ @Sign
+ @NotEmpty(message = "商户名称不能为空")
+ private String shopname;
+ @Sign
+ private String contactman;
+ @Sign
+ private String idtype;
+ @Sign
+ private String idno;
+ @Sign
+ @MobileNumber
+ private String mobile;
+ @Sign
+ @Email(message = "Email 格式错误")
+ private String email;
+ @Sign
+ private String address;
+ @Sign
+ private String zipcode;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/OpenUserParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/OpenUserParam.java
new file mode 100644
index 0000000..e24a632
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/OpenUserParam.java
@@ -0,0 +1,65 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.IDNoCheck;
+import com.supwisdom.dlpay.api.annotation.MobileNumber;
+import com.supwisdom.dlpay.api.annotation.Sex;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import com.supwisdom.dlpay.api.util.Constants;
+import com.supwisdom.dlpay.api.types.IDTypes;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.validation.constraints.Email;
+import javax.validation.constraints.NotEmpty;
+
+
+@Setter
+@Getter
+@IDNoCheck(value = IDTypes.IDTYPE_LIST, idno = "idno", idtype = "idtype", message = "证件类型错误")
+public class OpenUserParam extends APIRequestParam {
+ @Sign
+ @NotEmpty(message = "用户唯一号不能为空")
+ private String uid;
+ @Sign
+ @NotEmpty(message = "姓名不能为空")
+ private String name;
+ @Sign
+ @Sex
+ private String sex;
+ @Sign
+ @NotEmpty(message = "证件类型非法")
+ private String idtype;
+ @Sign
+ @NotEmpty(message = "证件号不能为空,且仅支持数字和字母")
+ private String idno;
+ @Sign
+ @MobileNumber(message = "手机号格式错误")
+ private String mobile;
+ @Sign
+ private String tel;
+ @Sign
+ @Email(message = "电子邮件格式不合法")
+ private String email;
+ @Sign
+ private String address;
+ @Sign
+ private String zipcode;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (!StringUtils.isEmpty(sex)&&!Constants.SEX_MALE.equals(sex) && !Constants.SEX_FEMALE.equals(sex)) {
+ throw new RequestParamCheckException("性别非法[male|female]");
+ }
+ if (StringUtils.isEmpty(idno) || !StringUtils.isAlphanumeric(idno)) {
+ throw new RequestParamCheckException("证件号不能为空,且仅支持数字和字母");
+ }
+ if (!StringUtils.isEmpty(mobile) && !StringUtils.isNumeric(mobile)) {
+ throw new RequestParamCheckException("手机号格式错误");
+ }
+ return true;
+ }
+}
+
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/PayReverseResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/PayReverseResponse.java
new file mode 100644
index 0000000..2c3c819
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/PayReverseResponse.java
@@ -0,0 +1,14 @@
+package com.supwisdom.dlpay.api.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+@Setter
+public class PayReverseResponse extends ApiResponse {
+ private String refno;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QrcodePayParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QrcodePayParam.java
new file mode 100644
index 0000000..600d773
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QrcodePayParam.java
@@ -0,0 +1,150 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.bean.groups.ConfirmAction;
+import com.supwisdom.dlpay.api.bean.groups.InitAction;
+import com.supwisdom.dlpay.api.bean.groups.QueryAction;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import org.springframework.stereotype.Service;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NegativeOrZero;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+public class QrcodePayParam extends APIRequestParam {
+ @Sign
+ @NotNull(message = "订单号不能为空", groups = {QueryAction.class, InitAction.class, ConfirmAction.class})
+ private String billno;
+
+ @Sign
+ @NotNull(message = "商户号不能为空", groups = {QueryAction.class, InitAction.class, ConfirmAction.class})
+ private String shopaccno;
+
+ @Sign
+ @NotEmpty(message = "支付码不能为空", groups = {InitAction.class})
+ private String qrcode;
+
+ @Sign
+ private String qrcodeFormat; // origin - 原始码, hex - hex format, base64 - base64 encode
+
+ @Sign
+ private String userid;
+
+ @Sign
+ @NotEmpty(message = "交易日期不能为空", groups = {InitAction.class, ConfirmAction.class})
+ private String transdate;
+
+ @Sign
+ @NotEmpty(message = "交易时间不能为空", groups = {InitAction.class, ConfirmAction.class})
+ private String transtime;
+
+ @Sign
+ @Min(value = 1L, message = "交易金额必须大于零", groups = ConfirmAction.class)
+ private Integer amount;
+
+ @Sign
+ @NotNull(message = "必须指定是否匿名支付", groups = ConfirmAction.class)
+ private Boolean anonymous;
+ @Sign
+ @NotEmpty(message = "流水类型不能为空", groups = {InitAction.class, ConfirmAction.class})
+ private String dtltype;
+
+ /**请求IP*/
+ @Sign
+ private String spip;
+
+ public String getDtltype() {
+ return dtltype;
+ }
+
+ public void setDtltype(String dtltype) {
+ this.dtltype = dtltype;
+ }
+
+ public String getSpip() {
+ return spip;
+ }
+
+ public void setSpip(String spip) {
+ this.spip = spip;
+ }
+
+ public String getBillno() {
+ return billno;
+ }
+
+ public void setBillno(String billno) {
+ this.billno = billno;
+ }
+
+ public String getQrcode() {
+ return qrcode;
+ }
+
+ public void setQrcode(String qrcode) {
+ this.qrcode = qrcode;
+ }
+
+ 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 getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Integer amount) {
+ this.amount = amount;
+ }
+
+ public String getShopaccno() {
+ return shopaccno;
+ }
+
+ public void setShopaccno(String shopaccno) {
+ this.shopaccno = shopaccno;
+ }
+
+ public Boolean getAnonymous() {
+ return anonymous;
+ }
+
+ public void setAnonymous(Boolean anonymous) {
+ this.anonymous = anonymous;
+ }
+
+ public String getUserid() {
+ return userid;
+ }
+
+ public void setUserid(String userid) {
+ this.userid = userid;
+ }
+
+ public String getQrcodeFormat() {
+ return qrcodeFormat;
+ }
+
+ public void setQrcodeFormat(String qrcodeFormat) {
+ this.qrcodeFormat = qrcodeFormat;
+ }
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QrcodePayResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QrcodePayResponse.java
new file mode 100644
index 0000000..15b27b0
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QrcodePayResponse.java
@@ -0,0 +1,76 @@
+package com.supwisdom.dlpay.api.bean;
+
+public class QrcodePayResponse extends ApiResponse {
+ private String refno;
+ private String accdate;
+ private String userid;
+ private Boolean anonymous;
+ private Integer amount;
+ private String sourceType;
+ private String paydesc;
+ private boolean requireQuery;
+
+ public String getRefno() {
+ return refno;
+ }
+
+ public void setRefno(String refno) {
+ this.refno = refno;
+ }
+
+ public String getUserid() {
+ return userid;
+ }
+
+ public void setUserid(String userid) {
+ this.userid = userid;
+ }
+
+ public Boolean getAnonymous() {
+ return anonymous;
+ }
+
+ public void setAnonymous(Boolean anonymous) {
+ this.anonymous = anonymous;
+ }
+
+ public Integer getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Integer amount) {
+ this.amount = amount;
+ }
+
+ public String getSourceType() {
+ return sourceType;
+ }
+
+ public void setSourceType(String sourceType) {
+ this.sourceType = sourceType;
+ }
+
+ public String getPaydesc() {
+ return paydesc;
+ }
+
+ public void setPaydesc(String paydesc) {
+ this.paydesc = paydesc;
+ }
+
+ public boolean isRequireQuery() {
+ return requireQuery;
+ }
+
+ public void setRequireQuery(boolean requireQuery) {
+ this.requireQuery = requireQuery;
+ }
+
+ public String getAccdate() {
+ return accdate;
+ }
+
+ public void setAccdate(String accdate) {
+ this.accdate = accdate;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryDtlResultParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryDtlResultParam.java
new file mode 100644
index 0000000..a16d55d
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryDtlResultParam.java
@@ -0,0 +1,52 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
+
+@Getter
+@Setter
+public class QueryDtlResultParam extends APIRequestParam {
+ @Sign
+ private String refno;
+ @Sign
+ private String billno;
+ @Sign
+ private String shopaccno;
+
+ public String getRefno() {
+ return refno;
+ }
+
+ public void setRefno(String refno) {
+ this.refno = refno;
+ }
+
+ public String getBillno() {
+ return billno;
+ }
+
+ public void setBillno(String billno) {
+ this.billno = billno;
+ }
+
+ public String getShopaccno() {
+ return shopaccno;
+ }
+
+ public void setShopaccno(String shopaccno) {
+ this.shopaccno = shopaccno;
+ }
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (StringUtils.isEmpty(refno) && (StringUtils.isEmpty(billno)
+ || StringUtils.isEmpty(shopaccno))) {
+ throw new RequestParamCheckException("流水唯一号不能为空");
+ }
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryShopParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryShopParam.java
new file mode 100644
index 0000000..6d1ee9a
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryShopParam.java
@@ -0,0 +1,26 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
+
+@Getter
+@Setter
+public class QueryShopParam extends APIRequestParam {
+ @Sign
+ private Integer shopid;
+ @Sign
+ private String shopaccno;
+ @Sign
+ private String shopUniqueId;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (StringUtils.isEmpty(shopUniqueId) && null == shopid && StringUtils.isEmpty(shopaccno))
+ throw new RequestParamCheckException("商户唯一标志不能为空");
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryTransDtlResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryTransDtlResponse.java
new file mode 100644
index 0000000..118bd56
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryTransDtlResponse.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.api.bean;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Setter
+@Getter
+@AllArgsConstructor
+@NoArgsConstructor
+public class QueryTransDtlResponse extends ApiResponse {
+ private String refno;
+ private String outTradeNo;
+ private Double amount;
+ private String status;
+ private String sourceType;
+ private String payinfo;
+ private String reverseFlag;
+ private String transdesc;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryUserParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryUserParam.java
new file mode 100644
index 0000000..55a5dcf
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QueryUserParam.java
@@ -0,0 +1,26 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
+
+
+@Getter
+@Setter
+public class QueryUserParam extends APIRequestParam {
+ @Sign
+ private String userid;
+ @Sign
+ private String uid;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (StringUtils.isEmpty(userid) && StringUtils.isEmpty(uid)) {
+ throw new RequestParamCheckException("用户唯一号不能为空");
+ }
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ShopResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ShopResponse.java
new file mode 100644
index 0000000..25dd194
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ShopResponse.java
@@ -0,0 +1,15 @@
+package com.supwisdom.dlpay.api.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class ShopResponse extends ApiResponse {
+ private Integer shopid;
+ private String shopaccno;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ThirdPayResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ThirdPayResponse.java
new file mode 100644
index 0000000..226ed29
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ThirdPayResponse.java
@@ -0,0 +1,17 @@
+package com.supwisdom.dlpay.api.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class ThirdPayResponse extends ApiResponse {
+ private String refno;
+ private String billno;
+ private Double amount;
+ private String body;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ThirdPayfinishParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ThirdPayfinishParam.java
new file mode 100644
index 0000000..b7c1928
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ThirdPayfinishParam.java
@@ -0,0 +1,23 @@
+package com.supwisdom.dlpay.api.bean;
+
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+public class ThirdPayfinishParam extends APIRequestParam {
+ @Sign
+ @NotNull(message = "交易参考号不能为空")
+ private String refno;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ return true;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ThirdPayinitParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ThirdPayinitParam.java
new file mode 100644
index 0000000..fae16dc
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/ThirdPayinitParam.java
@@ -0,0 +1,58 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import com.supwisdom.dlpay.api.util.DateUtil;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+@Getter
+@Setter
+public class ThirdPayinitParam extends APIRequestParam {
+ @Sign
+ private String uid;
+ @Sign
+ @NotEmpty(message = "请指定交易商户")
+ private String shopaccno;
+ @Sign
+ @NotNull(message = "支付金额不能为空")
+ @Min(value = 0, message = "支付金额不能小于 0")
+ private Integer amount;
+ private List<ConsumeFeetype> feelist;
+ @Sign
+ @NotNull(message = "订单号不能为空")
+ private String billno;
+ @Sign
+ @NotNull(message = "交易日期不能为空")
+ private String transdate;
+ @Sign
+ @NotNull(message = "交易时间不能为空")
+ private String transtime;
+ @Sign
+ @NotNull(message = "流水类型不能为空")
+ private String dtltype;
+ @Sign
+ @NotNull(message = "支付方式不能为空")
+ private String sourceType;
+
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT)) {
+ throw new RequestParamCheckException("交易日期错误[yyyyMMdd]");
+ }
+ if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT)) {
+ throw new RequestParamCheckException("交易时间错误[HHmmss]");
+ }
+
+ return true;
+ }
+}
+
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/UserResponse.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/UserResponse.java
new file mode 100644
index 0000000..1afe052
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/UserResponse.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.api.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class UserResponse extends ApiResponse {
+ private String userid;
+ private String uid;
+ private String name;
+ private String idtype;
+ private String idno;
+ private String mobile;
+ private String email;
+ private String status;
+ private Double balance;
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/YktCardPayinitParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/YktCardPayinitParam.java
new file mode 100644
index 0000000..34a734f
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/YktCardPayinitParam.java
@@ -0,0 +1,62 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.APIRequestParam;
+import com.supwisdom.dlpay.api.annotation.Sign;
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import com.supwisdom.dlpay.api.util.DateUtil;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+@Getter
+@Setter
+public class YktCardPayinitParam extends APIRequestParam {
+ @Sign
+ private String uid;
+ @Sign
+ @NotEmpty(message = "请指定交易商户")
+ private String shopaccno;
+ @Sign
+ @NotNull(message = "支付金额不能为空")
+ @Min(value = 0, message = "支付金额不能小于 0")
+ private Integer amount;
+
+ private List<ConsumeFeetype> feelist;
+
+ @Sign
+ @NotNull(message = "订单号不能为空")
+ private String billno;
+ @Sign
+ @NotNull(message = "交易日期不能为空")
+ private String transdate;
+ @Sign
+ @NotNull(message = "交易时间不能为空")
+ private String transtime;
+ @Sign
+ @NotNull(message = "一卡通唯一号不能为空")
+ private String stuempno;
+ @Sign
+ private String yktshopid;
+ @Sign
+ private String devphyid;
+
+ @Override
+ public boolean checkParam() throws RequestParamCheckException {
+ if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT)) {
+ throw new RequestParamCheckException("交易日期错误[yyyyMMdd]");
+ }
+ if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT)) {
+ throw new RequestParamCheckException("交易时间错误[HHmmss]");
+ }
+ if (!StringUtils.isEmpty(yktshopid) && !StringUtils.isNumeric(yktshopid))
+ throw new RequestParamCheckException("一卡通商户号非整数");
+
+ return true;
+ }
+}
+
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/ConfirmAction.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/ConfirmAction.java
new file mode 100644
index 0000000..cce7503
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/ConfirmAction.java
@@ -0,0 +1,4 @@
+package com.supwisdom.dlpay.api.bean.groups;
+
+public interface ConfirmAction {
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/CreateAction.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/CreateAction.java
new file mode 100644
index 0000000..b668e2d
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/CreateAction.java
@@ -0,0 +1,4 @@
+package com.supwisdom.dlpay.api.bean.groups;
+
+public interface CreateAction {
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/InitAction.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/InitAction.java
new file mode 100644
index 0000000..cafa6bf
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/InitAction.java
@@ -0,0 +1,4 @@
+package com.supwisdom.dlpay.api.bean.groups;
+
+public interface InitAction {
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/QueryAction.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/QueryAction.java
new file mode 100644
index 0000000..db544e3
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/QueryAction.java
@@ -0,0 +1,4 @@
+package com.supwisdom.dlpay.api.bean.groups;
+
+public interface QueryAction {
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/exception/RequestParamCheckException.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/exception/RequestParamCheckException.java
new file mode 100644
index 0000000..fdce721
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/exception/RequestParamCheckException.java
@@ -0,0 +1,14 @@
+package com.supwisdom.dlpay.api.exception;
+
+public class RequestParamCheckException extends Exception {
+ private int errCode;
+
+ public RequestParamCheckException(String message) {
+ super(String.format("Req-%d,%s", 20000, message));
+ this.errCode = 20000;
+ }
+
+ public int getErrCode() {
+ return errCode;
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/types/IDTypes.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/types/IDTypes.java
new file mode 100644
index 0000000..92cc8d7
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/types/IDTypes.java
@@ -0,0 +1,65 @@
+package com.supwisdom.dlpay.api.types;
+
+public enum IDTypes {
+ IDCARD(52, "idcard"), // 身份证
+ RESIDENCE_BOOKLET(55, "residence_booklet"), //户口簿
+ PASSPORT(70, "passport"), // 护照
+ HK_MACAU_PASS(76, "hk_macau_pass"), // 港澳居民来往内地通行证
+ TAIWAN_PASS(67, "taiwan_pass"), // 台湾同胞来往内地通行证
+ FOREIGNER_RESIDENCE_PERMIT(68, "foreigner_residence_permit"), // 外国人居留证
+ MILITARY_IDCARD(58, "military_idcard"), // 军官证
+ SOLDIER_IDCARD(64, "soldier_idcard"), // 士兵证
+ DRIVING_LICENSE(-97, "driving_license"), // 驾照
+ STUDENT_IDCARD(-98, "student_idcard"), // 学生证
+ OTHERS(-99, "unknown"),
+ IDTYPE_LIST(-100, new IDTypes[]{IDCARD, RESIDENCE_BOOKLET, PASSPORT, HK_MACAU_PASS, TAIWAN_PASS, FOREIGNER_RESIDENCE_PERMIT, MILITARY_IDCARD, SOLDIER_IDCARD,
+ DRIVING_LICENSE, STUDENT_IDCARD, OTHERS}); // 其它
+
+
+ IDTypes(int id, Object data) {
+ this.id = id;
+ this.data = data;
+ }
+
+ public String value() {
+ return this.data.toString();
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public Object getData() {
+ return this.data;
+ }
+
+
+ private Object data;
+
+ private int id;
+
+ public static String findById(int id) {
+ IDTypes[] list = (IDTypes[]) IDTypes.IDTYPE_LIST.getData();
+ for (IDTypes item : list) {
+ if (item.getId() == id) {
+ return item.value();
+ }
+ }
+ return null;
+ }
+
+ public static int findByValue(String idtype) {
+ IDTypes[] list = (IDTypes[]) IDTypes.IDTYPE_LIST.getData();
+ for (IDTypes item : list) {
+ if (item.value().equals(idtype)) {
+ return item.getId();
+ }
+ }
+ return -999;
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/types/SexTypes.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/types/SexTypes.java
new file mode 100644
index 0000000..da8866f
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/types/SexTypes.java
@@ -0,0 +1,28 @@
+package com.supwisdom.dlpay.api.types;
+
+public enum SexTypes {
+ MALE("male"),
+ FEMALE("female"),
+ UNKNOWN("unknown"),
+ ALL(new SexTypes[]{MALE, FEMALE, UNKNOWN});
+
+ SexTypes(Object data) {
+ this.data = data;
+ }
+
+
+ public String value() {
+ return this.data.toString();
+ }
+
+ public Object getData() {
+ return this.data;
+ }
+
+ private Object data;
+
+ @Override
+ public String toString() {
+ return value();
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/types/ShopTypes.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/types/ShopTypes.java
new file mode 100644
index 0000000..32bb010
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/types/ShopTypes.java
@@ -0,0 +1,34 @@
+package com.supwisdom.dlpay.api.types;
+
+public enum ShopTypes {
+ GROUP("group", "商户组"),
+ ROOT("root", "根商户"),
+ NORMAL("normal", "结算商户"),
+ ALL("all", new ShopTypes[]{ROOT, GROUP, NORMAL});
+
+ ShopTypes(String t, Object data) {
+ this.id = t;
+ this.data = data;
+ }
+
+ public String value() {
+ return this.id;
+ }
+
+ public Object data() {
+ return this.data;
+ }
+
+ public String desc() {
+ return this.data.toString();
+ }
+
+
+ public String id;
+ public Object data;
+
+ @Override
+ public String toString() {
+ return value();
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/Constants.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/Constants.java
new file mode 100644
index 0000000..3c4aebe
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/Constants.java
@@ -0,0 +1,7 @@
+package com.supwisdom.dlpay.api.util;
+
+public class Constants {
+ public static final String SEX_MALE = "male";
+ public static final String SEX_FEMALE = "female";
+
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/DateUtil.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/DateUtil.java
new file mode 100644
index 0000000..2e45a7e
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/DateUtil.java
@@ -0,0 +1,345 @@
+package com.supwisdom.dlpay.api.util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+public class DateUtil {
+ private static final Logger logger = LoggerFactory.getLogger(DateUtil.class);
+ public static final String DATE_FMT = "yyyyMMdd";
+ public static final String TIME_FMT = "HHmmss";
+ public static final String DATETIME_FMT = "yyyyMMddHHmmss";
+
+ /**
+ * Description: 返回一个当前时间 @return String 格式:yyyyMMddHHmmss @exception Modify
+ * History:
+ */
+ public static String getNow() {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ return sdf.format(new Date());
+ }
+
+
+ /**
+ * Description: 根据类型返回一个当前时间 @param partten String @return String 格式:partten
+ */
+ public static String getNow(String partten) {
+ SimpleDateFormat sdf = new 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ 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;
+ }
+ }
+
+ /**
+ * 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 {
+ SimpleDateFormat sdf = new 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ Date d = sdf.parse(startDay);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(d.getTime());
+ calendar.add(Calendar.DATE, intervalday);
+ return sdf.format(calendar.getTime());
+ } catch (ParseException e) {
+ return startDay;
+ }
+ }
+
+ /**
+ * 得到两个日期相差的天数 格式 yyyyMMdd @return diffdays = secondDay - firstDay
+ */
+ public static long getIntervalDay(String firstDay, String secondDay) {
+ try {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ Date f = sdf.parse(firstDay);
+ Date s = sdf.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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ Date f = sdf.parse(firstTime);
+ Date s = sdf.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 {
+ SimpleDateFormat sdf = new 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ Date f = sdf.parse(firstTime);
+ Date s = sdf.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 {
+ SimpleDateFormat sdf = new 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ 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;
+ }
+
+ /**
+ * 获得两个字符串日期之间的时间差(单位毫秒)
+ */
+ public static long getIntervalTime(String startTime, String endTime, String pattern) {
+ long duration = 0;
+ try {
+ SimpleDateFormat sdf = new 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+ Date d = sdf.parse(datetime);
+ return datetime.trim().equals(sdf.format(d));
+ } 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ Calendar calendar = Calendar.getInstance();
+ boolean isFirstSunday = (calendar.getFirstDayOfWeek() == Calendar.SUNDAY); //一周第一天是否为星期天
+ Date d = sdf.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 {
+ SimpleDateFormat sdf = new 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;
+ }
+
+ private static Date set(Date date, int calendarField, int amount) {
+ Calendar c = Calendar.getInstance();
+ c.setLenient(false);
+ c.setTime(date);
+ c.add(calendarField, amount);
+ return c.getTime();
+ }
+
+
+ public static Date setMinutes(Date date, int amount) {
+ return set(date, Calendar.MINUTE, amount);
+ }
+
+
+ public static long getNowSecond() {
+ Calendar calendar = Calendar.getInstance();
+ return calendar.getTimeInMillis() / 1000;
+ }
+
+
+ public static String getUTCTime(Long timeInMillisSecond) {
+ Calendar time = Calendar.getInstance();
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
+ fmt.setTimeZone(TimeZone.getTimeZone("UTC"));
+ time.setTimeInMillis(timeInMillisSecond);
+ return fmt.format(time.getTime());
+ }
+
+ public static String getUTCTime() {
+ return getUTCTime(System.currentTimeMillis());
+ }
+
+ public static int compareDay(Timestamp d1, Timestamp d2) {
+ Calendar cd1 = Calendar.getInstance();
+ cd1.setTimeInMillis(d1.getTime());
+ Calendar cd2 = Calendar.getInstance();
+ cd2.setTimeInMillis(d2.getTime());
+
+ if (cd1.get(Calendar.YEAR) != cd2.get(Calendar.YEAR)) {
+ return cd1.compareTo(cd2);
+ }
+
+ return Integer.compare(cd1.get(Calendar.DAY_OF_YEAR), cd2.get(Calendar.DAY_OF_YEAR));
+ }
+
+ public static Boolean sameDay(Timestamp d1, Timestamp d2) {
+ return (compareDay(d1, d2) == 0);
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/HMACUtil.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/HMACUtil.java
new file mode 100644
index 0000000..f268646
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/HMACUtil.java
@@ -0,0 +1,29 @@
+package com.supwisdom.dlpay.api.util;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+
+public class HMACUtil {
+ public static String sha256HMAC(String message, String secret) {
+ String hash = "";
+ try {
+ Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
+ SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256");
+ sha256_HMAC.init(secret_key);
+ byte[] bytes = sha256_HMAC.doFinal(message.getBytes());
+ hash = byteArrayToHexString(bytes);
+ System.out.println(hash);
+ } catch (Exception e) {
+ System.out.println("Error HmacSHA256 ===========" + e.getMessage());
+ }
+ return hash;
+ }
+
+ private static String byteArrayToHexString(byte[] bytes) {
+ StringBuilder builder = new StringBuilder();
+ for (byte b : bytes) {
+ builder.append(String.format("%02x", ((int) b) & 0xFF));
+ }
+ return builder.toString();
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/MobileNumberCheck.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/MobileNumberCheck.java
new file mode 100644
index 0000000..161868e
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/MobileNumberCheck.java
@@ -0,0 +1,163 @@
+package com.supwisdom.dlpay.api.util;
+
+import java.util.regex.Pattern;
+
+public class MobileNumberCheck {
+
+ /**
+ * 座机电话格式验证
+ **/
+ private static final String PHONE_CALL_PATTERN = "^(?:\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(?:-\\d{1,4})?$";
+
+ /**
+ * 中国电信号码格式验证 手机段: 133,153,180,181,189,177,1700,173
+ **/
+ private static final String CHINA_TELECOM_PATTERN = "(?:^(?:\\+86)?1(?:33|53|7[37]|8[019])\\d{8}$)|(?:^(?:\\+86)?1700\\d{7}$)";
+
+ /**
+ * 中国联通号码格式验证 手机段:130,131,132,155,156,185,186,145,176,1707,1708,1709,175
+ **/
+ private static final String CHINA_UNICOM_PATTERN = "(?:^(?:\\+86)?1(?:3[0-2]|4[5]|5[56]|7[56]|8[56])\\d{8}$)|(?:^(?:\\+86)?170[7-9]\\d{7}$)";
+ /**
+ * 简单手机号码校验,校验手机号码的长度和1开头
+ */
+ private static final String SIMPLE_PHONE_CHECK = "^(?:\\+86)?1\\d{10}$";
+ /**
+ * 中国移动号码格式验证
+ * 手机段:134,135,136,137,138,139,150,151,152,157,158,159,182,183,184
+ * ,187,188,147,178,1705
+ **/
+ private static final String CHINA_MOBILE_PATTERN = "(?:^(?:\\+86)?1(?:3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478])\\d{8}$)|(?:^(?:\\+86)?1705\\d{7}$)";
+
+ /**
+ * 仅手机号格式校验
+ */
+ private static final String PHONE_PATTERN = new StringBuilder(300)
+ .append(CHINA_MOBILE_PATTERN).append("|")
+ .append(CHINA_TELECOM_PATTERN).append("|")
+ .append(CHINA_UNICOM_PATTERN).toString();
+
+ /**
+ * 手机和座机号格式校验
+ */
+ private static final String PHONE_TEL_PATTERN = new StringBuilder(350)
+ .append(PHONE_PATTERN).append("|").append("(")
+ .append(PHONE_CALL_PATTERN).append(")").toString();
+
+
+ /**
+ * 匹配多个号码以,、或空格隔开的格式,如 17750581369
+ * 13306061248、(596)3370653,17750581369,13306061248 (0596)3370653
+ *
+ * @param input
+ * @param separator 可以自己指定分隔符,如"、, "表示可以以顿号、逗号和空格分隔
+ * @return
+ */
+ public static boolean checkMultiPhone(String input, String separator) {
+ separator = escapeMetacharacterOfStr(separator);
+ String regex = "^(?!.+["
+ + separator
+ + "]$)(?:(?:(?:(?:\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(?:-\\d{1,4})?)|(?:1\\d{10}))(?:["
+ + separator + "]|$))+$";
+ return match(regex, input);
+ }
+
+ /**
+ * 转义字符串中的[]-^\元字符
+ *
+ * @param input
+ * @param separator
+ * @return
+ */
+ private static String escapeMetacharacterOfStr(String input) {
+ String regex = "[-^\\[\\]\\\\]";
+ return input.replaceAll(regex, "\\\\$0");
+ }
+
+ /**
+ * 仅手机号码校验
+ *
+ * @param input
+ * @return
+ */
+ public static boolean isPhone(String input) {
+ return match(PHONE_PATTERN, input);
+ }
+
+ /**
+ * 手机号或座机号校验
+ *
+ * @param input
+ * @return
+ */
+ public static boolean isPhoneOrTel(String input) {
+ System.out.println(PHONE_TEL_PATTERN);
+ return match(PHONE_TEL_PATTERN, input);
+ }
+
+ /**
+ * 验证电话号码的格式
+ *
+ * @param str 校验电话字符串
+ * @return 返回true, 否则为false
+ * @author LinBilin
+ */
+ public static boolean isPhoneCallNum(String str) {
+ return match(PHONE_CALL_PATTERN, str);
+ }
+
+ /**
+ * 验证【电信】手机号码的格式
+ *
+ * @param str 校验手机字符串
+ * @return 返回true, 否则为false
+ * @author LinBilin
+ */
+ public static boolean isChinaTelecomPhoneNum(String str) {
+ return match(CHINA_TELECOM_PATTERN, str);
+ }
+
+ /**
+ * 验证【联通】手机号码的格式
+ *
+ * @param str 校验手机字符串
+ * @return 返回true, 否则为false
+ * @author LinBilin
+ */
+ public static boolean isChinaUnicomPhoneNum(String str) {
+ return match(CHINA_UNICOM_PATTERN, str);
+ }
+
+ /**
+ * 验证【移动】手机号码的格式
+ *
+ * @param str 校验手机字符串
+ * @return 返回true, 否则为false
+ * @author LinBilin
+ */
+ public static boolean isChinaMobilePhoneNum(String str) {
+ return match(CHINA_MOBILE_PATTERN, str);
+ }
+
+ /**
+ * 简单手机号码校验,校验手机号码的长度和1开头
+ *
+ * @param str
+ * @return
+ */
+ public static boolean isPhoneSimple(String str) {
+ return match(SIMPLE_PHONE_CHECK, str);
+ }
+
+ /**
+ * 匹配函数
+ *
+ * @param regex
+ * @param input
+ * @return
+ */
+ private static boolean match(String regex, String input) {
+ return Pattern.matches(regex, input);
+ }
+
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/IDNoCheckValidator.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/IDNoCheckValidator.java
new file mode 100644
index 0000000..1837138
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/IDNoCheckValidator.java
@@ -0,0 +1,65 @@
+package com.supwisdom.dlpay.api.validator;
+
+import com.supwisdom.dlpay.api.annotation.IDNoCheck;
+import com.supwisdom.dlpay.api.types.IDTypes;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+
+public class IDNoCheckValidator implements ConstraintValidator<IDNoCheck, Object> {
+ private String idnoField;
+ private String idtypeField;
+ private String[] idtypeList;
+
+ @Override
+ public boolean isValid(Object value, ConstraintValidatorContext context) {
+ try {
+ String idtype = BeanUtils.getProperty(value, idtypeField);
+ if (idtype == null) {
+ return true;
+ }
+ if (!Arrays.asList(idtypeList).contains(idtype)) {
+ return false;
+ }
+ String idno = BeanUtils.getProperty(value, idnoField);
+ if (StringUtils.isEmpty(idno)) {
+ return false;
+ }
+ if (IDTypes.IDCARD.value().equals(idtype) && idno.length() != 18) {
+ return false;
+ }
+ return true;
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ @Override
+ public void initialize(IDNoCheck constraintAnnotation) {
+ idnoField = constraintAnnotation.idno();
+ idtypeField = constraintAnnotation.idtype();
+ if (StringUtils.isEmpty(idnoField) || StringUtils.isEmpty(idtypeField)) {
+ throw new IllegalArgumentException("IDNO 和 IDType 字段必须指定");
+ }
+ Object value = constraintAnnotation.value().getData();
+ if (value instanceof IDTypes[]) {
+ idtypeList = new String[((IDTypes[]) value).length];
+ for (int i = 0; i < ((IDTypes[]) value).length; ++i) {
+ idtypeList[i] = ((IDTypes[]) value)[i].value();
+ }
+ } else if (value instanceof String) {
+ idtypeList = new String[]{(String) value};
+ } else {
+ throw new IllegalArgumentException("IDTypes 类型错误");
+ }
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/IntegerListValidator.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/IntegerListValidator.java
new file mode 100644
index 0000000..aec2cee
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/IntegerListValidator.java
@@ -0,0 +1,27 @@
+package com.supwisdom.dlpay.api.validator;
+
+import com.supwisdom.dlpay.api.annotation.IntegerList;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.util.Arrays;
+
+public class IntegerListValidator implements ConstraintValidator<IntegerList, Integer> {
+
+ private Integer[] valueList;
+
+ @Override
+ public boolean isValid(Integer value, ConstraintValidatorContext context) {
+ if (Arrays.asList(valueList).contains(value))
+ return true;
+ return false;
+ }
+
+ @Override
+ public void initialize(IntegerList constraintAnnotation) {
+ valueList = new Integer[constraintAnnotation.value().length];
+ for (int i = 0; i < constraintAnnotation.value().length; i++) {
+ valueList[i] = Integer.parseInt(constraintAnnotation.value()[i]);
+ }
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/MobileNumberValidator.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/MobileNumberValidator.java
new file mode 100644
index 0000000..4ded93f
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/MobileNumberValidator.java
@@ -0,0 +1,23 @@
+package com.supwisdom.dlpay.api.validator;
+
+import com.supwisdom.dlpay.api.annotation.MobileNumber;
+import com.supwisdom.dlpay.api.util.MobileNumberCheck;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class MobileNumberValidator implements ConstraintValidator<MobileNumber, String> {
+
+ @Override
+ public boolean isValid(String value, ConstraintValidatorContext context) {
+ if (value == null || StringUtils.isEmpty(value)) {
+ return true;
+ }
+ return MobileNumberCheck.isPhone(value);
+ }
+
+ @Override
+ public void initialize(MobileNumber constraintAnnotation) {
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/SexValidator.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/SexValidator.java
new file mode 100644
index 0000000..faa6f9b
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/SexValidator.java
@@ -0,0 +1,32 @@
+package com.supwisdom.dlpay.api.validator;
+
+
+import com.supwisdom.dlpay.api.annotation.Sex;
+import com.supwisdom.dlpay.api.types.SexTypes;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.util.Arrays;
+
+
+public class SexValidator implements ConstraintValidator<Sex, String> {
+ private String[] sexTypes;
+
+ @Override
+ public boolean isValid(String value, ConstraintValidatorContext context) {
+ return Arrays.asList(sexTypes).contains(value);
+ }
+
+ @Override
+ public void initialize(Sex constraintAnnotation) {
+ if (constraintAnnotation.value().getData() instanceof SexTypes[]) {
+ SexTypes[] arrays = (SexTypes[]) constraintAnnotation.value().getData();
+ sexTypes = new String[arrays.length];
+ for (int i = 0; i < arrays.length; i++) {
+ sexTypes[i] = arrays[i].value();
+ }
+ } else {
+ sexTypes = new String[]{constraintAnnotation.value().value()};
+ }
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/ShopTypeValidator.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/ShopTypeValidator.java
new file mode 100644
index 0000000..f04c41d
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/ShopTypeValidator.java
@@ -0,0 +1,33 @@
+package com.supwisdom.dlpay.api.validator;
+
+import com.supwisdom.dlpay.api.annotation.ShopType;
+import com.supwisdom.dlpay.api.types.ShopTypes;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.util.Arrays;
+
+public class ShopTypeValidator implements ConstraintValidator<ShopType, String> {
+ private String[] allTypes;
+
+ @Override
+ public boolean isValid(String value, ConstraintValidatorContext context) {
+ if (value == null || value.isEmpty()) {
+ return true;
+ }
+ return Arrays.asList(allTypes).contains(value);
+ }
+
+ @Override
+ public void initialize(ShopType constraintAnnotation) {
+ Object value = constraintAnnotation.value().data();
+ if (value instanceof ShopTypes[]) {
+ allTypes = new String[((ShopTypes[]) value).length];
+ for (int i = 0; i < ((ShopTypes[]) value).length; ++i) {
+ allTypes[i] = ((ShopTypes[]) value)[i].value();
+ }
+ } else {
+ allTypes = new String[]{value.toString()};
+ }
+ }
+}
\ No newline at end of file
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/StringListValidator.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/StringListValidator.java
new file mode 100644
index 0000000..b4300b5
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/StringListValidator.java
@@ -0,0 +1,51 @@
+package com.supwisdom.dlpay.api.validator;
+
+import com.supwisdom.dlpay.api.annotation.StringList;
+import org.springframework.expression.Expression;
+import org.springframework.expression.ExpressionParser;
+import org.springframework.expression.spel.standard.SpelExpressionParser;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.util.Arrays;
+
+public class StringListValidator implements ConstraintValidator<StringList, String> {
+ private String[] valueList;
+
+ @Override
+ public boolean isValid(String value, ConstraintValidatorContext context) {
+ if (Arrays.asList(valueList).contains(value))
+ return true;
+ return false;
+ }
+
+ @Override
+ public void initialize(StringList constraintAnnotation) {
+ if (constraintAnnotation.value().length > 0) {
+ valueList = constraintAnnotation.value();
+ } else if (!constraintAnnotation.expr().isEmpty()) {
+ parseExpress(constraintAnnotation.expr());
+ } else {
+ throw new IllegalArgumentException("StringList validator must has `value` or `expr` property");
+ }
+ }
+
+ private void parseExpress(String expr) {
+ ExpressionParser expressionParser = new SpelExpressionParser();
+ Expression expression = expressionParser.parseExpression(expr);
+ Object value = expression.getValue();
+ if (value instanceof String) {
+ valueList = new String[]{(String) value};
+ } else if (value instanceof String[]) {
+ valueList = (String[]) value;
+ } else if (value instanceof Object[]) {
+ valueList = new String[((Object[]) value).length];
+ Object[] realValue = (Object[]) value;
+ for (int i = 0; i < realValue.length; ++i) {
+ valueList[i] = realValue[i].toString();
+ }
+ } else {
+ throw new IllegalArgumentException("parse expr error!");
+ }
+ }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/UserStatusValidator.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/UserStatusValidator.java
new file mode 100644
index 0000000..b124f65
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/UserStatusValidator.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.api.validator;
+
+import com.supwisdom.dlpay.api.annotation.UserStatus;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.util.Arrays;
+
+public class UserStatusValidator implements ConstraintValidator<UserStatus, String> {
+ private final String[] ALL_STATUS = {"open", "closed", "losed"};
+
+ @Override
+ public boolean isValid(String value, ConstraintValidatorContext context) {
+ if (Arrays.asList(ALL_STATUS).contains(value))
+ return true;
+ return false;
+ }
+
+ @Override
+ public void initialize(UserStatus constraintAnnotation) {
+ }
+}
diff --git a/payapi-common/src/test/java/com/supwisdom/dlpay/api/bean/CitizenCardPayinitParamTest.java b/payapi-common/src/test/java/com/supwisdom/dlpay/api/bean/CitizenCardPayinitParamTest.java
new file mode 100644
index 0000000..0b3dd8b
--- /dev/null
+++ b/payapi-common/src/test/java/com/supwisdom/dlpay/api/bean/CitizenCardPayinitParamTest.java
@@ -0,0 +1,69 @@
+package com.supwisdom.dlpay.api.bean;
+
+import com.supwisdom.dlpay.api.types.IDTypes;
+import com.supwisdom.dlpay.api.types.SexTypes;
+import org.junit.Test;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class CitizenCardPayinitParamTest {
+
+ private Validator validator;
+
+ @org.junit.Before
+ public void setUp() throws Exception {
+ ValidatorFactory factor = Validation.buildDefaultValidatorFactory();
+ validator = factor.getValidator();
+ }
+
+ @Test
+ public void testCitizenPay() {
+ CitizenCardPayinitParam param = new CitizenCardPayinitParam();
+
+ List<ConstraintViolation<CitizenCardPayinitParam>> violations = validate(param);
+ String message = getViolationMessage(violations);
+ assertFalse(message, violations.isEmpty());
+ }
+
+ private <T> List<ConstraintViolation<T>> validate(T param) {
+ Set<ConstraintViolation<T>> violations = validator.validate(param);
+ List<ConstraintViolation<T>> result = StreamSupport.stream(violations.spliterator(), false)
+ .collect(Collectors.toList());
+ return result;
+ }
+
+ private <T> String getViolationMessage(List<ConstraintViolation<T>> violations) {
+ StringBuilder message = new StringBuilder();
+ for (ConstraintViolation<T> item : violations) {
+ message.append(item.getMessage()).append("\n");
+ }
+ return message.toString();
+ }
+
+ @Test
+ public void testOpenUserParam() {
+ OpenUserParam param = new OpenUserParam();
+ List<ConstraintViolation<OpenUserParam>> result = validate(param);
+ assertFalse(getViolationMessage(result), result.isEmpty());
+
+ param.setIdtype(IDTypes.IDCARD.value());
+ param.setIdno("123213");
+ param.setUid("1231323");
+ param.setName("lily");
+ param.setSex(SexTypes.MALE.value());
+ param.setMobile("+8618272733888");
+
+ result = validate(param);
+ assertTrue(getViolationMessage(result), result.isEmpty());
+
+ }
+}
\ No newline at end of file
diff --git a/payapi-sdk/build.gradle b/payapi-sdk/build.gradle
new file mode 100644
index 0000000..6151e73
--- /dev/null
+++ b/payapi-sdk/build.gradle
@@ -0,0 +1,74 @@
+plugins {
+ id 'java-library'
+ id 'maven-publish'
+ id 'org.springframework.boot'
+ id "com.palantir.git-version"
+}
+
+
+apply plugin: 'io.spring.dependency-management'
+
+group = rootProject.group
+
+def sdkVersion = gitVersion()
+
+publishing {
+ publications {
+ mavenJava(MavenPublication) {
+ groupId = project.group
+ artifactId = 'payapi-sdk'
+ version = sdkVersion
+ from components.java
+ }
+ }
+ repositories {
+ maven {
+ // change URLs to point to your repos, e.g. http://my.org/repo
+ def releasesRepoUrl = "http://ykt-nx.supwisdom.com/repository/ecard-repo/"
+ def snapshotsRepoUrl = "http://ykt-nx.supwisdom.com/repository/ecard-repo/snapshot/"
+ url = version.endsWith('dirty') ? snapshotsRepoUrl : releasesRepoUrl
+ credentials(PasswordCredentials) {
+ username = nxUser
+ password = nxPassword
+ }
+ }
+ }
+}
+
+bootJar {
+ enabled = false
+}
+
+dependencies {
+ implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
+ implementation 'org.springframework.boot:spring-boot-starter-data-redis'
+
+ implementation project(':payapi-common')
+
+ implementation 'org.springframework.cloud:spring-cloud-dependencies:Finchley.SR3'
+ implementation 'org.springframework.cloud:spring-cloud-starter-openfeign:2.1.2.RELEASE'
+
+ implementation 'javax.servlet:javax.servlet-api:4.0.1'
+ compileOnly 'org.projectlombok:lombok:1.18.8'
+ annotationProcessor 'org.projectlombok:lombok:1.18.8'
+ compile 'com.github.mwiede:feign-validation:1.0'
+
+ testImplementation 'org.springframework:spring-test'
+ testImplementation 'org.springframework.boot:spring-boot-test'
+ testImplementation 'junit:junit:4.12'
+ testAnnotationProcessor 'org.projectlombok:lombok:1.18.8'
+ testCompileOnly 'org.projectlombok:lombok:1.18.8'
+ testImplementation 'org.hamcrest:hamcrest:2.1'
+ testImplementation project(':payapi-common')
+
+}
+
+jar {
+ enabled = true
+ baseName = "payapi-sdk"
+ manifest {
+ attributes('Payapi-SDK-Version': sdkVersion)
+ }
+}
+
+publish.dependsOn(jar)
\ No newline at end of file
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/ApiLoginHelper.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/ApiLoginHelper.java
new file mode 100644
index 0000000..378bf1b
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/ApiLoginHelper.java
@@ -0,0 +1,50 @@
+package com.supwisdom.dlpay.paysdk;
+
+import com.supwisdom.dlpay.api.bean.ApiLoginInitResponse;
+import com.supwisdom.dlpay.api.bean.ApiLoginResponse;
+import com.supwisdom.dlpay.api.util.HMACUtil;
+import com.supwisdom.dlpay.paysdk.proxy.ApiLoginProxy;
+import com.supwisdom.dlpay.paysdk.utils.JwtContext;
+
+public class ApiLoginHelper {
+ private ApiLoginProxy apiLoginProxy;
+
+ public ApiLoginHelper(ApiLoginProxy apiLoginProxy) {
+ this.apiLoginProxy = apiLoginProxy;
+ }
+
+ public void login(String appid, String secret) {
+ loginWithClientId(appid, null, secret);
+ }
+
+ public void loginWithClientId(String appid, String clientId, String secret) {
+ ApiLoginInitResponse loginInit;
+ if (clientId != null) {
+ loginInit = apiLoginProxy.loginInitWithClientId(appid, clientId);
+ } else {
+ loginInit = apiLoginProxy.loginInit(appid);
+ }
+ if (loginInit.getRetcode() != 0) {
+ throw new RuntimeException("登录初始化错误: " + loginInit.getRetcode() + ", " + loginInit.getException());
+ }
+ String token = HMACUtil.sha256HMAC(loginInit.getToken(), secret);
+ ApiLoginResponse login;
+ if (clientId != null) {
+ login = apiLoginProxy.loginWithClientId(appid, token, clientId);
+ } else {
+ login = apiLoginProxy.login(appid, token);
+ }
+ if (login.getRetcode() != 0) {
+ throw new RuntimeException("登录错误: " + loginInit.getRetcode() + ", " + loginInit.getException());
+ }
+ JwtContext.setJwt(login.getJwt());
+ }
+
+ public void refresh() {
+ ApiLoginResponse response = apiLoginProxy.refresh();
+ if (response.getRetcode() != 0) {
+ throw new RuntimeException("刷新JWT错误: " + response.getRetcode() + ", " + response.getException());
+ }
+ JwtContext.setJwt(response.getJwt());
+ }
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/PayAPIRequestInterceptor.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/PayAPIRequestInterceptor.java
new file mode 100644
index 0000000..1002d52
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/PayAPIRequestInterceptor.java
@@ -0,0 +1,23 @@
+package com.supwisdom.dlpay.paysdk;
+
+import com.supwisdom.dlpay.paysdk.utils.Constants;
+import com.supwisdom.dlpay.paysdk.utils.JwtContext;
+import feign.RequestInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+@Component
+public class PayAPIRequestInterceptor {
+ @Bean
+ public RequestInterceptor headerInterceptor() {
+ return requestTemplate -> {
+ // 小示例,没什么卵用
+ requestTemplate.header(Constants.HEADER_TENANT_ID, "{tenantid}");
+ String jwt = JwtContext.getJwt();
+ if (jwt != null) {
+ requestTemplate.header(Constants.JWT_HEADER, "Bearer " + jwt);
+ }
+ };
+ }
+}
+
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ApiCommonProxy.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ApiCommonProxy.java
new file mode 100644
index 0000000..47a8e53
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ApiCommonProxy.java
@@ -0,0 +1,11 @@
+package com.supwisdom.dlpay.paysdk.proxy;
+
+import com.supwisdom.dlpay.api.bean.ApiVersionResponse;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@FeignClient(name = "apiCommonProxy", url = "${payapi.url}")
+public interface ApiCommonProxy {
+ @GetMapping(value = "/api/common/version")
+ ApiVersionResponse apiVersion();
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ApiLoginProxy.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ApiLoginProxy.java
new file mode 100644
index 0000000..f564a00
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ApiLoginProxy.java
@@ -0,0 +1,29 @@
+package com.supwisdom.dlpay.paysdk.proxy;
+
+import com.supwisdom.dlpay.api.bean.ApiLoginInitResponse;
+import com.supwisdom.dlpay.api.bean.ApiLoginResponse;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient(value = "apiLoginProxy", url = "${payapi.url}")
+public interface ApiLoginProxy {
+ @RequestMapping(value = "/api/auth/gettoken", method = RequestMethod.GET)
+ ApiLoginInitResponse loginInit(@RequestParam("appid") String appid);
+
+ @RequestMapping(value = "/api/auth/gettoken/{clientid}", method = RequestMethod.GET)
+ ApiLoginInitResponse loginInitWithClientId(@RequestParam("appid") String appid,
+ @PathVariable(value = "clientid") String clientid);
+
+ @RequestMapping(value = "/api/auth/authentication", method = RequestMethod.GET)
+ ApiLoginResponse login(@RequestParam("appid") String appid, @RequestParam("secret") String secret);
+
+ @RequestMapping(value = "/api/auth/authentication/{clientid}", method = RequestMethod.GET)
+ ApiLoginResponse loginWithClientId(@RequestParam("appid") String appid, @RequestParam("secret") String secret,
+ @PathVariable(value = "clientid") String clientid);
+
+ @RequestMapping(value = "/api/auth/refresh", method = RequestMethod.GET)
+ ApiLoginResponse refresh();
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/CitizenCardPayProxy.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/CitizenCardPayProxy.java
new file mode 100644
index 0000000..d68a238
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/CitizenCardPayProxy.java
@@ -0,0 +1,20 @@
+package com.supwisdom.dlpay.paysdk.proxy;
+
+import com.supwisdom.dlpay.api.bean.CitizenCardPayfinishParam;
+import com.supwisdom.dlpay.api.bean.CitizenCardPayinitParam;
+import com.supwisdom.dlpay.api.bean.CitizenPayResponse;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import javax.validation.Valid;
+
+@FeignClient(value = "citizenCardPay", url = "${payapi.url}")
+public interface CitizenCardPayProxy {
+ @RequestMapping(value = "/api/consume/citizencard/payinit", method = RequestMethod.GET)
+ CitizenPayResponse citizencardPayinit(@RequestBody CitizenCardPayinitParam param);
+
+ @RequestMapping(value = "/api/consume/citizencard/payfinish", method = RequestMethod.GET)
+ CitizenPayResponse citizencardPayFinish(@RequestBody CitizenCardPayfinishParam param);
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ConsumePropxy.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ConsumePropxy.java
new file mode 100644
index 0000000..54975a5
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ConsumePropxy.java
@@ -0,0 +1,20 @@
+package com.supwisdom.dlpay.paysdk.proxy;
+
+import com.supwisdom.dlpay.api.bean.QrcodePayParam;
+import com.supwisdom.dlpay.api.bean.QrcodePayResponse;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@FeignClient(name = "consumePropxy", url = "${payapi.url}")
+@RequestMapping("/api/consume")
+public interface ConsumePropxy {
+
+ @PostMapping("/qrcode/init")
+ QrcodePayResponse qrcodePayInit(@RequestBody QrcodePayParam param);
+
+ @PostMapping("/qrcode/confirm")
+ QrcodePayResponse qrcodePayConfirm(@RequestBody QrcodePayParam param);
+
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ShopProxy.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ShopProxy.java
new file mode 100644
index 0000000..adb2b3c
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/ShopProxy.java
@@ -0,0 +1,20 @@
+package com.supwisdom.dlpay.paysdk.proxy;
+
+import com.supwisdom.dlpay.api.bean.OpenShopParam;
+import com.supwisdom.dlpay.api.bean.QueryShopParam;
+import com.supwisdom.dlpay.api.bean.ShopResponse;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@FeignClient(name = "shopProxy", url = "${payapi.url}")
+@RequestMapping("/api/shop")
+public interface ShopProxy {
+ @PostMapping("/open")
+ ShopResponse openAccount(@RequestBody OpenShopParam param);
+
+ @GetMapping("/query")
+ ShopResponse queryShop(@RequestBody QueryShopParam param);
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/TransactionProxy.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/TransactionProxy.java
new file mode 100644
index 0000000..570587a
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/TransactionProxy.java
@@ -0,0 +1,18 @@
+package com.supwisdom.dlpay.paysdk.proxy;
+
+import com.supwisdom.dlpay.api.bean.*;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+@FeignClient(name = "payTransactionProxy", url = "${payapi.url}")
+public interface TransactionProxy {
+ @PostMapping("/api/consume/paycancel")
+ PayReverseResponse payCancel(@RequestBody ConsumePayCancelParam param);
+
+ @PostMapping("/api/consume/payrefund")
+ PayReverseResponse payRefund(@RequestBody ConsumePayRefundParam param);
+
+ @PostMapping("/api/consume/queryresult")
+ QueryTransDtlResponse queryDtlResult(@RequestBody QueryDtlResultParam param);
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/UserProxy.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/UserProxy.java
new file mode 100644
index 0000000..ddcf198
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/UserProxy.java
@@ -0,0 +1,21 @@
+package com.supwisdom.dlpay.paysdk.proxy;
+
+import com.supwisdom.dlpay.api.bean.ModifyUserParam;
+import com.supwisdom.dlpay.api.bean.OpenUserParam;
+import com.supwisdom.dlpay.api.bean.QueryUserParam;
+import com.supwisdom.dlpay.api.bean.UserResponse;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+@FeignClient(value = "userProxy", url = "${payapi.url}")
+public interface UserProxy {
+ @PostMapping("/api/user/open")
+ UserResponse openAccount(@RequestBody OpenUserParam param);
+
+ @PostMapping("/api/user/query")
+ UserResponse queryAccount(@RequestBody QueryUserParam param);
+
+ @PostMapping("/api/user/modify")
+ UserResponse modifyAccount(@RequestBody ModifyUserParam param);
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/YktPayProxy.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/YktPayProxy.java
new file mode 100644
index 0000000..46d967c
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/proxy/YktPayProxy.java
@@ -0,0 +1,19 @@
+package com.supwisdom.dlpay.paysdk.proxy;
+
+import com.supwisdom.dlpay.api.bean.CitizenCardPayfinishParam;
+import com.supwisdom.dlpay.api.bean.YktCardPayinitParam;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.Map;
+
+@FeignClient(name = "yktPayProxy", url = "${payapi.url}")
+public interface YktPayProxy {
+ @PostMapping("/api/consume/ykt/payinit")
+ ResponseEntity<Map<String, String>> yktPayInit(@RequestBody YktCardPayinitParam param);
+
+ @PostMapping("/api/consume/ykt/payfinish")
+ ResponseEntity<Map<String, String>> yktPayFinish(@RequestBody CitizenCardPayfinishParam param);
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/utils/Constants.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/utils/Constants.java
new file mode 100644
index 0000000..f3dae03
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/utils/Constants.java
@@ -0,0 +1,6 @@
+package com.supwisdom.dlpay.paysdk.utils;
+
+public class Constants {
+ public static final String HEADER_TENANT_ID = "X-TENANT-ID";
+ public static final String JWT_HEADER = "Authorization";
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/utils/JwtContext.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/utils/JwtContext.java
new file mode 100644
index 0000000..0bd07ef
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/utils/JwtContext.java
@@ -0,0 +1,17 @@
+package com.supwisdom.dlpay.paysdk.utils;
+
+public class JwtContext {
+ private static String jwt;
+
+ public static String getJwt() {
+ synchronized (JwtContext.class) {
+ return jwt;
+ }
+ }
+
+ public static void setJwt(String j) {
+ synchronized (JwtContext.class) {
+ jwt = j;
+ }
+ }
+}
diff --git a/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/utils/Utils.java b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/utils/Utils.java
new file mode 100644
index 0000000..27b15a0
--- /dev/null
+++ b/payapi-sdk/src/main/java/com/supwisdom/dlpay/paysdk/utils/Utils.java
@@ -0,0 +1,5 @@
+package com.supwisdom.dlpay.paysdk.utils;
+
+public class Utils {
+
+}
diff --git a/payapi-sdk/src/test/java/com/supwisdom/dlpay/paysdktest/CitizenCardPayProxyTest.java b/payapi-sdk/src/test/java/com/supwisdom/dlpay/paysdktest/CitizenCardPayProxyTest.java
new file mode 100644
index 0000000..be86202
--- /dev/null
+++ b/payapi-sdk/src/test/java/com/supwisdom/dlpay/paysdktest/CitizenCardPayProxyTest.java
@@ -0,0 +1,180 @@
+package com.supwisdom.dlpay.paysdktest;
+
+
+import com.supwisdom.dlpay.api.bean.*;
+import com.supwisdom.dlpay.api.util.DateUtil;
+import com.supwisdom.dlpay.paysdk.ApiLoginHelper;
+import com.supwisdom.dlpay.paysdk.proxy.*;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
+import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.cloud.openfeign.FeignAutoConfiguration;
+import org.springframework.cloud.openfeign.ribbon.FeignRibbonClientAutoConfiguration;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.notNullValue;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(properties = {
+ "payapi.url=http://localhost:8099/payapi"},
+ classes = CitizenCardPayProxyTest.class)
+@ImportAutoConfiguration({RibbonAutoConfiguration.class,
+ FeignRibbonClientAutoConfiguration.class, FeignAutoConfiguration.class,
+ HttpMessageConvertersAutoConfiguration.class})
+@EnableFeignClients(basePackages = "com.supwisdom.dlpay.paysdk")
+@ComponentScan(basePackages = {"com.supwisdom.dlpay.paysdk"})
+public class CitizenCardPayProxyTest {
+ private final static String appid = "700001";
+ private final static String secret = "5f788ce433ec44f299351cdf7f137e81";
+
+ @Autowired
+ private ApiLoginProxy apiLoginProxy;
+
+ @Autowired
+ private CitizenCardPayProxy citizenCardPayProxy;
+
+ @Autowired
+ private ApiCommonProxy apiCommonProxy;
+ @Autowired
+ private ShopProxy shopProxy;
+ @Autowired
+ private UserProxy userProxy;
+ @Autowired
+ private ConsumePropxy consumePropxy;
+
+
+ @org.junit.Test
+ public void citizencardPayinit() {
+ ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
+ helper.login(appid, secret);
+
+ ApiVersionResponse version = apiCommonProxy.apiVersion();
+
+ assertThat("get version error " + version.getException(),
+ version.getVersion(), notNullValue());
+
+ System.out.println(version.getVersion());
+
+ CitizenCardPayinitParam initParam = new CitizenCardPayinitParam();
+ initParam.setBillno("20190708172756000001");
+ initParam.setCardNo("20190619001");
+ initParam.setAmount(0);
+ initParam.setTransdate("20190708");
+ initParam.setTranstime("172713");
+ initParam.setShopaccno("2000000038");
+ CitizenPayResponse payInit = citizenCardPayProxy.citizencardPayinit(initParam);
+ assertThat("pay initialized " + payInit.getRetmsg() + payInit.getException(),
+ payInit.getRetcode(), equalTo(0));
+ }
+ @Test
+ public void openShopAccount(){
+
+ ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
+ helper.login(appid, secret);
+ ApiVersionResponse version = apiCommonProxy.apiVersion();
+
+ assertThat("get version error " + version.getException(),
+ version.getVersion(), notNullValue());
+ OpenShopParam param = new OpenShopParam();
+ param.setShopUniqueId("35315266");
+ param.setShoptype("normal");
+ param.setShopname("test1");
+ param.setFshopid(1);
+ param.setSign("130FE09F73123638337F34DAAE4DF2DF");
+ param.setTenantid("default");
+ ShopResponse response = shopProxy.openAccount(param);
+ assertThat("shop open " + response.getRetmsg() + response.getException(),
+ response.getRetcode(), equalTo(0));
+ }
+ @Test
+ public void openUserAccount(){
+
+ ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
+ helper.login(appid, secret);
+ ApiVersionResponse version = apiCommonProxy.apiVersion();
+
+ assertThat("get version error " + version.getException(),
+ version.getVersion(), notNullValue());
+ OpenUserParam param = new OpenUserParam();
+ param.setUid("testuid1");
+ param.setIdtype("student_idcard");
+ param.setIdno("100016");
+ param.setName("100016");
+ param.setTenantid("default");
+ param.generalSign(secret);
+ System.out.println(param.getSign());
+ UserResponse response = userProxy.openAccount(param);
+ assertThat("user open " + response.getRetmsg() + response.getException(),
+ response.getRetcode(), equalTo(0));
+ }
+
+ @Test
+ public void qrcodeInit(){
+ ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
+ helper.login(appid, secret);
+ ApiVersionResponse version = apiCommonProxy.apiVersion();
+
+ assertThat("get version error " + version.getException(),
+ version.getVersion(), notNullValue());
+
+ QrcodePayParam param = new QrcodePayParam();
+ param.setAmount(1);
+ param.setAnonymous(true);
+ param.setBillno(DateUtil.getNow());
+ param.setQrcodeFormat("origin");
+ param.setTransdate(DateUtil.getNow("yyyyMMdd"));
+ param.setTranstime(DateUtil.getNow("HHmmss"));
+ param.setTenantid("default");
+ param.setShopaccno("2000000012");
+ param.setQrcode("286972142340737770");
+ QrcodePayResponse response = consumePropxy.qrcodePayInit(param);
+ assertThat("qrcodeInit " + response.getRetmsg() + response.getException(),
+ response.getRetcode(), equalTo(0));
+ }
+
+ @Test
+ public void qrcodePay(){
+ ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
+ helper.login(appid, secret);
+ ApiVersionResponse version = apiCommonProxy.apiVersion();
+
+ assertThat("get version error " + version.getException(),
+ version.getVersion(), notNullValue());
+
+ QrcodePayParam param = new QrcodePayParam();
+ param.setAmount(1);
+ param.setAnonymous(false);
+ param.setBillno(DateUtil.getNow());
+ param.setQrcodeFormat("origin");
+ param.setTransdate(DateUtil.getNow("yyyyMMdd"));
+ param.setTranstime(DateUtil.getNow("HHmmss"));
+ //param.setTenantid("default");
+ param.setShopaccno("2000000012");
+ param.setQrcode("134985742861278239");
+ param.setUserid("402882816be4b6b9016be4b78ab30001");
+ param.setDtltype("canteen");
+ param.setSpip("172.28.43.3");
+ QrcodePayResponse response = consumePropxy.qrcodePayInit(param);
+ assertThat("qrcodeInit " + response.getRetmsg() + response.getException(),
+ response.getRetcode(), equalTo(0));
+
+ response = consumePropxy.qrcodePayConfirm(param);
+ assertThat("qrcodeConfirm:" + response.getRetmsg() + response.getException()+",query="+response.isRequireQuery(),
+ response.getRetcode(), equalTo(0));
+ }
+
+ public static void main(String[] args) {
+
+ }
+}
diff --git a/payapi/Dockerfile b/payapi/Dockerfile
new file mode 100644
index 0000000..28f3e81
--- /dev/null
+++ b/payapi/Dockerfile
@@ -0,0 +1,9 @@
+FROM openjdk:8
+
+COPY payapi-1.jar /opt/payapi/payapi.jar
+
+EXPOSE 8080
+
+WORKDIR /opt/payapi
+
+CMD ["java" , "-jar", "payapi.jar"]
diff --git a/payapi/build.gradle b/payapi/build.gradle
new file mode 100644
index 0000000..3e5d865
--- /dev/null
+++ b/payapi/build.gradle
@@ -0,0 +1,119 @@
+plugins {
+ id 'java'
+ id 'org.springframework.boot'
+ id 'org.jetbrains.kotlin.jvm'
+ id 'org.jetbrains.kotlin.plugin.jpa' version '1.3.31'
+ id 'org.jetbrains.kotlin.plugin.spring'
+ id "com.palantir.git-version"
+ id 'com.palantir.docker'
+}
+
+apply plugin: 'java'
+apply plugin: 'io.spring.dependency-management'
+
+payapiVersion = gitVersion()
+def details = versionDetails()
+
+group = rootProject.group
+version = '1'
+sourceCompatibility = jdkVersion
+def payapiStartClass = 'com.supwisdom.dlpay.PayApiApplicationKt'
+
+println("Build version: $payapiVersion")
+
+bootJar {
+ mainClassName = payapiStartClass
+ manifest {
+ attributes('Payapi-Version': payapiVersion)
+ }
+}
+
+jar {
+ baseName = 'payapi'
+}
+
+docker {
+ def imageVersion
+ if (details.commitDistance > 0 || !details.isCleanTag) {
+ imageVersion = 'dev'
+ } else {
+ imageVersion = details.lastTag
+ }
+ name 'harbor.supwisdom.com/dali/payapi:' + imageVersion
+ println(jar.archivePath)
+ files jar.archivePath
+}
+
+docker.dependsOn(jar)
+
+dependencies {
+ implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
+ implementation 'org.springframework.boot:spring-boot-starter-data-redis'
+ implementation 'org.springframework.boot:spring-boot-starter-web'
+ implementation 'org.springframework.boot:spring-boot-starter-security'
+ implementation 'org.springframework.boot:spring-boot-starter-cache'
+ implementation 'org.springframework.boot:spring-boot-autoconfigure'
+ implementation 'org.springframework.security:spring-security-oauth2-jose'
+ implementation 'org.springframework.security:spring-security-oauth2-client'
+ implementation 'org.springframework.security:spring-security-oauth2-jose'
+ implementation 'org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.1.5.RELEASE'
+ implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
+ implementation 'org.springframework.session:spring-session-data-redis'
+ implementation 'org.springframework.boot:spring-boot-starter-cache'
+ implementation 'org.springframework.social:spring-social-web:1.1.6.RELEASE'
+ implementation 'org.jetbrains.kotlin:kotlin-reflect'
+ implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
+ implementation 'commons-codec:commons-codec:1.12'
+ implementation 'org.apache.commons:commons-lang3:3.9'
+ implementation 'net.javacrumbs.shedlock:shedlock-spring:2.5.0'
+ implementation 'net.javacrumbs.shedlock:shedlock-provider-redis-spring:2.5.0'
+
+ implementation 'org.springframework.cloud:spring-cloud-starter-consul-discovery:2.1.2.RELEASE'
+
+ implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
+
+ runtime("org.springframework.boot:spring-boot-devtools")
+
+ implementation 'org.postgresql:postgresql:42.2.5'
+ implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
+ implementation 'com.jcabi:jcabi-manifests:1.1'
+ implementation 'org.bitbucket.b_c:jose4j:0.6.5'
+ implementation 'io.github.microutils:kotlin-logging:1.6.26'
+ implementation 'org.slf4j:slf4j-parent:1.7.26'
+ implementation 'com.github.penggle:kaptcha:2.3.2'
+ implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
+ implementation group: 'com.sun.jersey', name: 'jersey-client', version: '1.19'
+ implementation group: 'javax.servlet', name: 'jstl', version: '1.2'
+ implementation group: 'taglibs', name: 'standard', version: '1.1.2'
+ implementation group: 'commons-codec', name: 'commons-codec', version: '1.6'
+// implementation files('libs/ojdbc6.jar')
+ implementation 'commons-dbcp:commons-dbcp:1.4'
+
+ implementation project(':payapi-common')
+ /*支付宝SDK*/
+ implementation group: 'com.alipay.sdk', name: 'alipay-sdk-java', version: '3.7.110.ALL'
+
+ annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
+ annotationProcessor 'org.projectlombok:lombok:1.18.8'
+ compileOnly 'org.projectlombok:lombok:1.18.8'
+
+// providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
+ testImplementation 'org.springframework.boot:spring-boot-starter-test'
+ testImplementation 'io.rest-assured:rest-assured:3.3.0'
+ testImplementation 'io.rest-assured:spring-mock-mvc:3.3.0'
+ testImplementation 'org.hamcrest:hamcrest:2.1'
+}
+
+compileKotlin {
+ kotlinOptions {
+ freeCompilerArgs = ['-Xjsr305=strict']
+ jvmTarget = jdkVersion
+ }
+}
+
+compileTestKotlin {
+ kotlinOptions {
+ freeCompilerArgs = ['-Xjsr305=strict']
+ jvmTarget = jdkVersion
+ }
+}
diff --git a/libs/ojdbc6.jar b/payapi/libs/ojdbc6.jar
similarity index 100%
rename from libs/ojdbc6.jar
rename to payapi/libs/ojdbc6.jar
Binary files differ
diff --git a/src/main/java/com/supwisdom/dlpay/AppPreparedEvent.java b/payapi/src/main/java/com/supwisdom/dlpay/AppPreparedEvent.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/AppPreparedEvent.java
rename to payapi/src/main/java/com/supwisdom/dlpay/AppPreparedEvent.java
diff --git a/src/main/java/com/supwisdom/dlpay/ServletInitializer.kt b/payapi/src/main/java/com/supwisdom/dlpay/ServletInitializer.kt
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/ServletInitializer.kt
rename to payapi/src/main/java/com/supwisdom/dlpay/ServletInitializer.kt
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentCode.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentCode.java
new file mode 100644
index 0000000..0d56cc1
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentCode.java
@@ -0,0 +1,35 @@
+package com.supwisdom.dlpay.agent;
+
+public enum AgentCode {
+ SUCCESS("success", "成功"),
+ FAIL("fail", "交易失败"),
+ REFNO_NOT_EXISTS("refno_not_exists", "指定流水不存在"),
+ ILLEGAL_DATA("illegal_data", "数据不合法,不能交易"),
+ SERVER_INTERNAL_ERROR("server_internal_error", "交易系统错误"),
+ REQUIRE_QUERY("require_query", "交易未完成,请查询"),
+ WAIT_NOTIFY("wait_notify", "交易已发起,等待通知"),
+ SHORT_OF_BALANCE("short_of_balance", "余额不足"),
+ NOT_SUPPORT("not_support", "不支持功能"),
+ COMMON_ERROR("common_error", "其它错误"),
+ CONFIG_ERROR("config_error", "参数配置错误");
+ AgentCode(String code, String msg) {
+ this.code = code;
+ this.msg = msg;
+ }
+
+ public String value() {
+ return this.code;
+ }
+
+ public String message() {
+ return this.msg;
+ }
+
+ private String code;
+ private String msg;
+
+ @Override
+ public String toString() {
+ return code;
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentConst.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentConst.java
new file mode 100644
index 0000000..6807f6b
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentConst.java
@@ -0,0 +1,5 @@
+package com.supwisdom.dlpay.agent;
+
+public class AgentConst {
+
+}
\ No newline at end of file
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentPayService.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentPayService.java
new file mode 100644
index 0000000..9b10dfc
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentPayService.java
@@ -0,0 +1,15 @@
+package com.supwisdom.dlpay.agent;
+
+import com.supwisdom.dlpay.api.domain.TTransactionMain;
+
+public interface AgentPayService {
+ AgentResponse auth(String agentid, String billno);
+
+ AgentResponse pay(TTransactionMain transaction);
+
+ AgentResponse cancel(TTransactionMain transaction);
+
+ AgentResponse refund(TTransactionMain transaction);
+
+ AgentResponse query(TTransactionMain transaction);
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentResponse.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentResponse.java
new file mode 100644
index 0000000..d07cba5
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentResponse.java
@@ -0,0 +1,62 @@
+package com.supwisdom.dlpay.agent;
+
+public class AgentResponse {
+ public static final String AGENTCODE_SUCCESS = "0";
+
+ public static final String AGENTCODE_FAIL = "1";
+
+ private AgentCode code;
+ private String agentCode;
+ private String agentMsg;
+ private String agentBody;
+ private String agentRefno;
+ private DtlStatus dtlStatus;
+
+ public String getAgentBody() {
+ return agentBody;
+ }
+
+ public void setAgentBody(String agentBody) {
+ this.agentBody = agentBody;
+ }
+
+ public AgentCode getCode() {
+ return code;
+ }
+
+ public void setCode(AgentCode code) {
+ this.code = code;
+ }
+
+ public String getAgentCode() {
+ return agentCode;
+ }
+
+ public void setAgentCode(String agentCode) {
+ this.agentCode = agentCode;
+ }
+
+ public String getAgentMsg() {
+ return agentMsg;
+ }
+
+ public void setAgentMsg(String agentMsg) {
+ this.agentMsg = agentMsg;
+ }
+
+ public String getAgentRefno() {
+ return agentRefno;
+ }
+
+ public void setAgentRefno(String agentRefno) {
+ this.agentRefno = agentRefno;
+ }
+
+ public DtlStatus getDtlStatus() {
+ return dtlStatus;
+ }
+
+ public void setDtlStatus(DtlStatus dtlStatus) {
+ this.dtlStatus = dtlStatus;
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/DtlStatus.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/DtlStatus.java
new file mode 100644
index 0000000..a13f1d5
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/DtlStatus.java
@@ -0,0 +1,9 @@
+package com.supwisdom.dlpay.agent;
+
+public enum DtlStatus {
+ SUCCESS, //成功
+ FAIL, //失败
+ REFUND, //已退款
+ PARTIAL_REFUND, //部分退款
+ WAIT //等待付款
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/DlpayResp.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/DlpayResp.java
new file mode 100644
index 0000000..bc9510a
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/DlpayResp.java
@@ -0,0 +1,118 @@
+package com.supwisdom.dlpay.agent.citizencard;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "root")
+public class DlpayResp {
+ private String code;
+ private String message;
+ private String transdate;
+ private String transtime;
+ private String bankjourno; //银行流水号
+ private String sinstatus; //1-已签约 2-未签约
+ private String captcha; //验证码
+ private String status; //0-成功;1-失败;2-已退款;3-部分退款
+ private String filename;
+ private String trxdate; //银行记账日期
+ private Integer amount; //查询时返回流水金额
+
+ @XmlElement(name = "CODE")
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ @XmlElement(name = "MESSAGE")
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ @XmlElement(name = "TRANSDATE")
+ public String getTransdate() {
+ return transdate;
+ }
+
+ public void setTransdate(String transdate) {
+ this.transdate = transdate;
+ }
+
+ @XmlElement(name = "TRANSTIME")
+ public String getTranstime() {
+ return transtime;
+ }
+
+ public void setTranstime(String transtime) {
+ this.transtime = transtime;
+ }
+
+ @XmlElement(name = "BANKJOURNO")
+ public String getBankjourno() {
+ return bankjourno;
+ }
+
+ public void setBankjourno(String bankjourno) {
+ this.bankjourno = bankjourno;
+ }
+
+ @XmlElement(name = "SINSTATUS")
+ public String getSinstatus() {
+ return sinstatus;
+ }
+
+ public void setSinstatus(String sinstatus) {
+ this.sinstatus = sinstatus;
+ }
+
+ @XmlElement(name = "CAPTCHA")
+ public String getCaptcha() {
+ return captcha;
+ }
+
+ public void setCaptcha(String captcha) {
+ this.captcha = captcha;
+ }
+
+ @XmlElement(name = "STATUS")
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ @XmlElement(name = "FILENAME")
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ @XmlElement(name = "TRXDATE")
+ public String getTrxdate() {
+ return trxdate;
+ }
+
+ public void setTrxdate(String trxdate) {
+ this.trxdate = trxdate;
+ }
+
+ @XmlElement(name = "AMOUNT")
+ public Integer getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Integer amount) {
+ this.amount = amount;
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/YnrccRespCode.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/YnrccRespCode.java
new file mode 100644
index 0000000..6fdd230
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/YnrccRespCode.java
@@ -0,0 +1,27 @@
+package com.supwisdom.dlpay.agent.citizencard;
+
+public class YnrccRespCode {
+ private String code;
+ private String msg;
+
+ public YnrccRespCode(String code, String msg) {
+ this.code = code;
+ this.msg = msg;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getMsg() {
+ return msg;
+ }
+
+ public void setMsg(String msg) {
+ this.msg = msg;
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/YnrccUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/YnrccUtil.java
new file mode 100644
index 0000000..4c8a23d
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/YnrccUtil.java
@@ -0,0 +1,87 @@
+package com.supwisdom.dlpay.agent.citizencard;
+
+import com.supwisdom.dlpay.agent.AgentCode;
+import org.springframework.data.util.Pair;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class YnrccUtil {
+ public static final String BANKCARD_BIND_TRANSCODE = "BC5510";
+ public static final String BANKCARD_SIGN_TRANSCODE = "BC5511";
+ public static final String BANKCARD_PAY_TRANSCODE = "BC5512";
+ public static final String BANKCARD_PAYREFUND_TRANSCODE = "BC5513";
+ public static final String BANKCARD_QUERYRESULT_TRANSCODE = "BC5514";
+ public static final String BANKCARD_CHKFILE_TRANSCODE = "BC5515";
+
+ public static final String DLPAY_CATEGORIE = "C001"; //消费类别
+
+ public static final String YNRCC_ANGENT_URL = "ynrcc.agent.url"; //农商行前置url
+ public static final String YNRCC_SIGNKEY = "ynrcc.agent.signkey"; //农商行前置md5key
+ public static final String YNRCC_MERCHANT_BANKCARDNO = "merchant.bankcardno";
+ public static final String YNRCC_MERCHANT_BANKACCNAME = "merchant.bankaccname";
+
+ public static final String PARAM_CONFIG_ERROR = "90000"; // 参数未配置
+ public static final String PARAM_VALUE_ERROR = "90001"; // 参数值错误
+
+ public static final int AGENT_CONNECT_TIMEOUT = 20;
+ public static final String TRANSTYPE_SIGNCARD = "1"; //签约
+ public static final String TRANSTYPE_UNSIGNCARD = "2"; //解约
+
+ public static final String CODE_SUCCESS = "0000"; //成功
+ public static final String CODE_NOT_EXISTS = "0401"; //流水不存在
+ public static final String CODE_EXCEPTION = "10000"; //异常
+ public static final String NO_RECORDS_TODAY = "0406"; //当日无交易明细
+
+ //查询接口返回的流水状态
+ public static final String DTL_STATUS_SUCCESS = "0"; //成功
+ public static final String DTL_STATUS_FAIL = "1"; //失败
+ public static final String DTL_STATUS_REFUND = "2"; //已退款
+ public static final String DTL_STATUS_PART_REFUND = "3"; //部分退款
+
+ public static final int QUERY_MAX_COUNT = 3; //最大查询次数
+
+ public static final String YNRCC_BILLS_DOWNLOAD_LASTDATE = "ynrcc.download.bills.lastdate";
+
+ public static final List<Pair<AgentCode, YnrccRespCode>> errcode = new ArrayList<>(0);
+
+ static {
+ errcode.add(Pair.of(AgentCode.SUCCESS, new YnrccRespCode("0000", "成功")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0101", "手机号不一致")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0102", "无预留手机号")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0103", "证件类型不一致")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0104", "证件号码不一致")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0105", "户名不符")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0106", "卡状态异常")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0107", "无此卡号")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0108", "已存在签约信息,与签约证件号码不符")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0109", "已存在签约信息,与签约证件类型不符")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0110", "已存在签约信息,与签约户名不符")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0111", "已存在签约信息,与签约手机号不符")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0112", "卡已挂失")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0113", "卡已密码挂失")));
+
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0201", "未进行银行卡绑定")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0202", "无效的交易类型")));
+
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0301", "未签约")));
+ errcode.add(Pair.of(AgentCode.SHORT_OF_BALANCE, new YnrccRespCode("0302", "余额不足")));
+ errcode.add(Pair.of(AgentCode.SERVER_INTERNAL_ERROR, new YnrccRespCode("0303", "MD5校验失败")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0304", "该卡号已经解约,不允许重复解约")));
+ errcode.add(Pair.of(AgentCode.REFNO_NOT_EXISTS, new YnrccRespCode("0401", "原始流水不存在")));
+ errcode.add(Pair.of(AgentCode.FAIL, new YnrccRespCode("0402", "原始流水未成功")));
+ errcode.add(Pair.of(AgentCode.FAIL, new YnrccRespCode("0403", "原始流水已退款")));
+ errcode.add(Pair.of(AgentCode.SHORT_OF_BALANCE, new YnrccRespCode("0404", "商户账户余额不足")));
+ errcode.add(Pair.of(AgentCode.FAIL, new YnrccRespCode("0405", "不在退款时间范围内")));
+ errcode.add(Pair.of(AgentCode.SUCCESS, new YnrccRespCode("0406", "当日无交易明细")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0407", "非大理市民卡,不允许交易")));
+ errcode.add(Pair.of(AgentCode.FAIL, new YnrccRespCode("0408", "同一请求流水号不允许重复提交")));
+ errcode.add(Pair.of(AgentCode.COMMON_ERROR, new YnrccRespCode("4444", "其他错误")));
+ errcode.add(Pair.of(AgentCode.REQUIRE_QUERY, new YnrccRespCode(CODE_EXCEPTION, "待查询")));
+ errcode.add(Pair.of(AgentCode.SERVER_INTERNAL_ERROR, new YnrccRespCode(PARAM_CONFIG_ERROR, "{message}")));
+ errcode.add(Pair.of(AgentCode.SERVER_INTERNAL_ERROR, new YnrccRespCode(PARAM_VALUE_ERROR, "{message}")));
+ }
+
+
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePatternDao.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePatternDao.java
new file mode 100644
index 0000000..198645e
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePatternDao.java
@@ -0,0 +1,14 @@
+package com.supwisdom.dlpay.agent.dao;
+
+import com.supwisdom.dlpay.agent.domain.QrcodePattern;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.List;
+
+public interface QrcodePatternDao extends CrudRepository<QrcodePattern, Integer> {
+ List<QrcodePattern> findByTenantid(String tenantid);
+
+ void deleteByTenantid(String tenantid);
+
+ List<QrcodePattern> findBySourceTypeAndTenantid(String sourceType, String tenantid);
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePayTransDao.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePayTransDao.java
new file mode 100644
index 0000000..1a54012
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePayTransDao.java
@@ -0,0 +1,20 @@
+package com.supwisdom.dlpay.agent.dao;
+
+import com.supwisdom.dlpay.agent.domain.QrcodePayTrans;
+import org.springframework.data.jpa.repository.Lock;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.stereotype.Repository;
+
+import javax.persistence.LockModeType;
+
+
+@Repository
+public interface QrcodePayTransDao extends CrudRepository<QrcodePayTrans, String> {
+ QrcodePayTrans findByRefnoAndTenantid(String refno, String tenantid);
+
+ @Lock(LockModeType.OPTIMISTIC)
+ QrcodePayTrans findByAgentMerchIdAndHostdateAndBillnoAndTenantid(String agentMerchId, String hostdate,
+ String billno, String tenantid);
+
+ void deleteByRefnoAndTenantid(String refno, String tenantid);
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/domain/QrcodePattern.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/domain/QrcodePattern.java
new file mode 100644
index 0000000..f5e4e73
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/domain/QrcodePattern.java
@@ -0,0 +1,62 @@
+package com.supwisdom.dlpay.agent.domain;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+@Table(name = "tb_qrcode_pattern")
+@Entity
+public class QrcodePattern implements Serializable {
+
+ private static final long serialVersionUID = 1731574413627262946L;
+
+ @SequenceGenerator(name = "qrcode_pattern_id", sequenceName = "SEQ_QRCODE_PATTERN", allocationSize = 1, initialValue = 10)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qrcode_pattern_id")
+ @Id
+ @Column(name = "id")
+ private Integer id;
+
+ @Column(name = "sourcetype", length = 20)
+ @NotNull
+ private String sourceType;
+
+ @Column(name = "pattern", length = 300)
+ @NotNull
+ private String pattern;
+
+ @Column(name = "tenantid", length = 20)
+ @NotNull
+ private String tenantid;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getSourceType() {
+ return sourceType;
+ }
+
+ public void setSourceType(String sourceType) {
+ this.sourceType = sourceType;
+ }
+
+ public String getPattern() {
+ return pattern;
+ }
+
+ public void setPattern(String pattern) {
+ this.pattern = pattern;
+ }
+
+ public String getTenantid() {
+ return tenantid;
+ }
+
+ public void setTenantid(String tenantid) {
+ this.tenantid = tenantid;
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/domain/QrcodePayTrans.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/domain/QrcodePayTrans.java
new file mode 100644
index 0000000..ec57610
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/domain/QrcodePayTrans.java
@@ -0,0 +1,196 @@
+package com.supwisdom.dlpay.agent.domain;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "tb_qrcode_pay_trans",
+ indexes = {@Index(name = "qrcode_pay_trans_idx", columnList = "qrcode, sourcetype"),
+ @Index(name = "qrcode_pay_trans_idx2", columnList = "agent_merch_id, billno, tenantid", unique = true),
+ @Index(name = "qrcode_pay_trans_idx3", columnList = "agent_merch_id, billno")})
+public class QrcodePayTrans implements Serializable {
+ private static final long serialVersionUID = 5203902461916249307L;
+
+ @Id
+ @SequenceGenerator(name = "qrcode_pay_trans_id", sequenceName = "SEQ_QRCODE_PAY_TRANS", allocationSize = 1, initialValue = 1)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qrcode_pay_trans_id")
+ @Column(name = "id")
+ private int id;
+
+ @Column(name = "agent_merch_id", length = 30)
+ @NotNull
+ private String agentMerchId;
+
+ @Column(name = "billno", length = 32)
+ @NotNull
+ private String billno;
+
+ @Column(name = "hostdate", length = 8)
+ @NotNull
+ private String hostdate;
+
+ @Column(name = "refno", length = 32)
+ private String refno;
+
+ @Column(name = "agent_user_id", length = 200)
+ private String agentUserId;
+
+ @Column(name = "agent_refno", length = 64)
+ private String agentRefno;
+
+ @Column(name = "qrcode", length = 256)
+ @NotNull
+ private String qrcode;
+
+ @Column(name = "anonymous")
+ @NotNull
+ private boolean anonymous;
+
+ @Column(name = "sourcetype", length = 30)
+ @NotNull
+ private String sourceType;
+
+ @Column(name = "userid", length = 40)
+ private String userid;
+
+ @NotNull
+ @Column(name = "createTime")
+ private Timestamp createTime;
+
+ @Column(name = "update_time")
+ @NotNull
+ @Version
+ private Timestamp updateTime;
+
+ @NotNull
+ @Column(name = "tenantid", length = 20)
+ private String tenantid;
+
+ @Column(name = "spid", length = 20)
+ private String spip;
+
+ public QrcodePayTrans() {
+ }
+
+ public String getRefno() {
+ return refno;
+ }
+
+ public void setRefno(String refno) {
+ this.refno = refno;
+ }
+
+ public String getAgentUserId() {
+ return agentUserId;
+ }
+
+ public void setAgentUserId(String agentUserId) {
+ this.agentUserId = agentUserId;
+ }
+
+ public String getQrcode() {
+ return qrcode;
+ }
+
+ public void setQrcode(String qrcode) {
+ this.qrcode = qrcode;
+ }
+
+ public Timestamp getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Timestamp createTime) {
+ this.createTime = createTime;
+ }
+
+ public String getTenantid() {
+ return tenantid;
+ }
+
+ public void setTenantid(String tenantid) {
+ this.tenantid = tenantid;
+ }
+
+ public String getSourceType() {
+ return sourceType;
+ }
+
+ public void setSourceType(String sourceType) {
+ this.sourceType = sourceType;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getAgentMerchId() {
+ return agentMerchId;
+ }
+
+ public void setAgentMerchId(String agentMerchId) {
+ this.agentMerchId = agentMerchId;
+ }
+
+ public String getBillno() {
+ return billno;
+ }
+
+ public void setBillno(String billno) {
+ this.billno = billno;
+ }
+
+ public String getHostdate() {
+ return hostdate;
+ }
+
+ public void setHostdate(String hostdate) {
+ this.hostdate = hostdate;
+ }
+
+ public boolean isAnonymous() {
+ return anonymous;
+ }
+
+ public void setAnonymous(boolean anonymous) {
+ this.anonymous = anonymous;
+ }
+
+ public String getUserid() {
+ return userid;
+ }
+
+ public void setUserid(String userid) {
+ this.userid = userid;
+ }
+
+ public String getAgentRefno() {
+ return agentRefno;
+ }
+
+ public void setAgentRefno(String agentRefno) {
+ this.agentRefno = agentRefno;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ public String getSpip() {
+ return spip;
+ }
+
+ public void setSpip(String spip) {
+ this.spip = spip;
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/service/AgentServiceProxy.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/AgentServiceProxy.java
new file mode 100644
index 0000000..80cb888
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/AgentServiceProxy.java
@@ -0,0 +1,79 @@
+package com.supwisdom.dlpay.agent.service;
+
+import com.supwisdom.dlpay.agent.dao.QrcodePayTransDao;
+import com.supwisdom.dlpay.agent.domain.QrcodePattern;
+import com.supwisdom.dlpay.agent.domain.QrcodePayTrans;
+import com.supwisdom.dlpay.framework.service.SystemUtilService;
+import com.supwisdom.dlpay.framework.tenant.TenantContext;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+@Service
+public class AgentServiceProxy {
+ private final QrcodePayTransDao qrcodeTransDao;
+ private final QrcodePatternService qrcodePatternService;
+ private final SystemUtilService systemUtilService;
+
+ public AgentServiceProxy(QrcodePayTransDao qrcodeTransDao,
+ QrcodePatternService qrcodePatternService,
+ SystemUtilService systemUtilService) {
+ this.qrcodeTransDao = qrcodeTransDao;
+ this.qrcodePatternService = qrcodePatternService;
+ this.systemUtilService = systemUtilService;
+ }
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ public QrcodePayTrans qrcodePayTransFindByRefno(String refno) {
+ return qrcodeTransDao.findByRefnoAndTenantid(refno, TenantContext.getTenantSchema());
+ }
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ public QrcodePayTrans qrcodePayTransFindByMerchIdAndBillno(String merchid, String billno) {
+ return qrcodeTransDao.findByAgentMerchIdAndHostdateAndBillnoAndTenantid(merchid,
+ systemUtilService.getSysdatetime().getHostdate(), billno, TenantContext.getTenantSchema());
+ }
+
+ public QrcodePayTrans qrcodePayTransSaveOrUpdate(@NotNull QrcodePayTrans bean) {
+ if (StringUtil.isEmpty(bean.getTenantid())) {
+ bean.setTenantid(TenantContext.getTenantSchema());
+ }
+ return qrcodeTransDao.save(bean);
+ }
+
+ public QrcodePattern qrcodeMatch(String code, String format) {
+ return qrcodeMatch(code);
+ }
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ public QrcodePattern qrcodeMatch(String code) {
+ List<QrcodePattern> pattern = qrcodePatternService.getAllQrcodePattern();
+ List<QrcodePattern> found = new ArrayList<>();
+ for (QrcodePattern item : pattern) {
+ if (Pattern.matches(item.getPattern(), code)) {
+ found.add(item);
+ }
+ }
+ if (found.size() == 0) {
+ throw new IllegalArgumentException("不支持的Qrcode");
+ }
+ if (found.size() > 1) {
+ Set<String> foundST = new HashSet<>();
+ for (QrcodePattern item : found) {
+ foundST.add(item.getSourceType());
+ }
+ if (foundST.size() > 1) {
+ throw new IllegalArgumentException("Qrcode匹配错误,找到多个sourcetype");
+ }
+ }
+ return found.get(0);
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/service/QrcodePatternService.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/QrcodePatternService.java
new file mode 100644
index 0000000..2ea2c3d
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/QrcodePatternService.java
@@ -0,0 +1,15 @@
+package com.supwisdom.dlpay.agent.service;
+
+import com.supwisdom.dlpay.agent.domain.QrcodePattern;
+
+import java.util.List;
+
+public interface QrcodePatternService {
+ List<QrcodePattern> getAllQrcodePattern();
+
+ void deleteAllQrcodePattern();
+
+ QrcodePattern saveOrUpdateQrcodePattern(QrcodePattern pattern);
+
+ List<QrcodePattern> findAllBySourcetype(String sourceType);
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/service/impl/QrcodePatternServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/impl/QrcodePatternServiceImpl.java
new file mode 100644
index 0000000..c14ee51
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/impl/QrcodePatternServiceImpl.java
@@ -0,0 +1,48 @@
+package com.supwisdom.dlpay.agent.service.impl;
+
+import com.supwisdom.dlpay.agent.dao.QrcodePatternDao;
+import com.supwisdom.dlpay.agent.domain.QrcodePattern;
+import com.supwisdom.dlpay.agent.service.QrcodePatternService;
+import com.supwisdom.dlpay.framework.tenant.TenantContext;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class QrcodePatternServiceImpl implements QrcodePatternService {
+ private final QrcodePatternDao qrcodePatternDao;
+
+ public QrcodePatternServiceImpl(QrcodePatternDao qrcodePatternDao) {
+ this.qrcodePatternDao = qrcodePatternDao;
+ }
+
+ @Override
+ @Cacheable(cacheNames = "qrcode_pattern_cache", key = "@tenantHolder.genKey('qrcode_pattern')")
+ public List<QrcodePattern> getAllQrcodePattern() {
+ return qrcodePatternDao.findByTenantid(TenantContext.getTenantSchema());
+ }
+
+ @Override
+ @CacheEvict(cacheNames = "qrcode_pattern_cache", key = "@tenantHolder.genKey('qrcode_pattern') + '.*'", allEntries = true)
+ public void deleteAllQrcodePattern() {
+ qrcodePatternDao.deleteByTenantid(TenantContext.getTenantSchema());
+ }
+
+ @Override
+ @CacheEvict(cacheNames = "qrcode_pattern_cache", key = "@tenantHolder.genKey('qrcode_pattern') + '.*'", allEntries = true)
+ public QrcodePattern saveOrUpdateQrcodePattern(@NotNull QrcodePattern pattern) {
+ if (pattern.getTenantid() == null || pattern.getTenantid().isEmpty()) {
+ pattern.setTenantid(TenantContext.getTenantSchema());
+ }
+ return qrcodePatternDao.save(pattern);
+ }
+
+ @Override
+ @Cacheable(cacheNames = "qrcode_pattern_cache", key = "@tenantHolder.genKey('qrcode_pattern', #sourceType)")
+ public List<QrcodePattern> findAllBySourcetype(String sourceType) {
+ return qrcodePatternDao.findBySourceTypeAndTenantid(sourceType, TenantContext.getTenantSchema());
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/bean/BaseResp.java b/payapi/src/main/java/com/supwisdom/dlpay/api/bean/BaseResp.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/bean/BaseResp.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/bean/BaseResp.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/bean/JsonResult.java b/payapi/src/main/java/com/supwisdom/dlpay/api/bean/JsonResult.java
similarity index 99%
rename from src/main/java/com/supwisdom/dlpay/api/bean/JsonResult.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/bean/JsonResult.java
index 67c9b77..dafde31 100755
--- a/src/main/java/com/supwisdom/dlpay/api/bean/JsonResult.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/bean/JsonResult.java
@@ -1,78 +1,78 @@
-package com.supwisdom.dlpay.api.bean;
-
-import java.util.HashMap;
-
-public class JsonResult extends HashMap<String, Object> {
- public JsonResult() {
- }
-
- /**
- * 返回成功
- */
- public static JsonResult ok() {
- return ok("操作成功");
- }
-
- /**
- * 返回成功
- */
- public static JsonResult ok(String message) {
- return ok(200, message);
- }
-
- /**
- * 返回成功
- */
- public static JsonResult ok(int code, String message) {
- JsonResult jsonResult = new JsonResult();
- jsonResult.put("code", code);
- jsonResult.put("msg", message);
- return jsonResult;
- }
-
- /**
- * 返回失败
- */
- public static JsonResult error() {
- return error("操作失败");
- }
-
- /**
- * 返回失败
- */
- public static JsonResult error(String messag) {
- return error(500, messag);
- }
-
- /**
- * 返回失败
- */
- public static JsonResult error(int code, String message) {
- return ok(code, message);
- }
-
- /**
- * 设置code
- */
- public JsonResult setCode(int code) {
- super.put("code", code);
- return this;
- }
-
- /**
- * 设置message
- */
- public JsonResult setMessage(String message) {
- super.put("msg", message);
- return this;
- }
-
- /**
- * 放入object
- */
- @Override
- public JsonResult put(String key, Object object) {
- super.put(key, object);
- return this;
- }
+package com.supwisdom.dlpay.api.bean;
+
+import java.util.HashMap;
+
+public class JsonResult extends HashMap<String, Object> {
+ public JsonResult() {
+ }
+
+ /**
+ * 返回成功
+ */
+ public static JsonResult ok() {
+ return ok("操作成功");
+ }
+
+ /**
+ * 返回成功
+ */
+ public static JsonResult ok(String message) {
+ return ok(200, message);
+ }
+
+ /**
+ * 返回成功
+ */
+ public static JsonResult ok(int code, String message) {
+ JsonResult jsonResult = new JsonResult();
+ jsonResult.put("code", code);
+ jsonResult.put("msg", message);
+ return jsonResult;
+ }
+
+ /**
+ * 返回失败
+ */
+ public static JsonResult error() {
+ return error("操作失败");
+ }
+
+ /**
+ * 返回失败
+ */
+ public static JsonResult error(String messag) {
+ return error(500, messag);
+ }
+
+ /**
+ * 返回失败
+ */
+ public static JsonResult error(int code, String message) {
+ return ok(code, message);
+ }
+
+ /**
+ * 设置code
+ */
+ public JsonResult setCode(int code) {
+ super.put("code", code);
+ return this;
+ }
+
+ /**
+ * 设置message
+ */
+ public JsonResult setMessage(String message) {
+ super.put("msg", message);
+ return this;
+ }
+
+ /**
+ * 放入object
+ */
+ @Override
+ public JsonResult put(String key, Object object) {
+ super.put(key, object);
+ return this;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/supwisdom/dlpay/api/bean/ReqParam.java b/payapi/src/main/java/com/supwisdom/dlpay/api/bean/ReqParam.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/bean/ReqParam.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/bean/ReqParam.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/bean/SupStatusRevResp.java b/payapi/src/main/java/com/supwisdom/dlpay/api/bean/SupStatusRevResp.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/bean/SupStatusRevResp.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/bean/SupStatusRevResp.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/bean/SupYktResp.java b/payapi/src/main/java/com/supwisdom/dlpay/api/bean/SupYktResp.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/bean/SupYktResp.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/bean/SupYktResp.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/bean/WechatReqResp.java b/payapi/src/main/java/com/supwisdom/dlpay/api/bean/WechatReqResp.java
similarity index 91%
rename from src/main/java/com/supwisdom/dlpay/api/bean/WechatReqResp.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/bean/WechatReqResp.java
index f69eb68..40b62e5 100644
--- a/src/main/java/com/supwisdom/dlpay/api/bean/WechatReqResp.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/bean/WechatReqResp.java
@@ -237,6 +237,41 @@
this.sign = MD5.encodeByMD5(str.toString());
return sign;
}
+ public String generalQuerySign(){
+ this.nonce_str = RandomUtils.getRandomString(30);
+ StringBuffer str = new StringBuffer()
+ .append("appid=").append(this.appid)
+ .append("&mch_id=").append(this.mch_id)
+ .append("&nonce_str=").append(nonce_str)
+ .append("&out_trade_no=").append(this.out_trade_no);
+ str.append("&key=").append(this.key);
+ this.sign = MD5.encodeByMD5(str.toString());
+ return sign;
+ }
+ public String generalQueryXML(){
+ StringBuffer requestStr = new StringBuffer();
+ requestStr
+ .append("<xml>")
+ .append("<appid>")
+ .append(this.appid)
+ .append("</appid>")
+ .append("<mch_id>")
+ .append(this.mch_id)
+ .append("</mch_id>")
+ .append("<nonce_str>")
+ .append(this.nonce_str)
+ .append("</nonce_str>")
+ .append("<out_trade_no>")
+ .append(this.out_trade_no)
+ .append("</out_trade_no>")
+ ;
+ requestStr.append("<sign>")
+ .append(this.sign)
+ .append("</sign>")
+ .append("</xml>");
+ return requestStr.toString();
+ }
+
public String generalCheckSign(){
this.nonce_str = RandomUtils.getRandomString(30);
StringBuffer str = new StringBuffer()
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java
similarity index 86%
rename from src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java
index 91c7bac..174a3a3 100644
--- a/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java
@@ -3,10 +3,7 @@
import com.supwisdom.dlpay.api.domain.TAccount;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.jpa.repository.QueryHints;
+import org.springframework.data.jpa.repository.*;
import org.springframework.data.repository.query.Param;
import javax.persistence.LockModeType;
@@ -39,4 +36,8 @@
@Query("select a from TAccount a where a.person.name like CONCAT('%',:accname,'%') ")
Page<TAccount> findAllByAccnameContaining(@Param("accname") String accname, Pageable pageable);
+
+ @Modifying
+ @Query("update TAccount set accname=?1 where userid=?2")
+ void updateAccnameByUserid(String accname, String userid);
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/dao/CardDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/CardDao.java
new file mode 100644
index 0000000..3b7d7f4
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/CardDao.java
@@ -0,0 +1,19 @@
+package com.supwisdom.dlpay.api.dao;
+
+import com.supwisdom.dlpay.api.domain.TCard;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+
+public interface CardDao extends JpaRepository<TCard, String> {
+
+ @Query("from TCard t where t.cardno=?1 and t.cardtype=?2")
+ TCard findCardByCardnoAndCardtype(String cardno, String cardtype);
+
+ @Modifying
+ @Query("update TCard set status='closed' where userid=?1 and cardtype='bankcard' ")
+ void closedBankcardStatusByUserid(String userid);
+
+ @Query("from TCard t where t.userid=?1 and t.cardtype=?2 and t.status='normal' ")
+ TCard findCardByUseridAndCardtype(String userid, String cardtype);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/DebitCreditDtlDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/DebitCreditDtlDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/dao/DebitCreditDtlDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/DebitCreditDtlDao.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/dao/DtlQueryDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/DtlQueryDao.java
new file mode 100644
index 0000000..178a88c
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/DtlQueryDao.java
@@ -0,0 +1,13 @@
+package com.supwisdom.dlpay.api.dao;
+
+import com.supwisdom.dlpay.api.domain.TDtlQuery;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
+
+public interface DtlQueryDao extends JpaRepository<TDtlQuery, String> {
+
+ @Query("from TDtlQuery t where t.accdate=?1 and t.status=?2 and t.qcnt<=?3 order by t.lastsaved ")
+ List<TDtlQuery> getNeedQueryDtls(String accdate, String status, int maxQcnt);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PersonDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/PersonDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/dao/PersonDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/PersonDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PersonIdentityDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/PersonIdentityDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/dao/PersonIdentityDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/PersonIdentityDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PersondtlDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/PersondtlDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/dao/PersondtlDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/PersondtlDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PointsTransdtlDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/PointsTransdtlDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/dao/PointsTransdtlDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/PointsTransdtlDao.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/dao/ShopSourceTypeConfigDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/ShopSourceTypeConfigDao.java
new file mode 100644
index 0000000..e861165
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/ShopSourceTypeConfigDao.java
@@ -0,0 +1,17 @@
+package com.supwisdom.dlpay.api.dao;
+
+import com.supwisdom.dlpay.api.domain.TShopSourceTypeConfig;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface ShopSourceTypeConfigDao extends JpaRepository<TShopSourceTypeConfig, String> {
+ @Query("select a from TShopSourceTypeConfig a where a.sourceType=?1 and a.shopaccno=?2 ")
+ List<TShopSourceTypeConfig> getShopSourceTypeConfigs(String paytype, String shopaccno);
+
+ @Query("select a from TShopSourceTypeConfig a where a.shopaccno=?1 and a.sourceType=?2 and a.configid=?3 ")
+ TShopSourceTypeConfig getShopSourceTypeConfigById(String shopaccno, String sourceType, String configid);
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/dao/ShopSourceTypeDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/ShopSourceTypeDao.java
new file mode 100644
index 0000000..8099292
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/ShopSourceTypeDao.java
@@ -0,0 +1,14 @@
+package com.supwisdom.dlpay.api.dao;
+
+import com.supwisdom.dlpay.api.domain.TShopSourceType;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ShopSourceTypeDao extends JpaRepository<TShopSourceType, String>, JpaSpecificationExecutor<TShopSourceType> {
+ @Query("select a from TShopSourceType a where a.sourceType=?1 and a.shopaccno=?2 ")
+ TShopSourceType getById(String sourceType, String shopaccno);
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/ShopdtlDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/ShopdtlDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/dao/ShopdtlDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/ShopdtlDao.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeConfigDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeConfigDao.java
new file mode 100644
index 0000000..fe9cf03
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeConfigDao.java
@@ -0,0 +1,20 @@
+package com.supwisdom.dlpay.api.dao;
+
+import com.supwisdom.dlpay.api.domain.TSourceTypeConfig;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * Created by shuwei on 2019/4/9.
+ */
+@Repository
+public interface SourceTypeConfigDao extends JpaRepository<TSourceTypeConfig, String> {
+
+ List<TSourceTypeConfig> getBySourceType(String sourceType);
+
+ TSourceTypeConfig getBySourceTypeAndConfigid(String sourceType, String configid);
+
+ List<TSourceTypeConfig> getBySourceTypeOrderByConfigid(String paytype);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/SubjectdtlDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/SubjectdtlDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/dao/SubjectdtlDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/SubjectdtlDao.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/dao/TransactionChkdtlDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/TransactionChkdtlDao.java
new file mode 100644
index 0000000..63058e8
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/TransactionChkdtlDao.java
@@ -0,0 +1,10 @@
+package com.supwisdom.dlpay.api.dao;
+
+import com.supwisdom.dlpay.api.domain.TTransactionChkdtl;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface TransactionChkdtlDao extends JpaRepository<TTransactionChkdtl, String> {
+
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/dao/TransactionChkfileDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/TransactionChkfileDao.java
new file mode 100644
index 0000000..a42f8ad
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/TransactionChkfileDao.java
@@ -0,0 +1,12 @@
+package com.supwisdom.dlpay.api.dao;
+
+import com.supwisdom.dlpay.api.domain.TTransactionChkfile;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Service;
+
+@Service
+public interface TransactionChkfileDao extends JpaRepository<TTransactionChkfile, String> {
+
+ TTransactionChkfile getByAccdateAndSourcetype(String accdate, String sourcetype);
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/TransactionMainDao.java b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/TransactionMainDao.java
similarity index 75%
rename from src/main/java/com/supwisdom/dlpay/api/dao/TransactionMainDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/dao/TransactionMainDao.java
index 476a1fa..b72f8d2 100644
--- a/src/main/java/com/supwisdom/dlpay/api/dao/TransactionMainDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/dao/TransactionMainDao.java
@@ -16,9 +16,16 @@
@Query(value = "select t from TTransactionMain t where t.refno = ?1")
TTransactionMain findByRefnoForUpdate(String refno);
+ @Lock(LockModeType.OPTIMISTIC)
+ @Query(value = "select t from TTransactionMain t where t.refno = ?1")
+ TTransactionMain findByRefnoNoLock(String refno);
+
TTransactionMain findByRefno(String refno);
@Query("select t from TTransactionMain t where t.outTradeNo=?1 and t.outId=?2")
TTransactionMain findByBillno(String billno, String outid);
+
+ @Query("select min(t.accdate) from TTransactionMain t where t.sourceType=?1 ")
+ String findMinAccdateBySourcetype(String sourcetype);
}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TAccount.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TAccount.java
similarity index 93%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TAccount.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TAccount.java
index c019cee..ccbb872 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TAccount.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TAccount.java
@@ -1,7 +1,7 @@
package com.supwisdom.dlpay.api.domain;
-import com.supwisdom.dlpay.framework.util.MD5;
import com.supwisdom.dlpay.framework.util.MoneyUtil;
+import com.supwisdom.dlpay.framework.util.Signature;
import com.supwisdom.dlpay.framework.util.TradeDict;
import org.hibernate.annotations.GenericGenerator;
@@ -257,22 +257,28 @@
}
public String generateTac() {
- String data = this.accno + MoneyUtil.YuanToFen(this.availbal) + MoneyUtil.YuanToFen(this.balance) + MoneyUtil.YuanToFen(this.frozebal);
- return MD5.generatePassword(data, this.accno);
+ String data = this.accno
+ + this.opendate
+ + this.transStatus
+ + this.userid
+ + MoneyUtil.YuanToFen(this.availbal)
+ + MoneyUtil.YuanToFen(this.balance)
+ + MoneyUtil.YuanToFen(this.frozebal);
+ return Signature.generateTac(this.accno, data);
}
public boolean tacCheck() {
String tac_c = generateTac();
- if (tac_c.equalsIgnoreCase(this.tac) || this.tac == null) {
+ if (tac_c.equalsIgnoreCase(this.tac) || Signature.SPY_TAC.equals(this.tac)) {
return true;
}
return false;
}
- public void addAmount(double amount) {
- this.balance = this.balance + amount;
- this.availbal = this.availbal + amount;
- this.tac = this.generateTac();
+ @PrePersist
+ @PreUpdate
+ public void updateTac() {
+ this.tac = generateTac();
}
public boolean checkOverflow() {
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBal.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBal.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBal.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBal.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBalPk.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBalPk.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBalPk.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBalPk.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TCard.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TCard.java
new file mode 100644
index 0000000..41dba29
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TCard.java
@@ -0,0 +1,151 @@
+package com.supwisdom.dlpay.api.domain;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+
+@Entity
+@Table(name = "TB_CARD",
+ indexes = {@Index(name = "tb_card_uk", columnList = "cardno,cardtype", unique = true)})
+public class TCard {
+ @Id
+ @GenericGenerator(name = "idGenerator", strategy = "uuid")
+ @GeneratedValue(generator = "idGenerator")
+ @Column(name = "ID", nullable = false, length = 32)
+ private String id;
+
+ @Column(name = "CARDNO", nullable = false, length = 32)
+ private String cardno;
+
+ @Column(name = "CARDTYPE", nullable = false, length = 20)
+ private String cardtype;
+
+ @Column(name = "CARDPHYID", length = 20)
+ private String cardphyid;
+
+ @Column(name = "STATUS", nullable = false, length = 20)
+ private String status; //normal/closed
+
+ @Column(name = "TRANS_STATUS", nullable = false, length = 20)
+ private String transStatus; //normal/loss/frozen/locked
+
+ @Column(name = "EXPIREDATE", length = 20)
+ private String expiredate;
+
+ @Column(name = "SIGNED", nullable = false, length = 10)
+ private Boolean signed = false; //签约状态
+
+ @Column(name = "USERID", nullable = false, length = 32)
+ private String userid;
+
+ @Column(name = "LASTSAVED", length = 20)
+ private String lastsaved;
+
+ @Column(name = "tenantid", length = 20)
+ @NotNull
+ private String tenantid = "";
+
+ public TCard() {
+ }
+
+ public TCard(String cardno, String cardtype, String cardphyid, String status, String transStatus, String expiredate, Boolean signed, String userid, String lastsaved) {
+ this.cardno = cardno;
+ this.cardtype = cardtype;
+ this.cardphyid = cardphyid;
+ this.status = status;
+ this.transStatus = transStatus;
+ this.expiredate = expiredate;
+ this.signed = signed;
+ this.userid = userid;
+ this.lastsaved = lastsaved;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getCardno() {
+ return cardno;
+ }
+
+ public void setCardno(String cardno) {
+ this.cardno = cardno;
+ }
+
+ public String getCardtype() {
+ return cardtype;
+ }
+
+ public void setCardtype(String cardtype) {
+ this.cardtype = cardtype;
+ }
+
+ public String getCardphyid() {
+ return cardphyid;
+ }
+
+ public void setCardphyid(String cardphyid) {
+ this.cardphyid = cardphyid;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getTransStatus() {
+ return transStatus;
+ }
+
+ public void setTransStatus(String transStatus) {
+ this.transStatus = transStatus;
+ }
+
+ public String getExpiredate() {
+ return expiredate;
+ }
+
+ public void setExpiredate(String expiredate) {
+ this.expiredate = expiredate;
+ }
+
+ public Boolean getSigned() {
+ return signed;
+ }
+
+ public void setSigned(Boolean signed) {
+ this.signed = signed;
+ }
+
+ public String getUserid() {
+ return userid;
+ }
+
+ public void setUserid(String userid) {
+ this.userid = userid;
+ }
+
+ public String getLastsaved() {
+ return lastsaved;
+ }
+
+ public void setLastsaved(String lastsaved) {
+ this.lastsaved = lastsaved;
+ }
+
+ public String getTenantid() {
+ return tenantid;
+ }
+
+ public void setTenantid(String tenantid) {
+ this.tenantid = tenantid;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtl.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtl.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtl.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtlPK.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtlPK.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtlPK.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtlPK.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TDtlQuery.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TDtlQuery.java
new file mode 100644
index 0000000..feec7c5
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TDtlQuery.java
@@ -0,0 +1,115 @@
+package com.supwisdom.dlpay.api.domain;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "TB_DTL_QUERY")
+public class TDtlQuery {
+ @Id
+ @GenericGenerator(name = "idGenerator", strategy = "uuid")
+ @GeneratedValue(generator = "idGenerator")
+ @Column(name = "id", nullable = false, length = 32)
+ private String id;
+
+ @Column(name = "ACCDATE", nullable = false, length = 32)
+ private String accdate;
+
+ @Column(name = "REFNO", nullable = false, length = 32)
+ private String refno;
+
+ @Column(name = "STATUS", nullable = false, length = 32)
+ private String status;
+
+ @Column(name = "REMARK", length = 600)
+ private String remark;
+
+ @Column(name = "QCNT", length = 9)
+ private Integer qcnt;
+
+ @Column(name = "LASTSAVED")
+ @Version
+ private Timestamp lastsaved;
+
+ @Column(name = "tenantid", nullable = false, length = 20)
+ private String tenantId;
+
+ public TDtlQuery(){
+ }
+
+ public TDtlQuery(String accdate, String refno, String status, String remark, Integer qcnt, Timestamp lastsaved, String tenantId) {
+ this.accdate = accdate;
+ this.refno = refno;
+ this.status = status;
+ this.remark = remark;
+ this.qcnt = qcnt;
+ this.lastsaved = lastsaved;
+ this.tenantId = tenantId;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getAccdate() {
+ return accdate;
+ }
+
+ public void setAccdate(String accdate) {
+ this.accdate = accdate;
+ }
+
+ public String getRefno() {
+ return refno;
+ }
+
+ public void setRefno(String refno) {
+ this.refno = refno;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ public Integer getQcnt() {
+ return qcnt;
+ }
+
+ public void setQcnt(Integer qcnt) {
+ this.qcnt = qcnt;
+ }
+
+ public Timestamp getLastsaved() {
+ return lastsaved;
+ }
+
+ public void setLastsaved(Timestamp lastsaved) {
+ this.lastsaved = lastsaved;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TPerson.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPerson.java
similarity index 91%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TPerson.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPerson.java
index 75fa85a..a8cfbd6 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TPerson.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPerson.java
@@ -1,14 +1,18 @@
package com.supwisdom.dlpay.api.domain;
+import com.supwisdom.dlpay.api.annotation.IDNoCheck;
+import com.supwisdom.dlpay.api.annotation.MobileNumber;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
+import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "TB_PERSON",
indexes = {@Index(name = "person_name_idx", columnList = "name"),
@Index(name = "person_idno_uk", unique = true, columnList = "idtype,idno")})
+@IDNoCheck(message = "证件信息错误", idno = "idno", idtype = "idtype")
public class TPerson {
@Id
@GenericGenerator(name = "idGenerator", strategy = "uuid")
@@ -26,7 +30,7 @@
@NotNull
private String status;
- @Column(name = "IDTYPE", length = 20)
+ @Column(name = "IDTYPE", length = 60)
private String idtype;
@Column(name = "IDNO", length = 30)
@@ -39,12 +43,14 @@
private String nation;
@Column(name = "EMAIL", length = 60)
+ @Email(message = "电子邮件格式错误")
private String email;
@Column(name = "TEL", length = 20)
private String tel;
@Column(name = "MOBILE", length = 30)
+ @MobileNumber(message = "手机号格式错误")
private String mobile;
@Column(name = "ADDR", length = 240)
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TPersonIdentity.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPersonIdentity.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TPersonIdentity.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPersonIdentity.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java
similarity index 91%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java
index 303ea2e..c961f32 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java
@@ -10,6 +10,7 @@
indexes = {@Index(name = "prsndtl_transdate_idx", columnList = "transdate"),
@Index(name = "prsndtl_accdate_idx", columnList = "accdate"),
@Index(name = "prsndtl_status_idx", columnList = "status"),
+ @Index(name = "prsndlt_tenantid_idx", columnList = "tenantid"),
@Index(name = "prsndtl_reverse_idx", columnList = "REVERSE_FLAG")})
public class TPersondtl {
@@ -22,7 +23,6 @@
private String accdate; //记账日期
@Column(name = "USERID", length = 32)
- @NotNull
private String userid; //用户ID,或账号
@Column(name = "ACCNO", length = 32)
@@ -93,18 +93,21 @@
@NotNull
private String tenantid = "";
- @Column(name = "DTLTYPE", length = 20)
- private String dtltype;
+ @Column(name = "DTLTYPE", length = 20)
+ private String dtltype;
- public String getDtltype() {
- return dtltype;
- }
+ @Column(name = "anonymous")
+ private Boolean anonymous;
- public void setDtltype(String dtltype) {
- this.dtltype = dtltype;
- }
+ public String getDtltype() {
+ return dtltype;
+ }
- public String getRefno() {
+ public void setDtltype(String dtltype) {
+ this.dtltype = dtltype;
+ }
+
+ public String getRefno() {
return refno;
}
@@ -287,4 +290,12 @@
public void setTenantid(String tenantid) {
this.tenantid = tenantid;
}
+
+ public Boolean getAnonymous() {
+ return anonymous;
+ }
+
+ public void setAnonymous(Boolean anonymous) {
+ this.anonymous = anonymous;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TPointsAccount.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPointsAccount.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TPointsAccount.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPointsAccount.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TPointsTransdtl.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPointsTransdtl.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TPointsTransdtl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPointsTransdtl.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytype.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TShopSourceType.java
similarity index 65%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytype.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TShopSourceType.java
index 0310592..f28f307 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytype.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TShopSourceType.java
@@ -1,19 +1,31 @@
package com.supwisdom.dlpay.api.domain;
+import org.hibernate.annotations.GenericGenerator;
+
import javax.persistence.*;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
-@Table(name = "TB_SHOP_PAYTYPE")
-@IdClass(TShopPaytypePK.class)
-public class TShopPaytype {
- @Id
- @Column(name = "SHOPACCNO", nullable = false, length = 10)
- private String shopaccno;
+@Table(name = "TB_SHOP_SOURCETYPE",
+ indexes = {@Index(name = "shop_sourcetype_idx",
+ columnList = "shopaccno, sourcetype, tenantid", unique = true)})
+public class TShopSourceType implements Serializable {
+ private static final long serialVersionUID = -5789612905074310179L;
@Id
- @Column(name = "PAYTYPE", nullable = false, length = 20)
- private String paytype;
+ @GenericGenerator(name = "idGenerator", strategy = "uuid")
+ @GeneratedValue(generator = "idGenerator")
+ @Column(name = "id")
+ private String id;
+
+ @Column(name = "SHOPACCNO", length = 10)
+ @NotNull
+ private String shopaccno;
+
+ @Column(name = "SOURCETYPE", length = 20)
+ @NotNull
+ private String sourceType;
@Column(name = "CONSUME_ENABLE", length = 10)
@NotNull
@@ -42,12 +54,12 @@
this.shopaccno = shopaccno;
}
- public String getPaytype() {
- return paytype;
+ public String getSourceType() {
+ return sourceType;
}
- public void setPaytype(String paytype) {
- this.paytype = paytype;
+ public void setSourceType(String sourceType) {
+ this.sourceType = sourceType;
}
public boolean getConsumeEnable() {
@@ -89,4 +101,12 @@
public void setTenantid(String tenantid) {
this.tenantid = tenantid;
}
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytypeConfig.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TShopSourceTypeConfig.java
similarity index 70%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytypeConfig.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TShopSourceTypeConfig.java
index a86da1c..981b0d1 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytypeConfig.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TShopSourceTypeConfig.java
@@ -4,10 +4,15 @@
import javax.persistence.*;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
-@Table(name = "TB_SHOP_PAYTYPE_CONFIG", indexes = {@Index(name = "shop_paytype_config_uk", unique = true, columnList = "shopaccno,paytype,configid")})
-public class TShopPaytypeConfig {
+@Table(name = "TB_SHOP_PAYTYPE_CONFIG",
+ indexes = {@Index(name = "shop_sourceype_config_idx", unique = true,
+ columnList = "shopaccno,sourcetype,configid,tenantid")})
+public class TShopSourceTypeConfig implements Serializable {
+ private static final long serialVersionUID = 135187738251025666L;
+
@Id
@GenericGenerator(name = "idGenerator", strategy = "uuid")
@GeneratedValue(generator = "idGenerator")
@@ -18,9 +23,9 @@
@NotNull
private String shopaccno;
- @Column(name = "PAYTYPE", length = 20)
+ @Column(name = "SOURCETYPE", length = 20)
@NotNull
- private String paytype;
+ private String sourceType;
@Column(name = "CONFIGID", length = 40)
@NotNull
@@ -36,12 +41,12 @@
@NotNull
private String tenantid = "";
- public TShopPaytypeConfig() {
+ public TShopSourceTypeConfig() {
}
- public TShopPaytypeConfig(String shopaccno, String paytype, String configid, String configValue, String configName) {
+ public TShopSourceTypeConfig(String shopaccno, String sourceType, String configid, String configValue, String configName) {
this.shopaccno = shopaccno;
- this.paytype = paytype;
+ this.sourceType = sourceType;
this.configid = configid;
this.configValue = configValue;
this.configName = configName;
@@ -63,12 +68,12 @@
this.shopaccno = shopaccno;
}
- public String getPaytype() {
- return paytype;
+ public String getSourceType() {
+ return sourceType;
}
- public void setPaytype(String paytype) {
- this.paytype = paytype;
+ public void setSourceType(String sourceType) {
+ this.sourceType = sourceType;
}
public String getConfigid() {
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TShopdtl.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TShopdtl.java
similarity index 98%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TShopdtl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TShopdtl.java
index 6e5c7bc..e930ce8 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TShopdtl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TShopdtl.java
@@ -8,6 +8,7 @@
indexes = {@Index(name = "shopdtl_accdate", columnList = "accdate"),
@Index(name = "shopdtl_shopaccno", columnList = "shopaccno"),
@Index(name = "shopdtl_transdate", columnList = "transdate"),
+ @Index(name = "shopdtl_tenantid_idx", columnList = "tenantid"),
@Index(name = "shopdtl_updateflag", columnList = "updatebala")})
public class TShopdtl {
@Id
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
similarity index 70%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
index 1748dc5..d20efaf 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
@@ -1,11 +1,9 @@
package com.supwisdom.dlpay.api.domain;
import com.supwisdom.dlpay.framework.domain.DictionaryTable;
+import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
+import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@@ -13,9 +11,17 @@
* Created by shuwei on 2019/4/9.
*/
@Entity
-@Table(name = "TB_SOURCETYPE")
+@Table(name = "TB_SOURCETYPE",
+ indexes = {@Index(name = "sourcetype_idx", columnList = "sourcetype, tenantid", unique = true)})
public class TSourceType implements DictionaryTable, Serializable {
+ private static final long serialVersionUID = 2424711106241326859L;
+
@Id
+ @GenericGenerator(name = "idGenerator", strategy = "uuid")
+ @GeneratedValue(generator = "idGenerator")
+ @Column(name = "sourcetype_id", length = 32)
+ private String sourceTypeId;
+
@Column(name = "SOURCETYPE", nullable = false, length = 20)
private String sourceType;
@@ -43,6 +49,12 @@
@NotNull
private Boolean checkable; // 是否需要清算
+ @Column(name = "pay_subjno", length = 12)
+ private @NotNull String paySubjno;
+
+ @Column(name = "deposite_subjno", length = 12)
+ private String depositeSubjno;
+
@Column(name = "PAYDESC", length = 200)
private String paydesc;
@@ -131,4 +143,28 @@
public Object getDictValue() {
return this.paydesc;
}
+
+ public String getSourceTypeId() {
+ return sourceTypeId;
+ }
+
+ public void setSourceTypeId(String sourceTypeId) {
+ this.sourceTypeId = sourceTypeId;
+ }
+
+ public @NotNull String getPaySubjno() {
+ return paySubjno;
+ }
+
+ public void setPaySubjno(@NotNull String paySubjno) {
+ this.paySubjno = paySubjno;
+ }
+
+ public String getDepositeSubjno() {
+ return depositeSubjno;
+ }
+
+ public void setDepositeSubjno(String depositeSubjno) {
+ this.depositeSubjno = depositeSubjno;
+ }
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceTypeConfig.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceTypeConfig.java
new file mode 100644
index 0000000..c56ffde
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceTypeConfig.java
@@ -0,0 +1,99 @@
+package com.supwisdom.dlpay.api.domain;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * Created by shuwei on 2019/4/9.
+ */
+@Entity
+@Table(name = "TB_SOURCETYPE_CONFIG",
+ indexes = {@Index(name = "source_type_config_idx", columnList = "sourcetype, configid, tenantid", unique = true)})
+public class TSourceTypeConfig implements Serializable {
+ private static final long serialVersionUID = 9020235338229267313L;
+ @Id
+ @SequenceGenerator(name = "sourcetype_cfg_id", sequenceName = "SEQ_SOURCETYPE_CONFIG", allocationSize = 1, initialValue = 1000)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sourcetype_cfg_id")
+ @Column(name = "id", length = 32)
+ private String id;
+
+ @Column(name = "SOURCETYPE", length = 20)
+ @NotNull
+ private String sourceType;
+
+ @Column(name = "CONFIGID", length = 40)
+ @NotNull
+ private String configid;
+
+ @Column(name = "CONFIG_VALUE", length = 2000)
+ private String configValue;
+
+ @Column(name = "CONFIG_NAME", length = 200)
+ private String configName;
+
+ @Column(name = "GLOBALFLAG")
+ private Boolean globalflag = false;
+
+ @Column(name = "tenantid", length = 20)
+ @NotNull
+ private String tenantid = "";
+
+ public String getSourceType() {
+ return sourceType;
+ }
+
+ public void setSourceType(String sourceType) {
+ this.sourceType = sourceType;
+ }
+
+ public String getConfigid() {
+ return configid;
+ }
+
+ public void setConfigid(String configid) {
+ this.configid = configid;
+ }
+
+ public String getConfigValue() {
+ return configValue;
+ }
+
+ public void setConfigValue(String configValue) {
+ this.configValue = configValue;
+ }
+
+ public String getConfigName() {
+ return configName;
+ }
+
+ public void setConfigName(String configName) {
+ this.configName = configName;
+ }
+
+ public String getTenantid() {
+ return tenantid;
+ }
+
+ public void setTenantid(String tenantid) {
+ this.tenantid = tenantid;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public Boolean getGlobalflag() {
+ return globalflag;
+ }
+
+ public void setGlobalflag(Boolean globalflag) {
+ this.globalflag = globalflag;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TSubjectdtl.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSubjectdtl.java
similarity index 93%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TSubjectdtl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSubjectdtl.java
index ba51cfd..eaa385c 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TSubjectdtl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSubjectdtl.java
@@ -59,6 +59,10 @@
@NotNull
private String tenantid = "";
+ @Column(name = "DTLTYPE", length = 20)
+ @NotNull
+ private String dtltype;
+
public String getRefno() {
return refno;
}
@@ -170,4 +174,12 @@
public void setTenantid(String tenantid) {
this.tenantid = tenantid;
}
+
+ public String getDtltype() {
+ return dtltype;
+ }
+
+ public void setDtltype(String dtltype) {
+ this.dtltype = dtltype;
+ }
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionChkdtl.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionChkdtl.java
new file mode 100644
index 0000000..d230036
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionChkdtl.java
@@ -0,0 +1,179 @@
+package com.supwisdom.dlpay.api.domain;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "TB_TRANSACTION_CHKDTL",
+ indexes = {@Index(name = "uk_transaction_chkdtl", unique = true, columnList = "accdate,sourcetype,seqno")})
+public class TTransactionChkdtl {
+ @Id
+ @GenericGenerator(name = "idGenerator", strategy = "uuid")
+ @GeneratedValue(generator = "idGenerator")
+ @Column(name = "ID", nullable = false, length = 32)
+ private String id;
+
+ @Column(name = "ACCDATE", nullable = false, length = 8)
+ private String accdate;
+
+ @Column(name = "SOURCETYPE", nullable = false, length = 20)
+ private String sourcetype;
+
+ @Column(name = "SEQNO", nullable = false, precision = 9)
+ private Integer seqno;
+
+ @Column(name = "AMOUNT", nullable = false, precision = 9, scale = 2)
+ private Double amount;
+
+ @Column(name = "THIRD_REFNO", nullable = false, length = 32)
+ private String thirdRefno; //第三方流水号
+
+ @Column(name = "LOCAL_REFNO", nullable = false, length = 32)
+ private String localRefno; //本地流水号
+
+ @Column(name = "THIRD_ACCDATE", nullable = false, length = 8)
+ private String thirdAccdate; //第三方记账日期
+
+ @Column(name = "THIRD_STATUS", length = 20)
+ private String thirdStatus; //第三方流水状态
+
+ @Column(name = "REMARK", length = 200)
+ private String remark;
+
+ @Column(name = "EXTDATA", length = 200)
+ private String extdata;
+
+ @Column(name = "CHKRESULT", nullable = false, length = 20)
+ private String chkresult;
+
+ @Column(name = "RESOLVED", nullable = false, length = 20)
+ private String resolved;
+
+ @Column(name = "LASTSAVED")
+ private Timestamp lastsaved;
+
+ @Column(name = "tenantid", length = 20)
+ private String tenantid = "";
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getAccdate() {
+ return accdate;
+ }
+
+ public void setAccdate(String accdate) {
+ this.accdate = accdate;
+ }
+
+ public String getSourcetype() {
+ return sourcetype;
+ }
+
+ public void setSourcetype(String sourcetype) {
+ this.sourcetype = sourcetype;
+ }
+
+ public Integer getSeqno() {
+ return seqno;
+ }
+
+ public void setSeqno(Integer seqno) {
+ this.seqno = seqno;
+ }
+
+ public Double getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Double amount) {
+ this.amount = amount;
+ }
+
+ public String getThirdRefno() {
+ return thirdRefno;
+ }
+
+ public void setThirdRefno(String thirdRefno) {
+ this.thirdRefno = thirdRefno;
+ }
+
+ public String getLocalRefno() {
+ return localRefno;
+ }
+
+ public void setLocalRefno(String localRefno) {
+ this.localRefno = localRefno;
+ }
+
+ public String getThirdAccdate() {
+ return thirdAccdate;
+ }
+
+ public void setThirdAccdate(String thirdAccdate) {
+ this.thirdAccdate = thirdAccdate;
+ }
+
+ public String getThirdStatus() {
+ return thirdStatus;
+ }
+
+ public void setThirdStatus(String thirdStatus) {
+ this.thirdStatus = thirdStatus;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ public String getExtdata() {
+ return extdata;
+ }
+
+ public void setExtdata(String extdata) {
+ this.extdata = extdata;
+ }
+
+ public String getChkresult() {
+ return chkresult;
+ }
+
+ public void setChkresult(String chkresult) {
+ this.chkresult = chkresult;
+ }
+
+ public String getResolved() {
+ return resolved;
+ }
+
+ public void setResolved(String resolved) {
+ this.resolved = resolved;
+ }
+
+ public Timestamp getLastsaved() {
+ return lastsaved;
+ }
+
+ public void setLastsaved(Timestamp lastsaved) {
+ this.lastsaved = lastsaved;
+ }
+
+ public String getTenantid() {
+ return tenantid;
+ }
+
+ public void setTenantid(String tenantid) {
+ this.tenantid = tenantid;
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionChkfile.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionChkfile.java
new file mode 100644
index 0000000..2cdc0f4
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionChkfile.java
@@ -0,0 +1,135 @@
+package com.supwisdom.dlpay.api.domain;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "TB_TRANSACTION_CHKFILE",
+ indexes = {@Index(name = "uk_transaction_chkfile", unique = true, columnList = "accdate,sourcetype,")})
+public class TTransactionChkfile {
+ @Id
+ @GenericGenerator(name = "idGenerator", strategy = "uuid")
+ @GeneratedValue(generator = "idGenerator")
+ @Column(name = "ID", nullable = false, length = 32)
+ private String id;
+
+ @Column(name = "ACCDATE", nullable = false, length = 8)
+ private String accdate;
+
+ @Column(name = "SOURCETYPE", nullable = false, length = 20)
+ private String sourcetype;
+
+ @Column(name = "STATUS", nullable = false, length = 20)
+ private String status;
+
+ @Column(name = "REMARK", length = 600)
+ private String remark;
+
+ @Column(name = "THIRDCNT", nullable = false, precision = 9)
+ private Integer thirdcnt;
+
+ @Column(name = "THIRDAMT", nullable = false, precision = 15, scale = 2)
+ private Double thirdamt;
+
+ @Column(name = "LOCALCNT", nullable = false, precision = 9)
+ private Integer localcnt;
+
+ @Column(name = "LOCALAMT", nullable = false, precision = 15, scale = 2)
+ private Double localamt;
+
+ @Column(name = "LASTSAVED")
+ private Timestamp lastsaved;
+
+ @Column(name = "tenantid", length = 20)
+ private String tenantid = "";
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getAccdate() {
+ return accdate;
+ }
+
+ public void setAccdate(String accdate) {
+ this.accdate = accdate;
+ }
+
+ public String getSourcetype() {
+ return sourcetype;
+ }
+
+ public void setSourcetype(String sourcetype) {
+ this.sourcetype = sourcetype;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ public Integer getThirdcnt() {
+ return thirdcnt;
+ }
+
+ public void setThirdcnt(Integer thirdcnt) {
+ this.thirdcnt = thirdcnt;
+ }
+
+ public Double getThirdamt() {
+ return thirdamt;
+ }
+
+ public void setThirdamt(Double thirdamt) {
+ this.thirdamt = thirdamt;
+ }
+
+ public Integer getLocalcnt() {
+ return localcnt;
+ }
+
+ public void setLocalcnt(Integer localcnt) {
+ this.localcnt = localcnt;
+ }
+
+ public Double getLocalamt() {
+ return localamt;
+ }
+
+ public void setLocalamt(Double localamt) {
+ this.localamt = localamt;
+ }
+
+ public Timestamp getLastsaved() {
+ return lastsaved;
+ }
+
+ public void setLastsaved(Timestamp lastsaved) {
+ this.lastsaved = lastsaved;
+ }
+
+ public String getTenantid() {
+ return tenantid;
+ }
+
+ public void setTenantid(String tenantid) {
+ this.tenantid = tenantid;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionMain.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionMain.java
similarity index 92%
rename from src/main/java/com/supwisdom/dlpay/api/domain/TTransactionMain.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionMain.java
index 474d5cc..8d34d10 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionMain.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionMain.java
@@ -2,6 +2,7 @@
import com.supwisdom.dlpay.framework.util.Subject;
import com.supwisdom.dlpay.framework.util.TradeDict;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import javax.persistence.*;
import javax.validation.constraints.Digits;
@@ -15,6 +16,7 @@
@Table(name = "TB_TRANSACTIONMAIN",
indexes = {@Index(name = "transmain_accdate", columnList = "accdate"),
@Index(name = "transmain_status", columnList = "status"),
+ @Index(name = "transmain_tenantid_idx", columnList = "tenantid"),
@Index(name = "transmain_outtrade", unique = true, columnList = "outid, outtradeno")})
@SequenceGenerator(name = "seq_refno", allocationSize = 100)
public class TTransactionMain {
@@ -57,6 +59,9 @@
@Column(name = "sourcetype", length = 20)
private String sourceType = "";
+ @Column(name = "SOURCETYPE_REFNO", length = 32)
+ private String sourceTypeRefno;
+
@Column(name = "outtradeno", length = 60)
private String outTradeNo = "";
@@ -79,6 +84,10 @@
@Column(name = "end_time")
private Timestamp endTime;
+ @Column(name = "update_time")
+ @Version
+ private Timestamp updateTime;
+
@Column(name = "reverse_type", nullable = false, length = 10)
@NotNull
private String reverseType = TradeDict.REVERSE_FLAG_NONE; // 流水标识, none - 正常交易流水, cancel - 撤销流水, refund - 退款流水
@@ -115,6 +124,7 @@
private String tenantid = "";
@Column(name = "DTLTYPE", length = 20)
+ @NotNull
private String dtltype;
public String getDtltype() {
@@ -124,6 +134,7 @@
public void setDtltype(String dtltype) {
this.dtltype = dtltype;
}
+
public String getRefno() {
return refno;
}
@@ -293,6 +304,14 @@
this.sourceType = sourceType;
}
+ public String getSourceTypeRefno() {
+ return sourceTypeRefno;
+ }
+
+ public void setSourceTypeRefno(String sourceTypeRefno) {
+ this.sourceTypeRefno = sourceTypeRefno;
+ }
+
public Integer getTransCode() {
return transCode;
}
@@ -365,4 +384,12 @@
public void setTenantid(String tenantid) {
this.tenantid = tenantid;
}
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/api/repositories/AccountService.java b/payapi/src/main/java/com/supwisdom/dlpay/api/repositories/AccountService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/repositories/AccountService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/repositories/AccountService.java
diff --git a/src/main/java/com/supwisdom/dlpay/api/repositories/ShopaccService.java b/payapi/src/main/java/com/supwisdom/dlpay/api/repositories/ShopaccService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/api/repositories/ShopaccService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/api/repositories/ShopaccService.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java b/payapi/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java
new file mode 100644
index 0000000..833eb0a
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java
@@ -0,0 +1,44 @@
+package com.supwisdom.dlpay.api.service;
+
+import com.supwisdom.dlpay.api.domain.TSourceType;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Map;
+
+/**
+ * Created by shuwei on 2019/4/9.
+ */
+public interface SourceTypeService {
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ TSourceType getBySourceType(String paytype);
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ Map<String, String> getSourceTypeConfigBySourceType(String pattype);
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ boolean checkRechargeSourcetype(String sourcetype) throws Exception;
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ boolean checkShopSourceType(String shopaccno, String sourceType, boolean anonymousflag) throws Exception;
+
+ /**
+ * 获取支付能力充值参数全局配置
+ */
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ Map<String, String> getChargePaytypeConfig(String paytype, boolean ignoreStatus) throws Exception;
+
+ /**
+ * 获取商户支付能力消费参数配置
+ */
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ Map<String, String> getConsumePaytypeConfig(String paytype, String shopaccno, boolean anonymousflag, boolean ignoreStatus) throws Exception;
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ boolean checkCanReverse(String sourcetype) throws Exception;
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ boolean checkShopCanReverse(String sourcetype, String shopaccno) throws Exception;
+
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
new file mode 100644
index 0000000..96f3656
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
@@ -0,0 +1,199 @@
+package com.supwisdom.dlpay.api.service.impl;
+
+import com.supwisdom.dlpay.api.dao.ShopSourceTypeConfigDao;
+import com.supwisdom.dlpay.api.dao.ShopSourceTypeDao;
+import com.supwisdom.dlpay.api.dao.SourceTypeConfigDao;
+import com.supwisdom.dlpay.api.dao.SourceTypeDao;
+import com.supwisdom.dlpay.api.domain.TShopSourceType;
+import com.supwisdom.dlpay.api.domain.TShopSourceTypeConfig;
+import com.supwisdom.dlpay.api.domain.TSourceType;
+import com.supwisdom.dlpay.api.domain.TSourceTypeConfig;
+import com.supwisdom.dlpay.api.service.SourceTypeService;
+import com.supwisdom.dlpay.exception.TransactionProcessException;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.framework.util.TradeErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by shuwei on 2019/4/9.
+ */
+@Service
+public class SourceTypeServiceImpl implements SourceTypeService {
+ private final SourceTypeDao sourceTypeDao;
+ private final SourceTypeConfigDao sourceTypeConfigDao;
+ private final ShopSourceTypeDao shopSourceTypeDao;
+ private final ShopSourceTypeConfigDao shopSourceTypeConfigDao;
+
+ @Autowired
+ public SourceTypeServiceImpl(SourceTypeDao sourceTypeDao, SourceTypeConfigDao sourceTypeConfigDao,
+ ShopSourceTypeDao shopSourceTypeDao, ShopSourceTypeConfigDao shopSourceTypeConfigDao) {
+ this.sourceTypeDao = sourceTypeDao;
+ this.sourceTypeConfigDao = sourceTypeConfigDao;
+ this.shopSourceTypeDao = shopSourceTypeDao;
+ this.shopSourceTypeConfigDao = shopSourceTypeConfigDao;
+ }
+
+
+ @Override
+ @Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('sourcetype', #sourceType)")
+ public TSourceType getBySourceType(String sourceType) {
+ return sourceTypeDao.getOne(sourceType);
+ }
+
+ @Override
+ @Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('sourcetype_config', #sourceType)")
+ public Map<String, String> getSourceTypeConfigBySourceType(String sourceType) {
+ List<TSourceTypeConfig> list = sourceTypeConfigDao.getBySourceType(sourceType);
+ Map<String, String> map = new HashMap<>(list.size());
+ for (TSourceTypeConfig sourceTypeConfig : list) {
+ map.put(sourceTypeConfig.getConfigid(), sourceTypeConfig.getConfigValue());
+ }
+ return map;
+ }
+
+ @Override
+ public boolean checkRechargeSourcetype(String sourcetype) throws Exception {
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(sourcetype);
+ if (null == tSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]");
+ } else if (!tSourceType.getEnable() || !tSourceType.getChargeEnable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统充值未启用支付方式[" + sourcetype + "]");
+ }
+ return true;
+ }
+
+ @Override
+ public boolean checkShopSourceType(String shopaccno, String sourceType, boolean anonymousflag) throws Exception {
+ //step1: 判断系统支付能力是否启用
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(sourceType);
+ if (null == tSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourceType + "]");
+ } else {
+ if (!tSourceType.getEnable() || !tSourceType.getConsumeEnable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[" + sourceType + "]消费");
+ }
+ if (anonymousflag && !tSourceType.getAnonymousEnable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[" + sourceType + "]未启用匿名消费");
+ }
+ }
+
+ //step2: 判断商户支付能力是否启用
+ TShopSourceType tShopSourceType = shopSourceTypeDao.getById(sourceType, shopaccno);
+ if (null == tShopSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + sourceType + "]");
+ } else {
+ if (!tShopSourceType.getConsumeEnable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + sourceType + "]消费");
+ }
+ if (anonymousflag && !tShopSourceType.getAnonymousEnable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]的支付方式[" + sourceType + "]未启用匿名消费");
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public Map<String, String> getChargePaytypeConfig(String paytype, boolean ignoreStatus) throws Exception {
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(paytype);
+ if (null == tSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + paytype + "]");
+ } else if (!ignoreStatus && (!tSourceType.getEnable() || !tSourceType.getChargeEnable())) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统充值未启用支付方式[" + paytype + "]");
+ }
+
+ Map<String, String> result = new HashMap<>(0);
+ List<TSourceTypeConfig> list = sourceTypeConfigDao.getBySourceType(paytype);
+ if (!StringUtil.isEmpty(list)) {
+ for (TSourceTypeConfig config : list) {
+ result.put(config.getConfigid(), config.getConfigValue());
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getConsumePaytypeConfig(String paytype, String shopaccno, boolean anonymousflag, boolean ignoreStatus) throws Exception {
+ //step1: 判断系统支付能力是否启用
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(paytype);
+ if (null == tSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + paytype + "]");
+ } else {
+ if (!ignoreStatus && (!tSourceType.getEnable() || !tSourceType.getConsumeEnable())) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[" + paytype + "]消费");
+ }
+ if (!ignoreStatus && anonymousflag && !tSourceType.getAnonymousEnable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[" + paytype + "]未启用匿名消费");
+ }
+ }
+
+ //step2: 判断商户支付能力是否启用
+ TShopSourceType tShopSourceType = shopSourceTypeDao.getById(paytype, shopaccno);
+ if (null == tShopSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + paytype + "]");
+ } else {
+ if (!ignoreStatus && !tShopSourceType.getConsumeEnable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + paytype + "]消费");
+ }
+ if (!ignoreStatus && anonymousflag && !tShopSourceType.getAnonymousEnable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]的支付方式[" + paytype + "]未启用匿名消费");
+ }
+ }
+
+ Map<String, String> result = new HashMap<>(0);
+ List<TSourceTypeConfig> list = sourceTypeConfigDao.getBySourceType(paytype);
+ if (!StringUtil.isEmpty(list)) {
+ for (TSourceTypeConfig config : list) {
+ if (config.getGlobalflag()) {
+ result.put(config.getConfigid(), config.getConfigValue()); //统用参数
+ }
+ }
+ }
+
+ List<TShopSourceTypeConfig> shoplist = shopSourceTypeConfigDao.getShopSourceTypeConfigs(paytype, shopaccno);
+ if (!StringUtil.isEmpty(shoplist)) {
+ for (TShopSourceTypeConfig shopconfig : shoplist) {
+ result.put(shopconfig.getConfigid(), shopconfig.getConfigValue()); //个性参数
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean checkCanReverse(String sourcetype) throws Exception {
+ //step1: 判断系统支付能力是否启用
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(sourcetype);
+ if (null == tSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]");
+ } else if (!tSourceType.getReversable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]的流水冲正或退款");
+ }
+ return true;
+ }
+
+ @Override
+ public boolean checkShopCanReverse(String sourcetype, String shopaccno) throws Exception {
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(sourcetype);
+ if (null == tSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]");
+ } else if (!tSourceType.getReversable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]的流水冲正或退款功能");
+ }
+
+ TShopSourceType tShopSourceType = shopSourceTypeDao.getById(sourcetype, shopaccno);
+ if (null == tShopSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + sourcetype + "]");
+ } else if (!tShopSourceType.getReverseEnable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + sourcetype + "]的流水冲正或退款功能");
+ }
+ return true;
+ }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/exception/TransactionCheckException.java b/payapi/src/main/java/com/supwisdom/dlpay/exception/TransactionCheckException.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/exception/TransactionCheckException.java
rename to payapi/src/main/java/com/supwisdom/dlpay/exception/TransactionCheckException.java
diff --git a/src/main/java/com/supwisdom/dlpay/exception/TransactionException.java b/payapi/src/main/java/com/supwisdom/dlpay/exception/TransactionException.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/exception/TransactionException.java
rename to payapi/src/main/java/com/supwisdom/dlpay/exception/TransactionException.java
diff --git a/src/main/java/com/supwisdom/dlpay/exception/TransactionProcessException.java b/payapi/src/main/java/com/supwisdom/dlpay/exception/TransactionProcessException.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/exception/TransactionProcessException.java
rename to payapi/src/main/java/com/supwisdom/dlpay/exception/TransactionProcessException.java
diff --git a/src/main/java/com/supwisdom/dlpay/exception/ValidateCodeException.java b/payapi/src/main/java/com/supwisdom/dlpay/exception/ValidateCodeException.java
similarity index 99%
rename from src/main/java/com/supwisdom/dlpay/exception/ValidateCodeException.java
rename to payapi/src/main/java/com/supwisdom/dlpay/exception/ValidateCodeException.java
index 0a500ad..98ea42b 100755
--- a/src/main/java/com/supwisdom/dlpay/exception/ValidateCodeException.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/exception/ValidateCodeException.java
@@ -1,23 +1,23 @@
-/**
- *
- */
-package com.supwisdom.dlpay.exception;
-
-import org.springframework.security.core.AuthenticationException;
-
-/**
- * @author lenovo
- *
- */
-public class ValidateCodeException extends AuthenticationException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1170189980006964105L;
-
-
- public ValidateCodeException(String msg) {
- super(msg);
- }
-}
+/**
+ *
+ */
+package com.supwisdom.dlpay.exception;
+
+import org.springframework.security.core.AuthenticationException;
+
+/**
+ * @author lenovo
+ *
+ */
+public class ValidateCodeException extends AuthenticationException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1170189980006964105L;
+
+
+ public ValidateCodeException(String msg) {
+ super(msg);
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/KaptchaConfig.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/KaptchaConfig.java
new file mode 100644
index 0000000..c69dc38
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/KaptchaConfig.java
@@ -0,0 +1,29 @@
+package com.supwisdom.dlpay.framework;
+
+import com.google.code.kaptcha.impl.DefaultKaptcha;
+import com.google.code.kaptcha.util.Config;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Properties;
+
+@Configuration
+public class KaptchaConfig {
+ @Bean
+ public DefaultKaptcha getDefaultKaptcha(){
+ DefaultKaptcha captchaProducer = new DefaultKaptcha();
+ Properties properties = new Properties();
+ properties.setProperty("kaptcha.border", "yes");
+ properties.setProperty("kaptcha.border.color", "105,179,90");
+ properties.setProperty("kaptcha.textproducer.font.color", "blue");
+ properties.setProperty("kaptcha.image.width", "110");
+ properties.setProperty("kaptcha.image.height", "40");
+ properties.setProperty("kaptcha.textproducer.font.size", "30");
+ properties.setProperty("kaptcha.session.key", "code");
+ properties.setProperty("kaptcha.textproducer.char.length", "4");
+ properties.setProperty("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑");
+ Config config = new Config(properties);
+ captchaProducer.setConfig(config);
+ return captchaProducer;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/core/DatabaseConfig.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/core/DatabaseConfig.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/core/DatabaseConfig.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/core/DatabaseConfig.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/core/DayendSettleTask.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/core/DayendSettleTask.java
similarity index 76%
rename from src/main/java/com/supwisdom/dlpay/framework/core/DayendSettleTask.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/core/DayendSettleTask.java
index de2afe3..368bf8e 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/core/DayendSettleTask.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/core/DayendSettleTask.java
@@ -1,10 +1,9 @@
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 net.javacrumbs.shedlock.core.SchedulerLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -14,32 +13,18 @@
@Component
public class DayendSettleTask {
@Autowired
- private SystemUtilService systemUtilService;
- @Autowired
private DayendSettleService dayendSettleService;
private TSettleLog settleLog;
private static final Logger logger = LoggerFactory.getLogger(DayendSettleTask.class);
- @Scheduled(cron="${dayend.settletask.cron}")
+ @Scheduled(cron = "${dayend.settletask.cron}")
+ @SchedulerLock(name = "DayendSettleTask", lockAtMostForString = "PT30M")
public void doSettleTask() {
if (logger.isDebugEnabled()) logger.debug("进入日结算任务!");
-
- TTaskLock lock = null;
+ settleLog = dayendSettleService.doCreateSettleLog(); //记录日志
try {
- try {
- lock = systemUtilService.doLockTask("DAYENDSETTLETASK", 30, "日终结算");
- if (lock == null) {
- if (logger.isDebugEnabled()) logger.debug("日终结算正在其他服务器上执行");
- return;
- }
- } catch (Exception e) {
- return;
- }
-
- settleLog = dayendSettleService.doCreateSettleLog(); //记录日志
-
//step1: 账户校验(fixme: 清算任务?)
long t1 = System.currentTimeMillis();
if (!checkAccounts()) {
@@ -71,12 +56,6 @@
} 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);
- }
}
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/core/JwtConfig.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/core/JwtConfig.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/core/JwtConfig.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/core/JwtConfig.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/core/JwtToken.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/core/JwtToken.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/core/JwtToken.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/core/JwtToken.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/core/JwtTokenUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/core/JwtTokenUtil.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/core/JwtTokenUtil.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/core/JwtTokenUtil.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/core/PasswordBCryptConfig.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/core/PasswordBCryptConfig.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/core/PasswordBCryptConfig.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/core/PasswordBCryptConfig.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/ApiClientDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ApiClientDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/ApiClientDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ApiClientDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/BusinessparaDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/BusinessparaDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/BusinessparaDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/BusinessparaDao.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java
new file mode 100644
index 0000000..e731908
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java
@@ -0,0 +1,19 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.domain.TDictionary;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface DictionaryDao extends JpaRepository<TDictionary, Integer> {
+ @Query("from TDictionary t where t.dicttype=?1 order by t.dictid ")
+ List<TDictionary> findAllByDicttype(String dicttype);
+
+ void deleteByDicttype(String dicttype);
+
+ @Query("from TDictionary t where t.dicttype=?1 and t.dictval=?2 ")
+ TDictionary getByDicttypeAndDictval(String dicttype, String dictval);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/FeetypeConfigDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/FeetypeConfigDao.java
similarity index 84%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/FeetypeConfigDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/FeetypeConfigDao.java
index b626087..56ce647 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/FeetypeConfigDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/FeetypeConfigDao.java
@@ -1,13 +1,12 @@
package com.supwisdom.dlpay.framework.dao;
import com.supwisdom.dlpay.framework.domain.TFeetypeConfig;
-import com.supwisdom.dlpay.framework.domain.TFeetypeConfigPK;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@Repository
-public interface FeetypeConfigDao extends JpaRepository<TFeetypeConfig, TFeetypeConfigPK> {
+public interface FeetypeConfigDao extends JpaRepository<TFeetypeConfig, Integer> {
@Query("select a from TFeetypeConfig a where a.feetype=?1 and a.paytype=?2 ")
TFeetypeConfig getById(String feetype, String paytype);
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/FunctionDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/FunctionDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/FunctionDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/FunctionDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/OperLogDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/OperLogDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/OperLogDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/OperLogDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/OperRoleDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/OperRoleDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/OperRoleDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/OperRoleDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorDao.java
similarity index 93%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/OperatorDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorDao.java
index 27b511f..3563a48 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorDao.java
@@ -12,5 +12,6 @@
public interface OperatorDao extends JpaRepository<TOperator, String>, JpaSpecificationExecutor<TOperator> {
TOperator findByOpercode(String opercode);
+ TOperator findByOperid(String operid);
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/PeriodDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/PeriodDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/PeriodDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/PeriodDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/PermissionDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/PermissionDao.java
similarity index 82%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/PermissionDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/PermissionDao.java
index af782a8..1bd85c4 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/PermissionDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/PermissionDao.java
@@ -3,9 +3,13 @@
import com.supwisdom.dlpay.framework.domain.TPermission;
import org.springframework.data.jpa.repository.JpaRepository;
+import java.util.List;
+
public interface PermissionDao extends JpaRepository<TPermission, String> {
TPermission findByRoleIdAndResid(String roleId, Integer resid);
+ List<TPermission> findByRoleId(String roleId);
+
void deleteByRoleId(String roleId);
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/ResourceDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ResourceDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/ResourceDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ResourceDao.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/RoleDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/RoleDao.java
new file mode 100644
index 0000000..1e4e925
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/RoleDao.java
@@ -0,0 +1,26 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.domain.TRole;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface RoleDao extends JpaRepository<TRole, String> {
+ @Query("from TRole order by createtime asc ")
+ List<TRole> getAllRoles();
+
+ TRole findByRoleCode(String roleCode);
+
+ Page<TRole> findAllByRoleNameContaining(String roleName, Pageable pageable);
+
+ TRole findByRoleNameAndRoleIdNot(String roleName, String roleId);
+
+ TRole findByRoleCodeAndRoleIdNot(String roleCode, String roleId);
+
+ TRole findByRoleName(String roleName);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
similarity index 77%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
index d1f2d37..e125f7a 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
@@ -18,11 +18,12 @@
List<TRoleFunction> findByRoleId(String roleId);
- @Query(value = " select f.id||'' as id ,f.parentid||'' as pid,f.name,case when rf.id is null then 0 else 1 end as checked,case when f.parentid=-1 then 1 else 0 end as open from tb_function f " +
+ @Query(value = "select tt.id,tt.pid,tt.name,tt.checked,tt.open from " +
+ " ( select f.id||'' as id ,f.parentid||'' as pid,f.name,case when rf.id is null then 0 else 1 end as checked,case when f.parentid=-1 then 1 else 0 end as open from tb_function f " +
" left join tb_role_function rf on rf.functionid = f.id and rf.roleid=?1 " +
" union all " +
" select r.id||'_res' as id,r.function_id||'' as pid,r.name,case when p.id is null then 0 else 1 end as checked,0 as open from tb_resource r " +
- " left join tb_permission p on p.resid = r.id and p.roleid=?1 " , nativeQuery = true)
+ " left join tb_permission p on p.resid = r.id and p.roleid=?1 ) tt order by tt.id " , nativeQuery = true)
List<NodeData> findByRoleIdNative(String roleId);
void deleteByRoleId(String roleId);
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SettleLogDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SettleLogDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/SettleLogDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SettleLogDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
similarity index 95%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
index 303a3b0..f76cffa 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
@@ -37,6 +37,8 @@
TShopacc getByShopaccno(String shopaccno);
+ TShopacc getByShopaccnoAndTenantId(String shopaccno, String tenantid);
+
@Transactional
@Modifying(clearAutomatically = true)
@Query("update TShopacc set shopname=?1 where shopaccno=?2")
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccdayDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccdayDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccdayDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccdayDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
similarity index 95%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
index f88623d..78ecb03 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
@@ -26,6 +26,8 @@
TSubject findBySubjno(String subjno);
+ TSubject findBySubjnoAndTenantId(String subjno, String tenantid);
+
@Query("from TSubject where displayflag='y' order by subjno ")
List<TSubject> findAllDisplaySubjects();
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectbalDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectbalDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/SubjectbalDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectbalDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectdayDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectdayDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/SubjectdayDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectdayDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SysparaDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SysparaDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/SysparaDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SysparaDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/TaskLockDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/TaskLockDao.java
similarity index 89%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/TaskLockDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/TaskLockDao.java
index e1343d4..2c76329 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/TaskLockDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/TaskLockDao.java
@@ -14,10 +14,6 @@
@Repository
public interface TaskLockDao extends JpaRepository<TTaskLock, String> {
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query("select a from TTaskLock a where a.taskcode=:taskcode")
- TTaskLock getTaskLockWithLock(@Param("taskcode") String taskcode);
-
//================= database=Oracle =================//
@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/java/com/supwisdom/dlpay/framework/dao/TenantConfigDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/TenantConfigDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/TenantConfigDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/TenantConfigDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/TranscodeDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/TranscodeDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/TranscodeDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/TranscodeDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherEntryDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherEntryDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/VoucherEntryDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherEntryDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/VouchernoCtlDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/VouchernoCtlDao.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/dao/VouchernoCtlDao.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/dao/VouchernoCtlDao.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/data/ExistBean.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/data/ExistBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/data/ExistBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/data/ExistBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/data/FSubjectInfoBean.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/data/FSubjectInfoBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/data/FSubjectInfoBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/data/FSubjectInfoBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/data/MerchBean.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/data/MerchBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/data/MerchBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/data/MerchBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/data/NodeData.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/data/NodeData.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/data/NodeData.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/data/NodeData.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/data/SubjectInfoBean.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/data/SubjectInfoBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/data/SubjectInfoBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/data/SubjectInfoBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/data/SystemDateTime.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/data/SystemDateTime.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/data/SystemDateTime.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/data/SystemDateTime.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/data/VoucherTemp.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/data/VoucherTemp.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/data/VoucherTemp.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/data/VoucherTemp.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/ApiClientRedis.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/ApiClientRedis.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/ApiClientRedis.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/ApiClientRedis.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/DictionaryTable.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/DictionaryTable.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/DictionaryTable.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/DictionaryTable.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/JwtRedis.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/JwtRedis.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/JwtRedis.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/JwtRedis.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/PersonRedis.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/PersonRedis.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/PersonRedis.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/PersonRedis.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TApiClient.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TApiClient.java
similarity index 66%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TApiClient.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TApiClient.java
index 9ffe634..a9c2b05 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TApiClient.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TApiClient.java
@@ -2,29 +2,37 @@
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
+import javax.persistence.*;
import javax.validation.constraints.NotNull;
@Entity
-@Table(name = "TB_APICLIENT")
+@Table(name = "TB_APICLIENT",
+ indexes = {@Index(name = "apiclient_idx", columnList = "appid, tenantid", unique = true)})
public class TApiClient {
@Id
- @Column(name = "appid", nullable = false, length = 20)
+ @SequenceGenerator(name = "apiclient_id", sequenceName = "SEQ_APICLIENT", allocationSize = 1, initialValue = 10)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "apiclient_id")
+ @Column(name = "id")
+ @NotNull
+ private Integer id;
+
+ @Column(name = "appid", length = 20)
+ @NotNull
private String appid;
- @Column(name = "secret", nullable = false, length = 64)
+ @Column(name = "secret", length = 64)
+ @NotNull
private String secret;
- @Column(name = "status", nullable = false, length = 10)
+ @Column(name = "status", length = 10)
+ @NotNull
private String status;
@Column(name = "roles", length = 300)
private String roles;
- @Column(name = "BCRYPT_SECRET", nullable = false, length = 64)
+ @Column(name = "BCRYPT_SECRET", length = 64)
+ @NotNull
private String bcryptSecret;
@Column(name = "THIRDURL", length = 200)
@@ -87,4 +95,12 @@
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TBusinesspara.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TBusinesspara.java
similarity index 87%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TBusinesspara.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TBusinesspara.java
index 9b38245..a1e1209 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TBusinesspara.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TBusinesspara.java
@@ -43,4 +43,12 @@
public void setParaval(String paraval) {
this.paraval = paraval;
}
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
similarity index 60%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
index 16c4a9a..1f766c9 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
@@ -5,15 +5,23 @@
import java.io.Serializable;
@Entity
-@Table(name = "TB_DICTIONARY")
-@IdClass(TDictionaryPK.class)
+@Table(name = "TB_DICTIONARY",
+ indexes = {@Index(name = "dictionary_idx", columnList = "dicttype, dictval, tenantid", unique = true)})
public class TDictionary implements DictionaryTable, Serializable {
+ private static final long serialVersionUID = -4346024672769882893L;
@Id
- @Column(name = "DICTTYPE", nullable = false)
+ @Column(name = "id")
+ @SequenceGenerator(name = "dictid", sequenceName = "SEQ_DICTIONARY", allocationSize = 1, initialValue = 1000)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "dictid")
+ @NotNull
+ private Integer dictid;
+
+ @Column(name = "DICTTYPE")
+ @NotNull
private String dicttype;
- @Id
- @Column(name = "DICTVAL", nullable = false, length = 30)
+ @Column(name = "DICTVAL", length = 30)
+ @NotNull
private String dictval;
@Column(name = "DICTTYPENAME", length = 60)
@@ -58,6 +66,22 @@
this.dictcaption = dictcaption;
}
+ public Integer getDictid() {
+ return dictid;
+ }
+
+ public void setDictid(Integer dictid) {
+ this.dictid = dictid;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
@Override
public String getDictKey() {
return this.dictval;
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TFeetypeConfig.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TFeetypeConfig.java
new file mode 100644
index 0000000..9c27ac7
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TFeetypeConfig.java
@@ -0,0 +1,94 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.*;
+import javax.validation.constraints.NegativeOrZero;
+import javax.validation.constraints.NotNull;
+
+@Entity
+@Table(name = "TB_FEETYPE_CONFIG",
+ indexes = {@Index(name = "feetype_config_idx", columnList = "feetype, paytype, tenantid", unique = true)})
+public class TFeetypeConfig {
+ @Id
+ @SequenceGenerator(name = "feetype_cfg_id", sequenceName = "SEQ_FEETYPECONFIG", allocationSize = 1, initialValue = 10)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "feetype_cfg_id")
+ @Column(name = "id")
+ @NotNull
+ private Integer id;
+
+ @Column(name = "FEETYPE", length = 20)
+ @NotNull
+ private String feetype;
+
+ @Column(name = "PAYTYPE", length = 20)
+ @NotNull
+ 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;
+
+ @Column(name = "tenantid", length = 20)
+ @NotNull
+ private String tenantId;
+
+ 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;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TFunction.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TFunction.java
similarity index 93%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TFunction.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TFunction.java
index 594a258..cbf8354 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TFunction.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TFunction.java
@@ -7,10 +7,12 @@
import java.io.Serializable;
@Entity
-@Table(name = "TB_FUNCTION")
+@Table(name = "TB_FUNCTION",
+ indexes = {@Index(name = "function_idx", columnList = "tenantid")})
@JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
@SequenceGenerator(name = "SEQ_FUNC", sequenceName = "SEQ_FUNC", allocationSize = 1, initialValue = 1000)
public class TFunction implements Serializable {
+ private static final long serialVersionUID = 1862862725121064784L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_FUNC")
@Column(name = "ID", nullable = false)
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperLog.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperLog.java
similarity index 95%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TOperLog.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperLog.java
index 5fad64a..4d9c2f1 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperLog.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperLog.java
@@ -6,7 +6,8 @@
import javax.validation.constraints.NotNull;
@Entity
-@Table(name = "TB_OPER_LOG")
+@Table(name = "TB_OPER_LOG",
+ indexes = {@Index(name = "oper_log_idx", columnList = "tenantid")})
public class TOperLog {
@Id
@GenericGenerator(name = "idGenerator", strategy = "uuid")
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperRole.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperRole.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TOperRole.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperRole.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
similarity index 89%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
index 9d250ac..8e8f83b 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
@@ -1,18 +1,21 @@
package com.supwisdom.dlpay.framework.domain;
+import com.supwisdom.dlpay.api.annotation.MobileNumber;
import com.supwisdom.dlpay.framework.util.TradeDict;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import javax.persistence.*;
+import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
import java.util.Collection;
@Entity
@Table(name = "TB_OPERATOR",
- indexes = {@Index(name = "opercode_idx", columnList = "OPERCODE", unique = true)})
-public class TOperator implements UserDetails {
+ indexes = {@Index(name = "opercode_idx", columnList = "OPERCODE, tenantid", unique = true)})
+public class TOperator implements UserDetails, Serializable {
private static final long serialVersionUID = 2148742269021236587L;
@Id
@GenericGenerator(name = "idGenerator", strategy = "uuid")
@@ -44,9 +47,11 @@
private String sex;
@Column(name = "MOBILE", length = 20)
+ @MobileNumber(message = "请输入正确手机号")
private String mobile;
@Column(name = "EMAIL", length = 60)
+ @Email(message = "请输入正确邮箱")
private String email;
@Column(name = "OPENDATE", length = 8)
@@ -61,6 +66,10 @@
@NotNull
private String tenantId;
+ @Column(name = "thirdadmin", length = 20)
+ @NotNull
+ private String thirdadmin;
+
@Transient
private Collection<? extends GrantedAuthority> authorities; //权限
@@ -228,4 +237,12 @@
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
+
+ public String getThirdadmin() {
+ return thirdadmin;
+ }
+
+ public void setThirdadmin(String thirdadmin) {
+ this.thirdadmin = thirdadmin;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriod.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriod.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TPeriod.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriod.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriodPK.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriodPK.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TPeriodPK.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriodPK.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TPermission.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TPermission.java
similarity index 90%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TPermission.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TPermission.java
index e6fd9e1..35f0044 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TPermission.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TPermission.java
@@ -6,7 +6,8 @@
import javax.validation.constraints.NotNull;
@Entity
-@Table(name = "TB_PERMISSION")
+@Table(name = "TB_PERMISSION",
+ indexes = {@Index(name = "permission_idx", columnList = "resid, roleid, tenantid", unique = true)})
public class TPermission {
@Id
@GenericGenerator(name = "idGenerator", strategy = "uuid")
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java
similarity index 97%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java
index 9658a21..13be663 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java
@@ -5,7 +5,7 @@
@Entity
@Table(name = "TB_RESOURCE")
-@SequenceGenerator(name = "SEQ_RES", sequenceName = "SEQ_RES", allocationSize = 1)
+@SequenceGenerator(name = "SEQ_RES", sequenceName = "SEQ_RES", allocationSize = 1000)
public class TResource {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_RES")
@@ -13,7 +13,6 @@
private Integer id;
@Column(name = "CODE", length = 32)
- @NotNull
private String code;
@Column(name = "NAME", length = 32)
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TRole.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TRole.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TRole.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TRole.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TRoleFunction.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TRoleFunction.java
similarity index 79%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TRoleFunction.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TRoleFunction.java
index 911ca71..18a0a68 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TRoleFunction.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TRoleFunction.java
@@ -4,10 +4,13 @@
import javax.persistence.*;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
-@Table(name = "TB_ROLE_FUNCTION")
-public class TRoleFunction {
+@Table(name = "TB_ROLE_FUNCTION",
+ indexes = {@Index(name = "role_funcation_idx", columnList = "roleid, functionid, tenantid", unique = true)})
+public class TRoleFunction implements Serializable {
+ private static final long serialVersionUID = 6098241093888979729L;
@Id
@GenericGenerator(name = "idGenerator", strategy = "uuid")
@GeneratedValue(generator = "idGenerator")
@@ -22,9 +25,6 @@
@NotNull
private Integer functionId;
- @Column(name = "PERMISSIONS", length = 200)
- private String permissions;
-
@Column(name = "tenantid", length = 20)
@NotNull
private String tenantId;
@@ -53,14 +53,6 @@
this.functionId = functionId;
}
- public String getPermissions() {
- return permissions;
- }
-
- public void setPermissions(String permissions) {
- this.permissions = permissions;
- }
-
public String getTenantId() {
return tenantId;
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TSettleLog.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSettleLog.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TSettleLog.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSettleLog.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TSettlectl.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSettlectl.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TSettlectl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSettlectl.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
similarity index 89%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
index 49b5df7..5c81f45 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
@@ -15,13 +15,16 @@
private Integer shopid;
@Column(name = "FSHOPID", precision = 9)
+ @NotNull
private Integer fshopid;
@Column(name = "SHOPNAME", length = 200)
+ @NotNull
private String shopname;
- @Column(name = "SHOPTYPE", precision = 1)
- private Integer shoptype;
+ @Column(name = "SHOPTYPE", length = 30)
+ @NotNull
+ private String shoptype;
@Column(name = "STATUS", length = 20)
@NotNull
@@ -33,7 +36,7 @@
@Column(name = "CONTACTMAN", length = 60)
private String contactman;
- @Column(name = "IDTYPE", length = 1)
+ @Column(name = "IDTYPE", length = 32)
private String idtype;
@Column(name = "IDNO", length = 60)
@@ -73,7 +76,7 @@
public TShop() {
}
- public TShop(Integer fshopid, String shopname, Integer shoptype, String status, String shopaccno, String contactman, String idtype, String idno, String tel, String mobile, String email, String addr, String zipcode, String opendate, String closedate, String thirdUniqueIdenty) {
+ public TShop(Integer fshopid, String shopname, String shoptype, String status, String shopaccno, String contactman, String idtype, String idno, String tel, String mobile, String email, String addr, String zipcode, String opendate, String closedate, String thirdUniqueIdenty) {
this.fshopid = fshopid;
this.shopname = shopname;
this.shoptype = shoptype;
@@ -124,11 +127,11 @@
this.shopname = shopname;
}
- public Integer getShoptype() {
+ public String getShoptype() {
return shoptype;
}
- public void setShoptype(Integer shoptype) {
+ public void setShoptype(String shoptype) {
this.shoptype = shoptype;
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TShopacc.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShopacc.java
similarity index 80%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TShopacc.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShopacc.java
index fe9c1d1..943b4e5 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TShopacc.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShopacc.java
@@ -1,5 +1,9 @@
package com.supwisdom.dlpay.framework.domain;
+import com.supwisdom.dlpay.framework.util.MoneyUtil;
+import com.supwisdom.dlpay.framework.util.Sign;
+import com.supwisdom.dlpay.framework.util.Signature;
+
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
@@ -124,6 +128,27 @@
this.lastUpdate = new Timestamp(System.currentTimeMillis());
}
+ public String genMAC() {
+ String data = this.shopaccno + this.status
+ + this.shopid
+ + this.opendate + MoneyUtil.YuanToFen(this.balance);
+ return Signature.generateTac(this.shopaccno, data);
+ }
+
+ public boolean checkMAC() {
+ String mac = genMAC();
+ if (mac.equalsIgnoreCase(this.mac) || Signature.SPY_TAC.equals(this.mac)) {
+ return true;
+ }
+ return false;
+ }
+
+ @PrePersist
+ @PreUpdate
+ public void updateMAC() {
+ this.mac = genMAC();
+ }
+
public Timestamp getLastUpdate() {
return lastUpdate;
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TShopaccday.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShopaccday.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TShopaccday.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShopaccday.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TShopaccdayPK.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShopaccdayPK.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TShopaccdayPK.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShopaccdayPK.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java
similarity index 74%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java
index fa1554c..d76cd59 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java
@@ -1,15 +1,21 @@
package com.supwisdom.dlpay.framework.domain;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
+import javax.persistence.*;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
-@Table(name = "TB_SUBJECT")
-public class TSubject {
+@Table(name = "TB_SUBJECT",
+ indexes = {@Index(name = "subject_idx", columnList = "subjno, tenantid", unique = true)})
+public class TSubject implements Serializable, DictionaryTable {
+
@Id
+ @Column(name = "subjid")
+ @NotNull
+ @SequenceGenerator(name = "subjectid", sequenceName = "SEQ_SUBJECTID", allocationSize = 1, initialValue = 1000)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "subjectid")
+ private Integer id;
+
@Column(name = "SUBJNO", nullable = false, length = 10)
private String subjno;
@@ -121,4 +127,22 @@
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ @Override
+ public String getDictKey() {
+ return this.subjno;
+ }
+
+ @Override
+ public Object getDictValue() {
+ return this.subjname;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectbal.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectbal.java
similarity index 90%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectbal.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectbal.java
index f58c591..93a64e1 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectbal.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectbal.java
@@ -1,16 +1,18 @@
package com.supwisdom.dlpay.framework.domain;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
+import javax.persistence.*;
import javax.validation.constraints.NotNull;
@Entity
-@Table(name = "TB_SUBJECTBAL")
+@Table(name = "TB_SUBJECTBAL",
+ indexes = {@Index(name = "subjectbal_idx", columnList = "subjno, tenantid", unique = true)})
public class TSubjectbal {
@Id
- @Column(name = "SUBJNO", nullable = false, length = 10)
+ @Column(name = "subjid", nullable = false, length = 32)
+ private String subjid;
+
+ @Column(name = "SUBJNO", length = 10)
+ @NotNull
private String subjno;
@Column(name = "ACCUMDRAMT", precision = 15, scale = 2)
@@ -183,4 +185,12 @@
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
+
+ public String getSubjid() {
+ return subjid;
+ }
+
+ public void setSubjid(String subjid) {
+ this.subjid = subjid;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectday.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectday.java
similarity index 77%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectday.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectday.java
index eedf9b5..d200c62 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectday.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectday.java
@@ -4,42 +4,47 @@
import javax.validation.constraints.NotNull;
@Entity
-@Table(name = "TB_SUBJECTDAY")
+@Table(name = "TB_SUBJECTDAY",
+ indexes = {@Index(name = "subjectday_idx", columnList = "subjno, accdate, tenantid", unique = true)})
@IdClass(TSubjectdayPK.class)
public class TSubjectday {
@Id
- @Column(name="ACCDATE", nullable = false, length = 8)
- private String accdate;
+ @Column(name = "subjid", nullable = false, length = 32)
+ private String subjid;
@Id
- @Column(name="SUBJNO", nullable = false, length = 10)
+ @Column(name = "ACCDATE", nullable = false, length = 8)
+ private String accdate;
+
+ @Column(name = "SUBJNO", length = 10)
+ @NotNull
private String subjno;
- @Column(name="PERIOD_YEAR", precision = 4)
+ @Column(name = "PERIOD_YEAR", precision = 4)
private Integer periodYear;
- @Column(name="PERIOD_MONTH", precision = 2)
+ @Column(name = "PERIOD_MONTH", precision = 2)
private Integer periodMonth;
- @Column(name="BEGINDRBAL", precision = 15, scale = 2)
+ @Column(name = "BEGINDRBAL", precision = 15, scale = 2)
private Double begindrbal;
- @Column(name="BEGINCRBAL", precision = 15, scale = 2)
+ @Column(name = "BEGINCRBAL", precision = 15, scale = 2)
private Double begincrbal;
- @Column(name="DRAMT", precision = 15, scale = 2)
+ @Column(name = "DRAMT", precision = 15, scale = 2)
private Double dramt;
- @Column(name="CRAMT", precision = 15, scale = 2)
+ @Column(name = "CRAMT", precision = 15, scale = 2)
private Double cramt;
- @Column(name="DRBAL", precision = 15, scale = 2)
+ @Column(name = "DRBAL", precision = 15, scale = 2)
private Double drbal;
- @Column(name="CRBAL", precision = 15, scale = 2)
+ @Column(name = "CRBAL", precision = 15, scale = 2)
private Double crbal;
- @Column(name="UPDTIME", precision = 15, scale = 2)
+ @Column(name = "UPDTIME", precision = 15, scale = 2)
private String updtime;
@Column(name = "tenantid", length = 20)
@@ -171,4 +176,12 @@
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
+
+ public String getSubjid() {
+ return subjid;
+ }
+
+ public void setSubjid(String subjid) {
+ this.subjid = subjid;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectdayPK.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectdayPK.java
similarity index 72%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectdayPK.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectdayPK.java
index a3fdd45..ac70e2f 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectdayPK.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubjectdayPK.java
@@ -10,8 +10,8 @@
private String accdate;
@Id
- @Column(name = "SUBJNO", nullable = false, length = 10)
- private String subjno;
+ @Column(name = "SUBJID", nullable = false, length = 32)
+ private String subjid;
public String getAccdate() {
return accdate;
@@ -21,12 +21,12 @@
this.accdate = accdate;
}
- public String getSubjno() {
- return subjno;
+ public String getSubjid() {
+ return subjid;
}
- public void setSubjno(String subjno) {
- this.subjno = subjno;
+ public void setSubjid(String subjid) {
+ this.subjid = subjid;
}
@Override
@@ -36,7 +36,7 @@
TSubjectdayPK tSubjectdayPK = (TSubjectdayPK) o;
if (accdate != null ? !accdate.equals(tSubjectdayPK.getAccdate()) : accdate != null)
return false;
- if (subjno != null ? !subjno.equals(tSubjectdayPK.getSubjno()) : subjno != null)
+ if (subjid != null ? !subjid.equals(tSubjectdayPK.getSubjid()) : subjid != null)
return false;
return true;
@@ -45,7 +45,7 @@
@Override
public int hashCode() {
int result = accdate != null ? accdate.hashCode() : 0;
- result = 31 * result + (subjno != null ? subjno.hashCode() : 0);
+ result = 31 * result + (subjid != null ? subjid.hashCode() : 0);
return result;
}
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TSyspara.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSyspara.java
similarity index 78%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TSyspara.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSyspara.java
index 3434b87..8269487 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TSyspara.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSyspara.java
@@ -5,19 +5,24 @@
import com.supwisdom.dlpay.framework.util.StringUtil;
import com.supwisdom.dlpay.framework.util.SysparaUtil;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
+import javax.persistence.*;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
@Table(name = "TB_SYSPARA")
-public class TSyspara {
+@IdClass(TSysparaPK.class)
+public class TSyspara implements Serializable {
+ private static final long serialVersionUID = 6760877848228345624L;
@Id
@Column(name = "PARAID", nullable = false, precision = 9)
private Integer paraid;
+ @Id
+ @Column(name = "tenantid", length = 20)
+ @NotNull
+ private String tenantId;
+
@Column(name = "PARAVAL", length = 100)
private String paraval;
@@ -28,7 +33,7 @@
private String paraunit;
@Column(name = "VALUETYPE", length = 10)
- private String valueType = SysparaUtil.SYSPARA_VALUETYPE_STRING;
+ private String valueType = SysparaUtil.VALUETYPE_STRING;
@Column(name = "EDITFLAG", precision = 1)
@NotNull
@@ -45,9 +50,6 @@
@NotNull
private String lastsaved;
- @Column(name = "tenantid", length = 20)
- @NotNull
- private String tenantId;
public TSyspara() {
}
@@ -156,17 +158,17 @@
*/
public boolean checkValueInvalid() {
if (!StringUtil.isEmpty(this.paraval)) {
- if (SysparaUtil.SYSPARA_VALUETYPE_AMOUNT.equals(this.valueType) && !NumberUtil.isAmount(this.paraval)) {
+ if (SysparaUtil.VALUETYPE_AMOUNT.equals(this.valueType) && !NumberUtil.isAmount(this.paraval)) {
return true; //参数值非金额类型
- } else if (SysparaUtil.SYSPARA_VALUETYPE_DECIMAL.equals(this.valueType) && !NumberUtil.isDecimal(this.paraval)) {
+ } else if (SysparaUtil.VALUETYPE_DECIMAL.equals(this.valueType) && !NumberUtil.isDecimal(this.paraval)) {
return true; //参数值非数值类型
- } else if (SysparaUtil.SYSPARA_VALUETYPE_NUMBER.equals(this.valueType) && !NumberUtil.isNumber(this.paraval)) {
+ } else if (SysparaUtil.VALUETYPE_NUMBER.equals(this.valueType) && !NumberUtil.isNumber(this.paraval)) {
return true; //参数值非整数
- } else if (SysparaUtil.SYSPARA_VALUETYPE_SWITCH.equals(this.valueType) && !"1".equals(this.paraval) && !"0".equals(this.paraval)) {
+ } else if (SysparaUtil.VALUETYPE_SWITCH.equals(this.valueType) && !"1".equals(this.paraval) && !"0".equals(this.paraval)) {
return true; //参数值非开关量 0/1
- } else if (SysparaUtil.SYSPARA_VALUETYPE_DATE.equals(this.valueType) && !DateUtil.checkDatetimeValid(this.paraval, "yyyyMMdd")) {
+ } else if (SysparaUtil.VALUETYPE_DATE.equals(this.valueType) && !DateUtil.checkDatetimeValid(this.paraval, "yyyyMMdd")) {
return true; //参数值非日期格式
- } else if (SysparaUtil.SYSPARA_VALUETYPE_DATETIME.equals(this.valueType) && !DateUtil.checkDatetimeValid(this.paraval, "yyyyMMddHHmmss")) {
+ } else if (SysparaUtil.VALUETYPE_DATETIME.equals(this.valueType) && !DateUtil.checkDatetimeValid(this.paraval, "yyyyMMddHHmmss")) {
return true; //参数值非日期时间格式
}
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSysparaPK.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSysparaPK.java
new file mode 100644
index 0000000..353225a
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSysparaPK.java
@@ -0,0 +1,48 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Objects;
+
+public class TSysparaPK implements Serializable {
+ @Id
+ @Column(name = "PARAID", nullable = false, precision = 9)
+ private Integer paraid;
+
+ @Id
+ @Column(name = "tenantid", length = 20)
+ @NotNull
+ private String tenantId;
+
+ public Integer getParaid() {
+ return paraid;
+ }
+
+ public void setParaid(Integer paraid) {
+ this.paraid = paraid;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof TSysparaPK)) return false;
+ TSysparaPK that = (TSysparaPK) o;
+ return Objects.equals(getParaid(), that.getParaid()) &&
+ Objects.equals(getTenantId(), that.getTenantId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getParaid(), getTenantId());
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TTaskLock.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TTaskLock.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TTaskLock.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TTaskLock.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TTenantConfig.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TTenantConfig.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TTenantConfig.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TTenantConfig.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java
similarity index 70%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java
index ac42871..1506e65 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java
@@ -1,16 +1,19 @@
package com.supwisdom.dlpay.framework.domain;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
+import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Entity
-@Table(name = "TB_TRANSCODE")
+@Table(name = "TB_TRANSCODE",
+ indexes = {@Index(name = "transcode_idx", columnList = "transcode, tenantid", unique = true)})
public class TTranscode implements DictionaryTable, Serializable {
+ private static final long serialVersionUID = -8077649544237207668L;
@Id
+ @Column(name = "transcode_id")
+ @NotNull
+ private Integer trascodeId;
+
@Column(name = "TRANSCODE", nullable = false, precision = 4)
private Integer transcode;
@@ -54,4 +57,12 @@
public Object getDictValue() {
return this.transname;
}
+
+ public Integer getTrascodeId() {
+ return trascodeId;
+ }
+
+ public void setTrascodeId(Integer trascodeId) {
+ this.trascodeId = trascodeId;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucher.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucher.java
similarity index 98%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TVoucher.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucher.java
index 71b30d8..679d14e 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucher.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucher.java
@@ -4,7 +4,8 @@
import javax.validation.constraints.NotNull;
@Entity
-@Table(name = "TB_VOUCHER")
+@Table(name = "TB_VOUCHER",
+ indexes = {@Index(name = "voucher_idx", columnList = "voucherdate, tenantid")})
public class TVoucher {
@Id
@SequenceGenerator(name = "voucherid", sequenceName = "SEQ_VOUCHERID", allocationSize = 1)
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucherEntry.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucherEntry.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TVoucherEntry.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucherEntry.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucherEntryPK.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucherEntryPK.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TVoucherEntryPK.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucherEntryPK.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TVouchernoCtl.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TVouchernoCtl.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/domain/TVouchernoCtl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TVouchernoCtl.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/filter/CrosXssFilter.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/filter/CrosXssFilter.java
new file mode 100644
index 0000000..c9bf7e0
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/filter/CrosXssFilter.java
@@ -0,0 +1,59 @@
+package com.supwisdom.dlpay.framework.filter;
+
+import com.google.gson.Gson;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.*;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+@WebFilter
+public class CrosXssFilter implements Filter {
+ private static final Logger logger = LoggerFactory.getLogger(CrosXssFilter.class);
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+
+ }
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+ request.setCharacterEncoding("utf-8");
+
+ //跨域设置
+// if(response instanceof HttpServletResponse){
+// HttpServletResponse httpServletResponse=(HttpServletResponse)response;
+// //通过在响应 header 中设置 ‘*’ 来允许来自所有域的跨域请求访问。
+// httpServletResponse.setHeader("Access-Control-Allow-Origin", "*");
+// //通过对 Credentials 参数的设置,就可以保持跨域 Ajax 时的 Cookie
+// //设置了Allow-Credentials,Allow-Origin就不能为*,需要指明具体的url域
+// //httpServletResponse.setHeader("Access-Control-Allow-Credentials", "true");
+// //请求方式
+// httpServletResponse.setHeader("Access-Control-Allow-Methods", "*");
+// //(预检请求)的返回结果(即 Access-Control-Allow-Methods 和Access-Control-Allow-Headers 提供的信息) 可以被缓存多久
+// httpServletResponse.setHeader("Access-Control-Max-Age", "86400");
+// //首部字段用于预检请求的响应。其指明了实际请求中允许携带的首部字段
+// httpServletResponse.setHeader("Access-Control-Allow-Headers", "*");
+// }
+
+ //sql,xss过滤
+ HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+ logger.info("CrosXssFilter.......orignal url:{},ParameterMap:{}",
+ httpServletRequest.getRequestURI(),
+ new Gson().toJson(httpServletRequest.getParameterMap()));
+ XssHttpServletRequestWrapper xssHttpServletRequestWrapper = new XssHttpServletRequestWrapper(
+ httpServletRequest);
+ chain.doFilter(xssHttpServletRequestWrapper, response);
+ logger.info("CrosXssFilter..........doFilter url:{},ParameterMap:{}",
+ xssHttpServletRequestWrapper.getRequestURI(),
+ new Gson().toJson(xssHttpServletRequestWrapper.getParameterMap()));
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/filter/ValidateCodeFilter.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/filter/ValidateCodeFilter.java
new file mode 100644
index 0000000..c58260d
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/filter/ValidateCodeFilter.java
@@ -0,0 +1,92 @@
+package com.supwisdom.dlpay.framework.filter;
+
+
+import com.supwisdom.dlpay.exception.ValidateCodeException;
+import com.supwisdom.dlpay.framework.security.CodeUtil;
+import com.supwisdom.dlpay.framework.security.MyAuthenticationFailureHandler;
+import com.supwisdom.dlpay.framework.security.validate.ImageCodeUtil;
+import com.supwisdom.dlpay.framework.security.validate.VerifyCode;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+
+@Component("validateCodeFilter")
+public class ValidateCodeFilter extends OncePerRequestFilter {
+
+ /**
+ * 校验失败处理器
+ */
+ @Autowired
+ private MyAuthenticationFailureHandler myAuthenticationFailureHandler;
+
+
+ @Override
+ protected void doFilterInternal(HttpServletRequest request,
+ HttpServletResponse response, FilterChain filterChain)
+ throws ServletException, IOException {
+ String context = request.getContextPath();
+ if (context == null || "" == context.trim()) {
+ context = "/";
+ }
+ if (request.getRequestURI().isEmpty()) {
+ filterChain.doFilter(request, response);
+ return;
+ }
+ String url = request.getRequestURI();
+ if (!"/".equals(context)) {
+ url = url.replace(context, "");
+ }
+ if (StringUtil.equals("/login/form", url)
+ && StringUtil.equalsIgnoreCase(request.getMethod(), "post")) {
+ try {
+ validate(request);
+ } catch (ValidateCodeException e) {
+ //response.setStatus(HttpStatus.OK.value());
+ //response.setContentType("application/json;charset=UTF-8");
+ //response.getWriter().write(objectMapper.writeValueAsString(JsonResult.error(400, e.getMessage())));
+ //response.sendError(HttpStatus.UNAUTHORIZED.value(),e.getMessage());
+ myAuthenticationFailureHandler.onAuthenticationFailure(request, response, e);
+ return;
+ }
+ }
+ filterChain.doFilter(request, response);
+ }
+
+ private void validate(HttpServletRequest request) throws ValidateCodeException {
+ if (!CodeUtil.checkVerifyCode(request)) {
+ throw new ValidateCodeException("验证码不匹配");
+ } else {
+ request.getSession().removeAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
+ }
+// VerifyCode imageCode = (VerifyCode) request.getSession().getAttribute(ImageCodeUtil.LOGIN_IMAGECODE_SESSIONKEY);
+// String inputCode;
+// try {
+// inputCode = request.getParameter("imageCode");
+// } catch (Exception e) {
+// throw new ValidateCodeException("获取验证码的值失败");
+// }
+// if (StringUtil.isEmpty(inputCode)) {
+// throw new ValidateCodeException("验证码不能为空");
+// }
+// if (null == imageCode) {
+// throw new ValidateCodeException("验证码不存在");
+// }
+// if (imageCode.isExpired()) {
+// request.getSession().removeAttribute(ImageCodeUtil.LOGIN_IMAGECODE_SESSIONKEY);
+// throw new ValidateCodeException("验证码已过期");
+// }
+// if (!StringUtil.equalsIgnoreCase(imageCode.getText(), inputCode)) {
+// throw new ValidateCodeException("验证码不匹配");
+// }
+// request.getSession().removeAttribute(ImageCodeUtil.LOGIN_IMAGECODE_SESSIONKEY);
+ }
+
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/filter/XssHttpServletRequestWrapper.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/filter/XssHttpServletRequestWrapper.java
new file mode 100644
index 0000000..f918b86
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/filter/XssHttpServletRequestWrapper.java
@@ -0,0 +1,130 @@
+package com.supwisdom.dlpay.framework.filter;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.StringUtils;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 防止sql注入,xss攻击
+ */
+public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
+ private final static Logger log = LoggerFactory.getLogger(XssHttpServletRequestWrapper.class);
+ private final static String key = "and|or|exec|insert|select|delete|update|truncate|declare";
+ private static Set<String> notAllowedKeyWords = new HashSet<String>(0);
+ private static String replacedString = "INVALID";
+
+ static {
+ String keyStr[] = key.split("\\|");
+ for (String str : keyStr) {
+ notAllowedKeyWords.add(str);
+ }
+ }
+
+ private String currentUrl;
+
+ /**
+ * Constructs a request object wrapping the given request.
+ *
+ * @param request the {@link HttpServletRequest} to be wrapped.
+ * @throws IllegalArgumentException if the request is null
+ */
+ public XssHttpServletRequestWrapper(HttpServletRequest request) {
+ super(request);
+ currentUrl = request.getRequestURI();
+ }
+
+ /**
+ * 覆盖getParameter方法,将参数名和参数值都做xss过滤。
+ * 如果需要获得原始的值,则通过super.getParameterValues(name)来获取
+ * getParameterNames,getParameterValues和getParameterMap也可能需要覆盖
+ */
+ @Override
+ public String getParameter(String parameter) {
+ String value = super.getParameter(parameter);
+ if (value == null) {
+ return null;
+ }
+ return cleanXSS(value);
+ }
+
+ @Override
+ public String[] getParameterValues(String parameter) {
+ String[] values = super.getParameterValues(parameter);
+ if (values == null) {
+ return null;
+ }
+ int count = values.length;
+ String[] encodedValues = new String[count];
+ for (int i = 0; i < count; i++) {
+ encodedValues[i] = cleanXSS(values[i]);
+ }
+ return encodedValues;
+ }
+
+ @Override
+ public Map<String, String[]> getParameterMap() {
+ Map<String, String[]> values = super.getParameterMap();
+ if (values == null) {
+ return null;
+ }
+ Map<String, String[]> result = new HashMap<>();
+ for (String key : values.keySet()) {
+ String encodedKey = cleanXSS(key);
+ int count = values.get(key).length;
+ String[] encodedValues = new String[count];
+ for (int i = 0; i < count; i++) {
+ encodedValues[i] = cleanXSS(values.get(key)[i]);
+ }
+ result.put(encodedKey, encodedValues);
+ }
+ return result;
+ }
+
+ /**
+ * 覆盖getHeader方法,将参数名和参数值都做xss过滤。
+ * 如果需要获得原始的值,则通过super.getHeaders(name)来获取
+ * getHeaderNames 也可能需要覆盖
+ */
+ @Override
+ public String getHeader(String name) {
+ String value = super.getHeader(name);
+ if (value == null) {
+ return null;
+ }
+ return cleanXSS(value);
+ }
+
+ private String cleanXSS(String valueP) {
+ // You'll need to remove the spaces from the html entities below
+ String value = valueP.replaceAll("<", "<").replaceAll(">", ">");
+ value = value.replaceAll("<", "& lt;").replaceAll(">", "& gt;");
+ value = value.replaceAll("\\(", "& #40;").replaceAll("\\)", "& #41;");
+ value = value.replaceAll("'", "& #39;");
+ value = value.replaceAll("eval\\((.*)\\)", "");
+ value = value.replaceAll("[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']", "\"\"");
+// value = value.replaceAll("'", "‘").replaceAll(";", ";").replaceAll("=", "").replaceAll("%", "").replaceAll("\\+", "");
+ value = value.replaceAll("script", "");
+ value = cleanSqlKeyWords(value);
+ return value;
+ }
+
+ private String cleanSqlKeyWords(String value) {
+ String paramValue = value;
+ for (String keyword : notAllowedKeyWords) {
+ if (paramValue.length() > keyword.length() + 4
+ && (paramValue.contains(" " + keyword) || paramValue.contains(keyword + " ") || paramValue.contains(" " + keyword + " "))) {
+ paramValue = StringUtils.replace(paramValue, keyword, replacedString);
+ log.error(this.currentUrl + "已被过滤,因为参数中包含不允许sql的关键词(" + keyword
+ + ")" + ";参数:" + value + ";过滤后的参数:" + paramValue);
+ }
+ }
+ return paramValue;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/redisrepo/ApiClientRepository.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/redisrepo/ApiClientRepository.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/redisrepo/ApiClientRepository.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/redisrepo/ApiClientRepository.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/redisrepo/ApiJwtRepository.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/redisrepo/ApiJwtRepository.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/redisrepo/ApiJwtRepository.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/redisrepo/ApiJwtRepository.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/redisrepo/PersonRepository.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/redisrepo/PersonRepository.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/redisrepo/PersonRepository.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/redisrepo/PersonRepository.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/security/CodeUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/CodeUtil.java
new file mode 100644
index 0000000..ef3b475
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/CodeUtil.java
@@ -0,0 +1,45 @@
+package com.supwisdom.dlpay.framework.security;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CodeUtil {
+ /**
+ * 将获取到的前端参数转为string类型
+ *
+ * @param request
+ * @param key
+ * @return
+ */
+ public static String getString(HttpServletRequest request, String key) {
+ try {
+ String result = request.getParameter(key);
+ if (result != null) {
+ result = result.trim();
+ }
+ if ("".equals(result)) {
+ result = null;
+ }
+ return result;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * 验证码校验
+ *
+ * @param request
+ * @return
+ */
+ public static boolean checkVerifyCode(HttpServletRequest request) {
+ //获取生成的验证码
+ String verifyCodeExpected = (String) request.getSession()
+ .getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
+ //获取用户输入的验证码
+ String verifyCodeActual = CodeUtil.getString(request, "verifyCodeActual");
+ if (verifyCodeActual == null || !verifyCodeActual.equals(verifyCodeExpected)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/MyAuthenticationFailureHandler.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/MyAuthenticationFailureHandler.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/security/MyAuthenticationFailureHandler.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/security/MyAuthenticationFailureHandler.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/MyAuthenticationSuccessHandler.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/MyAuthenticationSuccessHandler.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/security/MyAuthenticationSuccessHandler.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/security/MyAuthenticationSuccessHandler.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/MyInvalidSessionStrategy.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/MyInvalidSessionStrategy.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/security/MyInvalidSessionStrategy.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/security/MyInvalidSessionStrategy.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/MyPermissionEvaluator.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/MyPermissionEvaluator.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/security/MyPermissionEvaluator.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/security/MyPermissionEvaluator.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/OperUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/OperUtil.java
similarity index 99%
rename from src/main/java/com/supwisdom/dlpay/framework/security/OperUtil.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/security/OperUtil.java
index d576b41..4dd8c9e 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/security/OperUtil.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/OperUtil.java
@@ -1,68 +1,68 @@
-package com.supwisdom.dlpay.framework.security;
-
-import com.supwisdom.dlpay.framework.domain.TOperator;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.context.SecurityContextHolder;
-
-import java.util.Collection;
-
-public class OperUtil {
-
- public static TOperator getCurrentOper() {
- Authentication au = SecurityContextHolder.getContext()
- .getAuthentication();
- if (au == null)
- return null;
- if (au.getPrincipal() == null)
- return null;
- if (au != null && au.getPrincipal() instanceof TOperator) {
- return (TOperator) au.getPrincipal();
- } else {
- TOperator oper = new TOperator();
- oper.setOpername(au.getPrincipal().toString());
- oper.setOperpwd(au.getCredentials() == null ? null : au
- .getCredentials().toString());
- return oper;
- }
- }
-
- public static String getCurrentOperid() {
- TOperator oper = getCurrentOper();
- if (oper == null)
- return null;
- return oper.getOperid() == null ? oper.getOpercode() : oper.getOperid();
- }
-
- public static boolean isLogined() {
- Authentication au = SecurityContextHolder.getContext()
- .getAuthentication();
- if (au == null)
- return false;
- if (au.getPrincipal() == null)
- return false;
- if (au.getPrincipal() instanceof TOperator)
- return true;
- return false;
- }
-
- public static boolean isAdmin() {
- TOperator loginOper = OperUtil.getCurrentOper();
- if (loginOper != null) {
- Collection<? extends GrantedAuthority> gas = loginOper.getAuthorities();
- if (gas == null) {
- return false;
- }
- boolean flag = false;
- for (GrantedAuthority grantedAuthority : gas) {
- if ("ROLE_ADMIN".equals(grantedAuthority.getAuthority())) {
- flag = true;
- }
- }
- return flag;
- } else {
- return false;
- }
- }
-
-}
+package com.supwisdom.dlpay.framework.security;
+
+import com.supwisdom.dlpay.framework.domain.TOperator;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.context.SecurityContextHolder;
+
+import java.util.Collection;
+
+public class OperUtil {
+
+ public static TOperator getCurrentOper() {
+ Authentication au = SecurityContextHolder.getContext()
+ .getAuthentication();
+ if (au == null)
+ return null;
+ if (au.getPrincipal() == null)
+ return null;
+ if (au != null && au.getPrincipal() instanceof TOperator) {
+ return (TOperator) au.getPrincipal();
+ } else {
+ TOperator oper = new TOperator();
+ oper.setOpername(au.getPrincipal().toString());
+ oper.setOperpwd(au.getCredentials() == null ? null : au
+ .getCredentials().toString());
+ return oper;
+ }
+ }
+
+ public static String getCurrentOperid() {
+ TOperator oper = getCurrentOper();
+ if (oper == null)
+ return null;
+ return oper.getOperid() == null ? oper.getOpercode() : oper.getOperid();
+ }
+
+ public static boolean isLogined() {
+ Authentication au = SecurityContextHolder.getContext()
+ .getAuthentication();
+ if (au == null)
+ return false;
+ if (au.getPrincipal() == null)
+ return false;
+ if (au.getPrincipal() instanceof TOperator)
+ return true;
+ return false;
+ }
+
+ public static boolean isAdmin() {
+ TOperator loginOper = OperUtil.getCurrentOper();
+ if (loginOper != null) {
+ Collection<? extends GrantedAuthority> gas = loginOper.getAuthorities();
+ if (gas == null) {
+ return false;
+ }
+ boolean flag = false;
+ for (GrantedAuthority grantedAuthority : gas) {
+ if ("ROLE_ADMIN".equals(grantedAuthority.getAuthority())) {
+ flag = true;
+ }
+ }
+ return flag;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/ValidateCodeSecurityConfig.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/ValidateCodeSecurityConfig.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/security/ValidateCodeSecurityConfig.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/security/ValidateCodeSecurityConfig.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCode.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCode.java
similarity index 99%
rename from src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCode.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCode.java
index 6b56ca8..d88d3af 100755
--- a/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCode.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCode.java
@@ -1,21 +1,21 @@
-package com.supwisdom.dlpay.framework.security.validate;
-
-import java.awt.image.BufferedImage;
-
-public class ImageCode extends ValidateCode {
- private BufferedImage image;
-
- public ImageCode(BufferedImage image, String code, int expireTime) {
- super(code, expireTime);
- this.image = image;
- }
-
- public BufferedImage getImage() {
- return image;
- }
-
- public void setImage(BufferedImage image) {
- this.image = image;
- }
-
-}
+package com.supwisdom.dlpay.framework.security.validate;
+
+import java.awt.image.BufferedImage;
+
+public class ImageCode extends ValidateCode {
+ private BufferedImage image;
+
+ public ImageCode(BufferedImage image, String code, int expireTime) {
+ super(code, expireTime);
+ this.image = image;
+ }
+
+ public BufferedImage getImage() {
+ return image;
+ }
+
+ public void setImage(BufferedImage image) {
+ this.image = image;
+ }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCodeUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCodeUtil.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCodeUtil.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCodeUtil.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/validate/ValidateCode.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/validate/ValidateCode.java
similarity index 99%
rename from src/main/java/com/supwisdom/dlpay/framework/security/validate/ValidateCode.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/security/validate/ValidateCode.java
index b20eca2..67a4812 100755
--- a/src/main/java/com/supwisdom/dlpay/framework/security/validate/ValidateCode.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/validate/ValidateCode.java
@@ -1,55 +1,55 @@
-package com.supwisdom.dlpay.framework.security.validate;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.supwisdom.dlpay.framework.util.DateUtil;
-import java.util.Date;
-
-
-public class ValidateCode{
-
- private String code;
-
- private Date expireTime;
-
- public ValidateCode() {
- super();
- }
-
- public ValidateCode(String code, Date expireTime) {
- super();
- this.code = code;
- this.expireTime = expireTime;
- }
-
- public ValidateCode(String code, int expireTime) {
- super();
- this.code = code;
- this.expireTime = DateUtil.setMinutes(new Date(), expireTime);
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public Date getExpireTime() {
- return expireTime;
- }
-
- public void setExpireTime(Date expireTime) {
- this.expireTime = expireTime;
- }
-
- @JsonIgnore
- public boolean isExpired() {
- return new Date().compareTo(expireTime) > 0;
- }
-
- @Override
- public String toString() {
- return "ValidateCode [code=" + code + ", expireTime=" + expireTime + "]";
- }
-}
+package com.supwisdom.dlpay.framework.security.validate;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import java.util.Date;
+
+
+public class ValidateCode{
+
+ private String code;
+
+ private Date expireTime;
+
+ public ValidateCode() {
+ super();
+ }
+
+ public ValidateCode(String code, Date expireTime) {
+ super();
+ this.code = code;
+ this.expireTime = expireTime;
+ }
+
+ public ValidateCode(String code, int expireTime) {
+ super();
+ this.code = code;
+ this.expireTime = DateUtil.setMinutes(new Date(), expireTime);
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public Date getExpireTime() {
+ return expireTime;
+ }
+
+ public void setExpireTime(Date expireTime) {
+ this.expireTime = expireTime;
+ }
+
+ @JsonIgnore
+ public boolean isExpired() {
+ return new Date().compareTo(expireTime) > 0;
+ }
+
+ @Override
+ public String toString() {
+ return "ValidateCode [code=" + code + ", expireTime=" + expireTime + "]";
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/validate/VerifyCode.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/security/validate/VerifyCode.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/security/validate/VerifyCode.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/security/validate/VerifyCode.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/DayendSettleService.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/DayendSettleService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/service/DayendSettleService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/service/DayendSettleService.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/DayendStatisticsService.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/DayendStatisticsService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/service/DayendStatisticsService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/service/DayendStatisticsService.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/OperatorDetailService.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/OperatorDetailService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/service/OperatorDetailService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/service/OperatorDetailService.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
similarity index 85%
rename from src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
index e575265..7eda63d 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
@@ -16,25 +16,15 @@
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);
-
- /**
* 获取记账日期
*/
+ @Transactional
String getAccdate();
/**
* 获取流水号
*/
+ @Transactional
String getRefno();
/**
@@ -44,6 +34,7 @@
/********************** 获取【系统参数】【业务参数】通用方法 **********************/
+ @Transactional
String getSysparaValue(int paraid);
String getSysparaValue(int paraid, String defaultValue);
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java
similarity index 98%
rename from src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java
index 2f4959b..8310435 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java
@@ -469,7 +469,7 @@
// List<TVoucherEntry> entryList = voucherEntryDao.getVoucherEntryByVoucherid(voucherid);
// if (null == voucher) {
// throw new Exception("凭证查询无记录");
-// } else if ("auto".equals(voucher.getSourcetype())) {
+// } else if ("auto".equals(voucher.getSourceType())) {
// throw new Exception("该凭证不是手工录入凭证");
// } else if (voucher.getCheckflag() != 1) {
// throw new Exception("该凭证未审核");
@@ -499,7 +499,7 @@
//
// //明细
// for (TVoucherEntry entry : entryList) {
-// if (Subject.SUBJNO_MACHANT_INCOME.equals(entry.getSubjno())) {
+// if (Subject.SUBJNO_MACHANT_INCOME.equals(entry.getSubjid())) {
// TShopaccbal tShopaccbal = shopaccbalDao.getTShopaccbalByIdWithLock(entry.getAccno());
// if (null == tShopaccbal) {
// throw new Exception("商户表商户账号[" + entry.getAccno() + "]不存在");
@@ -509,12 +509,12 @@
// entry.setBalflag(2);
// entry.setBalance(tShopaccbal.getBalance());
// } else {
-// TSubjectbal tSubjectbal = subjectbalDao.getTSubjectbalBySubjnoWithLock(entry.getSubjno());
-// TSubject subject = subjectDao.getOne(entry.getSubjno());
+// TSubjectbal tSubjectbal = subjectbalDao.getTSubjectbalBySubjnoWithLock(entry.getSubjid());
+// TSubject subject = subjectDao.getOne(entry.getSubjid());
// if (null == tSubjectbal || null == subject) {
-// throw new Exception("科目表科目号[" + entry.getSubjno() + "]不存在");
+// throw new Exception("科目表科目号[" + entry.getSubjid() + "]不存在");
// } else if (subject.getEndflag() != 1) {
-// throw new Exception("科目[" + entry.getSubjno() + "]非末级科目");
+// throw new Exception("科目[" + entry.getSubjid() + "]非末级科目");
// }
// entry.setBalflag(subject.getBalflag());
// if (subject.getBalflag() == 1) {
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendStatisticsServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendStatisticsServiceImpl.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendStatisticsServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendStatisticsServiceImpl.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/impl/OperatorDetailServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/impl/OperatorDetailServiceImpl.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/service/impl/OperatorDetailServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/service/impl/OperatorDetailServiceImpl.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
similarity index 84%
rename from src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
index 51b2b0b..baf8449 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
@@ -57,37 +57,6 @@
}
@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() == 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;
- }
-
- @Override
public String getAccdate() {
String hostdate = getSysdatetime().getHostdate();
TSettlectl settlectl = settleCtlDao.getOne(1);
diff --git a/src/main/java/com/supwisdom/dlpay/framework/tenant/HibernateConfig.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/HibernateConfig.java
similarity index 97%
rename from src/main/java/com/supwisdom/dlpay/framework/tenant/HibernateConfig.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/HibernateConfig.java
index 5070d62..bff7098 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/tenant/HibernateConfig.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/HibernateConfig.java
@@ -1,5 +1,9 @@
package com.supwisdom.dlpay.framework.tenant;
+import java.util.HashMap;
+import java.util.Map;
+import javax.sql.DataSource;
+
import lombok.extern.slf4j.Slf4j;
import org.hibernate.MultiTenancyStrategy;
import org.hibernate.cfg.Environment;
@@ -15,9 +19,6 @@
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
-import javax.sql.DataSource;
-import java.util.HashMap;
-import java.util.Map;
@Configuration
@Slf4j
@@ -57,6 +58,7 @@
em.setPackagesToScan("com.supwisdom");
em.setJpaPropertyMap(properties);
em.setJpaVendorAdapter(getJpaVendorAdapter());
+ log.info("setup multi-tenant entityManagerFactor");
return em;
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantConnectionProviderImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantConnectionProviderImpl.java
similarity index 94%
rename from src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantConnectionProviderImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantConnectionProviderImpl.java
index d13ffdb..a8f8dd5 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantConnectionProviderImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantConnectionProviderImpl.java
@@ -1,5 +1,6 @@
package com.supwisdom.dlpay.framework.tenant;
+import com.supwisdom.dlpay.framework.util.StringUtil;
import org.hibernate.HibernateException;
import org.hibernate.engine.jdbc.connections.spi.AbstractDataSourceBasedMultiTenantConnectionProviderImpl;
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
@@ -33,7 +34,7 @@
String tenantIdentifier = TenantContext.getTenantSchema();
final Connection connection = getAnyConnection();
try {
- if (tenantIdentifier != null) {
+ if (!StringUtil.isEmpty(tenantIdentifier)) {
connection.createStatement().execute("SET search_path = \"" + tenantIdentifier + "\", public");
} else {
connection.createStatement().execute("SET search_path = public");
diff --git a/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantIdentifierResolver.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantIdentifierResolver.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantIdentifierResolver.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantIdentifierResolver.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantCacheKeyGen.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantCacheKeyGen.java
new file mode 100644
index 0000000..254c4e4
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantCacheKeyGen.java
@@ -0,0 +1,27 @@
+package com.supwisdom.dlpay.framework.tenant;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.cache.interceptor.KeyGenerator;
+
+import java.lang.reflect.Method;
+
+public class TenantCacheKeyGen implements KeyGenerator {
+ private static final char delimiter = ':';
+
+ @Override
+ public Object generate(Object target, Method method, Object... params) {
+ StringBuilder name = new StringBuilder();
+ name.append(target.getClass().getSimpleName())
+ .append(delimiter);
+ String tenant = TenantContext.getTenantSchema();
+ if (StringUtils.isEmpty(tenant)) {
+ tenant = "default";
+ }
+ name.append(tenant).append(delimiter);
+ for (Object item : params) {
+ name.append(delimiter).append(item.toString());
+ }
+ return name.toString();
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantContext.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantContext.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/tenant/TenantContext.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantContext.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantHolder.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantHolder.java
new file mode 100644
index 0000000..585767f
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantHolder.java
@@ -0,0 +1,27 @@
+package com.supwisdom.dlpay.framework.tenant;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+@Component("tenantHolder")
+public class TenantHolder {
+ private static final char delimiter = '-';
+
+ public String getId() {
+ String id = TenantContext.getTenantSchema();
+ if (id == null || StringUtils.isEmpty(id)) {
+ return "default";
+ }
+ return id;
+ }
+
+ public String genKey(String prefix, String... args) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getId()).append(delimiter)
+ .append(prefix);
+ for (String item : args) {
+ builder.append(delimiter).append(item);
+ }
+ return builder.toString();
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantInterceptor.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantInterceptor.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/tenant/TenantInterceptor.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantInterceptor.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/ApplicationUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/ApplicationUtil.java
new file mode 100644
index 0000000..3523689
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/ApplicationUtil.java
@@ -0,0 +1,29 @@
+package com.supwisdom.dlpay.framework.util;
+
+import com.supwisdom.dlpay.agent.AgentPayService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.context.ApplicationContext;
+
+public class ApplicationUtil {
+ private static final Logger logger = LoggerFactory.getLogger(ApplicationUtil.class);
+
+ public static AgentPayService findAgentPayService(ApplicationContext context, String service) {
+ try {
+ Object bean = context.getBean(service);
+ if (bean instanceof AgentPayService) {
+ return (AgentPayService) bean;
+ } else {
+ return null;
+ }
+ } catch (NoSuchBeanDefinitionException ex) {
+ logger.error("can't create bean <%s> , ex %s", service, ex.getMessage());
+ return null;
+ } catch (BeansException ex) {
+ logger.error("can't create bean <%s> , ex %s", service, ex.getMessage());
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java
similarity index 84%
rename from src/main/java/com/supwisdom/dlpay/framework/util/Constants.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java
index 17dd6bc..46af8bb 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java
@@ -8,4 +8,6 @@
public static final String JWT_CLAIM_TENANTID = "tenantId";
public static final String JWT_CLAIM_UID = "uid";
public static final String JWT_CLAIM_AUTHORITIES = "authorities";
+ // 根商户ID
+ public static final Integer ROOT_SHOP_FID = 1;
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
similarity index 60%
rename from src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
index af7b9e2..9eac02d 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
@@ -4,9 +4,14 @@
// dictionary 表字典
public static final String REVERSE_FLAG = "reverseflagList";
public static final String DTL_STATUS = "dtlStatusList";
+ public static final String IDTYPE = "idtypeList";
+ public static final String SEX = "sexList";
+ public static final String ACCOUNT_STATUS = "accountStatusList";
+ public static final String DTLTYPES = "dtltypeList";
/////////////////////////////////////
public static final String SOURCE_TYPE = "sourcetypeList";
public static final String TRANS_CODE = "transcodeList";
public static final String PAY_TYPE = "paytypelist";
+ public static final String ALL_SUBJECT = "allSubjectList";
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/MD5.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/MD5.java
similarity index 77%
rename from src/main/java/com/supwisdom/dlpay/framework/util/MD5.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/MD5.java
index 4d5ba84..91abab4 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/MD5.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/MD5.java
@@ -67,4 +67,21 @@
return hexDigits[d1] + hexDigits[d2];
}
+ public static String encodeByMD5ForDlpay(String originString) {
+ if (originString != null) {
+ try {
+ //创建具有指定算法名称的信息摘要
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ //使用指定的字节数组对摘要进行最后更新,然后完成摘要计算
+ byte[] results = md.digest(originString.getBytes("GBK"));
+ //将得到的字节数组变成字符串返回
+ String resultString = byteArrayToHexString(results);
+ return resultString;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ return null;
+ }
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/MoneyUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/MoneyUtil.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/MoneyUtil.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/MoneyUtil.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/NumberUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/NumberUtil.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/NumberUtil.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/NumberUtil.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/PageResult.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/PageResult.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/PageResult.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/PageResult.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/PermissionConstants.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/PermissionConstants.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/PermissionConstants.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/PermissionConstants.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/RandomUtils.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/RandomUtils.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/RandomUtils.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/RandomUtils.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/Sign.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Sign.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/Sign.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/Sign.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Signature.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Signature.java
new file mode 100644
index 0000000..849d275
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Signature.java
@@ -0,0 +1,21 @@
+package com.supwisdom.dlpay.framework.util;
+
+import com.supwisdom.dlpay.api.util.HMACUtil;
+import com.supwisdom.dlpay.framework.tenant.TenantContext;
+
+public class Signature {
+ public static final String SPY_TAC = "DLzJi044R7QHhJCDhpjZId8d";
+ private static final String ROOT_STATIC_KEY = "WfFTw42/2JnHP1Qjs4hnMstgANbhRvbXL84rNg==";
+
+ private static String deliveryKey(String tenantId, String factor) {
+ return HMACUtil.sha256HMAC(tenantId + factor, ROOT_STATIC_KEY);
+ }
+
+ public static String generateTac(String factor, String data) {
+ String tenant = TenantContext.getTenantSchema();
+ if (tenant == null) {
+ throw new IllegalArgumentException("TenantID 未定义");
+ }
+ return HMACUtil.sha256HMAC(deliveryKey(tenant, factor), data).substring(0, 24);
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/StringUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/StringUtil.java
similarity index 99%
rename from src/main/java/com/supwisdom/dlpay/framework/util/StringUtil.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/StringUtil.java
index 20756cc..d5bebe9 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/StringUtil.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/StringUtil.java
@@ -151,4 +151,6 @@
public static String nameReplace(String s){
return s.replaceAll("([\\d\\D]{1})(.*)", "$1**");
}
+
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/Subject.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Subject.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/Subject.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/Subject.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java
new file mode 100644
index 0000000..a67d6ff
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java
@@ -0,0 +1,26 @@
+package com.supwisdom.dlpay.framework.util;
+
+public class SysparaUtil {
+ public static final String VALUETYPE_AMOUNT = "amount"; //金额类型 Double
+ public static final String VALUETYPE_SWITCH = "switch"; //开关类型 Boolean 0/1
+ public static final String VALUETYPE_DATE = "date"; //日期类型 yyyyMMdd
+ public static final String VALUETYPE_DATETIME = "datetime"; //日期+时间 yyyyMMddHHmmss
+ public static final String VALUETYPE_DECIMAL = "decimal"; //数值
+ public static final String VALUETYPE_NUMBER = "number "; //整数,包含正负
+ public static final String VALUETYPE_STRING = "string"; //字符串
+
+
+ public static final int BALANCE_LIMIT = 1; //系统默认最大余额限制的ID
+ public static final int MOBILE_LOGIN_EXPIRE_IN_SECONDS = 4; //手机端用户过期时间(秒)
+ public static final int NOPASS_LIMIT = 2; //默认免密额度
+ public static final int DAY_PAY_LIMIT = 3; //默认日累计额度
+
+ public static final int DLCARDMANAGER_APPID = 2019; //与卡管系统对接的应用ID
+ public static final int DLCARDMANAGER_SECRET = 2020; //与卡管系统对接的应用appkey
+ public static final int DLCARDMANAGER_DESKEY = 2021; //与卡管系统对接的业务参数deskey
+
+ public static final double DEFAULT_BALANCE_LIMIT = 10000.0; // 系统默认最大余额限制
+ public static final double DEFAULT_NOPASS_LIMIT = 100.0; // 默认免密额度
+ public static final double DEFAULT_DAY_PAY_LIMIT = 200.0; // 默认日累计额度
+
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeCode.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeCode.java
new file mode 100644
index 0000000..d55d345
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeCode.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.framework.util;
+
+/**
+ * 交易码、交易类型
+ */
+public class TradeCode {
+ public static final int TRANSCODE_BALANCE_PAY = 3000; //账户余额支付
+ public static final int TRANSCODE_CITIZENCARD_PAY = 3010; //市民卡代扣消费
+ public static final int TRANSCODE_YKTCARD_PAY = 3020; //一卡通支付
+
+
+ public static final int TRANSCODE_WECHAT = 3030;//微信支付
+
+ public static final int TRANSCODE_ALIPAY = 3040;//支付宝支付
+
+ // QRcode 聚合支付
+ public static final int TRANSCODE_QRCODE = 1002;
+
+ public static final int TRANSCODE_ERCHARGE = 3500; //账户充值
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/TradeDict.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeDict.java
similarity index 93%
rename from src/main/java/com/supwisdom/dlpay/framework/util/TradeDict.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeDict.java
index d193d3a..85c2578 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/TradeDict.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeDict.java
@@ -6,10 +6,14 @@
* normal -- 正常
* closed -- 注销
* locked -- 锁定、冻结
+ * frozen -- 冻结
+ * lost -- 挂失
*/
public static final String STATUS_NORMAL = "normal";
public static final String STATUS_CLOSED = "closed";
public static final String STATUS_LOCKED = "locked";
+ public static final String STATUS_LOST = "lost";
+ public static final String STATUS_FROZEN = "frozen";
public static final String STATUS_YES = "yes";
public static final String STATUS_NO = "no";
@@ -92,6 +96,7 @@
* - refund : 手工撤销
*/
public static final String REVERSE_FLAG_NONE = "none";
+ public static final String REVERSE_FLAG_WIP = "wip";
public static final String REVERSE_FLAG_CANCEL = "cancel";
public static final String REVERSE_FLAG_REFUND = "refund";
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/TradeErrorCode.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeErrorCode.java
similarity index 85%
rename from src/main/java/com/supwisdom/dlpay/framework/util/TradeErrorCode.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeErrorCode.java
index d48c602..2ff2c01 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/TradeErrorCode.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeErrorCode.java
@@ -90,16 +90,6 @@
public static final int LOCK_READ_TIMEOUT = 10015;
/**
- * 卡已挂失
- */
- public static final int ACCOUNT_IS_LOSS = 10016;
-
- /**
- * 卡已锁定
- */
- public static final int ACCOUNT_IS_LOCKED = 10017;
-
- /**
* 费用类别未定义
*/
public static final int FEETYPE_NOT_EXISTS = 10018;
@@ -140,4 +130,19 @@
public static final int REQUEST_PARAM_EEROR = 30005; // 请求参数实体位置错误
+ //============= 交易错误 ============//
+ public static final int CARD_NOT_EXISTS = 40000; //卡不存在
+
+ public static final int CARD_IS_CLOSED = 40001; //卡已注销
+
+ public static final int ACCOUNT_IS_LOSS = 40002; //卡已挂失
+
+ public static final int ACCOUNT_IS_FROZEN = 40003; //卡已挂失
+
+ public static final int ACCOUNT_IS_LOCKED = 40004; //卡已锁定
+
+ public static final int WAIT_QUERY_RESULT = 55555; //查询结果
+
+
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/TradeSummary.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeSummary.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/TradeSummary.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeSummary.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/Tradetype.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Tradetype.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/Tradetype.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/Tradetype.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/TranstypeCode.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TranstypeCode.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/TranstypeCode.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/TranstypeCode.java
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/WebConstant.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/WebConstant.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/framework/util/WebConstant.java
rename to payapi/src/main/java/com/supwisdom/dlpay/framework/util/WebConstant.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/XmlUtils.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/XmlUtils.java
new file mode 100644
index 0000000..996af8e
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/XmlUtils.java
@@ -0,0 +1,75 @@
+package com.supwisdom.dlpay.framework.util;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import java.io.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class XmlUtils {
+ public static <T> String getObjectToXml(T object) throws IOException {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+
+ try {
+ JAXBContext context = JAXBContext.newInstance(object.getClass());
+ // 将对象转变为xml Object------XML
+ // 指定对应的xml文件
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_ENCODING, "gbk");//编码格式
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);// 是否格式化生成的xml串
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);// 是否省略xml头信息
+
+ // 将对象转换为对应的XML文件
+ marshaller.marshal(object, byteArrayOutputStream);
+ } catch (JAXBException e) {
+
+ e.printStackTrace();
+ }
+ // 转化为字符串返回
+ String xmlContent = new String(byteArrayOutputStream.toByteArray(),
+ "gbk");
+ return xmlContent;
+ }
+
+ public static <T> T getXmlToObject(String xmlContent, String charset, Class clazz) {
+ try {
+ JAXBContext context = JAXBContext.newInstance(clazz);
+ // xml转换为对象 XML------Object
+ InputStream inputStream;
+ try {
+ inputStream = new ByteArrayInputStream(
+ xmlContent.getBytes(charset));
+ Unmarshaller um = context.createUnmarshaller();
+
+ return (T) um.unmarshal(inputStream);
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } catch (JAXBException e) {
+
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static Map<String, String> parseXml(String xml) throws Exception {
+ Map<String, String> map = new HashMap<String, String>();
+ Document document = DocumentHelper.parseText(xml);
+ Element root = document.getRootElement();
+ List<Element> elementList = root.elements();
+ for (Element e : elementList)
+ map.put(e.getName(), e.getText());
+ return map;
+ }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/AccountPerson.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/AccountPerson.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/AccountPerson.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/AccountPerson.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/FunctionSearchBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/FunctionSearchBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/FunctionSearchBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/FunctionSearchBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/IdTypeBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/IdTypeBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/IdTypeBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/IdTypeBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/LogBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/LogBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/LogBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/LogBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/OperatorSearchBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/OperatorSearchBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/OperatorSearchBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/OperatorSearchBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/PageBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/PageBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/PageBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/PageBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/PersonParamBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/PersonParamBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/PersonParamBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/PersonParamBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessInfo.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessInfo.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessInfo.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessInfo.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessShowBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessShowBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessShowBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessShowBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/ShopConfigBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopConfigBean.java
similarity index 83%
rename from src/main/java/com/supwisdom/dlpay/system/bean/ShopConfigBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopConfigBean.java
index 1e477e7..9085d2e 100644
--- a/src/main/java/com/supwisdom/dlpay/system/bean/ShopConfigBean.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopConfigBean.java
@@ -3,7 +3,7 @@
public class ShopConfigBean {
private String shopaccno;
private String shopname;
- private String paytype;
+ private String sourceType;
private String paydesc;
private boolean consumeEnable;
private boolean anonymousEnable;
@@ -12,10 +12,10 @@
public ShopConfigBean() {
}
- public ShopConfigBean(String shopaccno, String shopname, String paytype, String paydesc, boolean consumeEnable, boolean anonymousEnable, boolean reverseEnable) {
+ public ShopConfigBean(String shopaccno, String shopname, String sourceType, String paydesc, boolean consumeEnable, boolean anonymousEnable, boolean reverseEnable) {
this.shopaccno = shopaccno;
this.shopname = shopname;
- this.paytype = paytype;
+ this.sourceType = sourceType;
this.paydesc = paydesc;
this.consumeEnable = consumeEnable;
this.anonymousEnable = anonymousEnable;
@@ -38,12 +38,12 @@
this.shopname = shopname;
}
- public String getPaytype() {
- return paytype;
+ public String getSourceType() {
+ return sourceType;
}
- public void setPaytype(String paytype) {
- this.paytype = paytype;
+ public void setSourceType(String sourceType) {
+ this.sourceType = sourceType;
}
public String getPaydesc() {
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/ShopdtlSearchBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopdtlSearchBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/ShopdtlSearchBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopdtlSearchBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayInfo.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayInfo.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayInfo.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayInfo.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayShowBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayShowBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayShowBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayShowBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDetailShowBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDetailShowBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/SubjectDetailShowBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDetailShowBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/UserdtlSearchBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/UserdtlSearchBean.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/bean/UserdtlSearchBean.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/UserdtlSearchBean.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/ZTreeNode.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ZTreeNode.java
similarity index 89%
rename from src/main/java/com/supwisdom/dlpay/system/bean/ZTreeNode.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/bean/ZTreeNode.java
index 61e122e..8a4c964 100644
--- a/src/main/java/com/supwisdom/dlpay/system/bean/ZTreeNode.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ZTreeNode.java
@@ -8,7 +8,7 @@
private boolean checked;
private boolean open;
- private Integer shoptype; //商户类别,商户树用到
+ private String shoptype; //商户类别,商户树用到
private String shopaccno; //商户账号
private String iconSkin; //自定义图标
@@ -52,11 +52,11 @@
this.checked = checked;
}
- public Integer getShoptype() {
+ public String getShoptype() {
return shoptype;
}
- public void setShoptype(Integer shoptype) {
+ public void setShoptype(String shoptype) {
this.shoptype = shoptype;
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/DictPoolAction.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/DictPoolAction.java
similarity index 62%
rename from src/main/java/com/supwisdom/dlpay/system/controller/DictPoolAction.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/controller/DictPoolAction.java
index af00076..aa8bf76 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/DictPoolAction.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/DictPoolAction.java
@@ -5,6 +5,7 @@
import com.supwisdom.dlpay.system.service.DictionaryProxy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@@ -13,17 +14,23 @@
@RestController
public class DictPoolAction {
- @Autowired
- private DictionaryProxy dictionaryProxy;
+ private final DictionaryProxy dictionaryProxy;
+
+ public DictPoolAction(DictionaryProxy dictionaryProxy) {
+ this.dictionaryProxy = dictionaryProxy;
+ }
@GetMapping("/dictpool")
- public Map getDictDataByDicttype(@FormParam("dicttype") String dictType, HttpServletRequest request) {
- dictType = request.getParameter("dicttype");
+ public Map getDictDataByDicttype(@RequestParam("dicttype") String dictType, HttpServletRequest request) {
+ if (dictType == null) {
+ dictType = request.getParameter("dicttype");
+ }
return dictionaryProxy.getDictionaryAsMap(dictType);
}
@GetMapping("/dictrefresh")
public JsonResult refreshDict() {
+ dictionaryProxy.refreshDictionary();
return JsonResult.ok();
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java
similarity index 97%
rename from src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java
index 05d5977..c2dc9d1 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java
@@ -123,6 +123,9 @@
@ResponseBody
public JsonResult addres(@RequestBody TResource resource) {
if (resource != null) {
+ if(null == resource.getTenantId()){
+ resource.setTenantId(TenantContext.getTenantSchema());
+ }
return functionService.saveRes(resource);
} else {
return JsonResult.error("添加失败");
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
similarity index 96%
rename from src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
index dc0ef57..4ef27de 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
@@ -5,6 +5,7 @@
import com.supwisdom.dlpay.framework.security.OperUtil;
import com.supwisdom.dlpay.framework.util.PageResult;
import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.framework.util.TradeDict;
import com.supwisdom.dlpay.framework.util.WebConstant;
import com.supwisdom.dlpay.system.bean.FunctionSearchBean;
import com.supwisdom.dlpay.system.bean.LogBean;
@@ -95,7 +96,8 @@
public JsonResult add(@RequestParam("operid") String operid, @RequestParam("opercode") String opercode,
@RequestParam("opername") String opername, @RequestParam("sex") String sex,
@RequestParam("mobile") String mobile, @RequestParam("email") String email,
- @RequestParam("roleId") String roleId, Model map) {
+ @RequestParam("roleId") String roleId, @RequestParam(value = "thirdadmin", required = false) String thirdadmin,
+ Model map) {
if (operatorService.checkOpercodeExists(opercode, operid)) {
return JsonResult.error("账号重复");
}
@@ -103,9 +105,10 @@
operator.setOpername(opername);
operator.setOpercode(opercode);
operator.setOperid(operid);
- operator.setMobile(mobile);
+ operator.setMobile(StringUtil.isEmpty(mobile)?null:mobile.trim());
operator.setEmail(email);
operator.setSex(sex);
+ operator.setThirdadmin("yes".equalsIgnoreCase(thirdadmin) ? "yes" : "no");
boolean ret = operatorService.saveOperator(operator, roleId);
if (ret) {
return JsonResult.ok("操作成功");
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
similarity index 76%
rename from src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
index 7a16f3b..6d46a45 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
@@ -2,17 +2,17 @@
import com.supwisdom.dlpay.api.bean.JsonResult;
import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
+import com.supwisdom.dlpay.api.domain.TSourceTypeConfig;
import com.supwisdom.dlpay.framework.domain.TApiClient;
import com.supwisdom.dlpay.framework.domain.TBusinesspara;
import com.supwisdom.dlpay.framework.domain.TSyspara;
import com.supwisdom.dlpay.framework.service.SystemUtilService;
import com.supwisdom.dlpay.framework.tenant.TenantContext;
import com.supwisdom.dlpay.framework.util.*;
+import com.supwisdom.dlpay.system.service.DictionaryProxy;
import com.supwisdom.dlpay.system.service.ParamService;
import com.supwisdom.dlpay.util.ConstantUtil;
import com.supwisdom.dlpay.util.WebCheckException;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -24,10 +24,17 @@
@Controller
public class ParamController {
- @Autowired
- private ParamService paramService;
- @Autowired
- private SystemUtilService systemUtilService;
+ private final ParamService paramService;
+ private final SystemUtilService systemUtilService;
+ private final DictionaryProxy dictionaryProxy;
+
+ public ParamController(ParamService paramService,
+ SystemUtilService systemUtilService,
+ DictionaryProxy dictionaryProxy) {
+ this.paramService = paramService;
+ this.systemUtilService = systemUtilService;
+ this.dictionaryProxy = dictionaryProxy;
+ }
@GetMapping("/param/syspara")
public String sysparaView() {
@@ -230,11 +237,11 @@
@PreAuthorize("hasPermission('/param/load4addapiclient','')")
public String load4AddApiclientPara(Model model) {
Map<String, String> roles = new HashMap<>(0);
- roles.put("ROLE_THIRD_COMMON", "ROLE_THIRD_COMMON");
- roles.put("ROLE_THIRD_CONSUME", "ROLE_THIRD_CONSUME");
- roles.put("ROLE_THIRD_DEPOSIT", "ROLE_THIRD_DEPOSIT");
- roles.put("ROLE_THIRD_SHOP", "ROLE_THIRD_SHOP");
- roles.put("ROLE_THIRD_ADMIN", "ROLE_THIRD_ADMIN");
+ roles.put("ROLE_THIRD_COMMON", "调用通用接口权限");
+ roles.put("ROLE_THIRD_CONSUME", "调用消费接口权限");
+ roles.put("ROLE_THIRD_DEPOSIT", "调用充值接口权限");
+ roles.put("ROLE_THIRD_SHOP", "调用商户接口权限");
+ roles.put("ROLE_THIRD_ADMIN", "调用用户接口权限");
model.addAttribute("rolelist", roles);
return "system/param/apiclientform";
}
@@ -355,45 +362,47 @@
* 支付能力配置
* ====================================================
*/
- @GetMapping("/param/paytype")
- public String paytypeView() {
- return "system/param/paytype";
+ @GetMapping("/param/sourcetype")
+ public String sourcetypeView() {
+ return "system/param/sourcetype";
}
- @GetMapping("/param/paytypelist")
- @PreAuthorize("hasPermission('/param/paytype','')")
+ @GetMapping("/param/sourcetypelist")
+ @PreAuthorize("hasPermission('/param/sourcetype','')")
@ResponseBody
public PageResult<TSourceType> getPaytypeDataList(@RequestParam("page") Integer pageNo,
@RequestParam("limit") Integer pageSize,
- @RequestParam(value = "paytype", required = false) String paytype) {
+ @RequestParam(value = "sourcetype", required = false) String sourcetype) {
try {
if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return paramService.getSourceTypePage(paytype, pageNo, pageSize);
+ return paramService.getSourceTypePage(sourcetype, pageNo, pageSize);
} catch (Exception e) {
e.printStackTrace();
return new PageResult<>(99, "系统查询错误");
}
}
- @GetMapping("/param/load4addpaytype")
- @PreAuthorize("hasPermission('/param/load4addpaytype','')")
+ @GetMapping("/param/load4addsourcetype")
+ @PreAuthorize("hasPermission('/param/load4addsourcetype','')")
public String load4AddPaytype(Model model) {
- return "system/param/paytypeform";
+ model.addAttribute("subjectList",
+ dictionaryProxy.getDictionaryAsList(Dictionary.ALL_SUBJECT));
+ return "system/param/sourcetypeform";
}
- @PostMapping("/param/updatepaytypestate")
- @PreAuthorize("hasPermission('/param/updatepaytypestate','')")
+ @PostMapping("/param/updatesourcetypestate")
+ @PreAuthorize("hasPermission('/param/updatesourcetypestate','')")
@ResponseBody
- public JsonResult updatePaytypeState(@RequestParam("paytype") String paytype,
+ public JsonResult updatePaytypeState(@RequestParam("sourcetype") String sourcetype,
@RequestParam("state") Boolean state,
@RequestParam(value = "optype", required = false) String optype) {
- if (StringUtil.isEmpty(paytype)
- || (!StringUtil.isEmpty(optype) && !"charge".equals(optype) && !"consume".equals(optype) && !"anonymous".equals(optype))) {
+ if (StringUtil.isEmpty(sourcetype)
+ || (!StringUtil.isEmpty(optype) && !"charge".equals(optype) && !"consume".equals(optype) && !"anonymous".equals(optype) && !"reversable".equals(optype) && !"checkable".equals(optype))) {
return JsonResult.error("参数传递错误");
}
try {
- TSourceType tPaytype = paramService.getSourceType(paytype);
+ TSourceType tPaytype = paramService.getSourceType(sourcetype);
if (null == tPaytype) {
return JsonResult.error("支付方式不存在!");
}
@@ -412,6 +421,16 @@
return JsonResult.error("状态错误,请重新查询后操作");
}
tPaytype.setAnonymousEnable(state);
+ } else if ("reversable".equals(optype)) {
+ if (state.equals(tPaytype.getReversable())) {
+ return JsonResult.error("状态错误,请重新查询后操作");
+ }
+ tPaytype.setReversable(state);
+ } else if ("checkable".equals(optype)) {
+ if (state.equals(tPaytype.getCheckable())) {
+ return JsonResult.error("状态错误,请重新查询后操作");
+ }
+ tPaytype.setCheckable(state);
} else {
if (state.equals(tPaytype.getEnable())) {
return JsonResult.error("状态错误,请重新查询后操作");
@@ -430,20 +449,20 @@
}
}
- @PostMapping("/param/updatepaytypename")
- @PreAuthorize("hasPermission('/param/updatepaytypename','')")
+ @PostMapping("/param/updatesourcetypename")
+ @PreAuthorize("hasPermission('/param/updatesourcetypename','')")
@ResponseBody
- public JsonResult updatePaytypeName(@RequestParam("paytype") String paytype,
- @RequestParam("paydesc") String paydesc) {
- if (StringUtil.isEmpty(paytype) || StringUtil.isEmpty(paydesc)) {
+ public JsonResult updatePaytypeName(@RequestParam("sourcetype") String sourcetype,
+ @RequestParam("paydesc") String desc) {
+ if (StringUtil.isEmpty(sourcetype) || StringUtil.isEmpty(desc)) {
return JsonResult.error("参数传递错误");
}
try {
- TSourceType tPaytype = paramService.getSourceType(paytype);
+ TSourceType tPaytype = paramService.getSourceType(sourcetype);
if (null == tPaytype) {
return JsonResult.error("支付方式不存在!");
}
- tPaytype.setPaydesc(paydesc.trim());
+ tPaytype.setPaydesc(desc.trim());
if (paramService.saveOrUpdateSourceType(tPaytype)) {
return JsonResult.ok("修改成功");
} else {
@@ -455,12 +474,12 @@
}
}
- @PostMapping("/param/deletepaytype")
- @PreAuthorize("hasPermission('/param/deletepaytype','')")
+ @PostMapping("/param/deletesourcetype")
+ @PreAuthorize("hasPermission('/param/deletesourcetype','')")
@ResponseBody
- public JsonResult deletePaytype(@RequestParam("paytype") String paytype) {
+ public JsonResult deletePaytype(@RequestParam("sourcetype") String sourcetype) {
try {
- TSourceType tPaytype = paramService.getSourceType(paytype);
+ TSourceType tPaytype = paramService.getSourceType(sourcetype);
if (null == tPaytype) {
return JsonResult.error("支付方式不存在!");
}
@@ -475,29 +494,37 @@
}
}
- @PostMapping("/param/addpaytype")
- @PreAuthorize("hasPermission('/param/addpaytype','')")
+ @PostMapping("/param/addsourcetype")
+ @PreAuthorize("hasPermission('/param/addsourcetype','')")
@ResponseBody
- public JsonResult addPaytype(@RequestParam("paytype") String paytype,
+ public JsonResult addPaytype(@RequestParam("sourcetype") String sourcetype,
@RequestParam(value = "enable", required = false, defaultValue = "no") String enable,
@RequestParam(value = "chargeEnable", required = false, defaultValue = "no") String chargeEnable,
@RequestParam(value = "consumeEnable", required = false, defaultValue = "no") String consumeEnable,
@RequestParam(value = "anonymousEnable", required = false, defaultValue = "no") String anonymousEnable,
+ @RequestParam(value = "reversable", required = false, defaultValue = "no") String reversable,
+ @RequestParam(value = "checkable", required = false, defaultValue = "no") String checkable,
+ @RequestParam(value = "paySubjno", required = false, defaultValue = "-") String paySubjno,
+ @RequestParam(value = "depositeSubjno", required = false, defaultValue = "-") String depositeSubjno,
@RequestParam("paydesc") String paydesc) {
try {
- TSourceType tPaytype = paramService.getSourceType(paytype);
- if (null != tPaytype) {
+ TSourceType sourcetypeBean = paramService.getSourceType(sourcetype);
+ if (null != sourcetypeBean) {
return JsonResult.error("支付方式已经存在");
}
- tPaytype = new TSourceType();
- tPaytype.setSourceType(paytype.trim());
+ sourcetypeBean = new TSourceType();
+ sourcetypeBean.setSourceType(sourcetype.trim());
if (StringUtil.isEmpty(paydesc)) return JsonResult.error("支付名称不能为空!");
- tPaytype.setPaydesc(paydesc.trim());
- tPaytype.setEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(enable));
- tPaytype.setChargeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(chargeEnable));
- tPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable));
- tPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable));
- if (paramService.saveOrUpdateSourceType(tPaytype)) {
+ sourcetypeBean.setPaydesc(paydesc.trim());
+ sourcetypeBean.setEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(enable));
+ sourcetypeBean.setChargeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(chargeEnable));
+ sourcetypeBean.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable));
+ sourcetypeBean.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable));
+ sourcetypeBean.setReversable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(reversable));
+ sourcetypeBean.setCheckable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(checkable));
+ sourcetypeBean.setPaySubjno(paySubjno);
+ sourcetypeBean.setDepositeSubjno(depositeSubjno);
+ if (paramService.saveOrUpdateSourceType(sourcetypeBean)) {
return JsonResult.ok("新增成功");
} else {
return JsonResult.error("新增失败");
@@ -508,10 +535,10 @@
}
}
- @GetMapping("/param/checkpaytype")
+ @GetMapping("/param/checksourcetype")
@ResponseBody
- public JsonResult checkPaytype(@RequestParam("paytype") String paytype) {
- TSourceType tPaytype = paramService.getSourceType(paytype);
+ public JsonResult checkPaytype(@RequestParam("sourcetype") String sourcetype) {
+ TSourceType tPaytype = paramService.getSourceType(sourcetype);
if (null != tPaytype) {
return JsonResult.error("支付方式已经存在");
} else {
@@ -519,28 +546,28 @@
}
}
- @GetMapping("/param/load4paytypeconfig")
- @PreAuthorize("hasPermission('/param/load4paytypeconfig','')")
- public String load4PaytypeConfig(@RequestParam("paytype") String paytype, Model model) {
- List<TPaytypeConfig> configList = paramService.getSourceTypeConfigList(paytype);
+ @GetMapping("/param/load4sourcetypeconfig")
+ @PreAuthorize("hasPermission('/param/load4sourcetypeconfig','')")
+ public String load4PaytypeConfig(@RequestParam("sourcetype") String sourceType, Model model) {
+ List<TSourceTypeConfig> configList = paramService.getSourceTypeConfigList(sourceType);
model.addAttribute("configlist", configList);
- model.addAttribute("paytype", paytype);
- return "system/param/paytypeconfig";
+ model.addAttribute("sourcetype", sourceType);
+ return "system/param/sourcetypeconfig";
}
- @PostMapping("/param/addpaytypeconfig")
- @PreAuthorize("hasPermission('/param/addpaytypeconfig','')")
+ @PostMapping("/param/addsourcetypeconfig")
+ @PreAuthorize("hasPermission('/param/addsourcetypeconfig','')")
@ResponseBody
public JsonResult addPaytypeConfig(@RequestBody Map<String, String> param) {
- String paytypeHtmlKey = "hid_paytype"; //页面上传来paytype的KEY
- if (null == param || StringUtil.isEmpty(param.get(paytypeHtmlKey))) {
+ String sourcetypeHtmlKey = "hid_sourcetype"; //页面上传来sourcetype的KEY
+ if (null == param || StringUtil.isEmpty(param.get(sourcetypeHtmlKey))) {
return JsonResult.error("参数传递错误");
}
try {
- String paytype = param.get(paytypeHtmlKey).trim();
- param.remove(paytypeHtmlKey);
- if (paramService.saveSourceTypeConfig(paytype, param)) {
+ String sourcetype = param.get(sourcetypeHtmlKey).trim();
+ param.remove(sourcetypeHtmlKey);
+ if (paramService.saveSourceTypeConfig(sourcetype, param)) {
return JsonResult.ok("配置成功");
} else {
return JsonResult.error("配置失败");
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/RoleController.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/RoleController.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/controller/RoleController.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/controller/RoleController.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
similarity index 76%
rename from src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
index f7f69bb..7afabc4 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
@@ -2,8 +2,11 @@
import com.supwisdom.dlpay.api.bean.JsonResult;
import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TShopPaytype;
-import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig;
+import com.supwisdom.dlpay.api.domain.TShopSourceType;
+import com.supwisdom.dlpay.api.domain.TShopSourceTypeConfig;
+import com.supwisdom.dlpay.api.types.IDTypes;
+import com.supwisdom.dlpay.api.types.ShopTypes;
+import com.supwisdom.dlpay.framework.domain.TDictionary;
import com.supwisdom.dlpay.framework.domain.TShop;
import com.supwisdom.dlpay.framework.domain.TShopacc;
import com.supwisdom.dlpay.framework.service.SystemUtilService;
@@ -13,6 +16,7 @@
import com.supwisdom.dlpay.system.service.ParamService;
import com.supwisdom.dlpay.system.service.ShopDataService;
import com.supwisdom.dlpay.util.ConstantUtil;
+import com.supwisdom.dlpay.util.EnumCheck;
import com.supwisdom.dlpay.util.WebCheckException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -35,8 +39,12 @@
@Autowired
private DictionaryProxy dictionaryProxy;
+ private EnumCheck<ShopTypes, String> shopTypeCheck = new EnumCheck<>();
+
@GetMapping("/shop/index")
- public String shopView() {
+ public String shopView(Model model) {
+ model.addAttribute(Dictionary.IDTYPE,
+ dictionaryProxy.<TDictionary>getDictionaryAsList(Dictionary.IDTYPE));
return "system/shop/index";
}
@@ -84,7 +92,7 @@
@PreAuthorize("hasPermission('/shop/saveorupdate','')")
@ResponseBody
public JsonResult saveOrUpdateShop(@RequestParam("shopid") Integer shopid, @RequestParam("shopname") String shopname,
- @RequestParam("fshopid") Integer fshopid, @RequestParam("shoptype") Integer shoptype,
+ @RequestParam("fshopid") Integer fshopid, @RequestParam("shoptype") String shoptype,
@RequestParam(value = "contactman", required = false) String contactman,
@RequestParam(value = "idtype", required = false) String idtype,
@RequestParam(value = "idno", required = false) String idno,
@@ -93,7 +101,8 @@
@RequestParam(value = "email", required = false) String email,
@RequestParam(value = "addr", required = false) String addr,
@RequestParam(value = "zipcode", required = false) String zipcode) {
- if (null == shopid || StringUtil.isEmpty(shopname) || null == fshopid || (shoptype != 0 && shoptype != 1)) {
+ if (null == shopid || StringUtil.isEmpty(shopname) || null == fshopid
+ || !shopTypeCheck.isInEnums(shoptype, ShopTypes.NORMAL, ShopTypes.GROUP, ShopTypes.ROOT)) {
return JsonResult.error("参数传递错误");
}
@@ -115,17 +124,16 @@
}
shop.setFshopid(fshopid);
shop.setShopname(shopname);
-// shop.setShoptype(shoptype); //商户类型不能改
}
shop.setContactman(contactman == null ? null : contactman.trim());
shop.setIdno(idno == null ? null : idno.trim());
shop.setIdtype(idtype == null ? null : idtype.trim());
if (!StringUtil.isEmpty(shop.getIdno()) && StringUtil.isEmpty(shop.getIdtype())) {
return JsonResult.error("填写证件号时必须制定证件类型!");
- } else if (!StringUtil.isEmpty(shop.getIdno()) && "1".equals(shop.getIdtype()) && !StringUtil.isIdentity(shop.getIdno())) {
+ } else if (!StringUtil.isEmpty(shop.getIdno()) && IDTypes.IDCARD.value().equals(shop.getIdtype()) && !StringUtil.isIdentity(shop.getIdno())) {
return JsonResult.error("身份证格式错误!");
}
- shop.setMobile(mobile == null ? null : mobile);
+ shop.setMobile(mobile);
if (!StringUtil.isEmpty(shop.getMobile()) && !StringUtil.isMobile(shop.getMobile())) {
return JsonResult.error("请正确填写手机号!");
}
@@ -160,7 +168,7 @@
public String shopConfigView(Model model) {
// model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
model.addAttribute(Dictionary.PAY_TYPE,
- dictionaryProxy.<TSourceType>getDictionaryObject(Dictionary.SOURCE_TYPE));
+ dictionaryProxy.<TSourceType>getDictionaryAsList(Dictionary.SOURCE_TYPE));
return "system/shop/config";
}
@@ -171,36 +179,36 @@
return JsonResult.ok("OK").put("data", shopDataService.getAllShopNodes());
}
- @GetMapping("/shop/shoppaytypelist")
- @PreAuthorize("hasPermission('/shop/shoppaytypelist','')")
+ @GetMapping("/shop/shopsourcetypelist")
+ @PreAuthorize("hasPermission('/shop/shopsourcetypelist','')")
@ResponseBody
public PageResult<ShopConfigBean> getShopPaytypeList(@RequestParam("page") Integer pageNo,
@RequestParam("limit") Integer pageSize,
- @RequestParam(value = "paytype", required = false) String paytype,
+ @RequestParam(value = "sourcetype", required = false) String sourcetype,
@RequestParam(value = "shopaccno", required = false) String shopaccno) {
try {
if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return shopDataService.getShopPaytypeInfos(shopaccno, paytype, pageNo, pageSize);
+ return shopDataService.getShopPaytypeInfos(shopaccno, sourcetype, pageNo, pageSize);
} catch (Exception e) {
e.printStackTrace();
return new PageResult<>(99, "系统查询错误");
}
}
- @PostMapping("/shop/updatepaytypestat")
- @PreAuthorize("hasPermission('/shop/updatepaytypestat','')")
+ @PostMapping("/shop/updatesourcetypestat")
+ @PreAuthorize("hasPermission('/shop/updatesourcetypestat','')")
@ResponseBody
- public JsonResult updateShopPaytypeStat(@RequestParam("shopaccno") String shopaccno, @RequestParam("paytype") String paytype,
+ public JsonResult updateShopPaytypeStat(@RequestParam("shopaccno") String shopaccno, @RequestParam("sourceType") String sourcetype,
@RequestParam("state") String state, @RequestParam("optype") String optype) {
- if (StringUtil.isEmpty(shopaccno) || StringUtil.isEmpty(paytype)
+ if (StringUtil.isEmpty(shopaccno) || StringUtil.isEmpty(sourcetype)
|| (!ConstantUtil.ENABLE_NO.equals(state) && !ConstantUtil.ENABLE_YES.equals(state))
- || (!"consume".equals(optype) && !"anonymous".equals(optype) && !"refund".equals(optype))) {
+ || (!"consume".equals(optype) && !"anonymous".equals(optype) && !"reverse".equals(optype))) {
return JsonResult.error("参数传递错误");
}
try {
- TShopPaytype shopPaytype = shopDataService.getShopPaytype(shopaccno.trim(), paytype.trim());
+ TShopSourceType shopPaytype = shopDataService.getShopPaytype(shopaccno.trim(), sourcetype.trim());
if (null == shopPaytype) {
return JsonResult.error("商户支付能力不存在!");
}
@@ -233,41 +241,41 @@
}
}
- @GetMapping("/shop/load4addpaytype")
- @PreAuthorize("hasPermission('/shop/load4addpaytype','')")
+ @GetMapping("/shop/load4addsourcetype")
+ @PreAuthorize("hasPermission('/shop/load4addsourcetype','')")
public String load4AddShopPaytype(Model model) {
model.addAttribute(Dictionary.PAY_TYPE,
dictionaryProxy.getDictionaryAsList(Dictionary.SOURCE_TYPE));
return "system/shop/configform";
}
- @PostMapping("/shop/addshoppaytype")
- @PreAuthorize("hasPermission('/shop/addshoppaytype','')")
+ @PostMapping("/shop/addshopsourcetype")
+ @PreAuthorize("hasPermission('/shop/addshopsourcetype','')")
@ResponseBody
- public JsonResult addShoppaytype(@RequestParam("shopaccno") String shopaccno,
- @RequestParam("paytype") String paytype,
- @RequestParam(value = "consumeEnable", required = false, defaultValue = "no") String consumeEnable,
- @RequestParam(value = "anonymousEnable", required = false, defaultValue = "no") String anonymousEnable,
- @RequestParam(value = "reverseEnable", required = false, defaultValue = "no") String reverseEnable) {
- if (StringUtil.isEmpty(shopaccno) || StringUtil.isEmpty(paytype)) {
+ public JsonResult addShopsourcetype(@RequestParam("shopaccno") String shopaccno,
+ @RequestParam("sourcetype") String sourcetype,
+ @RequestParam(value = "consumeEnable", required = false, defaultValue = "no") String consumeEnable,
+ @RequestParam(value = "anonymousEnable", required = false, defaultValue = "no") String anonymousEnable,
+ @RequestParam(value = "reverseEnable", required = false, defaultValue = "no") String reverseEnable) {
+ if (StringUtil.isEmpty(shopaccno) || StringUtil.isEmpty(sourcetype)) {
return JsonResult.error("参数传递错误");
}
try {
TShopacc shopacc = shopDataService.getShopaccByAccno(shopaccno.trim());
- TSourceType tPaytype = paramService.getSourceType(paytype.trim());
+ TSourceType tPaytype = paramService.getSourceType(sourcetype.trim());
if (null == shopacc) {
return JsonResult.error("商户账户不存在!");
}
if (null == tPaytype) {
return JsonResult.error("支付方式在系统中不存在!");
}
- TShopPaytype shopPaytype = shopDataService.getShopPaytype(shopaccno.trim(), paytype.trim());
+ TShopSourceType shopPaytype = shopDataService.getShopPaytype(shopaccno.trim(), sourcetype.trim());
if (null != shopPaytype) {
return JsonResult.error("商户该支付能力已经存在!");
}
- shopPaytype = new TShopPaytype();
+ shopPaytype = new TShopSourceType();
shopPaytype.setShopaccno(shopacc.getShopaccno());
- shopPaytype.setPaytype(tPaytype.getSourceType());
+ shopPaytype.setSourceType(tPaytype.getSourceType());
shopPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable));
shopPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable));
shopPaytype.setReverseEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(reverseEnable));
@@ -283,33 +291,33 @@
}
}
- @GetMapping("/shop/load4paytypepara")
- @PreAuthorize("hasPermission('/shop/load4paytypepara','')")
+ @GetMapping("/shop/load4sourcetypepara")
+ @PreAuthorize("hasPermission('/shop/load4sourcetypepara','')")
public String load4AddShopPaytypePara(@RequestParam("shopaccno") String shopaccno,
- @RequestParam("paytype") String paytype,
+ @RequestParam("sourceType") String sourcetype,
Model model) {
- List<TShopPaytypeConfig> configList = shopDataService.getShopPaytypeConfigs(shopaccno, paytype);
+ List<TShopSourceTypeConfig> configList = shopDataService.getShopPaytypeConfigs(shopaccno, sourcetype);
model.addAttribute("configlist", configList);
model.addAttribute("shopaccno", shopaccno);
- model.addAttribute("paytype", paytype);
+ model.addAttribute("sourcetype", sourcetype);
return "system/shop/configpara";
}
- @PostMapping("/shop/addpaytypepara")
- @PreAuthorize("hasPermission('/shop/addpaytypepara','')")
+ @PostMapping("/shop/addsourcetypepara")
+ @PreAuthorize("hasPermission('/shop/addsourcetypepara','')")
@ResponseBody
public JsonResult addShopPaytypePara(@RequestBody Map<String, String> param) {
String shopaccnoHtmlKey = "hid_shopaccno"; //页面上传来shopaccno的KEY
- String paytypeHtmlKey = "hid_paytype"; //页面上传来paytype的KEY
- if (null == param || StringUtil.isEmpty(param.get(paytypeHtmlKey)) || StringUtil.isEmpty(param.get(shopaccnoHtmlKey))) {
+ String sourcetypeHtmlKey = "hid_sourcetype"; //页面上传来sourcetype的KEY
+ if (null == param || StringUtil.isEmpty(param.get(sourcetypeHtmlKey)) || StringUtil.isEmpty(param.get(shopaccnoHtmlKey))) {
return JsonResult.error("参数传递错误");
}
try {
String shopaccno = param.get(shopaccnoHtmlKey).trim();
- String paytype = param.get(paytypeHtmlKey).trim();
+ String sourcetype = param.get(sourcetypeHtmlKey).trim();
param.remove(shopaccnoHtmlKey);
- param.remove(paytypeHtmlKey);
- if (shopDataService.saveOrUpdateShopPaytypeConfig(shopaccno, paytype, param)) {
+ param.remove(sourcetypeHtmlKey);
+ if (shopDataService.saveOrUpdateShopPaytypeConfig(shopaccno, sourcetype, param)) {
return JsonResult.ok("配置成功");
} else {
return JsonResult.error("配置失败");
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
new file mode 100644
index 0000000..31c7fae
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
@@ -0,0 +1,164 @@
+package com.supwisdom.dlpay.system.controller;
+
+import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.api.domain.TAccount;
+import com.supwisdom.dlpay.api.domain.TPerson;
+import com.supwisdom.dlpay.api.domain.TPersonIdentity;
+import com.supwisdom.dlpay.api.domain.TPointsAccount;
+import com.supwisdom.dlpay.framework.domain.TOperator;
+import com.supwisdom.dlpay.framework.util.Dictionary;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.framework.util.WebConstant;
+import com.supwisdom.dlpay.system.bean.IdTypeBean;
+import com.supwisdom.dlpay.system.bean.PersonParamBean;
+import com.supwisdom.dlpay.system.service.DictionaryProxy;
+import com.supwisdom.dlpay.system.service.UserDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Controller
+public class UserController {
+ @Autowired
+ private UserDataService userDataService;
+
+ @Autowired
+ private DictionaryProxy dictionaryProxy;
+
+ @GetMapping("/user/index")
+ public String index() {
+ return "system/user/index";
+ }
+
+ @GetMapping("/user/list")
+ @PreAuthorize("hasPermission('/user/list','')")
+ @ResponseBody
+ public PageResult<TPerson> getDataList(@RequestParam("page") Integer pageNo,
+ @RequestParam("limit") Integer pageSize,
+ @RequestParam(value = "searchkey", required = false) String searchKey) {
+ try {
+ if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+ if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+ PersonParamBean searchBean = new PersonParamBean();
+ searchBean.setPageNo(pageNo);
+ searchBean.setName(searchKey);
+ searchBean.setPageSize(pageSize);
+ return userDataService.getPersonsByKey(searchBean);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new PageResult<>(99, "系统查询错误");
+ }
+ }
+
+ @GetMapping("/user/loadadd")
+ public String add(ModelMap map) {
+ map.put(Dictionary.IDTYPE, dictionaryProxy.getDictionaryAsList(Dictionary.IDTYPE));
+ return "system/user/add";
+ }
+
+ @PostMapping("/user/add")
+ @PreAuthorize("hasPermission('/user/add','')")
+ @ResponseBody
+ public JsonResult add(@RequestBody TPerson person) {
+ if (StringUtil.isEmpty(person.getName())
+ || StringUtil.isEmpty(person.getSex())
+ || StringUtil.isEmpty(person.getIdno())
+ || StringUtil.isEmpty(person.getIdtype())
+ || StringUtil.isEmpty(person.getMobile())) {
+ return JsonResult.error("参数错误");
+ }
+ return userDataService.saveUser(person);
+ }
+
+ @PostMapping("/user/del")
+ @PreAuthorize("hasPermission('/user/del','')")
+ @ResponseBody
+ public JsonResult del(@RequestParam String userid) {
+ if (StringUtil.isEmpty(userid)) {
+ return JsonResult.error("参数错误");
+ }
+ return userDataService.deleteUser(userid);
+ }
+
+ @GetMapping("/user/acc")
+ public String acc() {
+ return "system/user/account";
+ }
+
+ @GetMapping("/user/account")
+ @PreAuthorize("hasPermission('/user/account','')")
+ @ResponseBody
+ public PageResult<TAccount> getDataAccountList(@RequestParam("page") Integer pageNo,
+ @RequestParam("limit") Integer pageSize,
+ @RequestParam(value = "searchkey", required = false) String searchKey) {
+ try {
+ if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+ if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+ PersonParamBean searchBean = new PersonParamBean();
+ searchBean.setPageNo(pageNo);
+ searchBean.setName(searchKey);
+ searchBean.setPageSize(pageSize);
+ return userDataService.getAccountsByKey(searchBean);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new PageResult<>(99, "系统查询错误");
+ }
+ }
+
+ @GetMapping("/user/point")
+ public String point() {
+ return "system/user/point";
+ }
+
+ @GetMapping("/user/pointlist")
+ @PreAuthorize("hasPermission('/user/pointlist','')")
+ @ResponseBody
+ public PageResult<TPointsAccount> getDataPointList(@RequestParam("page") Integer pageNo,
+ @RequestParam("limit") Integer pageSize,
+ @RequestParam(value = "searchkey", required = false) String searchKey) {
+ try {
+ if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+ if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+ PersonParamBean searchBean = new PersonParamBean();
+ searchBean.setPageNo(pageNo);
+ searchBean.setName(searchKey);
+ searchBean.setPageSize(pageSize);
+ return userDataService.getPointsByKey(searchBean);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new PageResult<>(99, "系统查询错误");
+ }
+ }
+
+ @PostMapping("/user/delacc")
+ @PreAuthorize("hasPermission('/user/delacc','')")
+ @ResponseBody
+ public JsonResult delacc(@RequestParam String accno) {
+ if (StringUtil.isEmpty(accno)) {
+ return JsonResult.error("参数错误");
+ }
+ return userDataService.closeAccount(accno);
+ }
+
+ @PostMapping("/user/delpoint")
+ @PreAuthorize("hasPermission('/user/delpoint','')")
+ @ResponseBody
+ public JsonResult delpoint(@RequestParam String userid) {
+ if (StringUtil.isEmpty(userid)) {
+ return JsonResult.error("参数错误");
+ }
+ return userDataService.deletePoint(userid);
+ }
+
+ @GetMapping("/user/pointdtl")
+ public String pointdtl(@RequestParam String userid, ModelMap map) {
+ map.put("userid", userid);
+ return "system/user/pointdtl";
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java
new file mode 100644
index 0000000..b7824dd
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java
@@ -0,0 +1,21 @@
+package com.supwisdom.dlpay.system.service;
+
+import com.supwisdom.dlpay.framework.domain.TDictionary;
+import com.supwisdom.dlpay.framework.domain.TSubject;
+import com.supwisdom.dlpay.framework.domain.TTranscode;
+
+import java.util.List;
+
+public interface DictionaryDataService {
+ List<TDictionary> getDictionaryByDictType(String dicttype);
+
+ void updateDictionaryByDictType(String dicttype, List<TDictionary> list);
+
+ void refreshCache(String dicttype);
+
+ void refreshCache();
+
+ List<TTranscode> getTransCode();
+
+ List<TSubject> getAllSubject();
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
similarity index 85%
rename from src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
index 7f8d814..361ee89 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
@@ -49,8 +49,18 @@
return (List<T>) paramService.getAllSourceType();
} else if (Dictionary.TRANS_CODE.equals(dictType)) {
return (List<T>) dictionaryDataService.getTransCode();
+ } else if (Dictionary.ALL_SUBJECT.equals(dictType)) {
+ return (List<T>) dictionaryDataService.getAllSubject();
} else {
return (List<T>) dictionaryDataService.getDictionaryByDictType(dictType);
}
}
+
+ public void refreshDictionary() {
+ dictionaryDataService.refreshCache();
+ }
+
+ public void refreshDictionary(String dicttype) {
+ dictionaryDataService.refreshCache(dicttype);
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/FunctionService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/FunctionService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/service/FunctionService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/FunctionService.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
similarity index 96%
rename from src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
index dc9d180..b2a0334 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
@@ -1,7 +1,7 @@
package com.supwisdom.dlpay.system.service;
import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
+import com.supwisdom.dlpay.api.domain.TSourceTypeConfig;
import com.supwisdom.dlpay.framework.domain.TApiClient;
import com.supwisdom.dlpay.framework.domain.TBusinesspara;
import com.supwisdom.dlpay.framework.domain.TSyspara;
@@ -64,7 +64,7 @@
boolean deleteSourceType(TSourceType paytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TPaytypeConfig> getSourceTypeConfigList(String paytype);
+ List<TSourceTypeConfig> getSourceTypeConfigList(String paytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
boolean saveSourceTypeConfig(String paytype, Map<String, String> param) throws WebCheckException;
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/RoleService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/RoleService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/service/RoleService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/RoleService.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
similarity index 84%
rename from src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
index 9f5bd1a..606cb7c 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
@@ -1,8 +1,7 @@
package com.supwisdom.dlpay.system.service;
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TShopPaytype;
-import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig;
+import com.supwisdom.dlpay.api.domain.TShopSourceType;
+import com.supwisdom.dlpay.api.domain.TShopSourceTypeConfig;
import com.supwisdom.dlpay.framework.domain.TShop;
import com.supwisdom.dlpay.framework.domain.TShopacc;
import com.supwisdom.dlpay.framework.util.PageResult;
@@ -32,16 +31,16 @@
PageResult<ShopConfigBean> getShopPaytypeInfos(String shopaccno, String paytype, int pageNo, int pageSize);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- TShopPaytype getShopPaytype(String shopaccno, String paytype);
+ TShopSourceType getShopPaytype(String shopaccno, String paytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
TShopacc getShopaccByAccno(String shopaccno);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOrUpdateShopPaytype(TShopPaytype shopPaytype);
+ boolean saveOrUpdateShopPaytype(TShopSourceType shopPaytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- List<TShopPaytypeConfig> getShopPaytypeConfigs(String shopaccno, String paytype);
+ List<TShopSourceTypeConfig> getShopPaytypeConfigs(String shopaccno, String paytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
boolean saveOrUpdateShopPaytypeConfig(String shopaccno, String paytype, Map<String, String> param) throws WebCheckException;
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
new file mode 100644
index 0000000..be4365a
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
@@ -0,0 +1,103 @@
+package com.supwisdom.dlpay.system.service.impl;
+
+import com.supwisdom.dlpay.framework.dao.DictionaryDao;
+import com.supwisdom.dlpay.framework.dao.SubjectDao;
+import com.supwisdom.dlpay.framework.dao.TranscodeDao;
+import com.supwisdom.dlpay.framework.domain.TDictionary;
+import com.supwisdom.dlpay.framework.domain.TSubject;
+import com.supwisdom.dlpay.framework.domain.TTranscode;
+import com.supwisdom.dlpay.system.service.DictionaryDataService;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class DictionaryDataServiceImpl implements DictionaryDataService {
+ private final DictionaryDao dictionaryDao;
+ private final TranscodeDao transcodeDao;
+ private final SubjectDao subjectDao;
+
+ public DictionaryDataServiceImpl(DictionaryDao dictionaryDao,
+ TranscodeDao transcodeDao,
+ SubjectDao subjectDao) {
+ this.dictionaryDao = dictionaryDao;
+ this.transcodeDao = transcodeDao;
+ this.subjectDao = subjectDao;
+ }
+
+ @Override
+ @Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey(#dicttype)")
+ public List<TDictionary> getDictionaryByDictType(String dicttype) {
+ List<TDictionary> list = dictionaryDao.findAllByDicttype(dicttype);
+ if (!list.isEmpty()) {
+ return list;
+ }
+ return new ArrayList<>();
+ }
+
+
+ private TDictionary findExistsOrNew(List<TDictionary> list, TDictionary item) {
+ for (TDictionary i : list) {
+ if (item.getDicttype().equals(i.getDicttype()) && item.getDictval().equals(i.getDictval())) {
+ i.setDicttypename(item.getDicttypename());
+ i.setDictcaption(item.getDictcaption());
+ return i;
+ }
+ }
+ TDictionary newDict = new TDictionary();
+ newDict.setDicttype(item.getDicttype());
+ newDict.setDictval(item.getDictval());
+ newDict.setDictcaption(item.getDictcaption());
+ newDict.setDicttypename(item.getDicttypename());
+ return newDict;
+ }
+
+ @Override
+ @CacheEvict(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey(#dicttype)")
+ public void updateDictionaryByDictType(String dicttype, List<TDictionary> list) {
+ for (TDictionary item : list) {
+ if (!dicttype.equals(item.getDicttype())) {
+ throw new IllegalArgumentException("TDictionary dicttype mismatch");
+ }
+ }
+ List<TDictionary> exists = dictionaryDao.findAllByDicttype(dicttype);
+ List<TDictionary> newItems = new ArrayList<>();
+ dictionaryDao.deleteByDicttype(dicttype);
+ for (TDictionary item : list) {
+ newItems.add(findExistsOrNew(exists, item));
+ }
+ exists.removeAll(newItems);
+ dictionaryDao.deleteAll(exists);
+ dictionaryDao.saveAll(newItems);
+ }
+
+ @Override
+ @CacheEvict(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey(#dicttype)")
+ public void refreshCache(String dicttype) {
+ }
+
+ @Override
+ @CacheEvict(cacheNames = "dictionary_cache", key = "@tenantHolder.getId() + '.*'", allEntries = true)
+ public void refreshCache() {
+
+ }
+
+ @Override
+ @Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('transcode')")
+ public List<TTranscode> getTransCode() {
+ List<TTranscode> list = transcodeDao.findAll();
+ if (!list.isEmpty()) {
+ return list;
+ }
+ return new ArrayList<>();
+ }
+
+ @Override
+ @Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('allsubject')")
+ public List<TSubject> getAllSubject() {
+ return subjectDao.findAllDisplaySubjects();
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/FunctionServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/FunctionServiceImpl.java
similarity index 97%
rename from src/main/java/com/supwisdom/dlpay/system/service/impl/FunctionServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/FunctionServiceImpl.java
index 9dec0bf..8a20b8d 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/FunctionServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/FunctionServiceImpl.java
@@ -33,7 +33,6 @@
private RoleFunctionDao roleFunctionDao;
@Override
- @Cacheable(cacheNames = "oper_function_list", key = "#p0")
public List<TFunction> getFunctionsByOperid(String operid) {
List<TFunction> list = functionDao.getTFunctionsByOperid(StringUtil.isEmpty(operid) ? "" : operid.trim());
if (!StringUtil.isEmpty(list)) return list;
@@ -71,7 +70,6 @@
}
@Override
- @CacheEvict(cacheNames = "oper_function_list")
public TFunction getFunctionByNameAndId(String name, Integer id) {
if (id != null && id != 0) {
return functionDao.findByNameAndIdNot(name, id);
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
similarity index 95%
rename from src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
index 73ce52b..508361c 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
@@ -81,25 +81,26 @@
operator.setTenantId(TenantContext.getTenantSchema());
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
operator.setOperpwd(encoder.encode(WebConstant.OPERPWD_DEFAULT));
+ operator.setTenantId(TenantContext.getTenantSchema());
operator = operatorDao.save(operator);
for (String role : roleids) {
TOperRole operRole = new TOperRole();
operRole.setOperid(operator.getOperid());
operRole.setRoleId(role);
+ operRole.setTenantId(operator.getTenantId());
operRoleDao.save(operRole);
}
} else {
- Optional<TOperator> temp = operatorDao.findById(operator.getOperid());
- if (!temp.isPresent()) {
+ TOperator op = operatorDao.findByOperid(operator.getOperid());
+ if (op == null) {
return false;
}
- TOperator op = temp.get();
op.setSex(operator.getSex());
op.setEmail(operator.getEmail());
op.setMobile(operator.getMobile());
op.setOpername(operator.getOpername());
op.setOpercode(operator.getOpercode());
- op.setTenantId(operator.getTenantId());
+ op.setThirdadmin(operator.getThirdadmin());
operatorDao.save(op);
operRoleDao.deleteByOperid(op.getOperid());
String[] roleids = roles.split(",");
@@ -107,6 +108,7 @@
TOperRole operRole = new TOperRole();
operRole.setOperid(op.getOperid());
operRole.setRoleId(role);
+ operRole.setTenantId(op.getTenantId());
operRoleDao.save(operRole);
}
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
similarity index 75%
rename from src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
index 4fe84f7..88e7e1b 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
@@ -1,15 +1,17 @@
package com.supwisdom.dlpay.system.service.impl;
-import com.supwisdom.dlpay.api.dao.PaytypeConfigDao;
+import com.supwisdom.dlpay.api.dao.SourceTypeConfigDao;
import com.supwisdom.dlpay.api.dao.SourceTypeDao;
+import com.supwisdom.dlpay.api.domain.TSourceTypeConfig;
import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
import com.supwisdom.dlpay.framework.dao.ApiClientDao;
import com.supwisdom.dlpay.framework.dao.BusinessparaDao;
import com.supwisdom.dlpay.framework.dao.SysparaDao;
import com.supwisdom.dlpay.framework.domain.TApiClient;
import com.supwisdom.dlpay.framework.domain.TBusinesspara;
import com.supwisdom.dlpay.framework.domain.TSyspara;
+import com.supwisdom.dlpay.framework.tenant.TenantContext;
+import com.supwisdom.dlpay.framework.tenant.TenantHolder;
import com.supwisdom.dlpay.framework.util.PageResult;
import com.supwisdom.dlpay.framework.util.StringUtil;
import com.supwisdom.dlpay.system.service.ParamService;
@@ -45,7 +47,7 @@
@Autowired
private SourceTypeDao sourceTypeDao;
@Autowired
- private PaytypeConfigDao paytypeConfigDao;
+ private SourceTypeConfigDao paytypeConfigDao;
@Override
public PageResult<TSyspara> getSysparaPage(Integer paraid, String paraname, int pageNo, int pageSize) {
@@ -110,6 +112,7 @@
@Override
public boolean saveOrUpdateBusinesspara(TBusinesspara businesspara) {
if (null != businesspara) {
+ businesspara.setTenantId(TenantContext.getTenantSchema());
businessparaDao.save(businesspara);
return true;
}
@@ -161,45 +164,46 @@
}
@Override
- @Cacheable(cacheNames = "source_type_cache", key = "#p0")
- public TSourceType getSourceType(String paytype) {
- if (!StringUtil.isEmpty(paytype)) {
- return sourceTypeDao.getBySourceType(paytype.trim());
+ @Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('sourcetype', #sourceType)")
+ public TSourceType getSourceType(String sourceType) {
+ if (!StringUtil.isEmpty(sourceType)) {
+ return sourceTypeDao.getBySourceType(sourceType.trim());
}
return null;
}
@Override
- @Cacheable(cacheNames = "source_type_cache")
+ @Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('sourcetype')")
public List<TSourceType> getAllSourceType() {
return sourceTypeDao.findAll();
}
@Override
- @Cacheable(cacheNames = "source_type_cache", key = "#paytype.sourceType")
- public boolean saveOrUpdateSourceType(TSourceType paytype) {
- if (null != paytype) {
- sourceTypeDao.save(paytype);
+ @CacheEvict(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('sourcetype', #sourceType.sourceType)")
+ public boolean saveOrUpdateSourceType(TSourceType sourceType) {
+ if (null != sourceType) {
+ sourceType.setTenantid(TenantContext.getTenantSchema());
+ sourceTypeDao.save(sourceType);
return true;
}
return false;
}
@Override
- @CacheEvict(cacheNames = "source_type_cache", key = "#paytype.sourceType")
- public boolean deleteSourceType(TSourceType paytype) {
- if (null != paytype) {
- sourceTypeDao.delete(paytype);
+ @CacheEvict(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('sourcetype', #sourceType.sourceType)")
+ public boolean deleteSourceType(TSourceType sourceType) {
+ if (null != sourceType) {
+ sourceTypeDao.delete(sourceType);
return true;
}
return false;
}
@Override
- @Cacheable(cacheNames = "source_type_config_cache", key = "#p0")
- public List<TPaytypeConfig> getSourceTypeConfigList(String paytype) {
- if (!StringUtil.isEmpty(paytype)) {
- List<TPaytypeConfig> list = paytypeConfigDao.getByPaytypeOrderByConfigid(paytype.trim());
+ @Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('sourcetype_config', #sourceType)")
+ public List<TSourceTypeConfig> getSourceTypeConfigList(String sourceType) {
+ if (!StringUtil.isEmpty(sourceType)) {
+ List<TSourceTypeConfig> list = paytypeConfigDao.getBySourceTypeOrderByConfigid(sourceType.trim());
if (!StringUtil.isEmpty(list))
return list;
}
@@ -207,13 +211,13 @@
}
@Override
- @Cacheable(cacheNames = "source_type_config_cache", key = "#p0")
- public boolean saveSourceTypeConfig(String paytype, Map<String, String> param) throws WebCheckException {
- TSourceType tPaytype = getSourceType(paytype);
- if (null == tPaytype) throw new WebCheckException("支付能力[" + paytype + "]不存在");
+ @CacheEvict(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('sourcetype_config', #sourceType)")
+ public boolean saveSourceTypeConfig(String sourceType, Map<String, String> param) throws WebCheckException {
+ TSourceType tPaytype = getSourceType(sourceType);
+ if (null == tPaytype) throw new WebCheckException("支付能力[" + sourceType + "]不存在");
for (String key : param.keySet()) {
String value = param.get(key);
- TPaytypeConfig config = paytypeConfigDao.getByPaytypeAndAndConfigid(tPaytype.getSourceType(), key);
+ TSourceTypeConfig config = paytypeConfigDao.getBySourceTypeAndConfigid(tPaytype.getSourceType(), key);
if (null == config)
throw new WebCheckException("支付能力[" + tPaytype.getSourceType() + "]不存在配置项[" + key + "],请重新查询");
config.setConfigValue(StringUtil.isEmpty(value) ? null : value.trim());
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
similarity index 70%
rename from src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
index 66acac4..ce04c41 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
@@ -14,6 +14,8 @@
import com.supwisdom.dlpay.system.bean.FunctionSearchBean;
import com.supwisdom.dlpay.system.bean.ZTreeNode;
import com.supwisdom.dlpay.system.service.RoleService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
@@ -26,6 +28,8 @@
@Service
public class RoleServiceImpl implements RoleService {
+ private Logger logger = LoggerFactory.getLogger(RoleServiceImpl.class);
+
@Autowired
private RoleDao roleDao;
@@ -91,7 +95,6 @@
temp = opt.get();
temp.setRoleName(role.getRoleName());
temp.setRoleDesc(role.getRoleDesc());
-// temp.setRoleCode(role.getRoleCode());
temp.setLastsaved(DateUtil.getNow());
temp.setTenantId(TenantContext.getTenantSchema());
roleDao.save(temp);
@@ -121,29 +124,63 @@
return permissionDao.findByRoleIdAndResid(roleFuncId, resid);
}
+ private TPermission findOrNewPermission(List<TPermission> exists, String roleId, Integer resId) {
+ for (TPermission item : exists) {
+ if (resId.equals(item.getResid())) {
+ return item;
+ }
+ }
+
+ TPermission perm = new TPermission();
+ perm.setRoleId(roleId);
+ perm.setResid(resId);
+ perm.setTenantId(TenantContext.getTenantSchema());
+ return perm;
+ }
+
+ private TRoleFunction findOrNewRoleFunction(List<TRoleFunction> exists, String roleId, Integer funcId) {
+ for (TRoleFunction item : exists) {
+ if (funcId.equals(item.getFunctionId())) {
+ return item;
+ }
+ }
+ TRoleFunction func = new TRoleFunction();
+ func.setFunctionId(funcId);
+ func.setRoleId(roleId);
+ func.setTenantId(TenantContext.getTenantSchema());
+ return func;
+ }
+
@Override
public JsonResult saveRoleFuncId(String roleId, String funcs) {
Optional<TRole> ret = roleDao.findById(roleId);
- if (ret == null || !ret.isPresent()) {
+ if (!ret.isPresent()) {
return JsonResult.error("角色不存在");
}
- roleFunctionDao.deleteByRoleId(roleId);
- permissionDao.deleteByRoleId(roleId);
+ List<TRoleFunction> functions = roleFunctionDao.findByRoleId(roleId);
+ List<TPermission> permissions = permissionDao.findByRoleId(roleId);
+ ArrayList<TRoleFunction> retainFuncs = new ArrayList<>();
+ ArrayList<TPermission> retainPerms = new ArrayList<>();
String[] datas = funcs.split(",");
for (String func : datas) {
if (func.contains("_res")) {
String id = func.replace("_res", "");
- TPermission permission = new TPermission();
- permission.setResid(Integer.valueOf(id));
- permission.setRoleId(roleId);
- permissionDao.save(permission);
+ retainPerms.add(findOrNewPermission(permissions, roleId, Integer.parseInt(id)));
} else {
- TRoleFunction roleFunction = new TRoleFunction();
- roleFunction.setFunctionId(Integer.valueOf(func));
- roleFunction.setRoleId(roleId);
- roleFunctionDao.save(roleFunction);
+ if ("-1".equals(func)) continue; //全选排除
+ retainFuncs.add(findOrNewRoleFunction(functions, roleId, Integer.parseInt(func)));
}
}
+ // funcations
+ functions.removeAll(retainFuncs);
+ if (functions.size() > 0)
+ roleFunctionDao.deleteAll(functions);
+ roleFunctionDao.saveAll(retainFuncs);
+ // permissions
+ permissions.removeAll(retainPerms);
+ if (permissions.size() > 0)
+ permissionDao.deleteAll(permissions);
+ permissionDao.saveAll(retainPerms);
return JsonResult.ok("成功");
}
@@ -151,22 +188,31 @@
public List<ZTreeNode> findByRoleIdNative(String roleId) {
List<NodeData> nodeData = roleFunctionDao.findByRoleIdNative(roleId);
List<ZTreeNode> ret = new ArrayList<>();
+ boolean allChecked = true;
for (NodeData data : nodeData) {
ZTreeNode zTreeNode = new ZTreeNode();
zTreeNode.setpId(data.getPid());
zTreeNode.setId(data.getId());
zTreeNode.setName(data.getName());
- zTreeNode.setChecked(data.getChecked() == 0 ? false : true);
- zTreeNode.setOpen(data.getOpen() == 0 ? false : true);
+ zTreeNode.setChecked(data.getChecked() != 0);
+ if (allChecked && !zTreeNode.isChecked()) allChecked = false;
+ zTreeNode.setOpen(data.getOpen() != 0);
ret.add(zTreeNode);
}
+ ZTreeNode root = new ZTreeNode();
+ root.setId("-1");
+ root.setpId("-99");
+ root.setName("选择全部功能");
+ root.setChecked(allChecked);
+ root.setOpen(true);
+ ret.add(root);
return ret;
}
@Override
public JsonResult deleteRole(String roleid) {
Optional<TRole> ret = roleDao.findById(roleid);
- if (ret == null || !ret.isPresent()) {
+ if (!ret.isPresent()) {
return JsonResult.error("角色不存在");
}
if (ret.get().getEditflag() != 1) {
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
similarity index 94%
rename from src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
index dc1128f..e85609c 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
@@ -1,5 +1,6 @@
package com.supwisdom.dlpay.system.service.impl;
+import com.supwisdom.dlpay.api.types.ShopTypes;
import com.supwisdom.dlpay.framework.dao.*;
import com.supwisdom.dlpay.framework.domain.TSettlectl;
import com.supwisdom.dlpay.framework.domain.TShop;
@@ -10,6 +11,7 @@
import com.supwisdom.dlpay.framework.util.StringUtil;
import com.supwisdom.dlpay.system.bean.*;
import com.supwisdom.dlpay.system.service.SettleReportService;
+import com.supwisdom.dlpay.util.EnumCheck;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@@ -32,10 +34,12 @@
@Autowired
private ShopDao shopDao;
+ private EnumCheck<ShopTypes, String> shoptypeCheck = new EnumCheck<>();
+
@Override
public String getSystemSettledate() {
TSettlectl settlectl = settleCtlDao.getOne(1);
- if (null != settlectl && null != settlectl.getSettledate()) {
+ if (null != settlectl.getSettledate()) {
return settlectl.getSettledate().toString();
}
return DateUtil.getNow("yyyyMMdd");
@@ -143,7 +147,7 @@
TreeSelectNode node = new TreeSelectNode();
node.setId(shop.getShopid().toString());
node.setName(shop.getShopname());
- node.setOpen(shop.getShoptype() == 0);
+ node.setOpen(!shoptypeCheck.isInEnums(shop.getShoptype(), ShopTypes.NORMAL));
node.setChecked(false);
node.setAccno(shop.getShopaccno() == null ? "" : shop.getShopaccno());
node.setpId(String.valueOf(fshopid));
@@ -203,11 +207,11 @@
//商户组,计算该组下所有的交易额
long transcnt = 0;
double transamt = 0;
- List<TShop> childrenShops = getChildrenShopByShopid(shopAllList,shop.getShopid().intValue()); //子商户列表
+ List<TShop> childrenShops = getChildrenShopByShopid(shopAllList, shop.getShopid().intValue()); //子商户列表
for (TShop child : childrenShops) {
- if(!StringUtil.isEmpty(child.getShopaccno())){
- for(ShopBusinessInfo info:businessInfos){
- if(child.getShopaccno().equals(info.getShopaccno())){
+ if (!StringUtil.isEmpty(child.getShopaccno())) {
+ for (ShopBusinessInfo info : businessInfos) {
+ if (child.getShopaccno().equals(info.getShopaccno())) {
transcnt += info.getTranscnt();
transamt += (info.getCramt() - info.getDramt());
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
similarity index 71%
rename from src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
index 88d4deb..a7cf9a7 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
@@ -1,13 +1,14 @@
package com.supwisdom.dlpay.system.service.impl;
-import com.supwisdom.dlpay.api.dao.PaytypeConfigDao;
+import com.supwisdom.dlpay.api.dao.SourceTypeConfigDao;
import com.supwisdom.dlpay.api.dao.SourceTypeDao;
-import com.supwisdom.dlpay.api.dao.ShopPaytypeConfigDao;
-import com.supwisdom.dlpay.api.dao.ShopPaytypeDao;
+import com.supwisdom.dlpay.api.dao.ShopSourceTypeConfigDao;
+import com.supwisdom.dlpay.api.dao.ShopSourceTypeDao;
import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
-import com.supwisdom.dlpay.api.domain.TShopPaytype;
-import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig;
+import com.supwisdom.dlpay.api.domain.TSourceTypeConfig;
+import com.supwisdom.dlpay.api.domain.TShopSourceType;
+import com.supwisdom.dlpay.api.domain.TShopSourceTypeConfig;
+import com.supwisdom.dlpay.api.types.ShopTypes;
import com.supwisdom.dlpay.framework.dao.ShopDao;
import com.supwisdom.dlpay.framework.dao.ShopaccDao;
import com.supwisdom.dlpay.framework.data.SystemDateTime;
@@ -15,14 +16,11 @@
import com.supwisdom.dlpay.framework.domain.TShopacc;
import com.supwisdom.dlpay.framework.service.SystemUtilService;
import com.supwisdom.dlpay.framework.tenant.TenantContext;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.framework.util.Subject;
-import com.supwisdom.dlpay.framework.util.TradeDict;
+import com.supwisdom.dlpay.framework.util.*;
import com.supwisdom.dlpay.system.bean.ShopConfigBean;
import com.supwisdom.dlpay.system.bean.ZTreeNode;
import com.supwisdom.dlpay.system.service.ShopDataService;
-import com.supwisdom.dlpay.util.ConstantUtil;
+import com.supwisdom.dlpay.util.EnumCheck;
import com.supwisdom.dlpay.util.WebCheckException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@@ -44,15 +42,17 @@
@Autowired
private ShopaccDao shopaccDao;
@Autowired
- private ShopPaytypeDao shopPaytypeDao;
+ private ShopSourceTypeDao shopSourceTypeDao;
@Autowired
private SystemUtilService systemUtilService;
@Autowired
- private SourceTypeDao paytypeDao;
+ private SourceTypeDao sourceTypeDao;
@Autowired
- private PaytypeConfigDao paytypeConfigDao;
+ private SourceTypeConfigDao sourceTypeConfigDao;
@Autowired
- private ShopPaytypeConfigDao shopPaytypeConfigDao;
+ private ShopSourceTypeConfigDao shopPaytypeConfigDao;
+
+ private EnumCheck<ShopTypes, String> enumUtil = new EnumCheck<>();
@Override
public List<ZTreeNode> getAllShopNodes() {
@@ -69,7 +69,8 @@
node.setOpen(true);
node.setShoptype(shop.getShoptype());
node.setShopaccno(StringUtil.isEmpty(shop.getShopaccno()) ? "" : shop.getShopaccno());
- node.setIconSkin(shop.getShoptype() == 0 ? "pIcon01" : "pIcon02");
+ node.setIconSkin(enumUtil.isInEnums(shop.getShoptype(),
+ ShopTypes.ROOT, ShopTypes.GROUP) ? "pIcon01" : "pIcon02");
result.add(node);
}
}
@@ -87,6 +88,9 @@
@Override
public boolean deleteShop(TShop shop) throws WebCheckException {
if (null != shop) {
+ if (ShopTypes.ROOT.value().equals(shop.getShoptype())) {
+ throw new WebCheckException("不能删除根商户节点");
+ }
List<TShop> childShops = shopDao.getChildShopsByShopid(shop.getShopid());
if (!StringUtil.isEmpty(childShops))
throw new WebCheckException("请先删除下级商户");
@@ -111,7 +115,8 @@
TShop fshop = shopDao.getTShopByShopid(shop.getFshopid());
if (null == fshop) {
throw new WebCheckException("上级商户不存在!");
- } else if (fshop.getShoptype() == 1) {
+ } else if (!enumUtil.isInEnums(fshop.getShoptype(),
+ ShopTypes.ROOT, ShopTypes.GROUP)) {
throw new WebCheckException("上级商户不是商户组!");
}
}
@@ -131,7 +136,7 @@
shop.setOpendate(dt.getHostdate());
shop.setTenantId(TenantContext.getTenantSchema());
shopDao.save(shop);
- if (shop.getShoptype() == 1) {
+ if (enumUtil.isInEnums(shop.getShoptype(), ShopTypes.NORMAL)) {
TShopacc shopacc = new TShopacc();
shopacc.setShopaccno(String.format("2%09d", shop.getShopid()));
shopacc.setShopid(shop.getShopid());
@@ -148,46 +153,46 @@
// TShopPaytype shopPaytype = new TShopPaytype();
// shopPaytype.setShopaccno(shopacc.getShopaccno());
-// shopPaytype.setPaytype(TradeDict.PAYTYPE_BALANCE);
+// shopPaytype.setSourceType(TradeDict.PAYTYPE_BALANCE);
// shopPaytype.setConsumeEnable(true);
// shopPaytype.setAnonymousEnable(false);
// shopPaytype.setReverseEnable(false);
// shopPaytype.setCreatetime(dt.getHostdatetime());
-// shopPaytypeDao.save(shopPaytype); //默认增加余额支付方式
+// shopSourceTypeDao.save(shopPaytype); //默认增加余额支付方式
}
return true;
}
}
@Override
- public PageResult<ShopConfigBean> getShopPaytypeInfos(String shopaccno, String paytype, int pageNo, int pageSize) {
- Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("shopaccno", "paytype"));
+ public PageResult<ShopConfigBean> getShopPaytypeInfos(String shopaccno, String sourceType, int pageNo, int pageSize) {
+ Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("shopaccno", "sourceType"));
- Page<TShopPaytype> page = shopPaytypeDao.findAll(new Specification<TShopPaytype>() {
+ Page<TShopSourceType> page = shopSourceTypeDao.findAll(new Specification<TShopSourceType>() {
@Override
- public Predicate toPredicate(Root<TShopPaytype> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
+ public Predicate toPredicate(Root<TShopSourceType> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
List<Predicate> predicates = new ArrayList<>();
if (!StringUtil.isEmpty(shopaccno)) {
predicates.add(criteriaBuilder.equal(root.get("shopaccno").as(String.class), shopaccno.trim()));
}
- if (!StringUtil.isEmpty(paytype)) {
- predicates.add(criteriaBuilder.equal(root.get("paytype").as(String.class), paytype.trim()));
+ if (!StringUtil.isEmpty(sourceType)) {
+ predicates.add(criteriaBuilder.equal(root.get("sourceType").as(String.class), sourceType.trim()));
}
return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
}
}, pageable);
- if (null == page || page.getTotalElements() == 0) {
+ if (page.getTotalElements() == 0) {
return new PageResult<>(99, "无数据");
}
List<ShopConfigBean> list = new ArrayList<>(0);
- for (TShopPaytype pt : page.getContent()) {
+ for (TShopSourceType pt : page.getContent()) {
ShopConfigBean bean = new ShopConfigBean();
bean.setShopaccno(pt.getShopaccno());
TShopacc shopacc = shopaccDao.getByShopaccno(pt.getShopaccno());
bean.setShopname(shopacc == null ? "" : shopacc.getShopname());
- bean.setPaytype(pt.getPaytype());
- TSourceType tPaytype = paytypeDao.getBySourceType(pt.getPaytype());
+ bean.setSourceType(pt.getSourceType());
+ TSourceType tPaytype = sourceTypeDao.getBySourceType(pt.getSourceType());
bean.setPaydesc(tPaytype == null ? "" : tPaytype.getPaydesc());
bean.setConsumeEnable(pt.getConsumeEnable());
bean.setAnonymousEnable(pt.getAnonymousEnable());
@@ -198,8 +203,8 @@
}
@Override
- public TShopPaytype getShopPaytype(String shopaccno, String paytype) {
- return shopPaytypeDao.getById(paytype, shopaccno);
+ public TShopSourceType getShopPaytype(String shopaccno, String paytype) {
+ return shopSourceTypeDao.getById(paytype, shopaccno);
}
@Override
@@ -211,27 +216,30 @@
}
@Override
- public boolean saveOrUpdateShopPaytype(TShopPaytype shopPaytype) {
+ public boolean saveOrUpdateShopPaytype(TShopSourceType shopPaytype) {
if (null != shopPaytype) {
shopPaytype.setTenantid(TenantContext.getTenantSchema());
- shopPaytypeDao.save(shopPaytype);
+ shopSourceTypeDao.save(shopPaytype);
return true;
}
return false;
}
@Override
- public List<TShopPaytypeConfig> getShopPaytypeConfigs(String shopaccno, String paytype) {
- List<TShopPaytypeConfig> result = new ArrayList<>(0);
+ public List<TShopSourceTypeConfig> getShopPaytypeConfigs(String shopaccno, String paytype) {
+ List<TShopSourceTypeConfig> result = new ArrayList<>(0);
if (!StringUtil.isEmpty(paytype)) {
- List<TPaytypeConfig> list = paytypeConfigDao.getByPaytypeOrderByConfigid(paytype.trim());
+ List<TSourceTypeConfig> list = sourceTypeConfigDao.getBySourceTypeOrderByConfigid(paytype.trim());
if (!StringUtil.isEmpty(list)) {
- for (TPaytypeConfig pt : list) {
- TShopPaytypeConfig spc = shopPaytypeConfigDao.getShopPaytypeConfigById(shopaccno, pt.getPaytype(), pt.getConfigid());
+ for (TSourceTypeConfig pt : list) {
+ if(pt.getGlobalflag()){
+ continue; //通用参数跳过
+ }
+ TShopSourceTypeConfig spc = shopPaytypeConfigDao.getShopSourceTypeConfigById(shopaccno, pt.getSourceType(), pt.getConfigid());
if (null == spc) {
- spc = new TShopPaytypeConfig();
+ spc = new TShopSourceTypeConfig();
spc.setShopaccno(shopaccno);
- spc.setPaytype(pt.getPaytype());
+ spc.setSourceType(pt.getSourceType());
spc.setConfigid(pt.getConfigid());
spc.setConfigName(pt.getConfigName());
spc.setConfigValue(null);
@@ -245,22 +253,22 @@
@Override
public boolean saveOrUpdateShopPaytypeConfig(String shopaccno, String paytype, Map<String, String> param) throws WebCheckException {
- TShopPaytype shopPaytype = getShopPaytype(shopaccno, paytype);
+ TShopSourceType shopPaytype = getShopPaytype(shopaccno, paytype);
if (null == shopPaytype) {
throw new WebCheckException("此商户[" + shopaccno + "]还不具有该支付能力[" + paytype + "]");
}
for (String key : param.keySet()) {
String value = param.get(key);
- TShopPaytypeConfig spc = shopPaytypeConfigDao.getShopPaytypeConfigById(shopPaytype.getShopaccno(), shopPaytype.getPaytype(), key);
+ TShopSourceTypeConfig spc = shopPaytypeConfigDao.getShopSourceTypeConfigById(shopPaytype.getShopaccno(), shopPaytype.getSourceType(), key);
if (null != spc) {
spc.setConfigValue(StringUtil.isEmpty(value) ? null : value.trim());
} else {
- spc = new TShopPaytypeConfig();
+ spc = new TShopSourceTypeConfig();
spc.setShopaccno(shopPaytype.getShopaccno());
- spc.setPaytype(shopPaytype.getPaytype());
+ spc.setSourceType(shopPaytype.getSourceType());
spc.setConfigid(key);
spc.setConfigValue(StringUtil.isEmpty(value) ? null : value.trim());
- TPaytypeConfig paytypeConfig = paytypeConfigDao.getByPaytypeAndAndConfigid(shopPaytype.getPaytype(), key);
+ TSourceTypeConfig paytypeConfig = sourceTypeConfigDao.getBySourceTypeAndConfigid(shopPaytype.getSourceType(), key);
if (null != paytypeConfig) {
spc.setConfigName(paytypeConfig.getConfigName());
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
similarity index 97%
rename from src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
rename to payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
index 1254d32..0cc0b4d 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
@@ -90,8 +90,10 @@
if (StringUtil.isEmpty(person.getStatus())) {
person.setStatus(TradeDict.STATUS_NORMAL);
}
+ person.setLastsaved(systemUtilService.getSysdatetime().getHostdatetime());
person.setTenantid(TenantContext.getTenantSchema());
personDao.save(person);
+ return JsonResult.ok("修改成功");
} else {
TPerson has = personDao.findByIdentity(person.getIdtype(), person.getIdno());
if (has != null) {
@@ -112,7 +114,7 @@
account.setAvailbal(0.0);
account.setFrozebal(0.0);
account.setLowfreeFlag(false);
- account.setMaxbal(systemUtilService.getSysparaValueAsDouble(SysparaUtil.SYSPARAID_NO1, SysparaUtil.SYSPARA_NO1_DEFAULT));
+ account.setMaxbal(systemUtilService.getSysparaValueAsDouble(SysparaUtil.BALANCE_LIMIT, SysparaUtil.DEFAULT_BALANCE_LIMIT));
account.setLastdayDpsamt(0.0);
account.setLastdayTransamt(0.0);
account.setOpendate(systemDateTime.getHostdate());
diff --git a/src/main/java/com/supwisdom/dlpay/util/Code.java b/payapi/src/main/java/com/supwisdom/dlpay/util/Code.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/util/Code.java
rename to payapi/src/main/java/com/supwisdom/dlpay/util/Code.java
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
new file mode 100644
index 0000000..3c7b5de
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
@@ -0,0 +1,36 @@
+package com.supwisdom.dlpay.util;
+
+/**
+ * Created by shuwei on 2019/4/9.
+ */
+public class ConstantUtil {
+
+ public static final String ENABLE_YES = "yes";
+ public static final String ENABLE_NO = "no";
+
+ public static final String SEX_MALE = "male";
+ public static final String SEX_FEMALE = "female";
+
+ /**
+ * TDictionary的dicttype
+ * */
+ public static final int DICTTYPE_NO1 = 1; //冲正状态字典
+ public static final int DICTTYPE_NO2 = 2; //流水状态字典
+
+ /*
+ * 页面ID
+ * */
+
+ public static final String PAGE_USERXIEYI = "xieyi";//用户协议页面
+ public static final String PAGE_BANKXIEYI = "bankxieyi";//银行协议页面
+
+ /**
+ * 卡库同步的Cardtype
+ * */
+ public static final String CARDTYPE_CITIZENCARD = "citizencard";
+ public static final String CARDTYPE_BANKCARD = "bankcard";
+
+ public static final String QUERYTYPE_NEED_QUERY = "query";
+ public static final String QUERYTYPE_QUERY_FINISH = "finish";
+ public static final int QUERY_MAX_COUNT = 10;
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/util/DESedeUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/util/DESedeUtil.java
new file mode 100644
index 0000000..0d0e4cf
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/util/DESedeUtil.java
@@ -0,0 +1,107 @@
+package com.supwisdom.dlpay.util;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang.StringUtils;
+
+import javax.crypto.*;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.UnsupportedEncodingException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * 加密/解密工具类
+ */
+public class DESedeUtil {
+ /**
+ * 加密工具类唯一实例
+ */
+ private static DESedeUtil instance = null;
+ /**
+ *
+ */
+ private Cipher cipher;
+ /**
+ *
+ */
+ private SecretKey secretKey;
+ /**
+ *
+ */
+ private IvParameterSpec ivSpec;
+
+ /**
+ * 初始化、创建密钥数据
+ *
+ * @throws NoSuchPaddingException
+ * @throws NoSuchAlgorithmException
+ */
+ private DESedeUtil(String deskey) throws NoSuchAlgorithmException, NoSuchPaddingException {
+ byte[] keyData = Base64.decodeBase64(deskey);
+ String fullAlg = "DESede/CBC/PKCS5Padding";
+ cipher = Cipher.getInstance(fullAlg);
+ int blockSize = cipher.getBlockSize();
+ byte[] iv = new byte[blockSize];
+ for (int i = 0; i < blockSize; ++i) {
+ iv[i] = 0;
+ }
+ secretKey = new SecretKeySpec(keyData, StringUtils.substringBefore(fullAlg, "/"));
+ ivSpec = new IvParameterSpec(iv);
+ }
+
+ /**
+ * 获取唯一实例
+ *
+ * @return
+ * @throws NoSuchPaddingException
+ * @throws NoSuchAlgorithmException
+ */
+ public static DESedeUtil getInstance(String deskey) throws NoSuchAlgorithmException, NoSuchPaddingException {
+ if (null == instance) {
+ synchronized (DESedeUtil.class) {
+ if (null == instance) {
+ instance = new DESedeUtil(deskey);
+ }
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * 加密
+ *
+ * @param s 待加密字符串
+ * @return 返回BASE64编码加密字符串
+ * @throws InvalidAlgorithmParameterException
+ * @throws InvalidKeyException
+ * @throws BadPaddingException
+ * @throws IllegalBlockSizeException
+ * @throws UnsupportedEncodingException
+ */
+ public String encode(String s) throws InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
+ cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivSpec);
+ byte[] cipherBytes = cipher.doFinal(s.getBytes("UTF-8"));
+ return new String(Base64.encodeBase64(cipherBytes));
+ }
+
+ /**
+ * 解密
+ *
+ * @param s 待解密字符串
+ * @return 返回明文
+ * @throws InvalidAlgorithmParameterException
+ * @throws InvalidKeyException
+ * @throws BadPaddingException
+ * @throws IllegalBlockSizeException
+ * @throws UnsupportedEncodingException
+ */
+ public String decode(String s) throws InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
+ cipher.init(Cipher.DECRYPT_MODE, secretKey, ivSpec);
+ byte[] resultBytes = cipher.doFinal(Base64.decodeBase64(s));
+ return new String(resultBytes, "UTF-8");
+ }
+
+}
+
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/util/EnumCheck.java b/payapi/src/main/java/com/supwisdom/dlpay/util/EnumCheck.java
new file mode 100644
index 0000000..953aa5f
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/util/EnumCheck.java
@@ -0,0 +1,12 @@
+package com.supwisdom.dlpay.util;
+
+public class EnumCheck<T, U> {
+ public boolean isInEnums(U value, T... expected) {
+ for (T item : expected) {
+ if (item.toString().equals(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/util/PaytypeUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/util/PaytypeUtil.java
new file mode 100644
index 0000000..045e54c
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/util/PaytypeUtil.java
@@ -0,0 +1,53 @@
+package com.supwisdom.dlpay.util;
+
+/**
+ * Created by shuwei on 2019/4/9.
+ */
+public class PaytypeUtil {
+ public static final String YKTPAY = "yktpay";
+
+ public static final String WECHAT = "wechat";
+
+
+ /**
+ * 支付宝支付,配置的KEY值
+ */
+ public static final String CFG_ALIPAY_APPID = "alipay.appid";
+
+ public static final String CFG_ALIPAY_PRIVATEKEY = "alipay.rsa.private.key";
+
+ public static final String CFG_ALIPAY_PUBLICKEY = "alipay.public.key";
+
+ public static final String CFG_ALIPAY_PAYURL = "alipay.payurl";
+
+ public static final String CFG_ALIPAY_NOTIFY = "notify.url";
+
+ public static final String CFG_ALIPAY_RETURNURL = "alipay.returnurl";
+
+ /**
+ * 微信支付,配置的KEY值
+ */
+ public static final String CFG_WECHAT_APPID = "wechat.appid";
+
+ public static final String CFG_WECHAT_MECHID = "wechat.mechid";
+
+ public static final String CFG_WECHAT_MECHKEY = "wechat.mechkey";
+
+ public static final String CFG_WECHAT_NOTIFY = "wechat.notify";
+
+ public static final String CFG_WECHAT_REFUNDCERT = "wechat.refund.certpath";
+
+ public static final String CFG_WECHAT_REFUNDCERT_PWD = "wechat.refund.certpwd";
+
+
+ public static final String CFG_WECHAT_OAUTHCODE = "https://api.mch.weixin.qq.com/tools/authcodetoopenid";
+
+ public static final String CFG_WECHAT_QRCODEPAY = "https://api.mch.weixin.qq.com/pay/micropay";
+
+ public static final String CFG_WECHAT_UNIONPAY = "https://api.mch.weixin.qq.com/pay/unifiedorder";
+
+ public static final String CFG_WECHAT_QUERY = "https://api.mch.weixin.qq.com/pay/orderquery";
+
+ public static final String CFG_WECHAT_REFUND = "https://api.mch.weixin.qq.com/secapi/pay/refund";
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/util/WebCheckException.java b/payapi/src/main/java/com/supwisdom/dlpay/util/WebCheckException.java
similarity index 100%
rename from src/main/java/com/supwisdom/dlpay/util/WebCheckException.java
rename to payapi/src/main/java/com/supwisdom/dlpay/util/WebCheckException.java
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/PayApiApplication.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/PayApiApplication.kt
new file mode 100644
index 0000000..e256b06
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/PayApiApplication.kt
@@ -0,0 +1,135 @@
+package com.supwisdom.dlpay
+
+import com.supwisdom.dlpay.framework.tenant.TenantCacheKeyGen
+import io.lettuce.core.ReadFrom
+import net.javacrumbs.shedlock.core.LockProvider
+import net.javacrumbs.shedlock.provider.redis.spring.RedisLockProvider
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.boot.SpringApplication
+import org.springframework.boot.autoconfigure.SpringBootApplication
+import org.springframework.boot.autoconfigure.data.redis.RedisProperties
+import org.springframework.boot.builder.SpringApplicationBuilder
+import org.springframework.boot.context.properties.ConfigurationProperties
+import org.springframework.boot.web.servlet.ServletComponentScan
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
+import org.springframework.cache.annotation.EnableCaching
+import org.springframework.cache.interceptor.KeyGenerator
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.data.redis.connection.RedisConnectionFactory
+import org.springframework.data.redis.connection.RedisPassword
+import org.springframework.data.redis.connection.RedisStandaloneConfiguration
+import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration
+import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory
+import org.springframework.data.redis.core.RedisTemplate
+import org.springframework.data.redis.repository.configuration.EnableRedisRepositories
+import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer
+import org.springframework.data.redis.serializer.StringRedisSerializer
+import org.springframework.http.client.ClientHttpRequestFactory
+import org.springframework.http.client.SimpleClientHttpRequestFactory
+import org.springframework.scheduling.annotation.EnableScheduling
+import org.springframework.stereotype.Component
+import org.springframework.web.client.RestTemplate
+import java.net.InetSocketAddress
+import java.net.Proxy
+
+
+@Configuration
+@EnableRedisRepositories
+class AppConfig {
+
+ @Autowired
+ private lateinit var redis: RedisProperties
+
+ @Bean
+ fun redisConnectionFactory(): RedisConnectionFactory {
+ val clientConfig = LettuceClientConfiguration.builder()
+ .readFrom(ReadFrom.SLAVE_PREFERRED)
+ .build()
+ val serverConfig = RedisStandaloneConfiguration(redis.host, redis.port)
+ if (redis.password.isNotEmpty()) {
+ serverConfig.password = RedisPassword.of(redis.password)
+ }
+ serverConfig.database = redis.database
+ return LettuceConnectionFactory(serverConfig, clientConfig)
+ }
+
+ @Bean("tenantCacheKey")
+ fun createTenantCacheableKey(): KeyGenerator {
+ return TenantCacheKeyGen()
+ }
+
+ @Bean
+ fun lockProvider(connectionFactory: RedisConnectionFactory): LockProvider {
+ return RedisLockProvider(connectionFactory, "prod")
+ }
+}
+
+@Configuration
+class HttpSessionConfig {
+ @Bean
+ fun sessionRedisTemplate(
+ connectionFactory: RedisConnectionFactory): RedisTemplate<Any, Any> {
+ val template = RedisTemplate<Any, Any>()
+ template.keySerializer = StringRedisSerializer()
+ template.hashKeySerializer = StringRedisSerializer()
+
+ template.setDefaultSerializer(GenericJackson2JsonRedisSerializer())
+ template.setConnectionFactory(connectionFactory)
+ return template
+ }
+}
+
+@Configuration
+class RestTemplateConfig {
+ @Component
+ @ConfigurationProperties("resttemplate.proxy")
+ class RestTemplateProxyConfig {
+ @Value("\${type:}")
+ lateinit var type: String
+ @Value("\${host:}")
+ lateinit var host: String
+ @Value("\${port:0}")
+ var port: Int = 0
+ }
+
+ @Bean
+ fun simpleClientHttpRequestFactory(proxyConfig: RestTemplateProxyConfig): SimpleClientHttpRequestFactory {
+ val factory = SimpleClientHttpRequestFactory()
+ factory.setConnectTimeout(15000)
+ factory.setReadTimeout(5000)
+ if (proxyConfig.type.isNotEmpty()) {
+ val proxyType = when (proxyConfig.type) {
+ "http" -> Proxy.Type.HTTP
+ "socks5" -> Proxy.Type.SOCKS
+ else -> Proxy.Type.DIRECT
+ }
+ factory.setProxy(Proxy(proxyType, InetSocketAddress(proxyConfig.host, proxyConfig.port)))
+ }
+ return factory
+ }
+
+ @Bean
+ fun restTemplate(factory: SimpleClientHttpRequestFactory): RestTemplate {
+ return RestTemplate(factory)
+ }
+}
+
+
+@SpringBootApplication
+@EnableDiscoveryClient
+@EnableScheduling
+@EnableCaching
+@ServletComponentScan
+class PayApiApplication : SpringBootServletInitializer() {
+
+ override fun configure(builder: SpringApplicationBuilder): SpringApplicationBuilder {
+ return builder.sources(PayApiApplication::class.java)
+ }
+}
+
+fun main(args: Array<String>) {
+ SpringApplication.run(PayApiApplication::class.java, * args)
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/alipay_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/alipay_service.kt
new file mode 100644
index 0000000..0174c65
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/alipay_service.kt
@@ -0,0 +1,61 @@
+package com.supwisdom.dlpay.agent.service
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.AgentPayService
+import com.supwisdom.dlpay.agent.AgentResponse
+import com.supwisdom.dlpay.api.bean.BaseResp
+import com.supwisdom.dlpay.api.domain.TTransactionMain
+import com.supwisdom.dlpay.api.service.ConsumePayService
+import com.supwisdom.dlpay.framework.util.TradeCode
+import com.supwisdom.dlpay.framework.util.TradeDict
+import org.springframework.stereotype.Component
+
+interface AlipayService {
+ fun doQrcodepay(transaction: TTransactionMain): AgentResponse
+
+ fun doPrepay(transaction: TTransactionMain): AgentResponse
+
+ fun doRefund(transaction: TTransactionMain): AgentResponse
+
+ fun doQuery(transaction: TTransactionMain): AgentResponse
+
+ fun doNotify(param: Map<String, String>): AgentResponse
+
+ /**
+ * 下载对账单
+ * */
+ fun downloadBill(shopacc:String,accdate:String): BaseResp
+}
+
+@Component("alipayAgent")
+class AlipayAgentService(val consumePayService: ConsumePayService,
+ val aipayService: AlipayService) : AgentPayService {
+
+ override fun auth(shopaccno: String?, billno: String?): AgentResponse {
+ if (consumePayService.checkShopPaytype(shopaccno!!, TradeDict.PAYTYPE_ALIPAY, true)) {
+ //TODO 支付宝实名认证逻辑
+ }
+ return AgentResponse().apply {
+ this.code = AgentCode.NOT_SUPPORT
+ }
+ }
+
+ override fun pay(transaction: TTransactionMain): AgentResponse {
+ return when (transaction.transCode) {
+ TradeCode.TRANSCODE_QRCODE -> aipayService.doQrcodepay(transaction)
+ else -> aipayService.doPrepay(transaction)
+ }
+ }
+
+ override fun cancel(transaction: TTransactionMain): AgentResponse {
+ return refund(transaction)
+ }
+
+ override fun refund(transaction: TTransactionMain): AgentResponse {
+ return aipayService.doRefund(transaction)
+ }
+
+ override fun query(transaction: TTransactionMain): AgentResponse {
+ return aipayService.doQuery(transaction)
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/balance_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/balance_service.kt
new file mode 100644
index 0000000..6852f9b
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/balance_service.kt
@@ -0,0 +1,39 @@
+package com.supwisdom.dlpay.agent.service
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.AgentPayService
+import com.supwisdom.dlpay.agent.AgentResponse
+import com.supwisdom.dlpay.api.domain.TTransactionMain
+import org.springframework.stereotype.Component
+
+@Component("balanceAgent")
+class BalanceAgentService : AgentPayService {
+ private val responseCode = AgentResponse().apply {
+ code = AgentCode.SUCCESS
+ agentCode = "0"
+ agentMsg = "成功"
+ agentRefno = ""
+ }
+
+ override fun auth(shopaccno: String?, billno: String?): AgentResponse {
+ return AgentResponse().apply {
+ this.code = AgentCode.NOT_SUPPORT
+ }
+ }
+
+ override fun pay(transaction: TTransactionMain): AgentResponse {
+ return responseCode
+ }
+
+ override fun cancel(transaction: TTransactionMain): AgentResponse {
+ return responseCode
+ }
+
+ override fun refund(transaction: TTransactionMain): AgentResponse {
+ return responseCode
+ }
+
+ override fun query(transaction: TTransactionMain): AgentResponse {
+ return responseCode
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/citizencard_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/citizencard_service.kt
new file mode 100644
index 0000000..5136d37
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/citizencard_service.kt
@@ -0,0 +1,99 @@
+package com.supwisdom.dlpay.agent.service
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.AgentPayService
+import com.supwisdom.dlpay.agent.AgentResponse
+import com.supwisdom.dlpay.agent.DtlStatus
+import com.supwisdom.dlpay.agent.citizencard.DlpayResp
+import com.supwisdom.dlpay.agent.citizencard.YnrccRespCode
+import com.supwisdom.dlpay.agent.citizencard.YnrccUtil
+import com.supwisdom.dlpay.api.domain.TTransactionMain
+import com.supwisdom.dlpay.framework.util.MoneyUtil
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Component
+
+interface CitizencardPayService {
+ fun bindCard(bankcardno: String, username: String, idtype: String, idno: String, phone: String): DlpayResp
+
+ fun signCard(bankcardno: String, username: String, idtype: String, idno: String, phone: String, transtype: String): DlpayResp
+
+ fun cardPay(shopaccno: String, userid: String, accdate: String, amount: Int, refno: String): DlpayResp
+
+ fun cardPayRefund(refno: String, accdate: String, orignRefno: String, amount: Int): DlpayResp
+
+ fun queryResult(orignRefno: String): DlpayResp
+
+ fun getChkfilename(checkdate: String, merchantBankcardno: String?): DlpayResp
+
+}
+
+@Component("citizenCardAgent")
+class CitizenCardPayAgent : AgentPayService {
+ @Autowired
+ private lateinit var citizencardPayService: CitizencardPayService
+
+ private fun agentCode(code: String, msg: String?): org.springframework.data.util.Pair<AgentCode, YnrccRespCode> {
+ return YnrccUtil.errcode.firstOrNull {
+ it.second.code == code
+ }?.let {
+ org.springframework.data.util.Pair.of(it.first, YnrccRespCode(
+ code, it.second.msg.replace("{message}", msg ?: "未知")
+ ))
+ } ?: org.springframework.data.util.Pair.of(AgentCode.COMMON_ERROR,
+ YnrccRespCode(code, msg ?: "未知"))
+ }
+
+ override fun auth(shopaccno: String?, billno: String?): AgentResponse {
+ return AgentResponse().apply {
+ this.code = AgentCode.NOT_SUPPORT
+ }
+ }
+
+ override fun pay(transaction: TTransactionMain): AgentResponse {
+ val resp = citizencardPayService.cardPay(transaction.shopDtl.shopaccno, transaction.personDtl.userid, transaction.accdate,
+ MoneyUtil.YuanToFen(transaction.personDtl.amount), transaction.refno)
+
+ return AgentResponse().also {
+ val code = agentCode(resp.code, resp.message)
+ it.code = code.first
+ it.agentCode = code.second.code
+ it.agentMsg = code.first.message() + "-" + code.second.msg
+ it.agentRefno = resp.bankjourno
+ }
+ }
+
+ override fun cancel(transaction: TTransactionMain): AgentResponse {
+ return refund(transaction)
+ }
+
+ override fun refund(transaction: TTransactionMain): AgentResponse {
+ val resp = citizencardPayService.cardPayRefund(transaction.refno, transaction.accdate,
+ transaction.reverseRefno, MoneyUtil.YuanToFen(transaction.personDtl.amount))
+
+ return AgentResponse().also {
+ val code = agentCode(resp.code, resp.message)
+ it.code = code.first
+ it.agentCode = code.second.code
+ it.agentMsg = code.first.message() + "-" + code.second.msg
+ it.agentRefno = resp.bankjourno
+ }
+ }
+
+ override fun query(transaction: TTransactionMain): AgentResponse {
+ val resp = citizencardPayService.queryResult(transaction.refno)
+
+ return AgentResponse().also {
+ val code = agentCode(resp.code, resp.message)
+ it.code = code.first
+ it.agentCode = code.second.code
+ it.agentMsg = code.first.message() + "-" + code.second.msg
+ it.agentRefno = resp.bankjourno
+ it.dtlStatus = when (resp.status) {
+ YnrccUtil.DTL_STATUS_SUCCESS -> DtlStatus.SUCCESS
+ YnrccUtil.DTL_STATUS_REFUND -> DtlStatus.REFUND
+ YnrccUtil.DTL_STATUS_PART_REFUND -> DtlStatus.PARTIAL_REFUND
+ else -> DtlStatus.FAIL
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/alipay_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/alipay_service_impl.kt
new file mode 100644
index 0000000..ccae15f
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/alipay_service_impl.kt
@@ -0,0 +1,263 @@
+package com.supwisdom.dlpay.agent.service.impl
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.AgentResponse
+import com.supwisdom.dlpay.agent.service.AlipayService
+import com.supwisdom.dlpay.api.service.SourceTypeService
+import com.supwisdom.dlpay.framework.util.TradeDict
+import com.supwisdom.dlpay.util.PaytypeUtil
+import mu.KotlinLogging
+import org.springframework.stereotype.Service
+import com.alipay.api.request.AlipayTradePayRequest
+import com.alipay.api.DefaultAlipayClient
+import com.alipay.api.domain.AlipayTradePayModel
+import com.supwisdom.dlpay.agent.service.AgentServiceProxy
+import com.supwisdom.dlpay.api.domain.TTransactionMain
+import com.alipay.api.AlipayApiException
+import com.alipay.api.internal.util.AlipaySignature
+import com.alipay.api.request.AlipayTradeAppPayRequest
+import com.supwisdom.dlpay.api.service.ConsumePayService
+import com.supwisdom.dlpay.api.service.TransactionServiceProxy
+import com.alipay.api.request.AlipayTradeQueryRequest
+import com.supwisdom.dlpay.agent.DtlStatus
+import com.alipay.api.domain.AlipayTradeQueryModel
+import com.alipay.api.domain.AlipayTradeRefundModel
+import com.supwisdom.dlpay.api.bean.BaseResp
+
+
+@Service
+class AlipayServiceImpl(val sourceTypeService: SourceTypeService,
+ val agentServiceProxy: AgentServiceProxy,
+ val consumePayService: ConsumePayService,
+ val transactionService: TransactionServiceProxy) : AlipayService {
+ val logger = KotlinLogging.logger { }
+
+ fun checkCfg(config: Map<String, String?>, resp: AgentResponse): Boolean {
+ if (config[PaytypeUtil.CFG_ALIPAY_APPID].isNullOrEmpty()
+ || config[PaytypeUtil.CFG_ALIPAY_PRIVATEKEY].isNullOrEmpty()
+ || config[PaytypeUtil.CFG_ALIPAY_PUBLICKEY].isNullOrEmpty()) {
+ resp.code = AgentCode.CONFIG_ERROR
+ resp.agentCode = AgentResponse.AGENTCODE_FAIL
+ resp.agentMsg = "支付宝相关配置为空"
+ logger.error { "请检查:${PaytypeUtil.CFG_ALIPAY_APPID},${PaytypeUtil.CFG_ALIPAY_PRIVATEKEY},${PaytypeUtil.CFG_ALIPAY_PUBLICKEY}" }
+ return false
+ }
+ return true
+ }
+
+ override fun doQrcodepay(transaction: TTransactionMain): AgentResponse {
+ var qrcodePayTrans = agentServiceProxy.qrcodePayTransFindByRefno(transaction.refno)
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_ALIPAY, transaction.shopDtl.shopaccno, qrcodePayTrans.isAnonymous, false)
+ var agentResponse = AgentResponse()
+ if (checkCfg(config, agentResponse)) {
+ var payurl = config[PaytypeUtil.CFG_ALIPAY_PAYURL]
+ if (payurl.isNullOrEmpty()) {
+ payurl = "https://openapi.alipay.com/gateway.do"
+ }
+ val alipayClient = DefaultAlipayClient(payurl, config[PaytypeUtil.CFG_ALIPAY_APPID], config[PaytypeUtil.CFG_ALIPAY_PRIVATEKEY], "json", "UTF-8", config[PaytypeUtil.CFG_ALIPAY_PUBLICKEY], "RSA2")
+ val request = AlipayTradePayRequest()
+ request.bizModel = AlipayTradePayModel().apply {
+ this.authCode = qrcodePayTrans.qrcode
+ this.outTradeNo = transaction.refno
+ this.subject = "POS扫支付宝二维码消费"
+ this.totalAmount = transaction.shopDtl.amount.toString()
+ }
+ try {
+ val response = alipayClient.execute(request)
+ if ("10000" == response.code) {
+ if (response.isSuccess) {
+ agentResponse.code = AgentCode.SUCCESS
+ agentResponse.agentRefno = response.tradeNo
+ agentResponse.agentMsg = response.msg
+ agentResponse.agentCode = response.code
+ qrcodePayTrans.agentRefno = response.tradeNo
+ agentServiceProxy.qrcodePayTransSaveOrUpdate(qrcodePayTrans)
+ } else {
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentMsg = response.msg
+ agentResponse.agentCode = response.code
+ logger.error { "支付宝:${response.code},${response.msg},${response.subCode},${response.subMsg}" }
+ }
+ } else if ("10003" == response.code || "20000" == response.code) {
+ agentResponse.code = AgentCode.REQUIRE_QUERY
+ agentResponse.agentMsg = response.msg
+ agentResponse.agentCode = response.code
+ logger.error { "支付宝:${response.code},${response.msg},${response.subCode},${response.subMsg}" }
+ } else {
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentMsg = response.msg
+ agentResponse.agentCode = response.code
+ logger.error { "支付宝:${response.code},${response.msg},${response.subCode},${response.subMsg}" }
+ }
+ } catch (e: AlipayApiException) {
+ logger.error { "支付宝:${e.message}" }
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentMsg = "调用支付宝异常"
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ }
+ }
+ return agentResponse
+ }
+
+ override fun doPrepay(transaction: TTransactionMain): AgentResponse {
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_ALIPAY, transaction.shopDtl.shopaccno, false, false)
+ var agentResponse = AgentResponse()
+ if (checkCfg(config, agentResponse)) {
+ if (config[PaytypeUtil.CFG_ALIPAY_NOTIFY].isNullOrEmpty()) {
+ agentResponse.code = AgentCode.CONFIG_ERROR
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ agentResponse.agentMsg = "支付宝相关配置为空"
+ logger.error { "支付宝异步通知地址未配置:${PaytypeUtil.CFG_ALIPAY_NOTIFY}" }
+ }
+ var payurl = config[PaytypeUtil.CFG_ALIPAY_PAYURL]
+ if (payurl.isNullOrEmpty()) {
+ payurl = "https://openapi.alipay.com/gateway.do"
+ }
+ val alipayClient = DefaultAlipayClient(payurl, config[PaytypeUtil.CFG_ALIPAY_APPID], config[PaytypeUtil.CFG_ALIPAY_PRIVATEKEY], "json", "UTF-8", config[PaytypeUtil.CFG_ALIPAY_PUBLICKEY], "RSA2")
+ val request = AlipayTradeAppPayRequest()
+ var productCode = ""
+ //判断是否为H5
+ //productCode = "QUICK_WAP_WAY"
+ request.bizModel = AlipayTradePayModel().apply {
+ this.outTradeNo = transaction.refno
+ this.subject = "支付宝支付"
+ this.totalAmount = transaction.shopDtl.amount.toString()
+ this.productCode = productCode
+ }
+ request.notifyUrl = config[PaytypeUtil.CFG_ALIPAY_NOTIFY]
+ request.returnUrl = config[PaytypeUtil.CFG_ALIPAY_RETURNURL]
+ try {
+ /**
+ * h5 支付方式
+ * String form = alipayClient.pageExecute(request).getBody();
+ *
+ * */
+ val response = alipayClient.sdkExecute(request)
+ if (response.isSuccess) {
+ agentResponse.agentRefno = response.tradeNo
+ agentResponse.agentMsg = response.msg
+ agentResponse.agentCode = response.code
+ //body 为APP
+ agentResponse.agentBody = response.body
+ } else {
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentMsg = response.msg
+ agentResponse.agentCode = response.code
+ logger.error { "支付宝:${response.code},${response.msg},${response.subCode},${response.subMsg}" }
+ }
+ } catch (e: AlipayApiException) {
+ logger.error { "支付宝:${e.message}" }
+ agentResponse.code = AgentCode.FAIL
+ }
+ }
+ return agentResponse
+ }
+
+ override fun doRefund(transaction: TTransactionMain): AgentResponse {
+ var agentResponse = AgentResponse()
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_ALIPAY, transaction.shopDtl.shopaccno, false, false)
+ if (checkCfg(config, agentResponse)) {
+ var payurl = config[PaytypeUtil.CFG_ALIPAY_PAYURL]
+ if (payurl.isNullOrEmpty()) {
+ payurl = "https://openapi.alipay.com/gateway.do"
+ }
+ val alipayClient = DefaultAlipayClient(payurl, config[PaytypeUtil.CFG_ALIPAY_APPID], config[PaytypeUtil.CFG_ALIPAY_PRIVATEKEY], "json", "UTF-8", config[PaytypeUtil.CFG_ALIPAY_PUBLICKEY], "RSA2")
+ val request = AlipayTradeQueryRequest()
+ request.bizModel = AlipayTradeRefundModel().apply {
+ this.outTradeNo = transaction.refno
+ this.refundAmount = transaction.shopDtl.amount.toString()
+ }
+ val response = alipayClient.execute(request)
+ if (response.isSuccess) {
+ agentResponse.code = AgentCode.SUCCESS
+ agentResponse.agentMsg = response.msg
+ agentResponse.agentCode = response.code
+ agentResponse.dtlStatus = DtlStatus.REFUND
+ } else {
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentMsg = response.msg
+ agentResponse.agentCode = response.code
+ }
+ }
+ return agentResponse
+ }
+
+ override fun doQuery(transaction: TTransactionMain): AgentResponse {
+ var agentResponse = AgentResponse()
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_ALIPAY, transaction.shopDtl.shopaccno, false, false)
+ if (checkCfg(config, agentResponse)) {
+ var payurl = config[PaytypeUtil.CFG_ALIPAY_PAYURL]
+ if (payurl.isNullOrEmpty()) {
+ payurl = "https://openapi.alipay.com/gateway.do"
+ }
+ val alipayClient = DefaultAlipayClient(payurl, config[PaytypeUtil.CFG_ALIPAY_APPID], config[PaytypeUtil.CFG_ALIPAY_PRIVATEKEY], "json", "UTF-8", config[PaytypeUtil.CFG_ALIPAY_PUBLICKEY], "RSA2")
+ val request = AlipayTradeQueryRequest()
+ request.bizModel = AlipayTradeQueryModel().apply {
+ this.outTradeNo = transaction.refno
+ }
+ val response = alipayClient.execute(request)
+ if (response.isSuccess) {
+ //check response.totalAmount
+ agentResponse.code = AgentCode.SUCCESS
+ agentResponse.agentMsg = response.msg
+ agentResponse.agentCode = response.code
+ when (response.tradeStatus) {
+ "TRADE_SUCCESS", "TRADE_FINISHED" -> agentResponse.dtlStatus = DtlStatus.SUCCESS
+ "TRADE_CLOSED" -> agentResponse.dtlStatus = DtlStatus.REFUND
+ "WAIT_BUYER_PAY" -> agentResponse.dtlStatus = DtlStatus.WAIT
+ }
+ } else {
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentMsg = response.msg
+ agentResponse.agentCode = response.code
+ }
+ }
+ return agentResponse
+ }
+
+ override fun doNotify(param: Map<String, String>): AgentResponse {
+ var refno = param["out_trade_no"]
+ var agentResponse = AgentResponse()
+ if (refno.isNullOrEmpty()) {
+ agentResponse.code = AgentCode.FAIL
+ return agentResponse
+ }
+ var transaction = consumePayService.getTransactionMainDtl(refno, null, null)
+ if (transaction == null) {
+ agentResponse.code = AgentCode.REFNO_NOT_EXISTS
+ return agentResponse
+ }
+ if (transaction.status == TradeDict.DTL_STATUS_SUCCESS) {
+ agentResponse.code = AgentCode.SUCCESS
+ return agentResponse
+ }
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_ALIPAY, transaction.shopDtl.shopaccno, false, false)
+ if (config[PaytypeUtil.CFG_ALIPAY_PUBLICKEY].isNullOrEmpty()) {
+ agentResponse.code = AgentCode.CONFIG_ERROR
+ return agentResponse
+ }
+ var flag = AlipaySignature.rsaCheckV1(param, config[PaytypeUtil.CFG_ALIPAY_PUBLICKEY], "UTF-8", "RSA2")
+ return when (flag) {
+ true -> {
+ //total amt 校验 map["total_amount"]
+ var tradeno = param["trade_no"]
+ if (tradeno.isNullOrEmpty()) {
+ transactionService.success(transaction.refno)
+ } else {
+ transactionService.success(transaction.refno, tradeno, true)
+ }
+ agentResponse.code = AgentCode.SUCCESS
+ agentResponse
+ }
+ false -> {
+ logger.error { "支付宝签名校验错误" }
+ agentResponse.code = AgentCode.FAIL
+ agentResponse
+ }
+ }
+ }
+
+ override fun downloadBill(shopacc: String, accdate: String): BaseResp {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/citizencard_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/citizencard_service_impl.kt
new file mode 100644
index 0000000..2eddc6b
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/citizencard_service_impl.kt
@@ -0,0 +1,369 @@
+package com.supwisdom.dlpay.agent.service.impl
+
+import com.google.gson.Gson
+import com.sun.jersey.api.client.Client
+import com.sun.jersey.api.client.ClientResponse
+import com.supwisdom.dlpay.agent.citizencard.DlpayResp
+import com.supwisdom.dlpay.api.service.CardService
+import com.supwisdom.dlpay.api.service.SourceTypeService
+import com.supwisdom.dlpay.api.service.UserService
+import com.supwisdom.dlpay.api.types.IDTypes
+import com.supwisdom.dlpay.agent.service.CitizencardPayService
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.util.*
+import com.supwisdom.dlpay.agent.citizencard.YnrccUtil
+import mu.KotlinLogging
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+import javax.ws.rs.core.MediaType
+
+@Service
+class CitizencardPayServiceImpl : CitizencardPayService {
+ @Autowired
+ lateinit var sourceTypeService: SourceTypeService
+ @Autowired
+ lateinit var systemUtilService: SystemUtilService
+ @Autowired
+ lateinit var cardService: CardService
+ @Autowired
+ lateinit var userService: UserService
+
+ private val logger = KotlinLogging.logger { }
+
+ private fun checkCitizencardConfig(config: Map<String, String?>, resp: DlpayResp): Boolean {
+ val agentUrl = config[YnrccUtil.YNRCC_ANGENT_URL]
+ val signKey = config[YnrccUtil.YNRCC_SIGNKEY]
+ if (agentUrl.isNullOrEmpty()) {
+ resp.code = YnrccUtil.PARAM_CONFIG_ERROR
+ resp.message = "系统参数未配置[农商行前置地址前缀]"
+ logger.error(resp.message)
+ return false
+ }
+ if (signKey.isNullOrEmpty()) {
+ resp.code = YnrccUtil.PARAM_CONFIG_ERROR
+ resp.message = "系统参数未配置[农商行前置签名秘钥]"
+ logger.error(resp.message)
+ return false
+ }
+ return true
+ }
+
+ override fun bindCard(bankcardno: String, username: String, idtype: String, idno: String, phone: String): DlpayResp {
+ var resp = DlpayResp()
+ val config = sourceTypeService.getChargePaytypeConfig(TradeDict.PAYTYPE_CITIZEN_CARD, true)
+ if (!checkCitizencardConfig(config, resp)) {
+ return resp
+ }
+ val idType = IDTypes.findByValue(idtype)
+ if (idType < 0) {
+ resp.code = YnrccUtil.PARAM_VALUE_ERROR
+ resp.message = "证件类型未识别[$idtype]"
+ logger.error(resp.message)
+ return resp
+ }
+ val systime = systemUtilService.sysdatetime
+ val refno = systemUtilService.refno
+ val params = hashMapOf<String, String>()
+ params.plus(mapOf(
+ "transcode" to YnrccUtil.BANKCARD_BIND_TRANSCODE,
+ "transdate" to systime.hostdate,
+ "transtime" to systime.hosttime,
+ "categorie" to YnrccUtil.DLPAY_CATEGORIE,
+ "refno" to refno,
+ "bankcardno" to bankcardno,
+ "username" to username,
+ "idtype" to idType,
+ "idno" to idno,
+ "phone" to phone,
+ "sign_type" to "MD5"
+ ))
+ val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
+ params["sign"] = sign
+ val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/bindcard"
+ logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
+ val client = Client.create()
+ client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ return if (200 == respClient.status) {
+ resp = respClient.getEntity(DlpayResp::class.java)
+ logger.error("refno=[$refno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ resp
+ } else {
+ resp.code = "99"
+ resp.message = "请求前置返回失败[httpStatus=$respClient.status]"
+ logger.error(resp.message)
+ resp
+ }
+ }
+
+ override fun signCard(bankcardno: String, username: String, idtype: String, idno: String, phone: String, transtype: String): DlpayResp {
+ var resp = DlpayResp()
+ val config = sourceTypeService.getChargePaytypeConfig(TradeDict.PAYTYPE_CITIZEN_CARD, true)
+ if (!checkCitizencardConfig(config, resp)) {
+ return resp
+ }
+ val idType = IDTypes.findByValue(idtype)
+ if (idType < 0) {
+ resp.code = YnrccUtil.PARAM_VALUE_ERROR
+ resp.message = "证件类型未识别[$idtype]"
+ logger.error(resp.message)
+ return resp
+ }
+ if (YnrccUtil.TRANSTYPE_SIGNCARD != transtype && YnrccUtil.TRANSTYPE_UNSIGNCARD != transtype) {
+ resp.code = YnrccUtil.PARAM_VALUE_ERROR
+ resp.message = "签约类型错误[$transtype]"
+ logger.error(resp.message)
+ return resp
+ }
+
+ val systime = systemUtilService.sysdatetime
+ val refno = systemUtilService.refno
+ val params = hashMapOf<String, String>()
+ params.plus(mapOf(
+ "transcode" to YnrccUtil.BANKCARD_SIGN_TRANSCODE,
+ "transdate" to systime.hostdate,
+ "transtime" to systime.hosttime,
+ "refno" to refno,
+ "categorie" to YnrccUtil.DLPAY_CATEGORIE,
+ "transtype" to transtype,
+ "bankcardno" to bankcardno,
+ "username" to username,
+ "idtype" to idType,
+ "idno" to idno,
+ "phone" to phone,
+ "sign_type" to "MD5"
+ ))
+ val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
+ params["sign"] = sign
+ val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/signcard"
+ logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
+ val client = Client.create()
+ client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ return if (200 == respClient.status) {
+ resp = respClient.getEntity(DlpayResp::class.java)
+ logger.error("refno=[$refno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ resp
+ } else {
+ resp.code = "99"
+ resp.message = "请求前置返回失败[httpStatus=$respClient.status]"
+ logger.error(resp.message)
+ resp
+ }
+ }
+
+ override fun cardPay(shopaccno: String, userid: String, accdate: String, amount: Int, refno: String): DlpayResp {
+ var resp = DlpayResp()
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_CITIZEN_CARD, shopaccno, false, false)
+ if (!checkCitizencardConfig(config, resp)) {
+ return resp
+ }
+ val merchantBankcardno = config[YnrccUtil.YNRCC_MERCHANT_BANKCARDNO]
+ val merchantBankaccname = config[YnrccUtil.YNRCC_MERCHANT_BANKACCNAME]
+ if (StringUtil.isEmpty(merchantBankcardno) || StringUtil.isEmpty(merchantBankaccname)) {
+ resp.code = YnrccUtil.PARAM_CONFIG_ERROR
+ resp.message = "系统参数未配置[商户收款银行账号]"
+ logger.error(resp.message)
+ return resp
+ }
+ val person = userService.findOnePersonByUserid(userid)
+ val idType = IDTypes.findByValue(person.idtype)
+ if (idType < 0) {
+ resp.code = YnrccUtil.PARAM_VALUE_ERROR
+ resp.message = "证件类型未识别[${person.idtype}]"
+ logger.error(resp.message)
+ return resp
+ }
+ val userBankcard = cardService.getBankcardByUserid(person.userid)
+ if (null == userBankcard) {
+ resp.code = "99"
+ resp.message = "用户[${person.userid}]未绑定银行卡"
+ logger.error(resp.message)
+ return resp
+ } else if (TradeDict.STATUS_NORMAL != userBankcard.status) {
+ resp.code = "99"
+ resp.message = "用户[${person.userid}]绑定银行卡状态异常"
+ logger.error(resp.message)
+ return resp
+ } else if (!userBankcard.signed) {
+ resp.code = "99"
+ resp.message = "用户[${person.userid}]绑定银行卡未签约"
+ logger.error(resp.message)
+ return resp
+ }
+ val bankcardno = userBankcard.cardno
+
+ val systime = systemUtilService.sysdatetime
+ val params = hashMapOf<String, String>()
+ params.plus(mapOf(
+ "transcode" to YnrccUtil.BANKCARD_PAY_TRANSCODE,
+ "transdate" to accdate, //我们的记账日期
+ "transtime" to systime.hosttime,
+ "refno" to refno,
+ "categorie" to YnrccUtil.DLPAY_CATEGORIE,
+ "bankcardno" to bankcardno,
+ "username" to person.name,
+ "idtype" to idType,
+ "idno" to person.idno,
+ "merchant_bankcardno" to merchantBankcardno,
+ "merchant_bankaccname" to merchantBankaccname,
+ "amount" to amount,
+ "description" to "市民卡代扣消费",
+ "sign_type" to "MD5"
+ ))
+ val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
+ params["sign"] = sign
+ val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/cardpay"
+ logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
+ try {
+ val client = Client.create()
+ client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ return if (200 == respClient.status) {
+ resp = respClient.getEntity(DlpayResp::class.java)
+ logger.error("refno=[$refno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ resp
+ } else {
+ resp.code = "99"
+ resp.message = "请求前置返回失败[httpStatus=$respClient.status]"
+ logger.error(resp.message)
+ resp
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ resp.code = YnrccUtil.CODE_EXCEPTION
+ resp.message = "请求前置抛出异常"
+ logger.error(resp.message)
+ return resp
+ }
+ }
+
+ override fun cardPayRefund(refno: String, accdate: String, orignRefno: String, amount: Int): DlpayResp {
+ var resp = DlpayResp()
+ val config = sourceTypeService.getChargePaytypeConfig(TradeDict.PAYTYPE_CITIZEN_CARD, true)
+ if (!checkCitizencardConfig(config, resp)) {
+ return resp
+ }
+
+ val systime = systemUtilService.sysdatetime
+ val params = hashMapOf<String, String>()
+ params.plus(mapOf(
+ "transcode" to YnrccUtil.BANKCARD_PAYREFUND_TRANSCODE,
+ "transdate" to accdate, //我们的记账日期
+ "transtime" to systime.hosttime,
+ "refno" to refno,
+ "refundRefno" to orignRefno,
+ "amount" to amount,
+ "description" to "市民卡代扣消费退款",
+ "sign_type" to "MD5"
+ ))
+ val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
+ params["sign"] = sign
+ val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/cardpayrefund"
+ logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
+ try {
+ val client = Client.create()
+ client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ return if (200 == respClient.status) {
+ resp = respClient.getEntity(DlpayResp::class.java)
+ logger.error("refno=[$refno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ resp
+ } else {
+ resp.code = "99"
+ resp.message = "请求前置返回失败[httpStatus=$respClient.status]"
+ logger.error(resp.message)
+ resp
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ resp.code = YnrccUtil.CODE_EXCEPTION
+ resp.message = "请求前置抛出异常"
+ logger.error(resp.message)
+ return resp
+ }
+ }
+
+ override fun queryResult(orignRefno: String): DlpayResp {
+ var resp = DlpayResp()
+ val config = sourceTypeService.getChargePaytypeConfig(TradeDict.PAYTYPE_CITIZEN_CARD, true)
+ if (!checkCitizencardConfig(config, resp)) {
+ return resp
+ }
+
+ val systime = systemUtilService.sysdatetime
+ val refno = systemUtilService.refno
+ val params = hashMapOf<String, String>()
+ params.plus(mapOf(
+ "transcode" to YnrccUtil.BANKCARD_QUERYRESULT_TRANSCODE,
+ "transdate" to systime.hostdate,
+ "transtime" to systime.hosttime,
+ "refno" to refno,
+ "orignRefno" to orignRefno,
+ "sign_type" to "MD5"
+ ))
+ val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
+ params["sign"] = sign
+ val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/queryresult"
+ logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
+ try {
+ val client = Client.create()
+ client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ return if (200 == respClient.status) {
+ resp = respClient.getEntity(DlpayResp::class.java)
+ logger.error("refno=[$orignRefno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ resp
+ } else {
+ resp.code = "99"
+ resp.message = "请求前置返回失败[httpStatus=$respClient.status]"
+ logger.error(resp.message)
+ resp
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ resp.code = YnrccUtil.CODE_EXCEPTION
+ resp.message = "请求前置抛出异常"
+ logger.error(resp.message)
+ return resp
+ }
+ }
+
+ override fun getChkfilename(checkdate: String, merchantBankcardno: String?): DlpayResp {
+ var resp = DlpayResp()
+ val config = sourceTypeService.getChargePaytypeConfig(TradeDict.PAYTYPE_CITIZEN_CARD, true)
+ if (!checkCitizencardConfig(config, resp)) {
+ return resp
+ }
+ val systime = systemUtilService.sysdatetime
+ val refno = systemUtilService.refno
+ val params = hashMapOf<String, String>()
+ params.plus(mapOf(
+ "transcode" to YnrccUtil.BANKCARD_CHKFILE_TRANSCODE,
+ "transdate" to systime.hostdate,
+ "transtime" to systime.hosttime,
+ "refno" to refno,
+ "checkdate" to checkdate,
+ "merchant_bankcardno" to merchantBankcardno,
+ "sign_type" to "MD5"
+ ))
+ val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
+ params["sign"] = sign
+ val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/bindcard"
+ logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
+ val client = Client.create()
+ client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ return if (200 == respClient.status) {
+ resp = respClient.getEntity(DlpayResp::class.java)
+ logger.error("refno=[$refno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ resp
+ } else {
+ resp.code = "99"
+ resp.message = "请求前置返回失败[httpStatus=$respClient.status]"
+ logger.error(resp.message)
+ resp
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/swykt_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/swykt_service_impl.kt
new file mode 100644
index 0000000..6b64727
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/swykt_service_impl.kt
@@ -0,0 +1,131 @@
+package com.supwisdom.dlpay.agent.service.impl
+
+import com.google.gson.Gson
+import com.sun.jersey.api.client.Client
+import com.sun.jersey.api.client.ClientResponse
+import com.supwisdom.dlpay.agent.service.SWYKTV5Service
+import com.supwisdom.dlpay.api.bean.BaseResp
+import com.supwisdom.dlpay.api.bean.SupStatusRevResp
+import com.supwisdom.dlpay.api.bean.SupYktResp
+import com.supwisdom.dlpay.api.service.SourceTypeService
+import com.supwisdom.dlpay.api.service.UserService
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.util.*
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+
+@Service
+class SWYKTV5ServiceImpl :SWYKTV5Service {
+ @Autowired
+ lateinit var sourceTypeService: SourceTypeService
+ @Autowired
+ lateinit var systemUtilService: SystemUtilService
+ @Autowired
+ lateinit var userService: UserService
+
+ override fun onLineThirdPay(shopaccno: String, userid: String, accdate: String, amount: Int, refno: String): BaseResp {
+ val code = BaseResp()
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_YKT_CARD, shopaccno, false, false)
+ val appid = config["appid"]
+ if (appid.isNullOrEmpty()) {
+ code.retcode = "1"
+ code.retmsg = "一卡通支付方式未启用或未配置[appid]"
+ return code
+ }
+ val appkey = config["appkey"]
+ if (appkey.isNullOrEmpty()) {
+ code.retcode = "1"
+ code.retmsg = "一卡通支付方式未启用或未配置[appkey]"
+ return code
+ }
+ val orderurl = config["orderurl"]
+ if (orderurl.isNullOrEmpty()) {
+ code.retcode = "1"
+ code.retmsg = "一卡通支付方式未启用或未配置[orderurl]"
+ return code
+ }
+ val person = userService.findOnePersonByUserid(userid)
+
+ val params = hashMapOf<String, String?>()
+ params.put("partner_id", appid)
+ params.put("stuempno", person.idno)
+ params.put("tradeno",refno)
+ params.put("tradename", "校园卡支付")
+ params.put("amount", amount.toString())
+ //TODO 解决一卡通商户号问题
+ //params.put("shopid", yktshopid)
+ //params.put("devphyid", devphyid)
+ params.put("calcmanagefee", "T") //是否计算费率
+ params.put("timestamp", DateUtil.getNow())
+ params.put("sign_method", "HMAC");
+ params.put("limitflag", "off") //是否判断消费限额,on-判断;off-不判断。默认on(判断限额)。为空或不为off都是on;
+ var signstr = StringUtil.createLinkString(HmacUtil.paraFilter(params))
+ val sign = HmacUtil.HMACSHA1(signstr, appkey)
+ signstr = "$signstr&sign=$sign&sourcetype=food"
+ val c = Client.create()
+ c.setConnectTimeout(20000)
+ val r = c.resource(orderurl)
+ val respClient = r.post(ClientResponse::class.java, signstr)
+ if (200 == respClient.status) {
+ val ret = respClient.getEntity(String::class.java)
+ if (ret != null) {
+ try {
+ val gson = Gson()
+ val result = gson.fromJson(ret, SupYktResp::class.java)
+ if (result == null) {
+ code.retcode = "1"
+ code.retmsg = "返回内容为空"
+ return code
+ }
+ if ("0" != result.retcode) {
+ if ("30" == result.retcode) {
+ if (result.other != null) {
+ try {
+ val supStatusRevResp = gson.fromJson(result.other,
+ SupStatusRevResp::class.java)
+ if (supStatusRevResp != null) {
+ //同流水号,同一笔已经支付完成的,不重复支付。
+ if (3 == supStatusRevResp.status
+ && supStatusRevResp.revflag != null
+ && !supStatusRevResp.revflag) {
+ code.retcode = "0"
+ code.retmsg = "成功"
+ return code
+ }
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ }
+ }
+ code.retcode = "1"
+ code.retmsg = "交易失败:" + result.retmsg
+ return code
+ }
+ code.retcode = "0"
+ code.retmsg = "成功"
+ return code
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ }
+ }
+ code.retcode = "1"
+ code.retmsg = "请求失败"
+ return code
+ }
+
+ override fun onLineCardPay(): BaseResp {
+ TODO("not implemented")
+ }
+
+ override fun onLineCardPayConfirm(): BaseResp {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun offLineCardTransdtl(): BaseResp {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/wechat_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/wechat_service_impl.kt
new file mode 100644
index 0000000..1f3b6d1
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/impl/wechat_service_impl.kt
@@ -0,0 +1,327 @@
+package com.supwisdom.dlpay.agent.service.impl
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.AgentResponse
+import com.supwisdom.dlpay.agent.DtlStatus
+import com.supwisdom.dlpay.agent.service.AgentServiceProxy
+import com.supwisdom.dlpay.agent.service.WechatService
+import com.supwisdom.dlpay.api.bean.BaseResp
+import com.supwisdom.dlpay.api.bean.WechatReqResp
+import com.supwisdom.dlpay.api.dao.PersonIdentityDao
+import com.supwisdom.dlpay.api.domain.TTransactionMain
+import com.supwisdom.dlpay.api.service.ConsumePayService
+import com.supwisdom.dlpay.api.service.SourceTypeService
+import com.supwisdom.dlpay.api.service.TransactionServiceProxy
+import com.supwisdom.dlpay.framework.util.*
+import com.supwisdom.dlpay.util.PaytypeUtil
+import mu.KotlinLogging
+import org.apache.commons.lang.StringUtils
+import org.springframework.http.converter.StringHttpMessageConverter
+import org.springframework.stereotype.Service
+import org.springframework.web.client.RestTemplate
+import java.nio.charset.StandardCharsets
+
+
+@Service
+class WechatServiceImpl(val sourceTypeService: SourceTypeService,
+ val agentServiceProxy: AgentServiceProxy,
+ val personIdentityDao: PersonIdentityDao,
+ val consumePayService: ConsumePayService,
+ val transactionService: TransactionServiceProxy,
+ val restTemplate: RestTemplate) : WechatService {
+
+ val logger = KotlinLogging.logger { }
+
+ fun checkCfg(config: Map<String, String?>, resp: AgentResponse): Boolean {
+ if (config[PaytypeUtil.CFG_WECHAT_APPID].isNullOrEmpty()
+ || config[PaytypeUtil.CFG_WECHAT_MECHKEY].isNullOrEmpty()
+ || config[PaytypeUtil.CFG_WECHAT_MECHID].isNullOrEmpty()) {
+ resp.code = AgentCode.CONFIG_ERROR
+ resp.agentCode = AgentResponse.AGENTCODE_FAIL
+ resp.agentMsg = "微信相关配置为空"
+ logger.error { "请检查:${PaytypeUtil.CFG_WECHAT_APPID},${PaytypeUtil.CFG_WECHAT_MECHID},${PaytypeUtil.CFG_WECHAT_MECHKEY}" }
+ return false
+ }
+ return true
+ }
+
+ override fun doAuth(shopaccno: String?, billno: String?): AgentResponse {
+ var qrcodeTrans = agentServiceProxy.qrcodePayTransFindByMerchIdAndBillno(shopaccno, billno)
+ var agentResponse = AgentResponse()
+ if (qrcodeTrans == null) {
+ agentResponse.code = AgentCode.REFNO_NOT_EXISTS
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ return agentResponse
+ }
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_WECHAT, shopaccno, qrcodeTrans.isAnonymous, false)
+ if (checkCfg(config, agentResponse)) {
+ val bean = WechatReqResp().apply {
+ this.appid = config[PaytypeUtil.CFG_WECHAT_APPID]
+ this.auth_code = qrcodeTrans.qrcode
+ this.mch_id = config[PaytypeUtil.CFG_WECHAT_MECHID]
+ this.key = config[PaytypeUtil.CFG_WECHAT_MECHKEY]
+ }
+ bean.generalCheckSign()
+ var xml = bean.generalCheckXML()
+ restTemplate.messageConverters[1] = StringHttpMessageConverter(StandardCharsets.UTF_8)
+ var res = restTemplate.postForEntity(PaytypeUtil.CFG_WECHAT_OAUTHCODE, xml, String::class.java)
+ var eleMap = XmlUtils.parseXml(res.body)
+ var retcode = eleMap["return_code"]
+ var resultCode = eleMap["result_code"]
+ var openid = eleMap["openid"]
+ if (!retcode.isNullOrEmpty() && "SUCCESS" == retcode
+ && !resultCode.isNullOrEmpty() && "SUCCESS" == resultCode && !openid.isNullOrEmpty()) {
+ qrcodeTrans.agentUserId = openid
+ var ip = personIdentityDao.getByThirdUid(openid)
+ if (ip != null) {
+ qrcodeTrans.userid = ip.person.userid
+ }
+ agentServiceProxy.qrcodePayTransSaveOrUpdate(qrcodeTrans)
+ agentResponse.code = AgentCode.SUCCESS
+ agentResponse.agentCode = retcode
+ agentResponse.agentMsg = eleMap["return_msg"]
+ } else {
+ logger.error { "code=${eleMap["err_code"]},des=${eleMap["err_code_des"]}" }
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = eleMap["err_code"]
+ agentResponse.agentMsg = eleMap["err_code_des"]
+ }
+ }
+ return agentResponse
+ }
+
+ override fun doQrcodepay(transaction: TTransactionMain): AgentResponse {
+ var qrcodeTrans = agentServiceProxy.qrcodePayTransFindByRefno(transaction.refno)
+ var agentResponse = AgentResponse()
+ if (qrcodeTrans == null) {
+ agentResponse.code = AgentCode.REFNO_NOT_EXISTS
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ return agentResponse
+ }
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_WECHAT, transaction.shopDtl.shopaccno, qrcodeTrans.isAnonymous, false)
+ if (checkCfg(config, agentResponse)) {
+ val bean = WechatReqResp().apply {
+ this.appid = config[PaytypeUtil.CFG_WECHAT_APPID]
+ this.auth_code = qrcodeTrans.qrcode
+ this.mch_id = config[PaytypeUtil.CFG_WECHAT_MECHID]
+ this.key = config[PaytypeUtil.CFG_WECHAT_MECHKEY]
+ this.out_trade_no = transaction.refno
+ this.total_fee = MoneyUtil.YuanToFen(transaction.shopDtl.amount)
+ this.spbill_create_ip = qrcodeTrans.spip
+ this.body = "POS扫微信二维码支付"
+ }
+
+ bean.generalPaySign()
+ var xml = bean.generaPayXML()
+ restTemplate.messageConverters[1] = StringHttpMessageConverter(StandardCharsets.UTF_8)
+ var res = restTemplate.postForEntity(PaytypeUtil.CFG_WECHAT_QRCODEPAY, xml, String::class.java)
+ var eleMap = XmlUtils.parseXml(res.body)
+ var retcode = eleMap["return_code"]
+ var resultCode = eleMap["result_code"]
+ var openid = eleMap["openid"]
+ var errorCode = eleMap["err_code"]
+ if (!retcode.isNullOrEmpty() && "SUCCESS" == retcode
+ && !resultCode.isNullOrEmpty() && "SUCCESS" == resultCode && !openid.isNullOrEmpty()) {
+ agentResponse.code = AgentCode.SUCCESS
+ agentResponse.agentCode = resultCode
+ agentResponse.dtlStatus = DtlStatus.SUCCESS
+ agentResponse.agentMsg = eleMap["return_msg"]
+ agentResponse.agentRefno = eleMap["transaction_id"]
+ qrcodeTrans.agentRefno = eleMap["transaction_id"]
+ agentServiceProxy.qrcodePayTransSaveOrUpdate(qrcodeTrans)
+ } else if("SYSTEMERROR"==errorCode||"BANKERROR"==errorCode||"USERPAYING"==errorCode){
+ logger.error { "code=${errorCode},des=${eleMap["err_code_des"]}" }
+ agentResponse.code = AgentCode.REQUIRE_QUERY
+ agentResponse.agentCode = eleMap["err_code"]
+ agentResponse.agentMsg = eleMap["err_code_des"]
+ agentResponse.agentRefno = eleMap["transaction_id"]
+ qrcodeTrans.agentRefno = eleMap["transaction_id"]
+ agentServiceProxy.qrcodePayTransSaveOrUpdate(qrcodeTrans)
+ }else{
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = eleMap["err_code"]
+ agentResponse.agentMsg = eleMap["err_code_des"]
+ logger.error { "code=${errorCode},des=${eleMap["err_code_des"]}" }
+ }
+ }
+ return agentResponse
+ }
+
+ override fun doPrepay(transaction: TTransactionMain): AgentResponse {
+ var agentResponse = AgentResponse()
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_WECHAT, transaction.shopDtl.shopaccno, false, false)
+ if (checkCfg(config, agentResponse)) {
+ //H5 支付
+ val bean = WechatReqResp().apply {
+ this.appid = config[PaytypeUtil.CFG_WECHAT_APPID]
+ this.mch_id = config[PaytypeUtil.CFG_WECHAT_MECHID]
+ this.key = config[PaytypeUtil.CFG_WECHAT_MECHKEY]
+ this.out_trade_no = transaction.refno
+ this.total_fee = MoneyUtil.YuanToFen(transaction.shopDtl.amount)
+ this.spbill_create_ip = ""
+ this.body = "微信支付"
+ this.trade_type = "MWEB"
+ this.notify_url = config[PaytypeUtil.CFG_WECHAT_NOTIFY]
+ this.scene_info = "{\"h5_info\": {\"type\":\"Wap\",\"wap_url\": \"" + config[PaytypeUtil.CFG_WECHAT_NOTIFY] + "\",\"wap_name\": \"微信支付\"}}"
+ }
+ //TODO IP 问题
+ bean.generaSign()
+ val xml = bean.generaXML()
+ restTemplate.messageConverters[1] = StringHttpMessageConverter(StandardCharsets.UTF_8)
+ var res = restTemplate.postForEntity(PaytypeUtil.CFG_WECHAT_UNIONPAY, xml, String::class.java)
+ var eleMap = XmlUtils.parseXml(res.body)
+ var retcode = eleMap["return_code"]
+ var resultCode = eleMap["result_code"]
+ val mwebUrl = eleMap["mweb_url"]
+ if (!retcode.isNullOrEmpty() && "SUCCESS" == retcode
+ && !resultCode.isNullOrEmpty() && "SUCCESS" == resultCode && !mwebUrl.isNullOrEmpty()) {
+ agentResponse.code = AgentCode.REQUIRE_QUERY
+ agentResponse.agentCode =resultCode
+ agentResponse.agentMsg = eleMap["return_msg"]
+ agentResponse.agentBody = mwebUrl
+ agentResponse.agentRefno = eleMap["prepay_id"]
+ } else {
+ logger.error { "code=${eleMap["err_code"]},des=${eleMap["err_code_des"]}" }
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = eleMap["err_code"]
+ agentResponse.agentMsg = eleMap["err_code_des"]
+ }
+ }
+ return agentResponse
+ }
+
+ override fun doQuery(transaction: TTransactionMain): AgentResponse {
+ var agentResponse = AgentResponse()
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_WECHAT, transaction.shopDtl.shopaccno, false, false)
+ if (checkCfg(config, agentResponse)) {
+ //H5 支付
+ val bean = WechatReqResp().apply {
+ this.appid = config[PaytypeUtil.CFG_WECHAT_APPID]
+ this.mch_id = config[PaytypeUtil.CFG_WECHAT_MECHID]
+ this.key = config[PaytypeUtil.CFG_WECHAT_MECHKEY]
+ this.out_trade_no = transaction.refno
+ }
+ bean.generalQuerySign()
+ val xml = bean.generalQueryXML()
+ restTemplate.messageConverters[1] = StringHttpMessageConverter(StandardCharsets.UTF_8)
+ var res = restTemplate.postForEntity(PaytypeUtil.CFG_WECHAT_QUERY, xml, String::class.java)
+ var eleMap = XmlUtils.parseXml(res.body)
+ var retcode = eleMap["return_code"]
+ var resultCode = eleMap["result_code"]
+ val tradeState = eleMap["trade_state"]
+ if (!retcode.isNullOrEmpty() && "SUCCESS" == retcode
+ && !resultCode.isNullOrEmpty() && "SUCCESS" == resultCode) {
+ agentResponse.code = AgentCode.REQUIRE_QUERY
+ agentResponse.agentCode = resultCode
+ agentResponse.agentMsg = eleMap["return_msg"]
+ when (tradeState) {
+ "SUCCESS" -> agentResponse.dtlStatus = DtlStatus.SUCCESS
+ "REFUND" -> agentResponse.dtlStatus = DtlStatus.REFUND
+ "NOTPAY", "CLOSED", "REVOKED", "PAYERROR" -> agentResponse.dtlStatus = DtlStatus.FAIL
+ "USERPAYING" -> agentResponse.dtlStatus = DtlStatus.WAIT
+ }
+ } else {
+ logger.error { "code=${eleMap["err_code"]}},des=${eleMap["err_code_des"]}" }
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = eleMap["err_code"]
+ agentResponse.agentMsg = eleMap["err_code_des"]
+ }
+ }
+ return agentResponse
+ }
+
+ override fun doRefund(transaction: TTransactionMain): AgentResponse {
+ var agentResponse = AgentResponse()
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_WECHAT, transaction.shopDtl.shopaccno, false, false)
+ if (checkCfg(config, agentResponse)) {
+ val bean = WechatReqResp().apply {
+ this.appid = config[PaytypeUtil.CFG_WECHAT_APPID]
+ this.mch_id = config[PaytypeUtil.CFG_WECHAT_MECHID]
+ this.key = config[PaytypeUtil.CFG_WECHAT_MECHKEY]
+ this.out_trade_no = transaction.refno
+ this.total_fee = MoneyUtil.YuanToFen(transaction.shopDtl.amount)
+ this.refund_fee = MoneyUtil.YuanToFen(transaction.refundAmount)
+ this.out_refund_no = transaction.reverseRefno
+ this.notify_url = config[PaytypeUtil.CFG_WECHAT_NOTIFY]
+ }
+ bean.generaReverseSign()
+ val xml = bean.generaReverseXML()
+ var res = restTemplate.postForEntity(PaytypeUtil.CFG_WECHAT_REFUND, xml, String::class.java)
+ var eleMap = XmlUtils.parseXml(res.body)
+ var retcode = eleMap["return_code"]
+ var resultCode = eleMap["result_code"]
+ if (!retcode.isNullOrEmpty() && "SUCCESS" == retcode
+ && !resultCode.isNullOrEmpty() && "SUCCESS" == resultCode ) {
+ agentResponse.code = AgentCode.REQUIRE_QUERY
+ agentResponse.agentCode =resultCode
+ agentResponse.agentRefno = eleMap["refund_id"]
+ agentResponse.agentMsg = eleMap["return_msg"]
+ } else {
+ logger.error { "code=${eleMap["err_code"]},des=${eleMap["err_code_des"]}" }
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = eleMap["err_code"]
+ agentResponse.agentMsg = eleMap["err_code_des"]
+ }
+ }
+ return agentResponse
+ }
+
+ override fun doNotify(param: Map<String, String>): AgentResponse {
+ var agentResponse = AgentResponse()
+ var transaction = consumePayService.getTransactionMainDtl(param["out_trade_no"], null, null)
+ if (transaction == null) {
+ agentResponse.code = AgentCode.REFNO_NOT_EXISTS
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ return agentResponse
+ }
+ if (transaction.status == TradeDict.DTL_STATUS_SUCCESS) {
+ agentResponse.code = AgentCode.SUCCESS
+ agentResponse.agentMsg = "流水已成功,不能重复入账"
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ return agentResponse
+ }
+ val sign = param["sign"]
+ if (StringUtils.isEmpty(sign)) {
+ logger.error("签名错误")
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ agentResponse.agentMsg = "签名错误"
+ }
+ var temp = StringUtil.paraFilter(param)
+ var signStr = StringUtil.createLinkString(temp)
+ val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_WECHAT, transaction.shopDtl.shopaccno, false, false)
+ var key = config[PaytypeUtil.CFG_WECHAT_MECHKEY]
+ signStr += "&key=$key"
+ val signRet = MD5.encodeByMD5(signStr)
+ logger.error("*******signStr=$signStr")
+ if (!signRet.equals(sign, ignoreCase = true)) {
+ logger.error("签名错误:$signRet,$sign")
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ agentResponse.agentMsg = "签名错误"
+ }
+ val returnCode = param["return_code"]
+ val resultCode = param["result_code"]
+ if (!returnCode.isNullOrEmpty() && "SUCCESS" == returnCode
+ && !resultCode.isNullOrEmpty() && "SUCCESS" == resultCode) {
+ val transid = param["transaction_id"]
+ if(transid.isNullOrEmpty()){
+ transactionService.success(transaction.refno)
+ }else{
+ transactionService.success(transaction.refno,transid, true)
+ }
+ agentResponse.code = AgentCode.SUCCESS
+ agentResponse.agentCode = resultCode
+ } else {
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = param["err_code"]
+ agentResponse.agentMsg = param["err_code_des"]
+ logger.error { "code=${param["err_code"]},des=${param["err_code_des"]}" }
+ }
+ return agentResponse
+ }
+
+ override fun downloadBill(shopacc:String,accdate:String): BaseResp {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/swykt_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/swykt_service.kt
new file mode 100644
index 0000000..165c4c7
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/swykt_service.kt
@@ -0,0 +1,58 @@
+package com.supwisdom.dlpay.agent.service
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.AgentPayService
+import com.supwisdom.dlpay.agent.AgentResponse
+import com.supwisdom.dlpay.api.bean.BaseResp
+import com.supwisdom.dlpay.api.domain.TPersondtl
+import com.supwisdom.dlpay.api.domain.TTransactionMain
+import org.springframework.stereotype.Component
+
+interface SWYKTV5Service{
+
+ /**
+ * 调用一卡通V5第三方支付接口
+ * */
+ fun onLineThirdPay(shopaccno: String, userid: String, accdate: String, amount: Int, refno: String):BaseResp
+
+ /**
+ * 调用一卡通V5卡片联机支付接口
+ * */
+ fun onLineCardPay():BaseResp
+
+ /**
+ * 调用一卡通V5卡片联机密码确认支付接口
+ * */
+ fun onLineCardPayConfirm():BaseResp
+
+ /**
+ * 调用一卡通V5卡片脱机上传授信流水接口
+ * */
+ fun offLineCardTransdtl():BaseResp
+
+}
+
+@Component("swyktv5Agent")
+class SWYktV5AgentService : AgentPayService {
+ override fun auth(shopaccno: String?, billno: String?): AgentResponse {
+ return AgentResponse().apply {
+ this.code = AgentCode.NOT_SUPPORT
+ }
+ }
+
+ override fun pay(transaction: TTransactionMain?): AgentResponse {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun cancel(transaction: TTransactionMain?): AgentResponse {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun refund(transaction: TTransactionMain?): AgentResponse {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun query(transaction: TTransactionMain?): AgentResponse {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/wanxiao_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/wanxiao_service.kt
new file mode 100644
index 0000000..eb77875
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/wanxiao_service.kt
@@ -0,0 +1,32 @@
+package com.supwisdom.dlpay.agent.service
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.AgentPayService
+import com.supwisdom.dlpay.agent.AgentResponse
+import com.supwisdom.dlpay.api.domain.TTransactionMain
+import org.springframework.stereotype.Component
+
+@Component("wanxiaoAgent")
+class WanxiaoAgentService : AgentPayService {
+ override fun auth(shopaccno: String?, billno: String?): AgentResponse {
+ return AgentResponse().apply {
+ this.code = AgentCode.NOT_SUPPORT
+ }
+ }
+
+ override fun pay(transaction: TTransactionMain?): AgentResponse {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun cancel(transaction: TTransactionMain?): AgentResponse {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun refund(transaction: TTransactionMain?): AgentResponse {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun query(transaction: TTransactionMain?): AgentResponse {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/wechat_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/wechat_service.kt
new file mode 100644
index 0000000..7fe78de
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/wechat_service.kt
@@ -0,0 +1,62 @@
+package com.supwisdom.dlpay.agent.service
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.AgentPayService
+import com.supwisdom.dlpay.agent.AgentResponse
+import com.supwisdom.dlpay.api.bean.BaseResp
+import com.supwisdom.dlpay.api.domain.TTransactionMain
+import com.supwisdom.dlpay.api.service.ConsumePayService
+import com.supwisdom.dlpay.framework.util.TradeCode
+import com.supwisdom.dlpay.framework.util.TradeDict
+import org.springframework.stereotype.Component
+
+interface WechatService {
+ fun doAuth(shopaccno: String?, billno: String?): AgentResponse
+
+ fun doQrcodepay(transaction: TTransactionMain): AgentResponse
+
+ fun doPrepay(transaction: TTransactionMain): AgentResponse
+
+ fun doQuery(transaction: TTransactionMain): AgentResponse
+
+ fun doRefund(transaction: TTransactionMain): AgentResponse
+
+ fun doNotify(param: Map<String, String>): AgentResponse
+
+ /**
+ * 下载对账单
+ * */
+ fun downloadBill(shopacc:String,accdate:String):BaseResp
+}
+
+@Component("wechatAgent")
+class WeChatPayAgentService(val consumePayService: ConsumePayService,
+ val wechatService: WechatService) : AgentPayService {
+ override fun auth(shopaccno: String?, billno: String?): AgentResponse {
+ if (consumePayService.checkShopPaytype(shopaccno!!, TradeDict.PAYTYPE_WECHAT, true)) {
+ return wechatService.doAuth(shopaccno, billno)
+ }
+ return AgentResponse().apply {
+ this.code = AgentCode.NOT_SUPPORT
+ }
+ }
+
+ override fun pay(transaction: TTransactionMain?): AgentResponse {
+ return when (transaction!!.transCode) {
+ TradeCode.TRANSCODE_QRCODE -> wechatService.doQrcodepay(transaction)
+ else -> wechatService.doPrepay(transaction)
+ }
+ }
+
+ override fun cancel(transaction: TTransactionMain?): AgentResponse {
+ return refund(transaction)
+ }
+
+ override fun refund(transaction: TTransactionMain?): AgentResponse {
+ return wechatService.doRefund(transaction!!)
+ }
+
+ override fun query(transaction: TTransactionMain?): AgentResponse {
+ return wechatService.doQuery(transaction!!)
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/ThirdPayCall.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/ThirdPayCall.kt
new file mode 100644
index 0000000..3d3cbae
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/ThirdPayCall.kt
@@ -0,0 +1,532 @@
+package com.supwisdom.dlpay.api
+
+import com.google.gson.Gson
+import com.sun.jersey.api.client.Client
+import com.sun.jersey.api.client.ClientResponse
+import com.supwisdom.dlpay.api.bean.*
+import com.supwisdom.dlpay.api.domain.TPersondtl
+import com.supwisdom.dlpay.api.domain.TShopdtl
+import com.supwisdom.dlpay.framework.util.*
+import com.supwisdom.dlpay.util.Code
+import mu.KotlinLogging
+
+
+
+class CallService {
+
+ companion object {
+ private val logger = KotlinLogging.logger { }
+
+
+ fun callWechatPay(config: Map<String, String>, paydtl: TPersondtl, time: String, wechattype: String,
+ realip: String?, qrcode: String?, openid: String?): BaseResp {
+ val code = BaseResp()
+ val appid = config["appid"]
+ if (appid.isNullOrEmpty()) {
+ code.retcode = "1"
+ code.retmsg = "微信支付方式未启用或未配置"
+ return code
+ }
+ val appkey = config["appkey"]
+ val orderurl = config["orderurl"]
+ val mchid = config["mchid"]
+ val wechatReqResp = WechatReqResp()
+ wechatReqResp.openid = openid
+ wechatReqResp.appid = appid
+ wechatReqResp.total_fee = MoneyUtil.YuanToFen(paydtl.amount)
+ wechatReqResp.body = paydtl.payinfo
+ wechatReqResp.key = appkey
+ wechatReqResp.mch_id = mchid
+ wechatReqResp.notify_url = config["notifyurl"] + "/notify/wechat"
+ wechatReqResp.out_trade_no = paydtl.refno
+ wechatReqResp.spbill_create_ip = realip
+ val c = Client.create()
+ c.setConnectTimeout(20000)
+ return when (wechattype) {
+ "qrcode" -> {
+ code
+ }
+ "app" -> {
+ wechatReqResp.trade_type = "APP"
+ code
+ }
+ "mp" -> {
+ wechatReqResp.trade_type = "JSAPI"
+ wechatReqResp.generaSign()
+ val xml = wechatReqResp.generaXML()
+ val r = c.resource(orderurl)
+ val respClient = r.post(ClientResponse::class.java, xml)
+ if (200 == respClient.status) {
+ try {
+ val ret = respClient.getEntity(String::class.java)
+ if (ret != null) {
+ val eleMap = XmlUtils.parseXml(ret)
+ val retcode = eleMap["return_code"]
+ val result_code = eleMap["result_code"]
+ val prepay_id = eleMap["prepay_id"]
+ if (!retcode.isNullOrEmpty() && "SUCCESS" == retcode
+ && !result_code.isNullOrEmpty() && "SUCCESS" == result_code
+ && !prepay_id.isNullOrEmpty()) {
+ wechatReqResp.retcode = 0
+ wechatReqResp.retmsg = "初始化成功"
+ wechatReqResp.prepay_id = prepay_id
+ //TODO prepay_id 是否保存
+ wechatReqResp.timestamp = DateUtil.getNowSecond().toString()
+ wechatReqResp.nonce_str = RandomUtils.getRandomString(30)
+ wechatReqResp.generaJSAPISign()
+ val params = wechatReqResp.generaJSAPIParamters()
+ code.setCode(Code.SUCCESS)
+ code.data = params
+ } else {
+ code.retcode = "1"
+ code.retmsg = eleMap["return_msg"]
+ }
+ } else {
+ code.retcode = "1"
+ code.retmsg = "微信支付请求失败"
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ code.retcode = "1"
+ code.retmsg = "微信支付请求异常"
+ }
+
+ } else {
+ code.retcode = "1"
+ code.retmsg = "微信支付请求返回失败"
+ }
+ code
+ }
+ "h5" -> {
+ wechatReqResp.trade_type = "MWEB"
+ wechatReqResp.scene_info = "{\"h5_info\": {\"type\":\"Wap\",\"wap_url\": \"" + config["notifyurl"] + "\",\"wap_name\": \"${paydtl.payinfo}\"}}"
+ val xml = wechatReqResp.generaXML()
+ val r = c.resource(orderurl)
+ val respClient = r.post(ClientResponse::class.java, xml)
+ if (200 == respClient.status) {
+ try {
+ val ret = respClient.getEntity(String::class.java)
+ if (ret != null) {
+ val eleMap = XmlUtils.parseXml(ret)
+ val retcode = eleMap["return_code"]
+ val result_code = eleMap["result_code"]
+ val prepay_id = eleMap["prepay_id"]
+ val mweb_url = eleMap["mweb_url"]
+ if (!retcode.isNullOrEmpty() && "SUCCESS" == retcode
+ && !result_code.isNullOrEmpty() && "SUCCESS" == result_code
+ && !prepay_id.isNullOrEmpty()) {
+ wechatReqResp.retcode = 0
+ wechatReqResp.retmsg = "初始化成功"
+ wechatReqResp.prepay_id = prepay_id
+ wechatReqResp.mweb_url = mweb_url
+ code.setCode(Code.SUCCESS)
+ code.data = mweb_url
+ } else {
+ code.retcode = "1"
+ code.retmsg = eleMap["return_msg"]
+ }
+ } else {
+ code.retcode = "1"
+ code.retmsg = "微信支付请求失败"
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ code.retcode = "1"
+ code.retmsg = "微信支付请求异常"
+ }
+
+ } else {
+ code.retcode = "1"
+ code.retmsg = "微信支付请求返回失败"
+ }
+ code
+ }
+ else -> {
+ code.retcode = "1"
+ code.retmsg = "未标识的类型:wechattype=$wechattype"
+ code
+ }
+ }
+ }
+
+ /*
+ /**
+ * 大理农商行银行卡绑定
+ * */
+ fun CallCitizenCardBind(config: Map<String, String?>, transdate: String, transtime: String, refno: String, bankcardno: String, name: String, idtype: String, idno: String, phone: String): CallBackResp {
+ val resp = CallBackResp()
+ val ip = config["socket.ip"]
+ val port = config["socket.port"]
+ val idType = IDTypes.findByValue(idtype)
+ if (ip.isNullOrEmpty() || port.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "市民卡socket的IP和端口未配置"
+ return resp
+ }
+ if (idType < 0) {
+ resp.retcode = "99"
+ resp.retmsg = "证件类型未识别[$idtype]"
+ return resp
+ }
+
+ val req = DlpayReq().apply {
+ this.transdate = transdate
+ this.transtime = transtime
+ this.sn = refno
+ this.bcNo = bankcardno
+ this.name = name
+ this.idType = "$idType"
+ this.idNo = idno
+ this.phone = phone
+ }
+ logger.info("请求绑定银行卡发送报文:\n${req.bindCardXml}")
+ try {
+ val returnXml = DlpayUtil.send(ip, port.toInt(), 10, req.bindCardXml)
+ logger.info("请求绑定银行卡返回报文[$refno]:\n$returnXml")
+ if (returnXml.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "请求绑定银行卡返回报文为空"
+ return resp
+ }
+ val returnResp = XmlUtils.getXmlToObject<DlpayResp>(returnXml.substring(8), "GBK", DlpayResp::class.java)
+ if (null == returnResp) {
+ resp.retcode = "99"
+ resp.retmsg = "解析返回报文错误!"
+ return resp
+ }
+
+ if ("0000" == returnResp.code) {
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("outtradeno", returnResp.bankjourno) //银行流水号
+ resp.add("verifycode", returnResp.captcha) //fixme:短信验证码!!
+ } else {
+ resp.retcode = "99"
+ resp.retmsg = returnResp.message
+ }
+ return resp
+ } catch (e: Exception) {
+ e.printStackTrace()
+ resp.retcode = "99"
+ resp.retmsg = "请求绑定银行卡异常!e:${e.message}"
+ return resp
+ }
+ }
+
+ /**
+ * 大理农商行银行卡签约/解约
+ * transtype:1-签约,2-解约
+ * */
+ fun CallCitizenCardSigned(config: Map<String, String?>, transdate: String, transtime: String, refno: String, bankcardno: String, name: String, idtype: String, idno: String, phone: String, transtype: String): CallBackResp {
+ val resp = CallBackResp()
+ val ip = config["socket.ip"]
+ val port = config["socket.port"]
+ val idType = IDTypes.findByValue(idtype)
+ if (ip.isNullOrEmpty() || port.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "市民卡socket的IP和端口未配置"
+ return resp
+ }
+ if (idType < 0) {
+ resp.retcode = "99"
+ resp.retmsg = "证件类型未识别[$idtype]"
+ return resp
+ }
+ if ("1" != transtype && "2" != transtype) {
+ resp.retcode = "99"
+ resp.retmsg = "请求操作类型错误[$transtype]"
+ return resp
+ }
+
+ val req = DlpayReq().apply {
+ this.transdate = transdate
+ this.transtime = transtime
+ this.sn = refno
+ this.categorie = DlpayReq.DLPAY_CATEGORIE //业务类别
+ this.bcNo = bankcardno
+ this.name = name
+ this.idType = "$idType"
+ this.idNo = idno
+ this.phone = phone
+ this.transType = transtype //1-签约,2-解约
+ }
+ logger.info("代扣签(解)约发送报文:\n${req.signXml}")
+ try {
+ val returnXml = DlpayUtil.send(ip, port.toInt(), 10, req.signXml)
+ logger.info("请求代扣签(解)约返回报文[$refno]:\n$returnXml")
+ if (returnXml.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "请求代扣签(解)约返回报文为空"
+ return resp
+ }
+ val returnResp = XmlUtils.getXmlToObject<DlpayResp>(returnXml.substring(8), "GBK", DlpayResp::class.java)
+ if (null == returnResp) {
+ resp.retcode = "99"
+ resp.retmsg = "解析返回报文错误!"
+ return resp
+ }
+
+ if ("0000" == returnResp.code) {
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("outtradeno", returnResp.bankjourno) //银行流水号
+ } else {
+ resp.retcode = "99"
+ resp.retmsg = returnResp.message
+ }
+ return resp
+ } catch (e: Exception) {
+ e.printStackTrace()
+ resp.retcode = "99"
+ resp.retmsg = "请求代扣签(解)约异常!e:${e.message}"
+ return resp
+ }
+ }
+
+ /**
+ * 大理农商行银行卡代扣消费
+ * */
+ fun callCitizenCardPay(config: Map<String, String?>, transdate: String, transtime: String, refno: String, amount:Double, bankcardno: String, name: String, idtype: String, idno: String): CallBackResp {
+ val resp = CallBackResp()
+ val ip = config["socket.ip"]
+ val port = config["socket.port"]
+ val merchantBankCardno = config["bankcardno"] //商户银行账号
+ val merchantBankAccname = config["bankaccname"] //商户银行开户名
+ val idType = IDTypes.findByValue(idtype)
+ if (ip.isNullOrEmpty() || port.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "市民卡socket的IP和端口未配置"
+ return resp
+ }else if(merchantBankCardno.isNullOrEmpty() || merchantBankAccname.isNullOrEmpty()){
+ resp.retcode = "99"
+ resp.retmsg = "商户银行收款参数未配置"
+ return resp
+ }
+
+ if (idType < 0) {
+ resp.retcode = "99"
+ resp.retmsg = "证件类型未识别[$idtype]"
+ return resp
+ }
+
+ val req = DlpayReq().apply {
+ this.transdate = transdate
+ this.transtime = transtime
+ this.sn = refno
+ this.categorie = DlpayReq.DLPAY_CATEGORIE //业务代码
+ this.bcNo = bankcardno
+ this.name = name
+ this.idType = "$idType"
+ this.idNo = idno
+ this.merchantBcno = merchantBankCardno
+ this.merchantName = merchantBankAccname
+ this.amount = MoneyUtil.YuanToFen(amount)
+ this.description="市民卡代扣消费"
+ }
+ logger.info("请求代扣消费发送报文:\n${req.cardpayXml}")
+ try {
+ val returnXml = DlpayUtil.send(ip, port.toInt(), 10, req.cardpayXml)
+ logger.info("请求代扣消费返回报文[$refno]:\n$returnXml")
+ if (returnXml.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "请求代扣消费返回报文为空"
+ return resp
+ }
+ val returnResp = XmlUtils.getXmlToObject<DlpayResp>(returnXml.substring(8), "GBK", DlpayResp::class.java)
+ if (null == returnResp) {
+ resp.retcode = "99"
+ resp.retmsg = "解析返回报文错误!"
+ return resp
+ }
+
+ if ("0000" == returnResp.code) {
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("outtradeno", returnResp.bankjourno) //银行流水号
+ } else {
+ resp.retcode = "99"
+ resp.retmsg = returnResp.message
+ }
+ return resp
+ } catch (e: Exception) {
+ e.printStackTrace()
+ //fixme: 查询逻辑?
+ resp.retcode = "99"
+ resp.retmsg = "请求代扣消费异常!e:${e.message}"
+ return resp
+ }
+ }
+
+ /**
+ * 大理农商行银行卡消费退款
+ * */
+ fun CallCitizenCardPayRefund(config: Map<String, String?>, transdate: String, transtime: String, refno: String, originRefno:String, amount:Double): CallBackResp {
+ val resp = CallBackResp()
+ val ip = config["socket.ip"]
+ val port = config["socket.port"]
+ if (ip.isNullOrEmpty() || port.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "市民卡socket的IP和端口未配置"
+ return resp
+ }
+
+ val req = DlpayReq().apply {
+ this.transdate = transdate
+ this.transtime = transtime
+ this.sn = refno
+ this.oriSn = originRefno
+ this.amount = MoneyUtil.YuanToFen(amount)
+ this.description="市民卡代扣消费退款"
+ }
+ logger.info("请求消费退款发送报文:\n${req.payRefundXml}")
+ try {
+ val returnXml = DlpayUtil.send(ip, port.toInt(), 10, req.payRefundXml)
+ logger.info("请求消费退款返回报文[$refno]:\n$returnXml")
+ if (returnXml.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "请求消费退款返回报文为空"
+ return resp
+ }
+ val returnResp = XmlUtils.getXmlToObject<DlpayResp>(returnXml.substring(8), "GBK", DlpayResp::class.java)
+ if (null == returnResp) {
+ resp.retcode = "99"
+ resp.retmsg = "解析返回报文错误!"
+ return resp
+ }
+
+ if ("0000" == returnResp.code) {
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("outtradeno", returnResp.bankjourno) //银行流水号
+ } else {
+ resp.retcode = "99"
+ resp.retmsg = returnResp.message
+ }
+ return resp
+ } catch (e: Exception) {
+ e.printStackTrace()
+ //fixme: 查询逻辑?
+ resp.retcode = "99"
+ resp.retmsg = "请求消费退款异常!e:${e.message}"
+ return resp
+ }
+ }
+
+ /**
+ * 大理农商行银行卡消费退款结果查询
+ * */
+ fun CallCitizenCardPayQueryResult(config: Map<String, String?>, transdate: String, transtime: String, refno: String, originRefno:String): CallBackResp{
+ val resp = CallBackResp()
+ val ip = config["socket.ip"]
+ val port = config["socket.port"]
+ if (ip.isNullOrEmpty() || port.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "市民卡socket的IP和端口未配置"
+ return resp
+ }
+
+ val req = DlpayReq().apply {
+ this.transdate = transdate
+ this.transtime = transtime
+ this.sn = refno
+ this.oriSn = originRefno
+ }
+ logger.info("请求查询结果发送报文:\n${req.queryResultXml}")
+ try {
+ val returnXml = DlpayUtil.send(ip, port.toInt(), 10, req.queryResultXml)
+ logger.info("请求查询结果返回报文[$refno]:\n$returnXml")
+ if (returnXml.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "请求查询结果返回报文为空"
+ return resp
+ }
+ val returnResp = XmlUtils.getXmlToObject<DlpayResp>(returnXml.substring(8), "GBK", DlpayResp::class.java)
+ if (null == returnResp) {
+ resp.retcode = "99"
+ resp.retmsg = "解析返回报文错误!"
+ return resp
+ }
+
+ if("0401" == returnResp.code){
+ //原流水不存在
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("dtlstatus", "notfind")
+ }else if ("0000" == returnResp.code) {
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("outtradeno", returnResp.bankjourno) //银行流水号
+ when(returnResp.status){
+ "0" -> resp.add("dtlstatus", "success")
+ "2" -> resp.add("dtlstatus", "refund")
+ else -> resp.add("dtlstatus", "fail")
+ }
+ } else {
+ //查询失败
+ resp.retcode = "99"
+ resp.retmsg = returnResp.message
+ }
+ return resp
+ } catch (e: Exception) {
+ e.printStackTrace()
+ resp.retcode = "99"
+ resp.retmsg = "请求查询结果异常!e:${e.message}"
+ return resp
+ }
+ }
+
+ fun CallCitizenCardChkfile(config: Map<String, String?>, transdate: String, transtime: String, refno: String, chkdate:String): CallBackResp {
+ val resp = CallBackResp()
+ val ip = config["socket.ip"]
+ val port = config["socket.port"]
+ if (ip.isNullOrEmpty() || port.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "市民卡socket的IP和端口未配置"
+ return resp
+ }
+
+ val req = DlpayReq().apply {
+ this.transdate = transdate
+ this.transtime = transtime
+ this.sn = refno
+ this.chkdate = chkdate
+ }
+ logger.info("请求[$chkdate]对账发送报文:\n${req.chkfileXml}")
+ try {
+ val returnXml = DlpayUtil.send(ip, port.toInt(), 10, req.chkfileXml)
+ logger.info("请求[$chkdate]对账返回报文[$refno]:\n$returnXml")
+ if (returnXml.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "请求[$chkdate]对账返回报文为空"
+ return resp
+ }
+ val returnResp = XmlUtils.getXmlToObject<DlpayResp>(returnXml.substring(8), "GBK", DlpayResp::class.java)
+ if (null == returnResp) {
+ resp.retcode = "99"
+ resp.retmsg = "解析返回报文错误!"
+ return resp
+ }
+
+ if ("0000" == returnResp.code) {
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("outtradeno", returnResp.bankjourno) //银行流水号
+ resp.add("filename", returnResp.filename)
+
+ } else {
+ //查询失败
+ resp.retcode = "99"
+ resp.retmsg = returnResp.message
+ }
+ return resp
+ } catch (e: Exception) {
+ e.printStackTrace()
+ resp.retcode = "99"
+ resp.retmsg = "请求[$chkdate]对账异常!e:${e.message}"
+ return resp
+ }
+ }
+
+ */
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt
new file mode 100644
index 0000000..ecc5f3b
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt
@@ -0,0 +1,141 @@
+package com.supwisdom.dlpay.api
+
+import com.supwisdom.dlpay.api.bean.JsonResult
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException
+import com.supwisdom.dlpay.exception.TransactionCheckException
+import com.supwisdom.dlpay.exception.TransactionException
+import com.supwisdom.dlpay.framework.ResponseBodyBuilder
+import com.supwisdom.dlpay.framework.service.CommonService
+import com.supwisdom.dlpay.framework.tenant.TenantContext
+import com.supwisdom.dlpay.framework.util.TradeErrorCode
+import mu.KotlinLogging
+import org.aspectj.lang.ProceedingJoinPoint
+import org.aspectj.lang.annotation.Around
+import org.aspectj.lang.annotation.Aspect
+import org.aspectj.lang.annotation.Pointcut
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.http.HttpHeaders
+import org.springframework.http.HttpStatus
+import org.springframework.http.ResponseEntity
+import org.springframework.security.core.context.SecurityContextHolder
+import org.springframework.stereotype.Component
+import org.springframework.transaction.TransactionSystemException
+import org.springframework.web.bind.MethodArgumentNotValidException
+import org.springframework.web.bind.annotation.ControllerAdvice
+import org.springframework.web.bind.annotation.ExceptionHandler
+import org.springframework.web.bind.annotation.RestControllerAdvice
+import org.springframework.web.context.request.WebRequest
+import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
+import java.lang.reflect.UndeclaredThrowableException
+import javax.servlet.http.HttpServletRequest
+import javax.validation.ConstraintViolationException
+
+
+@RestControllerAdvice("com.supwisdom.dlpay.api")
+class RestControllerAdvice {
+ val logger = KotlinLogging.logger { }
+
+ @ExceptionHandler
+ fun handleException(ex: Exception, request: HttpServletRequest): ResponseEntity<Any> {
+ logger.error { "Request unhandler exception, url<${request.requestURI}>, ex<${ex.cause}>" }
+ val undeclared = if (ex is UndeclaredThrowableException) ex.undeclaredThrowable else ex
+ if (undeclared is RequestParamCheckException) {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .requestException(undeclared, "请求参数错误"))
+ } else if (undeclared is TransactionException) {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .exception(undeclared.code(), undeclared, "业务处理错误"))
+ }
+
+ return ResponseEntity.ok().body(ResponseBodyBuilder.create()
+ .exception(TradeErrorCode.BUSINESS_DEAL_ERROR, undeclared, "业务处理报错"))
+ }
+}
+
+@ControllerAdvice("com.supwisdom.dlpay")
+class MvcControllerAdvice {
+ private val logger = KotlinLogging.logger { }
+ @ExceptionHandler(ConstraintViolationException::class)
+ fun handleException(e: ConstraintViolationException): ResponseEntity<Any> {
+ logger.error { "unhandle exception : $e" }
+ return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body(e)
+ }
+}
+
+@ControllerAdvice
+class CustomGlobalExceptionHandler : ResponseEntityExceptionHandler() {
+ // error handle for @Valid
+ override fun handleMethodArgumentNotValid(ex: MethodArgumentNotValidException,
+ headers: HttpHeaders,
+ status: HttpStatus, request: WebRequest): ResponseEntity<Any> {
+ val msg = ex.bindingResult.fieldErrors.joinToString(",") {
+ it?.defaultMessage ?: ""
+ }
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(300001, msg))
+
+ }
+
+ @ExceptionHandler(TransactionSystemException::class)
+ fun handleContraintViolationException(e: TransactionSystemException): ResponseEntity<Any> {
+ logger.error { "unhandle exception : $e" }
+ var cause = e.cause
+ while (cause != null) {
+ if (cause is ConstraintViolationException) {
+ val msg = cause.constraintViolations.joinToString {
+ it.message
+ }
+ return ResponseEntity.status(HttpStatus.OK).body(JsonResult.error(msg))
+ }
+ cause = cause.cause
+ }
+ return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body(e)
+ }
+}
+
+@Component
+@Aspect
+class RestControllerAspect {
+ @Autowired
+ lateinit var commonService: CommonService
+
+ @Value("\${security.request.sign: true}")
+ private var requestSignCheck: Boolean = true
+
+ private val logger = KotlinLogging.logger { }
+
+ @Pointcut("@within(org.springframework.web.bind.annotation.RestController)")
+ fun restcontroller() {
+ }
+
+ @Pointcut("@annotation(org.springframework.web.bind.annotation.PostMapping)")
+ fun postmapping() {
+ }
+
+ @Around("restcontroller() && postmapping() && args(@RequestBody body, ..)")
+ @Throws(Throwable::class)
+ fun logPostMethods(joinPoint: ProceedingJoinPoint, body: Any): Any {
+ return try {
+ if (body is APIRequestParam) {
+ //TenantContext.setTenantSchema(body.tenantid)
+ body.checkParam()
+
+ if (requestSignCheck &&
+ !body.checkSign(commonService.getSecretByAppid(
+ SecurityContextHolder.getContext().authentication.name))) {
+ throw RequestParamCheckException("参数签名错误")
+ }
+ } else {
+ throw TransactionCheckException(TradeErrorCode.REQUEST_PARAM_EEROR, "请求参数实体位置错误")
+ }
+
+ val result = joinPoint.proceed()
+ logger.debug(result.toString())
+ result
+ } catch (t: Throwable) {
+ logger.error { "request error , ex<${t.message}>" }
+ throw t
+ }
+ }
+}
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/async_tasks.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/async_tasks.kt
new file mode 100644
index 0000000..5b9745a
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/async_tasks.kt
@@ -0,0 +1,144 @@
+package com.supwisdom.dlpay.api
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.DtlStatus
+import com.supwisdom.dlpay.agent.citizencard.YnrccUtil
+import com.supwisdom.dlpay.api.domain.TDtlQuery
+import com.supwisdom.dlpay.api.domain.TTransactionMain
+import com.supwisdom.dlpay.api.repositories.ShopaccService
+import com.supwisdom.dlpay.api.service.DtlQueryResultService
+import com.supwisdom.dlpay.api.service.TransactionServiceProxy
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.util.ApplicationUtil
+import com.supwisdom.dlpay.framework.util.TradeDict
+import com.supwisdom.dlpay.util.ConstantUtil
+import mu.KotlinLogging
+import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.ApplicationContext
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.scheduling.annotation.Async
+import org.springframework.scheduling.annotation.AsyncConfigurer
+import org.springframework.scheduling.annotation.EnableAsync
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
+import org.springframework.stereotype.Component
+import java.lang.reflect.Method
+import java.util.concurrent.Executor
+
+@Configuration
+@EnableAsync
+class SpringAsyncConfig : AsyncConfigurer {
+ @Bean(value = ["shopAccBalanceUpdater", "queryAgentPayResult"])
+ fun threadPoolExecutor(): Executor {
+ return ThreadPoolTaskExecutor().apply {
+ corePoolSize = 5
+ maxPoolSize = 10
+ setWaitForTasksToCompleteOnShutdown(true)
+ }
+ }
+
+ override fun getAsyncUncaughtExceptionHandler(): AsyncUncaughtExceptionHandler? {
+ return MyAsyncUncaughtExceptionHandler()
+ }
+}
+
+class MyAsyncUncaughtExceptionHandler : AsyncUncaughtExceptionHandler {
+ private val logger = KotlinLogging.logger { }
+ override fun handleUncaughtException(ex: Throwable, method: Method, vararg params: Any?) {
+ logger.error { "Async Task execute error: <${method.name}>, exception <${ex.message}>" }
+ }
+}
+
+
+@Component
+class ShopAccBalanceAsyncTask {
+ private val logger = KotlinLogging.logger { }
+
+ @Autowired
+ private lateinit var shopaccService: ShopaccService
+
+ @Async("shopAccBalanceUpdater")
+ fun updateShopBalance(shopdtlRefno: String) {
+ shopaccService.recalcShopBalance(shopdtlRefno, true)
+ }
+}
+
+@Component
+class AgentQueryResultTask {
+ private val logger = KotlinLogging.logger { }
+
+ @Autowired
+ lateinit var transactionService: TransactionServiceProxy
+
+ @Autowired
+ private lateinit var applicationContext: ApplicationContext
+
+ @Autowired
+ private lateinit var dtlQueryResultService: DtlQueryResultService
+
+ @Autowired
+ private lateinit var systemUtilService: SystemUtilService
+
+ @Async("queryAgentPayResult")
+ fun queryResult(transaction: TTransactionMain, qcnt: Int) {
+ try {
+ if (qcnt >= YnrccUtil.QUERY_MAX_COUNT) {
+ //查询超最大次数
+ logger.error("查询refno=[${transaction.refno}]流水结果超最大查询次数[${YnrccUtil.QUERY_MAX_COUNT}]")
+
+ //保存进查询表,定时扫描任务去查询
+ dtlQueryResultService.saveOrUpdateDtlQuery(TDtlQuery().apply {
+ this.accdate = transaction.accdate
+ this.refno = transaction.refno
+ this.status = ConstantUtil.QUERYTYPE_NEED_QUERY
+ this.remark = null
+ this.qcnt = 0
+ this.lastsaved = systemUtilService.sysdatetime.sysdate
+ })
+ return
+ }
+
+ val service = ApplicationUtil.findAgentPayService(applicationContext,
+ transaction.sourceType+ "Agent")
+
+ logger.info("refno=[${transaction.refno}]开始第" + (qcnt + 1) + "次查询支付结果:")
+ val resp = service.query(transaction)
+ when (resp.code) {
+ AgentCode.SUCCESS -> {
+ //查询成功
+ when (resp.dtlStatus) {
+ DtlStatus.SUCCESS ->
+ transactionService.success(transaction.refno, resp.agentRefno, false) //流水成功
+ DtlStatus.REFUND -> {
+ //流水已退款 TODO:流水成功后才退款,无查询原成功流水逻辑
+ logger.error("refno=[${transaction.refno}]查询结果为:已退款!!!")
+ return
+ }
+ DtlStatus.PARTIAL_REFUND -> {
+ //流水已部分退款 TODO:暂无逻辑
+ logger.error("refno=[${transaction.refno}]查询结果为:已部分退款!!!")
+ return
+ }
+ else -> {
+ //流水失败
+ transactionService.fail(transaction.refno, "查询流水状态为交易失败")
+ }
+ }
+ }
+ AgentCode.REFNO_NOT_EXISTS ->
+ transactionService.fail(transaction.refno, "银行流水不存在") //银行返回流水不存在
+ AgentCode.REQUIRE_QUERY -> {
+ queryResult(transaction, qcnt + 1) //查询次数加1
+ }
+ else -> {
+ //其他明确错误,查询失败
+ logger.error("查询refno=[${transaction.refno}]流水结果返回失败:code=[${resp.agentCode}],message=[${resp.agentMsg}]")
+ }
+ }
+ } catch (ex: Exception) {
+ ex.printStackTrace()
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt
new file mode 100644
index 0000000..739b2c3
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt
@@ -0,0 +1,81 @@
+package com.supwisdom.dlpay.api.bean
+
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException
+import com.supwisdom.dlpay.framework.util.*
+import com.supwisdom.dlpay.util.DESedeUtil
+
+class DaliDatasyncParam {
+ var app_id: String = ""
+ var data: String = ""
+ var count: Int = 0
+ var timestamp: String = ""
+ var sign_type: String = ""
+ var sign: String = ""
+
+ fun checkParam(): Boolean {
+ if (StringUtil.isEmpty(app_id)) {
+ throw RequestParamCheckException("请求参数错误[应用ID为空]")
+ }
+ if (StringUtil.isEmpty(data)) {
+ throw RequestParamCheckException("请求参数错误[业务参数报文为空]")
+ }
+ if (count < 1) throw RequestParamCheckException("请求参数错误[业务明细至少有一条]")
+ if (!DateUtil.checkDatetimeValid(timestamp, DateUtil.DATETIME_FMT)) {
+ throw RequestParamCheckException("请求参数错误[时间戳]")
+ }
+ if (StringUtil.isEmpty(sign_type)
+ || !"HmacSHA256".equals(sign_type, true)) {
+ throw RequestParamCheckException("请求参数错误[签名算法]")
+ }
+ if (StringUtil.isEmpty(sign)) {
+ throw RequestParamCheckException("请求参数错误[签名为空]")
+ }
+
+ return true
+ }
+
+ fun checkSign(key: String): Boolean {
+ val signData = "app_id=$app_id&count=$count&data=$data×tamp=$timestamp"
+ return sign.equals(HmacUtil.HMACSHA256(signData, key), true)
+ }
+
+ fun decData(deskey: String): ArrayList<DaliDatasyncDetail> {
+ try {
+ val listType = object : TypeToken<ArrayList<DaliDatasyncDetail>>() {}.type
+ val decstr = DESedeUtil.getInstance(deskey).decode(data)
+ return Gson().fromJson(decstr, listType)
+ } catch (e: Exception) {
+ throw RequestParamCheckException("数据解密失败!")
+ }
+ }
+
+}
+
+class DaliDatasyncDetail {
+ var cardno: String = ""
+ var cardphyid: String = ""
+ var expiredate: String = ""
+ var cardstatus: String = ""
+ var bankcardno: String? = null
+ var username: String = ""
+ var idtype: String = ""
+ var idno: String = ""
+ var mobile: String? = null
+ var email: String? = null
+
+ fun checkParam(): Boolean {
+ if (StringUtil.isEmpty(idtype) || StringUtil.isEmpty(idno) || StringUtil.isEmpty(username)) throw RequestParamCheckException("用户明细数据关键字段为空")
+ if (StringUtil.isEmpty(cardno) || StringUtil.isEmpty(cardphyid) || StringUtil.isEmpty(expiredate) || StringUtil.isEmpty(cardstatus)) throw RequestParamCheckException("卡片明细数据关键字段为空")
+ return true
+ }
+}
+
+class DaliDatasyncErrorDetail{
+ var cardno:String=""
+ var errcode:String=""
+ var errmsg:String=""
+}
+
+
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/controller/charge_api_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/charge_api_controller.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/api/controller/charge_api_controller.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/charge_api_controller.kt
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
new file mode 100644
index 0000000..673b575
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
@@ -0,0 +1,735 @@
+package com.supwisdom.dlpay.api.controller
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.AgentPayService
+import com.supwisdom.dlpay.agent.domain.QrcodePayTrans
+import com.supwisdom.dlpay.agent.service.AgentServiceProxy
+import com.supwisdom.dlpay.api.*
+import com.supwisdom.dlpay.api.bean.*
+import com.supwisdom.dlpay.api.bean.groups.ConfirmAction
+import com.supwisdom.dlpay.api.bean.groups.InitAction
+import com.supwisdom.dlpay.api.domain.TSourceType
+import com.supwisdom.dlpay.api.service.*
+import com.supwisdom.dlpay.exception.TransactionCheckException
+import com.supwisdom.dlpay.framework.ResponseBodyBuilder
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.tenant.TenantContext
+import com.supwisdom.dlpay.framework.util.*
+import org.apache.commons.lang3.StringUtils
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.ApplicationContext
+import org.springframework.http.ResponseEntity
+import org.springframework.validation.annotation.Validated
+import org.springframework.web.bind.annotation.*
+import javax.servlet.http.HttpServletRequest
+import javax.validation.Valid
+
+@RestController
+@RequestMapping("/api/consume")
+class ConsumeAPIController {
+ @Autowired
+ lateinit var accountUtilServcie: AccountUtilServcie
+ @Autowired
+ lateinit var userService: UserService
+ @Autowired
+ lateinit var systemUtilService: SystemUtilService
+ @Autowired
+ lateinit var consumePayService: ConsumePayService
+ @Autowired
+ lateinit var transactionService: TransactionServiceProxy
+ @Autowired
+ lateinit var cardService: CardService
+ @Autowired
+ private lateinit var applicationContext: ApplicationContext
+
+ @Autowired
+ private lateinit var sourceTypeService: SourceTypeService
+ @Autowired
+ lateinit var agentQueryResultTask: AgentQueryResultTask
+
+ @Autowired
+ private lateinit var agentServiceProxy: AgentServiceProxy
+
+ /**
+ * ============================================================================
+ * 消费流水结果查询统一接口
+ * ============================================================================
+ * */
+ @PostMapping("/queryresult")
+ fun queryDtlResult(@Valid @RequestBody param: QueryDtlResultParam): ResponseEntity<Any> {
+ //TODO 第三方支付,根据支付结果主动触发一次查询
+ consumePayService.getTransactionMainDtl(param.refno, param.billno, param.shopaccno)?.let {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(QueryTransDtlResponse(it.refno, it.outTradeNo, it.shopDtl.amount,
+ it.status, it.sourceType, it.personDtl.payinfo, it.reverseFlag,
+ it.shopDtl.transdesc), "查询成功"))
+ } ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(TradeErrorCode.TRANSACTION_NOT_EXISTS, "流水不存在"))
+ }
+
+ /**
+ * ============================================================================
+ * 账户【余额支付】
+ * ============================================================================
+ * */
+ @PostMapping("/balance/pay")
+ fun balancePay(@RequestBody param: CitizenCardPayinitParam): ResponseEntity<Any> {
+ val person = userService.findPersonByIdentityCheckStatus(param.cardNo)
+ if (consumePayService.checkShopPaytype(param.shopaccno, TradeDict.PAYTYPE_BALANCE)) {
+ val account = accountUtilServcie.readAccount(person.userid)
+ val shopacc = accountUtilServcie.readShopbyShopaccno(param.shopaccno)
+
+ val dtl = TransactionBuilder().apply {
+ setTransInfo(param.transdate, param.transtime,
+ TradeCode.TRANSCODE_BALANCE_PAY,
+ TradeDict.PAYTYPE_BALANCE)
+ setOutTransInfo(shopacc.shopaccno, param.billno)
+ operator(param.shopaccno, TradeDict.OPERTYPE_SHOP)
+ payinfo = param.cardNo //fixme: 卡号或其他唯一信息
+ description = "账户余额消费"
+ }.person(account).apply {
+ setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_OUT)
+ setOpposite(AccountProxy(shopacc))
+ }.and().shop(shopacc).apply {
+ setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_IN)
+ setOpposite(AccountProxy(account))
+ }.and().addDebitCreditRecord(AccountProxy(account), AccountProxy(shopacc),
+ param.amount / 100.0, "账户余额消费")
+ .also {
+ param.feelist?.also {
+ TODO("feelist 费用清单未实现!")
+ }
+// param.feelist?.forEach {
+// val feeamt = it.amount / 100.0
+// when (it.feetype) {
+// TradeDict.FEETYPE_CONSUME_MEALER -> {
+// //搭伙费
+// val feetypeConfig = accountUtilServcie.readFeetype(TradeDict.FEETYPE_CONSUME_MEALER, TradeDict.PAYTYPE_BALANCE)
+// val subject = accountUtilServcie.readSubject(feetypeConfig.crsubjno) //不同在贷方科目
+// when (Subject.SUBJNO_MACHANT_INCOME == subject.subjno) {
+// true -> builder.addDebitCreditRecord(AccountProxy(account), AccountProxy(shopacc), feeamt, feetypeConfig.summary) //商户收
+// false -> builder.addDebitCreditRecord(AccountProxy(account), AccountProxy(subject), feeamt, feetypeConfig.summary) //其他科目
+// }
+// }
+// TradeDict.FEETYPE_CONSUME_DISCOUNT -> {
+// //优惠折扣
+// val feetypeConfig = accountUtilServcie.readFeetype(TradeDict.FEETYPE_CONSUME_DISCOUNT, TradeDict.PAYTYPE_BALANCE)
+// val subject = accountUtilServcie.readSubject(feetypeConfig.drsubjno) //不同在借方科目
+// builder.addDebitCreditRecord(AccountProxy(subject), AccountProxy(shopacc), feeamt, feetypeConfig.summary)
+//
+// }
+// else -> throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR,
+// "账户余额支付费用清单不支持feetype<${it.feetype}>")
+// }
+// }
+ }.init(transactionService)
+
+ transactionService.success(dtl.refno)
+
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .data("refno", dtl.refno)
+ .data("billno", dtl.outTradeNo)
+ .data("amount", dtl.personDtl.amount)
+ .success("交易成功"))
+ }
+
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(TradeErrorCode.BUSINESS_PAYTYPE_NOSUPPORT, "不支持支付方式<账户余额>"))
+ }
+
+
+ /**
+ * ============================================================================
+ * 市民卡【交易初始化】
+ * ============================================================================
+ * */
+ @PostMapping("/citizencard/payinit")
+ fun citizencardPayinit(@Valid @RequestBody param: CitizenCardPayinitParam): ResponseEntity<Any> {
+ val person = cardService.getPersonByCitizencard(param.cardNo)
+ val dtlType = consumePayService.getDtltypeDictionary(param.dtltype, Dictionary.DTLTYPES)
+ if (consumePayService.checkShopPaytype(param.shopaccno, TradeDict.PAYTYPE_CITIZEN_CARD)) {
+ val account = accountUtilServcie.readAccount(person.userid)
+ val shopacc = accountUtilServcie.readShopbyShopaccno(param.shopaccno)
+ val subject = accountUtilServcie.readSubject(Subject.SUBJNO_PAY_CITIZEN_CARD)
+ val transaction = TransactionBuilder().apply {
+ setTransInfo(param.transdate, param.transtime,
+ TradeCode.TRANSCODE_CITIZENCARD_PAY,
+ TradeDict.PAYTYPE_CITIZEN_CARD)
+ setOutTransInfo(shopacc.shopaccno, param.billno)
+ operator(param.shopaccno, TradeDict.OPERTYPE_SHOP)
+ payinfo = param.cardNo
+ description = dtlType.dictcaption
+ dtltype = param.dtltype
+ }.person(account).apply {
+ setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_OUT)
+ setOpposite(AccountProxy(shopacc))
+ }.and().shop(shopacc).apply {
+ setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_IN)
+ setOpposite(AccountProxy(account))
+ }.and().addDebitCreditRecord(AccountProxy(subject), AccountProxy(account),
+ param.amount / 100.0, dtlType.dictcaption)
+ .addDebitCreditRecord(AccountProxy(account), AccountProxy(shopacc),
+ param.amount / 100.0, dtlType.dictcaption)
+ .also {
+ param.feelist?.also {
+ TODO("feelist 费用清单未实现!")
+ }
+// param.feelist?.forEach {
+// val feeamt = it.amount / 100.0
+// when (it.feetype) {
+// TradeDict.FEETYPE_CONSUME_MEALER -> {
+// //搭伙费
+// val feetypeConfig = accountUtilServcie.readFeetype(TradeDict.FEETYPE_CONSUME_MEALER, TradeDict.PAYTYPE_BALANCE)
+// val subject = accountUtilServcie.readSubject(feetypeConfig.crsubjno) //不同在贷方科目
+// when (Subject.SUBJNO_MACHANT_INCOME == subject.subjno) {
+// true -> builder.addDebitCreditRecord(AccountProxy(account), AccountProxy(shopacc), feeamt, feetypeConfig.summary) //商户收
+// false -> builder.addDebitCreditRecord(AccountProxy(account), AccountProxy(subject), feeamt, feetypeConfig.summary) //其他科目
+// }
+// }
+// TradeDict.FEETYPE_CONSUME_DISCOUNT -> {
+// //优惠折扣
+// val feetypeConfig = accountUtilServcie.readFeetype(TradeDict.FEETYPE_CONSUME_DISCOUNT, TradeDict.PAYTYPE_BALANCE)
+// val subject = accountUtilServcie.readSubject(feetypeConfig.drsubjno) //不同在借方科目
+// builder.addDebitCreditRecord(AccountProxy(subject), AccountProxy(shopacc), feeamt, feetypeConfig.summary)
+//
+// }
+// else -> throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR,
+// "账户余额支付费用清单不支持feetype<${it.feetype}>")
+// }
+//
+// }
+ }.init(transactionService)
+
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(CitizenPayResponse(transaction.refno,
+ transaction.outTradeNo,
+ transaction.shopDtl.amount), "交易初始化成功"))
+ }
+
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(TradeErrorCode.BUSINESS_PAYTYPE_NOSUPPORT, "不支持支付方式<市民卡代扣>"))
+ }
+
+ fun createAgentService(sourceType: String): AgentPayService {
+ return ApplicationUtil.findAgentPayService(applicationContext, sourceType + "Agent")
+ ?: throw TransactionCheckException(TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "支付类型<$sourceType>未定义")
+ }
+
+ /**
+ * ============================================================================
+ * 市民卡【交易确认】
+ * ============================================================================
+ * */
+ @PostMapping("/citizencard/payfinish")
+ fun citizencardPayinit(@Valid @RequestBody param: CitizenCardPayfinishParam): ResponseEntity<Any> {
+ val dtl = transactionService.wip(param.refno)
+ val service = createAgentService(TradeDict.PAYTYPE_CITIZEN_CARD)
+ val resp = service.pay(dtl)
+ when (resp.code) {
+ AgentCode.SUCCESS ->
+ transactionService.success(dtl.refno, resp.agentRefno, false).let {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(CitizenPayResponse(it.refno,
+ it.outTradeNo,
+ it.shopDtl.amount), "交易确认成功"))
+
+
+ }
+ AgentCode.REQUIRE_QUERY -> {
+ //去查询
+ agentQueryResultTask.queryResult(dtl, 0)
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(CitizenPayResponse(dtl.refno,
+ dtl.outTradeNo,
+ dtl.shopDtl.amount), TradeErrorCode.WAIT_QUERY_RESULT, "请查询支付结果"))
+ }
+ else -> //失败
+ transactionService.fail(param.refno, resp.agentMsg).let {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(CitizenPayResponse(dtl.refno, dtl.outTradeNo, dtl.shopDtl.amount),
+ TradeErrorCode.BUSINESS_DEAL_ERROR, "交易扣费失败-${resp.agentMsg}"))
+ }
+ }
+ }
+
+ /**
+ * ============================================================================
+ * 消费流水撤销
+ * ============================================================================
+ * */
+ @PostMapping("/paycancel")
+ fun payCancel(@Valid @RequestBody param: ConsumePayCancelParam): ResponseEntity<Any> {
+ consumePayService.getTransactionMainDtl(param.refno, param.billno, param.shopaccno)?.let { mainDtl ->
+ if (mainDtl.sourceType.isNotEmpty()) {
+ //判断能否冲正
+ if (mainDtl.shop) {
+ consumePayService.checkCanReverse(mainDtl.sourceType, mainDtl.shopDtl.shopaccno)
+ } else {
+ consumePayService.checkCanReverse(mainDtl.sourceType)
+ }
+ } else {
+ throw TransactionCheckException(TradeErrorCode.TRANSDTL_STATUS_ERROR,
+ "该笔交易未定义sourcetype, 不支持撤销")
+ }
+
+ val builder = TransactionBuilder().apply {
+ setTransInfo(param.transdate, param.transtime, mainDtl.transCode, mainDtl.sourceType)
+ setOutTransInfo(mainDtl.outId, param.requestbillno)
+ }
+
+ val cancelTrans = builder.cancelInit(mainDtl.refno, transactionService)
+ transactionService.wip(cancelTrans.refno)
+ val service = createAgentService(mainDtl.sourceType)
+ val resp = service.cancel(cancelTrans)
+ when (resp.code) {
+ AgentCode.SUCCESS -> {
+ transactionService.success(cancelTrans.refno, resp.agentRefno, false)
+
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(PayReverseResponse(cancelTrans.refno), "交易撤销成功"))
+ }
+ AgentCode.REQUIRE_QUERY -> {
+ //待查询
+ agentQueryResultTask.queryResult(cancelTrans, 0)
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(PayReverseResponse(cancelTrans.refno),
+ TradeErrorCode.WAIT_QUERY_RESULT, "请查询撤销结果"))
+ }
+ else -> transactionService.fail(cancelTrans.refno,
+ "${resp.agentCode}-${resp.agentMsg}").let {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(PayReverseResponse(cancelTrans.refno),
+ TradeErrorCode.BUSINESS_DEAL_ERROR, "交易撤销失败!${resp.agentMsg}"))
+ }
+ }
+
+ } ?: return ResponseEntity.ok(ResponseBodyBuilder.create().fail(PayReverseResponse(),
+ TradeErrorCode.TRANSACTION_NOT_EXISTS, "流水不存在"))
+ }
+
+ /**
+ * ============================================================================
+ * 消费流水退款
+ * ============================================================================
+ * */
+ @PostMapping("/payrefund")
+ fun payRefund(@Valid @RequestBody param: ConsumePayRefundParam): ResponseEntity<Any> {
+ consumePayService.getTransactionMainDtl(param.refno, param.billno, param.shopaccno)?.let { mainDtl ->
+ if (mainDtl.sourceType.isNotEmpty()) {
+ //判断能否冲正
+ if (mainDtl.shop) {
+ consumePayService.checkCanReverse(mainDtl.sourceType, mainDtl.shopDtl.shopaccno)
+ } else {
+ consumePayService.checkCanReverse(mainDtl.sourceType)
+ }
+ } else {
+ throw TransactionCheckException(TradeErrorCode.TRANSDTL_STATUS_ERROR,
+ "该笔交易未定义sourcetype, 不支持退款")
+ }
+
+ val builder = TransactionBuilder().apply {
+ setTransInfo(param.transdate, param.transtime, mainDtl.transCode, mainDtl.sourceType)
+ setOutTransInfo(mainDtl.outId, param.requestbillno)
+ }
+ val refundTrans = builder.refundInit(mainDtl.refno, param.refundAmount / 100.0, transactionService)
+ transactionService.wip(refundTrans.refno)
+ val service = createAgentService(mainDtl.sourceType)
+ val resp = service.refund(refundTrans)
+
+ when (resp.code) {
+ AgentCode.SUCCESS -> {
+ transactionService.success(refundTrans.refno, resp.agentRefno, false)
+
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(PayReverseResponse(refundTrans.refno), "交易退款成功"))
+ }
+ AgentCode.REQUIRE_QUERY -> {
+ //待查询
+ agentQueryResultTask.queryResult(refundTrans, 0)
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(PayReverseResponse(refundTrans.refno),
+ TradeErrorCode.WAIT_QUERY_RESULT, "请查询退款结果"))
+ }
+ else -> transactionService.fail(refundTrans.refno,
+ "${resp.agentCode}-${resp.agentMsg}").let {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(PayReverseResponse(refundTrans.refno),
+ TradeErrorCode.BUSINESS_DEAL_ERROR, "退款失败!${resp.agentMsg}"))
+ }
+ }
+
+ } ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(TradeErrorCode.TRANSACTION_NOT_EXISTS, "流水不存在"))
+ }
+
+
+ /**
+ * ============================================================================
+ * 一卡通支付【交易初始化】
+ * ============================================================================
+ * */
+ @PostMapping("/ykt/payinit")
+ fun yktPayInit(@RequestBody param: YktCardPayinitParam): ResponseEntity<Any> {
+// val person = param.uid?.let { userService.findByThirdUniqueIdenty(it) } //没注册,可能匿名?
+// if (consumePayService.checkShopSourceType(param.shopaccno, TradeDict.PAYTYPE_YKT_CARD, person == null)) {
+// val dtl = PersonTransBuilder.newBuilder(accountUtilServcie)
+// .chooseTradetype(Tradetype.CONSUME) //消费
+// .also {
+// if (null != person) it.setOwner(person)
+// }
+// .setTransinfo(TradeCode.TRANSCODE_YKTCARD_PAY, "一卡通支付")
+// .setTransDatetime(param.transdate, param.transtime) //交易时间
+// .selectPaytype(TradeDict.PAYTYPE_YKT_CARD, param.stuempno)
+// .addDetail(AccountHolder.subject(Subject.SUBJNO_PAY_YKT),
+// AccountHolder.shop(param.shopaccno),
+// param.amount / 100.0, "一卡通支付")
+// .also { builder ->
+// param.feelist?.forEach {
+// //fixme: 科目 -> 商户 与个人无关
+// builder.addDetail(AccountHolder.feetype(it.feetype, TradeDict.PAYTYPE_YKT_CARD)
+// .with(AccountHolder.shop(param.shopaccno))
+// .with(AccountHolder.subject(Subject.SUBJNO_PAY_YKT))
+// , it.amount / 100.0)
+// }
+// }
+// .addExtendParam("stuempno", param.stuempno)
+// .addExtendParam("yktshopid", param.yktshopid ?: "")
+// .addExtendParam("devphyid", param.devphyid ?: "")
+// //.addExtendParam(param.extendmap) //fixme: 保存调一卡通附加参数 (是否直接传附加参数map)
+// .init(personBalancePayService)
+//
+// return ResponseEntity.ok(ResponseBodyBuilder.create()
+// .data("refno", dtl.refno)
+// .data("amount", dtl.amount)
+// .success("交易初始化成功"))
+//
+// }
+
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(TradeErrorCode.BUSINESS_PAYTYPE_NOSUPPORT, "不支持支付方式<一卡通支付>"))
+ }
+
+
+ /**
+ * ============================================================================
+ * 一卡通支付【交易确认】
+ * ============================================================================
+ * */
+ @PostMapping("/ykt/payfinish")
+ fun yktPayFinish(@RequestBody param: CitizenCardPayfinishParam): ResponseEntity<Any> {
+// var dtl = PersonTransBuilder.newBuilder(accountUtilServcie)
+// .setRefno(param.refno)
+// .wip(personBalancePayService)
+// val extendMap = consumePayService.getUserdtlExtendParamMap(dtl.refno)
+// val code = CallService.callYktPay(consumePayService.getPaytypeConfig(TradeDict.PAYTYPE_YKT_CARD, dtl.shopaccno, dtl.userid == null),
+// dtl, DateUtil.getNow(), extendMap["stuempno"]!!, extendMap["yktshopid"]!!, extendMap["devphyid"])
+// if (code.retcode == "0") {
+// dtl = PersonTransBuilder.newBuilder(accountUtilServcie)
+// .setRefno(param.refno)
+// .addResult(code.data)
+// .success(personBalancePayService) //流水置成功
+//
+// return ResponseEntity.ok(ResponseBodyBuilder.create()
+// .data("refno", dtl.refno)
+// .data("billno", dtl.outtradeno)
+// .success())
+// } else {
+// PersonTransBuilder.newBuilder(accountUtilServcie)
+// .setRefno(param.refno)
+// .addResult("errmsg", code.retmsg!!)
+// .finish(personBalancePayService, TradeDict.DTL_STATUS_FAIL) //流水置成功
+//
+// return ResponseEntity.ok(ResponseBodyBuilder.create()
+// .fail(TradeErrorCode.BUSINESS_DEAL_ERROR, "交易扣费失败-${code.retmsg}"))
+// }
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(TradeErrorCode.BUSINESS_DEAL_ERROR, "交易扣费失败"))
+ }
+
+ @RequestMapping("/qrcode/init", method = [RequestMethod.POST, RequestMethod.GET])
+ fun qrcodePayInit(@Validated(InitAction::class) @RequestBody param: QrcodePayParam): ResponseEntity<ApiResponse> {
+ val apiResp = QrcodePayResponse()
+ // 1. 检查 qrcode
+ val qrcode = agentServiceProxy.qrcodeMatch(param.qrcode)
+ ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResp, TradeErrorCode.BUSINESS_DEAL_ERROR, "未识别的支付码"))
+
+ val sourceType = sourceTypeService.getBySourceType(qrcode.sourceType)
+ ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResp, TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "不支持的支付方式<${qrcode.sourceType}>"))
+ if (sourceType.paySubjno.isEmpty()
+ || !StringUtils.isNumeric(sourceType.paySubjno)) {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResp, TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "支付方式<${qrcode.sourceType}>未配置科目号"))
+ }
+ var systime = systemUtilService.sysdatetime
+ // 2. 记录 qrcode 交易明细表
+ val qrcodeTrans = agentServiceProxy.qrcodePayTransSaveOrUpdate(
+ QrcodePayTrans().apply {
+ this.agentMerchId = param.shopaccno
+ this.billno = param.billno
+ this.qrcode = param.qrcode
+ this.createTime = systime.sysdate
+ this.hostdate = systime.hostdate
+ this.sourceType = sourceType.sourceType
+ this.isAnonymous = param.anonymous
+ this.updateTime = systime.sysdate
+ })
+
+ // 3. 查询用户身份
+ val service = createAgentService(qrcode.sourceType)
+ val agentResp = service.auth(qrcodeTrans.agentMerchId, qrcodeTrans.billno)
+ // 4. 重新读取 qrcode 交易明细表,以获取 service.auth 查询后的结果数据
+ val qrcodeTransResp = agentServiceProxy.qrcodePayTransFindByMerchIdAndBillno(qrcodeTrans.agentMerchId,
+ qrcodeTrans.billno)
+ apiResp.also {
+ it.sourceType = sourceType.sourceType
+ it.paydesc = qrcodeSummary(sourceType)
+ }
+ return when (agentResp.code) {
+ AgentCode.SUCCESS -> {
+ if (!sourceType.anonymousEnable && qrcodeTransResp.isAnonymous) {
+ ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResp, TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "支付方式<${qrcode.sourceType}> 不支持匿名支付"))
+ } else {
+ ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(apiResp.also {
+ it.anonymous = qrcodeTransResp.isAnonymous
+ it.userid = qrcodeTransResp.agentUserId
+ }))
+ }
+ }
+ AgentCode.NOT_SUPPORT -> {
+ if (!sourceType.anonymousEnable) {
+ ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResp, TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "支付方式<${qrcode.sourceType}> 不支持匿名支付"))
+ } else {
+ ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(apiResp.also {
+ it.anonymous = qrcodeTransResp.isAnonymous
+ }))
+ }
+ }
+ else -> {
+ ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResp, TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "第三方身份错误,<${agentResp.agentMsg}"))
+ }
+ }
+ }
+
+ private fun qrcodeSummary(st: TSourceType): String = st.paydesc + "扫码付"
+
+ @PostMapping("/qrcode/confirm")
+ fun qrcodePayConfirm(@Validated(ConfirmAction::class) @RequestBody param: QrcodePayParam): ResponseEntity<ApiResponse> {
+ //1. 交易检查
+ val apiResponse = QrcodePayResponse()
+ val qrcodeTrans = agentServiceProxy.qrcodePayTransFindByMerchIdAndBillno(param.shopaccno,
+ param.billno) ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResponse, TradeErrorCode.BUSINESS_DEAL_ERROR, "未找到billno"))
+ if (!qrcodeTrans.refno.isNullOrEmpty()) {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResponse, TradeErrorCode.BUSINESS_DEAL_ERROR, "该交易已确认,请查询结果"))
+ }
+
+ if (qrcodeTrans.qrcode != param.qrcode && param.qrcode.isNotEmpty()) {
+ val qrcode = agentServiceProxy.qrcodeMatch(param.qrcode)
+ ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResponse, TradeErrorCode.BUSINESS_DEAL_ERROR, "未识别的支付码"))
+ if (qrcodeTrans.sourceType != qrcode.sourceType) {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResponse, TradeErrorCode.BUSINESS_DEAL_ERROR, "支付码不符"))
+ }
+ qrcodeTrans.qrcode = param.qrcode
+ }
+
+ val sourceType = sourceTypeService.getBySourceType(qrcodeTrans.sourceType)
+ ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResponse, TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "不支持的支付方式<${qrcodeTrans.sourceType}>"))
+ if (!sourceType.anonymousEnable && qrcodeTrans.isAnonymous) {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResponse, TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "支付方式<${qrcodeTrans.sourceType}>不支持匿名支付"))
+ }
+ qrcodeTrans.spip = param.spip
+ val dtlType = consumePayService.getDtltypeDictionary(param.dtltype, Dictionary.DTLTYPES)
+ //2. 初始化交易流水
+ // sourcetype 资产类科目
+ val stSubject = accountUtilServcie.readSubject(sourceType.paySubjno)
+ // build 交易明细
+ val builder = TransactionBuilder().apply {
+ setTransInfo(param.transdate, param.transtime, TradeCode.TRANSCODE_QRCODE, qrcodeTrans.sourceType)
+ setOutTransInfo(qrcodeTrans.agentMerchId, qrcodeTrans.billno)
+ payinfo = qrcodeSummary(sourceType)
+ description = dtlType.dictcaption
+ dtltype = param.dtltype
+ }
+
+ val shopacc = accountUtilServcie.readShopbyShopaccno(qrcodeTrans.agentMerchId)
+ val amount = param.amount / 100.0
+ builder.shop(shopacc).apply {
+ setAmount(amount, TradeDict.TRADE_FLAG_IN)
+ }
+ if (qrcodeTrans.isAnonymous) {
+ builder.anonymous().apply {
+ setAmount(amount, TradeDict.TRADE_FLAG_OUT)
+ setOpposite(shopacc.shopaccno, shopacc.shopname)
+ }.and() // 匿名消费时,借 科目 , 贷 商户
+ .addDebitCreditRecord(AccountProxy(stSubject), AccountProxy(shopacc),
+ amount, qrcodeSummary(sourceType))
+ } else {
+ val account = accountUtilServcie.readAccount(param.userid)
+ builder.person(account).apply {
+ setAmount(amount, TradeDict.TRADE_FLAG_OUT)
+ setOpposite(shopacc.shopaccno, shopacc.shopname)
+ }.and().shop().apply {
+ setOpposite(account.accno, account.accname)
+ }.and() // 实名消费时, 1. 借 科目, 贷 个人账户 ;2. 借 个人账户 贷 商户
+ .addDebitCreditRecord(AccountProxy(stSubject), AccountProxy(account),
+ amount, qrcodeSummary(sourceType))
+ .addDebitCreditRecord(AccountProxy(account), AccountProxy(shopacc),
+ amount, qrcodeSummary(sourceType))
+ }
+
+ // 同一个客户ID + billno 是唯一索引,如果重复请求不能保存
+ val transaction = builder.init(transactionService)
+
+ // qrcode 交易明细表记录 refno
+ qrcodeTrans.refno = transaction.refno
+ // 保存失败,可能客户端重复请求,导致前序交易已完成
+ agentServiceProxy.qrcodePayTransSaveOrUpdate(qrcodeTrans)
+
+ //3. 调用第三方支付
+ transactionService.wip(transaction.refno)
+ val service = createAgentService(qrcodeTrans.sourceType)
+ apiResponse.apply {
+ refno = transaction.refno
+ accdate = transaction.accdate
+ isRequireQuery = false
+ anonymous = qrcodeTrans.isAnonymous
+ }
+
+ val response = service.pay(transaction)
+ return when (response.code) {
+ AgentCode.SUCCESS -> {
+ transactionService.success(transaction.refno)
+ ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(apiResponse))
+ }
+ AgentCode.REQUIRE_QUERY -> {
+ ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(apiResponse.also {
+ it.isRequireQuery = true
+ }))
+ }
+ else -> {
+ transactionService.fail(transaction.refno, response.agentMsg)
+ ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(apiResponse, TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "第三方身份错误,<${response.agentMsg}"))
+ }
+ }
+ }
+
+ /**
+ * ============================================================================
+ * 第三方(支付宝、微信)支付【交易初始化】
+ * ============================================================================
+ * */
+ @PostMapping("/thirdpay/payinit")
+ fun thirdpayInit(@RequestBody param: ThirdPayinitParam): ResponseEntity<Any> {
+ val dtlType = consumePayService.getDtltypeDictionary(param.dtltype, Dictionary.DTLTYPES)
+ val sourceType = sourceTypeService.getBySourceType(param.sourceType)
+ ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(ApiResponse(), TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "不支持的支付方式<${param.sourceType}>"))
+
+ if (consumePayService.checkShopPaytype(param.shopaccno, sourceType.sourceType)) {
+ val account = accountUtilServcie.readAccount(param.uid)
+ val shopacc = accountUtilServcie.readShopbyShopaccno(param.shopaccno)
+ val subject = accountUtilServcie.readSubject(sourceType.paySubjno)
+ var transcode=0
+ when(sourceType.sourceType){
+ TradeDict.PAYTYPE_ALIPAY ->transcode = TradeCode.TRANSCODE_ALIPAY
+ TradeDict.PAYTYPE_WECHAT ->transcode = TradeCode.TRANSCODE_WECHAT
+ }
+ val transaction = TransactionBuilder().apply {
+ setTransInfo(param.transdate, param.transtime,transcode,
+ sourceType.sourceType)
+ setOutTransInfo(shopacc.shopaccno, param.billno)
+ operator(param.shopaccno, TradeDict.OPERTYPE_SHOP)
+
+ }.person(account).apply {
+ setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_OUT)
+ setOpposite(AccountProxy(shopacc))
+ }.and().shop(shopacc).apply {
+ setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_IN)
+ setOpposite(AccountProxy(account))
+ }.and().addDebitCreditRecord(AccountProxy(subject), AccountProxy(account),
+ param.amount / 100.0, dtlType.dictcaption)
+ .addDebitCreditRecord(AccountProxy(account), AccountProxy(shopacc),
+ param.amount / 100.0, dtlType.dictcaption)
+ .also {
+ param.feelist?.also {
+ TODO("feelist 费用清单未实现!")
+ }
+ }.init(transactionService)
+
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(ThirdPayResponse(transaction.refno,
+ transaction.outTradeNo,
+ transaction.shopDtl.amount,null), "交易初始化成功"))
+ }
+
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(TradeErrorCode.BUSINESS_PAYTYPE_NOSUPPORT, "不支持支付方式<第三方支付>"))
+ }
+
+
+ /**
+ * ============================================================================
+ * 第三方(支付宝、微信)支付【交易确认】
+ * ============================================================================
+ * */
+ @PostMapping("/thirdpay/payfinish")
+ fun thirdpayFinish(@RequestBody param: ThirdPayfinishParam): ResponseEntity<Any> {
+ val dtl = transactionService.wip(param.refno)
+ var type=""
+ if(dtl.transCode== TradeCode.TRANSCODE_ALIPAY){
+ type = TradeDict.PAYTYPE_ALIPAY
+ }else if(dtl.transCode== TradeCode.TRANSCODE_WECHAT){
+ type = TradeDict.PAYTYPE_WECHAT
+ }
+ val service = createAgentService(type)
+ val resp = service.pay(dtl)
+ when (resp.code) {
+ AgentCode.SUCCESS ->
+ transactionService.success(dtl.refno, resp.agentRefno, false).let {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .success(ThirdPayResponse(it.refno,
+ it.outTradeNo,
+ it.shopDtl.amount,resp.agentBody), "交易确认成功"))
+
+ }
+ AgentCode.REQUIRE_QUERY -> {
+ //去查询
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(ThirdPayResponse(dtl.refno,
+ dtl.outTradeNo,
+ dtl.shopDtl.amount,resp.agentBody), TradeErrorCode.WAIT_QUERY_RESULT, "请查询支付结果"))
+ }
+ else -> //失败
+ transactionService.fail(param.refno, resp.agentMsg).let {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(ThirdPayResponse(dtl.refno, dtl.outTradeNo, dtl.shopDtl.amount,resp.agentBody),
+ TradeErrorCode.BUSINESS_DEAL_ERROR, "交易扣费失败-${resp.agentMsg}"))
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/dali_datasync_api_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/dali_datasync_api_controller.kt
new file mode 100644
index 0000000..5f08635
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/dali_datasync_api_controller.kt
@@ -0,0 +1,88 @@
+package com.supwisdom.dlpay.api.controller
+
+import com.google.gson.Gson
+import com.supwisdom.dlpay.api.bean.DaliDatasyncErrorDetail
+import com.supwisdom.dlpay.api.bean.DaliDatasyncParam
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException
+import com.supwisdom.dlpay.api.service.DaliDatasyncService
+import com.supwisdom.dlpay.framework.ResponseBodyBuilder
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.util.StringUtil
+import com.supwisdom.dlpay.framework.util.SysparaUtil
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.http.ResponseEntity
+import org.springframework.web.bind.annotation.*
+
+@RequestMapping("/api/common")
+class DaliDatasyncApiController {
+ @Autowired
+ lateinit var systemUtilService: SystemUtilService
+ @Autowired
+ lateinit var daliDatasyncService: DaliDatasyncService
+
+ /**
+ * ============================================================================
+ * 大理卡管系统推送市民卡信息同步接口
+ * ============================================================================
+ * */
+ @PostMapping("/datasync")
+ @ResponseBody
+ fun daliDatasync(@RequestBody param: DaliDatasyncParam): ResponseEntity<Any> {
+ try {
+ param.checkParam()
+ val appid = systemUtilService.getSysparaValue(SysparaUtil.DLCARDMANAGER_APPID)
+ val appkey = systemUtilService.getSysparaValue(SysparaUtil.DLCARDMANAGER_SECRET)
+ val deskey = systemUtilService.getSysparaValue(SysparaUtil.DLCARDMANAGER_DESKEY)
+ if (StringUtil.isEmpty(appid) || StringUtil.isEmpty(appkey) || StringUtil.isEmpty(deskey)) {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(1000, "系统参数未配置"))
+ } else if (appid != param.app_id) {
+ throw RequestParamCheckException("请求参数错误[应用ID错误]")
+ }
+ if (!param.checkSign(appkey)) {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(2001, "签名错误"))
+ }
+
+ val datalist = param.decData(deskey)
+ if (param.count != datalist.size) {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(2002, "请求参数错误[数据条数不匹配]"))
+ }
+
+ var errlist = ArrayList<DaliDatasyncErrorDetail>(0)
+
+ datalist.forEach {detail->
+ try {
+ detail.checkParam()
+ daliDatasyncService.doUpdateUserInfos(detail)
+ } catch (e1: RequestParamCheckException) {
+ errlist.add(DaliDatasyncErrorDetail().apply {
+ cardno = detail.cardno
+ errcode = "2001"
+ errmsg = e1.message?:"明细数据关键字段为空"
+ })
+ }catch (e2: Exception){
+ errlist.add(DaliDatasyncErrorDetail().apply {
+ cardno = detail.cardno
+ errcode = "3000"
+ errmsg = e2.message?:"明细处理错误"
+ })
+ }
+ }
+
+ return when(StringUtil.isEmpty(errlist)){
+ true -> ResponseEntity.ok(mapOf("retcode" to "0000", "retmsg" to "SUCCESS", "resultcode" to "0000", "resultmsg" to ""))
+ false -> ResponseEntity.ok(mapOf("retcode" to "0000", "retmsg" to "请求成功接收", "resultcode" to "4000", "resultmsg" to "明细数据处理有错", "data" to Gson().toJson(errlist)))
+ }
+ } catch (ex: RequestParamCheckException) {
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(2001, ex.message ?: "请求参数错误"))
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return ResponseEntity.ok(ResponseBodyBuilder.create()
+ .fail(4000, "系统处理错误"))
+ }
+ }
+
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/controller/notify_api_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/notify_api_controller.kt
similarity index 97%
rename from src/main/kotlin/com/supwisdom/dlpay/api/controller/notify_api_controller.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/notify_api_controller.kt
index d57c96d..51ed2ef 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/controller/notify_api_controller.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/notify_api_controller.kt
@@ -64,7 +64,7 @@
map = StringUtil.paraFilter(map)
//TODO 校验签名
var signStr = StringUtil.createLinkString(map)
- val config = paytypeService.getPaytypeConfigByPaytype(PaytypeUtil.WECHAT)
+ val config = paytypeService.getSourceTypeConfigBySourceType(PaytypeUtil.WECHAT)
if (config["appkey"].isNullOrEmpty()) {
logger.error("签名错误")
return "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[签名错误]]></return_msg></xml>"
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt
similarity index 77%
rename from src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt
index ef9b194..a722aec 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt
@@ -2,11 +2,12 @@
import com.supwisdom.dlpay.api.bean.OpenShopParam
import com.supwisdom.dlpay.api.bean.QueryShopParam
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException
import com.supwisdom.dlpay.framework.ResponseBodyBuilder
import com.supwisdom.dlpay.api.service.ShopService
-import com.supwisdom.dlpay.exception.RequestParamCheckException
import com.supwisdom.dlpay.exception.TransactionException
import com.supwisdom.dlpay.framework.service.CommonService
+import com.supwisdom.dlpay.framework.tenant.TenantContext
import com.supwisdom.dlpay.framework.util.TradeErrorCode
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.ResponseEntity
@@ -24,12 +25,9 @@
private lateinit var commonService: CommonService
@PostMapping("/open")
- fun openAccount(@RequestBody param: OpenShopParam, request: HttpServletRequest, response: HttpServletResponse): ResponseEntity<Any> {
+ fun openAccount(@RequestBody param: OpenShopParam): ResponseEntity<Any> {
try {
- if (!param.checkParam() || !param.checkSign(commonService.getAppidSecretByRequest(request))) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误"))
- }
+ TenantContext.setTenantSchema(param.tenantid)
shopService.findByThirdUniqueId(param.shopUniqueId)?.let {
return ResponseEntity.ok(ResponseBodyBuilder.create()
.fail(TradeErrorCode.BUSINESS_SHOP_EXISTS, "该商户唯一号[${param.shopUniqueId}]已经存在"))
@@ -54,13 +52,9 @@
}
@GetMapping("/query")
- fun queryShop(@RequestBody param: QueryShopParam, request: HttpServletRequest, response: HttpServletResponse): ResponseEntity<Any> {
+ fun queryShop(@RequestBody param: QueryShopParam): ResponseEntity<Any> {
try {
- if (param.checkParam() && param.checkSign(commonService.getAppidSecretByRequest(request))) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误"))
- }
-
+ TenantContext.setTenantSchema(param.tenantid)
shopService.findByShopBySearch(param.shopid, param.shopaccno, param.shopUniqueId)?.let {
return ResponseEntity.ok(ResponseBodyBuilder.create()
.data("shop", it)
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/controller/user_api_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/user_api_controller.kt
similarity index 80%
rename from src/main/kotlin/com/supwisdom/dlpay/api/controller/user_api_controller.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/user_api_controller.kt
index 71aab56..551b7c6 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/controller/user_api_controller.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/user_api_controller.kt
@@ -3,8 +3,8 @@
import com.supwisdom.dlpay.api.bean.ModifyUserParam
import com.supwisdom.dlpay.api.bean.OpenUserParam
import com.supwisdom.dlpay.api.bean.QueryUserParam
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException
import com.supwisdom.dlpay.api.service.UserService
-import com.supwisdom.dlpay.exception.RequestParamCheckException
import com.supwisdom.dlpay.exception.TransactionException
import com.supwisdom.dlpay.framework.ResponseBodyBuilder
import com.supwisdom.dlpay.framework.service.CommonService
@@ -24,17 +24,10 @@
class UserAPIController {
@Autowired
private lateinit var useService: UserService
- @Autowired
- private lateinit var commonService: CommonService
@PostMapping("/open")
- fun openAccount(@RequestBody param: OpenUserParam, request: HttpServletRequest, response: HttpServletResponse): ResponseEntity<Any> {
+ fun openAccount(@RequestBody param: OpenUserParam): ResponseEntity<Any> {
try {
-
- if (!param.checkParam() || !param.checkSign(commonService.getAppidSecretByRequest(request))) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误"))
- }
useService.findByThirdUniqueIdenty(param.uid).let {
if (null != it) {
return ResponseEntity.ok(ResponseBodyBuilder.create()
@@ -60,13 +53,8 @@
}
@PostMapping("/query")
- fun queryAccount(@RequestBody param: QueryUserParam, request: HttpServletRequest, response: HttpServletResponse): ResponseEntity<Any> {
+ fun queryAccount(@RequestBody param: QueryUserParam): ResponseEntity<Any> {
try {
- if (param.checkParam() && param.checkSign(commonService.getAppidSecretByRequest(request))) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误"))
- }
-
useService.findByUseridOrThirdUniqueIdenty(param.userid, param.uid).let {
if (null != it) {
val account = useService.findAccountByUserid(it.userid, null)
@@ -109,12 +97,8 @@
}
@PostMapping("/modify")
- fun modifyAccount(@RequestBody param: ModifyUserParam, request: HttpServletRequest, response: HttpServletResponse): ResponseEntity<Any> {
+ fun modifyAccount(@RequestBody param: ModifyUserParam): ResponseEntity<Any> {
try {
- if (param.checkParam() && param.checkSign(commonService.getAppidSecretByRequest(request))) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误"))
- }
useService.findByUseridOrThirdUniqueIdenty(param.userid, param.uid)?.let {
param.name = param.name?.let { URLDecoder.decode(param.name, Charsets.UTF_8.toString()) } //解码
param.address = param.address?.let { URLDecoder.decode(param.address, Charsets.UTF_8.toString()) } //解码
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_task.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_task.kt
new file mode 100644
index 0000000..35136c5
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_task.kt
@@ -0,0 +1,153 @@
+package com.supwisdom.dlpay.api
+
+import com.supwisdom.dlpay.agent.AgentCode
+import com.supwisdom.dlpay.agent.DtlStatus
+import com.supwisdom.dlpay.api.domain.TDtlQuery
+import com.supwisdom.dlpay.api.domain.TShopdtl
+import com.supwisdom.dlpay.api.repositories.ShopaccService
+import com.supwisdom.dlpay.api.service.ConsumePayService
+import com.supwisdom.dlpay.api.service.DtlQueryResultService
+import com.supwisdom.dlpay.api.service.TransactionServiceProxy
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.util.ApplicationUtil
+import com.supwisdom.dlpay.framework.util.TradeDict
+import com.supwisdom.dlpay.util.ConstantUtil
+import net.javacrumbs.shedlock.core.SchedulerLock
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.ApplicationContext
+import org.springframework.scheduling.annotation.Scheduled
+import org.springframework.stereotype.Component
+import org.springframework.stereotype.Service
+
+@Service
+class MySchedulerTask {
+ @Autowired
+ private lateinit var shopaccService: ShopaccService
+
+ fun doShopBlanceUpdate(dtl: TShopdtl) {
+ shopaccService.recalcShopBalance(dtl.refno, true)
+ }
+
+ @Scheduled(cron = "\${shopbalance.updater.cron:-}")
+ @SchedulerLock(name = "dealShopUnupdatedDtl", lockAtMostForString = "PT10M")
+ fun dealShopUnupdatedDtl() {
+ try {
+ shopaccService.findUnupdatedShopDtl(100).forEach {
+ doShopBlanceUpdate(it)
+ }
+ } catch (ex: Exception) {
+ ex.printStackTrace()
+ }
+ }
+}
+
+/**
+ * 定时扫描TDtlQuery,查询第三方流水状态
+ * */
+@Component
+class DtlQueryResultSchedulerTask {
+ @Autowired
+ private lateinit var systemUtilService: SystemUtilService
+ @Autowired
+ private lateinit var dtlQueryResultService: DtlQueryResultService
+ @Autowired
+ lateinit var transactionService: TransactionServiceProxy
+ @Autowired
+ lateinit var consumePayService: ConsumePayService
+ @Autowired
+ private lateinit var applicationContext: ApplicationContext
+
+ @Scheduled(cron = "\${query.third.transdtl.result.cron:-}")
+ @SchedulerLock(name = "DtlQueryResultSchedulerTask", lockAtMostForString = "PT10M")
+ fun queryThirdTransdtlResult() {
+ try {
+ //仅查询当天数据,查询次数在规定次数之下
+ dtlQueryResultService.getNeedQueryRecords(systemUtilService.accdate, ConstantUtil.QUERY_MAX_COUNT).forEach {
+ try {
+ doQuery(it)
+ } catch (exp: Exception) {
+ it.qcnt = it.qcnt + 1
+ dtlQueryResultService.saveOrUpdateDtlQuery(it) //次数加一
+ }
+ }
+ } catch (ex: Exception) {
+ ex.printStackTrace()
+ }
+ }
+
+ private fun doQuery(dtlQuery: TDtlQuery) {
+ if (ConstantUtil.QUERYTYPE_NEED_QUERY != dtlQuery.status) {
+ return //已结束
+ }
+ val dtl = consumePayService.getTransactionMainDtl(dtlQuery.refno, null, null)
+ if (null == dtl) {
+ dtlQuery.qcnt = dtlQuery.qcnt + 1
+ dtlQuery.status = ConstantUtil.QUERYTYPE_QUERY_FINISH
+ dtlQuery.remark = "refno未找到流水"
+ dtlQueryResultService.saveOrUpdateDtlQuery(dtlQuery)
+ return
+ } else if (TradeDict.DTL_STATUS_WIP != dtl.status) {
+ dtlQuery.qcnt = dtlQuery.qcnt + 1
+ dtlQuery.status = ConstantUtil.QUERYTYPE_QUERY_FINISH
+ dtlQuery.remark = "原始流水非wip状态"
+ dtlQueryResultService.saveOrUpdateDtlQuery(dtlQuery)
+ return
+ } else if (TradeDict.PAYTYPE_CITIZEN_CARD != dtl.sourceType) {
+ //fixme: 现仅供大理农商卡对接查询
+ dtlQuery.qcnt = dtlQuery.qcnt + 1
+ dtlQuery.status = ConstantUtil.QUERYTYPE_QUERY_FINISH
+ dtlQuery.remark = "非大理市民卡支付流水"
+ dtlQueryResultService.saveOrUpdateDtlQuery(dtlQuery)
+ return
+ }
+
+ val service = ApplicationUtil.findAgentPayService(applicationContext, dtl.sourceType + "Agent")
+ val resp = service.query(dtl)
+ when (resp.code) {
+ AgentCode.SUCCESS -> {
+ //查询成功
+ when (resp.dtlStatus) {
+ DtlStatus.SUCCESS -> {
+ transactionService.success(dtl.refno, resp.agentRefno, false) //流水成功
+ dtlQuery.qcnt = dtlQuery.qcnt + 1
+ dtlQuery.status = ConstantUtil.QUERYTYPE_QUERY_FINISH
+ dtlQuery.remark = "查询成功,流水为付款成功状态"
+ dtlQueryResultService.saveOrUpdateDtlQuery(dtlQuery)
+ return
+ }
+ DtlStatus.REFUND, DtlStatus.PARTIAL_REFUND -> {
+ dtlQuery.qcnt = dtlQuery.qcnt + 1
+ dtlQuery.status = ConstantUtil.QUERYTYPE_QUERY_FINISH
+ dtlQuery.remark = "查询成功,流水为已退款或部分退款状态"
+ dtlQueryResultService.saveOrUpdateDtlQuery(dtlQuery)
+ return
+ }
+ else -> {
+ //流水失败
+ transactionService.fail(dtl.refno, "查询流水状态为交易失败")
+ dtlQuery.qcnt = dtlQuery.qcnt + 1
+ dtlQuery.status = ConstantUtil.QUERYTYPE_QUERY_FINISH
+ dtlQuery.remark = "查询成功,流水为失败状态"
+ dtlQueryResultService.saveOrUpdateDtlQuery(dtlQuery)
+ return
+ }
+ }
+ }
+ AgentCode.REFNO_NOT_EXISTS -> {
+ transactionService.fail(dtl.refno, "银行流水不存在") //银行返回流水不存在
+ dtlQuery.qcnt = dtlQuery.qcnt + 1
+ dtlQuery.status = ConstantUtil.QUERYTYPE_QUERY_FINISH
+ dtlQuery.remark = "查询成功,返回流水不存在"
+ dtlQueryResultService.saveOrUpdateDtlQuery(dtlQuery)
+ return
+ }
+ else -> {
+ //其他明确错误,后续再查询
+ dtlQuery.qcnt = dtlQuery.qcnt + 1
+ dtlQuery.remark = "查询失败!${resp.agentMsg}"
+ dtlQueryResultService.saveOrUpdateDtlQuery(dtlQuery)
+ return
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_ynrccchk_task.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_ynrccchk_task.kt
new file mode 100644
index 0000000..e721a02
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_ynrccchk_task.kt
@@ -0,0 +1,80 @@
+package com.supwisdom.dlpay.api
+
+import com.supwisdom.dlpay.agent.citizencard.YnrccUtil
+import com.supwisdom.dlpay.agent.service.CitizencardPayService
+import com.supwisdom.dlpay.api.service.SourceTypeService
+import com.supwisdom.dlpay.api.service.TransactionReconciliationService
+import com.supwisdom.dlpay.api.service.YnrccBusinessService
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.util.DateUtil
+import com.supwisdom.dlpay.framework.util.TradeDict
+import mu.KotlinLogging
+import net.javacrumbs.shedlock.core.SchedulerLock
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.scheduling.annotation.Scheduled
+import org.springframework.stereotype.Component
+import org.springframework.web.client.RestTemplate
+
+
+/**
+ * 第三方对账任务
+ * */
+@Component
+class DownloadYnrccChkfileTask {
+ @Autowired
+ private lateinit var systemUtilService: SystemUtilService
+ @Autowired
+ private lateinit var ynrccBusinessService: YnrccBusinessService
+ @Autowired
+ private lateinit var citizencardPayService: CitizencardPayService
+ @Autowired
+ private lateinit var transactionReconciliationService: TransactionReconciliationService
+ @Autowired
+ private lateinit var sourceTypeService: SourceTypeService
+ @Autowired
+ private lateinit var restTemplate: RestTemplate
+
+ private val logger = KotlinLogging.logger { }
+
+
+ @Scheduled(cron = "\${download.ynrcc.chkfile.cron:-}")
+ @SchedulerLock(name = "DownloadYnrccChkfileSchedulerTask", lockAtMostForString = "PT10M")
+ fun doDownloadYnrccChkfile() {
+ try {
+ //下载对账单逻辑
+ val hostdate = systemUtilService.sysdatetime.hostdate
+ val downloadLastdate = ynrccBusinessService.getLastDownloadBillDate()
+ val diffDays = DateUtil.getIntervalDay(downloadLastdate, hostdate).toInt()
+ logger.info("大理农商行对账单下载:downloadLastdate=$downloadLastdate, hostdate=$hostdate, diffDays=$diffDays ")
+
+ for (i in 1 until diffDays) {
+ val billDate = DateUtil.getNewDay(downloadLastdate, i) //要取对账单的日期
+
+ var chkfile = transactionReconciliationService.getTransactionChkfile(billDate, TradeDict.PAYTYPE_CITIZEN_CARD)
+ if (null != chkfile) {
+ continue // 已经存在对账单
+ }
+
+ val resp = citizencardPayService.getChkfilename(billDate, null)
+ if (YnrccUtil.CODE_SUCCESS == resp.code) {
+ val agentConfig = sourceTypeService.getChargePaytypeConfig(TradeDict.PAYTYPE_CITIZEN_CARD, true)
+ val agentUrl = agentConfig[YnrccUtil.YNRCC_ANGENT_URL] + "/download"
+ //根据filename 取文件数据
+
+
+ } else if (YnrccUtil.NO_RECORDS_TODAY == resp.code) {
+ //当日无交易明细,也创建空记录
+
+ } else {
+ //报错,退出对账单拉取
+ logger.error("大理农商行对账单下载[$billDate]报错:${resp.message}")
+ break
+ }
+ }
+
+ } catch (ex: Exception) {
+ ex.printStackTrace()
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/card_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/card_service.kt
new file mode 100644
index 0000000..4b09146
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/card_service.kt
@@ -0,0 +1,15 @@
+package com.supwisdom.dlpay.api.service
+
+import com.supwisdom.dlpay.api.domain.TCard
+import com.supwisdom.dlpay.api.domain.TPerson
+import org.springframework.transaction.annotation.Transactional
+
+interface CardService {
+ @Transactional(rollbackFor = arrayOf(Exception::class), readOnly = true)
+ fun getBankcardByUserid(userid: String): TCard?
+
+ @Transactional(rollbackFor = arrayOf(Exception::class), readOnly = true)
+ fun getPersonByCitizencard(cardno: String, ignoreStatus: Boolean? = false): TPerson
+
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/charge_api_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/charge_api_service.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/charge_api_service.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/charge_api_service.kt
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/consume_pay_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/consume_pay_service.kt
similarity index 72%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/consume_pay_service.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/consume_pay_service.kt
index ec92ddc..29867ae 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/consume_pay_service.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/consume_pay_service.kt
@@ -1,6 +1,7 @@
package com.supwisdom.dlpay.api.service
import com.supwisdom.dlpay.api.domain.TTransactionMain
+import com.supwisdom.dlpay.framework.domain.TDictionary
import org.springframework.transaction.annotation.Propagation
import org.springframework.transaction.annotation.Transactional
@@ -16,4 +17,11 @@
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = [Exception::class], readOnly = true)
fun getTransactionMainDtl(refno: String?, billno: String?, shopaccno: String?): TTransactionMain?
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = [Exception::class], readOnly = true)
+ fun getDtltypeDictionary(dictval:String, dicttype:String):TDictionary
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = [Exception::class], readOnly = true)
+ fun checkCanReverse(sourcetype: String, shopaccno: String? = null): Boolean
+
}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/dali_datasync_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/dali_datasync_service.kt
new file mode 100644
index 0000000..d5a960f
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/dali_datasync_service.kt
@@ -0,0 +1,13 @@
+package com.supwisdom.dlpay.api.service
+
+import com.supwisdom.dlpay.api.bean.DaliDatasyncDetail
+import com.supwisdom.dlpay.api.domain.TCard
+import org.springframework.transaction.annotation.Propagation
+import org.springframework.transaction.annotation.Transactional
+
+interface DaliDatasyncService{
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class))
+ fun doUpdateUserInfos(bean: DaliDatasyncDetail): Boolean
+
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/dtl_query_result_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/dtl_query_result_service.kt
new file mode 100644
index 0000000..9673b0f
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/dtl_query_result_service.kt
@@ -0,0 +1,15 @@
+package com.supwisdom.dlpay.api.service
+
+import com.supwisdom.dlpay.api.domain.TDtlQuery
+import org.springframework.transaction.annotation.Propagation
+import org.springframework.transaction.annotation.Transactional
+
+interface DtlQueryResultService {
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = [Exception::class])
+ fun saveOrUpdateDtlQuery(dtlQuery: TDtlQuery): TDtlQuery
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = [Exception::class], readOnly = true)
+ fun getNeedQueryRecords(accdate: String, maxCount:Int): List<TDtlQuery>
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/account_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/account_service_impl.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/impl/account_service_impl.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/account_service_impl.kt
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/card_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/card_service_impl.kt
new file mode 100644
index 0000000..4610ef7
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/card_service_impl.kt
@@ -0,0 +1,41 @@
+package com.supwisdom.dlpay.api.service.impl
+
+import com.supwisdom.dlpay.api.dao.CardDao
+import com.supwisdom.dlpay.api.dao.PersonDao
+import com.supwisdom.dlpay.api.domain.TCard
+import com.supwisdom.dlpay.api.domain.TPerson
+import com.supwisdom.dlpay.api.service.CardService
+import com.supwisdom.dlpay.exception.TransactionProcessException
+import com.supwisdom.dlpay.framework.util.TradeDict
+import com.supwisdom.dlpay.framework.util.TradeErrorCode
+import com.supwisdom.dlpay.util.ConstantUtil
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+
+@Service
+class CardServiceImpl : CardService {
+ @Autowired
+ lateinit var cardDao: CardDao
+ @Autowired
+ lateinit var personDao: PersonDao
+
+ override fun getBankcardByUserid(userid: String): TCard? {
+ return cardDao.findCardByUseridAndCardtype(userid, ConstantUtil.CARDTYPE_BANKCARD)
+ }
+
+ override fun getPersonByCitizencard(cardno: String, ignoreStatus: Boolean?): TPerson {
+ val cityCard = cardDao.findCardByCardnoAndCardtype(cardno, ConstantUtil.CARDTYPE_CITIZENCARD)
+ ?: throw TransactionProcessException(TradeErrorCode.CARD_NOT_EXISTS, "市民卡[$cardno]不存在!")
+ if (true != ignoreStatus) {
+ when {
+ TradeDict.STATUS_NORMAL != cityCard.status -> throw TransactionProcessException(TradeErrorCode.CARD_IS_CLOSED, "市民卡[$cardno]已经注销!")
+ TradeDict.STATUS_LOST == cityCard.transStatus -> throw TransactionProcessException(TradeErrorCode.ACCOUNT_IS_LOSS, "市民卡[$cardno]已经挂失!")
+ TradeDict.STATUS_FROZEN == cityCard.transStatus -> throw TransactionProcessException(TradeErrorCode.ACCOUNT_IS_FROZEN, "市民卡[$cardno]已经冻结!")
+ TradeDict.STATUS_LOCKED == cityCard.transStatus -> throw TransactionProcessException(TradeErrorCode.ACCOUNT_IS_LOCKED, "市民卡[$cardno]已被锁定!")
+ }
+ }
+
+ return personDao.findByUserid(cityCard.userid)
+ ?: throw TransactionProcessException(TradeErrorCode.ACCOUNT_NOT_EXISTS, "市民卡[$cardno]用户信息不存在!")
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/charge_api_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/charge_api_service_impl.kt
similarity index 62%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/impl/charge_api_service_impl.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/charge_api_service_impl.kt
index 3122da3..d76880f 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/charge_api_service_impl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/charge_api_service_impl.kt
@@ -1,38 +1,26 @@
package com.supwisdom.dlpay.api.service.impl
import com.supwisdom.dlpay.api.dao.PersondtlDao
-import com.supwisdom.dlpay.api.dao.SourceTypeDao
import com.supwisdom.dlpay.api.dao.TransactionMainDao
import com.supwisdom.dlpay.api.domain.TPersondtl
import com.supwisdom.dlpay.api.domain.TTransactionMain
import com.supwisdom.dlpay.api.service.ChargeApiService
-import com.supwisdom.dlpay.exception.TransactionProcessException
+import com.supwisdom.dlpay.api.service.SourceTypeService
import com.supwisdom.dlpay.framework.util.StringUtil
-import com.supwisdom.dlpay.framework.util.TradeErrorCode
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
@Service
class ChargeApiServiceImpl : ChargeApiService {
@Autowired
- lateinit var sourceTypeDao: SourceTypeDao
+ lateinit var sourceTypeService: SourceTypeService
@Autowired
lateinit var transactionMainDao: TransactionMainDao
@Autowired
lateinit var persondtlDao: PersondtlDao
override fun checkRechargeSourcetype(sourceType: String): Boolean {
- sourceTypeDao.getBySourceType(sourceType).let {
- if (null == it) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[$sourceType]")
- } else {
- if (!it.enable || !it.chargeEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统充值未启用支付方式[$sourceType]")
- }
- }
- }
-
- return true
+ return sourceTypeService.checkRechargeSourcetype(sourceType)
}
override fun getTransactionMainDtl(refno: String?, billno: String?, outid: String?): TTransactionMain? {
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/consume_pay_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/consume_pay_service_impl.kt
new file mode 100644
index 0000000..8830fcd
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/consume_pay_service_impl.kt
@@ -0,0 +1,56 @@
+package com.supwisdom.dlpay.api.service.impl
+
+import com.supwisdom.dlpay.api.dao.TransactionMainDao
+import com.supwisdom.dlpay.api.domain.TTransactionMain
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException
+import com.supwisdom.dlpay.api.service.ConsumePayService
+import com.supwisdom.dlpay.api.service.SourceTypeService
+
+import com.supwisdom.dlpay.framework.dao.DictionaryDao
+import com.supwisdom.dlpay.framework.domain.TDictionary
+import com.supwisdom.dlpay.framework.util.StringUtil
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+
+@Service
+class ConsumePayServiceImpl : ConsumePayService {
+ @Autowired
+ lateinit var sourceTypeService: SourceTypeService
+ @Autowired
+ lateinit var transactionMainDao: TransactionMainDao
+ @Autowired
+ lateinit var dictionaryDao: DictionaryDao
+
+ override fun checkShopPaytype(shopaccno: String, sourceType: String, anonymousflag: Boolean?): Boolean {
+ return sourceTypeService.checkShopSourceType(shopaccno, sourceType, true == anonymousflag)
+ }
+
+ override fun getPaytypeConfig(paytype: String, shopaccno: String,
+ anonymousflag: Boolean?, ignoreStatus: Boolean?): Map<String, String?> {
+ return sourceTypeService.getConsumePaytypeConfig(paytype, shopaccno, true == anonymousflag, true == ignoreStatus)
+ }
+
+ override fun getTransactionMainDtl(refno: String?, billno: String?, shopaccno: String?): TTransactionMain? {
+ return when (!StringUtil.isEmpty(refno)) {
+ true -> transactionMainDao.findByRefno(refno)
+ false -> transactionMainDao.findByBillno(billno, shopaccno)
+ }
+ }
+
+ override fun getUserdtlExtendParamMap(refno: String): Map<String, String> {
+ TODO("未实现方法")
+ }
+
+ override fun getDtltypeDictionary(dictval: String, dicttype: String): TDictionary {
+ return dictionaryDao.getByDicttypeAndDictval(dicttype, dictval)
+ ?: throw RequestParamCheckException("未识别流水类别[$dictval]")
+ }
+
+ override fun checkCanReverse(sourcetype: String, shopaccno: String?): Boolean {
+ return if (StringUtil.isEmpty(shopaccno)) {
+ sourceTypeService.checkCanReverse(sourcetype)
+ } else {
+ sourceTypeService.checkShopCanReverse(sourcetype, shopaccno);
+ }
+ }
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/dali_datasync_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/dali_datasync_service_impl.kt
new file mode 100644
index 0000000..df5ed08
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/dali_datasync_service_impl.kt
@@ -0,0 +1,132 @@
+package com.supwisdom.dlpay.api.service.impl
+
+import com.supwisdom.dlpay.api.bean.DaliDatasyncDetail
+import com.supwisdom.dlpay.api.dao.AccountDao
+import com.supwisdom.dlpay.api.dao.CardDao
+import com.supwisdom.dlpay.api.dao.PersonDao
+import com.supwisdom.dlpay.api.domain.TAccount
+import com.supwisdom.dlpay.api.domain.TCard
+import com.supwisdom.dlpay.api.domain.TPerson
+import com.supwisdom.dlpay.api.service.DaliDatasyncService
+import com.supwisdom.dlpay.exception.TransactionProcessException
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.tenant.TenantContext
+import com.supwisdom.dlpay.framework.util.*
+import com.supwisdom.dlpay.util.ConstantUtil
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+
+@Service
+class DaliDatasyncServiceImpl : DaliDatasyncService {
+ @Autowired
+ lateinit var accountDao: AccountDao
+ @Autowired
+ lateinit var personDao: PersonDao
+ @Autowired
+ lateinit var cardDao: CardDao
+ @Autowired
+ lateinit var systemUtilService: SystemUtilService
+
+ override fun doUpdateUserInfos(bean: DaliDatasyncDetail): Boolean {
+ val maxbal = systemUtilService.getSysparaValueAsDouble(SysparaUtil.BALANCE_LIMIT, SysparaUtil.DEFAULT_BALANCE_LIMIT)
+ val lowfreeLimit = systemUtilService.getSysparaValueAsDouble(SysparaUtil.NOPASS_LIMIT, SysparaUtil.DEFAULT_NOPASS_LIMIT)
+ val daylimit = systemUtilService.getSysparaValueAsDouble(SysparaUtil.DAY_PAY_LIMIT, SysparaUtil.DEFAULT_DAY_PAY_LIMIT)
+
+ val systime = systemUtilService.sysdatetime
+ var person = personDao.findByIdentity(bean.idtype.trim(), bean.idno.trim())
+ if (null != person) {
+ if (person.name != bean.username) {
+ person.name = bean.username
+ person.lastsaved = systime.hostdatetime
+ person = personDao.save(person)
+ accountDao.updateAccnameByUserid(person.name, person.userid)
+ }
+ } else {
+ person = TPerson().apply {
+ name = bean.username
+ status = TradeDict.STATUS_NORMAL
+ idtype = bean.idtype.trim()
+ idno = bean.idno.trim()
+ email = bean.email
+ mobile = bean.mobile
+ lastsaved = systime.hostdatetime
+ }
+ person.tenantid = TenantContext.getTenantSchema()
+ person = personDao.save(person)
+
+ var account = TAccount().apply {
+ accname = person.name
+ subjno = Subject.SUBJNO_PERSONAL_DEPOSIT
+ userid = person.userid
+ transStatus = person.status
+ balance = 0.00
+ availbal = 0.00
+ frozebal = 0.00
+ lowfreeFlag = false
+ this.lowfreeLimit = lowfreeLimit
+ this.daylimit = daylimit
+ this.maxbal = maxbal
+ lasttranstime = systime.sysdate
+ lastdayTransamt = 0.00
+ lastdayDpsamt = 0.00
+ opendate = systime.hostdate
+ }
+ account.generateTac()
+ account.tenantid = TenantContext.getTenantSchema()
+ accountDao.save(account)
+ }
+
+ var cityCard = cardDao.findCardByCardnoAndCardtype(bean.cardno.trim(), ConstantUtil.CARDTYPE_CITIZENCARD)
+ if (null != cityCard) {
+ //仅修改有效期和状态
+ if (cityCard.expiredate != bean.expiredate.trim()) {
+ cityCard.expiredate = bean.expiredate.trim()
+ }
+ //fixme: bean.cardstatus 判断修改状态
+
+ cardDao.save(cityCard)
+ } else {
+ cityCard = TCard().apply {
+ cardno = bean.cardno.trim()
+ cardtype = ConstantUtil.CARDTYPE_CITIZENCARD
+ cardphyid = bean.cardphyid.trim()
+ status = TradeDict.STATUS_NORMAL // fixme: bean.cardstatus 判断
+ transStatus = TradeDict.STATUS_NORMAL
+ expiredate = bean.expiredate.trim()
+ signed = false
+ userid = person.userid
+ lastsaved = systime.hostdatetime
+ }
+ cityCard.tenantid = TenantContext.getTenantSchema()
+ cardDao.save(cityCard)
+ }
+
+ if (!StringUtil.isEmpty(bean.bankcardno)) {
+ var bankCard = cardDao.findCardByCardnoAndCardtype(bean.bankcardno!!.trim(), ConstantUtil.CARDTYPE_BANKCARD)
+ if (null == bankCard) {
+ bankCard = TCard().apply {
+ cardno = bean.bankcardno!!.trim()
+ cardtype = ConstantUtil.CARDTYPE_BANKCARD
+ cardphyid = ""
+ status = TradeDict.STATUS_NORMAL // fixme: bean.cardstatus 判断
+ transStatus = TradeDict.STATUS_NORMAL
+ expiredate = "21991231"
+ signed = false
+ userid = person.userid
+ lastsaved = systime.hostdatetime
+ }
+ cardDao.closedBankcardStatusByUserid(bankCard.userid) //注销其他银行卡
+ bankCard.tenantid = TenantContext.getTenantSchema()
+ cardDao.save(bankCard) //绑定新的银行卡
+
+ } else {
+ if (bankCard.userid != person.userid) {
+ throw TransactionProcessException(3000, "银行卡已被人绑定")
+ }
+ }
+ }
+
+ return true
+ }
+
+}
\ No newline at end of file
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/dtl_query_result_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/dtl_query_result_service_impl.kt
new file mode 100644
index 0000000..a42427b
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/dtl_query_result_service_impl.kt
@@ -0,0 +1,27 @@
+package com.supwisdom.dlpay.api.service.impl
+
+import com.supwisdom.dlpay.api.dao.DtlQueryDao
+import com.supwisdom.dlpay.api.domain.TDtlQuery
+import com.supwisdom.dlpay.api.service.DtlQueryResultService
+import com.supwisdom.dlpay.framework.tenant.TenantContext
+import com.supwisdom.dlpay.util.ConstantUtil
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+
+@Service
+class DtlQueryResultServiceImpl : DtlQueryResultService {
+ @Autowired
+ private lateinit var dtlQueryDao: DtlQueryDao
+
+ override fun saveOrUpdateDtlQuery(dtlQuery: TDtlQuery): TDtlQuery {
+ if (null == dtlQuery.tenantId) {
+ dtlQuery.tenantId = TenantContext.getTenantSchema()
+ }
+ return dtlQueryDao.save(dtlQuery)
+ }
+
+ override fun getNeedQueryRecords(accdate: String, maxCount: Int): List<TDtlQuery> {
+ return dtlQueryDao.getNeedQueryDtls(accdate, ConstantUtil.QUERYTYPE_NEED_QUERY, maxCount)
+ ?: ArrayList(0)
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt
similarity index 60%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt
index e54f063..1807686 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt
@@ -11,6 +11,7 @@
import com.supwisdom.dlpay.framework.domain.TFeetypeConfig
import com.supwisdom.dlpay.framework.domain.TShopacc
import com.supwisdom.dlpay.framework.domain.TSubject
+import com.supwisdom.dlpay.framework.tenant.TenantContext
import com.supwisdom.dlpay.framework.util.TradeErrorCode
import org.hibernate.exception.LockTimeoutException
import org.springframework.beans.factory.annotation.Autowired
@@ -33,10 +34,18 @@
@Autowired
lateinit var feetypeConfigDao: FeetypeConfigDao
+ private fun accountCheck(account: TAccount) {
+ if (!account.tacCheck()) {
+ throw TransactionProcessException(TradeErrorCode.ACCOUNT_TAC_ERROR,
+ "个人账户<${account.userid}>验证错误")
+ }
+ }
+
override fun readAccountForUpdateNowait(userid: String): TAccount {
return try {
- accountDao.getByUseridForUpdateNowait(userid)
- ?: throw TransactionProcessException(TradeErrorCode.ACCOUNT_NOT_EXISTS, "账户<$userid>不存在")
+ accountDao.getByUseridForUpdateNowait(userid)?.also {
+ accountCheck(it)
+ } ?: throw TransactionProcessException(TradeErrorCode.ACCOUNT_NOT_EXISTS, "账户<$userid>不存在")
} catch (ex: Exception) {
when (ex) {
is CannotAcquireLockException, is LockTimeoutException -> throw TransactionException(TradeErrorCode.ACCOUNT_TRADE_BUSY, "账户<$userid>交易繁忙,请稍后再试")
@@ -46,22 +55,32 @@
}
override fun readAccount(userid: String): TAccount {
- return accountDao.findByUserid(userid)
- ?: throw TransactionProcessException(TradeErrorCode.ACCOUNT_NOT_EXISTS, "账户<$userid>不存在")
+ return accountDao.findByUserid(userid)?.also {
+ accountCheck(it)
+ } ?: throw TransactionProcessException(TradeErrorCode.ACCOUNT_NOT_EXISTS, "账户<$userid>不存在")
+ }
+
+ private fun shopAccCheck(shopacc: TShopacc) {
+ if (!shopacc.checkMAC()) {
+ throw TransactionProcessException(TradeErrorCode.ACCOUNT_TAC_ERROR,
+ "商户账户<${shopacc.shopid}>验证错误")
+ }
}
override fun readShopAcc(shopId: Int): TShopacc {
- return shopaccDao.findByShopid(shopId)
- ?: throw TransactionProcessException(TradeErrorCode.SHOP_NOT_EXISTS, "商户<$shopId>不存在")
+ return shopaccDao.findByShopid(shopId)?.also {
+ shopAccCheck(it)
+ } ?: throw TransactionProcessException(TradeErrorCode.SHOP_NOT_EXISTS, "商户<$shopId>不存在")
}
override fun readShopbyShopaccno(shopaccno: String): TShopacc {
- return shopaccDao.findByShopaccno(shopaccno)
- ?: throw TransactionProcessException(TradeErrorCode.SHOP_NOT_EXISTS, "商户<$shopaccno>不存在")
+ return shopaccDao.getByShopaccnoAndTenantId(shopaccno, TenantContext.getTenantSchema())?.also {
+ shopAccCheck(it)
+ } ?: throw TransactionProcessException(TradeErrorCode.SHOP_NOT_EXISTS, "商户<$shopaccno>不存在")
}
override fun readSubject(subjno: String): TSubject {
- return subjectDao.findBySubjno(subjno)
+ return subjectDao.findBySubjnoAndTenantId(subjno, TenantContext.getTenantSchema())
?: throw TransactionProcessException(TradeErrorCode.SUBJECT_NOT_EXISTS, "科目<$subjno>不存在")
}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
similarity index 90%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
index 07c6c40..50a80d1 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
@@ -1,18 +1,19 @@
package com.supwisdom.dlpay.api.service.impl
import com.supwisdom.dlpay.api.bean.OpenShopParam
+import com.supwisdom.dlpay.api.service.ShopService
+import com.supwisdom.dlpay.api.types.ShopTypes
+import com.supwisdom.dlpay.exception.TransactionProcessException
import com.supwisdom.dlpay.framework.dao.ShopDao
import com.supwisdom.dlpay.framework.dao.ShopaccDao
import com.supwisdom.dlpay.framework.domain.TShop
import com.supwisdom.dlpay.framework.domain.TShopacc
import com.supwisdom.dlpay.framework.service.SystemUtilService
-import com.supwisdom.dlpay.framework.util.Subject
-import com.supwisdom.dlpay.api.service.ShopService
-import com.supwisdom.dlpay.exception.TransactionProcessException
import com.supwisdom.dlpay.framework.util.StringUtil
+import com.supwisdom.dlpay.framework.util.Subject
import com.supwisdom.dlpay.framework.util.TradeDict
import com.supwisdom.dlpay.framework.util.TradeErrorCode
-import com.supwisdom.dlpay.util.ConstantUtil
+import com.supwisdom.dlpay.util.EnumCheck
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
@@ -28,8 +29,10 @@
@Autowired
private lateinit var systemUtilService: SystemUtilService
+ private val shoptypeCheck = EnumCheck<ShopTypes, String>()
+
override fun findByThirdUniqueId(uniqueId: String): TShop? {
- return shopDao.getByThirdUniqueIdenty(uniqueId)
+ return shopDao.getByThirdUniqueIdenty(uniqueId)
}
override fun registerShop(param: OpenShopParam): TShop {
@@ -59,8 +62,9 @@
zipcode = param.zipcode
opendate = systemdatetime.hostdate
thirdUniqueIdenty = param.shopUniqueId
+ tenantId = param.tenantid
})
- if (ConstantUtil.SHOPTYPE_GROUP != shop.shoptype) {
+ if (shoptypeCheck.isInEnums(shop.shoptype, ShopTypes.NORMAL)) {
//非商户组要创建账号
val shopaccno = String.format("2%09d", shop.shopid)
shopaccDao.save(TShopacc().apply {
@@ -70,6 +74,7 @@
this.subjno = Subject.SUBJNO_MACHANT_INCOME
this.status = TradeDict.STATUS_NORMAL
this.opendate = shop.opendate
+ this.tenantId = param.tenantid
})
shop.shopaccno = shopaccno
shopDao.save(shop) //更新账号
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_reconciliation_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_reconciliation_service_impl.kt
new file mode 100644
index 0000000..f334403
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_reconciliation_service_impl.kt
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.api.service.impl
+
+import com.supwisdom.dlpay.api.dao.TransactionChkdtlDao
+import com.supwisdom.dlpay.api.dao.TransactionChkfileDao
+import com.supwisdom.dlpay.api.domain.TTransactionChkfile
+import com.supwisdom.dlpay.api.service.TransactionReconciliationService
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+
+@Service
+class TransactionReconciliationServiceImpl : TransactionReconciliationService {
+ @Autowired
+ private lateinit var transactionChkfileDao: TransactionChkfileDao
+ @Autowired
+ private lateinit var transactionChkdtlDao: TransactionChkdtlDao
+
+ override fun getTransactionChkfile(accdate: String, sourcetype: String): TTransactionChkfile? {
+ return transactionChkfileDao.getByAccdateAndSourcetype(accdate, sourcetype)
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt
similarity index 87%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt
index 44598d1..2a8c984 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt
@@ -1,16 +1,14 @@
package com.supwisdom.dlpay.api.service.impl
import com.supwisdom.dlpay.api.TransactionBuilder
-import com.supwisdom.dlpay.api.dao.AccountDao
import com.supwisdom.dlpay.api.dao.TransactionMainDao
import com.supwisdom.dlpay.api.domain.*
import com.supwisdom.dlpay.api.repositories.AccountService
+import com.supwisdom.dlpay.api.service.AccountUtilServcie
import com.supwisdom.dlpay.api.service.SourceTypeService
import com.supwisdom.dlpay.api.service.TransactionService
import com.supwisdom.dlpay.exception.TransactionCheckException
import com.supwisdom.dlpay.exception.TransactionProcessException
-import com.supwisdom.dlpay.framework.dao.ShopaccDao
-import com.supwisdom.dlpay.framework.dao.SubjectDao
import com.supwisdom.dlpay.framework.service.SystemUtilService
import com.supwisdom.dlpay.framework.tenant.TenantContext
import com.supwisdom.dlpay.framework.util.Subject
@@ -31,13 +29,7 @@
private lateinit var accountService: AccountService
@Autowired
- private lateinit var accountDao: AccountDao
-
- @Autowired
- private lateinit var shopaccDao: ShopaccDao
-
- @Autowired
- private lateinit var subjectDao: SubjectDao
+ private lateinit var accountUtilService: AccountUtilServcie
@Autowired
private lateinit var systemUtilService: SystemUtilService
@@ -66,7 +58,7 @@
private fun builderRecords(builder: TransactionBuilder, status: String): TTransactionMain {
try {
preCheck(builder)
- val sourceType = sourceTypeService.getByPaytype(builder.sourceType)
+ val sourceType = sourceTypeService.getBySourceType(builder.sourceType)
?: throw TransactionCheckException(TradeErrorCode.BUSINESS_PAYTYPE_NOSUPPORT,
"交易源未定义,sourctype <${builder.sourceType}>")
// 记录三方的交易流水(个人,商户,科目)
@@ -88,19 +80,22 @@
settleDate = null
tenantid = TenantContext.getTenantSchema()
this.sourceType = sourceType.sourceType
+ dtltype = builder.dtltype
}
if (builder.hasPerson()) {
TPersondtl().apply {
this.refno = transaction.refno
this.accdate = transaction.accdate
- userid = builder.person().person.userid
- accountNo = builder.person().person.accno
- userName = builder.person().person.accname
+ if (!builder.person().isAnonymous()) {
+ userid = builder.person().person!!.userid
+ accountNo = builder.person().person!!.accno
+ userName = builder.person().person!!.accname
+ befbal = builder.person().person!!.availbal
+ }
outtradeno = builder.outtradeno
transdate = builder.transDate
transtime = builder.transTime
- befbal = builder.person().person.availbal
amount = builder.person().amount
this.sourceType = builder.sourceType
payinfo = builder.person().payinfo
@@ -112,7 +107,9 @@
this.reverseFlag = TradeDict.REVERSE_FLAG_NONE
remark = builder.person().remark
tenantid = transaction.tenantid
+ this.dtltype = builder.dtltype
this.status = status
+ this.anonymous = builder.person().isAnonymous()
}.also {
// persondtlDao.save(it)
transaction.personDtl = it
@@ -141,6 +138,7 @@
this.reverseFlag = TradeDict.REVERSE_FLAG_NONE
this.updateBala = false
this.tenantid = transaction.tenantid
+ this.dtltype = builder.dtltype
this.status = status
}.also {
// save shopdtl
@@ -162,6 +160,7 @@
this.oppositeAccNo = builder.subject().oppositeAccNo()
this.oppositeAccName = builder.subject().oppositeAccName()
this.tenantid = transaction.tenantid
+ this.dtltype = builder.dtltype
this.status = status
}.also {
transaction.subjectDtl = it
@@ -187,9 +186,9 @@
}
- if (builder.hasPerson()) {
+ if (builder.hasPerson() && !builder.person().isAnonymous()) {
val dc = getDebitOrCredit(builder.person().tradeFlag, builder.isReverseTrans())
- transaction.sumAmountByAccno(builder.person().person.accno,
+ transaction.sumAmountByAccno(builder.person().person!!.accno,
Subject.SUBJNO_PERSONAL_DEPOSIT,
dc).also {
if (transaction.personDtl.amount != getTransAmountFromDetail(builder, it)) {
@@ -314,6 +313,13 @@
if (transaction.shop) {
transaction.shopDtl.remark = remark
}
+ if (transaction.reverseType != TradeDict.REVERSE_FLAG_NONE) {
+ val originTrans = transactionMainDao.findByRefnoNoLock(transaction.reverseRefno ?: "")
+ ?: throw TransactionProcessException(TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "系统异常,无法处理退款流水")
+ originTrans.reverseFlag = TradeDict.REVERSE_FLAG_NONE
+ transactionMainDao.save(originTrans)
+ }
transaction.endTime = systemUtilService.sysdatetime.sysdate
transactionMainDao.save(transaction)
return transaction
@@ -321,7 +327,7 @@
//////////////////////////////////////////////////////////////////
// 成功
- private fun transactionOnSuccess(transaction: TTransactionMain, remark: String, overdraft: Boolean) {
+ private fun transactionOnSuccess(transaction: TTransactionMain, sorcetypeRefno: String, overdraft: Boolean) {
if (transaction.person) {
// update account balance
val amount = transaction.sumAmountByAccno(
@@ -335,21 +341,20 @@
"个人流水<${transaction.refno}>不存在")
}
transaction.personDtl.status = TradeDict.DTL_STATUS_SUCCESS
- transaction.personDtl.remark = remark
}
if (transaction.shop) {
transaction.shopDtl.updateBala = false
transaction.shopDtl.status = TradeDict.DTL_STATUS_SUCCESS
transaction.shopDtl.accdate = transaction.accdate
- transaction.shopDtl.remark = remark
}
if (transaction.subject) {
// update subject balance
}
+ transaction.sourceTypeRefno = sorcetypeRefno
}
- override fun success(refno: String, remark: String): TTransactionMain {
+ override fun success(refno: String, sourcetypeRefno: String, accdateUpdate: Boolean?): TTransactionMain {
val transaction = transactionMainDao.findByRefnoForUpdate(refno)
?: throw TransactionProcessException(TradeErrorCode.TRANSACTION_IS_FINISHED, "参考号<$refno>错误,流水不存在")
@@ -358,8 +363,18 @@
throw TransactionProcessException(TradeErrorCode.TRANSACTION_IS_FINISHED, "流水<$refno>状态错误,流水已结束")
}
transaction.status = TradeDict.DTL_STATUS_SUCCESS
- transaction.accdate = systemUtilService.accdate
- transactionOnSuccess(transaction, remark, false)
+ if (true == accdateUpdate) {
+ transaction.accdate = systemUtilService.accdate
+ }
+ transactionOnSuccess(transaction, sourcetypeRefno, false)
+
+ if (transaction.reverseType != TradeDict.REVERSE_FLAG_NONE) {
+ val originTrans = transactionMainDao.findByRefnoNoLock(transaction.reverseRefno ?: "")
+ ?: throw TransactionProcessException(TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "系统异常,无法处理退款流水")
+ originTrans.reverseFlag = transaction.reverseType
+ transactionMainDao.save(originTrans)
+ }
transaction.endTime = systemUtilService.sysdatetime.sysdate
transactionMainDao.save(transaction)
@@ -367,7 +382,7 @@
}
override fun success(refno: String): TTransactionMain {
- return success(refno, "")
+ return success(refno, "", true)
}
//////////////////////////////////////////////////////////////////
@@ -380,17 +395,17 @@
throw TransactionProcessException(TradeErrorCode.TRANSDTL_STATUS_ERROR,
"原流水不是成功状态")
}
- if (originTrans.reverseFlag != TradeDict.REVERSE_FLAG_NONE
- || originTrans.reverseFlag != TradeDict.REVERSE_FLAG_REFUND) {
+ if (originTrans.reverseFlag != TradeDict.REVERSE_FLAG_NONE) {
throw TransactionProcessException(TradeErrorCode.TRANSDTL_STATUS_ERROR,
- "原流水已被退款")
+ "原流水已被退款或正在处理退款中")
}
- doReversePrepareAndCheck(originTrans, builder)
+ doReversePrepareAndCheck(originTrans, builder, refundAmount)
+ // 判断退款金额
builder.preCheck()
val transaction = doReverseProcess(originTrans, builder)
- originTrans.reverseFlag = TradeDict.REVERSE_FLAG_REFUND
+ originTrans.reverseFlag = TradeDict.REVERSE_FLAG_WIP
originTrans.refundAmount = refundAmount
transactionMainDao.save(originTrans)
return transaction
@@ -409,10 +424,10 @@
"原流水已被冲正")
}
- doReversePrepareAndCheck(originTrans, builder)
+ doReversePrepareAndCheck(originTrans, builder, 0.0)
val transaction = doReverseProcess(originTrans, builder)
- originTrans.reverseFlag = TradeDict.REVERSE_FLAG_CANCEL
+ originTrans.reverseFlag = TradeDict.REVERSE_FLAG_WIP
transactionMainDao.save(originTrans)
return transaction
}
@@ -456,20 +471,17 @@
return builderRecords(builder, TradeDict.DTL_STATUS_INIT)
}
- private fun doReversePrepareAndCheck(originTrans: TTransactionMain, builder: TransactionBuilder) {
+ private fun doReversePrepareAndCheck(originTrans: TTransactionMain, builder: TransactionBuilder,
+ amount: Double) {
if (originTrans.person) {
- val account = accountDao.findByUserid(originTrans.personDtl.userid)
- ?: throw TransactionProcessException(TradeErrorCode.ACCOUNT_NOT_EXISTS,
- "账户不存在")
+ val account = accountUtilService.readAccount(originTrans.personDtl.userid)
builder.person(account).apply {
setAmount(-originTrans.personDtl.amount,
getOppositeTradeFlag(originTrans.personDtl.tradeflag))
}
}
if (originTrans.shop) {
- val shopacc = shopaccDao.findByShopaccno(originTrans.shopDtl.shopaccno)
- ?: throw TransactionProcessException(TradeErrorCode.ACCOUNT_NOT_EXISTS,
- "商户不存在")
+ val shopacc = accountUtilService.readShopbyShopaccno(originTrans.shopDtl.shopaccno)
builder.shop(shopacc).apply {
setAmount(-originTrans.shopDtl.amount,
getOppositeTradeFlag(originTrans.shopDtl.tradeflag))
@@ -477,9 +489,7 @@
}
if (originTrans.subject) {
- val subject = subjectDao.findBySubjno(originTrans.subjectDtl.subjectno)
- ?: throw TransactionProcessException(TradeErrorCode.ACCOUNT_NOT_EXISTS,
- "科目不存在")
+ val subject = accountUtilService.readSubject(originTrans.subjectDtl.subjectno)
builder.subject(subject)
}
}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/user_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/user_service_impl.kt
similarity index 98%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/impl/user_service_impl.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/user_service_impl.kt
index 6a17565..80ad233 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/user_service_impl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/user_service_impl.kt
@@ -7,7 +7,6 @@
import com.supwisdom.dlpay.framework.service.SystemUtilService
import com.supwisdom.dlpay.api.service.UserService
import com.supwisdom.dlpay.exception.TransactionProcessException
-import com.supwisdom.dlpay.framework.domain.TOperator
import com.supwisdom.dlpay.framework.util.*
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.data.domain.PageRequest
@@ -68,7 +67,7 @@
lowfreeFlag = false
lowfreeLimit = lowfreeLimit
daylimit = daylimit
- maxbal = systemUtilService.getSysparaValueAsDouble(SysparaUtil.SYSPARAID_NO1, SysparaUtil.SYSPARA_NO1_DEFAULT)
+ maxbal = systemUtilService.getSysparaValueAsDouble(SysparaUtil.BALANCE_LIMIT, SysparaUtil.DEFAULT_BALANCE_LIMIT)
lasttranstime = systemdatetime.sysdate
lastdayTransamt = 0.0
lastdayDpsamt = 0.0
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/ynrcc_business_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/ynrcc_business_service_impl.kt
new file mode 100644
index 0000000..99b0566
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/ynrcc_business_service_impl.kt
@@ -0,0 +1,46 @@
+package com.supwisdom.dlpay.api.service.impl
+
+import com.supwisdom.dlpay.agent.citizencard.YnrccUtil
+import com.supwisdom.dlpay.api.dao.TransactionMainDao
+import com.supwisdom.dlpay.api.service.YnrccBusinessService
+import com.supwisdom.dlpay.framework.dao.BusinessparaDao
+import com.supwisdom.dlpay.framework.domain.TBusinesspara
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.tenant.TenantContext
+import com.supwisdom.dlpay.framework.util.DateUtil
+import com.supwisdom.dlpay.framework.util.TradeDict
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+
+@Service
+class YnrccBusinessServiceImpl : YnrccBusinessService {
+ @Autowired
+ private lateinit var businessparaDao: BusinessparaDao
+ @Autowired
+ private lateinit var systemUtilService: SystemUtilService
+ @Autowired
+ private lateinit var transactionMainDao: TransactionMainDao
+
+
+ override fun getLastDownloadBillDate(): String {
+ var businesspara = businessparaDao.findByParakeyForUpdate(YnrccUtil.YNRCC_BILLS_DOWNLOAD_LASTDATE)
+ if (null != businesspara && DateUtil.checkDatetimeValid(businesspara.paraval, DateUtil.DATE_FMT)) {
+ return businesspara.paraval
+ }
+ val startdate = transactionMainDao.findMinAccdateBySourcetype(TradeDict.PAYTYPE_CITIZEN_CARD)
+ ?: systemUtilService.sysdatetime.hostdate
+
+ if (null != businesspara) {
+ businesspara.paraval = DateUtil.getNewDay(startdate, -1)
+ } else {
+ businesspara = TBusinesspara().apply {
+ this.parakey = YnrccUtil.YNRCC_BILLS_DOWNLOAD_LASTDATE
+ this.paraval = DateUtil.getNewDay(startdate, -1)
+ this.tenantId = TenantContext.getTenantSchema()
+ }
+ }
+ businesspara = businessparaDao.save(businesspara)
+ return businesspara.paraval
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/pay_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/pay_service.kt
similarity index 95%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/pay_service.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/pay_service.kt
index f10c1a3..443acd0 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/pay_service.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/pay_service.kt
@@ -9,10 +9,9 @@
interface AccountUtilServcie {
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class))
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = [Exception::class])
fun readAccountForUpdateNowait(userid: String): TAccount
-
fun readAccount(userid: String): TAccount
fun readShopAcc(shopId: Int): TShopacc
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/shop_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/shop_service.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/shop_service.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/shop_service.kt
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/transaction_reconciliation_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/transaction_reconciliation_service.kt
new file mode 100644
index 0000000..2171dee
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/transaction_reconciliation_service.kt
@@ -0,0 +1,10 @@
+package com.supwisdom.dlpay.api.service
+
+import com.supwisdom.dlpay.api.domain.TTransactionChkfile
+import org.springframework.transaction.annotation.Transactional
+
+interface TransactionReconciliationService {
+ @Transactional(rollbackFor = [Exception::class], readOnly = true)
+ fun getTransactionChkfile(accdate: String, sourcetype: String): TTransactionChkfile?
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/transaction_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/transaction_service.kt
similarity index 91%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/transaction_service.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/transaction_service.kt
index fff1a0e..76abfd8 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/transaction_service.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/transaction_service.kt
@@ -27,7 +27,7 @@
fun fail(refno: String, remark: String): TTransactionMain
@Transactional
- fun success(refno: String, remark: String): TTransactionMain
+ fun success(refno: String, sourcetypeRefno: String, accdateUpdate: Boolean? = true): TTransactionMain
@Transactional
fun success(refno: String): TTransactionMain
@@ -84,8 +84,8 @@
return transactionService.fail(refno, remark)
}
- fun success(refno: String, remark: String): TTransactionMain {
- return transactionService.success(refno, remark).also {
+ fun success(refno: String, sourcetypeRefno: String, accdateUpdate: Boolean? = true): TTransactionMain {
+ return transactionService.success(refno, sourcetypeRefno, accdateUpdate).also {
if (it.shop) {
shopAccBalanceAsyncTask.updateShopBalance(it.refno)
}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/user_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/user_service.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/api/service/user_service.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/user_service.kt
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/ynrcc_business_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/ynrcc_business_service.kt
new file mode 100644
index 0000000..8a33cfd
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/ynrcc_business_service.kt
@@ -0,0 +1,9 @@
+package com.supwisdom.dlpay.api.service
+
+import org.springframework.transaction.annotation.Transactional
+
+interface YnrccBusinessService {
+ @Transactional(rollbackFor = [Exception::class])
+ fun getLastDownloadBillDate(): String
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/transaction_builder.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/transaction_builder.kt
similarity index 91%
rename from src/main/kotlin/com/supwisdom/dlpay/api/transaction_builder.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/api/transaction_builder.kt
index a237617..64f9033 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/transaction_builder.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/transaction_builder.kt
@@ -8,6 +8,7 @@
import com.supwisdom.dlpay.framework.domain.TSubject
import com.supwisdom.dlpay.framework.util.TradeDict
import com.supwisdom.dlpay.framework.util.TradeErrorCode
+import kotlin.math.abs
open class SubTransactionBuilder<T : SubTransactionBuilder<T>>(val parent: TransactionBuilder) {
var payinfo: String = ""
@@ -33,11 +34,11 @@
}
fun oppositeAccNo(): String {
- return this.oppAccno
+ return if (hasOpposite()) this.oppAccno else ""
}
fun oppositeAccName(): String {
- return this.oppAccName
+ return if (hasOpposite()) this.oppAccName else ""
}
fun setOpposite(accno: String, accName: String) {
@@ -65,7 +66,7 @@
* amount : 交易金额, 正向交易金额必须 >= 0, 冲正交易金额必须 <= 0
*/
fun setAmount(amount: Double, inOut: String): SubTransactionBuilder<T> {
- this.amount = if (inOut == TradeDict.TRADE_FLAG_IN) Math.abs(amount) else -Math.abs(amount)
+ this.amount = if (inOut == TradeDict.TRADE_FLAG_IN) abs(amount) else -abs(amount)
this.tradeFlag = inOut
return this
}
@@ -80,8 +81,11 @@
}
-class PersonTranactionBuilder(parent: TransactionBuilder, val person: TAccount)
+class PersonTranactionBuilder(parent: TransactionBuilder, val person: TAccount?)
: SubTransactionBuilder<PersonTranactionBuilder>(parent) {
+ fun isAnonymous(): Boolean {
+ return person == null
+ }
}
class ShopTransactionBuilder(parent: TransactionBuilder, val shopacc: TShopacc)
@@ -211,11 +215,21 @@
var payinfo: String = ""
var description: String = ""
var remark: String = ""
+ var dtltype: String = ""
fun person(): PersonTranactionBuilder {
return this.personBuilder
}
+ fun anonymous(): PersonTranactionBuilder {
+ if (this::personBuilder.isInitialized) {
+ throw TransactionCheckException(TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "交易个人流水已经初始化")
+ }
+ this.personBuilder = PersonTranactionBuilder(this, null)
+ return this.personBuilder
+ }
+
fun person(account: TAccount): PersonTranactionBuilder {
return if (!this::personBuilder.isInitialized) {
PersonTranactionBuilder(this, account).also {
@@ -295,6 +309,11 @@
}
fun preCheck() {
+ if (dtltype.isEmpty()) {
+ throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR,
+ "流水类型错误")
+ }
+
if (outId.isNotEmpty() && outtradeno.isEmpty()) {
throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR,
"第三方账号未指定第三方流水号")
@@ -327,7 +346,7 @@
}
if (hasPerson()) {
person().also {
- if (it.person.transStatus != TradeDict.STATUS_NORMAL) {
+ if (!it.isAnonymous() && it.person!!.transStatus != TradeDict.STATUS_NORMAL) {
throw TransactionCheckException(TradeErrorCode.PERSON_STATUS_ERROR,
"个人状态错误")
}
@@ -364,9 +383,11 @@
throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR,
"商户交易金额不正确")
}
- if (!it.hasOpposite()) {
- throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR,
- "商户交易对方账户未设置")
+ if (hasPerson()) {
+ if (!person().isAnonymous() && !it.hasOpposite()) {
+ throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR,
+ "商户交易对方账户未设置")
+ }
}
}
}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/app/bean/app_request_param.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/app/bean/app_request_param.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/app/bean/app_request_param.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/app/bean/app_request_param.kt
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/controller/framework_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/framework/controller/framework_controller.kt
similarity index 78%
rename from src/main/kotlin/com/supwisdom/dlpay/framework/controller/framework_controller.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/framework/controller/framework_controller.kt
index b385f9b..a55845f 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/framework/controller/framework_controller.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/framework/controller/framework_controller.kt
@@ -1,6 +1,7 @@
package com.supwisdom.dlpay.framework.controller
import com.jcabi.manifests.Manifests
+import com.supwisdom.dlpay.api.bean.ApiVersionResponse
import com.supwisdom.dlpay.framework.ResponseBodyBuilder
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
@@ -9,20 +10,18 @@
@RestController
-@RequestMapping("/common")
+@RequestMapping("/api/common")
class AboutController {
@GetMapping("/version")
fun version(): ResponseEntity<Any> {
return try {
Manifests.read("Payapi-Version").let {
ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("version", it)
- .success())
+ .success(ApiVersionResponse(it)))
}
} catch (e: IllegalArgumentException) {
ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("version", "unknown")
- .success())
+ .success(ApiVersionResponse("unknown")))
}
}
}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/controller/security_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/framework/controller/security_controller.kt
similarity index 83%
rename from src/main/kotlin/com/supwisdom/dlpay/framework/controller/security_controller.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/framework/controller/security_controller.kt
index 0bb3345..8ca8d92 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/framework/controller/security_controller.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/framework/controller/security_controller.kt
@@ -1,5 +1,8 @@
package com.supwisdom.dlpay.framework.controller
+import com.google.code.kaptcha.Producer
+import com.supwisdom.dlpay.api.bean.ApiLoginInitResponse
+import com.supwisdom.dlpay.api.bean.ApiLoginResponse
import com.supwisdom.dlpay.exception.TransactionCheckException
import com.supwisdom.dlpay.framework.ResponseBodyBuilder
import com.supwisdom.dlpay.framework.core.JwtConfig
@@ -21,12 +24,9 @@
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
-import org.springframework.security.core.Authentication
import org.springframework.security.core.annotation.AuthenticationPrincipal
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.security.core.userdetails.UserDetails
-import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer
-import org.springframework.security.oauth2.provider.OAuth2Authentication
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler
import org.springframework.social.connect.web.HttpSessionSessionStrategy
import org.springframework.stereotype.Controller
@@ -74,16 +74,12 @@
} ?: throw TransactionCheckException(TradeErrorCode.BUSINESS_DEAL_ERROR,
"系统未配置租户信息")
- apiClientDao.findById(appid).run {
- if (!isPresent) {
- return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build()
- }
- if (get().status != TradeDict.STATUS_NORMAL) {
+ apiClientDao.findByAppid(appid)?.apply {
+ if (this.status != TradeDict.STATUS_NORMAL) {
return ResponseEntity.ok(ResponseBodyBuilder.create()
.fail(TradeErrorCode.BUSINESS_DEAL_ERROR, "API状态错误"))
}
- get()
- }.let { api ->
+ }?.let { api ->
val token = generateRandomToken()
val now = systemUtil.sysdatetime.hostdatetime
ApiClientRedis().also {
@@ -96,10 +92,8 @@
apiClientRepository.save(it)
}
return ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("token", token)
- .data("timestamp", now)
- .success())
- }
+ .success(ApiLoginInitResponse(now, token)))
+ } ?: return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build()
}
private fun generateRandomToken(): String {
@@ -134,10 +128,8 @@
}
ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("jwt", token.jwtToken)
- .data("appid", appid)
- .data("expiredAt", DateUtil.getUTCTime(token.expiration.valueInMillis))
- .success())
+ .success(ApiLoginResponse(token.jwtToken,
+ appid, DateUtil.getUTCTime(token.expiration.valueInMillis))))
} else {
ResponseEntity.status(HttpStatus.UNAUTHORIZED).build()
}
@@ -152,14 +144,14 @@
}
val jwt = JwtTokenUtil(jwtConfig).verifyToken(auth.substring(jwtConfig.tokenHeader.length))
val appid = jwt["uid"] as String
- return apiClientDao.findById(appid).let {
- if (it.isPresent && it.get().status == TradeDict.STATUS_NORMAL) {
+ val result = apiClientDao.findByAppid(appid)?.let {
+ if (it.status == TradeDict.STATUS_NORMAL) {
// 新证书
val token = JwtTokenUtil(jwtConfig).generateToken(
mapOf(Constants.JWT_CLAIM_UID to appid,
"issuer" to "payapi",
"audience" to jwt["audience"],
- Constants.JWT_CLAIM_AUTHORITIES to it.get().roles.split(";")))
+ Constants.JWT_CLAIM_AUTHORITIES to it.roles.split(";")))
JwtRedis().apply {
jti = token.jti
uid = appid
@@ -170,25 +162,43 @@
}
ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("jwt", token.jwtToken)
- .data("appid", appid)
- .data("expiredAt", DateUtil.getUTCTime(token.expiration.valueInMillis))
- .success())
+ .success(ApiLoginResponse(token.jwtToken,
+ appid, DateUtil.getUTCTime(token.expiration.valueInMillis))))
} else {
- ResponseEntity.status(HttpStatus.UNAUTHORIZED).build()
+ ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(mapOf("msg" to "appid error"))
}
- }
+ } ?: ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(mapOf("msg" to "appid error"))
+ return result as ResponseEntity<Any>
}
}
@RestController
class ValidateCodeController {
+ @Autowired
+ private lateinit var captchaProducer: Producer
+
@GetMapping("/code/image")
fun createCode(request: HttpServletRequest, response: HttpServletResponse) {
val imageCode = VerifyCode(60)
HttpSessionSessionStrategy().setAttribute(ServletWebRequest(request), ImageCodeUtil.LOGIN_IMAGECODE_SESSIONKEY, imageCode)
- ImageIO.write(imageCode.image, "JPEG", response.outputStream)
+ val session = request.session
+ response.setDateHeader("Expires", 0)
+ response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate")
+ response.addHeader("Cache-Control", "post-check=0, pre-check=0")
+ response.setHeader("Pragma", "no-cache")
+ response.contentType = "image/jpeg"
+ //生成验证码
+ val capText = captchaProducer.createText()
+ session.setAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY, capText)
+ //向客户端写出
+ val bi = captchaProducer.createImage(capText);
+ ImageIO.write(bi, "JPEG", response.outputStream)
+ try {
+ response.outputStream.flush()
+ } catch (ex: Exception) {
+ response.outputStream.close()
+ }
}
}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/framework_util.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/framework/framework_util.kt
similarity index 68%
rename from src/main/kotlin/com/supwisdom/dlpay/framework/framework_util.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/framework/framework_util.kt
index 8379ea6..1f63e38 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/framework/framework_util.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/framework/framework_util.kt
@@ -1,7 +1,9 @@
package com.supwisdom.dlpay.framework
import com.google.gson.Gson
-import com.supwisdom.dlpay.exception.RequestParamCheckException
+import com.supwisdom.dlpay.api.APIRequestParam
+import com.supwisdom.dlpay.api.bean.ApiResponse
+import com.supwisdom.dlpay.api.exception.RequestParamCheckException
import com.supwisdom.dlpay.exception.TransactionCheckException
import com.supwisdom.dlpay.exception.TransactionException
import com.supwisdom.dlpay.framework.util.TradeErrorCode
@@ -36,6 +38,12 @@
return build()
}
+ fun success(bean: ApiResponse, msg: String? = null): ApiResponse {
+ bean.retcode = 0
+ bean.retmsg = msg ?: "成功"
+ return bean
+ }
+
fun fail(code: Int, msg: String): Map<String, Any> {
if (code == 0) {
throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR, "错误码未正确定义")
@@ -44,6 +52,15 @@
return build()
}
+ fun fail(bean: ApiResponse, code: Int, msg: String): ApiResponse {
+ if (code == 0) {
+ throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR, "错误码未正确定义")
+ }
+ bean.retcode = code
+ bean.retmsg = msg
+ return bean
+ }
+
fun exception(code: Int, exception: Exception, msg: String? = null): Map<String, Any> {
data("exception", exception.message ?: "$exception")
result(code, msg)
@@ -56,18 +73,39 @@
return build()
}
+ fun exception(bean: ApiResponse, code: Int, cause: Throwable?, msg: String? = null): ApiResponse {
+ bean.retcode = code
+ bean.retmsg = msg ?: "失败"
+ bean.exception = cause?.message ?: "unknown exception"
+ return bean
+ }
+
fun transException(exception: TransactionException, msg: String): Map<String, Any> {
data("exception", exception.message!!)
result(exception.code(), "$msg - [${exception.message}]")
return build()
}
+ fun transException(bean: ApiResponse, exception: TransactionException, msg: String): ApiResponse {
+ bean.retcode = exception.code()
+ bean.retmsg = "$msg - [${exception.message}]"
+ bean.exception = "$exception"
+ return bean
+ }
+
fun requestException(exception: RequestParamCheckException, msg: String): Map<String, Any> {
data("exception", exception.message!!)
result(exception.errCode, "$msg - [${exception.message}]")
return build()
}
+ fun requestException(bean: ApiResponse, exception: RequestParamCheckException, msg: String): ApiResponse {
+ bean.retcode = exception.errCode
+ bean.retmsg = "$msg - [${exception.message}]"
+ bean.exception = "$exception"
+ return bean
+ }
+
fun data(name: String, value: Any): ResponseBodyBuilder {
if (name in RESERVED_KEY) {
throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR, "返回值 <$name> 为保留值,不能使用")
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/service/framework_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/framework/service/framework_service.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/framework/service/framework_service.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/framework/service/framework_service.kt
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/framework_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/framework_service_impl.kt
similarity index 92%
rename from src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/framework_service_impl.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/framework_service_impl.kt
index 32c6d92..d5a13dd 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/framework_service_impl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/framework_service_impl.kt
@@ -1,10 +1,6 @@
package com.supwisdom.dlpay.framework.service.impl
-import com.google.gson.Gson
-import com.google.gson.reflect.TypeToken
import com.jcabi.manifests.Manifests
-import com.supwisdom.dlpay.api.bean.ConsumeFeetype
-import com.supwisdom.dlpay.exception.RequestParamCheckException
import com.supwisdom.dlpay.exception.TransactionProcessException
import com.supwisdom.dlpay.framework.core.JwtConfig
import com.supwisdom.dlpay.framework.core.JwtTokenUtil
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/tenant.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/framework/tenant.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/framework/tenant.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/framework/tenant.kt
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/AuthLoginHandler.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/AuthLoginHandler.kt
similarity index 77%
rename from src/main/kotlin/com/supwisdom/dlpay/mobile/AuthLoginHandler.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/AuthLoginHandler.kt
index ca0ba0a..0f66df7 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/mobile/AuthLoginHandler.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/AuthLoginHandler.kt
@@ -3,17 +3,16 @@
import com.fasterxml.jackson.databind.ObjectMapper
import com.supwisdom.dlpay.api.bean.JsonResult
import com.supwisdom.dlpay.api.service.UserService
-import com.supwisdom.dlpay.exception.ValidateCodeException
import com.supwisdom.dlpay.framework.core.JwtConfig
import com.supwisdom.dlpay.framework.core.JwtTokenUtil
import com.supwisdom.dlpay.framework.domain.JwtRedis
-import com.supwisdom.dlpay.framework.redisrepo.ApiClientRepository
import com.supwisdom.dlpay.framework.redisrepo.ApiJwtRepository
import com.supwisdom.dlpay.framework.service.SystemUtilService
import com.supwisdom.dlpay.framework.util.*
import com.supwisdom.dlpay.mobile.dao.MobileUserDao
import com.supwisdom.dlpay.mobile.domain.TBMobileUser
import com.supwisdom.dlpay.mobile.exception.UserLoginFailException
+import com.supwisdom.dlpay.mobile.service.MobileApiService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.HttpStatus
import org.springframework.security.authentication.BadCredentialsException
@@ -31,7 +30,7 @@
@Component("authLoginSuccessHandler")
class AuthLoginSuccessHandler : SimpleUrlAuthenticationSuccessHandler() {
@Autowired
- lateinit var mobileUserDao: MobileUserDao
+ lateinit var mobileApiService: MobileApiService
@Autowired
lateinit var objectMapper: ObjectMapper
@Autowired
@@ -45,48 +44,51 @@
override fun onAuthenticationSuccess(request: HttpServletRequest, response: HttpServletResponse, authentication: Authentication) {
- logger.error(request?.getParameter("platform"))
- var temp = authentication!!.principal as TBMobileUser
- var user = mobileUserDao.findByPhone(temp.phone)
- if(user!=null) {
- var exp = systemUtilService.getSysparaValueAsInt(SysparaUtil.SYSPARAID_NO3,60*60*24*3)
- jwtConfig.expiration = exp.toLong()
+ logger.error(request.getParameter("platform"))
+ val temp = authentication.principal as TBMobileUser
+ val user = mobileApiService.findUserByPhone(temp.phone)
+ val exp = systemUtilService.getSysparaValueAsInt(SysparaUtil.MOBILE_LOGIN_EXPIRE_IN_SECONDS,60*60*24*3)
+ jwtConfig.expiration = exp.toLong()
+ if (user != null) {
+ //TODO 从数据取jwtConfig.expiration
val token = JwtTokenUtil(jwtConfig).generateToken(
mapOf("uid" to user.uid, "issuer" to "payapi",
"audience" to temp.phone,
Constants.JWT_CLAIM_TENANTID to "mobile",
Constants.JWT_CLAIM_AUTHORITIES to temp.authorities))
- var jwt = JwtRedis().apply {
+ val jwt = JwtRedis().apply {
jti = token.jti
uid = temp.phone
status = TradeDict.JWT_STATUS_NORMAL
expiration = token.expiration.valueInMillis
}.apply {
//删除之前的token
- if(!user.jti.isNullOrEmpty()){
+ if (!user.jti.isNullOrEmpty()) {
apiJwtRepository.deleteById(user.jti!!)
}
apiJwtRepository.save(this)
}
- if (user.loginpwderror != null && user.loginpwderror!! > 0) {
+ if (user.loginpwderror > 0) {
user.loginpwderror = 0
user.loginpwderrortime = null
}
user.lastlogin = DateUtil.getNow()
user.jti = jwt.jti
- mobileUserDao.save(user)
+ mobileApiService.saveUser(user)
var payseted = false
- if(!user!!.paypwd.isNullOrEmpty()){
+ if(!user.paypwd.isNullOrEmpty()){
payseted = true
}
var name = ""
+ var signed=""
if (!user.userid.isNullOrEmpty()) {
- var person = userService.findOnePersonByUserid(user.userid!!)
- if (person != null) {
- name = person.name
+ val person = userService.findOnePersonByUserid(user.userid!!)
+ var card = mobileApiService.findCardByUserid(user.userid!!)
+ name = person.name
+ if(card!=null&&card.signed){
+ signed = TradeDict.STATUS_YES
}
}
-
response.status = HttpStatus.OK.value()
response.contentType = "application/json;charset=UTF-8"
response.writer.write(objectMapper.writeValueAsString(JsonResult.ok()
@@ -97,9 +99,9 @@
?.put("name", name)
?.put("phone", StringUtil.phoneReplace(user.phone))
?.put("paypwdset",payseted)
- ?.put("signed", if (user.issigned.isNullOrEmpty()) "" else user.issigned)
+ ?.put("signed", signed)
?.put("userid",if(user.userid.isNullOrEmpty()) "" else user.userid)))
- }else{
+ } else {
throw UserLoginFailException("登录错误")
}
}
@@ -118,18 +120,15 @@
override fun onAuthenticationFailure(request: HttpServletRequest,
response: HttpServletResponse, exception: AuthenticationException) {
logger.error("登录失败:" + exception.message + "|" + exception.javaClass)
- var errmsg = ""
- if (exception is BadCredentialsException) {
- errmsg = "手机号或密码错误"
- } else if (exception is LockedException) {
- errmsg = "账户被锁定"
- } else {
- errmsg = exception.message!!
+ val errmsg = when (exception) {
+ is BadCredentialsException -> "手机号或密码错误"
+ is LockedException -> "账户被锁定"
+ else -> exception.message!!
}
- var temp = request.getParameter("username")
+ val temp = request.getParameter("username")
if(!temp.isNullOrEmpty()) {
mobileUserDao.findByPhone(temp)?.let {
- if (it.loginpwderror == null || it.loginpwderror == 0) {
+ if (it.loginpwderror == 0) {
it.loginpwderror = 0
it.loginpwderrortime = System.currentTimeMillis()
}
@@ -141,4 +140,4 @@
response.contentType = "application/json;charset=UTF-8"
response.writer.write(objectMapper.writeValueAsString(JsonResult.error(errmsg)))
}
-}
\ No newline at end of file
+}
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt
new file mode 100644
index 0000000..09af455
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt
@@ -0,0 +1,672 @@
+package com.supwisdom.dlpay.mobile
+
+import com.supwisdom.dlpay.agent.citizencard.YnrccUtil
+import com.supwisdom.dlpay.agent.service.CitizencardPayService
+import com.supwisdom.dlpay.api.bean.JsonResult
+import com.supwisdom.dlpay.api.service.UserService
+import com.supwisdom.dlpay.api.util.MobileNumberCheck
+import com.supwisdom.dlpay.framework.core.JwtConfig
+import com.supwisdom.dlpay.framework.core.JwtTokenUtil
+import com.supwisdom.dlpay.framework.domain.JwtRedis
+import com.supwisdom.dlpay.framework.redisrepo.ApiJwtRepository
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.util.*
+import com.supwisdom.dlpay.mobile.domain.TBMobileUser
+import com.supwisdom.dlpay.mobile.service.MobileApiService
+import com.supwisdom.dlpay.system.service.DictionaryProxy
+import com.supwisdom.dlpay.util.ConstantUtil
+import org.apache.commons.lang.StringUtils
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.data.redis.core.RedisTemplate
+import org.springframework.security.core.GrantedAuthority
+import org.springframework.security.core.authority.AuthorityUtils
+import org.springframework.security.core.context.SecurityContextHolder
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
+import org.springframework.web.bind.annotation.RequestParam
+import java.time.Duration
+import java.util.Calendar
+
+
+@RestController
+@RequestMapping("/mobileapi/i")
+class ApiInit {
+ @Autowired
+ lateinit var mobileApiService: MobileApiService
+ @Autowired
+ lateinit var redisTemplate: RedisTemplate<String, String>
+ @Autowired
+ lateinit var jwtConfig: JwtConfig
+ @Autowired
+ lateinit var apiJwtRepository: ApiJwtRepository
+ @Autowired
+ lateinit var systemUtilService: SystemUtilService
+
+ @RequestMapping("/time")
+ fun time(): JsonResult {
+ return JsonResult.ok("OK").put("now", System.currentTimeMillis())!!
+ }
+
+ @RequestMapping("/test")
+ fun test(uid: String): JsonResult {
+ return JsonResult.ok("OK").put("uid", uid)!!
+ }
+
+ @RequestMapping("/uxy")
+ fun xieyi(): JsonResult {
+ var page = mobileApiService.findPageById(ConstantUtil.PAGE_USERXIEYI)
+ if (page != null) {
+ return JsonResult.ok("OK").put("page", page.pageContent)!!
+ }
+ return JsonResult.error("页面未配置")
+ }
+
+ /**
+ * 注册或找回时使用的验证码生成接口
+ * */
+ @RequestMapping("/code")
+ fun code(@RequestParam phone: String, @RequestParam type: String?): JsonResult {
+ if (phone.isEmpty() || !MobileNumberCheck.isPhone(phone)) {
+ return JsonResult.error("手机号不合法")
+ }
+ val user = mobileApiService.findUserByPhone(phone)
+ if (type.isNullOrEmpty() || "new" == type) {
+ if (user != null && !user.loginpwd.isEmpty()) {
+ return JsonResult.error("该手机号已注册,请登录或找回密码")
+ }
+ } else {
+ if ("find" == type) {
+ if (user == null) {
+ return JsonResult.error("手机号不存在,请注册")
+ }
+ } else {
+ return JsonResult.error("类型错误")
+ }
+ }
+ // 如果未设置密码
+ val temp = redisTemplate.opsForValue().get(phone)
+ if (temp.isNullOrEmpty()) {
+ val code = RandomUtils.randomNumber(6)
+ System.out.println(code)
+ redisTemplate.opsForValue().set(phone, code, Duration.ofMinutes(5))
+ }
+ //TODO call send code sdk
+ return JsonResult.ok("验证码已发送")
+ }
+
+ /**
+ * 注册或找回时使用的验证码校验接口
+ * */
+ @RequestMapping("/checkcode")
+ fun check(@RequestParam phone: String,
+ @RequestParam code: String,
+ @RequestParam platform: String?,
+ @RequestParam uuid: String?): JsonResult {
+ val temp = redisTemplate.opsForValue().get(phone)
+ if (!temp.isNullOrEmpty()) {
+ if (temp != code) {
+ return JsonResult.error("验证码错误")
+ }
+ var user = mobileApiService.findUserByPhone(phone)
+ if (user == null) {
+ user = TBMobileUser()
+ user.phone = phone
+ user.registerplatform = platform
+ user.registerdate = DateUtil.getNow()
+ user.devuid = uuid
+ user.status = TradeDict.STATUS_NORMAL
+ user.paypwderror = 0
+ user.loginpwderror = 0
+ user = mobileApiService.saveUser(user)
+ }
+ user.status = TradeDict.STATUS_NORMAL
+ user.registerplatform = platform
+ user.devuid = uuid
+ user = mobileApiService.saveUser(user)
+ val newCode = RandomUtils.getRandomString(30)
+ redisTemplate.opsForValue().set(user.uid, newCode, Duration.ofHours(1))
+ redisTemplate.delete(phone)
+ return JsonResult.ok("OK").put("uid", user.uid)?.put("randcode", newCode)!!
+ } else {
+ return JsonResult.error(-1, "验证码无效或已过期,请重新获取")
+ }
+ }
+
+ /**
+ * 注册
+ * */
+ @RequestMapping("/register")
+ fun register(@RequestParam id: String,
+ @RequestParam pwd: String,
+ @RequestParam repwd: String,
+ @RequestParam random: String): JsonResult {
+ if (random.isEmpty()) {
+ return JsonResult.error("信息有误,请返回上一步")
+ }
+ if (pwd.isEmpty() || repwd.isEmpty() || pwd.length < 6) {
+ return JsonResult.error("请重新设置密码,密码不能小于6位字符")
+ }
+ if (!pwd.matches(Regex("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,32}$"))) {
+ return JsonResult.error("密码必须包含数字和字符,长度6~32位")
+ }
+ if (pwd != repwd) {
+ return JsonResult.error("两次密码不一致")
+ }
+ val user: TBMobileUser? = mobileApiService.findUserById(id) ?: return JsonResult.error("用户不存在,请注册")
+ val code = redisTemplate.opsForValue().get(id)
+ if (random != code) {
+ return JsonResult.error("信息有误,请返回上一步,并重新发送验证码")
+ }
+ val encoder = BCryptPasswordEncoder()
+ user!!.loginpwd = encoder.encode(pwd)
+ val exp = systemUtilService.getSysparaValueAsInt(SysparaUtil.MOBILE_LOGIN_EXPIRE_IN_SECONDS, 60 * 60 * 24 * 3)
+ jwtConfig.expiration = exp.toLong()
+ val authorities: Collection<GrantedAuthority> = AuthorityUtils.createAuthorityList("ROLE_USER")
+ user.auths = authorities
+ val token = JwtTokenUtil(jwtConfig).generateToken(
+ mapOf("uid" to user.uid, "issuer" to "payapi",
+ "audience" to user.phone,
+ Constants.JWT_CLAIM_TENANTID to "mobile",
+ Constants.JWT_CLAIM_AUTHORITIES to user.authorities))
+ val jwt = JwtRedis().apply {
+ jti = token.jti
+ uid = user.phone
+ status = TradeDict.JWT_STATUS_NORMAL
+ expiration = token.expiration.valueInMillis
+ }.apply {
+ //删除之前的token
+ if (!user.jti.isNullOrEmpty()) {
+ apiJwtRepository.deleteById(user.jti!!)
+ }
+ apiJwtRepository.save(this)
+ }
+ if (user.loginpwderror > 0) {
+ user.loginpwderror = 0
+ user.loginpwderrortime = null
+ }
+ user.lastlogin = DateUtil.getNow()
+ user.jti = jwt.jti
+ mobileApiService.saveUser(user)
+ redisTemplate.delete(user.uid)
+ var payseted = false
+ if (!user.paypwd.isNullOrEmpty()) {
+ payseted = true
+ }
+ var signed = ""
+ if (!user.userid.isNullOrEmpty()) {
+ val card = mobileApiService.findCardByUserid(user.userid!!)
+ if (card != null && card.signed) {
+ signed = TradeDict.STATUS_YES
+ }
+ }
+ return JsonResult.ok("OK").put("token", token.jwtToken)
+ ?.put("userid", if (user.userid.isNullOrEmpty()) "" else user.userid)
+ ?.put("expire", token.expiration.valueInMillis)
+ ?.put("now", System.currentTimeMillis())
+ ?.put("phone", StringUtil.phoneReplace(user.phone))
+ ?.put("paypwdset", payseted)
+ ?.put("signed", signed)
+ ?.put("tenantid", "mobile")!!
+ }
+}
+
+
+@RestController
+@RequestMapping("/mobileapi/v1")
+class ApiV1 {
+ @Autowired
+ lateinit var mobileApiService: MobileApiService
+ @Autowired
+ lateinit var userService: UserService
+ @Autowired
+ lateinit var redisTemplate: RedisTemplate<String, String>
+ @Autowired
+ lateinit var dictionaryProxy: DictionaryProxy
+ @Autowired
+ lateinit var citizencardPayService: CitizencardPayService
+
+ @RequestMapping("/idtypes")
+ fun idtypes(): JsonResult {
+ var dict = dictionaryProxy.getDictionaryAsMap(Dictionary.IDTYPE)
+ return JsonResult.ok("OK").put("idtypes", dict)!!
+ }
+
+ /**
+ * 用户信息
+ * */
+ @RequestMapping("/infor")
+ fun getUserInfor(): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ return JsonResult.ok("OK").put("now", System.currentTimeMillis())!!
+ }
+
+ /**
+ * 验证码生成,内部校验
+ * */
+ @RequestMapping("/code")
+ fun code(): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
+ if (user.phone.isEmpty()) {
+ return JsonResult.error("用户不存在,请注册")
+ }
+ val temp = redisTemplate.opsForValue().get(user.phone)
+ if (temp.isNullOrEmpty()) {
+ val code = RandomUtils.randomNumber(6)
+ System.out.println(code)
+ redisTemplate.opsForValue().set(user.phone, code, Duration.ofMinutes(5))
+ }
+ //TODO call send code sdk
+ return JsonResult.ok("验证码已发送")
+ }
+
+ @RequestMapping("/checkcode")
+ fun check(@RequestParam code: String, @RequestParam personid: String?
+ ): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ val temp = redisTemplate.opsForValue().get(user.phone)
+ if (!temp.isNullOrEmpty()) {
+ if (temp != code) {
+ return JsonResult.error("验证码错误")
+ }
+ val newCode = RandomUtils.getRandomString(30)
+ redisTemplate.opsForValue().set(user.uid, newCode, Duration.ofHours(1))
+ redisTemplate.delete(user.phone)
+ if (!personid.isNullOrEmpty()) {
+ //绑定用户
+ val person = userService.findOnePersonByUserid(personid)
+ user.bindtime = DateUtil.getNow()
+ user.userid = person.userid
+ mobileApiService.saveUser(user)
+ }
+ return JsonResult.ok("OK").put("randcode", newCode)!!
+ } else {
+ return JsonResult.error(-1, "验证码无效或已过期,请重新获取")
+ }
+ }
+
+ /**
+ * 绑卡
+ * */
+ @RequestMapping("/bindcard")
+ fun bindcard(cardno: String, name: String, idtype: String, idno: String): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ val phone = user.phone
+ val card = mobileApiService.findCardByNo(cardno)
+ ?: return JsonResult.error("银行卡号有误")
+ if (card.userid.isNullOrEmpty() || card.status != TradeDict.STATUS_NORMAL) {
+ return JsonResult.error("银行卡号信息有误")
+ }
+ val person = userService.findOnePersonByUserid(card.userid)
+ if (person.name != name) {
+ return JsonResult.error("绑定信息有误[姓名]")
+ }
+ if (person.idtype != idtype || person.idno != idno) {
+ return JsonResult.error("绑定信息有误[证件类型/证件号]")
+ }
+ val exsitUser = mobileApiService.findUserById(card.userid)
+ if (exsitUser != null) {
+ return JsonResult.error("该银行卡号已被绑定,如有疑问,请联系客服")
+ }
+ //call api
+ var resp = citizencardPayService.bindCard(cardno, name, idtype, idno, phone);
+ if (resp.code != "0000") {
+ return JsonResult.error(resp.message)
+ }
+ var signed = ""
+ if (resp.sinstatus == "1") {
+ signed = TradeDict.STATUS_YES
+ card.signed = true
+ user.signedtime = DateUtil.getNow();
+ mobileApiService.saveCard(card)
+ mobileApiService.saveUser(user)
+ }
+ System.out.println(resp.captcha)
+ var code = if (resp.captcha.isNullOrEmpty()) {
+ RandomUtils.randomNumber(6)
+ } else {
+ resp.captcha
+ }
+ System.out.println(code)
+ redisTemplate.opsForValue().set(user.phone, code, Duration.ofMinutes(10))
+ var payseted = false
+ if (!user.paypwd.isNullOrEmpty()) {
+ payseted = true
+ }
+
+ return JsonResult.ok("OK").put("personid", card.userid)
+ ?.put("paypwdset", payseted)
+ ?.put("phonex", StringUtil.phoneReplace(phone))
+ ?.put("signed", signed)!!
+
+
+ }
+
+ /**
+ * 支付密码
+ * */
+ @RequestMapping("/paypwd")
+ fun paypwd(pwd: String, repwd: String, oldpwd: String?, type: String, randcode: String?): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ if (pwd != repwd) {
+ return JsonResult.error("两次密码不一致,请确认")
+ }
+ if (pwd.length != 6) {
+ return JsonResult.error("支付密码为6位数字")
+ }
+ if (!StringUtils.isNumeric(pwd)) {
+ return JsonResult.error("支付密码为6位数字")
+ }
+ val encoder = BCryptPasswordEncoder()
+ if (user.paypwd.isNullOrEmpty()) {
+ user.paypwd = encoder.encode(pwd)
+ mobileApiService.saveUser(user)
+ return JsonResult.ok("OK")
+ ?.put("paypwdset", true)!!
+ } else {
+ when (type) {
+ "new" -> return JsonResult.error("支付密码已设置")
+ "renew" -> {
+ if (oldpwd.isNullOrEmpty()) {
+ return JsonResult.error("原支付密码错误")
+ }
+ val paypwdtimes = user.checkPaypwdtime()
+ if (paypwdtimes == -1) {
+ return JsonResult.error("密码错误次数过多,请30分钟后再试")
+ } else if (paypwdtimes == 1) {
+ mobileApiService.saveUser(user)
+ }
+ if (!encoder.matches(oldpwd, user.paypwd)) {
+ user.updatePaypwderror(false).also {
+ if (it) mobileApiService.saveUser(user)
+ }
+ return JsonResult.error("原支付密码错误")
+ } else {
+ user.updatePaypwderror(true).also {
+ if (it) mobileApiService.saveUser(user)
+ }
+ }
+ user.paypwd = encoder.encode(pwd)
+ mobileApiService.saveUser(user)
+ return JsonResult.ok("OK")
+ ?.put("paypwdset", true)!!
+ }
+ "find" -> {
+ if (randcode.isNullOrEmpty()) {
+ return JsonResult.error("信息有误,请返回并重新设置")
+ }
+ val code = redisTemplate.opsForValue().get(user.uid)
+ if (randcode != code) {
+ return JsonResult.error(-1, "长时间未操作,请返回上一步,并重新发送验证码")
+ }
+ user.paypwd = encoder.encode(pwd)
+ mobileApiService.saveUser(user)
+ redisTemplate.delete(user.uid)
+ return JsonResult.ok("OK").put("paypwdset", true)!!
+ }
+ else -> return JsonResult.error("请求错误")
+ }
+ }
+ }
+
+ /**
+ *
+ * 银行协议
+ * */
+ @RequestMapping("/bxy")
+ fun xieyi(): JsonResult {
+ val page = mobileApiService.findPageById(ConstantUtil.PAGE_BANKXIEYI)
+ if (page != null) {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ var signed = ""
+ if (!user.userid.isNullOrEmpty()) {
+ var card = mobileApiService.findCardByUserid(user.userid!!)
+ ?: return JsonResult.error(-1, "卡片不存在,请重新绑定")
+ if (card.signed) {
+ signed = TradeDict.STATUS_YES
+ }
+ } else {
+ return JsonResult.error(-1, "请先绑定银行卡")
+ }
+ return JsonResult.ok("OK").put("page", page.pageContent)?.put("signed", signed)!!
+ }
+ return JsonResult.error("页面未配置")
+ }
+
+ /**
+ *
+ * 签约银行协议
+ * */
+ @RequestMapping("/signbxy")
+ fun signbxy(agree: String): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ var signed: String
+ if (!user.userid.isNullOrEmpty()) {
+ var card = mobileApiService.findCardByUserid(user.userid!!) ?: return JsonResult.error("卡片不存在,请重新绑定")
+ if (card.signed) {
+ signed = TradeDict.STATUS_YES
+ } else {
+ //call sign api
+ val person = userService.findOnePersonByUserid(card.userid)
+ var resp = citizencardPayService.signCard(card.cardno, person.name, person.idtype, person.idno, user.phone, YnrccUtil.TRANSTYPE_SIGNCARD)
+ if (resp.code != "0000") {
+ return JsonResult.error(resp.message)
+ }
+ card.signed = true
+ user.signedtime = DateUtil.getNow();
+ mobileApiService.saveCard(card)
+ mobileApiService.saveUser(user)
+ signed = TradeDict.STATUS_YES
+ }
+ } else {
+ return JsonResult.error("请先绑定银行卡")
+ }
+ return JsonResult.ok("ok")
+ .put("signed", signed)!!
+ }
+
+ /**
+ * 查询账单
+ * */
+ @RequestMapping("/bills")
+ fun bills(pageno: Int): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ val c = Calendar.getInstance()
+ val timeOfDay = c.get(Calendar.HOUR_OF_DAY)
+ var t = ""
+ when (timeOfDay) {
+ in 0..7 -> t = "早上好"
+ in 8..12 -> t = "上午好"
+ in 13..17 -> t = "下午好"
+ in 18..23 -> t = "晚上好"
+ }
+ if (user.userid.isNullOrEmpty()) {
+ return JsonResult.ok("OK").put("t", t)!!
+ }
+ val no = if (pageno <= 0) 1 else pageno
+ val today = DateUtil.getNow("yyyyMMdd")
+ val yester = DateUtil.getNowInterDay(-1)
+ val acc = userService.findAccountByUserid(user.userid!!, null)
+ val point = userService.findPointsAccountByUserid(user.userid!!)
+ var amount = 0.0;
+ var pi = 0L
+ if (acc != null && acc.availbal != null) {
+ amount = acc.availbal
+ }
+ if (point != null && point.points != null) {
+ pi = point.points
+ }
+ var payseted = false
+ if (!user.paypwd.isNullOrEmpty()) {
+ payseted = true
+ }
+ val person = userService.findOnePersonByUserid(user.userid!!)
+ val card = mobileApiService.findCardByUserid(user.userid!!)
+ var needrebind = false
+ var signed = ""
+ if (card == null) {
+ //卡片已补办,或绑定失败,需要重新绑定
+ needrebind = true
+ } else {
+ if (card.signed) {
+ signed = TradeDict.STATUS_YES
+ }
+ }
+ var name = person.name
+ val page = userService.findPersondtlByUserid(user.userid!!, no)
+ return JsonResult.ok("OK").put("page", page)
+ ?.put("today", today)
+ ?.put("yesterday", yester)
+ ?.put("point", pi)
+ ?.put("amount", amount)
+ ?.put("paypwdset", payseted)
+ ?.put("name", name)
+ ?.put("needrebind", needrebind)
+ ?.put("signed", signed)
+ ?.put("userid", if (user.userid.isNullOrEmpty()) "" else user.userid)!!.put("t", t)!!
+ }
+
+ /**
+ * 账单明细
+ * */
+ @RequestMapping("/billdetail")
+ fun billdetail(billid: String): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user: TBMobileUser? = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ if (user!!.userid.isNullOrEmpty()) {
+ return JsonResult.ok("OK")
+ }
+ val dtl = userService.findPersondtlDetailByUserid(user.userid!!, billid)
+ return JsonResult.ok("OK").put("dtl", dtl)!!
+ }
+
+ /**
+ * 密码修改
+ * */
+ @RequestMapping("/pwdset")
+ fun pwdset(oldpwd: String, newpwd: String, renewpwd: String): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ if (newpwd != renewpwd) {
+ return JsonResult.error("两次密码不一致,请确认")
+ }
+ if (!newpwd.matches(Regex("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,32}$"))) {
+ return JsonResult.error("密码必须包含数字和字符,长度6~32位")
+ }
+ if (newpwd.isEmpty() || newpwd.length < 6) {
+ return JsonResult.error("请重新设置密码,密码不能小于6位字符")
+ }
+ val pwdtimes = user.checkLoginpwdtime()
+ if (pwdtimes == -1) {
+ return JsonResult.error(-1, "原密码错误次数过多,将退出系统,请重新登录系统或点击忘记密码功能找回密码")
+ } else if (pwdtimes == 1) {
+ mobileApiService.saveUser(user)
+ }
+ val encoder = BCryptPasswordEncoder()
+ if (!encoder.matches(oldpwd, user.loginpwd)) {
+ user.updateLoginpwderror(false).also {
+ if (it) mobileApiService.saveUser(user)
+ }
+ return JsonResult.error("原密码错误")
+ } else {
+ user.updateLoginpwderror(true)
+ }
+ user.loginpwd = encoder.encode(newpwd)
+ mobileApiService.saveUser(user)
+ return JsonResult.ok("密码修改成功")
+ }
+
+ /**
+ *
+ * 市民卡挂失
+ * */
+ @RequestMapping("/cardinfor")
+ fun cardinfor(): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ if (user.userid.isNullOrEmpty()) {
+ return JsonResult.error(-1, "银行卡未绑定,请先绑定")
+ }
+ val person = userService.findOnePersonByUserid(user.userid!!)
+ val card = mobileApiService.findCardByUserid(user.userid!!) ?: return JsonResult.error(-1, "银行卡未绑定,请先绑定")
+ var status = ""
+ //normal/loss/frozen/locked
+ when (card.transStatus) {
+ TradeDict.STATUS_NORMAL -> status = "正常"
+ TradeDict.STATUS_LOST -> status = "已挂失"
+ TradeDict.STATUS_LOCKED -> status = "已锁定"
+ TradeDict.STATUS_FROZEN -> status = "已冻结"
+ }
+ return JsonResult.ok("ok").put("name", person.name)
+ ?.put("cardno", card.cardno)
+ ?.put("cardstatus", status)!!
+ }
+
+ /**
+ *
+ * 市民卡挂失
+ * */
+ @RequestMapping("/cardlost")
+ fun cardlost(paypwd: String): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ val paypwdtimes = user.checkPaypwdtime()
+ if (paypwdtimes == -1) {
+ return JsonResult.error("支付密码错误次数过多,请30分钟后再试")
+ } else if (paypwdtimes == 1) {
+ mobileApiService.saveUser(user)
+ }
+ val encoder = BCryptPasswordEncoder()
+ if (!encoder.matches(paypwd, user.paypwd)) {
+ user.updatePaypwderror(false).also {
+ if (it) mobileApiService.saveUser(user)
+ }
+ return JsonResult.error("支付密码错误")
+ } else {
+ user.updatePaypwderror(true).also {
+ if (it) mobileApiService.saveUser(user)
+ }
+ }
+ var card = mobileApiService.findCardByUserid(user.userid!!) ?: return JsonResult.error(-1, "银行卡未绑定,请先绑定")
+ if (card.transStatus != TradeDict.STATUS_NORMAL) {
+ return JsonResult.error("卡状态非正常,不能挂失")
+ }
+ card.transStatus = TradeDict.STATUS_LOST
+ mobileApiService.saveCard(card)
+ return JsonResult.ok("ok")
+ }
+
+ /**
+ *
+ * 二维码在线生成
+ * */
+ @RequestMapping("/qrcode")
+ fun qrcode(): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ //TODO cardlost
+ return JsonResult.ok("ok").put("qrcode",p.name)!!
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/dao/ApiDao.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/dao/ApiDao.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/mobile/dao/ApiDao.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/dao/ApiDao.kt
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/dao/MobileUserDao.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/dao/MobileUserDao.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/mobile/dao/MobileUserDao.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/dao/MobileUserDao.kt
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/domain/TBMobileUser.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/domain/TBMobileUser.kt
similarity index 65%
rename from src/main/kotlin/com/supwisdom/dlpay/mobile/domain/TBMobileUser.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/domain/TBMobileUser.kt
index 285546a..68b9155 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/mobile/domain/TBMobileUser.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/domain/TBMobileUser.kt
@@ -1,5 +1,6 @@
package com.supwisdom.dlpay.mobile.domain
+import com.supwisdom.dlpay.api.bean.JsonResult
import com.supwisdom.dlpay.framework.util.TradeDict
import org.hibernate.annotations.GenericGenerator
import org.springframework.security.core.GrantedAuthority
@@ -36,6 +37,7 @@
override fun isAccountNonLocked(): Boolean {
return TradeDict.STATUS_LOCKED != this.status
}
+
@Transient
var auths: Collection<GrantedAuthority>? = null
@@ -158,4 +160,65 @@
* */
@Column(name = "ulogo", length = 100)
var ulogo: String? = null
+
+
+ fun checkLoginpwdtime():Int{
+ if (this.loginpwderror >= 5 && (System.currentTimeMillis() - this.loginpwderrortime!!) < 1000 * 60 * 30) {
+ return -1
+ } else if (this.loginpwderror >= 5 && (System.currentTimeMillis() - this.loginpwderrortime!!) > 1000 * 60 * 30) {
+ //更新时间
+ this.loginpwderror = 0
+ this.loginpwderrortime = null
+ return 1
+ }
+ return 0
+ }
+
+ fun updateLoginpwderror(ok: Boolean): Boolean {
+ return if (ok) {
+ if (this.loginpwderror > 0) {
+ this.loginpwderror = 0
+ this.loginpwderrortime = null
+ true
+ } else {
+ false
+ }
+ } else {
+ if (this.loginpwderror == 0) {
+ this.loginpwderrortime = System.currentTimeMillis()
+ }
+ this.loginpwderror += 1
+ true
+ }
+ }
+
+ fun checkPaypwdtime():Int{
+ if (this.paypwderror >= 5 && (System.currentTimeMillis() - this.paypwderrortime!!) < 1000 * 60 * 30) {
+ return -1
+ } else if (this.paypwderror >= 5 && (System.currentTimeMillis() - this.paypwderrortime!!) > 1000 * 60 * 30) {
+ //更新时间
+ this.paypwderror = 0
+ this.paypwderrortime = null
+ return 1
+ }
+ return 0
+ }
+
+ fun updatePaypwderror(ok: Boolean): Boolean {
+ return if (ok) {
+ if (this.paypwderror > 0) {
+ this.paypwderror = 0
+ this.paypwderrortime = null
+ true
+ } else {
+ false
+ }
+ } else {
+ if (this.paypwderror == 0) {
+ this.paypwderrortime = System.currentTimeMillis()
+ }
+ this.paypwderror += 1
+ true
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/domain/TBPages.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/domain/TBPages.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/mobile/domain/TBPages.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/domain/TBPages.kt
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/exception/UserLoginFailException.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/exception/UserLoginFailException.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/mobile/exception/UserLoginFailException.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/exception/UserLoginFailException.kt
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/service/MobileApiService.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/MobileApiService.kt
similarity index 68%
rename from src/main/kotlin/com/supwisdom/dlpay/mobile/service/MobileApiService.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/MobileApiService.kt
index 6ddc123..6b28b01 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/mobile/service/MobileApiService.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/MobileApiService.kt
@@ -1,5 +1,6 @@
package com.supwisdom.dlpay.mobile.service
+import com.supwisdom.dlpay.api.domain.TCard
import com.supwisdom.dlpay.mobile.domain.TBMobileUser
import com.supwisdom.dlpay.mobile.domain.TBPages
@@ -12,4 +13,9 @@
fun findUserById(id: String): TBMobileUser?
+ fun findCardByNo(cardno: String):TCard?
+
+ fun findCardByUserid(userid :String) :TCard?
+
+ fun saveCard(card:TCard):TCard
}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/service/MobileUserService.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/MobileUserService.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/mobile/service/MobileUserService.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/MobileUserService.kt
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileApiServiceImpl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileApiServiceImpl.kt
new file mode 100644
index 0000000..e7dee86
--- /dev/null
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileApiServiceImpl.kt
@@ -0,0 +1,56 @@
+package com.supwisdom.dlpay.mobile.service.impl
+
+import com.supwisdom.dlpay.api.dao.CardDao
+import com.supwisdom.dlpay.api.domain.TCard
+import com.supwisdom.dlpay.mobile.dao.MobileUserDao
+import com.supwisdom.dlpay.mobile.dao.PagesDao
+import com.supwisdom.dlpay.mobile.domain.TBMobileUser
+import com.supwisdom.dlpay.mobile.domain.TBPages
+import com.supwisdom.dlpay.mobile.service.MobileApiService
+import com.supwisdom.dlpay.util.ConstantUtil
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+
+@Service
+class MobileApiServiceImpl : MobileApiService {
+ @Autowired
+ lateinit var mobileUserDao: MobileUserDao
+
+ @Autowired
+ lateinit var cardDao: CardDao
+
+ @Autowired
+ lateinit var pagesDao: PagesDao
+
+ override fun saveUser(user: TBMobileUser): TBMobileUser {
+ return mobileUserDao.save(user)
+ }
+
+ override fun findPageById(pageid: String): TBPages? {
+ return pagesDao.findById(pageid).let {
+ if (it.isPresent) it.get() else null
+ }
+ }
+
+ override fun findUserByPhone(phone: String): TBMobileUser? {
+ return mobileUserDao.findByPhone(phone)
+ }
+
+ override fun findUserById(id: String): TBMobileUser? {
+ return mobileUserDao.findById(id).let {
+ if (it.isPresent) it.get() else null
+ }
+ }
+
+ override fun findCardByNo(cardno: String): TCard? {
+ return cardDao.findCardByCardnoAndCardtype(cardno,ConstantUtil.CARDTYPE_BANKCARD)
+ }
+
+ override fun findCardByUserid(userid: String): TCard? {
+ return cardDao.findCardByUseridAndCardtype(userid,ConstantUtil.CARDTYPE_BANKCARD)
+ }
+
+ override fun saveCard(card: TCard): TCard {
+ return cardDao.save(card)
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileUserServiceImpl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileUserServiceImpl.kt
similarity index 65%
rename from src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileUserServiceImpl.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileUserServiceImpl.kt
index 197da10..2878eb3 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileUserServiceImpl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileUserServiceImpl.kt
@@ -4,7 +4,7 @@
import com.supwisdom.dlpay.mobile.domain.TBMobileUser
import com.supwisdom.dlpay.mobile.exception.UserLoginFailException
import com.supwisdom.dlpay.mobile.service.MobileUserService
-import org.slf4j.LoggerFactory
+import mu.KotlinLogging
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.security.core.GrantedAuthority
import org.springframework.security.core.authority.AuthorityUtils
@@ -14,42 +14,44 @@
@Service
class MobileUserServiceImpl : MobileUserService {
- var logger = LoggerFactory.getLogger(MobileUserServiceImpl::class.java)
+ companion object {
+ const val TIME_INTERVAL = 1000 * 6 * 30
+ }
+
+ val logger = KotlinLogging.logger { }
@Autowired
lateinit var mobileUserDao: MobileUserDao
override fun loadUserByUsername(username: String?): UserDetails {
- logger.error("username:"+username)
- if(username.isNullOrEmpty()){
+ logger.error("username:$username")
+ if (username.isNullOrEmpty()) {
throw UsernameNotFoundException("用户不存在")
}
- var temp = mobileUserDao.findByPhone(username!!)
- if(temp!=null) {
- if(temp.loginpwd.isNullOrEmpty()){
+ val temp = mobileUserDao.findByPhone(username)
+ if (temp != null) {
+ if (temp.loginpwd.isEmpty()) {
throw UserLoginFailException("用户注册后未设置登录密码,请找回密码或重新注册")
}
- if (temp.loginpwderror != null && temp.loginpwderror!! >= 5 && (System.currentTimeMillis() - temp.loginpwderrortime!!) < 1000 * 60 * 30) {
+ if (temp.loginpwderror >= 5 && (System.currentTimeMillis() - temp.loginpwderrortime!!) < TIME_INTERVAL) {
throw UserLoginFailException("密码错误次数过多,请30分钟后再试")
- } else if (temp.loginpwderror != null && temp.loginpwderror!! >= 5 && (System.currentTimeMillis() - temp.loginpwderrortime!!) > 1000 * 60 * 30) {
+ } else if (temp.loginpwderror >= 5 && (System.currentTimeMillis() - temp.loginpwderrortime!!) > TIME_INTERVAL) {
//更新时间
temp.loginpwderror = 0
temp.loginpwderrortime = null
mobileUserDao.save(temp)
}
- var authorities: Collection<GrantedAuthority> = AuthorityUtils.createAuthorityList("ROLE_USER")
+ val authorities: Collection<GrantedAuthority> = AuthorityUtils.createAuthorityList("ROLE_USER")
temp.auths = authorities
- }else{
+ } else {
throw UsernameNotFoundException("用户不存在")
}
return temp
}
override fun getByUid(uid: String): TBMobileUser? {
- var t = mobileUserDao.findById(uid)
- if(t.isPresent){
- return t.get()
+ return mobileUserDao.findById(uid).let {
+ if (it.isPresent) it.get() else null
}
- return null
}
}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/oauth.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/oauth.kt
similarity index 100%
rename from src/main/kotlin/com/supwisdom/dlpay/oauth.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/oauth.kt
diff --git a/src/main/kotlin/com/supwisdom/dlpay/security.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/security.kt
similarity index 95%
rename from src/main/kotlin/com/supwisdom/dlpay/security.kt
rename to payapi/src/main/kotlin/com/supwisdom/dlpay/security.kt
index dfe454a..2e747ae 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/security.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/security.kt
@@ -48,7 +48,6 @@
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
import javax.sql.DataSource
-import kotlin.collections.ArrayList
@Component
@@ -86,7 +85,7 @@
url = url.replace(context, "")
}
logger.info(url)
- if(!url.startsWith("/api/")&&!url.startsWith("/mobileapi/v1/")){
+ if (!url.startsWith("/api/") && !url.startsWith("/mobileapi/v1/")) {
filterChain.doFilter(request, response)
return
}
@@ -103,7 +102,7 @@
return
}
val claims = getUtil().verifyToken(jwt)
- if(url.equals("/mobileapi/v1/logout")){
+ if (url.equals("/mobileapi/v1/logout")) {
SecurityContextHolder.clearContext()
apiJwtRepository.deleteById(claims[ReservedClaimNames.JWT_ID].toString())
throw JoseException("JWT has not been register")
@@ -120,11 +119,11 @@
}
val tenantId = request.getHeader(Constants.HEADER_TETANTID)
if (tenantId == null) {
- response.status=HttpStatus.UNAUTHORIZED.value()
+ response.status = HttpStatus.UNAUTHORIZED.value()
return
}
if (claims[Constants.JWT_CLAIM_TENANTID] != tenantId) {
- response.status=HttpStatus.UNAUTHORIZED.value()
+ response.status = HttpStatus.UNAUTHORIZED.value()
return
}
val auth = UsernamePasswordAuthenticationToken(claims[Constants.JWT_CLAIM_UID], null,
@@ -137,12 +136,12 @@
// jwt 过期后返回 401
apiJwtRepository.deleteById(e.jwtContext.jwtClaims.jwtId)
}
- response.status=HttpStatus.UNAUTHORIZED.value()
+ response.status = HttpStatus.UNAUTHORIZED.value()
return
} catch (e: JoseException) {
SecurityContextHolder.clearContext()
// jwt 失效后返回 401
- response.status=HttpStatus.UNAUTHORIZED.value()
+ response.status = HttpStatus.UNAUTHORIZED.value()
response.contentType = "application/json;charset=UTF-8"
return
} catch (e:Exception){
@@ -179,8 +178,9 @@
.authorizeRequests()
.antMatchers("/api/auth/**").permitAll()
.antMatchers("/api/notify/**").permitAll()
+ .antMatchers("/api/common/**").permitAll()
.antMatchers("/api/userinfor").hasAnyRole("ADMIN", "THIRD_ADMIN")
- .antMatchers("/api/common/**").hasAnyRole("THIRD_COMMON", "THIRD_ADMIN")
+// .antMatchers("/api/common/**").hasAnyRole("THIRD_COMMON", "THIRD_ADMIN")
.antMatchers("/api/consume/**").hasRole("THIRD_CONSUME")
.antMatchers("/api/recharge/**").hasRole("THIRD_DEPOSIT")
.antMatchers("/api/user/**").hasRole("THIRD_ADMIN")
@@ -195,6 +195,7 @@
return super.authenticationManagerBean()
}
}
+
@Configuration
@Order(2)
class MobileApiSecurityConfigurationAdapter : WebSecurityConfigurerAdapter() {
@@ -214,6 +215,7 @@
override fun configure(auth: AuthenticationManagerBuilder) {
auth.authenticationProvider(userProvider())
}
+
@Bean
fun userProvider(): DaoAuthenticationProvider {
return DaoAuthenticationProvider().apply {
@@ -312,7 +314,7 @@
http.apply(validateCodeSecurityConfig)
.and()
.authorizeRequests()
- .antMatchers("/login", "/login/form","/mobileapi/**").permitAll()
+ .antMatchers("/login", "/login/form", "/mobileapi/**").permitAll()
.antMatchers("/static/**").permitAll()
.antMatchers("/code/image").permitAll()
.antMatchers("/**").hasAnyRole("USER", "ADMIN")
diff --git a/src/main/resources/application.properties b/payapi/src/main/resources/application.properties
similarity index 75%
rename from src/main/resources/application.properties
rename to payapi/src/main/resources/application.properties
index f0ec114..9f662ab 100644
--- a/src/main/resources/application.properties
+++ b/payapi/src/main/resources/application.properties
@@ -1,6 +1,6 @@
#######################################springboot配置 start#################################
spring.application.name=supwisdom.payapi
-spring.cloud.consul.discovery.health-check-path=${management.context-path}/health
+spring.cloud.consul.discovery.health-check-path=${management.context-path}/api/common/version
spring.cloud.consul.discovery.health-check-interval=10s
spring.cloud.consul.discovery.instanceId=${spring.application.name}:${spring.application.instance_id:${random.value}}
# 单库数据库配置
@@ -8,9 +8,6 @@
spring.datasource.hikari.connection-timeout=60000
spring.datasource.hikari.maximum-pool-size=5
spring.jpa.hibernate.ddl-auto=update
-spring.flyway.locations=classpath:db/migration
-spring.flyway.baseline-version=0
-spring.flyway.baseline-on-migrate=true
# logging
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n
logging.level.org.hibernate.SQL=debug
@@ -26,11 +23,20 @@
spring.thymeleaf.mode=HTML5
spring.thymeleaf.cache=false
spring.thymeleaf.enabled=true
+################## 全局字符编码设置 ######################
+spring.http.encoding.force=true
+spring.http.encoding.charset=UTF-8
+spring.http.encoding.enabled=true
+server.tomcat.uri-encoding=UTF-8
##################################################
## quartz task scheduler
-shopbalance.updater.cron=10/* * * * *
+shopbalance.updater.cron=10/* * * * * ?
dayend.settletask.cron=0 3/30 2-3 * * ?
+query.third.transdtl.result.cron=7 0/3 * * * ?
+download.ynrcc.chkfile.cron =3 0/10 1 * * ?
#dayend.settletask.cron = 0 0/2 * * * ?
################################################
# user password
auth.password.bcrypt.length=10
+###################################################
+spring.redis.database=0
\ No newline at end of file
diff --git a/src/main/resources/data-postgresql.sql b/payapi/src/main/resources/data-postgresql.sql
similarity index 91%
rename from src/main/resources/data-postgresql.sql
rename to payapi/src/main/resources/data-postgresql.sql
index bdea1da..89ba0ee 100644
--- a/src/main/resources/data-postgresql.sql
+++ b/payapi/src/main/resources/data-postgresql.sql
@@ -8,6 +8,8 @@
insert into TB_VOUCHERNOCTL(VOUCHERTYPE,PERIODMONTH,VOUCHERNO,"tenantid")
values (1,to_number(to_char(CURRENT_TIMESTAMP,'MM'),'99'),0, , '{tenantid}');
+update TB_SUBJECT set opendate = to_number(to_char(CURRENT_TIMESTAMP,'yyyymmdd'),'99999999');
+
CREATE SEQUENCE seq_refno;
--------- end of script
diff --git a/payapi/src/main/resources/data.sql b/payapi/src/main/resources/data.sql
new file mode 100644
index 0000000..2bca5e2
--- /dev/null
+++ b/payapi/src/main/resources/data.sql
@@ -0,0 +1,593 @@
+INSERT INTO tb_tenantconfig(cfgid, tenantid, datacenter_id)
+values ('main', '{tenantid}', '01');
+
+INSERT INTO tb_operator(operid, closedate, opendate, opercode, opername, operpwd, opertype, status, thirdadmin, tenantid)
+VALUES ('LOR2IwRkbOjp+sVG9KR2BpHZbwGKepS4', '20500101', '20190101', 'system', '系统管理员', '$2a$10$Ex9xp11.vCaD8D0a7ahiUOKqDij1TcCUBwRAmrqXeDvAkmzLibn4.', 'oper', 'normal', 'no', '{tenantid}');
+
+
+INSERT INTO tb_role(roleid, createtime, editflag, lastsaved, rolecode, roledesc, rolename, tenantid)
+VALUES ('d1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '20190101000000', 0, '', 'ROLE_ADMIN', '超级管理员', '超级管理员', '{tenantid}');
+
+INSERT INTO tb_oper_role(id, operid, roleid, tenantid)
+VALUES ('1', 'LOR2IwRkbOjp+sVG9KR2BpHZbwGKepS4', 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (1, NULL, 0, NULL, 'layui-icon-home', '#', '主页', 1, -1, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (2, NULL, 1, NULL, 'layui-icon-home', '/home/console', '控制台', 1, 1, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (3, NULL, 0, NULL, 'layui-icon-set', '#', '系统中心', 2, -1, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (5, NULL, 1, NULL, 'layui-icon-set', '/role/index', '角色管理', 2, 3, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (6, NULL, 1, NULL, 'layui-icon-set', '/operator/index', '操作员管理', 4, 3, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (4, NULL, 1, NULL, 'layui-icon-set', '/function/index', '功能维护', 1, 3, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (7, NULL, 0, NULL, 'layui-icon-release', '#', '商户中心', 4, -1, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (9, NULL, 1, NULL, '', '/operator/logs', '操作日志', 4, 3, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (10, NULL, 0, NULL, 'layui-icon-util', '#', '参数管理', 3, -1, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (11, NULL, 1, NULL, 'layui-icon-util', '/param/syspara', '全局参数配置', 1, 10, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (12, NULL, 1, NULL, 'layui-icon-util', '/param/businesspara', '业务参数配置', 2, 10, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (17, NULL, 1, NULL, 'layui-icon-util', '/param/apiclientpara', '应用参数配置', 3, 10, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (18, NULL, 1, NULL, 'layui-icon-util', '/param/sourcetype', '支付能力配置', 4, 10, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (19, NULL, 0, NULL, 'layui-icon-user', '#', '用户中心', 5, -1, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (20, NULL, 0, NULL, 'layui-icon-rmb', '#', '结算中心', 6, -1, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (21, NULL, 1, NULL, '', '/user/index', '用户管理', 1, 19, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (23, NULL, 1, NULL, '', '/shop/index', '商户管理', 1, 7, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (24, NULL, 1, NULL, '', '/user/point', '积分管理', 3, 19, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (22, NULL, 1, NULL, '', '/user/acc', '账户管理', 2, 19, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (25, NULL, 1, NULL, '', '/shop/config', '商户支付能力配置', 2, 7, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (26, NULL, 0, NULL, 'layui-icon-tabs', '#', '流水管理', 3, -1, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (27, NULL, 1, NULL, '', '/dtl/userdtl', '个人流水查询', 1, 26, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (28, NULL, 1, NULL, '', '/dtl/shopdtl', '商户流水查询', 2, 26, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (29, NULL, 1, NULL, '', '/report/subjectday', '科目汇总表', 1, 20, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (30, NULL, 1, NULL, '', '/report/subjectdetail', '科目明细账', 2, 20, '{tenantid}');
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (31, NULL, 1, NULL, '', '/report/shopbusiness', '商户营业情况表', 3, 20, '{tenantid}');
+
+
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b7955772c0032', 1, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b7955772d0033', 2, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b7955772d0034', 3, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b7955772d0035', 5, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557730003b', 6, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577310041', 4, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557732004a', 9, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557732004c', 7, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557732004d', 23, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577330052', 25, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557733005a', 20, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557733005b', 29, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557733005d', 30, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557733005f', 31, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577340061', 19, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577340062', 21, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577350068', 24, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557735006a', 22, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557735006c', 26, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557735006d', 27, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557735006f', 28, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577350071', 10, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577350072', 11, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577360074', 17, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557736007b', 12, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577370081', 18, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (4, '1', 4, '添加功能', '/function/add', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (5, '', 4, '添加父功能', '/function/loadadd', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (6, '1', 6, '查询', '/operator/index', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (7, '', 6, '添加查询', '/operator/load4add', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (8, '', 6, '添加和修改', '/operator/add', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (9, '', 6, '重置密码', '/operator/resetpwd', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (10, '', 4, '查询', '/function/index', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (11, '', 4, '删除', '/function/delfunc', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (12, '', 4, '添加子功能', '/function/loadsubadd', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (13, '', 4, '维护资源', '/function/loadres', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (14, '', 4, '添加资源', '/function/addres', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (15, '', 4, '删除资源', '/function/delres', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (16, '', 5, '查询', '/role/index', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (17, '', 5, '添加', '/role/add', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (19, '', 5, '分配功能', '/role/addfunc', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (20, '', 5, '加载分配功能', '/role/loadfunc', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (21, '', 5, '删除角色', '/role/del', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (22, '', 6, '修改状态', '/operator/updatestate', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (24, '', 9, '查询', '/operator/logslist', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (26, '', 11, '修改', '/param/sysparaupdate', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (27, '', 11, '查询', '/param/syspara', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (28, '', 12, '查询', '/param/businesspara', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (29, '', 12, '删除', '/param/deletebusinesspara', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (30, '', 12, '修改', '/param/businessparaupdate', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (32, '', 12, '新增', '/param/addbusinesspara', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (33, '', 12, '新增跳转', '/param/load4addbuspara', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (34, '', 17, '查询', '/param/apiclientpara', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (35, '', 17, '新增修改跳转', '/param/load4addapiclient', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (36, '', 17, '修改状态', '/param/updateapiclientstate', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (37, '', 17, '删除', '/param/deleteapiclient', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (39, '', 17, '修改', '/param/updateapiclientpara', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (40, '', 17, '新增', '/param/addapiclientpara', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (41, '', 18, '查询', '/param/sourcetype', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (42, '', 21, '查询', '/user/list', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (43, '', 18, '新增跳转', '/param/load4addsourcetype', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (44, '', 18, '切换状态', '/param/updatesourcetypestate', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (45, '', 18, '修改', '/param/updatesourcetypename', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (46, '', 18, '删除', '/param/deletesourcetype', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (48, '', 18, '配置跳转', '/param/load4sourcetypeconfig', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (49, '', 18, '配置参数', '/param/addsourcetypeconfig', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (50, '', 22, '查询', '/user/account', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (52, '', 24, '查询', '/user/pointlist', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (53, '', 23, '删除', '/shop/deleteshop', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (54, '', 21, '添加', '/user/add', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (56, '', 23, '查询', '/shop/getshopinfo', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (57, '', 23, '商户树', '/shop/index', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (58, '', 23, '新增修改', '/shop/saveorupdate', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (59, '', 21, '删除', '/user/del', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (60, '', 21, '注销账户', '/user/delacc', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (61, '', 21, '删除积分账户', '/user/delpoint', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (63, '', 25, '商户树', '/shop/config', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (64, '', 25, '查询', '/shop/shopsourcetypelist', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (65, '', 25, '切换状态', '/shop/updatesourcetypestat', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (66, '', 25, '新增跳转', '/shop/load4addsourcetype', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (67, '', 25, '新增', '/shop/addshopsourcetype', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (68, '', 25, '配置跳转', '/shop/load4sourcetypepara', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (69, '', 25, '配置', '/shop/addsourcetypepara', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (70, '', 27, '查询', '/dtl/userdtl', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (71, '', 28, '查询', '/dtl/shopdtl', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (72, '', 29, '查询', '/report/subjectday', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (73, '', 30, '查询', '/report/subjectdetail', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (74, '', 31, '查询', '/report/shopbusiness', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (76, '', 18, '新增', '/param/addsourcetype', '{tenantid}');
+
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577300036', 16, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577300037', 17, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577300038', 19, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b795577300039', 20, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557730003a', 21, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557730003c', 6, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
+VALUES ('ff8080816b7947ed016b79557730003d', 7, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557731003e', 8, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557731003f', 9, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577310040', 22, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577310042', 4, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577310043', 5, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577310044', 10, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577310045', 11, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577310046', 12, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577320047', 13, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577320048', 14, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577320049', 15, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557732004b', 24, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557732004e', 53, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557732004f', 57, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577320050', 56, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577320051', 58, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577330053', 63, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+ VALUES ('ff8080816b7947ed016b795577330054', 64, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577330055', 65, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577330056', 66, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+ VALUES ('ff8080816b7947ed016b795577330057', 68, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+ VALUES ('ff8080816b7947ed016b795577330058', 67, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+ VALUES ('ff8080816b7947ed016b795577330059', 69, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557733005c', 72, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557733005e', 73, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577340060', 74, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577340063', 54, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577340064', 60, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577340065', 61, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+ VALUES ('ff8080816b7947ed016b795577350066', 42, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577350067', 59, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577350069', 52, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+ VALUES ('ff8080816b7947ed016b79557735006b', 50, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557735006e', 70, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577350070', 71, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577360073', 27, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577360075', 39, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577360076', 34, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577360077', 40, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577360078', 37, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577360079', 36, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557736007a', 35, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557736007c', 33, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557736007d', 32, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b79557736007e', 28, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+ VALUES ('ff8080816b7947ed016b79557737007f', 30, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577370080', 29, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577370082', 46, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577370083', 48, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577370084', 41, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577370085', 44, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+ VALUES ('ff8080816b7947ed016b795577370086', 49, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577370087', 45, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816b7947ed016b795577370088', 43, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816bbb130c016bbb6ea2f700c9', 76, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816bbb130c016bbb6ea2f600b3', 26, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+
+
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (1, '1001', 1, 'y', 1, NULL, 20190430, 1, '库存现金', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (2, '1002', 1, 'y', 1, NULL, 20190430, 1, '银行存款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (3, '1121', 1, 'n', 0, NULL, 20190430, 1, '应收票据', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (4, '112101', 1, 'n', 1, '1121', 20190430, 2, '支票', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (5, '112102', 1, 'n', 1, '1121', 20190430, 2, '经费本', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (6, '1122', 1, 'y', 0, NULL, 20190430, 1, '应收账款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (7, '112201', 1, 'y', 1, '1122', 20190430, 2, '现金充值款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (8, '112209', 1, 'y', 1, '1122', 20190617, 2, '其他第三方充值款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (9, '112210', 1, 'y', 1, '1122', 20190430, 2, '支付宝充值款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (10, '112211', 1, 'y', 1, '1122', 20190430, 2, '微信充值款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (11, '112212', 1, 'n', 1, '1122', 20190430, 2, '银联充值款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (12, '112213', 1, 'y', 1, '1122', 20190430, 2, '一卡通充值款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (13, '112230', 1, 'y', 1, '1122', 20190430, 2, '支付宝支付款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (14, '112231', 1, 'y', 1, '1122', 20190430, 2, '微信支付款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (15, '112232', 1, 'n', 1, '1122', 20190430, 2, '银联支付款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (16, '112233', 1, 'y', 1, '1122', 20190430, 2, '一卡通支付款', 1, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (17, '112234', 1, 'y', 1, '1122', NULL, 2, '市民卡支付款', 1, '{tenantid}');
+--负债
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (18, '2001', 2, 'n', 1, NULL, 20190430, 1, '用户押金', 2, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (19, '2004', 2, 'y', 1, NULL, 20190430, 1, '商户营业款', 2, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (20, '2202', 2, 'y', 0, NULL, 20190430, 1, '应付账款', 2, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (21, '220201', 2, 'y', 1, '2202', 20190430, 2, '个人存款', 2, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (22, '220211', 2, 'n', 1, '2202', 20190430, 2, '销户退款', 2, '{tenantid}');
+--损益
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (23, '6021', 2, 'y', 0, NULL, 20190430, 1, '手续费收入', 6, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (24, '602101', 2, 'y', 1, '6021', 20190430, 2, '支付宝充值手续费', 6, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (25, '602102', 2, 'y', 1, '6021', 20190430, 2, '微信充值手续费', 6, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (26, '602103', 2, 'n', 1, '6021', 20190430, 2, '银联充值手续费', 6, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (27, '6601', 2, 'y', 0, NULL, 20190430, 1, '销售费用', 6, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (28, '660101', 2, 'y', 1, '6601', 20190430, 2, '折扣优惠款', 6, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (29, '660102', 2, 'y', 1, '6601', 20190430, 2, '积分抵扣款', 6, '{tenantid}');
+INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
+VALUES (30, '6602', 2, 'y', 1, NULL, 20190430, 1, '管理费收入', 6, '{tenantid}');
+
+
+
+INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno", "deposite_subjno", "tenantid")
+VALUES ('D3820D49DACA49199E36537F6719665F', 'citizenCard', 't', '大理市民卡', 't', 'f', 't', 'f', 't', '112234', '-', '{tenantid}');
+INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno","deposite_subjno","tenantid")
+VALUES ('0997477F40904AD1A2E37FD15345CE00', 'balance', 'f', '账户余额', 't', 'f', 't', 'f', 't', '-', '-', '{tenantid}');
+INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno","deposite_subjno", "tenantid")
+VALUES ('F0CA47ADC0F24DFCA0D95DF4136CC2D0', 'thirdpart', 'f', '其他第三方支付', 't', 't', 'f', 'f', 'f','-','-', '{tenantid}');
+INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno","deposite_subjno","tenantid")
+VALUES ('F5B344726FA24BD896E70DEE3D3F46CA', 'swyktv5', 't', '一卡通支付', 't', 't', 't', 't', 't','-','-', '{tenantid}');
+INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno","deposite_subjno","tenantid")
+VALUES ('28EE54CD3B044CC197D6C5B0E309F8B8', 'alipay', 't', '支付宝', 't', 't', 't', 't', 'f', '112230','112210', '{tenantid}');
+INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno","deposite_subjno","tenantid")
+VALUES ('DAEF88B54B684347B2B83940C38C7671', 'wechat', 't', '微信支付', 't', 't', 't', 't', 'f', '112231','112211', '{tenantid}');
+
+-- 支付方式
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('1', 'swyktv5','appid','模板','100005', 't', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('2', 'swyktv5','appkey','模板','adc4ac6822fd462780f878b86cb94688', 't', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('3', 'swyktv5','orderurl','模板','http://172.28.201.101:9116/epayapi/services/thirdparty/common/pay', 't', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('4', 'swyktv5','reverseurl','模板','http://172.28.201.101:9116/epayapi/services/thirdparty/common/payreverse', 't', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('5', 'alipay', 'alipay.gateway', '支付宝网关地址', 'https://openapi.alipay.com/gateway.do', 't', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('6', 'alipay', 'enable.paymethod', '支付渠道', 'balance,moneyFund,debitCardExpress,bankPay,pcredit', 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('7', 'alipay', 'notify.url', '异步通知地址', 'http://ykt.supwisdom.com:9116/epay/zfb/newnotify', 't', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('8', 'alipay', 'timeout.express', '支付超时时间', '5m', 't', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('9', 'alipay', 'alipay.public.key', '支付宝商户应用的支付宝公钥', NULL, 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('10', 'alipay', 'alipay.rsa.private.key', '支付宝商户应用RSA私钥', NULL, 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('11', 'alipay', 'alipay.rsa.public.key', '支付宝商户应用RSA公钥', NULL, 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('12', 'alipay', 'alipay.appid', '支付宝应用APPID', NULL, 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('13', 'citizenCard', 'ynrcc.agent.url', '农商行前置地址前缀', NULL, 't', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('15', 'citizenCard', 'ynrcc.agent.signkey', '农商行前置签名秘钥', NULL, 't', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('16', 'citizenCard', 'merchant.bankcardno', '商户银行卡号', NULL, 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('17', 'citizenCard', 'merchant.bankaccname', '银行开户名', NULL, 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('18', 'wechat', 'wechat.appid', '微信APPID', null, 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('19', 'wechat', 'wechat.mechid', '微信商户号', NULL, 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('20', 'wechat', 'wechat.mechkey', '微信商户支付秘钥', NULL, 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('21', 'wechat', 'wechat.notify', '微信支付结果通知地址', NULL, 't', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('22', 'wechat', 'wechat.refund.certpath', '微信退款证书路径', NULL, 'f', '{tenantid}');
+INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
+VALUES ('23', 'wechat', 'wechat.refund.certpwd', '微信退款证书密码', NULL, 'f', '{tenantid}');
+
+INSERT INTO "tb_syspara" ("paraid", "displayflag", "editflag", "lastsaved", "paraname", "paraunit", "paraval", "remark", "valuetype", "tenantid")
+VALUES (1, 'yes', 1, '20190514165658', '账户最大余额默认值', '元', '10001', '账户开户时的默认账户最大余额', 'amount', '{tenantid}');
+
+INSERT INTO "tb_task_lock" ("taskcode", "remark", "taskstatus", "tasktime", "tenantid")
+VALUES ('DAYENDSETTLETASK', '日终结算', '0', '20190619100600', '{tenantid}');
+
+INSERT INTO "tb_shop" ("shopid", "shopname", "shoptype", "fshopid", "status", "opendate", "tenantid")
+VALUES (1, '支付中心', 0, 0, 'normal', '20190517', '{tenantid}');
+
+INSERT INTO "tb_transcode" ("transcode", "transname", "tenantid")
+VALUES (3010, '市民卡代扣', '{tenantid}');
+INSERT INTO "tb_transcode" ("transcode", "transname", "tenantid")
+VALUES (1002, '支付码聚合付', '{tenantid}');
+INSERT INTO "tb_transcode" ("transcode", "transname", "tenantid")
+VALUES (3500, '账户充值', '{tenantid}');
+
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (1, 'cancel', 'reverseFlagList', '冲正', '冲正状态', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (2, 'reverse', 'reverseFlagList', '手工撤销', '冲正状态', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (3, 'none', 'reverseFlagList', '-', '冲正状态', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (4, 'init', 'dtlStatusList', '初始化', '流水状态', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (5, 'success', 'dtlStatusList', '交易成功', '流水状态', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (6, 'fail', 'dtlStatusList', '交易失败', '流水状态', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (7, 'wip', 'dtlStatusList','待支付', '流水状态', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (8, 'cancel','dtlStatusList', '交易取消', '流水状态', '{tenantid}');
+
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (9, 'idcard', 'idtypeList', '身份证', '证件类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (10, 'residence_booklet', 'idtypeList', '户口簿', '证件类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (11, 'passport', 'idtypeList', '护照', '证件类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (12, 'hk_macau_pass', 'idtypeList', '港澳居民来往内地通行证', '证件类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (13, 'taiwan_pass', 'idtypeList', '台湾同胞来往内地通行证', '证件类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (14, 'foreigner_residence_permit', 'idtypeList', '外国人居留证', '证件类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (15, 'military_idcard', 'idtypeList', '军官证', '证件类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (16, 'soldier_idcard', 'idtypeList', '士兵证', '证件类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (17, 'driving_license', 'idtypeList', '驾照', '证件类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (18, 'student_idcard', 'idtypeList', '学工号', '证件类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (19, 'unknown', 'idtypeList', '其他', '证件类型', '{tenantid}');
+
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (20, 'male', 'sexList', '男', '性别', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (21, 'female', 'sexList', '女', '性别', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (22, 'unknown', 'sexList', '未知', '性别', '{tenantid}');
+
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (23, 'normal', 'accountStatusList', '正常', '账户状态', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (24, 'closed', 'accountStatusList', '注销', '账户状态', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (25, 'locked', 'accountStatusList', '锁定', '账户状态', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (26, 'unknown', 'accountStatusList', '异常', '账户状态', '{tenantid}');
+
+
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (27, 'water', 'dtltypeList', '生活用水', '流水类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (28, 'carbus', 'dtltypeList', '乘车', '流水类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (29, 'canteen', 'dtltypeList', '食堂就餐', '流水类型', '{tenantid}');
+INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
+VALUES (30, 'shopmarket', 'dtltypeList', '商超消费', '流水类型', '{tenantid}');
+
+INSERT INTO TB_QRCODE_PATTERN(ID, PATTERN, SOURCETYPE, TENANTID)
+VALUES(1, '28\d{16}', 'alipay', '{tenantid}');
+INSERT INTO TB_QRCODE_PATTERN(ID, PATTERN, SOURCETYPE, TENANTID)
+VALUES(2, '13\d{16}', 'wechat', '{tenantid}');
+----------------------------------------------------
+commit;
\ No newline at end of file
diff --git a/src/main/resources/static/custom/css/admin.css b/payapi/src/main/resources/static/custom/css/admin.css
similarity index 100%
rename from src/main/resources/static/custom/css/admin.css
rename to payapi/src/main/resources/static/custom/css/admin.css
diff --git a/src/main/resources/static/custom/css/console.css b/payapi/src/main/resources/static/custom/css/console.css
similarity index 100%
rename from src/main/resources/static/custom/css/console.css
rename to payapi/src/main/resources/static/custom/css/console.css
diff --git a/src/main/resources/static/custom/css/login.css b/payapi/src/main/resources/static/custom/css/login.css
similarity index 100%
rename from src/main/resources/static/custom/css/login.css
rename to payapi/src/main/resources/static/custom/css/login.css
diff --git a/src/main/resources/static/custom/css/theme-blue.css b/payapi/src/main/resources/static/custom/css/theme-blue.css
similarity index 100%
rename from src/main/resources/static/custom/css/theme-blue.css
rename to payapi/src/main/resources/static/custom/css/theme-blue.css
diff --git a/src/main/resources/static/custom/images/bg_login.png b/payapi/src/main/resources/static/custom/images/bg_login.png
similarity index 100%
rename from src/main/resources/static/custom/images/bg_login.png
rename to payapi/src/main/resources/static/custom/images/bg_login.png
Binary files differ
diff --git a/src/main/resources/static/custom/images/head.png b/payapi/src/main/resources/static/custom/images/head.png
similarity index 100%
rename from src/main/resources/static/custom/images/head.png
rename to payapi/src/main/resources/static/custom/images/head.png
Binary files differ
diff --git a/src/main/resources/static/custom/images/logo.png b/payapi/src/main/resources/static/custom/images/logo.png
similarity index 100%
rename from src/main/resources/static/custom/images/logo.png
rename to payapi/src/main/resources/static/custom/images/logo.png
Binary files differ
diff --git a/src/main/resources/static/custom/module/admin.js b/payapi/src/main/resources/static/custom/module/admin.js
similarity index 96%
rename from src/main/resources/static/custom/module/admin.js
rename to payapi/src/main/resources/static/custom/module/admin.js
index e15cfdf..1694286 100755
--- a/src/main/resources/static/custom/module/admin.js
+++ b/payapi/src/main/resources/static/custom/module/admin.js
@@ -145,6 +145,18 @@
layer.msg(jsonRs.msg, {icon: 2});
}
}
+
+ if(result.indexOf("<title>统一身份认证</title>")!=-1){
+ layer.msg("登录过期,请重新登录!", {icon: 2, time: 1500}, function () {
+ location.replace(baseUrl + 'login');
+ }, 500);
+ return;
+ }else if(result.indexOf("<title>403 无权限</title>")!=-1){
+ layer.close(popupCenterIndex);
+ layer.msg("无资源权限", {icon: 2, time:2000});
+ return;
+ }
+
successCallback(result, status, xhr);
};
param.error = function (xhr) {
@@ -384,4 +396,4 @@
});
exports('admin', admin);
-});
+});
\ No newline at end of file
diff --git a/src/main/resources/static/custom/module/formSelects/formSelects-v4.all.js b/payapi/src/main/resources/static/custom/module/formSelects/formSelects-v4.all.js
similarity index 100%
rename from src/main/resources/static/custom/module/formSelects/formSelects-v4.all.js
rename to payapi/src/main/resources/static/custom/module/formSelects/formSelects-v4.all.js
diff --git a/src/main/resources/static/custom/module/formSelects/formSelects-v4.css b/payapi/src/main/resources/static/custom/module/formSelects/formSelects-v4.css
similarity index 100%
rename from src/main/resources/static/custom/module/formSelects/formSelects-v4.css
rename to payapi/src/main/resources/static/custom/module/formSelects/formSelects-v4.css
diff --git a/src/main/resources/static/custom/module/formSelects/formSelects-v4.js b/payapi/src/main/resources/static/custom/module/formSelects/formSelects-v4.js
similarity index 100%
rename from src/main/resources/static/custom/module/formSelects/formSelects-v4.js
rename to payapi/src/main/resources/static/custom/module/formSelects/formSelects-v4.js
diff --git a/src/main/resources/static/custom/module/index.js b/payapi/src/main/resources/static/custom/module/index.js
similarity index 100%
rename from src/main/resources/static/custom/module/index.js
rename to payapi/src/main/resources/static/custom/module/index.js
diff --git a/src/main/resources/static/custom/module/treeSelect/treeSelect.js b/payapi/src/main/resources/static/custom/module/treeSelect/treeSelect.js
similarity index 93%
rename from src/main/resources/static/custom/module/treeSelect/treeSelect.js
rename to payapi/src/main/resources/static/custom/module/treeSelect/treeSelect.js
index 5e20c18..e7a85fd 100755
--- a/src/main/resources/static/custom/module/treeSelect/treeSelect.js
+++ b/payapi/src/main/resources/static/custom/module/treeSelect/treeSelect.js
@@ -481,7 +481,7 @@
return a;
},
loadCss: function () {
- var ztree = '.ztree *{padding:0;margin:0;font-size:12px;font-family:Verdana,Arial,Helvetica,AppleGothic,sans-serif}.ztree{margin:0;padding:5px;color:#333}.ztree li{padding:0;margin:0;list-style:none;line-height:14px;text-align:left;white-space:nowrap;outline:0}.ztree li ul{margin:0;padding:0 0 0 18px}.ztree li ul.line{background:url(./img/line_conn.gif) 0 0 repeat-y;}.ztree li a{padding:1px 3px 0 0;margin:0;cursor:pointer;height:17px;color:#333;background-color:transparent;text-decoration:none;vertical-align:top;display:inline-block}.ztree li a:hover{text-decoration:underline}.ztree li a.curSelectedNode{padding-top:0px;background-color:#FFE6B0;color:black;height:16px;border:1px #FFB951 solid;opacity:0.8;}.ztree li a.curSelectedNode_Edit{padding-top:0px;background-color:#FFE6B0;color:black;height:16px;border:1px #FFB951 solid;opacity:0.8;}.ztree li a.tmpTargetNode_inner{padding-top:0px;background-color:#316AC5;color:white;height:16px;border:1px #316AC5 solid;opacity:0.8;filter:alpha(opacity=80)}.ztree li a.tmpTargetNode_prev{}.ztree li a.tmpTargetNode_next{}.ztree li a input.rename{height:14px;width:80px;padding:0;margin:0;font-size:12px;border:1px #7EC4CC solid;*border:0px}.ztree li span{line-height:16px;margin-right:2px}.ztree li span.button{line-height:0;margin:0;width:16px;height:16px;display:inline-block;vertical-align:middle;border:0 none;cursor:pointer;outline:none;background-color:transparent;background-repeat:no-repeat;background-attachment:scroll;background-image:url("./img/zTreeStandard.png");*background-image:url("./img/zTreeStandard.gif")}.ztree li span.button.chk{width:13px;height:13px;margin:0 3px 0 0;cursor:auto}.ztree li span.button.chk.checkbox_false_full{background-position:0 0}.ztree li span.button.chk.checkbox_false_full_focus{background-position:0 -14px}.ztree li span.button.chk.checkbox_false_part{background-position:0 -28px}.ztree li span.button.chk.checkbox_false_part_focus{background-position:0 -42px}.ztree li span.button.chk.checkbox_false_disable{background-position:0 -56px}.ztree li span.button.chk.checkbox_true_full{background-position:-14px 0}.ztree li span.button.chk.checkbox_true_full_focus{background-position:-14px -14px}.ztree li span.button.chk.checkbox_true_part{background-position:-14px -28px}.ztree li span.button.chk.checkbox_true_part_focus{background-position:-14px -42px}.ztree li span.button.chk.checkbox_true_disable{background-position:-14px -56px}.ztree li span.button.chk.radio_false_full{background-position:-28px 0}.ztree li span.button.chk.radio_false_full_focus{background-position:-28px -14px}.ztree li span.button.chk.radio_false_part{background-position:-28px -28px}.ztree li span.button.chk.radio_false_part_focus{background-position:-28px -42px}.ztree li span.button.chk.radio_false_disable{background-position:-28px -56px}.ztree li span.button.chk.radio_true_full{background-position:-42px 0}.ztree li span.button.chk.radio_true_full_focus{background-position:-42px -14px}.ztree li span.button.chk.radio_true_part{background-position:-42px -28px}.ztree li span.button.chk.radio_true_part_focus{background-position:-42px -42px}.ztree li span.button.chk.radio_true_disable{background-position:-42px -56px}.ztree li span.button.switch{width:18px;height:18px}.ztree li span.button.root_open{background-position:-92px -54px}.ztree li span.button.root_close{background-position:-74px -54px}.ztree li span.button.roots_open{background-position:-92px 0}.ztree li span.button.roots_close{background-position:-74px 0}.ztree li span.button.center_open{background-position:-92px -18px}.ztree li span.button.center_close{background-position:-74px -18px}.ztree li span.button.bottom_open{background-position:-92px -36px}.ztree li span.button.bottom_close{background-position:-74px -36px}.ztree li span.button.noline_open{background-position:-92px -72px}.ztree li span.button.noline_close{background-position:-74px -72px}.ztree li span.button.root_docu{background:none;}.ztree li span.button.roots_docu{background-position:-56px 0}.ztree li span.button.center_docu{background-position:-56px -18px}.ztree li span.button.bottom_docu{background-position:-56px -36px}.ztree li span.button.noline_docu{background:none;}.ztree li span.button.ico_open{margin-right:2px;background-position:-110px -16px;vertical-align:top;*vertical-align:middle}.ztree li span.button.ico_close{margin-right:2px;background-position:-110px 0;vertical-align:top;*vertical-align:middle}.ztree li span.button.ico_docu{margin-right:2px;background-position:-110px -32px;vertical-align:top;*vertical-align:middle}.ztree li span.button.edit{margin-right:2px;background-position:-110px -48px;vertical-align:top;*vertical-align:middle}.ztree li span.button.remove{margin-right:2px;background-position:-110px -64px;vertical-align:top;*vertical-align:middle}.ztree li span.button.ico_loading{margin-right:2px;background:url(./img/loading.gif) no-repeat scroll 0 0 transparent;vertical-align:top;*vertical-align:middle}ul.tmpTargetzTree{background-color:#FFE6B0;opacity:0.8;filter:alpha(opacity=80)}span.tmpzTreeMove_arrow{width:16px;height:16px;display:inline-block;padding:0;margin:2px 0 0 1px;border:0 none;position:absolute;background-color:transparent;background-repeat:no-repeat;background-attachment:scroll;background-position:-110px -80px;background-image:url("./img/zTreeStandard.png");*background-image:url("./img/zTreeStandard.gif")}ul.ztree.zTreeDragUL{margin:0;padding:0;position:absolute;width:auto;height:auto;overflow:hidden;background-color:#cfcfcf;border:1px #00B83F dotted;opacity:0.8;filter:alpha(opacity=80)}.zTreeMask{z-index:10000;background-color:#cfcfcf;opacity:0.0;filter:alpha(opacity=0);position:absolute}',
+ var ztree = '.ztree *{padding:0;margin:0;font-size:12px;font-family:Verdana,Arial,Helvetica,AppleGothic,sans-serif}.ztree{margin:0;padding:5px;color:#333}.ztree li{padding:0;margin:0;list-style:none;line-height:14px;text-align:left;white-space:nowrap;outline:0}.ztree li a:hover{text-decoration:underline}.ztree li a.curSelectedNode{padding-top:0px;background-color:#FFE6B0;color:black;height:16px;border:1px #FFB951 solid;opacity:0.8;}.ztree li a.curSelectedNode_Edit{padding-top:0px;background-color:#FFE6B0;color:black;height:16px;border:1px #FFB951 solid;opacity:0.8;}.ztree li a.tmpTargetNode_inner{padding-top:0px;background-color:#316AC5;color:white;height:16px;border:1px #316AC5 solid;opacity:0.8;filter:alpha(opacity=80)}.ztree li a.tmpTargetNode_prev{}.ztree li a.tmpTargetNode_next{}.ztree li a input.rename{height:14px;width:80px;padding:0;margin:0;font-size:12px;border:1px #7EC4CC solid;*border:0px}.ztree li span{line-height:16px;margin-right:2px}.ztree li span.button.chk.checkbox_false_full_focus{background-position:0 -14px}.ztree li span.button.chk.checkbox_false_part{background-position:0 -28px}.ztree li span.button.chk.checkbox_false_part_focus{background-position:0 -42px}.ztree li span.button.chk.checkbox_false_disable{background-position:0 -56px}.ztree li span.button.chk.checkbox_true_full{background-position:-14px 0}.ztree li span.button.chk.checkbox_true_full_focus{background-position:-14px -14px}.ztree li span.button.chk.checkbox_true_part{background-position:-14px -28px}.ztree li span.button.chk.checkbox_true_part_focus{background-position:-14px -42px}.ztree li span.button.chk.checkbox_true_disable{background-position:-14px -56px}.ztree li span.button.chk.radio_false_full{background-position:-28px 0}.ztree li span.button.chk.radio_false_full_focus{background-position:-28px -14px}.ztree li span.button.chk.radio_false_part{background-position:-28px -28px}.ztree li span.button.chk.radio_false_part_focus{background-position:-28px -42px}.ztree li span.button.chk.radio_false_disable{background-position:-28px -56px}.ztree li span.button.chk.radio_true_full{background-position:-42px 0}.ztree li span.button.chk.radio_true_full_focus{background-position:-42px -14px}.ztree li span.button.chk.radio_true_part{background-position:-42px -28px}.ztree li span.button.chk.radio_true_part_focus{background-position:-42px -42px}.ztree li span.button.chk.radio_true_disable{background-position:-42px -56px}.ztree li span.button.switch{width:18px;height:18px}.ztree li span.button.root_open{background-position:-92px -54px}.ztree li span.button.root_close{background-position:-74px -54px}.ztree li span.button.roots_open{background-position:-92px 0}.ztree li span.button.roots_close{background-position:-74px 0}.ztree li span.button.center_open{background-position:-92px -18px}.ztree li span.button.center_close{background-position:-74px -18px}.ztree li span.button.bottom_open{background-position:-92px -36px}.ztree li span.button.bottom_close{background-position:-74px -36px}.ztree li span.button.noline_open{background-position:-92px -72px}.ztree li span.button.noline_close{background-position:-74px -72px}.ztree li span.button.root_docu{background:none;}.ztree li span.button.roots_docu{background-position:-56px 0}.ztree li span.button.center_docu{background-position:-56px -18px}.ztree li span.button.bottom_docu{background-position:-56px -36px}.ztree li span.button.noline_docu{background:none;}.ztree li span.button.ico_open{margin-right:2px;background-position:-110px -16px;vertical-align:top;*vertical-align:middle}.ztree li span.button.ico_close{margin-right:2px;background-position:-110px 0;vertical-align:top;*vertical-align:middle}.ztree li span.button.ico_docu{margin-right:2px;background-position:-110px -32px;vertical-align:top;*vertical-align:middle}.ztree li span.button.edit{margin-right:2px;background-position:-110px -48px;vertical-align:top;*vertical-align:middle}.ztree li span.button.remove{margin-right:2px;background-position:-110px -64px;vertical-align:top;*vertical-align:middle}ul.tmpTargetzTree{background-color:#FFE6B0;opacity:0.8;filter:alpha(opacity=80)}ul.ztree.zTreeDragUL{margin:0;padding:0;position:absolute;width:auto;height:auto;overflow:hidden;background-color:#cfcfcf;border:1px #00B83F dotted;opacity:0.8;filter:alpha(opacity=80)}.zTreeMask{z-index:10000;background-color:#cfcfcf;opacity:0.0;filter:alpha(opacity=0);position:absolute}',
ztree_ex = '.layui-treeSelect .ztree li span.button{font-family:layui-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:none;line-height:inherit;}.layui-treeSelect .ztree li span.button.ico_open{display:none;}.layui-treeSelect .ztree li span.button.ico_close{display:none;}.layui-treeSelect .ztree li span.button.ico_docu:before{content:"\\e621";}.layui-treeSelect .ztree li span.button.bottom_close:before,.layui-treeSelect .ztree li span.button.center_close:before,.layui-treeSelect .ztree li span.button.roots_close:before,.layui-treeSelect .ztree li span.button.root_close:before{content:"\\e623";}.layui-treeSelect .ztree li span.button.bottom_open:before,.layui-treeSelect .ztree li span.button.roots_open:before,.layui-treeSelect .ztree li span.button.center_open:before,.layui-treeSelect .ztree li span.button.root_open:before{content:"\\e625";}.layui-treeSelect .ztree li a:hover{text-decoration:none;}.layui-treeSelect .ztree *{font-size:14px;}.layui-treeSelect .ztree li{line-height:inherit;padding:2px 0;}.layui-treeSelect .ztree li span.button.switch{position:relative;top:-1px;}.layui-treeSelect .ztree li a,.ztree li span{line-height:18px;height:inherit;}.layui-treeSelect .ztree li a.curSelectedNode{color:#5FB878;background:none;border:none;height:inherit;padding-top:1px;}.layui-treeSelect .layui-anim::-webkit-scrollbar{width:6px;height:6px;background-color:#F5F5F5;}.layui-treeSelect .layui-anim::-webkit-scrollbar-track{box-shadow:inset 0 0 6px rgba(107,98,98,0.3);border-radius:10px;background-color:#F5F5F5;}.layui-treeSelect .layui-anim::-webkit-scrollbar-thumb{border-radius:10px;box-shadow:inset 0 0 6px rgba(107,98,98,0.3);background-color:#555;}.layui-treeSelect.layui-form-select .layui-anim{display:none;position:absolute;left:0;top:42px;padding:5px 0;z-index:9999;min-width:100%;border:1px solid #d2d2d2;max-height:300px;overflow-y:auto;background-color:#fff;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.12);box-sizing:border-box;}.layui-treeSelect.layui-form-selected .layui-anim{display:block;}.layui-treeSelect .ztree li ul.line{background:none;position:relative;}.layui-treeSelect .ztree li ul.line:before{content:"";height:100%;border-left:1px dotted #ece;position:absolute;left:8px;}.layui-treeSelect .ztree li .center_docu:before,.ztree li .bottom_docu::before{content:"";height:100%;border-left:1px dotted #ece;position:absolute;left:8px;}.layui-treeSelect .ztree li .center_docu::after,.ztree li .bottom_docu::after{content:"";position:absolute;left:8px;top:8px;width:8px;border-top:1px dotted #ece;}.layui-treeSelect .ztree li span.button.ico_open{display:inline-block;position:relative;top:1px;}.layui-treeSelect .ztree li span.button.ico_close{display:inline-block;position:relative;top:1px;}.layui-treeSelect .ztree li span.button.ico_open:before{content:"\\e643";}.layui-treeSelect .ztree li span.button.ico_close:before{content:"\\e63f";}';
$head = $('head'),
ztreeStyle = $head.find('style[ztree]');
diff --git a/src/main/resources/static/custom/module/treetable-lay/treetable.css b/payapi/src/main/resources/static/custom/module/treetable-lay/treetable.css
similarity index 100%
rename from src/main/resources/static/custom/module/treetable-lay/treetable.css
rename to payapi/src/main/resources/static/custom/module/treetable-lay/treetable.css
diff --git a/src/main/resources/static/custom/module/treetable-lay/treetable.js b/payapi/src/main/resources/static/custom/module/treetable-lay/treetable.js
similarity index 100%
rename from src/main/resources/static/custom/module/treetable-lay/treetable.js
rename to payapi/src/main/resources/static/custom/module/treetable-lay/treetable.js
diff --git a/src/main/resources/static/libs/custom.js b/payapi/src/main/resources/static/libs/custom.js
similarity index 84%
rename from src/main/resources/static/libs/custom.js
rename to payapi/src/main/resources/static/libs/custom.js
index e91928d..12564c2 100644
--- a/src/main/resources/static/libs/custom.js
+++ b/payapi/src/main/resources/static/libs/custom.js
@@ -15,7 +15,7 @@
pool: {},
addNewDict: function (dictType) {
var that = this;
- console.log("正在加载<"+dictType+">");
+ console.log("正在加载<" + dictType + ">");
$.ajax(that.url, {
method: "GET",
data: "dicttype=" + dictType,
@@ -25,11 +25,11 @@
that.storage.removeItem(dictType);
} else {
that.storage.setItem(dictType, JSON.stringify(data));
- console.log("<"+dictType+">加载成功!");
+ console.log("<" + dictType + ">加载成功!");
}
},
- error: function(e){
- console.log("<"+dictType+">加载失败!");
+ error: function (e) {
+ console.log("<" + dictType + ">加载失败!");
}
}
);
@@ -48,7 +48,7 @@
that.storage.removeItem(dictType);
} else {
that.storage.setItem(dictType, JSON.stringify(data));
- console.log("<"+dictType+">加载成功!");
+ console.log("<" + dictType + ">加载成功!");
}
},
error: function (e) {
@@ -60,7 +60,12 @@
},
initAll: function (url) {
this.url = url;
- this.addNewDict("sourcetypeList").addNewDict("reverseFlagList");
+ this.addNewDict("sourcetypeList")
+ .addNewDict("reverseFlagList")
+ .addNewDict("idtypeList")
+ .addNewDict("sexList")
+ .addNewDict("accountStatusList")
+ .addNewDict("allSubjectList")
},
getDict: function (dictType) {
var dict, that = this;
diff --git a/src/main/resources/static/libs/jquery/jquery-3.2.1.min.js b/payapi/src/main/resources/static/libs/jquery/jquery-3.2.1.min.js
similarity index 100%
rename from src/main/resources/static/libs/jquery/jquery-3.2.1.min.js
rename to payapi/src/main/resources/static/libs/jquery/jquery-3.2.1.min.js
diff --git a/src/main/resources/static/libs/layui/css/layui.css b/payapi/src/main/resources/static/libs/layui/css/layui.css
similarity index 100%
rename from src/main/resources/static/libs/layui/css/layui.css
rename to payapi/src/main/resources/static/libs/layui/css/layui.css
diff --git a/src/main/resources/static/libs/layui/css/layui.mobile.css b/payapi/src/main/resources/static/libs/layui/css/layui.mobile.css
similarity index 100%
rename from src/main/resources/static/libs/layui/css/layui.mobile.css
rename to payapi/src/main/resources/static/libs/layui/css/layui.mobile.css
diff --git a/src/main/resources/static/libs/layui/css/modules/code.css b/payapi/src/main/resources/static/libs/layui/css/modules/code.css
similarity index 100%
rename from src/main/resources/static/libs/layui/css/modules/code.css
rename to payapi/src/main/resources/static/libs/layui/css/modules/code.css
diff --git a/src/main/resources/static/libs/layui/css/modules/laydate/default/laydate.css b/payapi/src/main/resources/static/libs/layui/css/modules/laydate/default/laydate.css
similarity index 100%
rename from src/main/resources/static/libs/layui/css/modules/laydate/default/laydate.css
rename to payapi/src/main/resources/static/libs/layui/css/modules/laydate/default/laydate.css
diff --git a/src/main/resources/static/libs/layui/css/modules/layer/default/icon-ext.png b/payapi/src/main/resources/static/libs/layui/css/modules/layer/default/icon-ext.png
similarity index 100%
rename from src/main/resources/static/libs/layui/css/modules/layer/default/icon-ext.png
rename to payapi/src/main/resources/static/libs/layui/css/modules/layer/default/icon-ext.png
Binary files differ
diff --git a/src/main/resources/static/libs/layui/css/modules/layer/default/icon.png b/payapi/src/main/resources/static/libs/layui/css/modules/layer/default/icon.png
similarity index 100%
rename from src/main/resources/static/libs/layui/css/modules/layer/default/icon.png
rename to payapi/src/main/resources/static/libs/layui/css/modules/layer/default/icon.png
Binary files differ
diff --git a/src/main/resources/static/libs/layui/css/modules/layer/default/layer.css b/payapi/src/main/resources/static/libs/layui/css/modules/layer/default/layer.css
similarity index 100%
rename from src/main/resources/static/libs/layui/css/modules/layer/default/layer.css
rename to payapi/src/main/resources/static/libs/layui/css/modules/layer/default/layer.css
diff --git a/src/main/resources/static/libs/layui/css/modules/layer/default/loading-0.gif b/payapi/src/main/resources/static/libs/layui/css/modules/layer/default/loading-0.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/css/modules/layer/default/loading-0.gif
rename to payapi/src/main/resources/static/libs/layui/css/modules/layer/default/loading-0.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/css/modules/layer/default/loading-1.gif b/payapi/src/main/resources/static/libs/layui/css/modules/layer/default/loading-1.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/css/modules/layer/default/loading-1.gif
rename to payapi/src/main/resources/static/libs/layui/css/modules/layer/default/loading-1.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/css/modules/layer/default/loading-2.gif b/payapi/src/main/resources/static/libs/layui/css/modules/layer/default/loading-2.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/css/modules/layer/default/loading-2.gif
rename to payapi/src/main/resources/static/libs/layui/css/modules/layer/default/loading-2.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/font/iconfont.eot b/payapi/src/main/resources/static/libs/layui/font/iconfont.eot
similarity index 100%
rename from src/main/resources/static/libs/layui/font/iconfont.eot
rename to payapi/src/main/resources/static/libs/layui/font/iconfont.eot
Binary files differ
diff --git a/src/main/resources/static/libs/layui/font/iconfont.svg b/payapi/src/main/resources/static/libs/layui/font/iconfont.svg
similarity index 100%
rename from src/main/resources/static/libs/layui/font/iconfont.svg
rename to payapi/src/main/resources/static/libs/layui/font/iconfont.svg
diff --git a/src/main/resources/static/libs/layui/font/iconfont.ttf b/payapi/src/main/resources/static/libs/layui/font/iconfont.ttf
similarity index 100%
rename from src/main/resources/static/libs/layui/font/iconfont.ttf
rename to payapi/src/main/resources/static/libs/layui/font/iconfont.ttf
Binary files differ
diff --git a/src/main/resources/static/libs/layui/font/iconfont.woff b/payapi/src/main/resources/static/libs/layui/font/iconfont.woff
similarity index 100%
rename from src/main/resources/static/libs/layui/font/iconfont.woff
rename to payapi/src/main/resources/static/libs/layui/font/iconfont.woff
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/0.gif b/payapi/src/main/resources/static/libs/layui/images/face/0.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/0.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/0.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/1.gif b/payapi/src/main/resources/static/libs/layui/images/face/1.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/1.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/1.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/10.gif b/payapi/src/main/resources/static/libs/layui/images/face/10.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/10.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/10.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/11.gif b/payapi/src/main/resources/static/libs/layui/images/face/11.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/11.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/11.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/12.gif b/payapi/src/main/resources/static/libs/layui/images/face/12.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/12.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/12.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/13.gif b/payapi/src/main/resources/static/libs/layui/images/face/13.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/13.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/13.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/14.gif b/payapi/src/main/resources/static/libs/layui/images/face/14.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/14.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/14.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/15.gif b/payapi/src/main/resources/static/libs/layui/images/face/15.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/15.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/15.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/16.gif b/payapi/src/main/resources/static/libs/layui/images/face/16.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/16.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/16.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/17.gif b/payapi/src/main/resources/static/libs/layui/images/face/17.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/17.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/17.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/18.gif b/payapi/src/main/resources/static/libs/layui/images/face/18.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/18.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/18.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/19.gif b/payapi/src/main/resources/static/libs/layui/images/face/19.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/19.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/19.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/2.gif b/payapi/src/main/resources/static/libs/layui/images/face/2.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/2.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/2.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/20.gif b/payapi/src/main/resources/static/libs/layui/images/face/20.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/20.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/20.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/21.gif b/payapi/src/main/resources/static/libs/layui/images/face/21.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/21.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/21.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/22.gif b/payapi/src/main/resources/static/libs/layui/images/face/22.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/22.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/22.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/23.gif b/payapi/src/main/resources/static/libs/layui/images/face/23.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/23.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/23.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/24.gif b/payapi/src/main/resources/static/libs/layui/images/face/24.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/24.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/24.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/25.gif b/payapi/src/main/resources/static/libs/layui/images/face/25.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/25.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/25.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/26.gif b/payapi/src/main/resources/static/libs/layui/images/face/26.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/26.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/26.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/27.gif b/payapi/src/main/resources/static/libs/layui/images/face/27.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/27.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/27.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/28.gif b/payapi/src/main/resources/static/libs/layui/images/face/28.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/28.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/28.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/29.gif b/payapi/src/main/resources/static/libs/layui/images/face/29.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/29.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/29.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/3.gif b/payapi/src/main/resources/static/libs/layui/images/face/3.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/3.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/3.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/30.gif b/payapi/src/main/resources/static/libs/layui/images/face/30.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/30.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/30.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/31.gif b/payapi/src/main/resources/static/libs/layui/images/face/31.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/31.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/31.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/32.gif b/payapi/src/main/resources/static/libs/layui/images/face/32.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/32.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/32.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/33.gif b/payapi/src/main/resources/static/libs/layui/images/face/33.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/33.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/33.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/34.gif b/payapi/src/main/resources/static/libs/layui/images/face/34.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/34.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/34.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/35.gif b/payapi/src/main/resources/static/libs/layui/images/face/35.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/35.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/35.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/36.gif b/payapi/src/main/resources/static/libs/layui/images/face/36.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/36.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/36.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/37.gif b/payapi/src/main/resources/static/libs/layui/images/face/37.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/37.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/37.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/38.gif b/payapi/src/main/resources/static/libs/layui/images/face/38.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/38.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/38.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/39.gif b/payapi/src/main/resources/static/libs/layui/images/face/39.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/39.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/39.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/4.gif b/payapi/src/main/resources/static/libs/layui/images/face/4.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/4.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/4.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/40.gif b/payapi/src/main/resources/static/libs/layui/images/face/40.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/40.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/40.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/41.gif b/payapi/src/main/resources/static/libs/layui/images/face/41.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/41.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/41.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/42.gif b/payapi/src/main/resources/static/libs/layui/images/face/42.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/42.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/42.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/43.gif b/payapi/src/main/resources/static/libs/layui/images/face/43.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/43.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/43.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/44.gif b/payapi/src/main/resources/static/libs/layui/images/face/44.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/44.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/44.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/45.gif b/payapi/src/main/resources/static/libs/layui/images/face/45.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/45.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/45.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/46.gif b/payapi/src/main/resources/static/libs/layui/images/face/46.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/46.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/46.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/47.gif b/payapi/src/main/resources/static/libs/layui/images/face/47.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/47.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/47.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/48.gif b/payapi/src/main/resources/static/libs/layui/images/face/48.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/48.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/48.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/49.gif b/payapi/src/main/resources/static/libs/layui/images/face/49.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/49.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/49.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/5.gif b/payapi/src/main/resources/static/libs/layui/images/face/5.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/5.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/5.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/50.gif b/payapi/src/main/resources/static/libs/layui/images/face/50.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/50.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/50.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/51.gif b/payapi/src/main/resources/static/libs/layui/images/face/51.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/51.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/51.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/52.gif b/payapi/src/main/resources/static/libs/layui/images/face/52.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/52.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/52.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/53.gif b/payapi/src/main/resources/static/libs/layui/images/face/53.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/53.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/53.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/54.gif b/payapi/src/main/resources/static/libs/layui/images/face/54.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/54.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/54.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/55.gif b/payapi/src/main/resources/static/libs/layui/images/face/55.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/55.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/55.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/56.gif b/payapi/src/main/resources/static/libs/layui/images/face/56.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/56.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/56.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/57.gif b/payapi/src/main/resources/static/libs/layui/images/face/57.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/57.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/57.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/58.gif b/payapi/src/main/resources/static/libs/layui/images/face/58.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/58.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/58.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/59.gif b/payapi/src/main/resources/static/libs/layui/images/face/59.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/59.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/59.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/6.gif b/payapi/src/main/resources/static/libs/layui/images/face/6.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/6.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/6.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/60.gif b/payapi/src/main/resources/static/libs/layui/images/face/60.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/60.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/60.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/61.gif b/payapi/src/main/resources/static/libs/layui/images/face/61.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/61.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/61.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/62.gif b/payapi/src/main/resources/static/libs/layui/images/face/62.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/62.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/62.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/63.gif b/payapi/src/main/resources/static/libs/layui/images/face/63.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/63.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/63.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/64.gif b/payapi/src/main/resources/static/libs/layui/images/face/64.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/64.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/64.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/65.gif b/payapi/src/main/resources/static/libs/layui/images/face/65.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/65.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/65.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/66.gif b/payapi/src/main/resources/static/libs/layui/images/face/66.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/66.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/66.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/67.gif b/payapi/src/main/resources/static/libs/layui/images/face/67.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/67.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/67.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/68.gif b/payapi/src/main/resources/static/libs/layui/images/face/68.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/68.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/68.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/69.gif b/payapi/src/main/resources/static/libs/layui/images/face/69.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/69.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/69.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/7.gif b/payapi/src/main/resources/static/libs/layui/images/face/7.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/7.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/7.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/70.gif b/payapi/src/main/resources/static/libs/layui/images/face/70.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/70.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/70.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/71.gif b/payapi/src/main/resources/static/libs/layui/images/face/71.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/71.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/71.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/8.gif b/payapi/src/main/resources/static/libs/layui/images/face/8.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/8.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/8.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/images/face/9.gif b/payapi/src/main/resources/static/libs/layui/images/face/9.gif
similarity index 100%
rename from src/main/resources/static/libs/layui/images/face/9.gif
rename to payapi/src/main/resources/static/libs/layui/images/face/9.gif
Binary files differ
diff --git a/src/main/resources/static/libs/layui/lay/modules/carousel.js b/payapi/src/main/resources/static/libs/layui/lay/modules/carousel.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/carousel.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/carousel.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/code.js b/payapi/src/main/resources/static/libs/layui/lay/modules/code.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/code.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/code.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/colorpicker.js b/payapi/src/main/resources/static/libs/layui/lay/modules/colorpicker.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/colorpicker.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/colorpicker.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/element.js b/payapi/src/main/resources/static/libs/layui/lay/modules/element.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/element.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/element.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/flow.js b/payapi/src/main/resources/static/libs/layui/lay/modules/flow.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/flow.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/flow.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/form.js b/payapi/src/main/resources/static/libs/layui/lay/modules/form.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/form.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/form.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/jquery.js b/payapi/src/main/resources/static/libs/layui/lay/modules/jquery.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/jquery.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/jquery.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/laydate.js b/payapi/src/main/resources/static/libs/layui/lay/modules/laydate.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/laydate.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/laydate.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/layedit.js b/payapi/src/main/resources/static/libs/layui/lay/modules/layedit.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/layedit.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/layedit.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/layer.js b/payapi/src/main/resources/static/libs/layui/lay/modules/layer.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/layer.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/layer.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/laypage.js b/payapi/src/main/resources/static/libs/layui/lay/modules/laypage.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/laypage.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/laypage.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/laytpl.js b/payapi/src/main/resources/static/libs/layui/lay/modules/laytpl.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/laytpl.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/laytpl.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/mobile.js b/payapi/src/main/resources/static/libs/layui/lay/modules/mobile.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/mobile.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/mobile.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/rate.js b/payapi/src/main/resources/static/libs/layui/lay/modules/rate.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/rate.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/rate.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/slider.js b/payapi/src/main/resources/static/libs/layui/lay/modules/slider.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/slider.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/slider.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/table.js b/payapi/src/main/resources/static/libs/layui/lay/modules/table.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/table.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/table.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/tree.js b/payapi/src/main/resources/static/libs/layui/lay/modules/tree.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/tree.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/tree.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/upload.js b/payapi/src/main/resources/static/libs/layui/lay/modules/upload.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/upload.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/upload.js
diff --git a/src/main/resources/static/libs/layui/lay/modules/util.js b/payapi/src/main/resources/static/libs/layui/lay/modules/util.js
similarity index 100%
rename from src/main/resources/static/libs/layui/lay/modules/util.js
rename to payapi/src/main/resources/static/libs/layui/lay/modules/util.js
diff --git a/src/main/resources/static/libs/layui/layui.all.js b/payapi/src/main/resources/static/libs/layui/layui.all.js
similarity index 100%
rename from src/main/resources/static/libs/layui/layui.all.js
rename to payapi/src/main/resources/static/libs/layui/layui.all.js
diff --git a/src/main/resources/static/libs/layui/layui.js b/payapi/src/main/resources/static/libs/layui/layui.js
similarity index 100%
rename from src/main/resources/static/libs/layui/layui.js
rename to payapi/src/main/resources/static/libs/layui/layui.js
diff --git a/payapi/src/main/resources/static/libs/moment.js b/payapi/src/main/resources/static/libs/moment.js
new file mode 100644
index 0000000..4eabd05
--- /dev/null
+++ b/payapi/src/main/resources/static/libs/moment.js
@@ -0,0 +1,11142 @@
+;(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ global.moment = factory()
+}(this, function () { 'use strict';
+
+ var hookCallback;
+
+ function utils_hooks__hooks () {
+ return hookCallback.apply(null, arguments);
+ }
+
+ // This is done to register the method called with moment()
+ // without creating circular dependencies.
+ function setHookCallback (callback) {
+ hookCallback = callback;
+ }
+
+ function isArray(input) {
+ return Object.prototype.toString.call(input) === '[object Array]';
+ }
+
+ function isDate(input) {
+ return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
+ }
+
+ function map(arr, fn) {
+ var res = [], i;
+ for (i = 0; i < arr.length; ++i) {
+ res.push(fn(arr[i], i));
+ }
+ return res;
+ }
+
+ function hasOwnProp(a, b) {
+ return Object.prototype.hasOwnProperty.call(a, b);
+ }
+
+ function extend(a, b) {
+ for (var i in b) {
+ if (hasOwnProp(b, i)) {
+ a[i] = b[i];
+ }
+ }
+
+ if (hasOwnProp(b, 'toString')) {
+ a.toString = b.toString;
+ }
+
+ if (hasOwnProp(b, 'valueOf')) {
+ a.valueOf = b.valueOf;
+ }
+
+ return a;
+ }
+
+ function create_utc__createUTC (input, format, locale, strict) {
+ return createLocalOrUTC(input, format, locale, strict, true).utc();
+ }
+
+ function defaultParsingFlags() {
+ // We need to deep clone this object.
+ return {
+ empty : false,
+ unusedTokens : [],
+ unusedInput : [],
+ overflow : -2,
+ charsLeftOver : 0,
+ nullInput : false,
+ invalidMonth : null,
+ invalidFormat : false,
+ userInvalidated : false,
+ iso : false
+ };
+ }
+
+ function getParsingFlags(m) {
+ if (m._pf == null) {
+ m._pf = defaultParsingFlags();
+ }
+ return m._pf;
+ }
+
+ function valid__isValid(m) {
+ if (m._isValid == null) {
+ var flags = getParsingFlags(m);
+ m._isValid = !isNaN(m._d.getTime()) &&
+ flags.overflow < 0 &&
+ !flags.empty &&
+ !flags.invalidMonth &&
+ !flags.invalidWeekday &&
+ !flags.nullInput &&
+ !flags.invalidFormat &&
+ !flags.userInvalidated;
+
+ if (m._strict) {
+ m._isValid = m._isValid &&
+ flags.charsLeftOver === 0 &&
+ flags.unusedTokens.length === 0 &&
+ flags.bigHour === undefined;
+ }
+ }
+ return m._isValid;
+ }
+
+ function valid__createInvalid (flags) {
+ var m = create_utc__createUTC(NaN);
+ if (flags != null) {
+ extend(getParsingFlags(m), flags);
+ }
+ else {
+ getParsingFlags(m).userInvalidated = true;
+ }
+
+ return m;
+ }
+
+ function isUndefined(input) {
+ return input === void 0;
+ }
+
+ // Plugins that add properties should also add the key here (null value),
+ // so we can properly clone ourselves.
+ var momentProperties = utils_hooks__hooks.momentProperties = [];
+
+ function copyConfig(to, from) {
+ var i, prop, val;
+
+ if (!isUndefined(from._isAMomentObject)) {
+ to._isAMomentObject = from._isAMomentObject;
+ }
+ if (!isUndefined(from._i)) {
+ to._i = from._i;
+ }
+ if (!isUndefined(from._f)) {
+ to._f = from._f;
+ }
+ if (!isUndefined(from._l)) {
+ to._l = from._l;
+ }
+ if (!isUndefined(from._strict)) {
+ to._strict = from._strict;
+ }
+ if (!isUndefined(from._tzm)) {
+ to._tzm = from._tzm;
+ }
+ if (!isUndefined(from._isUTC)) {
+ to._isUTC = from._isUTC;
+ }
+ if (!isUndefined(from._offset)) {
+ to._offset = from._offset;
+ }
+ if (!isUndefined(from._pf)) {
+ to._pf = getParsingFlags(from);
+ }
+ if (!isUndefined(from._locale)) {
+ to._locale = from._locale;
+ }
+
+ if (momentProperties.length > 0) {
+ for (i in momentProperties) {
+ prop = momentProperties[i];
+ val = from[prop];
+ if (!isUndefined(val)) {
+ to[prop] = val;
+ }
+ }
+ }
+
+ return to;
+ }
+
+ var updateInProgress = false;
+
+ // Moment prototype object
+ function Moment(config) {
+ copyConfig(this, config);
+ this._d = new Date(config._d != null ? config._d.getTime() : NaN);
+ // Prevent infinite loop in case updateOffset creates new moment
+ // objects.
+ if (updateInProgress === false) {
+ updateInProgress = true;
+ utils_hooks__hooks.updateOffset(this);
+ updateInProgress = false;
+ }
+ }
+
+ function isMoment (obj) {
+ return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
+ }
+
+ function absFloor (number) {
+ if (number < 0) {
+ return Math.ceil(number);
+ } else {
+ return Math.floor(number);
+ }
+ }
+
+ function toInt(argumentForCoercion) {
+ var coercedNumber = +argumentForCoercion,
+ value = 0;
+
+ if (coercedNumber !== 0 && isFinite(coercedNumber)) {
+ value = absFloor(coercedNumber);
+ }
+
+ return value;
+ }
+
+ // compare two arrays, return the number of differences
+ function compareArrays(array1, array2, dontConvert) {
+ var len = Math.min(array1.length, array2.length),
+ lengthDiff = Math.abs(array1.length - array2.length),
+ diffs = 0,
+ i;
+ for (i = 0; i < len; i++) {
+ if ((dontConvert && array1[i] !== array2[i]) ||
+ (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
+ diffs++;
+ }
+ }
+ return diffs + lengthDiff;
+ }
+
+ function Locale() {
+ }
+
+ // internal storage for locale config files
+ var locales = {};
+ var globalLocale;
+
+ function normalizeLocale(key) {
+ return key ? key.toLowerCase().replace('_', '-') : key;
+ }
+
+ // pick the locale from the array
+ // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
+ // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
+ function chooseLocale(names) {
+ var i = 0, j, next, locale, split;
+
+ while (i < names.length) {
+ split = normalizeLocale(names[i]).split('-');
+ j = split.length;
+ next = normalizeLocale(names[i + 1]);
+ next = next ? next.split('-') : null;
+ while (j > 0) {
+ locale = loadLocale(split.slice(0, j).join('-'));
+ if (locale) {
+ return locale;
+ }
+ if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
+ //the next array item is better than a shallower substring of this one
+ break;
+ }
+ j--;
+ }
+ i++;
+ }
+ return null;
+ }
+
+ function loadLocale(name) {
+ var oldLocale = null;
+ // TODO: Find a better way to register and load all the locales in Node
+ if (!locales[name] && (typeof module !== 'undefined') &&
+ module && module.exports) {
+ try {
+ oldLocale = globalLocale._abbr;
+ require('./locale/' + name);
+ // because defineLocale currently also sets the global locale, we
+ // want to undo that for lazy loaded locales
+ locale_locales__getSetGlobalLocale(oldLocale);
+ } catch (e) { }
+ }
+ return locales[name];
+ }
+
+ // This function will load locale and then set the global locale. If
+ // no arguments are passed in, it will simply return the current global
+ // locale key.
+ function locale_locales__getSetGlobalLocale (key, values) {
+ var data;
+ if (key) {
+ if (isUndefined(values)) {
+ data = locale_locales__getLocale(key);
+ }
+ else {
+ data = defineLocale(key, values);
+ }
+
+ if (data) {
+ // moment.duration._locale = moment._locale = data;
+ globalLocale = data;
+ }
+ }
+
+ return globalLocale._abbr;
+ }
+
+ function defineLocale (name, values) {
+ if (values !== null) {
+ values.abbr = name;
+ locales[name] = locales[name] || new Locale();
+ locales[name].set(values);
+
+ // backwards compat for now: also set the locale
+ locale_locales__getSetGlobalLocale(name);
+
+ return locales[name];
+ } else {
+ // useful for testing
+ delete locales[name];
+ return null;
+ }
+ }
+
+ // returns locale data
+ function locale_locales__getLocale (key) {
+ var locale;
+
+ if (key && key._locale && key._locale._abbr) {
+ key = key._locale._abbr;
+ }
+
+ if (!key) {
+ return globalLocale;
+ }
+
+ if (!isArray(key)) {
+ //short-circuit everything else
+ locale = loadLocale(key);
+ if (locale) {
+ return locale;
+ }
+ key = [key];
+ }
+
+ return chooseLocale(key);
+ }
+
+ var aliases = {};
+
+ function addUnitAlias (unit, shorthand) {
+ var lowerCase = unit.toLowerCase();
+ aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
+ }
+
+ function normalizeUnits(units) {
+ return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
+ }
+
+ function normalizeObjectUnits(inputObject) {
+ var normalizedInput = {},
+ normalizedProp,
+ prop;
+
+ for (prop in inputObject) {
+ if (hasOwnProp(inputObject, prop)) {
+ normalizedProp = normalizeUnits(prop);
+ if (normalizedProp) {
+ normalizedInput[normalizedProp] = inputObject[prop];
+ }
+ }
+ }
+
+ return normalizedInput;
+ }
+
+ function isFunction(input) {
+ return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
+ }
+
+ function makeGetSet (unit, keepTime) {
+ return function (value) {
+ if (value != null) {
+ get_set__set(this, unit, value);
+ utils_hooks__hooks.updateOffset(this, keepTime);
+ return this;
+ } else {
+ return get_set__get(this, unit);
+ }
+ };
+ }
+
+ function get_set__get (mom, unit) {
+ return mom.isValid() ?
+ mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
+ }
+
+ function get_set__set (mom, unit, value) {
+ if (mom.isValid()) {
+ mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
+ }
+ }
+
+ // MOMENTS
+
+ function getSet (units, value) {
+ var unit;
+ if (typeof units === 'object') {
+ for (unit in units) {
+ this.set(unit, units[unit]);
+ }
+ } else {
+ units = normalizeUnits(units);
+ if (isFunction(this[units])) {
+ return this[units](value);
+ }
+ }
+ return this;
+ }
+
+ function zeroFill(number, targetLength, forceSign) {
+ var absNumber = '' + Math.abs(number),
+ zerosToFill = targetLength - absNumber.length,
+ sign = number >= 0;
+ return (sign ? (forceSign ? '+' : '') : '-') +
+ Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
+ }
+
+ var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
+
+ var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
+
+ var formatFunctions = {};
+
+ var formatTokenFunctions = {};
+
+ // token: 'M'
+ // padded: ['MM', 2]
+ // ordinal: 'Mo'
+ // callback: function () { this.month() + 1 }
+ function addFormatToken (token, padded, ordinal, callback) {
+ var func = callback;
+ if (typeof callback === 'string') {
+ func = function () {
+ return this[callback]();
+ };
+ }
+ if (token) {
+ formatTokenFunctions[token] = func;
+ }
+ if (padded) {
+ formatTokenFunctions[padded[0]] = function () {
+ return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
+ };
+ }
+ if (ordinal) {
+ formatTokenFunctions[ordinal] = function () {
+ return this.localeData().ordinal(func.apply(this, arguments), token);
+ };
+ }
+ }
+
+ function removeFormattingTokens(input) {
+ if (input.match(/\[[\s\S]/)) {
+ return input.replace(/^\[|\]$/g, '');
+ }
+ return input.replace(/\\/g, '');
+ }
+
+ function makeFormatFunction(format) {
+ var array = format.match(formattingTokens), i, length;
+
+ for (i = 0, length = array.length; i < length; i++) {
+ if (formatTokenFunctions[array[i]]) {
+ array[i] = formatTokenFunctions[array[i]];
+ } else {
+ array[i] = removeFormattingTokens(array[i]);
+ }
+ }
+
+ return function (mom) {
+ var output = '';
+ for (i = 0; i < length; i++) {
+ output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
+ }
+ return output;
+ };
+ }
+
+ // format date using native date object
+ function formatMoment(m, format) {
+ if (!m.isValid()) {
+ return m.localeData().invalidDate();
+ }
+
+ format = expandFormat(format, m.localeData());
+ formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
+
+ return formatFunctions[format](m);
+ }
+
+ function expandFormat(format, locale) {
+ var i = 5;
+
+ function replaceLongDateFormatTokens(input) {
+ return locale.longDateFormat(input) || input;
+ }
+
+ localFormattingTokens.lastIndex = 0;
+ while (i >= 0 && localFormattingTokens.test(format)) {
+ format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
+ localFormattingTokens.lastIndex = 0;
+ i -= 1;
+ }
+
+ return format;
+ }
+
+ var match1 = /\d/; // 0 - 9
+ var match2 = /\d\d/; // 00 - 99
+ var match3 = /\d{3}/; // 000 - 999
+ var match4 = /\d{4}/; // 0000 - 9999
+ var match6 = /[+-]?\d{6}/; // -999999 - 999999
+ var match1to2 = /\d\d?/; // 0 - 99
+ var match3to4 = /\d\d\d\d?/; // 999 - 9999
+ var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
+ var match1to3 = /\d{1,3}/; // 0 - 999
+ var match1to4 = /\d{1,4}/; // 0 - 9999
+ var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
+
+ var matchUnsigned = /\d+/; // 0 - inf
+ var matchSigned = /[+-]?\d+/; // -inf - inf
+
+ var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
+ var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
+
+ var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
+
+ // any word (or two) characters or numbers including two/three word month in arabic.
+ // includes scottish gaelic two word and hyphenated months
+ var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
+
+
+ var regexes = {};
+
+ function addRegexToken (token, regex, strictRegex) {
+ regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
+ return (isStrict && strictRegex) ? strictRegex : regex;
+ };
+ }
+
+ function getParseRegexForToken (token, config) {
+ if (!hasOwnProp(regexes, token)) {
+ return new RegExp(unescapeFormat(token));
+ }
+
+ return regexes[token](config._strict, config._locale);
+ }
+
+ // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
+ function unescapeFormat(s) {
+ return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
+ return p1 || p2 || p3 || p4;
+ }));
+ }
+
+ function regexEscape(s) {
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+ }
+
+ var tokens = {};
+
+ function addParseToken (token, callback) {
+ var i, func = callback;
+ if (typeof token === 'string') {
+ token = [token];
+ }
+ if (typeof callback === 'number') {
+ func = function (input, array) {
+ array[callback] = toInt(input);
+ };
+ }
+ for (i = 0; i < token.length; i++) {
+ tokens[token[i]] = func;
+ }
+ }
+
+ function addWeekParseToken (token, callback) {
+ addParseToken(token, function (input, array, config, token) {
+ config._w = config._w || {};
+ callback(input, config._w, config, token);
+ });
+ }
+
+ function addTimeToArrayFromToken(token, input, config) {
+ if (input != null && hasOwnProp(tokens, token)) {
+ tokens[token](input, config._a, config, token);
+ }
+ }
+
+ var YEAR = 0;
+ var MONTH = 1;
+ var DATE = 2;
+ var HOUR = 3;
+ var MINUTE = 4;
+ var SECOND = 5;
+ var MILLISECOND = 6;
+ var WEEK = 7;
+ var WEEKDAY = 8;
+
+ function daysInMonth(year, month) {
+ return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
+ }
+
+ // FORMATTING
+
+ addFormatToken('M', ['MM', 2], 'Mo', function () {
+ return this.month() + 1;
+ });
+
+ addFormatToken('MMM', 0, 0, function (format) {
+ return this.localeData().monthsShort(this, format);
+ });
+
+ addFormatToken('MMMM', 0, 0, function (format) {
+ return this.localeData().months(this, format);
+ });
+
+ // ALIASES
+
+ addUnitAlias('month', 'M');
+
+ // PARSING
+
+ addRegexToken('M', match1to2);
+ addRegexToken('MM', match1to2, match2);
+ addRegexToken('MMM', function (isStrict, locale) {
+ return locale.monthsShortRegex(isStrict);
+ });
+ addRegexToken('MMMM', function (isStrict, locale) {
+ return locale.monthsRegex(isStrict);
+ });
+
+ addParseToken(['M', 'MM'], function (input, array) {
+ array[MONTH] = toInt(input) - 1;
+ });
+
+ addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
+ var month = config._locale.monthsParse(input, token, config._strict);
+ // if we didn't find a month name, mark the date as invalid.
+ if (month != null) {
+ array[MONTH] = month;
+ } else {
+ getParsingFlags(config).invalidMonth = input;
+ }
+ });
+
+ // LOCALES
+
+ var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/;
+ var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
+ function localeMonths (m, format) {
+ return isArray(this._months) ? this._months[m.month()] :
+ this._months[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
+ }
+
+ var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
+ function localeMonthsShort (m, format) {
+ return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
+ this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
+ }
+
+ function localeMonthsParse (monthName, format, strict) {
+ var i, mom, regex;
+
+ if (!this._monthsParse) {
+ this._monthsParse = [];
+ this._longMonthsParse = [];
+ this._shortMonthsParse = [];
+ }
+
+ for (i = 0; i < 12; i++) {
+ // make the regex if we don't have it already
+ mom = create_utc__createUTC([2000, i]);
+ if (strict && !this._longMonthsParse[i]) {
+ this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
+ this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
+ }
+ if (!strict && !this._monthsParse[i]) {
+ regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
+ this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
+ }
+ // test the regex
+ if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
+ return i;
+ } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
+ return i;
+ } else if (!strict && this._monthsParse[i].test(monthName)) {
+ return i;
+ }
+ }
+ }
+
+ // MOMENTS
+
+ function setMonth (mom, value) {
+ var dayOfMonth;
+
+ if (!mom.isValid()) {
+ // No op
+ return mom;
+ }
+
+ // TODO: Move this out of here!
+ if (typeof value === 'string') {
+ value = mom.localeData().monthsParse(value);
+ // TODO: Another silent failure?
+ if (typeof value !== 'number') {
+ return mom;
+ }
+ }
+
+ dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
+ mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
+ return mom;
+ }
+
+ function getSetMonth (value) {
+ if (value != null) {
+ setMonth(this, value);
+ utils_hooks__hooks.updateOffset(this, true);
+ return this;
+ } else {
+ return get_set__get(this, 'Month');
+ }
+ }
+
+ function getDaysInMonth () {
+ return daysInMonth(this.year(), this.month());
+ }
+
+ var defaultMonthsShortRegex = matchWord;
+ function monthsShortRegex (isStrict) {
+ if (this._monthsParseExact) {
+ if (!hasOwnProp(this, '_monthsRegex')) {
+ computeMonthsParse.call(this);
+ }
+ if (isStrict) {
+ return this._monthsShortStrictRegex;
+ } else {
+ return this._monthsShortRegex;
+ }
+ } else {
+ return this._monthsShortStrictRegex && isStrict ?
+ this._monthsShortStrictRegex : this._monthsShortRegex;
+ }
+ }
+
+ var defaultMonthsRegex = matchWord;
+ function monthsRegex (isStrict) {
+ if (this._monthsParseExact) {
+ if (!hasOwnProp(this, '_monthsRegex')) {
+ computeMonthsParse.call(this);
+ }
+ if (isStrict) {
+ return this._monthsStrictRegex;
+ } else {
+ return this._monthsRegex;
+ }
+ } else {
+ return this._monthsStrictRegex && isStrict ?
+ this._monthsStrictRegex : this._monthsRegex;
+ }
+ }
+
+ function computeMonthsParse () {
+ function cmpLenRev(a, b) {
+ return b.length - a.length;
+ }
+
+ var shortPieces = [], longPieces = [], mixedPieces = [],
+ i, mom;
+ for (i = 0; i < 12; i++) {
+ // make the regex if we don't have it already
+ mom = create_utc__createUTC([2000, i]);
+ shortPieces.push(this.monthsShort(mom, ''));
+ longPieces.push(this.months(mom, ''));
+ mixedPieces.push(this.months(mom, ''));
+ mixedPieces.push(this.monthsShort(mom, ''));
+ }
+ // Sorting makes sure if one month (or abbr) is a prefix of another it
+ // will match the longer piece.
+ shortPieces.sort(cmpLenRev);
+ longPieces.sort(cmpLenRev);
+ mixedPieces.sort(cmpLenRev);
+ for (i = 0; i < 12; i++) {
+ shortPieces[i] = regexEscape(shortPieces[i]);
+ longPieces[i] = regexEscape(longPieces[i]);
+ mixedPieces[i] = regexEscape(mixedPieces[i]);
+ }
+
+ this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
+ this._monthsShortRegex = this._monthsRegex;
+ this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')$', 'i');
+ this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')$', 'i');
+ }
+
+ function checkOverflow (m) {
+ var overflow;
+ var a = m._a;
+
+ if (a && getParsingFlags(m).overflow === -2) {
+ overflow =
+ a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
+ a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
+ a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
+ a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
+ a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
+ a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
+ -1;
+
+ if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
+ overflow = DATE;
+ }
+ if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
+ overflow = WEEK;
+ }
+ if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
+ overflow = WEEKDAY;
+ }
+
+ getParsingFlags(m).overflow = overflow;
+ }
+
+ return m;
+ }
+
+ function warn(msg) {
+ if (utils_hooks__hooks.suppressDeprecationWarnings === false &&
+ (typeof console !== 'undefined') && console.warn) {
+ console.warn('Deprecation warning: ' + msg);
+ }
+ }
+
+ function deprecate(msg, fn) {
+ var firstTime = true;
+
+ return extend(function () {
+ if (firstTime) {
+ warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack);
+ firstTime = false;
+ }
+ return fn.apply(this, arguments);
+ }, fn);
+ }
+
+ var deprecations = {};
+
+ function deprecateSimple(name, msg) {
+ if (!deprecations[name]) {
+ warn(msg);
+ deprecations[name] = true;
+ }
+ }
+
+ utils_hooks__hooks.suppressDeprecationWarnings = false;
+
+ // iso 8601 regex
+ // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
+ var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
+ var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
+
+ var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
+
+ var isoDates = [
+ ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
+ ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
+ ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
+ ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
+ ['YYYY-DDD', /\d{4}-\d{3}/],
+ ['YYYY-MM', /\d{4}-\d\d/, false],
+ ['YYYYYYMMDD', /[+-]\d{10}/],
+ ['YYYYMMDD', /\d{8}/],
+ // YYYYMM is NOT allowed by the standard
+ ['GGGG[W]WWE', /\d{4}W\d{3}/],
+ ['GGGG[W]WW', /\d{4}W\d{2}/, false],
+ ['YYYYDDD', /\d{7}/]
+ ];
+
+ // iso time formats and regexes
+ var isoTimes = [
+ ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
+ ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
+ ['HH:mm:ss', /\d\d:\d\d:\d\d/],
+ ['HH:mm', /\d\d:\d\d/],
+ ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
+ ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
+ ['HHmmss', /\d\d\d\d\d\d/],
+ ['HHmm', /\d\d\d\d/],
+ ['HH', /\d\d/]
+ ];
+
+ var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
+
+ // date from iso format
+ function configFromISO(config) {
+ var i, l,
+ string = config._i,
+ match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
+ allowTime, dateFormat, timeFormat, tzFormat;
+
+ if (match) {
+ getParsingFlags(config).iso = true;
+
+ for (i = 0, l = isoDates.length; i < l; i++) {
+ if (isoDates[i][1].exec(match[1])) {
+ dateFormat = isoDates[i][0];
+ allowTime = isoDates[i][2] !== false;
+ break;
+ }
+ }
+ if (dateFormat == null) {
+ config._isValid = false;
+ return;
+ }
+ if (match[3]) {
+ for (i = 0, l = isoTimes.length; i < l; i++) {
+ if (isoTimes[i][1].exec(match[3])) {
+ // match[2] should be 'T' or space
+ timeFormat = (match[2] || ' ') + isoTimes[i][0];
+ break;
+ }
+ }
+ if (timeFormat == null) {
+ config._isValid = false;
+ return;
+ }
+ }
+ if (!allowTime && timeFormat != null) {
+ config._isValid = false;
+ return;
+ }
+ if (match[4]) {
+ if (tzRegex.exec(match[4])) {
+ tzFormat = 'Z';
+ } else {
+ config._isValid = false;
+ return;
+ }
+ }
+ config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
+ configFromStringAndFormat(config);
+ } else {
+ config._isValid = false;
+ }
+ }
+
+ // date from iso format or fallback
+ function configFromString(config) {
+ var matched = aspNetJsonRegex.exec(config._i);
+
+ if (matched !== null) {
+ config._d = new Date(+matched[1]);
+ return;
+ }
+
+ configFromISO(config);
+ if (config._isValid === false) {
+ delete config._isValid;
+ utils_hooks__hooks.createFromInputFallback(config);
+ }
+ }
+
+ utils_hooks__hooks.createFromInputFallback = deprecate(
+ 'moment construction falls back to js Date. This is ' +
+ 'discouraged and will be removed in upcoming major ' +
+ 'release. Please refer to ' +
+ 'https://github.com/moment/moment/issues/1407 for more info.',
+ function (config) {
+ config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
+ }
+ );
+
+ function createDate (y, m, d, h, M, s, ms) {
+ //can't just apply() to create a date:
+ //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
+ var date = new Date(y, m, d, h, M, s, ms);
+
+ //the date constructor remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
+ date.setFullYear(y);
+ }
+ return date;
+ }
+
+ function createUTCDate (y) {
+ var date = new Date(Date.UTC.apply(null, arguments));
+
+ //the Date.UTC function remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
+ date.setUTCFullYear(y);
+ }
+ return date;
+ }
+
+ // FORMATTING
+
+ addFormatToken('Y', 0, 0, function () {
+ var y = this.year();
+ return y <= 9999 ? '' + y : '+' + y;
+ });
+
+ addFormatToken(0, ['YY', 2], 0, function () {
+ return this.year() % 100;
+ });
+
+ addFormatToken(0, ['YYYY', 4], 0, 'year');
+ addFormatToken(0, ['YYYYY', 5], 0, 'year');
+ addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
+
+ // ALIASES
+
+ addUnitAlias('year', 'y');
+
+ // PARSING
+
+ addRegexToken('Y', matchSigned);
+ addRegexToken('YY', match1to2, match2);
+ addRegexToken('YYYY', match1to4, match4);
+ addRegexToken('YYYYY', match1to6, match6);
+ addRegexToken('YYYYYY', match1to6, match6);
+
+ addParseToken(['YYYYY', 'YYYYYY'], YEAR);
+ addParseToken('YYYY', function (input, array) {
+ array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input);
+ });
+ addParseToken('YY', function (input, array) {
+ array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
+ });
+ addParseToken('Y', function (input, array) {
+ array[YEAR] = parseInt(input, 10);
+ });
+
+ // HELPERS
+
+ function daysInYear(year) {
+ return isLeapYear(year) ? 366 : 365;
+ }
+
+ function isLeapYear(year) {
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
+ }
+
+ // HOOKS
+
+ utils_hooks__hooks.parseTwoDigitYear = function (input) {
+ return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
+ };
+
+ // MOMENTS
+
+ var getSetYear = makeGetSet('FullYear', false);
+
+ function getIsLeapYear () {
+ return isLeapYear(this.year());
+ }
+
+ // start-of-first-week - start-of-year
+ function firstWeekOffset(year, dow, doy) {
+ var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
+ fwd = 7 + dow - doy,
+ // first-week day local weekday -- which local weekday is fwd
+ fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
+
+ return -fwdlw + fwd - 1;
+ }
+
+ //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
+ function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
+ var localWeekday = (7 + weekday - dow) % 7,
+ weekOffset = firstWeekOffset(year, dow, doy),
+ dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
+ resYear, resDayOfYear;
+
+ if (dayOfYear <= 0) {
+ resYear = year - 1;
+ resDayOfYear = daysInYear(resYear) + dayOfYear;
+ } else if (dayOfYear > daysInYear(year)) {
+ resYear = year + 1;
+ resDayOfYear = dayOfYear - daysInYear(year);
+ } else {
+ resYear = year;
+ resDayOfYear = dayOfYear;
+ }
+
+ return {
+ year: resYear,
+ dayOfYear: resDayOfYear
+ };
+ }
+
+ function weekOfYear(mom, dow, doy) {
+ var weekOffset = firstWeekOffset(mom.year(), dow, doy),
+ week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
+ resWeek, resYear;
+
+ if (week < 1) {
+ resYear = mom.year() - 1;
+ resWeek = week + weeksInYear(resYear, dow, doy);
+ } else if (week > weeksInYear(mom.year(), dow, doy)) {
+ resWeek = week - weeksInYear(mom.year(), dow, doy);
+ resYear = mom.year() + 1;
+ } else {
+ resYear = mom.year();
+ resWeek = week;
+ }
+
+ return {
+ week: resWeek,
+ year: resYear
+ };
+ }
+
+ function weeksInYear(year, dow, doy) {
+ var weekOffset = firstWeekOffset(year, dow, doy),
+ weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
+ return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
+ }
+
+ // Pick the first defined of two or three arguments.
+ function defaults(a, b, c) {
+ if (a != null) {
+ return a;
+ }
+ if (b != null) {
+ return b;
+ }
+ return c;
+ }
+
+ function currentDateArray(config) {
+ // hooks is actually the exported moment object
+ var nowValue = new Date(utils_hooks__hooks.now());
+ if (config._useUTC) {
+ return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
+ }
+ return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
+ }
+
+ // convert an array to a date.
+ // the array should mirror the parameters below
+ // note: all values past the year are optional and will default to the lowest possible value.
+ // [year, month, day , hour, minute, second, millisecond]
+ function configFromArray (config) {
+ var i, date, input = [], currentDate, yearToUse;
+
+ if (config._d) {
+ return;
+ }
+
+ currentDate = currentDateArray(config);
+
+ //compute day of the year from weeks and weekdays
+ if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
+ dayOfYearFromWeekInfo(config);
+ }
+
+ //if the day of the year is set, figure out what it is
+ if (config._dayOfYear) {
+ yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
+
+ if (config._dayOfYear > daysInYear(yearToUse)) {
+ getParsingFlags(config)._overflowDayOfYear = true;
+ }
+
+ date = createUTCDate(yearToUse, 0, config._dayOfYear);
+ config._a[MONTH] = date.getUTCMonth();
+ config._a[DATE] = date.getUTCDate();
+ }
+
+ // Default to current date.
+ // * if no year, month, day of month are given, default to today
+ // * if day of month is given, default month and year
+ // * if month is given, default only year
+ // * if year is given, don't default anything
+ for (i = 0; i < 3 && config._a[i] == null; ++i) {
+ config._a[i] = input[i] = currentDate[i];
+ }
+
+ // Zero out whatever was not defaulted, including time
+ for (; i < 7; i++) {
+ config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
+ }
+
+ // Check for 24:00:00.000
+ if (config._a[HOUR] === 24 &&
+ config._a[MINUTE] === 0 &&
+ config._a[SECOND] === 0 &&
+ config._a[MILLISECOND] === 0) {
+ config._nextDay = true;
+ config._a[HOUR] = 0;
+ }
+
+ config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
+ // Apply timezone offset from input. The actual utcOffset can be changed
+ // with parseZone.
+ if (config._tzm != null) {
+ config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
+ }
+
+ if (config._nextDay) {
+ config._a[HOUR] = 24;
+ }
+ }
+
+ function dayOfYearFromWeekInfo(config) {
+ var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
+
+ w = config._w;
+ if (w.GG != null || w.W != null || w.E != null) {
+ dow = 1;
+ doy = 4;
+
+ // TODO: We need to take the current isoWeekYear, but that depends on
+ // how we interpret now (local, utc, fixed offset). So create
+ // a now version of current config (take local/utc/offset flags, and
+ // create now).
+ weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year);
+ week = defaults(w.W, 1);
+ weekday = defaults(w.E, 1);
+ if (weekday < 1 || weekday > 7) {
+ weekdayOverflow = true;
+ }
+ } else {
+ dow = config._locale._week.dow;
+ doy = config._locale._week.doy;
+
+ weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
+ week = defaults(w.w, 1);
+
+ if (w.d != null) {
+ // weekday -- low day numbers are considered next week
+ weekday = w.d;
+ if (weekday < 0 || weekday > 6) {
+ weekdayOverflow = true;
+ }
+ } else if (w.e != null) {
+ // local weekday -- counting starts from begining of week
+ weekday = w.e + dow;
+ if (w.e < 0 || w.e > 6) {
+ weekdayOverflow = true;
+ }
+ } else {
+ // default to begining of week
+ weekday = dow;
+ }
+ }
+ if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
+ getParsingFlags(config)._overflowWeeks = true;
+ } else if (weekdayOverflow != null) {
+ getParsingFlags(config)._overflowWeekday = true;
+ } else {
+ temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
+ config._a[YEAR] = temp.year;
+ config._dayOfYear = temp.dayOfYear;
+ }
+ }
+
+ // constant that refers to the ISO standard
+ utils_hooks__hooks.ISO_8601 = function () {};
+
+ // date from string and format string
+ function configFromStringAndFormat(config) {
+ // TODO: Move this to another part of the creation flow to prevent circular deps
+ if (config._f === utils_hooks__hooks.ISO_8601) {
+ configFromISO(config);
+ return;
+ }
+
+ config._a = [];
+ getParsingFlags(config).empty = true;
+
+ // This array is used to make a Date, either with `new Date` or `Date.UTC`
+ var string = '' + config._i,
+ i, parsedInput, tokens, token, skipped,
+ stringLength = string.length,
+ totalParsedInputLength = 0;
+
+ tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
+
+ for (i = 0; i < tokens.length; i++) {
+ token = tokens[i];
+ parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
+ // console.log('token', token, 'parsedInput', parsedInput,
+ // 'regex', getParseRegexForToken(token, config));
+ if (parsedInput) {
+ skipped = string.substr(0, string.indexOf(parsedInput));
+ if (skipped.length > 0) {
+ getParsingFlags(config).unusedInput.push(skipped);
+ }
+ string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
+ totalParsedInputLength += parsedInput.length;
+ }
+ // don't parse if it's not a known token
+ if (formatTokenFunctions[token]) {
+ if (parsedInput) {
+ getParsingFlags(config).empty = false;
+ }
+ else {
+ getParsingFlags(config).unusedTokens.push(token);
+ }
+ addTimeToArrayFromToken(token, parsedInput, config);
+ }
+ else if (config._strict && !parsedInput) {
+ getParsingFlags(config).unusedTokens.push(token);
+ }
+ }
+
+ // add remaining unparsed input length to the string
+ getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
+ if (string.length > 0) {
+ getParsingFlags(config).unusedInput.push(string);
+ }
+
+ // clear _12h flag if hour is <= 12
+ if (getParsingFlags(config).bigHour === true &&
+ config._a[HOUR] <= 12 &&
+ config._a[HOUR] > 0) {
+ getParsingFlags(config).bigHour = undefined;
+ }
+ // handle meridiem
+ config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
+
+ configFromArray(config);
+ checkOverflow(config);
+ }
+
+
+ function meridiemFixWrap (locale, hour, meridiem) {
+ var isPm;
+
+ if (meridiem == null) {
+ // nothing to do
+ return hour;
+ }
+ if (locale.meridiemHour != null) {
+ return locale.meridiemHour(hour, meridiem);
+ } else if (locale.isPM != null) {
+ // Fallback
+ isPm = locale.isPM(meridiem);
+ if (isPm && hour < 12) {
+ hour += 12;
+ }
+ if (!isPm && hour === 12) {
+ hour = 0;
+ }
+ return hour;
+ } else {
+ // this is not supposed to happen
+ return hour;
+ }
+ }
+
+ // date from string and array of format strings
+ function configFromStringAndArray(config) {
+ var tempConfig,
+ bestMoment,
+
+ scoreToBeat,
+ i,
+ currentScore;
+
+ if (config._f.length === 0) {
+ getParsingFlags(config).invalidFormat = true;
+ config._d = new Date(NaN);
+ return;
+ }
+
+ for (i = 0; i < config._f.length; i++) {
+ currentScore = 0;
+ tempConfig = copyConfig({}, config);
+ if (config._useUTC != null) {
+ tempConfig._useUTC = config._useUTC;
+ }
+ tempConfig._f = config._f[i];
+ configFromStringAndFormat(tempConfig);
+
+ if (!valid__isValid(tempConfig)) {
+ continue;
+ }
+
+ // if there is any input that was not parsed add a penalty for that format
+ currentScore += getParsingFlags(tempConfig).charsLeftOver;
+
+ //or tokens
+ currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
+
+ getParsingFlags(tempConfig).score = currentScore;
+
+ if (scoreToBeat == null || currentScore < scoreToBeat) {
+ scoreToBeat = currentScore;
+ bestMoment = tempConfig;
+ }
+ }
+
+ extend(config, bestMoment || tempConfig);
+ }
+
+ function configFromObject(config) {
+ if (config._d) {
+ return;
+ }
+
+ var i = normalizeObjectUnits(config._i);
+ config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
+ return obj && parseInt(obj, 10);
+ });
+
+ configFromArray(config);
+ }
+
+ function createFromConfig (config) {
+ var res = new Moment(checkOverflow(prepareConfig(config)));
+ if (res._nextDay) {
+ // Adding is smart enough around DST
+ res.add(1, 'd');
+ res._nextDay = undefined;
+ }
+
+ return res;
+ }
+
+ function prepareConfig (config) {
+ var input = config._i,
+ format = config._f;
+
+ config._locale = config._locale || locale_locales__getLocale(config._l);
+
+ if (input === null || (format === undefined && input === '')) {
+ return valid__createInvalid({nullInput: true});
+ }
+
+ if (typeof input === 'string') {
+ config._i = input = config._locale.preparse(input);
+ }
+
+ if (isMoment(input)) {
+ return new Moment(checkOverflow(input));
+ } else if (isArray(format)) {
+ configFromStringAndArray(config);
+ } else if (format) {
+ configFromStringAndFormat(config);
+ } else if (isDate(input)) {
+ config._d = input;
+ } else {
+ configFromInput(config);
+ }
+
+ if (!valid__isValid(config)) {
+ config._d = null;
+ }
+
+ return config;
+ }
+
+ function configFromInput(config) {
+ var input = config._i;
+ if (input === undefined) {
+ config._d = new Date(utils_hooks__hooks.now());
+ } else if (isDate(input)) {
+ config._d = new Date(+input);
+ } else if (typeof input === 'string') {
+ configFromString(config);
+ } else if (isArray(input)) {
+ config._a = map(input.slice(0), function (obj) {
+ return parseInt(obj, 10);
+ });
+ configFromArray(config);
+ } else if (typeof(input) === 'object') {
+ configFromObject(config);
+ } else if (typeof(input) === 'number') {
+ // from milliseconds
+ config._d = new Date(input);
+ } else {
+ utils_hooks__hooks.createFromInputFallback(config);
+ }
+ }
+
+ function createLocalOrUTC (input, format, locale, strict, isUTC) {
+ var c = {};
+
+ if (typeof(locale) === 'boolean') {
+ strict = locale;
+ locale = undefined;
+ }
+ // object construction must be done this way.
+ // https://github.com/moment/moment/issues/1423
+ c._isAMomentObject = true;
+ c._useUTC = c._isUTC = isUTC;
+ c._l = locale;
+ c._i = input;
+ c._f = format;
+ c._strict = strict;
+
+ return createFromConfig(c);
+ }
+
+ function local__createLocal (input, format, locale, strict) {
+ return createLocalOrUTC(input, format, locale, strict, false);
+ }
+
+ var prototypeMin = deprecate(
+ 'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
+ function () {
+ var other = local__createLocal.apply(null, arguments);
+ if (this.isValid() && other.isValid()) {
+ return other < this ? this : other;
+ } else {
+ return valid__createInvalid();
+ }
+ }
+ );
+
+ var prototypeMax = deprecate(
+ 'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
+ function () {
+ var other = local__createLocal.apply(null, arguments);
+ if (this.isValid() && other.isValid()) {
+ return other > this ? this : other;
+ } else {
+ return valid__createInvalid();
+ }
+ }
+ );
+
+ // Pick a moment m from moments so that m[fn](other) is true for all
+ // other. This relies on the function fn to be transitive.
+ //
+ // moments should either be an array of moment objects or an array, whose
+ // first element is an array of moment objects.
+ function pickBy(fn, moments) {
+ var res, i;
+ if (moments.length === 1 && isArray(moments[0])) {
+ moments = moments[0];
+ }
+ if (!moments.length) {
+ return local__createLocal();
+ }
+ res = moments[0];
+ for (i = 1; i < moments.length; ++i) {
+ if (!moments[i].isValid() || moments[i][fn](res)) {
+ res = moments[i];
+ }
+ }
+ return res;
+ }
+
+ // TODO: Use [].sort instead?
+ function min () {
+ var args = [].slice.call(arguments, 0);
+
+ return pickBy('isBefore', args);
+ }
+
+ function max () {
+ var args = [].slice.call(arguments, 0);
+
+ return pickBy('isAfter', args);
+ }
+
+ var now = function () {
+ return Date.now ? Date.now() : +(new Date());
+ };
+
+ function Duration (duration) {
+ var normalizedInput = normalizeObjectUnits(duration),
+ years = normalizedInput.year || 0,
+ quarters = normalizedInput.quarter || 0,
+ months = normalizedInput.month || 0,
+ weeks = normalizedInput.week || 0,
+ days = normalizedInput.day || 0,
+ hours = normalizedInput.hour || 0,
+ minutes = normalizedInput.minute || 0,
+ seconds = normalizedInput.second || 0,
+ milliseconds = normalizedInput.millisecond || 0;
+
+ // representation for dateAddRemove
+ this._milliseconds = +milliseconds +
+ seconds * 1e3 + // 1000
+ minutes * 6e4 + // 1000 * 60
+ hours * 36e5; // 1000 * 60 * 60
+ // Because of dateAddRemove treats 24 hours as different from a
+ // day when working around DST, we need to store them separately
+ this._days = +days +
+ weeks * 7;
+ // It is impossible translate months into days without knowing
+ // which months you are are talking about, so we have to store
+ // it separately.
+ this._months = +months +
+ quarters * 3 +
+ years * 12;
+
+ this._data = {};
+
+ this._locale = locale_locales__getLocale();
+
+ this._bubble();
+ }
+
+ function isDuration (obj) {
+ return obj instanceof Duration;
+ }
+
+ // FORMATTING
+
+ function offset (token, separator) {
+ addFormatToken(token, 0, 0, function () {
+ var offset = this.utcOffset();
+ var sign = '+';
+ if (offset < 0) {
+ offset = -offset;
+ sign = '-';
+ }
+ return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
+ });
+ }
+
+ offset('Z', ':');
+ offset('ZZ', '');
+
+ // PARSING
+
+ addRegexToken('Z', matchShortOffset);
+ addRegexToken('ZZ', matchShortOffset);
+ addParseToken(['Z', 'ZZ'], function (input, array, config) {
+ config._useUTC = true;
+ config._tzm = offsetFromString(matchShortOffset, input);
+ });
+
+ // HELPERS
+
+ // timezone chunker
+ // '+10:00' > ['10', '00']
+ // '-1530' > ['-15', '30']
+ var chunkOffset = /([\+\-]|\d\d)/gi;
+
+ function offsetFromString(matcher, string) {
+ var matches = ((string || '').match(matcher) || []);
+ var chunk = matches[matches.length - 1] || [];
+ var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
+ var minutes = +(parts[1] * 60) + toInt(parts[2]);
+
+ return parts[0] === '+' ? minutes : -minutes;
+ }
+
+ // Return a moment from input, that is local/utc/zone equivalent to model.
+ function cloneWithOffset(input, model) {
+ var res, diff;
+ if (model._isUTC) {
+ res = model.clone();
+ diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);
+ // Use low-level api, because this fn is low-level api.
+ res._d.setTime(+res._d + diff);
+ utils_hooks__hooks.updateOffset(res, false);
+ return res;
+ } else {
+ return local__createLocal(input).local();
+ }
+ }
+
+ function getDateOffset (m) {
+ // On Firefox.24 Date#getTimezoneOffset returns a floating point.
+ // https://github.com/moment/moment/pull/1871
+ return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
+ }
+
+ // HOOKS
+
+ // This function will be called whenever a moment is mutated.
+ // It is intended to keep the offset in sync with the timezone.
+ utils_hooks__hooks.updateOffset = function () {};
+
+ // MOMENTS
+
+ // keepLocalTime = true means only change the timezone, without
+ // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
+ // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
+ // +0200, so we adjust the time as needed, to be valid.
+ //
+ // Keeping the time actually adds/subtracts (one hour)
+ // from the actual represented time. That is why we call updateOffset
+ // a second time. In case it wants us to change the offset again
+ // _changeInProgress == true case, then we have to adjust, because
+ // there is no such time in the given timezone.
+ function getSetOffset (input, keepLocalTime) {
+ var offset = this._offset || 0,
+ localAdjust;
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ if (input != null) {
+ if (typeof input === 'string') {
+ input = offsetFromString(matchShortOffset, input);
+ } else if (Math.abs(input) < 16) {
+ input = input * 60;
+ }
+ if (!this._isUTC && keepLocalTime) {
+ localAdjust = getDateOffset(this);
+ }
+ this._offset = input;
+ this._isUTC = true;
+ if (localAdjust != null) {
+ this.add(localAdjust, 'm');
+ }
+ if (offset !== input) {
+ if (!keepLocalTime || this._changeInProgress) {
+ add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
+ } else if (!this._changeInProgress) {
+ this._changeInProgress = true;
+ utils_hooks__hooks.updateOffset(this, true);
+ this._changeInProgress = null;
+ }
+ }
+ return this;
+ } else {
+ return this._isUTC ? offset : getDateOffset(this);
+ }
+ }
+
+ function getSetZone (input, keepLocalTime) {
+ if (input != null) {
+ if (typeof input !== 'string') {
+ input = -input;
+ }
+
+ this.utcOffset(input, keepLocalTime);
+
+ return this;
+ } else {
+ return -this.utcOffset();
+ }
+ }
+
+ function setOffsetToUTC (keepLocalTime) {
+ return this.utcOffset(0, keepLocalTime);
+ }
+
+ function setOffsetToLocal (keepLocalTime) {
+ if (this._isUTC) {
+ this.utcOffset(0, keepLocalTime);
+ this._isUTC = false;
+
+ if (keepLocalTime) {
+ this.subtract(getDateOffset(this), 'm');
+ }
+ }
+ return this;
+ }
+
+ function setOffsetToParsedOffset () {
+ if (this._tzm) {
+ this.utcOffset(this._tzm);
+ } else if (typeof this._i === 'string') {
+ this.utcOffset(offsetFromString(matchOffset, this._i));
+ }
+ return this;
+ }
+
+ function hasAlignedHourOffset (input) {
+ if (!this.isValid()) {
+ return false;
+ }
+ input = input ? local__createLocal(input).utcOffset() : 0;
+
+ return (this.utcOffset() - input) % 60 === 0;
+ }
+
+ function isDaylightSavingTime () {
+ return (
+ this.utcOffset() > this.clone().month(0).utcOffset() ||
+ this.utcOffset() > this.clone().month(5).utcOffset()
+ );
+ }
+
+ function isDaylightSavingTimeShifted () {
+ if (!isUndefined(this._isDSTShifted)) {
+ return this._isDSTShifted;
+ }
+
+ var c = {};
+
+ copyConfig(c, this);
+ c = prepareConfig(c);
+
+ if (c._a) {
+ var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a);
+ this._isDSTShifted = this.isValid() &&
+ compareArrays(c._a, other.toArray()) > 0;
+ } else {
+ this._isDSTShifted = false;
+ }
+
+ return this._isDSTShifted;
+ }
+
+ function isLocal () {
+ return this.isValid() ? !this._isUTC : false;
+ }
+
+ function isUtcOffset () {
+ return this.isValid() ? this._isUTC : false;
+ }
+
+ function isUtc () {
+ return this.isValid() ? this._isUTC && this._offset === 0 : false;
+ }
+
+ // ASP.NET json date format regex
+ var aspNetRegex = /(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/;
+
+ // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
+ // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
+ var isoRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;
+
+ function create__createDuration (input, key) {
+ var duration = input,
+ // matching against regexp is expensive, do it on demand
+ match = null,
+ sign,
+ ret,
+ diffRes;
+
+ if (isDuration(input)) {
+ duration = {
+ ms : input._milliseconds,
+ d : input._days,
+ M : input._months
+ };
+ } else if (typeof input === 'number') {
+ duration = {};
+ if (key) {
+ duration[key] = input;
+ } else {
+ duration.milliseconds = input;
+ }
+ } else if (!!(match = aspNetRegex.exec(input))) {
+ sign = (match[1] === '-') ? -1 : 1;
+ duration = {
+ y : 0,
+ d : toInt(match[DATE]) * sign,
+ h : toInt(match[HOUR]) * sign,
+ m : toInt(match[MINUTE]) * sign,
+ s : toInt(match[SECOND]) * sign,
+ ms : toInt(match[MILLISECOND]) * sign
+ };
+ } else if (!!(match = isoRegex.exec(input))) {
+ sign = (match[1] === '-') ? -1 : 1;
+ duration = {
+ y : parseIso(match[2], sign),
+ M : parseIso(match[3], sign),
+ d : parseIso(match[4], sign),
+ h : parseIso(match[5], sign),
+ m : parseIso(match[6], sign),
+ s : parseIso(match[7], sign),
+ w : parseIso(match[8], sign)
+ };
+ } else if (duration == null) {// checks for null or undefined
+ duration = {};
+ } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
+ diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to));
+
+ duration = {};
+ duration.ms = diffRes.milliseconds;
+ duration.M = diffRes.months;
+ }
+
+ ret = new Duration(duration);
+
+ if (isDuration(input) && hasOwnProp(input, '_locale')) {
+ ret._locale = input._locale;
+ }
+
+ return ret;
+ }
+
+ create__createDuration.fn = Duration.prototype;
+
+ function parseIso (inp, sign) {
+ // We'd normally use ~~inp for this, but unfortunately it also
+ // converts floats to ints.
+ // inp may be undefined, so careful calling replace on it.
+ var res = inp && parseFloat(inp.replace(',', '.'));
+ // apply sign while we're at it
+ return (isNaN(res) ? 0 : res) * sign;
+ }
+
+ function positiveMomentsDifference(base, other) {
+ var res = {milliseconds: 0, months: 0};
+
+ res.months = other.month() - base.month() +
+ (other.year() - base.year()) * 12;
+ if (base.clone().add(res.months, 'M').isAfter(other)) {
+ --res.months;
+ }
+
+ res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
+
+ return res;
+ }
+
+ function momentsDifference(base, other) {
+ var res;
+ if (!(base.isValid() && other.isValid())) {
+ return {milliseconds: 0, months: 0};
+ }
+
+ other = cloneWithOffset(other, base);
+ if (base.isBefore(other)) {
+ res = positiveMomentsDifference(base, other);
+ } else {
+ res = positiveMomentsDifference(other, base);
+ res.milliseconds = -res.milliseconds;
+ res.months = -res.months;
+ }
+
+ return res;
+ }
+
+ // TODO: remove 'name' arg after deprecation is removed
+ function createAdder(direction, name) {
+ return function (val, period) {
+ var dur, tmp;
+ //invert the arguments, but complain about it
+ if (period !== null && !isNaN(+period)) {
+ deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
+ tmp = val; val = period; period = tmp;
+ }
+
+ val = typeof val === 'string' ? +val : val;
+ dur = create__createDuration(val, period);
+ add_subtract__addSubtract(this, dur, direction);
+ return this;
+ };
+ }
+
+ function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) {
+ var milliseconds = duration._milliseconds,
+ days = duration._days,
+ months = duration._months;
+
+ if (!mom.isValid()) {
+ // No op
+ return;
+ }
+
+ updateOffset = updateOffset == null ? true : updateOffset;
+
+ if (milliseconds) {
+ mom._d.setTime(+mom._d + milliseconds * isAdding);
+ }
+ if (days) {
+ get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
+ }
+ if (months) {
+ setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
+ }
+ if (updateOffset) {
+ utils_hooks__hooks.updateOffset(mom, days || months);
+ }
+ }
+
+ var add_subtract__add = createAdder(1, 'add');
+ var add_subtract__subtract = createAdder(-1, 'subtract');
+
+ function moment_calendar__calendar (time, formats) {
+ // We want to compare the start of today, vs this.
+ // Getting start-of-today depends on whether we're local/utc/offset or not.
+ var now = time || local__createLocal(),
+ sod = cloneWithOffset(now, this).startOf('day'),
+ diff = this.diff(sod, 'days', true),
+ format = diff < -6 ? 'sameElse' :
+ diff < -1 ? 'lastWeek' :
+ diff < 0 ? 'lastDay' :
+ diff < 1 ? 'sameDay' :
+ diff < 2 ? 'nextDay' :
+ diff < 7 ? 'nextWeek' : 'sameElse';
+
+ var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]);
+
+ return this.format(output || this.localeData().calendar(format, this, local__createLocal(now)));
+ }
+
+ function clone () {
+ return new Moment(this);
+ }
+
+ function isAfter (input, units) {
+ var localInput = isMoment(input) ? input : local__createLocal(input);
+ if (!(this.isValid() && localInput.isValid())) {
+ return false;
+ }
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
+ if (units === 'millisecond') {
+ return +this > +localInput;
+ } else {
+ return +localInput < +this.clone().startOf(units);
+ }
+ }
+
+ function isBefore (input, units) {
+ var localInput = isMoment(input) ? input : local__createLocal(input);
+ if (!(this.isValid() && localInput.isValid())) {
+ return false;
+ }
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
+ if (units === 'millisecond') {
+ return +this < +localInput;
+ } else {
+ return +this.clone().endOf(units) < +localInput;
+ }
+ }
+
+ function isBetween (from, to, units) {
+ return this.isAfter(from, units) && this.isBefore(to, units);
+ }
+
+ function isSame (input, units) {
+ var localInput = isMoment(input) ? input : local__createLocal(input),
+ inputMs;
+ if (!(this.isValid() && localInput.isValid())) {
+ return false;
+ }
+ units = normalizeUnits(units || 'millisecond');
+ if (units === 'millisecond') {
+ return +this === +localInput;
+ } else {
+ inputMs = +localInput;
+ return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
+ }
+ }
+
+ function isSameOrAfter (input, units) {
+ return this.isSame(input, units) || this.isAfter(input,units);
+ }
+
+ function isSameOrBefore (input, units) {
+ return this.isSame(input, units) || this.isBefore(input,units);
+ }
+
+ function diff (input, units, asFloat) {
+ var that,
+ zoneDelta,
+ delta, output;
+
+ if (!this.isValid()) {
+ return NaN;
+ }
+
+ that = cloneWithOffset(input, this);
+
+ if (!that.isValid()) {
+ return NaN;
+ }
+
+ zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
+
+ units = normalizeUnits(units);
+
+ if (units === 'year' || units === 'month' || units === 'quarter') {
+ output = monthDiff(this, that);
+ if (units === 'quarter') {
+ output = output / 3;
+ } else if (units === 'year') {
+ output = output / 12;
+ }
+ } else {
+ delta = this - that;
+ output = units === 'second' ? delta / 1e3 : // 1000
+ units === 'minute' ? delta / 6e4 : // 1000 * 60
+ units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
+ units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
+ units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
+ delta;
+ }
+ return asFloat ? output : absFloor(output);
+ }
+
+ function monthDiff (a, b) {
+ // difference in months
+ var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
+ // b is in (anchor - 1 month, anchor + 1 month)
+ anchor = a.clone().add(wholeMonthDiff, 'months'),
+ anchor2, adjust;
+
+ if (b - anchor < 0) {
+ anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
+ // linear across the month
+ adjust = (b - anchor) / (anchor - anchor2);
+ } else {
+ anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
+ // linear across the month
+ adjust = (b - anchor) / (anchor2 - anchor);
+ }
+
+ return -(wholeMonthDiff + adjust);
+ }
+
+ utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
+
+ function toString () {
+ return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
+ }
+
+ function moment_format__toISOString () {
+ var m = this.clone().utc();
+ if (0 < m.year() && m.year() <= 9999) {
+ if (isFunction(Date.prototype.toISOString)) {
+ // native implementation is ~50x faster, use it when we can
+ return this.toDate().toISOString();
+ } else {
+ return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+ }
+ } else {
+ return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+ }
+ }
+
+ function moment_format__format (inputString) {
+ var output = formatMoment(this, inputString || utils_hooks__hooks.defaultFormat);
+ return this.localeData().postformat(output);
+ }
+
+ function from (time, withoutSuffix) {
+ if (this.isValid() &&
+ ((isMoment(time) && time.isValid()) ||
+ local__createLocal(time).isValid())) {
+ return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
+ } else {
+ return this.localeData().invalidDate();
+ }
+ }
+
+ function fromNow (withoutSuffix) {
+ return this.from(local__createLocal(), withoutSuffix);
+ }
+
+ function to (time, withoutSuffix) {
+ if (this.isValid() &&
+ ((isMoment(time) && time.isValid()) ||
+ local__createLocal(time).isValid())) {
+ return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
+ } else {
+ return this.localeData().invalidDate();
+ }
+ }
+
+ function toNow (withoutSuffix) {
+ return this.to(local__createLocal(), withoutSuffix);
+ }
+
+ // If passed a locale key, it will set the locale for this
+ // instance. Otherwise, it will return the locale configuration
+ // variables for this instance.
+ function locale (key) {
+ var newLocaleData;
+
+ if (key === undefined) {
+ return this._locale._abbr;
+ } else {
+ newLocaleData = locale_locales__getLocale(key);
+ if (newLocaleData != null) {
+ this._locale = newLocaleData;
+ }
+ return this;
+ }
+ }
+
+ var lang = deprecate(
+ 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
+ function (key) {
+ if (key === undefined) {
+ return this.localeData();
+ } else {
+ return this.locale(key);
+ }
+ }
+ );
+
+ function localeData () {
+ return this._locale;
+ }
+
+ function startOf (units) {
+ units = normalizeUnits(units);
+ // the following switch intentionally omits break keywords
+ // to utilize falling through the cases.
+ switch (units) {
+ case 'year':
+ this.month(0);
+ /* falls through */
+ case 'quarter':
+ case 'month':
+ this.date(1);
+ /* falls through */
+ case 'week':
+ case 'isoWeek':
+ case 'day':
+ this.hours(0);
+ /* falls through */
+ case 'hour':
+ this.minutes(0);
+ /* falls through */
+ case 'minute':
+ this.seconds(0);
+ /* falls through */
+ case 'second':
+ this.milliseconds(0);
+ }
+
+ // weeks are a special case
+ if (units === 'week') {
+ this.weekday(0);
+ }
+ if (units === 'isoWeek') {
+ this.isoWeekday(1);
+ }
+
+ // quarters are also special
+ if (units === 'quarter') {
+ this.month(Math.floor(this.month() / 3) * 3);
+ }
+
+ return this;
+ }
+
+ function endOf (units) {
+ units = normalizeUnits(units);
+ if (units === undefined || units === 'millisecond') {
+ return this;
+ }
+ return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
+ }
+
+ function to_type__valueOf () {
+ return +this._d - ((this._offset || 0) * 60000);
+ }
+
+ function unix () {
+ return Math.floor(+this / 1000);
+ }
+
+ function toDate () {
+ return this._offset ? new Date(+this) : this._d;
+ }
+
+ function toArray () {
+ var m = this;
+ return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
+ }
+
+ function toObject () {
+ var m = this;
+ return {
+ years: m.year(),
+ months: m.month(),
+ date: m.date(),
+ hours: m.hours(),
+ minutes: m.minutes(),
+ seconds: m.seconds(),
+ milliseconds: m.milliseconds()
+ };
+ }
+
+ function toJSON () {
+ // JSON.stringify(new Date(NaN)) === 'null'
+ return this.isValid() ? this.toISOString() : 'null';
+ }
+
+ function moment_valid__isValid () {
+ return valid__isValid(this);
+ }
+
+ function parsingFlags () {
+ return extend({}, getParsingFlags(this));
+ }
+
+ function invalidAt () {
+ return getParsingFlags(this).overflow;
+ }
+
+ function creationData() {
+ return {
+ input: this._i,
+ format: this._f,
+ locale: this._locale,
+ isUTC: this._isUTC,
+ strict: this._strict
+ };
+ }
+
+ // FORMATTING
+
+ addFormatToken(0, ['gg', 2], 0, function () {
+ return this.weekYear() % 100;
+ });
+
+ addFormatToken(0, ['GG', 2], 0, function () {
+ return this.isoWeekYear() % 100;
+ });
+
+ function addWeekYearFormatToken (token, getter) {
+ addFormatToken(0, [token, token.length], 0, getter);
+ }
+
+ addWeekYearFormatToken('gggg', 'weekYear');
+ addWeekYearFormatToken('ggggg', 'weekYear');
+ addWeekYearFormatToken('GGGG', 'isoWeekYear');
+ addWeekYearFormatToken('GGGGG', 'isoWeekYear');
+
+ // ALIASES
+
+ addUnitAlias('weekYear', 'gg');
+ addUnitAlias('isoWeekYear', 'GG');
+
+ // PARSING
+
+ addRegexToken('G', matchSigned);
+ addRegexToken('g', matchSigned);
+ addRegexToken('GG', match1to2, match2);
+ addRegexToken('gg', match1to2, match2);
+ addRegexToken('GGGG', match1to4, match4);
+ addRegexToken('gggg', match1to4, match4);
+ addRegexToken('GGGGG', match1to6, match6);
+ addRegexToken('ggggg', match1to6, match6);
+
+ addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
+ week[token.substr(0, 2)] = toInt(input);
+ });
+
+ addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
+ week[token] = utils_hooks__hooks.parseTwoDigitYear(input);
+ });
+
+ // MOMENTS
+
+ function getSetWeekYear (input) {
+ return getSetWeekYearHelper.call(this,
+ input,
+ this.week(),
+ this.weekday(),
+ this.localeData()._week.dow,
+ this.localeData()._week.doy);
+ }
+
+ function getSetISOWeekYear (input) {
+ return getSetWeekYearHelper.call(this,
+ input, this.isoWeek(), this.isoWeekday(), 1, 4);
+ }
+
+ function getISOWeeksInYear () {
+ return weeksInYear(this.year(), 1, 4);
+ }
+
+ function getWeeksInYear () {
+ var weekInfo = this.localeData()._week;
+ return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
+ }
+
+ function getSetWeekYearHelper(input, week, weekday, dow, doy) {
+ var weeksTarget;
+ if (input == null) {
+ return weekOfYear(this, dow, doy).year;
+ } else {
+ weeksTarget = weeksInYear(input, dow, doy);
+ if (week > weeksTarget) {
+ week = weeksTarget;
+ }
+ return setWeekAll.call(this, input, week, weekday, dow, doy);
+ }
+ }
+
+ function setWeekAll(weekYear, week, weekday, dow, doy) {
+ var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
+ date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
+
+ // console.log("got", weekYear, week, weekday, "set", date.toISOString());
+ this.year(date.getUTCFullYear());
+ this.month(date.getUTCMonth());
+ this.date(date.getUTCDate());
+ return this;
+ }
+
+ // FORMATTING
+
+ addFormatToken('Q', 0, 'Qo', 'quarter');
+
+ // ALIASES
+
+ addUnitAlias('quarter', 'Q');
+
+ // PARSING
+
+ addRegexToken('Q', match1);
+ addParseToken('Q', function (input, array) {
+ array[MONTH] = (toInt(input) - 1) * 3;
+ });
+
+ // MOMENTS
+
+ function getSetQuarter (input) {
+ return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
+ }
+
+ // FORMATTING
+
+ addFormatToken('w', ['ww', 2], 'wo', 'week');
+ addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
+
+ // ALIASES
+
+ addUnitAlias('week', 'w');
+ addUnitAlias('isoWeek', 'W');
+
+ // PARSING
+
+ addRegexToken('w', match1to2);
+ addRegexToken('ww', match1to2, match2);
+ addRegexToken('W', match1to2);
+ addRegexToken('WW', match1to2, match2);
+
+ addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
+ week[token.substr(0, 1)] = toInt(input);
+ });
+
+ // HELPERS
+
+ // LOCALES
+
+ function localeWeek (mom) {
+ return weekOfYear(mom, this._week.dow, this._week.doy).week;
+ }
+
+ var defaultLocaleWeek = {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ };
+
+ function localeFirstDayOfWeek () {
+ return this._week.dow;
+ }
+
+ function localeFirstDayOfYear () {
+ return this._week.doy;
+ }
+
+ // MOMENTS
+
+ function getSetWeek (input) {
+ var week = this.localeData().week(this);
+ return input == null ? week : this.add((input - week) * 7, 'd');
+ }
+
+ function getSetISOWeek (input) {
+ var week = weekOfYear(this, 1, 4).week;
+ return input == null ? week : this.add((input - week) * 7, 'd');
+ }
+
+ // FORMATTING
+
+ addFormatToken('D', ['DD', 2], 'Do', 'date');
+
+ // ALIASES
+
+ addUnitAlias('date', 'D');
+
+ // PARSING
+
+ addRegexToken('D', match1to2);
+ addRegexToken('DD', match1to2, match2);
+ addRegexToken('Do', function (isStrict, locale) {
+ return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
+ });
+
+ addParseToken(['D', 'DD'], DATE);
+ addParseToken('Do', function (input, array) {
+ array[DATE] = toInt(input.match(match1to2)[0], 10);
+ });
+
+ // MOMENTS
+
+ var getSetDayOfMonth = makeGetSet('Date', true);
+
+ // FORMATTING
+
+ addFormatToken('d', 0, 'do', 'day');
+
+ addFormatToken('dd', 0, 0, function (format) {
+ return this.localeData().weekdaysMin(this, format);
+ });
+
+ addFormatToken('ddd', 0, 0, function (format) {
+ return this.localeData().weekdaysShort(this, format);
+ });
+
+ addFormatToken('dddd', 0, 0, function (format) {
+ return this.localeData().weekdays(this, format);
+ });
+
+ addFormatToken('e', 0, 0, 'weekday');
+ addFormatToken('E', 0, 0, 'isoWeekday');
+
+ // ALIASES
+
+ addUnitAlias('day', 'd');
+ addUnitAlias('weekday', 'e');
+ addUnitAlias('isoWeekday', 'E');
+
+ // PARSING
+
+ addRegexToken('d', match1to2);
+ addRegexToken('e', match1to2);
+ addRegexToken('E', match1to2);
+ addRegexToken('dd', matchWord);
+ addRegexToken('ddd', matchWord);
+ addRegexToken('dddd', matchWord);
+
+ addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
+ var weekday = config._locale.weekdaysParse(input, token, config._strict);
+ // if we didn't get a weekday name, mark the date as invalid
+ if (weekday != null) {
+ week.d = weekday;
+ } else {
+ getParsingFlags(config).invalidWeekday = input;
+ }
+ });
+
+ addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
+ week[token] = toInt(input);
+ });
+
+ // HELPERS
+
+ function parseWeekday(input, locale) {
+ if (typeof input !== 'string') {
+ return input;
+ }
+
+ if (!isNaN(input)) {
+ return parseInt(input, 10);
+ }
+
+ input = locale.weekdaysParse(input);
+ if (typeof input === 'number') {
+ return input;
+ }
+
+ return null;
+ }
+
+ // LOCALES
+
+ var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
+ function localeWeekdays (m, format) {
+ return isArray(this._weekdays) ? this._weekdays[m.day()] :
+ this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
+ }
+
+ var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
+ function localeWeekdaysShort (m) {
+ return this._weekdaysShort[m.day()];
+ }
+
+ var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
+ function localeWeekdaysMin (m) {
+ return this._weekdaysMin[m.day()];
+ }
+
+ function localeWeekdaysParse (weekdayName, format, strict) {
+ var i, mom, regex;
+
+ if (!this._weekdaysParse) {
+ this._weekdaysParse = [];
+ this._minWeekdaysParse = [];
+ this._shortWeekdaysParse = [];
+ this._fullWeekdaysParse = [];
+ }
+
+ for (i = 0; i < 7; i++) {
+ // make the regex if we don't have it already
+
+ mom = local__createLocal([2000, 1]).day(i);
+ if (strict && !this._fullWeekdaysParse[i]) {
+ this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
+ this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
+ this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
+ }
+ if (!this._weekdaysParse[i]) {
+ regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
+ this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
+ }
+ // test the regex
+ if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
+ return i;
+ } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
+ return i;
+ } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
+ return i;
+ } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
+ return i;
+ }
+ }
+ }
+
+ // MOMENTS
+
+ function getSetDayOfWeek (input) {
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
+ if (input != null) {
+ input = parseWeekday(input, this.localeData());
+ return this.add(input - day, 'd');
+ } else {
+ return day;
+ }
+ }
+
+ function getSetLocaleDayOfWeek (input) {
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
+ return input == null ? weekday : this.add(input - weekday, 'd');
+ }
+
+ function getSetISODayOfWeek (input) {
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ // behaves the same as moment#day except
+ // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
+ // as a setter, sunday should belong to the previous week.
+ return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
+ }
+
+ // FORMATTING
+
+ addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
+
+ // ALIASES
+
+ addUnitAlias('dayOfYear', 'DDD');
+
+ // PARSING
+
+ addRegexToken('DDD', match1to3);
+ addRegexToken('DDDD', match3);
+ addParseToken(['DDD', 'DDDD'], function (input, array, config) {
+ config._dayOfYear = toInt(input);
+ });
+
+ // HELPERS
+
+ // MOMENTS
+
+ function getSetDayOfYear (input) {
+ var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
+ return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
+ }
+
+ // FORMATTING
+
+ function hFormat() {
+ return this.hours() % 12 || 12;
+ }
+
+ addFormatToken('H', ['HH', 2], 0, 'hour');
+ addFormatToken('h', ['hh', 2], 0, hFormat);
+
+ addFormatToken('hmm', 0, 0, function () {
+ return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
+ });
+
+ addFormatToken('hmmss', 0, 0, function () {
+ return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
+ zeroFill(this.seconds(), 2);
+ });
+
+ addFormatToken('Hmm', 0, 0, function () {
+ return '' + this.hours() + zeroFill(this.minutes(), 2);
+ });
+
+ addFormatToken('Hmmss', 0, 0, function () {
+ return '' + this.hours() + zeroFill(this.minutes(), 2) +
+ zeroFill(this.seconds(), 2);
+ });
+
+ function meridiem (token, lowercase) {
+ addFormatToken(token, 0, 0, function () {
+ return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
+ });
+ }
+
+ meridiem('a', true);
+ meridiem('A', false);
+
+ // ALIASES
+
+ addUnitAlias('hour', 'h');
+
+ // PARSING
+
+ function matchMeridiem (isStrict, locale) {
+ return locale._meridiemParse;
+ }
+
+ addRegexToken('a', matchMeridiem);
+ addRegexToken('A', matchMeridiem);
+ addRegexToken('H', match1to2);
+ addRegexToken('h', match1to2);
+ addRegexToken('HH', match1to2, match2);
+ addRegexToken('hh', match1to2, match2);
+
+ addRegexToken('hmm', match3to4);
+ addRegexToken('hmmss', match5to6);
+ addRegexToken('Hmm', match3to4);
+ addRegexToken('Hmmss', match5to6);
+
+ addParseToken(['H', 'HH'], HOUR);
+ addParseToken(['a', 'A'], function (input, array, config) {
+ config._isPm = config._locale.isPM(input);
+ config._meridiem = input;
+ });
+ addParseToken(['h', 'hh'], function (input, array, config) {
+ array[HOUR] = toInt(input);
+ getParsingFlags(config).bigHour = true;
+ });
+ addParseToken('hmm', function (input, array, config) {
+ var pos = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos));
+ array[MINUTE] = toInt(input.substr(pos));
+ getParsingFlags(config).bigHour = true;
+ });
+ addParseToken('hmmss', function (input, array, config) {
+ var pos1 = input.length - 4;
+ var pos2 = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos1));
+ array[MINUTE] = toInt(input.substr(pos1, 2));
+ array[SECOND] = toInt(input.substr(pos2));
+ getParsingFlags(config).bigHour = true;
+ });
+ addParseToken('Hmm', function (input, array, config) {
+ var pos = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos));
+ array[MINUTE] = toInt(input.substr(pos));
+ });
+ addParseToken('Hmmss', function (input, array, config) {
+ var pos1 = input.length - 4;
+ var pos2 = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos1));
+ array[MINUTE] = toInt(input.substr(pos1, 2));
+ array[SECOND] = toInt(input.substr(pos2));
+ });
+
+ // LOCALES
+
+ function localeIsPM (input) {
+ // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
+ // Using charAt should be more compatible.
+ return ((input + '').toLowerCase().charAt(0) === 'p');
+ }
+
+ var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
+ function localeMeridiem (hours, minutes, isLower) {
+ if (hours > 11) {
+ return isLower ? 'pm' : 'PM';
+ } else {
+ return isLower ? 'am' : 'AM';
+ }
+ }
+
+
+ // MOMENTS
+
+ // Setting the hour should keep the time, because the user explicitly
+ // specified which hour he wants. So trying to maintain the same hour (in
+ // a new timezone) makes sense. Adding/subtracting hours does not follow
+ // this rule.
+ var getSetHour = makeGetSet('Hours', true);
+
+ // FORMATTING
+
+ addFormatToken('m', ['mm', 2], 0, 'minute');
+
+ // ALIASES
+
+ addUnitAlias('minute', 'm');
+
+ // PARSING
+
+ addRegexToken('m', match1to2);
+ addRegexToken('mm', match1to2, match2);
+ addParseToken(['m', 'mm'], MINUTE);
+
+ // MOMENTS
+
+ var getSetMinute = makeGetSet('Minutes', false);
+
+ // FORMATTING
+
+ addFormatToken('s', ['ss', 2], 0, 'second');
+
+ // ALIASES
+
+ addUnitAlias('second', 's');
+
+ // PARSING
+
+ addRegexToken('s', match1to2);
+ addRegexToken('ss', match1to2, match2);
+ addParseToken(['s', 'ss'], SECOND);
+
+ // MOMENTS
+
+ var getSetSecond = makeGetSet('Seconds', false);
+
+ // FORMATTING
+
+ addFormatToken('S', 0, 0, function () {
+ return ~~(this.millisecond() / 100);
+ });
+
+ addFormatToken(0, ['SS', 2], 0, function () {
+ return ~~(this.millisecond() / 10);
+ });
+
+ addFormatToken(0, ['SSS', 3], 0, 'millisecond');
+ addFormatToken(0, ['SSSS', 4], 0, function () {
+ return this.millisecond() * 10;
+ });
+ addFormatToken(0, ['SSSSS', 5], 0, function () {
+ return this.millisecond() * 100;
+ });
+ addFormatToken(0, ['SSSSSS', 6], 0, function () {
+ return this.millisecond() * 1000;
+ });
+ addFormatToken(0, ['SSSSSSS', 7], 0, function () {
+ return this.millisecond() * 10000;
+ });
+ addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
+ return this.millisecond() * 100000;
+ });
+ addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
+ return this.millisecond() * 1000000;
+ });
+
+
+ // ALIASES
+
+ addUnitAlias('millisecond', 'ms');
+
+ // PARSING
+
+ addRegexToken('S', match1to3, match1);
+ addRegexToken('SS', match1to3, match2);
+ addRegexToken('SSS', match1to3, match3);
+
+ var token;
+ for (token = 'SSSS'; token.length <= 9; token += 'S') {
+ addRegexToken(token, matchUnsigned);
+ }
+
+ function parseMs(input, array) {
+ array[MILLISECOND] = toInt(('0.' + input) * 1000);
+ }
+
+ for (token = 'S'; token.length <= 9; token += 'S') {
+ addParseToken(token, parseMs);
+ }
+ // MOMENTS
+
+ var getSetMillisecond = makeGetSet('Milliseconds', false);
+
+ // FORMATTING
+
+ addFormatToken('z', 0, 0, 'zoneAbbr');
+ addFormatToken('zz', 0, 0, 'zoneName');
+
+ // MOMENTS
+
+ function getZoneAbbr () {
+ return this._isUTC ? 'UTC' : '';
+ }
+
+ function getZoneName () {
+ return this._isUTC ? 'Coordinated Universal Time' : '';
+ }
+
+ var momentPrototype__proto = Moment.prototype;
+
+ momentPrototype__proto.add = add_subtract__add;
+ momentPrototype__proto.calendar = moment_calendar__calendar;
+ momentPrototype__proto.clone = clone;
+ momentPrototype__proto.diff = diff;
+ momentPrototype__proto.endOf = endOf;
+ momentPrototype__proto.format = moment_format__format;
+ momentPrototype__proto.from = from;
+ momentPrototype__proto.fromNow = fromNow;
+ momentPrototype__proto.to = to;
+ momentPrototype__proto.toNow = toNow;
+ momentPrototype__proto.get = getSet;
+ momentPrototype__proto.invalidAt = invalidAt;
+ momentPrototype__proto.isAfter = isAfter;
+ momentPrototype__proto.isBefore = isBefore;
+ momentPrototype__proto.isBetween = isBetween;
+ momentPrototype__proto.isSame = isSame;
+ momentPrototype__proto.isSameOrAfter = isSameOrAfter;
+ momentPrototype__proto.isSameOrBefore = isSameOrBefore;
+ momentPrototype__proto.isValid = moment_valid__isValid;
+ momentPrototype__proto.lang = lang;
+ momentPrototype__proto.locale = locale;
+ momentPrototype__proto.localeData = localeData;
+ momentPrototype__proto.max = prototypeMax;
+ momentPrototype__proto.min = prototypeMin;
+ momentPrototype__proto.parsingFlags = parsingFlags;
+ momentPrototype__proto.set = getSet;
+ momentPrototype__proto.startOf = startOf;
+ momentPrototype__proto.subtract = add_subtract__subtract;
+ momentPrototype__proto.toArray = toArray;
+ momentPrototype__proto.toObject = toObject;
+ momentPrototype__proto.toDate = toDate;
+ momentPrototype__proto.toISOString = moment_format__toISOString;
+ momentPrototype__proto.toJSON = toJSON;
+ momentPrototype__proto.toString = toString;
+ momentPrototype__proto.unix = unix;
+ momentPrototype__proto.valueOf = to_type__valueOf;
+ momentPrototype__proto.creationData = creationData;
+
+ // Year
+ momentPrototype__proto.year = getSetYear;
+ momentPrototype__proto.isLeapYear = getIsLeapYear;
+
+ // Week Year
+ momentPrototype__proto.weekYear = getSetWeekYear;
+ momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
+
+ // Quarter
+ momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
+
+ // Month
+ momentPrototype__proto.month = getSetMonth;
+ momentPrototype__proto.daysInMonth = getDaysInMonth;
+
+ // Week
+ momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek;
+ momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek;
+ momentPrototype__proto.weeksInYear = getWeeksInYear;
+ momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
+
+ // Day
+ momentPrototype__proto.date = getSetDayOfMonth;
+ momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek;
+ momentPrototype__proto.weekday = getSetLocaleDayOfWeek;
+ momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
+ momentPrototype__proto.dayOfYear = getSetDayOfYear;
+
+ // Hour
+ momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
+
+ // Minute
+ momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
+
+ // Second
+ momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
+
+ // Millisecond
+ momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
+
+ // Offset
+ momentPrototype__proto.utcOffset = getSetOffset;
+ momentPrototype__proto.utc = setOffsetToUTC;
+ momentPrototype__proto.local = setOffsetToLocal;
+ momentPrototype__proto.parseZone = setOffsetToParsedOffset;
+ momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
+ momentPrototype__proto.isDST = isDaylightSavingTime;
+ momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted;
+ momentPrototype__proto.isLocal = isLocal;
+ momentPrototype__proto.isUtcOffset = isUtcOffset;
+ momentPrototype__proto.isUtc = isUtc;
+ momentPrototype__proto.isUTC = isUtc;
+
+ // Timezone
+ momentPrototype__proto.zoneAbbr = getZoneAbbr;
+ momentPrototype__proto.zoneName = getZoneName;
+
+ // Deprecations
+ momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
+ momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
+ momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
+ momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone);
+
+ var momentPrototype = momentPrototype__proto;
+
+ function moment_moment__createUnix (input) {
+ return local__createLocal(input * 1000);
+ }
+
+ function moment_moment__createInZone () {
+ return local__createLocal.apply(null, arguments).parseZone();
+ }
+
+ var defaultCalendar = {
+ sameDay : '[Today at] LT',
+ nextDay : '[Tomorrow at] LT',
+ nextWeek : 'dddd [at] LT',
+ lastDay : '[Yesterday at] LT',
+ lastWeek : '[Last] dddd [at] LT',
+ sameElse : 'L'
+ };
+
+ function locale_calendar__calendar (key, mom, now) {
+ var output = this._calendar[key];
+ return isFunction(output) ? output.call(mom, now) : output;
+ }
+
+ var defaultLongDateFormat = {
+ LTS : 'h:mm:ss A',
+ LT : 'h:mm A',
+ L : 'MM/DD/YYYY',
+ LL : 'MMMM D, YYYY',
+ LLL : 'MMMM D, YYYY h:mm A',
+ LLLL : 'dddd, MMMM D, YYYY h:mm A'
+ };
+
+ function longDateFormat (key) {
+ var format = this._longDateFormat[key],
+ formatUpper = this._longDateFormat[key.toUpperCase()];
+
+ if (format || !formatUpper) {
+ return format;
+ }
+
+ this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
+ return val.slice(1);
+ });
+
+ return this._longDateFormat[key];
+ }
+
+ var defaultInvalidDate = 'Invalid date';
+
+ function invalidDate () {
+ return this._invalidDate;
+ }
+
+ var defaultOrdinal = '%d';
+ var defaultOrdinalParse = /\d{1,2}/;
+
+ function ordinal (number) {
+ return this._ordinal.replace('%d', number);
+ }
+
+ function preParsePostFormat (string) {
+ return string;
+ }
+
+ var defaultRelativeTime = {
+ future : 'in %s',
+ past : '%s ago',
+ s : 'a few seconds',
+ m : 'a minute',
+ mm : '%d minutes',
+ h : 'an hour',
+ hh : '%d hours',
+ d : 'a day',
+ dd : '%d days',
+ M : 'a month',
+ MM : '%d months',
+ y : 'a year',
+ yy : '%d years'
+ };
+
+ function relative__relativeTime (number, withoutSuffix, string, isFuture) {
+ var output = this._relativeTime[string];
+ return (isFunction(output)) ?
+ output(number, withoutSuffix, string, isFuture) :
+ output.replace(/%d/i, number);
+ }
+
+ function pastFuture (diff, output) {
+ var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
+ return isFunction(format) ? format(output) : format.replace(/%s/i, output);
+ }
+
+ function locale_set__set (config) {
+ var prop, i;
+ for (i in config) {
+ prop = config[i];
+ if (isFunction(prop)) {
+ this[i] = prop;
+ } else {
+ this['_' + i] = prop;
+ }
+ }
+ // Lenient ordinal parsing accepts just a number in addition to
+ // number + (possibly) stuff coming from _ordinalParseLenient.
+ this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
+ }
+
+ var prototype__proto = Locale.prototype;
+
+ prototype__proto._calendar = defaultCalendar;
+ prototype__proto.calendar = locale_calendar__calendar;
+ prototype__proto._longDateFormat = defaultLongDateFormat;
+ prototype__proto.longDateFormat = longDateFormat;
+ prototype__proto._invalidDate = defaultInvalidDate;
+ prototype__proto.invalidDate = invalidDate;
+ prototype__proto._ordinal = defaultOrdinal;
+ prototype__proto.ordinal = ordinal;
+ prototype__proto._ordinalParse = defaultOrdinalParse;
+ prototype__proto.preparse = preParsePostFormat;
+ prototype__proto.postformat = preParsePostFormat;
+ prototype__proto._relativeTime = defaultRelativeTime;
+ prototype__proto.relativeTime = relative__relativeTime;
+ prototype__proto.pastFuture = pastFuture;
+ prototype__proto.set = locale_set__set;
+
+ // Month
+ prototype__proto.months = localeMonths;
+ prototype__proto._months = defaultLocaleMonths;
+ prototype__proto.monthsShort = localeMonthsShort;
+ prototype__proto._monthsShort = defaultLocaleMonthsShort;
+ prototype__proto.monthsParse = localeMonthsParse;
+ prototype__proto._monthsRegex = defaultMonthsRegex;
+ prototype__proto.monthsRegex = monthsRegex;
+ prototype__proto._monthsShortRegex = defaultMonthsShortRegex;
+ prototype__proto.monthsShortRegex = monthsShortRegex;
+
+ // Week
+ prototype__proto.week = localeWeek;
+ prototype__proto._week = defaultLocaleWeek;
+ prototype__proto.firstDayOfYear = localeFirstDayOfYear;
+ prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
+
+ // Day of Week
+ prototype__proto.weekdays = localeWeekdays;
+ prototype__proto._weekdays = defaultLocaleWeekdays;
+ prototype__proto.weekdaysMin = localeWeekdaysMin;
+ prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin;
+ prototype__proto.weekdaysShort = localeWeekdaysShort;
+ prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort;
+ prototype__proto.weekdaysParse = localeWeekdaysParse;
+
+ // Hours
+ prototype__proto.isPM = localeIsPM;
+ prototype__proto._meridiemParse = defaultLocaleMeridiemParse;
+ prototype__proto.meridiem = localeMeridiem;
+
+ function lists__get (format, index, field, setter) {
+ var locale = locale_locales__getLocale();
+ var utc = create_utc__createUTC().set(setter, index);
+ return locale[field](utc, format);
+ }
+
+ function list (format, index, field, count, setter) {
+ if (typeof format === 'number') {
+ index = format;
+ format = undefined;
+ }
+
+ format = format || '';
+
+ if (index != null) {
+ return lists__get(format, index, field, setter);
+ }
+
+ var i;
+ var out = [];
+ for (i = 0; i < count; i++) {
+ out[i] = lists__get(format, i, field, setter);
+ }
+ return out;
+ }
+
+ function lists__listMonths (format, index) {
+ return list(format, index, 'months', 12, 'month');
+ }
+
+ function lists__listMonthsShort (format, index) {
+ return list(format, index, 'monthsShort', 12, 'month');
+ }
+
+ function lists__listWeekdays (format, index) {
+ return list(format, index, 'weekdays', 7, 'day');
+ }
+
+ function lists__listWeekdaysShort (format, index) {
+ return list(format, index, 'weekdaysShort', 7, 'day');
+ }
+
+ function lists__listWeekdaysMin (format, index) {
+ return list(format, index, 'weekdaysMin', 7, 'day');
+ }
+
+ locale_locales__getSetGlobalLocale('en', {
+ ordinalParse: /\d{1,2}(th|st|nd|rd)/,
+ ordinal : function (number) {
+ var b = number % 10,
+ output = (toInt(number % 100 / 10) === 1) ? 'th' :
+ (b === 1) ? 'st' :
+ (b === 2) ? 'nd' :
+ (b === 3) ? 'rd' : 'th';
+ return number + output;
+ }
+ });
+
+ // Side effect imports
+ utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
+ utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
+
+ var mathAbs = Math.abs;
+
+ function duration_abs__abs () {
+ var data = this._data;
+
+ this._milliseconds = mathAbs(this._milliseconds);
+ this._days = mathAbs(this._days);
+ this._months = mathAbs(this._months);
+
+ data.milliseconds = mathAbs(data.milliseconds);
+ data.seconds = mathAbs(data.seconds);
+ data.minutes = mathAbs(data.minutes);
+ data.hours = mathAbs(data.hours);
+ data.months = mathAbs(data.months);
+ data.years = mathAbs(data.years);
+
+ return this;
+ }
+
+ function duration_add_subtract__addSubtract (duration, input, value, direction) {
+ var other = create__createDuration(input, value);
+
+ duration._milliseconds += direction * other._milliseconds;
+ duration._days += direction * other._days;
+ duration._months += direction * other._months;
+
+ return duration._bubble();
+ }
+
+ // supports only 2.0-style add(1, 's') or add(duration)
+ function duration_add_subtract__add (input, value) {
+ return duration_add_subtract__addSubtract(this, input, value, 1);
+ }
+
+ // supports only 2.0-style subtract(1, 's') or subtract(duration)
+ function duration_add_subtract__subtract (input, value) {
+ return duration_add_subtract__addSubtract(this, input, value, -1);
+ }
+
+ function absCeil (number) {
+ if (number < 0) {
+ return Math.floor(number);
+ } else {
+ return Math.ceil(number);
+ }
+ }
+
+ function bubble () {
+ var milliseconds = this._milliseconds;
+ var days = this._days;
+ var months = this._months;
+ var data = this._data;
+ var seconds, minutes, hours, years, monthsFromDays;
+
+ // if we have a mix of positive and negative values, bubble down first
+ // check: https://github.com/moment/moment/issues/2166
+ if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
+ (milliseconds <= 0 && days <= 0 && months <= 0))) {
+ milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
+ days = 0;
+ months = 0;
+ }
+
+ // The following code bubbles up values, see the tests for
+ // examples of what that means.
+ data.milliseconds = milliseconds % 1000;
+
+ seconds = absFloor(milliseconds / 1000);
+ data.seconds = seconds % 60;
+
+ minutes = absFloor(seconds / 60);
+ data.minutes = minutes % 60;
+
+ hours = absFloor(minutes / 60);
+ data.hours = hours % 24;
+
+ days += absFloor(hours / 24);
+
+ // convert days to months
+ monthsFromDays = absFloor(daysToMonths(days));
+ months += monthsFromDays;
+ days -= absCeil(monthsToDays(monthsFromDays));
+
+ // 12 months -> 1 year
+ years = absFloor(months / 12);
+ months %= 12;
+
+ data.days = days;
+ data.months = months;
+ data.years = years;
+
+ return this;
+ }
+
+ function daysToMonths (days) {
+ // 400 years have 146097 days (taking into account leap year rules)
+ // 400 years have 12 months === 4800
+ return days * 4800 / 146097;
+ }
+
+ function monthsToDays (months) {
+ // the reverse of daysToMonths
+ return months * 146097 / 4800;
+ }
+
+ function as (units) {
+ var days;
+ var months;
+ var milliseconds = this._milliseconds;
+
+ units = normalizeUnits(units);
+
+ if (units === 'month' || units === 'year') {
+ days = this._days + milliseconds / 864e5;
+ months = this._months + daysToMonths(days);
+ return units === 'month' ? months : months / 12;
+ } else {
+ // handle milliseconds separately because of floating point math errors (issue #1867)
+ days = this._days + Math.round(monthsToDays(this._months));
+ switch (units) {
+ case 'week' : return days / 7 + milliseconds / 6048e5;
+ case 'day' : return days + milliseconds / 864e5;
+ case 'hour' : return days * 24 + milliseconds / 36e5;
+ case 'minute' : return days * 1440 + milliseconds / 6e4;
+ case 'second' : return days * 86400 + milliseconds / 1000;
+ // Math.floor prevents floating point math errors here
+ case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
+ default: throw new Error('Unknown unit ' + units);
+ }
+ }
+ }
+
+ // TODO: Use this.as('ms')?
+ function duration_as__valueOf () {
+ return (
+ this._milliseconds +
+ this._days * 864e5 +
+ (this._months % 12) * 2592e6 +
+ toInt(this._months / 12) * 31536e6
+ );
+ }
+
+ function makeAs (alias) {
+ return function () {
+ return this.as(alias);
+ };
+ }
+
+ var asMilliseconds = makeAs('ms');
+ var asSeconds = makeAs('s');
+ var asMinutes = makeAs('m');
+ var asHours = makeAs('h');
+ var asDays = makeAs('d');
+ var asWeeks = makeAs('w');
+ var asMonths = makeAs('M');
+ var asYears = makeAs('y');
+
+ function duration_get__get (units) {
+ units = normalizeUnits(units);
+ return this[units + 's']();
+ }
+
+ function makeGetter(name) {
+ return function () {
+ return this._data[name];
+ };
+ }
+
+ var milliseconds = makeGetter('milliseconds');
+ var seconds = makeGetter('seconds');
+ var minutes = makeGetter('minutes');
+ var hours = makeGetter('hours');
+ var days = makeGetter('days');
+ var duration_get__months = makeGetter('months');
+ var years = makeGetter('years');
+
+ function weeks () {
+ return absFloor(this.days() / 7);
+ }
+
+ var round = Math.round;
+ var thresholds = {
+ s: 45, // seconds to minute
+ m: 45, // minutes to hour
+ h: 22, // hours to day
+ d: 26, // days to month
+ M: 11 // months to year
+ };
+
+ // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
+ function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
+ return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
+ }
+
+ function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
+ var duration = create__createDuration(posNegDuration).abs();
+ var seconds = round(duration.as('s'));
+ var minutes = round(duration.as('m'));
+ var hours = round(duration.as('h'));
+ var days = round(duration.as('d'));
+ var months = round(duration.as('M'));
+ var years = round(duration.as('y'));
+
+ var a = seconds < thresholds.s && ['s', seconds] ||
+ minutes <= 1 && ['m'] ||
+ minutes < thresholds.m && ['mm', minutes] ||
+ hours <= 1 && ['h'] ||
+ hours < thresholds.h && ['hh', hours] ||
+ days <= 1 && ['d'] ||
+ days < thresholds.d && ['dd', days] ||
+ months <= 1 && ['M'] ||
+ months < thresholds.M && ['MM', months] ||
+ years <= 1 && ['y'] || ['yy', years];
+
+ a[2] = withoutSuffix;
+ a[3] = +posNegDuration > 0;
+ a[4] = locale;
+ return substituteTimeAgo.apply(null, a);
+ }
+
+ // This function allows you to set a threshold for relative time strings
+ function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
+ if (thresholds[threshold] === undefined) {
+ return false;
+ }
+ if (limit === undefined) {
+ return thresholds[threshold];
+ }
+ thresholds[threshold] = limit;
+ return true;
+ }
+
+ function humanize (withSuffix) {
+ var locale = this.localeData();
+ var output = duration_humanize__relativeTime(this, !withSuffix, locale);
+
+ if (withSuffix) {
+ output = locale.pastFuture(+this, output);
+ }
+
+ return locale.postformat(output);
+ }
+
+ var iso_string__abs = Math.abs;
+
+ function iso_string__toISOString() {
+ // for ISO strings we do not use the normal bubbling rules:
+ // * milliseconds bubble up until they become hours
+ // * days do not bubble at all
+ // * months bubble up until they become years
+ // This is because there is no context-free conversion between hours and days
+ // (think of clock changes)
+ // and also not between days and months (28-31 days per month)
+ var seconds = iso_string__abs(this._milliseconds) / 1000;
+ var days = iso_string__abs(this._days);
+ var months = iso_string__abs(this._months);
+ var minutes, hours, years;
+
+ // 3600 seconds -> 60 minutes -> 1 hour
+ minutes = absFloor(seconds / 60);
+ hours = absFloor(minutes / 60);
+ seconds %= 60;
+ minutes %= 60;
+
+ // 12 months -> 1 year
+ years = absFloor(months / 12);
+ months %= 12;
+
+
+ // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
+ var Y = years;
+ var M = months;
+ var D = days;
+ var h = hours;
+ var m = minutes;
+ var s = seconds;
+ var total = this.asSeconds();
+
+ if (!total) {
+ // this is the same as C#'s (Noda) and python (isodate)...
+ // but not other JS (goog.date)
+ return 'P0D';
+ }
+
+ return (total < 0 ? '-' : '') +
+ 'P' +
+ (Y ? Y + 'Y' : '') +
+ (M ? M + 'M' : '') +
+ (D ? D + 'D' : '') +
+ ((h || m || s) ? 'T' : '') +
+ (h ? h + 'H' : '') +
+ (m ? m + 'M' : '') +
+ (s ? s + 'S' : '');
+ }
+
+ var duration_prototype__proto = Duration.prototype;
+
+ duration_prototype__proto.abs = duration_abs__abs;
+ duration_prototype__proto.add = duration_add_subtract__add;
+ duration_prototype__proto.subtract = duration_add_subtract__subtract;
+ duration_prototype__proto.as = as;
+ duration_prototype__proto.asMilliseconds = asMilliseconds;
+ duration_prototype__proto.asSeconds = asSeconds;
+ duration_prototype__proto.asMinutes = asMinutes;
+ duration_prototype__proto.asHours = asHours;
+ duration_prototype__proto.asDays = asDays;
+ duration_prototype__proto.asWeeks = asWeeks;
+ duration_prototype__proto.asMonths = asMonths;
+ duration_prototype__proto.asYears = asYears;
+ duration_prototype__proto.valueOf = duration_as__valueOf;
+ duration_prototype__proto._bubble = bubble;
+ duration_prototype__proto.get = duration_get__get;
+ duration_prototype__proto.milliseconds = milliseconds;
+ duration_prototype__proto.seconds = seconds;
+ duration_prototype__proto.minutes = minutes;
+ duration_prototype__proto.hours = hours;
+ duration_prototype__proto.days = days;
+ duration_prototype__proto.weeks = weeks;
+ duration_prototype__proto.months = duration_get__months;
+ duration_prototype__proto.years = years;
+ duration_prototype__proto.humanize = humanize;
+ duration_prototype__proto.toISOString = iso_string__toISOString;
+ duration_prototype__proto.toString = iso_string__toISOString;
+ duration_prototype__proto.toJSON = iso_string__toISOString;
+ duration_prototype__proto.locale = locale;
+ duration_prototype__proto.localeData = localeData;
+
+ // Deprecations
+ duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
+ duration_prototype__proto.lang = lang;
+
+ // Side effect imports
+
+ // FORMATTING
+
+ addFormatToken('X', 0, 0, 'unix');
+ addFormatToken('x', 0, 0, 'valueOf');
+
+ // PARSING
+
+ addRegexToken('x', matchSigned);
+ addRegexToken('X', matchTimestamp);
+ addParseToken('X', function (input, array, config) {
+ config._d = new Date(parseFloat(input, 10) * 1000);
+ });
+ addParseToken('x', function (input, array, config) {
+ config._d = new Date(toInt(input));
+ });
+
+ // Side effect imports
+
+ ;
+
+ //! moment.js
+ //! version : 2.11.1
+ //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
+ //! license : MIT
+ //! momentjs.com
+
+ utils_hooks__hooks.version = '2.11.1';
+
+ setHookCallback(local__createLocal);
+
+ utils_hooks__hooks.fn = momentPrototype;
+ utils_hooks__hooks.min = min;
+ utils_hooks__hooks.max = max;
+ utils_hooks__hooks.now = now;
+ utils_hooks__hooks.utc = create_utc__createUTC;
+ utils_hooks__hooks.unix = moment_moment__createUnix;
+ utils_hooks__hooks.months = lists__listMonths;
+ utils_hooks__hooks.isDate = isDate;
+ utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale;
+ utils_hooks__hooks.invalid = valid__createInvalid;
+ utils_hooks__hooks.duration = create__createDuration;
+ utils_hooks__hooks.isMoment = isMoment;
+ utils_hooks__hooks.weekdays = lists__listWeekdays;
+ utils_hooks__hooks.parseZone = moment_moment__createInZone;
+ utils_hooks__hooks.localeData = locale_locales__getLocale;
+ utils_hooks__hooks.isDuration = isDuration;
+ utils_hooks__hooks.monthsShort = lists__listMonthsShort;
+ utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin;
+ utils_hooks__hooks.defineLocale = defineLocale;
+ utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort;
+ utils_hooks__hooks.normalizeUnits = normalizeUnits;
+ utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;
+ utils_hooks__hooks.prototype = momentPrototype;
+
+ var moment__default = utils_hooks__hooks;
+
+ //! moment.js locale configuration
+ //! locale : afrikaans (af)
+ //! author : Werner Mollentze : https://github.com/wernerm
+
+ var af = moment__default.defineLocale('af', {
+ months : 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'),
+ monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'),
+ weekdays : 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split('_'),
+ weekdaysShort : 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'),
+ weekdaysMin : 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'),
+ meridiemParse: /vm|nm/i,
+ isPM : function (input) {
+ return /^nm$/i.test(input);
+ },
+ meridiem : function (hours, minutes, isLower) {
+ if (hours < 12) {
+ return isLower ? 'vm' : 'VM';
+ } else {
+ return isLower ? 'nm' : 'NM';
+ }
+ },
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[Vandag om] LT',
+ nextDay : '[Môre om] LT',
+ nextWeek : 'dddd [om] LT',
+ lastDay : '[Gister om] LT',
+ lastWeek : '[Laas] dddd [om] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'oor %s',
+ past : '%s gelede',
+ s : '\'n paar sekondes',
+ m : '\'n minuut',
+ mm : '%d minute',
+ h : '\'n uur',
+ hh : '%d ure',
+ d : '\'n dag',
+ dd : '%d dae',
+ M : '\'n maand',
+ MM : '%d maande',
+ y : '\'n jaar',
+ yy : '%d jaar'
+ },
+ ordinalParse: /\d{1,2}(ste|de)/,
+ ordinal : function (number) {
+ return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter
+ },
+ week : {
+ dow : 1, // Maandag is die eerste dag van die week.
+ doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Moroccan Arabic (ar-ma)
+ //! author : ElFadili Yassine : https://github.com/ElFadiliY
+ //! author : Abdel Said : https://github.com/abdelsaid
+
+ var ar_ma = moment__default.defineLocale('ar-ma', {
+ months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'),
+ monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'),
+ weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
+ weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
+ weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[اليوم على الساعة] LT',
+ nextDay: '[غدا على الساعة] LT',
+ nextWeek: 'dddd [على الساعة] LT',
+ lastDay: '[أمس على الساعة] LT',
+ lastWeek: 'dddd [على الساعة] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'في %s',
+ past : 'منذ %s',
+ s : 'ثوان',
+ m : 'دقيقة',
+ mm : '%d دقائق',
+ h : 'ساعة',
+ hh : '%d ساعات',
+ d : 'يوم',
+ dd : '%d أيام',
+ M : 'شهر',
+ MM : '%d أشهر',
+ y : 'سنة',
+ yy : '%d سنوات'
+ },
+ week : {
+ dow : 6, // Saturday is the first day of the week.
+ doy : 12 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Arabic Saudi Arabia (ar-sa)
+ //! author : Suhail Alkowaileet : https://github.com/xsoh
+
+ var ar_sa__symbolMap = {
+ '1': '١',
+ '2': '٢',
+ '3': '٣',
+ '4': '٤',
+ '5': '٥',
+ '6': '٦',
+ '7': '٧',
+ '8': '٨',
+ '9': '٩',
+ '0': '٠'
+ }, ar_sa__numberMap = {
+ '١': '1',
+ '٢': '2',
+ '٣': '3',
+ '٤': '4',
+ '٥': '5',
+ '٦': '6',
+ '٧': '7',
+ '٨': '8',
+ '٩': '9',
+ '٠': '0'
+ };
+
+ var ar_sa = moment__default.defineLocale('ar-sa', {
+ months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
+ monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
+ weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
+ weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
+ weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ meridiemParse: /ص|م/,
+ isPM : function (input) {
+ return 'م' === input;
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 12) {
+ return 'ص';
+ } else {
+ return 'م';
+ }
+ },
+ calendar : {
+ sameDay: '[اليوم على الساعة] LT',
+ nextDay: '[غدا على الساعة] LT',
+ nextWeek: 'dddd [على الساعة] LT',
+ lastDay: '[أمس على الساعة] LT',
+ lastWeek: 'dddd [على الساعة] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'في %s',
+ past : 'منذ %s',
+ s : 'ثوان',
+ m : 'دقيقة',
+ mm : '%d دقائق',
+ h : 'ساعة',
+ hh : '%d ساعات',
+ d : 'يوم',
+ dd : '%d أيام',
+ M : 'شهر',
+ MM : '%d أشهر',
+ y : 'سنة',
+ yy : '%d سنوات'
+ },
+ preparse: function (string) {
+ return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
+ return ar_sa__numberMap[match];
+ }).replace(/،/g, ',');
+ },
+ postformat: function (string) {
+ return string.replace(/\d/g, function (match) {
+ return ar_sa__symbolMap[match];
+ }).replace(/,/g, '،');
+ },
+ week : {
+ dow : 6, // Saturday is the first day of the week.
+ doy : 12 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Tunisian Arabic (ar-tn)
+
+ var ar_tn = moment__default.defineLocale('ar-tn', {
+ months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
+ monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
+ weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
+ weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
+ weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
+ longDateFormat: {
+ LT: 'HH:mm',
+ LTS: 'HH:mm:ss',
+ L: 'DD/MM/YYYY',
+ LL: 'D MMMM YYYY',
+ LLL: 'D MMMM YYYY HH:mm',
+ LLLL: 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar: {
+ sameDay: '[اليوم على الساعة] LT',
+ nextDay: '[غدا على الساعة] LT',
+ nextWeek: 'dddd [على الساعة] LT',
+ lastDay: '[أمس على الساعة] LT',
+ lastWeek: 'dddd [على الساعة] LT',
+ sameElse: 'L'
+ },
+ relativeTime: {
+ future: 'في %s',
+ past: 'منذ %s',
+ s: 'ثوان',
+ m: 'دقيقة',
+ mm: '%d دقائق',
+ h: 'ساعة',
+ hh: '%d ساعات',
+ d: 'يوم',
+ dd: '%d أيام',
+ M: 'شهر',
+ MM: '%d أشهر',
+ y: 'سنة',
+ yy: '%d سنوات'
+ },
+ week: {
+ dow: 1, // Monday is the first day of the week.
+ doy: 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! Locale: Arabic (ar)
+ //! Author: Abdel Said: https://github.com/abdelsaid
+ //! Changes in months, weekdays: Ahmed Elkhatib
+ //! Native plural forms: forabi https://github.com/forabi
+
+ var ar__symbolMap = {
+ '1': '١',
+ '2': '٢',
+ '3': '٣',
+ '4': '٤',
+ '5': '٥',
+ '6': '٦',
+ '7': '٧',
+ '8': '٨',
+ '9': '٩',
+ '0': '٠'
+ }, ar__numberMap = {
+ '١': '1',
+ '٢': '2',
+ '٣': '3',
+ '٤': '4',
+ '٥': '5',
+ '٦': '6',
+ '٧': '7',
+ '٨': '8',
+ '٩': '9',
+ '٠': '0'
+ }, pluralForm = function (n) {
+ return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5;
+ }, plurals = {
+ s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'],
+ m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'],
+ h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'],
+ d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'],
+ M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'],
+ y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام']
+ }, pluralize = function (u) {
+ return function (number, withoutSuffix, string, isFuture) {
+ var f = pluralForm(number),
+ str = plurals[u][pluralForm(number)];
+ if (f === 2) {
+ str = str[withoutSuffix ? 0 : 1];
+ }
+ return str.replace(/%d/i, number);
+ };
+ }, ar__months = [
+ 'كانون الثاني يناير',
+ 'شباط فبراير',
+ 'آذار مارس',
+ 'نيسان أبريل',
+ 'أيار مايو',
+ 'حزيران يونيو',
+ 'تموز يوليو',
+ 'آب أغسطس',
+ 'أيلول سبتمبر',
+ 'تشرين الأول أكتوبر',
+ 'تشرين الثاني نوفمبر',
+ 'كانون الأول ديسمبر'
+ ];
+
+ var ar = moment__default.defineLocale('ar', {
+ months : ar__months,
+ monthsShort : ar__months,
+ weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
+ weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
+ weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'D/\u200FM/\u200FYYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ meridiemParse: /ص|م/,
+ isPM : function (input) {
+ return 'م' === input;
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 12) {
+ return 'ص';
+ } else {
+ return 'م';
+ }
+ },
+ calendar : {
+ sameDay: '[اليوم عند الساعة] LT',
+ nextDay: '[غدًا عند الساعة] LT',
+ nextWeek: 'dddd [عند الساعة] LT',
+ lastDay: '[أمس عند الساعة] LT',
+ lastWeek: 'dddd [عند الساعة] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'بعد %s',
+ past : 'منذ %s',
+ s : pluralize('s'),
+ m : pluralize('m'),
+ mm : pluralize('m'),
+ h : pluralize('h'),
+ hh : pluralize('h'),
+ d : pluralize('d'),
+ dd : pluralize('d'),
+ M : pluralize('M'),
+ MM : pluralize('M'),
+ y : pluralize('y'),
+ yy : pluralize('y')
+ },
+ preparse: function (string) {
+ return string.replace(/\u200f/g, '').replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
+ return ar__numberMap[match];
+ }).replace(/،/g, ',');
+ },
+ postformat: function (string) {
+ return string.replace(/\d/g, function (match) {
+ return ar__symbolMap[match];
+ }).replace(/,/g, '،');
+ },
+ week : {
+ dow : 6, // Saturday is the first day of the week.
+ doy : 12 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : azerbaijani (az)
+ //! author : topchiyev : https://github.com/topchiyev
+
+ var az__suffixes = {
+ 1: '-inci',
+ 5: '-inci',
+ 8: '-inci',
+ 70: '-inci',
+ 80: '-inci',
+ 2: '-nci',
+ 7: '-nci',
+ 20: '-nci',
+ 50: '-nci',
+ 3: '-üncü',
+ 4: '-üncü',
+ 100: '-üncü',
+ 6: '-ncı',
+ 9: '-uncu',
+ 10: '-uncu',
+ 30: '-uncu',
+ 60: '-ıncı',
+ 90: '-ıncı'
+ };
+
+ var az = moment__default.defineLocale('az', {
+ months : 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split('_'),
+ monthsShort : 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'),
+ weekdays : 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'),
+ weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'),
+ weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[bugün saat] LT',
+ nextDay : '[sabah saat] LT',
+ nextWeek : '[gələn həftə] dddd [saat] LT',
+ lastDay : '[dünən] LT',
+ lastWeek : '[keçən həftə] dddd [saat] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s sonra',
+ past : '%s əvvəl',
+ s : 'birneçə saniyyə',
+ m : 'bir dəqiqə',
+ mm : '%d dəqiqə',
+ h : 'bir saat',
+ hh : '%d saat',
+ d : 'bir gün',
+ dd : '%d gün',
+ M : 'bir ay',
+ MM : '%d ay',
+ y : 'bir il',
+ yy : '%d il'
+ },
+ meridiemParse: /gecə|səhər|gündüz|axşam/,
+ isPM : function (input) {
+ return /^(gündüz|axşam)$/.test(input);
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 4) {
+ return 'gecə';
+ } else if (hour < 12) {
+ return 'səhər';
+ } else if (hour < 17) {
+ return 'gündüz';
+ } else {
+ return 'axşam';
+ }
+ },
+ ordinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,
+ ordinal : function (number) {
+ if (number === 0) { // special case for zero
+ return number + '-ıncı';
+ }
+ var a = number % 10,
+ b = number % 100 - a,
+ c = number >= 100 ? 100 : null;
+ return number + (az__suffixes[a] || az__suffixes[b] || az__suffixes[c]);
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : belarusian (be)
+ //! author : Dmitry Demidov : https://github.com/demidov91
+ //! author: Praleska: http://praleska.pro/
+ //! Author : Menelion Elensúle : https://github.com/Oire
+
+ function be__plural(word, num) {
+ var forms = word.split('_');
+ return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
+ }
+ function be__relativeTimeWithPlural(number, withoutSuffix, key) {
+ var format = {
+ 'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін',
+ 'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін',
+ 'dd': 'дзень_дні_дзён',
+ 'MM': 'месяц_месяцы_месяцаў',
+ 'yy': 'год_гады_гадоў'
+ };
+ if (key === 'm') {
+ return withoutSuffix ? 'хвіліна' : 'хвіліну';
+ }
+ else if (key === 'h') {
+ return withoutSuffix ? 'гадзіна' : 'гадзіну';
+ }
+ else {
+ return number + ' ' + be__plural(format[key], +number);
+ }
+ }
+
+ var be = moment__default.defineLocale('be', {
+ months : {
+ format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_'),
+ standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_')
+ },
+ monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'),
+ weekdays : {
+ format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_'),
+ standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'),
+ isFormat: /\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/
+ },
+ weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'),
+ weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY г.',
+ LLL : 'D MMMM YYYY г., HH:mm',
+ LLLL : 'dddd, D MMMM YYYY г., HH:mm'
+ },
+ calendar : {
+ sameDay: '[Сёння ў] LT',
+ nextDay: '[Заўтра ў] LT',
+ lastDay: '[Учора ў] LT',
+ nextWeek: function () {
+ return '[У] dddd [ў] LT';
+ },
+ lastWeek: function () {
+ switch (this.day()) {
+ case 0:
+ case 3:
+ case 5:
+ case 6:
+ return '[У мінулую] dddd [ў] LT';
+ case 1:
+ case 2:
+ case 4:
+ return '[У мінулы] dddd [ў] LT';
+ }
+ },
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'праз %s',
+ past : '%s таму',
+ s : 'некалькі секунд',
+ m : be__relativeTimeWithPlural,
+ mm : be__relativeTimeWithPlural,
+ h : be__relativeTimeWithPlural,
+ hh : be__relativeTimeWithPlural,
+ d : 'дзень',
+ dd : be__relativeTimeWithPlural,
+ M : 'месяц',
+ MM : be__relativeTimeWithPlural,
+ y : 'год',
+ yy : be__relativeTimeWithPlural
+ },
+ meridiemParse: /ночы|раніцы|дня|вечара/,
+ isPM : function (input) {
+ return /^(дня|вечара)$/.test(input);
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 4) {
+ return 'ночы';
+ } else if (hour < 12) {
+ return 'раніцы';
+ } else if (hour < 17) {
+ return 'дня';
+ } else {
+ return 'вечара';
+ }
+ },
+ ordinalParse: /\d{1,2}-(і|ы|га)/,
+ ordinal: function (number, period) {
+ switch (period) {
+ case 'M':
+ case 'd':
+ case 'DDD':
+ case 'w':
+ case 'W':
+ return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы';
+ case 'D':
+ return number + '-га';
+ default:
+ return number;
+ }
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : bulgarian (bg)
+ //! author : Krasen Borisov : https://github.com/kraz
+
+ var bg = moment__default.defineLocale('bg', {
+ months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'),
+ monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'),
+ weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'),
+ weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'),
+ weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'D.MM.YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY H:mm',
+ LLLL : 'dddd, D MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay : '[Днес в] LT',
+ nextDay : '[Утре в] LT',
+ nextWeek : 'dddd [в] LT',
+ lastDay : '[Вчера в] LT',
+ lastWeek : function () {
+ switch (this.day()) {
+ case 0:
+ case 3:
+ case 6:
+ return '[В изминалата] dddd [в] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[В изминалия] dddd [в] LT';
+ }
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'след %s',
+ past : 'преди %s',
+ s : 'няколко секунди',
+ m : 'минута',
+ mm : '%d минути',
+ h : 'час',
+ hh : '%d часа',
+ d : 'ден',
+ dd : '%d дни',
+ M : 'месец',
+ MM : '%d месеца',
+ y : 'година',
+ yy : '%d години'
+ },
+ ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
+ ordinal : function (number) {
+ var lastDigit = number % 10,
+ last2Digits = number % 100;
+ if (number === 0) {
+ return number + '-ев';
+ } else if (last2Digits === 0) {
+ return number + '-ен';
+ } else if (last2Digits > 10 && last2Digits < 20) {
+ return number + '-ти';
+ } else if (lastDigit === 1) {
+ return number + '-ви';
+ } else if (lastDigit === 2) {
+ return number + '-ри';
+ } else if (lastDigit === 7 || lastDigit === 8) {
+ return number + '-ми';
+ } else {
+ return number + '-ти';
+ }
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Bengali (bn)
+ //! author : Kaushik Gandhi : https://github.com/kaushikgandhi
+
+ var bn__symbolMap = {
+ '1': '১',
+ '2': '২',
+ '3': '৩',
+ '4': '৪',
+ '5': '৫',
+ '6': '৬',
+ '7': '৭',
+ '8': '৮',
+ '9': '৯',
+ '0': '০'
+ },
+ bn__numberMap = {
+ '১': '1',
+ '২': '2',
+ '৩': '3',
+ '৪': '4',
+ '৫': '5',
+ '৬': '6',
+ '৭': '7',
+ '৮': '8',
+ '৯': '9',
+ '০': '0'
+ };
+
+ var bn = moment__default.defineLocale('bn', {
+ months : 'জানুয়ারী_ফেবুয়ারী_মার্চ_এপ্রিল_মে_জুন_জুলাই_অগাস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'),
+ monthsShort : 'জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_অগ_সেপ্ট_অক্টো_নভ_ডিসেম্'.split('_'),
+ weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পত্তিবার_শুক্রবার_শনিবার'.split('_'),
+ weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পত্তি_শুক্র_শনি'.split('_'),
+ weekdaysMin : 'রব_সম_মঙ্গ_বু_ব্রিহ_শু_শনি'.split('_'),
+ longDateFormat : {
+ LT : 'A h:mm সময়',
+ LTS : 'A h:mm:ss সময়',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY, A h:mm সময়',
+ LLLL : 'dddd, D MMMM YYYY, A h:mm সময়'
+ },
+ calendar : {
+ sameDay : '[আজ] LT',
+ nextDay : '[আগামীকাল] LT',
+ nextWeek : 'dddd, LT',
+ lastDay : '[গতকাল] LT',
+ lastWeek : '[গত] dddd, LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s পরে',
+ past : '%s আগে',
+ s : 'কয়েক সেকেন্ড',
+ m : 'এক মিনিট',
+ mm : '%d মিনিট',
+ h : 'এক ঘন্টা',
+ hh : '%d ঘন্টা',
+ d : 'এক দিন',
+ dd : '%d দিন',
+ M : 'এক মাস',
+ MM : '%d মাস',
+ y : 'এক বছর',
+ yy : '%d বছর'
+ },
+ preparse: function (string) {
+ return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) {
+ return bn__numberMap[match];
+ });
+ },
+ postformat: function (string) {
+ return string.replace(/\d/g, function (match) {
+ return bn__symbolMap[match];
+ });
+ },
+ meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/,
+ isPM: function (input) {
+ return /^(দুপুর|বিকাল|রাত)$/.test(input);
+ },
+ //Bengali is a vast language its spoken
+ //in different forms in various parts of the world.
+ //I have just generalized with most common one used
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 4) {
+ return 'রাত';
+ } else if (hour < 10) {
+ return 'সকাল';
+ } else if (hour < 17) {
+ return 'দুপুর';
+ } else if (hour < 20) {
+ return 'বিকাল';
+ } else {
+ return 'রাত';
+ }
+ },
+ week : {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : tibetan (bo)
+ //! author : Thupten N. Chakrishar : https://github.com/vajradog
+
+ var bo__symbolMap = {
+ '1': '༡',
+ '2': '༢',
+ '3': '༣',
+ '4': '༤',
+ '5': '༥',
+ '6': '༦',
+ '7': '༧',
+ '8': '༨',
+ '9': '༩',
+ '0': '༠'
+ },
+ bo__numberMap = {
+ '༡': '1',
+ '༢': '2',
+ '༣': '3',
+ '༤': '4',
+ '༥': '5',
+ '༦': '6',
+ '༧': '7',
+ '༨': '8',
+ '༩': '9',
+ '༠': '0'
+ };
+
+ var bo = moment__default.defineLocale('bo', {
+ months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'),
+ monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'),
+ weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'),
+ weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'),
+ weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'),
+ longDateFormat : {
+ LT : 'A h:mm',
+ LTS : 'A h:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY, A h:mm',
+ LLLL : 'dddd, D MMMM YYYY, A h:mm'
+ },
+ calendar : {
+ sameDay : '[དི་རིང] LT',
+ nextDay : '[སང་ཉིན] LT',
+ nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT',
+ lastDay : '[ཁ་སང] LT',
+ lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s ལ་',
+ past : '%s སྔན་ལ',
+ s : 'ལམ་སང',
+ m : 'སྐར་མ་གཅིག',
+ mm : '%d སྐར་མ',
+ h : 'ཆུ་ཚོད་གཅིག',
+ hh : '%d ཆུ་ཚོད',
+ d : 'ཉིན་གཅིག',
+ dd : '%d ཉིན་',
+ M : 'ཟླ་བ་གཅིག',
+ MM : '%d ཟླ་བ',
+ y : 'ལོ་གཅིག',
+ yy : '%d ལོ'
+ },
+ preparse: function (string) {
+ return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) {
+ return bo__numberMap[match];
+ });
+ },
+ postformat: function (string) {
+ return string.replace(/\d/g, function (match) {
+ return bo__symbolMap[match];
+ });
+ },
+ meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,
+ isPM: function (input) {
+ return /^(ཉིན་གུང|དགོང་དག|མཚན་མོ)$/.test(input);
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 4) {
+ return 'མཚན་མོ';
+ } else if (hour < 10) {
+ return 'ཞོགས་ཀས';
+ } else if (hour < 17) {
+ return 'ཉིན་གུང';
+ } else if (hour < 20) {
+ return 'དགོང་དག';
+ } else {
+ return 'མཚན་མོ';
+ }
+ },
+ week : {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : breton (br)
+ //! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou
+
+ function relativeTimeWithMutation(number, withoutSuffix, key) {
+ var format = {
+ 'mm': 'munutenn',
+ 'MM': 'miz',
+ 'dd': 'devezh'
+ };
+ return number + ' ' + mutation(format[key], number);
+ }
+ function specialMutationForYears(number) {
+ switch (lastNumber(number)) {
+ case 1:
+ case 3:
+ case 4:
+ case 5:
+ case 9:
+ return number + ' bloaz';
+ default:
+ return number + ' vloaz';
+ }
+ }
+ function lastNumber(number) {
+ if (number > 9) {
+ return lastNumber(number % 10);
+ }
+ return number;
+ }
+ function mutation(text, number) {
+ if (number === 2) {
+ return softMutation(text);
+ }
+ return text;
+ }
+ function softMutation(text) {
+ var mutationTable = {
+ 'm': 'v',
+ 'b': 'v',
+ 'd': 'z'
+ };
+ if (mutationTable[text.charAt(0)] === undefined) {
+ return text;
+ }
+ return mutationTable[text.charAt(0)] + text.substring(1);
+ }
+
+ var br = moment__default.defineLocale('br', {
+ months : 'Genver_C\'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split('_'),
+ monthsShort : 'Gen_C\'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
+ weekdays : 'Sul_Lun_Meurzh_Merc\'her_Yaou_Gwener_Sadorn'.split('_'),
+ weekdaysShort : 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
+ weekdaysMin : 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'h[e]mm A',
+ LTS : 'h[e]mm:ss A',
+ L : 'DD/MM/YYYY',
+ LL : 'D [a viz] MMMM YYYY',
+ LLL : 'D [a viz] MMMM YYYY h[e]mm A',
+ LLLL : 'dddd, D [a viz] MMMM YYYY h[e]mm A'
+ },
+ calendar : {
+ sameDay : '[Hiziv da] LT',
+ nextDay : '[Warc\'hoazh da] LT',
+ nextWeek : 'dddd [da] LT',
+ lastDay : '[Dec\'h da] LT',
+ lastWeek : 'dddd [paset da] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'a-benn %s',
+ past : '%s \'zo',
+ s : 'un nebeud segondennoù',
+ m : 'ur vunutenn',
+ mm : relativeTimeWithMutation,
+ h : 'un eur',
+ hh : '%d eur',
+ d : 'un devezh',
+ dd : relativeTimeWithMutation,
+ M : 'ur miz',
+ MM : relativeTimeWithMutation,
+ y : 'ur bloaz',
+ yy : specialMutationForYears
+ },
+ ordinalParse: /\d{1,2}(añ|vet)/,
+ ordinal : function (number) {
+ var output = (number === 1) ? 'añ' : 'vet';
+ return number + output;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : bosnian (bs)
+ //! author : Nedim Cholich : https://github.com/frontyard
+ //! based on (hr) translation by Bojan Marković
+
+ function bs__translate(number, withoutSuffix, key) {
+ var result = number + ' ';
+ switch (key) {
+ case 'm':
+ return withoutSuffix ? 'jedna minuta' : 'jedne minute';
+ case 'mm':
+ if (number === 1) {
+ result += 'minuta';
+ } else if (number === 2 || number === 3 || number === 4) {
+ result += 'minute';
+ } else {
+ result += 'minuta';
+ }
+ return result;
+ case 'h':
+ return withoutSuffix ? 'jedan sat' : 'jednog sata';
+ case 'hh':
+ if (number === 1) {
+ result += 'sat';
+ } else if (number === 2 || number === 3 || number === 4) {
+ result += 'sata';
+ } else {
+ result += 'sati';
+ }
+ return result;
+ case 'dd':
+ if (number === 1) {
+ result += 'dan';
+ } else {
+ result += 'dana';
+ }
+ return result;
+ case 'MM':
+ if (number === 1) {
+ result += 'mjesec';
+ } else if (number === 2 || number === 3 || number === 4) {
+ result += 'mjeseca';
+ } else {
+ result += 'mjeseci';
+ }
+ return result;
+ case 'yy':
+ if (number === 1) {
+ result += 'godina';
+ } else if (number === 2 || number === 3 || number === 4) {
+ result += 'godine';
+ } else {
+ result += 'godina';
+ }
+ return result;
+ }
+ }
+
+ var bs = moment__default.defineLocale('bs', {
+ months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'),
+ monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'),
+ weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'),
+ weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
+ weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD. MM. YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY H:mm',
+ LLLL : 'dddd, D. MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay : '[danas u] LT',
+ nextDay : '[sutra u] LT',
+ nextWeek : function () {
+ switch (this.day()) {
+ case 0:
+ return '[u] [nedjelju] [u] LT';
+ case 3:
+ return '[u] [srijedu] [u] LT';
+ case 6:
+ return '[u] [subotu] [u] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[u] dddd [u] LT';
+ }
+ },
+ lastDay : '[jučer u] LT',
+ lastWeek : function () {
+ switch (this.day()) {
+ case 0:
+ case 3:
+ return '[prošlu] dddd [u] LT';
+ case 6:
+ return '[prošle] [subote] [u] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[prošli] dddd [u] LT';
+ }
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'za %s',
+ past : 'prije %s',
+ s : 'par sekundi',
+ m : bs__translate,
+ mm : bs__translate,
+ h : bs__translate,
+ hh : bs__translate,
+ d : 'dan',
+ dd : bs__translate,
+ M : 'mjesec',
+ MM : bs__translate,
+ y : 'godinu',
+ yy : bs__translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : catalan (ca)
+ //! author : Juan G. Hurtado : https://github.com/juanghurtado
+
+ var ca = moment__default.defineLocale('ca', {
+ months : 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'),
+ monthsShort : 'gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.'.split('_'),
+ weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'),
+ weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'),
+ weekdaysMin : 'Dg_Dl_Dt_Dc_Dj_Dv_Ds'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY H:mm',
+ LLLL : 'dddd D MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay : function () {
+ return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
+ },
+ nextDay : function () {
+ return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
+ },
+ nextWeek : function () {
+ return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
+ },
+ lastDay : function () {
+ return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
+ },
+ lastWeek : function () {
+ return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'en %s',
+ past : 'fa %s',
+ s : 'uns segons',
+ m : 'un minut',
+ mm : '%d minuts',
+ h : 'una hora',
+ hh : '%d hores',
+ d : 'un dia',
+ dd : '%d dies',
+ M : 'un mes',
+ MM : '%d mesos',
+ y : 'un any',
+ yy : '%d anys'
+ },
+ ordinalParse: /\d{1,2}(r|n|t|è|a)/,
+ ordinal : function (number, period) {
+ var output = (number === 1) ? 'r' :
+ (number === 2) ? 'n' :
+ (number === 3) ? 'r' :
+ (number === 4) ? 't' : 'è';
+ if (period === 'w' || period === 'W') {
+ output = 'a';
+ }
+ return number + output;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : czech (cs)
+ //! author : petrbela : https://github.com/petrbela
+
+ var cs__months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'),
+ cs__monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_');
+ function cs__plural(n) {
+ return (n > 1) && (n < 5) && (~~(n / 10) !== 1);
+ }
+ function cs__translate(number, withoutSuffix, key, isFuture) {
+ var result = number + ' ';
+ switch (key) {
+ case 's': // a few seconds / in a few seconds / a few seconds ago
+ return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami';
+ case 'm': // a minute / in a minute / a minute ago
+ return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou');
+ case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
+ if (withoutSuffix || isFuture) {
+ return result + (cs__plural(number) ? 'minuty' : 'minut');
+ } else {
+ return result + 'minutami';
+ }
+ break;
+ case 'h': // an hour / in an hour / an hour ago
+ return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
+ case 'hh': // 9 hours / in 9 hours / 9 hours ago
+ if (withoutSuffix || isFuture) {
+ return result + (cs__plural(number) ? 'hodiny' : 'hodin');
+ } else {
+ return result + 'hodinami';
+ }
+ break;
+ case 'd': // a day / in a day / a day ago
+ return (withoutSuffix || isFuture) ? 'den' : 'dnem';
+ case 'dd': // 9 days / in 9 days / 9 days ago
+ if (withoutSuffix || isFuture) {
+ return result + (cs__plural(number) ? 'dny' : 'dní');
+ } else {
+ return result + 'dny';
+ }
+ break;
+ case 'M': // a month / in a month / a month ago
+ return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem';
+ case 'MM': // 9 months / in 9 months / 9 months ago
+ if (withoutSuffix || isFuture) {
+ return result + (cs__plural(number) ? 'měsíce' : 'měsíců');
+ } else {
+ return result + 'měsíci';
+ }
+ break;
+ case 'y': // a year / in a year / a year ago
+ return (withoutSuffix || isFuture) ? 'rok' : 'rokem';
+ case 'yy': // 9 years / in 9 years / 9 years ago
+ if (withoutSuffix || isFuture) {
+ return result + (cs__plural(number) ? 'roky' : 'let');
+ } else {
+ return result + 'lety';
+ }
+ break;
+ }
+ }
+
+ var cs = moment__default.defineLocale('cs', {
+ months : cs__months,
+ monthsShort : cs__monthsShort,
+ monthsParse : (function (months, monthsShort) {
+ var i, _monthsParse = [];
+ for (i = 0; i < 12; i++) {
+ // use custom parser to solve problem with July (červenec)
+ _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i');
+ }
+ return _monthsParse;
+ }(cs__months, cs__monthsShort)),
+ shortMonthsParse : (function (monthsShort) {
+ var i, _shortMonthsParse = [];
+ for (i = 0; i < 12; i++) {
+ _shortMonthsParse[i] = new RegExp('^' + monthsShort[i] + '$', 'i');
+ }
+ return _shortMonthsParse;
+ }(cs__monthsShort)),
+ longMonthsParse : (function (months) {
+ var i, _longMonthsParse = [];
+ for (i = 0; i < 12; i++) {
+ _longMonthsParse[i] = new RegExp('^' + months[i] + '$', 'i');
+ }
+ return _longMonthsParse;
+ }(cs__months)),
+ weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'),
+ weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'),
+ weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'),
+ longDateFormat : {
+ LT: 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY H:mm',
+ LLLL : 'dddd D. MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay: '[dnes v] LT',
+ nextDay: '[zítra v] LT',
+ nextWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[v neděli v] LT';
+ case 1:
+ case 2:
+ return '[v] dddd [v] LT';
+ case 3:
+ return '[ve středu v] LT';
+ case 4:
+ return '[ve čtvrtek v] LT';
+ case 5:
+ return '[v pátek v] LT';
+ case 6:
+ return '[v sobotu v] LT';
+ }
+ },
+ lastDay: '[včera v] LT',
+ lastWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[minulou neděli v] LT';
+ case 1:
+ case 2:
+ return '[minulé] dddd [v] LT';
+ case 3:
+ return '[minulou středu v] LT';
+ case 4:
+ case 5:
+ return '[minulý] dddd [v] LT';
+ case 6:
+ return '[minulou sobotu v] LT';
+ }
+ },
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'za %s',
+ past : 'před %s',
+ s : cs__translate,
+ m : cs__translate,
+ mm : cs__translate,
+ h : cs__translate,
+ hh : cs__translate,
+ d : cs__translate,
+ dd : cs__translate,
+ M : cs__translate,
+ MM : cs__translate,
+ y : cs__translate,
+ yy : cs__translate
+ },
+ ordinalParse : /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : chuvash (cv)
+ //! author : Anatoly Mironov : https://github.com/mirontoli
+
+ var cv = moment__default.defineLocale('cv', {
+ months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'),
+ monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'),
+ weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'),
+ weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'),
+ weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD-MM-YYYY',
+ LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]',
+ LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm',
+ LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm'
+ },
+ calendar : {
+ sameDay: '[Паян] LT [сехетре]',
+ nextDay: '[Ыран] LT [сехетре]',
+ lastDay: '[Ӗнер] LT [сехетре]',
+ nextWeek: '[Ҫитес] dddd LT [сехетре]',
+ lastWeek: '[Иртнӗ] dddd LT [сехетре]',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : function (output) {
+ var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран';
+ return output + affix;
+ },
+ past : '%s каялла',
+ s : 'пӗр-ик ҫеккунт',
+ m : 'пӗр минут',
+ mm : '%d минут',
+ h : 'пӗр сехет',
+ hh : '%d сехет',
+ d : 'пӗр кун',
+ dd : '%d кун',
+ M : 'пӗр уйӑх',
+ MM : '%d уйӑх',
+ y : 'пӗр ҫул',
+ yy : '%d ҫул'
+ },
+ ordinalParse: /\d{1,2}-мӗш/,
+ ordinal : '%d-мӗш',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Welsh (cy)
+ //! author : Robert Allen
+
+ var cy = moment__default.defineLocale('cy', {
+ months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'),
+ monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'),
+ weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'),
+ weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'),
+ weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'),
+ // time formats are the same as en-gb
+ longDateFormat: {
+ LT: 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L: 'DD/MM/YYYY',
+ LL: 'D MMMM YYYY',
+ LLL: 'D MMMM YYYY HH:mm',
+ LLLL: 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar: {
+ sameDay: '[Heddiw am] LT',
+ nextDay: '[Yfory am] LT',
+ nextWeek: 'dddd [am] LT',
+ lastDay: '[Ddoe am] LT',
+ lastWeek: 'dddd [diwethaf am] LT',
+ sameElse: 'L'
+ },
+ relativeTime: {
+ future: 'mewn %s',
+ past: '%s yn ôl',
+ s: 'ychydig eiliadau',
+ m: 'munud',
+ mm: '%d munud',
+ h: 'awr',
+ hh: '%d awr',
+ d: 'diwrnod',
+ dd: '%d diwrnod',
+ M: 'mis',
+ MM: '%d mis',
+ y: 'blwyddyn',
+ yy: '%d flynedd'
+ },
+ ordinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,
+ // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh
+ ordinal: function (number) {
+ var b = number,
+ output = '',
+ lookup = [
+ '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed
+ 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed
+ ];
+ if (b > 20) {
+ if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) {
+ output = 'fed'; // not 30ain, 70ain or 90ain
+ } else {
+ output = 'ain';
+ }
+ } else if (b > 0) {
+ output = lookup[b];
+ }
+ return number + output;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : danish (da)
+ //! author : Ulrik Nielsen : https://github.com/mrbase
+
+ var da = moment__default.defineLocale('da', {
+ months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'),
+ monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'),
+ weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'),
+ weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'),
+ weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY HH:mm',
+ LLLL : 'dddd [d.] D. MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[I dag kl.] LT',
+ nextDay : '[I morgen kl.] LT',
+ nextWeek : 'dddd [kl.] LT',
+ lastDay : '[I går kl.] LT',
+ lastWeek : '[sidste] dddd [kl] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'om %s',
+ past : '%s siden',
+ s : 'få sekunder',
+ m : 'et minut',
+ mm : '%d minutter',
+ h : 'en time',
+ hh : '%d timer',
+ d : 'en dag',
+ dd : '%d dage',
+ M : 'en måned',
+ MM : '%d måneder',
+ y : 'et år',
+ yy : '%d år'
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : austrian german (de-at)
+ //! author : lluchs : https://github.com/lluchs
+ //! author: Menelion Elensúle: https://github.com/Oire
+ //! author : Martin Groller : https://github.com/MadMG
+ //! author : Mikolaj Dadela : https://github.com/mik01aj
+
+ function de_at__processRelativeTime(number, withoutSuffix, key, isFuture) {
+ var format = {
+ 'm': ['eine Minute', 'einer Minute'],
+ 'h': ['eine Stunde', 'einer Stunde'],
+ 'd': ['ein Tag', 'einem Tag'],
+ 'dd': [number + ' Tage', number + ' Tagen'],
+ 'M': ['ein Monat', 'einem Monat'],
+ 'MM': [number + ' Monate', number + ' Monaten'],
+ 'y': ['ein Jahr', 'einem Jahr'],
+ 'yy': [number + ' Jahre', number + ' Jahren']
+ };
+ return withoutSuffix ? format[key][0] : format[key][1];
+ }
+
+ var de_at = moment__default.defineLocale('de-at', {
+ months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
+ monthsShort : 'Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
+ weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
+ weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
+ weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
+ longDateFormat : {
+ LT: 'HH:mm',
+ LTS: 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY HH:mm',
+ LLLL : 'dddd, D. MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[heute um] LT [Uhr]',
+ sameElse: 'L',
+ nextDay: '[morgen um] LT [Uhr]',
+ nextWeek: 'dddd [um] LT [Uhr]',
+ lastDay: '[gestern um] LT [Uhr]',
+ lastWeek: '[letzten] dddd [um] LT [Uhr]'
+ },
+ relativeTime : {
+ future : 'in %s',
+ past : 'vor %s',
+ s : 'ein paar Sekunden',
+ m : de_at__processRelativeTime,
+ mm : '%d Minuten',
+ h : de_at__processRelativeTime,
+ hh : '%d Stunden',
+ d : de_at__processRelativeTime,
+ dd : de_at__processRelativeTime,
+ M : de_at__processRelativeTime,
+ MM : de_at__processRelativeTime,
+ y : de_at__processRelativeTime,
+ yy : de_at__processRelativeTime
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : german (de)
+ //! author : lluchs : https://github.com/lluchs
+ //! author: Menelion Elensúle: https://github.com/Oire
+ //! author : Mikolaj Dadela : https://github.com/mik01aj
+
+ function de__processRelativeTime(number, withoutSuffix, key, isFuture) {
+ var format = {
+ 'm': ['eine Minute', 'einer Minute'],
+ 'h': ['eine Stunde', 'einer Stunde'],
+ 'd': ['ein Tag', 'einem Tag'],
+ 'dd': [number + ' Tage', number + ' Tagen'],
+ 'M': ['ein Monat', 'einem Monat'],
+ 'MM': [number + ' Monate', number + ' Monaten'],
+ 'y': ['ein Jahr', 'einem Jahr'],
+ 'yy': [number + ' Jahre', number + ' Jahren']
+ };
+ return withoutSuffix ? format[key][0] : format[key][1];
+ }
+
+ var de = moment__default.defineLocale('de', {
+ months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
+ monthsShort : 'Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
+ weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
+ weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
+ weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
+ longDateFormat : {
+ LT: 'HH:mm',
+ LTS: 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY HH:mm',
+ LLLL : 'dddd, D. MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[heute um] LT [Uhr]',
+ sameElse: 'L',
+ nextDay: '[morgen um] LT [Uhr]',
+ nextWeek: 'dddd [um] LT [Uhr]',
+ lastDay: '[gestern um] LT [Uhr]',
+ lastWeek: '[letzten] dddd [um] LT [Uhr]'
+ },
+ relativeTime : {
+ future : 'in %s',
+ past : 'vor %s',
+ s : 'ein paar Sekunden',
+ m : de__processRelativeTime,
+ mm : '%d Minuten',
+ h : de__processRelativeTime,
+ hh : '%d Stunden',
+ d : de__processRelativeTime,
+ dd : de__processRelativeTime,
+ M : de__processRelativeTime,
+ MM : de__processRelativeTime,
+ y : de__processRelativeTime,
+ yy : de__processRelativeTime
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : dhivehi (dv)
+ //! author : Jawish Hameed : https://github.com/jawish
+
+ var dv__months = [
+ 'ޖެނުއަރީ',
+ 'ފެބްރުއަރީ',
+ 'މާރިޗު',
+ 'އޭޕްރީލު',
+ 'މޭ',
+ 'ޖޫން',
+ 'ޖުލައި',
+ 'އޯގަސްޓު',
+ 'ސެޕްޓެމްބަރު',
+ 'އޮކްޓޯބަރު',
+ 'ނޮވެމްބަރު',
+ 'ޑިސެމްބަރު'
+ ], dv__weekdays = [
+ 'އާދިއްތަ',
+ 'ހޯމަ',
+ 'އަންގާރަ',
+ 'ބުދަ',
+ 'ބުރާސްފަތި',
+ 'ހުކުރު',
+ 'ހޮނިހިރު'
+ ];
+
+ var dv = moment__default.defineLocale('dv', {
+ months : dv__months,
+ monthsShort : dv__months,
+ weekdays : dv__weekdays,
+ weekdaysShort : dv__weekdays,
+ weekdaysMin : 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'),
+ longDateFormat : {
+
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'D/M/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ meridiemParse: /މކ|މފ/,
+ isPM : function (input) {
+ return '' === input;
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 12) {
+ return 'މކ';
+ } else {
+ return 'މފ';
+ }
+ },
+ calendar : {
+ sameDay : '[މިއަދު] LT',
+ nextDay : '[މާދަމާ] LT',
+ nextWeek : 'dddd LT',
+ lastDay : '[އިއްޔެ] LT',
+ lastWeek : '[ފާއިތުވި] dddd LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'ތެރޭގައި %s',
+ past : 'ކުރިން %s',
+ s : 'ސިކުންތުކޮޅެއް',
+ m : 'މިނިޓެއް',
+ mm : 'މިނިޓު %d',
+ h : 'ގަޑިއިރެއް',
+ hh : 'ގަޑިއިރު %d',
+ d : 'ދުވަހެއް',
+ dd : 'ދުވަސް %d',
+ M : 'މަހެއް',
+ MM : 'މަސް %d',
+ y : 'އަހަރެއް',
+ yy : 'އަހަރު %d'
+ },
+ preparse: function (string) {
+ return string.replace(/،/g, ',');
+ },
+ postformat: function (string) {
+ return string.replace(/,/g, '،');
+ },
+ week : {
+ dow : 7, // Sunday is the first day of the week.
+ doy : 12 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : modern greek (el)
+ //! author : Aggelos Karalias : https://github.com/mehiel
+
+ var el = moment__default.defineLocale('el', {
+ monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'),
+ monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'),
+ months : function (momentToFormat, format) {
+ if (/D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM'
+ return this._monthsGenitiveEl[momentToFormat.month()];
+ } else {
+ return this._monthsNominativeEl[momentToFormat.month()];
+ }
+ },
+ monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'),
+ weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'),
+ weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'),
+ weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'),
+ meridiem : function (hours, minutes, isLower) {
+ if (hours > 11) {
+ return isLower ? 'μμ' : 'ΜΜ';
+ } else {
+ return isLower ? 'πμ' : 'ΠΜ';
+ }
+ },
+ isPM : function (input) {
+ return ((input + '').toLowerCase()[0] === 'μ');
+ },
+ meridiemParse : /[ΠΜ]\.?Μ?\.?/i,
+ longDateFormat : {
+ LT : 'h:mm A',
+ LTS : 'h:mm:ss A',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY h:mm A',
+ LLLL : 'dddd, D MMMM YYYY h:mm A'
+ },
+ calendarEl : {
+ sameDay : '[Σήμερα {}] LT',
+ nextDay : '[Αύριο {}] LT',
+ nextWeek : 'dddd [{}] LT',
+ lastDay : '[Χθες {}] LT',
+ lastWeek : function () {
+ switch (this.day()) {
+ case 6:
+ return '[το προηγούμενο] dddd [{}] LT';
+ default:
+ return '[την προηγούμενη] dddd [{}] LT';
+ }
+ },
+ sameElse : 'L'
+ },
+ calendar : function (key, mom) {
+ var output = this._calendarEl[key],
+ hours = mom && mom.hours();
+ if (isFunction(output)) {
+ output = output.apply(mom);
+ }
+ return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις'));
+ },
+ relativeTime : {
+ future : 'σε %s',
+ past : '%s πριν',
+ s : 'λίγα δευτερόλεπτα',
+ m : 'ένα λεπτό',
+ mm : '%d λεπτά',
+ h : 'μία ώρα',
+ hh : '%d ώρες',
+ d : 'μία μέρα',
+ dd : '%d μέρες',
+ M : 'ένας μήνας',
+ MM : '%d μήνες',
+ y : 'ένας χρόνος',
+ yy : '%d χρόνια'
+ },
+ ordinalParse: /\d{1,2}η/,
+ ordinal: '%dη',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : australian english (en-au)
+
+ var en_au = moment__default.defineLocale('en-au', {
+ months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
+ monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
+ weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
+ weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
+ weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'h:mm A',
+ LTS : 'h:mm:ss A',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY h:mm A',
+ LLLL : 'dddd, D MMMM YYYY h:mm A'
+ },
+ calendar : {
+ sameDay : '[Today at] LT',
+ nextDay : '[Tomorrow at] LT',
+ nextWeek : 'dddd [at] LT',
+ lastDay : '[Yesterday at] LT',
+ lastWeek : '[Last] dddd [at] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'in %s',
+ past : '%s ago',
+ s : 'a few seconds',
+ m : 'a minute',
+ mm : '%d minutes',
+ h : 'an hour',
+ hh : '%d hours',
+ d : 'a day',
+ dd : '%d days',
+ M : 'a month',
+ MM : '%d months',
+ y : 'a year',
+ yy : '%d years'
+ },
+ ordinalParse: /\d{1,2}(st|nd|rd|th)/,
+ ordinal : function (number) {
+ var b = number % 10,
+ output = (~~(number % 100 / 10) === 1) ? 'th' :
+ (b === 1) ? 'st' :
+ (b === 2) ? 'nd' :
+ (b === 3) ? 'rd' : 'th';
+ return number + output;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : canadian english (en-ca)
+ //! author : Jonathan Abourbih : https://github.com/jonbca
+
+ var en_ca = moment__default.defineLocale('en-ca', {
+ months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
+ monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
+ weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
+ weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
+ weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'h:mm A',
+ LTS : 'h:mm:ss A',
+ L : 'YYYY-MM-DD',
+ LL : 'D MMMM, YYYY',
+ LLL : 'D MMMM, YYYY h:mm A',
+ LLLL : 'dddd, D MMMM, YYYY h:mm A'
+ },
+ calendar : {
+ sameDay : '[Today at] LT',
+ nextDay : '[Tomorrow at] LT',
+ nextWeek : 'dddd [at] LT',
+ lastDay : '[Yesterday at] LT',
+ lastWeek : '[Last] dddd [at] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'in %s',
+ past : '%s ago',
+ s : 'a few seconds',
+ m : 'a minute',
+ mm : '%d minutes',
+ h : 'an hour',
+ hh : '%d hours',
+ d : 'a day',
+ dd : '%d days',
+ M : 'a month',
+ MM : '%d months',
+ y : 'a year',
+ yy : '%d years'
+ },
+ ordinalParse: /\d{1,2}(st|nd|rd|th)/,
+ ordinal : function (number) {
+ var b = number % 10,
+ output = (~~(number % 100 / 10) === 1) ? 'th' :
+ (b === 1) ? 'st' :
+ (b === 2) ? 'nd' :
+ (b === 3) ? 'rd' : 'th';
+ return number + output;
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : great britain english (en-gb)
+ //! author : Chris Gedrim : https://github.com/chrisgedrim
+
+ var en_gb = moment__default.defineLocale('en-gb', {
+ months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
+ monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
+ weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
+ weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
+ weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[Today at] LT',
+ nextDay : '[Tomorrow at] LT',
+ nextWeek : 'dddd [at] LT',
+ lastDay : '[Yesterday at] LT',
+ lastWeek : '[Last] dddd [at] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'in %s',
+ past : '%s ago',
+ s : 'a few seconds',
+ m : 'a minute',
+ mm : '%d minutes',
+ h : 'an hour',
+ hh : '%d hours',
+ d : 'a day',
+ dd : '%d days',
+ M : 'a month',
+ MM : '%d months',
+ y : 'a year',
+ yy : '%d years'
+ },
+ ordinalParse: /\d{1,2}(st|nd|rd|th)/,
+ ordinal : function (number) {
+ var b = number % 10,
+ output = (~~(number % 100 / 10) === 1) ? 'th' :
+ (b === 1) ? 'st' :
+ (b === 2) ? 'nd' :
+ (b === 3) ? 'rd' : 'th';
+ return number + output;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Irish english (en-ie)
+ //! author : Chris Cartlidge : https://github.com/chriscartlidge
+
+ var en_ie = moment__default.defineLocale('en-ie', {
+ months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
+ monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
+ weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
+ weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
+ weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD-MM-YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[Today at] LT',
+ nextDay : '[Tomorrow at] LT',
+ nextWeek : 'dddd [at] LT',
+ lastDay : '[Yesterday at] LT',
+ lastWeek : '[Last] dddd [at] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'in %s',
+ past : '%s ago',
+ s : 'a few seconds',
+ m : 'a minute',
+ mm : '%d minutes',
+ h : 'an hour',
+ hh : '%d hours',
+ d : 'a day',
+ dd : '%d days',
+ M : 'a month',
+ MM : '%d months',
+ y : 'a year',
+ yy : '%d years'
+ },
+ ordinalParse: /\d{1,2}(st|nd|rd|th)/,
+ ordinal : function (number) {
+ var b = number % 10,
+ output = (~~(number % 100 / 10) === 1) ? 'th' :
+ (b === 1) ? 'st' :
+ (b === 2) ? 'nd' :
+ (b === 3) ? 'rd' : 'th';
+ return number + output;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : New Zealand english (en-nz)
+
+ var en_nz = moment__default.defineLocale('en-nz', {
+ months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
+ monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
+ weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
+ weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
+ weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'h:mm A',
+ LTS : 'h:mm:ss A',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY h:mm A',
+ LLLL : 'dddd, D MMMM YYYY h:mm A'
+ },
+ calendar : {
+ sameDay : '[Today at] LT',
+ nextDay : '[Tomorrow at] LT',
+ nextWeek : 'dddd [at] LT',
+ lastDay : '[Yesterday at] LT',
+ lastWeek : '[Last] dddd [at] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'in %s',
+ past : '%s ago',
+ s : 'a few seconds',
+ m : 'a minute',
+ mm : '%d minutes',
+ h : 'an hour',
+ hh : '%d hours',
+ d : 'a day',
+ dd : '%d days',
+ M : 'a month',
+ MM : '%d months',
+ y : 'a year',
+ yy : '%d years'
+ },
+ ordinalParse: /\d{1,2}(st|nd|rd|th)/,
+ ordinal : function (number) {
+ var b = number % 10,
+ output = (~~(number % 100 / 10) === 1) ? 'th' :
+ (b === 1) ? 'st' :
+ (b === 2) ? 'nd' :
+ (b === 3) ? 'rd' : 'th';
+ return number + output;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : esperanto (eo)
+ //! author : Colin Dean : https://github.com/colindean
+ //! komento: Mi estas malcerta se mi korekte traktis akuzativojn en tiu traduko.
+ //! Se ne, bonvolu korekti kaj avizi min por ke mi povas lerni!
+
+ var eo = moment__default.defineLocale('eo', {
+ months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'),
+ monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'),
+ weekdays : 'Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato'.split('_'),
+ weekdaysShort : 'Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab'.split('_'),
+ weekdaysMin : 'Di_Lu_Ma_Me_Ĵa_Ve_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'YYYY-MM-DD',
+ LL : 'D[-an de] MMMM, YYYY',
+ LLL : 'D[-an de] MMMM, YYYY HH:mm',
+ LLLL : 'dddd, [la] D[-an de] MMMM, YYYY HH:mm'
+ },
+ meridiemParse: /[ap]\.t\.m/i,
+ isPM: function (input) {
+ return input.charAt(0).toLowerCase() === 'p';
+ },
+ meridiem : function (hours, minutes, isLower) {
+ if (hours > 11) {
+ return isLower ? 'p.t.m.' : 'P.T.M.';
+ } else {
+ return isLower ? 'a.t.m.' : 'A.T.M.';
+ }
+ },
+ calendar : {
+ sameDay : '[Hodiaŭ je] LT',
+ nextDay : '[Morgaŭ je] LT',
+ nextWeek : 'dddd [je] LT',
+ lastDay : '[Hieraŭ je] LT',
+ lastWeek : '[pasinta] dddd [je] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'je %s',
+ past : 'antaŭ %s',
+ s : 'sekundoj',
+ m : 'minuto',
+ mm : '%d minutoj',
+ h : 'horo',
+ hh : '%d horoj',
+ d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo
+ dd : '%d tagoj',
+ M : 'monato',
+ MM : '%d monatoj',
+ y : 'jaro',
+ yy : '%d jaroj'
+ },
+ ordinalParse: /\d{1,2}a/,
+ ordinal : '%da',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : spanish (es)
+ //! author : Julio Napurí : https://github.com/julionc
+
+ var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'),
+ es__monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_');
+
+ var es = moment__default.defineLocale('es', {
+ months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
+ monthsShort : function (m, format) {
+ if (/-MMM-/.test(format)) {
+ return es__monthsShort[m.month()];
+ } else {
+ return monthsShortDot[m.month()];
+ }
+ },
+ weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
+ weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
+ weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D [de] MMMM [de] YYYY',
+ LLL : 'D [de] MMMM [de] YYYY H:mm',
+ LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm'
+ },
+ calendar : {
+ sameDay : function () {
+ return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
+ },
+ nextDay : function () {
+ return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
+ },
+ nextWeek : function () {
+ return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
+ },
+ lastDay : function () {
+ return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
+ },
+ lastWeek : function () {
+ return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'en %s',
+ past : 'hace %s',
+ s : 'unos segundos',
+ m : 'un minuto',
+ mm : '%d minutos',
+ h : 'una hora',
+ hh : '%d horas',
+ d : 'un día',
+ dd : '%d días',
+ M : 'un mes',
+ MM : '%d meses',
+ y : 'un año',
+ yy : '%d años'
+ },
+ ordinalParse : /\d{1,2}º/,
+ ordinal : '%dº',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : estonian (et)
+ //! author : Henry Kehlmann : https://github.com/madhenry
+ //! improvements : Illimar Tambek : https://github.com/ragulka
+
+ function et__processRelativeTime(number, withoutSuffix, key, isFuture) {
+ var format = {
+ 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'],
+ 'm' : ['ühe minuti', 'üks minut'],
+ 'mm': [number + ' minuti', number + ' minutit'],
+ 'h' : ['ühe tunni', 'tund aega', 'üks tund'],
+ 'hh': [number + ' tunni', number + ' tundi'],
+ 'd' : ['ühe päeva', 'üks päev'],
+ 'M' : ['kuu aja', 'kuu aega', 'üks kuu'],
+ 'MM': [number + ' kuu', number + ' kuud'],
+ 'y' : ['ühe aasta', 'aasta', 'üks aasta'],
+ 'yy': [number + ' aasta', number + ' aastat']
+ };
+ if (withoutSuffix) {
+ return format[key][2] ? format[key][2] : format[key][1];
+ }
+ return isFuture ? format[key][0] : format[key][1];
+ }
+
+ var et = moment__default.defineLocale('et', {
+ months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'),
+ monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'),
+ weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'),
+ weekdaysShort : 'P_E_T_K_N_R_L'.split('_'),
+ weekdaysMin : 'P_E_T_K_N_R_L'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY H:mm',
+ LLLL : 'dddd, D. MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay : '[Täna,] LT',
+ nextDay : '[Homme,] LT',
+ nextWeek : '[Järgmine] dddd LT',
+ lastDay : '[Eile,] LT',
+ lastWeek : '[Eelmine] dddd LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s pärast',
+ past : '%s tagasi',
+ s : et__processRelativeTime,
+ m : et__processRelativeTime,
+ mm : et__processRelativeTime,
+ h : et__processRelativeTime,
+ hh : et__processRelativeTime,
+ d : et__processRelativeTime,
+ dd : '%d päeva',
+ M : et__processRelativeTime,
+ MM : et__processRelativeTime,
+ y : et__processRelativeTime,
+ yy : et__processRelativeTime
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : euskara (eu)
+ //! author : Eneko Illarramendi : https://github.com/eillarra
+
+ var eu = moment__default.defineLocale('eu', {
+ months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'),
+ monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'),
+ weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'),
+ weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'),
+ weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'YYYY-MM-DD',
+ LL : 'YYYY[ko] MMMM[ren] D[a]',
+ LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm',
+ LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm',
+ l : 'YYYY-M-D',
+ ll : 'YYYY[ko] MMM D[a]',
+ lll : 'YYYY[ko] MMM D[a] HH:mm',
+ llll : 'ddd, YYYY[ko] MMM D[a] HH:mm'
+ },
+ calendar : {
+ sameDay : '[gaur] LT[etan]',
+ nextDay : '[bihar] LT[etan]',
+ nextWeek : 'dddd LT[etan]',
+ lastDay : '[atzo] LT[etan]',
+ lastWeek : '[aurreko] dddd LT[etan]',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s barru',
+ past : 'duela %s',
+ s : 'segundo batzuk',
+ m : 'minutu bat',
+ mm : '%d minutu',
+ h : 'ordu bat',
+ hh : '%d ordu',
+ d : 'egun bat',
+ dd : '%d egun',
+ M : 'hilabete bat',
+ MM : '%d hilabete',
+ y : 'urte bat',
+ yy : '%d urte'
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Persian (fa)
+ //! author : Ebrahim Byagowi : https://github.com/ebraminio
+
+ var fa__symbolMap = {
+ '1': '۱',
+ '2': '۲',
+ '3': '۳',
+ '4': '۴',
+ '5': '۵',
+ '6': '۶',
+ '7': '۷',
+ '8': '۸',
+ '9': '۹',
+ '0': '۰'
+ }, fa__numberMap = {
+ '۱': '1',
+ '۲': '2',
+ '۳': '3',
+ '۴': '4',
+ '۵': '5',
+ '۶': '6',
+ '۷': '7',
+ '۸': '8',
+ '۹': '9',
+ '۰': '0'
+ };
+
+ var fa = moment__default.defineLocale('fa', {
+ months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'),
+ monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'),
+ weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'),
+ weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'),
+ weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ meridiemParse: /قبل از ظهر|بعد از ظهر/,
+ isPM: function (input) {
+ return /بعد از ظهر/.test(input);
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 12) {
+ return 'قبل از ظهر';
+ } else {
+ return 'بعد از ظهر';
+ }
+ },
+ calendar : {
+ sameDay : '[امروز ساعت] LT',
+ nextDay : '[فردا ساعت] LT',
+ nextWeek : 'dddd [ساعت] LT',
+ lastDay : '[دیروز ساعت] LT',
+ lastWeek : 'dddd [پیش] [ساعت] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'در %s',
+ past : '%s پیش',
+ s : 'چندین ثانیه',
+ m : 'یک دقیقه',
+ mm : '%d دقیقه',
+ h : 'یک ساعت',
+ hh : '%d ساعت',
+ d : 'یک روز',
+ dd : '%d روز',
+ M : 'یک ماه',
+ MM : '%d ماه',
+ y : 'یک سال',
+ yy : '%d سال'
+ },
+ preparse: function (string) {
+ return string.replace(/[۰-۹]/g, function (match) {
+ return fa__numberMap[match];
+ }).replace(/،/g, ',');
+ },
+ postformat: function (string) {
+ return string.replace(/\d/g, function (match) {
+ return fa__symbolMap[match];
+ }).replace(/,/g, '،');
+ },
+ ordinalParse: /\d{1,2}م/,
+ ordinal : '%dم',
+ week : {
+ dow : 6, // Saturday is the first day of the week.
+ doy : 12 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : finnish (fi)
+ //! author : Tarmo Aidantausta : https://github.com/bleadof
+
+ var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '),
+ numbersFuture = [
+ 'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden',
+ numbersPast[7], numbersPast[8], numbersPast[9]
+ ];
+ function fi__translate(number, withoutSuffix, key, isFuture) {
+ var result = '';
+ switch (key) {
+ case 's':
+ return isFuture ? 'muutaman sekunnin' : 'muutama sekunti';
+ case 'm':
+ return isFuture ? 'minuutin' : 'minuutti';
+ case 'mm':
+ result = isFuture ? 'minuutin' : 'minuuttia';
+ break;
+ case 'h':
+ return isFuture ? 'tunnin' : 'tunti';
+ case 'hh':
+ result = isFuture ? 'tunnin' : 'tuntia';
+ break;
+ case 'd':
+ return isFuture ? 'päivän' : 'päivä';
+ case 'dd':
+ result = isFuture ? 'päivän' : 'päivää';
+ break;
+ case 'M':
+ return isFuture ? 'kuukauden' : 'kuukausi';
+ case 'MM':
+ result = isFuture ? 'kuukauden' : 'kuukautta';
+ break;
+ case 'y':
+ return isFuture ? 'vuoden' : 'vuosi';
+ case 'yy':
+ result = isFuture ? 'vuoden' : 'vuotta';
+ break;
+ }
+ result = verbalNumber(number, isFuture) + ' ' + result;
+ return result;
+ }
+ function verbalNumber(number, isFuture) {
+ return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number;
+ }
+
+ var fi = moment__default.defineLocale('fi', {
+ months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'),
+ monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'),
+ weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'),
+ weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'),
+ weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'),
+ longDateFormat : {
+ LT : 'HH.mm',
+ LTS : 'HH.mm.ss',
+ L : 'DD.MM.YYYY',
+ LL : 'Do MMMM[ta] YYYY',
+ LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm',
+ LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm',
+ l : 'D.M.YYYY',
+ ll : 'Do MMM YYYY',
+ lll : 'Do MMM YYYY, [klo] HH.mm',
+ llll : 'ddd, Do MMM YYYY, [klo] HH.mm'
+ },
+ calendar : {
+ sameDay : '[tänään] [klo] LT',
+ nextDay : '[huomenna] [klo] LT',
+ nextWeek : 'dddd [klo] LT',
+ lastDay : '[eilen] [klo] LT',
+ lastWeek : '[viime] dddd[na] [klo] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s päästä',
+ past : '%s sitten',
+ s : fi__translate,
+ m : fi__translate,
+ mm : fi__translate,
+ h : fi__translate,
+ hh : fi__translate,
+ d : fi__translate,
+ dd : fi__translate,
+ M : fi__translate,
+ MM : fi__translate,
+ y : fi__translate,
+ yy : fi__translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : faroese (fo)
+ //! author : Ragnar Johannesen : https://github.com/ragnar123
+
+ var fo = moment__default.defineLocale('fo', {
+ months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'),
+ monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'),
+ weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'),
+ weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'),
+ weekdaysMin : 'su_má_tý_mi_hó_fr_le'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D. MMMM, YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[Í dag kl.] LT',
+ nextDay : '[Í morgin kl.] LT',
+ nextWeek : 'dddd [kl.] LT',
+ lastDay : '[Í gjár kl.] LT',
+ lastWeek : '[síðstu] dddd [kl] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'um %s',
+ past : '%s síðani',
+ s : 'fá sekund',
+ m : 'ein minutt',
+ mm : '%d minuttir',
+ h : 'ein tími',
+ hh : '%d tímar',
+ d : 'ein dagur',
+ dd : '%d dagar',
+ M : 'ein mánaði',
+ MM : '%d mánaðir',
+ y : 'eitt ár',
+ yy : '%d ár'
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : canadian french (fr-ca)
+ //! author : Jonathan Abourbih : https://github.com/jonbca
+
+ var fr_ca = moment__default.defineLocale('fr-ca', {
+ months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
+ monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
+ weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
+ weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
+ weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'YYYY-MM-DD',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[Aujourd\'hui à] LT',
+ nextDay: '[Demain à] LT',
+ nextWeek: 'dddd [à] LT',
+ lastDay: '[Hier à] LT',
+ lastWeek: 'dddd [dernier à] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'dans %s',
+ past : 'il y a %s',
+ s : 'quelques secondes',
+ m : 'une minute',
+ mm : '%d minutes',
+ h : 'une heure',
+ hh : '%d heures',
+ d : 'un jour',
+ dd : '%d jours',
+ M : 'un mois',
+ MM : '%d mois',
+ y : 'un an',
+ yy : '%d ans'
+ },
+ ordinalParse: /\d{1,2}(er|e)/,
+ ordinal : function (number) {
+ return number + (number === 1 ? 'er' : 'e');
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : swiss french (fr)
+ //! author : Gaspard Bucher : https://github.com/gaspard
+
+ var fr_ch = moment__default.defineLocale('fr-ch', {
+ months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
+ monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
+ weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
+ weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
+ weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[Aujourd\'hui à] LT',
+ nextDay: '[Demain à] LT',
+ nextWeek: 'dddd [à] LT',
+ lastDay: '[Hier à] LT',
+ lastWeek: 'dddd [dernier à] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'dans %s',
+ past : 'il y a %s',
+ s : 'quelques secondes',
+ m : 'une minute',
+ mm : '%d minutes',
+ h : 'une heure',
+ hh : '%d heures',
+ d : 'un jour',
+ dd : '%d jours',
+ M : 'un mois',
+ MM : '%d mois',
+ y : 'un an',
+ yy : '%d ans'
+ },
+ ordinalParse: /\d{1,2}(er|e)/,
+ ordinal : function (number) {
+ return number + (number === 1 ? 'er' : 'e');
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : french (fr)
+ //! author : John Fischer : https://github.com/jfroffice
+
+ var fr = moment__default.defineLocale('fr', {
+ months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
+ monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
+ weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
+ weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
+ weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[Aujourd\'hui à] LT',
+ nextDay: '[Demain à] LT',
+ nextWeek: 'dddd [à] LT',
+ lastDay: '[Hier à] LT',
+ lastWeek: 'dddd [dernier à] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'dans %s',
+ past : 'il y a %s',
+ s : 'quelques secondes',
+ m : 'une minute',
+ mm : '%d minutes',
+ h : 'une heure',
+ hh : '%d heures',
+ d : 'un jour',
+ dd : '%d jours',
+ M : 'un mois',
+ MM : '%d mois',
+ y : 'un an',
+ yy : '%d ans'
+ },
+ ordinalParse: /\d{1,2}(er|)/,
+ ordinal : function (number) {
+ return number + (number === 1 ? 'er' : '');
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : frisian (fy)
+ //! author : Robin van der Vliet : https://github.com/robin0van0der0v
+
+ var fy__monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'),
+ fy__monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_');
+
+ var fy = moment__default.defineLocale('fy', {
+ months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'),
+ monthsShort : function (m, format) {
+ if (/-MMM-/.test(format)) {
+ return fy__monthsShortWithoutDots[m.month()];
+ } else {
+ return fy__monthsShortWithDots[m.month()];
+ }
+ },
+ weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'),
+ weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'),
+ weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD-MM-YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[hjoed om] LT',
+ nextDay: '[moarn om] LT',
+ nextWeek: 'dddd [om] LT',
+ lastDay: '[juster om] LT',
+ lastWeek: '[ôfrûne] dddd [om] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'oer %s',
+ past : '%s lyn',
+ s : 'in pear sekonden',
+ m : 'ien minút',
+ mm : '%d minuten',
+ h : 'ien oere',
+ hh : '%d oeren',
+ d : 'ien dei',
+ dd : '%d dagen',
+ M : 'ien moanne',
+ MM : '%d moannen',
+ y : 'ien jier',
+ yy : '%d jierren'
+ },
+ ordinalParse: /\d{1,2}(ste|de)/,
+ ordinal : function (number) {
+ return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de');
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : great britain scottish gealic (gd)
+ //! author : Jon Ashdown : https://github.com/jonashdown
+
+ var gd__months = [
+ 'Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd'
+ ];
+
+ var gd__monthsShort = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh'];
+
+ var gd__weekdays = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne'];
+
+ var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis'];
+
+ var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa'];
+
+ var gd = moment__default.defineLocale('gd', {
+ months : gd__months,
+ monthsShort : gd__monthsShort,
+ monthsParseExact : true,
+ weekdays : gd__weekdays,
+ weekdaysShort : weekdaysShort,
+ weekdaysMin : weekdaysMin,
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[An-diugh aig] LT',
+ nextDay : '[A-màireach aig] LT',
+ nextWeek : 'dddd [aig] LT',
+ lastDay : '[An-dè aig] LT',
+ lastWeek : 'dddd [seo chaidh] [aig] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'ann an %s',
+ past : 'bho chionn %s',
+ s : 'beagan diogan',
+ m : 'mionaid',
+ mm : '%d mionaidean',
+ h : 'uair',
+ hh : '%d uairean',
+ d : 'latha',
+ dd : '%d latha',
+ M : 'mìos',
+ MM : '%d mìosan',
+ y : 'bliadhna',
+ yy : '%d bliadhna'
+ },
+ ordinalParse : /\d{1,2}(d|na|mh)/,
+ ordinal : function (number) {
+ var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh';
+ return number + output;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : galician (gl)
+ //! author : Juan G. Hurtado : https://github.com/juanghurtado
+
+ var gl = moment__default.defineLocale('gl', {
+ months : 'Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro'.split('_'),
+ monthsShort : 'Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.'.split('_'),
+ weekdays : 'Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado'.split('_'),
+ weekdaysShort : 'Dom._Lun._Mar._Mér._Xov._Ven._Sáb.'.split('_'),
+ weekdaysMin : 'Do_Lu_Ma_Mé_Xo_Ve_Sá'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY H:mm',
+ LLLL : 'dddd D MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay : function () {
+ return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT';
+ },
+ nextDay : function () {
+ return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT';
+ },
+ nextWeek : function () {
+ return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT';
+ },
+ lastDay : function () {
+ return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT';
+ },
+ lastWeek : function () {
+ return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT';
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : function (str) {
+ if (str === 'uns segundos') {
+ return 'nuns segundos';
+ }
+ return 'en ' + str;
+ },
+ past : 'hai %s',
+ s : 'uns segundos',
+ m : 'un minuto',
+ mm : '%d minutos',
+ h : 'unha hora',
+ hh : '%d horas',
+ d : 'un día',
+ dd : '%d días',
+ M : 'un mes',
+ MM : '%d meses',
+ y : 'un ano',
+ yy : '%d anos'
+ },
+ ordinalParse : /\d{1,2}º/,
+ ordinal : '%dº',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Hebrew (he)
+ //! author : Tomer Cohen : https://github.com/tomer
+ //! author : Moshe Simantov : https://github.com/DevelopmentIL
+ //! author : Tal Ater : https://github.com/TalAter
+
+ var he = moment__default.defineLocale('he', {
+ months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'),
+ monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'),
+ weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'),
+ weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'),
+ weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D [ב]MMMM YYYY',
+ LLL : 'D [ב]MMMM YYYY HH:mm',
+ LLLL : 'dddd, D [ב]MMMM YYYY HH:mm',
+ l : 'D/M/YYYY',
+ ll : 'D MMM YYYY',
+ lll : 'D MMM YYYY HH:mm',
+ llll : 'ddd, D MMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[היום ב־]LT',
+ nextDay : '[מחר ב־]LT',
+ nextWeek : 'dddd [בשעה] LT',
+ lastDay : '[אתמול ב־]LT',
+ lastWeek : '[ביום] dddd [האחרון בשעה] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'בעוד %s',
+ past : 'לפני %s',
+ s : 'מספר שניות',
+ m : 'דקה',
+ mm : '%d דקות',
+ h : 'שעה',
+ hh : function (number) {
+ if (number === 2) {
+ return 'שעתיים';
+ }
+ return number + ' שעות';
+ },
+ d : 'יום',
+ dd : function (number) {
+ if (number === 2) {
+ return 'יומיים';
+ }
+ return number + ' ימים';
+ },
+ M : 'חודש',
+ MM : function (number) {
+ if (number === 2) {
+ return 'חודשיים';
+ }
+ return number + ' חודשים';
+ },
+ y : 'שנה',
+ yy : function (number) {
+ if (number === 2) {
+ return 'שנתיים';
+ } else if (number % 10 === 0 && number !== 10) {
+ return number + ' שנה';
+ }
+ return number + ' שנים';
+ }
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : hindi (hi)
+ //! author : Mayank Singhal : https://github.com/mayanksinghal
+
+ var hi__symbolMap = {
+ '1': '१',
+ '2': '२',
+ '3': '३',
+ '4': '४',
+ '5': '५',
+ '6': '६',
+ '7': '७',
+ '8': '८',
+ '9': '९',
+ '0': '०'
+ },
+ hi__numberMap = {
+ '१': '1',
+ '२': '2',
+ '३': '3',
+ '४': '4',
+ '५': '5',
+ '६': '6',
+ '७': '7',
+ '८': '8',
+ '९': '9',
+ '०': '0'
+ };
+
+ var hi = moment__default.defineLocale('hi', {
+ months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'),
+ monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'),
+ weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
+ weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'),
+ weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'),
+ longDateFormat : {
+ LT : 'A h:mm बजे',
+ LTS : 'A h:mm:ss बजे',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY, A h:mm बजे',
+ LLLL : 'dddd, D MMMM YYYY, A h:mm बजे'
+ },
+ calendar : {
+ sameDay : '[आज] LT',
+ nextDay : '[कल] LT',
+ nextWeek : 'dddd, LT',
+ lastDay : '[कल] LT',
+ lastWeek : '[पिछले] dddd, LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s में',
+ past : '%s पहले',
+ s : 'कुछ ही क्षण',
+ m : 'एक मिनट',
+ mm : '%d मिनट',
+ h : 'एक घंटा',
+ hh : '%d घंटे',
+ d : 'एक दिन',
+ dd : '%d दिन',
+ M : 'एक महीने',
+ MM : '%d महीने',
+ y : 'एक वर्ष',
+ yy : '%d वर्ष'
+ },
+ preparse: function (string) {
+ return string.replace(/[१२३४५६७८९०]/g, function (match) {
+ return hi__numberMap[match];
+ });
+ },
+ postformat: function (string) {
+ return string.replace(/\d/g, function (match) {
+ return hi__symbolMap[match];
+ });
+ },
+ // Hindi notation for meridiems are quite fuzzy in practice. While there exists
+ // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi.
+ meridiemParse: /रात|सुबह|दोपहर|शाम/,
+ meridiemHour : function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === 'रात') {
+ return hour < 4 ? hour : hour + 12;
+ } else if (meridiem === 'सुबह') {
+ return hour;
+ } else if (meridiem === 'दोपहर') {
+ return hour >= 10 ? hour : hour + 12;
+ } else if (meridiem === 'शाम') {
+ return hour + 12;
+ }
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 4) {
+ return 'रात';
+ } else if (hour < 10) {
+ return 'सुबह';
+ } else if (hour < 17) {
+ return 'दोपहर';
+ } else if (hour < 20) {
+ return 'शाम';
+ } else {
+ return 'रात';
+ }
+ },
+ week : {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : hrvatski (hr)
+ //! author : Bojan Marković : https://github.com/bmarkovic
+
+ function hr__translate(number, withoutSuffix, key) {
+ var result = number + ' ';
+ switch (key) {
+ case 'm':
+ return withoutSuffix ? 'jedna minuta' : 'jedne minute';
+ case 'mm':
+ if (number === 1) {
+ result += 'minuta';
+ } else if (number === 2 || number === 3 || number === 4) {
+ result += 'minute';
+ } else {
+ result += 'minuta';
+ }
+ return result;
+ case 'h':
+ return withoutSuffix ? 'jedan sat' : 'jednog sata';
+ case 'hh':
+ if (number === 1) {
+ result += 'sat';
+ } else if (number === 2 || number === 3 || number === 4) {
+ result += 'sata';
+ } else {
+ result += 'sati';
+ }
+ return result;
+ case 'dd':
+ if (number === 1) {
+ result += 'dan';
+ } else {
+ result += 'dana';
+ }
+ return result;
+ case 'MM':
+ if (number === 1) {
+ result += 'mjesec';
+ } else if (number === 2 || number === 3 || number === 4) {
+ result += 'mjeseca';
+ } else {
+ result += 'mjeseci';
+ }
+ return result;
+ case 'yy':
+ if (number === 1) {
+ result += 'godina';
+ } else if (number === 2 || number === 3 || number === 4) {
+ result += 'godine';
+ } else {
+ result += 'godina';
+ }
+ return result;
+ }
+ }
+
+ var hr = moment__default.defineLocale('hr', {
+ months : {
+ format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split('_'),
+ standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_')
+ },
+ monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'),
+ weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'),
+ weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
+ weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD. MM. YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY H:mm',
+ LLLL : 'dddd, D. MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay : '[danas u] LT',
+ nextDay : '[sutra u] LT',
+ nextWeek : function () {
+ switch (this.day()) {
+ case 0:
+ return '[u] [nedjelju] [u] LT';
+ case 3:
+ return '[u] [srijedu] [u] LT';
+ case 6:
+ return '[u] [subotu] [u] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[u] dddd [u] LT';
+ }
+ },
+ lastDay : '[jučer u] LT',
+ lastWeek : function () {
+ switch (this.day()) {
+ case 0:
+ case 3:
+ return '[prošlu] dddd [u] LT';
+ case 6:
+ return '[prošle] [subote] [u] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[prošli] dddd [u] LT';
+ }
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'za %s',
+ past : 'prije %s',
+ s : 'par sekundi',
+ m : hr__translate,
+ mm : hr__translate,
+ h : hr__translate,
+ hh : hr__translate,
+ d : 'dan',
+ dd : hr__translate,
+ M : 'mjesec',
+ MM : hr__translate,
+ y : 'godinu',
+ yy : hr__translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : hungarian (hu)
+ //! author : Adam Brunner : https://github.com/adambrunner
+
+ var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' ');
+ function hu__translate(number, withoutSuffix, key, isFuture) {
+ var num = number,
+ suffix;
+ switch (key) {
+ case 's':
+ return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce';
+ case 'm':
+ return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce');
+ case 'mm':
+ return num + (isFuture || withoutSuffix ? ' perc' : ' perce');
+ case 'h':
+ return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája');
+ case 'hh':
+ return num + (isFuture || withoutSuffix ? ' óra' : ' órája');
+ case 'd':
+ return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja');
+ case 'dd':
+ return num + (isFuture || withoutSuffix ? ' nap' : ' napja');
+ case 'M':
+ return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
+ case 'MM':
+ return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
+ case 'y':
+ return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve');
+ case 'yy':
+ return num + (isFuture || withoutSuffix ? ' év' : ' éve');
+ }
+ return '';
+ }
+ function week(isFuture) {
+ return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]';
+ }
+
+ var hu = moment__default.defineLocale('hu', {
+ months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'),
+ monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'),
+ weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'),
+ weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'),
+ weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'YYYY.MM.DD.',
+ LL : 'YYYY. MMMM D.',
+ LLL : 'YYYY. MMMM D. H:mm',
+ LLLL : 'YYYY. MMMM D., dddd H:mm'
+ },
+ meridiemParse: /de|du/i,
+ isPM: function (input) {
+ return input.charAt(1).toLowerCase() === 'u';
+ },
+ meridiem : function (hours, minutes, isLower) {
+ if (hours < 12) {
+ return isLower === true ? 'de' : 'DE';
+ } else {
+ return isLower === true ? 'du' : 'DU';
+ }
+ },
+ calendar : {
+ sameDay : '[ma] LT[-kor]',
+ nextDay : '[holnap] LT[-kor]',
+ nextWeek : function () {
+ return week.call(this, true);
+ },
+ lastDay : '[tegnap] LT[-kor]',
+ lastWeek : function () {
+ return week.call(this, false);
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s múlva',
+ past : '%s',
+ s : hu__translate,
+ m : hu__translate,
+ mm : hu__translate,
+ h : hu__translate,
+ hh : hu__translate,
+ d : hu__translate,
+ dd : hu__translate,
+ M : hu__translate,
+ MM : hu__translate,
+ y : hu__translate,
+ yy : hu__translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Armenian (hy-am)
+ //! author : Armendarabyan : https://github.com/armendarabyan
+
+ var hy_am = moment__default.defineLocale('hy-am', {
+ months : {
+ format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_'),
+ standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_')
+ },
+ monthsShort : 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'),
+ weekdays : 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_'),
+ weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'),
+ weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY թ.',
+ LLL : 'D MMMM YYYY թ., HH:mm',
+ LLLL : 'dddd, D MMMM YYYY թ., HH:mm'
+ },
+ calendar : {
+ sameDay: '[այսօր] LT',
+ nextDay: '[վաղը] LT',
+ lastDay: '[երեկ] LT',
+ nextWeek: function () {
+ return 'dddd [օրը ժամը] LT';
+ },
+ lastWeek: function () {
+ return '[անցած] dddd [օրը ժամը] LT';
+ },
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : '%s հետո',
+ past : '%s առաջ',
+ s : 'մի քանի վայրկյան',
+ m : 'րոպե',
+ mm : '%d րոպե',
+ h : 'ժամ',
+ hh : '%d ժամ',
+ d : 'օր',
+ dd : '%d օր',
+ M : 'ամիս',
+ MM : '%d ամիս',
+ y : 'տարի',
+ yy : '%d տարի'
+ },
+ meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,
+ isPM: function (input) {
+ return /^(ցերեկվա|երեկոյան)$/.test(input);
+ },
+ meridiem : function (hour) {
+ if (hour < 4) {
+ return 'գիշերվա';
+ } else if (hour < 12) {
+ return 'առավոտվա';
+ } else if (hour < 17) {
+ return 'ցերեկվա';
+ } else {
+ return 'երեկոյան';
+ }
+ },
+ ordinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/,
+ ordinal: function (number, period) {
+ switch (period) {
+ case 'DDD':
+ case 'w':
+ case 'W':
+ case 'DDDo':
+ if (number === 1) {
+ return number + '-ին';
+ }
+ return number + '-րդ';
+ default:
+ return number;
+ }
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Bahasa Indonesia (id)
+ //! author : Mohammad Satrio Utomo : https://github.com/tyok
+ //! reference: http://id.wikisource.org/wiki/Pedoman_Umum_Ejaan_Bahasa_Indonesia_yang_Disempurnakan
+
+ var id = moment__default.defineLocale('id', {
+ months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'),
+ monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des'.split('_'),
+ weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'),
+ weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'),
+ weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'),
+ longDateFormat : {
+ LT : 'HH.mm',
+ LTS : 'HH.mm.ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY [pukul] HH.mm',
+ LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
+ },
+ meridiemParse: /pagi|siang|sore|malam/,
+ meridiemHour : function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === 'pagi') {
+ return hour;
+ } else if (meridiem === 'siang') {
+ return hour >= 11 ? hour : hour + 12;
+ } else if (meridiem === 'sore' || meridiem === 'malam') {
+ return hour + 12;
+ }
+ },
+ meridiem : function (hours, minutes, isLower) {
+ if (hours < 11) {
+ return 'pagi';
+ } else if (hours < 15) {
+ return 'siang';
+ } else if (hours < 19) {
+ return 'sore';
+ } else {
+ return 'malam';
+ }
+ },
+ calendar : {
+ sameDay : '[Hari ini pukul] LT',
+ nextDay : '[Besok pukul] LT',
+ nextWeek : 'dddd [pukul] LT',
+ lastDay : '[Kemarin pukul] LT',
+ lastWeek : 'dddd [lalu pukul] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'dalam %s',
+ past : '%s yang lalu',
+ s : 'beberapa detik',
+ m : 'semenit',
+ mm : '%d menit',
+ h : 'sejam',
+ hh : '%d jam',
+ d : 'sehari',
+ dd : '%d hari',
+ M : 'sebulan',
+ MM : '%d bulan',
+ y : 'setahun',
+ yy : '%d tahun'
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : icelandic (is)
+ //! author : Hinrik Örn Sigurðsson : https://github.com/hinrik
+
+ function is__plural(n) {
+ if (n % 100 === 11) {
+ return true;
+ } else if (n % 10 === 1) {
+ return false;
+ }
+ return true;
+ }
+ function is__translate(number, withoutSuffix, key, isFuture) {
+ var result = number + ' ';
+ switch (key) {
+ case 's':
+ return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum';
+ case 'm':
+ return withoutSuffix ? 'mínúta' : 'mínútu';
+ case 'mm':
+ if (is__plural(number)) {
+ return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum');
+ } else if (withoutSuffix) {
+ return result + 'mínúta';
+ }
+ return result + 'mínútu';
+ case 'hh':
+ if (is__plural(number)) {
+ return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum');
+ }
+ return result + 'klukkustund';
+ case 'd':
+ if (withoutSuffix) {
+ return 'dagur';
+ }
+ return isFuture ? 'dag' : 'degi';
+ case 'dd':
+ if (is__plural(number)) {
+ if (withoutSuffix) {
+ return result + 'dagar';
+ }
+ return result + (isFuture ? 'daga' : 'dögum');
+ } else if (withoutSuffix) {
+ return result + 'dagur';
+ }
+ return result + (isFuture ? 'dag' : 'degi');
+ case 'M':
+ if (withoutSuffix) {
+ return 'mánuður';
+ }
+ return isFuture ? 'mánuð' : 'mánuði';
+ case 'MM':
+ if (is__plural(number)) {
+ if (withoutSuffix) {
+ return result + 'mánuðir';
+ }
+ return result + (isFuture ? 'mánuði' : 'mánuðum');
+ } else if (withoutSuffix) {
+ return result + 'mánuður';
+ }
+ return result + (isFuture ? 'mánuð' : 'mánuði');
+ case 'y':
+ return withoutSuffix || isFuture ? 'ár' : 'ári';
+ case 'yy':
+ if (is__plural(number)) {
+ return result + (withoutSuffix || isFuture ? 'ár' : 'árum');
+ }
+ return result + (withoutSuffix || isFuture ? 'ár' : 'ári');
+ }
+ }
+
+ var is = moment__default.defineLocale('is', {
+ months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'),
+ monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'),
+ weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'),
+ weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'),
+ weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY [kl.] H:mm',
+ LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm'
+ },
+ calendar : {
+ sameDay : '[í dag kl.] LT',
+ nextDay : '[á morgun kl.] LT',
+ nextWeek : 'dddd [kl.] LT',
+ lastDay : '[í gær kl.] LT',
+ lastWeek : '[síðasta] dddd [kl.] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'eftir %s',
+ past : 'fyrir %s síðan',
+ s : is__translate,
+ m : is__translate,
+ mm : is__translate,
+ h : 'klukkustund',
+ hh : is__translate,
+ d : is__translate,
+ dd : is__translate,
+ M : is__translate,
+ MM : is__translate,
+ y : is__translate,
+ yy : is__translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : italian (it)
+ //! author : Lorenzo : https://github.com/aliem
+ //! author: Mattia Larentis: https://github.com/nostalgiaz
+
+ var it = moment__default.defineLocale('it', {
+ months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'),
+ monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'),
+ weekdays : 'Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato'.split('_'),
+ weekdaysShort : 'Dom_Lun_Mar_Mer_Gio_Ven_Sab'.split('_'),
+ weekdaysMin : 'Do_Lu_Ma_Me_Gi_Ve_Sa'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[Oggi alle] LT',
+ nextDay: '[Domani alle] LT',
+ nextWeek: 'dddd [alle] LT',
+ lastDay: '[Ieri alle] LT',
+ lastWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[la scorsa] dddd [alle] LT';
+ default:
+ return '[lo scorso] dddd [alle] LT';
+ }
+ },
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : function (s) {
+ return ((/^[0-9].+$/).test(s) ? 'tra' : 'in') + ' ' + s;
+ },
+ past : '%s fa',
+ s : 'alcuni secondi',
+ m : 'un minuto',
+ mm : '%d minuti',
+ h : 'un\'ora',
+ hh : '%d ore',
+ d : 'un giorno',
+ dd : '%d giorni',
+ M : 'un mese',
+ MM : '%d mesi',
+ y : 'un anno',
+ yy : '%d anni'
+ },
+ ordinalParse : /\d{1,2}º/,
+ ordinal: '%dº',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : japanese (ja)
+ //! author : LI Long : https://github.com/baryon
+
+ var ja = moment__default.defineLocale('ja', {
+ months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
+ monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
+ weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'),
+ weekdaysShort : '日_月_火_水_木_金_土'.split('_'),
+ weekdaysMin : '日_月_火_水_木_金_土'.split('_'),
+ longDateFormat : {
+ LT : 'Ah時m分',
+ LTS : 'Ah時m分s秒',
+ L : 'YYYY/MM/DD',
+ LL : 'YYYY年M月D日',
+ LLL : 'YYYY年M月D日Ah時m分',
+ LLLL : 'YYYY年M月D日Ah時m分 dddd'
+ },
+ meridiemParse: /午前|午後/i,
+ isPM : function (input) {
+ return input === '午後';
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 12) {
+ return '午前';
+ } else {
+ return '午後';
+ }
+ },
+ calendar : {
+ sameDay : '[今日] LT',
+ nextDay : '[明日] LT',
+ nextWeek : '[来週]dddd LT',
+ lastDay : '[昨日] LT',
+ lastWeek : '[前週]dddd LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s後',
+ past : '%s前',
+ s : '数秒',
+ m : '1分',
+ mm : '%d分',
+ h : '1時間',
+ hh : '%d時間',
+ d : '1日',
+ dd : '%d日',
+ M : '1ヶ月',
+ MM : '%dヶ月',
+ y : '1年',
+ yy : '%d年'
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Boso Jowo (jv)
+ //! author : Rony Lantip : https://github.com/lantip
+ //! reference: http://jv.wikipedia.org/wiki/Basa_Jawa
+
+ var jv = moment__default.defineLocale('jv', {
+ months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'),
+ monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'),
+ weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'),
+ weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'),
+ weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'),
+ longDateFormat : {
+ LT : 'HH.mm',
+ LTS : 'HH.mm.ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY [pukul] HH.mm',
+ LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
+ },
+ meridiemParse: /enjing|siyang|sonten|ndalu/,
+ meridiemHour : function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === 'enjing') {
+ return hour;
+ } else if (meridiem === 'siyang') {
+ return hour >= 11 ? hour : hour + 12;
+ } else if (meridiem === 'sonten' || meridiem === 'ndalu') {
+ return hour + 12;
+ }
+ },
+ meridiem : function (hours, minutes, isLower) {
+ if (hours < 11) {
+ return 'enjing';
+ } else if (hours < 15) {
+ return 'siyang';
+ } else if (hours < 19) {
+ return 'sonten';
+ } else {
+ return 'ndalu';
+ }
+ },
+ calendar : {
+ sameDay : '[Dinten puniko pukul] LT',
+ nextDay : '[Mbenjang pukul] LT',
+ nextWeek : 'dddd [pukul] LT',
+ lastDay : '[Kala wingi pukul] LT',
+ lastWeek : 'dddd [kepengker pukul] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'wonten ing %s',
+ past : '%s ingkang kepengker',
+ s : 'sawetawis detik',
+ m : 'setunggal menit',
+ mm : '%d menit',
+ h : 'setunggal jam',
+ hh : '%d jam',
+ d : 'sedinten',
+ dd : '%d dinten',
+ M : 'sewulan',
+ MM : '%d wulan',
+ y : 'setaun',
+ yy : '%d taun'
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Georgian (ka)
+ //! author : Irakli Janiashvili : https://github.com/irakli-janiashvili
+
+ var ka = moment__default.defineLocale('ka', {
+ months : {
+ standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'),
+ format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_')
+ },
+ monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'),
+ weekdays : {
+ standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'),
+ format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'),
+ isFormat: /(წინა|შემდეგ)/
+ },
+ weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'),
+ weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'),
+ longDateFormat : {
+ LT : 'h:mm A',
+ LTS : 'h:mm:ss A',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY h:mm A',
+ LLLL : 'dddd, D MMMM YYYY h:mm A'
+ },
+ calendar : {
+ sameDay : '[დღეს] LT[-ზე]',
+ nextDay : '[ხვალ] LT[-ზე]',
+ lastDay : '[გუშინ] LT[-ზე]',
+ nextWeek : '[შემდეგ] dddd LT[-ზე]',
+ lastWeek : '[წინა] dddd LT-ზე',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : function (s) {
+ return (/(წამი|წუთი|საათი|წელი)/).test(s) ?
+ s.replace(/ი$/, 'ში') :
+ s + 'ში';
+ },
+ past : function (s) {
+ if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) {
+ return s.replace(/(ი|ე)$/, 'ის წინ');
+ }
+ if ((/წელი/).test(s)) {
+ return s.replace(/წელი$/, 'წლის წინ');
+ }
+ },
+ s : 'რამდენიმე წამი',
+ m : 'წუთი',
+ mm : '%d წუთი',
+ h : 'საათი',
+ hh : '%d საათი',
+ d : 'დღე',
+ dd : '%d დღე',
+ M : 'თვე',
+ MM : '%d თვე',
+ y : 'წელი',
+ yy : '%d წელი'
+ },
+ ordinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,
+ ordinal : function (number) {
+ if (number === 0) {
+ return number;
+ }
+ if (number === 1) {
+ return number + '-ლი';
+ }
+ if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) {
+ return 'მე-' + number;
+ }
+ return number + '-ე';
+ },
+ week : {
+ dow : 1,
+ doy : 7
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : kazakh (kk)
+ //! authors : Nurlan Rakhimzhanov : https://github.com/nurlan
+
+ var kk__suffixes = {
+ 0: '-ші',
+ 1: '-ші',
+ 2: '-ші',
+ 3: '-ші',
+ 4: '-ші',
+ 5: '-ші',
+ 6: '-шы',
+ 7: '-ші',
+ 8: '-ші',
+ 9: '-шы',
+ 10: '-шы',
+ 20: '-шы',
+ 30: '-шы',
+ 40: '-шы',
+ 50: '-ші',
+ 60: '-шы',
+ 70: '-ші',
+ 80: '-ші',
+ 90: '-шы',
+ 100: '-ші'
+ };
+
+ var kk = moment__default.defineLocale('kk', {
+ months : 'Қаңтар_Ақпан_Наурыз_Сәуір_Мамыр_Маусым_Шілде_Тамыз_Қыркүйек_Қазан_Қараша_Желтоқсан'.split('_'),
+ monthsShort : 'Қаң_Ақп_Нау_Сәу_Мам_Мау_Шіл_Там_Қыр_Қаз_Қар_Жел'.split('_'),
+ weekdays : 'Жексенбі_Дүйсенбі_Сейсенбі_Сәрсенбі_Бейсенбі_Жұма_Сенбі'.split('_'),
+ weekdaysShort : 'Жек_Дүй_Сей_Сәр_Бей_Жұм_Сен'.split('_'),
+ weekdaysMin : 'Жк_Дй_Сй_Ср_Бй_Жм_Сн'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[Бүгін сағат] LT',
+ nextDay : '[Ертең сағат] LT',
+ nextWeek : 'dddd [сағат] LT',
+ lastDay : '[Кеше сағат] LT',
+ lastWeek : '[Өткен аптаның] dddd [сағат] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s ішінде',
+ past : '%s бұрын',
+ s : 'бірнеше секунд',
+ m : 'бір минут',
+ mm : '%d минут',
+ h : 'бір сағат',
+ hh : '%d сағат',
+ d : 'бір күн',
+ dd : '%d күн',
+ M : 'бір ай',
+ MM : '%d ай',
+ y : 'бір жыл',
+ yy : '%d жыл'
+ },
+ ordinalParse: /\d{1,2}-(ші|шы)/,
+ ordinal : function (number) {
+ var a = number % 10,
+ b = number >= 100 ? 100 : null;
+ return number + (kk__suffixes[number] || kk__suffixes[a] || kk__suffixes[b]);
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : khmer (km)
+ //! author : Kruy Vanna : https://github.com/kruyvanna
+
+ var km = moment__default.defineLocale('km', {
+ months: 'មករា_កុម្ភៈ_មិនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'),
+ monthsShort: 'មករា_កុម្ភៈ_មិនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'),
+ weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
+ weekdaysShort: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
+ weekdaysMin: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
+ longDateFormat: {
+ LT: 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L: 'DD/MM/YYYY',
+ LL: 'D MMMM YYYY',
+ LLL: 'D MMMM YYYY HH:mm',
+ LLLL: 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar: {
+ sameDay: '[ថ្ងៃនេះ ម៉ោង] LT',
+ nextDay: '[ស្អែក ម៉ោង] LT',
+ nextWeek: 'dddd [ម៉ោង] LT',
+ lastDay: '[ម្សិលមិញ ម៉ោង] LT',
+ lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT',
+ sameElse: 'L'
+ },
+ relativeTime: {
+ future: '%sទៀត',
+ past: '%sមុន',
+ s: 'ប៉ុន្មានវិនាទី',
+ m: 'មួយនាទី',
+ mm: '%d នាទី',
+ h: 'មួយម៉ោង',
+ hh: '%d ម៉ោង',
+ d: 'មួយថ្ងៃ',
+ dd: '%d ថ្ងៃ',
+ M: 'មួយខែ',
+ MM: '%d ខែ',
+ y: 'មួយឆ្នាំ',
+ yy: '%d ឆ្នាំ'
+ },
+ week: {
+ dow: 1, // Monday is the first day of the week.
+ doy: 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : korean (ko)
+ //!
+ //! authors
+ //!
+ //! - Kyungwook, Park : https://github.com/kyungw00k
+ //! - Jeeeyul Lee <jeeeyul@gmail.com>
+
+ var ko = moment__default.defineLocale('ko', {
+ months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'),
+ monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'),
+ weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'),
+ weekdaysShort : '일_월_화_수_목_금_토'.split('_'),
+ weekdaysMin : '일_월_화_수_목_금_토'.split('_'),
+ longDateFormat : {
+ LT : 'A h시 m분',
+ LTS : 'A h시 m분 s초',
+ L : 'YYYY.MM.DD',
+ LL : 'YYYY년 MMMM D일',
+ LLL : 'YYYY년 MMMM D일 A h시 m분',
+ LLLL : 'YYYY년 MMMM D일 dddd A h시 m분'
+ },
+ calendar : {
+ sameDay : '오늘 LT',
+ nextDay : '내일 LT',
+ nextWeek : 'dddd LT',
+ lastDay : '어제 LT',
+ lastWeek : '지난주 dddd LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s 후',
+ past : '%s 전',
+ s : '몇초',
+ ss : '%d초',
+ m : '일분',
+ mm : '%d분',
+ h : '한시간',
+ hh : '%d시간',
+ d : '하루',
+ dd : '%d일',
+ M : '한달',
+ MM : '%d달',
+ y : '일년',
+ yy : '%d년'
+ },
+ ordinalParse : /\d{1,2}일/,
+ ordinal : '%d일',
+ meridiemParse : /오전|오후/,
+ isPM : function (token) {
+ return token === '오후';
+ },
+ meridiem : function (hour, minute, isUpper) {
+ return hour < 12 ? '오전' : '오후';
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Luxembourgish (lb)
+ //! author : mweimerskirch : https://github.com/mweimerskirch, David Raison : https://github.com/kwisatz
+
+ function lb__processRelativeTime(number, withoutSuffix, key, isFuture) {
+ var format = {
+ 'm': ['eng Minutt', 'enger Minutt'],
+ 'h': ['eng Stonn', 'enger Stonn'],
+ 'd': ['een Dag', 'engem Dag'],
+ 'M': ['ee Mount', 'engem Mount'],
+ 'y': ['ee Joer', 'engem Joer']
+ };
+ return withoutSuffix ? format[key][0] : format[key][1];
+ }
+ function processFutureTime(string) {
+ var number = string.substr(0, string.indexOf(' '));
+ if (eifelerRegelAppliesToNumber(number)) {
+ return 'a ' + string;
+ }
+ return 'an ' + string;
+ }
+ function processPastTime(string) {
+ var number = string.substr(0, string.indexOf(' '));
+ if (eifelerRegelAppliesToNumber(number)) {
+ return 'viru ' + string;
+ }
+ return 'virun ' + string;
+ }
+ /**
+ * Returns true if the word before the given number loses the '-n' ending.
+ * e.g. 'an 10 Deeg' but 'a 5 Deeg'
+ *
+ * @param number {integer}
+ * @returns {boolean}
+ */
+ function eifelerRegelAppliesToNumber(number) {
+ number = parseInt(number, 10);
+ if (isNaN(number)) {
+ return false;
+ }
+ if (number < 0) {
+ // Negative Number --> always true
+ return true;
+ } else if (number < 10) {
+ // Only 1 digit
+ if (4 <= number && number <= 7) {
+ return true;
+ }
+ return false;
+ } else if (number < 100) {
+ // 2 digits
+ var lastDigit = number % 10, firstDigit = number / 10;
+ if (lastDigit === 0) {
+ return eifelerRegelAppliesToNumber(firstDigit);
+ }
+ return eifelerRegelAppliesToNumber(lastDigit);
+ } else if (number < 10000) {
+ // 3 or 4 digits --> recursively check first digit
+ while (number >= 10) {
+ number = number / 10;
+ }
+ return eifelerRegelAppliesToNumber(number);
+ } else {
+ // Anything larger than 4 digits: recursively check first n-3 digits
+ number = number / 1000;
+ return eifelerRegelAppliesToNumber(number);
+ }
+ }
+
+ var lb = moment__default.defineLocale('lb', {
+ months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
+ monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
+ weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'),
+ weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'),
+ weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'),
+ longDateFormat: {
+ LT: 'H:mm [Auer]',
+ LTS: 'H:mm:ss [Auer]',
+ L: 'DD.MM.YYYY',
+ LL: 'D. MMMM YYYY',
+ LLL: 'D. MMMM YYYY H:mm [Auer]',
+ LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]'
+ },
+ calendar: {
+ sameDay: '[Haut um] LT',
+ sameElse: 'L',
+ nextDay: '[Muer um] LT',
+ nextWeek: 'dddd [um] LT',
+ lastDay: '[Gëschter um] LT',
+ lastWeek: function () {
+ // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule
+ switch (this.day()) {
+ case 2:
+ case 4:
+ return '[Leschten] dddd [um] LT';
+ default:
+ return '[Leschte] dddd [um] LT';
+ }
+ }
+ },
+ relativeTime : {
+ future : processFutureTime,
+ past : processPastTime,
+ s : 'e puer Sekonnen',
+ m : lb__processRelativeTime,
+ mm : '%d Minutten',
+ h : lb__processRelativeTime,
+ hh : '%d Stonnen',
+ d : lb__processRelativeTime,
+ dd : '%d Deeg',
+ M : lb__processRelativeTime,
+ MM : '%d Méint',
+ y : lb__processRelativeTime,
+ yy : '%d Joer'
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal: '%d.',
+ week: {
+ dow: 1, // Monday is the first day of the week.
+ doy: 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : lao (lo)
+ //! author : Ryan Hart : https://github.com/ryanhart2
+
+ var lo = moment__default.defineLocale('lo', {
+ months : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'),
+ monthsShort : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'),
+ weekdays : 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'),
+ weekdaysShort : 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'),
+ weekdaysMin : 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'ວັນdddd D MMMM YYYY HH:mm'
+ },
+ meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/,
+ isPM: function (input) {
+ return input === 'ຕອນແລງ';
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 12) {
+ return 'ຕອນເຊົ້າ';
+ } else {
+ return 'ຕອນແລງ';
+ }
+ },
+ calendar : {
+ sameDay : '[ມື້ນີ້ເວລາ] LT',
+ nextDay : '[ມື້ອື່ນເວລາ] LT',
+ nextWeek : '[ວັນ]dddd[ໜ້າເວລາ] LT',
+ lastDay : '[ມື້ວານນີ້ເວລາ] LT',
+ lastWeek : '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'ອີກ %s',
+ past : '%sຜ່ານມາ',
+ s : 'ບໍ່ເທົ່າໃດວິນາທີ',
+ m : '1 ນາທີ',
+ mm : '%d ນາທີ',
+ h : '1 ຊົ່ວໂມງ',
+ hh : '%d ຊົ່ວໂມງ',
+ d : '1 ມື້',
+ dd : '%d ມື້',
+ M : '1 ເດືອນ',
+ MM : '%d ເດືອນ',
+ y : '1 ປີ',
+ yy : '%d ປີ'
+ },
+ ordinalParse: /(ທີ່)\d{1,2}/,
+ ordinal : function (number) {
+ return 'ທີ່' + number;
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Lithuanian (lt)
+ //! author : Mindaugas Mozūras : https://github.com/mmozuras
+
+ var lt__units = {
+ 'm' : 'minutė_minutės_minutę',
+ 'mm': 'minutės_minučių_minutes',
+ 'h' : 'valanda_valandos_valandą',
+ 'hh': 'valandos_valandų_valandas',
+ 'd' : 'diena_dienos_dieną',
+ 'dd': 'dienos_dienų_dienas',
+ 'M' : 'mėnuo_mėnesio_mėnesį',
+ 'MM': 'mėnesiai_mėnesių_mėnesius',
+ 'y' : 'metai_metų_metus',
+ 'yy': 'metai_metų_metus'
+ };
+ function translateSeconds(number, withoutSuffix, key, isFuture) {
+ if (withoutSuffix) {
+ return 'kelios sekundės';
+ } else {
+ return isFuture ? 'kelių sekundžių' : 'kelias sekundes';
+ }
+ }
+ function translateSingular(number, withoutSuffix, key, isFuture) {
+ return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]);
+ }
+ function special(number) {
+ return number % 10 === 0 || (number > 10 && number < 20);
+ }
+ function forms(key) {
+ return lt__units[key].split('_');
+ }
+ function lt__translate(number, withoutSuffix, key, isFuture) {
+ var result = number + ' ';
+ if (number === 1) {
+ return result + translateSingular(number, withoutSuffix, key[0], isFuture);
+ } else if (withoutSuffix) {
+ return result + (special(number) ? forms(key)[1] : forms(key)[0]);
+ } else {
+ if (isFuture) {
+ return result + forms(key)[1];
+ } else {
+ return result + (special(number) ? forms(key)[1] : forms(key)[2]);
+ }
+ }
+ }
+ var lt = moment__default.defineLocale('lt', {
+ months : {
+ format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'),
+ standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_')
+ },
+ monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'),
+ weekdays : {
+ format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split('_'),
+ standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'),
+ isFormat: /dddd HH:mm/
+ },
+ weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'),
+ weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'YYYY-MM-DD',
+ LL : 'YYYY [m.] MMMM D [d.]',
+ LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
+ LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]',
+ l : 'YYYY-MM-DD',
+ ll : 'YYYY [m.] MMMM D [d.]',
+ lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
+ llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]'
+ },
+ calendar : {
+ sameDay : '[Šiandien] LT',
+ nextDay : '[Rytoj] LT',
+ nextWeek : 'dddd LT',
+ lastDay : '[Vakar] LT',
+ lastWeek : '[Praėjusį] dddd LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'po %s',
+ past : 'prieš %s',
+ s : translateSeconds,
+ m : translateSingular,
+ mm : lt__translate,
+ h : translateSingular,
+ hh : lt__translate,
+ d : translateSingular,
+ dd : lt__translate,
+ M : translateSingular,
+ MM : lt__translate,
+ y : translateSingular,
+ yy : lt__translate
+ },
+ ordinalParse: /\d{1,2}-oji/,
+ ordinal : function (number) {
+ return number + '-oji';
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : latvian (lv)
+ //! author : Kristaps Karlsons : https://github.com/skakri
+ //! author : Jānis Elmeris : https://github.com/JanisE
+
+ var lv__units = {
+ 'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'),
+ 'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'),
+ 'h': 'stundas_stundām_stunda_stundas'.split('_'),
+ 'hh': 'stundas_stundām_stunda_stundas'.split('_'),
+ 'd': 'dienas_dienām_diena_dienas'.split('_'),
+ 'dd': 'dienas_dienām_diena_dienas'.split('_'),
+ 'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
+ 'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
+ 'y': 'gada_gadiem_gads_gadi'.split('_'),
+ 'yy': 'gada_gadiem_gads_gadi'.split('_')
+ };
+ /**
+ * @param withoutSuffix boolean true = a length of time; false = before/after a period of time.
+ */
+ function lv__format(forms, number, withoutSuffix) {
+ if (withoutSuffix) {
+ // E.g. "21 minūte", "3 minūtes".
+ return number % 10 === 1 && number !== 11 ? forms[2] : forms[3];
+ } else {
+ // E.g. "21 minūtes" as in "pēc 21 minūtes".
+ // E.g. "3 minūtēm" as in "pēc 3 minūtēm".
+ return number % 10 === 1 && number !== 11 ? forms[0] : forms[1];
+ }
+ }
+ function lv__relativeTimeWithPlural(number, withoutSuffix, key) {
+ return number + ' ' + lv__format(lv__units[key], number, withoutSuffix);
+ }
+ function relativeTimeWithSingular(number, withoutSuffix, key) {
+ return lv__format(lv__units[key], number, withoutSuffix);
+ }
+ function relativeSeconds(number, withoutSuffix) {
+ return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm';
+ }
+
+ var lv = moment__default.defineLocale('lv', {
+ months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'),
+ monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'),
+ weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'),
+ weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'),
+ weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY.',
+ LL : 'YYYY. [gada] D. MMMM',
+ LLL : 'YYYY. [gada] D. MMMM, HH:mm',
+ LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm'
+ },
+ calendar : {
+ sameDay : '[Šodien pulksten] LT',
+ nextDay : '[Rīt pulksten] LT',
+ nextWeek : 'dddd [pulksten] LT',
+ lastDay : '[Vakar pulksten] LT',
+ lastWeek : '[Pagājušā] dddd [pulksten] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'pēc %s',
+ past : 'pirms %s',
+ s : relativeSeconds,
+ m : relativeTimeWithSingular,
+ mm : lv__relativeTimeWithPlural,
+ h : relativeTimeWithSingular,
+ hh : lv__relativeTimeWithPlural,
+ d : relativeTimeWithSingular,
+ dd : lv__relativeTimeWithPlural,
+ M : relativeTimeWithSingular,
+ MM : lv__relativeTimeWithPlural,
+ y : relativeTimeWithSingular,
+ yy : lv__relativeTimeWithPlural
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Montenegrin (me)
+ //! author : Miodrag Nikač <miodrag@restartit.me> : https://github.com/miodragnikac
+
+ var me__translator = {
+ words: { //Different grammatical cases
+ m: ['jedan minut', 'jednog minuta'],
+ mm: ['minut', 'minuta', 'minuta'],
+ h: ['jedan sat', 'jednog sata'],
+ hh: ['sat', 'sata', 'sati'],
+ dd: ['dan', 'dana', 'dana'],
+ MM: ['mjesec', 'mjeseca', 'mjeseci'],
+ yy: ['godina', 'godine', 'godina']
+ },
+ correctGrammaticalCase: function (number, wordKey) {
+ return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
+ },
+ translate: function (number, withoutSuffix, key) {
+ var wordKey = me__translator.words[key];
+ if (key.length === 1) {
+ return withoutSuffix ? wordKey[0] : wordKey[1];
+ } else {
+ return number + ' ' + me__translator.correctGrammaticalCase(number, wordKey);
+ }
+ }
+ };
+
+ var me = moment__default.defineLocale('me', {
+ months: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
+ monthsShort: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
+ weekdays: ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'],
+ weekdaysShort: ['ned.', 'pon.', 'uto.', 'sri.', 'čet.', 'pet.', 'sub.'],
+ weekdaysMin: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'],
+ longDateFormat: {
+ LT: 'H:mm',
+ LTS : 'H:mm:ss',
+ L: 'DD. MM. YYYY',
+ LL: 'D. MMMM YYYY',
+ LLL: 'D. MMMM YYYY H:mm',
+ LLLL: 'dddd, D. MMMM YYYY H:mm'
+ },
+ calendar: {
+ sameDay: '[danas u] LT',
+ nextDay: '[sjutra u] LT',
+
+ nextWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[u] [nedjelju] [u] LT';
+ case 3:
+ return '[u] [srijedu] [u] LT';
+ case 6:
+ return '[u] [subotu] [u] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[u] dddd [u] LT';
+ }
+ },
+ lastDay : '[juče u] LT',
+ lastWeek : function () {
+ var lastWeekDays = [
+ '[prošle] [nedjelje] [u] LT',
+ '[prošlog] [ponedjeljka] [u] LT',
+ '[prošlog] [utorka] [u] LT',
+ '[prošle] [srijede] [u] LT',
+ '[prošlog] [četvrtka] [u] LT',
+ '[prošlog] [petka] [u] LT',
+ '[prošle] [subote] [u] LT'
+ ];
+ return lastWeekDays[this.day()];
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'za %s',
+ past : 'prije %s',
+ s : 'nekoliko sekundi',
+ m : me__translator.translate,
+ mm : me__translator.translate,
+ h : me__translator.translate,
+ hh : me__translator.translate,
+ d : 'dan',
+ dd : me__translator.translate,
+ M : 'mjesec',
+ MM : me__translator.translate,
+ y : 'godinu',
+ yy : me__translator.translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : macedonian (mk)
+ //! author : Borislav Mickov : https://github.com/B0k0
+
+ var mk = moment__default.defineLocale('mk', {
+ months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'),
+ monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'),
+ weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'),
+ weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'),
+ weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'D.MM.YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY H:mm',
+ LLLL : 'dddd, D MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay : '[Денес во] LT',
+ nextDay : '[Утре во] LT',
+ nextWeek : '[Во] dddd [во] LT',
+ lastDay : '[Вчера во] LT',
+ lastWeek : function () {
+ switch (this.day()) {
+ case 0:
+ case 3:
+ case 6:
+ return '[Изминатата] dddd [во] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[Изминатиот] dddd [во] LT';
+ }
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'после %s',
+ past : 'пред %s',
+ s : 'неколку секунди',
+ m : 'минута',
+ mm : '%d минути',
+ h : 'час',
+ hh : '%d часа',
+ d : 'ден',
+ dd : '%d дена',
+ M : 'месец',
+ MM : '%d месеци',
+ y : 'година',
+ yy : '%d години'
+ },
+ ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
+ ordinal : function (number) {
+ var lastDigit = number % 10,
+ last2Digits = number % 100;
+ if (number === 0) {
+ return number + '-ев';
+ } else if (last2Digits === 0) {
+ return number + '-ен';
+ } else if (last2Digits > 10 && last2Digits < 20) {
+ return number + '-ти';
+ } else if (lastDigit === 1) {
+ return number + '-ви';
+ } else if (lastDigit === 2) {
+ return number + '-ри';
+ } else if (lastDigit === 7 || lastDigit === 8) {
+ return number + '-ми';
+ } else {
+ return number + '-ти';
+ }
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : malayalam (ml)
+ //! author : Floyd Pink : https://github.com/floydpink
+
+ var ml = moment__default.defineLocale('ml', {
+ months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'),
+ monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'),
+ weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'),
+ weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'),
+ weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'),
+ longDateFormat : {
+ LT : 'A h:mm -നു',
+ LTS : 'A h:mm:ss -നു',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY, A h:mm -നു',
+ LLLL : 'dddd, D MMMM YYYY, A h:mm -നു'
+ },
+ calendar : {
+ sameDay : '[ഇന്ന്] LT',
+ nextDay : '[നാളെ] LT',
+ nextWeek : 'dddd, LT',
+ lastDay : '[ഇന്നലെ] LT',
+ lastWeek : '[കഴിഞ്ഞ] dddd, LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s കഴിഞ്ഞ്',
+ past : '%s മുൻപ്',
+ s : 'അൽപ നിമിഷങ്ങൾ',
+ m : 'ഒരു മിനിറ്റ്',
+ mm : '%d മിനിറ്റ്',
+ h : 'ഒരു മണിക്കൂർ',
+ hh : '%d മണിക്കൂർ',
+ d : 'ഒരു ദിവസം',
+ dd : '%d ദിവസം',
+ M : 'ഒരു മാസം',
+ MM : '%d മാസം',
+ y : 'ഒരു വർഷം',
+ yy : '%d വർഷം'
+ },
+ meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,
+ isPM : function (input) {
+ return /^(ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി)$/.test(input);
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 4) {
+ return 'രാത്രി';
+ } else if (hour < 12) {
+ return 'രാവിലെ';
+ } else if (hour < 17) {
+ return 'ഉച്ച കഴിഞ്ഞ്';
+ } else if (hour < 20) {
+ return 'വൈകുന്നേരം';
+ } else {
+ return 'രാത്രി';
+ }
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Marathi (mr)
+ //! author : Harshad Kale : https://github.com/kalehv
+ //! author : Vivek Athalye : https://github.com/vnathalye
+
+ var mr__symbolMap = {
+ '1': '१',
+ '2': '२',
+ '3': '३',
+ '4': '४',
+ '5': '५',
+ '6': '६',
+ '7': '७',
+ '8': '८',
+ '9': '९',
+ '0': '०'
+ },
+ mr__numberMap = {
+ '१': '1',
+ '२': '2',
+ '३': '3',
+ '४': '4',
+ '५': '5',
+ '६': '6',
+ '७': '7',
+ '८': '8',
+ '९': '9',
+ '०': '0'
+ };
+
+ function relativeTimeMr(number, withoutSuffix, string, isFuture)
+ {
+ var output = '';
+ if (withoutSuffix) {
+ switch (string) {
+ case 's': output = 'काही सेकंद'; break;
+ case 'm': output = 'एक मिनिट'; break;
+ case 'mm': output = '%d मिनिटे'; break;
+ case 'h': output = 'एक तास'; break;
+ case 'hh': output = '%d तास'; break;
+ case 'd': output = 'एक दिवस'; break;
+ case 'dd': output = '%d दिवस'; break;
+ case 'M': output = 'एक महिना'; break;
+ case 'MM': output = '%d महिने'; break;
+ case 'y': output = 'एक वर्ष'; break;
+ case 'yy': output = '%d वर्षे'; break;
+ }
+ }
+ else {
+ switch (string) {
+ case 's': output = 'काही सेकंदां'; break;
+ case 'm': output = 'एका मिनिटा'; break;
+ case 'mm': output = '%d मिनिटां'; break;
+ case 'h': output = 'एका तासा'; break;
+ case 'hh': output = '%d तासां'; break;
+ case 'd': output = 'एका दिवसा'; break;
+ case 'dd': output = '%d दिवसां'; break;
+ case 'M': output = 'एका महिन्या'; break;
+ case 'MM': output = '%d महिन्यां'; break;
+ case 'y': output = 'एका वर्षा'; break;
+ case 'yy': output = '%d वर्षां'; break;
+ }
+ }
+ return output.replace(/%d/i, number);
+ }
+
+ var mr = moment__default.defineLocale('mr', {
+ months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'),
+ monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'),
+ weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
+ weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'),
+ weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'),
+ longDateFormat : {
+ LT : 'A h:mm वाजता',
+ LTS : 'A h:mm:ss वाजता',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY, A h:mm वाजता',
+ LLLL : 'dddd, D MMMM YYYY, A h:mm वाजता'
+ },
+ calendar : {
+ sameDay : '[आज] LT',
+ nextDay : '[उद्या] LT',
+ nextWeek : 'dddd, LT',
+ lastDay : '[काल] LT',
+ lastWeek: '[मागील] dddd, LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future: '%sमध्ये',
+ past: '%sपूर्वी',
+ s: relativeTimeMr,
+ m: relativeTimeMr,
+ mm: relativeTimeMr,
+ h: relativeTimeMr,
+ hh: relativeTimeMr,
+ d: relativeTimeMr,
+ dd: relativeTimeMr,
+ M: relativeTimeMr,
+ MM: relativeTimeMr,
+ y: relativeTimeMr,
+ yy: relativeTimeMr
+ },
+ preparse: function (string) {
+ return string.replace(/[१२३४५६७८९०]/g, function (match) {
+ return mr__numberMap[match];
+ });
+ },
+ postformat: function (string) {
+ return string.replace(/\d/g, function (match) {
+ return mr__symbolMap[match];
+ });
+ },
+ meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/,
+ meridiemHour : function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === 'रात्री') {
+ return hour < 4 ? hour : hour + 12;
+ } else if (meridiem === 'सकाळी') {
+ return hour;
+ } else if (meridiem === 'दुपारी') {
+ return hour >= 10 ? hour : hour + 12;
+ } else if (meridiem === 'सायंकाळी') {
+ return hour + 12;
+ }
+ },
+ meridiem: function (hour, minute, isLower) {
+ if (hour < 4) {
+ return 'रात्री';
+ } else if (hour < 10) {
+ return 'सकाळी';
+ } else if (hour < 17) {
+ return 'दुपारी';
+ } else if (hour < 20) {
+ return 'सायंकाळी';
+ } else {
+ return 'रात्री';
+ }
+ },
+ week : {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Bahasa Malaysia (ms-MY)
+ //! author : Weldan Jamili : https://github.com/weldan
+
+ var ms_my = moment__default.defineLocale('ms-my', {
+ months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'),
+ monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),
+ weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),
+ weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),
+ weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),
+ longDateFormat : {
+ LT : 'HH.mm',
+ LTS : 'HH.mm.ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY [pukul] HH.mm',
+ LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
+ },
+ meridiemParse: /pagi|tengahari|petang|malam/,
+ meridiemHour: function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === 'pagi') {
+ return hour;
+ } else if (meridiem === 'tengahari') {
+ return hour >= 11 ? hour : hour + 12;
+ } else if (meridiem === 'petang' || meridiem === 'malam') {
+ return hour + 12;
+ }
+ },
+ meridiem : function (hours, minutes, isLower) {
+ if (hours < 11) {
+ return 'pagi';
+ } else if (hours < 15) {
+ return 'tengahari';
+ } else if (hours < 19) {
+ return 'petang';
+ } else {
+ return 'malam';
+ }
+ },
+ calendar : {
+ sameDay : '[Hari ini pukul] LT',
+ nextDay : '[Esok pukul] LT',
+ nextWeek : 'dddd [pukul] LT',
+ lastDay : '[Kelmarin pukul] LT',
+ lastWeek : 'dddd [lepas pukul] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'dalam %s',
+ past : '%s yang lepas',
+ s : 'beberapa saat',
+ m : 'seminit',
+ mm : '%d minit',
+ h : 'sejam',
+ hh : '%d jam',
+ d : 'sehari',
+ dd : '%d hari',
+ M : 'sebulan',
+ MM : '%d bulan',
+ y : 'setahun',
+ yy : '%d tahun'
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Bahasa Malaysia (ms-MY)
+ //! author : Weldan Jamili : https://github.com/weldan
+
+ var locale_ms = moment__default.defineLocale('ms', {
+ months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'),
+ monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),
+ weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),
+ weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),
+ weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),
+ longDateFormat : {
+ LT : 'HH.mm',
+ LTS : 'HH.mm.ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY [pukul] HH.mm',
+ LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
+ },
+ meridiemParse: /pagi|tengahari|petang|malam/,
+ meridiemHour: function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === 'pagi') {
+ return hour;
+ } else if (meridiem === 'tengahari') {
+ return hour >= 11 ? hour : hour + 12;
+ } else if (meridiem === 'petang' || meridiem === 'malam') {
+ return hour + 12;
+ }
+ },
+ meridiem : function (hours, minutes, isLower) {
+ if (hours < 11) {
+ return 'pagi';
+ } else if (hours < 15) {
+ return 'tengahari';
+ } else if (hours < 19) {
+ return 'petang';
+ } else {
+ return 'malam';
+ }
+ },
+ calendar : {
+ sameDay : '[Hari ini pukul] LT',
+ nextDay : '[Esok pukul] LT',
+ nextWeek : 'dddd [pukul] LT',
+ lastDay : '[Kelmarin pukul] LT',
+ lastWeek : 'dddd [lepas pukul] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'dalam %s',
+ past : '%s yang lepas',
+ s : 'beberapa saat',
+ m : 'seminit',
+ mm : '%d minit',
+ h : 'sejam',
+ hh : '%d jam',
+ d : 'sehari',
+ dd : '%d hari',
+ M : 'sebulan',
+ MM : '%d bulan',
+ y : 'setahun',
+ yy : '%d tahun'
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Burmese (my)
+ //! author : Squar team, mysquar.com
+
+ var my__symbolMap = {
+ '1': '၁',
+ '2': '၂',
+ '3': '၃',
+ '4': '၄',
+ '5': '၅',
+ '6': '၆',
+ '7': '၇',
+ '8': '၈',
+ '9': '၉',
+ '0': '၀'
+ }, my__numberMap = {
+ '၁': '1',
+ '၂': '2',
+ '၃': '3',
+ '၄': '4',
+ '၅': '5',
+ '၆': '6',
+ '၇': '7',
+ '၈': '8',
+ '၉': '9',
+ '၀': '0'
+ };
+
+ var my = moment__default.defineLocale('my', {
+ months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'),
+ monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'),
+ weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'),
+ weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'),
+ weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'),
+
+ longDateFormat: {
+ LT: 'HH:mm',
+ LTS: 'HH:mm:ss',
+ L: 'DD/MM/YYYY',
+ LL: 'D MMMM YYYY',
+ LLL: 'D MMMM YYYY HH:mm',
+ LLLL: 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar: {
+ sameDay: '[ယနေ.] LT [မှာ]',
+ nextDay: '[မနက်ဖြန်] LT [မှာ]',
+ nextWeek: 'dddd LT [မှာ]',
+ lastDay: '[မနေ.က] LT [မှာ]',
+ lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]',
+ sameElse: 'L'
+ },
+ relativeTime: {
+ future: 'လာမည့် %s မှာ',
+ past: 'လွန်ခဲ့သော %s က',
+ s: 'စက္ကန်.အနည်းငယ်',
+ m: 'တစ်မိနစ်',
+ mm: '%d မိနစ်',
+ h: 'တစ်နာရီ',
+ hh: '%d နာရီ',
+ d: 'တစ်ရက်',
+ dd: '%d ရက်',
+ M: 'တစ်လ',
+ MM: '%d လ',
+ y: 'တစ်နှစ်',
+ yy: '%d နှစ်'
+ },
+ preparse: function (string) {
+ return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) {
+ return my__numberMap[match];
+ });
+ },
+ postformat: function (string) {
+ return string.replace(/\d/g, function (match) {
+ return my__symbolMap[match];
+ });
+ },
+ week: {
+ dow: 1, // Monday is the first day of the week.
+ doy: 4 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : norwegian bokmål (nb)
+ //! authors : Espen Hovlandsdal : https://github.com/rexxars
+ //! Sigurd Gartmann : https://github.com/sigurdga
+
+ var nb = moment__default.defineLocale('nb', {
+ months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'),
+ monthsShort : 'jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.'.split('_'),
+ weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'),
+ weekdaysShort : 'sø._ma._ti._on._to._fr._lø.'.split('_'),
+ weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY [kl.] HH:mm',
+ LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm'
+ },
+ calendar : {
+ sameDay: '[i dag kl.] LT',
+ nextDay: '[i morgen kl.] LT',
+ nextWeek: 'dddd [kl.] LT',
+ lastDay: '[i går kl.] LT',
+ lastWeek: '[forrige] dddd [kl.] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'om %s',
+ past : 'for %s siden',
+ s : 'noen sekunder',
+ m : 'ett minutt',
+ mm : '%d minutter',
+ h : 'en time',
+ hh : '%d timer',
+ d : 'en dag',
+ dd : '%d dager',
+ M : 'en måned',
+ MM : '%d måneder',
+ y : 'ett år',
+ yy : '%d år'
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : nepali/nepalese
+ //! author : suvash : https://github.com/suvash
+
+ var ne__symbolMap = {
+ '1': '१',
+ '2': '२',
+ '3': '३',
+ '4': '४',
+ '5': '५',
+ '6': '६',
+ '7': '७',
+ '8': '८',
+ '9': '९',
+ '0': '०'
+ },
+ ne__numberMap = {
+ '१': '1',
+ '२': '2',
+ '३': '3',
+ '४': '4',
+ '५': '5',
+ '६': '6',
+ '७': '7',
+ '८': '8',
+ '९': '9',
+ '०': '0'
+ };
+
+ var ne = moment__default.defineLocale('ne', {
+ months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'),
+ monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'),
+ weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'),
+ weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'),
+ weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'),
+ longDateFormat : {
+ LT : 'Aको h:mm बजे',
+ LTS : 'Aको h:mm:ss बजे',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY, Aको h:mm बजे',
+ LLLL : 'dddd, D MMMM YYYY, Aको h:mm बजे'
+ },
+ preparse: function (string) {
+ return string.replace(/[१२३४५६७८९०]/g, function (match) {
+ return ne__numberMap[match];
+ });
+ },
+ postformat: function (string) {
+ return string.replace(/\d/g, function (match) {
+ return ne__symbolMap[match];
+ });
+ },
+ meridiemParse: /राति|बिहान|दिउँसो|साँझ/,
+ meridiemHour : function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === 'राति') {
+ return hour < 4 ? hour : hour + 12;
+ } else if (meridiem === 'बिहान') {
+ return hour;
+ } else if (meridiem === 'दिउँसो') {
+ return hour >= 10 ? hour : hour + 12;
+ } else if (meridiem === 'साँझ') {
+ return hour + 12;
+ }
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 3) {
+ return 'राति';
+ } else if (hour < 12) {
+ return 'बिहान';
+ } else if (hour < 16) {
+ return 'दिउँसो';
+ } else if (hour < 20) {
+ return 'साँझ';
+ } else {
+ return 'राति';
+ }
+ },
+ calendar : {
+ sameDay : '[आज] LT',
+ nextDay : '[भोलि] LT',
+ nextWeek : '[आउँदो] dddd[,] LT',
+ lastDay : '[हिजो] LT',
+ lastWeek : '[गएको] dddd[,] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%sमा',
+ past : '%s अगाडि',
+ s : 'केही क्षण',
+ m : 'एक मिनेट',
+ mm : '%d मिनेट',
+ h : 'एक घण्टा',
+ hh : '%d घण्टा',
+ d : 'एक दिन',
+ dd : '%d दिन',
+ M : 'एक महिना',
+ MM : '%d महिना',
+ y : 'एक बर्ष',
+ yy : '%d बर्ष'
+ },
+ week : {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : dutch (nl)
+ //! author : Joris Röling : https://github.com/jjupiter
+
+ var nl__monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
+ nl__monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_');
+
+ var nl = moment__default.defineLocale('nl', {
+ months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'),
+ monthsShort : function (m, format) {
+ if (/-MMM-/.test(format)) {
+ return nl__monthsShortWithoutDots[m.month()];
+ } else {
+ return nl__monthsShortWithDots[m.month()];
+ }
+ },
+ weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'),
+ weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'),
+ weekdaysMin : 'Zo_Ma_Di_Wo_Do_Vr_Za'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD-MM-YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[vandaag om] LT',
+ nextDay: '[morgen om] LT',
+ nextWeek: 'dddd [om] LT',
+ lastDay: '[gisteren om] LT',
+ lastWeek: '[afgelopen] dddd [om] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'over %s',
+ past : '%s geleden',
+ s : 'een paar seconden',
+ m : 'één minuut',
+ mm : '%d minuten',
+ h : 'één uur',
+ hh : '%d uur',
+ d : 'één dag',
+ dd : '%d dagen',
+ M : 'één maand',
+ MM : '%d maanden',
+ y : 'één jaar',
+ yy : '%d jaar'
+ },
+ ordinalParse: /\d{1,2}(ste|de)/,
+ ordinal : function (number) {
+ return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de');
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : norwegian nynorsk (nn)
+ //! author : https://github.com/mechuwind
+
+ var nn = moment__default.defineLocale('nn', {
+ months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'),
+ monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'),
+ weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'),
+ weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'),
+ weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY [kl.] H:mm',
+ LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm'
+ },
+ calendar : {
+ sameDay: '[I dag klokka] LT',
+ nextDay: '[I morgon klokka] LT',
+ nextWeek: 'dddd [klokka] LT',
+ lastDay: '[I går klokka] LT',
+ lastWeek: '[Føregåande] dddd [klokka] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'om %s',
+ past : 'for %s sidan',
+ s : 'nokre sekund',
+ m : 'eit minutt',
+ mm : '%d minutt',
+ h : 'ein time',
+ hh : '%d timar',
+ d : 'ein dag',
+ dd : '%d dagar',
+ M : 'ein månad',
+ MM : '%d månader',
+ y : 'eit år',
+ yy : '%d år'
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : polish (pl)
+ //! author : Rafal Hirsz : https://github.com/evoL
+
+ var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'),
+ monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_');
+ function pl__plural(n) {
+ return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1);
+ }
+ function pl__translate(number, withoutSuffix, key) {
+ var result = number + ' ';
+ switch (key) {
+ case 'm':
+ return withoutSuffix ? 'minuta' : 'minutę';
+ case 'mm':
+ return result + (pl__plural(number) ? 'minuty' : 'minut');
+ case 'h':
+ return withoutSuffix ? 'godzina' : 'godzinę';
+ case 'hh':
+ return result + (pl__plural(number) ? 'godziny' : 'godzin');
+ case 'MM':
+ return result + (pl__plural(number) ? 'miesiące' : 'miesięcy');
+ case 'yy':
+ return result + (pl__plural(number) ? 'lata' : 'lat');
+ }
+ }
+
+ var pl = moment__default.defineLocale('pl', {
+ months : function (momentToFormat, format) {
+ if (format === '') {
+ // Hack: if format empty we know this is used to generate
+ // RegExp by moment. Give then back both valid forms of months
+ // in RegExp ready format.
+ return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')';
+ } else if (/D MMMM/.test(format)) {
+ return monthsSubjective[momentToFormat.month()];
+ } else {
+ return monthsNominative[momentToFormat.month()];
+ }
+ },
+ monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'),
+ weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'),
+ weekdaysShort : 'nie_pon_wt_śr_czw_pt_sb'.split('_'),
+ weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[Dziś o] LT',
+ nextDay: '[Jutro o] LT',
+ nextWeek: '[W] dddd [o] LT',
+ lastDay: '[Wczoraj o] LT',
+ lastWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[W zeszłą niedzielę o] LT';
+ case 3:
+ return '[W zeszłą środę o] LT';
+ case 6:
+ return '[W zeszłą sobotę o] LT';
+ default:
+ return '[W zeszły] dddd [o] LT';
+ }
+ },
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'za %s',
+ past : '%s temu',
+ s : 'kilka sekund',
+ m : pl__translate,
+ mm : pl__translate,
+ h : pl__translate,
+ hh : pl__translate,
+ d : '1 dzień',
+ dd : '%d dni',
+ M : 'miesiąc',
+ MM : pl__translate,
+ y : 'rok',
+ yy : pl__translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : brazilian portuguese (pt-br)
+ //! author : Caio Ribeiro Pereira : https://github.com/caio-ribeiro-pereira
+
+ var pt_br = moment__default.defineLocale('pt-br', {
+ months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'),
+ monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'),
+ weekdays : 'Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado'.split('_'),
+ weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'),
+ weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D [de] MMMM [de] YYYY',
+ LLL : 'D [de] MMMM [de] YYYY [às] HH:mm',
+ LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm'
+ },
+ calendar : {
+ sameDay: '[Hoje às] LT',
+ nextDay: '[Amanhã às] LT',
+ nextWeek: 'dddd [às] LT',
+ lastDay: '[Ontem às] LT',
+ lastWeek: function () {
+ return (this.day() === 0 || this.day() === 6) ?
+ '[Último] dddd [às] LT' : // Saturday + Sunday
+ '[Última] dddd [às] LT'; // Monday - Friday
+ },
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'em %s',
+ past : '%s atrás',
+ s : 'poucos segundos',
+ m : 'um minuto',
+ mm : '%d minutos',
+ h : 'uma hora',
+ hh : '%d horas',
+ d : 'um dia',
+ dd : '%d dias',
+ M : 'um mês',
+ MM : '%d meses',
+ y : 'um ano',
+ yy : '%d anos'
+ },
+ ordinalParse: /\d{1,2}º/,
+ ordinal : '%dº'
+ });
+
+ //! moment.js locale configuration
+ //! locale : portuguese (pt)
+ //! author : Jefferson : https://github.com/jalex79
+
+ var pt = moment__default.defineLocale('pt', {
+ months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'),
+ monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'),
+ weekdays : 'Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado'.split('_'),
+ weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'),
+ weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D [de] MMMM [de] YYYY',
+ LLL : 'D [de] MMMM [de] YYYY HH:mm',
+ LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[Hoje às] LT',
+ nextDay: '[Amanhã às] LT',
+ nextWeek: 'dddd [às] LT',
+ lastDay: '[Ontem às] LT',
+ lastWeek: function () {
+ return (this.day() === 0 || this.day() === 6) ?
+ '[Último] dddd [às] LT' : // Saturday + Sunday
+ '[Última] dddd [às] LT'; // Monday - Friday
+ },
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'em %s',
+ past : 'há %s',
+ s : 'segundos',
+ m : 'um minuto',
+ mm : '%d minutos',
+ h : 'uma hora',
+ hh : '%d horas',
+ d : 'um dia',
+ dd : '%d dias',
+ M : 'um mês',
+ MM : '%d meses',
+ y : 'um ano',
+ yy : '%d anos'
+ },
+ ordinalParse: /\d{1,2}º/,
+ ordinal : '%dº',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : romanian (ro)
+ //! author : Vlad Gurdiga : https://github.com/gurdiga
+ //! author : Valentin Agachi : https://github.com/avaly
+
+ function ro__relativeTimeWithPlural(number, withoutSuffix, key) {
+ var format = {
+ 'mm': 'minute',
+ 'hh': 'ore',
+ 'dd': 'zile',
+ 'MM': 'luni',
+ 'yy': 'ani'
+ },
+ separator = ' ';
+ if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) {
+ separator = ' de ';
+ }
+ return number + separator + format[key];
+ }
+
+ var ro = moment__default.defineLocale('ro', {
+ months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'),
+ monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'),
+ weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'),
+ weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'),
+ weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY H:mm',
+ LLLL : 'dddd, D MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay: '[azi la] LT',
+ nextDay: '[mâine la] LT',
+ nextWeek: 'dddd [la] LT',
+ lastDay: '[ieri la] LT',
+ lastWeek: '[fosta] dddd [la] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'peste %s',
+ past : '%s în urmă',
+ s : 'câteva secunde',
+ m : 'un minut',
+ mm : ro__relativeTimeWithPlural,
+ h : 'o oră',
+ hh : ro__relativeTimeWithPlural,
+ d : 'o zi',
+ dd : ro__relativeTimeWithPlural,
+ M : 'o lună',
+ MM : ro__relativeTimeWithPlural,
+ y : 'un an',
+ yy : ro__relativeTimeWithPlural
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : russian (ru)
+ //! author : Viktorminator : https://github.com/Viktorminator
+ //! Author : Menelion Elensúle : https://github.com/Oire
+
+ function ru__plural(word, num) {
+ var forms = word.split('_');
+ return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
+ }
+ function ru__relativeTimeWithPlural(number, withoutSuffix, key) {
+ var format = {
+ 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут',
+ 'hh': 'час_часа_часов',
+ 'dd': 'день_дня_дней',
+ 'MM': 'месяц_месяца_месяцев',
+ 'yy': 'год_года_лет'
+ };
+ if (key === 'm') {
+ return withoutSuffix ? 'минута' : 'минуту';
+ }
+ else {
+ return number + ' ' + ru__plural(format[key], +number);
+ }
+ }
+ var monthsParse = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[й|я]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i];
+
+ var ru = moment__default.defineLocale('ru', {
+ months : {
+ format: 'Января_Февраля_Марта_Апреля_Мая_Июня_Июля_Августа_Сентября_Октября_Ноября_Декабря'.split('_'),
+ standalone: 'Январь_Февраль_Март_Апрель_Май_Июнь_Июль_Август_Сентябрь_Октябрь_Ноябрь_Декабрь'.split('_')
+ },
+ monthsShort : {
+ format: 'янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек'.split('_'),
+ standalone: 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_')
+ },
+ weekdays : {
+ standalone: 'Воскресенье_Понедельник_Вторник_Среда_Четверг_Пятница_Суббота'.split('_'),
+ format: 'Воскресенье_Понедельник_Вторник_Среду_Четверг_Пятницу_Субботу'.split('_'),
+ isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/
+ },
+ weekdaysShort : 'Вс_Пн_Вт_Ср_Чт_Пт_Сб'.split('_'),
+ weekdaysMin : 'Вс_Пн_Вт_Ср_Чт_Пт_Сб'.split('_'),
+ monthsParse : monthsParse,
+ longMonthsParse : monthsParse,
+ shortMonthsParse : monthsParse,
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY г.',
+ LLL : 'D MMMM YYYY г., HH:mm',
+ LLLL : 'dddd, D MMMM YYYY г., HH:mm'
+ },
+ calendar : {
+ sameDay: '[Сегодня в] LT',
+ nextDay: '[Завтра в] LT',
+ lastDay: '[Вчера в] LT',
+ nextWeek: function (now) {
+ if (now.week() !== this.week()) {
+ switch (this.day()) {
+ case 0:
+ return '[В следующее] dddd [в] LT';
+ case 1:
+ case 2:
+ case 4:
+ return '[В следующий] dddd [в] LT';
+ case 3:
+ case 5:
+ case 6:
+ return '[В следующую] dddd [в] LT';
+ }
+ } else {
+ if (this.day() === 2) {
+ return '[Во] dddd [в] LT';
+ } else {
+ return '[В] dddd [в] LT';
+ }
+ }
+ },
+ lastWeek: function (now) {
+ if (now.week() !== this.week()) {
+ switch (this.day()) {
+ case 0:
+ return '[В прошлое] dddd [в] LT';
+ case 1:
+ case 2:
+ case 4:
+ return '[В прошлый] dddd [в] LT';
+ case 3:
+ case 5:
+ case 6:
+ return '[В прошлую] dddd [в] LT';
+ }
+ } else {
+ if (this.day() === 2) {
+ return '[Во] dddd [в] LT';
+ } else {
+ return '[В] dddd [в] LT';
+ }
+ }
+ },
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'через %s',
+ past : '%s назад',
+ s : 'несколько секунд',
+ m : ru__relativeTimeWithPlural,
+ mm : ru__relativeTimeWithPlural,
+ h : 'час',
+ hh : ru__relativeTimeWithPlural,
+ d : 'день',
+ dd : ru__relativeTimeWithPlural,
+ M : 'месяц',
+ MM : ru__relativeTimeWithPlural,
+ y : 'год',
+ yy : ru__relativeTimeWithPlural
+ },
+ meridiemParse: /ночи|утра|дня|вечера/i,
+ isPM : function (input) {
+ return /^(дня|вечера)$/.test(input);
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 4) {
+ return 'ночи';
+ } else if (hour < 12) {
+ return 'утра';
+ } else if (hour < 17) {
+ return 'дня';
+ } else {
+ return 'вечера';
+ }
+ },
+ ordinalParse: /\d{1,2}-(й|го|я)/,
+ ordinal: function (number, period) {
+ switch (period) {
+ case 'M':
+ case 'd':
+ case 'DDD':
+ return number + '-й';
+ case 'D':
+ return number + '-го';
+ case 'w':
+ case 'W':
+ return number + '-я';
+ default:
+ return number;
+ }
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Northern Sami (se)
+ //! authors : Bård Rolstad Henriksen : https://github.com/karamell
+
+
+ var se = moment__default.defineLocale('se', {
+ months : 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'),
+ monthsShort : 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'),
+ weekdays : 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'),
+ weekdaysShort : 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'),
+ weekdaysMin : 's_v_m_g_d_b_L'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'MMMM D. [b.] YYYY',
+ LLL : 'MMMM D. [b.] YYYY [ti.] HH:mm',
+ LLLL : 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm'
+ },
+ calendar : {
+ sameDay: '[otne ti] LT',
+ nextDay: '[ihttin ti] LT',
+ nextWeek: 'dddd [ti] LT',
+ lastDay: '[ikte ti] LT',
+ lastWeek: '[ovddit] dddd [ti] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : '%s geažes',
+ past : 'maŋit %s',
+ s : 'moadde sekunddat',
+ m : 'okta minuhta',
+ mm : '%d minuhtat',
+ h : 'okta diimmu',
+ hh : '%d diimmut',
+ d : 'okta beaivi',
+ dd : '%d beaivvit',
+ M : 'okta mánnu',
+ MM : '%d mánut',
+ y : 'okta jahki',
+ yy : '%d jagit'
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Sinhalese (si)
+ //! author : Sampath Sitinamaluwa : https://github.com/sampathsris
+
+ /*jshint -W100*/
+ var si = moment__default.defineLocale('si', {
+ months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'),
+ monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'),
+ weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'),
+ weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්රහ_සිකු_සෙන'.split('_'),
+ weekdaysMin : 'ඉ_ස_අ_බ_බ්ර_සි_සෙ'.split('_'),
+ longDateFormat : {
+ LT : 'a h:mm',
+ LTS : 'a h:mm:ss',
+ L : 'YYYY/MM/DD',
+ LL : 'YYYY MMMM D',
+ LLL : 'YYYY MMMM D, a h:mm',
+ LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss'
+ },
+ calendar : {
+ sameDay : '[අද] LT[ට]',
+ nextDay : '[හෙට] LT[ට]',
+ nextWeek : 'dddd LT[ට]',
+ lastDay : '[ඊයේ] LT[ට]',
+ lastWeek : '[පසුගිය] dddd LT[ට]',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%sකින්',
+ past : '%sකට පෙර',
+ s : 'තත්පර කිහිපය',
+ m : 'මිනිත්තුව',
+ mm : 'මිනිත්තු %d',
+ h : 'පැය',
+ hh : 'පැය %d',
+ d : 'දිනය',
+ dd : 'දින %d',
+ M : 'මාසය',
+ MM : 'මාස %d',
+ y : 'වසර',
+ yy : 'වසර %d'
+ },
+ ordinalParse: /\d{1,2} වැනි/,
+ ordinal : function (number) {
+ return number + ' වැනි';
+ },
+ meridiem : function (hours, minutes, isLower) {
+ if (hours > 11) {
+ return isLower ? 'ප.ව.' : 'පස් වරු';
+ } else {
+ return isLower ? 'පෙ.ව.' : 'පෙර වරු';
+ }
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : slovak (sk)
+ //! author : Martin Minka : https://github.com/k2s
+ //! based on work of petrbela : https://github.com/petrbela
+
+ var sk__months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
+ sk__monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_');
+ function sk__plural(n) {
+ return (n > 1) && (n < 5);
+ }
+ function sk__translate(number, withoutSuffix, key, isFuture) {
+ var result = number + ' ';
+ switch (key) {
+ case 's': // a few seconds / in a few seconds / a few seconds ago
+ return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami';
+ case 'm': // a minute / in a minute / a minute ago
+ return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou');
+ case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
+ if (withoutSuffix || isFuture) {
+ return result + (sk__plural(number) ? 'minúty' : 'minút');
+ } else {
+ return result + 'minútami';
+ }
+ break;
+ case 'h': // an hour / in an hour / an hour ago
+ return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
+ case 'hh': // 9 hours / in 9 hours / 9 hours ago
+ if (withoutSuffix || isFuture) {
+ return result + (sk__plural(number) ? 'hodiny' : 'hodín');
+ } else {
+ return result + 'hodinami';
+ }
+ break;
+ case 'd': // a day / in a day / a day ago
+ return (withoutSuffix || isFuture) ? 'deň' : 'dňom';
+ case 'dd': // 9 days / in 9 days / 9 days ago
+ if (withoutSuffix || isFuture) {
+ return result + (sk__plural(number) ? 'dni' : 'dní');
+ } else {
+ return result + 'dňami';
+ }
+ break;
+ case 'M': // a month / in a month / a month ago
+ return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom';
+ case 'MM': // 9 months / in 9 months / 9 months ago
+ if (withoutSuffix || isFuture) {
+ return result + (sk__plural(number) ? 'mesiace' : 'mesiacov');
+ } else {
+ return result + 'mesiacmi';
+ }
+ break;
+ case 'y': // a year / in a year / a year ago
+ return (withoutSuffix || isFuture) ? 'rok' : 'rokom';
+ case 'yy': // 9 years / in 9 years / 9 years ago
+ if (withoutSuffix || isFuture) {
+ return result + (sk__plural(number) ? 'roky' : 'rokov');
+ } else {
+ return result + 'rokmi';
+ }
+ break;
+ }
+ }
+
+ var sk = moment__default.defineLocale('sk', {
+ months : sk__months,
+ monthsShort : sk__monthsShort,
+ weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
+ weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'),
+ weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'),
+ longDateFormat : {
+ LT: 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY H:mm',
+ LLLL : 'dddd D. MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay: '[dnes o] LT',
+ nextDay: '[zajtra o] LT',
+ nextWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[v nedeľu o] LT';
+ case 1:
+ case 2:
+ return '[v] dddd [o] LT';
+ case 3:
+ return '[v stredu o] LT';
+ case 4:
+ return '[vo štvrtok o] LT';
+ case 5:
+ return '[v piatok o] LT';
+ case 6:
+ return '[v sobotu o] LT';
+ }
+ },
+ lastDay: '[včera o] LT',
+ lastWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[minulú nedeľu o] LT';
+ case 1:
+ case 2:
+ return '[minulý] dddd [o] LT';
+ case 3:
+ return '[minulú stredu o] LT';
+ case 4:
+ case 5:
+ return '[minulý] dddd [o] LT';
+ case 6:
+ return '[minulú sobotu o] LT';
+ }
+ },
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'za %s',
+ past : 'pred %s',
+ s : sk__translate,
+ m : sk__translate,
+ mm : sk__translate,
+ h : sk__translate,
+ hh : sk__translate,
+ d : sk__translate,
+ dd : sk__translate,
+ M : sk__translate,
+ MM : sk__translate,
+ y : sk__translate,
+ yy : sk__translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : slovenian (sl)
+ //! author : Robert Sedovšek : https://github.com/sedovsek
+
+ function sl__processRelativeTime(number, withoutSuffix, key, isFuture) {
+ var result = number + ' ';
+ switch (key) {
+ case 's':
+ return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami';
+ case 'm':
+ return withoutSuffix ? 'ena minuta' : 'eno minuto';
+ case 'mm':
+ if (number === 1) {
+ result += withoutSuffix ? 'minuta' : 'minuto';
+ } else if (number === 2) {
+ result += withoutSuffix || isFuture ? 'minuti' : 'minutama';
+ } else if (number < 5) {
+ result += withoutSuffix || isFuture ? 'minute' : 'minutami';
+ } else {
+ result += withoutSuffix || isFuture ? 'minut' : 'minutami';
+ }
+ return result;
+ case 'h':
+ return withoutSuffix ? 'ena ura' : 'eno uro';
+ case 'hh':
+ if (number === 1) {
+ result += withoutSuffix ? 'ura' : 'uro';
+ } else if (number === 2) {
+ result += withoutSuffix || isFuture ? 'uri' : 'urama';
+ } else if (number < 5) {
+ result += withoutSuffix || isFuture ? 'ure' : 'urami';
+ } else {
+ result += withoutSuffix || isFuture ? 'ur' : 'urami';
+ }
+ return result;
+ case 'd':
+ return withoutSuffix || isFuture ? 'en dan' : 'enim dnem';
+ case 'dd':
+ if (number === 1) {
+ result += withoutSuffix || isFuture ? 'dan' : 'dnem';
+ } else if (number === 2) {
+ result += withoutSuffix || isFuture ? 'dni' : 'dnevoma';
+ } else {
+ result += withoutSuffix || isFuture ? 'dni' : 'dnevi';
+ }
+ return result;
+ case 'M':
+ return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem';
+ case 'MM':
+ if (number === 1) {
+ result += withoutSuffix || isFuture ? 'mesec' : 'mesecem';
+ } else if (number === 2) {
+ result += withoutSuffix || isFuture ? 'meseca' : 'mesecema';
+ } else if (number < 5) {
+ result += withoutSuffix || isFuture ? 'mesece' : 'meseci';
+ } else {
+ result += withoutSuffix || isFuture ? 'mesecev' : 'meseci';
+ }
+ return result;
+ case 'y':
+ return withoutSuffix || isFuture ? 'eno leto' : 'enim letom';
+ case 'yy':
+ if (number === 1) {
+ result += withoutSuffix || isFuture ? 'leto' : 'letom';
+ } else if (number === 2) {
+ result += withoutSuffix || isFuture ? 'leti' : 'letoma';
+ } else if (number < 5) {
+ result += withoutSuffix || isFuture ? 'leta' : 'leti';
+ } else {
+ result += withoutSuffix || isFuture ? 'let' : 'leti';
+ }
+ return result;
+ }
+ }
+
+ var sl = moment__default.defineLocale('sl', {
+ months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'),
+ monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'),
+ weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'),
+ weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'),
+ weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'),
+ longDateFormat : {
+ LT : 'H:mm',
+ LTS : 'H:mm:ss',
+ L : 'DD. MM. YYYY',
+ LL : 'D. MMMM YYYY',
+ LLL : 'D. MMMM YYYY H:mm',
+ LLLL : 'dddd, D. MMMM YYYY H:mm'
+ },
+ calendar : {
+ sameDay : '[danes ob] LT',
+ nextDay : '[jutri ob] LT',
+
+ nextWeek : function () {
+ switch (this.day()) {
+ case 0:
+ return '[v] [nedeljo] [ob] LT';
+ case 3:
+ return '[v] [sredo] [ob] LT';
+ case 6:
+ return '[v] [soboto] [ob] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[v] dddd [ob] LT';
+ }
+ },
+ lastDay : '[včeraj ob] LT',
+ lastWeek : function () {
+ switch (this.day()) {
+ case 0:
+ return '[prejšnjo] [nedeljo] [ob] LT';
+ case 3:
+ return '[prejšnjo] [sredo] [ob] LT';
+ case 6:
+ return '[prejšnjo] [soboto] [ob] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[prejšnji] dddd [ob] LT';
+ }
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'čez %s',
+ past : 'pred %s',
+ s : sl__processRelativeTime,
+ m : sl__processRelativeTime,
+ mm : sl__processRelativeTime,
+ h : sl__processRelativeTime,
+ hh : sl__processRelativeTime,
+ d : sl__processRelativeTime,
+ dd : sl__processRelativeTime,
+ M : sl__processRelativeTime,
+ MM : sl__processRelativeTime,
+ y : sl__processRelativeTime,
+ yy : sl__processRelativeTime
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Albanian (sq)
+ //! author : Flakërim Ismani : https://github.com/flakerimi
+ //! author: Menelion Elensúle: https://github.com/Oire (tests)
+ //! author : Oerd Cukalla : https://github.com/oerd (fixes)
+
+ var sq = moment__default.defineLocale('sq', {
+ months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'),
+ monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'),
+ weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'),
+ weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'),
+ weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'),
+ meridiemParse: /PD|MD/,
+ isPM: function (input) {
+ return input.charAt(0) === 'M';
+ },
+ meridiem : function (hours, minutes, isLower) {
+ return hours < 12 ? 'PD' : 'MD';
+ },
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[Sot në] LT',
+ nextDay : '[Nesër në] LT',
+ nextWeek : 'dddd [në] LT',
+ lastDay : '[Dje në] LT',
+ lastWeek : 'dddd [e kaluar në] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'në %s',
+ past : '%s më parë',
+ s : 'disa sekonda',
+ m : 'një minutë',
+ mm : '%d minuta',
+ h : 'një orë',
+ hh : '%d orë',
+ d : 'një ditë',
+ dd : '%d ditë',
+ M : 'një muaj',
+ MM : '%d muaj',
+ y : 'një vit',
+ yy : '%d vite'
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Serbian-cyrillic (sr-cyrl)
+ //! author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
+
+ var sr_cyrl__translator = {
+ words: { //Different grammatical cases
+ m: ['један минут', 'једне минуте'],
+ mm: ['минут', 'минуте', 'минута'],
+ h: ['један сат', 'једног сата'],
+ hh: ['сат', 'сата', 'сати'],
+ dd: ['дан', 'дана', 'дана'],
+ MM: ['месец', 'месеца', 'месеци'],
+ yy: ['година', 'године', 'година']
+ },
+ correctGrammaticalCase: function (number, wordKey) {
+ return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
+ },
+ translate: function (number, withoutSuffix, key) {
+ var wordKey = sr_cyrl__translator.words[key];
+ if (key.length === 1) {
+ return withoutSuffix ? wordKey[0] : wordKey[1];
+ } else {
+ return number + ' ' + sr_cyrl__translator.correctGrammaticalCase(number, wordKey);
+ }
+ }
+ };
+
+ var sr_cyrl = moment__default.defineLocale('sr-cyrl', {
+ months: ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'],
+ monthsShort: ['јан.', 'феб.', 'мар.', 'апр.', 'мај', 'јун', 'јул', 'авг.', 'сеп.', 'окт.', 'нов.', 'дец.'],
+ weekdays: ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'],
+ weekdaysShort: ['нед.', 'пон.', 'уто.', 'сре.', 'чет.', 'пет.', 'суб.'],
+ weekdaysMin: ['не', 'по', 'ут', 'ср', 'че', 'пе', 'су'],
+ longDateFormat: {
+ LT: 'H:mm',
+ LTS : 'H:mm:ss',
+ L: 'DD. MM. YYYY',
+ LL: 'D. MMMM YYYY',
+ LLL: 'D. MMMM YYYY H:mm',
+ LLLL: 'dddd, D. MMMM YYYY H:mm'
+ },
+ calendar: {
+ sameDay: '[данас у] LT',
+ nextDay: '[сутра у] LT',
+ nextWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[у] [недељу] [у] LT';
+ case 3:
+ return '[у] [среду] [у] LT';
+ case 6:
+ return '[у] [суботу] [у] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[у] dddd [у] LT';
+ }
+ },
+ lastDay : '[јуче у] LT',
+ lastWeek : function () {
+ var lastWeekDays = [
+ '[прошле] [недеље] [у] LT',
+ '[прошлог] [понедељка] [у] LT',
+ '[прошлог] [уторка] [у] LT',
+ '[прошле] [среде] [у] LT',
+ '[прошлог] [четвртка] [у] LT',
+ '[прошлог] [петка] [у] LT',
+ '[прошле] [суботе] [у] LT'
+ ];
+ return lastWeekDays[this.day()];
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'за %s',
+ past : 'пре %s',
+ s : 'неколико секунди',
+ m : sr_cyrl__translator.translate,
+ mm : sr_cyrl__translator.translate,
+ h : sr_cyrl__translator.translate,
+ hh : sr_cyrl__translator.translate,
+ d : 'дан',
+ dd : sr_cyrl__translator.translate,
+ M : 'месец',
+ MM : sr_cyrl__translator.translate,
+ y : 'годину',
+ yy : sr_cyrl__translator.translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Serbian-latin (sr)
+ //! author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
+
+ var sr__translator = {
+ words: { //Different grammatical cases
+ m: ['jedan minut', 'jedne minute'],
+ mm: ['minut', 'minute', 'minuta'],
+ h: ['jedan sat', 'jednog sata'],
+ hh: ['sat', 'sata', 'sati'],
+ dd: ['dan', 'dana', 'dana'],
+ MM: ['mesec', 'meseca', 'meseci'],
+ yy: ['godina', 'godine', 'godina']
+ },
+ correctGrammaticalCase: function (number, wordKey) {
+ return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
+ },
+ translate: function (number, withoutSuffix, key) {
+ var wordKey = sr__translator.words[key];
+ if (key.length === 1) {
+ return withoutSuffix ? wordKey[0] : wordKey[1];
+ } else {
+ return number + ' ' + sr__translator.correctGrammaticalCase(number, wordKey);
+ }
+ }
+ };
+
+ var sr = moment__default.defineLocale('sr', {
+ months: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
+ monthsShort: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
+ weekdays: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
+ weekdaysShort: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'],
+ weekdaysMin: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'],
+ longDateFormat: {
+ LT: 'H:mm',
+ LTS : 'H:mm:ss',
+ L: 'DD. MM. YYYY',
+ LL: 'D. MMMM YYYY',
+ LLL: 'D. MMMM YYYY H:mm',
+ LLLL: 'dddd, D. MMMM YYYY H:mm'
+ },
+ calendar: {
+ sameDay: '[danas u] LT',
+ nextDay: '[sutra u] LT',
+ nextWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[u] [nedelju] [u] LT';
+ case 3:
+ return '[u] [sredu] [u] LT';
+ case 6:
+ return '[u] [subotu] [u] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[u] dddd [u] LT';
+ }
+ },
+ lastDay : '[juče u] LT',
+ lastWeek : function () {
+ var lastWeekDays = [
+ '[prošle] [nedelje] [u] LT',
+ '[prošlog] [ponedeljka] [u] LT',
+ '[prošlog] [utorka] [u] LT',
+ '[prošle] [srede] [u] LT',
+ '[prošlog] [četvrtka] [u] LT',
+ '[prošlog] [petka] [u] LT',
+ '[prošle] [subote] [u] LT'
+ ];
+ return lastWeekDays[this.day()];
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'za %s',
+ past : 'pre %s',
+ s : 'nekoliko sekundi',
+ m : sr__translator.translate,
+ mm : sr__translator.translate,
+ h : sr__translator.translate,
+ hh : sr__translator.translate,
+ d : 'dan',
+ dd : sr__translator.translate,
+ M : 'mesec',
+ MM : sr__translator.translate,
+ y : 'godinu',
+ yy : sr__translator.translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : swedish (sv)
+ //! author : Jens Alm : https://github.com/ulmus
+
+ var sv = moment__default.defineLocale('sv', {
+ months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'),
+ monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'),
+ weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'),
+ weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'),
+ weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'YYYY-MM-DD',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[Idag] LT',
+ nextDay: '[Imorgon] LT',
+ lastDay: '[Igår] LT',
+ nextWeek: '[På] dddd LT',
+ lastWeek: '[I] dddd[s] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'om %s',
+ past : 'för %s sedan',
+ s : 'några sekunder',
+ m : 'en minut',
+ mm : '%d minuter',
+ h : 'en timme',
+ hh : '%d timmar',
+ d : 'en dag',
+ dd : '%d dagar',
+ M : 'en månad',
+ MM : '%d månader',
+ y : 'ett år',
+ yy : '%d år'
+ },
+ ordinalParse: /\d{1,2}(e|a)/,
+ ordinal : function (number) {
+ var b = number % 10,
+ output = (~~(number % 100 / 10) === 1) ? 'e' :
+ (b === 1) ? 'a' :
+ (b === 2) ? 'a' :
+ (b === 3) ? 'e' : 'e';
+ return number + output;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : swahili (sw)
+ //! author : Fahad Kassim : https://github.com/fadsel
+
+ var sw = moment__default.defineLocale('sw', {
+ months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'),
+ monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'),
+ weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'),
+ weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'),
+ weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[leo saa] LT',
+ nextDay : '[kesho saa] LT',
+ nextWeek : '[wiki ijayo] dddd [saat] LT',
+ lastDay : '[jana] LT',
+ lastWeek : '[wiki iliyopita] dddd [saat] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s baadaye',
+ past : 'tokea %s',
+ s : 'hivi punde',
+ m : 'dakika moja',
+ mm : 'dakika %d',
+ h : 'saa limoja',
+ hh : 'masaa %d',
+ d : 'siku moja',
+ dd : 'masiku %d',
+ M : 'mwezi mmoja',
+ MM : 'miezi %d',
+ y : 'mwaka mmoja',
+ yy : 'miaka %d'
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : tamil (ta)
+ //! author : Arjunkumar Krishnamoorthy : https://github.com/tk120404
+
+ var ta__symbolMap = {
+ '1': '௧',
+ '2': '௨',
+ '3': '௩',
+ '4': '௪',
+ '5': '௫',
+ '6': '௬',
+ '7': '௭',
+ '8': '௮',
+ '9': '௯',
+ '0': '௦'
+ }, ta__numberMap = {
+ '௧': '1',
+ '௨': '2',
+ '௩': '3',
+ '௪': '4',
+ '௫': '5',
+ '௬': '6',
+ '௭': '7',
+ '௮': '8',
+ '௯': '9',
+ '௦': '0'
+ };
+
+ var ta = moment__default.defineLocale('ta', {
+ months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'),
+ monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'),
+ weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'),
+ weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'),
+ weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY, HH:mm',
+ LLLL : 'dddd, D MMMM YYYY, HH:mm'
+ },
+ calendar : {
+ sameDay : '[இன்று] LT',
+ nextDay : '[நாளை] LT',
+ nextWeek : 'dddd, LT',
+ lastDay : '[நேற்று] LT',
+ lastWeek : '[கடந்த வாரம்] dddd, LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s இல்',
+ past : '%s முன்',
+ s : 'ஒரு சில விநாடிகள்',
+ m : 'ஒரு நிமிடம்',
+ mm : '%d நிமிடங்கள்',
+ h : 'ஒரு மணி நேரம்',
+ hh : '%d மணி நேரம்',
+ d : 'ஒரு நாள்',
+ dd : '%d நாட்கள்',
+ M : 'ஒரு மாதம்',
+ MM : '%d மாதங்கள்',
+ y : 'ஒரு வருடம்',
+ yy : '%d ஆண்டுகள்'
+ },
+ ordinalParse: /\d{1,2}வது/,
+ ordinal : function (number) {
+ return number + 'வது';
+ },
+ preparse: function (string) {
+ return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) {
+ return ta__numberMap[match];
+ });
+ },
+ postformat: function (string) {
+ return string.replace(/\d/g, function (match) {
+ return ta__symbolMap[match];
+ });
+ },
+ // refer http://ta.wikipedia.org/s/1er1
+ meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 2) {
+ return ' யாமம்';
+ } else if (hour < 6) {
+ return ' வைகறை'; // வைகறை
+ } else if (hour < 10) {
+ return ' காலை'; // காலை
+ } else if (hour < 14) {
+ return ' நண்பகல்'; // நண்பகல்
+ } else if (hour < 18) {
+ return ' எற்பாடு'; // எற்பாடு
+ } else if (hour < 22) {
+ return ' மாலை'; // மாலை
+ } else {
+ return ' யாமம்';
+ }
+ },
+ meridiemHour : function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === 'யாமம்') {
+ return hour < 2 ? hour : hour + 12;
+ } else if (meridiem === 'வைகறை' || meridiem === 'காலை') {
+ return hour;
+ } else if (meridiem === 'நண்பகல்') {
+ return hour >= 10 ? hour : hour + 12;
+ } else {
+ return hour + 12;
+ }
+ },
+ week : {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : telugu (te)
+ //! author : Krishna Chaitanya Thota : https://github.com/kcthota
+
+ var te = moment__default.defineLocale('te', {
+ months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'),
+ monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'),
+ weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'),
+ weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'),
+ weekdaysMin : 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'),
+ longDateFormat : {
+ LT : 'A h:mm',
+ LTS : 'A h:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY, A h:mm',
+ LLLL : 'dddd, D MMMM YYYY, A h:mm'
+ },
+ calendar : {
+ sameDay : '[నేడు] LT',
+ nextDay : '[రేపు] LT',
+ nextWeek : 'dddd, LT',
+ lastDay : '[నిన్న] LT',
+ lastWeek : '[గత] dddd, LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s లో',
+ past : '%s క్రితం',
+ s : 'కొన్ని క్షణాలు',
+ m : 'ఒక నిమిషం',
+ mm : '%d నిమిషాలు',
+ h : 'ఒక గంట',
+ hh : '%d గంటలు',
+ d : 'ఒక రోజు',
+ dd : '%d రోజులు',
+ M : 'ఒక నెల',
+ MM : '%d నెలలు',
+ y : 'ఒక సంవత్సరం',
+ yy : '%d సంవత్సరాలు'
+ },
+ ordinalParse : /\d{1,2}వ/,
+ ordinal : '%dవ',
+ meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,
+ meridiemHour : function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === 'రాత్రి') {
+ return hour < 4 ? hour : hour + 12;
+ } else if (meridiem === 'ఉదయం') {
+ return hour;
+ } else if (meridiem === 'మధ్యాహ్నం') {
+ return hour >= 10 ? hour : hour + 12;
+ } else if (meridiem === 'సాయంత్రం') {
+ return hour + 12;
+ }
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 4) {
+ return 'రాత్రి';
+ } else if (hour < 10) {
+ return 'ఉదయం';
+ } else if (hour < 17) {
+ return 'మధ్యాహ్నం';
+ } else if (hour < 20) {
+ return 'సాయంత్రం';
+ } else {
+ return 'రాత్రి';
+ }
+ },
+ week : {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : thai (th)
+ //! author : Kridsada Thanabulpong : https://github.com/sirn
+
+ var th = moment__default.defineLocale('th', {
+ months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'),
+ monthsShort : 'มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา'.split('_'),
+ weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'),
+ weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference
+ weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'),
+ longDateFormat : {
+ LT : 'H นาฬิกา m นาที',
+ LTS : 'H นาฬิกา m นาที s วินาที',
+ L : 'YYYY/MM/DD',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY เวลา H นาฬิกา m นาที',
+ LLLL : 'วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที'
+ },
+ meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/,
+ isPM: function (input) {
+ return input === 'หลังเที่ยง';
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 12) {
+ return 'ก่อนเที่ยง';
+ } else {
+ return 'หลังเที่ยง';
+ }
+ },
+ calendar : {
+ sameDay : '[วันนี้ เวลา] LT',
+ nextDay : '[พรุ่งนี้ เวลา] LT',
+ nextWeek : 'dddd[หน้า เวลา] LT',
+ lastDay : '[เมื่อวานนี้ เวลา] LT',
+ lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'อีก %s',
+ past : '%sที่แล้ว',
+ s : 'ไม่กี่วินาที',
+ m : '1 นาที',
+ mm : '%d นาที',
+ h : '1 ชั่วโมง',
+ hh : '%d ชั่วโมง',
+ d : '1 วัน',
+ dd : '%d วัน',
+ M : '1 เดือน',
+ MM : '%d เดือน',
+ y : '1 ปี',
+ yy : '%d ปี'
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Tagalog/Filipino (tl-ph)
+ //! author : Dan Hagman
+
+ var tl_ph = moment__default.defineLocale('tl-ph', {
+ months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'),
+ monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'),
+ weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'),
+ weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'),
+ weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'MM/D/YYYY',
+ LL : 'MMMM D, YYYY',
+ LLL : 'MMMM D, YYYY HH:mm',
+ LLLL : 'dddd, MMMM DD, YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[Ngayon sa] LT',
+ nextDay: '[Bukas sa] LT',
+ nextWeek: 'dddd [sa] LT',
+ lastDay: '[Kahapon sa] LT',
+ lastWeek: 'dddd [huling linggo] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'sa loob ng %s',
+ past : '%s ang nakalipas',
+ s : 'ilang segundo',
+ m : 'isang minuto',
+ mm : '%d minuto',
+ h : 'isang oras',
+ hh : '%d oras',
+ d : 'isang araw',
+ dd : '%d araw',
+ M : 'isang buwan',
+ MM : '%d buwan',
+ y : 'isang taon',
+ yy : '%d taon'
+ },
+ ordinalParse: /\d{1,2}/,
+ ordinal : function (number) {
+ return number;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Klingon (tlh)
+ //! author : Dominika Kruk : https://github.com/amaranthrose
+
+ var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_');
+
+ function translateFuture(output) {
+ var time = output;
+ time = (output.indexOf('jaj') !== -1) ?
+ time.slice(0, -3) + 'leS' :
+ (output.indexOf('jar') !== -1) ?
+ time.slice(0, -3) + 'waQ' :
+ (output.indexOf('DIS') !== -1) ?
+ time.slice(0, -3) + 'nem' :
+ time + ' pIq';
+ return time;
+ }
+
+ function translatePast(output) {
+ var time = output;
+ time = (output.indexOf('jaj') !== -1) ?
+ time.slice(0, -3) + 'Hu’' :
+ (output.indexOf('jar') !== -1) ?
+ time.slice(0, -3) + 'wen' :
+ (output.indexOf('DIS') !== -1) ?
+ time.slice(0, -3) + 'ben' :
+ time + ' ret';
+ return time;
+ }
+
+ function tlh__translate(number, withoutSuffix, string, isFuture) {
+ var numberNoun = numberAsNoun(number);
+ switch (string) {
+ case 'mm':
+ return numberNoun + ' tup';
+ case 'hh':
+ return numberNoun + ' rep';
+ case 'dd':
+ return numberNoun + ' jaj';
+ case 'MM':
+ return numberNoun + ' jar';
+ case 'yy':
+ return numberNoun + ' DIS';
+ }
+ }
+
+ function numberAsNoun(number) {
+ var hundred = Math.floor((number % 1000) / 100),
+ ten = Math.floor((number % 100) / 10),
+ one = number % 10,
+ word = '';
+ if (hundred > 0) {
+ word += numbersNouns[hundred] + 'vatlh';
+ }
+ if (ten > 0) {
+ word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH';
+ }
+ if (one > 0) {
+ word += ((word !== '') ? ' ' : '') + numbersNouns[one];
+ }
+ return (word === '') ? 'pagh' : word;
+ }
+
+ var tlh = moment__default.defineLocale('tlh', {
+ months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'),
+ monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'),
+ weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
+ weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
+ weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[DaHjaj] LT',
+ nextDay: '[wa’leS] LT',
+ nextWeek: 'LLL',
+ lastDay: '[wa’Hu’] LT',
+ lastWeek: 'LLL',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : translateFuture,
+ past : translatePast,
+ s : 'puS lup',
+ m : 'wa’ tup',
+ mm : tlh__translate,
+ h : 'wa’ rep',
+ hh : tlh__translate,
+ d : 'wa’ jaj',
+ dd : tlh__translate,
+ M : 'wa’ jar',
+ MM : tlh__translate,
+ y : 'wa’ DIS',
+ yy : tlh__translate
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : turkish (tr)
+ //! authors : Erhan Gundogan : https://github.com/erhangundogan,
+ //! Burak Yiğit Kaya: https://github.com/BYK
+
+ var tr__suffixes = {
+ 1: '\'inci',
+ 5: '\'inci',
+ 8: '\'inci',
+ 70: '\'inci',
+ 80: '\'inci',
+ 2: '\'nci',
+ 7: '\'nci',
+ 20: '\'nci',
+ 50: '\'nci',
+ 3: '\'üncü',
+ 4: '\'üncü',
+ 100: '\'üncü',
+ 6: '\'ncı',
+ 9: '\'uncu',
+ 10: '\'uncu',
+ 30: '\'uncu',
+ 60: '\'ıncı',
+ 90: '\'ıncı'
+ };
+
+ var tr = moment__default.defineLocale('tr', {
+ months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'),
+ monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'),
+ weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'),
+ weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'),
+ weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd, D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay : '[bugün saat] LT',
+ nextDay : '[yarın saat] LT',
+ nextWeek : '[haftaya] dddd [saat] LT',
+ lastDay : '[dün] LT',
+ lastWeek : '[geçen hafta] dddd [saat] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : '%s sonra',
+ past : '%s önce',
+ s : 'birkaç saniye',
+ m : 'bir dakika',
+ mm : '%d dakika',
+ h : 'bir saat',
+ hh : '%d saat',
+ d : 'bir gün',
+ dd : '%d gün',
+ M : 'bir ay',
+ MM : '%d ay',
+ y : 'bir yıl',
+ yy : '%d yıl'
+ },
+ ordinalParse: /\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/,
+ ordinal : function (number) {
+ if (number === 0) { // special case for zero
+ return number + '\'ıncı';
+ }
+ var a = number % 10,
+ b = number % 100 - a,
+ c = number >= 100 ? 100 : null;
+ return number + (tr__suffixes[a] || tr__suffixes[b] || tr__suffixes[c]);
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : talossan (tzl)
+ //! author : Robin van der Vliet : https://github.com/robin0van0der0v with the help of Iustì Canun
+
+
+ // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals.
+ // This is currently too difficult (maybe even impossible) to add.
+ var tzl = moment__default.defineLocale('tzl', {
+ months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'),
+ monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'),
+ weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'),
+ weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'),
+ weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'),
+ longDateFormat : {
+ LT : 'HH.mm',
+ LTS : 'HH.mm.ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D. MMMM [dallas] YYYY',
+ LLL : 'D. MMMM [dallas] YYYY HH.mm',
+ LLLL : 'dddd, [li] D. MMMM [dallas] YYYY HH.mm'
+ },
+ meridiem : function (hours, minutes, isLower) {
+ if (hours > 11) {
+ return isLower ? 'd\'o' : 'D\'O';
+ } else {
+ return isLower ? 'd\'a' : 'D\'A';
+ }
+ },
+ calendar : {
+ sameDay : '[oxhi à] LT',
+ nextDay : '[demà à] LT',
+ nextWeek : 'dddd [à] LT',
+ lastDay : '[ieiri à] LT',
+ lastWeek : '[sür el] dddd [lasteu à] LT',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'osprei %s',
+ past : 'ja%s',
+ s : tzl__processRelativeTime,
+ m : tzl__processRelativeTime,
+ mm : tzl__processRelativeTime,
+ h : tzl__processRelativeTime,
+ hh : tzl__processRelativeTime,
+ d : tzl__processRelativeTime,
+ dd : tzl__processRelativeTime,
+ M : tzl__processRelativeTime,
+ MM : tzl__processRelativeTime,
+ y : tzl__processRelativeTime,
+ yy : tzl__processRelativeTime
+ },
+ ordinalParse: /\d{1,2}\./,
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ function tzl__processRelativeTime(number, withoutSuffix, key, isFuture) {
+ var format = {
+ 's': ['viensas secunds', '\'iensas secunds'],
+ 'm': ['\'n míut', '\'iens míut'],
+ 'mm': [number + ' míuts', '' + number + ' míuts'],
+ 'h': ['\'n þora', '\'iensa þora'],
+ 'hh': [number + ' þoras', '' + number + ' þoras'],
+ 'd': ['\'n ziua', '\'iensa ziua'],
+ 'dd': [number + ' ziuas', '' + number + ' ziuas'],
+ 'M': ['\'n mes', '\'iens mes'],
+ 'MM': [number + ' mesen', '' + number + ' mesen'],
+ 'y': ['\'n ar', '\'iens ar'],
+ 'yy': [number + ' ars', '' + number + ' ars']
+ };
+ return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1]);
+ }
+
+ //! moment.js locale configuration
+ //! locale : Morocco Central Atlas Tamaziɣt in Latin (tzm-latn)
+ //! author : Abdel Said : https://github.com/abdelsaid
+
+ var tzm_latn = moment__default.defineLocale('tzm-latn', {
+ months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'),
+ monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'),
+ weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
+ weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
+ weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[asdkh g] LT',
+ nextDay: '[aska g] LT',
+ nextWeek: 'dddd [g] LT',
+ lastDay: '[assant g] LT',
+ lastWeek: 'dddd [g] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'dadkh s yan %s',
+ past : 'yan %s',
+ s : 'imik',
+ m : 'minuḍ',
+ mm : '%d minuḍ',
+ h : 'saɛa',
+ hh : '%d tassaɛin',
+ d : 'ass',
+ dd : '%d ossan',
+ M : 'ayowr',
+ MM : '%d iyyirn',
+ y : 'asgas',
+ yy : '%d isgasn'
+ },
+ week : {
+ dow : 6, // Saturday is the first day of the week.
+ doy : 12 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : Morocco Central Atlas Tamaziɣt (tzm)
+ //! author : Abdel Said : https://github.com/abdelsaid
+
+ var tzm = moment__default.defineLocale('tzm', {
+ months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'),
+ monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'),
+ weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
+ weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
+ weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS: 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'dddd D MMMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[ⴰⵙⴷⵅ ⴴ] LT',
+ nextDay: '[ⴰⵙⴽⴰ ⴴ] LT',
+ nextWeek: 'dddd [ⴴ] LT',
+ lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT',
+ lastWeek: 'dddd [ⴴ] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s',
+ past : 'ⵢⴰⵏ %s',
+ s : 'ⵉⵎⵉⴽ',
+ m : 'ⵎⵉⵏⵓⴺ',
+ mm : '%d ⵎⵉⵏⵓⴺ',
+ h : 'ⵙⴰⵄⴰ',
+ hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ',
+ d : 'ⴰⵙⵙ',
+ dd : '%d oⵙⵙⴰⵏ',
+ M : 'ⴰⵢoⵓⵔ',
+ MM : '%d ⵉⵢⵢⵉⵔⵏ',
+ y : 'ⴰⵙⴳⴰⵙ',
+ yy : '%d ⵉⵙⴳⴰⵙⵏ'
+ },
+ week : {
+ dow : 6, // Saturday is the first day of the week.
+ doy : 12 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : ukrainian (uk)
+ //! author : zemlanin : https://github.com/zemlanin
+ //! Author : Menelion Elensúle : https://github.com/Oire
+
+ function uk__plural(word, num) {
+ var forms = word.split('_');
+ return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
+ }
+ function uk__relativeTimeWithPlural(number, withoutSuffix, key) {
+ var format = {
+ 'mm': withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин',
+ 'hh': withoutSuffix ? 'година_години_годин' : 'годину_години_годин',
+ 'dd': 'день_дні_днів',
+ 'MM': 'місяць_місяці_місяців',
+ 'yy': 'рік_роки_років'
+ };
+ if (key === 'm') {
+ return withoutSuffix ? 'хвилина' : 'хвилину';
+ }
+ else if (key === 'h') {
+ return withoutSuffix ? 'година' : 'годину';
+ }
+ else {
+ return number + ' ' + uk__plural(format[key], +number);
+ }
+ }
+ function weekdaysCaseReplace(m, format) {
+ var weekdays = {
+ 'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'),
+ 'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'),
+ 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_')
+ },
+ nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ?
+ 'accusative' :
+ ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ?
+ 'genitive' :
+ 'nominative');
+ return weekdays[nounCase][m.day()];
+ }
+ function processHoursFunction(str) {
+ return function () {
+ return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT';
+ };
+ }
+
+ var uk = moment__default.defineLocale('uk', {
+ months : {
+ 'format': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_'),
+ 'standalone': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_')
+ },
+ monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'),
+ weekdays : weekdaysCaseReplace,
+ weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
+ weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD.MM.YYYY',
+ LL : 'D MMMM YYYY р.',
+ LLL : 'D MMMM YYYY р., HH:mm',
+ LLLL : 'dddd, D MMMM YYYY р., HH:mm'
+ },
+ calendar : {
+ sameDay: processHoursFunction('[Сьогодні '),
+ nextDay: processHoursFunction('[Завтра '),
+ lastDay: processHoursFunction('[Вчора '),
+ nextWeek: processHoursFunction('[У] dddd ['),
+ lastWeek: function () {
+ switch (this.day()) {
+ case 0:
+ case 3:
+ case 5:
+ case 6:
+ return processHoursFunction('[Минулої] dddd [').call(this);
+ case 1:
+ case 2:
+ case 4:
+ return processHoursFunction('[Минулого] dddd [').call(this);
+ }
+ },
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : 'за %s',
+ past : '%s тому',
+ s : 'декілька секунд',
+ m : uk__relativeTimeWithPlural,
+ mm : uk__relativeTimeWithPlural,
+ h : 'годину',
+ hh : uk__relativeTimeWithPlural,
+ d : 'день',
+ dd : uk__relativeTimeWithPlural,
+ M : 'місяць',
+ MM : uk__relativeTimeWithPlural,
+ y : 'рік',
+ yy : uk__relativeTimeWithPlural
+ },
+ // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason
+ meridiemParse: /ночі|ранку|дня|вечора/,
+ isPM: function (input) {
+ return /^(дня|вечора)$/.test(input);
+ },
+ meridiem : function (hour, minute, isLower) {
+ if (hour < 4) {
+ return 'ночі';
+ } else if (hour < 12) {
+ return 'ранку';
+ } else if (hour < 17) {
+ return 'дня';
+ } else {
+ return 'вечора';
+ }
+ },
+ ordinalParse: /\d{1,2}-(й|го)/,
+ ordinal: function (number, period) {
+ switch (period) {
+ case 'M':
+ case 'd':
+ case 'DDD':
+ case 'w':
+ case 'W':
+ return number + '-й';
+ case 'D':
+ return number + '-го';
+ default:
+ return number;
+ }
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : uzbek (uz)
+ //! author : Sardor Muminov : https://github.com/muminoff
+
+ var uz = moment__default.defineLocale('uz', {
+ months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'),
+ monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'),
+ weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'),
+ weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'),
+ weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM YYYY',
+ LLL : 'D MMMM YYYY HH:mm',
+ LLLL : 'D MMMM YYYY, dddd HH:mm'
+ },
+ calendar : {
+ sameDay : '[Бугун соат] LT [да]',
+ nextDay : '[Эртага] LT [да]',
+ nextWeek : 'dddd [куни соат] LT [да]',
+ lastDay : '[Кеча соат] LT [да]',
+ lastWeek : '[Утган] dddd [куни соат] LT [да]',
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : 'Якин %s ичида',
+ past : 'Бир неча %s олдин',
+ s : 'фурсат',
+ m : 'бир дакика',
+ mm : '%d дакика',
+ h : 'бир соат',
+ hh : '%d соат',
+ d : 'бир кун',
+ dd : '%d кун',
+ M : 'бир ой',
+ MM : '%d ой',
+ y : 'бир йил',
+ yy : '%d йил'
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : vietnamese (vi)
+ //! author : Bang Nguyen : https://github.com/bangnk
+
+ var vi = moment__default.defineLocale('vi', {
+ months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'),
+ monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'),
+ weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'),
+ weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'),
+ weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'),
+ longDateFormat : {
+ LT : 'HH:mm',
+ LTS : 'HH:mm:ss',
+ L : 'DD/MM/YYYY',
+ LL : 'D MMMM [năm] YYYY',
+ LLL : 'D MMMM [năm] YYYY HH:mm',
+ LLLL : 'dddd, D MMMM [năm] YYYY HH:mm',
+ l : 'DD/M/YYYY',
+ ll : 'D MMM YYYY',
+ lll : 'D MMM YYYY HH:mm',
+ llll : 'ddd, D MMM YYYY HH:mm'
+ },
+ calendar : {
+ sameDay: '[Hôm nay lúc] LT',
+ nextDay: '[Ngày mai lúc] LT',
+ nextWeek: 'dddd [tuần tới lúc] LT',
+ lastDay: '[Hôm qua lúc] LT',
+ lastWeek: 'dddd [tuần rồi lúc] LT',
+ sameElse: 'L'
+ },
+ relativeTime : {
+ future : '%s tới',
+ past : '%s trước',
+ s : 'vài giây',
+ m : 'một phút',
+ mm : '%d phút',
+ h : 'một giờ',
+ hh : '%d giờ',
+ d : 'một ngày',
+ dd : '%d ngày',
+ M : 'một tháng',
+ MM : '%d tháng',
+ y : 'một năm',
+ yy : '%d năm'
+ },
+ ordinalParse: /\d{1,2}/,
+ ordinal : function (number) {
+ return number;
+ },
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : chinese (zh-cn)
+ //! author : suupic : https://github.com/suupic
+ //! author : Zeno Zeng : https://github.com/zenozeng
+
+ var zh_cn = moment__default.defineLocale('zh-cn', {
+ months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
+ monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
+ weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
+ weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
+ weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
+ longDateFormat : {
+ LT : 'Ah点mm分',
+ LTS : 'Ah点m分s秒',
+ L : 'YYYY-MM-DD',
+ LL : 'YYYY年MMMD日',
+ LLL : 'YYYY年MMMD日Ah点mm分',
+ LLLL : 'YYYY年MMMD日ddddAh点mm分',
+ l : 'YYYY-MM-DD',
+ ll : 'YYYY年MMMD日',
+ lll : 'YYYY年MMMD日Ah点mm分',
+ llll : 'YYYY年MMMD日ddddAh点mm分'
+ },
+ meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
+ meridiemHour: function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === '凌晨' || meridiem === '早上' ||
+ meridiem === '上午') {
+ return hour;
+ } else if (meridiem === '下午' || meridiem === '晚上') {
+ return hour + 12;
+ } else {
+ // '中午'
+ return hour >= 11 ? hour : hour + 12;
+ }
+ },
+ meridiem : function (hour, minute, isLower) {
+ var hm = hour * 100 + minute;
+ if (hm < 600) {
+ return '凌晨';
+ } else if (hm < 900) {
+ return '早上';
+ } else if (hm < 1130) {
+ return '上午';
+ } else if (hm < 1230) {
+ return '中午';
+ } else if (hm < 1800) {
+ return '下午';
+ } else {
+ return '晚上';
+ }
+ },
+ calendar : {
+ sameDay : function () {
+ return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
+ },
+ nextDay : function () {
+ return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
+ },
+ lastDay : function () {
+ return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
+ },
+ nextWeek : function () {
+ var startOfWeek, prefix;
+ startOfWeek = moment__default().startOf('week');
+ prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]';
+ return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
+ },
+ lastWeek : function () {
+ var startOfWeek, prefix;
+ startOfWeek = moment__default().startOf('week');
+ prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
+ return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
+ },
+ sameElse : 'LL'
+ },
+ ordinalParse: /\d{1,2}(日|月|周)/,
+ ordinal : function (number, period) {
+ switch (period) {
+ case 'd':
+ case 'D':
+ case 'DDD':
+ return number + '日';
+ case 'M':
+ return number + '月';
+ case 'w':
+ case 'W':
+ return number + '周';
+ default:
+ return number;
+ }
+ },
+ relativeTime : {
+ future : '%s内',
+ past : '%s前',
+ s : '几秒',
+ m : '1 分钟',
+ mm : '%d 分钟',
+ h : '1 小时',
+ hh : '%d 小时',
+ d : '1 天',
+ dd : '%d 天',
+ M : '1 个月',
+ MM : '%d 个月',
+ y : '1 年',
+ yy : '%d 年'
+ },
+ week : {
+ // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
+ dow : 1, // Monday is the first day of the week.
+ doy : 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+
+ //! moment.js locale configuration
+ //! locale : traditional chinese (zh-tw)
+ //! author : Ben : https://github.com/ben-lin
+
+ var zh_tw = moment__default.defineLocale('zh-tw', {
+ months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
+ monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
+ weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
+ weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'),
+ weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
+ longDateFormat : {
+ LT : 'Ah點mm分',
+ LTS : 'Ah點m分s秒',
+ L : 'YYYY年MMMD日',
+ LL : 'YYYY年MMMD日',
+ LLL : 'YYYY年MMMD日Ah點mm分',
+ LLLL : 'YYYY年MMMD日ddddAh點mm分',
+ l : 'YYYY年MMMD日',
+ ll : 'YYYY年MMMD日',
+ lll : 'YYYY年MMMD日Ah點mm分',
+ llll : 'YYYY年MMMD日ddddAh點mm分'
+ },
+ meridiemParse: /早上|上午|中午|下午|晚上/,
+ meridiemHour : function (hour, meridiem) {
+ if (hour === 12) {
+ hour = 0;
+ }
+ if (meridiem === '早上' || meridiem === '上午') {
+ return hour;
+ } else if (meridiem === '中午') {
+ return hour >= 11 ? hour : hour + 12;
+ } else if (meridiem === '下午' || meridiem === '晚上') {
+ return hour + 12;
+ }
+ },
+ meridiem : function (hour, minute, isLower) {
+ var hm = hour * 100 + minute;
+ if (hm < 900) {
+ return '早上';
+ } else if (hm < 1130) {
+ return '上午';
+ } else if (hm < 1230) {
+ return '中午';
+ } else if (hm < 1800) {
+ return '下午';
+ } else {
+ return '晚上';
+ }
+ },
+ calendar : {
+ sameDay : '[今天]LT',
+ nextDay : '[明天]LT',
+ nextWeek : '[下]ddddLT',
+ lastDay : '[昨天]LT',
+ lastWeek : '[上]ddddLT',
+ sameElse : 'L'
+ },
+ ordinalParse: /\d{1,2}(日|月|週)/,
+ ordinal : function (number, period) {
+ switch (period) {
+ case 'd' :
+ case 'D' :
+ case 'DDD' :
+ return number + '日';
+ case 'M' :
+ return number + '月';
+ case 'w' :
+ case 'W' :
+ return number + '週';
+ default :
+ return number;
+ }
+ },
+ relativeTime : {
+ future : '%s內',
+ past : '%s前',
+ s : '幾秒',
+ m : '一分鐘',
+ mm : '%d分鐘',
+ h : '一小時',
+ hh : '%d小時',
+ d : '一天',
+ dd : '%d天',
+ M : '一個月',
+ MM : '%d個月',
+ y : '一年',
+ yy : '%d年'
+ }
+ });
+
+ var moment_with_locales = moment__default;
+ moment_with_locales.locale('en');
+ return moment_with_locales;
+}));
\ No newline at end of file
diff --git a/src/main/resources/static/libs/q.js b/payapi/src/main/resources/static/libs/q.js
similarity index 100%
rename from src/main/resources/static/libs/q.js
rename to payapi/src/main/resources/static/libs/q.js
diff --git a/src/main/resources/static/libs/zTree/css/metroStyle/img/line_conn.png b/payapi/src/main/resources/static/libs/zTree/css/metroStyle/img/line_conn.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/metroStyle/img/line_conn.png
rename to payapi/src/main/resources/static/libs/zTree/css/metroStyle/img/line_conn.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/metroStyle/img/loading.gif b/payapi/src/main/resources/static/libs/zTree/css/metroStyle/img/loading.gif
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/metroStyle/img/loading.gif
rename to payapi/src/main/resources/static/libs/zTree/css/metroStyle/img/loading.gif
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/metroStyle/img/metro.gif b/payapi/src/main/resources/static/libs/zTree/css/metroStyle/img/metro.gif
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/metroStyle/img/metro.gif
rename to payapi/src/main/resources/static/libs/zTree/css/metroStyle/img/metro.gif
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/metroStyle/img/metro.png b/payapi/src/main/resources/static/libs/zTree/css/metroStyle/img/metro.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/metroStyle/img/metro.png
rename to payapi/src/main/resources/static/libs/zTree/css/metroStyle/img/metro.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/metroStyle/metroStyle.css b/payapi/src/main/resources/static/libs/zTree/css/metroStyle/metroStyle.css
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/metroStyle/metroStyle.css
rename to payapi/src/main/resources/static/libs/zTree/css/metroStyle/metroStyle.css
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/1_close.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/1_close.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/1_close.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/1_close.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/1_open.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/1_open.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/1_open.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/1_open.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/2.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/2.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/2.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/2.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/3.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/3.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/3.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/3.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/4.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/4.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/4.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/4.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/5.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/5.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/5.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/5.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/6.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/6.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/6.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/6.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/7.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/7.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/7.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/7.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/8.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/8.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/8.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/8.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/9.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/9.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/9.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/diy/9.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/line_conn.gif b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/line_conn.gif
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/line_conn.gif
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/line_conn.gif
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/loading.gif b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/loading.gif
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/loading.gif
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/loading.gif
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/zTreeStandard.gif b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/zTreeStandard.gif
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/zTreeStandard.gif
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/zTreeStandard.gif
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/img/zTreeStandard.png b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/zTreeStandard.png
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/img/zTreeStandard.png
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/img/zTreeStandard.png
Binary files differ
diff --git a/src/main/resources/static/libs/zTree/css/zTreeStyle/zTreeStyle.css b/payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/zTreeStyle.css
similarity index 100%
rename from src/main/resources/static/libs/zTree/css/zTreeStyle/zTreeStyle.css
rename to payapi/src/main/resources/static/libs/zTree/css/zTreeStyle/zTreeStyle.css
diff --git a/src/main/resources/static/libs/zTree/js/jquery.ztree.all-3.5.min.js b/payapi/src/main/resources/static/libs/zTree/js/jquery.ztree.all-3.5.min.js
similarity index 100%
rename from src/main/resources/static/libs/zTree/js/jquery.ztree.all-3.5.min.js
rename to payapi/src/main/resources/static/libs/zTree/js/jquery.ztree.all-3.5.min.js
diff --git a/src/main/resources/templates/error/403.html b/payapi/src/main/resources/templates/error/403.html
similarity index 99%
rename from src/main/resources/templates/error/403.html
rename to payapi/src/main/resources/templates/error/403.html
index 155f35a..a3843f7 100755
--- a/src/main/resources/templates/error/403.html
+++ b/payapi/src/main/resources/templates/error/403.html
@@ -1,27 +1,27 @@
-<!DOCTYPE html>
-<html xmlns:th="http://www.thymeleaf.org" >
-<head>
- <meta charset="utf-8">
- <title>403 无权限</title>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <link rel="stylesheet" th:href="@{/static/libs/layui/css/layui.css}" media="all"/>
- <link rel="stylesheet" th:href="@{/static/custom/css/admin.css}" media="all"/>
-</head>
-<body>
-<div class="layui-fluid">
- <div class="layadmin-tips">
- <i class="layui-icon" face></i>
- <div class="layui-text">
- <p>没有权限</p>
- <h1>
- <span class="layui-anim layui-anim-loop layui-anim-">4</span>
- <span class="layui-anim layui-anim-loop layui-anim-rotate">0</span>
- <span class="layui-anim layui-anim-loop layui-anim-">3</span>
- </h1>
- </div>
- </div>
-</div>
-</body>
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org" >
+<head>
+ <meta charset="utf-8">
+ <title>403 无权限</title>
+ <meta name="renderer" content="webkit">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <link rel="stylesheet" th:href="@{/static/libs/layui/css/layui.css}" media="all"/>
+ <link rel="stylesheet" th:href="@{/static/custom/css/admin.css}" media="all"/>
+</head>
+<body>
+<div class="layui-fluid">
+ <div class="layadmin-tips">
+ <i class="layui-icon" face></i>
+ <div class="layui-text">
+ <p>没有权限</p>
+ <h1>
+ <span class="layui-anim layui-anim-loop layui-anim-">4</span>
+ <span class="layui-anim layui-anim-loop layui-anim-rotate">0</span>
+ <span class="layui-anim layui-anim-loop layui-anim-">3</span>
+ </h1>
+ </div>
+ </div>
+</div>
+</body>
</html>
\ No newline at end of file
diff --git a/src/main/resources/templates/error/404.html b/payapi/src/main/resources/templates/error/404.html
similarity index 99%
rename from src/main/resources/templates/error/404.html
rename to payapi/src/main/resources/templates/error/404.html
index 89144f5..b818658 100755
--- a/src/main/resources/templates/error/404.html
+++ b/payapi/src/main/resources/templates/error/404.html
@@ -1,28 +1,28 @@
-<!DOCTYPE html>
-<html xmlns:th="http://www.thymeleaf.org" >
-<head>
- <meta charset="utf-8">
- <title>404 页面不存在</title>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <link rel="stylesheet" th:href="@{/static/libs/layui/css/layui.css}" media="all"/>
- <link rel="stylesheet" th:href="@{/static/custom/css/admin.css}" media="all"/>
-</head>
-<body>
-
-<div class="layui-fluid">
- <div class="layadmin-tips">
- <i class="layui-icon" face></i>
- <div class="layui-text">
- <p>页面不存在</p>
- <h1>
- <span class="layui-anim layui-anim-loop layui-anim-">4</span>
- <span class="layui-anim layui-anim-loop layui-anim-rotate">0</span>
- <span class="layui-anim layui-anim-loop layui-anim-">4</span>
- </h1>
- </div>
- </div>
-</div>
-</body>
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org" >
+<head>
+ <meta charset="utf-8">
+ <title>404 页面不存在</title>
+ <meta name="renderer" content="webkit">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <link rel="stylesheet" th:href="@{/static/libs/layui/css/layui.css}" media="all"/>
+ <link rel="stylesheet" th:href="@{/static/custom/css/admin.css}" media="all"/>
+</head>
+<body>
+
+<div class="layui-fluid">
+ <div class="layadmin-tips">
+ <i class="layui-icon" face></i>
+ <div class="layui-text">
+ <p>页面不存在</p>
+ <h1>
+ <span class="layui-anim layui-anim-loop layui-anim-">4</span>
+ <span class="layui-anim layui-anim-loop layui-anim-rotate">0</span>
+ <span class="layui-anim layui-anim-loop layui-anim-">4</span>
+ </h1>
+ </div>
+ </div>
+</div>
+</body>
</html>
\ No newline at end of file
diff --git a/src/main/resources/templates/error/500.html b/payapi/src/main/resources/templates/error/500.html
similarity index 99%
rename from src/main/resources/templates/error/500.html
rename to payapi/src/main/resources/templates/error/500.html
index c46acd2..fc442c7 100755
--- a/src/main/resources/templates/error/500.html
+++ b/payapi/src/main/resources/templates/error/500.html
@@ -1,28 +1,28 @@
-<!DOCTYPE html>
-<html xmlns:th="http://www.thymeleaf.org" >
-<head>
- <meta charset="utf-8">
- <title>500 服务出错</title>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <link rel="stylesheet" th:href="@{/static/libs/layui/css/layui.css}" media="all"/>
- <link rel="stylesheet" th:href="@{/static/custom/css/admin.css}" media="all"/>
-</head>
-<body>
-
-<div class="layui-fluid">
- <div class="layadmin-tips">
- <i class="layui-icon" face></i>
- <div class="layui-text">
- <p>服务器出错了</p>
- <h1>
- <span class="layui-anim layui-anim-loop layui-anim-">5</span>
- <span class="layui-anim layui-anim-loop layui-anim-rotate">0</span>
- <span class="layui-anim layui-anim-loop layui-anim-">0</span>
- </h1>
- </div>
- </div>
-</div>
-</body>
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org" >
+<head>
+ <meta charset="utf-8">
+ <title>500 服务出错</title>
+ <meta name="renderer" content="webkit">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <link rel="stylesheet" th:href="@{/static/libs/layui/css/layui.css}" media="all"/>
+ <link rel="stylesheet" th:href="@{/static/custom/css/admin.css}" media="all"/>
+</head>
+<body>
+
+<div class="layui-fluid">
+ <div class="layadmin-tips">
+ <i class="layui-icon" face></i>
+ <div class="layui-text">
+ <p>服务器出错了</p>
+ <h1>
+ <span class="layui-anim layui-anim-loop layui-anim-">5</span>
+ <span class="layui-anim layui-anim-loop layui-anim-rotate">0</span>
+ <span class="layui-anim layui-anim-loop layui-anim-">0</span>
+ </h1>
+ </div>
+ </div>
+</div>
+</body>
</html>
\ No newline at end of file
diff --git a/payapi/src/main/resources/templates/home/console.html b/payapi/src/main/resources/templates/home/console.html
new file mode 100755
index 0000000..76b0b79
--- /dev/null
+++ b/payapi/src/main/resources/templates/home/console.html
@@ -0,0 +1,28 @@
+<div class="layui-row layui-col-space15">
+
+</div>
+
+
+
+
+
+<script>
+ layui.use(['carousel', 'element'], function () {
+ var carousel = layui.carousel;
+ var element = layui.element;
+ var device = layui.device;
+
+ layui.link('[[@{/static/custom/css/console.css}]]');
+
+ // 渲染轮播
+ carousel.render({
+ elem: '.layui-carousel',
+ width: '100%',
+ height: '60px',
+ arrow: 'none',
+ autoplay: true,
+ trigger: device.ios || device.android ? 'click' : 'hover',
+ anim: 'fade'
+ });
+ });
+</script>
diff --git a/src/main/resources/templates/home/message.html b/payapi/src/main/resources/templates/home/message.html
similarity index 100%
rename from src/main/resources/templates/home/message.html
rename to payapi/src/main/resources/templates/home/message.html
diff --git a/src/main/resources/templates/home/password.html b/payapi/src/main/resources/templates/home/password.html
similarity index 99%
rename from src/main/resources/templates/home/password.html
rename to payapi/src/main/resources/templates/home/password.html
index e9e8aee..e74beba 100755
--- a/src/main/resources/templates/home/password.html
+++ b/payapi/src/main/resources/templates/home/password.html
@@ -1,58 +1,58 @@
-<div class="layui-card-header">
- <h2 class="header-title">修改密码</h2>
-</div>
-<div class="layui-card-body" style="padding: 30px;">
- <form class="layui-form" id="form-psw">
- <div class="layui-form-item">
- <input type="password" name="oldPsw" required lay-verify="required" class="layui-input"
- placeholder="请输入原密码" lay-verType="tips">
- </div>
- <div class="layui-form-item">
- <input type="password" name="newPsw" required lay-verify="required|psw" class="layui-input"
- placeholder="请输入新密码" lay-verType="tips">
- </div>
- <div class="layui-form-item">
- <input type="password" name="rePsw" required lay-verify="required|repsw" class="layui-input"
- placeholder="再次输入新密码" lay-verType="tips">
- </div>
- <div class="layui-form-item">
- <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="submit-psw">确认修改</button>
- </div>
- </form>
-</div>
-
-<script>
- layui.use(['form', 'admin', 'layer'], function () {
- var form = layui.form;
- var admin = layui.admin;
- var layer = layui.layer;
-
- // 监听提交
- form.on('submit(submit-psw)', function (data) {
- layer.load(2);
- $.post('[[@{/system/user/updatePsw}]]', data.field, function (data) {
- if (data.code == 200) {
- layer.closeAll('loading');
- admin.closePopupRight();
- layer.msg(data.msg, {icon: 1, time: 1000}, function () {
- location.replace('logout');
- });
- } else {
- layer.closeAll('loading');
- layer.msg(data.msg, {icon: 2});
- }
- });
- return false;
- });
-
- // 添加表单验证方法
- form.verify({
- psw: [/^[\S]{5,12}$/, '密码必须5到12位,且不能出现空格'],
- repsw: function (t) {
- if (t !== $('#form-psw input[name=newPsw]').val()) {
- return '两次密码输入不一致';
- }
- }
- });
- });
+<div class="layui-card-header">
+ <h2 class="header-title">修改密码</h2>
+</div>
+<div class="layui-card-body" style="padding: 30px;">
+ <form class="layui-form" id="form-psw">
+ <div class="layui-form-item">
+ <input type="password" name="oldPsw" required lay-verify="required" class="layui-input"
+ placeholder="请输入原密码" lay-verType="tips">
+ </div>
+ <div class="layui-form-item">
+ <input type="password" name="newPsw" required lay-verify="required|psw" class="layui-input"
+ placeholder="请输入新密码" lay-verType="tips">
+ </div>
+ <div class="layui-form-item">
+ <input type="password" name="rePsw" required lay-verify="required|repsw" class="layui-input"
+ placeholder="再次输入新密码" lay-verType="tips">
+ </div>
+ <div class="layui-form-item">
+ <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="submit-psw">确认修改</button>
+ </div>
+ </form>
+</div>
+
+<script>
+ layui.use(['form', 'admin', 'layer'], function () {
+ var form = layui.form;
+ var admin = layui.admin;
+ var layer = layui.layer;
+
+ // 监听提交
+ form.on('submit(submit-psw)', function (data) {
+ layer.load(2);
+ $.post('[[@{/system/user/updatePsw}]]', data.field, function (data) {
+ if (data.code == 200) {
+ layer.closeAll('loading');
+ admin.closePopupRight();
+ layer.msg(data.msg, {icon: 1, time: 1000}, function () {
+ location.replace('logout');
+ });
+ } else {
+ layer.closeAll('loading');
+ layer.msg(data.msg, {icon: 2});
+ }
+ });
+ return false;
+ });
+
+ // 添加表单验证方法
+ form.verify({
+ psw: [/^[\S]{5,12}$/, '密码必须5到12位,且不能出现空格'],
+ repsw: function (t) {
+ if (t !== $('#form-psw input[name=newPsw]').val()) {
+ return '两次密码输入不一致';
+ }
+ }
+ });
+ });
</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/home/theme.html b/payapi/src/main/resources/templates/home/theme.html
similarity index 82%
rename from src/main/resources/templates/home/theme.html
rename to payapi/src/main/resources/templates/home/theme.html
index 67cb12a..71700a0 100755
--- a/src/main/resources/templates/home/theme.html
+++ b/payapi/src/main/resources/templates/home/theme.html
@@ -1,37 +1,37 @@
-<div class="layui-card-header">
- <h2 class="header-title">多标签:</h2>
- <div class="pull-right layui-form">
- <input type="checkbox" lay-skin="switch" lay-text="ON|OFF" id="set-tab" lay-filter="set-tab" checked/>
- </div>
-</div>
-
-<div class="layui-card-header"><h2 class="header-title">设置主题:</h2></div>
-<div class="layui-card-body layui-text">
- <a href="/home/setTheme" class="layui-btn" style="background-color: #009688;">默认主题</a>
- <a href="/home/setTheme?themeName=blue" class="layui-btn layui-btn-normal">蓝色主题</a>
- <br><br><br>
-
-</div>
-
-<script>
- layui.use(['form', 'index', 'admin'], function () {
- var form = layui.form;
- var index = layui.index;
- var admin = layui.admin;
-
- $('#set-tab').prop('checked', index.pageTabs);
- form.render('checkbox');
-
- form.on('switch(set-tab)', function (data) {
- if (data.elem.checked) {
- location.reload();
- } else {
- index.pageTabs = false;
- index.checkPageTabs();
- admin.refresh();
- admin.closePopupRight();
- }
- });
-
- });
+<div class="layui-card-header">
+ <h2 class="header-title">多标签:</h2>
+ <div class="pull-right layui-form">
+ <input type="checkbox" lay-skin="switch" lay-text="ON|OFF" id="set-tab" lay-filter="set-tab" checked/>
+ </div>
+</div>
+
+<div class="layui-card-header"><h2 class="header-title">设置主题:</h2></div>
+<div class="layui-card-body layui-text">
+ <a th:href="@{/home/setTheme}" class="layui-btn" style="background-color: #009688;">默认主题</a>
+ <a th:href="@{/home/setTheme?themeName=blue}" class="layui-btn layui-btn-normal">蓝色主题</a>
+ <br><br><br>
+
+</div>
+
+<script>
+ layui.use(['form', 'index', 'admin'], function () {
+ var form = layui.form;
+ var index = layui.index;
+ var admin = layui.admin;
+
+ $('#set-tab').prop('checked', index.pageTabs);
+ form.render('checkbox');
+
+ form.on('switch(set-tab)', function (data) {
+ if (data.elem.checked) {
+ location.reload();
+ } else {
+ index.pageTabs = false;
+ index.checkPageTabs();
+ admin.refresh();
+ admin.closePopupRight();
+ }
+ });
+
+ });
</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/index.html b/payapi/src/main/resources/templates/index.html
similarity index 85%
rename from src/main/resources/templates/index.html
rename to payapi/src/main/resources/templates/index.html
index 1fb326d..302af3a 100755
--- a/src/main/resources/templates/index.html
+++ b/payapi/src/main/resources/templates/index.html
@@ -1,163 +1,165 @@
-<!DOCTYPE html>
-<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
-
-<head>
- <title>首页</title>
- <meta name="_csrf_header" th:content="${_csrf.headerName}" />
- <meta name="_csrf_token" th:content="${_csrf.parameterName}" th:value="${_csrf.token}" />
- <meta charset="utf-8"/>
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <link rel="stylesheet" th:href="@{/static/libs/layui/css/layui.css}"/>
- <link rel="stylesheet" th:href="@{/static/libs/zTree/css/zTreeStyle/zTreeStyle.css}"/>
- <link rel="stylesheet" th:href="@{/static/custom/module/formSelects/formSelects-v4.css}"/>
- <link rel="stylesheet" th:href="@{/static/custom/css/admin.css}"/>
- <link th:if="${session.theme != null}" rel="stylesheet" th:href="@{/static/custom/css/theme-blue.css}"/>
-</head>
-
-<body class="layui-layout-body">
-<div class="layui-layout layui-layout-admin">
- <!-- 头部 -->
- <div class="layui-header">
- <div class="layui-logo">
- <img th:src="@{/static/custom/images/logo.png}"/>
- <cite>支付中心</cite>
- </div>
- <ul class="layui-nav layui-layout-left">
- <li class="layui-nav-item" lay-unselect>
- <a ew-event="flexible" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
- </li>
- <li class="layui-nav-item" lay-unselect>
- <a ew-event="refresh" title="刷新"><i class="layui-icon layui-icon-refresh-3"></i></a>
- </li>
- </ul>
- <ul class="layui-nav layui-layout-right">
- <li class="layui-nav-item" lay-unselect>
- <a ew-event="refreshDict" title="刷新字典"><i class="layui-icon layui-icon-read"></i></a>
- </li>
- <!--<li class="layui-nav-item" lay-unselect>-->
- <!--<a id="btnMessage" title="消息"><i class="layui-icon layui-icon-notice"></i></a>-->
- <!--</li>-->
- <li class="layui-nav-item layui-hide-xs" lay-unselect>
- <a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>
- </li>
- <li class="layui-nav-item" lay-unselect>
- <a href="javascript:;">
- <img th:src="@{/static/custom/images/head.png}" class="layui-nav-img">
- <cite>[[${loginOper.opername}]]</cite>
- </a>
- <dl class="layui-nav-child">
- <dd ay-unselect><a lay-href="/operator/userinfor">基本资料</a></dd>
- <dd ay-unselect><a lay-href="/operator/setpwd">修改密码</a></dd>
- <hr>
- <dd layadmin-event="logout" style="text-align: center;" ><a th:href="@{/logout}">退出</a></dd>
- </dl>
- </li>
- <li class="layui-nav-item" lay-unselect>
- <a ew-event="theme" title="主题"><i class="layui-icon layui-icon-more-vertical"></i></a>
- </li>
- </ul>
- </div>
-
- <!-- 侧边栏 -->
- <div class="layui-side">
- <div class="layui-side-scroll">
- <ul class="layui-nav layui-nav-tree" style="margin-top: 15px;">
-
- <li class="layui-nav-item" th:each="menu : ${menus}">
- <a th:lay-href="${menu.menuUrl}"><i th:class="'layui-icon '+${menu.menuIcon}"></i> <cite>[[${menu.menuName}]]</cite></a>
- <dl class="layui-nav-child" th:if="${menu.subMenus.size()} > 0">
- <dd th:each="subMenu : ${menu.subMenus}">
- <a th:lay-href="${subMenu.menuUrl}">[[${subMenu.menuName}]]</a>
- <dl class="layui-nav-child" th:if="${subMenu.subMenus.size()} > 0">
- <dd th:each="temp : ${subMenu.subMenus}"><a th:lay-href="${temp.menuUrl}">
- <i th:class="'layui-icon '+${temp.menuIcon}"></i>
- [[${temp.menuName}]]
- </a>
- </dd>
- </dl>
- </dd>
- </dl>
- </li>
-
- <!--<li class="layui-nav-item">-->
- <!--<a href="javascript:;"><i class="layui-icon layui-icon-unlink"></i> <cite>多级菜单</cite></a>-->
- <!--<dl class="layui-nav-child">-->
- <!--<dd>-->
- <!--<a href="javascript:;">二级菜单</a>-->
- <!--<dl class="layui-nav-child">-->
- <!--<dd><a href="javascript:;">三级菜单</a></dd>-->
- <!--<dd><a href="javascript:;">三级菜单</a></dd>-->
- <!--</dl>-->
- <!--</dd>-->
- <!--</dl>-->
- <!--</li>-->
- </ul>
- </div>
- </div>
-
-
- <!-- 主体部分 -->
- <div class="layui-body">
- <div class="layui-tab" lay-allowClose="true" lay-filter="admin-pagetabs">
- <ul class="layui-tab-title">
- </ul>
- <div class="layui-tab-content">
- </div>
- </div>
- <div class="layui-icon admin-tabs-control layui-icon-prev" ew-event="leftPage"></div>
- <div class="layui-icon admin-tabs-control layui-icon-next" ew-event="rightPage"></div>
- <div class="layui-icon admin-tabs-control layui-icon-down">
- <ul class="layui-nav admin-tabs-select" lay-filter="admin-pagetabs-nav">
- <li class="layui-nav-item" lay-unselect>
- <a href="javascript:;"></a>
- <dl class="layui-nav-child layui-anim-fadein">
- <dd ew-event="closeThisTabs" lay-unselect><a href="javascript:;">关闭当前标签页</a></dd>
- <dd ew-event="closeOtherTabs" lay-unselect><a href="javascript:;">关闭其它标签页</a></dd>
- <dd ew-event="closeAllTabs" lay-unselect><a href="javascript:;">关闭全部标签页</a></dd>
- </dl>
- </li>
- </ul>
- </div>
- </div>
-
- <!-- 底部 -->
- <div class="layui-footer">Copyright © 2018 supwisdom All rights reserved. <span class="pull-right" th:text="${payapiVersion}">Version 1.0</span>
- </div>
-
- <!-- 手机屏幕遮罩层 -->
- <div class="site-mobile-shade"></div>
-</div>
-
-<script type="text/javascript" th:src="@{/static/libs/jquery/jquery-3.2.1.min.js}"></script>
-<script type="text/javascript" th:src="@{/static/libs/q.js}"></script>
-<script type="text/javascript" th:src="@{/static/libs/layui/layui.js}"></script>
-<script type="text/javascript" th:src="@{/static/libs/zTree/js/jquery.ztree.all-3.5.min.js}"></script>
-<script type="text/javascript" th:src="@{/static/libs/custom.js}"></script>
-
-<script>
- layui.config({
- base: 'static/custom/module/'
- }).extend({
- formSelects: 'formSelects/formSelects-v4',
- treetable: 'treetable-lay/treetable',
- treeSelect: 'treeSelect/treeSelect'
- }).use(['admin'], function () {
- var admin = layui.admin;
- });
-</script>
-
-<script>
- layui.use(['index'], function () {
- var index = layui.index;
- index.checkPageTabs(true); // 检查多标签是否开启
- index.initRouter(); // 导航栏和tab联动
- index.bindEvent(); // 绑定事件
-
- var dictpool = DictPoolToolkit();
- dictpool.initAll("[[@{/dictpool}]]"); //加载字典
- });
-</script>
-</body>
-
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
+
+<head>
+ <title>首页</title>
+ <meta name="_csrf_header" th:content="${_csrf.headerName}"/>
+ <meta name="_csrf_token" th:content="${_csrf.parameterName}" th:value="${_csrf.token}"/>
+ <meta charset="utf-8"/>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <link rel="stylesheet" th:href="@{/static/libs/layui/css/layui.css}"/>
+ <link rel="stylesheet" th:href="@{/static/libs/zTree/css/zTreeStyle/zTreeStyle.css}"/>
+ <link rel="stylesheet" th:href="@{/static/custom/module/formSelects/formSelects-v4.css}"/>
+ <link rel="stylesheet" th:href="@{/static/custom/css/admin.css}"/>
+ <link th:if="${session.theme != null}" rel="stylesheet" th:href="@{/static/custom/css/theme-blue.css}"/>
+</head>
+
+<body class="layui-layout-body">
+<div class="layui-layout layui-layout-admin">
+ <!-- 头部 -->
+ <div class="layui-header">
+ <div class="layui-logo">
+ <img th:src="@{/static/custom/images/logo.png}"/>
+ <cite>支付中心</cite>
+ </div>
+ <ul class="layui-nav layui-layout-left">
+ <li class="layui-nav-item" lay-unselect>
+ <a ew-event="flexible" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
+ </li>
+ <li class="layui-nav-item" lay-unselect>
+ <a ew-event="refresh" title="刷新"><i class="layui-icon layui-icon-refresh-3"></i></a>
+ </li>
+ </ul>
+ <ul class="layui-nav layui-layout-right">
+ <li class="layui-nav-item" lay-unselect>
+ <a ew-event="refreshDict" title="刷新字典"><i class="layui-icon layui-icon-read"></i></a>
+ </li>
+ <!--<li class="layui-nav-item" lay-unselect>-->
+ <!--<a id="btnMessage" title="消息"><i class="layui-icon layui-icon-notice"></i></a>-->
+ <!--</li>-->
+ <li class="layui-nav-item layui-hide-xs" lay-unselect>
+ <a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>
+ </li>
+ <li class="layui-nav-item" lay-unselect>
+ <a href="javascript:;">
+ <img th:src="@{/static/custom/images/head.png}" class="layui-nav-img">
+ <cite>[[${loginOper.opername}]]</cite>
+ </a>
+ <dl class="layui-nav-child">
+ <dd ay-unselect><a lay-href="/operator/userinfor">基本资料</a></dd>
+ <dd ay-unselect><a lay-href="/operator/setpwd">修改密码</a></dd>
+ <hr>
+ <dd layadmin-event="logout" style="text-align: center;"><a th:href="@{/logout}">退出</a></dd>
+ </dl>
+ </li>
+ <li class="layui-nav-item" lay-unselect>
+ <a ew-event="theme" title="主题"><i class="layui-icon layui-icon-more-vertical"></i></a>
+ </li>
+ </ul>
+ </div>
+
+ <!-- 侧边栏 -->
+ <div class="layui-side">
+ <div class="layui-side-scroll">
+ <ul class="layui-nav layui-nav-tree" style="margin-top: 15px;">
+
+ <li class="layui-nav-item" th:each="menu : ${menus}">
+ <a th:lay-href="${menu.menuUrl}"><i th:class="'layui-icon '+${menu.menuIcon}"></i> <cite>[[${menu.menuName}]]</cite></a>
+ <dl class="layui-nav-child" th:if="${menu.subMenus.size()} > 0">
+ <dd th:each="subMenu : ${menu.subMenus}">
+ <a th:lay-href="${subMenu.menuUrl}">[[${subMenu.menuName}]]</a>
+ <dl class="layui-nav-child" th:if="${subMenu.subMenus.size()} > 0">
+ <dd th:each="temp : ${subMenu.subMenus}"><a th:lay-href="${temp.menuUrl}">
+ <i th:class="'layui-icon '+${temp.menuIcon}"></i>
+ [[${temp.menuName}]]
+ </a>
+ </dd>
+ </dl>
+ </dd>
+ </dl>
+ </li>
+
+ <!--<li class="layui-nav-item">-->
+ <!--<a href="javascript:;"><i class="layui-icon layui-icon-unlink"></i> <cite>多级菜单</cite></a>-->
+ <!--<dl class="layui-nav-child">-->
+ <!--<dd>-->
+ <!--<a href="javascript:;">二级菜单</a>-->
+ <!--<dl class="layui-nav-child">-->
+ <!--<dd><a href="javascript:;">三级菜单</a></dd>-->
+ <!--<dd><a href="javascript:;">三级菜单</a></dd>-->
+ <!--</dl>-->
+ <!--</dd>-->
+ <!--</dl>-->
+ <!--</li>-->
+ </ul>
+ </div>
+ </div>
+
+
+ <!-- 主体部分 -->
+ <div class="layui-body">
+ <div class="layui-tab" lay-allowClose="true" lay-filter="admin-pagetabs">
+ <ul class="layui-tab-title">
+ </ul>
+ <div class="layui-tab-content">
+ </div>
+ </div>
+ <div class="layui-icon admin-tabs-control layui-icon-prev" ew-event="leftPage"></div>
+ <div class="layui-icon admin-tabs-control layui-icon-next" ew-event="rightPage"></div>
+ <div class="layui-icon admin-tabs-control layui-icon-down">
+ <ul class="layui-nav admin-tabs-select" lay-filter="admin-pagetabs-nav">
+ <li class="layui-nav-item" lay-unselect>
+ <a href="javascript:;"></a>
+ <dl class="layui-nav-child layui-anim-fadein">
+ <dd ew-event="closeThisTabs" lay-unselect><a href="javascript:;">关闭当前标签页</a></dd>
+ <dd ew-event="closeOtherTabs" lay-unselect><a href="javascript:;">关闭其它标签页</a></dd>
+ <dd ew-event="closeAllTabs" lay-unselect><a href="javascript:;">关闭全部标签页</a></dd>
+ </dl>
+ </li>
+ </ul>
+ </div>
+ </div>
+
+ <!-- 底部 -->
+ <div class="layui-footer">Copyright © 2018 supwisdom All rights reserved. <span class="pull-right"
+ th:text="${payapiVersion}">Version 1.0</span>
+ </div>
+
+ <!-- 手机屏幕遮罩层 -->
+ <div class="site-mobile-shade"></div>
+</div>
+
+<script type="text/javascript" th:src="@{/static/libs/jquery/jquery-3.2.1.min.js}"></script>
+<script type="text/javascript" th:src="@{/static/libs/q.js}"></script>
+<script type="text/javascript" th:src="@{/static/libs/layui/layui.js}"></script>
+<script type="text/javascript" th:src="@{/static/libs/zTree/js/jquery.ztree.all-3.5.min.js}"></script>
+<script type="text/javascript" th:src="@{/static/libs/moment.js}"></script>
+<script type="text/javascript" th:src="@{/static/libs/custom.js}"></script>
+
+<script>
+ layui.config({
+ base: 'static/custom/module/'
+ }).extend({
+ formSelects: 'formSelects/formSelects-v4',
+ treetable: 'treetable-lay/treetable',
+ treeSelect: 'treeSelect/treeSelect'
+ }).use(['admin'], function () {
+ var admin = layui.admin;
+ });
+</script>
+
+<script>
+ layui.use(['index'], function () {
+ var index = layui.index;
+ index.checkPageTabs(true); // 检查多标签是否开启
+ index.initRouter(); // 导航栏和tab联动
+ index.bindEvent(); // 绑定事件
+
+ var dictpool = DictPoolToolkit();
+ dictpool.initAll("[[@{/dictpool}]]"); //加载字典
+ });
+</script>
+</body>
+
</html>
\ No newline at end of file
diff --git a/src/main/resources/templates/login.html b/payapi/src/main/resources/templates/login.html
similarity index 97%
rename from src/main/resources/templates/login.html
rename to payapi/src/main/resources/templates/login.html
index d5d6c7b..a87ae82 100644
--- a/src/main/resources/templates/login.html
+++ b/payapi/src/main/resources/templates/login.html
@@ -45,7 +45,7 @@
<div class="layui-input-block">
<div class="layui-row inline-block">
<div class="layui-col-xs7">
- <input name="imageCode" type="text" placeholder="验证码"
+ <input name="verifyCodeActual" type="text" placeholder="验证码"
class="layui-input">
</div>
<div class="layui-col-xs5" style="padding-left: 10px;">
diff --git a/src/main/resources/templates/ologin.html b/payapi/src/main/resources/templates/ologin.html
similarity index 97%
rename from src/main/resources/templates/ologin.html
rename to payapi/src/main/resources/templates/ologin.html
index 8f9362e..ac043c3 100644
--- a/src/main/resources/templates/ologin.html
+++ b/payapi/src/main/resources/templates/ologin.html
@@ -42,7 +42,7 @@
<div class="layui-input-block">
<div class="layui-row inline-block">
<div class="layui-col-xs7">
- <input name="imageCode" type="text" placeholder="验证码"
+ <input name="verifyCodeActual" type="text" placeholder="验证码"
class="layui-input">
</div>
<div class="layui-col-xs5" style="padding-left: 10px;">
diff --git a/src/main/resources/templates/system/dtl/shopdtl.html b/payapi/src/main/resources/templates/system/dtl/shopdtl.html
similarity index 79%
rename from src/main/resources/templates/system/dtl/shopdtl.html
rename to payapi/src/main/resources/templates/system/dtl/shopdtl.html
index 536b7d9..ecebe4e 100644
--- a/src/main/resources/templates/system/dtl/shopdtl.html
+++ b/payapi/src/main/resources/templates/system/dtl/shopdtl.html
@@ -8,11 +8,12 @@
</div>
<div class="layui-card-body">
<div class="layui-form" lay-filter="shopdtl-search-form">
- <div class="layui-form-item" style="margin-bottom: 0;">
+ <div class="layui-form-item" style="margin-bottom: 10px;">
<div class="layui-inline">
<label class="layui-form-label">记账日期</label>
<div class="layui-input-inline" style="width: 120px;">
- <input type="text" name="startAccdate" id="shopdtl-search-startAccdate" placeholder="开始日期"
+ <input type="text" name="startAccdate" id="shopdtl-search-startAccdate"
+ placeholder="开始日期"
autocomplete="off" class="layui-input"/>
</div>
<div class="layui-form-mid">-</div>
@@ -23,18 +24,10 @@
</div>
</div>
- <div class="layui-inline" style="width: 298px;">
- <label class="layui-form-label">商户名称</label>
- <div class="layui-input-block">
- <input type="text" name="shopname" id="shopdtl-search-shopname" placeholder="商户名称"
- autocomplete="off" class="layui-input" maxlength="20"/>
- </div>
- </div>
-
<div class="layui-inline">
<label class="layui-form-label">支付方式</label>
- <div class="layui-input-block">
- <select name="sourcetype" id="shopdtl-search-sourcetype" class="layui-select">
+ <div class="layui-input-block" style="height: 38px;">
+ <select name="sourceType" id="shopdtl-search-sourceType" class="layui-select">
<option value=""> 全部</option>
<option th:each="pt:${paytypelist}" th:value="${pt.sourceType}"
th:text="${pt.paydesc}"></option>
@@ -44,41 +37,44 @@
<div class="layui-inline">
<label class="layui-form-label">状态</label>
- <div class="layui-input-block">
+ <div class="layui-input-block" style="height: 38px;">
<select name="transStatus" id="shopdtl-search-transStatus" class="layui-select">
<option value=""> 全部</option>
- <option th:each="st:${dtlstatuslist}" th:value="${st.dictval}"
+ <option th:each="st:${dtlStatusList}" th:value="${st.dictval}"
th:text="${st.dictcaption}"></option>
</select> 
</div>
</div>
</div>
- <div class="layui-form-item" style="margin-bottom: 0;">
+ <div class="layui-form-item" style="margin-bottom: 10px;">
<div class="layui-inline">
<label class="layui-form-label">交易日期</label>
<div class="layui-input-inline" style="width: 120px;">
- <input type="text" name="startTransdate" id="shopdtl-search-startTransdate" placeholder="开始日期"
+ <input type="text" name="startTransdate" id="shopdtl-search-startTransdate"
+ placeholder="开始日期"
autocomplete="off" class="layui-input"/>
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 120px;">
- <input type="text" name="endTransdate" id="shopdtl-search-endTransdate" placeholder="结束日期"
+ <input type="text" name="endTransdate" id="shopdtl-search-endTransdate"
+ placeholder="结束日期"
autocomplete="off" class="layui-input"/>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">选择商户</label>
- <div class="layui-input-block">
- <input type="text" name="shopaccno" id="shopdtl-search-shopaccno" placeholder="选择商户" lay-filter="shopdtl-search-shopaccno-filter"
+ <div class="layui-input-block" style="height: 38px;">
+ <input type="text" name="shopaccno" id="shopdtl-search-shopaccno" placeholder="选择商户"
+ lay-filter="shopdtl-search-shopaccno-filter"
autocomplete="off" class="layui-input"/>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">类型</label>
- <div class="layui-input-block">
+ <div class="layui-input-block" style="height: 38px;">
<select name="tradeflag" id="shopdtl-search-tradeflag" class="layui-select">
<option value=""> 全部</option>
<option value="in">收入</option>
@@ -86,13 +82,23 @@
</select> 
</div>
</div>
+ </div>
+
+ <div class="layui-form-item" style="margin-bottom: 0;">
+ <div class="layui-inline" style="margin-right: 20px;">
+ <label class="layui-form-label">商户名称</label>
+ <div class="layui-input-block" style="width: 265px;">
+ <input type="text" name="shopname" id="shopdtl-search-shopname" placeholder="商户名称"
+ autocomplete="off" class="layui-input" maxlength="20"/>
+ </div>
+ </div>
<div class="layui-inline">
<label class="layui-form-label">交易码</label>
- <div class="layui-input-block">
+ <div class="layui-input-block" style="height: 38px;">
<select name="transcode" id="shopdtl-search-transcode" class="layui-select">
<option value=""> 全部</option>
- <option th:each="tc:${transcodelist}" th:value="${tc.transcode}"
+ <option th:each="tc:${transcodeList}" th:value="${tc.transcode}"
th:text="${tc.transname}"></option>
</select>
</div>
@@ -155,8 +161,8 @@
click: function (d) {
var treeNode = d.current;
console.log(treeNode);
- if(undefined == treeNode.accno || null == treeNode.accno){
- layer.msg("请选择结算商户", {icon: 2, time:1500});
+ if (undefined == treeNode.accno || null == treeNode.accno) {
+ layer.msg("请选择结算商户", {icon: 2, time: 1500});
$("#shopdtl-search-shopaccno").val("");
treeSelect.revokeNode('shopdtl-search-shopaccno-filter');
return false;
@@ -178,7 +184,7 @@
endTransdate: $("#shopdtl-search-endTransdate").val(),
personname: $("#shopdtl-search-personname").val(),
shopaccno: $("#shopdtl-search-shopaccno").val(),
- sourcetype: $("#shopdtl-search-sourcetype").val(),
+ sourceType: $("#shopdtl-search-sourceType").val(),
tradeflag: $("#shopdtl-search-tradeflag").val(),
transcode: $("#shopdtl-search-transcode").val(),
transStatus: $("#shopdtl-search-transStatus").val()
@@ -194,7 +200,7 @@
"endTransdate": "",
"shopname": "",
"shopaccno": "",
- "sourcetype": "",
+ "sourceType": "",
"tradeflag": "",
"transcode": "",
"transStatus": ""
@@ -216,25 +222,33 @@
{field: 'shopname', title: '商户名称', align: 'center', width: 250},
{field: 'amount', title: '交易金额', align: 'center', width: 120, sort: true},
{
- field: 'transStatus', title: '状态', align: 'center', width: 90, templet: function (item) {
- if (item.transStatus == 'init') {
+ field: 'transStatus',
+ title: '状态',
+ align: 'center',
+ width: 90,
+ templet: function (item) {
+ if (item.status === 'init') {
return '<span class="layui-badge layui-bg-gray">初始化</span>';
- } else if (item.transStatus == 'success') {
+ } else if (item.status === 'success') {
return '<span class="layui-badge layui-bg-green">成功</span>';
- } else if (item.transStatus == 'fail') {
+ } else if (item.status === 'fail') {
return '<span class="layui-badge">失败</span>';
- } else if (item.transStatus == 'wip') {
+ } else if (item.status === 'wip') {
return '<span class="layui-badge layui-bg-orange">待支付</span>';
} else {
- return item.transStatus;
+ return item.status;
}
}
},
{
- field: 'tradeflag', title: '类型', align: 'center', width: 60, templet: function (item) {
- if (item.tradeflag == 'in') {
+ field: 'tradeflag',
+ title: '类型',
+ align: 'center',
+ width: 60,
+ templet: function (item) {
+ if (item.tradeflag === 'in') {
return '<span style="color: green;">收入</span>';
- } else if (item.tradeflag == 'out') {
+ } else if (item.tradeflag === 'out') {
return '<span style="color: red;">支出</span>';
} else {
return item.tradeflag;
@@ -250,12 +264,16 @@
width: 130,
sort: true,
templet: function (item) {
- return getTempDictValue('allSourcetypeList', item.sourceType);
+ return getTempDictValue('sourcetypeList', item.sourceType);
}
},
{
- field: 'reverseFlag', title: '冲正状态', align: 'center', width: 100, templet: function (item) {
- return getTempDictValue('allReverseflagList', item.reverseFlag);
+ field: 'reverseFlag',
+ title: '冲正状态',
+ align: 'center',
+ width: 100,
+ templet: function (item) {
+ return getTempDictValue('reverseFlagList', item.reverseFlag);
}
},
{field: 'oppositeAccName', title: '交易对象', align: 'center', width: 150},
diff --git a/src/main/resources/templates/system/dtl/userdtl.html b/payapi/src/main/resources/templates/system/dtl/userdtl.html
similarity index 93%
rename from src/main/resources/templates/system/dtl/userdtl.html
rename to payapi/src/main/resources/templates/system/dtl/userdtl.html
index a2e9d96..85c7665 100644
--- a/src/main/resources/templates/system/dtl/userdtl.html
+++ b/payapi/src/main/resources/templates/system/dtl/userdtl.html
@@ -8,7 +8,7 @@
</div>
<div class="layui-card-body">
<div class="layui-form" lay-filter="userdtl-search-form">
- <div class="layui-form-item" style="margin-bottom: 0;">
+ <div class="layui-form-item" style="margin-bottom: 10px;">
<div class="layui-inline">
<label class="layui-form-label">记账日期</label>
<div class="layui-input-inline" style="width: 120px;">
@@ -26,7 +26,7 @@
<div class="layui-inline">
<label class="layui-form-label">姓名</label>
- <div class="layui-input-block">
+ <div class="layui-input-block" style="width: 211px;">
<input type="text" name="personname" id="userdtl-search-personname" placeholder="姓名"
autocomplete="off" class="layui-input" maxlength="20"/>
</div>
@@ -34,28 +34,17 @@
<div class="layui-inline">
<label class="layui-form-label">支付方式</label>
- <div class="layui-input-block">
- <select name="sourcetype" id="userdtl-search-sourcetype" class="layui-select">
+ <div class="layui-input-block" style="height: 38px;">
+ <select name="sourceType" id="userdtl-search-sourceType" class="layui-select">
<option value=""> 全部</option>
<option th:each="pt:${paytypelist}" th:value="${pt.sourceType}"
th:text="${pt.paydesc}"></option>
</select> 
</div>
</div>
-
- <div class="layui-inline">
- <label class="layui-form-label">状态</label>
- <div class="layui-input-block">
- <select name="transStatus" id="userdtl-search-transStatus" class="layui-select">
- <option value=""> 全部</option>
- <option th:each="st:${dtlStatusList}" th:value="${st.dictval}"
- th:text="${st.dictcaption}"></option>
- </select> 
- </div>
- </div>
</div>
- <div class="layui-form-item" style="margin-bottom: 0;">
+ <div class="layui-form-item" style="margin-bottom: 10px;">
<div class="layui-inline">
<label class="layui-form-label">交易日期</label>
<div class="layui-input-inline" style="width: 120px;">
@@ -72,16 +61,19 @@
</div>
<div class="layui-inline">
- <label class="layui-form-label">市民卡号</label>
- <div class="layui-input-block">
- <input type="text" name="cardno" id="userdtl-search-cardno" placeholder="市民卡号"
- autocomplete="off" class="layui-input"/>
+ <label class="layui-form-label">状态</label>
+ <div class="layui-input-block" style="height:38px;">
+ <select name="transStatus" id="userdtl-search-transStatus" class="layui-select">
+ <option value=""> 全部</option>
+ <option th:each="st:${dtlStatusList}" th:value="${st.dictval}"
+ th:text="${st.dictcaption}"></option>
+ </select> 
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">类型</label>
- <div class="layui-input-block">
+ <div class="layui-input-block" style="height: 38px;">
<select name="tradeflag" id="userdtl-search-tradeflag" class="layui-select">
<option value=""> 全部</option>
<option value="in">收入</option>
@@ -89,7 +81,16 @@
</select> 
</div>
</div>
+ </div>
+ <div class="layui-form-item" style="margin-bottom: 0;">
+ <div class="layui-inline" style="margin-right: 20px;">
+ <label class="layui-form-label">市民卡号</label>
+ <div class="layui-input-block" style="width: 265px;">
+ <input type="text" name="cardno" id="userdtl-search-cardno" placeholder="市民卡号"
+ autocomplete="off" class="layui-input"/>
+ </div>
+ </div>
<div class="layui-inline">
<label class="layui-form-label">交易码</label>
<div class="layui-input-block">
@@ -147,7 +148,7 @@
endTransdate: $("#userdtl-search-endTransdate").val(),
personname: $("#userdtl-search-personname").val(),
cardno: $("#userdtl-search-cardno").val(),
- sourcetype: $("#userdtl-search-sourcetype").val(),
+ sourceType: $("#userdtl-search-sourceType").val(),
tradeflag: $("#userdtl-search-tradeflag").val(),
transcode: $("#userdtl-search-transcode").val(),
transStatus: $("#userdtl-search-transStatus").val()
@@ -163,7 +164,7 @@
"endTransdate": "",
"personname": "",
"cardno": "",
- "sourcetype": "",
+ "sourceType": "",
"tradeflag": "",
"transcode": "",
"transStatus": ""
diff --git a/src/main/resources/templates/system/function/form.html b/payapi/src/main/resources/templates/system/function/form.html
similarity index 99%
rename from src/main/resources/templates/system/function/form.html
rename to payapi/src/main/resources/templates/system/function/form.html
index e1468be..fa8d43b 100755
--- a/src/main/resources/templates/system/function/form.html
+++ b/payapi/src/main/resources/templates/system/function/form.html
@@ -1,117 +1,117 @@
-<!-- operator表单弹窗 -->
-<form id="form" lay-filter="form" class="layui-form model-form">
- <input name="id" id="id" type="hidden"/>
- <div class="layui-form-item">
- <label class="layui-form-label">功能名称</label>
- <div class="layui-input-block">
- <input name="name" placeholder="请输入功能名称" type="text" class="layui-input" maxlength="20"
- lay-verify="required|name" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">路径</label>
- <div class="layui-input-block">
- <input name="menuUrl" placeholder="请输入路径,父节点默认为 # " type="text" class="layui-input" maxlength="60" value="#" lay-verify="required" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">节点</label>
- <div class="layui-input-block">
- <input type="radio" name="isLeaf" value="0" title="父" checked/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">序号</label>
- <div class="layui-input-block">
- <input name="orderNum" placeholder="请输入序号" type="text" class="layui-input" />
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">图标</label>
- <div class="layui-input-block">
- <input name="menuIcon" placeholder="请输入图标 例:layui-icon-xx " type="text" class="layui-input" />
- </div>
- </div>
-
- <div class="layui-form-item model-form-footer">
- <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
- <button class="layui-btn" lay-filter="form-submit" lay-submit id="submitbtn">保存</button>
- </div>
-</form>
-
-<script>
- layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
- var layer = layui.layer;
- var admin = layui.admin;
- var form = layui.form;
- var formSelects = layui.formSelects;
- form.render('radio');
- form.verify({
- "name": function (e) {
- var msg = "";
- $.ajax({
- type: "GET",
- url: '[[@{/function/checkname}]]',
- async: false,
- data: {
- name: e,
- id: $("#id").val()
- },
- success: function (result) {
- if (result.code != 200) {
- msg = result.msg;
- }
- },
- error: function (error) {
- msg = "请求服务器校验账号失败";
- }
- });
- }
- });
-
- var url = '[[@{/function/add}]]';
- // 回显user数据
- var func = admin.getTempData('t_func');
- if (func) {
- $('input[name="id"]').attr('readonly', 'readonly');
- form.val('form', func);
- }
- // 表单提交事件
- form.on('submit(form-submit)', function (data) {
- layer.load(2);
- let token = $("meta[name='_csrf_token']").attr("value");
- debugger
- $.ajax({
- type : "POST",
- dataType : "json",
- url : url,
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- 'X-CSRF-TOKEN':token,
- },
- data : JSON.stringify(data.field),
- success : function(result) {
- layer.closeAll('loading');
- if (result.code == 200) {
- layer.msg(result.msg, {icon: 1});
- admin.finishPopupCenter();
- } else if (result.code == 401) {
- layer.msg(result.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- } else {
- console.log('err:' + result.code);
- layer.msg(result.msg, {icon: 2});
- }
- },
- error : function() {
- layer.closeAll('loading');
- layer.msg("请求服务器失败!", {icon: 2});
- }
- });
- return false;
- });
- });
+<!-- operator表单弹窗 -->
+<form id="form" lay-filter="form" class="layui-form model-form">
+ <input name="id" id="id" type="hidden"/>
+ <div class="layui-form-item">
+ <label class="layui-form-label">功能名称</label>
+ <div class="layui-input-block">
+ <input name="name" placeholder="请输入功能名称" type="text" class="layui-input" maxlength="20"
+ lay-verify="required|name" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">路径</label>
+ <div class="layui-input-block">
+ <input name="menuUrl" placeholder="请输入路径,父节点默认为 # " type="text" class="layui-input" maxlength="60" value="#" lay-verify="required" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">节点</label>
+ <div class="layui-input-block">
+ <input type="radio" name="isLeaf" value="0" title="父" checked/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">序号</label>
+ <div class="layui-input-block">
+ <input name="orderNum" placeholder="请输入序号" type="text" class="layui-input" />
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">图标</label>
+ <div class="layui-input-block">
+ <input name="menuIcon" placeholder="请输入图标 例:layui-icon-xx " type="text" class="layui-input" />
+ </div>
+ </div>
+
+ <div class="layui-form-item model-form-footer">
+ <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
+ <button class="layui-btn" lay-filter="form-submit" lay-submit id="submitbtn">保存</button>
+ </div>
+</form>
+
+<script>
+ layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
+ var layer = layui.layer;
+ var admin = layui.admin;
+ var form = layui.form;
+ var formSelects = layui.formSelects;
+ form.render('radio');
+ form.verify({
+ "name": function (e) {
+ var msg = "";
+ $.ajax({
+ type: "GET",
+ url: '[[@{/function/checkname}]]',
+ async: false,
+ data: {
+ name: e,
+ id: $("#id").val()
+ },
+ success: function (result) {
+ if (result.code != 200) {
+ msg = result.msg;
+ }
+ },
+ error: function (error) {
+ msg = "请求服务器校验账号失败";
+ }
+ });
+ }
+ });
+
+ var url = '[[@{/function/add}]]';
+ // 回显user数据
+ var func = admin.getTempData('t_func');
+ if (func) {
+ $('input[name="id"]').attr('readonly', 'readonly');
+ form.val('form', func);
+ }
+ // 表单提交事件
+ form.on('submit(form-submit)', function (data) {
+ layer.load(2);
+ let token = $("meta[name='_csrf_token']").attr("value");
+ debugger
+ $.ajax({
+ type : "POST",
+ dataType : "json",
+ url : url,
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ data : JSON.stringify(data.field),
+ success : function(result) {
+ layer.closeAll('loading');
+ if (result.code == 200) {
+ layer.msg(result.msg, {icon: 1});
+ admin.finishPopupCenter();
+ } else if (result.code == 401) {
+ layer.msg(result.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ return;
+ } else {
+ console.log('err:' + result.code);
+ layer.msg(result.msg, {icon: 2});
+ }
+ },
+ error : function() {
+ layer.closeAll('loading');
+ layer.msg("请求服务器失败!", {icon: 2});
+ }
+ });
+ return false;
+ });
+ });
</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/system/function/index.html b/payapi/src/main/resources/templates/system/function/index.html
similarity index 98%
rename from src/main/resources/templates/system/function/index.html
rename to payapi/src/main/resources/templates/system/function/index.html
index 93d53ac..5cff759 100755
--- a/src/main/resources/templates/system/function/index.html
+++ b/payapi/src/main/resources/templates/system/function/index.html
@@ -1,175 +1,175 @@
-<div class="layui-card">
- <div class="layui-card-header">
- <h2 class="header-title">功能维护</h2>
- <span class="layui-breadcrumb pull-right">
- <a href="#">系统中心</a>
- <a><cite>功能维护</cite></a>
- </span>
- </div>
- <div class="layui-card-body">
- <div class="layui-form toolbar">
- 搜索:
- <input id="search-value" class="layui-input search-input" type="text" placeholder="输入功能名称"/> 
- <button id="btn-search-func" class="layui-btn icon-btn" data-type="search"><i class="layui-icon"></i>搜索
- </button>
- <button id="btn-add-func" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>添加父功能</button>
- </div>
- <table class="layui-table" id="table" lay-filter="table"></table>
- </div>
-</div>
-
-<script>
- layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
- let form = layui.form;
- let table = layui.table;
- let admin = layui.admin;
-
- form.render('select');
-
- // 渲染表格
- table.render({
- elem: '#table',
- url: '[[@{/function/list}]]',
- page: true,
- cols: [
- [
- {field: 'id', title: '功能ID', width: 80,fixed: 'left', sort: true},
- {field: 'name', title: '功能名称', sort: true},
- {
- field: 'isLeaf', title: '节点', sort: true, width: 80, align: 'center', templet: function (item) {
- if (item.isLeaf == 0) {
- return '<span class="layui-badge ">父</span>'
- } else if (item.isLeaf == 1) {
- return '<span class="layui-badge layui-bg-green">子</span>'
- } else {
- return ''
- }
- }
- },
- {field: 'menuUrl', title: '路径'},
- {field: 'orderNum', sort: true, width: 80,title: '序号'},
- {
- field: 'menuIcon', title: '图标', width: 80,align: 'center', templet: function (item) {
- return '<i class="layui-icon ' + item.menuIcon + '"></i> '
- }
- },
- {
- field: 'id', align: 'center', title: '操作', fixed: 'right', templet: function (item) {
- if (item.isLeaf == 0) {
- return ' <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a> ' +
- ' <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="addsub"><i class="layui-icon layui-icon-set-sm"></i>添加子功能</a> ' +
- ' <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>'
- } else {
- return ' <a class="layui-btn layui-btn-xs" lay-event="editsub"><i class="layui-icon layui-icon-edit"></i>编辑</a> ' +
- ' <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="addres"><i class="layui-icon layui-icon-set-sm"></i>添加资源</a> ' +
- ' <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="listres"><i class="layui-icon layui-icon-set-sm"></i>维护资源</a> ' +
- ' <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>'
- }
- }
- }
- ]
- ]
- });
- // 搜索按钮点击事件
- $('#btn-search-func').click(function () {
- let key = $('#search-value').val();
- table.reload('table', {where: {searchkey: key}, page: {curr: 1}});
- });
- $('#btn-add-func').click(function () {
- showModel();
- });
- let showModel = function (data) {
- let title = data ? '编辑父功能' : '添加父功能';
- admin.putTempData('t_func', data);
- admin.popupCenter({
- title: title,
- path: '[[@{/function/loadadd}]]',
- finish: function () {
- table.reload('table', {});
- }
- });
- };
- let showModelSub = function (data,parentid) {
- let title = data ? '编辑子功能' : '添加子功能';
- admin.putTempData('parentId', parentid);
- admin.putTempData('t_func', data);
- admin.popupCenter({
- title: title,
- path: '[[@{/function/loadsubadd}]]',
- finish: function () {
- table.reload('table', {});
- }
- });
- };
-
- let showResModel = function (functionid) {
- let title = '维护资源';
- admin.putTempData('functionid', functionid);
- admin.popupCenter({
- title: title,
- area:'70%',
- path: '[[@{/function/loadres}]]?functionid='+functionid
- });
- };
- let showAddResModelSub = function (functionid) {
- let title = '添加资源';
- admin.putTempData('functionid', functionid);
- admin.popupCenter({
- title: title,
- path: '[[@{/function/loadresadd}]]',
- finish: function () {
- table.reload('table', {});
- }
- });
- };
- // 工具条点击事件
- table.on('tool(table)', function (obj) {
- let data = obj.data;
- let layEvent = obj.event;
- console.log(data);
- if (layEvent === 'edit') {
- showModel(data);
- } else if (layEvent === 'addsub') {
- showModelSub(null,data.id);
- } else if (layEvent === 'editsub') {
- showModelSub(data,data.parentId);
- } else if (layEvent === 'del') {
- showDelete(data);
- } else if(layEvent === 'listres'){
- showResModel(data.id);
- } else if(layEvent === 'addres'){
- showAddResModelSub(data.id);
- }
- });
- let showDelete = function (data) {
- layer.confirm('确定删除吗,该功能下的子功能、资源、角色分配的该功能都将被删除?', function (i) {
- layer.close(i);
- layer.load(2);
- let token = $("meta[name='_csrf_token']").attr("value");
- admin.go('[[@{/function/delfunc}]]', {
- funcid: data.id,
- _csrf:token
- }, function (data) {
- console.log(data.code);
- layer.closeAll('loading');
- if (data.code == 200) {
- layer.msg(data.msg, {icon: 1});
- } else if (data.code == 401) {
- layer.msg(data.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- }
- else {
- layer.msg(data.msg, {icon: 2});
- }
- table.reload('table', {});
- },function(ret){
- console.log(ret);
- layer.closeAll('loading');
- layer.msg('请求失败了,请稍后再试', {icon: 2});
- });
- });
- }
- });
-</script>
+<div class="layui-card">
+ <div class="layui-card-header">
+ <h2 class="header-title">功能维护</h2>
+ <span class="layui-breadcrumb pull-right">
+ <a href="#">系统中心</a>
+ <a><cite>功能维护</cite></a>
+ </span>
+ </div>
+ <div class="layui-card-body">
+ <div class="layui-form toolbar">
+ 搜索:
+ <input id="search-value" class="layui-input search-input" type="text" placeholder="输入功能名称"/> 
+ <button id="btn-search-func" class="layui-btn icon-btn" data-type="search"><i class="layui-icon"></i>搜索
+ </button>
+ <button id="btn-add-func" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>添加父功能</button>
+ </div>
+ <table class="layui-table" id="table" lay-filter="table"></table>
+ </div>
+</div>
+
+<script>
+ layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
+ let form = layui.form;
+ let table = layui.table;
+ let admin = layui.admin;
+
+ form.render('select');
+
+ // 渲染表格
+ table.render({
+ elem: '#table',
+ url: '[[@{/function/list}]]',
+ page: true,
+ cols: [
+ [
+ {field: 'id', title: '功能ID', width: 80,fixed: 'left', sort: true},
+ {field: 'name', title: '功能名称', sort: true},
+ {
+ field: 'isLeaf', title: '节点', sort: true, width: 80, align: 'center', templet: function (item) {
+ if (item.isLeaf == 0) {
+ return '<span class="layui-badge ">父</span>'
+ } else if (item.isLeaf == 1) {
+ return '<span class="layui-badge layui-bg-green">子</span>'
+ } else {
+ return ''
+ }
+ }
+ },
+ {field: 'menuUrl', title: '路径'},
+ {field: 'orderNum', sort: true, width: 80,title: '序号'},
+ {
+ field: 'menuIcon', title: '图标', width: 80,align: 'center', templet: function (item) {
+ return '<i class="layui-icon ' + item.menuIcon + '"></i> '
+ }
+ },
+ {
+ field: 'id', align: 'center', title: '操作', fixed: 'right', width:350, templet: function (item) {
+ if (item.isLeaf == 0) {
+ return ' <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a> ' +
+ ' <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="addsub"><i class="layui-icon layui-icon-set-sm"></i>添加子功能</a> ' +
+ ' <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>'
+ } else {
+ return ' <a class="layui-btn layui-btn-xs" lay-event="editsub"><i class="layui-icon layui-icon-edit"></i>编辑</a> ' +
+ ' <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="addres"><i class="layui-icon layui-icon-set-sm"></i>添加资源</a> ' +
+ ' <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="listres"><i class="layui-icon layui-icon-set-sm"></i>维护资源</a> ' +
+ ' <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>'
+ }
+ }
+ }
+ ]
+ ]
+ });
+ // 搜索按钮点击事件
+ $('#btn-search-func').click(function () {
+ let key = $('#search-value').val();
+ table.reload('table', {where: {searchkey: key}, page: {curr: 1}});
+ });
+ $('#btn-add-func').click(function () {
+ showModel();
+ });
+ let showModel = function (data) {
+ let title = data ? '编辑父功能' : '添加父功能';
+ admin.putTempData('t_func', data);
+ admin.popupCenter({
+ title: title,
+ path: '[[@{/function/loadadd}]]',
+ finish: function () {
+ table.reload('table', {});
+ }
+ });
+ };
+ let showModelSub = function (data,parentid) {
+ let title = data ? '编辑子功能' : '添加子功能';
+ admin.putTempData('parentId', parentid);
+ admin.putTempData('t_func', data);
+ admin.popupCenter({
+ title: title,
+ path: '[[@{/function/loadsubadd}]]',
+ finish: function () {
+ table.reload('table', {});
+ }
+ });
+ };
+
+ let showResModel = function (functionid) {
+ let title = '维护资源';
+ admin.putTempData('functionid', functionid);
+ admin.popupCenter({
+ title: title,
+ area:'70%',
+ path: '[[@{/function/loadres}]]?functionid='+functionid
+ });
+ };
+ let showAddResModelSub = function (functionid) {
+ let title = '添加资源';
+ admin.putTempData('functionid', functionid);
+ admin.popupCenter({
+ title: title,
+ path: '[[@{/function/loadresadd}]]',
+ finish: function () {
+ table.reload('table', {});
+ }
+ });
+ };
+ // 工具条点击事件
+ table.on('tool(table)', function (obj) {
+ let data = obj.data;
+ let layEvent = obj.event;
+ console.log(data);
+ if (layEvent === 'edit') {
+ showModel(data);
+ } else if (layEvent === 'addsub') {
+ showModelSub(null,data.id);
+ } else if (layEvent === 'editsub') {
+ showModelSub(data,data.parentId);
+ } else if (layEvent === 'del') {
+ showDelete(data);
+ } else if(layEvent === 'listres'){
+ showResModel(data.id);
+ } else if(layEvent === 'addres'){
+ showAddResModelSub(data.id);
+ }
+ });
+ let showDelete = function (data) {
+ layer.confirm('确定删除吗,该功能下的子功能、资源、角色分配的该功能都将被删除?', function (i) {
+ layer.close(i);
+ layer.load(2);
+ let token = $("meta[name='_csrf_token']").attr("value");
+ admin.go('[[@{/function/delfunc}]]', {
+ funcid: data.id,
+ _csrf:token
+ }, function (data) {
+ console.log(data.code);
+ layer.closeAll('loading');
+ if (data.code == 200) {
+ layer.msg(data.msg, {icon: 1});
+ } else if (data.code == 401) {
+ layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ return;
+ }
+ else {
+ layer.msg(data.msg, {icon: 2});
+ }
+ table.reload('table', {});
+ },function(ret){
+ console.log(ret);
+ layer.closeAll('loading');
+ layer.msg('请求失败了,请稍后再试', {icon: 2});
+ });
+ });
+ }
+ });
+</script>
diff --git a/src/main/resources/templates/system/function/resform.html b/payapi/src/main/resources/templates/system/function/resform.html
similarity index 99%
rename from src/main/resources/templates/system/function/resform.html
rename to payapi/src/main/resources/templates/system/function/resform.html
index 4ac8b98..50cd1aa 100755
--- a/src/main/resources/templates/system/function/resform.html
+++ b/payapi/src/main/resources/templates/system/function/resform.html
@@ -1,94 +1,94 @@
-<!-- operator表单弹窗 -->
-<form id="resform" lay-filter="resform" class="layui-form model-form">
- <input name="id" id="id" type="hidden"/>
- <div class="layui-form-item">
- <label class="layui-form-label">资源名称</label>
- <div class="layui-input-block">
- <input name="name" placeholder="请输入资源名称" type="text" class="layui-input" maxlength="60"
- lay-verify="required|name" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">路径</label>
- <div class="layui-input-block">
- <input name="uri" placeholder="请输入资源路径 " type="text" class="layui-input" maxlength="100"
- lay-verify="required" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">所属功能</label>
- <div class="layui-input-block">
- <select name="functionId" id="functionId" lay-verify="required">
- <option th:each="func : ${list}" th:value="${func.id}">[[${func.name}]]</option>
- </select>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">代码</label>
- <div class="layui-input-block">
- <input name="code" placeholder="请输入代码" type="text" class="layui-input"/>
- </div>
- </div>
- <div class="layui-form-item model-form-footer">
- <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
- <button class="layui-btn" lay-filter="resform-submit" lay-submit id="submitbtn">保存</button>
- </div>
-</form>
-
-<script>
- layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
- var layer = layui.layer;
- var admin = layui.admin;
- var form = layui.form;
- form.render('select');
- form.render('radio');
- var url = '[[@{/function/addres}]]';
- // 回显user数据
- var func = admin.getTempData('t_res');
- if (func) {
- $('input[name="id"]').attr('readonly', 'readonly');
- form.val('resform', func);
- }
- let functionid = admin.getTempData("functionid");
- if (functionid) {
- form.val('resform', {"functionId": functionid});
- }
- // 表单提交事件
- form.on('submit(resform-submit)', function (data) {
- layer.load(2);
- let token = $("meta[name='_csrf_token']").attr("value");
- debugger
- $.ajax({
- type: "POST",
- dataType: "json",
- url: url,
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- 'X-CSRF-TOKEN': token,
- },
- data: JSON.stringify(data.field),
- success: function (result) {
- layer.closeAll('loading');
- if (result.code == 200) {
- layer.msg(result.msg, {icon: 1});
- admin.finishPopupCenter();
- } else if (result.code == 401) {
- layer.msg(result.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- } else {
- console.log('err:' + result.code);
- layer.msg(result.msg, {icon: 2});
- }
- },
- error: function () {
- layer.closeAll('loading');
- layer.msg("请求服务器失败!", {icon: 2});
- }
- });
- return false;
- });
- });
+<!-- operator表单弹窗 -->
+<form id="resform" lay-filter="resform" class="layui-form model-form">
+ <input name="id" id="id" type="hidden"/>
+ <div class="layui-form-item">
+ <label class="layui-form-label">资源名称</label>
+ <div class="layui-input-block">
+ <input name="name" placeholder="请输入资源名称" type="text" class="layui-input" maxlength="60"
+ lay-verify="required|name" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">路径</label>
+ <div class="layui-input-block">
+ <input name="uri" placeholder="请输入资源路径 " type="text" class="layui-input" maxlength="100"
+ lay-verify="required" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">所属功能</label>
+ <div class="layui-input-block">
+ <select name="functionId" id="functionId" lay-verify="required">
+ <option th:each="func : ${list}" th:value="${func.id}">[[${func.name}]]</option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">代码</label>
+ <div class="layui-input-block">
+ <input name="code" placeholder="请输入代码" type="text" class="layui-input"/>
+ </div>
+ </div>
+ <div class="layui-form-item model-form-footer">
+ <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
+ <button class="layui-btn" lay-filter="resform-submit" lay-submit id="submitbtn">保存</button>
+ </div>
+</form>
+
+<script>
+ layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
+ var layer = layui.layer;
+ var admin = layui.admin;
+ var form = layui.form;
+ form.render('select');
+ form.render('radio');
+ var url = '[[@{/function/addres}]]';
+ // 回显user数据
+ var func = admin.getTempData('t_res');
+ if (func) {
+ $('input[name="id"]').attr('readonly', 'readonly');
+ form.val('resform', func);
+ }
+ let functionid = admin.getTempData("functionid");
+ if (functionid) {
+ form.val('resform', {"functionId": functionid});
+ }
+ // 表单提交事件
+ form.on('submit(resform-submit)', function (data) {
+ layer.load(2);
+ let token = $("meta[name='_csrf_token']").attr("value");
+ debugger
+ $.ajax({
+ type: "POST",
+ dataType: "json",
+ url: url,
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN': token,
+ },
+ data: JSON.stringify(data.field),
+ success: function (result) {
+ layer.closeAll('loading');
+ if (result.code == 200) {
+ layer.msg(result.msg, {icon: 1});
+ admin.finishPopupCenter();
+ } else if (result.code == 401) {
+ layer.msg(result.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ return;
+ } else {
+ console.log('err:' + result.code);
+ layer.msg(result.msg, {icon: 2});
+ }
+ },
+ error: function () {
+ layer.closeAll('loading');
+ layer.msg("请求服务器失败!", {icon: 2});
+ }
+ });
+ return false;
+ });
+ });
</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/system/function/reslist.html b/payapi/src/main/resources/templates/system/function/reslist.html
similarity index 99%
rename from src/main/resources/templates/system/function/reslist.html
rename to payapi/src/main/resources/templates/system/function/reslist.html
index 63ba042..9a39b92 100755
--- a/src/main/resources/templates/system/function/reslist.html
+++ b/payapi/src/main/resources/templates/system/function/reslist.html
@@ -1,90 +1,90 @@
-<div style="padding:20px;">
- <table class="layui-table" id="restable" lay-filter="restable">
- </table>
- <input type="hidden" id="functionid" th:value="${function.id}">
- <input type="hidden" id="functionname" th:value="${function.name}">
-</div>
-<script>
- layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
- let form = layui.form;
- let admin = layui.admin;
- form.render('select');
- let table = layui.table;
- let func = admin.getTempData('functionid');
- table.render({
- elem: '#restable',
- url: '[[@{/function/reslist}]]?functionid=' + func,
- cols: [
- [
- {field: 'id', title: '资源ID', width: 80, fixed: 'left', sort: true},
- {field: 'name', title: '资源名称', sort: true},
- {
- field: 'functionId', title: '所属功能', sort: true, align: 'center', templet: function (item) {
- return $("#functionname").val();
- }
- },
- {field: 'uri', title: '路径'},
- {field: 'code', sort: true, width: 80, title: '代码'},
- {
- field: 'id', align: 'center', title: '操作', templet: function (item) {
- return '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>'
- }
- }
- ]
- ]
- });
- // 工具条点击事件
- table.on('tool(restable)', function (obj) {
- let data = obj.data;
- let layEvent = obj.event;
- console.log(data);
- if (layEvent === 'edit') {
- showAddResModelSub(data);
- } else if (layEvent === 'del') {
- showDelete(data);
- }
- });
- let showAddResModelSub = function (data) {
- let title = '编辑资源';
- admin.putTempData('functionid', $("#functionid").val());
- admin.putTempData('t_data',data);
- admin.popupCenter({
- title: title,
- path: '[[@{/function/loadresadd}]]',
- finish: function () {
- table.reload('table', {});
- }
- });
- };
- let showDelete = function (data) {
- layer.confirm('确定删除吗?', function (i) {
- layer.close(i);
- layer.load(2);
- let token = $("meta[name='_csrf_token']").attr("value");
- admin.go('[[@{/function/delres}]]', {
- resid: data.id,
- _csrf:token
- }, function (data) {
- console.log(data.code);
- layer.closeAll('loading');
- if (data.code == 200) {
- layer.msg(data.msg, {icon: 1});
- } else if (data.code == 401) {
- layer.msg(data.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- }
- else {
- layer.msg(data.msg, {icon: 2});
- }
- table.reload('restable', {});
- },function(ret){
- console.log(ret);
- layer.closeAll('loading');
- layer.msg('请求失败了,请稍后再试', {icon: 2});
- });
- });
- }
- });
-</script>
+<div style="padding:20px;">
+ <table class="layui-table" id="restable" lay-filter="restable">
+ </table>
+ <input type="hidden" id="functionid" th:value="${function.id}">
+ <input type="hidden" id="functionname" th:value="${function.name}">
+</div>
+<script>
+ layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
+ let form = layui.form;
+ let admin = layui.admin;
+ form.render('select');
+ let table = layui.table;
+ let func = admin.getTempData('functionid');
+ table.render({
+ elem: '#restable',
+ url: '[[@{/function/reslist}]]?functionid=' + func,
+ cols: [
+ [
+ {field: 'id', title: '资源ID', width: 80, fixed: 'left', sort: true},
+ {field: 'name', title: '资源名称', sort: true},
+ {
+ field: 'functionId', title: '所属功能', sort: true, align: 'center', templet: function (item) {
+ return $("#functionname").val();
+ }
+ },
+ {field: 'uri', title: '路径'},
+ {field: 'code', sort: true, width: 80, title: '代码'},
+ {
+ field: 'id', align: 'center', title: '操作', templet: function (item) {
+ return '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>'
+ }
+ }
+ ]
+ ]
+ });
+ // 工具条点击事件
+ table.on('tool(restable)', function (obj) {
+ let data = obj.data;
+ let layEvent = obj.event;
+ console.log(data);
+ if (layEvent === 'edit') {
+ showAddResModelSub(data);
+ } else if (layEvent === 'del') {
+ showDelete(data);
+ }
+ });
+ let showAddResModelSub = function (data) {
+ let title = '编辑资源';
+ admin.putTempData('functionid', $("#functionid").val());
+ admin.putTempData('t_data',data);
+ admin.popupCenter({
+ title: title,
+ path: '[[@{/function/loadresadd}]]',
+ finish: function () {
+ table.reload('table', {});
+ }
+ });
+ };
+ let showDelete = function (data) {
+ layer.confirm('确定删除吗?', function (i) {
+ layer.close(i);
+ layer.load(2);
+ let token = $("meta[name='_csrf_token']").attr("value");
+ admin.go('[[@{/function/delres}]]', {
+ resid: data.id,
+ _csrf:token
+ }, function (data) {
+ console.log(data.code);
+ layer.closeAll('loading');
+ if (data.code == 200) {
+ layer.msg(data.msg, {icon: 1});
+ } else if (data.code == 401) {
+ layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ return;
+ }
+ else {
+ layer.msg(data.msg, {icon: 2});
+ }
+ table.reload('restable', {});
+ },function(ret){
+ console.log(ret);
+ layer.closeAll('loading');
+ layer.msg('请求失败了,请稍后再试', {icon: 2});
+ });
+ });
+ }
+ });
+</script>
diff --git a/src/main/resources/templates/system/function/subform.html b/payapi/src/main/resources/templates/system/function/subform.html
similarity index 99%
rename from src/main/resources/templates/system/function/subform.html
rename to payapi/src/main/resources/templates/system/function/subform.html
index f04a15e..d207807 100755
--- a/src/main/resources/templates/system/function/subform.html
+++ b/payapi/src/main/resources/templates/system/function/subform.html
@@ -1,106 +1,106 @@
-<!-- operator表单弹窗 -->
-<form id="form" lay-filter="subform" class="layui-form model-form">
- <input name="id" id="id" type="hidden"/>
- <div class="layui-form-item">
- <label class="layui-form-label">功能名称</label>
- <div class="layui-input-block">
- <input name="name" placeholder="请输入功能名称" type="text" class="layui-input" maxlength="20"
- lay-verify="required|name" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">路径</label>
- <div class="layui-input-block">
- <input name="menuUrl" placeholder="请输入路径,父节点默认为 # " type="text" class="layui-input" maxlength="60" lay-verify="required" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">父功能</label>
- <div class="layui-input-block">
- <select name="parentId" id="parentId" lay-verify="required">
- <option th:each="func : ${list}" th:value="${func.id}">[[${func.name}]]</option>
- </select>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">节点</label>
- <div class="layui-input-block">
- <input type="radio" name="isLeaf" value="1" title="子" checked/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">序号</label>
- <div class="layui-input-block">
- <input name="orderNum" placeholder="请输入序号" type="text" class="layui-input" />
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">图标</label>
- <div class="layui-input-block">
- <input name="menuIcon" placeholder="请输入图标 例:layui-icon-xx " type="text" class="layui-input" />
- </div>
- </div>
-
- <div class="layui-form-item model-form-footer">
- <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
- <button class="layui-btn" lay-filter="subform-submit" lay-submit id="submitbtn">保存</button>
- </div>
-</form>
-
-<script>
- layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
- var layer = layui.layer;
- var admin = layui.admin;
- var form = layui.form;
- form.render('select');
- form.render('radio');
- var url = '[[@{/function/add}]]';
- // 回显user数据
- var func = admin.getTempData('t_func');
- if (func) {
- $('input[name="id"]').attr('readonly', 'readonly');
- form.val('subform', func);
- }
- let parentId = admin.getTempData("parentId");
- if(parentId){
- form.val('subform', {"parentId":parentId});
- }
- // 表单提交事件
- form.on('submit(subform-submit)', function (data) {
- layer.load(2);
- let token = $("meta[name='_csrf_token']").attr("value");
- debugger
- $.ajax({
- type : "POST",
- dataType : "json",
- url : url,
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- 'X-CSRF-TOKEN':token,
- },
- data : JSON.stringify(data.field),
- success : function(result) {
- layer.closeAll('loading');
- if (result.code == 200) {
- layer.msg(result.msg, {icon: 1});
- admin.finishPopupCenter();
- } else if (result.code == 401) {
- layer.msg(result.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- } else {
- console.log('err:' + result.code);
- layer.msg(result.msg, {icon: 2});
- }
- },
- error : function() {
- layer.closeAll('loading');
- layer.msg("请求服务器失败!", {icon: 2});
- }
- });
- return false;
- });
- });
+<!-- operator表单弹窗 -->
+<form id="form" lay-filter="subform" class="layui-form model-form">
+ <input name="id" id="id" type="hidden"/>
+ <div class="layui-form-item">
+ <label class="layui-form-label">功能名称</label>
+ <div class="layui-input-block">
+ <input name="name" placeholder="请输入功能名称" type="text" class="layui-input" maxlength="20"
+ lay-verify="required|name" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">路径</label>
+ <div class="layui-input-block">
+ <input name="menuUrl" placeholder="请输入路径,父节点默认为 # " type="text" class="layui-input" maxlength="60" lay-verify="required" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">父功能</label>
+ <div class="layui-input-block">
+ <select name="parentId" id="parentId" lay-verify="required">
+ <option th:each="func : ${list}" th:value="${func.id}">[[${func.name}]]</option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">节点</label>
+ <div class="layui-input-block">
+ <input type="radio" name="isLeaf" value="1" title="子" checked/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">序号</label>
+ <div class="layui-input-block">
+ <input name="orderNum" placeholder="请输入序号" type="text" class="layui-input" />
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">图标</label>
+ <div class="layui-input-block">
+ <input name="menuIcon" placeholder="请输入图标 例:layui-icon-xx " type="text" class="layui-input" />
+ </div>
+ </div>
+
+ <div class="layui-form-item model-form-footer">
+ <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
+ <button class="layui-btn" lay-filter="subform-submit" lay-submit id="submitbtn">保存</button>
+ </div>
+</form>
+
+<script>
+ layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
+ var layer = layui.layer;
+ var admin = layui.admin;
+ var form = layui.form;
+ form.render('select');
+ form.render('radio');
+ var url = '[[@{/function/add}]]';
+ // 回显user数据
+ var func = admin.getTempData('t_func');
+ if (func) {
+ $('input[name="id"]').attr('readonly', 'readonly');
+ form.val('subform', func);
+ }
+ let parentId = admin.getTempData("parentId");
+ if(parentId){
+ form.val('subform', {"parentId":parentId});
+ }
+ // 表单提交事件
+ form.on('submit(subform-submit)', function (data) {
+ layer.load(2);
+ let token = $("meta[name='_csrf_token']").attr("value");
+ debugger
+ $.ajax({
+ type : "POST",
+ dataType : "json",
+ url : url,
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ data : JSON.stringify(data.field),
+ success : function(result) {
+ layer.closeAll('loading');
+ if (result.code == 200) {
+ layer.msg(result.msg, {icon: 1});
+ admin.finishPopupCenter();
+ } else if (result.code == 401) {
+ layer.msg(result.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ return;
+ } else {
+ console.log('err:' + result.code);
+ layer.msg(result.msg, {icon: 2});
+ }
+ },
+ error : function() {
+ layer.closeAll('loading');
+ layer.msg("请求服务器失败!", {icon: 2});
+ }
+ });
+ return false;
+ });
+ });
</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/system/operator/index.html b/payapi/src/main/resources/templates/system/operator/index.html
similarity index 94%
rename from src/main/resources/templates/system/operator/index.html
rename to payapi/src/main/resources/templates/system/operator/index.html
index 96ba2bc..49e4ab1 100644
--- a/src/main/resources/templates/system/operator/index.html
+++ b/payapi/src/main/resources/templates/system/operator/index.html
@@ -31,10 +31,10 @@
<script type="text/html" id="oper-tpl-state">
{{# if(d.opercode == 'system') { }}
<input type="checkbox" lay-filter="oper-tpl-state" value="{{d.operid}}" lay-skin="switch" lay-text="正常|注销"
- {{d.transStatus=='normal'?'checked':''}} disabled/>
+ {{d.status=='normal'?'checked':''}} disabled/>
{{# }else{ }}
<input type="checkbox" lay-filter="oper-tpl-state" value="{{d.operid}}" lay-skin="switch" lay-text="正常|注销"
- {{d.transStatus=='normal'?'checked':''}} />
+ {{d.status=='normal'?'checked':''}} />
{{# } }}
</script>
@@ -61,8 +61,8 @@
page: true,
cols: [
[
- {type: 'numbers', fixed: 'left'},
- {field: 'opercode', title: '管理员账号', fixed: 'left', sort: true},
+ {type: 'numbers', fixed: 'left', width: 50},
+ {field: 'opercode', title: '管理员账号', fixed: 'left',width: 150, sort: true},
{field: 'opername', title: '管理员名称', sort: true},
{field: 'transStatus', title: '状态', sort: true, width: 100, templet: '#oper-tpl-state'},
{
@@ -78,8 +78,10 @@
},
{field: 'mobile', sort: true, title: '手机号'},
{field: 'email', sort: true, title: '电子邮箱'},
- {field: 'opendate', sort: true, width: 120, title: '注册日期'},
- {align: 'center', toolbar: '#oper-table-bar', title: '操作', fixed: 'right'}
+ {field: 'opendate', sort: true, width: 120, title: '注册日期', align: 'center', templet: function (d) {
+ return admin.formatDate(d.opendate);
+ }},
+ {align: 'center', toolbar: '#oper-table-bar', title: '操作',width: 160, fixed: 'right'}
]
]
});
@@ -100,7 +102,7 @@
// 显示表单弹窗
var showEditModel = function (data) {
var title = data ? '修改用户' : '添加用户';
- admin.putTempData('t_user', data);
+ admin.putTempData('tmp_user', data);
admin.popupCenter({
title: title,
path: '[[@{/operator/load4add}]]',
diff --git a/src/main/resources/templates/system/operator/logs.html b/payapi/src/main/resources/templates/system/operator/logs.html
similarity index 70%
rename from src/main/resources/templates/system/operator/logs.html
rename to payapi/src/main/resources/templates/system/operator/logs.html
index 207b4ea..3f6f6ff 100644
--- a/src/main/resources/templates/system/operator/logs.html
+++ b/payapi/src/main/resources/templates/system/operator/logs.html
@@ -9,8 +9,8 @@
<div class="layui-card-body">
<div class="layui-form toolbar">
搜索:
- <input id="search-value" class="layui-input search-input" type="text" placeholder="输入管理员账号"/> 
- <button id="btn-search" class="layui-btn icon-btn" data-type="search"><i class="layui-icon"></i>搜索
+ <input id="search-operlog-value" class="layui-input search-input" type="text" placeholder="输入管理员账号"/> 
+ <button id="btn-operlog-search" class="layui-btn icon-btn" data-type="search"><i class="layui-icon"></i>搜索
</button>
</div>
<table class="layui-table" id="logtable" lay-filter="logtable"></table>
@@ -30,11 +30,11 @@
cols: [
[
{field: 'opername', title: '管理员账号', width: 160,fixed: 'left', sort: true},
- {field: 'functionname', title: '所属功能', width: 160,fixed: 'left', sort: true},
- {field: 'resname', title: '操作内容', width: 160,fixed: 'left', sort: true},
- {field: 'respath', title: '操作路径', width: 200,},
+ {field: 'functionname', title: '所属功能', sort: true},
+ {field: 'resname', title: '操作内容', sort: true},
+ {field: 'respath', title: '操作路径'},
{
- field: 'logdate', align: 'center', title: '操作时间', fixed: 'right', templet: function (item) {
+ field: 'logdate', align: 'center', title: '操作时间', width: 200, fixed: 'right', templet: function (item) {
return admin.formatDate(item.logdate);
}
}
@@ -42,8 +42,8 @@
]
});
// 搜索按钮点击事件
- $('#btn-search').click(function () {
- let key = $('#search-value').val();
+ $('#btn-operlog-search').click(function () {
+ let key = $('#search-operlog-value').val();
table.reload('logtable', {where: {searchkey: key}, page: {curr: 1}});
});
});
diff --git a/src/main/resources/templates/system/operator/operator.html b/payapi/src/main/resources/templates/system/operator/operator.html
similarity index 94%
rename from src/main/resources/templates/system/operator/operator.html
rename to payapi/src/main/resources/templates/system/operator/operator.html
index 682e6c4..0a50551 100644
--- a/src/main/resources/templates/system/operator/operator.html
+++ b/payapi/src/main/resources/templates/system/operator/operator.html
@@ -16,9 +16,9 @@
</div>
</div>
<div class="layui-form-item">
- <label class="layui-form-label" title="用于第三方授权登录,但不能访问本系统资源">授权登录用户</label>
+ <label class="layui-form-label" title="用于第三方授权登录,但不能访问本系统资源" style="width: 90px;">授权登录用户</label>
<div class="layui-input-block">
- <input type="checkbox" name="thirdadmin" value="yes" />
+ <input type="checkbox" name="thirdadmin" lay-skin="switch" lay-text="启用|关闭" value="yes" />
</div>
</div>
<div class="layui-form-item">
@@ -65,6 +65,7 @@
var formSelects = layui.formSelects;
form.render('radio');
+ form.render('checkbox');
form.verify({
"mobile": function (e) {
if (null != e && e.length > 0 && !(/^1\d{10}$/.test(e))) {
@@ -107,7 +108,7 @@
var url = '[[@{/operator/add}]]';
// 回显user数据
- var user = admin.getTempData('t_user');
+ var user = admin.getTempData('tmp_user');
if (user) {
$('input[name="opercode"]').attr('readonly', 'readonly');
form.val('oper-form', user);
@@ -119,6 +120,7 @@
}
// 表单提交事件
form.on('submit(oper-form-submit)', function (data) {
+ debugger
layer.load(2);
var token_name = $("meta[name='_csrf_token']").attr("content");
var token = $("meta[name='_csrf_token']").attr("value");
diff --git a/src/main/resources/templates/system/operator/setpwd.html b/payapi/src/main/resources/templates/system/operator/setpwd.html
similarity index 98%
rename from src/main/resources/templates/system/operator/setpwd.html
rename to payapi/src/main/resources/templates/system/operator/setpwd.html
index 53f4fef..7b77f60 100644
--- a/src/main/resources/templates/system/operator/setpwd.html
+++ b/payapi/src/main/resources/templates/system/operator/setpwd.html
@@ -41,7 +41,7 @@
$('#cancelBtn').click(function () {
admin.closeThisTabs()
});
- form.render('select');
+
let url = '[[@{/operator/dosetpwd}]]';
// 表单提交事件
form.on('submit(setmypass)', function (data) {
diff --git a/src/main/resources/templates/system/operator/userinfor.html b/payapi/src/main/resources/templates/system/operator/userinfor.html
similarity index 99%
rename from src/main/resources/templates/system/operator/userinfor.html
rename to payapi/src/main/resources/templates/system/operator/userinfor.html
index 1193ef3..7cb1bce 100644
--- a/src/main/resources/templates/system/operator/userinfor.html
+++ b/payapi/src/main/resources/templates/system/operator/userinfor.html
@@ -55,7 +55,7 @@
$('#cancelBtn').click(function () {
admin.closeThisTabs()
});
- form.render('select');
+ form.render('radio');
let url = '[[@{/operator/updateinfor}]]';
// 表单提交事件
form.on('submit(infor-form-submit)', function (data) {
diff --git a/src/main/resources/templates/system/param/apiclientform.html b/payapi/src/main/resources/templates/system/param/apiclientform.html
similarity index 97%
rename from src/main/resources/templates/system/param/apiclientform.html
rename to payapi/src/main/resources/templates/system/param/apiclientform.html
index 94353f7..16ace93 100644
--- a/src/main/resources/templates/system/param/apiclientform.html
+++ b/payapi/src/main/resources/templates/system/param/apiclientform.html
@@ -7,7 +7,7 @@
</div>
</div>
<div class="layui-form-item">
- <label class="layui-form-label">角色</label>
+ <label class="layui-form-label">权限</label>
<div class="layui-input-block">
<select name="roles" xm-select="roles" lay-verify="required">
<option th:each="role : ${rolelist}" th:value="${role.key}">[[${role.value}]]</option>
diff --git a/src/main/resources/templates/system/param/apiclientpara.html b/payapi/src/main/resources/templates/system/param/apiclientpara.html
similarity index 95%
rename from src/main/resources/templates/system/param/apiclientpara.html
rename to payapi/src/main/resources/templates/system/param/apiclientpara.html
index d8292d7..9f18342 100644
--- a/src/main/resources/templates/system/param/apiclientpara.html
+++ b/payapi/src/main/resources/templates/system/param/apiclientpara.html
@@ -22,14 +22,14 @@
<!-- 表格操作列 -->
<script type="text/html" id="apiclient-table-bar">
- <a class="layui-btn layui-btn-xs" lay-event="editRole">修改角色</a>
+ <a class="layui-btn layui-btn-xs" lay-event="editRole">修改</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<!-- 表格状态列 -->
<script type="text/html" id="api-tpl-state">
<input type="checkbox" lay-filter="api-tpl-state" value="{{d.appid}}" lay-skin="switch" lay-text="启用|关闭"
- {{d.transStatus=='normal'?'checked':''}} />
+ {{d.status=='normal'?'checked':''}} />
</script>
<script>
@@ -47,8 +47,8 @@
[
{field: 'appid', title: 'APPID', width: 120, align: 'right', fixed: 'left', sort: true},
{field: 'secret', title: '密钥', align: 'center', edit: 'text'},
- {field: 'transStatus', title: '状态', width: 100, templet: '#api-tpl-state',sort: true},
- {field: 'roles', title: '角色', align: 'center' },
+ {field: 'status', title: '状态', width: 100, templet: '#api-tpl-state',sort: true},
+ {field: 'roles', title: '权限', align: 'center' },
{align: 'center', title: '操作', width: 150, toolbar: '#apiclient-table-bar', fixed: 'right'}
]
]
@@ -68,7 +68,7 @@
});
function showEditModel(data) {
- var title = data ? '修改角色' : '新增应用';
+ var title = data ? '修改应用' : '新增应用';
admin.putTempData('t_appclient', data);
admin.popupCenter({
title: title,
diff --git a/src/main/resources/templates/system/param/businesspara.html b/payapi/src/main/resources/templates/system/param/businesspara.html
similarity index 100%
rename from src/main/resources/templates/system/param/businesspara.html
rename to payapi/src/main/resources/templates/system/param/businesspara.html
diff --git a/src/main/resources/templates/system/param/busparaform.html b/payapi/src/main/resources/templates/system/param/busparaform.html
similarity index 100%
rename from src/main/resources/templates/system/param/busparaform.html
rename to payapi/src/main/resources/templates/system/param/busparaform.html
diff --git a/src/main/resources/templates/system/param/paytype.html b/payapi/src/main/resources/templates/system/param/sourcetype.html
similarity index 62%
rename from src/main/resources/templates/system/param/paytype.html
rename to payapi/src/main/resources/templates/system/param/sourcetype.html
index 94ce96a..74087c2 100644
--- a/src/main/resources/templates/system/param/paytype.html
+++ b/payapi/src/main/resources/templates/system/param/sourcetype.html
@@ -9,39 +9,47 @@
<div class="layui-card-body">
<div class="layui-form toolbar">
搜索:
- <input id="search-global-sourceType" class="layui-input search-input" type="text" maxlength="40" style="width: 300px;"
+ <input id="search-global-sourceType" class="layui-input search-input" type="text" maxlength="40"
+ style="width: 300px;"
placeholder="输入支付方式查询"/>
<button id="btn-search-param" class="layui-btn icon-btn" data-type="search"><i class="layui-icon"></i>搜索
</button>
- <button id="btn-add-param" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>新 增
+ <button id="btn-add-param" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>新
+ 增
</button>
- <button id="btn-reset-param" class="layui-btn layui-btn-primary" data-type="reset"><i class="layui-icon"></i>清 空
+ <button id="btn-reset-param" class="layui-btn layui-btn-primary" data-type="reset"><i
+ class="layui-icon"></i>清 空
</button>
</div>
- <table class="layui-table" id="paytypeTable" lay-filter="paytypeTable-filter"></table>
+ <table class="layui-table" id="sourcetypeTable" lay-filter="sourcetypeTable-filter"></table>
</div>
</div>
<!-- 表格状态列 -->
<script type="text/html" id="enable-tpl-state">
- <input type="checkbox" lay-filter="enable-tpl-state" value="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="enable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
{{d.enable== true?'checked':''}}/>
</script>
<script type="text/html" id="chargeenable-tpl-state">
{{# if(d.enable == true){ }}
- <input type="checkbox" lay-filter="chargeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="chargeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
{{(d.enable== true && d.chargeEnable== true)?'checked':''}}/>
{{# }else{ }}
- <input type="checkbox" lay-filter="chargeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="chargeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
{{(d.enable== true && d.chargeEnable== true)?'checked':''}} disabled/>
{{# } }}
</script>
<script type="text/html" id="consumeenable-tpl-state">
{{# if(d.enable == true){ }}
- <input type="checkbox" lay-filter="consumeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="consumeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
{{(d.enable== true && d.consumeEnable== true)?'checked':''}}/>
{{# }else{ }}
- <input type="checkbox" lay-filter="consumeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="consumeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
{{(d.enable== true && d.consumeEnable== true)?'checked':''}} disabled/>
{{# } }}
</script>
@@ -56,6 +64,28 @@
{{(d.enable==true && d.anonymousEnable==true)?'checked':''}} disabled/>
{{# } }}
</script>
+<script type="text/html" id="reversable-tpl-state">
+ {{# if(d.enable == true ){ }}
+ <input type="checkbox" lay-filter="reversable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
+ {{(d.enable==true && d.reversable==true)?'checked':''}}/>
+ {{# }else{ }}
+ <input type="checkbox" lay-filter="reversable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
+ {{(d.enable==true && d.reversable==true)?'checked':''}} disabled/>
+ {{# } }}
+</script>
+<script type="text/html" id="checkable-tpl-state">
+ {{# if(d.enable == true ){ }}
+ <input type="checkbox" lay-filter="checkable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
+ {{(d.enable==true && d.checkable==true)?'checked':''}}/>
+ {{# }else{ }}
+ <input type="checkbox" lay-filter="checkable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
+ {{(d.enable==true && d.checkable==true)?'checked':''}} disabled/>
+ {{# } }}
+</script>
<script>
layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
@@ -64,13 +94,30 @@
var admin = layui.admin;
// 渲染表格
table.render({
- elem: '#paytypeTable',
- url: '[[@{/param/paytypelist}]]',
+ elem: '#sourcetypeTable',
+ url: '[[@{/param/sourcetypelist}]]',
page: true,
cols: [
[
- {field: 'sourceType', title: '支付方式', width: 200, align: 'center', fixed: 'left', sort: true},
- {field: 'paydesc', title: '名称', align: 'center', sort: true, edit:'text'},
+ {
+ field: 'sourceType',
+ title: '支付方式',
+ width: 130,
+ align: 'center',
+ fixed: 'left',
+ sort: true
+ },
+ {field: 'paydesc', title: '名称', align: 'center', sort: true, edit: 'text'},
+ {
+ field: 'paySubjno', title: '支付科目号', templet: function (item) {
+ return getTempDictValue('allSubjectList', item.paySubjno);
+ }
+ },
+ {
+ field: 'depositeSubjno', title: '充值科目号', templet: function (item) {
+ return getTempDictValue('allSubjectList', item.depositeSubjno);
+ }
+ },
{field: 'enable', title: '状态', align: 'center', templet: '#enable-tpl-state', sort: true},
{
field: 'chargeEnable',
@@ -94,8 +141,22 @@
sort: true
},
{
+ field: 'reversable',
+ title: '能否冲正',
+ align: 'center',
+ templet: '#reversable-tpl-state',
+ sort: true
+ },
+ {
+ field: 'checkable',
+ title: '是否清算',
+ align: 'center',
+ templet: '#anonymousenable-tpl-state',
+ sort: true
+ },
+ {
align: 'center', title: '操作', width: 150, fixed: 'right', templet: function (item) {
- if (item.sourceType != 'balance') {
+ if (item.sourceType !== 'balance') {
return '<a class="layui-btn layui-btn-xs" lay-event="config">配置</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
}
return '';
@@ -107,15 +168,15 @@
// 搜索按钮点击事件
$('#btn-search-param').click(function () {
var sourceType = $("#search-global-sourceType").val();
- table.reload('paytypeTable', {where: {paytype: sourceType}, page: {curr: 1}});
+ table.reload('sourcetypeTable', {where: {sourceType: sourceType}, page: {curr: 1}});
});
$('#btn-add-param').click(function () {
admin.popupCenter({
title: "新增支付能力",
- path: '[[@{/param/load4addpaytype}]]',
+ path: '[[@{/param/load4addsourcetype}]]',
finish: function () {
- table.reload('paytypeTable');
+ table.reload('sourcetypeTable');
}
});
});
@@ -127,25 +188,24 @@
// 修改总状态
form.on('switch(enable-tpl-state)', function (obj) {
var token = $("meta[name='_csrf_token']").attr("value");
- admin.go('[[@{/param/updatepaytypestate}]]', {
- paytype: obj.elem.value,
+ admin.go('[[@{/param/updatesourcetypestate}]]', {
+ sourcetype: obj.elem.value,
state: obj.elem.checked,
_csrf: token
}, function (data) {
- if (data.code == 200) {
- layer.msg(data.msg, {icon: 1, time:1000});
- table.reload('paytypeTable');
- } else if (data.code == 401) {
+ if (data.code === 200) {
+ layer.msg(data.msg, {icon: 1, time: 1000});
+ table.reload('sourcetypeTable');
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
layer.msg(data.msg, {icon: 2});
$(obj.elem).prop('checked', !obj.elem.checked);
form.render('checkbox');
}
- },function () {
+ }, function () {
layer.msg('请求失败了,请稍后再试', {icon: 2});
$(obj.elem).prop('checked', !obj.elem.checked);
form.render('checkbox');
@@ -167,21 +227,30 @@
updatePaytypeState(obj, "anonymous", token);
});
+ form.on('switch(reversable-tpl-state)', function (obj) {
+ var token = $("meta[name='_csrf_token']").attr("value");
+ updatePaytypeState(obj, "reversable", token);
+ });
+
+ form.on('switch(checkable-tpl-state)', function (obj) {
+ var token = $("meta[name='_csrf_token']").attr("value");
+ updatePaytypeState(obj, "checkable", token);
+ });
+
function updatePaytypeState(obj, optype, token) {
- admin.go('[[@{/param/updatepaytypestate}]]', {
- paytype: obj.elem.value,
+ admin.go('[[@{/param/updatesourcetypestate}]]', {
+ sourcetype: obj.elem.value,
state: obj.elem.checked,
optype: optype,
_csrf: token
}, function (data) {
- if (data.code == 200) {
+ if (data.code === 200) {
layer.msg(data.msg, {icon: 1, time: 1000});
- } else if (data.code == 401) {
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
layer.msg(data.msg, {icon: 2});
$(obj.elem).prop('checked', !obj.elem.checked);
@@ -194,46 +263,45 @@
});
}
- table.on('edit(paytypeTable-filter)', function (obj) {
+ table.on('edit(sourcetypeTable-filter)', function (obj) {
var row = obj.data; //得到所在行所有键值
var newval = obj.value; //得到修改后的值
- admin.go('[[@{/param/updatepaytypename}]]', {
- paytype: row.sourceType,
+ admin.go('[[@{/param/updatesourcetypename}]]', {
+ sourcetype: row.sourceType,
paydesc: newval,
- _csrf: $("meta[name='_csrf_token']").attr("value"),
+ _csrf: $("meta[name='_csrf_token']").attr("value")
}, function (data) {
- if (data.code == 200) {
+ if (data.code === 200) {
layer.msg("修改成功", {icon: 1, time: 1000});
- } else if (data.code == 401) {
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
layer.msg(data.msg, {icon: 2});
- table.reload('paytypeTable');
+ table.reload('sourcetypeTable');
}
- },function () {
+ }, function () {
layer.msg('修改失败了,请稍后再试', {icon: 2});
- table.reload('paytypeTable');
+ table.reload('sourcetypeTable');
});
})
//监听单元格
- table.on('tool(paytypeTable-filter)', function (obj) {
+ table.on('tool(sourcetypeTable-filter)', function (obj) {
var data = obj.data;
- if('del' == obj.event){
+ if ('del' === obj.event) {
if (confirm("确定要删除支付方式[" + data.sourceType + "_" + data.paydesc + "]吗?")) {
layer.load(2);
- admin.go('[[@{/param/deletepaytype}]]', {
- paytype: data.sourceType,
+ admin.go('[[@{/param/deletesourcetype}]]', {
+ sourcetype: data.sourceType,
_csrf: $("meta[name='_csrf_token']").attr("value")
}, function (data) {
console.log(data.code);
layer.closeAll('loading');
- if (data.code == 200) {
+ if (data.code === 200) {
layer.msg(data.msg, {icon: 1, time: 1000});
- } else if (data.code == 401) {
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
@@ -241,20 +309,20 @@
} else {
layer.msg(data.msg, {icon: 2});
}
- table.reload('paytypeTable');
+ table.reload('sourcetypeTable');
}, function (ret) {
console.log(ret);
layer.closeAll('loading');
layer.msg('请求失败了,请稍后再试', {icon: 2});
});
}
- }else if('config' ==obj.event){
+ } else if ('config' === obj.event) {
admin.popupCenter({
title: "配置参数【" + data.sourceType + "_" + data.paydesc + "】",
- path: '[[@{/param/load4paytypeconfig}]]?paytype='+data.sourceType,
+ path: '[[@{/param/load4sourcetypeconfig}]]?sourcetype=' + data.sourceType,
area: '800px',
finish: function () {
- table.reload('paytypeTable');
+ table.reload('sourcetypeTable');
}
});
}
diff --git a/src/main/resources/templates/system/param/paytypeconfig.html b/payapi/src/main/resources/templates/system/param/sourcetypeconfig.html
similarity index 82%
rename from src/main/resources/templates/system/param/paytypeconfig.html
rename to payapi/src/main/resources/templates/system/param/sourcetypeconfig.html
index ad6c9cf..4058462 100644
--- a/src/main/resources/templates/system/param/paytypeconfig.html
+++ b/payapi/src/main/resources/templates/system/param/sourcetypeconfig.html
@@ -1,6 +1,6 @@
<form id="sourceType-config-form" lay-filter="sourceType-config-form" class="layui-form model-form">
<div class="layui-form-item" style="display: none;">
- <input type="hidden" class="layui-input" id="hid_paytype" th:value="${paytype}"/>
+ <input type="hidden" class="layui-input" id="hid_sourcetype" th:value="${sourcetype}"/>
</div>
<div class="layui-form-item" style="text-align: center;" th:if="${configlist.size()} le 0">
@@ -12,7 +12,7 @@
<label class="layui-form-label" style="float: right;width: 100%;" th:text="${config.configid}">参数名</label>
</div>
<div class="layui-input-block" style="margin:0;display: inline;float: right;width: 80%;">
- <input type="text" th:name="${config.configid}" class="layui-input" th:value="${config.configValue}" autocomplete="off"/>
+ <input type="text" th:name="${config.configid}" class="layui-input" th:value="${config.configValue}" th:placeholder="${config.configName}" autocomplete="off"/>
</div>
</div>
@@ -32,35 +32,34 @@
form.on('submit(form-submit)', function (data) {
layer.load(2);
var vdata = data.field;
- if(JSON.stringify(vdata)=="{}"){
+ if(JSON.stringify(vdata)==="{}"){
layer.closeAll('loading');
admin.closePopupCenter();
return; //无配置项,直接关闭
}
var token=$("meta[name='_csrf_token']").attr("value");
- vdata["hid_paytype"] = $("#hid_paytype").val();
- console.log('addpaytype:',vdata);
+ vdata["hid_sourcetype"] = $("#hid_sourcetype").val();
+ console.log('addsourcetype:',vdata);
debugger
$.ajax({
type : "POST",
dataType : "json",
- url : '[[@{/param/addpaytypeconfig}]]',
+ url : '[[@{/param/addsourcetypeconfig}]]',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
- 'X-CSRF-TOKEN':token,
+ 'X-CSRF-TOKEN':token
},
data : JSON.stringify(vdata),
success : function(result) {
layer.closeAll('loading');
- if (result.code == 200) {
+ if (result.code === 200) {
layer.msg(result.msg, {icon: 1});
admin.finishPopupCenter();
- } else if (result.code == 401) {
+ } else if (result.code === 401) {
layer.msg(result.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
console.log('err:' + result.code);
layer.msg(result.msg, {icon: 2});
diff --git a/payapi/src/main/resources/templates/system/param/sourcetypeform.html b/payapi/src/main/resources/templates/system/param/sourcetypeform.html
new file mode 100644
index 0000000..ca3f5df
--- /dev/null
+++ b/payapi/src/main/resources/templates/system/param/sourcetypeform.html
@@ -0,0 +1,156 @@
+<form id="sourceType-form" lay-filter="form" class="layui-form model-form">
+ <div class="layui-form-item">
+ <label class="layui-form-label">支付方式</label>
+ <div class="layui-input-block">
+ <input name="sourcetype" placeholder="请输入支付方式代码" type="text" class="layui-input" maxlength="20"
+ lay-verify="required|sourcetype" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">名称</label>
+ <div class="layui-input-block">
+ <input name="paydesc" placeholder="请输入支付方式名称" type="text" class="layui-input" maxlength="30"
+ lay-verify="required" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">支付科目号</label>
+ <div class="layui-input-block">
+ <select name="paySubjno" lay-verify="" lay-search>
+ <option value="">不支持</option>
+ <option th:each="bean : ${subjectList}" th:value="${bean.subjno}"
+ th:text="${bean.subjname} + '(' + ${bean.subjno} + ')'">
+ </option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">充值科目号</label>
+ <div class="layui-input-block">
+ <select name="depositeSubjno" lay-verify="" lay-search>
+ <option value="">不支持</option>
+ <option th:each="bean : ${subjectList}" th:value="${bean.subjno}"
+ th:text="${bean.subjname} + '(' + ${bean.subjno} + ')'">
+ </option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">状态</label>
+ <div class="layui-input-block">
+ <input name="enable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes"
+ lay-verify="required" checked/>
+ </div>
+ </div>
+
+ <div class="layui-form-item">
+ <label class="layui-form-label">能否充值</label>
+ <div class="layui-input-block">
+ <input name="chargeEnable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes"
+ lay-verify="required" checked/>
+ </div>
+ </div>
+
+ <div class="layui-form-item">
+ <label class="layui-form-label">能否消费</label>
+ <div class="layui-input-block">
+ <input name="consumeEnable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes"
+ lay-verify="required" checked/>
+ </div>
+ </div>
+
+ <div class="layui-form-item">
+ <label class="layui-form-label">匿名消费</label>
+ <div class="layui-input-block">
+ <input name="anonymousEnable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes"
+ lay-verify="required" checked/>
+ </div>
+ </div>
+
+ <div class="layui-form-item">
+ <label class="layui-form-label">能否冲正</label>
+ <div class="layui-input-block">
+ <input name="reversable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes"
+ lay-verify="required" checked/>
+ </div>
+ </div>
+
+ <div class="layui-form-item">
+ <label class="layui-form-label">是否清算</label>
+ <div class="layui-input-block">
+ <input name="checkable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes"
+ lay-verify="required" checked/>
+ </div>
+ </div>
+
+ <div class="layui-form-item model-form-footer">
+ <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
+ <button class="layui-btn" lay-filter="form-submit" lay-submit id="submitbtn">保存</button>
+ </div>
+</form>
+
+
+<script>
+ layui.use(['layer', 'admin', 'form'], function () {
+ var layer = layui.layer;
+ var admin = layui.admin;
+ var form = layui.form;
+ form.render('checkbox');
+ form.render('select');
+ form.verify({
+ "sourceType": function (e) {
+ var msg = "";
+ $.ajax({
+ type: "GET",
+ url: '[[@{/param/checksourcetype}]]',
+ async: false,
+ data: {
+ sourceType: e
+ },
+ success: function (result) {
+ if (result.code !== 200) {
+ msg = result.msg;
+ }
+ },
+ error: function (error) {
+ msg = "请求服务器校验支付方式失败";
+ }
+ });
+ if (msg !== "") {
+ return msg;
+ }
+ }
+ });
+
+ // 表单提交事件
+ form.on('submit(form-submit)', function (data) {
+ layer.load(2);
+ var vdata = data.field;
+ vdata["_csrf"] = $("meta[name='_csrf_token']").attr("value");
+ $.ajax({
+ type: "POST",
+ dataType: "json",
+ url: '[[@{/param/addsourcetype}]]',
+ data: vdata,
+ success: function (result) {
+ layer.closeAll('loading');
+ if (result.code === 200) {
+ layer.msg(result.msg, {icon: 1});
+ admin.finishPopupCenter();
+ } else if (result.code === 401) {
+ layer.msg(result.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ } else {
+ console.log('err:' + result.code);
+ layer.msg(result.msg, {icon: 2});
+ }
+ },
+ error: function (err) {
+ admin.errorBack(err);
+ }
+ });
+ return false;
+ });
+ });
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/system/param/syspara.html b/payapi/src/main/resources/templates/system/param/syspara.html
similarity index 100%
rename from src/main/resources/templates/system/param/syspara.html
rename to payapi/src/main/resources/templates/system/param/syspara.html
diff --git a/src/main/resources/templates/system/report/shopbusiness.html b/payapi/src/main/resources/templates/system/report/shopbusiness.html
similarity index 97%
rename from src/main/resources/templates/system/report/shopbusiness.html
rename to payapi/src/main/resources/templates/system/report/shopbusiness.html
index c1c042e..9638612 100644
--- a/src/main/resources/templates/system/report/shopbusiness.html
+++ b/payapi/src/main/resources/templates/system/report/shopbusiness.html
@@ -71,11 +71,13 @@
form.render("checkbox");
laydate.render({
elem: '#shopbusiness-search-startdate',
- max: $("#shopbusiness-hidden-maxdate").val()
+ max: $("#shopbusiness-hidden-maxdate").val(),
+ trigger: 'click'
});
laydate.render({
elem: '#shopbusiness-search-enddate',
- max: $("#shopbusiness-hidden-maxdate").val()
+ max: $("#shopbusiness-hidden-maxdate").val(),
+ trigger: 'click'
});
treeSelect.render({
diff --git a/src/main/resources/templates/system/report/subjectday.html b/payapi/src/main/resources/templates/system/report/subjectday.html
similarity index 96%
rename from src/main/resources/templates/system/report/subjectday.html
rename to payapi/src/main/resources/templates/system/report/subjectday.html
index 41cdf17..11453f8 100644
--- a/src/main/resources/templates/system/report/subjectday.html
+++ b/payapi/src/main/resources/templates/system/report/subjectday.html
@@ -64,11 +64,13 @@
form.render("checkbox");
laydate.render({
elem: '#subjectday-search-startdate',
- max: $("#subjectday-hidden-maxdate").val()
+ max: $("#subjectday-hidden-maxdate").val(),
+ trigger: 'click'
});
laydate.render({
elem: '#subjectday-search-enddate',
- max: $("#subjectday-hidden-maxdate").val()
+ max: $("#subjectday-hidden-maxdate").val(),
+ trigger: 'click'
});
var renderTable = function (obj) {
@@ -115,7 +117,7 @@
],
// cols: [
// [
- // {field: 'subjno', title: '科目号', align: 'left'},
+ // {field: 'subjid', title: '科目号', align: 'left'},
// {
// field: 'subjname', title: '科目名称', align: 'left', templet: function (d) {
// if (d.subjlevel == 1) {
diff --git a/src/main/resources/templates/system/report/subjectdetail.html b/payapi/src/main/resources/templates/system/report/subjectdetail.html
similarity index 90%
rename from src/main/resources/templates/system/report/subjectdetail.html
rename to payapi/src/main/resources/templates/system/report/subjectdetail.html
index 7776301..f1b65e9 100644
--- a/src/main/resources/templates/system/report/subjectdetail.html
+++ b/payapi/src/main/resources/templates/system/report/subjectdetail.html
@@ -26,7 +26,7 @@
<div class="layui-inline">
<label class="layui-form-label">选择科目</label>
<div class="layui-input-block">
- <input type="text" name="subjno" id="subjectdetail-search-subjno" placeholder="选择科目" lay-filter="subjectdetail-search-subjno-filter"
+ <input type="text" name="subjid" id="subjectdetail-search-subjid" placeholder="选择科目" lay-filter="subjectdetail-search-subjid-filter"
autocomplete="off" class="layui-input"/>
</div>
</div>
@@ -62,15 +62,17 @@
form.render("select");
laydate.render({
elem: '#subjectdetail-search-startdate',
- max: $("#subjectdetail-hidden-maxdate").val()
+ max: $("#subjectdetail-hidden-maxdate").val(),
+ trigger: 'click'
});
laydate.render({
elem: '#subjectdetail-search-enddate',
- max: $("#subjectdetail-hidden-maxdate").val()
+ max: $("#subjectdetail-hidden-maxdate").val(),
+ trigger: 'click'
});
treeSelect.render({
- elem: '#subjectdetail-search-subjno',
+ elem: '#subjectdetail-search-subjid',
data: '[[@{/report/subjectselecttree}]]',
type: 'get',
placeholder: '选择科目',
@@ -89,8 +91,8 @@
console.log(treeNode);
if(treeNode.accno == '0'){
layer.msg("请选择末级科目", {icon: 2, time:1500});
- $("#subjectdetail-search-subjno").val("");
- treeSelect.revokeNode('subjectdetail-search-subjno-filter');
+ $("#subjectdetail-search-subjid").val("");
+ treeSelect.revokeNode('subjectdetail-search-subjid-filter');
return false;
}
return true;
@@ -139,14 +141,14 @@
renderTable({
startdate: $('#subjectdetail-search-startdate').val(),
enddate: $('#subjectdetail-search-enddate').val(),
- subjno: null
+ subjid: null
})
$('#subjectdetail-search-btn').click(function () {
var startdate = $("#subjectdetail-search-startdate").val();
var enddate = $("#subjectdetail-search-enddate").val();
- var subjno = $("#subjectdetail-search-subjno").val();
+ var subjid = $("#subjectdetail-search-subjid").val();
if (null == startdate || "" == $.trim(startdate)) {
layer.msg('请选择起始日期', {icon: 2, time: 1500});
return;
@@ -155,7 +157,7 @@
layer.msg('请选择截止日期', {icon: 2, time: 1500});
return;
}
- if (null == subjno || "" == $.trim(subjno)) {
+ if (null == subjid || "" == $.trim(subjid)) {
layer.msg('请选择科目', {icon: 2, time: 1500});
return;
}
@@ -163,7 +165,7 @@
renderTable({
startdate: startdate,
enddate: enddate,
- subjno: subjno
+ subjid: subjid
})
});
diff --git a/src/main/resources/templates/system/role/form.html b/payapi/src/main/resources/templates/system/role/form.html
similarity index 99%
rename from src/main/resources/templates/system/role/form.html
rename to payapi/src/main/resources/templates/system/role/form.html
index d60bac8..607c1f3 100755
--- a/src/main/resources/templates/system/role/form.html
+++ b/payapi/src/main/resources/templates/system/role/form.html
@@ -1,73 +1,73 @@
-<!-- operator表单弹窗 -->
-<form id="form" lay-filter="form" class="layui-form model-form">
- <input name="roleId" id="roleId" type="hidden"/>
- <div class="layui-form-item">
- <label class="layui-form-label">角色名称</label>
- <div class="layui-input-block">
- <input name="roleName" placeholder="请输入角色名称" type="text" class="layui-input" maxlength="20"
- lay-verify="required|roleName" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">角色描述</label>
- <div class="layui-input-block">
- <textarea name="roleDesc" placeholder="请输入描述" class="layui-textarea"></textarea>
- </div>
- </div>
-
- <div class="layui-form-item model-form-footer">
- <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
- <button class="layui-btn" lay-filter="form-submit" lay-submit id="submitbtn">保存</button>
- </div>
-</form>
-
-<script>
- layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
- var layer = layui.layer;
- var admin = layui.admin;
- var form = layui.form;
- var url = '[[@{/role/add}]]';
- // 回显user数据
- var func = admin.getTempData('t_func');
- if (func) {
- $('input[name="roleId"]').attr('readonly', 'readonly');
- form.val('form', func);
- }
- // 表单提交事件
- form.on('submit(form-submit)', function (data) {
- layer.load(2);
- let token = $("meta[name='_csrf_token']").attr("value");
- $.ajax({
- type : "POST",
- dataType : "json",
- url : url,
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- 'X-CSRF-TOKEN':token,
- },
- data : JSON.stringify(data.field),
- success : function(result) {
- layer.closeAll('loading');
- if (result.code == 200) {
- layer.msg(result.msg, {icon: 1});
- admin.finishPopupCenter();
- } else if (result.code == 401) {
- layer.msg(result.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- } else {
- console.log('err:' + result.code);
- layer.msg(result.msg, {icon: 2});
- }
- },
- error : function() {
- layer.closeAll('loading');
- layer.msg("请求服务器失败!", {icon: 2});
- }
- });
- return false;
- });
- });
+<!-- operator表单弹窗 -->
+<form id="form" lay-filter="form" class="layui-form model-form">
+ <input name="roleId" id="roleId" type="hidden"/>
+ <div class="layui-form-item">
+ <label class="layui-form-label">角色名称</label>
+ <div class="layui-input-block">
+ <input name="roleName" placeholder="请输入角色名称" type="text" class="layui-input" maxlength="20"
+ lay-verify="required|roleName" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">角色描述</label>
+ <div class="layui-input-block">
+ <textarea name="roleDesc" placeholder="请输入描述" class="layui-textarea"></textarea>
+ </div>
+ </div>
+
+ <div class="layui-form-item model-form-footer">
+ <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
+ <button class="layui-btn" lay-filter="form-submit" lay-submit id="submitbtn">保存</button>
+ </div>
+</form>
+
+<script>
+ layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
+ var layer = layui.layer;
+ var admin = layui.admin;
+ var form = layui.form;
+ var url = '[[@{/role/add}]]';
+ // 回显user数据
+ var func = admin.getTempData('t_func');
+ if (func) {
+ $('input[name="roleId"]').attr('readonly', 'readonly');
+ form.val('form', func);
+ }
+ // 表单提交事件
+ form.on('submit(form-submit)', function (data) {
+ layer.load(2);
+ let token = $("meta[name='_csrf_token']").attr("value");
+ $.ajax({
+ type : "POST",
+ dataType : "json",
+ url : url,
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ data : JSON.stringify(data.field),
+ success : function(result) {
+ layer.closeAll('loading');
+ if (result.code == 200) {
+ layer.msg(result.msg, {icon: 1});
+ admin.finishPopupCenter();
+ } else if (result.code == 401) {
+ layer.msg(result.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ return;
+ } else {
+ console.log('err:' + result.code);
+ layer.msg(result.msg, {icon: 2});
+ }
+ },
+ error : function() {
+ layer.closeAll('loading');
+ layer.msg("请求服务器失败!", {icon: 2});
+ }
+ });
+ return false;
+ });
+ });
</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/system/role/func.html b/payapi/src/main/resources/templates/system/role/func.html
similarity index 99%
rename from src/main/resources/templates/system/role/func.html
rename to payapi/src/main/resources/templates/system/role/func.html
index aeca844..917c8d9 100755
--- a/src/main/resources/templates/system/role/func.html
+++ b/payapi/src/main/resources/templates/system/role/func.html
@@ -1,88 +1,89 @@
-<div style="padding: 0 20px">
- <div class="layui-form-item" style="max-height: 490px;overflow: auto;">
- <ul id="funclist" class="ztree"></ul>
- </div>
- <div class="layui-form-item model-form-footer">
- <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
- <button class="layui-btn" lay-filter="form-submit" id="submitbtn">保存</button>
- </div>
-</div>
-<script>
- layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
- var layer = layui.layer;
- var admin = layui.admin;
- var form = layui.form;
- var func = admin.getTempData('roleId');
- let initTree = function (nodes) {
- let menuSetting = {
- view: {
- dblClickExpand: true,
- showLine: true,
- showIcon: false
- },
- check: {
- enable: true,
- },
- data: {
- simpleData: {
- enable: true
- }
- }
- };
- $.fn.zTree.init($("#funclist"), menuSetting, nodes);
- }
- admin.dgo('[[@{/role/func}]]', {
- roleId: func,
- }, function (data) {
- layer.closeAll('loading');
- if (data.code == 200) {
- initTree(data.node);
- } else if (data.code == 401) {
- layer.msg(data.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- } else {
- layer.msg(data.msg, {icon: 2});
- }
- }, function (ret) {
- layer.closeAll('loading');
- layer.msg('请求失败了,请稍后再试', {icon: 2});
- });
- $("#submitbtn").on('click', function (e) {
- let ids = [];
- let treeObj = $.fn.zTree.getZTreeObj("funclist");
- let nodes = treeObj.getCheckedNodes(true);
- for (let i = 0; i < nodes.length; i++) {
- ids.push(nodes[i].id);//存功能ID
- }
- if (ids.length < 1) {
- return;
- }
- let idStr = ids.toString();
- let token = $("meta[name='_csrf_token']").attr("value");
- admin.go('[[@{/role/addfunc}]]', {
- roleId: func,
- funcs: idStr,
- _csrf: token,
- }, function (data) {
- layer.closeAll('loading');
- if (data.code == 200) {
- layer.msg(data.msg, {icon: 1});
- admin.finishPopupCenter();
- } else if (data.code == 401) {
- layer.msg(data.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- } else {
- layer.msg(data.msg, {icon: 2});
- }
- }, function (ret) {
- console.log(ret);
- layer.closeAll('loading');
- layer.msg('请求失败了,请稍后再试', {icon: 2});
- });
- })
- });
+<div style="padding: 0 20px">
+ <div class="layui-form-item" style="max-height: 490px;overflow: auto;">
+ <ul id="funclist" class="ztree"></ul>
+ </div>
+ <div class="layui-form-item model-form-footer">
+ <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
+ <button class="layui-btn" lay-filter="form-submit" id="submitbtn">保存</button>
+ </div>
+</div>
+<script>
+ layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
+ var layer = layui.layer;
+ var admin = layui.admin;
+ var form = layui.form;
+ var func = admin.getTempData('roleId');
+ let initTree = function (nodes) {
+ let menuSetting = {
+ view: {
+ dblClickExpand: true,
+ showLine: true,
+ showIcon: false
+ },
+ check: {
+ enable: true,
+ },
+ data: {
+ simpleData: {
+ enable: true
+ }
+ }
+ };
+ $.fn.zTree.init($("#funclist"), menuSetting, nodes);
+ }
+ admin.dgo('[[@{/role/func}]]', {
+ roleId: func,
+ }, function (data) {
+ layer.closeAll('loading');
+ if (data.code == 200) {
+ initTree(data.node);
+ } else if (data.code == 401) {
+ layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ return;
+ } else {
+ layer.msg(data.msg, {icon: 2});
+ }
+ }, function (ret) {
+ layer.closeAll('loading');
+ layer.msg('请求失败了,请稍后再试', {icon: 2});
+ });
+ $("#submitbtn").on('click', function (e) {
+ let ids = [];
+ let treeObj = $.fn.zTree.getZTreeObj("funclist");
+ let nodes = treeObj.getCheckedNodes(true);
+ for (let i = 0; i < nodes.length; i++) {
+
+ ids.push(nodes[i].id);//存功能ID
+ }
+ if (ids.length < 1) {
+ return;
+ }
+ let idStr = ids.toString();
+ let token = $("meta[name='_csrf_token']").attr("value");
+ admin.go('[[@{/role/addfunc}]]', {
+ roleId: func,
+ funcs: idStr,
+ _csrf: token,
+ }, function (data) {
+ layer.closeAll('loading');
+ if (data.code == 200) {
+ layer.msg(data.msg, {icon: 1});
+ admin.finishPopupCenter();
+ } else if (data.code == 401) {
+ layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ return;
+ } else {
+ layer.msg(data.msg, {icon: 2});
+ }
+ }, function (ret) {
+ console.log(ret);
+ layer.closeAll('loading');
+ layer.msg('请求失败了,请稍后再试', {icon: 2});
+ });
+ })
+ });
</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/system/role/index.html b/payapi/src/main/resources/templates/system/role/index.html
similarity index 96%
rename from src/main/resources/templates/system/role/index.html
rename to payapi/src/main/resources/templates/system/role/index.html
index f92912f..535ecf3 100644
--- a/src/main/resources/templates/system/role/index.html
+++ b/payapi/src/main/resources/templates/system/role/index.html
@@ -31,11 +31,11 @@
page: true,
cols: [
[
- {field: 'roleName', title: '角色名称', width: 160,fixed: 'left', sort: true},
- {field: 'roleCode', title: '角色代码', width: 160,fixed: 'left', sort: true},
+ {field: 'roleName', title: '角色名称', width: 200,fixed: 'left', sort: true},
+ {field: 'roleCode', title: '角色代码', width: 200,fixed: 'left', sort: true},
{field: 'roleDesc', title: '描述'},
{
- field: 'roleId', align: 'center', title: '操作', fixed: 'right', templet: function (item) {
+ field: 'roleId', align: 'center', title: '操作', width: 300, fixed: 'right', templet: function (item) {
let html = ' <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a> ' +
' <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="addfunc"><i class="layui-icon layui-icon-set-sm"></i>分配功能</a> ';
if(item.editflag===1){
diff --git a/src/main/resources/templates/system/shop/config.html b/payapi/src/main/resources/templates/system/shop/config.html
similarity index 72%
rename from src/main/resources/templates/system/shop/config.html
rename to payapi/src/main/resources/templates/system/shop/config.html
index 38f6b8a..028a976 100644
--- a/src/main/resources/templates/system/shop/config.html
+++ b/payapi/src/main/resources/templates/system/shop/config.html
@@ -13,9 +13,9 @@
<div class="layui-card-header">
商户树<span style="font-size: 12px;">(双击结算商户查询)</span>
</div>
- <div class="layui-card-body layui-show"
- style="background-color: #D7F9F7;max-height: 560px;overflow:auto;">
- <ul id="shopacctree" class="ztree"></ul>
+ <div class="layui-card-body layui-show">
+ <ul id="shopacctree" class="ztree"
+ style="background-color: #D7F9F7;max-height: 560px;overflow:auto;"></ul>
</div>
</div>
</div>
@@ -29,16 +29,20 @@
<option th:each="pt:${paytypelist}" th:value="${pt.sourceType}"
th:text="${pt.paydesc}"></option>
</select> 
- <button id="btn-search-shoppaytype" class="layui-btn icon-btn" data-type="search"><i class="layui-icon"></i>搜索
+ <button id="btn-search-shopsourcetype" class="layui-btn icon-btn"
+ data-type="search"><i class="layui-icon"></i>搜索
</button>
- <button id="btn-add-shoppaytype" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>新
+ <button id="btn-add-shopsourcetype" class="layui-btn icon-btn" data-type="add"><i
+ class="layui-icon"></i>新
增
</button>
- <button id="btn-reset-shoppaytype" class="layui-btn layui-btn-primary" data-type="reset"><i
+ <button id="btn-reset-shopsourcetype" class="layui-btn layui-btn-primary"
+ data-type="reset"><i
class="layui-icon"></i>清 空
</button>
</div>
- <table class="layui-table" id="shopPaytypeTable" lay-filter="shopPaytypeTable-filter"></table>
+ <table class="layui-table" id="shopPaytypeTable"
+ lay-filter="shopPaytypeTable-filter"></table>
</div>
</div>
</div>
@@ -48,22 +52,26 @@
<!-- 表格状态列 -->
<script type="text/html" id="shop-consumeenable-tpl-state">
- <input type="checkbox" lay-filter="shop-consumeenable-tpl-state" value="{{d.shopaccno}}" def-sourceType="{{d.paytype}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="shop-consumeenable-tpl-state" value="{{d.shopaccno}}"
+ def-sourceType="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
{{d.consumeEnable==true?'checked':''}}/>
</script>
<script type="text/html" id="shop-anonymousenable-tpl-state">
{{# if(d.consumeEnable == true ){ }}
- <input type="checkbox" lay-filter="shop-anonymousenable-tpl-state" value="{{d.shopaccno}}" def-sourceType="{{d.paytype}}" lay-skin="switch"
+ <input type="checkbox" lay-filter="shop-anonymousenable-tpl-state" value="{{d.shopaccno}}"
+ def-sourceType="{{d.sourceType}}" lay-skin="switch"
lay-text="启用|关闭"
{{(d.consumeEnable==true && d.anonymousEnable==true)?'checked':''}}/>
{{# }else{ }}
- <input type="checkbox" lay-filter="shop-anonymousenable-tpl-state" value="{{d.shopaccno}}" def-sourceType="{{d.paytype}}" lay-skin="switch"
+ <input type="checkbox" lay-filter="shop-anonymousenable-tpl-state" value="{{d.shopaccno}}"
+ def-sourceType="{{d.sourceType}}" lay-skin="switch"
lay-text="启用|关闭"
{{(d.consumeEnable==true && d.anonymousEnable==true)?'checked':''}} disabled/>
{{# } }}
</script>
<script type="text/html" id="shop-reverseenable-tpl-state">
- <input type="checkbox" lay-filter="shop-reverseenable-tpl-state" value="{{d.shopaccno}}" def-sourceType="{{d.paytype}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="shop-reverseenable-tpl-state" value="{{d.shopaccno}}"
+ def-sourceType="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
{{d.reverseEnable==true?'checked':''}}/>
</script>
@@ -93,13 +101,12 @@
$.fn.zTree.init($("#shopacctree"), menuSetting, nodes);
}
admin.dgo('[[@{/shop/shopacctree}]]', {}, function (data) {
- if (data.code == 200) {
+ if (data.code === 200) {
initTree(data.data);
- } else if (data.code == 401) {
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
layer.msg(data.msg, {icon: 2, time: 2000});
}
@@ -108,34 +115,44 @@
layer.msg('查询商户树失败了,请稍后再试', {icon: 2});
});
- $('#btn-reset-shoppaytype').click(function () {
+ $('#btn-reset-shopsourcetype').click(function () {
$("#search-sourceType").val("");
form.render('select');
});
- $('#btn-search-shoppaytype').click(function(){
+ $('#btn-search-shopsourcetype').click(function () {
var ptype = $("#search-sourceType").val();
- table.reload('shopPaytypeTable', {where: {paytype: ptype, shopaccno:""}, page: {curr: 1}});
+ table.reload('shopPaytypeTable', {where: {sourcetype: ptype, shopaccno: ""}, page: {curr: 1}});
});
function ondblclick(event, treeId, treeNode) {
- if (treeNode.shoptype != 1 || ""==treeNode.shopaccno) {
+ if (treeNode.shoptype !== 'normal' || "" === treeNode.shopaccno) {
layer.msg("请选择结算商户查询", {icon: 2, time: 1000});
return;
}
var ptype = $("#search-sourceType").val();
- table.reload('shopPaytypeTable', {where: {paytype: ptype, shopaccno: treeNode.shopaccno}, page: {curr: 1}});
+ table.reload('shopPaytypeTable', {
+ where: {sourcetype: ptype, shopaccno: treeNode.shopaccno},
+ page: {curr: 1}
+ });
}
// 渲染表格
table.render({
elem: '#shopPaytypeTable',
- url: '[[@{/shop/shoppaytypelist}]]',
+ url: '[[@{/shop/shopsourcetypelist}]]',
page: true,
width: 1010,
cols: [
[
- {field: 'shopaccno', title: '商户账号', width: 150, align: 'center', fixed: 'left', sort: true},
- {field: 'shopname', title: '商户名称', align: 'center', fixed: 'left', sort: true},
+ {
+ field: 'shopaccno',
+ title: '商户账号',
+ width: 150,
+ align: 'center',
+ fixed: 'left',
+ sort: true
+ },
+ {field: 'shopname', title: '商户名称', align: 'center', fixed: 'left', sort: true},
{field: 'paydesc', title: '支付方式', align: 'center', sort: true},
{
field: 'consumeEnable',
@@ -161,8 +178,9 @@
templet: '#shop-reverseenable-tpl-state',
sort: true
},
- {align: 'center', title: '操作', width: 90, fixed: 'right', templet: function (item) {
- if (item.paytype != 'balance') {
+ {
+ align: 'center', title: '操作', width: 90, fixed: 'right', templet: function (item) {
+ if (item.sourceType !== 'balance') {
return '<a class="layui-btn layui-btn-xs" lay-event="config">配置</a>';
}
return '<span style="font-size: 12px;color: #D3D4D3;">无配置</span>';
@@ -175,27 +193,26 @@
// 修改总状态
form.on('switch(shop-consumeenable-tpl-state)', function (obj) {
var token = $("meta[name='_csrf_token']").attr("value");
- admin.go('[[@{/shop/updatepaytypestat}]]', {
+ admin.go('[[@{/shop/updatesourcetypestat}]]', {
shopaccno: obj.elem.value,
- paytype: $(obj.elem).attr("def-sourceType"),
+ sourceType: $(obj.elem).attr("def-sourceType"),
optype: "consume",
state: obj.elem.checked ? 'yes' : 'no',
_csrf: token
}, function (data) {
- if (data.code == 200) {
- layer.msg(data.msg, {icon: 1, time:1000});
+ if (data.code === 200) {
+ layer.msg(data.msg, {icon: 1, time: 1000});
table.reload('shopPaytypeTable');
- } else if (data.code == 401) {
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
layer.msg(data.msg, {icon: 2});
$(obj.elem).prop('checked', !obj.elem.checked);
form.render('checkbox');
}
- },function () {
+ }, function () {
layer.msg('请求失败了,请稍后再试', {icon: 2});
$(obj.elem).prop('checked', !obj.elem.checked);
form.render('checkbox');
@@ -213,20 +230,19 @@
});
function updateShopPaytypeState(obj, optype, token) {
- admin.go('[[@{/shop/updatepaytypestat}]]', {
+ admin.go('[[@{/shop/updatesourcetypestat}]]', {
shopaccno: obj.elem.value,
- paytype: $(obj.elem).attr("def-sourceType"),
+ sourceType: $(obj.elem).attr("def-sourceType"),
state: obj.elem.checked ? 'yes' : 'no',
optype: optype,
_csrf: token
}, function (data) {
- if (data.code == 200) {
+ if (data.code === 200) {
layer.msg(data.msg, {icon: 1, time: 1000});
- } else if (data.code == 401) {
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
layer.msg(data.msg, {icon: 2});
$(obj.elem).prop('checked', !obj.elem.checked);
@@ -239,28 +255,28 @@
});
}
- $('#btn-add-shoppaytype').click(function () {
+ $('#btn-add-shopsourcetype').click(function () {
var ztree = $.fn.zTree.getZTreeObj("shopacctree");
var shopNodes = ztree.getSelectedNodes();
- if (undefined == shopNodes || null == shopNodes || shopNodes.length < 1) {
+ if (undefined === shopNodes || null == shopNodes || shopNodes.length < 1) {
layer.msg("请先选中左侧的一个结算商户", {icon: 2, time: 1000});
return;
}
var shopNode = shopNodes[0]; //选中商户
- if(shopNode.shoptype!=1 || ""==shopNode.shopaccno){
+ if (shopNode.shoptype !== 'normal' || "" === shopNode.shopaccno) {
layer.msg("请选择结算商户!", {icon: 2, time: 1000});
return;
}
- admin.putTempData('t_addshoppaytype', {
- shopaccno:shopNode.shopaccno,
- shopname: shopNode.name.slice(shopNode.id.length+1) //23_第一食堂,截取商户名称
+ admin.putTempData('t_addshopsourcetype', {
+ shopaccno: shopNode.shopaccno,
+ shopname: shopNode.name.slice(shopNode.id.length + 1) //23_第一食堂,截取商户名称
});
admin.popupCenter({
title: "新增支付能力",
- path: '[[@{/shop/load4addpaytype}]]',
+ path: '[[@{/shop/load4addsourcetype}]]',
finish: function () {
table.reload('shopPaytypeTable', {
- where: {paytype: "", shopaccno: shopNode.shopaccno},
+ where: {sourcetype: "", shopaccno: shopNode.shopaccno},
page: {curr: 1}
});
}
@@ -270,10 +286,10 @@
//监听单元格
table.on('tool(shopPaytypeTable-filter)', function (obj) {
var data = obj.data;
- if ('config' == obj.event) {
+ if ('config' === obj.event) {
admin.popupCenter({
title: "配置参数【" + data.shopname + "_" + data.paydesc + "】",
- path: '[[@{/shop/load4paytypepara}]]?shopaccno=' + data.shopaccno + '&paytype=' + data.paytype,
+ path: '[[@{/shop/load4sourcetypepara}]]?shopaccno=' + data.shopaccno + '&sourceType=' + data.sourceType,
area: '800px',
finish: function () {
table.reload('shopPaytypeTable');
diff --git a/src/main/resources/templates/system/shop/configform.html b/payapi/src/main/resources/templates/system/shop/configform.html
similarity index 92%
rename from src/main/resources/templates/system/shop/configform.html
rename to payapi/src/main/resources/templates/system/shop/configform.html
index e0bd620..79cf14e 100644
--- a/src/main/resources/templates/system/shop/configform.html
+++ b/payapi/src/main/resources/templates/system/shop/configform.html
@@ -14,7 +14,7 @@
<div class="layui-form-item">
<label class="layui-form-label">支付方式</label>
<div class="layui-input-block">
- <select name="paytype" lay-verify="required">
+ <select name="sourcetype" lay-verify="required">
<option th:each="pt:${paytypelist}" th:value="${pt.sourceType}"
th:text="${pt.paydesc}"></option>
</select> 
@@ -57,7 +57,7 @@
form.render('checkbox');
form.render('select');
// 回显数据
- var shop = admin.getTempData('t_addshoppaytype');
+ var shop = admin.getTempData('t_addshopsourcetype');
if (shop) {
form.val('shop-sourceType-form', {
shopaccno: shop.shopaccno,
@@ -73,18 +73,17 @@
$.ajax({
type : "POST",
dataType : "json",
- url : '[[@{/shop/addshoppaytype}]]',
+ url : '[[@{/shop/addshopsourcetype}]]',
data : vdata,
success : function(result) {
layer.closeAll('loading');
- if (result.code == 200) {
+ if (result.code === 200) {
layer.msg(result.msg, {icon: 1});
admin.finishPopupCenter();
- } else if (result.code == 401) {
+ } else if (result.code === 401) {
layer.msg(result.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
console.log('err:', result);
layer.msg(result.msg, {icon: 2});
diff --git a/src/main/resources/templates/system/shop/configpara.html b/payapi/src/main/resources/templates/system/shop/configpara.html
similarity index 82%
rename from src/main/resources/templates/system/shop/configpara.html
rename to payapi/src/main/resources/templates/system/shop/configpara.html
index 6e77151..762778c 100644
--- a/src/main/resources/templates/system/shop/configpara.html
+++ b/payapi/src/main/resources/templates/system/shop/configpara.html
@@ -1,7 +1,8 @@
-<form id="shop-sourceType-config-form" lay-filter="shop-sourceType-config-form" class="layui-form model-form">
+<form id="shop-sourceType-config-form" lay-filter="shop-sourceType-config-form" class="layui-form model-form"
+ xmlns:th="http://www.w3.org/1999/xhtml">
<div class="layui-form-item" style="display: none;">
<input type="hidden" class="layui-input" id="hid_shopaccno" th:value="${shopaccno}"/>
- <input type="hidden" class="layui-input" id="hid_paytype" th:value="${paytype}"/>
+ <input type="hidden" class="layui-input" id="hid_sourcetype" th:value="${sourcetype}"/>
</div>
<div class="layui-form-item" style="text-align: center;" th:if="${configlist.size()} le 0">
@@ -13,7 +14,7 @@
<label class="layui-form-label" style="float: right;width: 100%;" th:text="${config.configid}">参数名</label>
</div>
<div class="layui-input-block" style="margin:0;display: inline;float: right;width: 80%;">
- <input type="text" th:name="${config.configid}" class="layui-input" th:value="${config.configValue}" autocomplete="off"/>
+ <input type="text" th:name="${config.configid}" class="layui-input" th:value="${config.configValue}" th:placeholder="${config.configName}" autocomplete="off"/>
</div>
</div>
@@ -33,36 +34,35 @@
form.on('submit(form-submit)', function (data) {
layer.load(2);
var vdata = data.field;
- if(JSON.stringify(vdata)=="{}"){
+ if(JSON.stringify(vdata)==="{}"){
layer.closeAll('loading');
admin.closePopupCenter();
return; //无配置项,直接关闭
}
var token = $("meta[name='_csrf_token']").attr("value");
- vdata["hid_paytype"] = $("#hid_paytype").val();
+ vdata["hid_sourcetype"] = $("#hid_sourcetype").val();
vdata["hid_shopaccno"] = $("#hid_shopaccno").val();
console.log('addShopPaytype:', vdata);
debugger
$.ajax({
type : "POST",
dataType : "json",
- url : '[[@{/shop/addpaytypepara}]]',
+ url : '[[@{/shop/addsourcetypepara}]]',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
- 'X-CSRF-TOKEN':token,
+ 'X-CSRF-TOKEN':token
},
data : JSON.stringify(vdata),
success : function(result) {
layer.closeAll('loading');
- if (result.code == 200) {
+ if (result.code === 200) {
layer.msg(result.msg, {icon: 1});
admin.finishPopupCenter();
- } else if (result.code == 401) {
+ } else if (result.code === 401) {
layer.msg(result.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
console.log('err:' + result.code);
layer.msg(result.msg, {icon: 2});
diff --git a/src/main/resources/templates/system/shop/index.html b/payapi/src/main/resources/templates/system/shop/index.html
similarity index 69%
rename from src/main/resources/templates/system/shop/index.html
rename to payapi/src/main/resources/templates/system/shop/index.html
index 000ef7d..78ef8af 100644
--- a/src/main/resources/templates/system/shop/index.html
+++ b/payapi/src/main/resources/templates/system/shop/index.html
@@ -10,72 +10,87 @@
<div class="layui-row">
<div class="layui-col-xs5 layui-col-md3">
<div class="layui-card">
- <div class="layui-card-body layui-show"
- style="background-color: #D7F9F7;max-height: 560px;overflow:auto;">
- <ul id="shoptree" class="ztree"></ul>
+ <div class="layui-card-header">
+ 商户树<span style="font-size: 12px;">(双击商户进行修改)</span>
+ </div>
+ <div class="layui-card-body layui-show" style="margin-bottom: 15px;">
+ <ul id="shoptree" class="ztree"
+ style="background-color: #D7F9F7;max-height: 527px;overflow:auto;"></ul>
</div>
</div>
</div>
<div class="layui-col-xs7 layui-col-md9">
<div class="layui-card" style="min-height: 600px;">
- <div id="shop-info" class="layui-form toolbar" lay-filter="shop-info-form" style="display: none;">
+ <div id="shop-info" class="layui-form toolbar" lay-filter="shop-info-form"
+ style="display: none;">
<div class="layui-card-header">商户基本信息</div>
+ <div class="layui-form-item" style="margin-left: 15px;">
+ <label class="layui-form-label" style="color: red;"><span
+ style="color: red;">*</span>商户类型</label>
+ <div class="layui-input-inline">
+ <select name="shoptype" id="shoptype" lay-filter="shoptype-filter"
+ lay-verify="required">
+ <option value="root">根商户</option>
+ <option value="group">商户组</option>
+ <option value="normal">结算商户</option>
+ </select>
+ </div>
+ <div class="layui-form-mid layui-word-aux">
+ 注意:商户组无商户账号,且能创建下级商户。结算商户是叶子商户,会创建商户账号。保存后无法修改!!!
+ </div>
+ </div>
<div class="layui-card-body">
<div class="layui-form-item">
- <div class="layui-inline" style="width: 40%;">
+ <div class="layui-inline">
<label class="layui-form-label">商户号</label>
<div class="layui-input-inline">
<input type="text" name="shopid" class="layui-input"
+ style="background-color: #f1f1f1;"
readonly="readonly"/>
</div>
</div>
- <div class="layui-inline" style="width: 55%;">
- <label class="layui-form-label">商户名</label>
- <div class="layui-input-inline" style="width: 65%;">
- <input type="text" name="shopname" autocomplete="off"
- class="layui-input" maxlength="30" lay-verify="required"/>
- </div>
- </div>
- </div>
- <div class="layui-form-item">
- <div class="layui-inline" style="width: 40%;">
- <label class="layui-form-label">上级商户号</label>
- <div class="layui-input-inline">
- <input type="text" name="fshopid" id="fshopid" class="layui-input" autocomplete="off"
- lay-verify="required|number"/>
- </div>
- </div>
- <div class="layui-inline" style="width: 55%;">
+ <div class="layui-inline">
<label class="layui-form-label">商户账号</label>
- <div class="layui-input-inline" style="width: 65%;">
+ <div class="layui-input-inline">
<input type="text" name="shopaccno" autocomplete="off"
+ style="background-color: #f1f1f1;"
class="layui-input" readonly="readonly"/>
</div>
</div>
</div>
<div class="layui-form-item">
- <label class="layui-form-label" style="color: red;">商户类型</label>
- <div class="layui-input-inline">
- <select name="shoptype" id="shoptype" lay-filter="shoptype-filter" lay-verify="required">
- <option value="0">商户组</option>
- <option value="1">结算商户</option>
- </select>
- </div>
- <div class="layui-form-mid layui-word-aux">
- 注意:商户组无商户账号,且能创建下级商户。结算商户是叶子商户,会创建商户账号。保存后无法修改!!!
- </div>
- </div>
- <div class="layui-form-item">
- <div class="layui-inline" style="width: 40%;">
- <label class="layui-form-label">邮编</label>
+ <div class="layui-inline">
+ <label class="layui-form-label"><span
+ style="color: red;">*</span>上级商户号</label>
<div class="layui-input-inline">
- <input type="text" name="zipcode" class="layui-input" autocomplete="off" />
+ <input type="text" name="fshopid" id="fshopid" class="layui-input"
+ autocomplete="off"
+ lay-verify="required|number"/>
</div>
</div>
- <div class="layui-inline" style="width: 55%;">
+ <div class="layui-inline">
+ <label class="layui-form-label"><span
+ style="color: red;">*</span>商户名</label>
+ <div class="layui-input-inline">
+ <input type="text" name="shopname" autocomplete="off"
+ class="layui-input" maxlength="30" lay-verify="required"/>
+ </div>
+ </div>
+ </div>
+
+ <div class="layui-form-item">
+ <div class="layui-inline">
+ <label class="layui-form-label">邮编</label>
+ <div class="layui-input-inline">
+ <input type="text" name="zipcode" class="layui-input"
+ autocomplete="off"/>
+ </div>
+ </div>
+ <div class="layui-inline">
<label class="layui-form-label">地址</label>
- <div class="layui-input-inline" style="width: 65%;">
- <input type="text" name="addr" class="layui-input" maxlength="40" autocomplete="off" />
+ <div class="layui-input-inline">
+ <input type="text" name="addr" class="layui-input" maxlength="40"
+ autocomplete="off"/>
</div>
</div>
</div>
@@ -83,60 +98,67 @@
<div class="layui-card-header">商户联系人信息</div>
<div class="layui-card-body">
<div class="layui-form-item">
- <div class="layui-inline" style="width: 40%;">
+ <div class="layui-inline">
<label class="layui-form-label">姓名</label>
<div class="layui-input-inline">
- <input type="text" name="contactman" class="layui-input" autocomplete="off"/>
+ <input type="text" name="contactman" class="layui-input"
+ autocomplete="off"/>
</div>
</div>
- <div class="layui-inline" style="width: 55%;">
+ <div class="layui-inline">
<label class="layui-form-label">手机号</label>
- <div class="layui-input-inline" style="width: 65%;">
- <input type="text" name="mobile" class="layui-input" maxlength="20" autocomplete="off"
- lay-verify="mobile" />
+ <div class="layui-input-inline">
+ <input type="text" name="mobile" class="layui-input" maxlength="20"
+ autocomplete="off"
+ lay-verify="mobile"/>
</div>
</div>
</div>
<div class="layui-form-item">
- <div class="layui-inline" style="width: 40%;">
+ <div class="layui-inline">
<label class="layui-form-label">证件类型</label>
<div class="layui-input-inline">
<select name="idtype" lay-filter="idtype-filter">
- <option value="1">身份证</option>
- <option value="2">护照</option>
- <option value="3">驾照</option>
- <option value="4">港澳通行证</option>
- <option value="5">学生证</option>
- <option value="9">其他</option>
+ <option th:each="bean : ${idtypeList}" th:value="${bean.dictval}">[[${bean.dictcaption}]]</option>
</select>
</div>
</div>
- <div class="layui-inline" style="width: 55%;">
+ <div class="layui-inline">
<label class="layui-form-label">证件号</label>
- <div class="layui-input-inline" style="width: 65%;">
- <input type="text" name="idno" class="layui-input" maxlength="20" autocomplete="off"/>
+ <div class="layui-input-inline">
+ <input type="text" name="idno" class="layui-input" maxlength="20"
+ autocomplete="off"/>
</div>
</div>
</div>
<div class="layui-form-item">
- <div class="layui-inline" style="width: 40%;">
+ <div class="layui-inline">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
- <input type="text" name="email" class="layui-input" autocomplete="off" lay-verify="swEmail"/>
+ <input type="text" name="email" class="layui-input" autocomplete="off"
+ lay-verify="swEmail"/>
</div>
</div>
- <div class="layui-inline" style="width: 55%;">
+ <div class="layui-inline">
<label class="layui-form-label">电话</label>
- <div class="layui-input-inline" style="width: 65%;">
- <input type="text" name="tel" class="layui-input" maxlength="20" autocomplete="off" />
+ <div class="layui-input-inline">
+ <input type="text" name="tel" class="layui-input" maxlength="20"
+ autocomplete="off"/>
</div>
</div>
</div>
</div>
<div class="layui-form-item" style="padding-bottom: 20px;text-align: center;">
- <button class="layui-btn" lay-filter="form-submit-shop-btn" lay-submit id="submitbtn-shop-btn">保存</button>
- <button class="layui-btn layui-btn-primary" type="button" id="cancelbtn">取消</button>
+ <button class="layui-btn" lay-filter="form-submit-shop-btn" lay-submit
+ id="submitbtn-shop-btn">保存
+ </button>
+ <button class="layui-btn layui-btn-primary" type="button" id="cancelbtn">取消
+ </button>
+ <div class="layui-inline" style="margin-left: 10px;" id="shop-add-hid-div">
+ <input type="checkbox" id="shop-add-continue-flag" lay-skin="primary"
+ title="继续新增"/>
+ </div>
</div>
</div>
</div>
@@ -150,6 +172,8 @@
var form = layui.form;
var table = layui.table;
var admin = layui.admin;
+ var $ = layui.jquery;
+
form.render('select');
form.verify({
"mobile": function (e) {
@@ -201,7 +225,7 @@
var zTree = $.fn.zTree.getZTreeObj("shoptree");
if (treeNode.isParent) {
var childrenNodes = treeNode.children;
- if (childrenNodes && childrenNodes.length != 0) {
+ if (childrenNodes && childrenNodes.length !== 0) {
layer.msg("请先删除下级商户", {icon: 2, time: 2000});
return false;
}
@@ -222,10 +246,10 @@
success: function (result) {
console.log(result);
layer.closeAll('loading');
- if (result.code == 200) {
+ if (result.code === 200) {
layer.msg(result.msg, {icon: 1});
flag = true;
- } else if (result.code == 401) {
+ } else if (result.code === 401) {
layer.msg(result.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
@@ -264,11 +288,11 @@
success: function (result) {
layer.closeAll('loading');
debugger
- if (result.code == 200) {
+ if (result.code === 200) {
var zTree = $.fn.zTree.getZTreeObj("shoptree");
var treeNode = zTree.getNodeByParam("id", '' + result.shop.shopid, null);
- if (undefined != treeNode && null != treeNode) {
- treeNode.id = ''+result.shop.shopid;
+ if (undefined !== treeNode && treeNode != null) {
+ treeNode.id = '' + result.shop.shopid;
treeNode.pId = '' + result.shop.fshopid;
treeNode.name = '' + result.shop.shopid + '_' + result.shop.shopname;
zTree.updateNode(treeNode); //修改节点
@@ -280,7 +304,7 @@
name: '' + result.shop.shopid + '_' + result.shop.shopname,
shoptype: result.shop.shoptype
}
- if (result.shop.shoptype == 1) {
+ if (result.shop.shoptype === 'normal') {
newNode["iconSkin"] = "pIcon02";
} else {
newNode["iconSkin"] = "pIcon01";
@@ -288,12 +312,13 @@
zTree.addNodes(ftreeNode, newNode); //新加树节点
}
layer.msg(result.msg, {icon: 1});
- $("#shop-info").hide();
- } else if (result.code == 401) {
+ if (!$("#shop-add-continue-flag").is(":checked")) {
+ $("#shop-info").hide();
+ }
+ } else if (result.code === 401) {
layer.msg(result.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
console.log('err:' + result.code);
layer.msg(result.msg, {icon: 2});
@@ -307,7 +332,7 @@
});
function addHoverDom(treeId, treeNode) {
- if (treeNode.shoptype == 0) {
+ if (treeNode.shoptype !== 'normal') {
var sObj = $("#" + treeNode.tId + "_span");
if (treeNode.editNameFlag || $("#addBtn_" + treeNode.tId).length > 0) return;
var addStr = "<span class='button add' id='addBtn_" + treeNode.tId
@@ -315,25 +340,28 @@
sObj.after(addStr);
var btn = $("#addBtn_" + treeNode.tId);
if (btn) btn.bind("click", function () {
- form.val("shop-info-form",{
- "shopid":"0",
+ form.val("shop-info-form", {
+ "shopid": "0",
"shopname": "",
- "shopaccno":"",
- "fshopid":treeNode.id,
- "shoptype":"1",
- "zipcode":"",
- "addr":"",
- "contactman":"",
- "idtype":"1",
- "idno":"",
- "mobile":"",
- "email":"",
- "tel":""
+ "shopaccno": "",
+ "fshopid": treeNode.id,
+ "shoptype": "normal",
+ "zipcode": "",
+ "addr": "",
+ "contactman": "",
+ "idtype": "idcard",
+ "idno": "",
+ "mobile": "",
+ "email": "",
+ "tel": ""
});
$("#fshopid").attr("readonly", "readonly");
+ $("#shoptype option[value='root']").remove();
$("#shoptype").removeAttr("disabled");
form.render('select');
$("#submitbtn-shop-btn").text("新增");
+ $("#shop-add-continue-flag").prop("checked", false);
+ $("#shop-add-hid-div").show();
$("#shop-info").show();
return false;
});
@@ -344,19 +372,28 @@
admin.dgo('[[@{/shop/getshopinfo}]]', {
"shopid": treeNode.id
}, function (data) {
- console.log("getshopinfo返回",data);
- if (data.code == 200) {
- form.val("shop-info-form",data.shop);
+ console.log("getshopinfo返回", data);
+ if (data.code === 200) {
+ debugger
+ var root_index = $("#shoptype option[value='root']").attr("index");
+ if(undefined == root_index){
+ $("#shoptype").append("<option value=\"root\">根商户</option>");
+ }
+ if(null==data.shop.idtype){
+ data.shop["idtype"]="idcard"
+ }
+ form.val("shop-info-form", data.shop);
$("#fshopid").removeAttr("readonly");
$("#shoptype").attr('disabled', 'disabled');
form.render('select');
$("#submitbtn-shop-btn").text("保存");
+ $("#shop-add-continue-flag").prop("checked", false);
+ $("#shop-add-hid-div").hide();
$("#shop-info").show();
- } else if (data.code == 401) {
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
layer.msg(data.msg, {icon: 2, time: 2000});
}
@@ -367,13 +404,12 @@
}
admin.dgo('[[@{/shop/shoptree}]]', {}, function (data) {
- if (data.code == 200) {
+ if (data.code === 200) {
initTree(data.data);
- } else if (data.code == 401) {
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
- return;
} else {
layer.msg(data.msg, {icon: 2, time: 2000});
}
diff --git a/src/main/resources/templates/system/user/account.html b/payapi/src/main/resources/templates/system/user/account.html
similarity index 61%
rename from src/main/resources/templates/system/user/account.html
rename to payapi/src/main/resources/templates/system/user/account.html
index cd9cc57..8dfc988 100644
--- a/src/main/resources/templates/system/user/account.html
+++ b/payapi/src/main/resources/templates/system/user/account.html
@@ -9,8 +9,10 @@
<div class="layui-card-body">
<div class="layui-form toolbar">
搜索:
- <input id="search-value-account" class="layui-input search-input" type="text" placeholder="输入用户名称"/> 
- <button id="btn-search-account" class="layui-btn icon-btn" data-type="search"><i class="layui-icon"></i>搜索
+ <input id="search-value-account" class="layui-input search-input" type="text"
+ placeholder="输入用户名称"/> 
+ <button id="btn-search-account" class="layui-btn icon-btn" data-type="search"><i
+ class="layui-icon"></i>搜索
</button>
</div>
<table class="layui-table" id="accounttable" lay-filter="accounttable"></table>
@@ -29,36 +31,63 @@
page: true,
cols: [
[
- {field: 'accno', title: '账号',fixed: 'left', width: 100},
- {field: 'person', title: '名称', width: 80,fixed: 'left', sort: true, templet: function (item) {
- if(item.accname!=null){
+ {field: 'accno', title: '账号', fixed: 'left', width: 300},
+ {
+ field: 'person',
+ title: '名称',
+ fixed: 'left',
+ sort: true,
+ templet: function (item) {
+ if (item.accname != null) {
return item.accname;
}
return item.person.name;
- }},
- {field: 'transStatus', title: '状态',fixed: 'left',width: 80 , templet: function (item) {
- if (item.transStatus == 'normal') {
- return '<span class="layui-badge layui-bg-green">正常</span>'
- } else if (item.transStatus == 'closed') {
- return '<span class="layui-badge">注销</span>'
- } else if (item.transStatus == 'locked') {
- return '<span class="layui-badge layui-bg-orange">锁定</span>'
- } else {
+ }
+ },
+ {
+ field: 'transStatus',
+ title: '状态',
+ align: 'center',
+ width: 100,
+ sort: true,
+ templet: function (item) {
+ let desc = getTempDictValue('accountStatusList', item.transStatus)
+ if (item.transStatus === 'normal') {
+ return '<span class="layui-badge layui-bg-green">' + desc + '</span>'
+ } else if (item.transStatus === 'closed') {
+ return '<span class="layui-badge">' + desc + '</span>'
+ } else if (item.transStatus === 'locked') {
+ return '<span class="layui-badge layui-bg-orange">' + desc + '</span>'
+ } else {
return '异常'
}
}
},
- {field: 'availbal', title: '可用余额', width: 100,fixed: 'left', sort: true},
- {field: 'balance', title: '总余额', width: 100,fixed: 'left', sort: true},
- {field: 'frozebal', title: '冻结余额', width: 100,fixed: 'left', sort: true},
- {field: 'lasttranstime', title: '最后交易日期', width: 120,fixed: 'left', sort: true},
- {field: 'opendate', title: '开户日期', width: 100,fixed: 'left', sort: true},
+ {field: 'availbal', title: '可用余额', width: 100, sort: true},
+ {field: 'balance', title: '总余额', width: 100, sort: true},
+ {field: 'frozebal', title: '冻结余额', width: 100, sort: true},
{
- field: 'accno', align: 'center', title: '操作', fixed: 'right', templet: function (item) {
- if (item.transStatus != 'closed') {
+ field: 'lasttranstime', title: '最后交易日期', sort: true, templet: function (item) {
+ var dt = moment(item.lasttranstime);
+ return dt.format("YYYY-MM-DD HH:mm:ss");
+ }
+ },
+ {
+ field: 'opendate', title: '开户日期', width: 120, sort: true, templet: function (item) {
+ return admin.formatDate(item.opendate);
+ }
+ },
+ {
+ field: 'accno',
+ align: 'center',
+ title: '操作',
+ fixed: 'right',
+ width: 150,
+ templet: function (item) {
+ if (item.transStatus !== 'closed') {
let html = ' <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>注销</a> ';
return html;
- }else {
+ } else {
return '';
}
}
@@ -93,9 +122,9 @@
}, function (data) {
console.log(data.code);
layer.closeAll('loading');
- if (data.code == 200) {
+ if (data.code === 200) {
layer.msg(data.msg, {icon: 1});
- } else if (data.code == 401) {
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
@@ -107,9 +136,9 @@
}, function (ret) {
console.log(ret);
layer.closeAll('loading');
- if(ret.transStatus==403){
+ if (ret.transStatus === 403) {
layer.msg('没有权限', {icon: 2});
- }else{
+ } else {
layer.msg('请求失败了,请稍后再试', {icon: 2});
}
});
diff --git a/src/main/resources/templates/system/user/add.html b/payapi/src/main/resources/templates/system/user/add.html
similarity index 87%
rename from src/main/resources/templates/system/user/add.html
rename to payapi/src/main/resources/templates/system/user/add.html
index e2f2c81..f33976e 100755
--- a/src/main/resources/templates/system/user/add.html
+++ b/payapi/src/main/resources/templates/system/user/add.html
@@ -1,110 +1,109 @@
-<!-- operator表单弹窗 -->
-<form id="user-form" lay-filter="user-form" class="layui-form model-form">
- <input name="userid" id="userid" type="hidden"/>
- <div class="layui-form-item">
- <label class="layui-form-label">姓名*</label>
- <div class="layui-input-block">
- <input name="name" placeholder="请输入名称" type="text" class="layui-input" maxlength="100"
- lay-verify="required" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">性别</label>
- <div class="layui-input-block">
- <input type="radio" name="sex" value="male" title="男" checked/>
- <input type="radio" name="sex" value="female" title="女"/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">证件类型*</label>
- <div class="layui-input-block">
- <select name="idtype" id="idtype" lay-verify="required">
- <option th:each="bean : ${idtypes}" th:value="${bean.idtype}">[[${bean.typename}]]</option>
- </select>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">证件号*</label>
- <div class="layui-input-block">
- <input name="idno" placeholder="请输入证件号" type="text" class="layui-input" maxlength="100"
- lay-verify="required" required/>
- </div>
- </div>
-
- <div class="layui-form-item">
- <label class="layui-form-label">手机号*</label>
- <div class="layui-input-block">
- <input name="mobile" placeholder="请输入手机号" type="text" class="layui-input" maxlength="11"
- lay-verify="required" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">邮箱</label>
- <div class="layui-input-block">
- <input name="email" placeholder="请输入邮箱" type="text" class="layui-input" maxlength="100" />
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">地址</label>
- <div class="layui-input-block">
- <input name="addr" placeholder="请输入地址" type="text" class="layui-input" maxlength="300" />
- </div>
- </div>
-
- <div class="layui-form-item model-form-footer">
- <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
- <button class="layui-btn" lay-filter="user-form-submit" lay-submit id="submitbtn">保存</button>
- </div>
-</form>
-
-<script>
- layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
- var layer = layui.layer;
- var admin = layui.admin;
- var form = layui.form;
- var url = '[[@{/user/add}]]';
- form.render('radio');
- form.render('select');
- // 回显user数据
- var bean = admin.getTempData('t_bean');
- if (bean) {
- form.val('user-form', bean);
- }
- // 表单提交事件
- form.on('submit(user-form-submit)', function (data) {
- layer.load(2);
- let token = $("meta[name='_csrf_token']").attr("value");
- $.ajax({
- type : "POST",
- dataType : "json",
- url : url,
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- 'X-CSRF-TOKEN':token,
- },
- data : JSON.stringify(data.field),
- success : function(result) {
- layer.closeAll('loading');
- if (result.code == 200) {
- layer.msg(result.msg, {icon: 1});
- admin.finishPopupCenter();
- } else if (result.code == 401) {
- layer.msg(result.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- } else {
- console.log('err:' + result.code);
- layer.msg(result.msg, {icon: 2});
- }
- },
- error : function() {
- layer.closeAll('loading');
- layer.msg("请求服务器失败!", {icon: 2});
- }
- });
- return false;
- });
- });
+<!-- operator表单弹窗 -->
+<form id="user-form" lay-filter="user-form" class="layui-form model-form">
+ <input name="userid" id="userid" type="hidden"/>
+ <div class="layui-form-item">
+ <label class="layui-form-label"><span style="color: red;">*</span>姓名</label>
+ <div class="layui-input-block">
+ <input name="name" placeholder="请输入名称" type="text" class="layui-input" maxlength="100"
+ lay-verify="required" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">性别</label>
+ <div class="layui-input-block">
+ <input type="radio" name="sex" value="male" title="男" checked/>
+ <input type="radio" name="sex" value="female" title="女"/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label"><span style="color: red;">*</span>证件类型</label>
+ <div class="layui-input-block">
+ <select name="idtype" id="idtype" lay-verify="required">
+ <option th:each="bean : ${idtypeList}" th:value="${bean.dictval}">[[${bean.dictcaption}]]</option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label"><span style="color: red;">*</span>证件号</label>
+ <div class="layui-input-block">
+ <input name="idno" placeholder="请输入证件号" type="text" class="layui-input" maxlength="100"
+ lay-verify="required" required/>
+ </div>
+ </div>
+
+ <div class="layui-form-item">
+ <label class="layui-form-label"><span style="color: red;">*</span>手机号</label>
+ <div class="layui-input-block">
+ <input name="mobile" placeholder="请输入手机号" type="text" class="layui-input" maxlength="11"
+ lay-verify="required" required/>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">邮箱</label>
+ <div class="layui-input-block">
+ <input name="email" placeholder="请输入邮箱" type="text" class="layui-input" maxlength="100" />
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">地址</label>
+ <div class="layui-input-block">
+ <input name="addr" placeholder="请输入地址" type="text" class="layui-input" maxlength="300" />
+ </div>
+ </div>
+
+ <div class="layui-form-item model-form-footer">
+ <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
+ <button class="layui-btn" lay-filter="user-form-submit" lay-submit id="submitbtn">保存</button>
+ </div>
+</form>
+
+<script>
+ layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
+ var layer = layui.layer;
+ var admin = layui.admin;
+ var form = layui.form;
+ var url = '[[@{/user/add}]]';
+ form.render('radio');
+ form.render('select');
+ // 回显user数据
+ var bean = admin.getTempData('t_bean');
+ if (bean) {
+ form.val('user-form', bean);
+ }
+ // 表单提交事件
+ form.on('submit(user-form-submit)', function (data) {
+ layer.load(2);
+ let token = $("meta[name='_csrf_token']").attr("value");
+ $.ajax({
+ type : "POST",
+ dataType : "json",
+ url : url,
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ data : JSON.stringify(data.field),
+ success : function(result) {
+ layer.closeAll('loading');
+ if (result.code === 200) {
+ layer.msg(result.msg, {icon: 1});
+ admin.finishPopupCenter();
+ } else if (result.code === 401) {
+ layer.msg(result.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ } else {
+ console.log('err:' + result.code);
+ layer.msg(result.msg, {icon: 2});
+ }
+ },
+ error : function() {
+ layer.closeAll('loading');
+ layer.msg("请求服务器失败!", {icon: 2});
+ }
+ });
+ return false;
+ });
+ });
</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/system/user/bind.html b/payapi/src/main/resources/templates/system/user/bind.html
similarity index 99%
rename from src/main/resources/templates/system/user/bind.html
rename to payapi/src/main/resources/templates/system/user/bind.html
index e5ea4d5..cba5937 100755
--- a/src/main/resources/templates/system/user/bind.html
+++ b/payapi/src/main/resources/templates/system/user/bind.html
@@ -1,76 +1,76 @@
-<div style="padding:20px;">
- <table class="layui-table" id="userbindtable" lay-filter="userbindtable">
- </table>
- <input type="hidden" id="userid" th:value="${userid}">
-</div>
-<script>
- layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
- let form = layui.form;
- let admin = layui.admin;
- form.render('select');
- let table = layui.table;
- let userid = admin.getTempData('userid');
- table.render({
- elem: '#userbindtable',
- url: '[[@{/user/bind}]]?userid=' + userid,
- cols: [
- [
- {field: 'id', title: '资源ID', width: 80, fixed: 'left', sort: true},
- {field: 'name', title: '资源名称', sort: true},
- {
- field: 'functionId', title: '所属功能', sort: true, align: 'center', templet: function (item) {
- return $("#functionname").val();
- }
- },
- {field: 'uri', title: '路径'},
- {field: 'code', sort: true, width: 80, title: '代码'},
- {
- field: 'id', align: 'center', title: '操作', templet: function (item) {
- return '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>'
- }
- }
- ]
- ]
- });
- // 工具条点击事件
- table.on('tool(userbindtable)', function (obj) {
- let data = obj.data;
- let layEvent = obj.event;
- console.log(data);
- if (layEvent === 'del') {
- showDelete(data);
- }
- });
-
- let showDelete = function (data) {
- layer.confirm('确定删除吗?', function (i) {
- layer.close(i);
- layer.load(2);
- let token = $("meta[name='_csrf_token']").attr("value");
- admin.go('[[@{/user/delbind}]]', {
- resid: data.id,
- _csrf:token
- }, function (data) {
- console.log(data.code);
- layer.closeAll('loading');
- if (data.code == 200) {
- layer.msg(data.msg, {icon: 1});
- } else if (data.code == 401) {
- layer.msg(data.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- }
- else {
- layer.msg(data.msg, {icon: 2});
- }
- table.reload('restable', {});
- },function(ret){
- console.log(ret);
- layer.closeAll('loading');
- layer.msg('请求失败了,请稍后再试', {icon: 2});
- });
- });
- }
- });
-</script>
+<div style="padding:20px;">
+ <table class="layui-table" id="userbindtable" lay-filter="userbindtable">
+ </table>
+ <input type="hidden" id="userid" th:value="${userid}">
+</div>
+<script>
+ layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
+ let form = layui.form;
+ let admin = layui.admin;
+ form.render('select');
+ let table = layui.table;
+ let userid = admin.getTempData('userid');
+ table.render({
+ elem: '#userbindtable',
+ url: '[[@{/user/bind}]]?userid=' + userid,
+ cols: [
+ [
+ {field: 'id', title: '资源ID', width: 80, fixed: 'left', sort: true},
+ {field: 'name', title: '资源名称', sort: true},
+ {
+ field: 'functionId', title: '所属功能', sort: true, align: 'center', templet: function (item) {
+ return $("#functionname").val();
+ }
+ },
+ {field: 'uri', title: '路径'},
+ {field: 'code', sort: true, width: 80, title: '代码'},
+ {
+ field: 'id', align: 'center', title: '操作', templet: function (item) {
+ return '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>'
+ }
+ }
+ ]
+ ]
+ });
+ // 工具条点击事件
+ table.on('tool(userbindtable)', function (obj) {
+ let data = obj.data;
+ let layEvent = obj.event;
+ console.log(data);
+ if (layEvent === 'del') {
+ showDelete(data);
+ }
+ });
+
+ let showDelete = function (data) {
+ layer.confirm('确定删除吗?', function (i) {
+ layer.close(i);
+ layer.load(2);
+ let token = $("meta[name='_csrf_token']").attr("value");
+ admin.go('[[@{/user/delbind}]]', {
+ resid: data.id,
+ _csrf:token
+ }, function (data) {
+ console.log(data.code);
+ layer.closeAll('loading');
+ if (data.code == 200) {
+ layer.msg(data.msg, {icon: 1});
+ } else if (data.code == 401) {
+ layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+ location.replace('[[@{/login}]]');
+ }, 1000);
+ return;
+ }
+ else {
+ layer.msg(data.msg, {icon: 2});
+ }
+ table.reload('restable', {});
+ },function(ret){
+ console.log(ret);
+ layer.closeAll('loading');
+ layer.msg('请求失败了,请稍后再试', {icon: 2});
+ });
+ });
+ }
+ });
+</script>
diff --git a/src/main/resources/templates/system/user/index.html b/payapi/src/main/resources/templates/system/user/index.html
similarity index 61%
rename from src/main/resources/templates/system/user/index.html
rename to payapi/src/main/resources/templates/system/user/index.html
index c035a36..5507955 100644
--- a/src/main/resources/templates/system/user/index.html
+++ b/payapi/src/main/resources/templates/system/user/index.html
@@ -10,9 +10,11 @@
<div class="layui-form toolbar">
搜索:
<input id="search-value-user" class="layui-input search-input" type="text" placeholder="输入用户名称"/> 
- <button id="btn-search-user" class="layui-btn icon-btn" data-type="search"><i class="layui-icon"></i>搜索
+ <button id="btn-search-user" class="layui-btn icon-btn" data-type="search"><i
+ class="layui-icon"></i>搜索
</button>
- <button id="btn-add-user" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>添加用户</button>
+ <button id="btn-add-user" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>添加用户
+ </button>
</div>
<table class="layui-table" id="usertable" lay-filter="usertable"></table>
</div>
@@ -30,55 +32,48 @@
page: true,
cols: [
[
- {field: 'name', title: '名称', width: 80,fixed: 'left', sort: true},
- {field: 'sex', title: '性别',fixed: 'left', width: 80, templet: function (item) {
- if (item.sex == 'male') {
- return '男'
- } else if (item.sex == 'female') {
- return '女'
- } else {
- return '男'
- }
- }
- },
- {field: 'transStatus', title: '状态',fixed: 'left',width: 80 , templet: function (item) {
- if (item.transStatus == 'normal') {
- return '<span class="layui-badge layui-bg-green">正常</span>'
- } else if (item.transStatus == 'closed') {
- return '<span class="layui-badge">注销</span>'
- } else if (item.transStatus == 'locked') {
- return '<span class="layui-badge layui-bg-orange">锁定</span>'
- } else {
- return '异常'
- }
- }
- },
- {field: 'idtype', align: 'center',width: 100, title: '证件类型', fixed: 'left', templet: function (item) {
- if (item.idtype == '1') {
- return '身份证'
- } else if (item.idtype == '2') {
- return '护照'
- } else if (item.idtype == '3') {
- return '驾照'
- } else if (item.idtype == '4') {
- return '港澳通行证'
- } else if (item.idtype == '5') {
- return '学工号'
- } else {
- return '其他'
- }
- }
- },
- {field: 'idno', title: '证件号', width: 120,fixed: 'left', sort: true},
- {field: 'email', title: '邮箱', width: 100,fixed: 'left', sort: true},
- {field: 'mobile', title: '手机', width: 120,fixed: 'left', sort: true},
- {field: 'tel', title: '电话', width: 100,fixed: 'left', sort: true},
- {field: 'addr', title: '地址', width: 200,fixed: 'left', sort: true},
- {field: 'lastsaved', title: '最后修改时间', width: 140,fixed: 'left', sort: true},
+ {field: 'name', title: '名称', width: 150, fixed: 'left', sort: true},
+ {field: 'sex', title: '性别', align: 'center', width: 80, templet: function(item){
+ return getTempDictValue('sexList', item.sex);
+ }},
{
- field: 'userid', align: 'center', title: '操作', fixed: 'right', templet: function (item) {
- let html = ' <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a> ';
- html +='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>';
+ field: 'status', title: '状态', align: 'center', width: 80, templet: function (item) {
+ let desc = getTempDictValue('accountStatusList', item.status);
+ if (item.status === 'normal') {
+ return '<span class="layui-badge layui-bg-green">' + desc + '</span>';
+ } else if (item.status === 'closed') {
+ return '<span class="layui-badge">' + desc + '</span>';
+ } else if (item.status === 'locked') {
+ return '<span class="layui-badge layui-bg-orange">' + desc + '</span>';
+ } else {
+ return '异常';
+ }
+ }
+ },
+ {
+ field: 'idtype', align: 'center', width: 100, title: '证件类型',
+ templet: function (item) {
+ return getTempDictValue('idtypeList', item.idtype);
+ }
+ },
+ {field: 'idno', title: '证件号', width: 120, align: 'center', sort: true},
+ {field: 'email', title: '邮箱', width: 100, align: 'center', sort: true},
+ {field: 'mobile', title: '手机', width: 120, align: 'center', sort: true},
+ {field: 'tel', title: '电话', align: 'center'},
+ {field: 'addr', title: '地址', align: 'center' },
+ {
+ field: 'lastsaved', title: '最后修改时间', width: 180, sort: true, templet: function (d) {
+ return admin.formatDate(d.lastsaved);
+ }
+ },
+ {
+ align: 'center',
+ title: '操作',
+ fixed: 'right',
+ width: 170,
+ templet: function (item) {
+ let html = ' <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a> ';
+ html += '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>';
/*html += '<a class="layui-btn layui-btn-xs" lay-event="other"><i class="layui-icon layui-icon-link"></i>交易记录</a> ';*/
return html;
}
@@ -128,9 +123,9 @@
}, function (data) {
console.log(data.code);
layer.closeAll('loading');
- if (data.code == 200) {
+ if (data.code === 200) {
layer.msg(data.msg, {icon: 1});
- } else if (data.code == 401) {
+ } else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
location.replace('[[@{/login}]]');
}, 1000);
@@ -142,9 +137,9 @@
}, function (ret) {
console.log(ret);
layer.closeAll('loading');
- if(ret.transStatus==403){
+ if (ret.transStatus === 403) {
layer.msg('没有权限', {icon: 2});
- }else{
+ } else {
layer.msg('请求失败了,请稍后再试', {icon: 2});
}
});
diff --git a/src/main/resources/templates/system/user/point.html b/payapi/src/main/resources/templates/system/user/point.html
similarity index 100%
rename from src/main/resources/templates/system/user/point.html
rename to payapi/src/main/resources/templates/system/user/point.html
diff --git a/src/main/resources/templates/system/user/pointdtl.html b/payapi/src/main/resources/templates/system/user/pointdtl.html
similarity index 100%
rename from src/main/resources/templates/system/user/pointdtl.html
rename to payapi/src/main/resources/templates/system/user/pointdtl.html
diff --git a/src/main/webapp/WEB-INF/web.xml b/payapi/src/main/webapp/WEB-INF/web.xml
similarity index 100%
rename from src/main/webapp/WEB-INF/web.xml
rename to payapi/src/main/webapp/WEB-INF/web.xml
diff --git a/src/test/kotlin/com/supwisdom/dlpay/DlpayApplicationTests.kt b/payapi/src/test/kotlin/com/supwisdom/dlpay/DlpayApplicationTests.kt
similarity index 100%
rename from src/test/kotlin/com/supwisdom/dlpay/DlpayApplicationTests.kt
rename to payapi/src/test/kotlin/com/supwisdom/dlpay/DlpayApplicationTests.kt
diff --git a/src/test/kotlin/com/supwisdom/dlpay/MvcBaseTest.kt b/payapi/src/test/kotlin/com/supwisdom/dlpay/MvcBaseTest.kt
similarity index 100%
rename from src/test/kotlin/com/supwisdom/dlpay/MvcBaseTest.kt
rename to payapi/src/test/kotlin/com/supwisdom/dlpay/MvcBaseTest.kt
diff --git a/src/test/kotlin/com/supwisdom/dlpay/controller/ApiControllerTest.kt b/payapi/src/test/kotlin/com/supwisdom/dlpay/controller/ApiControllerTest.kt
similarity index 100%
rename from src/test/kotlin/com/supwisdom/dlpay/controller/ApiControllerTest.kt
rename to payapi/src/test/kotlin/com/supwisdom/dlpay/controller/ApiControllerTest.kt
diff --git a/src/test/kotlin/com/supwisdom/dlpay/controller/ShopControllerTest.kt b/payapi/src/test/kotlin/com/supwisdom/dlpay/controller/ShopControllerTest.kt
similarity index 100%
rename from src/test/kotlin/com/supwisdom/dlpay/controller/ShopControllerTest.kt
rename to payapi/src/test/kotlin/com/supwisdom/dlpay/controller/ShopControllerTest.kt
diff --git a/src/test/kotlin/com/supwisdom/dlpay/controller/UserControllerTest.kt b/payapi/src/test/kotlin/com/supwisdom/dlpay/controller/UserControllerTest.kt
similarity index 100%
rename from src/test/kotlin/com/supwisdom/dlpay/controller/UserControllerTest.kt
rename to payapi/src/test/kotlin/com/supwisdom/dlpay/controller/UserControllerTest.kt
diff --git a/src/test/kotlin/com/supwisdom/dlpay/controller/security_controller_test.kt b/payapi/src/test/kotlin/com/supwisdom/dlpay/controller/security_controller_test.kt
similarity index 100%
rename from src/test/kotlin/com/supwisdom/dlpay/controller/security_controller_test.kt
rename to payapi/src/test/kotlin/com/supwisdom/dlpay/controller/security_controller_test.kt
diff --git a/src/test/kotlin/com/supwisdom/dlpay/password_test.kt b/payapi/src/test/kotlin/com/supwisdom/dlpay/password_test.kt
similarity index 100%
rename from src/test/kotlin/com/supwisdom/dlpay/password_test.kt
rename to payapi/src/test/kotlin/com/supwisdom/dlpay/password_test.kt
diff --git a/settings.gradle b/settings.gradle
index ec967da..42be481 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,20 +1,2 @@
-pluginManagement {
- resolutionStrategy {
- eachPlugin {
- if (requested.id.namespace != null) {
- if (requested.id.namespace.startsWith("org.jetbrains.kotlin")) {
- println "Kotlin version $kotlinVersion"
- useVersion kotlinVersion
- } else if(requested.id.namespace.startsWith("org.springframework")) {
- println "Springboot version $springbootVersion"
- useVersion springbootVersion
- }
- }
- }
- }
- repositories {
- gradlePluginPortal()
- }
-}
rootProject.name = 'payapi'
-
+include 'payapi', 'payapi-sdk', 'payapi-common', 'ynrcc-agent'
diff --git a/src/main/java/com/supwisdom/dlpay/api/bean/DlpayReq.java b/src/main/java/com/supwisdom/dlpay/api/bean/DlpayReq.java
deleted file mode 100644
index 3678cc0..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/bean/DlpayReq.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.supwisdom.dlpay.api.bean;
-
-public class DlpayReq {
- private static final String prefix = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
-
- //HEAD
- private String jkdm; //<JKDM>接口代码</JKDM>
- private String jgdm; //<JGDM>结果代码</JGDM>
- private String fsdw; //<FSDW>发送单位</FSDW>
- private String jsdw; //<JSDW>接收单位</JSDW>
- private String czyh; //<CZYH>操作员号</CZYH>
- private String jyxh; //<JYXH>交易序号</JYXH>
- private String jyqd; //<JYQD>交易渠道</JYQD>
- private String yhxx; //<YHXX>安全用户信息</YHXX>
- private String klxx; //<KLXX>安全口令信息</KLXX>
-
- //DATA业务参数 <KEY>key值</KEY>
-
-
- private String getPayXml() {
- StringBuffer xml = new StringBuffer();
- xml.append(prefix)
- .append("<FORMDATA>")
- //HEAD
- .append("<HEAD>")
- .append("<JKDM>").append(jkdm).append("</JKDM>")
- .append("<JGDM>").append("000000").append("</JGDM>") //发送时填充000000
- .append("<FSDW>").append(fsdw).append("</FSDW>")
- .append("<JSDW>").append(jsdw).append("</JSDW>")
- .append("<CZYH>").append(czyh).append("</CZYH>")
- .append("<JYXH>").append(jyxh).append("</JYXH>")
- .append("<JYQD>").append(jyqd).append("</JYQD>")
- .append("<YHXX>").append(yhxx).append("</YHXX>")
- .append("<KLXX>").append(klxx).append("</KLXX>")
- .append("</HEAD>")
- //DATA
- .append("<DATA>")
-// .append("<REFNO>").append("201906211124000011").append("</REFNO>")
- .append("</DATA>")
- .append("</FORMDATA>");
- return String.format("%08d", xml.toString().length()) + xml.toString();
- }
-
-
-
-
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/controller/TestAction.java b/src/main/java/com/supwisdom/dlpay/api/controller/TestAction.java
deleted file mode 100644
index 9a2d51b..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/controller/TestAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.supwisdom.dlpay.api.controller;
-
-import com.supwisdom.dlpay.api.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.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-@Controller //将所有方法标识@ResponseBody注解
-@RequestMapping("/test")
-public class TestAction {
- @Autowired
- private SystemUtilService systemUtilService;
-
- @RequestMapping("/demo")
- @ResponseBody
- 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/java/com/supwisdom/dlpay/api/dao/PaytypeConfigDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeConfigDao.java
deleted file mode 100644
index 50cf1e1..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeConfigDao.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfigPK;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-@Repository
-public interface PaytypeConfigDao extends JpaRepository<TPaytypeConfig, TPaytypeConfigPK> {
- List<TPaytypeConfig> getByPaytype(String paytype);
-
- TPaytypeConfig getByPaytypeAndAndConfigid(String paytype, String configid);
-
- List<TPaytypeConfig> getByPaytypeOrderByConfigid(String paytype);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeConfigDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeConfigDao.java
deleted file mode 100644
index a7164c8..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeConfigDao.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface ShopPaytypeConfigDao extends JpaRepository<TShopPaytypeConfig, String> {
- @Query("select a from TShopPaytypeConfig a where a.paytype=?1 and a.shopaccno=?2 ")
- List<TShopPaytypeConfig> getShopPaytypeConfigs(String paytype, String shopaccno);
-
- @Query("select a from TShopPaytypeConfig a where a.shopaccno=?1 and a.paytype=?2 and a.configid=?3 ")
- TShopPaytypeConfig getShopPaytypeConfigById(String shopaccno,String paytype, String configid);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeDao.java
deleted file mode 100644
index 03196e1..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeDao.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TShopPaytype;
-import com.supwisdom.dlpay.api.domain.TShopPaytypePK;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface ShopPaytypeDao extends JpaRepository<TShopPaytype, TShopPaytypePK>, JpaSpecificationExecutor<TShopPaytype> {
- @Query("select a from TShopPaytype a where a.paytype=?1 and a.shopaccno=?2 ")
- TShopPaytype getById(String paytype, String shopaccno);
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TPaytypeConfig.java b/src/main/java/com/supwisdom/dlpay/api/domain/TPaytypeConfig.java
deleted file mode 100644
index 048cbb1..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TPaytypeConfig.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.supwisdom.dlpay.api.domain;
-
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-@Entity
-@Table(name = "TB_PAYTYPE_CONFIG")
-@IdClass(TPaytypeConfigPK.class)
-public class TPaytypeConfig {
- @Id
- @Column(name = "PAYTYPE", nullable = false, length = 20)
- private String paytype;
- @Id
- @Column(name = "CONFIGID", nullable = false, length = 40)
- private String configid;
-
- @Column(name = "CONFIG_VALUE", length = 2000)
- private String configValue;
-
- @Column(name = "CONFIG_NAME", length = 200)
- private String configName;
-
- @Column(name = "tenantid", length = 20)
- @NotNull
- private String tenantid = "";
-
- public String getPaytype() {
- return paytype;
- }
-
- public void setPaytype(String paytype) {
- this.paytype = paytype;
- }
-
- public String getConfigid() {
- return configid;
- }
-
- public void setConfigid(String configid) {
- this.configid = configid;
- }
-
- public String getConfigValue() {
- return configValue;
- }
-
- public void setConfigValue(String configValue) {
- this.configValue = configValue;
- }
-
- public String getConfigName() {
- return configName;
- }
-
- public void setConfigName(String configName) {
- this.configName = configName;
- }
-
- public String getTenantid() {
- return tenantid;
- }
-
- public void setTenantid(String tenantid) {
- this.tenantid = tenantid;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TPaytypeConfigPK.java b/src/main/java/com/supwisdom/dlpay/api/domain/TPaytypeConfigPK.java
deleted file mode 100644
index 8f7e46f..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TPaytypeConfigPK.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.supwisdom.dlpay.api.domain;
-
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-@Embeddable
-public class TPaytypeConfigPK implements Serializable {
- @Id
- @Column(name = "PAYTYPE", nullable = false, length = 20)
- private String paytype;
- @Id
- @Column(name = "CONFIGID", nullable = false, length = 40)
- private String configid;
-
- public String getPaytype() {
- return paytype;
- }
-
- public void setPaytype(String paytype) {
- this.paytype = paytype;
- }
-
- public String getConfigid() {
- return configid;
- }
-
- public void setConfigid(String configid) {
- this.configid = configid;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- TPaytypeConfigPK that = (TPaytypeConfigPK) o;
-
- if (!paytype.equals(that.paytype)) return false;
- return configid.equals(that.configid);
- }
-
- @Override
- public int hashCode() {
- int result = paytype.hashCode();
- result = 31 * result + configid.hashCode();
- return result;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytypePK.java b/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytypePK.java
deleted file mode 100644
index 4196b55..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytypePK.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.supwisdom.dlpay.api.domain;
-
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-@Embeddable
-public class TShopPaytypePK implements Serializable {
- @Id
- @Column(name = "SHOPACCNO", nullable = false, length = 10)
- private String shopaccno;
-
- @Id
- @Column(name = "PAYTYPE", nullable = false, length = 20)
- private String paytype;
-
- public TShopPaytypePK() {
- }
-
- public TShopPaytypePK(String shopaccno, String paytype) {
- this.shopaccno = shopaccno;
- this.paytype = paytype;
- }
-
- public String getShopaccno() {
- return shopaccno;
- }
-
- public void setShopaccno(String shopaccno) {
- this.shopaccno = shopaccno;
- }
-
- 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;
- TShopPaytypePK tShopPaytypePK = (TShopPaytypePK) o;
- if (shopaccno != null ? !shopaccno.equals(tShopPaytypePK.getShopaccno()) : shopaccno != null)
- return false;
- if (paytype != null ? !paytype.equals(tShopPaytypePK.getPaytype()) : paytype != null)
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = shopaccno != null ? shopaccno.hashCode() : 0;
- result = 31 * result + (paytype != null ? paytype.hashCode() : 0);
- return result;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java b/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java
deleted file mode 100644
index 86a9841..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.supwisdom.dlpay.api.service;
-
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Map;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-public interface SourceTypeService {
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- TSourceType getByPaytype(String paytype);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- Map<String, String> getPaytypeConfigByPaytype(String pattype);
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java b/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
deleted file mode 100644
index 60cf1a5..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.supwisdom.dlpay.api.service.impl;
-
-import com.supwisdom.dlpay.api.dao.PaytypeConfigDao;
-import com.supwisdom.dlpay.api.dao.SourceTypeDao;
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
-import com.supwisdom.dlpay.api.service.SourceTypeService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.CacheConfig;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-@Service
-@CacheConfig(cacheNames = "sourcetypeCache")
-public class SourceTypeServiceImpl implements SourceTypeService {
- @Autowired
- private SourceTypeDao paytypeDao;
- @Autowired
- private PaytypeConfigDao paytypeConfigDao;
-
- @Override
- @Cacheable
- public TSourceType getByPaytype(String paytype) {
- return paytypeDao.getOne(paytype);
- }
-
- @Override
- @Cacheable
- public Map<String, String> getPaytypeConfigByPaytype(String pattype) {
- List<TPaytypeConfig> list = paytypeConfigDao.getByPaytype(pattype);
- Map<String, String> map = new HashMap<>(list.size());
- for (TPaytypeConfig paytypeConfig : list) {
- map.put(paytypeConfig.getConfigid(), paytypeConfig.getConfigValue());
- }
- return map;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/exception/RequestParamCheckException.java b/src/main/java/com/supwisdom/dlpay/exception/RequestParamCheckException.java
deleted file mode 100644
index 328a08d..0000000
--- a/src/main/java/com/supwisdom/dlpay/exception/RequestParamCheckException.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.supwisdom.dlpay.exception;
-
-public class RequestParamCheckException extends Exception {
- private int errCode;
-
- public RequestParamCheckException(int errCode, String message) {
- super(String.format("Req-%d,%s", errCode, message));
- this.errCode = errCode;
- }
-
- public int getErrCode() {
- return errCode;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java
deleted file mode 100644
index efdd384..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TDictionary;
-import com.supwisdom.dlpay.framework.domain.TDictionaryPK;
-import org.springframework.cache.annotation.CacheConfig;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface DictionaryDao extends JpaRepository<TDictionary, TDictionaryPK> {
- List<TDictionary> findAllByDicttype(String dicttype);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/RoleDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/RoleDao.java
deleted file mode 100644
index 9ccc7c9..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/RoleDao.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TRole;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface RoleDao extends JpaRepository<TRole, String> {
- @Query("from TRole order by createtime asc ")
- List<TRole> getAllRoles();
-
- TRole findByRoleCode(String roleCode);
-
- Page<TRole> findAllByRoleNameContaining(String roleName, Pageable pageable);
-
- TRole findByRoleNameAndRoleIdNot(String roleName, String roleId);
-
- TRole findByRoleCodeAndRoleIdNot(String roleCode, String roleId);
-
- TRole findByRoleName(String roleName);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/TranstypeDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/TranstypeDao.java
deleted file mode 100644
index a276c61..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/TranstypeDao.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TTranstype;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface TranstypeDao extends JpaRepository<TTranstype, Integer> {
- TTranstype findByTranstype(Integer transtype);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionaryPK.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionaryPK.java
deleted file mode 100644
index 1dbb4c8..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionaryPK.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.supwisdom.dlpay.framework.domain;
-
-import javax.persistence.Column;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class TDictionaryPK implements Serializable {
- @Id
- @Column(name = "DICTTYPE", nullable = false)
- private String dicttype;
-
- @Id
- @Column(name = "DICTVAL", nullable = false, length = 30)
- private String dictval;
-
- public String getDicttype() {
- return dicttype;
- }
-
- public void setDicttype(String dicttype) {
- this.dicttype = dicttype;
- }
-
- public String getDictval() {
- return dictval;
- }
-
- public void setDictval(String dictval) {
- this.dictval = dictval;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- TDictionaryPK tDictionaryPK = (TDictionaryPK) o;
- if (dicttype != null ? !dicttype.equals(tDictionaryPK.getDicttype()) : dicttype != null)
- return false;
- if (dictval != null ? !dictval.equals(tDictionaryPK.getDictval()) : dictval != null)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = dicttype != null ? dicttype.hashCode() : 0;
- result = 31 * result + (dictval != null ? dictval.hashCode() : 0);
- return result;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TFeetypeConfig.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TFeetypeConfig.java
deleted file mode 100644
index ef85c21..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TFeetypeConfig.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.supwisdom.dlpay.framework.domain;
-
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
-
-@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;
-
- @Column(name = "tenantid", length = 20)
- @NotNull
- private String tenantId;
-
- 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/java/com/supwisdom/dlpay/framework/domain/TFeetypeConfigPK.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TFeetypeConfigPK.java
deleted file mode 100644
index 92fbf6a..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TFeetypeConfigPK.java
+++ /dev/null
@@ -1,51 +0,0 @@
-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/java/com/supwisdom/dlpay/framework/domain/TTranstype.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TTranstype.java
deleted file mode 100644
index 5a52e0b..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TTranstype.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.supwisdom.dlpay.framework.domain;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-
-@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;
-
- @Column(name = "tenantid", length = 20)
- @NotNull
- private String tenantId;
-
- 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;
- }
-
- public String getTenantId() {
- return tenantId;
- }
-
- public void setTenantId(String tenantId) {
- this.tenantId = tenantId;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/filter/ValidateCodeFilter.java b/src/main/java/com/supwisdom/dlpay/framework/filter/ValidateCodeFilter.java
deleted file mode 100644
index 7255657..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/filter/ValidateCodeFilter.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.supwisdom.dlpay.framework.filter;
-
-
-import com.supwisdom.dlpay.exception.ValidateCodeException;
-import com.supwisdom.dlpay.framework.security.MyAuthenticationFailureHandler;
-import com.supwisdom.dlpay.framework.security.validate.ImageCodeUtil;
-import com.supwisdom.dlpay.framework.security.validate.VerifyCode;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.filter.OncePerRequestFilter;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-
-@Component("validateCodeFilter")
-public class ValidateCodeFilter extends OncePerRequestFilter {
-
- /**
- * 校验失败处理器
- */
- @Autowired
- private MyAuthenticationFailureHandler myAuthenticationFailureHandler;
-
-
- @Override
- protected void doFilterInternal(HttpServletRequest request,
- HttpServletResponse response, FilterChain filterChain)
- throws ServletException, IOException {
- String context = request.getContextPath();
- if (context == null || "" == context.trim()) {
- context = "/";
- }
- if (request.getRequestURI().isEmpty()) {
- filterChain.doFilter(request, response);
- return;
- }
- String url = request.getRequestURI();
- if (!"/".equals(context)) {
- url = url.replace(context, "");
- }
- if (StringUtil.equals("/login/form", url)
- && StringUtil.equalsIgnoreCase(request.getMethod(), "post")) {
- try {
- validate(request);
- } catch (ValidateCodeException e) {
- //response.setStatus(HttpStatus.OK.value());
- //response.setContentType("application/json;charset=UTF-8");
- //response.getWriter().write(objectMapper.writeValueAsString(JsonResult.error(400, e.getMessage())));
- //response.sendError(HttpStatus.UNAUTHORIZED.value(),e.getMessage());
- myAuthenticationFailureHandler.onAuthenticationFailure(request, response, e);
- return;
- }
- }
- filterChain.doFilter(request, response);
- }
-
- private void validate(HttpServletRequest request) throws ValidateCodeException {
- VerifyCode imageCode = (VerifyCode) request.getSession().getAttribute(ImageCodeUtil.LOGIN_IMAGECODE_SESSIONKEY);
- String inputCode;
- try {
- inputCode = request.getParameter("imageCode");
- } catch (Exception e) {
- throw new ValidateCodeException("获取验证码的值失败");
- }
- if (StringUtil.isEmpty(inputCode)) {
- throw new ValidateCodeException("验证码不能为空");
- }
- if (null == imageCode) {
- throw new ValidateCodeException("验证码不存在");
- }
- if (imageCode.isExpired()) {
- request.getSession().removeAttribute(ImageCodeUtil.LOGIN_IMAGECODE_SESSIONKEY);
- throw new ValidateCodeException("验证码已过期");
- }
- if (!StringUtil.equalsIgnoreCase(imageCode.getText(), inputCode)) {
- throw new ValidateCodeException("验证码不匹配");
- }
- request.getSession().removeAttribute(ImageCodeUtil.LOGIN_IMAGECODE_SESSIONKEY);
- }
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/APIRequestParam.java b/src/main/java/com/supwisdom/dlpay/framework/util/APIRequestParam.java
deleted file mode 100644
index 14fc1d7..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/util/APIRequestParam.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.supwisdom.dlpay.framework.util;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.beans.Introspector;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-public abstract class APIRequestParam {
- @Sign
- private String sign;
- @Sign
- private String sign_type;
- @Sign
- private String version;
-
- private static final Logger logger = LoggerFactory.getLogger(APIRequestParam.class);
-
- public String getSign() {
- return sign;
- }
-
- public void setSign(String sign) {
- this.sign = sign;
- }
-
- public String getSign_type() {
- return sign_type;
- }
-
- public void setSign_type(String sign_type) {
- this.sign_type = sign_type;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- private boolean calcSignAndCheck(Map<String, String> map, String key) {
- String sign = map.get("sign");
- String signType = map.get("sign_type") == null ? "MD5" : map.get("sign_type");
- if (StringUtil.isEmpty(sign)) return false;
-
- String signdata = StringUtil.createLinkString(StringUtil.paraFilter(map));
- logger.info("signdata=[" + signdata + "]");
-
- String calcSign = null;
- //fixme: 根据 signType 计算签名
- if ("MD5".equalsIgnoreCase(signType)) {
- calcSign = MD5.encodeByMD5(signdata + key); //默认MD5
- }
-
- if (sign.equalsIgnoreCase(calcSign)) {
- return true;
- }
- return false;
- }
-
- public boolean checkSign(String key){
- Class clazz = this.getClass();
- Map<String, String> paramMap = new HashMap<>();
- Method[] allGetter = clazz.getMethods();
-
- for (Method meth : allGetter) {
- if (meth.getName().startsWith("get") || meth.getName().startsWith("is")) {
- String fieldName = Introspector.decapitalize(meth.getName().substring(meth.getName().startsWith("get") ? 3 : 2));
- Field field;
- try {
- field = clazz.getDeclaredField(fieldName);
- } catch (NoSuchFieldException e) {
- try {
- field = clazz.getSuperclass().getDeclaredField(fieldName);
- } catch (NoSuchFieldException e1) {
-// e1.printStackTrace();
- continue;
- }
- }
-
- if (field.isAnnotationPresent(Sign.class)) {
- Object value;
- try {
- value = meth.invoke(this);
- } catch (Exception e) {
- e.printStackTrace();
- continue;
- }
- paramMap.put(fieldName, value == null ? null : value.toString());
- }
- }
- }
- return calcSignAndCheck(paramMap,key);
- }
-
- public abstract boolean checkParam();
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java b/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java
deleted file mode 100644
index c6788d8..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.supwisdom.dlpay.framework.util;
-
-public class SysparaUtil {
- public static final String SYSPARA_VALUETYPE_AMOUNT = "amount"; //金额类型 Double
- public static final String SYSPARA_VALUETYPE_SWITCH = "switch"; //开关类型 Boolean 0/1
- public static final String SYSPARA_VALUETYPE_DATE = "date"; //日期类型 yyyyMMdd
- public static final String SYSPARA_VALUETYPE_DATETIME = "datetime"; //日期+时间 yyyyMMddHHmmss
- public static final String SYSPARA_VALUETYPE_DECIMAL = "decimal"; //数值
- public static final String SYSPARA_VALUETYPE_NUMBER = "number "; //整数,包含正负
- public static final String SYSPARA_VALUETYPE_STRING = "string"; //字符串
-
-
- public static final int SYSPARAID_NO1 = 1; //系统默认最大余额限制的ID
- public static final int SYSPARAID_NO2 = 2; //paraid=2
- public static final int SYSPARAID_NO3 = 3; //用户过期时间,单位秒
- public static final double SYSPARA_NO1_DEFAULT = 10000.0; // 系统默认最大余额限制
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/TradeCode.java b/src/main/java/com/supwisdom/dlpay/framework/util/TradeCode.java
deleted file mode 100644
index cc1b344..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/util/TradeCode.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.supwisdom.dlpay.framework.util;
-
-/**
- * 交易码、交易类型
- * */
-public class TradeCode {
- public static final int TRANSCODE_BALANCE_PAY = 3000; //账户余额支付
- public static final int TRANSCODE_CITIZENCARD_PAY=3010; //市民卡代扣消费
- public static final int TRANSCODE_YKTCARD_PAY=3020; //一卡通支付
-
-
- public static final int TRANSCODE_WECHAT=1001;
-
-
- public static final int TRANSCODE_ERCHARGE = 3500; //账户充值
-
-
-
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/XmlUtils.java b/src/main/java/com/supwisdom/dlpay/framework/util/XmlUtils.java
deleted file mode 100644
index 66deb65..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/util/XmlUtils.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.supwisdom.dlpay.framework.util;
-
-import org.dom4j.Document;
-import org.dom4j.DocumentHelper;
-import org.dom4j.Element;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class XmlUtils {
- public static <T> String getObjectToXml(T object) throws IOException {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-
- try {
- JAXBContext context = JAXBContext.newInstance(object.getClass());
- // 将对象转变为xml Object------XML
- // 指定对应的xml文件
- Marshaller marshaller = context.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_ENCODING, "gbk");//编码格式
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);// 是否格式化生成的xml串
- marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);// 是否省略xml头信息
-
- // 将对象转换为对应的XML文件
- marshaller.marshal(object, byteArrayOutputStream);
- } catch (JAXBException e) {
-
- e.printStackTrace();
- }
- // 转化为字符串返回
- String xmlContent = new String(byteArrayOutputStream.toByteArray(),
- "gbk");
- return xmlContent;
- }
-
- /*
- public static <T> T getXmlToObject(String xmlContent, Class clazz) {
- try {
- JAXBContext context = JAXBContext.newInstance(clazz);
- // xml转换为对象 XML------Object
- InputStream inputStream;
- try {
- inputStream = new ByteArrayInputStream(
- xmlContent.getBytes("GBK"));
- Unmarshaller um = context.createUnmarshaller();
-
- @Suppress("UNCHECKED_CAST")
- return (T) um.unmarshal(inputStream);
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }catch (Exception e) {
- e.printStackTrace();
- }
- } catch (JAXBException e) {
-
- e.printStackTrace();
- }
- return null;
- }
-
- public static <T> T getXmlToObject(String xmlContent,String charset, Class clazz) {
- try {
- JAXBContext context = JAXBContext.newInstance(clazz);
- // xml转换为对象 XML------Object
- InputStream inputStream;
- try {
- inputStream = new ByteArrayInputStream(
- xmlContent.getBytes(charset));
- Unmarshaller um = context.createUnmarshaller();
-
- return (T) um.unmarshal(inputStream);
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }catch (Exception e) {
- e.printStackTrace();
- }
- } catch (JAXBException e) {
-
- e.printStackTrace();
- }
- return null;
- }
- */
- public static Map<String, String> parseXml(String xml) throws Exception {
- Map<String, String> map = new HashMap<String, String>();
- Document document = DocumentHelper.parseText(xml);
- Element root = document.getRootElement();
- List<Element> elementList = root.elements();
- for (Element e : elementList)
- map.put(e.getName(), e.getText());
- return map;
- }
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java b/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
deleted file mode 100644
index a39aa52..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package com.supwisdom.dlpay.system.controller;
-
-import com.supwisdom.dlpay.api.bean.JsonResult;
-import com.supwisdom.dlpay.api.domain.TAccount;
-import com.supwisdom.dlpay.api.domain.TPerson;
-import com.supwisdom.dlpay.api.domain.TPersonIdentity;
-import com.supwisdom.dlpay.api.domain.TPointsAccount;
-import com.supwisdom.dlpay.framework.domain.TOperator;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.framework.util.WebConstant;
-import com.supwisdom.dlpay.system.bean.IdTypeBean;
-import com.supwisdom.dlpay.system.bean.PersonParamBean;
-import com.supwisdom.dlpay.system.service.UserDataService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@Controller
-public class UserController {
- @Autowired
- private UserDataService userDataService;
-
- @GetMapping("/user/index")
- public String index() {
- return "system/user/index";
- }
-
- @GetMapping("/user/list")
- @PreAuthorize("hasPermission('/user/list','')")
- @ResponseBody
- public PageResult<TPerson> getDataList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "searchkey", required = false) String searchKey) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- PersonParamBean searchBean = new PersonParamBean();
- searchBean.setPageNo(pageNo);
- searchBean.setName(searchKey);
- searchBean.setPageSize(pageSize);
- return userDataService.getPersonsByKey(searchBean);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @GetMapping("/user/loadadd")
- public String add(ModelMap map) {
- List<IdTypeBean> list = new ArrayList<>();
- list.add(new IdTypeBean("1", "身份证"));
- list.add(new IdTypeBean("2", "护照"));
- list.add(new IdTypeBean("3", "驾照"));
- list.add(new IdTypeBean("4", "港澳通行证"));
- list.add(new IdTypeBean("5", "学工号"));
- list.add(new IdTypeBean("9", "其他"));
- map.put("idtypes", list);
- return "system/user/add";
- }
-
- @PostMapping("/user/add")
- @PreAuthorize("hasPermission('/user/add','')")
- @ResponseBody
- public JsonResult add(@RequestBody TPerson person) {
- if (StringUtil.isEmpty(person.getName())
- || StringUtil.isEmpty(person.getSex())
- || StringUtil.isEmpty(person.getIdno())
- || StringUtil.isEmpty(person.getIdtype())
- || StringUtil.isEmpty(person.getMobile())) {
- return JsonResult.error("参数错误");
- }
- return userDataService.saveUser(person);
- }
-
- @PostMapping("/user/del")
- @PreAuthorize("hasPermission('/user/del','')")
- @ResponseBody
- public JsonResult del(@RequestParam String userid) {
- if (StringUtil.isEmpty(userid)) {
- return JsonResult.error("参数错误");
- }
- return userDataService.deleteUser(userid);
- }
-
- @GetMapping("/user/acc")
- public String acc() {
- return "system/user/account";
- }
-
- @GetMapping("/user/account")
- @PreAuthorize("hasPermission('/user/account','')")
- @ResponseBody
- public PageResult<TAccount> getDataAccountList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "searchkey", required = false) String searchKey) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- PersonParamBean searchBean = new PersonParamBean();
- searchBean.setPageNo(pageNo);
- searchBean.setName(searchKey);
- searchBean.setPageSize(pageSize);
- return userDataService.getAccountsByKey(searchBean);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @GetMapping("/user/point")
- public String point() {
- return "system/user/point";
- }
-
- @GetMapping("/user/pointlist")
- @PreAuthorize("hasPermission('/user/pointlist','')")
- @ResponseBody
- public PageResult<TPointsAccount> getDataPointList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "searchkey", required = false) String searchKey) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- PersonParamBean searchBean = new PersonParamBean();
- searchBean.setPageNo(pageNo);
- searchBean.setName(searchKey);
- searchBean.setPageSize(pageSize);
- return userDataService.getPointsByKey(searchBean);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @PostMapping("/user/delacc")
- @PreAuthorize("hasPermission('/user/delacc','')")
- @ResponseBody
- public JsonResult delacc(@RequestParam String accno) {
- if (StringUtil.isEmpty(accno)) {
- return JsonResult.error("参数错误");
- }
- return userDataService.closeAccount(accno);
- }
- @PostMapping("/user/delpoint")
- @PreAuthorize("hasPermission('/user/delpoint','')")
- @ResponseBody
- public JsonResult delpoint(@RequestParam String userid) {
- if (StringUtil.isEmpty(userid)) {
- return JsonResult.error("参数错误");
- }
- return userDataService.deletePoint(userid);
- }
- @GetMapping("/user/pointdtl")
- public String pointdtl(@RequestParam String userid,ModelMap map) {
- map.put("userid",userid);
- return "system/user/pointdtl";
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java
deleted file mode 100644
index 48cc4df..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.supwisdom.dlpay.system.service;
-
-import com.supwisdom.dlpay.framework.domain.TDictionary;
-import com.supwisdom.dlpay.framework.domain.TTranscode;
-
-import java.util.List;
-
-public interface DictionaryDataService {
- List<TDictionary> getDictionaryByDictType(String dicttype);
-
- List<TTranscode> getTransCode();
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
deleted file mode 100644
index 523bded..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.supwisdom.dlpay.system.service.impl;
-
-import com.supwisdom.dlpay.framework.dao.DictionaryDao;
-import com.supwisdom.dlpay.framework.dao.TranscodeDao;
-import com.supwisdom.dlpay.framework.domain.TDictionary;
-import com.supwisdom.dlpay.framework.domain.TTranscode;
-import com.supwisdom.dlpay.system.service.DictionaryDataService;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@Service
-public class DictionaryDataServiceImpl implements DictionaryDataService {
- private final DictionaryDao dictionaryDao;
- private final TranscodeDao transcodeDao;
-
- public DictionaryDataServiceImpl(DictionaryDao dictionaryDao,
- TranscodeDao transcodeDao) {
- this.dictionaryDao = dictionaryDao;
- this.transcodeDao = transcodeDao;
- }
-
- @Override
- @Cacheable(cacheNames = "dicationary_cache", key = "#p0")
- public List<TDictionary> getDictionaryByDictType(String dicttype) {
- List<TDictionary> list = dictionaryDao.findAllByDicttype(dicttype);
- if (!list.isEmpty()) {
- return list;
- }
- return new ArrayList<>();
- }
-
-
- @Override
- @Cacheable(cacheNames = "trans_code_cache")
- public List<TTranscode> getTransCode() {
- List<TTranscode> list = transcodeDao.findAll();
- if (!list.isEmpty()) {
- return list;
- }
- return new ArrayList<>();
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java b/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
deleted file mode 100644
index 6f56ce7..0000000
--- a/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.supwisdom.dlpay.util;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-public class ConstantUtil {
-
- public static final String ENABLE_YES = "yes";
- public static final String ENABLE_NO = "no";
-
- public static final String SEX_MALE = "male";
- public static final String SEX_FEMALE = "female";
-
- public static final String IDTYPE_IDENTITY = "1"; //身份证
- public static final String IDTYPE_PASSPORT = "2"; //护照
- public static final String IDTYPE_DRIVING_LICENSE = "3"; //驾照
- public static final String IDTYPE_HKM_PASS = "4"; //港澳通行证
- public static final String IDTYPE_STUEMPNO = "5"; //学工号
- public static final String IDTYPE_OTHER = "9"; //其他
- public static final String[] IDTYPE_DICTS = {"1", "2", "3", "4", "5", "9"}; //联动
-
- public static final int SHOPTYPE_GROUP = 0; //商户组
- public static final int SHOPTYPE_LEAF = 1; //末级商户,独立核算商户
-
- public static final String FEETYPE_DEFAULT = "none";
- public static final String FEETYPE_MEALER = "mealer";
- public static final String FEETYPE_DISCOUNT = "discount";
- public static final String[] FEETYPE_DICTS = {"none", "mealer", "discount"}; //联动
-
-
- /**
- * TDictionary的dicttype
- * */
- public static final int DICTTYPE_NO1 = 1; //冲正状态字典
- public static final int DICTTYPE_NO2 = 2; //流水状态字典
-
- /*
- * 页面ID
- * */
-
- public static final String PAGE_USERXIEYI = "xieyi";//用户协议页面
- public static final String PAGE_BANKXIEYI = "bankxieyi";//银行协议页面
-}
diff --git a/src/main/java/com/supwisdom/dlpay/util/PaytypeUtil.java b/src/main/java/com/supwisdom/dlpay/util/PaytypeUtil.java
deleted file mode 100644
index 8222e90..0000000
--- a/src/main/java/com/supwisdom/dlpay/util/PaytypeUtil.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.supwisdom.dlpay.util;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-public class PaytypeUtil {
- public static final String YKTPAY = "yktpay";
-
- public static final String WECHAT = "wechat";
-}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/PayApiApplication.kt b/src/main/kotlin/com/supwisdom/dlpay/PayApiApplication.kt
deleted file mode 100644
index 0181d2d..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/PayApiApplication.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.supwisdom.dlpay
-
-import io.lettuce.core.ReadFrom
-import org.springframework.beans.factory.annotation.Value
-import org.springframework.boot.autoconfigure.SpringBootApplication
-import org.springframework.boot.runApplication
-import org.springframework.cache.annotation.EnableCaching
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.data.redis.connection.RedisConnectionFactory
-import org.springframework.data.redis.connection.RedisPassword
-import org.springframework.data.redis.connection.RedisStandaloneConfiguration
-import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration
-import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory
-import org.springframework.data.redis.core.RedisTemplate
-import org.springframework.data.redis.repository.configuration.EnableRedisRepositories
-import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer
-import org.springframework.data.redis.serializer.StringRedisSerializer
-import org.springframework.scheduling.annotation.EnableScheduling
-
-
-@Configuration
-@EnableRedisRepositories
-class AppConfig {
-
- @Value("\${redis.server}")
- lateinit var server: String
-
- @Value("\${redis.port}")
- var port: Int = 0
-
- @Value("\${redis.database}")
- var database: Int = 0
-
- @Value("\${redis.password}")
- lateinit var password: String
-
- @Bean
- fun redisConnectionFactory(): RedisConnectionFactory {
- val clientConfig = LettuceClientConfiguration.builder()
- .readFrom(ReadFrom.SLAVE_PREFERRED)
- .build()
- val serverConfig = RedisStandaloneConfiguration(server, port)
- if (password.isNotEmpty()) {
- serverConfig.password = RedisPassword.of(password)
- }
- serverConfig.database = database
-
- return LettuceConnectionFactory(serverConfig, clientConfig)
- }
-}
-
-@Configuration
-class HttpSessionConfig {
- @Bean
- fun sessionRedisTemplate(
- connectionFactory: RedisConnectionFactory): RedisTemplate<Any, Any> {
- val template = RedisTemplate<Any, Any>()
- template.keySerializer = StringRedisSerializer()
- template.hashKeySerializer = StringRedisSerializer()
-
- template.setDefaultSerializer(GenericJackson2JsonRedisSerializer())
- template.setConnectionFactory(connectionFactory)
- return template
- }
-}
-
-
-
-@SpringBootApplication
-@EnableDiscoveryClient
-@EnableScheduling
-@EnableCaching
-class PayApiApplication
-
-fun main(args: Array<String>) {
- runApplication<PayApiApplication>(*args)
-}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/ThirdPayCall.kt b/src/main/kotlin/com/supwisdom/dlpay/api/ThirdPayCall.kt
deleted file mode 100644
index 3b5bd5e..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/ThirdPayCall.kt
+++ /dev/null
@@ -1,245 +0,0 @@
-package com.supwisdom.dlpay.api
-
-import com.google.gson.Gson
-import com.sun.jersey.api.client.Client
-import com.sun.jersey.api.client.ClientResponse
-import com.supwisdom.dlpay.api.bean.BaseResp
-import com.supwisdom.dlpay.api.bean.SupStatusRevResp
-import com.supwisdom.dlpay.api.bean.SupYktResp
-import com.supwisdom.dlpay.api.bean.WechatReqResp
-import com.supwisdom.dlpay.api.domain.TPersondtl
-import com.supwisdom.dlpay.api.domain.TShopdtl
-import com.supwisdom.dlpay.framework.util.*
-import com.supwisdom.dlpay.util.Code
-
-class CallBackResp {
- var retcode: String = "99"
- var retmsg: String? = null
- val data = mutableMapOf<String, String>()
- fun add(key: String, value: String) {
- this.data.plus(mapOf(key to value))
- }
-}
-
-class CallService {
-
- companion object {
- fun callYktPay(config: Map<String, String?>, paydtl: TPersondtl, time: String, stuempno: String, yktshopid: String, devphyid: String?): CallBackResp {
- val code = CallBackResp()
- val appid = config["appid"]
- if (appid.isNullOrEmpty()) {
- code.retcode = "1"
- code.retmsg = "一卡通支付方式未启用或未配置"
- return code
- }
-
- val appkey = config["appkey"]
- val orderurl = config["orderurl"]
-
- val params = hashMapOf<String, String?>()
- params.put("partner_id", appid)
- params.put("stuempno", stuempno)
- params.put("tradeno", paydtl.refno)
- params.put("tradename", paydtl.payinfo)
- params.put("amount", MoneyUtil.YuanToFen(paydtl.amount).toString())
- params.put("shopid", yktshopid)
- params.put("devphyid", devphyid)
- params.put("calcmanagefee", "T") //是否计算费率
- params.put("timestamp", time)
- params.put("sign_method", "HMAC");
- params.put("limitflag", "off") //是否判断消费限额,on-判断;off-不判断。默认on(判断限额)。为空或不为off都是on;
- var signstr = StringUtil.createLinkString(HmacUtil.paraFilter(params))
- val sign = HmacUtil.HMACSHA1(signstr, appkey)
- signstr = "$signstr&sign=$sign&sourcetype=food"
- val c = Client.create()
- c.setConnectTimeout(20000)
- val r = c.resource(orderurl)
- val respClient = r.post(ClientResponse::class.java, signstr)
- if (200 == respClient.status) {
- val ret = respClient.getEntity(String::class.java)
- if (ret != null) {
- try {
- val gson = Gson()
- val result = gson.fromJson(ret, SupYktResp::class.java)
- if (result == null) {
- code.retcode = "1"
- code.retmsg = "返回内容为空"
- return code
- }
- if ("0" != result.retcode) {
- if ("30" == result.retcode) {
- if (result.other != null) {
- try {
- val supStatusRevResp = gson.fromJson(result.other,
- SupStatusRevResp::class.java)
- if (supStatusRevResp != null) {
- //同流水号,同一笔已经支付完成的,不重复支付。
- if (3 == supStatusRevResp.status
- && supStatusRevResp.revflag != null
- && !supStatusRevResp.revflag) {
- code.retcode = "0"
- code.retmsg = "成功"
- return code
- }
- }
- } catch (e: Exception) {
- e.printStackTrace()
- }
- }
- }
- code.retcode = "1"
- code.retmsg = "交易失败:" + result.retmsg
- return code
- }
- code.retcode = "0"
- code.retmsg = "成功"
- return code
- } catch (e: Exception) {
- e.printStackTrace()
- }
- }
- }
- code.retcode = "1"
- code.retmsg = "请求失败"
- return code
- }
-
- fun callWechatPay(config: Map<String, String>, paydtl: TPersondtl, time: String, wechattype: String,
- realip: String?, qrcode: String?, openid: String?): BaseResp {
- val code = BaseResp()
- val appid = config["appid"]
- if (appid.isNullOrEmpty()) {
- code.retcode = "1"
- code.retmsg = "微信支付方式未启用或未配置"
- return code
- }
- val appkey = config["appkey"]
- val orderurl = config["orderurl"]
- val mchid = config["mchid"]
- val wechatReqResp = WechatReqResp()
- wechatReqResp.openid = openid
- wechatReqResp.appid = appid
- wechatReqResp.total_fee = MoneyUtil.YuanToFen(paydtl.amount)
- wechatReqResp.body = paydtl.payinfo
- wechatReqResp.key = appkey
- wechatReqResp.mch_id = mchid
- wechatReqResp.notify_url = config["notifyurl"] + "/notify/wechat"
- wechatReqResp.out_trade_no = paydtl.refno
- wechatReqResp.spbill_create_ip = realip
- val c = Client.create()
- c.setConnectTimeout(20000)
- return when (wechattype) {
- "qrcode" -> {
- code
- }
- "app" -> {
- wechatReqResp.trade_type = "APP"
- code
- }
- "mp" -> {
- wechatReqResp.trade_type = "JSAPI"
- wechatReqResp.generaSign()
- val xml = wechatReqResp.generaXML()
- val r = c.resource(orderurl)
- val respClient = r.post(ClientResponse::class.java, xml)
- if (200 == respClient.status) {
- try {
- val ret = respClient.getEntity(String::class.java)
- if (ret != null) {
- val eleMap = XmlUtils.parseXml(ret)
- val retcode = eleMap["return_code"]
- val result_code = eleMap["result_code"]
- val prepay_id = eleMap["prepay_id"]
- if (!retcode.isNullOrEmpty() && "SUCCESS" == retcode
- && !result_code.isNullOrEmpty() && "SUCCESS" == result_code
- && !prepay_id.isNullOrEmpty()) {
- wechatReqResp.retcode = 0
- wechatReqResp.retmsg = "初始化成功"
- wechatReqResp.prepay_id = prepay_id
- //TODO prepay_id 是否保存
- wechatReqResp.timestamp = DateUtil.getNowSecond().toString()
- wechatReqResp.nonce_str = RandomUtils.getRandomString(30)
- wechatReqResp.generaJSAPISign()
- val params = wechatReqResp.generaJSAPIParamters()
- code.setCode(Code.SUCCESS)
- code.data = params
- } else {
- code.retcode = "1"
- code.retmsg = eleMap["return_msg"]
- }
- } else {
- code.retcode = "1"
- code.retmsg = "微信支付请求失败"
- }
- } catch (e: Exception) {
- e.printStackTrace()
- code.retcode = "1"
- code.retmsg = "微信支付请求异常"
- }
-
- } else {
- code.retcode = "1"
- code.retmsg = "微信支付请求返回失败"
- }
- code
- }
- "h5" -> {
- wechatReqResp.trade_type = "MWEB"
- wechatReqResp.scene_info = "{\"h5_info\": {\"type\":\"Wap\",\"wap_url\": \"" + config["notifyurl"] + "\",\"wap_name\": \"${paydtl.payinfo}\"}}"
- val xml = wechatReqResp.generaXML()
- val r = c.resource(orderurl)
- val respClient = r.post(ClientResponse::class.java, xml)
- if (200 == respClient.status) {
- try {
- val ret = respClient.getEntity(String::class.java)
- if (ret != null) {
- val eleMap = XmlUtils.parseXml(ret)
- val retcode = eleMap["return_code"]
- val result_code = eleMap["result_code"]
- val prepay_id = eleMap["prepay_id"]
- val mweb_url = eleMap["mweb_url"]
- if (!retcode.isNullOrEmpty() && "SUCCESS" == retcode
- && !result_code.isNullOrEmpty() && "SUCCESS" == result_code
- && !prepay_id.isNullOrEmpty()) {
- wechatReqResp.retcode = 0
- wechatReqResp.retmsg = "初始化成功"
- wechatReqResp.prepay_id = prepay_id
- wechatReqResp.mweb_url = mweb_url
- code.setCode(Code.SUCCESS)
- code.data = mweb_url
- } else {
- code.retcode = "1"
- code.retmsg = eleMap["return_msg"]
- }
- } else {
- code.retcode = "1"
- code.retmsg = "微信支付请求失败"
- }
- } catch (e: Exception) {
- e.printStackTrace()
- code.retcode = "1"
- code.retmsg = "微信支付请求异常"
- }
-
- } else {
- code.retcode = "1"
- code.retmsg = "微信支付请求返回失败"
- }
- code
- }
- else -> {
- code.retcode = "1"
- code.retmsg = "未标识的类型:wechattype=$wechattype"
- code
- }
- }
- }
-
- fun CallCitizenCardPay(config: Map<String, String?>, paydtl: TShopdtl): CallBackResp {
- val resp = CallBackResp()
- resp.retcode = "0"
- // TODO: 代扣逻辑
- return resp
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt b/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt
deleted file mode 100644
index 092fde8..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.supwisdom.dlpay.api
-
-import com.supwisdom.dlpay.exception.RequestParamCheckException
-import com.supwisdom.dlpay.exception.TransactionCheckException
-import com.supwisdom.dlpay.exception.TransactionException
-import com.supwisdom.dlpay.framework.ResponseBodyBuilder
-import com.supwisdom.dlpay.framework.service.CommonService
-import com.supwisdom.dlpay.framework.util.APIRequestParam
-import com.supwisdom.dlpay.framework.util.TradeErrorCode
-import mu.KotlinLogging
-import org.aspectj.lang.ProceedingJoinPoint
-import org.aspectj.lang.annotation.Around
-import org.aspectj.lang.annotation.Aspect
-import org.aspectj.lang.annotation.Pointcut
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.beans.factory.annotation.Value
-import org.springframework.http.ResponseEntity
-import org.springframework.security.core.Authentication
-import org.springframework.security.core.context.SecurityContextHolder
-import org.springframework.stereotype.Component
-import org.springframework.web.bind.annotation.ExceptionHandler
-import org.springframework.web.bind.annotation.RestControllerAdvice
-import java.lang.reflect.UndeclaredThrowableException
-import javax.servlet.http.HttpServletRequest
-
-
-@RestControllerAdvice("com.supwisdom.dlpay.api")
-class RestControllerAdvice {
- val logger = KotlinLogging.logger { }
-
- @ExceptionHandler
- fun handleException(ex: Exception, request: HttpServletRequest): ResponseEntity<Any> {
- logger.error { "Request unhandler exception, url<${request.requestURI}>, ex<${ex.cause}>" }
- val undeclared = if (ex is UndeclaredThrowableException) ex.undeclaredThrowable else ex
- if (undeclared is RequestParamCheckException) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .requestException(undeclared, "请求参数错误"))
- } else if (undeclared is TransactionException) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .exception(undeclared.code(), undeclared, "业务处理错误"))
- }
-
- return ResponseEntity.ok().body(ResponseBodyBuilder.create()
- .exception(TradeErrorCode.BUSINESS_DEAL_ERROR, undeclared, "业务处理报错"))
- }
-}
-
-@Component
-@Aspect
-class RestControllerAspect {
- @Autowired
- lateinit var commonService: CommonService
-
- @Value("\${security.request.sign: true}")
- private var requestSignCheck: Boolean = true
-
- private val logger = KotlinLogging.logger { }
-
- @Pointcut("@within(org.springframework.web.bind.annotation.RestController)")
- fun restcontroller() {
- }
-
- @Pointcut("@annotation(org.springframework.web.bind.annotation.PostMapping)")
- fun postmapping() {
- }
-
- @Around("restcontroller() && postmapping() && args(@RequestBody body, ..)")
- @Throws(Throwable::class)
- fun logPostMethods(joinPoint: ProceedingJoinPoint, body: Any): Any {
- return try {
- if (body is APIRequestParam) {
- body.checkParam()
-
- if (requestSignCheck &&
- !body.checkSign(commonService.getSecretByAppid(
- SecurityContextHolder.getContext().authentication.name))) {
- throw RequestParamCheckException(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误")
- }
- } else {
- throw TransactionCheckException(TradeErrorCode.REQUEST_PARAM_EEROR, "请求参数实体位置错误")
- }
-
- val result = joinPoint.proceed()
- logger.debug(result.toString())
- result
- } catch (t: Throwable) {
- logger.error { "request error , ex<${t.message}>" }
- throw t
- }
- }
-}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/async_tasks.kt b/src/main/kotlin/com/supwisdom/dlpay/api/async_tasks.kt
deleted file mode 100644
index 83bfde8..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/async_tasks.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.supwisdom.dlpay.api
-
-import com.supwisdom.dlpay.api.repositories.ShopaccService
-import mu.KotlinLogging
-import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.scheduling.annotation.Async
-import org.springframework.scheduling.annotation.AsyncConfigurer
-import org.springframework.scheduling.annotation.EnableAsync
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
-import org.springframework.stereotype.Component
-import java.lang.reflect.Method
-import java.util.concurrent.Executor
-
-@Configuration
-@EnableAsync
-class SpringAsyncConfig : AsyncConfigurer {
- @Bean("shopAccBalanceUpdater")
- fun threadPoolExecutor(): Executor {
- return ThreadPoolTaskExecutor().apply {
- corePoolSize = 5
- maxPoolSize = 10
- setWaitForTasksToCompleteOnShutdown(true)
- }
- }
-
- override fun getAsyncUncaughtExceptionHandler(): AsyncUncaughtExceptionHandler? {
- return MyAsyncUncaughtExceptionHandler()
- }
-}
-
-class MyAsyncUncaughtExceptionHandler : AsyncUncaughtExceptionHandler {
- private val logger = KotlinLogging.logger { }
- override fun handleUncaughtException(ex: Throwable, method: Method, vararg params: Any?) {
- logger.error { "Async Task execute error: <${method.name}>, exception <${ex.message}>" }
- }
-}
-
-
-@Component
-class ShopAccBalanceAsyncTask {
- private val logger = KotlinLogging.logger { }
-
- @Autowired
- private lateinit var shopaccService: ShopaccService
-
- @Async("shopAccBalanceUpdater")
- fun updateShopBalance(shopdtlRefno: String) {
- shopaccService.recalcShopBalance(shopdtlRefno, true)
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt b/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt
deleted file mode 100644
index 447a3f2..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt
+++ /dev/null
@@ -1,357 +0,0 @@
-package com.supwisdom.dlpay.api.bean
-
-import com.supwisdom.dlpay.exception.RequestParamCheckException
-import com.supwisdom.dlpay.framework.util.*
-import com.supwisdom.dlpay.util.ConstantUtil
-
-// ============================ USER ============================ //
-class OpenUserParam : APIRequestParam() {
- @Sign
- var uid: String = "" //第三方用户ID,必传
- @Sign
- var name: String = "" //必传
- @Sign
- var sex: String? = null
- @Sign
- var idtype: String = "" //必传
- @Sign
- var idno: String = "" //必传
- @Sign
- var mobile: String? = null
- @Sign
- var tel: String? = null
- @Sign
- var email: String? = null
- @Sign
- var address: String? = null
- @Sign
- var zipcode: String? = null
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(uid)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "用户唯一号不能为空")
- if (StringUtil.isEmpty(name)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "姓名不能为空")
- if (!StringUtil.isEmpty(sex) && ConstantUtil.SEX_MALE != sex && ConstantUtil.SEX_FEMALE != sex) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "性别非法[male|female]")
- if (StringUtil.isEmpty(idtype) || !ConstantUtil.IDTYPE_DICTS.contains(idtype)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件类型非法")
- if (StringUtil.isEmpty(idno) || !StringUtil.isCharAndNum(idno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件号不能为空,且仅支持数字和字母")
- if (ConstantUtil.IDTYPE_IDENTITY == idtype && !StringUtil.isIdentity(idno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "身份证格式错误")
- if (!StringUtil.isEmpty(mobile) && !StringUtil.isMobile(mobile)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "手机号格式错误")
- if (!StringUtil.isEmpty(email) && !StringUtil.isEmail(email)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "邮箱格式错误")
-
- return true
- }
-}
-
-class QueryUserParam : APIRequestParam() {
- @Sign
- var userid: String? = null // 用户ID二选一 (两者都传取userid)
- @Sign
- var uid: String? = null // 用户ID二选一
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(userid) && StringUtil.isEmpty(uid)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "用户唯一号不能为空")
-
- return true
- }
-}
-
-class ModifyUserParam : APIRequestParam() {
- @Sign
- var userid: String? = null // 用户ID二选一 (两者都传取userid)
- @Sign
- var uid: String? = null // 用户ID二选一
- @Sign
- var name: String? = null
- @Sign
- var sex: String? = null
- @Sign
- var idtype: String? = null
- @Sign
- var idno: String? = null
- @Sign
- var mobile: String? = null
- @Sign
- var tel: String? = null
- @Sign
- var email: String? = null
- @Sign
- var address: String? = null
- @Sign
- var zipcode: String? = null
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(userid) && StringUtil.isEmpty(uid)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "用户唯一号不能为空")
- if (!StringUtil.isEmpty(sex) && ConstantUtil.SEX_MALE != sex && ConstantUtil.SEX_FEMALE != sex) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "性别非法[male|female]")
- if (!StringUtil.isEmpty(idtype) && !ConstantUtil.IDTYPE_DICTS.contains(idtype)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件类型非法")
- if (!StringUtil.isEmpty(idno) && !StringUtil.isCharAndNum(idno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件号不能为空,且仅支持数字和字母")
- if (!StringUtil.isEmpty(idno) && StringUtil.isEmpty(idtype)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件号不能为空时,请指定证件类型")
- if (!StringUtil.isEmpty(idno) && ConstantUtil.IDTYPE_IDENTITY == idtype && !StringUtil.isIdentity(idno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "身份证格式错误")
- if (!StringUtil.isEmpty(mobile) && !StringUtil.isMobile(mobile)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "手机号格式错误")
- if (!StringUtil.isEmpty(email) && !StringUtil.isEmail(email)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "邮箱格式错误")
-
- return true
- }
-}
-
-
-// ============================ SHOP ============================ //
-class OpenShopParam : APIRequestParam() {
- @Sign
- var shopUniqueId: String = "" //必传
- @Sign
- var shoptype: Int = 1
- @Sign
- var fshopid: Int? = null
- @Sign
- var shopname: String = "" //必传
- @Sign
- var contactman: String? = null
- @Sign
- var idtype: String? = null
- @Sign
- var idno: String? = null
- @Sign
- var mobile: String? = null
- @Sign
- var email: String? = null
- @Sign
- var address: String? = null
- @Sign
- var zipcode: String? = null
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(shopUniqueId)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "商户唯一号不能为空")
- if (ConstantUtil.SHOPTYPE_GROUP != shoptype && ConstantUtil.SHOPTYPE_LEAF != shoptype) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "请指定商户类型")
- if (StringUtil.isEmpty(shopname)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "商户名称不能为空")
- if (!StringUtil.isEmpty(idtype) && !ConstantUtil.IDTYPE_DICTS.contains(idtype)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件类型非法")
- if (!StringUtil.isEmpty(idno) && !StringUtil.isCharAndNum(idno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件号不能为空,且仅支持数字和字母")
- if (!StringUtil.isEmpty(idno) && StringUtil.isEmpty(idtype)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件号不能为空时,请指定证件类型")
- if (!StringUtil.isEmpty(mobile) && !StringUtil.isMobile(mobile)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "手机号格式错误")
- if (!StringUtil.isEmpty(email) && !StringUtil.isEmail(email)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "邮箱格式错误")
-
- return true
- }
-}
-
-class QueryShopParam : APIRequestParam() {
- @Sign
- var shopid: Int? = null //注册时返回的shopid
- @Sign
- var shopaccno: String? = null //注册时返回的shopaccno
- @Sign
- var shopUniqueId: String? = null //注册传的商户唯一号
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(shopUniqueId) && null == shopid && StringUtil.isEmpty(shopaccno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "商户唯一标志不能为空")
-
- return true
- }
-}
-
-
-// ============================ CONSUME ============================ //
-class ConsumeFeetype {
- var feetype: String = ""
- var amount: Int = 0
-
- override fun toString(): String {
- return "{feetype='$feetype', amount=$amount}"
- }
-}
-
-class QueryDtlResultParam : APIRequestParam() {
- @Sign
- var refno: String? = null //二选一
- @Sign
- var billno: String? = null //二选一 (billno+shopaccno) 传billno时,shopaccno必传
- @Sign
- var shopaccno: String? = null
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(refno) && (StringUtil.isEmpty(billno) || StringUtil.isEmpty(shopaccno))) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "流水唯一号不能为空")
-
- return true
- }
-}
-
-class CitizenCardPayinitParam : APIRequestParam() {
- @Sign
- var cardNo: String = "" //必传
- @Sign
- var shopaccno: String = "" //必传
- @Sign
- var amount: Int = 0 //必传
-
- var feelist: List<ConsumeFeetype>? = null //TODO: 怎么拼接签名字符串??
- @Sign
- var billno: String = "" //必传
- @Sign
- var transdate: String = "" //必传
- @Sign
- var transtime: String = "" //必传
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(cardNo)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "卡唯一号不能为空")
- if (StringUtil.isEmpty(shopaccno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "请指定交易商户")
- if (amount <= 0) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易金额必须大于零")
- if (StringUtil.isEmpty(billno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "对接系统唯一订单号不能为空")
- if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易日期错误[yyyyMMdd]")
- if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易时间错误[HHmmss]")
-
- return true
- }
-}
-
-class CitizenCardPayfinishParam : APIRequestParam() {
- @Sign
- var refno: String = ""
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(refno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易参考号不能为空")
-
- return true
- }
-}
-
-class YktCardPayinitParam : APIRequestParam() {
- @Sign
- var uid: String? = null //未注册,可能不传
- @Sign
- var shopaccno: String = "" //必传
- @Sign
- var amount: Int = 0 //必传
-
- var feelist: List<ConsumeFeetype>? = null //TODO: 怎么拼接签名字符串??
- @Sign
- var billno: String = "" //必传
- @Sign
- var transdate: String = "" //必传
- @Sign
- var transtime: String = "" //必传
- @Sign
- var stuempno: String = "" //必传
- @Sign
- var yktshopid: String? = null
- @Sign
- var devphyid: String? = null
-
- override fun checkParam(): Boolean {
-
- if (StringUtil.isEmpty(shopaccno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "请指定交易商户")
- if (amount <= 0) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易金额必须大于零")
- if (StringUtil.isEmpty(billno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "对接系统唯一订单号不能为空")
- if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易日期错误[yyyyMMdd]")
- if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易时间错误[HHmmss]")
- if (StringUtil.isEmpty(stuempno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "一卡通唯一号不能为空")
- if (!StringUtil.isEmpty(yktshopid) && !NumberUtil.isDigits(yktshopid)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "一卡通商户号非整数")
-
- return true
- }
-}
-
-class ConsumePayCancelParam : APIRequestParam() {
- @Sign
- var refno: String? = null //流水号
- @Sign
- var billno: String? = null //订单号
- @Sign
- var shopaccno: String? = null //商户号
- @Sign
- var requestbillno: String = "" //退款请求唯一标识
- @Sign
- var transdate: String = "" //必传
- @Sign
- var transtime: String = "" //必传
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(refno) && (StringUtil.isEmpty(billno) || StringUtil.isEmpty(shopaccno))) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "原流水唯一号不能为空")
- if (StringUtil.isEmpty(requestbillno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "撤销或退款流水号不能为空")
- if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易日期错误[yyyyMMdd]")
- if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易时间错误[HHmmss]")
-
- return true
- }
-}
-
-class ConsumePayRefundParam : APIRequestParam() {
- @Sign
- var refno: String? = null //流水号
- @Sign
- var billno: String? = null //订单号
- @Sign
- var shopaccno: String? = null //商户号
-
- @Sign
- var refundAmount: Int = 0 // 退款金额
-
- @Sign
- var requestbillno: String = "" //退款请求唯一标识
- @Sign
- var transdate: String = "" //必传
- @Sign
- var transtime: String = "" //必传
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(refno) && (StringUtil.isEmpty(billno) || StringUtil.isEmpty(shopaccno))) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "原流水唯一号不能为空")
- if (StringUtil.isEmpty(requestbillno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "撤销或退款流水号不能为空")
- if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易日期错误[yyyyMMdd]")
- if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易时间错误[HHmmss]")
-
- return true
- }
-}
-
-
-// ============================ RECHARGE ============================ //
-class CommonRechargeInitParam : APIRequestParam() {
- @Sign
- var userid: String = "" //用户ID
- @Sign
- var amount: Int = 0 //必传
-
- var feelist: List<ConsumeFeetype>? = null //TODO: 怎么拼接签名字符串??
- @Sign
- var sourcetype: String = "" //必传,充值方式
- @Sign
- var billno: String = "" //必传
- @Sign
- var transdate: String = "" //必传
- @Sign
- var transtime: String = "" //必传
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(userid)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "请指定充值用户")
- if (amount <= 0) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "充值金额必须大于零")
- if (StringUtil.isEmpty(sourcetype)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "请指定充值的支付方式")
- if (StringUtil.isEmpty(billno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "对接系统唯一订单号不能为空")
- if (!DateUtil.checkDatetimeValid(transdate, DateUtil.DATE_FMT)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易日期错误[yyyyMMdd]")
- if (!DateUtil.checkDatetimeValid(transtime, DateUtil.TIME_FMT)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "交易时间错误[HHmmss]")
-
- return true
- }
-}
-
-class CommonRechargeConfirmParam : APIRequestParam() {
- @Sign
- var refno: String = "" //流水号
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(refno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "流水号不能为空")
-
- return true
- }
-}
-
-class CommonQueryRechargeResultParam : APIRequestParam() {
- @Sign
- var refno: String? = null //流水号
- @Sign
- var billno: String? = null
-
- override fun checkParam(): Boolean {
- if (StringUtil.isEmpty(refno) && StringUtil.isEmpty(billno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "流水号不能为空")
-
- return true
- }
-}
-
-
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt b/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
deleted file mode 100644
index 9e0ebd5..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
+++ /dev/null
@@ -1,463 +0,0 @@
-package com.supwisdom.dlpay.api.controller
-
-import com.supwisdom.dlpay.api.AccountProxy
-import com.supwisdom.dlpay.api.CallService
-import com.supwisdom.dlpay.api.TransactionBuilder
-import com.supwisdom.dlpay.api.bean.*
-import com.supwisdom.dlpay.api.service.AccountUtilServcie
-import com.supwisdom.dlpay.api.service.ConsumePayService
-import com.supwisdom.dlpay.api.service.TransactionServiceProxy
-import com.supwisdom.dlpay.api.service.UserService
-import com.supwisdom.dlpay.framework.ResponseBodyBuilder
-import com.supwisdom.dlpay.framework.service.SystemUtilService
-import com.supwisdom.dlpay.framework.util.Subject
-import com.supwisdom.dlpay.framework.util.TradeCode
-import com.supwisdom.dlpay.framework.util.TradeDict
-import com.supwisdom.dlpay.framework.util.TradeErrorCode
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.http.ResponseEntity
-import org.springframework.web.bind.annotation.PostMapping
-import org.springframework.web.bind.annotation.RequestBody
-import org.springframework.web.bind.annotation.RequestMapping
-import org.springframework.web.bind.annotation.RestController
-
-@RestController
-@RequestMapping("/api/consume")
-class ConsumeAPIController {
- @Autowired
- lateinit var accountUtilServcie: AccountUtilServcie
- @Autowired
- lateinit var userService: UserService
- @Autowired
- lateinit var systemUtilService: SystemUtilService
- @Autowired
- lateinit var consumePayService: ConsumePayService
- @Autowired
- lateinit var transactionService: TransactionServiceProxy
-
- /**
- * ============================================================================
- * 消费流水结果查询统一接口
- * ============================================================================
- * */
- @PostMapping("/queryresult")
- fun queryDtlResult(@RequestBody param: QueryDtlResultParam): ResponseEntity<Any> {
- consumePayService.getTransactionMainDtl(param.refno, param.billno, param.shopaccno)?.let {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("refno", it.refno)
- .data("billno", it.outTradeNo)
- .data("amount", it.shopDtl.amount)
- .data("status", it.status)
- .data("sourcetype", it.personDtl.sourceType)
- .data("payinfo", it.personDtl.payinfo)
- .data("reverseflag", it.reverseFlag)
- .data("transdesc", it.shopDtl.transdesc)
- .success("查询成功"))
- } ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.TRANSACTION_NOT_EXISTS, "流水不存在"))
- }
-
- /**
- * ============================================================================
- * 账户【余额支付】
- * ============================================================================
- * */
- @PostMapping("/balance/pay")
- fun balancePay(@RequestBody param: CitizenCardPayinitParam): ResponseEntity<Any> {
- val person = userService.findPersonByIdentityCheckStatus(param.cardNo)
- if (consumePayService.checkShopPaytype(param.shopaccno, TradeDict.PAYTYPE_BALANCE)) {
- val account = accountUtilServcie.readAccount(person.userid)
- val shopacc = accountUtilServcie.readShopbyShopaccno(param.shopaccno)
-
- val dtl = TransactionBuilder().apply {
- setTransInfo(param.transdate, param.transtime,
- TradeCode.TRANSCODE_BALANCE_PAY,
- TradeDict.PAYTYPE_BALANCE)
- setOutTransInfo(shopacc.shopaccno, param.billno)
- operator(param.shopaccno, TradeDict.OPERTYPE_SHOP)
- payinfo = param.cardNo //fixme: 卡号或其他唯一信息
- description = "账户余额消费"
- }.person(account).apply {
- setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_OUT)
- setOpposite(AccountProxy(shopacc))
- }.and().shop(shopacc).apply {
- setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_IN)
- setOpposite(AccountProxy(account))
- }.and().addDebitCreditRecord(AccountProxy(account), AccountProxy(shopacc),
- param.amount / 100.0, "账户余额消费")
- .also {
- param.feelist?.also {
- TODO("feelist 费用清单未实现!")
- }
-// param.feelist?.forEach {
-// val feeamt = it.amount / 100.0
-// when (it.feetype) {
-// TradeDict.FEETYPE_CONSUME_MEALER -> {
-// //搭伙费
-// val feetypeConfig = accountUtilServcie.readFeetype(TradeDict.FEETYPE_CONSUME_MEALER, TradeDict.PAYTYPE_BALANCE)
-// val subject = accountUtilServcie.readSubject(feetypeConfig.crsubjno) //不同在贷方科目
-// when (Subject.SUBJNO_MACHANT_INCOME == subject.subjno) {
-// true -> builder.addDebitCreditRecord(AccountProxy(account), AccountProxy(shopacc), feeamt, feetypeConfig.summary) //商户收
-// false -> builder.addDebitCreditRecord(AccountProxy(account), AccountProxy(subject), feeamt, feetypeConfig.summary) //其他科目
-// }
-// }
-// TradeDict.FEETYPE_CONSUME_DISCOUNT -> {
-// //优惠折扣
-// val feetypeConfig = accountUtilServcie.readFeetype(TradeDict.FEETYPE_CONSUME_DISCOUNT, TradeDict.PAYTYPE_BALANCE)
-// val subject = accountUtilServcie.readSubject(feetypeConfig.drsubjno) //不同在借方科目
-// builder.addDebitCreditRecord(AccountProxy(subject), AccountProxy(shopacc), feeamt, feetypeConfig.summary)
-//
-// }
-// else -> throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR,
-// "账户余额支付费用清单不支持feetype<${it.feetype}>")
-// }
-// }
- }.init(transactionService)
-
- transactionService.success(dtl.refno)
-
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("refno", dtl.refno)
- .data("billno", dtl.outTradeNo)
- .data("amount", dtl.personDtl.amount)
- .success("交易成功"))
- }
-
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.BUSINESS_PAYTYPE_NOSUPPORT, "不支持支付方式<账户余额>"))
- }
-
-
- /**
- * ============================================================================
- * 市民卡【交易初始化】
- * ============================================================================
- * */
- @PostMapping("/citizencard/payinit")
- fun citizencardPayinit(@RequestBody param: CitizenCardPayinitParam): ResponseEntity<Any> {
- val person = userService.findPersonByIdentityCheckStatus(param.cardNo)
- if (consumePayService.checkShopPaytype(param.shopaccno, TradeDict.PAYTYPE_CITIZEN_CARD)) {
-
- val account = accountUtilServcie.readAccount(person.userid)
- val shopacc = accountUtilServcie.readShopbyShopaccno(param.shopaccno)
- val subject = accountUtilServcie.readSubject(Subject.SUBJNO_PAY_CITIZEN_CARD)
- val transaction = TransactionBuilder().apply {
- setTransInfo(param.transdate, param.transtime,
- TradeCode.TRANSCODE_CITIZENCARD_PAY,
- TradeDict.PAYTYPE_CITIZEN_CARD)
- setOutTransInfo(shopacc.shopaccno, param.billno)
- operator(param.shopaccno, TradeDict.OPERTYPE_SHOP)
- payinfo = param.cardNo
- description = "市民卡代扣消费"
- }.person(account).apply {
- setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_OUT)
- setOpposite(AccountProxy(shopacc))
- }.and().shop(shopacc).apply {
- setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_IN)
- setOpposite(AccountProxy(account))
- }.and().addDebitCreditRecord(AccountProxy(subject), AccountProxy(account),
- param.amount / 100.0, "市民卡代扣消费")
- .addDebitCreditRecord(AccountProxy(account), AccountProxy(shopacc),
- param.amount / 100.0, "市民卡代扣消费")
- .also {
- param.feelist?.also {
- TODO("feelist 费用清单未实现!")
- }
-// param.feelist?.forEach {
-// val feeamt = it.amount / 100.0
-// when (it.feetype) {
-// TradeDict.FEETYPE_CONSUME_MEALER -> {
-// //搭伙费
-// val feetypeConfig = accountUtilServcie.readFeetype(TradeDict.FEETYPE_CONSUME_MEALER, TradeDict.PAYTYPE_BALANCE)
-// val subject = accountUtilServcie.readSubject(feetypeConfig.crsubjno) //不同在贷方科目
-// when (Subject.SUBJNO_MACHANT_INCOME == subject.subjno) {
-// true -> builder.addDebitCreditRecord(AccountProxy(account), AccountProxy(shopacc), feeamt, feetypeConfig.summary) //商户收
-// false -> builder.addDebitCreditRecord(AccountProxy(account), AccountProxy(subject), feeamt, feetypeConfig.summary) //其他科目
-// }
-// }
-// TradeDict.FEETYPE_CONSUME_DISCOUNT -> {
-// //优惠折扣
-// val feetypeConfig = accountUtilServcie.readFeetype(TradeDict.FEETYPE_CONSUME_DISCOUNT, TradeDict.PAYTYPE_BALANCE)
-// val subject = accountUtilServcie.readSubject(feetypeConfig.drsubjno) //不同在借方科目
-// builder.addDebitCreditRecord(AccountProxy(subject), AccountProxy(shopacc), feeamt, feetypeConfig.summary)
-//
-// }
-// else -> throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR,
-// "账户余额支付费用清单不支持feetype<${it.feetype}>")
-// }
-//
-// }
- }.init(transactionService)
-
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("refno", transaction.refno)
- .data("billno", transaction.outTradeNo)
- .data("amount", transaction.shopDtl.amount)
- .success("交易初始化成功"))
- }
-
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.BUSINESS_PAYTYPE_NOSUPPORT, "不支持支付方式<市民卡代扣>"))
- }
-
- /**
- * ============================================================================
- * 市民卡【交易确认】
- * ============================================================================
- * */
- @PostMapping("/citizencard/payfinish")
- fun citizencardPayinit(@RequestBody param: CitizenCardPayfinishParam): ResponseEntity<Any> {
- val code = transactionService.wip(param.refno).let {
- CallService.CallCitizenCardPay(
- consumePayService.getPaytypeConfig(TradeDict.PAYTYPE_CITIZEN_CARD, it.shopDtl.shopaccno),
- it.shopDtl)
- }
- if (code.retcode == "0") {
- transactionService.success(param.refno, "支付").let {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("refno", it.refno)
- .data("billno", it.outTradeNo)
- .data("amount", it.shopDtl.amount)
- .success("交易确认成功"))
- }
-
- } else {
- transactionService.fail(param.refno).let {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.BUSINESS_DEAL_ERROR, "交易扣费失败-${code.retmsg}"))
- }
- }
- }
-
- /**
- * ============================================================================
- * 消费流水撤销
- * ============================================================================
- * */
- @PostMapping("/paycancel")
- fun payCancel(@RequestBody param: ConsumePayCancelParam): ResponseEntity<Any> {
- consumePayService.getTransactionMainDtl(param.refno, param.billno, param.shopaccno)?.let {
- val builder = TransactionBuilder().apply {
- setTransInfo(param.transdate, param.transtime, it.transCode, it.sourceType)
- setOutTransInfo(it.outId, param.requestbillno)
- }
- val cancelTrans = builder.cancelInit(it.refno, transactionService)
- //fixme: 撤销逻辑
- if (it.sourceType.isNotEmpty()) {
- // 第三方冲正
- }
- transactionService.success(cancelTrans.refno)
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("refno", cancelTrans.refno)
- .success("交易确认成功"))
- } ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.TRANSACTION_NOT_EXISTS, "流水不存在"))
- }
-
- /**
- * ============================================================================
- * 消费流水退款
- * ============================================================================
- * */
- @PostMapping("/payrefund")
- fun payRefund(@RequestBody param: ConsumePayRefundParam): ResponseEntity<Any> {
- consumePayService.getTransactionMainDtl(param.refno, param.billno, param.shopaccno)?.let {
- val builder = TransactionBuilder().apply {
- setTransInfo(param.transdate, param.transtime, it.transCode, it.sourceType)
- setOutTransInfo(it.outId, param.requestbillno)
- }
- val refundTrans = builder.refundInit(it.refno,
- param.refundAmount / 100.0, transactionService)
- //fixme: 撤销逻辑
- if (it.sourceType.isNotEmpty()) {
- // 第三方冲正
- }
- transactionService.success(refundTrans.refno)
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("refno", refundTrans.refno)
- .success("交易确认成功"))
- } ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.TRANSACTION_NOT_EXISTS, "流水不存在"))
- }
-
- /**
- * ============================================================================
- * 一卡通支付【交易初始化】
- * ============================================================================
- * */
- @PostMapping("/ykt/payinit")
- fun yktPayInit(@RequestBody param: YktCardPayinitParam): ResponseEntity<Any> {
-// val person = param.uid?.let { userService.findByThirdUniqueIdenty(it) } //没注册,可能匿名?
-// if (consumePayService.checkShopPaytype(param.shopaccno, TradeDict.PAYTYPE_YKT_CARD, person == null)) {
-// val dtl = PersonTransBuilder.newBuilder(accountUtilServcie)
-// .chooseTradetype(Tradetype.CONSUME) //消费
-// .also {
-// if (null != person) it.setOwner(person)
-// }
-// .setTransinfo(TradeCode.TRANSCODE_YKTCARD_PAY, "一卡通支付")
-// .setTransDatetime(param.transdate, param.transtime) //交易时间
-// .selectPaytype(TradeDict.PAYTYPE_YKT_CARD, param.stuempno)
-// .addDetail(AccountHolder.subject(Subject.SUBJNO_PAY_YKT),
-// AccountHolder.shop(param.shopaccno),
-// param.amount / 100.0, "一卡通支付")
-// .also { builder ->
-// param.feelist?.forEach {
-// //fixme: 科目 -> 商户 与个人无关
-// builder.addDetail(AccountHolder.feetype(it.feetype, TradeDict.PAYTYPE_YKT_CARD)
-// .with(AccountHolder.shop(param.shopaccno))
-// .with(AccountHolder.subject(Subject.SUBJNO_PAY_YKT))
-// , it.amount / 100.0)
-// }
-// }
-// .addExtendParam("stuempno", param.stuempno)
-// .addExtendParam("yktshopid", param.yktshopid ?: "")
-// .addExtendParam("devphyid", param.devphyid ?: "")
-// //.addExtendParam(param.extendmap) //fixme: 保存调一卡通附加参数 (是否直接传附加参数map)
-// .init(personBalancePayService)
-//
-// return ResponseEntity.ok(ResponseBodyBuilder.create()
-// .data("refno", dtl.refno)
-// .data("amount", dtl.amount)
-// .success("交易初始化成功"))
-//
-// }
-
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.BUSINESS_PAYTYPE_NOSUPPORT, "不支持支付方式<一卡通支付>"))
- }
-
-
- /**
- * ============================================================================
- * 一卡通支付【交易确认】
- * ============================================================================
- * */
- @PostMapping("/ykt/payfinish")
- fun yktPayFinish(@RequestBody param: CitizenCardPayfinishParam): ResponseEntity<Any> {
-// var dtl = PersonTransBuilder.newBuilder(accountUtilServcie)
-// .setRefno(param.refno)
-// .wip(personBalancePayService)
-// val extendMap = consumePayService.getUserdtlExtendParamMap(dtl.refno)
-// val code = CallService.callYktPay(consumePayService.getPaytypeConfig(TradeDict.PAYTYPE_YKT_CARD, dtl.shopaccno, dtl.userid == null),
-// dtl, DateUtil.getNow(), extendMap["stuempno"]!!, extendMap["yktshopid"]!!, extendMap["devphyid"])
-// if (code.retcode == "0") {
-// dtl = PersonTransBuilder.newBuilder(accountUtilServcie)
-// .setRefno(param.refno)
-// .addResult(code.data)
-// .success(personBalancePayService) //流水置成功
-//
-// return ResponseEntity.ok(ResponseBodyBuilder.create()
-// .data("refno", dtl.refno)
-// .data("billno", dtl.outtradeno)
-// .success())
-// } else {
-// PersonTransBuilder.newBuilder(accountUtilServcie)
-// .setRefno(param.refno)
-// .addResult("errmsg", code.retmsg!!)
-// .finish(personBalancePayService, TradeDict.DTL_STATUS_FAIL) //流水置成功
-//
-// return ResponseEntity.ok(ResponseBodyBuilder.create()
-// .fail(TradeErrorCode.BUSINESS_DEAL_ERROR, "交易扣费失败-${code.retmsg}"))
-// }
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.BUSINESS_DEAL_ERROR, "交易扣费失败"))
- }
-
-// ============================================== //
-//
-// @GetMapping("/account/payinit")
-// fun accountPayInit(userid: String, amount: Int, manageFee: Int): ResponseEntity<Any> {
-// val dtl = PersonTransBuilder.newBuilder(accountUtilServcie)
-// .setTransDatetime("20190411", "112311")
-// .enableOverdraft(false)
-// .addDetail(AccountHolder.person(userid),
-// AccountHolder.shop("12323"),
-// amount / 100.0, "")
-// .addDetail(AccountHolder.person(userid), AccountHolder.transType(301),
-// manageFee / 100.0, "")
-// .done(personBalancePayService, false)
-//
-// return ResponseEntity.ok(dtl)
-// }
-//
-// @GetMapping("/account/payfinish")
-// fun accountPayFinish(refno: String): ResponseEntity<Any> {
-// val dtl = PersonTransBuilder.newBuilder(accountUtilServcie)
-// .done(refno, TradeDict.DTL_STATUS_SUCCESS, personBalancePayService)
-// return ResponseEntity.ok(dtl)
-// }
-
-
-//
-// /**
-// * 微信支付
-// * wechattype
-// * qrcode-扫微信二维码支付
-// * app-原生app微信支付
-// * mp-微信公众号支付
-// * h5-微信h5支付
-// *
-// * */
-// @PostMapping("/wechat/payinit")
-// fun wechatPayInit(userid: String, amount: Int, manageFee: Int,
-// stuempno: String, shopid: String, transdate: String, transtime: String,
-// outtradeno: String, payinfo: String, feetype: String,
-// wechattype: String, realip: String?, qrcode: String?, openid: String?): ResponseEntity<Any> {
-// return try {
-// val paytype = paytypeService.getBySourceType(PaytypeUtil.WECHAT)
-// if (paytype == null || ConstantUtil.ENABLE_YES != paytype.enable) {
-// ResponseEntity.ok(ResponseBodyBuilder.create()
-// .fail(1, "支付方式未开启"))
-// }
-// val person = userService.findByThirdUniqueIdenty(stuempno)
-// val dtl = PersonTransBuilder.newBuilder(accountUtilServcie)
-// .setTransDatetime(transdate, transtime)
-// .selectPaytype(PaytypeUtil.WECHAT, payinfo)
-// .setOuttradeno(outtradeno)
-// .also {
-// if (null != person) it.setOwner(person)
-// }
-// .tryLock(true)
-// .setTransinfo(TradeCode.TRANSCODE_WECHAT, "微信支付")
-// .chooseTradetype(Tradetype.CONSUME)
-// .also {
-// when (feetype) {
-// TradeDict.FEETYPE_CONSUME_MEALER -> {
-// it.addDetail(AccountHolder.subject(Subject.SUBJNO_PAY_WECHAT),
-// AccountHolder.shop(shopid),
-// amount / 100.0, "微信支付")
-// .addDetail(AccountHolder.transType(TranstypeCode.TT_CONSUUME_MANAGE_FEE)
-// .with(AccountHolder.shop(shopid)),
-// manageFee / 100.0)
-// }
-// TradeDict.FEETYPE_CONSUME_DISCOUNT -> {
-// it.addDetail(AccountHolder.subject(Subject.SUBJNO_PAY_WECHAT),
-// AccountHolder.shop(shopid),
-// (amount - manageFee) / 100.0, "微信支付")
-// .addDetail(AccountHolder.subject(Subject.SUBJNO_CONSUME_DISCOUNT),
-// AccountHolder.shop(shopid),
-// manageFee / 100.0, "优惠折扣")
-// }
-// else -> {
-// it.addDetail(AccountHolder.subject(Subject.SUBJNO_PAY_WECHAT),
-// AccountHolder.shop(shopid),
-// amount / 100.0, "微信支付")
-// }
-// }
-// }.done(personBalancePayService, false)
-// val code = CallService.callWechatPay(paytypeService.getPaytypeConfigByPaytype(PaytypeUtil.WECHAT),
-// dtl, DateUtil.getNow(), wechattype, realip, qrcode, openid)
-// if (code.retcode == "0") {
-// ResponseEntity.ok(ResponseBodyBuilder.create()
-// .data("refno", dtl.refno)
-// .success())
-// } else {
-// ResponseEntity.ok(ResponseBodyBuilder.create()
-// .fail(TradeErrorCode.TRANSACTION_NOT_EXISTS, "交易请求失败-${code.retcode}"))
-// }
-// } catch (e: TransactionException) {
-// ResponseEntity.ok(ResponseBodyBuilder.create()
-// .transException(e, "交易初始化异常"))
-// }
-// }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_task.kt b/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_task.kt
deleted file mode 100644
index 0e6d694..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_task.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.supwisdom.dlpay.api
-
-import com.supwisdom.dlpay.api.domain.TShopdtl
-import com.supwisdom.dlpay.api.repositories.ShopaccService
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.scheduling.annotation.Scheduled
-import org.springframework.stereotype.Service
-
-@Service
-class MySchedulerTask {
- @Autowired
- private lateinit var shopaccService: ShopaccService
-
- fun doShopBlanceUpdate(dtl: TShopdtl) {
- shopaccService.recalcShopBalance(dtl.refno, true)
- }
-
- @Scheduled(cron = "\${shopbalance.updater.cron:-}")
- fun dealShopUnupdatedDtl() {
- shopaccService.findUnupdatedShopDtl(100).forEach {
- doShopBlanceUpdate(it)
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/consume_pay_service_impl.kt b/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/consume_pay_service_impl.kt
deleted file mode 100644
index f367feb..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/consume_pay_service_impl.kt
+++ /dev/null
@@ -1,111 +0,0 @@
-package com.supwisdom.dlpay.api.service.impl
-
-import com.supwisdom.dlpay.api.dao.SourceTypeDao
-import com.supwisdom.dlpay.api.dao.ShopPaytypeConfigDao
-import com.supwisdom.dlpay.api.dao.ShopPaytypeDao
-import com.supwisdom.dlpay.api.dao.TransactionMainDao
-import com.supwisdom.dlpay.api.domain.TTransactionMain
-import com.supwisdom.dlpay.api.service.ConsumePayService
-import com.supwisdom.dlpay.exception.TransactionProcessException
-import com.supwisdom.dlpay.framework.util.StringUtil
-import com.supwisdom.dlpay.framework.util.TradeErrorCode
-import com.supwisdom.dlpay.util.ConstantUtil
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Service
-
-@Service
-class ConsumePayServiceImpl : ConsumePayService {
- @Autowired
- lateinit var sourceTypeDao: SourceTypeDao
- @Autowired
- lateinit var shopPaytypeDao: ShopPaytypeDao
- @Autowired
- lateinit var shopPaytypeConfigDao: ShopPaytypeConfigDao
- @Autowired
- lateinit var transactionMainDao: TransactionMainDao
-
- override fun checkShopPaytype(shopaccno: String, sourceType: String, anonymousflag: Boolean?): Boolean {
- sourceTypeDao.getBySourceType(sourceType).let {
- if (null == it) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[$sourceType]")
- } else {
- if (!it.enable || !it.consumeEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[$sourceType]消费")
- }
- if (true == anonymousflag && !it.anonymousEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[$sourceType]未启用匿名消费")
- }
- }
- }
- shopPaytypeDao.getById(sourceType, shopaccno).let {
- if (null == it) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$sourceType]")
- } else {
- if (!it.consumeEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$sourceType]")
- }
- if (true == anonymousflag && !it.anonymousEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$sourceType]未启用匿名消费")
- }
- }
- }
- return true
- }
-
- override fun getPaytypeConfig(paytype: String, shopaccno: String,
- anonymousflag: Boolean?, ignoreStatus: Boolean?): Map<String, String?> {
- sourceTypeDao.getBySourceType(paytype).let {
- if (null == it) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[$paytype]")
- } else {
- //对账取配置时不关心状态,不能报错
- if (true != ignoreStatus && (!it.enable || !it.consumeEnable)) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[$paytype]消费")
- }
- if (true != ignoreStatus && true == anonymousflag && !it.anonymousEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[$paytype]未启用匿名消费")
- }
- }
- }
-
- shopPaytypeDao.getById(paytype, shopaccno).let {
- if (null == it) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$paytype]")
- } else {
- //对账取配置时不关心状态,不能报错
- if (true != ignoreStatus && !it.consumeEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$paytype]")
- }
- if (true != ignoreStatus && true == anonymousflag && !it.anonymousEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$paytype]未启用匿名消费")
- }
- }
- }
-
- shopPaytypeConfigDao.getShopPaytypeConfigs(paytype, shopaccno)?.let {
- if (it.size < 1) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$paytype]未配置参数")
- } else {
- val result = mutableMapOf<String, String?>()
- it.forEach { paytypeConfig ->
- result.plus(mapOf(paytypeConfig.configid to paytypeConfig.configValue))
- }
- return result
- }
- }
- ?: throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$paytype]未配置参数")
- }
-
- override fun getTransactionMainDtl(refno: String?, billno: String?, shopaccno: String?): TTransactionMain? {
- return when (!StringUtil.isEmpty(refno)) {
- true -> transactionMainDao.findByRefno(refno)
- false -> transactionMainDao.findByBillno(billno, shopaccno)
- }
- }
-
- override fun getUserdtlExtendParamMap(refno: String): Map<String, String> {
- TODO("未实现方法")
- }
-
-
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt b/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt
deleted file mode 100644
index ecc01ab..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt
+++ /dev/null
@@ -1,537 +0,0 @@
-package com.supwisdom.dlpay.mobile
-
-import com.supwisdom.dlpay.api.bean.JsonResult
-import com.supwisdom.dlpay.api.dao.PersonDao
-import com.supwisdom.dlpay.api.domain.TPersonIdentity
-import com.supwisdom.dlpay.api.service.UserService
-import com.supwisdom.dlpay.framework.core.JwtConfig
-import com.supwisdom.dlpay.framework.core.JwtTokenUtil
-import com.supwisdom.dlpay.framework.domain.JwtRedis
-import com.supwisdom.dlpay.framework.redisrepo.ApiJwtRepository
-import com.supwisdom.dlpay.framework.service.SystemUtilService
-import com.supwisdom.dlpay.framework.util.*
-import com.supwisdom.dlpay.mobile.domain.TBMobileUser
-import com.supwisdom.dlpay.mobile.service.MobileApiService
-import com.supwisdom.dlpay.util.ConstantUtil
-import org.apache.commons.lang.StringUtils
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.data.redis.core.RedisTemplate
-import org.springframework.security.core.GrantedAuthority
-import org.springframework.security.core.authority.AuthorityUtils
-import org.springframework.security.core.context.SecurityContextHolder
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
-import org.springframework.web.bind.annotation.RequestMapping
-import org.springframework.web.bind.annotation.RestController
-import org.springframework.web.bind.annotation.RequestParam
-import java.time.Duration
-import java.util.Calendar
-
-
-@RestController
-@RequestMapping("/mobileapi/i")
-class ApiInit {
- @Autowired
- lateinit var mobileApiService: MobileApiService
- @Autowired
- lateinit var redisTemplate: RedisTemplate<String, String>
- @Autowired
- lateinit var jwtConfig: JwtConfig
- @Autowired
- lateinit var apiJwtRepository: ApiJwtRepository
- @Autowired
- lateinit var systemUtilService: SystemUtilService
-
- @RequestMapping("/time")
- fun time(): JsonResult {
- return JsonResult.ok("OK").put("now", System.currentTimeMillis())!!
- }
-
- @RequestMapping("/test")
- fun test(uid: String): JsonResult {
- return JsonResult.ok("OK").put("uid", uid)!!
- }
-
- @RequestMapping("/uxy")
- fun xieyi(): JsonResult {
- var page = mobileApiService.findPageById(ConstantUtil.PAGE_USERXIEYI)
- if (page != null) {
- return JsonResult.ok("OK").put("page", page.pageContent)!!
- }
- return JsonResult.error("页面未配置")
- }
-
- /**
- * 注册或找回时使用的验证码生成接口
- * */
- @RequestMapping("/code")
- fun code(@RequestParam phone: String, @RequestParam type: String?): JsonResult {
- if (phone.isNullOrEmpty() || phone.length != 11 || !StringUtil.isMobile(phone)) {
- return JsonResult.error("手机号有误")
- }
- var user = mobileApiService.findUserByPhone(phone)
- if (type.isNullOrEmpty() || "new" == type) {
- if (user != null && !user.loginpwd.isNullOrEmpty()) {
- return JsonResult.error("该手机号已注册,请登录或找回密码")
- }
- } else {
- if ("find" == type) {
- if (user == null) {
- return JsonResult.error("手机号不存在,请注册")
- }
- } else {
- return JsonResult.error("类型错误")
- }
- }
- // 如果未设置密码
- var temp = redisTemplate.opsForValue().get(phone)
- if (temp.isNullOrEmpty()) {
- var code = RandomUtils.randomNumber(6)
- System.out.println(code)
- redisTemplate.opsForValue().set(phone, code, Duration.ofMinutes(5))
- }
- //TODO call send code sdk
- return JsonResult.ok("验证码已发送")
- }
-
- /**
- * 注册或找回时使用的验证码校验接口
- * */
- @RequestMapping("/checkcode")
- fun check(@RequestParam phone: String,
- @RequestParam code: String,
- @RequestParam platform: String?,
- @RequestParam uuid: String?): JsonResult {
- var temp = redisTemplate.opsForValue().get(phone)
- if (!temp.isNullOrEmpty()) {
- if (temp != code) {
- return JsonResult.error("验证码错误")
- }
- var user = mobileApiService.findUserByPhone(phone)
- if (user == null) {
- user = TBMobileUser()
- user.phone = phone
- user.registerplatform = platform
- user.registerdate = DateUtil.getNow()
- user.devuid = uuid
- user.status = TradeDict.STATUS_NORMAL
- user.paypwderror = 0
- user.loginpwderror = 0
- user = mobileApiService.saveUser(user)
- }
- user.status = TradeDict.STATUS_NORMAL
- user.registerplatform = platform
- user.devuid = uuid
- user = mobileApiService.saveUser(user)
- var code = RandomUtils.getRandomString(30)
- redisTemplate.opsForValue().set(user.uid, code, Duration.ofHours(1))
- redisTemplate.delete(phone)
- return JsonResult.ok("OK").put("uid", user.uid)?.put("randcode", code)!!
- } else {
- return JsonResult.error(-1, "验证码无效或已过期,请重新获取")
- }
- }
-
- /**
- * 注册
- * */
- @RequestMapping("/register")
- fun register(@RequestParam id: String,
- @RequestParam pwd: String,
- @RequestParam repwd: String,
- @RequestParam random: String): JsonResult {
- if (random.isNullOrEmpty()) {
- return JsonResult.error("信息有误,请返回上一步")
- }
- if (pwd.isNullOrEmpty() || repwd.isNullOrEmpty() || pwd.length < 6) {
- return JsonResult.error("请重新设置密码,密码不能小于6位字符")
- }
- if (pwd != repwd) {
- return JsonResult.error("两次密码不一致")
- }
- var user: TBMobileUser? = mobileApiService.findUserById(id) ?: return JsonResult.error("用户不存在,请注册")
- var code = redisTemplate.opsForValue().get(id)
- if (random != code) {
- return JsonResult.error("信息有误,请返回上一步,并重新发送验证码")
- }
- val encoder = BCryptPasswordEncoder()
- user!!.loginpwd = encoder.encode(pwd)
- var exp = systemUtilService.getSysparaValueAsInt(SysparaUtil.SYSPARAID_NO3, 60 * 60 * 24 * 3)
- jwtConfig.expiration = exp.toLong()
- var authorities: Collection<GrantedAuthority> = AuthorityUtils.createAuthorityList("ROLE_USER")
- user.auths = authorities
- val token = JwtTokenUtil(jwtConfig).generateToken(
- mapOf("uid" to user.uid, "issuer" to "payapi",
- "audience" to user.phone,
- Constants.JWT_CLAIM_TENANTID to "mobile",
- Constants.JWT_CLAIM_AUTHORITIES to user.authorities))
- var jwt = JwtRedis().apply {
- jti = token.jti
- uid = user.phone
- status = TradeDict.JWT_STATUS_NORMAL
- expiration = token.expiration.valueInMillis
- }.apply {
- //删除之前的token
- if (!user.jti.isNullOrEmpty()) {
- apiJwtRepository.deleteById(user.jti!!)
- }
- apiJwtRepository.save(this)
- }
- if (user.loginpwderror != null && user.loginpwderror!! > 0) {
- user.loginpwderror = 0
- user.loginpwderrortime = null
- }
- user.lastlogin = DateUtil.getNow()
- user.jti = jwt.jti
- mobileApiService.saveUser(user)
- redisTemplate.delete(user.uid)
- var payseted = false
- if (!user!!.paypwd.isNullOrEmpty()) {
- payseted = true
- }
- return JsonResult.ok("OK").put("token", token.jwtToken)
- ?.put("userid", if (user.userid.isNullOrEmpty()) "" else user.userid)
- ?.put("expire", token.expiration.valueInMillis)
- ?.put("now", System.currentTimeMillis())
- ?.put("phone", StringUtil.phoneReplace(user.phone))
- ?.put("paypwdset", payseted)
- ?.put("signed", if (user.issigned.isNullOrEmpty()) "" else user.issigned)
- ?.put("tenantid", "mobile")!!
- }
-}
-
-
-@RestController
-@RequestMapping("/mobileapi/v1")
-class ApiV1 {
- @Autowired
- lateinit var mobileApiService: MobileApiService
- @Autowired
- lateinit var userService: UserService
- @Autowired
- lateinit var redisTemplate: RedisTemplate<String, String>
- @Autowired
- lateinit var personDao: PersonDao
-
- /**
- * 用户信息
- * */
- @RequestMapping("/infor")
- fun getUserInfor(): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- return JsonResult.ok("OK").put("now", System.currentTimeMillis())!!
- }
-
- /**
- * 验证码生成,内部校验
- * */
- @RequestMapping("/code")
- fun code(): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- if (user!!.phone.isNullOrEmpty()) {
- return JsonResult.error("用户不存在,请注册")
- }
- var temp = redisTemplate.opsForValue().get(user!!.phone)
- if (temp.isNullOrEmpty()) {
- var code = RandomUtils.randomNumber(6)
- System.out.println(code)
- redisTemplate.opsForValue().set(user!!.phone, code, Duration.ofMinutes(5))
- }
- //TODO call send code sdk
- return JsonResult.ok("验证码已发送")
- }
-
- @RequestMapping("/checkcode")
- fun check(@RequestParam code: String
- ): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- var temp = redisTemplate.opsForValue().get(user!!.phone)
- if (!temp.isNullOrEmpty()) {
- if (temp != code) {
- return JsonResult.error("验证码错误")
- }
- var code = RandomUtils.getRandomString(30)
- redisTemplate.opsForValue().set(user.uid, code, Duration.ofHours(1))
- redisTemplate.delete(user!!.phone)
- return JsonResult.ok("OK").put("randcode", code)!!
- } else {
- return JsonResult.error(-1, "验证码无效或已过期,请重新获取")
- }
- }
-
- /**
- * 绑卡
- * */
- @RequestMapping("/bindcard")
- fun bindcard(card: String, name: String, code: String): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- var phone = user!!.phone
- var temp = redisTemplate.opsForValue().get(phone)
- if (!temp.isNullOrEmpty()) {
- if (temp != code) {
- return JsonResult.error("验证码错误")
- }
- if (user!!.userid.isNullOrEmpty()) {
- var identy: TPersonIdentity? = userService.findPersonIdentity(card) ?: return JsonResult.error("银行卡号有误")
- if (identy!!.person == null || identy.status != TradeDict.STATUS_NORMAL) {
- return JsonResult.error("银行卡号信息有误")
- }
- if (identy!!.person.name != name) {
- return JsonResult.error("姓名有误")
- }
- var temp: TBMobileUser? = mobileApiService.findUserById(identy!!.person.userid)
- if (temp != null) {
- return JsonResult.error("该银行卡号已被绑定,如有疑问,请联系客服")
- }
- user.bindtime = DateUtil.getNow()
- user.userid = identy.person.userid
- mobileApiService.saveUser(user)
- redisTemplate.delete(phone)
- var payseted = false
- if (!user.paypwd.isNullOrEmpty()) {
- payseted = true
- }
- return JsonResult.ok("OK").put("userid", user.userid)
- ?.put("paypwdset", payseted)
- ?.put("signed", if (user.issigned.isNullOrEmpty()) "" else user.issigned)!!
- } else {
- return JsonResult.error(-1, "用户已绑定银行卡")
- .put("userid", if (user.userid.isNullOrEmpty()) "" else user.userid)!!
- }
- } else {
- return JsonResult.error(-1, "验证码无效或已过期,请重新获取")
- }
- }
-
- /**
- * 支付密码
- * */
- @RequestMapping("/paypwd")
- fun paypwd(pwd: String, repwd: String, oldpwd: String?, type: String, randcode: String?): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- if (pwd != repwd) {
- return JsonResult.error("两次密码不一致,请确认")
- }
- if (pwd.length != 6) {
- return JsonResult.error("支付密码为6位数字")
- }
- if (!StringUtils.isNumeric(pwd)) {
- return JsonResult.error("支付密码为6位数字")
- }
- val encoder = BCryptPasswordEncoder()
- if (user!!.paypwd.isNullOrEmpty()) {
- user!!.paypwd = encoder.encode(pwd)
- mobileApiService.saveUser(user)
- return JsonResult.ok("OK")
- ?.put("paypwdset", true)!!
- } else {
- when (type) {
- "new" -> return JsonResult.error("支付密码已设置")
- "renew" -> {
- if (oldpwd.isNullOrEmpty()) {
- return JsonResult.error("原支付密码错误")
- }
- if (user.paypwderror != null && user.paypwderror!! >= 5 && (System.currentTimeMillis() - user.paypwderrortime!!) < 1000 * 60 * 30) {
- return JsonResult.error("密码错误次数过多,请30分钟后再试")
- }else if (user.paypwderror != null && user.paypwderror!! >= 5 && (System.currentTimeMillis() - user.paypwderrortime!!) > 1000 * 60 * 30) {
- //更新时间
- user.paypwderror = 0
- user.paypwderrortime = null
- }
- val encoder = BCryptPasswordEncoder()
- var b = encoder.encode(oldpwd)
- if (!encoder.matches(oldpwd,user.paypwd)) {
- if (user.paypwderror == null || user.paypwderror == 0) {
- user.paypwderror = 0
- user.paypwderrortime = System.currentTimeMillis()
- }
- user.paypwderror += 1
- mobileApiService.saveUser(user)
- return JsonResult.error("原支付密码错误")
- }
- user!!.paypwd = encoder.encode(pwd)
- mobileApiService.saveUser(user)
- return JsonResult.ok("OK")
- ?.put("paypwdset", true)!!
- }
- "find" -> {
- if (randcode.isNullOrEmpty()) {
- return JsonResult.error("信息有误,请返回并重新设置")
- }
- var code = redisTemplate.opsForValue().get(user.uid)
- if (randcode != code) {
- return JsonResult.error(-1, "长时间未操作,请返回上一步,并重新发送验证码")
- }
- user!!.paypwd = encoder.encode(pwd)
- mobileApiService.saveUser(user)
- redisTemplate.delete(user.uid)
- return JsonResult.ok("OK")
- ?.put("paypwdset", true)!!
- }
- else -> return JsonResult.error("请求错误")
- }
- }
- }
-
- /**
- *
- * 银行协议
- * */
- @RequestMapping("/bxy")
- fun xieyi(): JsonResult {
- var page = mobileApiService.findPageById(ConstantUtil.PAGE_BANKXIEYI)
- if (page != null) {
- return JsonResult.ok("OK").put("page", page.pageContent)!!
- }
- return JsonResult.error("页面未配置")
- }
-
- /**
- *
- * 签约银行协议
- * */
- @RequestMapping("/signbxy")
- fun signbxy(agree: String): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- user!!.issigned = TradeDict.STATUS_YES
- user!!.signedtime = DateUtil.getNow()
- mobileApiService.saveUser(user)
- //TODO 调用第三方接口签约
- return JsonResult.ok("ok")
- .put("signed", if (user.issigned.isNullOrEmpty()) "" else user.issigned)!!
- }
-
- /**
- * 查询账单
- * */
- @RequestMapping("/bills")
- fun bills(pageno: Int): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- val c = Calendar.getInstance()
- val timeOfDay = c.get(Calendar.HOUR_OF_DAY)
- var t = ""
- when (timeOfDay) {
- in 0..7 -> t = "早上好"
- in 8..12 -> t = "上午好"
- in 13..17 -> t = "下午好"
- in 18..23 -> t = "晚上好"
- }
- if (user!!.userid.isNullOrEmpty()) {
- return JsonResult.ok("OK").put("t", t)!!
- }
- var no = if (pageno <= 0) {
- 1
- } else {
- pageno
- }
- var today = DateUtil.getNow("yyyyMMdd")
- var yester = DateUtil.getNowInterDay(-1)
- var acc = userService.findAccountByUserid(user.userid!!, null)
- var point = userService.findPointsAccountByUserid(user.userid!!)
- var amount = 0.0;
- var pi = 0L
- if (acc != null && acc.availbal != null) {
- amount = acc.availbal
- }
- if (point != null && point.points != null) {
- pi = point.points
- }
- var payseted = false
- if (!user!!.paypwd.isNullOrEmpty()) {
- payseted = true
- }
- var name = ""
- var person = userService.findOnePersonByUserid(user.userid!!)
- if (person != null) {
- name = person.name
- }
- var page = userService.findPersondtlByUserid(user!!.userid!!, no)
- return JsonResult.ok("OK").put("page", page)
- ?.put("today", today)
- ?.put("yesterday", yester)
- ?.put("point", pi)
- ?.put("amount", amount)
- ?.put("paypwdset", payseted)
- ?.put("name", name)
- ?.put("signed", if (user.issigned.isNullOrEmpty()) "" else user.issigned)
- ?.put("userid", if (user?.userid.isNullOrEmpty()) "" else user?.userid)!!
- ?.put("t", t)!!
- }
-
- /**
- * 账单明细
- * */
- @RequestMapping("/billdetail")
- fun billdetail(billid: String): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- if (user!!.userid.isNullOrEmpty()) {
- return JsonResult.ok("OK")
- }
- var dtl = userService.findPersondtlDetailByUserid(user?.userid!!, billid)
- return JsonResult.ok("OK").put("dtl", dtl)!!
- }
-
- /**
- * 密码修改
- * */
- @RequestMapping("/pwdset")
- fun pwdset(oldpwd: String, newpwd: String, renewpwd: String): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- if (newpwd != renewpwd) {
- return JsonResult.error("两次密码不一致,请确认")
- }
- if (newpwd.isNullOrEmpty() || newpwd.length < 6) {
- return JsonResult.error("请重新设置密码,密码不能小于6位字符")
- }
- if (user!!.loginpwderror > 5) {
- return JsonResult.error(-1, "原密码错误次数过多,将退出系统,请重新登录系统或点击忘记密码功能找回密码")
- }
- val encoder = BCryptPasswordEncoder()
- if (!encoder.matches(oldpwd,user!!.loginpwd)) {
- user.loginpwderror += 1
- mobileApiService.saveUser(user)
- return JsonResult.error("原密码错误")
- }
- if (user.loginpwderror != null && user.loginpwderror!! > 0) {
- user.loginpwderror = 0
- user.loginpwderrortime = null
- }
- user.loginpwd = encoder.encode(newpwd)
- mobileApiService.saveUser(user)
- return JsonResult.ok("密码修改成功")
- }
-
- /**
- *
- * 市民卡挂失
- * */
- @RequestMapping("/cardlost")
- fun cardlost(paypwd: String): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- //TODO cardlost
- return JsonResult.ok("ok")
- }
-
- /**
- *
- * 二维码在线生成
- * */
- @RequestMapping("/qrcode")
- fun qrcode(): JsonResult {
- val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- //TODO cardlost
- return JsonResult.ok("ok")
- }
-
-
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileApiServiceImpl.kt b/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileApiServiceImpl.kt
deleted file mode 100644
index 21cd2ee..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileApiServiceImpl.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.supwisdom.dlpay.mobile.service.impl
-
-import com.supwisdom.dlpay.mobile.dao.MobileUserDao
-import com.supwisdom.dlpay.mobile.dao.PagesDao
-import com.supwisdom.dlpay.mobile.domain.TBMobileUser
-import com.supwisdom.dlpay.mobile.domain.TBPages
-import com.supwisdom.dlpay.mobile.service.MobileApiService
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Service
-
-@Service
-class MobileApiServiceImpl : MobileApiService {
- @Autowired
- lateinit var mobileUserDao: MobileUserDao
-
- @Autowired
- lateinit var pagesDao: PagesDao
-
- override fun saveUser(user: TBMobileUser): TBMobileUser {
- return mobileUserDao.save(user)
- }
-
- override fun findPageById(pageid: String): TBPages? {
- var t = pagesDao.findById(pageid)
- if (t.isPresent) {
- return t.get()
- }
- return null
- }
-
- override fun findUserByPhone(phone: String): TBMobileUser? {
- return mobileUserDao.findByPhone(phone)
- }
-
- override fun findUserById(id: String): TBMobileUser? {
- var t = mobileUserDao.findById(id)
- if(t.isPresent){
- return t.get()
- }
- return null
- }
-}
\ No newline at end of file
diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql
deleted file mode 100644
index 5e91f80..0000000
--- a/src/main/resources/data.sql
+++ /dev/null
@@ -1,510 +0,0 @@
-INSERT INTO tb_tenantconfig(cfgid, tenantid, datacenter_id)
-values ('main', '{tenantid}', '01');
-
-INSERT INTO tb_operator(operid, closedate, opendate, opercode, opername, operpwd, opertype, status, tenantid)
-VALUES ('LOR2IwRkbOjp+sVG9KR2BpHZbwGKepS4', '20500101', '20190101', 'system', '系统管理员', '$2a$10$Ex9xp11.vCaD8D0a7ahiUOKqDij1TcCUBwRAmrqXeDvAkmzLibn4.', 'oper', 'normal', '{tenantid}');
-
-
-INSERT INTO tb_role(roleid, createtime, editflag, lastsaved, rolecode, roledesc, rolename, tenantid)
-VALUES ('d1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '20190101000000', 0, '', 'ROLE_ADMIN', '超级管理员', '超级管理员', '{tenantid}');
-
-INSERT INTO tb_oper_role(id, operid, roleid, tenantid)
-VALUES ('1', 'LOR2IwRkbOjp+sVG9KR2BpHZbwGKepS4', 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (1, NULL, 0, NULL, 'layui-icon-home', '#', '主页', 1, -1, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (2, NULL, 1, NULL, 'layui-icon-home', '/home/console', '控制台', 1, 1, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (3, NULL, 0, NULL, 'layui-icon-set', '#', '系统中心', 2, -1, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (5, NULL, 1, NULL, 'layui-icon-set', '/role/index', '角色管理', 2, 3, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (6, NULL, 1, NULL, 'layui-icon-set', '/operator/index', '操作员管理', 4, 3, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (4, NULL, 1, NULL, 'layui-icon-set', '/function/index', '功能维护', 1, 3, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (7, NULL, 0, NULL, 'layui-icon-release', '#', '商户中心', 4, -1, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (9, NULL, 1, NULL, '', '/operator/logs', '操作日志', 4, 3, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (10, NULL, 0, NULL, 'layui-icon-util', '#', '参数管理', 3, -1, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (11, NULL, 1, NULL, 'layui-icon-util', '/param/syspara', '全局参数配置', 1, 10, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (12, NULL, 1, NULL, 'layui-icon-util', '/param/businesspara', '业务参数配置', 2, 10, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (17, NULL, 1, NULL, 'layui-icon-util', '/param/apiclientpara', '应用参数配置', 3, 10, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (18, NULL, 1, NULL, 'layui-icon-util', '/param/paytype', '支付能力配置', 4, 10, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (19, NULL, 0, NULL, 'layui-icon-user', '#', '用户中心', 5, -1, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (20, NULL, 0, NULL, 'layui-icon-rmb', '#', '结算中心', 6, -1, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (21, NULL, 1, NULL, '', '/user/index', '用户管理', 1, 19, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (23, NULL, 1, NULL, '', '/shop/index', '商户管理', 1, 7, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (24, NULL, 1, NULL, '', '/user/point', '积分管理', 3, 19, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (22, NULL, 1, NULL, '', '/user/acc', '账户管理', 2, 19, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (25, NULL, 1, NULL, '', '/shop/config', '商户支付能力配置', 2, 7, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (26, NULL, 0, NULL, 'layui-icon-tabs', '#', '流水管理', 3, -1, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (27, NULL, 1, NULL, '', '/dtl/userdtl', '个人流水查询', 1, 26, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (28, NULL, 1, NULL, '', '/dtl/shopdtl', '商户流水查询', 2, 26, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (29, NULL, 1, NULL, '', '/report/subjectday', '科目汇总表', 1, 20, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (30, NULL, 1, NULL, '', '/report/subjectdetail', '科目明细账', 2, 20, '{tenantid}');
-INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (31, NULL, 1, NULL, '', '/report/shopbusiness', '商户营业情况表', 3, 20, '{tenantid}');
-
-
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b7955772c0032', 1, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b7955772d0033', 2, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b7955772d0034', 3, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b7955772d0035', 5, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557730003b', 6, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b795577310041', 4, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557732004a', 9, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557732004c', 7, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557732004d', 23, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b795577330052', 25, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557733005a', 20, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557733005b', 29, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557733005d', 30, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557733005f', 31, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b795577340061', 19, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b795577340062', 21, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b795577350068', 24, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557735006a', 22, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557735006c', 26, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557735006d', 27, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557735006f', 28, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b795577350071', 10, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b795577350072', 11, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b795577360074', 17, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b79557736007b', 12, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-INSERT INTO "tb_role_function" ("id", "functionid", "roleid", "permissions", tenantid)
-VALUES ('ff8080816b7947ed016b795577370081', 18, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', NULL, '{tenantid}');
-
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (4, '1', 4, '添加功能', '/function/add', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (5, '', 4, '添加父功能', '/function/loadadd', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (6, '1', 6, '查询', '/operator/index', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (7, '', 6, '添加查询', '/operator/load4add', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (8, '', 6, '添加和修改', '/operator/add', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (9, '', 6, '重置密码', '/operator/resetpwd', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (10, '', 4, '查询', '/function/index', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (11, '', 4, '删除', '/function/delfunc', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (12, '', 4, '添加子功能', '/function/loadsubadd', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (13, '', 4, '维护资源', '/function/loadres', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (14, '', 4, '添加资源', '/function/addres', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (15, '', 4, '删除资源', '/function/delres', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (16, '', 5, '查询', '/role/index', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (17, '', 5, '添加', '/role/add', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (19, '', 5, '分配功能', '/role/addfunc', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (20, '', 5, '加载分配功能', '/role/loadfunc', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (21, '', 5, '删除角色', '/role/del', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (22, '', 6, '修改状态', '/operator/updatestate', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (24, '', 9, '查询', '/operator/logslist', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (26, '', 11, '修改', '/param/sysparaupdate', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (27, '', 11, '查询', '/param/syspara', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (28, '', 12, '查询', '/param/businesspara', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (29, '', 12, '删除', '/param/deletebusinesspara', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (30, '', 12, '修改', '/param/businessparaupdate', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (32, '', 12, '新增', '/param/addbusinesspara', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (33, '', 12, '新增跳转', '/param/load4addbuspara', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (34, '', 17, '查询', '/param/apiclientpara', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (35, '', 17, '新增修改跳转', '/param/load4addapiclient', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (36, '', 17, '修改状态', '/param/updateapiclientstate', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (37, '', 17, '删除', '/param/deleteapiclient', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (39, '', 17, '修改', '/param/updateapiclientpara', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (40, '', 17, '新增', '/param/addapiclientpara', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (41, '', 18, '查询', '/param/paytype', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (42, '', 21, '查询', '/user/list', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (43, '', 18, '新增跳转', '/param/load4addpaytype', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (44, '', 18, '切换状态', '/param/updatepaytypestate', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (45, '', 18, '修改', '/param/updatepaytypename', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (46, '', 18, '删除', '/param/deletepaytype', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (48, '', 18, '配置跳转', '/param/load4paytypeconfig', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (49, '', 18, '配置参数', '/param/addpaytypeconfig', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (50, '', 22, '查询', '/user/account', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (52, '', 24, '查询', '/user/pointlist', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (53, '', 23, '删除', '/shop/deleteshop', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (54, '', 21, '添加', '/user/add', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (56, '', 23, '查询', '/shop/getshopinfo', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (57, '', 23, '商户树', '/shop/index', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (58, '', 23, '新增修改', '/shop/saveorupdate', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (59, '', 21, '删除', '/user/del', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (60, '', 21, '注销账户', '/user/delacc', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (61, '', 21, '删除积分账户', '/user/delpoint', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (63, '', 25, '商户树', '/shop/config', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (64, '', 25, '查询', '/shop/shoppaytypelist', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (65, '', 25, '切换状态', '/shop/updatepaytypestat', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (66, '', 25, '新增跳转', '/shop/load4addpaytype', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (67, '', 25, '新增', '/shop/addshoppaytype', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (68, '', 25, '配置跳转', '/shop/load4paytypepara', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (69, '', 25, '配置', '/shop/addpaytypepara', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (70, '', 27, '查询', '/dtl/userdtl', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (71, '', 28, '查询', '/dtl/shopdtl', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (72, '', 29, '查询', '/report/subjectday', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (73, '', 30, '查询', '/report/subjectdetail', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (74, '', 31, '查询', '/report/shopbusiness', '{tenantid}');
-INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (76, '', 18, '新增', '/param/addpaytype', '{tenantid}');
-
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
-VALUES ('ff8080816b7947ed016b795577300036', 16, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
-VALUES ('ff8080816b7947ed016b795577300037', 17, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
-VALUES ('ff8080816b7947ed016b795577300038', 19, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
-VALUES ('ff8080816b7947ed016b795577300039', 20, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
-VALUES ('ff8080816b7947ed016b79557730003a', 21, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
-VALUES ('ff8080816b7947ed016b79557730003c', 6, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
-VALUES ('ff8080816b7947ed016b79557730003d', 7, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557731003e', 8, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557731003f', 9, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577310040', 22, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577310042', 4, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577310043', 5, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577310044', 10, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577310045', 11, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577310046', 12, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577320047', 13, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577320048', 14, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577320049', 15, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557732004b', 24, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557732004e', 53, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557732004f', 57, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577320050', 56, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577320051', 58, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577330053', 63, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
- VALUES ('ff8080816b7947ed016b795577330054', 64, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577330055', 65, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577330056', 66, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
- VALUES ('ff8080816b7947ed016b795577330057', 68, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
- VALUES ('ff8080816b7947ed016b795577330058', 67, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
- VALUES ('ff8080816b7947ed016b795577330059', 69, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557733005c', 72, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557733005e', 73, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577340060', 74, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577340063', 54, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577340064', 60, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577340065', 61, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
- VALUES ('ff8080816b7947ed016b795577350066', 42, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577350067', 59, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577350069', 52, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
- VALUES ('ff8080816b7947ed016b79557735006b', 50, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557735006e', 70, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577350070', 71, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577360073', 27, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577360075', 39, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577360076', 34, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577360077', 40, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577360078', 37, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577360079', 36, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557736007a', 35, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557736007c', 33, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557736007d', 32, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b79557736007e', 28, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
- VALUES ('ff8080816b7947ed016b79557737007f', 30, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577370080', 29, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577370082', 46, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577370083', 48, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577370084', 41, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577370085', 44, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
- VALUES ('ff8080816b7947ed016b795577370086', 49, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577370087', 45, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
-VALUES ('ff8080816b7947ed016b795577370088', 43, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
-
-
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('1001', 1, 'y', 1, NULL, 20190430, 1, '库存现金', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('1002', 1, 'y', 1, NULL, 20190430, 1, '银行存款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('1121', 1, 'n', 0, NULL, 20190430, 1, '应收票据', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112101', 1, 'n', 1, '1121', 20190430, 2, '支票', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112102', 1, 'n', 1, '1121', 20190430, 2, '经费本', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('1122', 1, 'y', 0, NULL, 20190430, 1, '应收账款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112201', 1, 'y', 1, '1122', 20190430, 2, '现金充值款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112209', 1, 'y', 1, '1122', 20190617, 2, '其他第三方充值款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112210', 1, 'y', 1, '1122', 20190430, 2, '支付宝充值款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112211', 1, 'y', 1, '1122', 20190430, 2, '微信充值款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112212', 1, 'n', 1, '1122', 20190430, 2, '银联充值款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112213', 1, 'y', 1, '1122', 20190430, 2, '一卡通充值款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112230', 1, 'y', 1, '1122', 20190430, 2, '支付宝支付款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112231', 1, 'y', 1, '1122', 20190430, 2, '微信支付款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112232', 1, 'n', 1, '1122', 20190430, 2, '银联支付款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112233', 1, 'y', 1, '1122', 20190430, 2, '一卡通支付款', 1, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('112234', 1, 'y', 1, '1122', NULL, 2, '市民卡支付款', 1, '{tenantid}');
---负债
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('2001', 2, 'n', 1, NULL, 20190430, 1, '用户押金', 2, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('2004', 2, 'y', 1, NULL, 20190430, 1, '商户营业款', 2, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('2202', 2, 'y', 0, NULL, 20190430, 1, '应付账款', 2, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('220201', 2, 'y', 1, '2202', 20190430, 2, '个人存款', 2, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('220211', 2, 'n', 1, '2202', 20190430, 2, '销户退款', 2, '{tenantid}');
---损益
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('6021', 2, 'y', 0, NULL, 20190430, 1, '手续费收入', 6, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('602101', 2, 'y', 1, '6021', 20190430, 2, '支付宝充值手续费', 6, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('602102', 2, 'y', 1, '6021', 20190430, 2, '微信充值手续费', 6, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('602103', 2, 'n', 1, '6021', 20190430, 2, '银联充值手续费', 6, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('6601', 2, 'y', 0, NULL, 20190430, 1, '销售费用', 6, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('660101', 2, 'y', 1, '6601', 20190430, 2, '折扣优惠款', 6, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('660102', 2, 'y', 1, '6601', 20190430, 2, '积分抵扣款', 6, '{tenantid}');
-INSERT INTO "tb_subject" ("subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
-VALUES ('6602', 2, 'y', 1, NULL, 20190430, 1, '管理费收入', 6, '{tenantid}');
-update TB_SUBJECT set opendate = to_number(to_char(CURRENT_TIMESTAMP,'yyyymmdd'),'99999999');
-
-
-INSERT INTO "tb_sourcetype" ("sourcetype", "checkable", "paydesc", "enable", "charge_enable", "consume_enable", "anonymous_enable", "reversable", "tenantid")
-VALUES ('citizenCard', 't', '大理市民卡', 't', 'f', 't', 'f', 't', '{tenantid}');
-INSERT INTO "tb_sourcetype" ("sourcetype", "checkable", "paydesc", "enable", "charge_enable", "consume_enable", "anonymous_enable", "reversable", "tenantid")
-VALUES ('balance', 'f', '账户余额', 't', 'f', 't', 'f', 't', '{tenantid}');
-INSERT INTO "tb_sourcetype" ("sourcetype", "checkable", "paydesc", "enable", "charge_enable", "consume_enable", "anonymous_enable", "reversable", "tenantid")
-VALUES ('thirdpart', 'f', '其他第三方支付', 't', 't', 'f', 'f', 'f', '{tenantid}');
-INSERT INTO "tb_sourcetype" ("sourcetype", "checkable", "paydesc", "enable", "charge_enable", "consume_enable", "anonymous_enable", "reversable", "tenantid")
-VALUES ('yktpay', 't', '一卡通支付', 't', 't', 't', 't', 't', '{tenantid}');
-INSERT INTO "tb_sourcetype" ("sourcetype", "checkable", "paydesc", "enable", "charge_enable", "consume_enable", "anonymous_enable", "reversable", "tenantid")
-VALUES ('alipay', 't', '支付宝', 't', 't', 't', 't', 'f', '{tenantid}');
-INSERT INTO "tb_sourcetype" ("sourcetype", "checkable", "paydesc", "enable", "charge_enable", "consume_enable", "anonymous_enable", "reversable", "tenantid")
-VALUES ('wechat', 't', '微信支付', 't', 't', 't', 't', 'f', '{tenantid}');
-
--- 支付方式
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('yktpay','appid',null,'100005', '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('yktpay','appkey',null,'adc4ac6822fd462780f878b86cb94688', '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('yktpay','orderurl',null,'http://172.28.201.101:9116/epayapi/services/thirdparty/common/pay', '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('yktpay','reverseurl',null,'http://172.28.201.101:9116/epayapi/services/thirdparty/common/payreverse', '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('alipay', 'alipay.gateway', '支付宝网关地址', 'https://openapi.alipay.com/gateway.do', '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('alipay', 'enable.paymethod', '支付渠道', 'balance,moneyFund,debitCardExpress,bankPay,pcredit', '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('alipay', 'notify.url', '异步通知地址', 'http://ykt.supwisdom.com:9116/epay/zfb/newnotify', '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('alipay', 'timeout.express', '支付超时时间', '5m', '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('alipay', 'alipay.public.key', '支付宝商户应用的支付宝公钥', NULL, '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('alipay', 'alipay.rsa.private.key', '支付宝商户应用RSA私钥', NULL, '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('alipay', 'alipay.rsa.public.key', '支付宝商户应用RSA公钥', NULL, '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('alipay', 'appid', '支付宝应用APPID', NULL, '{tenantid}');
-INSERT INTO TB_PAYTYPE_CONFIG (PAYTYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE, "tenantid")
-VALUES ('citizenCard', 'bankcardno', NULL, NULL, '{tenantid}');
-
-INSERT INTO "tb_syspara" ("paraid", "displayflag", "editflag", "lastsaved", "paraname", "paraunit", "paraval", "remark", "valuetype", "tenantid")
-VALUES (1, 'yes', 1, '20190514165658', '账户最大余额默认值', '元', '10001', '账户开户时的默认账户最大余额', 'amount', '{tenantid}');
-
-INSERT INTO "tb_task_lock" ("taskcode", "remark", "taskstatus", "tasktime", "tenantid")
-VALUES ('DAYENDSETTLETASK', '日终结算', '0', '20190619100600', '{tenantid}');
-
-INSERT INTO "tb_shop" ("shopid", "shopname", "shoptype", "fshopid", "status", "opendate", "tenantid")
-VALUES (1, '支付中心', 0, 0, 'normal', '20190517', '{tenantid}');
-
-INSERT INTO "tb_transcode" ("transcode", "transname", "tenantid")
-VALUES (3010, '市民卡代扣', '{tenantid}');
-INSERT INTO "tb_transcode" ("transcode", "transname", "tenantid")
-VALUES (3500, '账户充值', '{tenantid}');
-
-INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('cancel', 'reverseFlagList', '冲正', '冲正状态', '{tenantid}');
-INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('reverse', 'reverseFlagList', '手工撤销', '冲正状态', '{tenantid}');
-INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('none', 'reverseFlagList', '-', '冲正状态', '{tenantid}');
-INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('init', 'dtlStatusList', '初始化', '流水状态', '{tenantid}');
-INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('success', 'dtlStatusList', '交易成功', '流水状态', '{tenantid}');
-INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('fail', 'dtlStatusList', '交易失败', '流水状态', '{tenantid}');
-INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('wip', 'dtlStatusList','待支付', '流水状态', '{tenantid}');
-INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('cancel','dtlStatusList', '交易取消', '流水状态', '{tenantid}');
-
-----------------------------------------------------
-commit;
\ No newline at end of file
diff --git a/src/main/resources/templates/home/console.html b/src/main/resources/templates/home/console.html
deleted file mode 100755
index 94a54a5..0000000
--- a/src/main/resources/templates/home/console.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<div class="layui-row layui-col-space15">
- <div class="layui-col-xs6 layui-col-md3">
- <div class="layui-card">
- <div class="layui-card-header">
- 访问量<span class="layui-badge layui-bg-blue pull-right">周</span>
- </div>
- <div class="layui-card-body">
- <p class="lay-big-font">9,999,666</p>
- <p>总计访问量<span class="pull-right">88万 <i class="layui-icon layui-icon-flag"></i></span></p>
- </div>
- </div>
- </div>
- <div class="layui-col-xs6 layui-col-md3">
- <div class="layui-card">
- <div class="layui-card-header">
- 下载<span class="layui-badge layui-bg-black pull-right">月</span>
- </div>
- <div class="layui-card-body">
- <p class="lay-big-font">33,555</p>
- <p>新下载<span class="pull-right">10% <i class="layui-icon layui-icon-download-circle"></i></span></p>
- </div>
- </div>
- </div>
- <div class="layui-col-xs6 layui-col-md3">
- <div class="layui-card">
- <div class="layui-card-header">
- Start<span class="layui-badge layui-bg-green pull-right">周</span>
- </div>
- <div class="layui-card-body">
- <p class="lay-big-font">999,666</p>
- <p>总Start数<span class="pull-right">88万 <i class="layui-icon layui-icon-rate"></i></span></p>
- </div>
- </div>
- </div>
- <div class="layui-col-xs6 layui-col-md3">
- <div class="layui-card">
- <div class="layui-card-header">
- 活跃用户<span class="layui-badge layui-bg-orange pull-right">月</span>
- </div>
- <div class="layui-card-body">
- <p class="lay-big-font">66,666</p>
- <p>最近一个月<span class="pull-right">15% <i class="layui-icon layui-icon-user"></i></span></p>
- </div>
- </div>
- </div>
-</div>
-
-
-
-
-
-<script>
- layui.use(['carousel', 'element'], function () {
- var carousel = layui.carousel;
- var element = layui.element;
- var device = layui.device;
-
- layui.link('[[@{/static/custom/css/console.css}]]');
-
- // 渲染轮播
- carousel.render({
- elem: '.layui-carousel',
- width: '100%',
- height: '60px',
- arrow: 'none',
- autoplay: true,
- trigger: device.ios || device.android ? 'click' : 'hover',
- anim: 'fade'
- });
- });
-</script>
diff --git a/src/main/resources/templates/system/param/paytypeform.html b/src/main/resources/templates/system/param/paytypeform.html
deleted file mode 100644
index e3a2d5a..0000000
--- a/src/main/resources/templates/system/param/paytypeform.html
+++ /dev/null
@@ -1,114 +0,0 @@
-<form id="sourceType-form" lay-filter="form" class="layui-form model-form">
- <div class="layui-form-item">
- <label class="layui-form-label">支付方式</label>
- <div class="layui-input-block">
- <input name="paytype" placeholder="请输入支付方式代码" type="text" class="layui-input" maxlength="20"
- lay-verify="required|sourceType" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">名称</label>
- <div class="layui-input-block">
- <input name="paydesc" placeholder="请输入支付方式名称" type="text" class="layui-input" maxlength="30"
- lay-verify="required" required/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">状态</label>
- <div class="layui-input-block">
- <input name="enable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes" lay-verify="required" checked/>
- </div>
- </div>
-
- <div class="layui-form-item">
- <label class="layui-form-label">能否充值</label>
- <div class="layui-input-block">
- <input name="chargeEnable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes" lay-verify="required" checked/>
- </div>
- </div>
-
- <div class="layui-form-item">
- <label class="layui-form-label">能否消费</label>
- <div class="layui-input-block">
- <input name="consumeEnable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes" lay-verify="required" checked/>
- </div>
- </div>
-
- <div class="layui-form-item">
- <label class="layui-form-label">匿名消费</label>
- <div class="layui-input-block">
- <input name="anonymousEnable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes" lay-verify="required" checked/>
- </div>
- </div>
-
- <div class="layui-form-item model-form-footer">
- <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
- <button class="layui-btn" lay-filter="form-submit" lay-submit id="submitbtn">保存</button>
- </div>
-</form>
-
-
-<script>
- layui.use(['layer', 'admin', 'form'], function () {
- var layer = layui.layer;
- var admin = layui.admin;
- var form = layui.form;
- form.render('checkbox');
- form.verify({
- "sourceType": function (e) {
- var msg = "";
- $.ajax({
- type: "GET",
- url: '[[@{/param/checkpaytype}]]',
- async: false,
- data: {
- paytype: e
- },
- success: function (result) {
- if (result.code != 200) {
- msg = result.msg;
- }
- },
- error: function (error) {
- msg = "请求服务器校验支付方式失败";
- }
- });
- if (msg != "") {
- return msg;
- }
- }
- });
-
- // 表单提交事件
- form.on('submit(form-submit)', function (data) {
- layer.load(2);
- var vdata = data.field;
- vdata["_csrf"] = $("meta[name='_csrf_token']").attr("value");
- $.ajax({
- type : "POST",
- dataType : "json",
- url : '[[@{/param/addpaytype}]]',
- data : vdata,
- success : function(result) {
- layer.closeAll('loading');
- if (result.code == 200) {
- layer.msg(result.msg, {icon: 1});
- admin.finishPopupCenter();
- } else if (result.code == 401) {
- layer.msg(result.msg, {icon: 2, time: 1500}, function () {
- location.replace('[[@{/login}]]');
- }, 1000);
- return;
- } else {
- console.log('err:' + result.code);
- layer.msg(result.msg, {icon: 2});
- }
- },
- error : function(err){
- admin.errorBack(err);
- }
- });
- return false;
- });
- });
-</script>
\ No newline at end of file
diff --git a/ynrcc-agent/Dockerfile b/ynrcc-agent/Dockerfile
new file mode 100644
index 0000000..3305510
--- /dev/null
+++ b/ynrcc-agent/Dockerfile
@@ -0,0 +1,9 @@
+FROM openjdk:8
+
+COPY ynrcc-agent-1.jar /opt/agent/agent.jar
+
+EXPOSE 8080
+
+WORKDIR /opt/agent
+
+CMD ["java" , "-jar", "agent.jar"]
diff --git a/ynrcc-agent/build.gradle b/ynrcc-agent/build.gradle
new file mode 100644
index 0000000..20cc9b3
--- /dev/null
+++ b/ynrcc-agent/build.gradle
@@ -0,0 +1,69 @@
+plugins {
+ id 'java'
+ id 'org.springframework.boot'
+ id "com.palantir.git-version"
+ id 'com.palantir.docker'
+}
+
+apply plugin: 'java'
+apply plugin: 'io.spring.dependency-management'
+
+def ynrccVersion = gitVersion()
+def details = versionDetails()
+
+group = rootProject.group
+version = '1'
+sourceCompatibility = jdkVersion
+def ynrccStartClass = 'com.supwisdom.agent.YnrccAgentApplication'
+
+println("Build version: $ynrccVersion")
+
+bootJar {
+ mainClassName = ynrccStartClass
+ manifest {
+ attributes('YnrccAgent-Version': ynrccVersion)
+ }
+}
+
+jar {
+ baseName = 'ynrcc-agent'
+}
+
+docker {
+ def imageVersion
+ if(details.commitDistance > 0 || !details.isCleanTag) {
+ imageVersion = 'dev'
+ } else {
+ imageVersion = details.lastTag
+ }
+ name 'harbor.supwisdom.com/dali/ynrcc:' + imageVersion
+ println(jar.archivePath)
+ files jar.archivePath
+}
+
+docker.dependsOn(jar)
+
+dependencies {
+
+ implementation 'org.springframework.boot:spring-boot-starter-web'
+ implementation 'org.springframework.boot:spring-boot-autoconfigure'
+ implementation 'commons-codec:commons-codec:1.12'
+ implementation 'com.jcabi:jcabi-manifests:1.1'
+ implementation 'org.slf4j:slf4j-parent:1.7.26'
+ implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
+ implementation group: 'com.sun.jersey', name: 'jersey-client', version: '1.19'
+ implementation group: 'javax.servlet', name: 'jstl', version: '1.2'
+ implementation group: 'taglibs', name: 'standard', version: '1.1.2'
+ implementation group: 'commons-codec', name: 'commons-codec', version: '1.6'
+ implementation 'org.dom4j:dom4j:2.1.1'
+ implementation 'commons-beanutils:commons-beanutils:1.9.3'
+ implementation 'commons-net:commons-net:3.6'
+
+ implementation project(':payapi-common')
+
+ testImplementation 'org.springframework.boot:spring-boot-starter-test'
+ testImplementation 'io.rest-assured:rest-assured:3.3.0'
+ testImplementation 'io.rest-assured:spring-mock-mvc:3.3.0'
+ testImplementation 'org.hamcrest:hamcrest:2.1'
+}
+
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/BussinessException.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/BussinessException.java
new file mode 100644
index 0000000..cad7023
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/BussinessException.java
@@ -0,0 +1,7 @@
+package com.supwisdom.agent.Util;
+
+public class BussinessException extends Exception {
+ public BussinessException(String message) {
+ super(message);
+ }
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/DateUtil.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/DateUtil.java
new file mode 100644
index 0000000..b9f451f
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/DateUtil.java
@@ -0,0 +1,361 @@
+package com.supwisdom.agent.Util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+public class DateUtil {
+ private static final Logger logger = LoggerFactory.getLogger(DateUtil.class);
+ public static final String DATE_FMT = "yyyyMMdd";
+ public static final String TIME_FMT = "HHmmss";
+ public static final String DATETIME_FMT = "yyyyMMddHHmmss";
+
+ /**
+ * Description: 返回一个当前时间 @return String 格式:yyyyMMddHHmmss @exception Modify
+ * History:
+ */
+ public static String getNow() {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ return sdf.format(new Date());
+ }
+
+
+ /**
+ * Description: 根据类型返回一个当前时间 @param partten String @return String 格式:partten
+ */
+ public static String getNow(String partten) {
+ SimpleDateFormat sdf = new SimpleDateFormat(partten);
+ return sdf.format(new Date());
+ }
+ /*
+ *
+ * */
+ public static String getNowInterDay(int intervalday) {
+ try {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ Date d = new Date();
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(d.getTime());
+ calendar.add(Calendar.DATE, intervalday);
+ return sdf.format(calendar.getTime());
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * Description: 得到一个特殊的时间 @param startTime String 格式:yyyyMMddHHmmss @param
+ * interval int 秒 @return String 格式:partten @exception Modify History:
+ */
+ public static String getNewTime(String startTime, int interval) {
+ try {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ 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;
+ }
+ }
+
+ /**
+ * 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 {
+ SimpleDateFormat sdf = new 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ Date d = sdf.parse(startDay);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(d.getTime());
+ calendar.add(Calendar.DATE, intervalday);
+ return sdf.format(calendar.getTime());
+ } catch (ParseException e) {
+ return startDay;
+ }
+ }
+
+ /**
+ * 得到两个日期相差的天数 格式 yyyyMMdd @return diffdays = secondDay - firstDay
+ */
+ public static long getIntervalDay(String firstDay, String secondDay) {
+ try {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ Date f = sdf.parse(firstDay);
+ Date s = sdf.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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ Date f = sdf.parse(firstTime);
+ Date s = sdf.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 {
+ SimpleDateFormat sdf = new 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ Date f = sdf.parse(firstTime);
+ Date s = sdf.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 {
+ SimpleDateFormat sdf = new 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ 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;
+ }
+
+ /**
+ * 获得两个字符串日期之间的时间差(单位毫秒)
+ */
+ public static long getIntervalTime(String startTime, String endTime, String pattern) {
+ long duration = 0;
+ try {
+ SimpleDateFormat sdf = new 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+ Date d = sdf.parse(datetime);
+ return datetime.trim().equals(sdf.format(d));
+ } 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 {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ Calendar calendar = Calendar.getInstance();
+ boolean isFirstSunday = (calendar.getFirstDayOfWeek() == Calendar.SUNDAY); //一周第一天是否为星期天
+ Date d = sdf.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 {
+ SimpleDateFormat sdf = new 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;
+ }
+
+ private static Date set(Date date, int calendarField, int amount) {
+ Calendar c = Calendar.getInstance();
+ c.setLenient(false);
+ c.setTime(date);
+ c.add(calendarField, amount);
+ return c.getTime();
+ }
+
+
+ public static Date setMinutes(Date date, int amount) {
+ return set(date, Calendar.MINUTE, amount);
+ }
+
+
+ public static long getNowSecond() {
+ Calendar calendar = Calendar.getInstance();
+ return calendar.getTimeInMillis() / 1000;
+ }
+
+
+ public static String getUTCTime(Long timeInMillisSecond) {
+ Calendar time = Calendar.getInstance();
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
+ fmt.setTimeZone(TimeZone.getTimeZone("UTC"));
+ time.setTimeInMillis(timeInMillisSecond);
+ return fmt.format(time.getTime());
+ }
+
+ public static String getUTCTime() {
+ return getUTCTime(System.currentTimeMillis());
+ }
+
+ public static int compareDay(Timestamp d1, Timestamp d2) {
+ Calendar cd1 = Calendar.getInstance();
+ cd1.setTimeInMillis(d1.getTime());
+ Calendar cd2 = Calendar.getInstance();
+ cd2.setTimeInMillis(d2.getTime());
+
+ if (cd1.get(Calendar.YEAR) != cd2.get(Calendar.YEAR)) {
+ return cd1.compareTo(cd2);
+ }
+
+ return Integer.compare(cd1.get(Calendar.DAY_OF_YEAR), cd2.get(Calendar.DAY_OF_YEAR));
+ }
+
+ public static Boolean sameDay(Timestamp d1, Timestamp d2) {
+ return (compareDay(d1, d2) == 0);
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/util/DlpayUtil.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/DlpayUtil.java
similarity index 83%
rename from src/main/java/com/supwisdom/dlpay/util/DlpayUtil.java
rename to ynrcc-agent/src/main/java/com/supwisdom/agent/Util/DlpayUtil.java
index 5aa25fb..4dbd2bb 100644
--- a/src/main/java/com/supwisdom/dlpay/util/DlpayUtil.java
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/DlpayUtil.java
@@ -1,4 +1,4 @@
-package com.supwisdom.dlpay.util;
+package com.supwisdom.agent.Util;
import org.dom4j.Document;
import org.dom4j.Element;
@@ -13,6 +13,13 @@
import java.util.Random;
public class DlpayUtil {
+ public static final String OPTYPE_BINDCARD = "bindcard"; //绑定银行卡
+ public static final String OPTYPE_SIGNCARD = "signcard"; //签(解)约银行卡
+ public static final String OPTYPE_CARDPAY = "cardpay"; //代扣消费
+ public static final String OPTYPE_PAYREFUND = "payrefund"; //消费退款
+ public static final String OPTYPE_QUERYRESULT = "queryresult"; //消费结果查询
+ public static final String OPTYPE_CHKDTL = "chkdtl"; //流水对账
+
/**
* socket方式请求农商行
*/
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/ErrorCode.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/ErrorCode.java
new file mode 100644
index 0000000..ecc83dc
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/ErrorCode.java
@@ -0,0 +1,10 @@
+package com.supwisdom.agent.Util;
+
+public class ErrorCode {
+ public static final String SYSTEM_ERROR = "10000";
+
+ public static final String REQ_PARAM_ERROR = "20000";
+ public static final String REQ_SIGN_ERROR = "21000";
+
+ public static final String BUSSINESS_ERROR = "30000";
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/MD5.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/MD5.java
new file mode 100644
index 0000000..aeea2f6
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/MD5.java
@@ -0,0 +1,96 @@
+package com.supwisdom.agent.Util;
+
+import java.security.MessageDigest;
+
+public class MD5 {
+ //十六进制下数字到字符的映射数组
+ private final static String[] hexDigits = {"0", "1", "2", "3", "4",
+ "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
+
+ /**
+ * 把inputString加密
+ */
+ public static String generatePassword(String data, String salt) {
+ String enyptString = data + "{" + salt + "}";
+ return encodeByMD5(enyptString);
+ }
+
+ /**
+ * 验证输入的密码是否正确
+ *
+ * @param password 加密后的密码
+ * @param inputString 输入的字符串
+ * @return 验证结果,TRUE:正确 FALSE:错误
+ */
+ public static boolean validatePassword(String password, String inputString) {
+ if (password.equals(encodeByMD5(inputString))) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * 对字符串进行MD5加密
+ */
+ public static String encodeByMD5(String originString) {
+ if (originString != null) {
+ try {
+ //创建具有指定算法名称的信息摘要
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ //使用指定的字节数组对摘要进行最后更新,然后完成摘要计算
+ byte[] results = md.digest(originString.getBytes("UTF-8"));
+ //将得到的字节数组变成字符串返回
+ String resultString = byteArrayToHexString(results);
+ return resultString.toUpperCase();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 转换字节数组为十六进制字符串
+ *
+ * @param 字节数组
+ * @return 十六进制字符串
+ */
+ private static String byteArrayToHexString(byte[] b) {
+ StringBuffer resultSb = new StringBuffer();
+ for (int i = 0; i < b.length; i++) {
+ resultSb.append(byteToHexString(b[i]));
+ }
+ return resultSb.toString();
+ }
+
+ /**
+ * 将一个字节转化成十六进制形式的字符串
+ */
+ private static String byteToHexString(byte b) {
+ int n = b;
+ if (n < 0)
+ n = 256 + n;
+ int d1 = n / 16;
+ int d2 = n % 16;
+ return hexDigits[d1] + hexDigits[d2];
+ }
+
+ public static String encodeByMD5ForYnrcc(String originString) {
+ if (originString != null) {
+ try {
+ //创建具有指定算法名称的信息摘要
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ //使用指定的字节数组对摘要进行最后更新,然后完成摘要计算
+ byte[] results = md.digest(originString.getBytes("GBK"));
+ //将得到的字节数组变成字符串返回
+ String resultString = byteArrayToHexString(results);
+ return resultString;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/RandomUtils.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/RandomUtils.java
new file mode 100644
index 0000000..6883fba
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/RandomUtils.java
@@ -0,0 +1,104 @@
+package com.supwisdom.agent.Util;
+
+import org.apache.commons.codec.binary.Base32;
+import org.apache.commons.codec.binary.Hex;
+
+import java.security.SecureRandom;
+import java.util.Random;
+
+/**
+ * 获取随机数类
+ *
+ * @author yanhua_mao
+ *
+ */
+public class RandomUtils {
+
+ /**
+ * 获取随机数
+ *
+ * @param length
+ * 位数
+ * @return 返回随机数
+ */
+ public static final String randomNumber(int length) {
+ char[] numbersAndLetters = null;
+ java.util.Random randGen = null;
+ if (length < 1) {
+ return null;
+ }
+ if (randGen == null) {
+ randGen = new java.util.Random();
+ numbersAndLetters = ("0123456789").toCharArray();
+ }
+ char[] randBuffer = new char[length];
+ for (int i = 0; i < randBuffer.length; i++) {
+ randBuffer[i] = numbersAndLetters[randGen.nextInt(9)];
+ }
+ return new String(randBuffer);
+ }
+
+ /**
+ * 产生一个随机的字符串
+ *
+ * @param 字符串长度
+ * @return
+ */
+ public static String getRandomString(int length) {
+ String base = "abcdefghijklmnopqrstuvwxyz234567";
+ Random random = new Random();
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < length; i++) {
+ int number = random.nextInt(base.length());
+ sb.append(base.charAt(number));
+ }
+ return sb.toString();
+ }
+
+ public static String getSecureRandom() {
+ SecureRandom a = new SecureRandom();
+ byte[] phonesecret = new byte[10];
+ a.nextBytes(phonesecret);
+
+ Base32 c = new Base32();
+ String s = c.encodeAsString(phonesecret);
+ String savesecret = Hex.encodeHexString(phonesecret);
+ String result = s + "_" + savesecret;
+ return result;
+ }
+
+ public static String getSecureRandomHex() {
+ SecureRandom a = new SecureRandom();
+ byte[] phonesecret = new byte[10];
+ a.nextBytes(phonesecret);
+
+ String savesecret = Hex.encodeHexString(phonesecret);
+ return savesecret;
+ }
+
+ /**
+ *
+ * @param length
+ * @return
+ */
+ public static String getCharAndNumr(int length) {
+ String val = "";
+
+ Random random = new Random();
+ for (int i = 0; i < length; i++) {
+ String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num"; // 输出字母还是数字
+
+ if ("char".equalsIgnoreCase(charOrNum)) // 字符串
+ {
+ int choice = random.nextInt(2) % 2 == 0 ? 65 : 97; // 取得大写字母还是小写字母
+ val += (char) (choice + random.nextInt(26));
+ } else if ("num".equalsIgnoreCase(charOrNum)) // 数字
+ {
+ val += String.valueOf(random.nextInt(10));
+ }
+ }
+
+ return val;
+ }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/StringUtil.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/StringUtil.java
similarity index 90%
copy from src/main/java/com/supwisdom/dlpay/framework/util/StringUtil.java
copy to ynrcc-agent/src/main/java/com/supwisdom/agent/Util/StringUtil.java
index 20756cc..e5fe750 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/StringUtil.java
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/StringUtil.java
@@ -1,4 +1,4 @@
-package com.supwisdom.dlpay.framework.util;
+package com.supwisdom.agent.Util;
import java.util.*;
import java.util.regex.Matcher;
@@ -151,4 +151,20 @@
public static String nameReplace(String s){
return s.replaceAll("([\\d\\D]{1})(.*)", "$1**");
}
+
+
+ /**
+ * 检验时间格式
+ */
+ 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 datetime.trim().equals(sdf.format(d));
+ } catch (Exception e) {
+ }
+ return false;
+ }
+
}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/XmlUtils.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/XmlUtils.java
new file mode 100644
index 0000000..c4a3eb2
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/Util/XmlUtils.java
@@ -0,0 +1,75 @@
+package com.supwisdom.agent.Util;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import java.io.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class XmlUtils {
+ public static <T> String getObjectToXml(T object) throws IOException {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+
+ try {
+ JAXBContext context = JAXBContext.newInstance(object.getClass());
+ // 将对象转变为xml Object------XML
+ // 指定对应的xml文件
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_ENCODING, "gbk");//编码格式
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);// 是否格式化生成的xml串
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);// 是否省略xml头信息
+
+ // 将对象转换为对应的XML文件
+ marshaller.marshal(object, byteArrayOutputStream);
+ } catch (JAXBException e) {
+
+ e.printStackTrace();
+ }
+ // 转化为字符串返回
+ String xmlContent = new String(byteArrayOutputStream.toByteArray(),
+ "gbk");
+ return xmlContent;
+ }
+
+ public static <T> T getXmlToObject(String xmlContent, String charset, Class clazz) {
+ try {
+ JAXBContext context = JAXBContext.newInstance(clazz);
+ // xml转换为对象 XML------Object
+ InputStream inputStream;
+ try {
+ inputStream = new ByteArrayInputStream(
+ xmlContent.getBytes(charset));
+ Unmarshaller um = context.createUnmarshaller();
+
+ return (T) um.unmarshal(inputStream);
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } catch (JAXBException e) {
+
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static Map<String, String> parseXml(String xml) throws Exception {
+ Map<String, String> map = new HashMap<String, String>();
+ Document document = DocumentHelper.parseText(xml);
+ Element root = document.getRootElement();
+ List<Element> elementList = root.elements();
+ for (Element e : elementList)
+ map.put(e.getName(), e.getText());
+ return map;
+ }
+
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/YnrccAgentApplication.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/YnrccAgentApplication.java
new file mode 100644
index 0000000..8e1bb6e
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/YnrccAgentApplication.java
@@ -0,0 +1,11 @@
+package com.supwisdom.agent;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class YnrccAgentApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(YnrccAgentApplication.class, args);
+ }
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/api/bean/CheckFileLine.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/bean/CheckFileLine.java
new file mode 100644
index 0000000..e3d9b69
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/bean/CheckFileLine.java
@@ -0,0 +1,100 @@
+package com.supwisdom.agent.api.bean;
+
+/**
+ * * 第二行及以后:交易日期|交易时间|报文业务类型|业务系统流水号|银行流水号|付款银行卡号|收款商户银行卡号|核心记账日期|交易金额|交易摘要|
+ * <p>
+ * private static final String[]chkFileColumnList=new String[]{"transdate","transtime","flag","refno","agentrefno",
+ * "payerid","payeeid","agentdate","amount","summary"};
+ */
+public class CheckFileLine {
+ private String transdate;
+ private String transtime;
+ private String flag;
+ private String refno;
+ private String agentrefno;
+ private String payerid;
+ private String payeeid;
+ private String agentdate;
+ private Integer amount;
+ private String summary;
+
+ 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 String getFlag() {
+ return flag;
+ }
+
+ public void setFlag(String flag) {
+ this.flag = flag;
+ }
+
+ public String getRefno() {
+ return refno;
+ }
+
+ public void setRefno(String refno) {
+ this.refno = refno;
+ }
+
+ public String getAgentrefno() {
+ return agentrefno;
+ }
+
+ public void setAgentrefno(String agentrefno) {
+ this.agentrefno = agentrefno;
+ }
+
+ public String getPayerid() {
+ return payerid;
+ }
+
+ public void setPayerid(String payerid) {
+ this.payerid = payerid;
+ }
+
+ public String getPayeeid() {
+ return payeeid;
+ }
+
+ public void setPayeeid(String payeeid) {
+ this.payeeid = payeeid;
+ }
+
+ public String getAgentdate() {
+ return agentdate;
+ }
+
+ public void setAgentdate(String agentdate) {
+ this.agentdate = agentdate;
+ }
+
+ public Integer getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Integer amount) {
+ this.amount = amount;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/api/bean/DlpayReq.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/bean/DlpayReq.java
new file mode 100644
index 0000000..03f957f
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/bean/DlpayReq.java
@@ -0,0 +1,292 @@
+package com.supwisdom.agent.api.bean;
+
+import com.supwisdom.agent.Util.MD5;
+
+public class DlpayReq {
+ private static final String prefix = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
+ private static final String BANKCARD_BIND_TRANSCODE = "BC5510";
+ private static final String BANKCARD_SIGN_TRANSCODE = "BC5511";
+ private static final String BANKCARD_PAY_TRANSCODE = "BC5512";
+ private static final String BANKCARD_PAYREFUND_TRANSCODE = "BC5513";
+ private static final String BANKCARD_QUERYRESULT_TRANSCODE = "BC5514";
+ private static final String BANKCARD_CHKFILE_TRANSCODE = "BC5515";
+
+ public static final String DLPAY_CATEGORIE = "C001"; //消费类别
+
+ private String transcode;
+ private String transdate; //交易日期
+ private String transtime; //交易时间
+ private String sn; //应用系统唯一流水号
+ private String bcNo; //银行卡卡号
+ private String name; //户名
+ private String idType; //证件类型
+ private String idNo; //证件号码
+ private String phone; //手机号
+
+ private String categorie; //消费类别
+ private String transType; //交易类型 签约1,解约2
+
+ private String merchantBcno; //商户卡号
+ private String merchantName; //商户户名
+ private Integer amount; //消费金额
+ private String description; //描述交易内容
+
+ private String oriSn; //原应用系统唯一流水号
+ private String chkdate; //对账日期
+
+ /**
+ * 市民卡绑定请求XML
+ * */
+ public String getBindCardXml() {
+ StringBuffer xml = new StringBuffer();
+ xml.append(prefix)
+ .append("<root>")
+ .append("<TRANSCODE>").append(transcode).append("</TRANSCODE>")
+ .append("<TRANSDATE>").append(transdate).append("</TRANSDATE>")
+ .append("<TRANSTIME>").append(transtime).append("</TRANSTIME>")
+ .append("<CATEGORIE>").append(categorie).append("</CATEGORIE>")
+ .append("<SN>").append(sn).append("</SN>")
+ .append("<BC_NO>").append(bcNo).append("</BC_NO>")
+ .append("<NAME>").append(name).append("</NAME>")
+ .append("<ID_TYPE>").append(idType).append("</ID_TYPE>")
+ .append("<ID_NO>").append(idNo).append("</ID_NO>")
+ .append("<PHONE>").append(phone).append("</PHONE>")
+ .append("</root>");
+ return String.format("%08d", xml.toString().length()) + xml.toString();
+ }
+
+
+ /**
+ * 市民卡签约/解约请求XML
+ * */
+ public String getSignXml(){
+ StringBuffer xml = new StringBuffer();
+ xml.append(prefix)
+ .append("<root>")
+ .append("<TRANSCODE>").append(transcode).append("</TRANSCODE>")
+ .append("<TRANSDATE>").append(transdate).append("</TRANSDATE>")
+ .append("<TRANSTIME>").append(transtime).append("</TRANSTIME>")
+ .append("<SN>").append(sn).append("</SN>")
+ .append("<CATEGORIE>").append(categorie).append("</CATEGORIE>")
+ .append("<BC_NO>").append(bcNo).append("</BC_NO>")
+ .append("<NAME>").append(name).append("</NAME>")
+ .append("<ID_TYPE>").append(idType).append("</ID_TYPE>")
+ .append("<ID_NO>").append(idNo).append("</ID_NO>")
+ .append("<PHONE>").append(phone).append("</PHONE>")
+ .append("<TRANS_TYPE>").append(transType).append("</TRANS_TYPE>")
+ .append("</root>");
+ return String.format("%08d", xml.toString().length()) + xml.toString();
+ }
+
+ /**
+ * 市民卡代扣消费接口请求报文
+ * */
+ public String getCardpayXml(){
+ StringBuffer xml = new StringBuffer();
+ xml.append(prefix)
+ .append("<root>")
+ .append("<TRANSCODE>").append(transcode).append("</TRANSCODE>")
+ .append("<TRANSDATE>").append(transdate).append("</TRANSDATE>")
+ .append("<TRANSTIME>").append(transtime).append("</TRANSTIME>")
+ .append("<SN>").append(sn).append("</SN>")
+ .append("<CATEGORIE>").append(categorie).append("</CATEGORIE>")
+ .append("<BC_NO>").append(bcNo).append("</BC_NO>")
+ .append("<NAME>").append(name).append("</NAME>")
+// .append("<ID_TYPE>").append(idType).append("</ID_TYPE>")
+ .append("<ID_NO>").append(idNo).append("</ID_NO>")
+ .append("<MERCHANT_BCNO>").append(merchantBcno).append("</MERCHANT_BCNO>")
+ .append("<MERCHANT_NAME>").append(merchantName).append("</MERCHANT_NAME>")
+ .append("<AMOUNT>").append(amount).append("</AMOUNT>")
+ .append("<DESCRIPTION>").append(description).append("</DESCRIPTION>")
+ .append("<MAC>").append(MD5.encodeByMD5ForYnrcc(merchantBcno + bcNo + amount)).append("</MAC>")
+ .append("</root>");
+ return String.format("%08d", xml.toString().length()) + xml.toString();
+ }
+
+ /**
+ * 市民卡退款接口请求报文
+ * */
+ public String getPayRefundXml(){
+ StringBuffer xml = new StringBuffer();
+ xml.append(prefix)
+ .append("<root>")
+ .append("<TRANSCODE>").append(transcode).append("</TRANSCODE>")
+ .append("<TRANSDATE>").append(transdate).append("</TRANSDATE>")
+ .append("<TRANSTIME>").append(transtime).append("</TRANSTIME>")
+ .append("<SN>").append(sn).append("</SN>")
+ .append("<ORI_SN>").append(oriSn).append("</ORI_SN>")
+ .append("<AMOUNT>").append(amount).append("</AMOUNT>")
+ .append("<DESCRIPTION>").append(description).append("</DESCRIPTION>")
+ .append("</root>");
+ return String.format("%08d", xml.toString().length()) + xml.toString();
+ }
+
+ /**
+ * 市民卡交易查询接口请求报文
+ * */
+ public String getQueryResultXml(){
+ StringBuffer xml = new StringBuffer();
+ xml.append(prefix)
+ .append("<root>")
+ .append("<TRANSCODE>").append(transcode).append("</TRANSCODE>")
+ .append("<TRANSDATE>").append(transdate).append("</TRANSDATE>")
+ .append("<TRANSTIME>").append(transtime).append("</TRANSTIME>")
+ .append("<SN>").append(sn).append("</SN>")
+ .append("<ORI_SN>").append(oriSn).append("</ORI_SN>")
+ .append("</root>");
+ return String.format("%08d", xml.toString().length()) + xml.toString();
+ }
+
+ /**
+ * 市民卡对账接口请求报文
+ * */
+ public String getChkfileXml(){
+ StringBuffer xml = new StringBuffer();
+ xml.append(prefix)
+ .append("<root>")
+ .append("<TRANSCODE>").append(transcode).append("</TRANSCODE>")
+ .append("<TRANSDATE>").append(transdate).append("</TRANSDATE>")
+ .append("<TRANSTIME>").append(transtime).append("</TRANSTIME>")
+ .append("<SN>").append(sn).append("</SN>")
+ .append("<DZDATE>").append(chkdate).append("</DZDATE>")
+ .append("<MERCHANT_BCNO>").append("</MERCHANT_BCNO>")
+ .append("</root>");
+ return String.format("%08d", xml.toString().length()) + xml.toString();
+ }
+
+ 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 String getSn() {
+ return sn;
+ }
+
+ public void setSn(String sn) {
+ this.sn = sn;
+ }
+
+ public String getBcNo() {
+ return bcNo;
+ }
+
+ public void setBcNo(String bcNo) {
+ this.bcNo = bcNo;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ 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 getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getCategorie() {
+ return categorie;
+ }
+
+ public void setCategorie(String categorie) {
+ this.categorie = categorie;
+ }
+
+ public String getTransType() {
+ return transType;
+ }
+
+ public void setTransType(String transType) {
+ this.transType = transType;
+ }
+
+ public String getMerchantBcno() {
+ return merchantBcno;
+ }
+
+ public void setMerchantBcno(String merchantBcno) {
+ this.merchantBcno = merchantBcno;
+ }
+
+ public String getMerchantName() {
+ return merchantName;
+ }
+
+ public void setMerchantName(String merchantName) {
+ this.merchantName = merchantName;
+ }
+
+ public Integer getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Integer amount) {
+ this.amount = amount;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getOriSn() {
+ return oriSn;
+ }
+
+ public void setOriSn(String oriSn) {
+ this.oriSn = oriSn;
+ }
+
+ public String getChkdate() {
+ return chkdate;
+ }
+
+ public void setChkdate(String chkdate) {
+ this.chkdate = chkdate;
+ }
+
+ public String getTranscode() {
+ return transcode;
+ }
+
+ public void setTranscode(String transcode) {
+ this.transcode = transcode;
+ }
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/api/bean/DlpayResp.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/bean/DlpayResp.java
new file mode 100644
index 0000000..29d5b26
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/bean/DlpayResp.java
@@ -0,0 +1,124 @@
+package com.supwisdom.agent.api.bean;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "root")
+public class DlpayResp {
+ private String code;
+ private String message;
+ private String transdate;
+ private String transtime;
+ private String bankjourno;
+ private String captcha;
+ private String sinstatus;
+ private String status;
+ private String filename;
+ private String trxdate;
+ private Integer amount;
+
+ @XmlElement(name = "CODE")
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ @XmlElement(name = "MESSAGE")
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ @XmlElement(name = "TRANSDATE")
+ public String getTransdate() {
+ return transdate;
+ }
+
+ public void setTransdate(String transdate) {
+ this.transdate = transdate;
+ }
+
+ @XmlElement(name = "TRANSTIME")
+ public String getTranstime() {
+ return transtime;
+ }
+
+ public void setTranstime(String transtime) {
+ this.transtime = transtime;
+ }
+
+ @XmlElement(name = "BANKJOURNO")
+ public String getBankjourno() {
+ return bankjourno;
+ }
+
+ public void setBankjourno(String bankjourno) {
+ this.bankjourno = bankjourno;
+ }
+
+ @XmlElement(name = "SINSTATUS")
+ public String getSinstatus() {
+ return sinstatus;
+ }
+
+ public void setSinstatus(String sinstatus) {
+ this.sinstatus = sinstatus;
+ }
+
+ @XmlElement(name = "CAPTCHA")
+ public String getCaptcha() {
+ return captcha;
+ }
+
+ public void setCaptcha(String captcha) {
+ this.captcha = captcha;
+ }
+
+ @XmlElement(name = "STATUS")
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ @XmlElement(name = "FILENAME")
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public String errPrint() {
+ return "error: code=[" + this.code + "],message=[" + this.message + "]";
+ }
+
+ @XmlElement(name = "TRXDATE")
+ public String getTrxdate() {
+ return trxdate;
+ }
+
+ public void setTrxdate(String trxdate) {
+ this.trxdate = trxdate;
+ }
+
+ @XmlElement(name = "AMOUNT")
+ public Integer getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Integer amount) {
+ this.amount = amount;
+ }
+
+
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/api/controller/YnrccApiController.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/controller/YnrccApiController.java
new file mode 100644
index 0000000..af77687
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/controller/YnrccApiController.java
@@ -0,0 +1,571 @@
+package com.supwisdom.agent.api.controller;
+
+import com.supwisdom.agent.Util.BussinessException;
+import com.supwisdom.agent.Util.DlpayUtil;
+import com.supwisdom.agent.Util.ErrorCode;
+import com.supwisdom.agent.Util.StringUtil;
+import com.supwisdom.agent.api.bean.CheckFileLine;
+import com.supwisdom.agent.api.bean.DlpayReq;
+import com.supwisdom.agent.api.bean.DlpayResp;
+import com.supwisdom.agent.api.service.YnrccApiService;
+import com.supwisdom.agent.api.service.YnrccParamCheckService;
+import com.supwisdom.dlpay.api.agent.Constant;
+import org.apache.commons.beanutils.BeanUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.FormParam;
+import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+
+
+@RestController
+@RequestMapping("/ynrcc")
+public class YnrccApiController {
+ @Autowired
+ private YnrccApiService ynrccApiService;
+ @Autowired
+ private YnrccParamCheckService ynrccParamCheckService;
+
+ /**
+ * 第一行:总笔数|总金额|代扣总笔数|代扣总金额|退款总笔数|退款总金额|
+ * 第二行及以后:交易日期|交易时间|报文业务类型|业务系统流水号|银行流水号|付款银行卡号|收款商户银行卡号|核心记账日期|交易金额|交易摘要|
+ */
+ private static final String[] chkFileColumnList = new String[]{"transdate", "transtime", Constant.COL_FLAG,
+ Constant.COL_REFNO, Constant.COL_AGENT_REFNO, Constant.COL_PAYERID, Constant.COL_PAYEEID,
+ Constant.COL_AGENT_DATE, Constant.COL_AMOUNT, Constant.COL_SUMMARY};
+
+ private static final String chkFileDelimiter = "|";
+ private static final String FLAG_WITHHOLD = "BC5512";
+ private static final String FLAG_REFUND = "BC5513";
+
+ private static final Logger logger = LoggerFactory.getLogger(YnrccApiController.class);
+
+ private boolean checkYnrccSign(Map<String, String> params, DlpayResp resp) {
+ if (!ynrccParamCheckService.checkSign(params)) {
+ resp.setCode(ErrorCode.REQ_SIGN_ERROR);
+ resp.setMessage("签名错误");
+ logger.error(resp.errPrint());
+ return false;
+ }
+ return true;
+ }
+
+ private void doSystemError(Exception e, DlpayResp resp) {
+ e.printStackTrace();
+ resp.setCode(ErrorCode.SYSTEM_ERROR);
+ resp.setMessage(StringUtil.isEmpty(e.getMessage()) ? "业务处理异常" : e.getMessage());
+ logger.error(resp.errPrint());
+ }
+
+ /**
+ * 绑定银行卡
+ */
+ @PostMapping("/bindcard")
+ public DlpayResp bindBankcard(@FormParam("transcode") String transcode, @FormParam("transdate") String transdate,
+ @FormParam("transtime") String transtime, @FormParam("categorie") String categorie,
+ @FormParam("refno") String refno, @FormParam("bankcardno") String bankcardno,
+ @FormParam("username") String username, @FormParam("idtype") String idtype,
+ @FormParam("idno") String idno, @FormParam("phone") String phone,
+ @FormParam("sign_type") String sign_type, @FormParam("sign") String sign) {
+ DlpayResp resp = new DlpayResp();
+ if (!ynrccParamCheckService.checkBindCardParam(transcode, transdate, transtime, refno, bankcardno, username, idtype, idno, phone, categorie, sign_type, sign, resp)) {
+ logger.error(resp.errPrint());
+ return resp;
+ }
+
+ Map<String, String> params = new HashMap<>(0);
+ params.put("transcode", transcode);
+ params.put("transdate", transdate);
+ params.put("transtime", transtime);
+ params.put("categorie", categorie);
+ params.put("refno", refno);
+ params.put("bankcardno", bankcardno);
+ params.put("username", username);
+ params.put("idtype", idtype);
+ params.put("idno", idno);
+ params.put("phone", phone);
+ params.put("sign_type", sign_type);
+ params.put("sign", sign);
+ if (!checkYnrccSign(params, resp)) {
+ return resp;
+ }
+
+ try {
+ DlpayReq req = new DlpayReq();
+ req.setTranscode(transcode);
+ req.setTransdate(transdate);
+ req.setTranstime(transtime);
+ req.setCategorie(categorie);
+ req.setSn(refno);
+ req.setBcNo(bankcardno);
+ req.setName(username);
+ req.setIdType(idtype);
+ req.setIdNo(idno);
+ req.setPhone(phone);
+ return ynrccApiService.sendToYnrcc(DlpayUtil.OPTYPE_BINDCARD, req);
+ } catch (BussinessException be) {
+ resp.setCode(ErrorCode.BUSSINESS_ERROR);
+ resp.setMessage(be.getMessage());
+ logger.error(resp.errPrint());
+ return resp;
+ } catch (Exception e) {
+ doSystemError(e, resp);
+ return resp;
+ }
+ }
+
+ /**
+ * 银行卡签约/解约
+ */
+ @PostMapping("/signcard")
+ public DlpayResp signBankcard(@FormParam("transcode") String transcode, @FormParam("transdate") String transdate,
+ @FormParam("transtime") String transtime, @FormParam("refno") String refno,
+ @FormParam("categorie") String categorie, @FormParam("transtype") String transtype,
+ @FormParam("bankcardno") String bankcardno, @FormParam("username") String username,
+ @FormParam("idtype") String idtype, @FormParam("idno") String idno,
+ @FormParam("phone") String phone,
+ @FormParam("sign_type") String sign_type, @FormParam("sign") String sign) {
+ DlpayResp resp = new DlpayResp();
+ if (!ynrccParamCheckService.checkSignCardParam(transcode, transdate, transtime, refno, categorie, bankcardno,
+ username, idtype, idno, phone, transtype, sign_type, sign, resp)) {
+ logger.error(resp.errPrint());
+ return resp;
+ }
+
+ Map<String, String> params = new HashMap<>(0);
+ params.put("transcode", transcode);
+ params.put("transdate", transdate);
+ params.put("transtime", transtime);
+ params.put("refno", refno);
+ params.put("categorie", categorie);
+ params.put("bankcardno", bankcardno);
+ params.put("username", username);
+ params.put("idtype", idtype);
+ params.put("idno", idno);
+ params.put("phone", phone);
+ params.put("transtype", transtype);
+ params.put("sign_type", sign_type);
+ params.put("sign", sign);
+ if (!checkYnrccSign(params, resp)) {
+ return resp;
+ }
+
+ try {
+ DlpayReq req = new DlpayReq();
+ req.setTranscode(transcode);
+ req.setTransdate(transdate);
+ req.setTranstime(transtime);
+ req.setSn(refno);
+ req.setCategorie(categorie);
+ req.setBcNo(bankcardno);
+ req.setName(username);
+ req.setIdType(idtype);
+ req.setIdNo(idno);
+ req.setPhone(phone);
+ req.setTransType(transtype);
+ return ynrccApiService.sendToYnrcc(DlpayUtil.OPTYPE_SIGNCARD, req);
+ } catch (BussinessException be) {
+ resp.setCode(ErrorCode.BUSSINESS_ERROR);
+ resp.setMessage(be.getMessage());
+ logger.error(resp.errPrint());
+ return resp;
+ } catch (Exception e) {
+ doSystemError(e, resp);
+ return resp;
+ }
+ }
+
+ /**
+ * 银行卡代扣
+ */
+ @PostMapping("/cardpay")
+ public DlpayResp cardpay(@FormParam("transcode") String transcode, @FormParam("transdate") String transdate,
+ @FormParam("transtime") String transtime, @FormParam("refno") String refno,
+ @FormParam("categorie") String categorie,
+ @FormParam("bankcardno") String bankcardno, @FormParam("username") String username,
+ @FormParam("idtype") String idtype, @FormParam("idno") String idno,
+ @FormParam("merchant_bankcardno") String merchant_bankcardno,
+ @FormParam("merchant_bankaccname") String merchant_bankaccname,
+ @FormParam("amount") Integer amount,
+ @FormParam("description") String description,
+ @FormParam("sign_type") String sign_type, @FormParam("sign") String sign) {
+ DlpayResp resp = new DlpayResp();
+ if (!ynrccParamCheckService.checkCardPayParam(transcode, transdate, transtime, refno, categorie, bankcardno,
+ username, idtype, idno, merchant_bankcardno, merchant_bankaccname, amount, description, sign_type, sign, resp)) {
+ logger.error(resp.errPrint());
+ return resp;
+ }
+
+ Map<String, String> params = new HashMap<>(0);
+ params.put("transcode", transcode);
+ params.put("transdate", transdate);
+ params.put("transtime", transtime);
+ params.put("refno", refno);
+ params.put("categorie", categorie);
+ params.put("bankcardno", bankcardno);
+ params.put("username", username);
+ params.put("idtype", idtype);
+ params.put("idno", idno);
+ params.put("merchant_bankcardno", merchant_bankcardno);
+ params.put("merchant_bankaccname", merchant_bankaccname);
+ params.put("amount", String.valueOf(amount));
+ params.put("description", description);
+ params.put("sign_type", sign_type);
+ params.put("sign", sign);
+ if (!checkYnrccSign(params, resp)) {
+ return resp;
+ }
+
+ try {
+ DlpayReq req = new DlpayReq();
+ req.setTranscode(transcode);
+ req.setTransdate(transdate);
+ req.setTranstime(transtime);
+ req.setSn(refno);
+ req.setCategorie(categorie);
+ req.setBcNo(bankcardno);
+ req.setName(username);
+// req.setIdType(idtype);
+ req.setIdNo(idno);
+ req.setMerchantBcno(merchant_bankcardno);
+ req.setMerchantName(merchant_bankaccname);
+ req.setAmount(amount);
+ req.setDescription(description);
+ return ynrccApiService.sendToYnrcc(DlpayUtil.OPTYPE_CARDPAY, req);
+ } catch (BussinessException be) {
+ resp.setCode(ErrorCode.BUSSINESS_ERROR);
+ resp.setMessage(be.getMessage());
+ logger.error(resp.errPrint());
+ return resp;
+ } catch (Exception e) {
+ doSystemError(e, resp);
+ return resp;
+ }
+ }
+
+ /**
+ * 银行卡代扣退款
+ */
+ @PostMapping("/cardpayrefund")
+ public DlpayResp cardpayRefund(@FormParam("transcode") String transcode, @FormParam("transdate") String transdate,
+ @FormParam("transtime") String transtime, @FormParam("refno") String refno,
+ @FormParam("refundRefno") String refundRefno,
+ @FormParam("amount") Integer amount,
+ @FormParam("description") String description,
+ @FormParam("sign_type") String sign_type, @FormParam("sign") String sign) {
+ DlpayResp resp = new DlpayResp();
+ if (!ynrccParamCheckService.checkPayRefundParam(transcode, transdate, transtime, refno, refundRefno, amount, description, sign_type, sign, resp)) {
+ logger.error(resp.errPrint());
+ return resp;
+ }
+
+ Map<String, String> params = new HashMap<>(0);
+ params.put("transcode", transcode);
+ params.put("transdate", transdate);
+ params.put("transtime", transtime);
+ params.put("refno", refno);
+ params.put("refundRefno", refundRefno);
+ params.put("amount", String.valueOf(amount));
+ params.put("description", description);
+ params.put("sign_type", sign_type);
+ params.put("sign", sign);
+ if (!checkYnrccSign(params, resp)) {
+ return resp;
+ }
+
+ try {
+ DlpayReq req = new DlpayReq();
+ req.setTranscode(transcode);
+ req.setTransdate(transdate);
+ req.setTranstime(transtime);
+ req.setSn(refno);
+ req.setOriSn(refundRefno);
+ req.setAmount(amount);
+ req.setDescription(description);
+ return ynrccApiService.sendToYnrcc(DlpayUtil.OPTYPE_PAYREFUND, req);
+ } catch (BussinessException be) {
+ resp.setCode(ErrorCode.BUSSINESS_ERROR);
+ resp.setMessage(be.getMessage());
+ logger.error(resp.errPrint());
+ return resp;
+ } catch (Exception e) {
+ doSystemError(e, resp);
+ return resp;
+ }
+ }
+
+ /**
+ * 查询消费结果
+ */
+ @PostMapping("/queryresult")
+ public DlpayResp queryResult(@FormParam("transcode") String transcode, @FormParam("transdate") String transdate,
+ @FormParam("transtime") String transtime, @FormParam("refno") String refno,
+ @FormParam("orignRefno") String orignRefno,
+ @FormParam("sign_type") String sign_type, @FormParam("sign") String sign) {
+ DlpayResp resp = new DlpayResp();
+ if (!ynrccParamCheckService.checkQueryResultParam(transcode, transdate, transtime, refno, orignRefno, sign_type, sign, resp)) {
+ logger.error(resp.errPrint());
+ return resp;
+ }
+
+ Map<String, String> params = new HashMap<>(0);
+ params.put("transcode", transcode);
+ params.put("transdate", transdate);
+ params.put("transtime", transtime);
+ params.put("refno", refno);
+ params.put("orignRefno", orignRefno);
+ params.put("sign_type", sign_type);
+ params.put("sign", sign);
+ if (!checkYnrccSign(params, resp)) {
+ return resp;
+ }
+
+ try {
+ DlpayReq req = new DlpayReq();
+ req.setTranscode(transcode);
+ req.setTransdate(transdate);
+ req.setTranstime(transtime);
+ req.setSn(refno);
+ req.setOriSn(orignRefno);
+ return ynrccApiService.sendToYnrcc(DlpayUtil.OPTYPE_QUERYRESULT, req);
+ } catch (BussinessException be) {
+ resp.setCode(ErrorCode.BUSSINESS_ERROR);
+ resp.setMessage(be.getMessage());
+ logger.error(resp.errPrint());
+ return resp;
+ } catch (Exception e) {
+ doSystemError(e, resp);
+ return resp;
+ }
+ }
+
+ /**
+ * 获取对账文件名
+ */
+ @PostMapping("/checkdtl")
+ public DlpayResp checkDtl(@FormParam("transcode") String transcode, @FormParam("transdate") String transdate,
+ @FormParam("transtime") String transtime, @FormParam("refno") String refno,
+ @FormParam("checkdate") String checkdate, @FormParam("merchant_bankcardno") String merchant_bankcardno,
+ @FormParam("sign_type") String sign_type, @FormParam("sign") String sign) {
+ DlpayResp resp = new DlpayResp();
+ if (!ynrccParamCheckService.checkChkfileParam(transcode, transdate, transtime, refno, checkdate, merchant_bankcardno, sign_type, sign, resp)) {
+ logger.error(resp.errPrint());
+ return resp;
+ }
+
+ Map<String, String> params = new HashMap<>(0);
+ params.put("transcode", transcode);
+ params.put("transdate", transdate);
+ params.put("transtime", transtime);
+ params.put("refno", refno);
+ params.put("checkdate", checkdate);
+ params.put("merchant_bankcardno", merchant_bankcardno);
+ params.put("sign_type", sign_type);
+ params.put("sign", sign);
+ if (!checkYnrccSign(params, resp)) {
+ return resp;
+ }
+
+ try {
+ DlpayReq req = new DlpayReq();
+ req.setTranscode(transcode);
+ req.setTransdate(transdate);
+ req.setTranstime(transtime);
+ req.setSn(refno);
+ req.setChkdate(checkdate);
+ req.setMerchantBcno(merchant_bankcardno);
+ return ynrccApiService.sendToYnrcc(DlpayUtil.OPTYPE_CHKDTL, req);
+ } catch (BussinessException be) {
+ resp.setCode(ErrorCode.BUSSINESS_ERROR);
+ resp.setMessage(be.getMessage());
+ logger.error(resp.errPrint());
+ return resp;
+ } catch (Exception e) {
+ doSystemError(e, resp);
+ return resp;
+ }
+ }
+
+ private <T> void populate(String[] fields, String[] column, T bean) {
+ if (fields.length < column.length) {
+ throw new IllegalArgumentException("错误的列定义");
+ }
+ try {
+ Map<String, String> data = new HashMap<>();
+ for (int col = 0; col < column.length; ++col) {
+ data.put(column[col], fields[col]);
+ }
+ BeanUtils.populate(bean, data);
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ throw new IllegalArgumentException("错误的列定义");
+ }
+
+ private <T> T populate(String[] fields, String[] column, Class<T> beanClass) {
+ try {
+ T bean = beanClass.newInstance();
+ populate(fields, column, bean);
+ return bean;
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ throw new IllegalArgumentException("错误的列定义");
+ }
+
+ private void writeLine(OutputStream output, Object... columns) throws IOException {
+ for (Object item : columns) {
+ output.write(item.toString().getBytes(StandardCharsets.UTF_8));
+ output.write(Constant.CHKFILE_DELIMITER.getBytes(StandardCharsets.UTF_8));
+ }
+ output.write("\n".getBytes());
+ }
+
+ private void parseFile(String filePath, OutputStream output) {
+ int lineno = 1;
+ try {
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(
+ new FileInputStream(filePath), "GBK"));
+ String header = reader.readLine();
+ if (header == null) {
+ throw new IllegalArgumentException("数据文件内容为空");
+ }
+
+ CheckFileHeader fileHeader = populate(CheckFileHeader.chkFileHeaderColumnList,
+ header.split(chkFileDelimiter), CheckFileHeader.class);
+
+
+ CheckFileLine record = new CheckFileLine();
+ writeLine(output, Constant.COL_REFNO, Constant.COL_AGENT_REFNO,
+ Constant.COL_AGENT_DATE, Constant.COL_FLAG, Constant.COL_PAYERID,
+ Constant.COL_PAYEEID, Constant.COL_STATUS,
+ Constant.COL_AMOUNT, Constant.COL_SUMMARY);
+ while (true) {
+ String line = reader.readLine();
+ if (line == null) {
+ break;
+ }
+ lineno++;
+ String[] field = line.split(chkFileDelimiter);
+ populate(chkFileColumnList, field, record);
+ int amount;
+ String flag;
+ if (FLAG_WITHHOLD.equals(record.getFlag())) {
+ amount = -record.getAmount();
+ flag = Constant.FLAG_PAY;
+ fileHeader.setPayCount(fileHeader.getPayCount() - 1);
+ fileHeader.setPayAmount(fileHeader.getPayAmount() - record.getAmount());
+ } else if (FLAG_REFUND.equals(record.getFlag())) {
+ amount = -record.getAmount();
+ flag = Constant.FLAG_REFUND;
+ fileHeader.setRefundCount(fileHeader.getRefundCount() - 1);
+ fileHeader.setRefundAmount(fileHeader.getRefundAmount() - record.getAmount());
+ } else {
+ throw new IllegalArgumentException("对账文件【报文业务类型】错误,行数 " + lineno + " 。");
+ }
+ fileHeader.setTotalCount(fileHeader.getTotalCount() - 1);
+ fileHeader.setTotalAmount(fileHeader.getTotalAmount() - record.getAmount());
+ writeLine(output, record.getRefno(), record.getAgentrefno(), record.getAgentdate(),
+ flag, record.getPayerid(), record.getPayeeid(), Constant.STATUS_SUCCESS,
+ amount, record.getSummary());
+ }
+ if (!fileHeader.isZero()) {
+ throw new IllegalArgumentException("对账文件总金额与笔数与明细不符");
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new IllegalArgumentException("对账文件数据格式错误,行数 " + lineno + " 。");
+ }
+ }
+
+ @GetMapping("/download")
+ public void downloadFile(@RequestParam("filename") String filename, HttpServletResponse response) throws IOException {
+ try {
+ String loaclfile = ynrccApiService.getChkfilePath(filename);
+ parseFile(loaclfile, response.getOutputStream());
+ } catch (Exception e) {
+ e.printStackTrace();
+ response.sendError(HttpStatus.SERVICE_UNAVAILABLE.value(), e.getMessage());
+ }
+ }
+
+
+ /**
+ * 第一行:总笔数|总金额|代扣总笔数|代扣总金额|退款总笔数|退款总金额|
+ */
+ private static class CheckFileHeader {
+ static final String[] chkFileHeaderColumnList = new String[]{"totalCount", "totalAmount", "payCount",
+ "payAmount", "refundCount", "refundAmount"};
+
+ private int totalCount;
+ private int totalAmount;
+ private int payCount;
+ private int payAmount;
+ private int refundCount;
+ private int refundAmount;
+
+ int getTotalCount() {
+ return totalCount;
+ }
+
+ void setTotalCount(int totalCount) {
+ this.totalCount = totalCount;
+ }
+
+ int getTotalAmount() {
+ return totalAmount;
+ }
+
+ void setTotalAmount(int totalAmount) {
+ this.totalAmount = totalAmount;
+ }
+
+ int getPayCount() {
+ return payCount;
+ }
+
+ void setPayCount(int payCount) {
+ this.payCount = payCount;
+ }
+
+ int getPayAmount() {
+ return payAmount;
+ }
+
+ void setPayAmount(int payAmount) {
+ this.payAmount = payAmount;
+ }
+
+ int getRefundCount() {
+ return refundCount;
+ }
+
+ void setRefundCount(int refundCount) {
+ this.refundCount = refundCount;
+ }
+
+ int getRefundAmount() {
+ return refundAmount;
+ }
+
+ void setRefundAmount(int refundAmount) {
+ this.refundAmount = refundAmount;
+ }
+
+ boolean isZero() {
+ return (totalAmount == 0 && totalCount == 0
+ && payAmount == 0 && payCount == 0 && refundAmount == 0 && refundCount == 0);
+ }
+ }
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/YnrccApiService.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/YnrccApiService.java
new file mode 100644
index 0000000..a17cb6c
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/YnrccApiService.java
@@ -0,0 +1,10 @@
+package com.supwisdom.agent.api.service;
+
+import com.supwisdom.agent.api.bean.DlpayReq;
+import com.supwisdom.agent.api.bean.DlpayResp;
+
+public interface YnrccApiService {
+ DlpayResp sendToYnrcc(String optype, DlpayReq req) throws Exception;
+
+ String getChkfilePath(String filename) throws Exception;
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/YnrccParamCheckService.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/YnrccParamCheckService.java
new file mode 100644
index 0000000..4eb674b
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/YnrccParamCheckService.java
@@ -0,0 +1,27 @@
+package com.supwisdom.agent.api.service;
+
+import com.supwisdom.agent.api.bean.DlpayResp;
+
+import java.util.Map;
+
+public interface YnrccParamCheckService {
+ boolean checkBindCardParam(String transcode, String transdate, String transtime, String refno,
+ String bankcardno, String username, String idtype, String idno,
+ String phone, String categorie, String sign_type, String sign, DlpayResp resp);
+
+ boolean checkSign(Map<String, String> param);
+
+ boolean checkSignCardParam(String transcode, String transdate, String transtime, String refno, String categorie, String bankcardno, String username,
+ String idtype, String idno, String phone, String transtype, String sign_type, String sign, DlpayResp resp);
+
+ boolean checkCardPayParam(String transcode, String transdate, String transtime, String refno, String categorie, String bankcardno, String username,
+ String idtype, String idno, String merchant_bankcardno, String merchant_bankaccname, Integer amount, String description,
+ String sign_type, String sign, DlpayResp resp);
+
+ boolean checkPayRefundParam(String transcode, String transdate, String transtime, String refno, String refundRefno, Integer amount, String description,
+ String sign_type, String sign, DlpayResp resp);
+
+ boolean checkQueryResultParam(String transcode, String transdate, String transtime, String refno, String orignRefno, String sign_type, String sign, DlpayResp resp);
+
+ boolean checkChkfileParam(String transcode, String transdate, String transtime, String refno, String checkdate, String merchant_bankcardno, String sign_type, String sign, DlpayResp resp);
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/impl/YnrccApiServiceImpl.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/impl/YnrccApiServiceImpl.java
new file mode 100644
index 0000000..4ae422e
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/impl/YnrccApiServiceImpl.java
@@ -0,0 +1,147 @@
+package com.supwisdom.agent.api.service.impl;
+
+import com.supwisdom.agent.Util.BussinessException;
+import com.supwisdom.agent.Util.DlpayUtil;
+import com.supwisdom.agent.Util.StringUtil;
+import com.supwisdom.agent.Util.XmlUtils;
+import com.supwisdom.agent.api.bean.DlpayReq;
+import com.supwisdom.agent.api.bean.DlpayResp;
+import com.supwisdom.agent.api.service.YnrccApiService;
+import com.supwisdom.agent.config.YnrccSocketConfig;
+import org.apache.commons.net.ftp.FTP;
+import org.apache.commons.net.ftp.FTPClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.*;
+
+@Service
+public class YnrccApiServiceImpl implements YnrccApiService {
+ @Autowired
+ private YnrccSocketConfig ynrccSocketConfig;
+
+ private static final Logger logger = LoggerFactory.getLogger(YnrccApiServiceImpl.class);
+
+ @Override
+ public DlpayResp sendToYnrcc(String optype, DlpayReq req) throws Exception {
+ String ip = ynrccSocketConfig.getIp();
+ Integer port = ynrccSocketConfig.getPort();
+ int timeout = ynrccSocketConfig.getTimeout();
+ if (StringUtil.isEmpty(ip) || null == port) {
+ throw new BussinessException("农商行Socket的IP和端口未配置");
+ }
+
+ String sendXml = null;
+ if (DlpayUtil.OPTYPE_BINDCARD.equals(optype)) {
+ //绑定银行卡
+ sendXml = req.getBindCardXml();
+ logger.error("请求【绑定银行卡】发送报文:\n" + sendXml);
+
+ } else if (DlpayUtil.OPTYPE_SIGNCARD.equals(optype)) {
+ sendXml = req.getSignXml();
+ logger.error("请求【银行卡签(解)约】发送报文:\n" + sendXml);
+
+ } else if (DlpayUtil.OPTYPE_CARDPAY.equals(optype)) {
+ sendXml = req.getCardpayXml();
+ logger.error("请求【银行卡代扣】发送报文:\n" + sendXml);
+
+ } else if (DlpayUtil.OPTYPE_CARDPAY.equals(optype)) {
+ sendXml = req.getCardpayXml();
+ logger.error("请求【银行卡代扣】发送报文:\n" + sendXml);
+
+ } else if (DlpayUtil.OPTYPE_PAYREFUND.equals(optype)) {
+ sendXml = req.getPayRefundXml();
+ logger.error("请求【代扣消费退款】发送报文:\n" + sendXml);
+
+ } else if (DlpayUtil.OPTYPE_QUERYRESULT.equals(optype)) {
+ sendXml = req.getQueryResultXml();
+ logger.error("请求【消费结果查询】发送报文:\n" + sendXml);
+
+ } else if (DlpayUtil.OPTYPE_CHKDTL.equals(optype)) {
+ sendXml = req.getChkfileXml();
+ logger.error("请求【获取对账单=" + req.getChkdate() + "】发送报文:\n" + sendXml);
+
+ } else {
+ throw new BussinessException("请求类型[" + optype + "]错误!");
+ }
+
+ String returnXml = DlpayUtil.send(ip, port, timeout, sendXml);
+ logger.error("refno=[" + req.getSn() + "]返回报文:\n" + returnXml);
+
+ if (StringUtil.isEmpty(returnXml)) {
+ throw new Exception("返回报文为空");
+ }
+
+ try {
+ DlpayResp resp = XmlUtils.getXmlToObject(returnXml.substring(8), "GBK", DlpayResp.class);
+ return resp;
+ } catch (Exception e) {
+ throw new BussinessException("返回报文解析异常!");
+ }
+ }
+
+ @Override
+ public String getChkfilePath(String filename) throws Exception {
+ //本地服务器上
+ if (!ynrccSocketConfig.getChkfileIsftp()) {
+ String localFilePath = ynrccSocketConfig.getChkfilePath();
+ if (localFilePath.endsWith("/")) {
+ return localFilePath + filename;
+ } else {
+ return localFilePath + "/" + filename;
+ }
+ }
+
+ //ftp取对账文件
+ String ftpIp = ynrccSocketConfig.getFtpIp();
+ Integer ftpPort = ynrccSocketConfig.getFtpPort();
+ String ftpUsername = ynrccSocketConfig.getFtpUsername();
+ String ftpUserpwd = ynrccSocketConfig.getFtpPassword();
+ String targetPath = ynrccSocketConfig.getFtpTargetPath();
+ String localFilePath = ynrccSocketConfig.getChkfilePath();
+ if (StringUtil.isEmpty(ftpIp) || null == ftpPort || StringUtil.isEmpty(ftpUsername) || StringUtil.isEmpty(ftpUserpwd) || StringUtil.isEmpty(targetPath)) {
+ throw new Exception("ftp参数未配置");
+ }
+
+ FTPClient ftpClient = new FTPClient();
+ try {
+ ftpClient.connect(ftpIp, ftpPort);
+ ftpClient.login(ftpUsername, ftpUserpwd);
+ ftpClient.enterLocalPassiveMode();
+ ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
+
+ String savePath = localFilePath.endsWith("/") ? (localFilePath + filename) : (localFilePath + "/" + filename);
+ String targetFile = targetPath.endsWith("/") ? (targetPath + filename) : (targetPath + "/" + filename);
+ //本地文件
+ File localFile = new File(savePath);
+ File parentDir = localFile.getParentFile();
+ if (!parentDir.exists()) {
+ parentDir.mkdir();
+ }
+
+ OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(localFile));
+ boolean success = ftpClient.retrieveFile(targetFile, outputStream);
+ outputStream.close();
+
+ if (success) {
+ return savePath;
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ } finally {
+ try {
+ if (ftpClient.isConnected()) {
+ ftpClient.logout();
+ ftpClient.disconnect();
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ throw new Exception("获取对账文件失败!");
+ }
+
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/impl/YnrccParamCheckServiceImpl.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/impl/YnrccParamCheckServiceImpl.java
new file mode 100644
index 0000000..52009b1
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/api/service/impl/YnrccParamCheckServiceImpl.java
@@ -0,0 +1,232 @@
+package com.supwisdom.agent.api.service.impl;
+
+import com.supwisdom.agent.Util.ErrorCode;
+import com.supwisdom.agent.Util.MD5;
+import com.supwisdom.agent.Util.StringUtil;
+import com.supwisdom.agent.api.bean.DlpayResp;
+import com.supwisdom.agent.api.service.YnrccParamCheckService;
+import com.supwisdom.agent.config.YnrccSocketConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+@Service
+public class YnrccParamCheckServiceImpl implements YnrccParamCheckService {
+ @Autowired
+ private YnrccSocketConfig ynrccSocketConfig;
+
+ private static final Logger logger = LoggerFactory.getLogger(YnrccParamCheckServiceImpl.class);
+
+ private boolean checkYnrccBaseParam(String transcode, String transdate, String transtime, String refno, String sign_type, String sign, DlpayResp resp) {
+ if (StringUtil.isEmpty(transcode)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[报文业务类型为空]");
+ return false;
+ }
+ if (!StringUtil.checkDatetimeValid(transdate, "yyyyMMdd")) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[交易日期错误]");
+ return false;
+ }
+ if (!StringUtil.checkDatetimeValid(transtime, "HHmmss")) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[交易时间错误]");
+ return false;
+ }
+ if (StringUtil.isEmpty(refno)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[业务请求交易流水号为空]");
+ return false;
+ }
+
+ if (StringUtil.isEmpty(sign_type)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[签名方式为空]");
+ return false;
+ }
+
+ if (StringUtil.isEmpty(sign)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[签名为空]");
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean checkBindCardParam(String transcode, String transdate, String transtime, String refno, String bankcardno, String username, String idtype, String idno, String phone, String categorie, String sign_type, String sign, DlpayResp resp) {
+ if (!checkYnrccBaseParam(transcode, transdate, transtime, refno, sign_type, sign, resp)) {
+ return false;
+ }
+ if (StringUtil.isEmpty(bankcardno)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[用户银行卡号为空]");
+ return false;
+ }
+ if (StringUtil.isEmpty(username)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[用户名为空]");
+ return false;
+ }
+ if (StringUtil.isEmpty(idtype)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[证件类型为空]");
+ return false;
+ }
+ if (StringUtil.isEmpty(idno)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[证件号为空]");
+ return false;
+ }
+ if (StringUtil.isEmpty(phone)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[手机号]");
+ return false;
+ }
+ if (StringUtil.isEmpty(categorie)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[消费类别]");
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean checkSign(Map<String, String> param) {
+ String sign = param.get("sign");
+ String signType = param.get("sign_type");
+ if (!StringUtil.isEmpty(sign)) {
+ String signdata = StringUtil.createLinkString(StringUtil.paraFilter(param));
+ logger.info(signdata);
+
+ String calcSign = null;
+ String md5Key = ynrccSocketConfig.getMd5Key();
+ if ("MD5".equalsIgnoreCase(signType)) {
+ calcSign = MD5.encodeByMD5(signdata + md5Key); //默认MD5
+ }
+
+ if (sign.equalsIgnoreCase(calcSign)) {
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean checkSignCardParam(String transcode, String transdate, String transtime, String refno, String categorie, String bankcardno, String username,
+ String idtype, String idno, String phone, String transtype, String sign_type, String sign, DlpayResp resp) {
+ if (!checkBindCardParam(transcode, transdate, transtime, refno, bankcardno, username, idtype, idno, phone, categorie, sign_type, sign, resp)) {
+ return false;
+ }
+ if (StringUtil.isEmpty(transtype)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[签约标志]");
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean checkCardPayParam(String transcode, String transdate, String transtime, String refno, String categorie, String bankcardno, String username, String idtype, String idno, String merchant_bankcardno, String merchant_bankaccname, Integer amount, String description, String sign_type, String sign, DlpayResp resp) {
+ if (!checkYnrccBaseParam(transcode, transdate, transtime, refno, sign_type, sign, resp)) {
+ return false;
+ }
+ if (StringUtil.isEmpty(categorie)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[消费类别]");
+ return false;
+ }
+ if (StringUtil.isEmpty(bankcardno)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[用户银行卡号为空]");
+ return false;
+ }
+ if (StringUtil.isEmpty(username)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[用户名为空]");
+ return false;
+ }
+// if(StringUtil.isEmpty(idtype)){
+// resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+// resp.setMessage("请求参数错误[证件类型为空]");
+// return false;
+// }
+
+ if (StringUtil.isEmpty(idno)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[证件号为空]");
+ return false;
+ }
+ if (StringUtil.isEmpty(merchant_bankcardno)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[商户银行卡号为空]");
+ return false;
+ }
+ if (StringUtil.isEmpty(merchant_bankaccname)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[商户银行开户名为空]");
+ return false;
+ }
+ if (null == amount) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[交易金额为空]");
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean checkPayRefundParam(String transcode, String transdate, String transtime, String refno, String refundRefno, Integer amount, String description,
+ String sign_type, String sign, DlpayResp resp) {
+ if (!checkYnrccBaseParam(transcode, transdate, transtime, refno, sign_type, sign, resp)) {
+ return false;
+ }
+ if (StringUtil.isEmpty(refundRefno)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[原交易流水号为空]");
+ return false;
+ }
+ if (null == amount) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[交易金额为空]");
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean checkQueryResultParam(String transcode, String transdate, String transtime, String refno, String orignRefno, String sign_type, String sign, DlpayResp resp) {
+ if (!checkYnrccBaseParam(transcode, transdate, transtime, refno, sign_type, sign, resp)) {
+ return false;
+ }
+ if (StringUtil.isEmpty(orignRefno)) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[原交易流水号为空]");
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean checkChkfileParam(String transcode, String transdate, String transtime, String refno, String checkdate, String merchant_bankcardno, String sign_type, String sign, DlpayResp resp) {
+ if (!checkYnrccBaseParam(transcode, transdate, transtime, refno, sign_type, sign, resp)) {
+ return false;
+ }
+
+ if (StringUtil.checkDatetimeValid(checkdate,"yyyyMMdd")) {
+ resp.setCode(ErrorCode.REQ_PARAM_ERROR);
+ resp.setMessage("请求参数错误[对账日期]");
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/ynrcc-agent/src/main/java/com/supwisdom/agent/config/YnrccSocketConfig.java b/ynrcc-agent/src/main/java/com/supwisdom/agent/config/YnrccSocketConfig.java
new file mode 100644
index 0000000..240f133
--- /dev/null
+++ b/ynrcc-agent/src/main/java/com/supwisdom/agent/config/YnrccSocketConfig.java
@@ -0,0 +1,84 @@
+package com.supwisdom.agent.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class YnrccSocketConfig {
+ @Value("${ynrcc.socket.ip}")
+ private String ip;
+
+ @Value("${ynrcc.socket.port}")
+ private Integer port;
+
+ @Value("${ynrcc.socket.timeout}")
+ private int timeout = 10;
+
+ @Value("${ynrcc.md5.key}")
+ private String md5Key;
+
+ @Value("${ynrcc.chkfile.ftp.enabled}")
+ private Boolean chkfileIsftp;
+
+ @Value("${ynrcc.chkfile.ftp.ip}")
+ private String ftpIp;
+
+ @Value("${ynrcc.chkfile.ftp.port}")
+ private Integer ftpPort;
+
+ @Value("${ynrcc.chkfile.local.path}")
+ private String chkfilePath;
+
+ @Value("${ynrcc.chkfile.ftp.username}")
+ private String ftpUsername;
+
+ @Value("${ynrcc.chkfile.ftp.userpwd}")
+ private String ftpPassword;
+
+ @Value("${ynrcc.chkfile.ftp.targetpath}")
+ private String ftpTargetPath;
+
+ public String getIp() {
+ return ip;
+ }
+
+ public Integer getPort() {
+ return port;
+ }
+
+ public int getTimeout() {
+ return timeout;
+ }
+
+ public String getMd5Key() {
+ return md5Key;
+ }
+
+ public Boolean getChkfileIsftp() {
+ return chkfileIsftp;
+ }
+
+ public String getFtpIp() {
+ return ftpIp;
+ }
+
+ public Integer getFtpPort() {
+ return ftpPort;
+ }
+
+ public String getChkfilePath() {
+ return chkfilePath;
+ }
+
+ public String getFtpUsername() {
+ return ftpUsername;
+ }
+
+ public String getFtpPassword() {
+ return ftpPassword;
+ }
+
+ public String getFtpTargetPath() {
+ return ftpTargetPath;
+ }
+}
diff --git a/ynrcc-agent/src/main/resources/application.properties b/ynrcc-agent/src/main/resources/application.properties
new file mode 100644
index 0000000..babfea2
--- /dev/null
+++ b/ynrcc-agent/src/main/resources/application.properties
@@ -0,0 +1,48 @@
+#######################################springboot配置 start#################################
+#spring.application.name=supwisdom.ynrcc.agent
+#spring.cloud.consul.discovery.health-check-path=${management.context-path}/api/common/version
+#spring.cloud.consul.discovery.health-check-interval=10s
+#spring.cloud.consul.discovery.instanceId=${spring.application.name}:${spring.application.instance_id:${random.value}}
+##################### 单库数据库配置 ##############################
+#spring.jpa.show-sql=true
+#s#pring.datasource.hikari.connection-timeout=60000
+#spring.datasource.hikari.maximum-pool-size=5
+#spring.jpa.hibernate.ddl-auto=update
+##################### redis ##############################
+#spring.redis.host=172.28.201.101
+#spring.redis.port=16379
+#spring.redis.password=kingstar
+#spring.redis.database=0
+# logging
+logging.config=classpath:logback.xml
+logging.level.root=info
+
+#logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n
+#logging.level.com.supwisdom.agent=info
+#logging.file=./log/ynrccagent.txt
+#logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n
+#################### JSP PAGE ####################
+server.servlet.context-path=/ynrccagent
+################## 全局字符编码设置 ######################
+spring.http.encoding.force=true
+spring.http.encoding.charset=UTF-8
+spring.http.encoding.enabled=true
+server.tomcat.uri-encoding=UTF-8
+##################################################
+## quartz task scheduler
+#dayend.settletask.cron = 0 0/2 * * * ?
+############# YNRCC SOCKET ###############
+ynrcc.socket.ip=127.0.0.1
+ynrcc.socket.port=8089
+## 超时时间(分钟)
+ynrcc.socket.timeout=10
+ynrcc.md5.key=80816b7947ed016bff8079557735006e
+ynrcc.chkfile.ftp.enabled=false
+ynrcc.chkfile.local.path=/opt/supwisdom/chkfile
+ynrcc.chkfile.ftp.ip=
+ynrcc.chkfile.ftp.port=
+ynrcc.chkfile.ftp.username=
+ynrcc.chkfile.ftp.userpwd=
+ynrcc.chkfile.ftp.targetpath=/
+
+
diff --git a/ynrcc-agent/src/main/resources/logback.xml b/ynrcc-agent/src/main/resources/logback.xml
new file mode 100644
index 0000000..5d0d4bd
--- /dev/null
+++ b/ynrcc-agent/src/main/resources/logback.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <!-- 格式化输出:%date表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %msg:日志消息,%n是换行符-->
+ <property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n"/>
+ <!-- 定义日志存储的路径,不要配置相对路径 -->
+ <property name="FILE_PATH" value="./log/ynrccagent.%d{yyyy-MM-dd}.%i.log" />
+
+ <!-- 控制台输出日志 -->
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <!-- 按照上面配置的LOG_PATTERN来打印日志 -->
+ <pattern>${LOG_PATTERN}</pattern>
+ </encoder>
+ </appender>
+
+ <!--每天生成一个日志文件,保存15天的日志文件。rollingFile是用来切分文件的 -->
+ <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <!--日志文件输出的文件名-->
+ <FileNamePattern>${FILE_PATH}</FileNamePattern>
+ <!-- 日志文件最大尺寸 -->
+ <maxFileSize>100MB</maxFileSize>
+ <!--日志文件保留天数-->
+ <!--<MaxHistory>365</MaxHistory>-->
+ </rollingPolicy>
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>${LOG_PATTERN}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- project default level -->
+ <logger name="src" level="INFO"/>
+
+ <!-- 日志输出级别 常用的日志级别按照从高到低依次为:ERROR、WARN、INFO、DEBUG。 -->
+ <root level="INFO">
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+</configuration>
\ No newline at end of file
diff --git a/ynrcc-agent/src/test/java/com/supwisdom/agent/api/controller/YnrccApiControllerTest.java b/ynrcc-agent/src/test/java/com/supwisdom/agent/api/controller/YnrccApiControllerTest.java
new file mode 100644
index 0000000..25746e0
--- /dev/null
+++ b/ynrcc-agent/src/test/java/com/supwisdom/agent/api/controller/YnrccApiControllerTest.java
@@ -0,0 +1,7 @@
+package com.supwisdom.agent.api.controller;
+
+import static org.junit.Assert.*;
+
+public class YnrccApiControllerTest {
+
+}
\ No newline at end of file
diff --git a/ynrcc-agent/src/test/resources/bank_20190718.txt b/ynrcc-agent/src/test/resources/bank_20190718.txt
new file mode 100644
index 0000000..1831d7a
--- /dev/null
+++ b/ynrcc-agent/src/test/resources/bank_20190718.txt
@@ -0,0 +1,4 @@
+3|600|2|300|1|300|
+20190701|132234|BC5512|20190614135011000011|20190701132234BK00001|6223900000000000001|6321980000000000002|20190701|100|市民卡代扣消费|
+20190701|134434|BC5512|20190614135011000012|20190701132234BK00002|6223900000000000001|6321980000000000002|20190702|200|市民卡代扣消费|
+20190701|142234|BC5513|20190614135011000013|20190701132234BK00003|6223900000000000001|6321980000000000002|20190701|300|退款|
\ No newline at end of file