|
|
@@ -278,6 +278,8 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
|
|
|
// 如果当前设置为默认,把其他的取消默认
|
|
|
initChangeDefault(settingInfo.getId(), settingInfo.getBelongOig(), settingInfo.getProjectOid(), settingInfo.getChannelType());
|
|
|
+
|
|
|
+ upsertOrgAccount(settingInfo);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -331,6 +333,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
projectPaySettingInfoDao.save(settingInfo);
|
|
|
// 如果当前设置为默认,把其他的取消默认
|
|
|
initChangeDefault(settingInfo.getId(), settingInfo.getBelongOig(), settingInfo.getProjectOid(), settingInfo.getChannelType());
|
|
|
+ upsertOrgAccount(settingInfo);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -360,6 +363,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
|
|
|
// 如果当前设置为默认,把其他的取消默认
|
|
|
initChangeDefault(settingInfo.getId(), settingInfo.getBelongOig(), settingInfo.getProjectOid(), settingInfo.getChannelType());
|
|
|
+ upsertOrgAccount(settingInfo);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -596,7 +600,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
* @return
|
|
|
*/
|
|
|
public ResultContent upsertPayAccount(String projectOid, PaymentType paymentType) {
|
|
|
- log.info("upsertPayAccount 维护支付中心的支付账号");
|
|
|
+ log.info("upsertPayAccount 维护项目支付中心的支付账号");
|
|
|
ProjectMainPaySetting projectMainPaySetting = projectMainPaySettingDao.findTopByProjectOidAndChannelType(projectOid, paymentType);
|
|
|
if (ObjectUtils.isEmpty(projectMainPaySetting)) {
|
|
|
log.error("upsertPayAccount 项目未配置; {} {}", paymentType.getRemark(), projectOid);
|
|
|
@@ -688,10 +692,89 @@ public class ProjectPaySettingServiceImpl extends SuperService {
|
|
|
accountModel.setRemark(remark);
|
|
|
com.github.microservice.pay.client.ret.ResultContent<Void> resultContent = payProductAccountService.upsert(accountModel);
|
|
|
if (resultContent.getState() == ResultState.Success) {
|
|
|
- log.info("更新支付产品账户成功... disable {}", disable);
|
|
|
+ log.info("更新项目支付产品账户成功... disable {}", disable);
|
|
|
orgPayAccountService.saveProjectAccount(projectOid, paymentType, accountModel.getProductChannelType());
|
|
|
} else {
|
|
|
- log.error("更新支付产品账户出错: {}", resultContent.getMsg());
|
|
|
+ log.error("更新项目支付产品账户出错: {}", resultContent.getMsg());
|
|
|
+ }
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始结构支付账户
|
|
|
+ *
|
|
|
+ * @param entity
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ResultContent upsertOrgAccount(ProjectOrgPaySettingInfo entity) {
|
|
|
+ log.info("维护机构的支付中心的支付账号");
|
|
|
+ if (ObjectUtils.isEmpty(entity)) {
|
|
|
+ log.error("upsertPayAccount 关联机构支付配置为空");
|
|
|
+ return ResultContent.buildFail("关联机构支付配置为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ String belongOig = entity.getBelongOig();
|
|
|
+ PaymentType paymentType = entity.getChannelType();
|
|
|
+ String payAccountName = orgPayAccountService.buildPayAccountName(belongOig, paymentType);
|
|
|
+
|
|
|
+ AccountModel accountModel = new AccountModel();
|
|
|
+ accountModel.setName(payAccountName);
|
|
|
+
|
|
|
+ String remark = "";
|
|
|
+ Boolean disable = Boolean.FALSE;
|
|
|
+ if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
+ if (paymentType == PaymentType.WeChat) {
|
|
|
+ // 微信支付
|
|
|
+ accountModel.setProductChannelType(PayProductChannelType.WeChatMiniAppPay);
|
|
|
+
|
|
|
+ WeChatMiniAppConf appConf = new WeChatMiniAppConf();
|
|
|
+ WxPayConfigModel model = (WxPayConfigModel) entity.getPayConfig();
|
|
|
+ appConf.setAppId(model.getAppId());
|
|
|
+ appConf.setMchId(model.getMchId());
|
|
|
+ appConf.setMchSerialNo(model.getMchSerialNo());
|
|
|
+ appConf.setPriKeyPath(model.getPrivateKeyStr());
|
|
|
+ appConf.setApiV3KeyPath(model.getApiV3Key());
|
|
|
+ appConf.setNotifyUrl(model.getNotifyUrl());
|
|
|
+ accountModel.setConf(appConf);
|
|
|
+ } else if (paymentType == PaymentType.UnionFrictionlessPay) {
|
|
|
+ // 银联无感支付
|
|
|
+ accountModel.setProductChannelType(PayProductChannelType.ChinaumsSenseless);
|
|
|
+
|
|
|
+ FrictionlessUnionConfigModel model = (FrictionlessUnionConfigModel) entity.getPayConfig();
|
|
|
+ // 支付中心
|
|
|
+ ChinaumsSenselessConf appConf = new ChinaumsSenselessConf();
|
|
|
+ appConf.setAppId(model.getAppId());
|
|
|
+ appConf.setAppKey(model.getAppKey());
|
|
|
+ appConf.setOrderNoPrefix(model.getOrderStart());
|
|
|
+ appConf.setMchId(model.getMchId());
|
|
|
+ appConf.setTerminalNo(model.getTid());
|
|
|
+ appConf.setPlanId(model.getPlanId());
|
|
|
+ appConf.setSecretKey(model.getNotifySecret());
|
|
|
+ appConf.setNotifyUrl(model.getNotifyUrl());
|
|
|
+
|
|
|
+ accountModel.setConf(appConf);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!disable) {
|
|
|
+ // 机构配置为开启
|
|
|
+ if (entity.getState() == null || entity.getState() != DataState.Enable) {
|
|
|
+ disable = Boolean.TRUE;
|
|
|
+ remark = "机构配置未启用";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 不可用
|
|
|
+ disable = Boolean.TRUE;
|
|
|
+ remark = "机构的账户信息不存在";
|
|
|
+ }
|
|
|
+ accountModel.setDisable(disable);
|
|
|
+ accountModel.setRemark(remark);
|
|
|
+ com.github.microservice.pay.client.ret.ResultContent<Void> resultContent = payProductAccountService.upsert(accountModel);
|
|
|
+ if (resultContent.getState() == ResultState.Success) {
|
|
|
+ log.info("更新机构支付产品账户成功... disable {}", disable);
|
|
|
+ orgPayAccountService.saveProjectAccount(belongOig, paymentType, accountModel.getProductChannelType());
|
|
|
+ } else {
|
|
|
+ log.error("更新机构支付产品账户出错: {}", resultContent.getMsg());
|
|
|
}
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|