|
|
@@ -60,9 +60,6 @@ public class ProjectChannelConfigService extends SuperService {
|
|
|
oid = getCurrentOid();
|
|
|
}
|
|
|
Organization orgInfo = organizationDao.findTopByOid(oid);
|
|
|
- if (ObjectUtils.isEmpty(orgInfo)) {
|
|
|
- return ResultContent.buildFail(String.format("oid不存在:%s", oid));
|
|
|
- }
|
|
|
PayChannelConfig entity = null;
|
|
|
PayChannelConfig nameTemp = payChannelConfigDao.findTopByPaymentChannelType(param.getPaymentChannelType());
|
|
|
|
|
|
@@ -85,17 +82,47 @@ public class ProjectChannelConfigService extends SuperService {
|
|
|
initEntityNoOid(entity);
|
|
|
}
|
|
|
BeanUtils.copyProperties(param, entity);
|
|
|
- entity.setProjectInfo(orgInfo);
|
|
|
- entity.setProjectName(orgInfo.getName());
|
|
|
- entity.setProjectCode(orgInfo.getCode());
|
|
|
- entity.setProjectOid(orgInfo.getOid());
|
|
|
+ if (ObjectUtils.isNotEmpty(orgInfo)) {
|
|
|
+ entity.setProjectOid(orgInfo.getOid());
|
|
|
+ entity.setAboutAuthType(orgInfo.getAuthType());
|
|
|
+ }
|
|
|
entity.setOid(oid);
|
|
|
entity.setAboutOid(oid);
|
|
|
- entity.setAboutAuthType(orgInfo.getAuthType());
|
|
|
payChannelConfigDao.save(entity);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
+ public ResultContent updatePayChannelConfig(PayChannelConfigParam param) {
|
|
|
+ if (StringUtils.isEmpty(param.getId())) {
|
|
|
+ return ResultContent.buildFail("id不能为空");
|
|
|
+ }
|
|
|
+ PayChannelConfig channelConfig = payChannelConfigDao.findTopByPaymentChannelType(param.getPaymentChannelType());
|
|
|
+ if (ObjectUtils.isEmpty(channelConfig)) {
|
|
|
+ return ResultContent.buildFail("数据不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ BeanUtils.copyProperties(param, channelConfig, "paymentChannelType");
|
|
|
+ initUpdateEntity(channelConfig);
|
|
|
+ payChannelConfigDao.save(channelConfig);
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultContent initAllChannel() {
|
|
|
+ // 免密支付
|
|
|
+ PayChannelConfigParam param = new PayChannelConfigParam();
|
|
|
+ param.setName("免密支付");
|
|
|
+ param.setPaymentChannelType(PaymentChannelType.SecretFreePayment);
|
|
|
+ savePayChannelConfig(param);
|
|
|
+
|
|
|
+ PayChannelConfigParam balanceParam = new PayChannelConfigParam();
|
|
|
+ balanceParam.setName("余额支付");
|
|
|
+ balanceParam.setPaymentChannelType(PaymentChannelType.BalancePayment);
|
|
|
+ balanceParam.setSort(2L);
|
|
|
+ savePayChannelConfig(balanceParam);
|
|
|
+
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 分页列表
|
|
|
*
|
|
|
@@ -187,12 +214,19 @@ public class ProjectChannelConfigService extends SuperService {
|
|
|
model = new PayChannelConfigModel();
|
|
|
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);
|
|
|
}
|
|
|
}
|