修改 sourcetype 并进行简单测试
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeDao.java
similarity index 65%
rename from src/main/java/com/supwisdom/dlpay/api/dao/PaytypeDao.java
rename to src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeDao.java
index dd6503b..b823f3d 100644
--- a/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeDao.java
+++ b/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeDao.java
@@ -13,11 +13,11 @@
* Created by shuwei on 2019/4/9.
*/
@Repository
-public interface PaytypeDao extends JpaRepository<TSourceType, String> {
- TSourceType getByPaytype(String paytype);
+public interface SourceTypeDao extends JpaRepository<TSourceType, String> {
+ TSourceType getBySourceType(String paytype);
- Page<TSourceType> findByPaytypeContaining(String paytype, Pageable pageable);
+ Page<TSourceType> findBySourceTypeContaining(String paytype, Pageable pageable);
@Query("select t from TSourceType t")
- List<TSourceType> getConsumePaytypes();
+ List<TSourceType> getConsumeSourceTypes();
}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtl.java b/src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtl.java
index 7c288bd..940a895 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtl.java
+++ b/src/main/java/com/supwisdom/dlpay/api/domain/TDebitCreditDtl.java
@@ -15,7 +15,7 @@
@Column(name = "SEQNO", nullable = false, precision = 2)
private Integer seqno;
- @Column(name = "settledate", nullable = false, length = 8)
+ @Column(name = "settledate", length = 8)
private String settleDate;
@Column(name = "DRSUBJNO", length = 10)
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytype.java b/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytype.java
index a9b95f1..c358b6c 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytype.java
+++ b/src/main/java/com/supwisdom/dlpay/api/domain/TShopPaytype.java
@@ -15,13 +15,13 @@
private String paytype;
@Column(name = "CONSUME_ENABLE", nullable = false, length = 10)
- private String consumeEnable; //该商户下,此支付方式能否消费
+ private boolean consumeEnable; //该商户下,此支付方式能否消费
@Column(name = "ANONYMOUS_ENABLE", nullable = false, length = 10)
- private String anonymousEnable; //该商户下,此支付方式能否匿名消费
+ private boolean anonymousEnable; //该商户下,此支付方式能否匿名消费
@Column(name = "REVERSE_ENABLE", nullable = false, length = 10)
- private String reverseEnable; //该商户下,此支付方式能否冲正
+ private boolean reverseEnable; //该商户下,此支付方式能否冲正
@Column(name = "CREATETIME", length = 14)
private String createtime;
@@ -42,27 +42,27 @@
this.paytype = paytype;
}
- public String getConsumeEnable() {
+ public boolean getConsumeEnable() {
return consumeEnable;
}
- public void setConsumeEnable(String consumeEnable) {
+ public void setConsumeEnable(boolean consumeEnable) {
this.consumeEnable = consumeEnable;
}
- public String getAnonymousEnable() {
+ public boolean getAnonymousEnable() {
return anonymousEnable;
}
- public void setAnonymousEnable(String anonymousEnable) {
+ public void setAnonymousEnable(boolean anonymousEnable) {
this.anonymousEnable = anonymousEnable;
}
- public String getReverseEnable() {
+ public boolean getReverseEnable() {
return reverseEnable;
}
- public void setReverseEnable(String reverseEnable) {
+ public void setReverseEnable(boolean reverseEnable) {
this.reverseEnable = reverseEnable;
}
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java b/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
index ef6b430..c751316 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
+++ b/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java
@@ -9,20 +9,26 @@
@Table(name = "TB_SOURCETYPE")
public class TSourceType {
@Id
- @Column(name = "PAYTYPE", nullable = false, length = 20)
+ @Column(name = "SOURCETYPE", nullable = false, length = 20)
private String sourceType;
@Column(name = "ENABLE", nullable = false, length = 20)
- private String enable;
+ private Boolean enable;
@Column(name = "CHARGE_ENABLE", nullable = false, length = 10)
- private String chargeEnable; //充值总开关
+ private Boolean chargeEnable; //充值总开关
@Column(name = "CONSUME_ENABLE", nullable = false, length = 10)
- private String consumeEnable; //消费总开关
+ private Boolean consumeEnable; //消费总开关
@Column(name = "ANONYMOUS_ENABLE", nullable = false, length = 10)
- private String anonymousEnable; //匿名消费总开关
+ private Boolean anonymousEnable; //匿名消费总开关
+
+ @Column(name = "reversable")
+ private Boolean reversable;
+
+ @Column(name = "dps_enable")
+ private Boolean depositEnable;
@Column(name = "checkable")
private Boolean checkable; // 是否需要清算
@@ -38,35 +44,35 @@
this.sourceType = sourceType;
}
- public String getEnable() {
+ public Boolean getEnable() {
return enable;
}
- public void setEnable(String enable) {
+ public void setEnable(Boolean enable) {
this.enable = enable;
}
- public String getChargeEnable() {
+ public boolean isChargeEnable() {
return chargeEnable;
}
- public void setChargeEnable(String chargeEnable) {
+ public void setChargeEnable(Boolean chargeEnable) {
this.chargeEnable = chargeEnable;
}
- public String getConsumeEnable() {
+ public Boolean getConsumeEnable() {
return consumeEnable;
}
- public void setConsumeEnable(String consumeEnable) {
+ public void setConsumeEnable(Boolean consumeEnable) {
this.consumeEnable = consumeEnable;
}
- public String getAnonymousEnable() {
+ public Boolean getAnonymousEnable() {
return anonymousEnable;
}
- public void setAnonymousEnable(String anonymousEnable) {
+ public void setAnonymousEnable(Boolean anonymousEnable) {
this.anonymousEnable = anonymousEnable;
}
@@ -85,4 +91,20 @@
public void setCheckable(Boolean checkable) {
this.checkable = checkable;
}
+
+ public Boolean getReversable() {
+ return reversable;
+ }
+
+ public void setReversable(Boolean reversable) {
+ this.reversable = reversable;
+ }
+
+ public Boolean getDepositEnable() {
+ return depositEnable;
+ }
+
+ public void setDepositEnable(Boolean depositEnable) {
+ this.depositEnable = depositEnable;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java b/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
index a9651a0..247342c 100644
--- a/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
@@ -1,7 +1,7 @@
package com.supwisdom.dlpay.api.service.impl;
import com.supwisdom.dlpay.api.dao.PaytypeConfigDao;
-import com.supwisdom.dlpay.api.dao.PaytypeDao;
+import com.supwisdom.dlpay.api.dao.SourceTypeDao;
import com.supwisdom.dlpay.api.domain.TSourceType;
import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
import com.supwisdom.dlpay.api.service.SourceTypeService;
@@ -18,7 +18,7 @@
@Service
public class SourceTypeServiceImpl implements SourceTypeService {
@Autowired
- private PaytypeDao paytypeDao;
+ private SourceTypeDao paytypeDao;
@Autowired
private PaytypeConfigDao paytypeConfigDao;
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/ShopConfigBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/ShopConfigBean.java
index 0bd5256..1e477e7 100644
--- a/src/main/java/com/supwisdom/dlpay/system/bean/ShopConfigBean.java
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/ShopConfigBean.java
@@ -5,14 +5,14 @@
private String shopname;
private String paytype;
private String paydesc;
- private String consumeEnable;
- private String anonymousEnable;
- private String reverseEnable;
+ private boolean consumeEnable;
+ private boolean anonymousEnable;
+ private boolean reverseEnable;
public ShopConfigBean() {
}
- public ShopConfigBean(String shopaccno, String shopname, String paytype, String paydesc, String consumeEnable, String anonymousEnable, String reverseEnable) {
+ public ShopConfigBean(String shopaccno, String shopname, String paytype, String paydesc, boolean consumeEnable, boolean anonymousEnable, boolean reverseEnable) {
this.shopaccno = shopaccno;
this.shopname = shopname;
this.paytype = paytype;
@@ -54,27 +54,27 @@
this.paydesc = paydesc;
}
- public String getConsumeEnable() {
+ public boolean isConsumeEnable() {
return consumeEnable;
}
- public void setConsumeEnable(String consumeEnable) {
+ public void setConsumeEnable(boolean consumeEnable) {
this.consumeEnable = consumeEnable;
}
- public String getAnonymousEnable() {
+ public boolean isAnonymousEnable() {
return anonymousEnable;
}
- public void setAnonymousEnable(String anonymousEnable) {
+ public void setAnonymousEnable(boolean anonymousEnable) {
this.anonymousEnable = anonymousEnable;
}
- public String getReverseEnable() {
+ public boolean isReverseEnable() {
return reverseEnable;
}
- public void setReverseEnable(String reverseEnable) {
+ public void setReverseEnable(boolean reverseEnable) {
this.reverseEnable = reverseEnable;
}
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java b/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
index 96e9458..24da8e3 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
@@ -384,9 +384,10 @@
@PreAuthorize("hasPermission('/param/updatepaytypestate','')")
@ResponseBody
public JsonResult updatePaytypeState(@RequestParam("paytype") String paytype,
- @RequestParam("state") String state,
+ @RequestParam("state") Boolean state,
@RequestParam(value = "optype", required = false) String optype) {
- if (StringUtil.isEmpty(paytype) || (!ConstantUtil.ENABLE_YES.equals(state) && !ConstantUtil.ENABLE_NO.equals(state)) || (!StringUtil.isEmpty(optype) && !"charge".equals(optype) && !"consume".equals(optype) && !"anonymous".equals(optype))) {
+ if (StringUtil.isEmpty(paytype)
+ || (!StringUtil.isEmpty(optype) && !"charge".equals(optype) && !"consume".equals(optype) && !"anonymous".equals(optype))) {
return JsonResult.error("参数传递错误");
}
try {
@@ -395,7 +396,7 @@
return JsonResult.error("支付方式不存在!");
}
if ("charge".equals(optype)) {
- if (state.equals(tPaytype.getChargeEnable())) {
+ if (state.equals(tPaytype.isChargeEnable())) {
return JsonResult.error("状态错误,请重新查询后操作");
}
tPaytype.setChargeEnable(state);
@@ -417,9 +418,9 @@
}
if (paramService.saveOrUpdatePaytype(tPaytype)) {
- return JsonResult.ok(ConstantUtil.ENABLE_YES.equals(state) ? "启用成功" : "关闭成功");
+ return JsonResult.ok(state ? "启用成功" : "关闭成功");
} else {
- return JsonResult.error(ConstantUtil.ENABLE_YES.equals(state) ? "启用失败" : "关闭失败");
+ return JsonResult.error(!state ? "启用失败" : "关闭失败");
}
} catch (Exception e) {
e.printStackTrace();
@@ -476,10 +477,10 @@
@PreAuthorize("hasPermission('/param/addpaytype','')")
@ResponseBody
public JsonResult addPaytype(@RequestParam("paytype") String paytype,
- @RequestParam(value = "enable",required = false,defaultValue = "no") String enable,
- @RequestParam(value = "chargeEnable",required = false,defaultValue = "no") String chargeEnable,
- @RequestParam(value = "consumeEnable",required = false,defaultValue = "no") String consumeEnable,
- @RequestParam(value = "anonymousEnable",required = false,defaultValue = "no") String anonymousEnable,
+ @RequestParam(value = "enable", required = false, defaultValue = "no") String enable,
+ @RequestParam(value = "chargeEnable", required = false, defaultValue = "no") String chargeEnable,
+ @RequestParam(value = "consumeEnable", required = false, defaultValue = "no") String consumeEnable,
+ @RequestParam(value = "anonymousEnable", required = false, defaultValue = "no") String anonymousEnable,
@RequestParam("paydesc") String paydesc) {
try {
TSourceType tPaytype = paramService.getPaytype(paytype);
@@ -490,10 +491,10 @@
tPaytype.setSourceType(paytype.trim());
if (StringUtil.isEmpty(paydesc)) return JsonResult.error("支付名称不能为空!");
tPaytype.setPaydesc(paydesc.trim());
- tPaytype.setEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(enable) ? ConstantUtil.ENABLE_YES : ConstantUtil.ENABLE_NO);
- tPaytype.setChargeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(chargeEnable) ? ConstantUtil.ENABLE_YES : ConstantUtil.ENABLE_NO);
- tPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable) ? ConstantUtil.ENABLE_YES : ConstantUtil.ENABLE_NO);
- tPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable) ? ConstantUtil.ENABLE_YES : ConstantUtil.ENABLE_NO);
+ 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));
if (paramService.saveOrUpdatePaytype(tPaytype)) {
return JsonResult.ok("新增成功");
} else {
@@ -528,9 +529,9 @@
@PostMapping("/param/addpaytypeconfig")
@PreAuthorize("hasPermission('/param/addpaytypeconfig','')")
@ResponseBody
- public JsonResult addPaytypeConfig(@RequestBody Map<String,String> param){
+ public JsonResult addPaytypeConfig(@RequestBody Map<String, String> param) {
String paytypeHtmlKey = "hid_paytype"; //页面上传来paytype的KEY
- if(null==param || StringUtil.isEmpty(param.get(paytypeHtmlKey))){
+ if (null == param || StringUtil.isEmpty(param.get(paytypeHtmlKey))) {
return JsonResult.error("参数传递错误");
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java b/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
index ed3dde1..f64753f 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
@@ -206,17 +206,17 @@
if (state.equals(shopPaytype.getConsumeEnable())) {
return JsonResult.error("状态错误,请重新查询后操作");
}
- shopPaytype.setConsumeEnable(state);
+ shopPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equals(state));
} else if ("anonymous".equals(optype)) {
if (state.equals(shopPaytype.getAnonymousEnable())) {
return JsonResult.error("状态错误,请重新查询后操作");
}
- shopPaytype.setAnonymousEnable(state);
+ shopPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equals(state));
} else if ("reverse".equals(optype)) {
if (state.equals(shopPaytype.getReverseEnable())) {
return JsonResult.error("状态错误,请重新查询后操作");
}
- shopPaytype.setReverseEnable(state);
+ shopPaytype.setReverseEnable(ConstantUtil.ENABLE_YES.equals(state));
}
if (shopDataService.saveOrUpdateShopPaytype(shopPaytype)) {
@@ -232,7 +232,7 @@
@GetMapping("/shop/load4addpaytype")
@PreAuthorize("hasPermission('/shop/load4addpaytype','')")
- public String load4AddShopPaytype(Model model){
+ public String load4AddShopPaytype(Model model) {
model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
return "system/shop/configform";
}
@@ -245,7 +245,7 @@
@RequestParam(value = "consumeEnable", required = false, defaultValue = "no") String consumeEnable,
@RequestParam(value = "anonymousEnable", required = false, defaultValue = "no") String anonymousEnable,
@RequestParam(value = "reverseEnable", required = false, defaultValue = "no") String reverseEnable) {
- if(StringUtil.isEmpty(shopaccno) || StringUtil.isEmpty(paytype)){
+ if (StringUtil.isEmpty(shopaccno) || StringUtil.isEmpty(paytype)) {
return JsonResult.error("参数传递错误");
}
try {
@@ -264,9 +264,9 @@
shopPaytype = new TShopPaytype();
shopPaytype.setShopaccno(shopacc.getShopaccno());
shopPaytype.setPaytype(tPaytype.getSourceType());
- shopPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable) ? ConstantUtil.ENABLE_YES : ConstantUtil.ENABLE_NO);
- shopPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable) ? ConstantUtil.ENABLE_YES : ConstantUtil.ENABLE_NO);
- shopPaytype.setReverseEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(reverseEnable) ? ConstantUtil.ENABLE_YES : ConstantUtil.ENABLE_NO);
+ shopPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable));
+ shopPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable));
+ shopPaytype.setReverseEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(reverseEnable));
shopPaytype.setCreatetime(systemUtilService.getSysdatetime().getHostdatetime());
if (shopDataService.saveOrUpdateShopPaytype(shopPaytype)) {
return JsonResult.ok("新增成功");
@@ -319,5 +319,4 @@
}
-
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
index e057236..4709fda 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
@@ -1,7 +1,7 @@
package com.supwisdom.dlpay.system.service.impl;
import com.supwisdom.dlpay.api.dao.PaytypeConfigDao;
-import com.supwisdom.dlpay.api.dao.PaytypeDao;
+import com.supwisdom.dlpay.api.dao.SourceTypeDao;
import com.supwisdom.dlpay.api.domain.TSourceType;
import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
import com.supwisdom.dlpay.framework.dao.ApiClientDao;
@@ -41,7 +41,7 @@
@Autowired
private ApiClientDao apiClientDao;
@Autowired
- private PaytypeDao paytypeDao;
+ private SourceTypeDao paytypeDao;
@Autowired
private PaytypeConfigDao paytypeConfigDao;
@@ -153,7 +153,7 @@
public PageResult<TSourceType> getPaytypePage(String paytype, int pageNo, int pageSize) {
Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("paytype"));
if (!StringUtil.isEmpty(paytype)) {
- return new PageResult<>(paytypeDao.findByPaytypeContaining(paytype.trim(), pageable));
+ return new PageResult<>(paytypeDao.findBySourceTypeContaining(paytype.trim(), pageable));
}
return new PageResult<>(paytypeDao.findAll(pageable));
}
@@ -161,7 +161,7 @@
@Override
public TSourceType getPaytype(String paytype) {
if (!StringUtil.isEmpty(paytype)) {
- return paytypeDao.getByPaytype(paytype.trim());
+ return paytypeDao.getBySourceType(paytype.trim());
}
return null;
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
index 5136bcc..d474e2c 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
@@ -1,7 +1,7 @@
package com.supwisdom.dlpay.system.service.impl;
import com.supwisdom.dlpay.api.dao.PaytypeConfigDao;
-import com.supwisdom.dlpay.api.dao.PaytypeDao;
+import com.supwisdom.dlpay.api.dao.SourceTypeDao;
import com.supwisdom.dlpay.api.dao.ShopPaytypeConfigDao;
import com.supwisdom.dlpay.api.dao.ShopPaytypeDao;
import com.supwisdom.dlpay.api.domain.TSourceType;
@@ -47,7 +47,7 @@
@Autowired
private SystemUtilService systemUtilService;
@Autowired
- private PaytypeDao paytypeDao;
+ private SourceTypeDao paytypeDao;
@Autowired
private PaytypeConfigDao paytypeConfigDao;
@Autowired
@@ -146,9 +146,9 @@
TShopPaytype shopPaytype = new TShopPaytype();
shopPaytype.setShopaccno(shopacc.getShopaccno());
shopPaytype.setPaytype(TradeDict.PAYTYPE_BALANCE);
- shopPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES);
- shopPaytype.setAnonymousEnable(ConstantUtil.ENABLE_NO);
- shopPaytype.setReverseEnable(ConstantUtil.ENABLE_NO);
+ shopPaytype.setConsumeEnable(true);
+ shopPaytype.setAnonymousEnable(false);
+ shopPaytype.setReverseEnable(false);
shopPaytype.setCreatetime(dt.getHostdatetime());
shopPaytypeDao.save(shopPaytype); //默认增加余额支付方式
}
@@ -158,7 +158,7 @@
@Override
public List<TSourceType> getConsumePaytypes() {
- List<TSourceType> list = paytypeDao.getConsumePaytypes();
+ List<TSourceType> list = paytypeDao.getConsumeSourceTypes();
if (!StringUtil.isEmpty(list)) {
return list;
}
@@ -193,7 +193,7 @@
TShopacc shopacc = shopaccDao.getByShopaccno(pt.getShopaccno());
bean.setShopname(shopacc == null ? "" : shopacc.getShopname());
bean.setPaytype(pt.getPaytype());
- TSourceType tPaytype = paytypeDao.getByPaytype(pt.getPaytype());
+ TSourceType tPaytype = paytypeDao.getBySourceType(pt.getPaytype());
bean.setPaydesc(tPaytype == null ? "" : tPaytype.getPaydesc());
bean.setConsumeEnable(pt.getConsumeEnable());
bean.setAnonymousEnable(pt.getAnonymousEnable());
@@ -210,7 +210,7 @@
@Override
public TShopacc getShopaccByAccno(String shopaccno) {
- if(!StringUtil.isEmpty(shopaccno)){
+ if (!StringUtil.isEmpty(shopaccno)) {
return shopaccDao.getByShopaccno(shopaccno.trim());
}
return null;
diff --git a/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java b/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
index 1bf5ac2..d791ab0 100644
--- a/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
+++ b/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
@@ -5,25 +5,25 @@
*/
public class ConstantUtil {
- public static final String ENABLE_YES = "yes";
- public static final String ENABLE_NO = "no";
+ public static final String ENABLE_YES = "yes";
+ public static final String ENABLE_NO = "no";
- public static final String SEX_MALE = "male";
- public static final String SEX_FEMALE = "female";
+ public static final String SEX_MALE = "male";
+ public static final String SEX_FEMALE = "female";
- public static final String IDTYPE_IDENTITY = "1"; //身份证
- public static final String IDTYPE_PASSPORT = "2"; //护照
- public static final String IDTYPE_DRIVING_LICENSE = "3"; //驾照
- public static final String IDTYPE_HKM_PASS = "4"; //港澳通行证
- public static final String IDTYPE_STUEMPNO = "5"; //学工号
- public static final String IDTYPE_OTHER = "9"; //其他
- public static final String[] IDTYPE_DICTS = {"1", "2", "3", "4", "5", "9"}; //联动
+ public static final String IDTYPE_IDENTITY = "1"; //身份证
+ public static final String IDTYPE_PASSPORT = "2"; //护照
+ public static final String IDTYPE_DRIVING_LICENSE = "3"; //驾照
+ public static final String IDTYPE_HKM_PASS = "4"; //港澳通行证
+ public static final String IDTYPE_STUEMPNO = "5"; //学工号
+ public static final String IDTYPE_OTHER = "9"; //其他
+ public static final String[] IDTYPE_DICTS = {"1", "2", "3", "4", "5", "9"}; //联动
- public static final int SHOPTYPE_GROUP = 0; //商户组
- public static final int SHOPTYPE_LEAF = 1; //末级商户,独立核算商户
+ public static final int SHOPTYPE_GROUP = 0; //商户组
+ public static final int SHOPTYPE_LEAF = 1; //末级商户,独立核算商户
- public static final String FEETYPE_DEFAULT = "none";
- public static final String FEETYPE_MEALER = "mealer";
- public static final String FEETYPE_DISCOUNT = "discount";
- public static final String[] FEETYPE_DICTS = {"none", "mealer", "discount"}; //联动
+ public static final String FEETYPE_DEFAULT = "none";
+ public static final String FEETYPE_MEALER = "mealer";
+ public static final String FEETYPE_DISCOUNT = "discount";
+ public static final String[] FEETYPE_DICTS = {"none", "mealer", "discount"}; //联动
}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt b/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
index 5e8cec5..4a8241d 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt
@@ -457,7 +457,7 @@
// outtradeno: String, payinfo: String, feetype: String,
// wechattype: String, realip: String?, qrcode: String?, openid: String?): ResponseEntity<Any> {
// return try {
-// val paytype = paytypeService.getByPaytype(PaytypeUtil.WECHAT)
+// val paytype = paytypeService.getBySourceType(PaytypeUtil.WECHAT)
// if (paytype == null || ConstantUtil.ENABLE_YES != paytype.enable) {
// ResponseEntity.ok(ResponseBodyBuilder.create()
// .fail(1, "支付方式未开启"))
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/consume_pay_service.kt b/src/main/kotlin/com/supwisdom/dlpay/api/service/consume_pay_service.kt
index 9aa7d21..412fdf5 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/consume_pay_service.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/service/consume_pay_service.kt
@@ -3,9 +3,9 @@
import org.springframework.transaction.annotation.Propagation
import org.springframework.transaction.annotation.Transactional
-interface ConsumePayService{
+interface ConsumePayService {
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = [Exception::class])
- fun checkShopPaytype(shopaccno: String, paytype: String, anonymousflag: Boolean? = false): Boolean
+ fun checkShopPaytype(shopaccno: String, sourceType: String, anonymousflag: Boolean? = false): Boolean
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = [Exception::class])
fun getPaytypeConfig(paytype: String, shopaccno: String, anonymousflag: Boolean? = false, ignoreStatus: Boolean? = false): Map<String, String?>
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/Consume_pay_service_impl.kt b/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/Consume_pay_service_impl.kt
index 8d891d8..3eb78fd 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/Consume_pay_service_impl.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/Consume_pay_service_impl.kt
@@ -1,6 +1,6 @@
package com.supwisdom.dlpay.api.service.impl
-import com.supwisdom.dlpay.api.dao.PaytypeDao
+import com.supwisdom.dlpay.api.dao.SourceTypeDao
import com.supwisdom.dlpay.api.dao.ShopPaytypeConfigDao
import com.supwisdom.dlpay.api.dao.ShopPaytypeDao
import com.supwisdom.dlpay.api.service.ConsumePayService
@@ -13,50 +13,51 @@
@Service
class ConsumePayServiceImpl : ConsumePayService {
@Autowired
- lateinit var paytypeDao: PaytypeDao
+ lateinit var sourceTypeDao: SourceTypeDao
@Autowired
lateinit var shopPaytypeDao: ShopPaytypeDao
@Autowired
lateinit var shopPaytypeConfigDao: ShopPaytypeConfigDao
- override fun checkShopPaytype(shopaccno: String, paytype: String, anonymousflag: Boolean?): Boolean {
- paytypeDao.getByPaytype(paytype).let {
+ override fun checkShopPaytype(shopaccno: String, sourceType: String, anonymousflag: Boolean?): Boolean {
+ sourceTypeDao.getBySourceType(sourceType).let {
if (null == it) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[$paytype]")
+ throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[$sourceType]")
} else {
- if (ConstantUtil.ENABLE_YES != it.enable || ConstantUtil.ENABLE_YES != it.consumeEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[$paytype]消费")
+ if (!it.enable || !it.consumeEnable) {
+ throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[$sourceType]消费")
}
- if (true == anonymousflag && ConstantUtil.ENABLE_YES != it.anonymousEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[$paytype]未启用匿名消费")
+ if (true == anonymousflag && !it.anonymousEnable) {
+ throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[$sourceType]未启用匿名消费")
}
}
}
- shopPaytypeDao.getById(paytype, shopaccno).let {
+ shopPaytypeDao.getById(sourceType, shopaccno).let {
if (null == it) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$paytype]")
+ throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$sourceType]")
} else {
- if (ConstantUtil.ENABLE_YES != it.consumeEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$paytype]")
+ if (!it.consumeEnable) {
+ throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$sourceType]")
}
- if (true == anonymousflag && ConstantUtil.ENABLE_YES != it.anonymousEnable) {
- throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$paytype]未启用匿名消费")
+ if (true == anonymousflag && !it.anonymousEnable) {
+ throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$sourceType]未启用匿名消费")
}
}
}
return true
}
- override fun getPaytypeConfig(paytype: String, shopaccno: String, anonymousflag: Boolean?, ignoreStatus: Boolean?): Map<String, String?> {
- paytypeDao.getByPaytype(paytype).let {
+ 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 && (ConstantUtil.ENABLE_YES != it.enable || ConstantUtil.ENABLE_YES != it.consumeEnable)) {
+ if (true != ignoreStatus && (!it.enable || !it.consumeEnable)) {
throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统未启用支付方式[$paytype]消费")
}
- if (true != ignoreStatus && true == anonymousflag && ConstantUtil.ENABLE_YES != it.anonymousEnable) {
+ if (true != ignoreStatus && true == anonymousflag && !it.anonymousEnable) {
throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统支付方式[$paytype]未启用匿名消费")
}
}
@@ -67,10 +68,10 @@
throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$paytype]")
} else {
//对账取配置时不关心状态,不能报错
- if (true != ignoreStatus && ConstantUtil.ENABLE_YES != it.consumeEnable) {
+ if (true != ignoreStatus && !it.consumeEnable) {
throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]未启用支付方式[$paytype]")
}
- if (true != ignoreStatus && true == anonymousflag && ConstantUtil.ENABLE_YES != it.anonymousEnable) {
+ if (true != ignoreStatus && true == anonymousflag && !it.anonymousEnable) {
throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$paytype]未启用匿名消费")
}
}
@@ -81,7 +82,9 @@
throw TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[$shopaccno]的支付方式[$paytype]未配置参数")
} else {
val result = mutableMapOf<String, String?>()
- it.forEach { result.plus(mapOf(it.configid to it.configValue)) }
+ it.forEach { paytypeConfig ->
+ result.plus(mapOf(paytypeConfig.configid to paytypeConfig.configValue))
+ }
return result
}
}