修改数据字典
diff --git a/build.gradle b/build.gradle
index 8146c48..0fa1842 100644
--- a/build.gradle
+++ b/build.gradle
@@ -28,6 +28,7 @@
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
+ implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.security:spring-security-oauth2-client'
implementation 'org.springframework.security:spring-security-oauth2-jose'
implementation 'org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.1.5.RELEASE'
diff --git a/src/main/java/com/supwisdom/dlpay/AppPreparedEvent.java b/src/main/java/com/supwisdom/dlpay/AppPreparedEvent.java
index 4dead6a..0ccb0eb 100644
--- a/src/main/java/com/supwisdom/dlpay/AppPreparedEvent.java
+++ b/src/main/java/com/supwisdom/dlpay/AppPreparedEvent.java
@@ -1,21 +1,16 @@
package com.supwisdom.dlpay;
-import com.supwisdom.dlpay.system.common.DictPool;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
-import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
//@Configuration
public class AppPreparedEvent {
- private final DictPool dictPool;
- public AppPreparedEvent(@Autowired DictPool dictPool) {
- this.dictPool = dictPool;
+ public AppPreparedEvent() {
+
}
@EventListener(ApplicationReadyEvent.class)
public void setupDictPool() {
- dictPool.init(); //初始化字典
}
}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java b/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
index 41d8ea9..1748dc5 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
+++ b/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
@@ -1,17 +1,20 @@
package com.supwisdom.dlpay.api.domain;
+import com.supwisdom.dlpay.framework.domain.DictionaryTable;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
/**
* Created by shuwei on 2019/4/9.
*/
@Entity
@Table(name = "TB_SOURCETYPE")
-public class TSourceType {
+public class TSourceType implements DictionaryTable, Serializable {
@Id
@Column(name = "SOURCETYPE", nullable = false, length = 20)
private String sourceType;
@@ -118,4 +121,14 @@
public void setTenantid(String tenantid) {
this.tenantid = tenantid;
}
+
+ @Override
+ public String getDictKey() {
+ return this.sourceType;
+ }
+
+ @Override
+ public Object getDictValue() {
+ return this.paydesc;
+ }
}
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..efdd384 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/DictionaryDao.java
@@ -2,6 +2,8 @@
import com.supwisdom.dlpay.framework.domain.TDictionary;
import com.supwisdom.dlpay.framework.domain.TDictionaryPK;
+import org.springframework.cache.annotation.CacheConfig;
+import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@@ -9,5 +11,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/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/TDictionary.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
index 24fccb2..16c4a9a 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TDictionary.java
@@ -2,14 +2,15 @@
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)
@@ -25,11 +26,11 @@
@NotNull
private String tenantId;
- public Integer getDicttype() {
+ public String getDicttype() {
return dicttype;
}
- public void setDicttype(Integer dicttype) {
+ public void setDicttype(String dicttype) {
this.dicttype = dicttype;
}
@@ -56,4 +57,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/TTranscode.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java
index d63b46b..ac42871 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TTranscode.java
@@ -5,10 +5,11 @@
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
@Table(name = "TB_TRANSCODE")
-public class TTranscode {
+public class TTranscode implements DictionaryTable, Serializable {
@Id
@Column(name = "TRANSCODE", nullable = false, precision = 4)
private Integer transcode;
@@ -43,4 +44,14 @@
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
+
+ @Override
+ public String getDictKey() {
+ return String.valueOf(this.transcode);
+ }
+
+ @Override
+ public Object getDictValue() {
+ return this.transname;
+ }
}
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..af7b9e2
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
@@ -0,0 +1,12 @@
+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 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/system/common/DictPool.java b/src/main/java/com/supwisdom/dlpay/system/common/DictPool.java
deleted file mode 100644
index 2a83dd1..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/common/DictPool.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.supwisdom.dlpay.system.common;
-
-import com.supwisdom.dlpay.system.service.DictionaryDataService;
-import com.supwisdom.dlpay.util.ConstantUtil;
-import kotlin.Suppress;
-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 final HashMap<String, Object> dictmap = new HashMap<>();
-
- private DictionaryDataService dictionaryDataService;
-
- public DictPool(@Autowired DictionaryDataService dataService) {
- this.dictionaryDataService = dataService;
- }
-
- @SuppressWarnings("unchecked")
- 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..af00076 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,12 @@
package com.supwisdom.dlpay.system.controller;
import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.system.service.DictionaryDataService;
+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 +14,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
index 1bd3bd8..0b3a882 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java
@@ -2,11 +2,16 @@
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.domain.TTranscode;
+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 com.supwisdom.dlpay.system.service.ShopDataService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,10 +25,11 @@
@Controller
public class DtlController {
@Autowired
- private ShopDataService shopDataService;
- @Autowired
private DtlDataService dtlDataService;
+ @Autowired
+ private DictionaryProxy dictionaryProxy;
+
/**
* ====================================================
* 个人流水查询
@@ -31,9 +37,16 @@
*/
@GetMapping("/dtl/userdtl")
public String userdtlView(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
- model.addAttribute("transcodelist", dtlDataService.getAllTranscodes());
- model.addAttribute("dtlstatuslist", dtlDataService.getAllDtlStatus());
+// model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
+// model.addAttribute("transcodelist", dtlDataService.getAllTranscodes());
+// model.addAttribute("dtlstatuslist", dtlDataService.getAllDtlStatus());
+
+ model.addAttribute(Dictionary.TRANS_CODE,
+ dictionaryProxy.<TTranscode>getDictionaryAsList(Dictionary.TRANS_CODE));
+ model.addAttribute(Dictionary.DTL_STATUS,
+ dictionaryProxy.<TDictionary>getDictionaryAsList(Dictionary.DTL_STATUS));
+ model.addAttribute(Dictionary.PAY_TYPE,
+ dictionaryProxy.<TSourceType>getDictionaryAsList(Dictionary.SOURCE_TYPE));
return "system/dtl/userdtl";
}
@@ -60,9 +73,12 @@
*/
@GetMapping("/dtl/shopdtl")
public String shopdtlView(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
- model.addAttribute("transcodelist", dtlDataService.getAllTranscodes());
- model.addAttribute("dtlstatuslist", dtlDataService.getAllDtlStatus());
+ 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";
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java b/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
index 53af3c4..7a16f3b 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
@@ -369,7 +369,7 @@
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);
+ return paramService.getSourceTypePage(paytype, pageNo, pageSize);
} catch (Exception e) {
e.printStackTrace();
return new PageResult<>(99, "系统查询错误");
@@ -393,7 +393,7 @@
return JsonResult.error("参数传递错误");
}
try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
+ TSourceType tPaytype = paramService.getSourceType(paytype);
if (null == tPaytype) {
return JsonResult.error("支付方式不存在!");
}
@@ -419,7 +419,7 @@
tPaytype.setEnable(state); //默认切换主状态
}
- if (paramService.saveOrUpdatePaytype(tPaytype)) {
+ if (paramService.saveOrUpdateSourceType(tPaytype)) {
return JsonResult.ok(state ? "启用成功" : "关闭成功");
} else {
return JsonResult.error(!state ? "启用失败" : "关闭失败");
@@ -439,12 +439,12 @@
return JsonResult.error("参数传递错误");
}
try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
+ TSourceType tPaytype = paramService.getSourceType(paytype);
if (null == tPaytype) {
return JsonResult.error("支付方式不存在!");
}
tPaytype.setPaydesc(paydesc.trim());
- if (paramService.saveOrUpdatePaytype(tPaytype)) {
+ if (paramService.saveOrUpdateSourceType(tPaytype)) {
return JsonResult.ok("修改成功");
} else {
return JsonResult.error("修改失败");
@@ -460,11 +460,11 @@
@ResponseBody
public JsonResult deletePaytype(@RequestParam("paytype") String paytype) {
try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
+ TSourceType tPaytype = paramService.getSourceType(paytype);
if (null == tPaytype) {
return JsonResult.error("支付方式不存在!");
}
- if (paramService.deletePaytype(tPaytype)) {
+ if (paramService.deleteSourceType(tPaytype)) {
return JsonResult.ok("删除成功");
} else {
return JsonResult.error("删除失败");
@@ -485,7 +485,7 @@
@RequestParam(value = "anonymousEnable", required = false, defaultValue = "no") String anonymousEnable,
@RequestParam("paydesc") String paydesc) {
try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
+ TSourceType tPaytype = paramService.getSourceType(paytype);
if (null != tPaytype) {
return JsonResult.error("支付方式已经存在");
}
@@ -497,7 +497,7 @@
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)) {
+ if (paramService.saveOrUpdateSourceType(tPaytype)) {
return JsonResult.ok("新增成功");
} else {
return JsonResult.error("新增失败");
@@ -511,7 +511,7 @@
@GetMapping("/param/checkpaytype")
@ResponseBody
public JsonResult checkPaytype(@RequestParam("paytype") String paytype) {
- TSourceType tPaytype = paramService.getPaytype(paytype);
+ TSourceType tPaytype = paramService.getSourceType(paytype);
if (null != tPaytype) {
return JsonResult.error("支付方式已经存在");
} else {
@@ -522,7 +522,7 @@
@GetMapping("/param/load4paytypeconfig")
@PreAuthorize("hasPermission('/param/load4paytypeconfig','')")
public String load4PaytypeConfig(@RequestParam("paytype") String paytype, Model model) {
- List<TPaytypeConfig> configList = paramService.getPaytypeConfigList(paytype);
+ List<TPaytypeConfig> configList = paramService.getSourceTypeConfigList(paytype);
model.addAttribute("configlist", configList);
model.addAttribute("paytype", paytype);
return "system/param/paytypeconfig";
@@ -540,7 +540,7 @@
try {
String paytype = param.get(paytypeHtmlKey).trim();
param.remove(paytypeHtmlKey);
- if (paramService.savePaytypeConfig(paytype, param)) {
+ if (paramService.saveSourceTypeConfig(paytype, param)) {
return JsonResult.ok("配置成功");
} else {
return JsonResult.error("配置失败");
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java b/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
index 91f12f8..f7f69bb 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
@@ -7,11 +7,9 @@
import com.supwisdom.dlpay.framework.domain.TShop;
import com.supwisdom.dlpay.framework.domain.TShopacc;
import com.supwisdom.dlpay.framework.service.SystemUtilService;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.framework.util.TradeDict;
-import com.supwisdom.dlpay.framework.util.WebConstant;
+import com.supwisdom.dlpay.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.ConstantUtil;
@@ -34,6 +32,9 @@
@Autowired
private SystemUtilService systemUtilService;
+ @Autowired
+ private DictionaryProxy dictionaryProxy;
+
@GetMapping("/shop/index")
public String shopView() {
return "system/shop/index";
@@ -157,7 +158,9 @@
*/
@GetMapping("/shop/config")
public String shopConfigView(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
+// model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
+ model.addAttribute(Dictionary.PAY_TYPE,
+ dictionaryProxy.<TSourceType>getDictionaryObject(Dictionary.SOURCE_TYPE));
return "system/shop/config";
}
@@ -233,7 +236,8 @@
@GetMapping("/shop/load4addpaytype")
@PreAuthorize("hasPermission('/shop/load4addpaytype','')")
public String load4AddShopPaytype(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
+ model.addAttribute(Dictionary.PAY_TYPE,
+ dictionaryProxy.getDictionaryAsList(Dictionary.SOURCE_TYPE));
return "system/shop/configform";
}
@@ -250,7 +254,7 @@
}
try {
TShopacc shopacc = shopDataService.getShopaccByAccno(shopaccno.trim());
- TSourceType tPaytype = paramService.getPaytype(paytype.trim());
+ TSourceType tPaytype = paramService.getSourceType(paytype.trim());
if (null == shopacc) {
return JsonResult.error("商户账户不存在!");
}
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..48cc4df 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,13 @@
package com.supwisdom.dlpay.system.service;
-import java.util.HashMap;
+import com.supwisdom.dlpay.framework.domain.TDictionary;
+import com.supwisdom.dlpay.framework.domain.TTranscode;
+
+import java.util.List;
public interface DictionaryDataService {
- HashMap<String, Object> getSystemAllSourcetype();
+ List<TDictionary> getDictionaryByDictType(String dicttype);
- HashMap<String, Object> getDictionaryByDicttype(int dicttype);
-
-
+ List<TTranscode> getTransCode();
}
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..7f8d814
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
@@ -0,0 +1,56 @@
+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) {
+ if (Dictionary.SOURCE_TYPE.equals(dictType)) {
+ return (List<T>) paramService.getAllSourceType();
+ } else if (Dictionary.TRANS_CODE.equals(dictType)) {
+ return (List<T>) dictionaryDataService.getTransCode();
+ } else {
+ 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..59afc6d 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java
@@ -21,11 +21,5 @@
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/ParamService.java b/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
index 3d2b0e8..dc9d180 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
@@ -49,23 +49,25 @@
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);
+ boolean saveOrUpdateSourceType(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/ShopDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
index b2eb69b..9f5bd1a 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
@@ -29,9 +29,6 @@
boolean saveOrUpdateShop(TShop shop) throws WebCheckException;
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- List<TSourceType> getConsumePaytypes();
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
PageResult<ShopConfigBean> getShopPaytypeInfos(String shopaccno, String paytype, int pageNo, int pageSize);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
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..523bded 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,45 @@
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.dao.TranscodeDao;
import com.supwisdom.dlpay.framework.domain.TDictionary;
-import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.framework.domain.TTranscode;
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;
+ private final TranscodeDao transcodeDao;
- @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,
+ TranscodeDao transcodeDao) {
+ this.dictionaryDao = dictionaryDao;
+ this.transcodeDao = transcodeDao;
}
@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<>();
+ }
+
+
+ @Override
+ @Cacheable(cacheNames = "trans_code_cache")
+ public List<TTranscode> getTransCode() {
+ List<TTranscode> list = transcodeDao.findAll();
+ if (!list.isEmpty()) {
+ return list;
+ }
+ return new ArrayList<>();
}
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java
index 869bf31..82fbdc2 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java
@@ -4,20 +4,20 @@
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.dao.DictionaryDao;
import com.supwisdom.dlpay.framework.dao.ShopDao;
import com.supwisdom.dlpay.framework.dao.TranscodeDao;
import com.supwisdom.dlpay.framework.domain.TDictionary;
import com.supwisdom.dlpay.framework.domain.TShop;
import com.supwisdom.dlpay.framework.domain.TTranscode;
import com.supwisdom.dlpay.framework.util.DateUtil;
+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.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 com.supwisdom.dlpay.util.ConstantUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@@ -32,6 +32,7 @@
import javax.persistence.criteria.Root;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
@Service
public class DtlDataServiceImpl implements DtlDataService {
@@ -42,7 +43,7 @@
@Autowired
private TranscodeDao transcodeDao;
@Autowired
- private DictionaryDao dictionaryDao;
+ private DictionaryProxy dictionaryProxy;
@Autowired
private ShopDao shopDao;
@@ -53,32 +54,32 @@
@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.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.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.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.getEndTransdate())) {
+ predicates.add(criteriaBuilder.le(root.get("transdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndTransdate()))));
}
- if(!StringUtil.isEmpty(searchBean.getPersonname())){
+ if (!StringUtil.isEmpty(searchBean.getPersonname())) {
predicates.add(criteriaBuilder.like(root.get("userName").as(String.class), "%" + searchBean.getPersonname().trim() + "%"));
}
- if(!StringUtil.isEmpty(searchBean.getSourcetype())){
+ if (!StringUtil.isEmpty(searchBean.getSourcetype())) {
predicates.add(criteriaBuilder.equal(root.get("sourceType").as(String.class), searchBean.getSourcetype().trim()));
}
- if(!StringUtil.isEmpty(searchBean.getTradeflag())){
+ if (!StringUtil.isEmpty(searchBean.getTradeflag())) {
predicates.add(criteriaBuilder.equal(root.get("tradeflag").as(String.class), searchBean.getTradeflag().trim()));
}
- if(!StringUtil.isEmpty(searchBean.getTranscode())){
+ if (!StringUtil.isEmpty(searchBean.getTranscode())) {
predicates.add(criteriaBuilder.equal(root.get("transcode").as(String.class), searchBean.getTranscode().trim()));
}
- if(!StringUtil.isEmpty(searchBean.getStatus())){
+ 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]));
@@ -90,62 +91,45 @@
@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(new Specification<TShopdtl>() {
- @Override
- public Predicate toPredicate(Root<TShopdtl> 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.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]));
+ 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);
}
@Override
- public List<TTranscode> getAllTranscodes(){
- return transcodeDao.findAll();
- }
-
- @Override
- public List<TDictionary> getAllDtlStatus(){
- List<TDictionary> list = dictionaryDao.findAllByDicttype(ConstantUtil.DICTTYPE_NO2);
- if(!StringUtil.isEmpty(list)){
- return list;
- }
- return new ArrayList<>(0);
- }
-
- @Override
public List<TreeSelectNode> getTreeSelectShops() {
List<TShop> shoplist = shopDao.getNormalShops();
if (StringUtil.isEmpty(shoplist)) {
@@ -160,7 +144,7 @@
if (fshopid.equals(shop.getFshopid())) {
TreeSelectNode node = new TreeSelectNode();
node.setId(String.valueOf(shop.getShopid()));
- if(!StringUtil.isEmpty(shop.getShopaccno())){
+ if (!StringUtil.isEmpty(shop.getShopaccno())) {
node.setId(shop.getShopaccno()); //替换商户账号
}
node.setName(shop.getShopname());
@@ -168,9 +152,9 @@
node.setChecked(false);
node.setAccno(shop.getShopaccno());
List<TreeSelectNode> children = getShopSelectTree(shoplist, shop.getShopid());
- if(null!=children && children.size()>0){
+ if (null != children && children.size() > 0) {
node.setChildren(children);
- }else{
+ } else {
node.setChildren(null);
}
result.add(node);
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 babde31..4fe84f7 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
@@ -16,6 +16,8 @@
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 +43,7 @@
@Autowired
private ApiClientDao apiClientDao;
@Autowired
- private SourceTypeDao paytypeDao;
+ private SourceTypeDao sourceTypeDao;
@Autowired
private PaytypeConfigDao paytypeConfigDao;
@@ -150,42 +152,52 @@
}
@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) {
+ @Cacheable(cacheNames = "source_type_cache")
+ public List<TSourceType> getAllSourceType() {
+ return sourceTypeDao.findAll();
+ }
+
+ @Override
+ @Cacheable(cacheNames = "source_type_cache", key = "#paytype.sourceType")
+ public boolean saveOrUpdateSourceType(TSourceType paytype) {
if (null != paytype) {
- paytypeDao.save(paytype);
+ sourceTypeDao.save(paytype);
return true;
}
return false;
}
@Override
- public boolean deletePaytype(TSourceType paytype) {
+ @CacheEvict(cacheNames = "source_type_cache", key = "#paytype.sourceType")
+ public boolean deleteSourceType(TSourceType paytype) {
if (null != paytype) {
- paytypeDao.delete(paytype);
+ sourceTypeDao.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,8 +207,9 @@
}
@Override
- public boolean savePaytypeConfig(String paytype, Map<String, String> param) throws WebCheckException {
- TSourceType tPaytype = getPaytype(paytype);
+ @Cacheable(cacheNames = "source_type_config_cache", key = "#p0")
+ public boolean saveSourceTypeConfig(String paytype, Map<String, String> param) throws WebCheckException {
+ TSourceType tPaytype = getSourceType(paytype);
if (null == tPaytype) throw new WebCheckException("支付能力[" + paytype + "]不存在");
for (String key : param.keySet()) {
String value = param.get(key);
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
index 0594fcc..88d4deb 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
@@ -160,15 +160,6 @@
}
@Override
- public List<TSourceType> getConsumePaytypes() {
- List<TSourceType> list = paytypeDao.getConsumeSourceTypes();
- if (!StringUtil.isEmpty(list)) {
- return list;
- }
- return new ArrayList<TSourceType>(0);
- }
-
- @Override
public PageResult<ShopConfigBean> getShopPaytypeInfos(String shopaccno, String paytype, int pageNo, int pageSize) {
Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("shopaccno", "paytype"));
diff --git a/src/main/kotlin/com/supwisdom/dlpay/PayApiApplication.kt b/src/main/kotlin/com/supwisdom/dlpay/PayApiApplication.kt
index 944944f..0181d2d 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/PayApiApplication.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/PayApiApplication.kt
@@ -4,6 +4,7 @@
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
+import org.springframework.cache.annotation.EnableCaching
import org.springframework.cloud.client.discovery.EnableDiscoveryClient
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@@ -70,6 +71,7 @@
@SpringBootApplication
@EnableDiscoveryClient
@EnableScheduling
+@EnableCaching
class PayApiApplication
fun main(args: Array<String>) {
diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql
index 6b60981..5e91f80 100644
--- a/src/main/resources/data.sql
+++ b/src/main/resources/data.sql
@@ -490,21 +490,21 @@
VALUES (3500, '账户充值', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('cancel', 1, '冲正', '冲正状态', '{tenantid}');
+VALUES ('cancel', 'reverseFlagList', '冲正', '冲正状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('reverse', 1, '手工撤销', '冲正状态', '{tenantid}');
+VALUES ('reverse', 'reverseFlagList', '手工撤销', '冲正状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('none', 1, ' ', '冲正状态', '{tenantid}');
+VALUES ('none', 'reverseFlagList', '-', '冲正状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('init', 2, '初始化', '流水状态', '{tenantid}');
+VALUES ('init', 'dtlStatusList', '初始化', '流水状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('success', 2, '交易成功', '流水状态', '{tenantid}');
+VALUES ('success', 'dtlStatusList', '交易成功', '流水状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('fail', 2, '交易失败', '流水状态', '{tenantid}');
+VALUES ('fail', 'dtlStatusList', '交易失败', '流水状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('wip', 2, '待支付', '流水状态', '{tenantid}');
+VALUES ('wip', 'dtlStatusList','待支付', '流水状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('cancel', 2, '交易取消', '流水状态', '{tenantid}');
+VALUES ('cancel','dtlStatusList', '交易取消', '流水状态', '{tenantid}');
----------------------------------------------------
commit;
\ No newline at end of file
diff --git a/src/main/resources/static/libs/custom.js b/src/main/resources/static/libs/custom.js
index 24dc9ad..e91928d 100644
--- a/src/main/resources/static/libs/custom.js
+++ b/src/main/resources/static/libs/custom.js
@@ -21,7 +21,7 @@
data: "dicttype=" + dictType,
contentType: "application/x-www-form-urlencoded",
success: function (data) {
- if (data == null || data == "") {
+ if (data == null || data === "") {
that.storage.removeItem(dictType);
} else {
that.storage.setItem(dictType, JSON.stringify(data));
@@ -60,15 +60,15 @@
},
initAll: function (url) {
this.url = url;
- this.addNewDict("allSourcetypeList").addNewDict("allReverseflagList");
+ this.addNewDict("sourcetypeList").addNewDict("reverseFlagList");
},
getDict: function (dictType) {
var dict, that = this;
- if (that.pool[dictType] != undefined) {
+ if (that.pool[dictType] !== undefined) {
return that.pool[dictType];
} else {
dict = that.storage.getItem(dictType);
- if (dict == undefined) {
+ if (dict === undefined) {
return null;
} else {
that.pool[dictType] = JSON.parse(dict);
@@ -83,7 +83,7 @@
return code;
} else {
var c = "" + code;
- return dict[c] == undefined ? code : dict[c];
+ return dict[c] === undefined ? code : dict[c];
}
}
}
diff --git a/src/main/resources/templates/system/dtl/userdtl.html b/src/main/resources/templates/system/dtl/userdtl.html
index 4291d59..a2e9d96 100644
--- a/src/main/resources/templates/system/dtl/userdtl.html
+++ b/src/main/resources/templates/system/dtl/userdtl.html
@@ -12,7 +12,8 @@
<div class="layui-inline">
<label class="layui-form-label">记账日期</label>
<div class="layui-input-inline" style="width: 120px;">
- <input type="text" name="startAccdate" id="userdtl-search-startAccdate" placeholder="开始日期"
+ <input type="text" name="startAccdate" id="userdtl-search-startAccdate"
+ placeholder="开始日期"
autocomplete="off" class="layui-input"/>
</div>
<div class="layui-form-mid">-</div>
@@ -47,7 +48,7 @@
<div class="layui-input-block">
<select name="transStatus" id="userdtl-search-transStatus" class="layui-select">
<option value=""> 全部</option>
- <option th:each="st:${dtlstatuslist}" th:value="${st.dictval}"
+ <option th:each="st:${dtlStatusList}" th:value="${st.dictval}"
th:text="${st.dictcaption}"></option>
</select> 
</div>
@@ -58,12 +59,14 @@
<div class="layui-inline">
<label class="layui-form-label">交易日期</label>
<div class="layui-input-inline" style="width: 120px;">
- <input type="text" name="startTransdate" id="userdtl-search-startTransdate" placeholder="开始日期"
+ <input type="text" name="startTransdate" id="userdtl-search-startTransdate"
+ placeholder="开始日期"
autocomplete="off" class="layui-input"/>
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 120px;">
- <input type="text" name="endTransdate" id="userdtl-search-endTransdate" placeholder="结束日期"
+ <input type="text" name="endTransdate" id="userdtl-search-endTransdate"
+ placeholder="结束日期"
autocomplete="off" class="layui-input"/>
</div>
</div>
@@ -92,7 +95,7 @@
<div class="layui-input-block">
<select name="transcode" id="userdtl-search-transcode" class="layui-select">
<option value=""> 全部</option>
- <option th:each="tc:${transcodelist}" th:value="${tc.transcode}"
+ <option th:each="tc:${transcodeList}" th:value="${tc.transcode}"
th:text="${tc.transname}"></option>
</select>
</div>
@@ -181,25 +184,33 @@
{field: 'userName', title: '姓名', align: 'center', width: 150},
{field: 'amount', title: '交易金额', align: 'center', width: 120, sort: true},
{
- field: 'transStatus', title: '状态', align: 'center', width: 90, templet: function (item) {
- if (item.transStatus == 'init') {
+ field: 'status',
+ title: '状态',
+ align: 'center',
+ width: 90,
+ templet: function (item) {
+ if (item.status === 'init') {
return '<span class="layui-badge layui-bg-gray">初始化</span>';
- } else if (item.transStatus == 'success') {
+ } else if (item.status === 'success') {
return '<span class="layui-badge layui-bg-green">成功</span>';
- } else if (item.transStatus == 'fail') {
+ } else if (item.status === 'fail') {
return '<span class="layui-badge">失败</span>';
- } else if (item.transStatus == 'wip') {
+ } else if (item.status === 'wip') {
return '<span class="layui-badge layui-bg-orange">待支付</span>';
} else {
- return item.transStatus;
+ return item.status;
}
}
},
{
- field: 'tradeflag', title: '类型', align: 'center', width: 60, templet: function (item) {
- if (item.tradeflag == 'in') {
+ field: 'tradeflag',
+ title: '类型',
+ align: 'center',
+ width: 60,
+ templet: function (item) {
+ if (item.tradeflag === 'in') {
return '<span style="color: green;">收入</span>';
- } else if (item.tradeflag == 'out') {
+ } else if (item.tradeflag === 'out') {
return '<span style="color: red;">支出</span>';
} else {
return item.tradeflag;
@@ -215,12 +226,16 @@
width: 130,
sort: true,
templet: function (item) {
- return getTempDictValue('allSourcetypeList', item.sourceType);
+ return getTempDictValue('sourcetypeList', item.sourceType);
}
},
{
- field: 'reverseFlag', title: '冲正状态', align: 'center', width: 100, templet: function (item) {
- return getTempDictValue('allReverseflagList', item.reverseFlag);
+ field: 'reverseFlag',
+ title: '冲正状态',
+ align: 'center',
+ width: 100,
+ templet: function (item) {
+ return getTempDictValue('reverseFlagList', item.reverseFlag);
}
},
{field: 'oppositeAccName', title: '交易对象', align: 'center', width: 250},