refactor: 规范变量命名
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
index c646730..2029372 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
@@ -25,15 +25,15 @@
*/
@Service
public class SourceTypeServiceImpl implements SourceTypeService {
- private final SourceTypeDao paytypeDao;
- private final SourceTypeConfigDao paytypeConfigDao;
+ private final SourceTypeDao sourceTypeDao;
+ private final SourceTypeConfigDao sourceTypeConfigDao;
private final ShopSourceTypeDao shopSourceTypeDao;
private final ShopSourceTypeConfigDao shopSourceTypeConfigDao;
@Autowired
- public SourceTypeServiceImpl(SourceTypeDao paytypeDao, SourceTypeConfigDao paytypeConfigDao, ShopSourceTypeDao shopSourceTypeDao, ShopSourceTypeConfigDao shopSourceTypeConfigDao) {
- this.paytypeDao = paytypeDao;
- this.paytypeConfigDao = paytypeConfigDao;
+ public SourceTypeServiceImpl(SourceTypeDao sourceTypeDao, SourceTypeConfigDao sourceTypeConfigDao, ShopSourceTypeDao shopSourceTypeDao, ShopSourceTypeConfigDao shopSourceTypeConfigDao) {
+ this.sourceTypeDao = sourceTypeDao;
+ this.sourceTypeConfigDao = sourceTypeConfigDao;
this.shopSourceTypeDao = shopSourceTypeDao;
this.shopSourceTypeConfigDao = shopSourceTypeConfigDao;
}
@@ -42,13 +42,13 @@
@Override
@Cacheable(cacheNames = "dictionary_cache", keyGenerator = "tenantCacheKey")
public TSourceType getBySourceType(String paytype) {
- return paytypeDao.getOne(paytype);
+ return sourceTypeDao.getOne(paytype);
}
@Override
@Cacheable(cacheNames = "dictionary_cache", keyGenerator = "tenantCacheKey")
public Map<String, String> getSourceTypeConfigBySourceType(String pattype) {
- List<TSourceTypeConfig> list = paytypeConfigDao.getBySourceType(pattype);
+ List<TSourceTypeConfig> list = sourceTypeConfigDao.getBySourceType(pattype);
Map<String, String> map = new HashMap<>(list.size());
for (TSourceTypeConfig paytypeConfig : list) {
map.put(paytypeConfig.getConfigid(), paytypeConfig.getConfigValue());
@@ -58,7 +58,7 @@
@Override
public boolean checkRechargeSourcetype(String sourcetype) throws Exception {
- TSourceType tSourceType = paytypeDao.getBySourceType(sourcetype);
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(sourcetype);
if (null == tSourceType) {
throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]");
} else if (!tSourceType.getEnable() || !tSourceType.getChargeEnable()) {
@@ -70,7 +70,7 @@
@Override
public boolean checkShopSourceType(String shopaccno, String sourceType, boolean anonymousflag) throws Exception {
//step1: 判断系统支付能力是否启用
- TSourceType tSourceType = paytypeDao.getBySourceType(sourceType);
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(sourceType);
if (null == tSourceType) {
throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourceType + "]");
} else {
@@ -100,7 +100,7 @@
@Override
public Map<String, String> getChargePaytypeConfig(String paytype, boolean ignoreStatus) throws Exception {
- TSourceType tSourceType = paytypeDao.getBySourceType(paytype);
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(paytype);
if (null == tSourceType) {
throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + paytype + "]");
} else if (!ignoreStatus && (!tSourceType.getEnable() || !tSourceType.getChargeEnable())) {
@@ -108,7 +108,7 @@
}
Map<String, String> result = new HashMap<>(0);
- List<TSourceTypeConfig> list = paytypeConfigDao.getBySourceType(paytype);
+ List<TSourceTypeConfig> list = sourceTypeConfigDao.getBySourceType(paytype);
if (!StringUtil.isEmpty(list)) {
for (TSourceTypeConfig config : list) {
result.put(config.getConfigid(), config.getConfigValue());
@@ -120,7 +120,7 @@
@Override
public Map<String, String> getConsumePaytypeConfig(String paytype, String shopaccno, boolean anonymousflag, boolean ignoreStatus) throws Exception {
//step1: 判断系统支付能力是否启用
- TSourceType tSourceType = paytypeDao.getBySourceType(paytype);
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(paytype);
if (null == tSourceType) {
throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + paytype + "]");
} else {
@@ -146,7 +146,7 @@
}
Map<String, String> result = new HashMap<>(0);
- List<TSourceTypeConfig> list = paytypeConfigDao.getBySourceType(paytype);
+ List<TSourceTypeConfig> list = sourceTypeConfigDao.getBySourceType(paytype);
if (!StringUtil.isEmpty(list)) {
for (TSourceTypeConfig config : list) {
if (config.getGlobalflag()) {
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
index 7496452..a28bdbf 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
@@ -34,6 +34,22 @@
}
+ private TDictionary findExistsOrNew(List<TDictionary> list, TDictionary item) {
+ for (TDictionary i : list) {
+ if (item.getDicttype().equals(i.getDicttype()) && item.getDictval().equals(i.getDictval())) {
+ i.setDicttypename(item.getDicttypename());
+ i.setDictcaption(item.getDictcaption());
+ return i;
+ }
+ }
+ TDictionary newDict = new TDictionary();
+ newDict.setDicttype(item.getDicttype());
+ newDict.setDictval(item.getDictval());
+ newDict.setDictcaption(item.getDictcaption());
+ newDict.setDicttypename(item.getDicttypename());
+ return newDict;
+ }
+
@Override
@CacheEvict(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey(#dicttype)")
public void updateDictionaryByDictType(String dicttype, List<TDictionary> list) {
@@ -42,10 +58,15 @@
throw new IllegalArgumentException("TDictionary dicttype mismatch");
}
}
+ List<TDictionary> exists = dictionaryDao.findAllByDicttype(dicttype);
+ List<TDictionary> newItems = new ArrayList<>();
dictionaryDao.deleteByDicttype(dicttype);
for (TDictionary item : list) {
- dictionaryDao.save(item);
+ newItems.add(findExistsOrNew(exists, item));
}
+ exists.removeAll(newItems);
+ dictionaryDao.deleteAll(exists);
+ dictionaryDao.saveAll(newItems);
}
@Override