|
|
@@ -1,10 +1,14 @@
|
|
|
package com.zhongshu.card.server.core.service.paySetting;
|
|
|
|
|
|
import com.github.microservice.net.ResultContent;
|
|
|
+import com.github.microservice.types.payment.PaymentType;
|
|
|
import com.zhongshu.card.client.type.DataState;
|
|
|
+import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
|
import com.zhongshu.card.server.core.dao.projectAbout.ProjectMainPaySettingDao;
|
|
|
import com.zhongshu.card.server.core.dao.projectAbout.ProjectOrgPaySettingInfoDao;
|
|
|
import com.zhongshu.card.server.core.dao.projectAbout.ProjectPaySettingDao;
|
|
|
+import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
+import com.zhongshu.card.server.core.domain.paySetting.ProjectOrgPaySettingInfo;
|
|
|
import com.zhongshu.card.server.core.domain.paySetting.ProjectPaySetting;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -34,6 +38,9 @@ public class OrgPaySettingJudgmentService extends SuperService {
|
|
|
@Autowired
|
|
|
private ProjectPaySettingDao projectPaySettingDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OrganizationDao organizationDao;
|
|
|
+
|
|
|
public ResultContent checkOrgPaySetting(String projectOid, String oid) {
|
|
|
// 检查项目上是否设置了支付产品
|
|
|
List<ProjectPaySetting> list = projectPaySettingDao.findByProjectOid(projectOid);
|
|
|
@@ -46,7 +53,22 @@ public class OrgPaySettingJudgmentService extends SuperService {
|
|
|
if (ObjectUtils.isEmpty(enableList)) {
|
|
|
return ResultContent.buildFail("项目上未启用支付产品");
|
|
|
}
|
|
|
-
|
|
|
+ Organization organization = organizationDao.findTopByOid(oid);
|
|
|
+ if (ObjectUtils.isEmpty(organization)) {
|
|
|
+ return ResultContent.buildFail(String.format("机构不存在"));
|
|
|
+ }
|
|
|
+ // 检查机构
|
|
|
+ for (ProjectPaySetting paySetting : enableList) {
|
|
|
+ if (paySetting.getChannelType() != PaymentType.WeChat) {
|
|
|
+ ProjectOrgPaySettingInfo projectOrgPaySettingInfo = projectPaySettingInfoDao.findTopByBelongOigAndProjectOidAndChannelType(oid, projectOid, paySetting.getChannelType());
|
|
|
+ if (ObjectUtils.isEmpty(projectOrgPaySettingInfo)) {
|
|
|
+ return ResultContent.buildFail(String.format("【%s】支付设备未配置%s", organization.getName(), paySetting.getChannelType().getRemark()));
|
|
|
+ }
|
|
|
+ if (projectOrgPaySettingInfo.getIsDefault() != null && projectOrgPaySettingInfo.getIsDefault()) {
|
|
|
+ return ResultContent.buildFail("不能绑定主账户");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|