|
|
@@ -1,11 +1,21 @@
|
|
|
package com.zhongshu.card.server.core.service.paySetting;
|
|
|
|
|
|
import com.github.microservice.net.ResultContent;
|
|
|
+import com.github.microservice.types.payment.PaymentChannelType;
|
|
|
+import com.github.microservice.types.payment.PaymentType;
|
|
|
+import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConf;
|
|
|
+import com.zhongshu.card.client.model.paySetting.paySetting.UnionFrictionlessSettingParam;
|
|
|
+import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
|
import com.zhongshu.card.server.core.dao.projectAbout.UnionFrictionlessSettingDao;
|
|
|
import com.zhongshu.card.server.core.domain.base.SuperMain;
|
|
|
+import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
+import com.zhongshu.card.server.core.domain.paySetting.PayChannelConfig;
|
|
|
import com.zhongshu.card.server.core.domain.paySetting.UnionFrictionlessSetting;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -25,15 +35,51 @@ public class UnionFrictionlessSettingService extends SuperService {
|
|
|
@Autowired
|
|
|
private ProjectChannelConfigService projectChannelConfigService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OrganizationDao organizationDao;
|
|
|
+
|
|
|
/**
|
|
|
* 保存数据
|
|
|
*
|
|
|
* @param param
|
|
|
* @return
|
|
|
*/
|
|
|
- public ResultContent saveInfo(UnionFrictionlessSetting param) {
|
|
|
+ public ResultContent saveInfo(UnionFrictionlessSettingParam param) {
|
|
|
+ PaymentType paymentType = param.getPaymentType();
|
|
|
+ if (paymentType == null) {
|
|
|
+ return ResultContent.buildFail("paymentType不能为空");
|
|
|
+ }
|
|
|
+ String projectOid = param.getProjectOid();
|
|
|
+ if (StringUtils.isEmpty(projectOid)) {
|
|
|
+ return ResultContent.buildFail(String.format("projectOid不能为空"));
|
|
|
+ }
|
|
|
+ PayChannelConfig payChannelConfig = projectChannelConfigService.getProjectPayChannel(projectOid, PaymentChannelType.SecretFreePayment);
|
|
|
+ if (ObjectUtils.isEmpty(payChannelConfig)) {
|
|
|
+ return ResultContent.buildFail(String.format("当前项目未配置%s",
|
|
|
+ PaymentChannelType.SecretFreePayment.getRemark()));
|
|
|
+ }
|
|
|
|
|
|
+ Organization projectInfo = organizationDao.findTopByOid(projectOid);
|
|
|
+ if (ObjectUtils.isEmpty(projectInfo)) {
|
|
|
+ return ResultContent.buildFail(String.format("projectOid数据不存在:%s", projectOid));
|
|
|
+ }
|
|
|
+ // 查询已存在的 支付类型的无感支付配置数据
|
|
|
+ UnionFrictionlessSetting entity = unionFrictionlessSettingDao
|
|
|
+ .findTopByProjectInfoAndPaymentType(projectInfo, paymentType);
|
|
|
+ if (paymentType == PaymentType.LakalaFrictionlessPay) {
|
|
|
+ LaKaLaCollectionConf laKaLaCollectionConf = param.getLaKaLaCollectionConf();
|
|
|
+ // 检查数据
|
|
|
+ }
|
|
|
+ if (entity == null) {
|
|
|
+ entity = new UnionFrictionlessSetting();
|
|
|
+ initEntity(entity);
|
|
|
+ }
|
|
|
+ entity.setProjectInfo(projectInfo);
|
|
|
+ entity.setProjectName(projectInfo.getName());
|
|
|
+ entity.setProjectCode(projectInfo.getCode());
|
|
|
|
|
|
+ BeanUtils.copyProperties(param, entity);
|
|
|
+ unionFrictionlessSettingDao.save(entity);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|