|
|
@@ -2,6 +2,7 @@ package com.zhongshu.card.server.core.service.paySetting;
|
|
|
|
|
|
import com.github.microservice.auth.security.type.AuthType;
|
|
|
import com.github.microservice.net.ResultMessage;
|
|
|
+import com.github.microservice.types.payment.PayFieldType;
|
|
|
import com.github.microservice.types.payment.PaymentType;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
|
import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConfig;
|
|
|
@@ -114,8 +115,14 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
configModel = new WxPayConfigModel();
|
|
|
}
|
|
|
BeanUtils.copyProperties(param, configModel);
|
|
|
- configModel.setPrivateKeyStr(AesUtils.turnMultipartFileToString(param.getPrivateKeyFile()));
|
|
|
-
|
|
|
+ String privateKeyStr = AesUtils.turnMultipartFileToString(param.getPrivateKeyFile());
|
|
|
+ if (StringUtils.isNotEmpty(privateKeyStr)) {
|
|
|
+ configModel.setPrivateKeyStr(privateKeyStr);
|
|
|
+ }
|
|
|
+ configModel.setPrivateKeyType("str");
|
|
|
+ if (StringUtils.isNotEmpty(configModel.getPrivateKeyStr())) {
|
|
|
+ return ResultContent.buildFail("证书文件为空");
|
|
|
+ }
|
|
|
return saveProjectPaySetting(param.getProjectOid(), PaymentType.WeChat, configModel);
|
|
|
}
|
|
|
|
|
|
@@ -129,6 +136,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
WxPayConfigModel model = null;
|
|
|
ProjectPaySetting paySetting = getProjectPaySetting(projectOid, PaymentType.WeChat);
|
|
|
if (ObjectUtils.isNotEmpty(paySetting)) {
|
|
|
+
|
|
|
model = (WxPayConfigModel) paySetting.getPayConfig();
|
|
|
}
|
|
|
return ResultContent.buildSuccess(model);
|
|
|
@@ -265,6 +273,21 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return model;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 检查项目是否支持 指定的付款方式
|
|
|
*
|
|
|
@@ -294,4 +317,16 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 得到微信支付需要的字段
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<PayConfigField> getWxConfig() {
|
|
|
+ List<PayConfigField> fields = new ArrayList<>(4);
|
|
|
+ PayConfigField.builder().name("").key("").type(PayFieldType.Str).isMust(Boolean.TRUE).build();
|
|
|
+
|
|
|
+
|
|
|
+ return fields;
|
|
|
+ }
|
|
|
}
|