为 sourcetype 增加了 paysubjno, depositesubjno
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePatternDao.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePatternDao.java
index d63e9d0..198645e 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePatternDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePatternDao.java
@@ -7,4 +7,8 @@
public interface QrcodePatternDao extends CrudRepository<QrcodePattern, Integer> {
List<QrcodePattern> findByTenantid(String tenantid);
+
+ void deleteByTenantid(String tenantid);
+
+ List<QrcodePattern> findBySourceTypeAndTenantid(String sourceType, String tenantid);
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/service/AgentServiceProxy.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/AgentServiceProxy.java
index 8f2809d..7de65cd 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/agent/service/AgentServiceProxy.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/AgentServiceProxy.java
@@ -5,6 +5,7 @@
import com.supwisdom.dlpay.agent.domain.QrcodePayTrans;
import com.supwisdom.dlpay.framework.service.SystemUtilService;
import com.supwisdom.dlpay.framework.tenant.TenantContext;
+import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -36,15 +37,19 @@
systemUtilService.getSysdatetime().getHostdate(), billno, TenantContext.getTenantSchema());
}
- public QrcodePayTrans qrcodePayTransSaveOrUpdate(QrcodePayTrans bean) {
+ public QrcodePayTrans qrcodePayTransSaveOrUpdate(@NotNull QrcodePayTrans bean) {
if (bean.getTenantid().isEmpty()) {
bean.setTenantid(TenantContext.getTenantSchema());
}
return qrcodeTransDao.save(bean);
}
+ public QrcodePattern qrcodeMatch(String code, String format) {
+ return qrcodeMatch(code);
+ }
+
public QrcodePattern qrcodeMatch(String code) {
- List<QrcodePattern> pattern = qrcodePatternService.getAllQrCodePattern();
+ List<QrcodePattern> pattern = qrcodePatternService.getAllQrcodePattern();
List<QrcodePattern> found = new ArrayList<>();
for (QrcodePattern item : pattern) {
if (Pattern.matches(item.getPattern(), code)) {
@@ -57,9 +62,7 @@
if (found.size() > 1) {
Set<String> foundST = new HashSet<>();
for (QrcodePattern item : found) {
- if (!foundST.contains(item.getSourceType())) {
- foundST.add(item.getSourceType());
- }
+ foundST.add(item.getSourceType());
}
if (foundST.size() > 1) {
throw new IllegalArgumentException("Qrcode匹配错误,找到多个sourcetype");
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/service/QrcodePatternService.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/QrcodePatternService.java
index d3a0397..2ea2c3d 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/agent/service/QrcodePatternService.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/QrcodePatternService.java
@@ -5,5 +5,11 @@
import java.util.List;
public interface QrcodePatternService {
- List<QrcodePattern> getAllQrCodePattern();
+ List<QrcodePattern> getAllQrcodePattern();
+
+ void deleteAllQrcodePattern();
+
+ QrcodePattern saveOrUpdateQrcodePattern(QrcodePattern pattern);
+
+ List<QrcodePattern> findAllBySourcetype(String sourceType);
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/service/impl/QrcodePatternServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/impl/QrcodePatternServiceImpl.java
index 2d7ad9f..4da560f 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/agent/service/impl/QrcodePatternServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/service/impl/QrcodePatternServiceImpl.java
@@ -4,7 +4,8 @@
import com.supwisdom.dlpay.agent.domain.QrcodePattern;
import com.supwisdom.dlpay.agent.service.QrcodePatternService;
import com.supwisdom.dlpay.framework.tenant.TenantContext;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
@@ -12,12 +13,36 @@
@Service
public class QrcodePatternServiceImpl implements QrcodePatternService {
- @Autowired
- private QrcodePatternDao qrcodePatternDao;
+ private final QrcodePatternDao qrcodePatternDao;
+
+ public QrcodePatternServiceImpl(QrcodePatternDao qrcodePatternDao) {
+ this.qrcodePatternDao = qrcodePatternDao;
+ }
@Override
@Cacheable(cacheNames = "qrcode_pattern_cache", key = "@tenantHolder.genKey('qrcode_pattern')")
- public List<QrcodePattern> getAllQrCodePattern() {
+ public List<QrcodePattern> getAllQrcodePattern() {
return qrcodePatternDao.findByTenantid(TenantContext.getTenantSchema());
}
+
+ @Override
+ @CacheEvict(cacheNames = "qrcode_pattern_cache", key = "@tenantHolder.genKey('qrcode_pattern') + '.*'")
+ public void deleteAllQrcodePattern() {
+ qrcodePatternDao.deleteByTenantid(TenantContext.getTenantSchema());
+ }
+
+ @Override
+ @CacheEvict(cacheNames = "qrcode_pattern_cache", key = "@tenantHolder.genKey('qrcode_pattern') + '.*'")
+ public QrcodePattern saveOrUpdateQrcodePattern(@NotNull QrcodePattern pattern) {
+ if (pattern.getTenantid() == null || pattern.getTenantid().isEmpty()) {
+ pattern.setTenantid(TenantContext.getTenantSchema());
+ }
+ return qrcodePatternDao.save(pattern);
+ }
+
+ @Override
+ @Cacheable(cacheNames = "qrcode_pattern_cache", key = "@tenantHolder.genKey('qrcode_pattern', #sourceType)")
+ public List<QrcodePattern> findAllBySourcetype(String sourceType) {
+ return qrcodePatternDao.findBySourceTypeAndTenantid(sourceType, TenantContext.getTenantSchema());
+ }
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java
index 9e0ad35..a4767f2 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java
@@ -97,6 +97,9 @@
@Column(name = "DTLTYPE", length = 20)
private String dtltype;
+ @Column(name = "anonymous")
+ private Boolean anonymous;
+
public String getDtltype() {
return dtltype;
}
@@ -288,4 +291,12 @@
public void setTenantid(String tenantid) {
this.tenantid = tenantid;
}
+
+ public Boolean getAnonymous() {
+ return anonymous;
+ }
+
+ public void setAnonymous(Boolean anonymous) {
+ this.anonymous = anonymous;
+ }
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
index 8d09f92..d20efaf 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
@@ -49,8 +49,11 @@
@NotNull
private Boolean checkable; // 是否需要清算
- @Column(name = "asset_subjno")
- private @NotNull String assetSubjno;
+ @Column(name = "pay_subjno", length = 12)
+ private @NotNull String paySubjno;
+
+ @Column(name = "deposite_subjno", length = 12)
+ private String depositeSubjno;
@Column(name = "PAYDESC", length = 200)
private String paydesc;
@@ -149,11 +152,19 @@
this.sourceTypeId = sourceTypeId;
}
- public @NotNull String getAssetSubjno() {
- return assetSubjno;
+ public @NotNull String getPaySubjno() {
+ return paySubjno;
}
- public void setAssetSubjno(@NotNull String assetSubjno) {
- this.assetSubjno = assetSubjno;
+ public void setPaySubjno(@NotNull String paySubjno) {
+ this.paySubjno = paySubjno;
+ }
+
+ public String getDepositeSubjno() {
+ return depositeSubjno;
+ }
+
+ public void setDepositeSubjno(String depositeSubjno) {
+ this.depositeSubjno = depositeSubjno;
}
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
index 303a3b0..f76cffa 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
@@ -37,6 +37,8 @@
TShopacc getByShopaccno(String shopaccno);
+ TShopacc getByShopaccnoAndTenantId(String shopaccno, String tenantid);
+
@Transactional
@Modifying(clearAutomatically = true)
@Query("update TShopacc set shopname=?1 where shopaccno=?2")
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
index f88623d..78ecb03 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
@@ -26,6 +26,8 @@
TSubject findBySubjno(String subjno);
+ TSubject findBySubjnoAndTenantId(String subjno, String tenantid);
+
@Query("from TSubject where displayflag='y' order by subjno ")
List<TSubject> findAllDisplaySubjects();
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java
index d02d05e..d76cd59 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java
@@ -2,11 +2,13 @@
import javax.persistence.*;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
@Table(name = "TB_SUBJECT",
indexes = {@Index(name = "subject_idx", columnList = "subjno, tenantid", unique = true)})
-public class TSubject {
+public class TSubject implements Serializable, DictionaryTable {
+
@Id
@Column(name = "subjid")
@NotNull
@@ -133,4 +135,14 @@
public void setId(Integer id) {
this.id = id;
}
+
+ @Override
+ public String getDictKey() {
+ return this.subjno;
+ }
+
+ @Override
+ public Object getDictValue() {
+ return this.subjname;
+ }
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
index ca18764..7eda63d 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
@@ -18,11 +18,13 @@
/**
* 获取记账日期
*/
+ @Transactional
String getAccdate();
/**
* 获取流水号
*/
+ @Transactional
String getRefno();
/**
@@ -32,6 +34,7 @@
/********************** 获取【系统参数】【业务参数】通用方法 **********************/
+ @Transactional
String getSysparaValue(int paraid);
String getSysparaValue(int paraid, String defaultValue);
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
index c7c9d89..9eac02d 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
@@ -13,4 +13,5 @@
public static final String SOURCE_TYPE = "sourcetypeList";
public static final String TRANS_CODE = "transcodeList";
public static final String PAY_TYPE = "paytypelist";
+ public static final String ALL_SUBJECT = "allSubjectList";
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
index 2bf71b3..6d46a45 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
@@ -9,10 +9,10 @@
import com.supwisdom.dlpay.framework.service.SystemUtilService;
import com.supwisdom.dlpay.framework.tenant.TenantContext;
import com.supwisdom.dlpay.framework.util.*;
+import com.supwisdom.dlpay.system.service.DictionaryProxy;
import com.supwisdom.dlpay.system.service.ParamService;
import com.supwisdom.dlpay.util.ConstantUtil;
import com.supwisdom.dlpay.util.WebCheckException;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -24,10 +24,17 @@
@Controller
public class ParamController {
- @Autowired
- private ParamService paramService;
- @Autowired
- private SystemUtilService systemUtilService;
+ private final ParamService paramService;
+ private final SystemUtilService systemUtilService;
+ private final DictionaryProxy dictionaryProxy;
+
+ public ParamController(ParamService paramService,
+ SystemUtilService systemUtilService,
+ DictionaryProxy dictionaryProxy) {
+ this.paramService = paramService;
+ this.systemUtilService = systemUtilService;
+ this.dictionaryProxy = dictionaryProxy;
+ }
@GetMapping("/param/syspara")
public String sysparaView() {
@@ -379,6 +386,8 @@
@GetMapping("/param/load4addsourcetype")
@PreAuthorize("hasPermission('/param/load4addsourcetype','')")
public String load4AddPaytype(Model model) {
+ model.addAttribute("subjectList",
+ dictionaryProxy.getDictionaryAsList(Dictionary.ALL_SUBJECT));
return "system/param/sourcetypeform";
}
@@ -495,23 +504,27 @@
@RequestParam(value = "anonymousEnable", required = false, defaultValue = "no") String anonymousEnable,
@RequestParam(value = "reversable", required = false, defaultValue = "no") String reversable,
@RequestParam(value = "checkable", required = false, defaultValue = "no") String checkable,
+ @RequestParam(value = "paySubjno", required = false, defaultValue = "-") String paySubjno,
+ @RequestParam(value = "depositeSubjno", required = false, defaultValue = "-") String depositeSubjno,
@RequestParam("paydesc") String paydesc) {
try {
- TSourceType tPaytype = paramService.getSourceType(sourcetype);
- if (null != tPaytype) {
+ TSourceType sourcetypeBean = paramService.getSourceType(sourcetype);
+ if (null != sourcetypeBean) {
return JsonResult.error("支付方式已经存在");
}
- tPaytype = new TSourceType();
- tPaytype.setSourceType(sourcetype.trim());
+ sourcetypeBean = new TSourceType();
+ sourcetypeBean.setSourceType(sourcetype.trim());
if (StringUtil.isEmpty(paydesc)) return JsonResult.error("支付名称不能为空!");
- tPaytype.setPaydesc(paydesc.trim());
- tPaytype.setEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(enable));
- tPaytype.setChargeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(chargeEnable));
- tPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable));
- tPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable));
- tPaytype.setReversable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(reversable));
- tPaytype.setCheckable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(checkable));
- if (paramService.saveOrUpdateSourceType(tPaytype)) {
+ sourcetypeBean.setPaydesc(paydesc.trim());
+ sourcetypeBean.setEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(enable));
+ sourcetypeBean.setChargeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(chargeEnable));
+ sourcetypeBean.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable));
+ sourcetypeBean.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable));
+ sourcetypeBean.setReversable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(reversable));
+ sourcetypeBean.setCheckable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(checkable));
+ sourcetypeBean.setPaySubjno(paySubjno);
+ sourcetypeBean.setDepositeSubjno(depositeSubjno);
+ if (paramService.saveOrUpdateSourceType(sourcetypeBean)) {
return JsonResult.ok("新增成功");
} else {
return JsonResult.error("新增失败");
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java
index d7d1027..b7824dd 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java
@@ -1,6 +1,7 @@
package com.supwisdom.dlpay.system.service;
import com.supwisdom.dlpay.framework.domain.TDictionary;
+import com.supwisdom.dlpay.framework.domain.TSubject;
import com.supwisdom.dlpay.framework.domain.TTranscode;
import java.util.List;
@@ -16,4 +17,5 @@
List<TTranscode> getTransCode();
+ List<TSubject> getAllSubject();
}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
index c78b89c..361ee89 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
@@ -49,6 +49,8 @@
return (List<T>) paramService.getAllSourceType();
} else if (Dictionary.TRANS_CODE.equals(dictType)) {
return (List<T>) dictionaryDataService.getTransCode();
+ } else if (Dictionary.ALL_SUBJECT.equals(dictType)) {
+ return (List<T>) dictionaryDataService.getAllSubject();
} else {
return (List<T>) dictionaryDataService.getDictionaryByDictType(dictType);
}
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 a28bdbf..be4365a 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
@@ -1,8 +1,10 @@
package com.supwisdom.dlpay.system.service.impl;
import com.supwisdom.dlpay.framework.dao.DictionaryDao;
+import com.supwisdom.dlpay.framework.dao.SubjectDao;
import com.supwisdom.dlpay.framework.dao.TranscodeDao;
import com.supwisdom.dlpay.framework.domain.TDictionary;
+import com.supwisdom.dlpay.framework.domain.TSubject;
import com.supwisdom.dlpay.framework.domain.TTranscode;
import com.supwisdom.dlpay.system.service.DictionaryDataService;
import org.springframework.cache.annotation.CacheEvict;
@@ -16,11 +18,14 @@
public class DictionaryDataServiceImpl implements DictionaryDataService {
private final DictionaryDao dictionaryDao;
private final TranscodeDao transcodeDao;
+ private final SubjectDao subjectDao;
public DictionaryDataServiceImpl(DictionaryDao dictionaryDao,
- TranscodeDao transcodeDao) {
+ TranscodeDao transcodeDao,
+ SubjectDao subjectDao) {
this.dictionaryDao = dictionaryDao;
this.transcodeDao = transcodeDao;
+ this.subjectDao = subjectDao;
}
@Override
@@ -89,4 +94,10 @@
}
return new ArrayList<>();
}
+
+ @Override
+ @Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('allsubject')")
+ public List<TSubject> getAllSubject() {
+ return subjectDao.findAllDisplaySubjects();
+ }
}
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
index 6a6a75e..9d923d2 100644
--- a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
@@ -6,8 +6,8 @@
import com.supwisdom.dlpay.agent.service.AgentServiceProxy
import com.supwisdom.dlpay.api.*
import com.supwisdom.dlpay.api.bean.*
-import com.supwisdom.dlpay.api.bean.groups.Confirm
-import com.supwisdom.dlpay.api.bean.groups.InitStep
+import com.supwisdom.dlpay.api.bean.groups.ConfirmAction
+import com.supwisdom.dlpay.api.bean.groups.InitAction
import com.supwisdom.dlpay.api.domain.TSourceType
import com.supwisdom.dlpay.api.service.*
import com.supwisdom.dlpay.exception.TransactionCheckException
@@ -445,20 +445,21 @@
}
@RequestMapping("/qrcode/init", method = [RequestMethod.POST, RequestMethod.GET])
- fun qrcodePayInit(@Validated(InitStep::class) @RequestBody param: QrcodePayParam): ResponseEntity<ApiResponse> {
+ fun qrcodePayInit(@Validated(InitAction::class) @RequestBody param: QrcodePayParam): ResponseEntity<ApiResponse> {
+ val apiResp = QrcodePayResponse()
// 1. 检查 qrcode
val qrcode = agentServiceProxy.qrcodeMatch(param.qrcode)
?: return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(QrcodePayResponse(), TradeErrorCode.BUSINESS_DEAL_ERROR, "未识别的支付码"))
+ .fail(apiResp, TradeErrorCode.BUSINESS_DEAL_ERROR, "未识别的支付码"))
val sourceType = sourceTypeService.getBySourceType(qrcode.sourceType)
?: return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(QrcodePayResponse(), TradeErrorCode.BUSINESS_DEAL_ERROR,
+ .fail(apiResp, TradeErrorCode.BUSINESS_DEAL_ERROR,
"不支持的支付方式<${qrcode.sourceType}>"))
- if (sourceType.assetSubjno.isEmpty()
- || !StringUtils.isNumeric(sourceType.assetSubjno)) {
+ if (sourceType.paySubjno.isEmpty()
+ || !StringUtils.isNumeric(sourceType.paySubjno)) {
return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(QrcodePayResponse(), TradeErrorCode.BUSINESS_DEAL_ERROR,
+ .fail(apiResp, TradeErrorCode.BUSINESS_DEAL_ERROR,
"支付方式<${qrcode.sourceType}>未配置科目号"))
}
// 2. 记录 qrcode 交易明细表
@@ -475,7 +476,7 @@
// 4. 重新读取 qrcode 交易明细表,以获取 service.auth 查询后的结果数据
val qrcodeTransResp = agentServiceProxy.qrcodePayTransFindByMerchIdAndBillno(qrcodeTrans.agentMerchId,
qrcodeTrans.billno)
- val apiResp = QrcodePayResponse().also {
+ apiResp.also {
it.sourceType = sourceType.sourceType
it.paydesc = qrcodeSummary(sourceType)
}
@@ -516,7 +517,7 @@
private fun qrcodeSummary(st: TSourceType): String = st.paydesc + "扫码付"
@PostMapping("/qrcodepay/confirm")
- fun qrcodePayConfirm(@Validated(Confirm::class) @RequestBody param: QrcodePayParam): ResponseEntity<ApiResponse> {
+ fun qrcodePayConfirm(@Validated(ConfirmAction::class) @RequestBody param: QrcodePayParam): ResponseEntity<ApiResponse> {
//1. 交易检查
val apiResponse = QrcodePayResponse()
val qrcodeTrans = agentServiceProxy.qrcodePayTransFindByMerchIdAndBillno(param.shopaccno,
@@ -550,11 +551,12 @@
//2. 初始化交易流水
// sourcetype 资产类科目
- val stSubject = accountUtilServcie.readSubject(sourceType.assetSubjno)
+ val stSubject = accountUtilServcie.readSubject(sourceType.paySubjno)
// build 交易明细
val builder = TransactionBuilder().apply {
setTransInfo(param.transdate, param.transtime, TradeCode.TRANSCODE_QRCODE, qrcodeTrans.sourceType)
setOutTransInfo(qrcodeTrans.agentMerchId, qrcodeTrans.billno)
+ payinfo = qrcodeSummary(sourceType)
}
val shopacc = accountUtilServcie.readShopbyShopaccno(qrcodeTrans.agentMerchId)
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt
index 1ab0d37..1807686 100644
--- a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt
@@ -9,9 +9,9 @@
import com.supwisdom.dlpay.framework.dao.ShopaccDao
import com.supwisdom.dlpay.framework.dao.SubjectDao
import com.supwisdom.dlpay.framework.domain.TFeetypeConfig
-import com.supwisdom.dlpay.framework.domain.TShop
import com.supwisdom.dlpay.framework.domain.TShopacc
import com.supwisdom.dlpay.framework.domain.TSubject
+import com.supwisdom.dlpay.framework.tenant.TenantContext
import com.supwisdom.dlpay.framework.util.TradeErrorCode
import org.hibernate.exception.LockTimeoutException
import org.springframework.beans.factory.annotation.Autowired
@@ -74,13 +74,13 @@
}
override fun readShopbyShopaccno(shopaccno: String): TShopacc {
- return shopaccDao.findByShopaccno(shopaccno)?.also {
+ return shopaccDao.getByShopaccnoAndTenantId(shopaccno, TenantContext.getTenantSchema())?.also {
shopAccCheck(it)
} ?: throw TransactionProcessException(TradeErrorCode.SHOP_NOT_EXISTS, "商户<$shopaccno>不存在")
}
override fun readSubject(subjno: String): TSubject {
- return subjectDao.findBySubjno(subjno)
+ return subjectDao.findBySubjnoAndTenantId(subjno, TenantContext.getTenantSchema())
?: throw TransactionProcessException(TradeErrorCode.SUBJECT_NOT_EXISTS, "科目<$subjno>不存在")
}
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt
index edb618c..2a8c984 100644
--- a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt
@@ -109,6 +109,7 @@
tenantid = transaction.tenantid
this.dtltype = builder.dtltype
this.status = status
+ this.anonymous = builder.person().isAnonymous()
}.also {
// persondtlDao.save(it)
transaction.personDtl = it
diff --git a/payapi/src/main/resources/data.sql b/payapi/src/main/resources/data.sql
index f1d7f88..ac1da71 100644
--- a/payapi/src/main/resources/data.sql
+++ b/payapi/src/main/resources/data.sql
@@ -439,23 +439,23 @@
INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
-"consume_enable", "anonymous_enable", "reversable", "asset_subjno", "tenantid")
-VALUES ('D3820D49DACA49199E36537F6719665F', 'citizenCard', 't', '大理市民卡', 't', 'f', 't', 'f', 't', '112234', '{tenantid}');
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno", "deposite_subjno", "tenantid")
+VALUES ('D3820D49DACA49199E36537F6719665F', 'citizenCard', 't', '大理市民卡', 't', 'f', 't', 'f', 't', '112234', '-', '{tenantid}');
INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
-"consume_enable", "anonymous_enable", "reversable", "asset_subjno","tenantid")
-VALUES ('0997477F40904AD1A2E37FD15345CE00', 'balance', 'f', '账户余额', 't', 'f', 't', 'f', 't', '-', '{tenantid}');
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno","deposite_subjno","tenantid")
+VALUES ('0997477F40904AD1A2E37FD15345CE00', 'balance', 'f', '账户余额', 't', 'f', 't', 'f', 't', '-', '-', '{tenantid}');
INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
-"consume_enable", "anonymous_enable", "reversable", ""asset_subjno",tenantid")
-VALUES ('F0CA47ADC0F24DFCA0D95DF4136CC2D0', 'thirdpart', 'f', '其他第三方支付', 't', 't', 'f', 'f', 'f','-', '{tenantid}');
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno","deposite_subjno", "tenantid")
+VALUES ('F0CA47ADC0F24DFCA0D95DF4136CC2D0', 'thirdpart', 'f', '其他第三方支付', 't', 't', 'f', 'f', 'f','-','-', '{tenantid}');
INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
-"consume_enable", "anonymous_enable", "reversable", "asset_subjno","tenantid")
-VALUES ('F5B344726FA24BD896E70DEE3D3F46CA', 'swyktv5', 't', '一卡通支付', 't', 't', 't', 't', 't','-', '{tenantid}');
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno","deposite_subjno","tenantid")
+VALUES ('F5B344726FA24BD896E70DEE3D3F46CA', 'swyktv5', 't', '一卡通支付', 't', 't', 't', 't', 't','-','-', '{tenantid}');
INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
-"consume_enable", "anonymous_enable", "reversable", "asset_subjno","tenantid")
-VALUES ('28EE54CD3B044CC197D6C5B0E309F8B8', 'alipay', 't', '支付宝', 't', 't', 't', 't', 'f', '112230', '{tenantid}');
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno","deposite_subjno","tenantid")
+VALUES ('28EE54CD3B044CC197D6C5B0E309F8B8', 'alipay', 't', '支付宝', 't', 't', 't', 't', 'f', '112230','112210', '{tenantid}');
INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable",
-"consume_enable", "anonymous_enable", "reversable", "asset_subjno","tenantid")
-VALUES ('DAEF88B54B684347B2B83940C38C7671', 'wechat', 't', '微信支付', 't', 't', 't', 't', 'f', '112231', '{tenantid}');
+"consume_enable", "anonymous_enable", "reversable", "pay_subjno","deposite_subjno","tenantid")
+VALUES ('DAEF88B54B684347B2B83940C38C7671', 'wechat', 't', '微信支付', 't', 't', 't', 't', 'f', '112231','112211', '{tenantid}');
-- 支付方式
INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")
diff --git a/payapi/src/main/resources/static/libs/custom.js b/payapi/src/main/resources/static/libs/custom.js
index 21e9601..12564c2 100644
--- a/payapi/src/main/resources/static/libs/custom.js
+++ b/payapi/src/main/resources/static/libs/custom.js
@@ -65,6 +65,7 @@
.addNewDict("idtypeList")
.addNewDict("sexList")
.addNewDict("accountStatusList")
+ .addNewDict("allSubjectList")
},
getDict: function (dictType) {
var dict, that = this;
diff --git a/payapi/src/main/resources/templates/system/param/sourcetype.html b/payapi/src/main/resources/templates/system/param/sourcetype.html
index 32ed15d..74087c2 100644
--- a/payapi/src/main/resources/templates/system/param/sourcetype.html
+++ b/payapi/src/main/resources/templates/system/param/sourcetype.html
@@ -9,13 +9,16 @@
<div class="layui-card-body">
<div class="layui-form toolbar">
搜索:
- <input id="search-global-sourceType" class="layui-input search-input" type="text" maxlength="40" style="width: 300px;"
+ <input id="search-global-sourceType" class="layui-input search-input" type="text" maxlength="40"
+ style="width: 300px;"
placeholder="输入支付方式查询"/>
<button id="btn-search-param" class="layui-btn icon-btn" data-type="search"><i class="layui-icon"></i>搜索
</button>
- <button id="btn-add-param" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>新 增
+ <button id="btn-add-param" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>新
+ 增
</button>
- <button id="btn-reset-param" class="layui-btn layui-btn-primary" data-type="reset"><i class="layui-icon"></i>清 空
+ <button id="btn-reset-param" class="layui-btn layui-btn-primary" data-type="reset"><i
+ class="layui-icon"></i>清 空
</button>
</div>
<table class="layui-table" id="sourcetypeTable" lay-filter="sourcetypeTable-filter"></table>
@@ -24,24 +27,29 @@
<!-- 表格状态列 -->
<script type="text/html" id="enable-tpl-state">
- <input type="checkbox" lay-filter="enable-tpl-state" value="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="enable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
{{d.enable== true?'checked':''}}/>
</script>
<script type="text/html" id="chargeenable-tpl-state">
{{# if(d.enable == true){ }}
- <input type="checkbox" lay-filter="chargeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="chargeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
{{(d.enable== true && d.chargeEnable== true)?'checked':''}}/>
{{# }else{ }}
- <input type="checkbox" lay-filter="chargeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="chargeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
{{(d.enable== true && d.chargeEnable== true)?'checked':''}} disabled/>
{{# } }}
</script>
<script type="text/html" id="consumeenable-tpl-state">
{{# if(d.enable == true){ }}
- <input type="checkbox" lay-filter="consumeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="consumeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
{{(d.enable== true && d.consumeEnable== true)?'checked':''}}/>
{{# }else{ }}
- <input type="checkbox" lay-filter="consumeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+ <input type="checkbox" lay-filter="consumeenable-tpl-state" value="{{d.sourceType}}" lay-skin="switch"
+ lay-text="启用|关闭"
{{(d.enable== true && d.consumeEnable== true)?'checked':''}} disabled/>
{{# } }}
</script>
@@ -91,8 +99,25 @@
page: true,
cols: [
[
- {field: 'sourceType', title: '支付方式', width: 200, align: 'center', fixed: 'left', sort: true},
- {field: 'paydesc', title: '名称', align: 'center', sort: true, edit:'text'},
+ {
+ field: 'sourceType',
+ title: '支付方式',
+ width: 130,
+ align: 'center',
+ fixed: 'left',
+ sort: true
+ },
+ {field: 'paydesc', title: '名称', align: 'center', sort: true, edit: 'text'},
+ {
+ field: 'paySubjno', title: '支付科目号', templet: function (item) {
+ return getTempDictValue('allSubjectList', item.paySubjno);
+ }
+ },
+ {
+ field: 'depositeSubjno', title: '充值科目号', templet: function (item) {
+ return getTempDictValue('allSubjectList', item.depositeSubjno);
+ }
+ },
{field: 'enable', title: '状态', align: 'center', templet: '#enable-tpl-state', sort: true},
{
field: 'chargeEnable',
@@ -169,7 +194,7 @@
_csrf: token
}, function (data) {
if (data.code === 200) {
- layer.msg(data.msg, {icon: 1, time:1000});
+ layer.msg(data.msg, {icon: 1, time: 1000});
table.reload('sourcetypeTable');
} else if (data.code === 401) {
layer.msg(data.msg, {icon: 2, time: 1500}, function () {
@@ -180,7 +205,7 @@
$(obj.elem).prop('checked', !obj.elem.checked);
form.render('checkbox');
}
- },function () {
+ }, function () {
layer.msg('请求失败了,请稍后再试', {icon: 2});
$(obj.elem).prop('checked', !obj.elem.checked);
form.render('checkbox');
@@ -242,7 +267,7 @@
var row = obj.data; //得到所在行所有键值
var newval = obj.value; //得到修改后的值
admin.go('[[@{/param/updatesourcetypename}]]', {
- sourcetype: row.sourceType,
+ sourcetype: row.sourceType,
paydesc: newval,
_csrf: $("meta[name='_csrf_token']").attr("value")
}, function (data) {
@@ -256,7 +281,7 @@
layer.msg(data.msg, {icon: 2});
table.reload('sourcetypeTable');
}
- },function () {
+ }, function () {
layer.msg('修改失败了,请稍后再试', {icon: 2});
table.reload('sourcetypeTable');
});
@@ -265,11 +290,11 @@
//监听单元格
table.on('tool(sourcetypeTable-filter)', function (obj) {
var data = obj.data;
- if('del' === obj.event){
+ if ('del' === obj.event) {
if (confirm("确定要删除支付方式[" + data.sourceType + "_" + data.paydesc + "]吗?")) {
layer.load(2);
admin.go('[[@{/param/deletesourcetype}]]', {
- sourcetype: data.sourceType,
+ sourcetype: data.sourceType,
_csrf: $("meta[name='_csrf_token']").attr("value")
}, function (data) {
console.log(data.code);
@@ -291,10 +316,10 @@
layer.msg('请求失败了,请稍后再试', {icon: 2});
});
}
- }else if('config' ===obj.event){
+ } else if ('config' === obj.event) {
admin.popupCenter({
title: "配置参数【" + data.sourceType + "_" + data.paydesc + "】",
- path: '[[@{/param/load4sourcetypeconfig}]]?sourcetype='+data.sourceType,
+ path: '[[@{/param/load4sourcetypeconfig}]]?sourcetype=' + data.sourceType,
area: '800px',
finish: function () {
table.reload('sourcetypeTable');
diff --git a/payapi/src/main/resources/templates/system/param/sourcetypeform.html b/payapi/src/main/resources/templates/system/param/sourcetypeform.html
index f99ad4c..2b9304d 100644
--- a/payapi/src/main/resources/templates/system/param/sourcetypeform.html
+++ b/payapi/src/main/resources/templates/system/param/sourcetypeform.html
@@ -14,6 +14,28 @@
</div>
</div>
<div class="layui-form-item">
+ <label class="layui-form-label">支付科目号</label>
+ <div class="layui-input-block">
+ <select name="paySubjno">
+ <option value="-">不支持</option>
+ <option th:each="bean : ${subjectList}" th:value="${bean.subjno}"
+ th:text="${bean.subjname} + '(' + ${bean.subjno} + ')'">
+ </option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <label class="layui-form-label">充值科目号</label>
+ <div class="layui-input-block">
+ <select name="depositeSubjno">
+ <option value="-">不支持</option>
+ <option th:each="bean : ${subjectList}" th:value="${bean.subjno}"
+ th:text="${bean.subjname} + '(' + ${bean.subjno} + ')'">
+ </option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<input name="enable" type="checkbox" lay-skin="switch" lay-text="启用|关闭" value="yes"
@@ -74,6 +96,7 @@
var admin = layui.admin;
var form = layui.form;
form.render('checkbox');
+ form.render('select');
form.verify({
"sourceType": function (e) {
var msg = "";