|
|
@@ -36,6 +36,7 @@ import com.zhongshu.card.server.core.domain.payment.ExpenseFlow;
|
|
|
import com.zhongshu.card.server.core.model.pay.UnionFrictionlessPayFinishModel;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.paySetting.OrgPayAccountService;
|
|
|
+import com.zhongshu.card.server.core.service.paySetting.ProjectMainPaySettingService;
|
|
|
import com.zhongshu.card.server.core.service.payment.PayCallService;
|
|
|
import com.zhongshu.card.server.core.util.BeanUtils;
|
|
|
import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
@@ -78,6 +79,9 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
@Autowired
|
|
|
ExecQueueService execQueueService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProjectMainPaySettingService projectMainPaySettingService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 银联申请签约
|
|
|
@@ -177,14 +181,18 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
return ResultContent.buildFail("银联请求失败");
|
|
|
}
|
|
|
|
|
|
- public boolean isSigned(String projectOid, String userId){
|
|
|
- String accountName = orgPayAccountService.queryOgPayAccount(projectOid, PaymentType.UnionFrictionlessPay);
|
|
|
- com.github.microservice.pay.client.ret.ResultContent<AccountModel> accountModelResultContent = payProductAccountService.get(accountName);
|
|
|
- if (!accountModelResultContent.getState().equals(ResultState.Success)) {
|
|
|
- throw new RuntimeException(accountModelResultContent.getMsg());
|
|
|
+ public boolean isSigned(String projectOid, String userId) {
|
|
|
+// String accountName = orgPayAccountService.queryOgPayAccount(projectOid, PaymentType.UnionFrictionlessPay);
|
|
|
+// com.github.microservice.pay.client.ret.ResultContent<AccountModel> accountModelResultContent = payProductAccountService.get(accountName);
|
|
|
+// if (!accountModelResultContent.getState().equals(ResultState.Success)) {
|
|
|
+// throw new RuntimeException(accountModelResultContent.getMsg());
|
|
|
+// }
|
|
|
+// ChinaumsSenselessConf conf = (ChinaumsSenselessConf) accountModelResultContent.getContent().getConf();
|
|
|
+// String mid = conf.getMchId();
|
|
|
+ String mid = projectMainPaySettingService.getProjectPaymentMchId(projectOid, PaymentType.UnionFrictionlessPay);
|
|
|
+ if (StringUtils.isEmpty(mid)) {
|
|
|
+ return false;
|
|
|
}
|
|
|
- ChinaumsSenselessConf conf = (ChinaumsSenselessConf) accountModelResultContent.getContent().getConf();
|
|
|
- String mid = conf.getMchId();
|
|
|
ChinaumsSenselessUserSignInfo topByUserIdAndMidAndExpire = chinaumsSenselessUserSignInfoDao.findTopByUserIdAndMidAndExpire(userId, mid, false);
|
|
|
return topByUserIdAndMidAndExpire.getContractState().equals(ContractState.SIGNED);
|
|
|
}
|
|
|
@@ -428,7 +436,7 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
Map bodyMap = JsonUtil.toObject(JsonUtil.toJson(refundResultContent.getContent()), Map.class);
|
|
|
|
|
|
if (bodyMap.get("respCode").equals("TARGET_PROCESSING")) {
|
|
|
- execQueueService.add(Map.of("refundOrderNo", refundOrderNo), 5, data->{
|
|
|
+ execQueueService.add(Map.of("refundOrderNo", refundOrderNo), 5, data -> {
|
|
|
final ExpenseFlowDao expenseFlowDao = ApplicationContextHolder.getContext().getBean(ExpenseFlowDao.class);
|
|
|
final ChinaumsSenselessPayService chinaumsSenselessPayService = ApplicationContextHolder.getContext().getBean(ChinaumsSenselessPayService.class);
|
|
|
final PayCallService payCallService = ApplicationContextHolder.getContext().getBean(PayCallService.class);
|
|
|
@@ -438,22 +446,22 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
log.info("找不到退款单");
|
|
|
return false;
|
|
|
}
|
|
|
- if (refundOrder.getRefundState().equals(RefundState.Refunded) || refundOrder.getRefundState().equals(RefundState.Fail)){
|
|
|
+ if (refundOrder.getRefundState().equals(RefundState.Refunded) || refundOrder.getRefundState().equals(RefundState.Fail)) {
|
|
|
log.info("当前退款单状态为已退款或退款失败");
|
|
|
return true;
|
|
|
}
|
|
|
ResultContent<UnionFrictionlessPayFinishModel> refundQuery = chinaumsSenselessPayService.refundQuery(refundOrder.getProjectOid(), refundOrder.getUserId(), refundOrder.getShopOid(), refundOrderNo, true);
|
|
|
- if (!refundQuery.getState().equals(com.github.microservice.net.ResultState.Success)){
|
|
|
+ if (!refundQuery.getState().equals(com.github.microservice.net.ResultState.Success)) {
|
|
|
log.info("查询退款结果失败:{}", refundQuery.getMsg());
|
|
|
return false;
|
|
|
}
|
|
|
log.info("refundStatus:{}", refundQuery.getContent().getRefundStatus());
|
|
|
- if (refundQuery.getContent().getRefundStatus().equals("PROCESSING") || refundQuery.getContent().getRefundStatus().equals("UNKNOWN")){
|
|
|
+ if (refundQuery.getContent().getRefundStatus().equals("PROCESSING") || refundQuery.getContent().getRefundStatus().equals("UNKNOWN")) {
|
|
|
return false;
|
|
|
}
|
|
|
ResultContent resultContent = payCallService.unionFrictionlessPayRefundFinish(refundQuery.getContent());
|
|
|
return resultContent.getState().equals(com.github.microservice.net.ResultState.Success);
|
|
|
- }, System.currentTimeMillis() + 30*24*60*60*1000L);
|
|
|
+ }, System.currentTimeMillis() + 30 * 24 * 60 * 60 * 1000L);
|
|
|
return ResultContent.buildContent(refundResultContent.getContent());
|
|
|
}
|
|
|
return ResultContent.buildFail(bodyMap.get("respDesc").toString());
|