为 sourcetype 增加了 paysubjno, depositesubjno
authorTang Cheng <cheng.tang@supwisdom.com>
Sun, 21 Jul 2019 13:40:07 +0000 (21:40 +0800)
committerTang Cheng <cheng.tang@supwisdom.com>
Sun, 21 Jul 2019 13:40:07 +0000 (21:40 +0800)
27 files changed:
payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/QrcodePayParam.java
payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/ConfirmAction.java [new file with mode: 0644]
payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/CreateAction.java [moved from payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/Query.java with 60% similarity]
payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/InitAction.java [moved from payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/Confirm.java with 61% similarity]
payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/QueryAction.java [moved from payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/InitStep.java with 60% similarity]
payapi/src/main/java/com/supwisdom/dlpay/agent/dao/QrcodePatternDao.java
payapi/src/main/java/com/supwisdom/dlpay/agent/service/AgentServiceProxy.java
payapi/src/main/java/com/supwisdom/dlpay/agent/service/QrcodePatternService.java
payapi/src/main/java/com/supwisdom/dlpay/agent/service/impl/QrcodePatternServiceImpl.java
payapi/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java
payapi/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
payapi/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TSubject.java
payapi/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
payapi/src/main/java/com/supwisdom/dlpay/framework/util/Dictionary.java
payapi/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryDataService.java
payapi/src/main/java/com/supwisdom/dlpay/system/service/DictionaryProxy.java
payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/pay_service_impl.kt
payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt
payapi/src/main/resources/data.sql
payapi/src/main/resources/static/libs/custom.js
payapi/src/main/resources/templates/system/param/sourcetype.html
payapi/src/main/resources/templates/system/param/sourcetypeform.html

index 798ffed..6ffef6f 100644 (file)
@@ -2,46 +2,50 @@ package com.supwisdom.dlpay.api.bean;
 
 import com.supwisdom.dlpay.api.APIRequestParam;
 import com.supwisdom.dlpay.api.annotation.Sign;
-import com.supwisdom.dlpay.api.bean.groups.Confirm;
-import com.supwisdom.dlpay.api.bean.groups.InitStep;
-import com.supwisdom.dlpay.api.bean.groups.Query;
+import com.supwisdom.dlpay.api.bean.groups.ConfirmAction;
+import com.supwisdom.dlpay.api.bean.groups.InitAction;
+import com.supwisdom.dlpay.api.bean.groups.QueryAction;
 import com.supwisdom.dlpay.api.exception.RequestParamCheckException;
+import org.springframework.stereotype.Service;
 
 import javax.validation.constraints.Min;
+import javax.validation.constraints.NegativeOrZero;
 import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 
 public class QrcodePayParam extends APIRequestParam {
   @Sign
-  @NotNull(message = "订单号不能为空", groups = {Query.class, InitStep.class, Confirm.class})
+  @NotNull(message = "订单号不能为空", groups = {QueryAction.class, InitAction.class, ConfirmAction.class})
   private String billno;
 
   @Sign
-  @NotNull(message = "商户号不能为空", groups = {Query.class, InitStep.class, Confirm.class})
+  @NotNull(message = "商户号不能为空", groups = {QueryAction.class, InitAction.class, ConfirmAction.class})
   private String shopaccno;
 
   @Sign
-  @NotEmpty(message = "支付码不能为空", groups = {InitStep.class})
+  @NotEmpty(message = "支付码不能为空", groups = {InitAction.class})
   private String qrcode;
 
+  @Sign
+  private String qrcodeFormat; // origin - 原始码, hex - hex format, base64 - base64 encode
+
   @Sign
   private String userid;
 
   @Sign
-  @NotEmpty(message = "交易日期不能为空", groups = {InitStep.class, Confirm.class})
+  @NotEmpty(message = "交易日期不能为空", groups = {InitAction.class, ConfirmAction.class})
   private String transdate;
 
   @Sign
-  @NotEmpty(message = "交易时间不能为空", groups = {InitStep.class, Confirm.class})
+  @NotEmpty(message = "交易时间不能为空", groups = {InitAction.class, ConfirmAction.class})
   private String transtime;
 
   @Sign
-  @NotNull(message = "交易金额不能为空", groups = Confirm.class)
-  @Min(value = 1L, message = "交易金额必须大于零", groups = Confirm.class)
+  @Min(value = 1L, message = "交易金额必须大于零", groups = ConfirmAction.class)
   private Integer amount;
 
   @Sign
-  @NotNull(message = "必须指定是否匿名支付", groups = Confirm.class)
+  @NotNull(message = "必须指定是否匿名支付", groups = ConfirmAction.class)
   private Boolean anonymous;
 
   public String getBillno() {
@@ -108,6 +112,14 @@ public class QrcodePayParam extends APIRequestParam {
     this.userid = userid;
   }
 
+  public String getQrcodeFormat() {
+    return qrcodeFormat;
+  }
+
+  public void setQrcodeFormat(String qrcodeFormat) {
+    this.qrcodeFormat = qrcodeFormat;
+  }
+
   @Override
   public boolean checkParam() throws RequestParamCheckException {
     return true;
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/ConfirmAction.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/groups/ConfirmAction.java
new file mode 100644 (file)
index 0000000..cce7503
--- /dev/null
@@ -0,0 +1,4 @@
+package com.supwisdom.dlpay.api.bean.groups;
+
+public interface ConfirmAction {
+}
index d63e9d0..198645e 100644 (file)
@@ -7,4 +7,8 @@ import java.util.List;
 
 public interface QrcodePatternDao extends CrudRepository<QrcodePattern, Integer> {
   List<QrcodePattern> findByTenantid(String tenantid);
+
+  void deleteByTenantid(String tenantid);
+
+  List<QrcodePattern> findBySourceTypeAndTenantid(String sourceType, String tenantid);
 }
index 8f2809d..7de65cd 100644 (file)
@@ -5,6 +5,7 @@ import com.supwisdom.dlpay.agent.domain.QrcodePattern;
 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 @@ public class AgentServiceProxy {
         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 @@ public class AgentServiceProxy {
     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");
index d3a0397..2ea2c3d 100644 (file)
@@ -5,5 +5,11 @@ import com.supwisdom.dlpay.agent.domain.QrcodePattern;
 import java.util.List;
 
 public interface QrcodePatternService {
-  List<QrcodePattern> getAllQrCodePattern();
+  List<QrcodePattern> getAllQrcodePattern();
+
+  void deleteAllQrcodePattern();
+
+  QrcodePattern saveOrUpdateQrcodePattern(QrcodePattern pattern);
+
+  List<QrcodePattern> findAllBySourcetype(String sourceType);
 }
index 2d7ad9f..4da560f 100644 (file)
@@ -4,7 +4,8 @@ import com.supwisdom.dlpay.agent.dao.QrcodePatternDao;
 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 @@ import java.util.List;
 
 @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());
+  }
 }
index 9e0ad35..a4767f2 100644 (file)
@@ -97,6 +97,9 @@ public class TPersondtl {
   @Column(name = "DTLTYPE", length = 20)
   private String dtltype;
 
+  @Column(name = "anonymous")
+  private Boolean anonymous;
+
   public String getDtltype() {
     return dtltype;
   }
@@ -288,4 +291,12 @@ public class TPersondtl {
   public void setTenantid(String tenantid) {
     this.tenantid = tenantid;
   }
+
+  public Boolean getAnonymous() {
+    return anonymous;
+  }
+
+  public void setAnonymous(Boolean anonymous) {
+    this.anonymous = anonymous;
+  }
 }
index 8d09f92..d20efaf 100644 (file)
@@ -49,8 +49,11 @@ public class TSourceType implements DictionaryTable, Serializable {
   @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 @@ public class TSourceType implements DictionaryTable, Serializable {
     this.sourceTypeId = sourceTypeId;
   }
 
-  public @NotNull String getAssetSubjno() {
-    return assetSubjno;
+  public @NotNull String getPaySubjno() {
+    return paySubjno;
+  }
+
+  public void setPaySubjno(@NotNull String paySubjno) {
+    this.paySubjno = paySubjno;
+  }
+
+  public String getDepositeSubjno() {
+    return depositeSubjno;
   }
 
-  public void setAssetSubjno(@NotNull String assetSubjno) {
-    this.assetSubjno = assetSubjno;
+  public void setDepositeSubjno(String depositeSubjno) {
+    this.depositeSubjno = depositeSubjno;
   }
 }
index 303a3b0..f76cffa 100644 (file)
@@ -37,6 +37,8 @@ public interface ShopaccDao extends JpaRepository<TShopacc, String> {
 
   TShopacc getByShopaccno(String shopaccno);
 
+  TShopacc getByShopaccnoAndTenantId(String shopaccno, String tenantid);
+
   @Transactional
   @Modifying(clearAutomatically = true)
   @Query("update TShopacc set shopname=?1 where shopaccno=?2")
index f88623d..78ecb03 100644 (file)
@@ -26,6 +26,8 @@ public interface SubjectDao extends JpaRepository<TSubject, String> {
 
   TSubject findBySubjno(String subjno);
 
+  TSubject findBySubjnoAndTenantId(String subjno, String tenantid);
+
   @Query("from TSubject where displayflag='y' order by subjno ")
   List<TSubject> findAllDisplaySubjects();
 }
index d02d05e..d76cd59 100644 (file)
@@ -2,11 +2,13 @@ package com.supwisdom.dlpay.framework.domain;
 
 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 class TSubject {
   public void setId(Integer id) {
     this.id = id;
   }
+
+  @Override
+  public String getDictKey() {
+    return this.subjno;
+  }
+
+  @Override
+  public Object getDictValue() {
+    return this.subjname;
+  }
 }
index ca18764..7eda63d 100644 (file)
@@ -18,11 +18,13 @@ public interface SystemUtilService {
   /**
    * 获取记账日期
    */
+  @Transactional
   String getAccdate();
 
   /**
    * 获取流水号
    */
+  @Transactional
   String getRefno();
 
   /**
@@ -32,6 +34,7 @@ public interface SystemUtilService {
 
 
   /********************** 获取【系统参数】【业务参数】通用方法 **********************/
+  @Transactional
   String getSysparaValue(int paraid);
 
   String getSysparaValue(int paraid, String defaultValue);
index c7c9d89..9eac02d 100644 (file)
@@ -13,4 +13,5 @@ public class Dictionary {
   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";
 }
index 2bf71b3..6d46a45 100644 (file)
@@ -9,10 +9,10 @@ import com.supwisdom.dlpay.framework.domain.TSyspara;
 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 @@ import java.util.Map;
 
 @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 @@ public class ParamController {
   @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 @@ public class ParamController {
                                @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("新增失败");
index d7d1027..b7824dd 100644 (file)
@@ -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 @@ public interface DictionaryDataService {
 
   List<TTranscode> getTransCode();
 
+  List<TSubject> getAllSubject();
 }
index c78b89c..361ee89 100644 (file)
@@ -49,6 +49,8 @@ public class DictionaryProxy {
       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);
     }
index a28bdbf..be4365a 100644 (file)
@@ -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 @@ import java.util.List;
 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 @@ public class DictionaryDataServiceImpl implements DictionaryDataService {
     }
     return new ArrayList<>();
   }
+
+  @Override
+  @Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('allsubject')")
+  public List<TSubject> getAllSubject() {
+    return subjectDao.findAllDisplaySubjects();
+  }
 }
index 6a6a75e..9d923d2 100644 (file)
@@ -6,8 +6,8 @@ import com.supwisdom.dlpay.agent.domain.QrcodePayTrans
 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 @@ class ConsumeAPIController {
     }
 
     @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 @@ class ConsumeAPIController {
         // 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 @@ class ConsumeAPIController {
     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 @@ class ConsumeAPIController {
 
         //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)
index 1ab0d37..1807686 100644 (file)
@@ -9,9 +9,9 @@ import com.supwisdom.dlpay.framework.dao.FeetypeConfigDao
 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 @@ class AccountUtilServcieImpl : AccountUtilServcie {
     }
 
     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>不存在")
     }
 
index edb618c..2a8c984 100644 (file)
@@ -109,6 +109,7 @@ class TransactionServiceImpl : TransactionService {
                     tenantid = transaction.tenantid
                     this.dtltype = builder.dtltype
                     this.status = status
+                    this.anonymous = builder.person().isAnonymous()
                 }.also {
                     //                    persondtlDao.save(it)
                     transaction.personDtl = it
index f1d7f88..ac1da71 100644 (file)
@@ -439,23 +439,23 @@ VALUES (30, '6602', 2, 'y', 1, NULL, 20190430, 1, '管理费收入', 6, '{tenant
 
 
 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")
index 21e9601..12564c2 100644 (file)
@@ -65,6 +65,7 @@
                     .addNewDict("idtypeList")
                     .addNewDict("sexList")
                     .addNewDict("accountStatusList")
+                    .addNewDict("allSubjectList")
             },
             getDict: function (dictType) {
                 var dict, that = this;
index 32ed15d..74087c2 100644 (file)
@@ -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">&#xe615;</i>搜索
             </button>
-            <button id="btn-add-param" class="layui-btn icon-btn" data-type="add"><i class="layui-icon">&#xe654;</i>新 增
+            <button id="btn-add-param" class="layui-btn icon-btn" data-type="add"><i class="layui-icon">&#xe654;</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>
 
 <!-- 表格状态列 -->
 <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>
             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',
                 _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 () {
                     $(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');
             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) {
                     layer.msg(data.msg, {icon: 2});
                     table.reload('sourcetypeTable');
                 }
-            },function () {
+            }, function () {
                 layer.msg('修改失败了,请稍后再试', {icon: 2});
                 table.reload('sourcetypeTable');
             });
         //监听单元格
         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);
                         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');
index f99ad4c..2b9304d 100644 (file)
                    lay-verify="required" required/>
         </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">
@@ -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 = "";