From: Tang Cheng Date: Mon, 27 May 2019 06:47:20 +0000 (+0800) Subject: refactor: 将 paytype 改为 sourcetype , 定义来源,包括消费、充值 X-Git-Tag: 1.0.0^2~190 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=4f8b60b55826aba2405652e119488fec674ff56c;p=epayment%2Ffood_payapi.git refactor: 将 paytype 改为 sourcetype , 定义来源,包括消费、充值 --- diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeDao.java index bd2c959b..dd6503bc 100644 --- a/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeDao.java +++ b/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeDao.java @@ -1,6 +1,6 @@ package com.supwisdom.dlpay.api.dao; -import com.supwisdom.dlpay.api.domain.TPaytype; +import com.supwisdom.dlpay.api.domain.TSourceType; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; @@ -13,11 +13,11 @@ import java.util.List; * Created by shuwei on 2019/4/9. */ @Repository -public interface PaytypeDao extends JpaRepository { - TPaytype getByPaytype(String paytype); +public interface PaytypeDao extends JpaRepository { + TSourceType getByPaytype(String paytype); - Page findByPaytypeContaining(String paytype, Pageable pageable); + Page findByPaytypeContaining(String paytype, Pageable pageable); - @Query("select t from TPaytype t") - List getConsumePaytypes(); + @Query("select t from TSourceType t") + List getConsumePaytypes(); } diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TPaytype.java b/src/main/java/com/supwisdom/dlpay/api/domain/TPaytype.java deleted file mode 100644 index 088cb9e7..00000000 --- a/src/main/java/com/supwisdom/dlpay/api/domain/TPaytype.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.supwisdom.dlpay.api.domain; - -import javax.persistence.*; - -/** - * Created by shuwei on 2019/4/9. - */ -@Entity -@Table(name = "TB_PAYTYPE") -public class TPaytype { - @Id - @Column(name = "PAYTYPE", nullable = false, length = 20) - private String paytype; - - @Column(name = "ENABLE", nullable = false, length = 20) - private String enable; - - @Column(name = "CHARGE_ENABLE", nullable = false, length = 10) - private String chargeEnable; //充值总开关 - - @Column(name = "CONSUME_ENABLE",nullable = false, length = 10) - private String consumeEnable; //消费总开关 - - @Column(name = "ANONYMOUS_ENABLE", nullable = false, length = 10) - private String anonymousEnable; //匿名消费总开关 - - @Column(name = "PAYDESC", length = 200) - private String paydesc; - - public String getPaytype() { - return paytype; - } - - public void setPaytype(String paytype) { - this.paytype = paytype; - } - - public String getEnable() { - return enable; - } - - public void setEnable(String enable) { - this.enable = enable; - } - - public String getChargeEnable() { - return chargeEnable; - } - - public void setChargeEnable(String chargeEnable) { - this.chargeEnable = chargeEnable; - } - - public String getConsumeEnable() { - return consumeEnable; - } - - public void setConsumeEnable(String consumeEnable) { - this.consumeEnable = consumeEnable; - } - - public String getAnonymousEnable() { - return anonymousEnable; - } - - public void setAnonymousEnable(String anonymousEnable) { - this.anonymousEnable = anonymousEnable; - } - - public String getPaydesc() { - return paydesc; - } - - public void setPaydesc(String paydesc) { - this.paydesc = paydesc; - } -} diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java b/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java index bb52bba6..3db4e5ac 100644 --- a/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java +++ b/src/main/java/com/supwisdom/dlpay/api/domain/TPersondtl.java @@ -41,8 +41,8 @@ public class TPersondtl { @Column(name = "amount", precision = 9, scale = 2, nullable = false) private Double amount; //实际付款金额 - @Column(name = "PAYTYPE", length = 20) - private String paytype; //支付方式 balance,wechat,alipay + @Column(name = "SOURCETYPE", length = 20) + private String sourceType; //支付方式 balance,wechat,alipay @Column(name = "PAYINFO", length = 200) private String payinfo; //记录支付信息备用字段 @@ -141,12 +141,12 @@ public class TPersondtl { this.amount = amount; } - public String getPaytype() { - return paytype; + public String getSourceType() { + return sourceType; } - public void setPaytype(String paytype) { - this.paytype = paytype; + public void setSourceType(String sourceType) { + this.sourceType = sourceType; } public String getPayinfo() { diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TShopdtl.java b/src/main/java/com/supwisdom/dlpay/api/domain/TShopdtl.java index 95a7b0fd..681085dd 100644 --- a/src/main/java/com/supwisdom/dlpay/api/domain/TShopdtl.java +++ b/src/main/java/com/supwisdom/dlpay/api/domain/TShopdtl.java @@ -1,7 +1,5 @@ package com.supwisdom.dlpay.api.domain; -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; - import javax.persistence.*; @Entity @@ -35,8 +33,8 @@ public class TShopdtl { @Column(name = "tradecode", precision = 8) private Integer tradeCode; - @Column(name = "paytype", length = 20) - private String payType; + @Column(name = "sourcetype", length = 20) + private String sourceType; @Column(name = "payinfo", length = 200) private String payInfo; @@ -118,12 +116,12 @@ public class TShopdtl { this.transTime = transTime; } - public String getPayType() { - return payType; + public String getSourceType() { + return sourceType; } - public void setPayType(String payType) { - this.payType = payType; + public void setSourceType(String sourceType) { + this.sourceType = sourceType; } public String getPayInfo() { diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java b/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java new file mode 100644 index 00000000..ef6b4300 --- /dev/null +++ b/src/main/java/com/supwisdom/dlpay/api/domain/TSourceType.java @@ -0,0 +1,88 @@ +package com.supwisdom.dlpay.api.domain; + +import javax.persistence.*; + +/** + * Created by shuwei on 2019/4/9. + */ +@Entity +@Table(name = "TB_SOURCETYPE") +public class TSourceType { + @Id + @Column(name = "PAYTYPE", nullable = false, length = 20) + private String sourceType; + + @Column(name = "ENABLE", nullable = false, length = 20) + private String enable; + + @Column(name = "CHARGE_ENABLE", nullable = false, length = 10) + private String chargeEnable; //充值总开关 + + @Column(name = "CONSUME_ENABLE", nullable = false, length = 10) + private String consumeEnable; //消费总开关 + + @Column(name = "ANONYMOUS_ENABLE", nullable = false, length = 10) + private String anonymousEnable; //匿名消费总开关 + + @Column(name = "checkable") + private Boolean checkable; // 是否需要清算 + + @Column(name = "PAYDESC", length = 200) + private String paydesc; + + public String getSourceType() { + return sourceType; + } + + public void setSourceType(String sourceType) { + this.sourceType = sourceType; + } + + public String getEnable() { + return enable; + } + + public void setEnable(String enable) { + this.enable = enable; + } + + public String getChargeEnable() { + return chargeEnable; + } + + public void setChargeEnable(String chargeEnable) { + this.chargeEnable = chargeEnable; + } + + public String getConsumeEnable() { + return consumeEnable; + } + + public void setConsumeEnable(String consumeEnable) { + this.consumeEnable = consumeEnable; + } + + public String getAnonymousEnable() { + return anonymousEnable; + } + + public void setAnonymousEnable(String anonymousEnable) { + this.anonymousEnable = anonymousEnable; + } + + public String getPaydesc() { + return paydesc; + } + + public void setPaydesc(String paydesc) { + this.paydesc = paydesc; + } + + public Boolean getCheckable() { + return checkable; + } + + public void setCheckable(Boolean checkable) { + this.checkable = checkable; + } +} diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionMain.java b/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionMain.java index fa3fc8d4..bd4a00f9 100644 --- a/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionMain.java +++ b/src/main/java/com/supwisdom/dlpay/api/domain/TTransactionMain.java @@ -38,6 +38,9 @@ public class TTransactionMain { @Column(name = "status", length = 20) private String status = "none"; + @Column(name = "sourcetype", length = 20) + private String sourceType = ""; + @Column(name = "outtradeno", length = 60) private String outTradeNo = ""; @@ -50,6 +53,9 @@ public class TTransactionMain { @Column(name = "OPERTYPE", length = 10) private String opertype; // person - 个人, shop - 商户, operator - 操作员 + @Column(name = "settledate", length = 8) + private String settleDate; + @Column(name = "create_time") private Timestamp createTime; @@ -228,6 +234,22 @@ public class TTransactionMain { this.checkable = checkable; } + public String getSettleDate() { + return settleDate; + } + + public void setSettleDate(String settleDate) { + this.settleDate = settleDate; + } + + public String getSourceType() { + return sourceType; + } + + public void setSourceType(String sourceType) { + this.sourceType = sourceType; + } + public Double sumAmountByAccno(String accno, String subjno, int balanceFlag, String debitOrCredit) { Double debitSum = 0.0; diff --git a/src/main/java/com/supwisdom/dlpay/api/service/PaytypeService.java b/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java similarity index 79% rename from src/main/java/com/supwisdom/dlpay/api/service/PaytypeService.java rename to src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java index 22ca3744..036007de 100644 --- a/src/main/java/com/supwisdom/dlpay/api/service/PaytypeService.java +++ b/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java @@ -1,6 +1,6 @@ package com.supwisdom.dlpay.api.service; -import com.supwisdom.dlpay.api.domain.TPaytype; +import com.supwisdom.dlpay.api.domain.TSourceType; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -9,10 +9,10 @@ import java.util.Map; /** * Created by shuwei on 2019/4/9. */ -public interface PaytypeService { +public interface SourceTypeService { @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class,readOnly = true) - TPaytype getByPaytype(String paytype); + TSourceType getByPaytype(String paytype); @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class,readOnly = true) Map getPaytypeConfigByPaytype(String pattype); diff --git a/src/main/java/com/supwisdom/dlpay/api/service/impl/PaytypeServiceImpl.java b/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java similarity index 80% rename from src/main/java/com/supwisdom/dlpay/api/service/impl/PaytypeServiceImpl.java rename to src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java index d1d1e5c9..a9651a04 100644 --- a/src/main/java/com/supwisdom/dlpay/api/service/impl/PaytypeServiceImpl.java +++ b/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java @@ -2,9 +2,9 @@ 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.domain.TPaytype; +import com.supwisdom.dlpay.api.domain.TSourceType; import com.supwisdom.dlpay.api.domain.TPaytypeConfig; -import com.supwisdom.dlpay.api.service.PaytypeService; +import com.supwisdom.dlpay.api.service.SourceTypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -16,14 +16,14 @@ import java.util.Map; * Created by shuwei on 2019/4/9. */ @Service -public class PaytypeServiceImpl implements PaytypeService { +public class SourceTypeServiceImpl implements SourceTypeService { @Autowired private PaytypeDao paytypeDao; @Autowired private PaytypeConfigDao paytypeConfigDao; @Override - public TPaytype getByPaytype(String paytype) { + public TSourceType getByPaytype(String paytype) { return paytypeDao.getOne(paytype); } 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 eb9f3f40..96e9458f 100644 --- a/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java +++ b/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java @@ -1,7 +1,7 @@ package com.supwisdom.dlpay.system.controller; import com.supwisdom.dlpay.api.bean.JsonResult; -import com.supwisdom.dlpay.api.domain.TPaytype; +import com.supwisdom.dlpay.api.domain.TSourceType; import com.supwisdom.dlpay.api.domain.TPaytypeConfig; import com.supwisdom.dlpay.framework.domain.TApiClient; import com.supwisdom.dlpay.framework.domain.TBusinesspara; @@ -361,9 +361,9 @@ public class ParamController { @GetMapping("/param/paytypelist") @PreAuthorize("hasPermission('/param/paytype','')") @ResponseBody - public PageResult getPaytypeDataList(@RequestParam("page") Integer pageNo, - @RequestParam("limit") Integer pageSize, - @RequestParam(value = "paytype", required = false) String paytype) { + public PageResult getPaytypeDataList(@RequestParam("page") Integer pageNo, + @RequestParam("limit") Integer pageSize, + @RequestParam(value = "paytype", required = false) String paytype) { try { if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT; if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT; @@ -390,7 +390,7 @@ public class ParamController { return JsonResult.error("参数传递错误"); } try { - TPaytype tPaytype = paramService.getPaytype(paytype); + TSourceType tPaytype = paramService.getPaytype(paytype); if (null == tPaytype) { return JsonResult.error("支付方式不存在!"); } @@ -436,7 +436,7 @@ public class ParamController { return JsonResult.error("参数传递错误"); } try { - TPaytype tPaytype = paramService.getPaytype(paytype); + TSourceType tPaytype = paramService.getPaytype(paytype); if (null == tPaytype) { return JsonResult.error("支付方式不存在!"); } @@ -457,7 +457,7 @@ public class ParamController { @ResponseBody public JsonResult deletePaytype(@RequestParam("paytype") String paytype) { try { - TPaytype tPaytype = paramService.getPaytype(paytype); + TSourceType tPaytype = paramService.getPaytype(paytype); if (null == tPaytype) { return JsonResult.error("支付方式不存在!"); } @@ -482,12 +482,12 @@ public class ParamController { @RequestParam(value = "anonymousEnable",required = false,defaultValue = "no") String anonymousEnable, @RequestParam("paydesc") String paydesc) { try { - TPaytype tPaytype = paramService.getPaytype(paytype); + TSourceType tPaytype = paramService.getPaytype(paytype); if (null != tPaytype) { return JsonResult.error("支付方式已经存在"); } - tPaytype = new TPaytype(); - tPaytype.setPaytype(paytype.trim()); + tPaytype = new TSourceType(); + 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); @@ -508,7 +508,7 @@ public class ParamController { @GetMapping("/param/checkpaytype") @ResponseBody public JsonResult checkPaytype(@RequestParam("paytype") String paytype) { - TPaytype tPaytype = paramService.getPaytype(paytype); + TSourceType tPaytype = paramService.getPaytype(paytype); if (null != tPaytype) { return JsonResult.error("支付方式已经存在"); } else { 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 2aba10b3..ed3dde17 100644 --- a/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java +++ b/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java @@ -1,7 +1,7 @@ package com.supwisdom.dlpay.system.controller; import com.supwisdom.dlpay.api.bean.JsonResult; -import com.supwisdom.dlpay.api.domain.TPaytype; +import com.supwisdom.dlpay.api.domain.TSourceType; import com.supwisdom.dlpay.api.domain.TShopPaytype; import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig; import com.supwisdom.dlpay.framework.domain.TShop; @@ -250,7 +250,7 @@ public class ShopController { } try { TShopacc shopacc = shopDataService.getShopaccByAccno(shopaccno.trim()); - TPaytype tPaytype = paramService.getPaytype(paytype.trim()); + TSourceType tPaytype = paramService.getPaytype(paytype.trim()); if (null == shopacc) { return JsonResult.error("商户账户不存在!"); } @@ -263,7 +263,7 @@ public class ShopController { } shopPaytype = new TShopPaytype(); shopPaytype.setShopaccno(shopacc.getShopaccno()); - shopPaytype.setPaytype(tPaytype.getPaytype()); + 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); diff --git a/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java b/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java index 4dedc44e..3d2b0e83 100644 --- a/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java +++ b/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java @@ -1,6 +1,6 @@ package com.supwisdom.dlpay.system.service; -import com.supwisdom.dlpay.api.domain.TPaytype; +import com.supwisdom.dlpay.api.domain.TSourceType; import com.supwisdom.dlpay.api.domain.TPaytypeConfig; import com.supwisdom.dlpay.framework.domain.TApiClient; import com.supwisdom.dlpay.framework.domain.TBusinesspara; @@ -49,16 +49,16 @@ public interface ParamService { boolean deleteApiClient(TApiClient apiClient); @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true) - PageResult getPaytypePage(String paytype, int pageNo, int pageSize); + PageResult getPaytypePage(String paytype, int pageNo, int pageSize); @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true) - TPaytype getPaytype(String paytype); + TSourceType getPaytype(String paytype); @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) - boolean saveOrUpdatePaytype(TPaytype paytype); + boolean saveOrUpdatePaytype(TSourceType paytype); @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) - boolean deletePaytype(TPaytype paytype); + boolean deletePaytype(TSourceType paytype); @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true) List getPaytypeConfigList(String paytype); diff --git a/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java index 63b9f274..b2eb69bd 100644 --- a/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java +++ b/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java @@ -1,6 +1,6 @@ package com.supwisdom.dlpay.system.service; -import com.supwisdom.dlpay.api.domain.TPaytype; +import com.supwisdom.dlpay.api.domain.TSourceType; import com.supwisdom.dlpay.api.domain.TShopPaytype; import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig; import com.supwisdom.dlpay.framework.domain.TShop; @@ -29,7 +29,7 @@ public interface ShopDataService { boolean saveOrUpdateShop(TShop shop) throws WebCheckException; @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true) - List getConsumePaytypes(); + List getConsumePaytypes(); @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true) PageResult getShopPaytypeInfos(String shopaccno, String paytype, int pageNo, int pageSize); 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 72cbb378..e0572367 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 @@ -2,7 +2,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.domain.TPaytype; +import com.supwisdom.dlpay.api.domain.TSourceType; import com.supwisdom.dlpay.api.domain.TPaytypeConfig; import com.supwisdom.dlpay.framework.dao.ApiClientDao; import com.supwisdom.dlpay.framework.dao.BusinessparaDao; @@ -150,7 +150,7 @@ public class ParamServiceImpl implements ParamService { } @Override - public PageResult getPaytypePage(String paytype, int pageNo, int pageSize) { + public PageResult 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)); @@ -159,7 +159,7 @@ public class ParamServiceImpl implements ParamService { } @Override - public TPaytype getPaytype(String paytype) { + public TSourceType getPaytype(String paytype) { if (!StringUtil.isEmpty(paytype)) { return paytypeDao.getByPaytype(paytype.trim()); } @@ -167,7 +167,7 @@ public class ParamServiceImpl implements ParamService { } @Override - public boolean saveOrUpdatePaytype(TPaytype paytype){ + public boolean saveOrUpdatePaytype(TSourceType paytype){ if(null!=paytype){ paytypeDao.save(paytype); return true; @@ -176,7 +176,7 @@ public class ParamServiceImpl implements ParamService { } @Override - public boolean deletePaytype(TPaytype paytype){ + public boolean deletePaytype(TSourceType paytype){ if(null!=paytype){ paytypeDao.delete(paytype); return true; @@ -196,12 +196,12 @@ public class ParamServiceImpl implements ParamService { @Override public boolean savePaytypeConfig(String paytype, Map param) throws WebCheckException { - TPaytype tPaytype = getPaytype(paytype); + TSourceType tPaytype = getPaytype(paytype); if (null == tPaytype) throw new WebCheckException("支付能力[" + paytype + "]不存在"); for (String key : param.keySet()) { String value = param.get(key); - TPaytypeConfig config = paytypeConfigDao.getByPaytypeAndAndConfigid(tPaytype.getPaytype(), key); - if (null == config) throw new WebCheckException("支付能力[" + tPaytype.getPaytype() + "]不存在配置项[" + key + "],请重新查询"); + TPaytypeConfig config = paytypeConfigDao.getByPaytypeAndAndConfigid(tPaytype.getSourceType(), key); + if (null == config) throw new WebCheckException("支付能力[" + tPaytype.getSourceType() + "]不存在配置项[" + key + "],请重新查询"); config.setConfigValue(StringUtil.isEmpty(value) ? null : value.trim()); paytypeConfigDao.save(config); } 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 37101ad0..5136bccc 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 @@ -4,7 +4,7 @@ import com.supwisdom.dlpay.api.dao.PaytypeConfigDao; import com.supwisdom.dlpay.api.dao.PaytypeDao; import com.supwisdom.dlpay.api.dao.ShopPaytypeConfigDao; import com.supwisdom.dlpay.api.dao.ShopPaytypeDao; -import com.supwisdom.dlpay.api.domain.TPaytype; +import com.supwisdom.dlpay.api.domain.TSourceType; import com.supwisdom.dlpay.api.domain.TPaytypeConfig; import com.supwisdom.dlpay.api.domain.TShopPaytype; import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig; @@ -157,12 +157,12 @@ public class ShopDataServiceImpl implements ShopDataService { } @Override - public List getConsumePaytypes() { - List list = paytypeDao.getConsumePaytypes(); + public List getConsumePaytypes() { + List list = paytypeDao.getConsumePaytypes(); if (!StringUtil.isEmpty(list)) { return list; } - return new ArrayList(0); + return new ArrayList(0); } @Override @@ -193,7 +193,7 @@ public class ShopDataServiceImpl implements ShopDataService { TShopacc shopacc = shopaccDao.getByShopaccno(pt.getShopaccno()); bean.setShopname(shopacc == null ? "" : shopacc.getShopname()); bean.setPaytype(pt.getPaytype()); - TPaytype tPaytype = paytypeDao.getByPaytype(pt.getPaytype()); + TSourceType tPaytype = paytypeDao.getByPaytype(pt.getPaytype()); bean.setPaydesc(tPaytype == null ? "" : tPaytype.getPaydesc()); bean.setConsumeEnable(pt.getConsumeEnable()); bean.setAnonymousEnable(pt.getAnonymousEnable()); 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 1b687897..5e8cec59 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 @@ -71,7 +71,7 @@ class ConsumeController { return ResponseEntity.ok(ResponseBodyBuilder.create() .data("refno", dtl.refno) .data("amount", dtl.personDtl.amount) - .data("paytype", dtl.personDtl.paytype) + .data("paytype", dtl.personDtl.sourceType) .data("payinfo", dtl.personDtl.payinfo) .also { if (null != person) { @@ -149,10 +149,11 @@ class ConsumeController { val shopacc = accountUtilServcie.readShopbyShopaccno(param.shopaccno) val builder = TransactionBuilder().apply { - setTransInfo(param.transdate, param.transtime, TradeCode.TRANSCODE_BALANCE_PAY, false) + setTransInfo(param.transdate, param.transtime, + TradeCode.TRANSCODE_BALANCE_PAY, + TradeDict.PAYTYPE_BALANCE) setOutTransInfo(shopacc.shopaccno, param.billno) operator(param.shopaccno, TradeDict.OPERTYPE_SHOP) - paytype = TradeDict.PAYTYPE_BALANCE payinfo = "账户余额消费" description = "账户余额消费" }.person(account).apply { @@ -218,10 +219,11 @@ class ConsumeController { val shopacc = accountUtilServcie.readShopbyShopaccno(param.shopaccno) val subject = accountUtilServcie.readSubject(Subject.SUBJNO_PAY_CITIZEN_CARD) val transaction = TransactionBuilder().apply { - setTransInfo(param.transdate, param.transtime, TradeCode.TRANSCODE_CITIZENCARD_PAY, true) + setTransInfo(param.transdate, param.transtime, + TradeCode.TRANSCODE_CITIZENCARD_PAY, + TradeDict.PAYTYPE_CITIZEN_CARD) setOutTransInfo(shopacc.shopaccno, param.billno) operator(param.shopaccno, TradeDict.OPERTYPE_SHOP) - paytype = TradeDict.PAYTYPE_CITIZEN_CARD payinfo = "市民卡代扣消费" description = "市民卡代扣消费" }.person(account).apply { diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/controller/notify_api_controller.kt b/src/main/kotlin/com/supwisdom/dlpay/api/controller/notify_api_controller.kt index 23376822..d57c96d6 100644 --- a/src/main/kotlin/com/supwisdom/dlpay/api/controller/notify_api_controller.kt +++ b/src/main/kotlin/com/supwisdom/dlpay/api/controller/notify_api_controller.kt @@ -1,7 +1,7 @@ package com.supwisdom.dlpay.api.controller import com.supwisdom.dlpay.api.service.AccountUtilServcie -import com.supwisdom.dlpay.api.service.PaytypeService +import com.supwisdom.dlpay.api.service.SourceTypeService import com.supwisdom.dlpay.api.service.TransactionService import com.supwisdom.dlpay.framework.util.MD5 import com.supwisdom.dlpay.framework.util.StringUtil @@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletResponse class NotifyController { private val logger = LoggerFactory.getLogger(NotifyController::class.java) @Autowired - lateinit var paytypeService: PaytypeService + lateinit var paytypeService: SourceTypeService @Autowired lateinit var accountUtilServcie: AccountUtilServcie diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt b/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt index a972d3fc..48b71059 100644 --- a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt +++ b/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/transaction_service_impl.kt @@ -5,6 +5,7 @@ import com.supwisdom.dlpay.api.dao.* import com.supwisdom.dlpay.api.domain.* import com.supwisdom.dlpay.api.repositories.ShopaccRepositoryImpl import com.supwisdom.dlpay.api.repositories.TAccountRepositoryImpl +import com.supwisdom.dlpay.api.service.SourceTypeService import com.supwisdom.dlpay.api.service.TransactionService import com.supwisdom.dlpay.exception.TransactionCheckException import com.supwisdom.dlpay.exception.TransactionProcessException @@ -41,13 +42,20 @@ class TransactionServiceImpl : TransactionService { @Autowired lateinit var systemUtilService: SystemUtilService + @Autowired + lateinit var sourceTypeService: SourceTypeService + private fun preCheck(builder: TransactionBuilder) { builder.preCheck() + } private fun builderRecords(builder: TransactionBuilder, status: String): TTransactionMain { try { preCheck(builder) + val sourceType = sourceTypeService.getByPaytype(builder.sourceType) + ?: throw TransactionCheckException(TradeErrorCode.BUSINESS_PAYTYPE_NOSUPPORT, + "交易源未定义,sourctype <${builder.sourceType}>") // 记录三方的交易流水(个人,商户,科目) val transaction = TTransactionMain().apply { refno = systemUtilService.refno @@ -58,6 +66,9 @@ class TransactionServiceImpl : TransactionService { operid = builder.operId opertype = builder.operType reverseFlag = builder.tradeType + checkable = sourceType.checkable + checkDate = null + settleDate = null } if (builder.hasPerson()) { @@ -76,7 +87,7 @@ class TransactionServiceImpl : TransactionService { } else { -builder.person().amount } - paytype = builder.person().paytype + this.sourceType = builder.sourceType payinfo = builder.person().payinfo transcode = builder.transCode tradeflag = builder.person().tradeFlag @@ -99,10 +110,11 @@ class TransactionServiceImpl : TransactionService { this.accdate = transaction.accdate this.amount = builder.shop().amount this.payInfo = builder.shop().payinfo - this.payType = builder.shop().paytype + this.sourceType = builder.sourceType this.transDate = builder.transDate this.transTime = builder.transTime this.tradeCode = builder.transCode + this.sourceType = builder.sourceType amount = if (builder.shop().tradeFlag == TradeDict.TRADE_FLAG_IN) { builder.shop().amount } else { @@ -130,7 +142,7 @@ class TransactionServiceImpl : TransactionService { this.accdate = transaction.accdate this.amount = builder.subject().amount this.payInfo = builder.subject().payinfo - this.payType = builder.subject().paytype + this.payType = builder.sourceType this.tradeCode = builder.transCode this.transDate = builder.transDate this.transTime = builder.transTime @@ -153,6 +165,7 @@ class TransactionServiceImpl : TransactionService { this.crsubjno = line.credit.getSubjectNo() this.amount = line.amount this.summary = line.summary + this.settleDate = null } }.apply { transaction.details = this diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/transaction_builder.kt b/src/main/kotlin/com/supwisdom/dlpay/api/transaction_builder.kt index 15a23d43..9dc29acf 100644 --- a/src/main/kotlin/com/supwisdom/dlpay/api/transaction_builder.kt +++ b/src/main/kotlin/com/supwisdom/dlpay/api/transaction_builder.kt @@ -10,11 +10,6 @@ import com.supwisdom.dlpay.framework.util.TradeDict import com.supwisdom.dlpay.framework.util.TradeErrorCode open class SubTransactionBuilder>(val parent: TransactionBuilder) { - var paytype: String = "" - get() { - return if (field.isEmpty()) parent.paytype else field - } - var payinfo: String = "" get() { return if (field.isEmpty()) parent.payinfo else field @@ -146,15 +141,15 @@ class TransactionBuilder { var transCode: Int = 0 //交易码,各明细流水统一 private set - // 是否需要清算的交易 - var checkable: Boolean = false + // 资金来源方案 + var sourceType: String = "" private set - fun setTransInfo(date: String, time: String, code: Int, checkable: Boolean = false): TransactionBuilder { + fun setTransInfo(date: String, time: String, code: Int, sourceType: String): TransactionBuilder { this.transDate = date this.transTime = time this.transCode = code - this.checkable = checkable + this.sourceType = sourceType return this } @@ -195,7 +190,6 @@ class TransactionBuilder { // 以下属性可以在子表中不同 - var paytype: String = "" var payinfo: String = "" var description: String = "" var remark: String = "" @@ -300,6 +294,10 @@ class TransactionBuilder { "操作员类型错误") } + if (sourceType.isEmpty()) { + throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR, + "交易源类型错误") + } if (hasPerson()) { person().also { if (it.tradeFlag !in VALID_TRADEFLAG) { @@ -314,7 +312,7 @@ class TransactionBuilder { throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR, "个人交易对方账户未设置") } - if (it.payinfo.isEmpty() || it.paytype.isEmpty()) { + if (it.payinfo.isEmpty()) { throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR, "个人交易信息未设置") } diff --git a/src/main/resources/templates/system/param/paytype.html b/src/main/resources/templates/system/param/paytype.html index a235ff97..fd065d68 100644 --- a/src/main/resources/templates/system/param/paytype.html +++ b/src/main/resources/templates/system/param/paytype.html @@ -9,7 +9,7 @@
搜索: - @@ -24,34 +24,34 @@ @@ -109,12 +109,12 @@ }); $('#btn-reset-shoppaytype').click(function () { - $("#search-paytype").val(""); + $("#search-sourceType").val(""); form.render('select'); }); $('#btn-search-shoppaytype').click(function(){ - var ptype = $("#search-paytype").val(); - table.reload('shopPaytypeTable', {where: {paytype: ptype, shopaccno:""}, page: {curr: 1}}); + var ptype = $("#search-sourceType").val(); + table.reload('shopPaytypeTable', {where: {sourceType: ptype, shopaccno:""}, page: {curr: 1}}); }); function ondblclick(event, treeId, treeNode) { @@ -122,8 +122,8 @@ layer.msg("请选择结算商户查询", {icon: 2, time: 1000}); return; } - var ptype = $("#search-paytype").val(); - table.reload('shopPaytypeTable', {where: {paytype: ptype, shopaccno: treeNode.shopaccno}, page: {curr: 1}}); + var ptype = $("#search-sourceType").val(); + table.reload('shopPaytypeTable', {where: {sourceType: ptype, shopaccno: treeNode.shopaccno}, page: {curr: 1}}); } // 渲染表格 @@ -162,7 +162,7 @@ sort: true }, {align: 'center', title: '操作', width: 90, fixed: 'right', templet: function (item) { - if (item.paytype != 'balance') { + if (item.sourceType != 'balance') { return '配置'; } return '无配置'; @@ -177,7 +177,7 @@ var token = $("meta[name='_csrf_token']").attr("value"); admin.go('/shop/updatepaytypestat', { shopaccno: obj.elem.value, - paytype: $(obj.elem).attr("def-paytype"), + sourceType: $(obj.elem).attr("def-sourceType"), optype: "consume", state: obj.elem.checked ? 'yes' : 'no', _csrf: token @@ -215,7 +215,7 @@ function updateShopPaytypeState(obj, optype, token) { admin.go('/shop/updatepaytypestat', { shopaccno: obj.elem.value, - paytype: $(obj.elem).attr("def-paytype"), + sourceType: $(obj.elem).attr("def-sourceType"), state: obj.elem.checked ? 'yes' : 'no', optype: optype, _csrf: token @@ -260,7 +260,7 @@ path: '/shop/load4addpaytype', finish: function () { table.reload('shopPaytypeTable', { - where: {paytype: "", shopaccno: shopNode.shopaccno}, + where: {sourceType: "", shopaccno: shopNode.shopaccno}, page: {curr: 1} }); } @@ -273,7 +273,7 @@ if ('config' == obj.event) { admin.popupCenter({ title: "配置参数【" + data.shopname + "_" + data.paydesc + "】", - path: '/shop/load4paytypepara?shopaccno=' + data.shopaccno + '&paytype=' + data.paytype, + path: '/shop/load4paytypepara?shopaccno=' + data.shopaccno + '&sourceType=' + data.sourceType, area: '800px', finish: function () { table.reload('shopPaytypeTable'); diff --git a/src/main/resources/templates/system/shop/configform.html b/src/main/resources/templates/system/shop/configform.html index 9f60ecff..b88732ef 100644 --- a/src/main/resources/templates/system/shop/configform.html +++ b/src/main/resources/templates/system/shop/configform.html @@ -1,4 +1,4 @@ -
+
@@ -14,8 +14,8 @@
-
@@ -59,7 +59,7 @@ // 回显数据 var shop = admin.getTempData('t_addshoppaytype'); if (shop) { - form.val('shop-paytype-form', { + form.val('shop-sourceType-form', { shopaccno: shop.shopaccno, shopname: shop.shopname }); diff --git a/src/main/resources/templates/system/shop/configpara.html b/src/main/resources/templates/system/shop/configpara.html index 231b6ae1..47acb3a1 100644 --- a/src/main/resources/templates/system/shop/configpara.html +++ b/src/main/resources/templates/system/shop/configpara.html @@ -1,7 +1,7 @@ - +