|
@@ -55,9 +55,8 @@ public class ProjectChannelConfigService extends SuperService {
|
|
|
if (StringUtils.isEmpty(oid)) {
|
|
if (StringUtils.isEmpty(oid)) {
|
|
|
oid = getCurrentOid();
|
|
oid = getCurrentOid();
|
|
|
}
|
|
}
|
|
|
- Organization orgInfo = organizationDao.findTopByOid(oid);
|
|
|
|
|
PayChannelConfig entity = null;
|
|
PayChannelConfig entity = null;
|
|
|
- PayChannelConfig nameTemp = payChannelConfigDao.findTopByPaymentChannelType(param.getPaymentChannelType());
|
|
|
|
|
|
|
+ PayChannelConfig nameTemp = payChannelConfigDao.findTopByPaymentType(param.getPaymentType());
|
|
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(param.getId())) {
|
|
if (ObjectUtils.isNotEmpty(param.getId())) {
|
|
|
entity = payChannelConfigDao.findTopById(param.getId());
|
|
entity = payChannelConfigDao.findTopById(param.getId());
|
|
@@ -77,11 +76,7 @@ public class ProjectChannelConfigService extends SuperService {
|
|
|
entity.setIsDelete(Boolean.FALSE);
|
|
entity.setIsDelete(Boolean.FALSE);
|
|
|
initEntityNoOid(entity);
|
|
initEntityNoOid(entity);
|
|
|
}
|
|
}
|
|
|
- BeanUtils.copyProperties(param, entity);
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(orgInfo)) {
|
|
|
|
|
- entity.setProjectOid(orgInfo.getOid());
|
|
|
|
|
- entity.setAboutAuthType(orgInfo.getAuthType());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ BeanUtils.copyPropertiesWithoutNull(param, entity);
|
|
|
entity.setOid(oid);
|
|
entity.setOid(oid);
|
|
|
entity.setAboutOid(oid);
|
|
entity.setAboutOid(oid);
|
|
|
payChannelConfigDao.save(entity);
|
|
payChannelConfigDao.save(entity);
|
|
@@ -92,30 +87,30 @@ public class ProjectChannelConfigService extends SuperService {
|
|
|
if (StringUtils.isEmpty(param.getId())) {
|
|
if (StringUtils.isEmpty(param.getId())) {
|
|
|
return ResultContent.buildFail("id不能为空");
|
|
return ResultContent.buildFail("id不能为空");
|
|
|
}
|
|
}
|
|
|
- PayChannelConfig channelConfig = payChannelConfigDao.findTopByPaymentChannelType(param.getPaymentChannelType());
|
|
|
|
|
|
|
+ PayChannelConfig channelConfig = payChannelConfigDao.findTopByPaymentType(param.getPaymentType());
|
|
|
if (ObjectUtils.isEmpty(channelConfig)) {
|
|
if (ObjectUtils.isEmpty(channelConfig)) {
|
|
|
return ResultContent.buildFail("数据不存在");
|
|
return ResultContent.buildFail("数据不存在");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- BeanUtils.copyProperties(param, channelConfig, "paymentChannelType");
|
|
|
|
|
|
|
+ BeanUtils.copyProperties(param, channelConfig, "paymentChannelType", "paymentType");
|
|
|
initUpdateEntity(channelConfig);
|
|
initUpdateEntity(channelConfig);
|
|
|
payChannelConfigDao.save(channelConfig);
|
|
payChannelConfigDao.save(channelConfig);
|
|
|
return ResultContent.buildSuccess();
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public ResultContent initAllChannel() {
|
|
public ResultContent initAllChannel() {
|
|
|
- // 免密支付
|
|
|
|
|
|
|
+ // 免密支付 拉卡拉
|
|
|
PayChannelConfigParam param = new PayChannelConfigParam();
|
|
PayChannelConfigParam param = new PayChannelConfigParam();
|
|
|
param.setName("免密支付");
|
|
param.setName("免密支付");
|
|
|
param.setPaymentChannelType(PaymentChannelType.SecretFreePayment);
|
|
param.setPaymentChannelType(PaymentChannelType.SecretFreePayment);
|
|
|
- param.setPaymentTypes(List.of(PaymentType.LakalaFrictionlessPay));
|
|
|
|
|
|
|
+ param.setPaymentType(PaymentType.LakalaFrictionlessPay);
|
|
|
savePayChannelConfig(param);
|
|
savePayChannelConfig(param);
|
|
|
|
|
|
|
|
|
|
+ // 余额支付 微信充值
|
|
|
PayChannelConfigParam balanceParam = new PayChannelConfigParam();
|
|
PayChannelConfigParam balanceParam = new PayChannelConfigParam();
|
|
|
balanceParam.setName("余额支付");
|
|
balanceParam.setName("余额支付");
|
|
|
balanceParam.setPaymentChannelType(PaymentChannelType.BalancePayment);
|
|
balanceParam.setPaymentChannelType(PaymentChannelType.BalancePayment);
|
|
|
balanceParam.setSort(2L);
|
|
balanceParam.setSort(2L);
|
|
|
- balanceParam.setPaymentTypes(List.of(PaymentType.WeChat));
|
|
|
|
|
|
|
+ balanceParam.setPaymentType(PaymentType.WeChat);
|
|
|
savePayChannelConfig(balanceParam);
|
|
savePayChannelConfig(balanceParam);
|
|
|
|
|
|
|
|
return ResultContent.buildSuccess();
|
|
return ResultContent.buildSuccess();
|
|
@@ -163,25 +158,18 @@ public class ProjectChannelConfigService extends SuperService {
|
|
|
return ResultContent.buildSuccess(toModel(entity));
|
|
return ResultContent.buildSuccess(toModel(entity));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 得到项目渠道配置
|
|
|
|
|
- *
|
|
|
|
|
- * @param paymentChannelType
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- public PayChannelConfig getProjectPayChannel(PaymentChannelType paymentChannelType) {
|
|
|
|
|
- PayChannelConfig entity = payChannelConfigDao.findTopByPaymentChannelType(paymentChannelType);
|
|
|
|
|
- return entity;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public PayChannelConfig getProjectPayChannel(PaymentType paymentType) {
|
|
public PayChannelConfig getProjectPayChannel(PaymentType paymentType) {
|
|
|
if (paymentType == null) {
|
|
if (paymentType == null) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- PayChannelConfig entity = payChannelConfigDao.findTopByPaymentChannelType(paymentType.getChannelType());
|
|
|
|
|
|
|
+ PayChannelConfig entity = payChannelConfigDao.findTopByPaymentType(paymentType);
|
|
|
return entity;
|
|
return entity;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public PayChannelConfigModel getProjectPayChannelModel(PaymentType paymentType) {
|
|
|
|
|
+ return toModel(getProjectPayChannel(paymentType));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public ResultContent changeState(String id, DataState state) {
|
|
public ResultContent changeState(String id, DataState state) {
|
|
|
PayChannelConfig entity = payChannelConfigDao.findTopById(id);
|
|
PayChannelConfig entity = payChannelConfigDao.findTopById(id);
|
|
|
if (ObjectUtils.isEmpty(entity)) {
|
|
if (ObjectUtils.isEmpty(entity)) {
|
|
@@ -215,24 +203,6 @@ public class ProjectChannelConfigService extends SuperService {
|
|
|
if (ObjectUtils.isNotEmpty(entity)) {
|
|
if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
model = new PayChannelConfigModel();
|
|
model = new PayChannelConfigModel();
|
|
|
BeanUtils.copyProperties(entity, model);
|
|
BeanUtils.copyProperties(entity, model);
|
|
|
-
|
|
|
|
|
- List<PaymentType> paymentTypes = entity.getPaymentTypes();
|
|
|
|
|
- if (ObjectUtils.isEmpty(paymentTypes)) {
|
|
|
|
|
- paymentTypes = new ArrayList<>(paymentTypes);
|
|
|
|
|
- }
|
|
|
|
|
- // 可用的支付渠道
|
|
|
|
|
- List<PaymentTypeModel> canUseAblePaymentTypes = new ArrayList<>();
|
|
|
|
|
- for (PaymentType paymentType : PaymentType.values()) {
|
|
|
|
|
- if (paymentType.getChannelType() != null && entity.getPaymentChannelType() == paymentType.getChannelType()) {
|
|
|
|
|
- PaymentTypeModel typeModel = new PaymentTypeModel();
|
|
|
|
|
- typeModel.setPaymentType(paymentType);
|
|
|
|
|
- if (paymentTypes.contains(paymentType)) {
|
|
|
|
|
- typeModel.setIsChecked(Boolean.TRUE);
|
|
|
|
|
- }
|
|
|
|
|
- canUseAblePaymentTypes.add(typeModel);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- model.setCanUseAblePaymentTypes(canUseAblePaymentTypes);
|
|
|
|
|
}
|
|
}
|
|
|
return model;
|
|
return model;
|
|
|
}
|
|
}
|