|
|
@@ -253,51 +253,14 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
* @return
|
|
|
*/
|
|
|
public ResultContent<WxPayConfigModel> getProjectWxConfig(String projectOid) {
|
|
|
- // 平台的
|
|
|
- String payName = PaymentType.WeChat.getRemark();
|
|
|
- PayChannelConfig channelConfig = payChannelConfigDao.findTopByPaymentType(PaymentType.WeChat);
|
|
|
- if (ObjectUtils.isEmpty(channelConfig)) {
|
|
|
- return ResultContent.buildFail(String.format("平台不支持%s", payName));
|
|
|
- }
|
|
|
- if (channelConfig.getState() == null || channelConfig.getState() != DataState.Enable) {
|
|
|
- return ResultContent.buildFail(String.format("平台%s未启用", payName));
|
|
|
- }
|
|
|
- // 项目的
|
|
|
- ProjectPaySetting paySetting = projectPaySettingDao.findTopByProjectOidAndChannelType(projectOid, PaymentType.WeChat);
|
|
|
-
|
|
|
- // 配置的
|
|
|
- List<ProjectPaySettingInfo> list = projectPaySettingInfoDao.findByProjectOidAndChannelType(projectOid, PaymentType.WeChat);
|
|
|
- if (ObjectUtils.isEmpty(list)) {
|
|
|
- return ResultContent.buildFail(String.format("项目未配置%s", payName));
|
|
|
+ ResultContent<ProjectPaySettingInfo> content = getProjectConfig(projectOid, PaymentType.WeChat);
|
|
|
+ if (content.isFailed()) {
|
|
|
+ return ResultContent.buildFail(content.getMsg());
|
|
|
}
|
|
|
- WxPayConfigModel model = new WxPayConfigModel();
|
|
|
+ WxPayConfigModel model = (WxPayConfigModel) content.getContent().getPayConfig();
|
|
|
return ResultContent.buildSuccess(model);
|
|
|
}
|
|
|
|
|
|
- public ResultContent<ProjectPaySettingInfo> getProjectConfig(String projectOid, PaymentType paymentType) {
|
|
|
- if (paymentType == null) {
|
|
|
- return ResultContent.buildFail("PaymentType未指定");
|
|
|
- }
|
|
|
- // 平台的
|
|
|
- String payName = PaymentType.WeChat.getRemark();
|
|
|
- PayChannelConfig channelConfig = payChannelConfigDao.findTopByPaymentType(PaymentType.WeChat);
|
|
|
- if (ObjectUtils.isEmpty(channelConfig)) {
|
|
|
- return ResultContent.buildFail(String.format("平台不支持%s", payName));
|
|
|
- }
|
|
|
- if (channelConfig.getState() == null || channelConfig.getState() != DataState.Enable) {
|
|
|
- return ResultContent.buildFail(String.format("平台%s未启用", payName));
|
|
|
- }
|
|
|
- // 项目的
|
|
|
- ProjectPaySetting paySetting = projectPaySettingDao.findTopByProjectOidAndChannelType(projectOid, PaymentType.WeChat);
|
|
|
-
|
|
|
- // 配置的
|
|
|
- List<ProjectPaySettingInfo> list = projectPaySettingInfoDao.findByProjectOidAndChannelType(projectOid, PaymentType.WeChat);
|
|
|
- if (ObjectUtils.isEmpty(list)) {
|
|
|
- return ResultContent.buildFail(String.format("项目未配置%s", payName));
|
|
|
- }
|
|
|
- ProjectPaySettingInfo paySettingInfo = list.get(0);
|
|
|
- return ResultContent.buildSuccess(paySettingInfo);
|
|
|
- }
|
|
|
//-----------------------------拉卡拉配置 start-------------------
|
|
|
|
|
|
/**
|
|
|
@@ -396,11 +359,6 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
- public ProjectPaySetting getProjectPaySetting(String projectOid, PaymentType paymentType) {
|
|
|
- return projectPaySettingDao.findTopByProjectOidAndChannelType(projectOid, paymentType);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
public ProjectPaySettingModel toModel(ProjectPaySetting entity) {
|
|
|
ProjectPaySettingModel model = null;
|
|
|
if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
@@ -408,53 +366,15 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
BeanUtils.copyProperties(entity, model);
|
|
|
// 关联的支付产品信息
|
|
|
model.setPayChannelConfigModel(projectChannelConfigService.getProjectPayChannelModel(entity.getChannelType()));
|
|
|
- }
|
|
|
- return model;
|
|
|
- }
|
|
|
-
|
|
|
- public ProjectPaySettingModel toAllModel(ProjectPaySetting entity) {
|
|
|
- ProjectPaySettingAllModel model = null;
|
|
|
- if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
- model = new ProjectPaySettingAllModel();
|
|
|
- BeanUtils.copyProperties(entity, model);
|
|
|
- // 关联的支付产品信息
|
|
|
- model.setPayChannelConfigModel(projectChannelConfigService.getProjectPayChannelModel(entity.getChannelType()));
|
|
|
-
|
|
|
- if (entity.getChannelType() == PaymentType.WeChat) {
|
|
|
- model.setFields(getWxConfig());
|
|
|
+ // 判断是否完成配置
|
|
|
+ ProjectPaySettingInfo settingInfo = projectPaySettingInfoDao.findTopByProjectOidAndChannelTypeAndIsDefault(entity.getProjectOid(), entity.getChannelType(), Boolean.TRUE);
|
|
|
+ if (ObjectUtils.isNotEmpty(settingInfo)) {
|
|
|
+ model.setIsConfig(Boolean.TRUE);
|
|
|
}
|
|
|
}
|
|
|
return model;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 检查项目是否支持 指定的付款方式
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- public ResultContent checkProjectSupportPayment(String projectOid, PaymentType paymentType) {
|
|
|
- if (paymentType == null) {
|
|
|
- return ResultContent.buildFail("支付方式为空");
|
|
|
- }
|
|
|
- // 检查平台设置产品没
|
|
|
- PayChannelConfig payChannelConfig = projectChannelConfigService.getProjectPayChannel(paymentType);
|
|
|
- if (ObjectUtils.isEmpty(payChannelConfig)) {
|
|
|
- ResultContent.buildFail(String.format("平台未配置%s", paymentType.getChannelType().getRemark()));
|
|
|
- }
|
|
|
- if (ObjectUtils.isEmpty(payChannelConfig)) {
|
|
|
- return ResultContent.buildFail(String.format("%s支付产品不支持%s", payChannelConfig.getName(), paymentType.getRemark()));
|
|
|
- }
|
|
|
- if (payChannelConfig.getState() != DataState.Enable) {
|
|
|
- return ResultContent.buildFail(String.format("支付产品%s%s", payChannelConfig.getName(), payChannelConfig.getState().getRemark()));
|
|
|
- }
|
|
|
- // 检查项目配置参数没
|
|
|
- ProjectPaySetting paySetting = getProjectPaySetting(projectOid, paymentType);
|
|
|
- if (ObjectUtils.isEmpty(paySetting)) {
|
|
|
- return ResultContent.buildFail(String.format("项目为配置%s参数", paymentType.getRemark()));
|
|
|
- }
|
|
|
- return ResultContent.buildSuccess();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 得到字段
|
|
|
*
|
|
|
@@ -506,4 +426,43 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
return model;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 得到项目的对应支付渠道的 参数配置
|
|
|
+ *
|
|
|
+ * @param projectOid
|
|
|
+ * @param paymentType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ResultContent<ProjectPaySettingInfo> getProjectConfig(String projectOid, PaymentType paymentType) {
|
|
|
+ if (paymentType == null) {
|
|
|
+ return ResultContent.buildFail("PaymentType未指定");
|
|
|
+ }
|
|
|
+ // 平台的
|
|
|
+ String payName = paymentType.getRemark();
|
|
|
+ PayChannelConfig channelConfig = payChannelConfigDao.findTopByPaymentType(paymentType);
|
|
|
+ if (ObjectUtils.isEmpty(channelConfig)) {
|
|
|
+ return ResultContent.buildFail(String.format("平台不支持%s", payName));
|
|
|
+ }
|
|
|
+ if (channelConfig.getState() == null || channelConfig.getState() != DataState.Enable) {
|
|
|
+ return ResultContent.buildFail(String.format("平台%s未启用", payName));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 项目的
|
|
|
+ ProjectPaySetting paySetting = projectPaySettingDao.findTopByProjectOidAndChannelType(projectOid, paymentType);
|
|
|
+ if (ObjectUtils.isEmpty(paySetting)) {
|
|
|
+ return ResultContent.buildFail(String.format("项目未配置%s", payName));
|
|
|
+ }
|
|
|
+ if (paySetting.getState() == null || paySetting.getState() != DataState.Enable) {
|
|
|
+ return ResultContent.buildFail(String.format("项目 %s未启动", payName));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 配置的
|
|
|
+ ProjectPaySettingInfo paySettingInfo = projectPaySettingInfoDao.findTopByProjectOidAndChannelTypeAndIsDefault(
|
|
|
+ projectOid, paymentType, Boolean.TRUE);
|
|
|
+ if (ObjectUtils.isEmpty(paySettingInfo)) {
|
|
|
+ return ResultContent.buildFail(String.format("%s没有默认的支付参数", payName));
|
|
|
+ }
|
|
|
+ return ResultContent.buildSuccess(paySettingInfo);
|
|
|
+ }
|
|
|
+
|
|
|
}
|