功能新增bug
authorXia Kaixiang <kaixiang.xia@supwisdom.com>
Fri, 12 Jul 2019 09:28:30 +0000 (17:28 +0800)
committerXia Kaixiang <kaixiang.xia@supwisdom.com>
Fri, 12 Jul 2019 09:29:23 +0000 (17:29 +0800)
12 files changed:
payapi/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeConfigDao.java
payapi/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java
payapi/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TResource.java
payapi/src/main/java/com/supwisdom/dlpay/system/controller/FunctionController.java
payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/charge_api_service_impl.kt
payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/consume_pay_service_impl.kt
payapi/src/main/resources/templates/system/report/shopbusiness.html
payapi/src/main/resources/templates/system/report/subjectday.html
payapi/src/main/resources/templates/system/report/subjectdetail.html

index 9caf30d..fe9cf03 100644 (file)
@@ -14,7 +14,7 @@ public interface SourceTypeConfigDao extends JpaRepository<TSourceTypeConfig, St
 
   List<TSourceTypeConfig> getBySourceType(String sourceType);
 
-  TSourceTypeConfig getBySourceTypeAndAndConfigid(String sourceType, String configid);
+  TSourceTypeConfig getBySourceTypeAndConfigid(String sourceType, String configid);
 
   List<TSourceTypeConfig> getBySourceTypeOrderByConfigid(String paytype);
 }
index 86a9841..d5a00d7 100644 (file)
@@ -18,4 +18,22 @@ public interface SourceTypeService {
   @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
   Map<String, String> getPaytypeConfigByPaytype(String pattype);
 
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  boolean checkRechargeSourcetype(String sourcetype) throws Exception;
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  boolean checkShopPaytype(String shopaccno, String sourceType, boolean anonymousflag) throws Exception;
+
+  /**
+   * 获取支付能力充值参数全局配置
+   */
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  Map<String, String> getChargePaytypeConfig(String paytype, boolean ignoreStatus) throws Exception;
+
+  /**
+   * 获取商户支付能力消费参数配置
+   */
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  Map<String, String> getConsumePaytypeConfig(String paytype, String shopaccno, boolean anonymousflag, boolean ignoreStatus) throws Exception;
+
 }
index c2c7f21..b6ed3f1 100644 (file)
@@ -1,10 +1,18 @@
 package com.supwisdom.dlpay.api.service.impl;
 
+import com.supwisdom.dlpay.api.dao.ShopSourceTypeConfigDao;
+import com.supwisdom.dlpay.api.dao.ShopSourceTypeDao;
 import com.supwisdom.dlpay.api.dao.SourceTypeConfigDao;
 import com.supwisdom.dlpay.api.dao.SourceTypeDao;
+import com.supwisdom.dlpay.api.domain.TShopSourceType;
+import com.supwisdom.dlpay.api.domain.TShopSourceTypeConfig;
 import com.supwisdom.dlpay.api.domain.TSourceType;
 import com.supwisdom.dlpay.api.domain.TSourceTypeConfig;
 import com.supwisdom.dlpay.api.service.SourceTypeService;
+import com.supwisdom.dlpay.exception.TransactionProcessException;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.framework.util.TradeErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
@@ -19,12 +27,18 @@ import java.util.Map;
 public class SourceTypeServiceImpl implements SourceTypeService {
   private final SourceTypeDao paytypeDao;
   private final SourceTypeConfigDao paytypeConfigDao;
+  private final ShopSourceTypeDao shopSourceTypeDao;
+  private final ShopSourceTypeConfigDao shopSourceTypeConfigDao;
 
-  public SourceTypeServiceImpl(SourceTypeDao paytypeDao, SourceTypeConfigDao paytypeConfigDao) {
+  @Autowired
+  public SourceTypeServiceImpl(SourceTypeDao paytypeDao, SourceTypeConfigDao paytypeConfigDao, ShopSourceTypeDao shopSourceTypeDao, ShopSourceTypeConfigDao shopSourceTypeConfigDao) {
     this.paytypeDao = paytypeDao;
     this.paytypeConfigDao = paytypeConfigDao;
+    this.shopSourceTypeDao = shopSourceTypeDao;
+    this.shopSourceTypeConfigDao = shopSourceTypeConfigDao;
   }
 
+
   @Override
   @Cacheable(cacheNames = "source_type_cache", keyGenerator = "tenantCacheKey")
   public TSourceType getByPaytype(String paytype) {
@@ -41,4 +55,114 @@ public class SourceTypeServiceImpl implements SourceTypeService {
     }
     return map;
   }
+
+  @Override
+  public boolean checkRechargeSourcetype(String sourcetype) throws Exception {
+    TSourceType tSourceType = paytypeDao.getBySourceType(sourcetype);
+    if (null == tSourceType) {
+      throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]");
+    } else if (!tSourceType.getEnable() || !tSourceType.getChargeEnable()) {
+      throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统充值未启用支付方式[" + sourcetype + "]");
+    }
+    return true;
+  }
+
+  @Override
+  public boolean checkShopPaytype(String shopaccno, String sourceType, boolean anonymousflag) throws Exception {
+    //step1: 判断系统支付能力是否启用
+    TSourceType tSourceType = paytypeDao.getBySourceType(sourceType);
+    if (null == tSourceType) {
+      throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourceType + "]");
+    } else {
+      if (!tSourceType.getEnable() || !tSourceType.getConsumeEnable()) {
+        throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[" + sourceType + "]消费");
+      }
+      if (anonymousflag && !tSourceType.getAnonymousEnable()) {
+        throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[" + sourceType + "]未启用匿名消费");
+      }
+    }
+
+    //step2: 判断商户支付能力是否启用
+    TShopSourceType tShopSourceType = shopSourceTypeDao.getById(sourceType, shopaccno);
+    if (null == tShopSourceType) {
+      throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + sourceType + "]");
+    } else {
+      if (!tShopSourceType.getConsumeEnable()) {
+        throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + sourceType + "]消费");
+      }
+      if (anonymousflag && !tShopSourceType.getAnonymousEnable()) {
+        throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]的支付方式[" + sourceType + "]未启用匿名消费");
+      }
+    }
+
+    return true;
+  }
+
+  @Override
+  public Map<String, String> getChargePaytypeConfig(String paytype, boolean ignoreStatus) throws Exception {
+    TSourceType tSourceType = paytypeDao.getBySourceType(paytype);
+    if (null == tSourceType) {
+      throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + paytype + "]");
+    } else if (!ignoreStatus && (!tSourceType.getEnable() || !tSourceType.getChargeEnable())) {
+      throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统充值未启用支付方式[" + paytype + "]");
+    }
+
+    Map<String, String> result = new HashMap<>(0);
+    List<TSourceTypeConfig> list = paytypeConfigDao.getBySourceType(paytype);
+    if (!StringUtil.isEmpty(list)) {
+      for (TSourceTypeConfig config : list) {
+        result.put(config.getConfigid(), config.getConfigValue());
+      }
+    }
+    return result;
+  }
+
+  @Override
+  public Map<String, String> getConsumePaytypeConfig(String paytype, String shopaccno, boolean anonymousflag, boolean ignoreStatus) throws Exception {
+    //step1: 判断系统支付能力是否启用
+    TSourceType tSourceType = paytypeDao.getBySourceType(paytype);
+    if (null == tSourceType) {
+      throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + paytype + "]");
+    } else {
+      if (!ignoreStatus && (!tSourceType.getEnable() || !tSourceType.getConsumeEnable())) {
+        throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[" + paytype + "]消费");
+      }
+      if (!ignoreStatus && anonymousflag && !tSourceType.getAnonymousEnable()) {
+        throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[" + paytype + "]未启用匿名消费");
+      }
+    }
+
+    //step2: 判断商户支付能力是否启用
+    TShopSourceType tShopSourceType = shopSourceTypeDao.getById(paytype, shopaccno);
+    if (null == tShopSourceType) {
+      throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + paytype + "]");
+    } else {
+      if (!ignoreStatus && !tShopSourceType.getConsumeEnable()) {
+        throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + paytype + "]消费");
+      }
+      if (!ignoreStatus && anonymousflag && !tShopSourceType.getAnonymousEnable()) {
+        throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]的支付方式[" + paytype + "]未启用匿名消费");
+      }
+    }
+
+    Map<String, String> result = new HashMap<>(0);
+    List<TSourceTypeConfig> list = paytypeConfigDao.getBySourceType(paytype);
+    if (!StringUtil.isEmpty(list)) {
+      for (TSourceTypeConfig config : list) {
+        if (config.getGlobalflag()) {
+          result.put(config.getConfigid(), config.getConfigValue()); //统用参数
+        }
+      }
+    }
+
+    List<TShopSourceTypeConfig> shoplist = shopSourceTypeConfigDao.getShopSourceTypeConfigs(paytype, shopaccno);
+    if (!StringUtil.isEmpty(shoplist)) {
+      for (TShopSourceTypeConfig shopconfig : shoplist) {
+        result.put(shopconfig.getConfigid(), shopconfig.getConfigValue()); //个性参数
+      }
+    }
+
+    return result;
+  }
+
 }
index 9658a21..13be663 100644 (file)
@@ -5,7 +5,7 @@ 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 = 1000)
 public class TResource {
   @Id
   @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_RES")
@@ -13,7 +13,6 @@ public class TResource {
   private Integer id;
 
   @Column(name = "CODE", length = 32)
-  @NotNull
   private String code;
 
   @Column(name = "NAME", length = 32)
index 05d5977..c2dc9d1 100644 (file)
@@ -123,6 +123,9 @@ public class FunctionController {
   @ResponseBody
   public JsonResult addres(@RequestBody TResource resource) {
     if (resource != null) {
+      if(null == resource.getTenantId()){
+        resource.setTenantId(TenantContext.getTenantSchema());
+      }
       return functionService.saveRes(resource);
     } else {
       return JsonResult.error("添加失败");
index d933a65..7336a7d 100644 (file)
@@ -216,7 +216,7 @@ public class ParamServiceImpl implements ParamService {
     if (null == tPaytype) throw new WebCheckException("支付能力[" + paytype + "]不存在");
     for (String key : param.keySet()) {
       String value = param.get(key);
-      TSourceTypeConfig config = paytypeConfigDao.getBySourceTypeAndAndConfigid(tPaytype.getSourceType(), key);
+      TSourceTypeConfig config = paytypeConfigDao.getBySourceTypeAndConfigid(tPaytype.getSourceType(), key);
       if (null == config)
         throw new WebCheckException("支付能力[" + tPaytype.getSourceType() + "]不存在配置项[" + key + "],请重新查询");
       config.setConfigValue(StringUtil.isEmpty(value) ? null : value.trim());
index 1993949..24beb2b 100644 (file)
@@ -259,7 +259,7 @@ public class ShopDataServiceImpl implements ShopDataService {
         spc.setSourceType(shopPaytype.getSourceType());
         spc.setConfigid(key);
         spc.setConfigValue(StringUtil.isEmpty(value) ? null : value.trim());
-        TSourceTypeConfig paytypeConfig = sourceTypeConfigDao.getBySourceTypeAndAndConfigid(shopPaytype.getSourceType(), key);
+        TSourceTypeConfig paytypeConfig = sourceTypeConfigDao.getBySourceTypeAndConfigid(shopPaytype.getSourceType(), key);
         if (null != paytypeConfig) {
           spc.setConfigName(paytypeConfig.getConfigName());
         }
index 3122da3..d76880f 100644 (file)
@@ -1,38 +1,26 @@
 package com.supwisdom.dlpay.api.service.impl
 
 import com.supwisdom.dlpay.api.dao.PersondtlDao
-import com.supwisdom.dlpay.api.dao.SourceTypeDao
 import com.supwisdom.dlpay.api.dao.TransactionMainDao
 import com.supwisdom.dlpay.api.domain.TPersondtl
 import com.supwisdom.dlpay.api.domain.TTransactionMain
 import com.supwisdom.dlpay.api.service.ChargeApiService
-import com.supwisdom.dlpay.exception.TransactionProcessException
+import com.supwisdom.dlpay.api.service.SourceTypeService
 import com.supwisdom.dlpay.framework.util.StringUtil
-import com.supwisdom.dlpay.framework.util.TradeErrorCode
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Service
 
 @Service
 class ChargeApiServiceImpl : ChargeApiService {
     @Autowired
-    lateinit var sourceTypeDao: SourceTypeDao
+    lateinit var sourceTypeService: SourceTypeService
     @Autowired
     lateinit var transactionMainDao: TransactionMainDao
     @Autowired
     lateinit var persondtlDao: PersondtlDao
 
     override fun checkRechargeSourcetype(sourceType: String): Boolean {
-        sourceTypeDao.getBySourceType(sourceType).let {
-            if (null == it) {
-                throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[$sourceType]")
-            } else {
-                if (!it.enable || !it.chargeEnable) {
-                    throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统充值未启用支付方式[$sourceType]")
-                }
-            }
-        }
-
-        return true
+        return sourceTypeService.checkRechargeSourcetype(sourceType)
     }
 
     override fun getTransactionMainDtl(refno: String?, billno: String?, outid: String?): TTransactionMain? {
index fe0df77..e0fd9ab 100644 (file)
@@ -1,98 +1,27 @@
 package com.supwisdom.dlpay.api.service.impl
 
-import com.supwisdom.dlpay.api.dao.SourceTypeDao
-import com.supwisdom.dlpay.api.dao.ShopSourceTypeConfigDao
-import com.supwisdom.dlpay.api.dao.ShopSourceTypeDao
 import com.supwisdom.dlpay.api.dao.TransactionMainDao
 import com.supwisdom.dlpay.api.domain.TTransactionMain
 import com.supwisdom.dlpay.api.service.ConsumePayService
-import com.supwisdom.dlpay.exception.TransactionProcessException
+import com.supwisdom.dlpay.api.service.SourceTypeService
 import com.supwisdom.dlpay.framework.util.StringUtil
-import com.supwisdom.dlpay.framework.util.TradeErrorCode
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Service
 
 @Service
 class ConsumePayServiceImpl : ConsumePayService {
     @Autowired
-    lateinit var sourceTypeDao: SourceTypeDao
-    @Autowired
-    lateinit var shopSourceTypeDao: ShopSourceTypeDao
-    @Autowired
-    lateinit var shopSourceTypeConfigDao: ShopSourceTypeConfigDao
+    lateinit var sourceTypeService: SourceTypeService
     @Autowired
     lateinit var transactionMainDao: TransactionMainDao
 
     override fun checkShopPaytype(shopaccno: String, sourceType: String, anonymousflag: Boolean?): Boolean {
-        sourceTypeDao.getBySourceType(sourceType).let {
-            if (null == it) {
-                throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[$sourceType]")
-            } else {
-                if (!it.enable || !it.consumeEnable) {
-                    throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[$sourceType]消费")
-                }
-                if (true == anonymousflag && !it.anonymousEnable) {
-                    throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[$sourceType]未启用匿名消费")
-                }
-            }
-        }
-        shopSourceTypeDao.getById(sourceType, shopaccno).let {
-            if (null == it) {
-                throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$sourceType]")
-            } else {
-                if (!it.consumeEnable) {
-                    throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$sourceType]")
-                }
-                if (true == anonymousflag && !it.anonymousEnable) {
-                    throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$sourceType]未启用匿名消费")
-                }
-            }
-        }
-        return true
+        return sourceTypeService.checkShopPaytype(shopaccno, sourceType, true == anonymousflag)
     }
 
     override fun getPaytypeConfig(paytype: String, shopaccno: String,
                                   anonymousflag: Boolean?, ignoreStatus: Boolean?): Map<String, String?> {
-        sourceTypeDao.getBySourceType(paytype).let {
-            if (null == it) {
-                throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[$paytype]")
-            } else {
-                //对账取配置时不关心状态,不能报错
-                if (true != ignoreStatus && (!it.enable || !it.consumeEnable)) {
-                    throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[$paytype]消费")
-                }
-                if (true != ignoreStatus && true == anonymousflag && !it.anonymousEnable) {
-                    throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[$paytype]未启用匿名消费")
-                }
-            }
-        }
-
-        shopSourceTypeDao.getById(paytype, shopaccno).let {
-            if (null == it) {
-                throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$paytype]")
-            } else {
-                //对账取配置时不关心状态,不能报错
-                if (true != ignoreStatus && !it.consumeEnable) {
-                    throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$paytype]")
-                }
-                if (true != ignoreStatus && true == anonymousflag && !it.anonymousEnable) {
-                    throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$paytype]未启用匿名消费")
-                }
-            }
-        }
-
-        shopSourceTypeConfigDao.getShopSourceTypeConfigs(paytype, shopaccno)?.let {
-            if (it.size < 1) {
-                throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$paytype]未配置参数")
-            } else {
-                val result = mutableMapOf<String, String?>()
-                it.forEach { paytypeConfig ->
-                    result.plus(mapOf(paytypeConfig.configid to paytypeConfig.configValue))
-                }
-                return result
-            }
-        }
-                ?: throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$paytype]未配置参数")
+        return sourceTypeService.getConsumePaytypeConfig(paytype, shopaccno, true == anonymousflag, true == ignoreStatus)
     }
 
     override fun getTransactionMainDtl(refno: String?, billno: String?, shopaccno: String?): TTransactionMain? {
index c1c042e..9638612 100644 (file)
         form.render("checkbox");
         laydate.render({
             elem: '#shopbusiness-search-startdate',
-            max: $("#shopbusiness-hidden-maxdate").val()
+            max: $("#shopbusiness-hidden-maxdate").val(),
+            trigger: 'click'
         });
         laydate.render({
             elem: '#shopbusiness-search-enddate',
-            max: $("#shopbusiness-hidden-maxdate").val()
+            max: $("#shopbusiness-hidden-maxdate").val(),
+            trigger: 'click'
         });
 
         treeSelect.render({
index bcff987..6804f2c 100644 (file)
         form.render("checkbox");
         laydate.render({
             elem: '#subjectday-search-startdate',
-            max: $("#subjectday-hidden-maxdate").val()
+            max: $("#subjectday-hidden-maxdate").val(),
+            trigger: 'click'
         });
         laydate.render({
             elem: '#subjectday-search-enddate',
-            max: $("#subjectday-hidden-maxdate").val()
+            max: $("#subjectday-hidden-maxdate").val(),
+            trigger: 'click'
         });
 
         var renderTable = function (obj) {
index b8956f2..f1b65e9 100644 (file)
         form.render("select");
         laydate.render({
             elem: '#subjectdetail-search-startdate',
-            max: $("#subjectdetail-hidden-maxdate").val()
+            max: $("#subjectdetail-hidden-maxdate").val(),
+            trigger: 'click'
         });
         laydate.render({
             elem: '#subjectdetail-search-enddate',
-            max: $("#subjectdetail-hidden-maxdate").val()
+            max: $("#subjectdetail-hidden-maxdate").val(),
+            trigger: 'click'
         });
 
         treeSelect.render({