|
|
@@ -22,20 +22,17 @@ import com.github.microservice.types.payment.PaymentType;
|
|
|
import com.zhongshu.card.client.model.pay.ChinaumsSenselessUserSignInfoModel;
|
|
|
import com.zhongshu.card.client.model.pay.UnionApplySignParam;
|
|
|
import com.zhongshu.card.client.type.ContractState;
|
|
|
-import com.zhongshu.card.client.type.RefundState;
|
|
|
import com.zhongshu.card.client.type.ShareOrderType;
|
|
|
import com.zhongshu.card.client.utils.DateUtils;
|
|
|
import com.zhongshu.card.server.core.dao.pay.ChinaumsSenselessUserSignInfoDao;
|
|
|
import com.zhongshu.card.server.core.dao.pay.ShareOrderDao;
|
|
|
-import com.zhongshu.card.server.core.dao.payment.ExpenseFlowDao;
|
|
|
import com.zhongshu.card.server.core.domain.pay.ChinaumsSenselessUserSignInfo;
|
|
|
import com.zhongshu.card.server.core.domain.pay.PayAccount;
|
|
|
import com.zhongshu.card.server.core.domain.pay.ShareOrder;
|
|
|
-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.payment.PayCallService;
|
|
|
+import com.zhongshu.card.server.core.service.paySetting.ProjectMainPaySettingService;
|
|
|
import com.zhongshu.card.server.core.util.BeanUtils;
|
|
|
import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
import io.micrometer.common.util.StringUtils;
|
|
|
@@ -74,7 +71,8 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
@Autowired
|
|
|
ShareOrderDao shareOrderDao;
|
|
|
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ProjectMainPaySettingService projectMainPaySettingService;
|
|
|
|
|
|
/**
|
|
|
* 银联申请签约
|
|
|
@@ -174,14 +172,11 @@ 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 mid = projectMainPaySettingService.getProjectPaymentMchId(projectOid, PaymentType.UnionFrictionlessPay);
|
|
|
+ if (org.apache.commons.lang3.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);
|
|
|
}
|
|
|
@@ -425,23 +420,23 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
Map bodyMap = JsonUtil.toObject(JsonUtil.toJson(refundResultContent.getContent()), Map.class);
|
|
|
|
|
|
if (bodyMap.get("respCode").equals("TARGET_PROCESSING")) {
|
|
|
- UnionFrictionlessPayFinishModel unionFrictionlessPayFinishModel = ExecuteQueueUtil.execute(5, index->{
|
|
|
+ UnionFrictionlessPayFinishModel unionFrictionlessPayFinishModel = ExecuteQueueUtil.execute(5, index -> {
|
|
|
return Map.of(1, 1000L, 2, 1000L, 3, 1000L, 4, 2000L).getOrDefault(index, 3000L);
|
|
|
- }, it->{
|
|
|
+ }, it -> {
|
|
|
var result = new ExecuteQueueUtil.Result<UnionFrictionlessPayFinishModel>();
|
|
|
|
|
|
ResultContent<UnionFrictionlessPayFinishModel> refundQuery = refundQuery(projectOid, userId, oid, 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 null;
|
|
|
}
|
|
|
- if (refundQuery.getContent().getRefundStatus().equals("SUCCESS") || refundQuery.getContent().getRefundStatus().equals("FAIL")){
|
|
|
+ if (refundQuery.getContent().getRefundStatus().equals("SUCCESS") || refundQuery.getContent().getRefundStatus().equals("FAIL")) {
|
|
|
result.setData(refundQuery.getContent());
|
|
|
result.setDone(true);
|
|
|
return result;
|
|
|
}
|
|
|
long time = System.currentTimeMillis() - it.getStartTime();
|
|
|
- if (time > 3000L){
|
|
|
+ if (time > 3000L) {
|
|
|
|
|
|
}
|
|
|
log.info("退款状态未知或退款中,继续查询,index:{}", it.getIndex());
|