更新了框架代码
diff --git a/build.gradle b/build.gradle
index 789c2d5..471af3a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,6 +3,7 @@
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.jpa'
id 'org.jetbrains.kotlin.plugin.spring'
+ id "com.palantir.git-version" version "0.12.0-rc2"
id 'com.palantir.docker' version '0.22.1'
}
@@ -14,6 +15,14 @@
waterManagerVersion = gitVersion()
repositories {
mavenCentral()
+
+ maven {
+ url "http://ykt-nx.supwisdom.com/repository/ecard-repo/"
+ credentials {
+ username 'ecard'
+ password 'Ecard4SUP'
+ }
+ }
}
def startClass = 'com.supwisdom.dlpay.WaterManagerApplicationKt'
@@ -52,6 +61,10 @@
implementation 'org.springframework.boot:spring-boot-starter-security'
// implementation 'org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.0.1.RELEASE'
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.security.oauth:spring-security-oauth2'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.session:spring-session-data-redis'
@@ -60,7 +73,7 @@
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
-
+ implementation 'com.github.penggle:kaptcha:2.3.2'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
implementation 'org.postgresql:postgresql:42.2.5'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
@@ -75,9 +88,12 @@
implementation group: 'commons-codec', name: 'commons-codec', version: '1.6'
implementation files('libs/ojdbc6.jar')
-
+ annotationProcessor 'org.projectlombok:lombok:1.18.8'
+ compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
-
+
+ compile 'com.supwisdom:payapi-sdk:e4bf762'
+
// 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'
diff --git a/src/main/java/com/supwisdom/dlpay/framework/KaptchaConfig.java b/src/main/java/com/supwisdom/dlpay/framework/KaptchaConfig.java
new file mode 100644
index 0000000..c69dc38
--- /dev/null
+++ b/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/JwtTokenUtil.java b/src/main/java/com/supwisdom/dlpay/framework/core/JwtTokenUtil.java
index 481df61..8ef087f 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/core/JwtTokenUtil.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/core/JwtTokenUtil.java
@@ -1,5 +1,6 @@
package com.supwisdom.dlpay.framework.core;
+import com.supwisdom.dlpay.framework.util.Constants;
import org.jose4j.jwa.AlgorithmConstraints;
import org.jose4j.jwk.JsonWebKey;
import org.jose4j.jws.AlgorithmIdentifiers;
@@ -13,7 +14,6 @@
import org.springframework.security.core.userdetails.UserDetails;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
public class JwtTokenUtil {
@@ -40,11 +40,14 @@
if (params.get("subject") != null) {
claims.setSubject(params.get("subject").toString()); // the subject/principal is whom the token is about
}
- if (params.get("authorities") != null) {
- claims.setClaim("authorities", params.get("authorities"));
+ if (params.get(Constants.JWT_CLAIM_AUTHORITIES) != null) {
+ claims.setClaim(Constants.JWT_CLAIM_AUTHORITIES, params.get(Constants.JWT_CLAIM_AUTHORITIES));
}
- if(params.get("uid") != null) {
- claims.setClaim("uid", params.get("uid"));
+ if (params.get(Constants.JWT_CLAIM_UID) != null) {
+ claims.setClaim(Constants.JWT_CLAIM_UID, params.get(Constants.JWT_CLAIM_UID));
+ }
+ if (params.get(Constants.JWT_CLAIM_TENANTID) != null) {
+ claims.setClaim(Constants.JWT_CLAIM_TENANTID, params.get(Constants.JWT_CLAIM_TENANTID));
}
/*
claims.setClaim("email", "mail@example.com"); // additional claims/attributes about the subject can be added
@@ -81,7 +84,7 @@
.setVerificationKey(key.getKey()) // verify the signature with the public key
.setSkipDefaultAudienceValidation()
.setJwsAlgorithmConstraints( // only allow the expected signature algorithm(s) in the given context
- new AlgorithmConstraints(org.jose4j.jwa.AlgorithmConstraints.ConstraintType.WHITELIST, // which is only RS256 here
+ new AlgorithmConstraints(AlgorithmConstraints.ConstraintType.WHITELIST, // which is only RS256 here
AlgorithmIdentifiers.HMAC_SHA256))
.build(); // create the JwtConsumer instance
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java
index 05e15ea..e31166d 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java
@@ -9,5 +9,5 @@
@Repository
public interface DictionaryDao extends JpaRepository<TDictionary, TDictionaryPK> {
- List<TDictionary> findAllByDicttype(int dicttype);
+ List<TDictionary> findAllByDicttype(String dicttype);
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorDao.java
index 27b511f..545af83 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorDao.java
@@ -1,11 +1,8 @@
package com.supwisdom.dlpay.framework.dao;
import com.supwisdom.dlpay.framework.domain.TOperator;
-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.JpaSpecificationExecutor;
-import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@Repository
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/PeriodDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/PeriodDao.java
deleted file mode 100644
index aa05bd7..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/PeriodDao.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TPeriod;
-import com.supwisdom.dlpay.framework.domain.TPeriodPK;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import javax.persistence.LockModeType;
-
-@Repository
-public interface PeriodDao extends JpaRepository<TPeriod, TPeriodPK> {
- @Query(value = "from TPeriod t where t.periodYear=:periodyear and t.periodMonth=:periodmonth ")
- TPeriod getPeriod(@Param("periodyear") Integer periodyear, @Param("periodmonth") Integer periodmonth);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query(value = "from TPeriod t where t.periodYear=:periodyear and t.periodMonth=:periodmonth ")
- TPeriod getTPeriodWithLock(@Param("periodyear") Integer periodyear, @Param("periodmonth") Integer periodmonth);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
index d1f2d37..15df54c 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
@@ -2,7 +2,6 @@
import com.supwisdom.dlpay.framework.data.NodeData;
import com.supwisdom.dlpay.framework.domain.TRoleFunction;
-import com.supwisdom.dlpay.system.bean.ZTreeNode;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@@ -18,11 +17,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/src/main/java/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java
deleted file mode 100644
index ec8fadc..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TSettlectl;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import javax.persistence.LockModeType;
-
-@Repository
-public interface SettleCtlDao extends JpaRepository<TSettlectl, Integer> {
- @Lock(value = LockModeType.PESSIMISTIC_WRITE)
- TSettlectl findByBooksetno(Integer booksetno);
-
- @Lock(value = LockModeType.PESSIMISTIC_WRITE)
- @Query(value = "from TSettlectl where booksetno=:booksetno ")
- TSettlectl findByBooksetnoWithLock(@Param("booksetno") Integer booksetno);
-
- @Modifying(clearAutomatically = true)
- @Query(value = "update TB_SETTLECTL set PERIODYEAR=:peridyear,PERIODMONTH=:peridmonth where BOOKSETNO=1 ", nativeQuery = true)
- void updateSettlePeriod(@Param("peridyear") int peridyear, @Param("peridmonth") int peridmonth);
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/TranscodeDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/TranscodeDao.java
deleted file mode 100644
index d40f266..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/TranscodeDao.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TTranscode;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface TranscodeDao extends JpaRepository<TTranscode, Integer> {
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/data/SystemDateTime.java b/src/main/java/com/supwisdom/dlpay/framework/data/SystemDateTime.java
index baaa274..b876d9d 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/data/SystemDateTime.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/data/SystemDateTime.java
@@ -1,6 +1,6 @@
package com.supwisdom.dlpay.framework.data;
-import java.util.Date;
+import java.sql.Timestamp;
public interface SystemDateTime {
String getHostdate();
@@ -9,5 +9,6 @@
String getHostdatetime();
- Date getSysdate();
+ Timestamp getSysdate();
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/ApiClientRedis.java b/src/main/java/com/supwisdom/dlpay/framework/domain/ApiClientRedis.java
index d7bb016..1be3460 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/ApiClientRedis.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/ApiClientRedis.java
@@ -15,6 +15,7 @@
String loginTimestamp;
+
public String getId() {
return id;
}
@@ -46,4 +47,5 @@
public void setRoles(String roles) {
this.roles = roles;
}
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/DictionaryTable.java b/src/main/java/com/supwisdom/dlpay/framework/domain/DictionaryTable.java
new file mode 100644
index 0000000..7d1d36a
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/DictionaryTable.java
@@ -0,0 +1,7 @@
+package com.supwisdom.dlpay.framework.domain;
+
+public interface DictionaryTable {
+ String getDictKey();
+
+ Object getDictValue();
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/JwtRedis.java b/src/main/java/com/supwisdom/dlpay/framework/domain/JwtRedis.java
index 01828e0..47ece23 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/JwtRedis.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/JwtRedis.java
@@ -4,7 +4,7 @@
import org.springframework.data.redis.core.RedisHash;
-@RedisHash("api_jwt")
+@RedisHash(value = "api_jwt", timeToLive = 3600L)
public class JwtRedis {
@Id
String jti;
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TApiClient.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TApiClient.java
index 385bff9..ac8eb1d 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TApiClient.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TApiClient.java
@@ -1,9 +1,12 @@
package com.supwisdom.dlpay.framework.domain;
+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.validation.constraints.NotNull;
@Entity
@Table(name = "TB_APICLIENT")
@@ -21,6 +24,13 @@
@Column(name = "roles", length = 300)
private String roles;
+ @Column(name = "BCRYPT_SECRET", nullable = false, length = 64)
+ private String bcryptSecret;
+
+ @Column(name = "THIRDURL", length = 200)
+ private String thirdurl;
+
+
public String getAppid() {
return appid;
}
@@ -35,6 +45,7 @@
public void setSecret(String secret) {
this.secret = secret;
+ this.bcryptSecret = new BCryptPasswordEncoder().encode(secret);
}
public String getStatus() {
@@ -52,4 +63,17 @@
public void setRoles(String roles) {
this.roles = roles;
}
+
+ public String getBcryptSecret() {
+ return bcryptSecret;
+ }
+
+ public String getThirdurl() {
+ return thirdurl;
+ }
+
+ public void setThirdurl(String thirdurl) {
+ this.thirdurl = thirdurl;
+ }
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TBusinesspara.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TBusinesspara.java
index 6c6691e..4a697c6 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TBusinesspara.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TBusinesspara.java
@@ -4,6 +4,7 @@
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "TB_BUSINESSPARA")
@@ -38,4 +39,5 @@
public void setParaval(String paraval) {
this.paraval = paraval;
}
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
index 461ef29..c838c3a 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
@@ -1,14 +1,16 @@
package com.supwisdom.dlpay.framework.domain;
import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
@Table(name = "TB_DICTIONARY")
@IdClass(TDictionaryPK.class)
-public class TDictionary {
+public class TDictionary implements DictionaryTable, Serializable {
@Id
- @Column(name = "DICTTYPE", nullable = false, precision = 9)
- private Integer dicttype;
+ @Column(name = "DICTTYPE", nullable = false)
+ private String dicttype;
@Id
@Column(name = "DICTVAL", nullable = false, length = 30)
@@ -20,11 +22,11 @@
@Column(name = "DICTCAPTION", length = 60)
private String dictcaption;
- public Integer getDicttype() {
+ public String getDicttype() {
return dicttype;
}
- public void setDicttype(Integer dicttype) {
+ public void setDicttype(String dicttype) {
this.dicttype = dicttype;
}
@@ -51,4 +53,14 @@
public void setDictcaption(String dictcaption) {
this.dictcaption = dictcaption;
}
+
+ @Override
+ public String getDictKey() {
+ return this.dictval;
+ }
+
+ @Override
+ public Object getDictValue() {
+ return this.dictcaption;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionaryPK.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionaryPK.java
index 04874e2..1dbb4c8 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionaryPK.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionaryPK.java
@@ -6,18 +6,18 @@
public class TDictionaryPK implements Serializable {
@Id
- @Column(name = "DICTTYPE", nullable = false, precision = 9)
- private Integer dicttype;
+ @Column(name = "DICTTYPE", nullable = false)
+ private String dicttype;
@Id
@Column(name = "DICTVAL", nullable = false, length = 30)
private String dictval;
- public Integer getDicttype() {
+ public String getDicttype() {
return dicttype;
}
- public void setDicttype(Integer dicttype) {
+ public void setDicttype(String dicttype) {
this.dicttype = dicttype;
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TFunction.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TFunction.java
index 2f3b83c..5d64c48 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TFunction.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TFunction.java
@@ -1,38 +1,43 @@
package com.supwisdom.dlpay.framework.domain;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
@Table(name = "TB_FUNCTION")
-@SequenceGenerator(name="SEQ_FUNC",sequenceName="SEQ_FUNC",allocationSize=1)
-public class TFunction {
+@JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
+@SequenceGenerator(name = "SEQ_FUNC", sequenceName = "SEQ_FUNC", allocationSize = 1, initialValue = 1000)
+public class TFunction implements Serializable {
@Id
- @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_FUNC")
- @Column(name="ID", nullable = false)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_FUNC")
+ @Column(name = "ID", nullable = false)
private Integer id;
- @Column(name="PARENTID")
+ @Column(name = "PARENTID")
private Integer parentId;
- @Column(name="NAME", length = 32)
+ @Column(name = "NAME", length = 32)
private String name;
- @Column(name="MENUURL", nullable = false, length = 60)
+ @Column(name = "MENUURL", nullable = false, length = 60)
private String menuUrl; //菜单url
- @Column(name="ISLEAF", nullable = false, precision = 1)
+ @Column(name = "ISLEAF", nullable = false, precision = 1)
private Integer isLeaf;
- @Column(name="ORDERNUM", precision = 9)
+ @Column(name = "ORDERNUM", precision = 9)
private Integer orderNum;
- @Column(name="MENUICON", precision = 9)
+ @Column(name = "MENUICON", precision = 9)
private String menuIcon;
- @Column(name="CREATETIME", length = 14)
+ @Column(name = "CREATETIME", length = 14)
private String createtime;
- @Column(name="LASTSAVED", length = 14)
+ @Column(name = "LASTSAVED", length = 14)
private String lastsaved;
public Integer getId() {
@@ -106,4 +111,5 @@
public void setLastsaved(String lastsaved) {
this.lastsaved = lastsaved;
}
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperLog.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TOperLog.java
index 1243efd..5c21e78 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperLog.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TOperLog.java
@@ -3,97 +3,99 @@
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "TB_OPER_LOG")
public class TOperLog {
- @Id
- @GenericGenerator(name = "idGenerator", strategy = "uuid")
- @GeneratedValue(generator = "idGenerator")
- @Column(name = "ID", nullable = false, length = 32)
- private String id;
+ @Id
+ @GenericGenerator(name = "idGenerator", strategy = "uuid")
+ @GeneratedValue(generator = "idGenerator")
+ @Column(name = "ID", nullable = false, length = 32)
+ private String id;
- @Column(name = "OPERID", nullable = false, length = 32)
- private String operid;
- @Column(name = "OPERNAME")
- private String opername;
+ @Column(name = "OPERID", nullable = false, length = 32)
+ private String operid;
+ @Column(name = "OPERNAME")
+ private String opername;
- @Column(name = "RESNAME")
- private String resname;
+ @Column(name = "RESNAME")
+ private String resname;
- @Column(name = "RESPATH")
- private String respath;
+ @Column(name = "RESPATH")
+ private String respath;
- @Column(name = "LOGDATE")
- private String logdate;
+ @Column(name = "LOGDATE")
+ private String logdate;
- @Column(name = "FUNCTIONID")
- private Integer functionid;
+ @Column(name = "FUNCTIONID")
+ private Integer functionid;
- @Column(name = "FUNCTIONNAME")
- private String functionname;
+ @Column(name = "FUNCTIONNAME")
+ private String functionname;
- public Integer getFunctionid() {
- return functionid;
- }
+ public Integer getFunctionid() {
+ return functionid;
+ }
- public void setFunctionid(Integer functionid) {
- this.functionid = functionid;
- }
+ public void setFunctionid(Integer functionid) {
+ this.functionid = functionid;
+ }
- public String getFunctionname() {
- return functionname;
- }
+ public String getFunctionname() {
+ return functionname;
+ }
- public void setFunctionname(String functionname) {
- this.functionname = functionname;
- }
+ public void setFunctionname(String functionname) {
+ this.functionname = functionname;
+ }
- public String getId() {
- return id;
- }
+ public String getId() {
+ return id;
+ }
- public void setId(String id) {
- this.id = id;
- }
+ public void setId(String id) {
+ this.id = id;
+ }
- public String getOperid() {
- return operid;
- }
+ public String getOperid() {
+ return operid;
+ }
- public void setOperid(String operid) {
- this.operid = operid;
- }
+ public void setOperid(String operid) {
+ this.operid = operid;
+ }
- public String getOpername() {
- return opername;
- }
+ public String getOpername() {
+ return opername;
+ }
- public void setOpername(String opername) {
- this.opername = opername;
- }
+ public void setOpername(String opername) {
+ this.opername = opername;
+ }
- public String getResname() {
- return resname;
- }
+ public String getResname() {
+ return resname;
+ }
- public void setResname(String resname) {
- this.resname = resname;
- }
+ public void setResname(String resname) {
+ this.resname = resname;
+ }
- public String getRespath() {
- return respath;
- }
+ public String getRespath() {
+ return respath;
+ }
- public void setRespath(String respath) {
- this.respath = respath;
- }
+ public void setRespath(String respath) {
+ this.respath = respath;
+ }
- public String getLogdate() {
- return logdate;
- }
+ public String getLogdate() {
+ return logdate;
+ }
- public void setLogdate(String logdate) {
- this.logdate = logdate;
- }
+ public void setLogdate(String logdate) {
+ this.logdate = logdate;
+ }
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperRole.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TOperRole.java
index d17c273..14b510c 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperRole.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TOperRole.java
@@ -3,6 +3,7 @@
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "TB_OPER_ROLE",
@@ -14,10 +15,12 @@
@Column(name = "ID", nullable = false, length = 32)
private String id;
- @Column(name = "ROLEID", nullable = false, length = 32)
+ @Column(name = "ROLEID", length = 32)
+ @NotNull
private String roleId;
- @Column(name = "OPERID", nullable = false, length = 32)
+ @Column(name = "OPERID", length = 32)
+ @NotNull
private String operid;
public String getId() {
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
index cfcbeea..6c12879 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
@@ -6,6 +6,7 @@
import org.springframework.security.core.userdetails.UserDetails;
import javax.persistence.*;
+import javax.validation.constraints.NotNull;
import java.util.Collection;
@Entity
@@ -19,19 +20,24 @@
@Column(name = "OPERID", nullable = false, length = 32)
private String operid;
- @Column(name = "OPERCODE", nullable = false, length = 20)
+ @Column(name = "OPERCODE", length = 20)
+ @NotNull
private String opercode;
- @Column(name = "OPERTYPE", nullable = false, length = 20)
+ @Column(name = "OPERTYPE", length = 20)
+ @NotNull
private String opertype;
- @Column(name = "OPERNAME", nullable = false, length = 100)
+ @Column(name = "OPERNAME", length = 100)
+ @NotNull
private String opername;
- @Column(name = "OPERPWD", nullable = false, length = 80)
+ @Column(name = "OPERPWD", length = 80)
+ @NotNull
private String operpwd;
- @Column(name = "STATUS", nullable = false, length = 32)
+ @Column(name = "STATUS", length = 32)
+ @NotNull
private String status;
@Column(name = "SEX", length = 10)
@@ -51,6 +57,11 @@
@Transient
private String roleids;
+
+ @Column(name = "thirdadmin", length = 20)
+ @NotNull
+ private String thirdadmin;
+
@Transient
private Collection<? extends GrantedAuthority> authorities; //权限
@@ -210,4 +221,12 @@
public void setRoleids(String roleids) {
this.roleids = roleids;
}
+
+ 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/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriod.java
deleted file mode 100644
index 4334eae..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriod.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.supwisdom.dlpay.framework.domain;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "TB_PERIOD")
-@IdClass(TPeriodPK.class)
-public class TPeriod {
- @Id
- @Column(name="PERIOD_YEAR", nullable = false, precision = 4)
- private Integer periodYear;
-
- @Id
- @Column(name="PERIOD_MONTH", nullable = false, precision = 2)
- private Integer periodMonth;
-
- @Column(name="STARTDATE", nullable = false, length = 8)
- private String startdate;
-
- @Column(name="ENDDATE", nullable = false, length = 8)
- private String enddate;
-
- @Column(name="SETTLEFLAG", nullable = false, precision = 1)
- private Integer settleflag=0;
-
- public Integer getPeriodYear() {
- return periodYear;
- }
-
- public void setPeriodYear(Integer periodYear) {
- this.periodYear = periodYear;
- }
-
- public Integer getPeriodMonth() {
- return periodMonth;
- }
-
- public void setPeriodMonth(Integer periodMonth) {
- this.periodMonth = periodMonth;
- }
-
- public String getStartdate() {
- return startdate;
- }
-
- public void setStartdate(String startdate) {
- this.startdate = startdate;
- }
-
- public String getEnddate() {
- return enddate;
- }
-
- public void setEnddate(String enddate) {
- this.enddate = enddate;
- }
-
- public Integer getSettleflag() {
- return settleflag;
- }
-
- public void setSettleflag(Integer settleflag) {
- this.settleflag = settleflag;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriodPK.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriodPK.java
deleted file mode 100644
index e307db3..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TPeriodPK.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.supwisdom.dlpay.framework.domain;
-
-import javax.persistence.Column;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class TPeriodPK implements Serializable {
-
- @Id
- @Column(name="PERIOD_YEAR", nullable = false, precision = 4)
- private Integer periodYear;
-
- @Id
- @Column(name="PERIOD_MONTH", nullable = false, precision = 2)
- private Integer periodMonth;
-
- public Integer getPeriodYear() {
- return periodYear;
- }
-
- public void setPeriodYear(Integer periodYear) {
- this.periodYear = periodYear;
- }
-
- public Integer getPeriodMonth() {
- return periodMonth;
- }
-
- public void setPeriodMonth(Integer periodMonth) {
- this.periodMonth = periodMonth;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- TPeriodPK tPeriodPK = (TPeriodPK) o;
- if (periodYear != null ? !periodYear.equals(tPeriodPK.getPeriodYear()) : periodYear != null)
- return false;
- if (periodMonth != null ? !periodMonth.equals(tPeriodPK.getPeriodMonth()) : periodMonth != null)
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = periodYear != null ? periodYear.hashCode() : 0;
- result = 31 * result + (periodMonth != null ? periodMonth.hashCode() : 0);
- return result;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TPermission.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TPermission.java
index f9a2368..be11862 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TPermission.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TPermission.java
@@ -3,54 +3,57 @@
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "TB_PERMISSION")
public class TPermission {
- @Id
- @GenericGenerator(name = "idGenerator", strategy = "uuid")
- @GeneratedValue(generator = "idGenerator")
- @Column(name = "ID", nullable = false, length = 32)
- private String id;
+ @Id
+ @GenericGenerator(name = "idGenerator", strategy = "uuid")
+ @GeneratedValue(generator = "idGenerator")
+ @Column(name = "ID", nullable = false, length = 32)
+ private String id;
- @Column(name = "ROLE_FUNC_ID", length = 32)
- private String roleFuncId;
+ @Column(name = "ROLE_FUNC_ID", length = 32)
+ private String roleFuncId;
- @Column(name = "RESID")
- private Integer resid;
+ @Column(name = "RESID")
+ @NotNull
+ private Integer resid;
- @Column(name = "ROLEID",length = 32)
- private String roleId;
+ @Column(name = "ROLEID", length = 32)
+ @NotNull
+ private String roleId;
- public String getRoleId() {
- return roleId;
- }
+ public String getRoleId() {
+ return roleId;
+ }
- public void setRoleId(String roleId) {
- this.roleId = roleId;
- }
+ public void setRoleId(String roleId) {
+ this.roleId = roleId;
+ }
- public String getId() {
- return id;
- }
+ public String getId() {
+ return id;
+ }
- public void setId(String id) {
- this.id = id;
- }
+ public void setId(String id) {
+ this.id = id;
+ }
- public String getRoleFuncId() {
- return roleFuncId;
- }
+ public String getRoleFuncId() {
+ return roleFuncId;
+ }
- public void setRoleFuncId(String roleFuncId) {
- this.roleFuncId = roleFuncId;
- }
+ public void setRoleFuncId(String roleFuncId) {
+ this.roleFuncId = roleFuncId;
+ }
- public Integer getResid() {
- return resid;
- }
+ public Integer getResid() {
+ return resid;
+ }
- public void setResid(Integer resid) {
- this.resid = resid;
- }
+ public void setResid(Integer resid) {
+ this.resid = resid;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java
index 63044cb..71f4fc5 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java
@@ -1,17 +1,19 @@
package com.supwisdom.dlpay.framework.domain;
import javax.persistence.*;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "TB_RESOURCE")
-@SequenceGenerator(name="SEQ_RES",sequenceName="SEQ_RES",allocationSize=1)
+@SequenceGenerator(name = "SEQ_RES", sequenceName = "SEQ_RES", allocationSize = 1)
public class TResource {
@Id
- @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_RES")
- @Column(name = "ID", nullable = false,length = 9)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_RES")
+ @Column(name = "ID", nullable = false, length = 9)
private Integer id;
- @Column(name = "CODE", nullable = false, length = 32)
+ @Column(name = "CODE", length = 32)
+ @NotNull
private String code;
@Column(name = "NAME", length = 32)
@@ -20,7 +22,8 @@
@Column(name = "URI", length = 32)
private String uri;
- @Column(name = "FUNCTION_ID", nullable = false, length = 32)
+ @Column(name = "FUNCTION_ID", length = 32)
+ @NotNull
private Integer functionId;
public Integer getId() {
@@ -62,4 +65,5 @@
public void setFunctionId(Integer functionId) {
this.functionId = functionId;
}
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TRole.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TRole.java
index 3112259..4f57b16 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TRole.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TRole.java
@@ -3,6 +3,7 @@
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "TB_ROLE")
@@ -10,25 +11,29 @@
@Id
@GenericGenerator(name = "idGenerator", strategy = "uuid")
@GeneratedValue(generator = "idGenerator")
- @Column(name="ROLEID", nullable = false, length = 32)
+ @Column(name = "ROLEID", nullable = false, length = 32)
private String roleId;
- @Column(name="ROLENAME", nullable = false, length = 60)
+ @Column(name = "ROLENAME", length = 60)
+ @NotNull
private String roleName;
- @Column(name="ROLECODE", nullable = false, length = 20)
+ @Column(name = "ROLECODE", length = 20)
+ @NotNull
private String roleCode;
- @Column(name="ROLEDESC", length = 60)
+ @Column(name = "ROLEDESC", length = 60)
private String roleDesc;
- @Column(name="EDITFLAG", length = 60)
+ @Column(name = "EDITFLAG", length = 60)
+ @NotNull
private Integer editflag;
- @Column(name="CREATETIME", length = 14)
+ @Column(name = "CREATETIME", length = 14)
+ @NotNull
private String createtime;
- @Column(name="LASTSAVED", length = 14)
+ @Column(name = "LASTSAVED", length = 14)
private String lastsaved;
public String getRoleId() {
@@ -86,4 +91,5 @@
public void setLastsaved(String lastsaved) {
this.lastsaved = lastsaved;
}
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TRoleFunction.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TRoleFunction.java
index c5e9f05..6c34f5a 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TRoleFunction.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TRoleFunction.java
@@ -3,6 +3,7 @@
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "TB_ROLE_FUNCTION")
@@ -10,16 +11,18 @@
@Id
@GenericGenerator(name = "idGenerator", strategy = "uuid")
@GeneratedValue(generator = "idGenerator")
- @Column(name="ID", nullable = false, length = 32)
+ @Column(name = "ID", nullable = false, length = 32)
private String id;
- @Column(name="ROLEID", nullable = false, length = 32)
+ @Column(name = "ROLEID", length = 32)
+ @NotNull
private String roleId;
- @Column(name="FUNCTIONID", nullable = false, length = 32)
+ @Column(name = "FUNCTIONID", length = 32)
+ @NotNull
private Integer functionId;
- @Column(name="PERMISSIONS", length = 200)
+ @Column(name = "PERMISSIONS", length = 200)
private String permissions;
public String getId() {
@@ -53,4 +56,5 @@
public void setPermissions(String permissions) {
this.permissions = permissions;
}
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TSettlectl.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TSettlectl.java
deleted file mode 100644
index 73dbf10..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TSettlectl.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.supwisdom.dlpay.framework.domain;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "TB_SETTLECTL")
-public class TSettlectl {
- @Id
- @Column(name="BOOKSETNO", nullable = false, precision = 2)
- private Integer booksetno;
-
- @Column(name="PERIODYEAR", nullable = false, precision = 4)
- private Integer periodYear;
-
- @Column(name="PERIODMONTH", nullable = false, precision = 2)
- private Integer periodMonth;
-
- @Column(name="STATDATE", precision = 8)
- private Integer statdate;
-
- @Column(name="SETTLEDATE",nullable = false, precision = 8)
- private Integer settledate;
-
- @Column(name="STATUS", nullable = false, precision = 1)
- private Integer status;
-
- @Column(name="UPDTIME", length = 14)
- private String updtime;
-
- public Integer getBooksetno() {
- return booksetno;
- }
-
- public void setBooksetno(Integer booksetno) {
- this.booksetno = booksetno;
- }
-
- public Integer getPeriodYear() {
- return periodYear;
- }
-
- public void setPeriodYear(Integer periodYear) {
- this.periodYear = periodYear;
- }
-
- public Integer getPeriodMonth() {
- return periodMonth;
- }
-
- public void setPeriodMonth(Integer periodMonth) {
- this.periodMonth = periodMonth;
- }
-
- public Integer getStatdate() {
- return statdate;
- }
-
- public void setStatdate(Integer statdate) {
- this.statdate = statdate;
- }
-
- public Integer getSettledate() {
- return settledate;
- }
-
- public void setSettledate(Integer settledate) {
- this.settledate = settledate;
- }
-
- public Integer getStatus() {
- return status;
- }
-
- public void setStatus(Integer status) {
- this.status = status;
- }
-
- public String getUpdtime() {
- return updtime;
- }
-
- public void setUpdtime(String updtime) {
- this.updtime = updtime;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TSyspara.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TSyspara.java
index 50cd0f7..1c57336 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TSyspara.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TSyspara.java
@@ -9,6 +9,7 @@
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "TB_SYSPARA")
@@ -29,16 +30,19 @@
@Column(name = "VALUETYPE", length = 10)
private String valueType = SysparaUtil.SYSPARA_VALUETYPE_STRING;
- @Column(name = "EDITFLAG", nullable = false, precision = 1)
+ @Column(name = "EDITFLAG", precision = 1)
+ @NotNull
private Integer editflag;
@Column(name = "DISPLAYFLAG", length = 10)
+ @NotNull
private String displayflag;
@Column(name = "REMARK", length = 240)
private String remark;
@Column(name = "LASTSAVED", length = 14)
+ @NotNull
private String lastsaved;
public TSyspara() {
@@ -135,6 +139,7 @@
/**
* 判断参数是否非法
+ *
* @return 非法 -> true; 合法 -> false
*/
public boolean checkValueInvalid() {
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TTaskLock.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TTaskLock.java
index 72912c7..c3b29be 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TTaskLock.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TTaskLock.java
@@ -5,6 +5,7 @@
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "TB_TASK_LOCK")
@@ -22,6 +23,7 @@
@Column(name="REMARK", length = 600)
private String remark;
+
public String getTaskcode() {
return taskcode;
}
@@ -53,4 +55,5 @@
public void setRemark(String remark) {
this.remark = remark;
}
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java
deleted file mode 100644
index f4bb2f0..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.supwisdom.dlpay.framework.domain;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "TB_TRANSCODE")
-public class TTranscode {
- @Id
- @Column(name="TRANSCODE", nullable = false, precision = 4)
- private Integer transcode;
-
- @Column(name="TRANSNAME", nullable = false, length = 100)
- private String transname;
-
- public Integer getTranscode() {
- return transcode;
- }
-
- public void setTranscode(Integer transcode) {
- this.transcode = transcode;
- }
-
- public String getTransname() {
- return transname;
- }
-
- public void setTransname(String transname) {
- this.transname = transname;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/filter/CrosXssFilter.java b/src/main/java/com/supwisdom/dlpay/framework/filter/CrosXssFilter.java
new file mode 100644
index 0000000..eafa20c
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/filter/CrosXssFilter.java
@@ -0,0 +1,54 @@
+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 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/src/main/java/com/supwisdom/dlpay/framework/filter/ValidateCodeFilter.java b/src/main/java/com/supwisdom/dlpay/framework/filter/ValidateCodeFilter.java
old mode 100755
new mode 100644
index 491a2e0..c58260d
--- a/src/main/java/com/supwisdom/dlpay/framework/filter/ValidateCodeFilter.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/filter/ValidateCodeFilter.java
@@ -1,98 +1,92 @@
-package com.supwisdom.dlpay.framework.filter;
-
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.supwisdom.dlpay.api.bean.JsonResult;
-import com.supwisdom.dlpay.exception.ValidateCodeException;
-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.http.HttpStatus;
-import org.springframework.security.web.authentication.AuthenticationFailureHandler;
-import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
-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 AuthenticationFailureHandler myAuthenticationFailureHandler;
-
- /**
- * 校验成功处理器
- */
- @Autowired
- private AuthenticationSuccessHandler myAuthenticationSuccessHandler;
- @Autowired
- private ObjectMapper objectMapper;
-
-
- @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);
- }
-
-}
+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/src/main/java/com/supwisdom/dlpay/framework/filter/XssHttpServletRequestWrapper.java b/src/main/java/com/supwisdom/dlpay/framework/filter/XssHttpServletRequestWrapper.java
new file mode 100644
index 0000000..ddc4d15
--- /dev/null
+++ b/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|exec|execute|insert|select|delete|update|count|drop|%|chr|mid|master|truncate|" +
+ "char|declare|sitename|net user|xp_cmdshell|;|or|-|+|,|like'|and|exec|execute|insert|create|drop|" +
+ "table|from|grant|use|group_concat|column_name|" +
+ "information_schema.columns|table_schema|union|where|select|delete|update|order|by|count|" +
+ "chr|mid|master|truncate|char|declare|or|;|-|--|,|like|//|/|%|#";
+ 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("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/security/CodeUtil.java b/src/main/java/com/supwisdom/dlpay/framework/security/CodeUtil.java
new file mode 100644
index 0000000..ef3b475
--- /dev/null
+++ b/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/MyPermissionEvaluator.java b/src/main/java/com/supwisdom/dlpay/framework/security/MyPermissionEvaluator.java
index 02dbce4..f1b65a8 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/security/MyPermissionEvaluator.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/security/MyPermissionEvaluator.java
@@ -2,70 +2,68 @@
import com.supwisdom.dlpay.framework.domain.*;
import com.supwisdom.dlpay.framework.util.DateUtil;
-import com.supwisdom.dlpay.framework.util.StringUtil;
import com.supwisdom.dlpay.system.service.FunctionService;
import com.supwisdom.dlpay.system.service.OperatorService;
import com.supwisdom.dlpay.system.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Component;
import java.io.Serializable;
-import java.util.Collection;
import java.util.List;
@Component
public class MyPermissionEvaluator implements PermissionEvaluator {
- @Autowired
- private RoleService roleService;
- @Autowired
- private OperatorService operatorService;
- @Autowired
- private FunctionService functionService;
- @Override
- public boolean hasPermission(Authentication authentication, Object targetUri, Object permission) {
- //TODO save logger
- if (targetUri != null) {
- UserDetails userDetails = (UserDetails) authentication.getPrincipal();
- if (userDetails != null) {
- TOperator operator = operatorService.getOperatorByCode(userDetails.getUsername());
- if (operator != null) {
- List<TOperRole> operRoles = operatorService.getOperRoleByOperId(operator.getOperid());
- for (TOperRole operRole : operRoles) {
- TRole role = roleService.findRoleByRoleid(operRole.getRoleId());
- if (role != null) {
- TResource resource = roleService.findResourceByURI(String.valueOf(targetUri));
- if (resource != null) {
- TPermission permission1 = roleService.findByRoleIdAndResid(role.getRoleId(), resource.getId());
- if (permission1 != null) {
- TOperLog log = new TOperLog();
- log.setLogdate(DateUtil.getNow());
- log.setOperid(operator.getOperid());
- log.setOpername(operator.getOpercode());
- log.setResname(resource.getName());
- log.setRespath(resource.getUri());
- TFunction function =functionService.getFunctionById(resource.getFunctionId());
- if(function!=null){
- log.setFunctionid(function.getId());
- log.setFunctionname(function.getName());
- }
- operatorService.saveOperLog(log);
- return true;
- }
- }
- }
- }
- }
- }
- }
- return false;
- }
+ @Autowired
+ private RoleService roleService;
+ @Autowired
+ private OperatorService operatorService;
+ @Autowired
+ private FunctionService functionService;
- @Override
- public boolean hasPermission(Authentication authentication, Serializable targetId, String targetType, Object permission) {
- return false;
+ @Override
+ public boolean hasPermission(Authentication authentication, Object targetUri, Object permission) {
+ //TODO save logger
+ if (targetUri != null) {
+ UserDetails userDetails = (UserDetails) authentication.getPrincipal();
+ if (userDetails != null) {
+ TOperator operator = operatorService.getOperatorByCode(userDetails.getUsername());
+ if (operator != null) {
+ List<TOperRole> operRoles = operatorService.getOperRoleByOperId(operator.getOperid());
+ for (TOperRole operRole : operRoles) {
+ TRole role = roleService.findRoleByRoleid(operRole.getRoleId());
+ if (role != null) {
+ TResource resource = roleService.findResourceByURI(String.valueOf(targetUri));
+ if (resource != null) {
+ TPermission permission1 = roleService.findByRoleIdAndResid(role.getRoleId(), resource.getId());
+ if (permission1 != null) {
+ TOperLog log = new TOperLog();
+ log.setLogdate(DateUtil.getNow());
+ log.setOperid(operator.getOperid());
+ log.setOpername(operator.getOpercode());
+ log.setResname(resource.getName());
+ log.setRespath(resource.getUri());
+ TFunction function = functionService.getFunctionById(resource.getFunctionId());
+ if (function != null) {
+ log.setFunctionid(function.getId());
+ log.setFunctionname(function.getName());
+ }
+ operatorService.saveOperLog(log);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
}
+ return false;
+ }
+
+ @Override
+ public boolean hasPermission(Authentication authentication, Serializable targetId, String targetType, Object permission) {
+ return false;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/OperUtil.java b/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/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/src/main/java/com/supwisdom/dlpay/framework/security/ValidateCodeSecurityConfig.java
index 56782db..22405b0 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/security/ValidateCodeSecurityConfig.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/security/ValidateCodeSecurityConfig.java
@@ -1,7 +1,5 @@
package com.supwisdom.dlpay.framework.security;
-import javax.servlet.Filter;
-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -9,9 +7,11 @@
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
import org.springframework.stereotype.Component;
+import javax.servlet.Filter;
+
@Component("validateCodeSecurityConfig")
public class ValidateCodeSecurityConfig extends SecurityConfigurerAdapter<DefaultSecurityFilterChain,HttpSecurity> {
-
+
@Autowired
private Filter validateCodeFilter;
diff --git a/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCode.java b/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCode.java
old mode 100755
new mode 100644
index 6b56ca8..d88d3af
--- a/src/main/java/com/supwisdom/dlpay/framework/security/validate/ImageCode.java
+++ b/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/ValidateCode.java b/src/main/java/com/supwisdom/dlpay/framework/security/validate/ValidateCode.java
old mode 100755
new mode 100644
index b20eca2..5580d49
--- a/src/main/java/com/supwisdom/dlpay/framework/security/validate/ValidateCode.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/security/validate/ValidateCode.java
@@ -1,55 +1,56 @@
-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/service/SystemUtilService.java b/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
index af90257..2c1ef49 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
@@ -11,35 +11,36 @@
/**
* 取数据库日期
- * */
+ */
+ @Transactional
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);
/**
* 获取记账日期
- * */
- String getAccdate();
+ */
+// String getAccdate();
/**
* 获取流水号
- * */
+ */
String getRefno();
/**
* 按交易码取交易名称
*/
- String getTranscodeName(int transocde, String defaultValue);
+// String getTranscodeName(int transocde, String defaultValue);
/********************** 获取【系统参数】【业务参数】通用方法 **********************/
@@ -73,6 +74,7 @@
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
TBusinesspara getBusinessValueForUpdateNowait(String parakey);
+
/********************** 获取【系统参数】【业务参数】通用方法 **********************/
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java b/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
index eee9e5a..3e0dedf 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
@@ -13,9 +13,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
@Service
public class SystemUtilServiceImpl implements SystemUtilService {
@Autowired
@@ -23,10 +20,7 @@
@Autowired
private TaskLockDao taskLockDao;
- @Autowired
- private SettleCtlDao settleCtlDao;
- @Autowired
- private TranscodeDao transcodeDao;
+
@Autowired
private SysparaDao sysparaDao;
@Autowired
@@ -34,35 +28,6 @@
private static final Logger logger = LoggerFactory.getLogger(SystemUtilServiceImpl.class);
- public static class SystemDateTimeImpl implements SystemDateTime {
- private Date now;
- private static final SimpleDateFormat sdft = new SimpleDateFormat("yyyyMMddHHmmss");
-
- public SystemDateTimeImpl(Date now) {
- this.now = now;
- }
-
- @Override
- public String getHostdate() {
- return sdft.format(this.now).substring(0, 8);
- }
-
- @Override
- public String getHosttime() {
- return sdft.format(this.now).substring(8, 14);
- }
-
- @Override
- public String getHostdatetime() {
- return sdft.format(this.now);
- }
-
- @Override
- public Date getSysdate() {
- return this.now;
- }
- }
-
/**
* 获取oracle数据库时间
*/
@@ -115,17 +80,6 @@
return lock;
}
- @Override
- public String getAccdate() {
- String hostdate = getSysdatetime().getHostdate();
- TSettlectl settlectl = settleCtlDao.getOne(1);
- if (null != settlectl && null != settlectl.getSettledate()) {
- if (Integer.valueOf(hostdate) < settlectl.getSettledate().intValue()) {
- return settlectl.getSettledate().toString();
- }
- }
- return hostdate;
- }
private String getOracleRefno() {
return taskLockDao.getOracleRefno();
@@ -141,14 +95,6 @@
}
}
- @Override
- public String getTranscodeName(int transocde, String defaultValue) {
- TTranscode tTranscode = transcodeDao.getOne(transocde);
- if (null != tTranscode && !StringUtil.isEmpty(tTranscode.getTransname())) {
- return tTranscode.getTransname();
- }
- return defaultValue;
- }
@Override
public String getSysparaValue(int paraid) {
@@ -174,29 +120,31 @@
@Override
public int getSysparaValueAsInt(int paraid, int defaultValue) {
TSyspara syspara = sysparaDao.findByParaid(paraid);
- if (null != syspara && NumberUtil.isNumber(syspara.getParaval())) return Integer.parseInt(syspara.getParaval());
+ if (null != syspara && NumberUtil.isNumber(syspara.getParaval()))
+ return Integer.parseInt(syspara.getParaval());
return defaultValue;
}
@Override
public double getSysparaValueAsDouble(int paraid, double defaultValue) {
TSyspara syspara = sysparaDao.findByParaid(paraid);
- if (null != syspara && NumberUtil.isDecimal(syspara.getParaval())) return Double.parseDouble(syspara.getParaval());
+ if (null != syspara && NumberUtil.isDecimal(syspara.getParaval()))
+ return Double.parseDouble(syspara.getParaval());
return defaultValue;
}
@Override
- public TSyspara getSyspara(int paraid){
+ public TSyspara getSyspara(int paraid) {
return sysparaDao.findByParaid(paraid);
}
@Override
- public TSyspara getSysparaValueForUpdate(int paraid){
+ public TSyspara getSysparaValueForUpdate(int paraid) {
return sysparaDao.findByParaidWithLock(paraid);
}
@Override
- public TSyspara getSysparaValueForUpdateNowait(int paraid){
+ public TSyspara getSysparaValueForUpdateNowait(int paraid) {
return sysparaDao.findByParaidWithLockNowait(paraid);
}
@@ -223,7 +171,7 @@
}
@Override
- public TBusinesspara getBusinessValueForUpdate(String parakey){
+ public TBusinesspara getBusinessValueForUpdate(String parakey) {
if (!StringUtil.isEmpty(parakey)) return businessparaDao.findByParakeyForUpdate(parakey.trim());
return null;
}
@@ -235,7 +183,7 @@
}
@Override
- public String getSubsystemSignKey(String syscode){
+ public String getSubsystemSignKey(String syscode) {
// fixme: 验证数据无误性签名秘钥
return "";
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/tenant/HibernateConfig.java b/src/main/java/com/supwisdom/dlpay/framework/tenant/HibernateConfig.java
new file mode 100644
index 0000000..26a582c
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/tenant/HibernateConfig.java
@@ -0,0 +1,64 @@
+package com.supwisdom.dlpay.framework.tenant;
+
+import lombok.extern.slf4j.Slf4j;
+import org.hibernate.MultiTenancyStrategy;
+import org.hibernate.cfg.Environment;
+import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
+import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties;
+import org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings;
+import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.orm.jpa.JpaVendorAdapter;
+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
+public class HibernateConfig {
+
+ private final JpaProperties jpaProperties;
+
+ private final HibernateProperties hibernateProperties;
+
+ public HibernateConfig(@Autowired JpaProperties jpaProperties,
+ HibernateProperties hibernateProperties) {
+ this.jpaProperties = jpaProperties;
+ this.hibernateProperties = hibernateProperties;
+ }
+
+ @Bean
+ public JpaVendorAdapter getJpaVendorAdapter() {
+ HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
+ adapter.setGenerateDdl(true);
+ return adapter;
+ }
+
+ @Bean("entityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(DataSource dataSource,
+ MultiTenantConnectionProvider multiTenantConnectionProvider,
+ CurrentTenantIdentifierResolver currentTenantIdentifierResolver) {
+ Map<String, Object> properties = new HashMap<>();
+ properties.putAll(hibernateProperties
+ .determineHibernateProperties(jpaProperties.getProperties(),
+ new HibernateSettings()));
+ properties.put(Environment.MULTI_TENANT, MultiTenancyStrategy.SCHEMA);
+ properties.put(Environment.MULTI_TENANT_CONNECTION_PROVIDER, multiTenantConnectionProvider);
+ properties.put(Environment.MULTI_TENANT_IDENTIFIER_RESOLVER, currentTenantIdentifierResolver);
+
+ LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
+ em.setDataSource(dataSource);
+ 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/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantConnectionProviderImpl.java
new file mode 100644
index 0000000..ed9fb0e
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantConnectionProviderImpl.java
@@ -0,0 +1,66 @@
+package com.supwisdom.dlpay.framework.tenant;
+
+import org.hibernate.HibernateException;
+import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Created by shuwei on 2018/12/4.
+ */
+@Component
+public class MultiTenantConnectionProviderImpl implements MultiTenantConnectionProvider {
+ @Autowired
+ private DataSource dataSource;
+
+ @Override
+ public Connection getAnyConnection() throws SQLException {
+ return dataSource.getConnection();
+ }
+
+ @Override
+ public void releaseAnyConnection(Connection connection) throws SQLException {
+ connection.close();
+ }
+
+ @Override
+ public Connection getConnection(String ti) throws SQLException {
+ String tenantIdentifier = TenantContext.getTenantSchema();
+ final Connection connection = getAnyConnection();
+ try {
+ if (tenantIdentifier != null) {
+ connection.createStatement().execute("SET search_path = \"" + tenantIdentifier + "\", public");
+ } else {
+ connection.createStatement().execute("SET search_path = public");
+ }
+ } catch (SQLException e) {
+ throw new HibernateException("Problem setting schema to " + tenantIdentifier, e);
+ }
+ return connection;
+ }
+
+ @Override
+ public void releaseConnection(String tenantIdentifier, Connection connection) throws SQLException {
+ connection.close();
+ }
+
+ @Override
+ public boolean supportsAggressiveRelease() {
+ return false;
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public boolean isUnwrappableAs(Class unwrapType) {
+ return false;
+ }
+
+ @Override
+ public <T> T unwrap(Class<T> unwrapType) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantIdentifierResolver.java b/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantIdentifierResolver.java
new file mode 100644
index 0000000..c1dc432
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/tenant/MultiTenantIdentifierResolver.java
@@ -0,0 +1,23 @@
+package com.supwisdom.dlpay.framework.tenant;
+
+import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shuwei on 2018/12/4.
+ */
+@Component
+public class MultiTenantIdentifierResolver implements CurrentTenantIdentifierResolver {
+ @Override
+ public String resolveCurrentTenantIdentifier() {
+ if (TenantContext.getTenantSchema() == null) {
+ return "default";
+ }
+ return TenantContext.getTenantSchema();
+ }
+
+ @Override
+ public boolean validateExistingCurrentSessions() {
+ return true;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantContext.java b/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantContext.java
new file mode 100644
index 0000000..c1d4ca4
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantContext.java
@@ -0,0 +1,20 @@
+package com.supwisdom.dlpay.framework.tenant;
+
+/**
+ * Created by shuwei on 2018/11/29.
+ */
+public class TenantContext {
+ private static ThreadLocal<String> currentTenant = new ThreadLocal<>();
+
+ public static void setTenantSchema(String tid) {
+ currentTenant.set(tid);
+ }
+
+ public static String getTenantSchema() {
+ return currentTenant.get();
+ }
+
+ public static void clear() {
+ currentTenant.set(null);
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantInterceptor.java b/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantInterceptor.java
new file mode 100644
index 0000000..59d56b6
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/tenant/TenantInterceptor.java
@@ -0,0 +1,23 @@
+package com.supwisdom.dlpay.framework.tenant;
+
+import com.supwisdom.dlpay.framework.domain.TOperator;
+import com.supwisdom.dlpay.framework.util.Constants;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Component
+public class TenantInterceptor extends HandlerInterceptorAdapter {
+
+ @Override
+ public void postHandle(HttpServletRequest request, HttpServletResponse response,
+ Object handler, ModelAndView modelAndView)
+ throws Exception {
+ //
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java b/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java
new file mode 100644
index 0000000..17dd6bc
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java
@@ -0,0 +1,11 @@
+package com.supwisdom.dlpay.framework.util;
+
+public class Constants {
+ // HTTP HEADER define
+ public static final String HEADER_TETANTID = "X-TENANT-ID";
+
+ // define
+ public static final String JWT_CLAIM_TENANTID = "tenantId";
+ public static final String JWT_CLAIM_UID = "uid";
+ public static final String JWT_CLAIM_AUTHORITIES = "authorities";
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java b/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java
index 3a7e013..30b15b1 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java
@@ -3,6 +3,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -20,7 +21,7 @@
* History:
*/
public static String getNow() {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
return sdf.format(new Date());
}
@@ -29,7 +30,7 @@
* Description: 根据类型返回一个当前时间 @param partten String @return String 格式:partten
*/
public static String getNow(String partten) {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(partten);
+ SimpleDateFormat sdf = new SimpleDateFormat(partten);
return sdf.format(new Date());
}
@@ -39,7 +40,7 @@
*/
public static String getNewTime(String startTime, int interval) {
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Date d = sdf.parse(startTime);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(d.getTime());
@@ -56,7 +57,7 @@
*/
public static String getNewTime(String startTime, int interval, String partten) {
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(partten);
+ SimpleDateFormat sdf = new SimpleDateFormat(partten);
Date d = sdf.parse(startTime);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(d.getTime());
@@ -69,7 +70,7 @@
public static String getNewDay(String startDay, int intervalday) {
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Date d = sdf.parse(startDay);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(d.getTime());
@@ -85,7 +86,7 @@
*/
public static long getIntervalDay(String firstDay, String secondDay) {
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Date f = sdf.parse(firstDay);
Date s = sdf.parse(secondDay);
long time = s.getTime() - f.getTime();
@@ -104,7 +105,7 @@
*/
public static int compareDatetime(String firstTime, String secondTime) {
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Date f = sdf.parse(firstTime);
Date s = sdf.parse(secondTime);
return f.compareTo(s);
@@ -122,7 +123,7 @@
*/
public static int compareDatetime(String firstTime, String secondTime, String pattern) {
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern);
Date f = sdf.parse(firstTime);
Date s = sdf.parse(secondTime);
return f.compareTo(s);
@@ -140,7 +141,7 @@
*/
public static int compareDatetime(String firstTime, String secondTime, int seconds) {
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Date f = sdf.parse(firstTime);
Date s = sdf.parse(secondTime);
Calendar calendar = Calendar.getInstance();
@@ -158,7 +159,7 @@
*/
public static String reformatDatetime(String time, String fromPattern, String toPattern) {
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(fromPattern);
+ SimpleDateFormat sdf = new SimpleDateFormat(fromPattern);
Date d = sdf.parse(time);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(d.getTime());
@@ -176,7 +177,7 @@
public static long getInterval(String startTime, String endTime) {
long duration = 0;
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
+ 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");
@@ -190,7 +191,7 @@
public static long getIntervalTime(String startTime, String endTime, String pattern) {
long duration = 0;
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+ 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");
@@ -237,9 +238,9 @@
public static boolean checkDatetimeValid(String datetime, String pattern) {
if (null == datetime) return false;
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern);
Date d = sdf.parse(datetime);
- return true;
+ return datetime.trim().equals(sdf.format(d));
} catch (Exception e) {
}
return false;
@@ -252,7 +253,7 @@
*/
public static int getWeekday(String datestr) {
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Calendar calendar = Calendar.getInstance();
boolean isFirstSunday = (calendar.getFirstDayOfWeek() == Calendar.SUNDAY); //一周第一天是否为星期天
Date d = sdf.parse(datestr);
@@ -275,7 +276,7 @@
*/
public static Date getSpecifyDate(String datestr, String pattern) {
try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern);
Date result = sdf.parse(datestr);
return result;
} catch (Exception e) {
@@ -324,4 +325,21 @@
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/framework/util/Dictionary.java b/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
new file mode 100644
index 0000000..46377e9
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
@@ -0,0 +1,15 @@
+package com.supwisdom.dlpay.framework.util;
+
+public class Dictionary {
+ // 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 SOURCE_TYPE = "sourcetypeList";
+ public static final String TRANS_CODE = "transcodeList";
+ public static final String PAY_TYPE = "paytypelist";
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java b/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java
index 7ea105c..88ca6e8 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java
@@ -2,11 +2,11 @@
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
-import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
public class HmacUtil {
/**
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/Subject.java b/src/main/java/com/supwisdom/dlpay/framework/util/Subject.java
index 4a46b28..e80344a 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/Subject.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/Subject.java
@@ -28,6 +28,11 @@
public static final String SUBJNO_RECHARGE_CASH = "112201";
/**
+ * 应收账款 - 其他第三方充值款
+ */
+ public static final String SUBJNO_RECHARGE_OTHER = "112209";
+
+ /**
* 应收账款 - 支付宝充值款
*/
public static final String SUBJNO_RECHARGE_ALIPAY = "112210";
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java b/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java
index 07e4aaf..3ccb2a7 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java
@@ -13,6 +13,10 @@
public static final int SYSPARAID_NO1 = 1; //系统默认最大余额限制的ID
public static final int SYSPARAID_NO2 = 2; //paraid=2
+ public static final int SYSPARAID_NO2019 = 2019; //与卡管系统对接的应用ID
+ public static final int SYSPARAID_NO2020 = 2020; //与卡管系统对接的应用appkey
+ public static final int SYSPARAID_NO2021 = 2021; //与卡管系统对接的业务参数deskey
+
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
index 20cd922..cc1b344 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/TradeCode.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/TradeCode.java
@@ -12,6 +12,9 @@
public static final int TRANSCODE_WECHAT=1001;
- public static final int TRANSTYPE_PAY = 311;
- public static final int TRANSTYPE_YKTPAY=1000;
+ public static final int TRANSCODE_ERCHARGE = 3500; //账户充值
+
+
+
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessInfo.java b/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessInfo.java
new file mode 100644
index 0000000..f7c2434
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessInfo.java
@@ -0,0 +1,60 @@
+package com.supwisdom.dlpay.system.bean;
+
+public class ShopBusinessInfo {
+ private String shopaccno;
+ private String summary;
+ private Long transcnt;
+ private Double dramt;
+ private Double cramt;
+
+ public ShopBusinessInfo() {
+ }
+
+ public ShopBusinessInfo(String shopaccno, String summary, Long transcnt, Double dramt, Double cramt) {
+ this.shopaccno = shopaccno;
+ this.summary = summary;
+ this.transcnt = transcnt;
+ this.dramt = dramt;
+ this.cramt = cramt;
+ }
+
+ public String getShopaccno() {
+ return shopaccno;
+ }
+
+ public void setShopaccno(String shopaccno) {
+ this.shopaccno = shopaccno;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
+
+ public Long getTranscnt() {
+ return transcnt;
+ }
+
+ public void setTranscnt(Long transcnt) {
+ this.transcnt = transcnt;
+ }
+
+ public Double getDramt() {
+ return dramt;
+ }
+
+ public void setDramt(Double dramt) {
+ this.dramt = dramt;
+ }
+
+ public Double getCramt() {
+ return cramt;
+ }
+
+ public void setCramt(Double cramt) {
+ this.cramt = cramt;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessShowBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessShowBean.java
new file mode 100644
index 0000000..0d793e1
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessShowBean.java
@@ -0,0 +1,67 @@
+package com.supwisdom.dlpay.system.bean;
+
+public class ShopBusinessShowBean {
+ private String shopid;
+ private String shopname;
+ private String fshopid;
+ private String shopaccno;
+ private String summary;
+ private Long transcnt;
+ private Double transamt;
+
+ public String getShopid() {
+ return shopid;
+ }
+
+ public void setShopid(String shopid) {
+ this.shopid = shopid;
+ }
+
+ public String getShopname() {
+ return shopname;
+ }
+
+ public void setShopname(String shopname) {
+ this.shopname = shopname;
+ }
+
+ public String getFshopid() {
+ return fshopid;
+ }
+
+ public void setFshopid(String fshopid) {
+ this.fshopid = fshopid;
+ }
+
+ public String getShopaccno() {
+ return shopaccno;
+ }
+
+ public void setShopaccno(String shopaccno) {
+ this.shopaccno = shopaccno;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
+
+ public Long getTranscnt() {
+ return transcnt;
+ }
+
+ public void setTranscnt(Long transcnt) {
+ this.transcnt = transcnt;
+ }
+
+ public Double getTransamt() {
+ return transamt;
+ }
+
+ public void setTransamt(Double transamt) {
+ this.transamt = transamt;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayInfo.java b/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayInfo.java
new file mode 100644
index 0000000..f31d5b5
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayInfo.java
@@ -0,0 +1,25 @@
+package com.supwisdom.dlpay.system.bean;
+
+public interface SubjectDayInfo {
+ String getSubjno();
+
+ String getSubjname();
+
+ String getFsubjno();
+
+ Integer getSubjlevel();
+
+ String getDisplayflag();
+
+ Double getLastdaydrbal();
+
+ Double getLastdaycrbal();
+
+ Double getDramt();
+
+ Double getCramt();
+
+ Double getDrbal();
+
+ Double getCrbal();
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayShowBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayShowBean.java
new file mode 100644
index 0000000..c36c212
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDayShowBean.java
@@ -0,0 +1,103 @@
+package com.supwisdom.dlpay.system.bean;
+
+public class SubjectDayShowBean {
+ private String subjno;
+ private String subjname;
+ private String fsubjno;
+ private Integer subjlevel;
+ private String displayflag;
+ private Double lastdaydrbal;
+ private Double lastdaycrbal;
+ private Double dramt;
+ private Double cramt;
+ private Double drbal;
+ private Double crbal;
+
+ public String getSubjno() {
+ return subjno;
+ }
+
+ public void setSubjno(String subjno) {
+ this.subjno = subjno;
+ }
+
+ public String getSubjname() {
+ return subjname;
+ }
+
+ public void setSubjname(String subjname) {
+ this.subjname = subjname;
+ }
+
+ public String getFsubjno() {
+ return fsubjno;
+ }
+
+ public void setFsubjno(String fsubjno) {
+ this.fsubjno = fsubjno;
+ }
+
+ public Integer getSubjlevel() {
+ return subjlevel;
+ }
+
+ public void setSubjlevel(Integer subjlevel) {
+ this.subjlevel = subjlevel;
+ }
+
+ public String getDisplayflag() {
+ return displayflag;
+ }
+
+ public void setDisplayflag(String displayflag) {
+ this.displayflag = displayflag;
+ }
+
+ public Double getLastdaydrbal() {
+ return lastdaydrbal;
+ }
+
+ public void setLastdaydrbal(Double lastdaydrbal) {
+ this.lastdaydrbal = lastdaydrbal;
+ }
+
+ public Double getLastdaycrbal() {
+ return lastdaycrbal;
+ }
+
+ public void setLastdaycrbal(Double lastdaycrbal) {
+ this.lastdaycrbal = lastdaycrbal;
+ }
+
+ public Double getDramt() {
+ return dramt;
+ }
+
+ public void setDramt(Double dramt) {
+ this.dramt = dramt;
+ }
+
+ public Double getCramt() {
+ return cramt;
+ }
+
+ public void setCramt(Double cramt) {
+ this.cramt = cramt;
+ }
+
+ public Double getDrbal() {
+ return drbal;
+ }
+
+ public void setDrbal(Double drbal) {
+ this.drbal = drbal;
+ }
+
+ public Double getCrbal() {
+ return crbal;
+ }
+
+ public void setCrbal(Double crbal) {
+ this.crbal = crbal;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDetailShowBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDetailShowBean.java
new file mode 100644
index 0000000..2cc3222
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDetailShowBean.java
@@ -0,0 +1,100 @@
+package com.supwisdom.dlpay.system.bean;
+
+public class SubjectDetailShowBean {
+ private Integer voucherdate; //凭证日期
+ private Integer voucherno; //凭证编号
+ private String subjno;
+ private String summary;
+ private Double dramt;
+ private Double cramt;
+ private Integer balflag;//1-借;2-贷
+ private Double balance;
+ private String oppname;
+
+ public SubjectDetailShowBean() {
+ }
+
+ public SubjectDetailShowBean(Integer voucherdate, Integer voucherno, String subjno, String summary, Double dramt, Double cramt, Integer balflag, Double balance, String oppname) {
+ this.voucherdate = voucherdate;
+ this.voucherno = voucherno;
+ this.subjno = subjno;
+ this.summary = summary;
+ this.dramt = dramt;
+ this.cramt = cramt;
+ this.balflag = balflag;
+ this.balance = balance;
+ this.oppname = oppname;
+ }
+
+ public Integer getVoucherdate() {
+ return voucherdate;
+ }
+
+ public void setVoucherdate(Integer voucherdate) {
+ this.voucherdate = voucherdate;
+ }
+
+ public Integer getVoucherno() {
+ return voucherno;
+ }
+
+ public void setVoucherno(Integer voucherno) {
+ this.voucherno = voucherno;
+ }
+
+ public String getSubjno() {
+ return subjno;
+ }
+
+ public void setSubjno(String subjno) {
+ this.subjno = subjno;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
+
+ public Double getDramt() {
+ return dramt;
+ }
+
+ public void setDramt(Double dramt) {
+ this.dramt = dramt;
+ }
+
+ public Double getCramt() {
+ return cramt;
+ }
+
+ public void setCramt(Double cramt) {
+ this.cramt = cramt;
+ }
+
+ public Integer getBalflag() {
+ return balflag;
+ }
+
+ public void setBalflag(Integer balflag) {
+ this.balflag = balflag;
+ }
+
+ public Double getBalance() {
+ return balance;
+ }
+
+ public void setBalance(Double balance) {
+ this.balance = balance;
+ }
+
+ public String getOppname() {
+ return oppname;
+ }
+
+ public void setOppname(String oppname) {
+ this.oppname = oppname;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java b/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java
index 47ceff2..87b6fd2 100644
--- a/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java
@@ -9,6 +9,7 @@
private boolean checked;
private List<TreeSelectNode> children;
+ private String pId; //扩展 父级ID
private String accno; //扩展:商户账号
public String getId() {
@@ -51,6 +52,14 @@
this.children = children;
}
+ public String getpId() {
+ return pId;
+ }
+
+ public void setpId(String pId) {
+ this.pId = pId;
+ }
+
public String getAccno() {
return accno;
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/common/DictPool.java b/src/main/java/com/supwisdom/dlpay/system/common/DictPool.java
deleted file mode 100644
index 56128cc..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/common/DictPool.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.supwisdom.dlpay.system.common;
-
-import com.supwisdom.dlpay.system.service.DictionaryDataService;
-import com.supwisdom.dlpay.util.ConstantUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@Component("dictPool")
-@Scope("singleton")
-public class DictPool {
- private static HashMap<String, Object> dictmap = new HashMap<>();
-
- @Autowired
- private DictionaryDataService dictionaryDataService;
-
- public static HashMap<Object, Object> getDictMap(String key) {
- synchronized (dictmap) {
- return (HashMap<Object, Object>) dictmap.get(key);
- }
- }
-
- public static void updateDict(String dictType, Map<String, String> value) {
- synchronized (dictmap) {
- dictmap.put(dictType, value);
- }
- }
-
- public void init() {
- dictmap.put("allSourcetypeList", dictionaryDataService.getSystemAllSourcetype());
- dictmap.put("allReverseflagList", dictionaryDataService.getDictionaryByDicttype(ConstantUtil.DICTTYPE_NO1));
-
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/DictPoolAction.java b/src/main/java/com/supwisdom/dlpay/system/controller/DictPoolAction.java
index 085a27d..39b5040 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/DictPoolAction.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/DictPoolAction.java
@@ -1,10 +1,11 @@
package com.supwisdom.dlpay.system.controller;
import com.supwisdom.dlpay.api.bean.JsonResult;
+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.RestController;
-import com.supwisdom.dlpay.system.common.DictPool;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.FormParam;
import java.util.Map;
@@ -12,18 +13,16 @@
@RestController
public class DictPoolAction {
@Autowired
- private DictPool dictPool;
+ private DictionaryProxy dictionaryProxy;
@GetMapping("/dictpool")
public Map getDictDataByDicttype(@FormParam("dicttype") String dictType, HttpServletRequest request) {
dictType = request.getParameter("dicttype");
- Map res = DictPool.getDictMap(dictType);
- return res;
+ return dictionaryProxy.getDictionaryAsMap(dictType);
}
@GetMapping("/dictrefresh")
public JsonResult refreshDict() {
- dictPool.init();
return JsonResult.ok();
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java b/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java
new file mode 100644
index 0000000..3532822
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java
@@ -0,0 +1,88 @@
+package com.supwisdom.dlpay.system.controller;
+
+import com.supwisdom.dlpay.api.domain.TPersondtl;
+import com.supwisdom.dlpay.api.domain.TShopdtl;
+import com.supwisdom.dlpay.api.domain.TSourceType;
+import com.supwisdom.dlpay.framework.domain.TDictionary;
+import com.supwisdom.dlpay.framework.util.Dictionary;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.WebConstant;
+import com.supwisdom.dlpay.system.bean.ShopdtlSearchBean;
+import com.supwisdom.dlpay.system.bean.TreeSelectNode;
+import com.supwisdom.dlpay.system.bean.UserdtlSearchBean;
+import com.supwisdom.dlpay.system.service.DictionaryProxy;
+import com.supwisdom.dlpay.system.service.DtlDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+
+@Controller
+public class DtlController {
+ @Autowired
+ private DtlDataService dtlDataService;
+
+ @Autowired
+ private DictionaryProxy dictionaryProxy;
+
+ /**
+ * ====================================================
+ * 个人流水查询
+ * ====================================================
+ */
+
+ @GetMapping("/dtl/userdtllist")
+ @PreAuthorize("hasPermission('/dtl/userdtl','')")
+ @ResponseBody
+ public PageResult<TPersondtl> searchUserdtlPage(@ModelAttribute UserdtlSearchBean searchBean) {
+ try {
+ Integer pageNo = searchBean.getPage();
+ Integer pageSize = searchBean.getLimit();
+ if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+ if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+ return dtlDataService.getPersondtlPage(searchBean, pageNo, pageSize);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new PageResult<>(99, "系统查询错误");
+ }
+ }
+
+ /**
+ * ====================================================
+ * 商户流水查询
+ * ====================================================
+ */
+ @GetMapping("/dtl/shopdtl")
+ public String shopdtlView(Model model) {
+ model.addAttribute(Dictionary.PAY_TYPE,
+ dictionaryProxy.getDictionaryAsList(Dictionary.SOURCE_TYPE));
+ model.addAttribute(Dictionary.TRANS_CODE,
+ dictionaryProxy.getDictionaryAsList(Dictionary.TRANS_CODE));
+ model.addAttribute(Dictionary.DTL_STATUS,
+ dictionaryProxy.getDictionaryAsList(Dictionary.DTL_STATUS));
+ return "system/dtl/shopdtl";
+ }
+
+ @GetMapping("/dtl/shopdtllist")
+ @PreAuthorize("hasPermission('/dtl/shopdtl','')")
+ @ResponseBody
+ public PageResult<TShopdtl> searchUserdtlPage(@ModelAttribute ShopdtlSearchBean searchBean) {
+ try {
+ Integer pageNo = searchBean.getPage();
+ Integer pageSize = searchBean.getLimit();
+ if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+ if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+ return dtlDataService.getShopdtlPage(searchBean, pageNo, pageSize);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new PageResult<>(99, "系统查询错误");
+ }
+ }
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java b/src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java
index bbd7a5c..a9cc78b 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java
@@ -4,6 +4,7 @@
import com.supwisdom.dlpay.api.bean.JsonResult;
import com.supwisdom.dlpay.framework.domain.TFunction;
import com.supwisdom.dlpay.framework.domain.TResource;
+import com.supwisdom.dlpay.framework.tenant.TenantContext;
import com.supwisdom.dlpay.framework.util.PageResult;
import com.supwisdom.dlpay.framework.util.WebConstant;
import com.supwisdom.dlpay.system.bean.FunctionSearchBean;
@@ -19,120 +20,115 @@
@Controller
public class FunctionController {
- @Autowired
- private FunctionService functionService;
+ @Autowired
+ private FunctionService functionService;
- @GetMapping("/function/index")
- public String indexView() {
- return "system/function/index";
- }
+ @GetMapping("/function/index")
+ public String indexView() {
+ return "system/function/index";
+ }
- @GetMapping("/function/list")
- @PreAuthorize("hasPermission('/function/index','')")
- @ResponseBody
- public PageResult<TFunction> 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;
- FunctionSearchBean searchBean = new FunctionSearchBean();
- searchBean.setPageNo(pageNo);
- searchBean.setFunctioname(searchKey);
- searchBean.setPageSize(pageSize);
- return functionService.getFunctionsByKey(searchBean);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
+ @GetMapping("/function/list")
+ @PreAuthorize("hasPermission('/function/index','')")
+ @ResponseBody
+ public PageResult<TFunction> 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;
+ FunctionSearchBean searchBean = new FunctionSearchBean();
+ searchBean.setPageNo(pageNo);
+ searchBean.setFunctioname(searchKey);
+ searchBean.setPageSize(pageSize);
+ return functionService.getFunctionsByKey(searchBean);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new PageResult<>(99, "系统查询错误");
}
+ }
- @GetMapping("/function/loadadd")
- @PreAuthorize("hasPermission('/function/loadadd','')")
- public String loadadd() {
- return "system/function/form";
- }
+ @GetMapping("/function/loadadd")
+ @PreAuthorize("hasPermission('/function/loadadd','')")
+ public String loadadd() {
+ return "system/function/form";
+ }
- @PostMapping("/function/add")
- @PreAuthorize("hasPermission('/function/add','')")
- @ResponseBody
- public JsonResult add(@RequestBody TFunction function) {
- if (function != null) {
- return functionService.saveFunction(function);
- } else {
- return JsonResult.error("添加失败");
- }
- }
- @PostMapping("/function/delfunc")
- @PreAuthorize("hasPermission('/function/delfunc','')")
- @ResponseBody
- public JsonResult delfunc(@RequestParam Integer funcid) {
- return functionService.deleteFunction(funcid);
- }
- @GetMapping("/function/checkname")
- @ResponseBody
- public JsonResult checkname(@RequestParam String name,
- @RequestParam(value = "id", required = false) Integer id) {
- TFunction function = functionService.getFunctionByNameAndId(name, id);
- if (function == null) {
- return JsonResult.ok();
- } else {
- return JsonResult.error("功能名称重复");
- }
- }
+ @PostMapping("/function/delfunc")
+ @PreAuthorize("hasPermission('/function/delfunc','')")
+ @ResponseBody
+ public JsonResult delfunc(@RequestParam Integer funcid) {
+ return functionService.deleteFunction(funcid);
+ }
- @GetMapping("/function/loadsubadd")
- @PreAuthorize("hasPermission('/function/loadsubadd','')")
- public String loadsubadd(Model model) {
- List<TFunction> functionList = functionService.getParentFunction();
- model.addAttribute("list", functionList);
- return "system/function/subform";
+ @GetMapping("/function/checkname")
+ @ResponseBody
+ public JsonResult checkname(@RequestParam String name,
+ @RequestParam(value = "id", required = false) Integer id) {
+ TFunction function = functionService.getFunctionByNameAndId(name, id);
+ if (function == null) {
+ return JsonResult.ok();
+ } else {
+ return JsonResult.error("功能名称重复");
}
+ }
- @GetMapping("/function/loadres")
- @PreAuthorize("hasPermission('/function/loadres','')")
- public String loadres(@RequestParam Integer functionid, Model model) {
- TFunction function = functionService.getFunctionById(functionid);
- List<TResource> resources = functionService.getResources(functionid);
- model.addAttribute("function", function);
- model.addAttribute("resources", resources);
- return "system/function/reslist";
- }
- @GetMapping("/function/reslist")
- @PreAuthorize("hasPermission('/function/loadres','')")
- @ResponseBody
- public PageResult<TResource> reslist(@RequestParam Integer functionid, Model model) {
- List<TResource> resources = functionService.getResources(functionid);
- return new PageResult<TResource>(resources);
- }
- @GetMapping("/function/loadresadd")
- public String loadresadd(Model model) {
- List<TFunction> functionList = functionService.getLeafFunction();
- model.addAttribute("list", functionList);
- return "system/function/resform";
- }
+ @GetMapping("/function/loadsubadd")
+ @PreAuthorize("hasPermission('/function/loadsubadd','')")
+ public String loadsubadd(Model model) {
+ List<TFunction> functionList = functionService.getParentFunction();
+ model.addAttribute("list", functionList);
+ return "system/function/subform";
+ }
- @PostMapping("/function/addres")
- @PreAuthorize("hasPermission('/function/addres','')")
- @ResponseBody
- public JsonResult addres(@RequestBody TResource resource) {
- if (resource != null) {
- return functionService.saveRes(resource);
- } else {
- return JsonResult.error("添加失败");
- }
+ @GetMapping("/function/loadres")
+ @PreAuthorize("hasPermission('/function/loadres','')")
+ public String loadres(@RequestParam Integer functionid, Model model) {
+ TFunction function = functionService.getFunctionById(functionid);
+ List<TResource> resources = functionService.getResources(functionid);
+ model.addAttribute("function", function);
+ model.addAttribute("resources", resources);
+ return "system/function/reslist";
+ }
+
+ @GetMapping("/function/reslist")
+ @PreAuthorize("hasPermission('/function/loadres','')")
+ @ResponseBody
+ public PageResult<TResource> reslist(@RequestParam Integer functionid, Model model) {
+ List<TResource> resources = functionService.getResources(functionid);
+ return new PageResult<TResource>(resources);
+ }
+
+ @GetMapping("/function/loadresadd")
+ public String loadresadd(Model model) {
+ List<TFunction> functionList = functionService.getLeafFunction();
+ model.addAttribute("list", functionList);
+ return "system/function/resform";
+ }
+
+ @PostMapping("/function/addres")
+ @PreAuthorize("hasPermission('/function/addres','')")
+ @ResponseBody
+ public JsonResult addres(@RequestBody TResource resource) {
+ if (resource != null) {
+ return functionService.saveRes(resource);
+ } else {
+ return JsonResult.error("添加失败");
}
- @GetMapping("/function/editres")
- public String loadresadd(@RequestParam Integer resid,Model model) {
- List<TFunction> functionList = functionService.getLeafFunction();
- model.addAttribute("list", functionList);
- return "system/function/resform";
- }
- @PostMapping("/function/delres")
- @PreAuthorize("hasPermission('/function/delres','')")
- @ResponseBody
- public JsonResult delres(@RequestParam Integer resid) {
- return functionService.deleteResource(resid);
- }
+ }
+
+ @GetMapping("/function/editres")
+ public String loadresadd(@RequestParam Integer resid, Model model) {
+ List<TFunction> functionList = functionService.getLeafFunction();
+ model.addAttribute("list", functionList);
+ return "system/function/resform";
+ }
+
+ @PostMapping("/function/delres")
+ @PreAuthorize("hasPermission('/function/delres','')")
+ @ResponseBody
+ public JsonResult delres(@RequestParam Integer resid) {
+ return functionService.deleteResource(resid);
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java b/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
index dc0ef57..1cc6c7c 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
@@ -1,12 +1,13 @@
package com.supwisdom.dlpay.system.controller;
import com.supwisdom.dlpay.api.bean.JsonResult;
-import com.supwisdom.dlpay.framework.domain.*;
+import com.supwisdom.dlpay.framework.domain.TOperLog;
+import com.supwisdom.dlpay.framework.domain.TOperRole;
+import com.supwisdom.dlpay.framework.domain.TOperator;
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.WebConstant;
-import com.supwisdom.dlpay.system.bean.FunctionSearchBean;
import com.supwisdom.dlpay.system.bean.LogBean;
import com.supwisdom.dlpay.system.bean.OperatorSearchBean;
import com.supwisdom.dlpay.system.service.OperatorService;
@@ -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("账号重复");
}
@@ -106,6 +108,7 @@
operator.setMobile(mobile);
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/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
deleted file mode 100644
index 24da8e3..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
+++ /dev/null
@@ -1,555 +0,0 @@
-package com.supwisdom.dlpay.system.controller;
-
-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.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.util.*;
-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;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Controller
-public class ParamController {
- @Autowired
- private ParamService paramService;
- @Autowired
- private SystemUtilService systemUtilService;
-
- @GetMapping("/param/syspara")
- public String sysparaView() {
- return "system/param/syspara";
- }
-
- @GetMapping("/param/sysparalist")
- @PreAuthorize("hasPermission('/param/syspara','')")
- @ResponseBody
- public PageResult<TSyspara> getDataList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "paraid", required = false) Integer paraid,
- @RequestParam(value = "paraname", required = false) String paraname) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return paramService.getSysparaPage(paraid, paraname, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @PostMapping("/param/sysparaupdate")
- @PreAuthorize("hasPermission('/param/sysparaupdate','')")
- @ResponseBody
- public JsonResult updateSyspara(@RequestParam("paraid") Integer paraid,
- @RequestParam("paraval") String paraval) {
- if (null == paraid || null == paraval) {
- return JsonResult.error("参数传递错误");
- } else if (paraval.length() > 30) {
- return JsonResult.error("参数值过长");
- }
- TSyspara syspara = paramService.getSysparaByParaid(paraid);
- if (null == syspara) {
- return JsonResult.error("全局参数不存在");
- }
- syspara.setParaval(paraval);
- syspara.setLastsaved(systemUtilService.getSysdatetime().getHostdatetime());
- if (syspara.checkValueInvalid()) {
- return JsonResult.error("参数值格式错误");
- }
- try {
- if (paramService.updateSyspara(syspara)) {
- return JsonResult.ok("修改成功");
- } else {
- return JsonResult.error("修改失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
-
- /**
- * ====================================================
- * 业务参数配置
- * ====================================================
- */
- @GetMapping("/param/businesspara")
- public String busiparaView() {
- return "system/param/businesspara";
- }
-
- @GetMapping("/param/businessparalist")
- @PreAuthorize("hasPermission('/param/businesspara','')")
- @ResponseBody
- public PageResult<TBusinesspara> getBusinessDataList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "paraname", required = false) String paraname) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return paramService.getBusinessparaPage(paraname, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @PostMapping("/param/deletebusinesspara")
- @PreAuthorize("hasPermission('/param/deletebusinesspara','')")
- @ResponseBody
- public JsonResult deleteBusinesspara(@RequestParam("parakey") String parakey) {
- try {
- if (StringUtil.isEmpty(parakey)) {
- return JsonResult.error("参数名为空");
- }
- TBusinesspara businesspara = paramService.getBusinessparaByParakey(parakey);
- if (null == businesspara) {
- return JsonResult.error("业务参数[" + parakey + "]不存在!");
- }
- if (paramService.deleteBusinesspara(businesspara)) {
- return JsonResult.ok("删除成功!");
- } else {
- return JsonResult.error("删除失败!");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/businessparaupdate")
- @PreAuthorize("hasPermission('/param/businessparaupdate','')")
- @ResponseBody
- public JsonResult updateBusinesspara(@RequestParam("parakey") String parakey, @RequestParam("paraval") String paraval) {
- try {
- if (StringUtil.isEmpty(parakey) || null == paraval) {
- return JsonResult.error("参数传递错误");
- }
- TBusinesspara businesspara = paramService.getBusinessparaByParakey(parakey);
- if (null == businesspara) {
- return JsonResult.error("业务参数[" + parakey + "]不存在!");
- }
- businesspara.setParaval(paraval);
- if (paramService.saveOrUpdateBusinesspara(businesspara)) {
- return JsonResult.ok("修改成功!");
- } else {
- return JsonResult.error("修改失败!");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @GetMapping("/param/load4addbuspara")
- @PreAuthorize("hasPermission('/param/load4addbuspara','')")
- public String loadadd() {
- return "system/param/busparaform";
- }
-
- @GetMapping("/param/checkbusname")
- @ResponseBody
- public JsonResult checkname(@RequestParam("parakey") String parakey) {
- TBusinesspara businesspara = paramService.getBusinessparaByParakey(parakey);
- if (businesspara == null) {
- return JsonResult.ok();
- } else {
- return JsonResult.error("参数名重复");
- }
- }
-
- @PostMapping("/param/addbusinesspara")
- @PreAuthorize("hasPermission('/param/addbusinesspara','')")
- @ResponseBody
- public JsonResult addBusinesspara(@RequestParam("parakey") String parakey, @RequestParam("paraval") String paraval) {
- if (StringUtil.isEmpty(parakey) || null == paraval) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TBusinesspara businesspara = paramService.getBusinessparaByParakey(parakey);
- if (null != businesspara) {
- return JsonResult.error("参数名重复");
- }
- businesspara = new TBusinesspara();
- businesspara.setParakey(parakey.trim());
- businesspara.setParaval(paraval.trim());
- if (paramService.saveOrUpdateBusinesspara(businesspara)) {
- return JsonResult.ok("新增成功!");
- } else {
- return JsonResult.error("新增失败!");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
-
- /**
- * ====================================================
- * APPID应用权限参数管理
- * ====================================================
- */
- @GetMapping("/param/apiclientpara")
- public String appidParaView() {
- return "system/param/apiclientpara";
- }
-
- @GetMapping("/param/apiclientparalist")
- @PreAuthorize("hasPermission('/param/apiclientpara','')")
- @ResponseBody
- public PageResult<TApiClient> getApiclientDataList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "appid", required = false) String appid) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return paramService.getApiClientparaPage(appid, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @GetMapping("/param/load4addapiclient")
- @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");
- model.addAttribute("rolelist", roles);
- return "system/param/apiclientform";
- }
-
- @PostMapping("/param/updateapiclientstate")
- @PreAuthorize("hasPermission('/param/updateapiclientstate','')")
- @ResponseBody
- public JsonResult updateApiclientState(@RequestParam("appid") String appid, @RequestParam("state") String state) {
- if (StringUtil.isEmpty(appid) || (!TradeDict.STATUS_NORMAL.equals(state) && !TradeDict.STATUS_CLOSED.equals(state))) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TApiClient apiClient = paramService.getApiClientByAppid(appid);
- if (null == apiClient) {
- return JsonResult.error("应用参数不存在");
- } else if (state.equals(apiClient.getStatus())) {
- return JsonResult.error("状态修改错误,请刷新查询");
- }
- apiClient.setStatus(state);
- if (paramService.saveOrUpdateApiClient(apiClient)) {
- return JsonResult.ok(TradeDict.STATUS_NORMAL.equals(state) ? "启用成功" : "关闭成功");
- } else {
- return JsonResult.error(TradeDict.STATUS_NORMAL.equals(state) ? "启用失败" : "关闭失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/deleteapiclient")
- @PreAuthorize("hasPermission('/param/deleteapiclient','')")
- @ResponseBody
- public JsonResult deleteApiclientParam(@RequestParam("appid") String appid) {
- if (StringUtil.isEmpty(appid)) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TApiClient apiClient = paramService.getApiClientByAppid(appid);
- if (null == apiClient) {
- return JsonResult.error("应用参数不存在");
- }
-
- if (paramService.deleteApiClient(apiClient)) {
- return JsonResult.ok("删除成功");
- } else {
- return JsonResult.error("删除失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/updateapiclientpara")
- @PreAuthorize("hasPermission('/param/updateapiclientpara','')")
- @ResponseBody
- public JsonResult updateApiclientSecret(@RequestParam("appid") String appid,
- @RequestParam(value = "secret", required = false) String secret,
- @RequestParam(value = "roles", required = false) String roles) {
- if (StringUtil.isEmpty(appid) || (StringUtil.isEmpty(secret) && StringUtil.isEmpty(roles))) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TApiClient apiClient = paramService.getApiClientByAppid(appid);
- if (null == apiClient) {
- return JsonResult.error("应用参数不存在");
- }
- if (!StringUtil.isEmpty(secret)) {
- apiClient.setSecret(secret);
- }
- if (!StringUtil.isEmpty(roles)) {
- apiClient.setRoles(roles);
- }
- if (paramService.saveOrUpdateApiClient(apiClient)) {
- return JsonResult.ok("修改成功");
- } else {
- return JsonResult.error("修改失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/addapiclientpara")
- @PreAuthorize("hasPermission('/param/addapiclientpara','')")
- @ResponseBody
- public JsonResult addApiclientPara(@RequestParam("appid") String appid,
- @RequestParam("roles") String roles) {
- if (StringUtil.isEmpty(appid) || StringUtil.isEmpty(roles)) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TApiClient apiClient = paramService.getApiClientByAppid(appid);
- if (null != apiClient) {
- return JsonResult.error("APPID重复");
- }
- apiClient = new TApiClient();
- apiClient.setAppid(appid.trim());
- apiClient.setSecret(RandomUtils.getUUIDStr());
- apiClient.setStatus(TradeDict.STATUS_NORMAL);
- apiClient.setRoles(roles);
- if (paramService.saveOrUpdateApiClient(apiClient)) {
- return JsonResult.ok("新增成功");
- } else {
- return JsonResult.error("新增失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- /**
- * ====================================================
- * 支付能力配置
- * ====================================================
- */
- @GetMapping("/param/paytype")
- public String paytypeView() {
- return "system/param/paytype";
- }
-
- @GetMapping("/param/paytypelist")
- @PreAuthorize("hasPermission('/param/paytype','')")
- @ResponseBody
- public PageResult<TSourceType> getPaytypeDataList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "paytype", required = false) String paytype) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return paramService.getPaytypePage(paytype, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @GetMapping("/param/load4addpaytype")
- @PreAuthorize("hasPermission('/param/load4addpaytype','')")
- public String load4AddPaytype(Model model) {
- return "system/param/paytypeform";
- }
-
- @PostMapping("/param/updatepaytypestate")
- @PreAuthorize("hasPermission('/param/updatepaytypestate','')")
- @ResponseBody
- public JsonResult updatePaytypeState(@RequestParam("paytype") String paytype,
- @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))) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
- if (null == tPaytype) {
- return JsonResult.error("支付方式不存在!");
- }
- if ("charge".equals(optype)) {
- if (state.equals(tPaytype.isChargeEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- tPaytype.setChargeEnable(state);
- } else if ("consume".equals(optype)) {
- if (state.equals(tPaytype.getConsumeEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- tPaytype.setConsumeEnable(state);
- } else if ("anonymous".equals(optype)) {
- if (state.equals(tPaytype.getAnonymousEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- tPaytype.setAnonymousEnable(state);
- } else {
- if (state.equals(tPaytype.getEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- tPaytype.setEnable(state); //默认切换主状态
- }
-
- if (paramService.saveOrUpdatePaytype(tPaytype)) {
- return JsonResult.ok(state ? "启用成功" : "关闭成功");
- } else {
- return JsonResult.error(!state ? "启用失败" : "关闭失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/updatepaytypename")
- @PreAuthorize("hasPermission('/param/updatepaytypename','')")
- @ResponseBody
- public JsonResult updatePaytypeName(@RequestParam("paytype") String paytype,
- @RequestParam("paydesc") String paydesc) {
- if (StringUtil.isEmpty(paytype) || StringUtil.isEmpty(paydesc)) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
- if (null == tPaytype) {
- return JsonResult.error("支付方式不存在!");
- }
- tPaytype.setPaydesc(paydesc.trim());
- if (paramService.saveOrUpdatePaytype(tPaytype)) {
- return JsonResult.ok("修改成功");
- } else {
- return JsonResult.error("修改失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/deletepaytype")
- @PreAuthorize("hasPermission('/param/deletepaytype','')")
- @ResponseBody
- public JsonResult deletePaytype(@RequestParam("paytype") String paytype) {
- try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
- if (null == tPaytype) {
- return JsonResult.error("支付方式不存在!");
- }
- if (paramService.deletePaytype(tPaytype)) {
- return JsonResult.ok("删除成功");
- } else {
- return JsonResult.error("删除失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/addpaytype")
- @PreAuthorize("hasPermission('/param/addpaytype','')")
- @ResponseBody
- public JsonResult addPaytype(@RequestParam("paytype") String paytype,
- @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("paydesc") String paydesc) {
- try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
- if (null != tPaytype) {
- return JsonResult.error("支付方式已经存在");
- }
- tPaytype = new TSourceType();
- tPaytype.setSourceType(paytype.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.saveOrUpdatePaytype(tPaytype)) {
- return JsonResult.ok("新增成功");
- } else {
- return JsonResult.error("新增失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @GetMapping("/param/checkpaytype")
- @ResponseBody
- public JsonResult checkPaytype(@RequestParam("paytype") String paytype) {
- TSourceType tPaytype = paramService.getPaytype(paytype);
- if (null != tPaytype) {
- return JsonResult.error("支付方式已经存在");
- } else {
- return JsonResult.ok("可以使用");
- }
- }
-
- @GetMapping("/param/load4paytypeconfig")
- @PreAuthorize("hasPermission('/param/load4paytypeconfig','')")
- public String load4PaytypeConfig(@RequestParam("paytype") String paytype, Model model) {
- List<TPaytypeConfig> configList = paramService.getPaytypeConfigList(paytype);
- model.addAttribute("configlist", configList);
- model.addAttribute("paytype", paytype);
- return "system/param/paytypeconfig";
- }
-
- @PostMapping("/param/addpaytypeconfig")
- @PreAuthorize("hasPermission('/param/addpaytypeconfig','')")
- @ResponseBody
- public JsonResult addPaytypeConfig(@RequestBody Map<String, String> param) {
- String paytypeHtmlKey = "hid_paytype"; //页面上传来paytype的KEY
- if (null == param || StringUtil.isEmpty(param.get(paytypeHtmlKey))) {
- return JsonResult.error("参数传递错误");
- }
-
- try {
- String paytype = param.get(paytypeHtmlKey).trim();
- param.remove(paytypeHtmlKey);
- if (paramService.savePaytypeConfig(paytype, param)) {
- return JsonResult.ok("配置成功");
- } else {
- return JsonResult.error("配置失败");
- }
- } catch (WebCheckException ex) {
- return JsonResult.error(ex.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java b/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
new file mode 100644
index 0000000..5e64b4b
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
@@ -0,0 +1,76 @@
+package com.supwisdom.dlpay.system.controller;
+
+import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig;
+import com.supwisdom.dlpay.api.domain.TSourceType;
+import com.supwisdom.dlpay.framework.service.SystemUtilService;
+import com.supwisdom.dlpay.framework.util.*;
+import com.supwisdom.dlpay.system.bean.ShopConfigBean;
+import com.supwisdom.dlpay.system.service.DictionaryProxy;
+import com.supwisdom.dlpay.system.service.ParamService;
+import com.supwisdom.dlpay.system.service.ShopDataService;
+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;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Controller
+public class ShopController {
+ @Autowired
+ private ShopDataService shopDataService;
+ @Autowired
+ private ParamService paramService;
+ @Autowired
+ private SystemUtilService systemUtilService;
+
+ @Autowired
+ private DictionaryProxy dictionaryProxy;
+
+ @GetMapping("/shop/index")
+ public String shopView() {
+ return "system/shop/index";
+ }
+
+
+ /**
+ * ====================================================
+ * 商户支付能力配置
+ * ====================================================
+ */
+ @GetMapping("/shop/config")
+ public String shopConfigView(Model model) {
+// model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
+ model.addAttribute(Dictionary.PAY_TYPE,
+ dictionaryProxy.<TSourceType>getDictionaryAsList(Dictionary.SOURCE_TYPE));
+ return "system/shop/config";
+ }
+
+
+ @GetMapping("/shop/load4addpaytype")
+ @PreAuthorize("hasPermission('/shop/load4addpaytype','')")
+ public String load4AddShopPaytype(Model model) {
+ model.addAttribute(Dictionary.PAY_TYPE,
+ dictionaryProxy.getDictionaryAsList(Dictionary.SOURCE_TYPE));
+ return "system/shop/configform";
+ }
+
+
+
+ @GetMapping("/shop/load4paytypepara")
+ @PreAuthorize("hasPermission('/shop/load4paytypepara','')")
+ public String load4AddShopPaytypePara(@RequestParam("shopaccno") String shopaccno,
+ @RequestParam("paytype") String paytype,
+ Model model) {
+ List<TShopPaytypeConfig> configList = shopDataService.getShopPaytypeConfigs(shopaccno, paytype);
+ model.addAttribute("configlist", configList);
+ model.addAttribute("shopaccno", shopaccno);
+ model.addAttribute("paytype", paytype);
+ return "system/shop/configpara";
+ }
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java b/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
index 4ea1598..6b80220 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
@@ -2,13 +2,14 @@
import com.supwisdom.dlpay.api.bean.JsonResult;
import com.supwisdom.dlpay.api.domain.TAccount;
-import com.supwisdom.dlpay.framework.domain.TPerson;
import com.supwisdom.dlpay.api.domain.TPointsAccount;
+import com.supwisdom.dlpay.framework.domain.TPerson;
+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;
@@ -16,147 +17,142 @@
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 UserDataService userDataService;
- @GetMapping("/user/index")
- public String index() {
- return "system/user/index";
- }
+ @Autowired
+ private DictionaryProxy dictionaryProxy;
- @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/index")
+ public String index() {
+ return "system/user/index";
+ }
- @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";
+ @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, "系统查询错误");
}
+ }
- @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);
- }
+ @GetMapping("/user/loadadd")
+ public String add(ModelMap map) {
+ map.put(Dictionary.IDTYPE, dictionaryProxy.getDictionaryAsList(Dictionary.IDTYPE));
+ return "system/user/add";
+ }
- @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);
+ @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);
+ }
- @GetMapping("/user/acc")
- public String acc() {
- return "system/user/account";
+ @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/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/acc")
+ public String acc() {
+ return "system/user/account";
+ }
- @GetMapping("/user/point")
- public String point() {
- return "system/user/point";
+ @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/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, "系统查询错误");
- }
- }
+ @GetMapping("/user/point")
+ public String point() {
+ return "system/user/point";
+ }
- @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);
+ @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/delpoint")
- @PreAuthorize("hasPermission('/user/delpoint','')")
- @ResponseBody
- public JsonResult delpoint(@RequestParam String userid) {
- if (StringUtil.isEmpty(userid)) {
- return JsonResult.error("参数错误");
- }
- return userDataService.deletePoint(userid);
+ }
+
+ @PostMapping("/user/delacc")
+ @PreAuthorize("hasPermission('/user/delacc','')")
+ @ResponseBody
+ public JsonResult delacc(@RequestParam String accno) {
+ if (StringUtil.isEmpty(accno)) {
+ return JsonResult.error("参数错误");
}
- @GetMapping("/user/pointdtl")
- public String pointdtl(@RequestParam String userid,ModelMap map) {
- map.put("userid",userid);
- return "system/user/pointdtl";
+ 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
index a378a8c..b750f81 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java
@@ -1,12 +1,10 @@
package com.supwisdom.dlpay.system.service;
-import java.util.HashMap;
+import com.supwisdom.dlpay.framework.domain.TDictionary;
+
+import java.util.List;
public interface DictionaryDataService {
- HashMap<String, Object> getSystemAllSourcetype();
-
- HashMap<String, Object> getDictionaryByDicttype(int dicttype);
-
-
+ List<TDictionary> getDictionaryByDictType(String dicttype);
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java b/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
new file mode 100644
index 0000000..723e954
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
@@ -0,0 +1,50 @@
+package com.supwisdom.dlpay.system.service;
+
+import com.supwisdom.dlpay.framework.domain.DictionaryTable;
+import com.supwisdom.dlpay.framework.util.Dictionary;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class DictionaryProxy {
+ private final DictionaryDataService dictionaryDataService;
+
+ private final ParamService paramService;
+
+ public DictionaryProxy(DictionaryDataService dictionaryDataService, ParamService paramService) {
+ this.dictionaryDataService = dictionaryDataService;
+ this.paramService = paramService;
+ }
+
+ @SuppressWarnings("UNCHECKED_CAST")
+ public <T> Map<String, T> getDictionaryObject(String dictType) {
+ List<T> list = getDictionaryAsList(dictType);
+ Map<String, T> result = new HashMap<>();
+ for (Object item : list) {
+ if (item instanceof DictionaryTable) {
+ result.put(((DictionaryTable) item).getDictKey(), (T) item);
+ }
+ }
+ return result;
+ }
+
+ public Map<String, Object> getDictionaryAsMap(String dictType) {
+ List list = getDictionaryAsList(dictType);
+ Map<String, Object> result = new HashMap<>();
+ for (Object item : list) {
+ if (item instanceof DictionaryTable) {
+ DictionaryTable it = (DictionaryTable) item;
+ result.put(it.getDictKey(), it.getDictValue());
+ }
+ }
+ return result;
+ }
+
+ @SuppressWarnings("UNCHECKED_CAST")
+ public <T> List<T> getDictionaryAsList(String dictType) {
+ return (List<T>) dictionaryDataService.getDictionaryByDictType(dictType);
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java
index fa0affe..8735059 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java
@@ -2,8 +2,6 @@
import com.supwisdom.dlpay.api.domain.TPersondtl;
import com.supwisdom.dlpay.api.domain.TShopdtl;
-import com.supwisdom.dlpay.framework.domain.TDictionary;
-import com.supwisdom.dlpay.framework.domain.TTranscode;
import com.supwisdom.dlpay.framework.util.PageResult;
import com.supwisdom.dlpay.system.bean.ShopdtlSearchBean;
import com.supwisdom.dlpay.system.bean.TreeSelectNode;
@@ -20,12 +18,4 @@
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
PageResult<TShopdtl> getShopdtlPage(ShopdtlSearchBean searchBean, int pageNo, int pageSize);
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TTranscode> getAllTranscodes();
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TDictionary> getAllDtlStatus();
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TreeSelectNode> getTreeSelectShops();
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/FunctionService.java b/src/main/java/com/supwisdom/dlpay/system/service/FunctionService.java
index 8884b21..4f1c841 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/FunctionService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/FunctionService.java
@@ -22,7 +22,7 @@
PageResult<TFunction> getFunctionsByKey(FunctionSearchBean param);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- TFunction getFunctionByNameAndId(String name,Integer id);
+ TFunction getFunctionByNameAndId(String name, Integer id);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
JsonResult saveFunction(TFunction function);
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java b/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java
index 3954045..6d0e612 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java
@@ -19,7 +19,7 @@
boolean checkOpercodeExists(String opercode, String operid);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOperator(TOperator operator,String roles);
+ boolean saveOperator(TOperator operator, String roles);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
TOperator getOperatorByCode(String opercode);
@@ -31,7 +31,7 @@
boolean resetPwd(String operid);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean updateState(String operid,String state);
+ boolean updateState(String operid, String state);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
boolean saveOperLog(TOperLog log);
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java b/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
index 3d2b0e8..093e9a9 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
+++ b/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.TSourceType;
import com.supwisdom.dlpay.framework.domain.TApiClient;
import com.supwisdom.dlpay.framework.domain.TBusinesspara;
import com.supwisdom.dlpay.framework.domain.TSyspara;
@@ -33,9 +33,6 @@
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
boolean deleteBusinesspara(TBusinesspara businesspara);
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOrUpdateBusinesspara(TBusinesspara businesspara);
-
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
PageResult<TApiClient> getApiClientparaPage(String appid, int pageNo, int pageSize);
@@ -49,23 +46,23 @@
boolean deleteApiClient(TApiClient apiClient);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- PageResult<TSourceType> getPaytypePage(String paytype, int pageNo, int pageSize);
+ PageResult<TSourceType> getSourceTypePage(String paytype, int pageNo, int pageSize);
+
+ @Transactional(readOnly = true)
+ List<TSourceType> getAllSourceType();
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- TSourceType getPaytype(String paytype);
+ TSourceType getSourceType(String paytype);
+
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOrUpdatePaytype(TSourceType paytype);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean deletePaytype(TSourceType paytype);
+ boolean deleteSourceType(TSourceType paytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TPaytypeConfig> getPaytypeConfigList(String paytype);
+ List<TPaytypeConfig> getSourceTypeConfigList(String paytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean savePaytypeConfig(String paytype, Map<String, String> param) throws WebCheckException;
-
+ boolean saveSourceTypeConfig(String paytype, Map<String, String> param) throws WebCheckException;
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java b/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
new file mode 100644
index 0000000..e6d580b
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
@@ -0,0 +1,31 @@
+package com.supwisdom.dlpay.system.service;
+
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.system.bean.ShopBusinessShowBean;
+import com.supwisdom.dlpay.system.bean.SubjectDayShowBean;
+import com.supwisdom.dlpay.system.bean.SubjectDetailShowBean;
+import com.supwisdom.dlpay.system.bean.TreeSelectNode;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+public interface SettleReportService {
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ String getSystemSettledate();
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ PageResult<SubjectDayShowBean> getSubjectDayInfos(String startdate, String enddate, boolean nodealshow);
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ PageResult<SubjectDetailShowBean> getSubjectDetailInfos(String startdate, String enddate, String subjno, int pageNo, int pageSize);
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ List<TreeSelectNode> getSystemShowSubjectTree();
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ List<TreeSelectNode> getSystemNormalShopTree();
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ PageResult<ShopBusinessShowBean> getShopBusinessShowInfos(String startdate, String enddate, String shopid, boolean nodealshow);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
new file mode 100644
index 0000000..a39475e
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
@@ -0,0 +1,21 @@
+package com.supwisdom.dlpay.system.service;
+
+import com.supwisdom.dlpay.api.domain.TShopPaytype;
+import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.system.bean.ShopConfigBean;
+import com.supwisdom.dlpay.system.bean.ZTreeNode;
+import com.supwisdom.dlpay.util.WebCheckException;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+public interface ShopDataService {
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
+ TShopPaytype getShopPaytype(String shopaccno, String paytype);
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
+ List<TShopPaytypeConfig> getShopPaytypeConfigs(String shopaccno, String paytype);
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
index e25e020..d60e949 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
@@ -2,9 +2,9 @@
import com.supwisdom.dlpay.api.bean.JsonResult;
import com.supwisdom.dlpay.api.domain.TAccount;
-import com.supwisdom.dlpay.framework.domain.TPerson;
import com.supwisdom.dlpay.api.domain.TPersonIdentity;
import com.supwisdom.dlpay.api.domain.TPointsAccount;
+import com.supwisdom.dlpay.framework.domain.TPerson;
import com.supwisdom.dlpay.framework.util.PageResult;
import com.supwisdom.dlpay.system.bean.PersonParamBean;
import org.springframework.transaction.annotation.Propagation;
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
index 85e9438..b1ab465 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
@@ -1,45 +1,31 @@
package com.supwisdom.dlpay.system.service.impl;
-import com.supwisdom.dlpay.api.dao.SourceTypeDao;
-import com.supwisdom.dlpay.api.domain.TSourceType;
import com.supwisdom.dlpay.framework.dao.DictionaryDao;
import com.supwisdom.dlpay.framework.domain.TDictionary;
-import com.supwisdom.dlpay.framework.util.StringUtil;
import com.supwisdom.dlpay.system.service.DictionaryDataService;
-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.ArrayList;
import java.util.List;
@Service
public class DictionaryDataServiceImpl implements DictionaryDataService {
- @Autowired
- private SourceTypeDao sourceTypeDao;
- @Autowired
- private DictionaryDao dictionaryDao;
+ private final DictionaryDao dictionaryDao;
- @Override
- public HashMap<String, Object> getSystemAllSourcetype() {
- HashMap<String, Object> result = new HashMap<>(0);
- List<TSourceType> list = sourceTypeDao.findAll();
- if (!StringUtil.isEmpty(list)) {
- for (TSourceType tst : list) {
- result.put(tst.getSourceType(), tst.getPaydesc());
- }
- }
- return result;
+ public DictionaryDataServiceImpl(DictionaryDao dictionaryDao) {
+ this.dictionaryDao = dictionaryDao;
+
}
@Override
- public HashMap<String, Object> getDictionaryByDicttype(int dicttype) {
- HashMap<String, Object> result = new HashMap<>(0);
+ @Cacheable(cacheNames = "dicationary_cache", key = "#p0")
+ public List<TDictionary> getDictionaryByDictType(String dicttype) {
List<TDictionary> list = dictionaryDao.findAllByDicttype(dicttype);
- if (!StringUtil.isEmpty(list)) {
- for (TDictionary dict : list) {
- result.put(dict.getDictval() == null ? "" : dict.getDictval(), dict.getDictcaption());
- }
+ if (!list.isEmpty()) {
+ return list;
}
- return result;
+ return new ArrayList<>();
}
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java
new file mode 100644
index 0000000..66fb425
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java
@@ -0,0 +1,122 @@
+package com.supwisdom.dlpay.system.service.impl;
+
+import com.supwisdom.dlpay.api.dao.PersondtlDao;
+import com.supwisdom.dlpay.api.dao.ShopdtlDao;
+import com.supwisdom.dlpay.api.domain.TPersondtl;
+import com.supwisdom.dlpay.api.domain.TShopdtl;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.system.bean.ShopdtlSearchBean;
+import com.supwisdom.dlpay.system.bean.TreeSelectNode;
+import com.supwisdom.dlpay.system.bean.UserdtlSearchBean;
+import com.supwisdom.dlpay.system.service.DictionaryProxy;
+import com.supwisdom.dlpay.system.service.DtlDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class DtlDataServiceImpl implements DtlDataService {
+ @Autowired
+ private PersondtlDao persondtlDao;
+ @Autowired
+ private ShopdtlDao shopdtlDao;
+ @Autowired
+ private DictionaryProxy dictionaryProxy;
+
+
+ @Override
+ public PageResult<TPersondtl> getPersondtlPage(UserdtlSearchBean searchBean, int pageNo, int pageSize) {
+ Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by(Sort.Direction.DESC, "refno"));
+ Page<TPersondtl> page = persondtlDao.findAll(new Specification<TPersondtl>() {
+ @Override
+ public Predicate toPredicate(Root<TPersondtl> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
+ List<Predicate> predicates = new ArrayList<>();
+ if (!StringUtil.isEmpty(searchBean.getStartAccdate())) {
+ predicates.add(criteriaBuilder.ge(root.get("accdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartAccdate()))));
+ }
+ if (!StringUtil.isEmpty(searchBean.getEndAccdate())) {
+ predicates.add(criteriaBuilder.le(root.get("accdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndAccdate()))));
+ }
+ if (!StringUtil.isEmpty(searchBean.getStartTransdate())) {
+ predicates.add(criteriaBuilder.ge(root.get("transdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartTransdate()))));
+
+ }
+ if (!StringUtil.isEmpty(searchBean.getEndTransdate())) {
+ predicates.add(criteriaBuilder.le(root.get("transdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndTransdate()))));
+ }
+ if (!StringUtil.isEmpty(searchBean.getPersonname())) {
+ predicates.add(criteriaBuilder.like(root.get("userName").as(String.class), "%" + searchBean.getPersonname().trim() + "%"));
+ }
+ if (!StringUtil.isEmpty(searchBean.getSourcetype())) {
+ predicates.add(criteriaBuilder.equal(root.get("sourceType").as(String.class), searchBean.getSourcetype().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getTradeflag())) {
+ predicates.add(criteriaBuilder.equal(root.get("tradeflag").as(String.class), searchBean.getTradeflag().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getTranscode())) {
+ predicates.add(criteriaBuilder.equal(root.get("transcode").as(String.class), searchBean.getTranscode().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getStatus())) {
+ predicates.add(criteriaBuilder.equal(root.get("status").as(String.class), searchBean.getStatus().trim()));
+ }
+ return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
+ }
+ }, pageable);
+ return new PageResult<>(page);
+ }
+
+ @Override
+ public PageResult<TShopdtl> getShopdtlPage(ShopdtlSearchBean searchBean, int pageNo, int pageSize) {
+ Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by(Sort.Direction.DESC, "refno"));
+ Page<TShopdtl> page = shopdtlDao.findAll((Specification<TShopdtl>) (root, query, criteriaBuilder) -> {
+ List<Predicate> predicates = new ArrayList<>();
+ if (!StringUtil.isEmpty(searchBean.getStartAccdate())) {
+ predicates.add(criteriaBuilder.ge(root.get("accdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartAccdate()))));
+ }
+ if (!StringUtil.isEmpty(searchBean.getEndAccdate())) {
+ predicates.add(criteriaBuilder.le(root.get("accdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndAccdate()))));
+ }
+ if (!StringUtil.isEmpty(searchBean.getStartTransdate())) {
+ predicates.add(criteriaBuilder.ge(root.get("transdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartTransdate()))));
+
+ }
+ if (!StringUtil.isEmpty(searchBean.getEndTransdate())) {
+ predicates.add(criteriaBuilder.le(root.get("transdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndTransdate()))));
+ }
+ if (!StringUtil.isEmpty(searchBean.getShopname())) {
+ predicates.add(criteriaBuilder.like(root.get("shopname").as(String.class), "%" + searchBean.getShopname().trim() + "%"));
+ }
+ if (!StringUtil.isEmpty(searchBean.getShopaccno())) {
+ predicates.add(criteriaBuilder.equal(root.get("shopaccno").as(String.class), searchBean.getShopaccno().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getSourcetype())) {
+ predicates.add(criteriaBuilder.equal(root.get("sourceType").as(String.class), searchBean.getSourcetype().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getTradeflag())) {
+ predicates.add(criteriaBuilder.equal(root.get("tradeflag").as(String.class), searchBean.getTradeflag().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getTranscode())) {
+ predicates.add(criteriaBuilder.equal(root.get("transcode").as(String.class), searchBean.getTranscode().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getStatus())) {
+ predicates.add(criteriaBuilder.equal(root.get("status").as(String.class), searchBean.getStatus().trim()));
+ }
+ return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
+ }, pageable);
+ return new PageResult<>(page);
+ }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/FunctionServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/FunctionServiceImpl.java
index 5a764a5..9dec0bf 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/FunctionServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/FunctionServiceImpl.java
@@ -11,6 +11,8 @@
import com.supwisdom.dlpay.system.bean.FunctionSearchBean;
import com.supwisdom.dlpay.system.service.FunctionService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
@@ -31,6 +33,7 @@
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;
@@ -68,6 +71,7 @@
}
@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/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
index e58032e..1a591ac 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
@@ -6,6 +6,7 @@
import com.supwisdom.dlpay.framework.domain.TOperLog;
import com.supwisdom.dlpay.framework.domain.TOperRole;
import com.supwisdom.dlpay.framework.domain.TOperator;
+import com.supwisdom.dlpay.framework.tenant.TenantContext;
import com.supwisdom.dlpay.framework.util.*;
import com.supwisdom.dlpay.system.bean.LogBean;
import com.supwisdom.dlpay.system.bean.OperatorSearchBean;
@@ -29,145 +30,146 @@
@Service
public class OperatorServiceImpl implements OperatorService {
- @Autowired
- private OperatorDao operatorDao;
- @Autowired
- private OperRoleDao operRoleDao;
- @Autowired
- private OperLogDao operLogDao;
+ @Autowired
+ private OperatorDao operatorDao;
+ @Autowired
+ private OperRoleDao operRoleDao;
+ @Autowired
+ private OperLogDao operLogDao;
- @Override
- public PageResult<TOperator> getOperatorsByPage(int pageNo, int pageSize, OperatorSearchBean searchBean) {
- Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.Direction.DESC, "opendate");
- Page<TOperator> page = operatorDao.findAll(new Specification<TOperator>() {
- @Override
- public Predicate toPredicate(Root<TOperator> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
- List<Predicate> predicates = new ArrayList<>();
- if (!StringUtil.isEmpty(searchBean.getOpercode())) {
- predicates.add(criteriaBuilder.equal(root.get("opercode").as(String.class), searchBean.getOpercode().trim()));
- }
- if (!StringUtil.isEmpty(searchBean.getOpername())) {
- predicates.add(criteriaBuilder.like(root.get("opername").as(String.class), "%" + searchBean.getOpername().trim() + "%"));
- }
- if (!StringUtil.isEmpty(searchBean.getMobile())) {
- predicates.add(criteriaBuilder.like(root.get("mobile").as(String.class), "%" + searchBean.getMobile().trim() + "%"));
- }
- if (null != searchBean.getDeleteShow() && !searchBean.getDeleteShow()) {
- predicates.add(criteriaBuilder.equal(root.get("status").as(String.class), TradeDict.STATUS_NORMAL)); //仅显示正常
- }
- return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
- }
- }, pageable);
+ @Override
+ public PageResult<TOperator> getOperatorsByPage(int pageNo, int pageSize, OperatorSearchBean searchBean) {
+ Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.Direction.DESC, "opendate");
+ Page<TOperator> page = operatorDao.findAll(new Specification<TOperator>() {
+ @Override
+ public Predicate toPredicate(Root<TOperator> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
+ List<Predicate> predicates = new ArrayList<>();
+ if (!StringUtil.isEmpty(searchBean.getOpercode())) {
+ predicates.add(criteriaBuilder.equal(root.get("opercode").as(String.class), searchBean.getOpercode().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getOpername())) {
+ predicates.add(criteriaBuilder.like(root.get("opername").as(String.class), "%" + searchBean.getOpername().trim() + "%"));
+ }
+ if (!StringUtil.isEmpty(searchBean.getMobile())) {
+ predicates.add(criteriaBuilder.like(root.get("mobile").as(String.class), "%" + searchBean.getMobile().trim() + "%"));
+ }
+ if (null != searchBean.getDeleteShow() && !searchBean.getDeleteShow()) {
+ predicates.add(criteriaBuilder.equal(root.get("status").as(String.class), TradeDict.STATUS_NORMAL)); //仅显示正常
+ }
+ return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
+ }
+ }, pageable);
- return new PageResult<>(page);
- }
+ return new PageResult<>(page);
+ }
- @Override
- public boolean checkOpercodeExists(String opercode, String operid) {
- TOperator oper = operatorDao.findByOpercode(opercode.trim());
- if (null != oper && StringUtil.isEmpty(operid)) return true;
- if (null != oper && !StringUtil.isEmpty(operid) && !operid.trim().equals(oper.getOperid())) return true;
+ @Override
+ public boolean checkOpercodeExists(String opercode, String operid) {
+ TOperator oper = operatorDao.findByOpercode(opercode.trim());
+ if (null != oper && StringUtil.isEmpty(operid)) return true;
+ if (null != oper && !StringUtil.isEmpty(operid) && !operid.trim().equals(oper.getOperid())) return true;
+ return false;
+ }
+
+ @Override
+ public boolean saveOperator(TOperator operator, String roles) {
+ if (StringUtil.isEmpty(operator.getOperid())) {
+ String[] roleids = roles.split(",");
+ operator.setOpendate(DateUtil.getNow("yyyyMMdd"));
+ operator.setStatus(TradeDict.STATUS_NORMAL);
+ operator.setOpertype(WebConstant.OPERTYPE_DEFAULT);
+ BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
+ operator.setOperpwd(encoder.encode(WebConstant.OPERPWD_DEFAULT));
+ operator = operatorDao.save(operator);
+ for (String role : roleids) {
+ TOperRole operRole = new TOperRole();
+ operRole.setOperid(operator.getOperid());
+ operRole.setRoleId(role);
+ operRoleDao.save(operRole);
+ }
+ } else {
+ Optional<TOperator> temp = operatorDao.findById(operator.getOperid());
+ if (!temp.isPresent()) {
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.setThirdadmin(operator.getThirdadmin());
+ operatorDao.save(op);
+ operRoleDao.deleteByOperid(op.getOperid());
+ String[] roleids = roles.split(",");
+ for (String role : roleids) {
+ TOperRole operRole = new TOperRole();
+ operRole.setOperid(op.getOperid());
+ operRole.setRoleId(role);
+ operRoleDao.save(operRole);
+ }
}
+ return true;
+ }
- @Override
- public boolean saveOperator(TOperator operator, String roles) {
- if (StringUtil.isEmpty(operator.getOperid())) {
- String[] roleids = roles.split(",");
- operator.setOpendate(DateUtil.getNow("yyyyMMdd"));
- operator.setStatus(TradeDict.STATUS_NORMAL);
- operator.setOpertype(WebConstant.OPERTYPE_DEFAULT);
- BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
- operator.setOperpwd(encoder.encode(WebConstant.OPERPWD_DEFAULT));
- operator = operatorDao.save(operator);
- for (String role : roleids) {
- TOperRole operRole = new TOperRole();
- operRole.setOperid(operator.getOperid());
- operRole.setRoleId(role);
- operRoleDao.save(operRole);
- }
- } else {
- Optional<TOperator> temp = operatorDao.findById(operator.getOperid());
- if (!temp.isPresent()) {
- 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());
- operatorDao.save(op);
- operRoleDao.deleteByOperid(op.getOperid());
- String[] roleids = roles.split(",");
- for (String role : roleids) {
- TOperRole operRole = new TOperRole();
- operRole.setOperid(op.getOperid());
- operRole.setRoleId(role);
- operRoleDao.save(operRole);
- }
- }
- return true;
- }
+ @Override
+ public TOperator getOperatorByCode(String opercode) {
+ return operatorDao.findByOpercode(opercode);
+ }
- @Override
- public TOperator getOperatorByCode(String opercode) {
- return operatorDao.findByOpercode(opercode);
- }
+ @Override
+ public List<TOperRole> getOperRoleByOperId(String operid) {
+ return operRoleDao.findAllByOperid(operid);
+ }
- @Override
- public List<TOperRole> getOperRoleByOperId(String operid) {
- return operRoleDao.findAllByOperid(operid);
+ @Override
+ public boolean resetPwd(String operid) {
+ Optional<TOperator> temp = operatorDao.findById(operid);
+ if (!temp.isPresent()) {
+ return false;
}
+ TOperator op = temp.get();
+ BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
+ op.setOperpwd(encoder.encode(WebConstant.OPERPWD_DEFAULT));
+ operatorDao.save(op);
+ return true;
+ }
- @Override
- public boolean resetPwd(String operid) {
- Optional<TOperator> temp = operatorDao.findById(operid);
- if (!temp.isPresent()) {
- return false;
- }
- TOperator op = temp.get();
- BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
- op.setOperpwd(encoder.encode(WebConstant.OPERPWD_DEFAULT));
- operatorDao.save(op);
- return true;
+ @Override
+ public boolean updateState(String operid, String state) {
+ Optional<TOperator> temp = operatorDao.findById(operid);
+ if (!temp.isPresent()) {
+ return false;
}
+ TOperator op = temp.get();
+ op.setStatus(state);
+ operatorDao.save(op);
+ return true;
+ }
- @Override
- public boolean updateState(String operid, String state) {
- Optional<TOperator> temp = operatorDao.findById(operid);
- if (!temp.isPresent()) {
- return false;
- }
- TOperator op = temp.get();
- op.setStatus(state);
- operatorDao.save(op);
- return true;
- }
+ @Override
+ public boolean saveOperLog(TOperLog log) {
+ operLogDao.save(log);
+ return true;
+ }
- @Override
- public boolean saveOperLog(TOperLog log) {
- operLogDao.save(log);
- return true;
+ @Override
+ public PageResult<TOperLog> getOperLogs(LogBean param) {
+ Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()
+ , Sort.by(Sort.Direction.DESC, "logdate"));
+ if (!StringUtil.isEmpty(param.getOpername())) {
+ return new PageResult<>(operLogDao.findAllByOpernameContaining(param.getOpername(), pageable));
}
+ return new PageResult<>(operLogDao.findAll(pageable));
+ }
- @Override
- public PageResult<TOperLog> getOperLogs(LogBean param) {
- Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()
- , Sort.by(Sort.Direction.DESC,"logdate"));
- if (!StringUtil.isEmpty(param.getOpername())) {
- return new PageResult<>(operLogDao.findAllByOpernameContaining(param.getOpername(), pageable));
- }
- return new PageResult<>(operLogDao.findAll(pageable));
+ @Override
+ public boolean saveOperator(TOperator operator) {
+ Optional<TOperator> temp = operatorDao.findById(operator.getOperid());
+ if (!temp.isPresent()) {
+ return false;
}
-
- @Override
- public boolean saveOperator(TOperator operator) {
- Optional<TOperator> temp = operatorDao.findById(operator.getOperid());
- if (!temp.isPresent()) {
- return false;
- }
- operatorDao.save(operator);
- return true;
- }
+ operatorDao.save(operator);
+ return true;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
index f774582..31794bf 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
@@ -2,20 +2,23 @@
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.domain.TSourceType;
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.util.PageResult;
import com.supwisdom.dlpay.framework.util.StringUtil;
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.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
@@ -41,7 +44,7 @@
@Autowired
private ApiClientDao apiClientDao;
@Autowired
- private SourceTypeDao paytypeDao;
+ private SourceTypeDao sourceTypeDao;
@Autowired
private PaytypeConfigDao paytypeConfigDao;
@@ -105,14 +108,6 @@
return false;
}
- @Override
- public boolean saveOrUpdateBusinesspara(TBusinesspara businesspara) {
- if (null != businesspara) {
- businessparaDao.save(businesspara);
- return true;
- }
- return false;
- }
@Override
public PageResult<TApiClient> getApiClientparaPage(String appid, int pageNo, int pageSize) {
@@ -132,8 +127,8 @@
}
@Override
- public boolean saveOrUpdateApiClient(TApiClient apiClient){
- if(null!=apiClient){
+ public boolean saveOrUpdateApiClient(TApiClient apiClient) {
+ if (null != apiClient) {
apiClientDao.save(apiClient);
return true;
}
@@ -150,42 +145,43 @@
}
@Override
- public PageResult<TSourceType> getPaytypePage(String paytype, int pageNo, int pageSize) {
+ public PageResult<TSourceType> getSourceTypePage(String paytype, int pageNo, int pageSize) {
Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("sourceType"));
if (!StringUtil.isEmpty(paytype)) {
- return new PageResult<>(paytypeDao.findBySourceTypeContaining(paytype.trim(), pageable));
+ return new PageResult<>(sourceTypeDao.findBySourceTypeContaining(paytype.trim(), pageable));
}
- return new PageResult<>(paytypeDao.findAll(pageable));
+ return new PageResult<>(sourceTypeDao.findAll(pageable));
}
@Override
- public TSourceType getPaytype(String paytype) {
+ @Cacheable(cacheNames = "source_type_cache", key = "#p0")
+ public TSourceType getSourceType(String paytype) {
if (!StringUtil.isEmpty(paytype)) {
- return paytypeDao.getBySourceType(paytype.trim());
+ return sourceTypeDao.getBySourceType(paytype.trim());
}
return null;
}
@Override
- public boolean saveOrUpdatePaytype(TSourceType paytype){
- if(null!=paytype){
- paytypeDao.save(paytype);
+ @Cacheable(cacheNames = "source_type_cache")
+ public List<TSourceType> getAllSourceType() {
+ return sourceTypeDao.findAll();
+ }
+
+
+ @Override
+ @CacheEvict(cacheNames = "source_type_cache", key = "#paytype.sourceType")
+ public boolean deleteSourceType(TSourceType paytype) {
+ if (null != paytype) {
+ sourceTypeDao.delete(paytype);
return true;
}
return false;
}
@Override
- public boolean deletePaytype(TSourceType paytype){
- if(null!=paytype){
- paytypeDao.delete(paytype);
- return true;
- }
- return false;
- }
-
- @Override
- public List<TPaytypeConfig> getPaytypeConfigList(String paytype) {
+ @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());
if (!StringUtil.isEmpty(list))
@@ -195,13 +191,15 @@
}
@Override
- public boolean savePaytypeConfig(String paytype, Map<String, String> param) throws WebCheckException {
- TSourceType tPaytype = getPaytype(paytype);
+ @CacheEvict(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 + "]不存在");
for (String key : param.keySet()) {
String value = param.get(key);
TPaytypeConfig config = paytypeConfigDao.getByPaytypeAndAndConfigid(tPaytype.getSourceType(), key);
- if (null == config) throw new WebCheckException("支付能力[" + tPaytype.getSourceType() + "]不存在配置项[" + key + "],请重新查询");
+ if (null == config)
+ throw new WebCheckException("支付能力[" + tPaytype.getSourceType() + "]不存在配置项[" + key + "],请重新查询");
config.setConfigValue(StringUtil.isEmpty(value) ? null : value.trim());
paytypeConfigDao.save(config);
}
@@ -209,5 +207,4 @@
}
-
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
index c96485c..67281b5 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
@@ -7,6 +7,7 @@
import com.supwisdom.dlpay.framework.domain.TResource;
import com.supwisdom.dlpay.framework.domain.TRole;
import com.supwisdom.dlpay.framework.domain.TRoleFunction;
+import com.supwisdom.dlpay.framework.tenant.TenantContext;
import com.supwisdom.dlpay.framework.util.DateUtil;
import com.supwisdom.dlpay.framework.util.PageResult;
import com.supwisdom.dlpay.framework.util.StringUtil;
@@ -25,154 +26,164 @@
@Service
public class RoleServiceImpl implements RoleService {
- @Autowired
- private RoleDao roleDao;
+ @Autowired
+ private RoleDao roleDao;
- @Autowired
- private ResourceDao resourceDao;
+ @Autowired
+ private ResourceDao resourceDao;
- @Autowired
- private RoleFunctionDao roleFunctionDao;
+ @Autowired
+ private RoleFunctionDao roleFunctionDao;
- @Autowired
- private PermissionDao permissionDao;
- @Autowired
- private OperRoleDao operRoleDao;
+ @Autowired
+ private PermissionDao permissionDao;
+ @Autowired
+ private OperRoleDao operRoleDao;
- @Override
- public List<TRole> findAllRoles() {
- List<TRole> list = roleDao.getAllRoles();
- if (!StringUtil.isEmpty(list)) return list;
- return new ArrayList<>(0);
+ @Override
+ public List<TRole> findAllRoles() {
+ List<TRole> list = roleDao.getAllRoles();
+ if (!StringUtil.isEmpty(list)) return list;
+ return new ArrayList<>(0);
+ }
+
+ @Override
+ public TRole findRoleByRoleid(String roleid) {
+ Optional<TRole> role = roleDao.findById(roleid);
+ if (role.isPresent()) {
+ return role.get();
}
+ return null;
+ }
- @Override
- public TRole findRoleByRoleid(String roleid) {
- Optional<TRole> role = roleDao.findById(roleid);
- if(role.isPresent()){
- return role.get();
- }
- return null;
+ @Override
+ public TResource findResourceByURI(String uri) {
+ return resourceDao.findByUri(uri);
+ }
+
+ @Override
+ public TRoleFunction findRoleFunctionByRoleIdAndFunctionId(String roleid, Integer functionid) {
+ return roleFunctionDao.findByRoleIdAndFunctionId(roleid, functionid);
+ }
+
+ @Override
+ public PageResult<TRole> getRolesByKey(FunctionSearchBean param) {
+ Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()
+ , Sort.by("createtime"));
+ if (!StringUtil.isEmpty(param.getFunctioname())) {
+ return new PageResult<>(roleDao.findAllByRoleNameContaining(param.getFunctioname(), pageable));
}
+ return new PageResult<>(roleDao.findAll(pageable));
+ }
- @Override
- public TResource findResourceByURI(String uri) {
- return resourceDao.findByUri(uri);
+ @Override
+ public JsonResult saveRole(TRole role) {
+ if (!StringUtil.isEmpty(role.getRoleId())) {
+ TRole temp = roleDao.findByRoleNameAndRoleIdNot(role.getRoleName(), role.getRoleId());
+ if (temp != null) {
+ return JsonResult.error("角色名称已存在");
+ }
+ Optional<TRole> opt = roleDao.findById(role.getRoleId());
+ if (opt == null || !opt.isPresent()) {
+ return JsonResult.error("角色已被删除");
+ }
+ temp = opt.get();
+ temp.setRoleName(role.getRoleName());
+ temp.setRoleDesc(role.getRoleDesc());
+// temp.setRoleCode(role.getRoleCode());
+ temp.setLastsaved(DateUtil.getNow());
+ roleDao.save(temp);
+ } else {
+ TRole temp = roleDao.findByRoleName(role.getRoleName());
+ if (temp != null) {
+ return JsonResult.error("角色名称已存在");
+ }
+
+ role.setCreatetime(DateUtil.getNow());
+ role.setEditflag(1);
+ role.setRoleCode("ROLE_ADMIN");
+ roleDao.save(role);
}
+ return JsonResult.ok("成功");
+ }
- @Override
- public TRoleFunction findRoleFunctionByRoleIdAndFunctionId(String roleid, Integer functionid) {
- return roleFunctionDao.findByRoleIdAndFunctionId(roleid, functionid);
+ @Override
+ public List<TRoleFunction> getRoleFuncByRoleid(String roleId) {
+ return roleFunctionDao.findByRoleId(roleId);
+ }
+
+
+ @Override
+ public TPermission findByRoleIdAndResid(String roleFuncId, Integer resid) {
+ return permissionDao.findByRoleIdAndResid(roleFuncId, resid);
+ }
+
+ @Override
+ public JsonResult saveRoleFuncId(String roleId, String funcs) {
+ Optional<TRole> ret = roleDao.findById(roleId);
+ if (ret == null || !ret.isPresent()) {
+ return JsonResult.error("角色不存在");
}
-
- @Override
- public PageResult<TRole> getRolesByKey(FunctionSearchBean param) {
- Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()
- , Sort.by("createtime"));
- if (!StringUtil.isEmpty(param.getFunctioname())) {
- return new PageResult<>(roleDao.findAllByRoleNameContaining(param.getFunctioname(), pageable));
- }
- return new PageResult<>(roleDao.findAll(pageable));
+ roleFunctionDao.deleteByRoleId(roleId);
+ permissionDao.deleteByRoleId(roleId);
+ 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);
+ } else {
+ if("-1".equals(func)) continue; //全选排除
+ TRoleFunction roleFunction = new TRoleFunction();
+ roleFunction.setFunctionId(Integer.valueOf(func));
+ roleFunction.setRoleId(roleId);
+ roleFunctionDao.save(roleFunction);
+ }
}
+ return JsonResult.ok("成功");
+ }
- @Override
- public JsonResult saveRole(TRole role) {
- if (!StringUtil.isEmpty(role.getRoleId())) {
- TRole temp = roleDao.findByRoleNameAndRoleIdNot(role.getRoleName(), role.getRoleId());
- if (temp != null) {
- return JsonResult.error("角色名称已存在");
- }
- Optional<TRole> opt = roleDao.findById(role.getRoleId());
- if (opt == null || !opt.isPresent()) {
- return JsonResult.error("角色已被删除");
- }
- temp = opt.get();
- temp.setRoleName(role.getRoleName());
- temp.setRoleDesc(role.getRoleDesc());
- temp.setRoleCode(role.getRoleCode());
- temp.setLastsaved(DateUtil.getNow());
- roleDao.save(temp);
- } else {
- TRole temp = roleDao.findByRoleName(role.getRoleName());
- if (temp != null) {
- return JsonResult.error("角色名称已存在");
- }
-
- role.setCreatetime(DateUtil.getNow());
- role.setEditflag(1);
- role.setRoleCode("ROLE_ADMIN");
- roleDao.save(role);
- }
- return JsonResult.ok("成功");
+ @Override
+ 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);
+ if (allChecked && !zTreeNode.isChecked()) allChecked = false;
+ zTreeNode.setOpen(data.getOpen() == 0 ? false : true);
+ 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 List<TRoleFunction> getRoleFuncByRoleid(String roleId) {
- return roleFunctionDao.findByRoleId(roleId);
+ @Override
+ public JsonResult deleteRole(String roleid) {
+ Optional<TRole> ret = roleDao.findById(roleid);
+ if (ret == null || !ret.isPresent()) {
+ return JsonResult.error("角色不存在");
}
-
-
- @Override
- public TPermission findByRoleIdAndResid(String roleFuncId, Integer resid) {
- return permissionDao.findByRoleIdAndResid(roleFuncId, resid);
+ if (ret.get().getEditflag() != 1) {
+ return JsonResult.error("该角色不能删除");
}
-
- @Override
- public JsonResult saveRoleFuncId(String roleId, String funcs) {
- Optional<TRole> ret = roleDao.findById(roleId);
- if (ret == null || !ret.isPresent()) {
- return JsonResult.error("角色不存在");
- }
- roleFunctionDao.deleteByRoleId(roleId);
- permissionDao.deleteByRoleId(roleId);
- 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);
- } else {
- TRoleFunction roleFunction = new TRoleFunction();
- roleFunction.setFunctionId(Integer.valueOf(func));
- roleFunction.setRoleId(roleId);
- roleFunctionDao.save(roleFunction);
- }
- }
- return JsonResult.ok("成功");
- }
-
- @Override
- public List<ZTreeNode> findByRoleIdNative(String roleId) {
- List<NodeData> nodeData = roleFunctionDao.findByRoleIdNative(roleId);
- List<ZTreeNode> ret = new ArrayList<>();
- 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);
- ret.add(zTreeNode);
- }
- return ret;
- }
-
- @Override
- public JsonResult deleteRole(String roleid) {
- Optional<TRole> ret = roleDao.findById(roleid);
- if (ret == null || !ret.isPresent()) {
- return JsonResult.error("角色不存在");
- }
- if(ret.get().getEditflag()!=1){
- return JsonResult.error("该角色不能删除");
- }
- permissionDao.deleteByRoleId(roleid);
- roleFunctionDao.deleteByRoleId(roleid);
- operRoleDao.deleteByRoleId(roleid);
- roleDao.deleteById(roleid);
- return JsonResult.ok("成功");
- }
+ permissionDao.deleteByRoleId(roleid);
+ roleFunctionDao.deleteByRoleId(roleid);
+ operRoleDao.deleteByRoleId(roleid);
+ roleDao.deleteById(roleid);
+ return JsonResult.ok("成功");
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
new file mode 100644
index 0000000..815d574
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
@@ -0,0 +1,84 @@
+package com.supwisdom.dlpay.system.service.impl;
+
+import com.supwisdom.dlpay.api.dao.PaytypeConfigDao;
+import com.supwisdom.dlpay.api.dao.ShopPaytypeConfigDao;
+import com.supwisdom.dlpay.api.dao.ShopPaytypeDao;
+import com.supwisdom.dlpay.api.dao.SourceTypeDao;
+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.TSourceType;
+import com.supwisdom.dlpay.framework.data.SystemDateTime;
+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.system.bean.ShopConfigBean;
+import com.supwisdom.dlpay.system.bean.ZTreeNode;
+import com.supwisdom.dlpay.system.service.ShopDataService;
+import com.supwisdom.dlpay.util.WebCheckException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class ShopDataServiceImpl implements ShopDataService {
+ @Autowired
+ private ShopPaytypeDao shopPaytypeDao;
+ @Autowired
+ private SystemUtilService systemUtilService;
+ @Autowired
+ private SourceTypeDao paytypeDao;
+ @Autowired
+ private PaytypeConfigDao paytypeConfigDao;
+ @Autowired
+ private ShopPaytypeConfigDao shopPaytypeConfigDao;
+
+
+
+
+
+ @Override
+ public TShopPaytype getShopPaytype(String shopaccno, String paytype) {
+ return shopPaytypeDao.getById(paytype, shopaccno);
+ }
+
+
+
+ @Override
+ public List<TShopPaytypeConfig> getShopPaytypeConfigs(String shopaccno, String paytype) {
+ List<TShopPaytypeConfig> result = new ArrayList<>(0);
+ if (!StringUtil.isEmpty(paytype)) {
+ List<TPaytypeConfig> list = paytypeConfigDao.getByPaytypeOrderByConfigid(paytype.trim());
+ if (!StringUtil.isEmpty(list)) {
+ for (TPaytypeConfig pt : list) {
+ TShopPaytypeConfig spc = shopPaytypeConfigDao.getShopPaytypeConfigById(shopaccno, pt.getPaytype(), pt.getConfigid());
+ if (null == spc) {
+ spc = new TShopPaytypeConfig();
+ spc.setShopaccno(shopaccno);
+ spc.setPaytype(pt.getPaytype());
+ spc.setConfigid(pt.getConfigid());
+ spc.setConfigName(pt.getConfigName());
+ spc.setConfigValue(null);
+ }
+ result.add(spc);
+ }
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
index 6488fd6..09b7358 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
@@ -25,163 +25,163 @@
@Service
public class UserDataServiceImpl implements UserDataService {
- @Autowired
- private PersonDao personDao;
- @Autowired
- private AccountDao accountDao;
- @Autowired
- private PointsAccountDao pointsAccountDao;
- @Autowired
- private SystemUtilService systemUtilService;
- @Autowired
- private PersonIdentityDao personIdentityDao;
+ @Autowired
+ private PersonDao personDao;
+ @Autowired
+ private AccountDao accountDao;
+ @Autowired
+ private PointsAccountDao pointsAccountDao;
+ @Autowired
+ private SystemUtilService systemUtilService;
+ @Autowired
+ private PersonIdentityDao personIdentityDao;
- @Override
- public PageResult<TPerson> getPersonsByKey(PersonParamBean param) {
- Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()
- , Sort.by(Sort.Direction.DESC, "lastsaved"));
- if (!StringUtil.isEmpty(param.getName())) {
- return new PageResult<>(personDao.findAllByNameContaining(param.getName(), pageable));
- }
- return new PageResult<>(personDao.findAll(pageable));
+ @Override
+ public PageResult<TPerson> getPersonsByKey(PersonParamBean param) {
+ Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()
+ , Sort.by(Sort.Direction.DESC, "lastsaved"));
+ if (!StringUtil.isEmpty(param.getName())) {
+ return new PageResult<>(personDao.findAllByNameContaining(param.getName(), pageable));
}
+ return new PageResult<>(personDao.findAll(pageable));
+ }
- @Override
- public PageResult<TAccount> getAccountsByKey(PersonParamBean param) {
- Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize());
- if (!StringUtil.isEmpty(param.getName())) {
- return new PageResult<>(accountDao.findAllByAccnameContaining(param.getName(), pageable));
- }
- return new PageResult<>(accountDao.findAll(pageable));
+ @Override
+ public PageResult<TAccount> getAccountsByKey(PersonParamBean param) {
+ Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize());
+ if (!StringUtil.isEmpty(param.getName())) {
+ return new PageResult<>(accountDao.findAllByAccnameContaining(param.getName(), pageable));
}
+ return new PageResult<>(accountDao.findAll(pageable));
+ }
- @Override
- public PageResult<TPointsAccount> getPointsByKey(PersonParamBean param) {
- Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize());
- if (!StringUtil.isEmpty(param.getName())) {
- return new PageResult<>(pointsAccountDao.findAllByNameContaining(param.getName(), pageable));
- }
- return new PageResult<>(pointsAccountDao.findAll(pageable));
+ @Override
+ public PageResult<TPointsAccount> getPointsByKey(PersonParamBean param) {
+ Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize());
+ if (!StringUtil.isEmpty(param.getName())) {
+ return new PageResult<>(pointsAccountDao.findAllByNameContaining(param.getName(), pageable));
}
+ return new PageResult<>(pointsAccountDao.findAll(pageable));
+ }
- @Override
- public JsonResult saveUser(TPerson person) {
- if (!StringUtil.isEmpty(person.getUserid())) {
- Optional<TPerson> temp = personDao.findById(person.getUserid());
- if (!temp.isPresent()) {
- return JsonResult.error("参数错误");
- }
- TPerson it = temp.get();
- if (!person.getIdno().equals(it.getIdno())
- || !person.getIdtype().equals(it.getIdtype())) {
- TPerson has = personDao.findByIdentity(person.getIdtype(), person.getIdno());
- if (has != null && !has.getUserid().equals(person.getUserid())) {
- return JsonResult.error("证件类型、证件号已存在");
- }
- }
- if (!person.getName().equals(it.getName())) {
- TAccount account = accountDao.findByUserid(person.getUserid());
- if (account != null) {
- account.setAccname(person.getName());
- accountDao.save(account);
- }
- }
- if (StringUtil.isEmpty(person.getStatus())) {
- person.setStatus(TradeDict.STATUS_NORMAL);
- }
- personDao.save(person);
- } else {
- TPerson has = personDao.findByIdentity(person.getIdtype(), person.getIdno());
- if (has != null) {
- return JsonResult.error("证件类型、证件号已存在");
- }
- SystemDateTime systemDateTime = systemUtilService.getSysdatetime();
- person.setStatus(TradeDict.STATUS_NORMAL);
- person.setLastsaved(systemDateTime.getHostdatetime());
- person = personDao.save(person);
-
- TAccount account = new TAccount();
- account.setAccname(person.getName());
- account.setSubjno(Subject.SUBJNO_PERSONAL_DEPOSIT);
- account.setUserid(person.getUserid());
- account.setStatus(person.getStatus());
- account.setBalance(0.0);
- account.setAvailbal(0.0);
- account.setFrozebal(0.0);
- account.setLowfreeFlag(false);
- account.setMaxbal(systemUtilService.getSysparaValueAsDouble(SysparaUtil.SYSPARAID_NO1, SysparaUtil.SYSPARA_NO1_DEFAULT));
- account.setLasttransdate(systemDateTime.getHostdate());
- account.setLastdayDpsamt(0.0);
- account.setLastdayTransamt(0.0);
- account.setOpendate(systemDateTime.getHostdate());
- account.setTac(account.generateTac());
- accountDao.save(account);
+ @Override
+ public JsonResult saveUser(TPerson person) {
+ if (!StringUtil.isEmpty(person.getUserid())) {
+ Optional<TPerson> temp = personDao.findById(person.getUserid());
+ if (!temp.isPresent()) {
+ return JsonResult.error("参数错误");
+ }
+ TPerson it = temp.get();
+ if (!person.getIdno().equals(it.getIdno())
+ || !person.getIdtype().equals(it.getIdtype())) {
+ TPerson has = personDao.findByIdentity(person.getIdtype(), person.getIdno());
+ if (has != null && !has.getUserid().equals(person.getUserid())) {
+ return JsonResult.error("证件类型、证件号已存在");
}
- return JsonResult.ok("添加成功");
- }
-
- @Override
- public JsonResult deleteUser(String userid) {
- TAccount account = accountDao.findByUserid(userid);
+ }
+ if (!person.getName().equals(it.getName())) {
+ TAccount account = accountDao.findByUserid(person.getUserid());
if (account != null) {
- if (!TradeDict.STATUS_CLOSED.equals(account.getStatus()) && account.getBalance() != 0) {
- return JsonResult.error("该用户账户未注销且余额不为0,无法删除");
- } else {
- accountDao.delete(account);
- }
+ account.setAccname(person.getName());
+ accountDao.save(account);
}
- TPointsAccount pointsAccount = pointsAccountDao.findByUserid(userid);
- if (pointsAccount != null) {
- if (pointsAccount.getPoints() != 0) {
- return JsonResult.error("该用户账户积分不为0,无法删除,若要删除请先删除积分账户");
- } else {
- pointsAccountDao.delete(pointsAccount);
- }
- }
- personDao.deleteById(userid);
- return JsonResult.ok("操作成功");
- }
+ }
+ if (StringUtil.isEmpty(person.getStatus())) {
+ person.setStatus(TradeDict.STATUS_NORMAL);
+ }
+ personDao.save(person);
+ } else {
+ TPerson has = personDao.findByIdentity(person.getIdtype(), person.getIdno());
+ if (has != null) {
+ return JsonResult.error("证件类型、证件号已存在");
+ }
+ SystemDateTime systemDateTime = systemUtilService.getSysdatetime();
+ person.setStatus(TradeDict.STATUS_NORMAL);
+ person.setLastsaved(systemDateTime.getHostdatetime());
+ person = personDao.save(person);
- @Override
- public JsonResult closeAccount(String accno) {
- Optional<TAccount> opt = accountDao.findById(accno);
- if (opt.isPresent()) {
- TAccount acc = opt.get();
- acc.setStatus(TradeDict.STATUS_CLOSED);
- accountDao.save(acc);
- return JsonResult.ok("操作成功");
- } else {
- return JsonResult.error("参数错误");
- }
+ TAccount account = new TAccount();
+ account.setAccname(person.getName());
+ account.setSubjno(Subject.SUBJNO_PERSONAL_DEPOSIT);
+ account.setUserid(person.getUserid());
+ account.setStatus(person.getStatus());
+ account.setBalance(0.0);
+ account.setAvailbal(0.0);
+ account.setFrozebal(0.0);
+ account.setLowfreeFlag(false);
+ account.setMaxbal(systemUtilService.getSysparaValueAsDouble(SysparaUtil.SYSPARAID_NO1, SysparaUtil.SYSPARA_NO1_DEFAULT));
+ account.setLasttransdate(systemDateTime.getHostdate());
+ account.setLastdayDpsamt(0.0);
+ account.setLastdayTransamt(0.0);
+ account.setOpendate(systemDateTime.getHostdate());
+ account.setTac(account.generateTac());
+ accountDao.save(account);
}
+ return JsonResult.ok("添加成功");
+ }
- @Override
- public JsonResult deletePoint(String userid) {
- Optional<TPointsAccount> pointsAccount = pointsAccountDao.findById(userid);
- if (pointsAccount.isPresent()) {
- pointsAccountDao.delete(pointsAccount.get());
- return JsonResult.ok("操作成功");
- }else {
- return JsonResult.error("参数错误");
- }
+ @Override
+ public JsonResult deleteUser(String userid) {
+ TAccount account = accountDao.findByUserid(userid);
+ if (account != null) {
+ if (!TradeDict.STATUS_CLOSED.equals(account.getStatus()) && account.getBalance() != 0) {
+ return JsonResult.error("该用户账户未注销且余额不为0,无法删除");
+ } else {
+ accountDao.delete(account);
+ }
}
+ TPointsAccount pointsAccount = pointsAccountDao.findByUserid(userid);
+ if (pointsAccount != null) {
+ if (pointsAccount.getPoints() != 0) {
+ return JsonResult.error("该用户账户积分不为0,无法删除,若要删除请先删除积分账户");
+ } else {
+ pointsAccountDao.delete(pointsAccount);
+ }
+ }
+ personDao.deleteById(userid);
+ return JsonResult.ok("操作成功");
+ }
- @Override
- public List<TPersonIdentity> getPersonIdentity(String userid) {
- return null;
+ @Override
+ public JsonResult closeAccount(String accno) {
+ Optional<TAccount> opt = accountDao.findById(accno);
+ if (opt.isPresent()) {
+ TAccount acc = opt.get();
+ acc.setStatus(TradeDict.STATUS_CLOSED);
+ accountDao.save(acc);
+ return JsonResult.ok("操作成功");
+ } else {
+ return JsonResult.error("参数错误");
}
+ }
- @Override
- public PageResult<TPointsAccount> getUserPointDTL(PersonParamBean param) {
- return null;
+ @Override
+ public JsonResult deletePoint(String userid) {
+ Optional<TPointsAccount> pointsAccount = pointsAccountDao.findById(userid);
+ if (pointsAccount.isPresent()) {
+ pointsAccountDao.delete(pointsAccount.get());
+ return JsonResult.ok("操作成功");
+ }else {
+ return JsonResult.error("参数错误");
}
+ }
- @Override
- public TPerson getPersonByThirdUid(String thirdUid) {
- TPersonIdentity personIdentity = personIdentityDao.getByThirdUid(thirdUid);
- if (personIdentity != null) {
- return personIdentity.getPerson();
- }
- return null;
+ @Override
+ public List<TPersonIdentity> getPersonIdentity(String userid) {
+ return null;
+ }
+
+ @Override
+ public PageResult<TPointsAccount> getUserPointDTL(PersonParamBean param) {
+ return null;
+ }
+
+ @Override
+ public TPerson getPersonByThirdUid(String thirdUid) {
+ TPersonIdentity personIdentity = personIdentityDao.getByThirdUid(thirdUid);
+ if (personIdentity != null) {
+ return personIdentity.getPerson();
}
+ return null;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/util/DESedeUtil.java b/src/main/java/com/supwisdom/dlpay/util/DESedeUtil.java
new file mode 100644
index 0000000..0d0e4cf
--- /dev/null
+++ b/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/src/main/java/com/supwisdom/dlpay/util/DlpayUtil.java b/src/main/java/com/supwisdom/dlpay/util/DlpayUtil.java
new file mode 100644
index 0000000..d4521d5
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/util/DlpayUtil.java
@@ -0,0 +1,76 @@
+package com.supwisdom.dlpay.util;
+
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+import java.io.*;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class DlpayUtil {
+ /**
+ * socket方式请求农商行
+ */
+ public static String send(String ip, int port, int timeout, String data) throws UnknownHostException, IOException {
+ Socket client = new Socket(ip, port);
+ client.setSoTimeout(timeout * 1000); //timeout秒
+ PrintWriter printWriter = new PrintWriter(client.getOutputStream());
+ // 发送消息
+ printWriter.println(data);
+ printWriter.flush();
+
+ // 读取返回信息
+ InputStreamReader streamReader = new InputStreamReader(client.getInputStream());
+ BufferedReader reader = new BufferedReader(streamReader);
+ StringBuffer content = new StringBuffer(); //存返回信息
+ int ch;
+ while ((ch = reader.read()) != -1) {
+ content.append((char) ch);
+ }
+ reader.close();
+ client.close();
+ return content.toString();
+ }
+
+ /**
+ * XML解析返回Map
+ * */
+ public static Map<String, Object> getXMLValue(String xml, String charset) {
+ if (null == xml) return null;
+ if (null == charset) charset = "UTF-8"; //默认 UTF-8
+ try {
+ byte[] data = xml.getBytes(charset);
+ ByteArrayInputStream bin = new ByteArrayInputStream(data);
+ SAXReader reader = new SAXReader();
+ Document document = reader.read(bin);
+ Element root = document.getRootElement();
+ List<Element> elementList = root.elements();
+ Map<String, Object> map = new HashMap<>(0);
+ for (Element e : elementList) {
+ map.put(e.getName(), getElementValue(e));
+ }
+ return map;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private static Object getElementValue(Element root) {
+ if (null == root) return null;
+ if (root.elements().size() > 0) {
+ List<Element> elementList = root.elements();
+ Map<String, Object> map = new HashMap<>(0);
+ for (Element e : elementList) {
+ map.put(e.getName(), getElementValue(e));
+ }
+ return map;
+ } else {
+ return root.getText();
+ }
+ }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/controller/framework_controller.kt b/src/main/kotlin/com/supwisdom/dlpay/framework/controller/framework_controller.kt
index c8d359f..3d2e5d2 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/framework/controller/framework_controller.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/controller/framework_controller.kt
@@ -9,12 +9,12 @@
@RestController
-@RequestMapping("/common")
+@RequestMapping("/api/common")
class AboutController {
@GetMapping("/version")
fun version(): ResponseEntity<Any> {
return try {
- Manifests.read("Water-Version").let {
+ Manifests.read("Payapi-Version").let {
ResponseEntity.ok(ResponseBodyBuilder.create()
.data("version", it)
.success())
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/controller/security_controller.kt b/src/main/kotlin/com/supwisdom/dlpay/framework/controller/security_controller.kt
index e4644a1..b1bb17c 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/framework/controller/security_controller.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/controller/security_controller.kt
@@ -1,5 +1,6 @@
package com.supwisdom.dlpay.framework.controller
+import com.google.code.kaptcha.Producer
import com.supwisdom.dlpay.framework.ResponseBodyBuilder
import com.supwisdom.dlpay.framework.core.JwtConfig
import com.supwisdom.dlpay.framework.core.JwtTokenUtil
@@ -13,9 +14,7 @@
import com.supwisdom.dlpay.framework.security.validate.VerifyCode
import com.supwisdom.dlpay.framework.service.CommonService
import com.supwisdom.dlpay.framework.service.SystemUtilService
-import com.supwisdom.dlpay.framework.util.DateUtil
-import com.supwisdom.dlpay.framework.util.HmacUtil
-import com.supwisdom.dlpay.framework.util.TradeDict
+import com.supwisdom.dlpay.framework.util.*
import com.supwisdom.dlpay.system.service.FunctionService
import mu.KotlinLogging
import org.springframework.beans.factory.annotation.Autowired
@@ -28,11 +27,11 @@
import org.springframework.social.connect.web.HttpSessionSessionStrategy
import org.springframework.stereotype.Controller
import org.springframework.ui.Model
-import org.springframework.web.bind.annotation.GetMapping
-import org.springframework.web.bind.annotation.PathVariable
-import org.springframework.web.bind.annotation.RequestMapping
-import org.springframework.web.bind.annotation.RestController
+import org.springframework.web.bind.annotation.*
import org.springframework.web.context.request.ServletWebRequest
+import java.io.IOException
+import java.lang.Exception
+import java.security.Principal
import java.util.*
import javax.imageio.ImageIO
import javax.servlet.http.HttpServletRequest
@@ -57,34 +56,6 @@
@Autowired
lateinit var jwtConfig: JwtConfig
- @GetMapping(value = ["/gettoken", "/gettoken/{clientid}"])
- fun loginInit(appid: String, @PathVariable clientid: String?): ResponseEntity<Any> {
- apiClientDao.findById(appid).run {
- if (!isPresent) {
- return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build()
- }
- if (get().status != "normal") {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(1, "API状态错误"))
- }
- get()
- }.let {
- val token = generateRandomToken()
- val now = systemUtil.sysdatetime.hostdatetime
- ApiClientRedis().apply {
- id = if (clientid == null) appid else "$appid-$clientid"
- loginTimestamp = now
- roles = it.roles
- this.token = HmacUtil.HMACSHA256(token, it.secret)
- }.also {
- apiClientRepository.save(it)
- }
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("token", token)
- .data("timestamp", now)
- .success())
- }
- }
private fun generateRandomToken(): String {
val random = ByteArray(12) { 0x00 }
@@ -96,35 +67,6 @@
return (api.token == secret)
}
- @GetMapping(value = ["/authentication", "/authentication/{clientid}"])
- fun login(appid: String, secret: String, @PathVariable clientid: String?): ResponseEntity<Any> {
- val requestId = if (clientid == null) appid else "$appid-$clientid"
- return apiClientRepository.findById(requestId).let {
- if (it.isPresent && checkSecretToken(it.get(), secret)) {
- apiClientRepository.deleteById(requestId)
- val token = JwtTokenUtil(jwtConfig).generateToken(
- mapOf("uid" to appid, "issuer" to "payapi",
- "audience" to (clientid ?: appid),
- "authorities" to it.get().roles.split(";")))
- JwtRedis().apply {
- jti = token.jti
- uid = appid
- status = TradeDict.JWT_STATUS_NORMAL
- expiration = token.expiration.valueInMillis
- }.apply {
- apiJwtRepository.save(this)
- }
-
- ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("jwt", token.jwtToken)
- .data("appid", appid)
- .data("expiredAt", DateUtil.getUTCTime(token.expiration.valueInMillis))
- .success())
- } else {
- ResponseEntity.status(HttpStatus.UNAUTHORIZED).build()
- }
- }
- }
@GetMapping("/refresh")
fun refresh(request: HttpServletRequest): ResponseEntity<Any> {
@@ -138,9 +80,10 @@
if (it.isPresent && it.get().status == TradeDict.STATUS_NORMAL) {
// 新证书
val token = JwtTokenUtil(jwtConfig).generateToken(
- mapOf("uid" to appid, "issuer" to "payapi",
+ mapOf(Constants.JWT_CLAIM_UID to appid,
+ "issuer" to "payapi",
"audience" to jwt["audience"],
- "authorities" to it.get().roles.split(";")))
+ Constants.JWT_CLAIM_AUTHORITIES to it.get().roles.split(";")))
JwtRedis().apply {
jti = token.jti
uid = appid
@@ -165,11 +108,40 @@
@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()
+ }
+ }
+}
+
+@RestController
+class UserInforController {
+
+ @RequestMapping("/api/userinfor")
+ fun user(user: Principal): Principal {
+ System.out.println(user)
+ return user
}
}
@@ -186,6 +158,23 @@
@GetMapping("/login")
fun loginView() = "login"
+ @RequestMapping("/third/logout")
+ fun oauthLogout(request: HttpServletRequest, response: HttpServletResponse) {
+ val back = request.getParameter("redirect_uri")
+ SecurityContextLogoutHandler().logout(request, null, null);
+ try {
+ SecurityContextHolder.getContext().authentication = null
+ if (back != null) {
+ response.sendRedirect(back)
+ } else {
+ logger.debug { request.getHeader("referer") }
+ response.sendRedirect(request.getHeader("referer"))
+ }
+ } catch (e: IOException) {
+ e.printStackTrace()
+ }
+ }
+
@GetMapping("/logout")
fun logout(request: HttpServletRequest, response: HttpServletResponse): String {
SecurityContextHolder.getContext().authentication?.also {
@@ -200,9 +189,10 @@
model.addAttribute("loginOper", operUser as TOperator)
val funclist = functionService.getFunctionsByOperid(operUser.operid)
model.addAttribute("menus", functionService.getMenuTree(funclist, -1))
- model.addAttribute("waterVersion", commonService.getSystemVersion())
+ model.addAttribute("payapiVersion", commonService.getSystemVersion())
return "index"
}
+
}
@Controller
@@ -212,7 +202,7 @@
* 控制台
*/
@GetMapping("/console")
- fun console() :String{
+ fun console(): String {
return "home/console"
}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/framework_util.kt b/src/main/kotlin/com/supwisdom/dlpay/framework/framework_util.kt
index b35904b..8379ea6 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/framework/framework_util.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/framework_util.kt
@@ -80,7 +80,7 @@
if (retCode == INVALIDE_RETCODE) {
throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR, "未设置返回码!")
} else if (retCode != 0) {
- LOGGER.error("【 ==== ERROR ==== 】: " + Gson().toJson(this.respData))
+ LOGGER.error(" ==== ERROR ==== 【retcode=[$retCode],retmsg=[$retMsg]】: data=" + Gson().toJson(this.respData))
} else {
LOGGER.info("retcode=[0],retmsg=[$retMsg] return success!!! \n" + Gson().toJson(this.respData))
}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/framework_service_impl.kt b/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/framework_service_impl.kt
index 7cfa16f..d5a13dd 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/framework_service_impl.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/service/impl/framework_service_impl.kt
@@ -30,7 +30,7 @@
override fun getSystemVersion(): String {
return try {
- Manifests.read("Water-Version") ?: "Unknown"
+ Manifests.read("Payapi-Version") ?: "version 1.0"
} catch (ex: Exception) {
// ex.printStackTrace()
"unknown"
diff --git a/src/main/kotlin/com/supwisdom/dlpay/framework/tenant.kt b/src/main/kotlin/com/supwisdom/dlpay/framework/tenant.kt
new file mode 100644
index 0000000..dc8bbe7
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/framework/tenant.kt
@@ -0,0 +1,42 @@
+package com.supwisdom.dlpay.framework
+
+import com.supwisdom.dlpay.framework.tenant.TenantInterceptor
+import mu.KotlinLogging
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.annotation.Configuration
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
+import javax.annotation.PostConstruct
+
+
+//@Order(1)
+//@WebFilter(filterName = "multi_tenant_filter", urlPatterns = ["/*"])
+//class TenantNameFilter : Filter {
+// override fun doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain) {
+// if (request is HttpServletRequest) {
+// request.getHeader(Constants.HEADER_TETANTID)?.also {
+// // set tanent datasource
+// TenantContext.setTenantSchema(it)
+// } ?: TenantContext.setTenantSchema("default")
+// }
+// chain.doFilter(request, response)
+// }
+//}
+
+@Configuration
+class MultiTenantDatasourceConfiguration : WebMvcConfigurer {
+
+ private val logger = KotlinLogging.logger { }
+ @Autowired
+ private lateinit var tenantInterceptor: TenantInterceptor
+
+ @PostConstruct
+ fun post() {
+ logger.info("MultiTenantDatasourceConfiguration post constructor.")
+ }
+
+ override fun addInterceptors(registry: InterceptorRegistry) {
+ logger.info("adding interceptor(s).")
+ registry.addInterceptor(tenantInterceptor)
+ }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/security.kt b/src/main/kotlin/com/supwisdom/dlpay/security.kt
index d6a30ea..87963fe 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/security.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/security.kt
@@ -4,11 +4,9 @@
import com.supwisdom.dlpay.framework.core.JwtTokenUtil
import com.supwisdom.dlpay.framework.core.PasswordBCryptConfig
import com.supwisdom.dlpay.framework.redisrepo.ApiJwtRepository
-import com.supwisdom.dlpay.framework.security.MyPermissionEvaluator
import com.supwisdom.dlpay.framework.security.ValidateCodeSecurityConfig
import com.supwisdom.dlpay.framework.service.OperatorDetailService
import com.supwisdom.dlpay.framework.util.TradeDict
-import com.supwisdom.dlpay.system.common.DictPool
import org.jose4j.jwt.consumer.InvalidJwtException
import org.jose4j.lang.JoseException
import org.springframework.beans.factory.annotation.Autowired
@@ -122,7 +120,7 @@
// UsernamePasswordAuthenticationFilter::class.java)
.antMatcher("/api/**")
.authorizeRequests()
- .antMatchers("/api/**").permitAll()
+ .antMatchers("/api/device/**").permitAll()
.antMatchers("/api/auth/**").permitAll()
.antMatchers("/api/notify/**").permitAll()
.antMatchers("/api/common/**").hasAnyRole("THIRD_COMMON", "THIRD_ADMIN")
@@ -152,8 +150,6 @@
lateinit var authenticationSuccessHandler: AuthenticationSuccessHandler
@Autowired
lateinit var passwordBCryptConfig: PasswordBCryptConfig
- @Autowired
- lateinit var dictPool: DictPool
@Autowired
lateinit var userDetailsService: OperatorDetailService
@@ -188,7 +184,6 @@
}
override fun configure(http: HttpSecurity) {
- dictPool.init() //初始化字典
// 设置 Web MVC 应用权限
http.apply(validateCodeSecurityConfig)
diff --git a/src/main/kotlin/com/supwisdom/dlpay/water/controller/api_controller.kt b/src/main/kotlin/com/supwisdom/dlpay/water/controller/api_controller.kt
index 21ff75a..49a8b82 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/water/controller/api_controller.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/water/controller/api_controller.kt
@@ -18,7 +18,7 @@
@RestController
-@RequestMapping("/api")
+@RequestMapping("/api/device")
class WaterApiController {
@Autowired
diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html
index 4201180..a1607f8 100644
--- a/src/main/resources/templates/login.html
+++ b/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" id="imageCode">
</div>
<div class="layui-col-xs5" style="padding-left: 10px;">