|
|
@@ -37,6 +37,7 @@ import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StopWatch;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
@@ -68,6 +69,7 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
ShareOrderDao shareOrderDao;
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 银联申请签约
|
|
|
* @return
|
|
|
@@ -257,7 +259,8 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
*/
|
|
|
@SneakyThrows
|
|
|
public ResultContent senselessPay(String projectOid, String oid, String userId, BigDecimal total, String orderNo, String remark) {
|
|
|
- log.info("开始构建参数:{}", DateUtils.paresTime(System.currentTimeMillis(), DateUtils.patternyyyySSS));
|
|
|
+ StopWatch stopWatch = new StopWatch();
|
|
|
+ stopWatch.start("获取支付配置");
|
|
|
String projectAccountName = orgPayAccountService.queryOgPayAccount(projectOid, PaymentType.UnionFrictionlessPay);
|
|
|
//获取银联支付产品账户及需要签约的商户号
|
|
|
String orgAccountName = orgPayAccountService.queryOgPayAccount(oid, PaymentType.UnionFrictionlessPay);
|
|
|
@@ -274,14 +277,17 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
}
|
|
|
ChinaumsSenselessConf projectConf = (ChinaumsSenselessConf) projectAccountModelResultContent.getContent().getConf();
|
|
|
String mid = projectConf.getMchId();
|
|
|
- log.info("获取项目及机构配置:{}", DateUtils.paresTime(System.currentTimeMillis(), DateUtils.patternyyyySSS));
|
|
|
+ stopWatch.stop();
|
|
|
|
|
|
+ stopWatch.start("获取签约参数");
|
|
|
//获取用户签约协议号
|
|
|
ChinaumsSenselessUserSignInfo userSignInfo = chinaumsSenselessUserSignInfoDao.findTopByUserIdAndMidAndExpire(userId, mid, false);
|
|
|
if (userSignInfo==null || !userSignInfo.getContractState().equals(ContractState.SIGNED)){
|
|
|
return ResultContent.buildFail("用户未签约或状态未知");
|
|
|
}
|
|
|
+ stopWatch.stop();
|
|
|
|
|
|
+ stopWatch.start("构建支付参数");
|
|
|
PayProductParameter<Object> payProductParameter = new PayProductParameter<>();
|
|
|
payProductParameter.setAccountName(projectAccountName);
|
|
|
ChinaSenselessPayRequest request = new ChinaSenselessPayRequest();
|
|
|
@@ -313,16 +319,21 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
shareOrderDao.save(shareOrder);
|
|
|
request.setSrcReserve(JsonUtil.toJson(Map.of("userId", userId, "oid", oid, "projectOid", projectOid, "orderNo", orderNo)));
|
|
|
payProductParameter.setMeta(BeanUtil.bean2Map(request));
|
|
|
- log.info("构建参数完成:{}", DateUtils.paresTime(System.currentTimeMillis(), DateUtils.patternyyyySSS));
|
|
|
+
|
|
|
+ stopWatch.stop();
|
|
|
+ stopWatch.start("请求银联");
|
|
|
com.github.microservice.pay.client.ret.ResultContent<Object> collectionResultContent = senselessPayService.collection(payProductParameter);
|
|
|
if (!collectionResultContent.getState().equals(ResultState.Success)){
|
|
|
return ResultContent.buildFail("请求失败");
|
|
|
}
|
|
|
+ stopWatch.stop();
|
|
|
+ stopWatch.start("转换支付结果");
|
|
|
Map bodyMap = JsonUtil.toObject(JsonUtil.toJson(collectionResultContent.getContent()), Map.class);
|
|
|
if (bodyMap.get("respCode").equals("0000")){
|
|
|
return ResultContent.buildContent(collectionResultContent.getContent());
|
|
|
}
|
|
|
- log.info("返回支付接口结果:{}", DateUtils.paresTime(System.currentTimeMillis(), DateUtils.patternyyyySSS));
|
|
|
+ stopWatch.stop();
|
|
|
+ log.info("time; {}", stopWatch.prettyPrint());
|
|
|
return ResultContent.buildFail(bodyMap.get("respDesc").toString());
|
|
|
}
|
|
|
|