mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-05 10:30:12 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -169,54 +169,6 @@ public class PayController extends BaseController {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 使用adapay支付订单
|
|
||||||
* http://localhost:8080/uniapp/pay/payOrderWithAdapay
|
|
||||||
* @param request
|
|
||||||
* @param dto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/payOrderWithAdapay")
|
|
||||||
public RestApiResponse<?> payOrderWithAdapay(HttpServletRequest request, @RequestBody PayOrderDTO dto) {
|
|
||||||
logger.info("adapay支付订单 param:{}", dto.toString());
|
|
||||||
RestApiResponse<?> response;
|
|
||||||
|
|
||||||
// 支付订单加锁
|
|
||||||
String lockKey = "pay_order_" + dto.getOrderCode();
|
|
||||||
String lockValue = IdUtils.fastUUID();
|
|
||||||
try {
|
|
||||||
String memberId = getMemberIdByAuthorization(request);
|
|
||||||
if (StringUtils.isBlank(memberId)) {
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR);
|
|
||||||
}
|
|
||||||
if (dto.getPayAmount() == null) {
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
|
||||||
}
|
|
||||||
dto.setMemberId(memberId);
|
|
||||||
dto.setLockValue(lockValue);
|
|
||||||
// redis锁
|
|
||||||
Boolean isLock = redisCache.lock(lockKey, lockValue, 60);
|
|
||||||
Map<String, Object> map = null;
|
|
||||||
if (isLock) {
|
|
||||||
map = orderService.payOrderWithAdapay(dto);
|
|
||||||
}
|
|
||||||
response = new RestApiResponse<>(map);
|
|
||||||
} catch (BusinessException e) {
|
|
||||||
logger.warn("adapay支付订单 warn param:{}", dto.toString(), e);
|
|
||||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("adapay支付订单 error param:{}", dto.toString(), e);
|
|
||||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_ORDER_PAY_ERROR);
|
|
||||||
} finally {
|
|
||||||
// 支付订单解锁
|
|
||||||
if (lockValue.equals(redisCache.getCacheObject(lockKey).toString())) {
|
|
||||||
redisCache.unLock(lockKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.info("adapay支付订单 result:{}", JSONObject.toJSONString(response));
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 7003 获取支付方式
|
* 7003 获取支付方式
|
||||||
* http://localhost:8080/uniapp/pay/getPayMode
|
* http://localhost:8080/uniapp/pay/getPayMode
|
||||||
|
|||||||
@@ -2,34 +2,27 @@ package com.jsowell.service;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.alibaba.fastjson2.TypeReference;
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.huifu.adapay.core.AdapayCore;
|
import com.huifu.adapay.core.AdapayCore;
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
||||||
import com.huifu.adapay.core.util.AdapaySign;
|
import com.huifu.adapay.core.util.AdapaySign;
|
||||||
import com.huifu.adapay.model.Payment;
|
|
||||||
import com.jsowell.adapay.common.CreateAdaPaymentParam;
|
|
||||||
import com.jsowell.common.constant.CacheConstants;
|
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||||
import com.jsowell.common.core.page.PageResponse;
|
import com.jsowell.common.core.page.PageResponse;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
|
import com.jsowell.common.enums.AcquirerEnum;
|
||||||
import com.jsowell.common.enums.InvoiceRecordEnum;
|
import com.jsowell.common.enums.InvoiceRecordEnum;
|
||||||
import com.jsowell.common.enums.MemberWalletEnum;
|
import com.jsowell.common.enums.MemberWalletEnum;
|
||||||
import com.jsowell.common.enums.adapay.AdapayEventEnum;
|
import com.jsowell.common.enums.adapay.AdapayEventEnum;
|
||||||
import com.jsowell.common.enums.ykc.*;
|
import com.jsowell.common.enums.ykc.*;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.AdapayUtil;
|
|
||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
import com.jsowell.common.util.SecurityUtils;
|
import com.jsowell.common.util.SecurityUtils;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
@@ -42,9 +35,11 @@ import com.jsowell.pile.vo.base.OrderAmountDetailVO;
|
|||||||
import com.jsowell.pile.vo.base.OrderPeriodAmountVO;
|
import com.jsowell.pile.vo.base.OrderPeriodAmountVO;
|
||||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||||
import com.jsowell.pile.vo.base.StationInfoVO;
|
import com.jsowell.pile.vo.base.StationInfoVO;
|
||||||
import com.jsowell.pile.vo.uniapp.InvoiceRecordVO;
|
|
||||||
import com.jsowell.pile.vo.uniapp.*;
|
import com.jsowell.pile.vo.uniapp.*;
|
||||||
import com.jsowell.pile.vo.web.*;
|
import com.jsowell.pile.vo.web.OrderDetailInfoVO;
|
||||||
|
import com.jsowell.pile.vo.web.PileStationVO;
|
||||||
|
import com.jsowell.pile.vo.web.PlatformTesterVO;
|
||||||
|
import com.jsowell.pile.vo.web.UpdateMemberBalanceDTO;
|
||||||
import com.jsowell.wxpay.dto.WeChatRefundDTO;
|
import com.jsowell.wxpay.dto.WeChatRefundDTO;
|
||||||
import com.jsowell.wxpay.response.WechatPayNotifyParameter;
|
import com.jsowell.wxpay.response.WechatPayNotifyParameter;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
@@ -52,7 +47,6 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cglib.beans.BeanMap;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -60,7 +54,6 @@ import java.math.BigDecimal;
|
|||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -163,435 +156,6 @@ public class OrderService {
|
|||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 使用adapay支付订单
|
|
||||||
* @param dto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Map<String, Object> payOrderWithAdapay(PayOrderDTO dto) {
|
|
||||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getOrderCode());
|
|
||||||
if (orderInfo == null) {
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_ORDER_NULL_ERROR);
|
|
||||||
}
|
|
||||||
if (!StringUtils.equals(orderInfo.getPayStatus(), "0")) {
|
|
||||||
// 订单已支付
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_ORDER_IS_NOT_TO_BE_PAID_ERROR);
|
|
||||||
}
|
|
||||||
Map<String, Object> resultMap = Maps.newHashMap();
|
|
||||||
if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_BALANCE.getValue())) {
|
|
||||||
// 余额支付
|
|
||||||
balancePayOrder(dto);
|
|
||||||
} else if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) {
|
|
||||||
// 微信支付 使用adapay
|
|
||||||
dto.setOrderBasicInfo(orderInfo);
|
|
||||||
Map<String, Object> weixinMap = adapayPayOrder(dto);
|
|
||||||
// 返回微信支付参数
|
|
||||||
resultMap.put("weixinMap", weixinMap);
|
|
||||||
} else if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_ALIPAY.getValue())) { // 支付宝支付
|
|
||||||
// TODO 返回支付宝支付参数
|
|
||||||
} else if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WHITELIST.getValue())) { // 白名单支付
|
|
||||||
// 白名单支付可以直接调支付回调方法
|
|
||||||
dto.setPayAmount(new BigDecimal("500"));
|
|
||||||
whiteListPayOrder(dto);
|
|
||||||
}
|
|
||||||
return resultMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 白名单支付订单逻辑
|
|
||||||
* @param dto
|
|
||||||
*/
|
|
||||||
private void whiteListPayOrder(PayOrderDTO dto) {
|
|
||||||
String orderCode = dto.getOrderCode();
|
|
||||||
BigDecimal payAmount = dto.getPayAmount();
|
|
||||||
String payMode = dto.getPayMode();
|
|
||||||
PayOrderSuccessCallbackDTO callbackDTO = PayOrderSuccessCallbackDTO.builder()
|
|
||||||
.orderCode(orderCode)
|
|
||||||
.payAmount(payAmount)
|
|
||||||
.payMode(payMode)
|
|
||||||
.build();
|
|
||||||
orderBasicInfoService.payOrderSuccessCallback(callbackDTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 使用汇付支付
|
|
||||||
* @param dto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Map<String, Object> adapayPayOrder(PayOrderDTO dto) {
|
|
||||||
log.info("===============使用汇付支付");
|
|
||||||
// 相同参数重复请求,返回同一个支付对象
|
|
||||||
String redisKey = CacheConstants.ADAPAY_ORDER_PARAM + dto.getOrderCode();
|
|
||||||
Map<String, Object> cacheObject = redisCache.getCacheObject(redisKey);
|
|
||||||
if (cacheObject != null) {
|
|
||||||
return cacheObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
OrderBasicInfo orderInfo = dto.getOrderBasicInfo();
|
|
||||||
if (orderInfo == null) {
|
|
||||||
// 订单为空重新查询
|
|
||||||
orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getOrderCode());
|
|
||||||
}
|
|
||||||
// 获取openId
|
|
||||||
String openId = memberService.getOpenIdByCode(dto.getCode());
|
|
||||||
if (StringUtils.isBlank(openId)) {
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_GET_OPEN_ID_BY_CODE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 封装对象
|
|
||||||
String amount = AdapayUtil.formatAmount(dto.getPayAmount()); // 用户支付金额
|
|
||||||
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
|
|
||||||
createAdaPaymentParam.setOrder_no(orderInfo.getOrderCode());
|
|
||||||
createAdaPaymentParam.setPay_amt(amount);
|
|
||||||
createAdaPaymentParam.setApp_id(ADAPAY_APP_ID);
|
|
||||||
createAdaPaymentParam.setPay_channel("wx_lite"); // todo 如果以后有支付宝等别的渠道,这里需要做修改,判断是什么渠道的请求
|
|
||||||
createAdaPaymentParam.setGoods_title("充电费用");
|
|
||||||
createAdaPaymentParam.setGoods_desc("充电桩预付款金额"); // 这个字段是微信支付凭证的商品名
|
|
||||||
Map<String, String> map = Maps.newHashMap();
|
|
||||||
map.put("type", ScenarioEnum.ORDER.getValue());
|
|
||||||
map.put("orderCode", dto.getOrderCode());
|
|
||||||
createAdaPaymentParam.setDescription(JSON.toJSONString(map));
|
|
||||||
//异步通知地址,url为http/https路径,服务器POST回调,URL 上请勿附带参数
|
|
||||||
createAdaPaymentParam.setNotify_url(ADAPAY_CALLBACK_URL);
|
|
||||||
createAdaPaymentParam.setExpend(JSONObject.toJSONString( ImmutableMap.of("open_id", openId)));
|
|
||||||
|
|
||||||
// 分账对象信息
|
|
||||||
// String adapayMemberId = adapayMemberAccountService.selectAdapayMemberIdByStationId(orderInfo.getStationId());
|
|
||||||
// if (StringUtils.isNotBlank(adapayMemberId)) {
|
|
||||||
// JSONObject jsonObject = new JSONObject();
|
|
||||||
// jsonObject.put("member_id", adapayMemberId);
|
|
||||||
// jsonObject.put("amount", amount);
|
|
||||||
// jsonObject.put("fee_flag", Constants.Y);
|
|
||||||
//
|
|
||||||
// // 分账对象信息列表,最多仅支持7个分账方,json 数组形式
|
|
||||||
// JSONArray jsonArray = new JSONArray();
|
|
||||||
// jsonArray.add(jsonObject);
|
|
||||||
// createAdaPaymentParam.setDiv_members(jsonArray.toString());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 延时分账
|
|
||||||
createAdaPaymentParam.setPay_mode("delay");
|
|
||||||
try {
|
|
||||||
log.info("创建汇付支付参数:{}", JSONObject.toJSONString(createAdaPaymentParam));
|
|
||||||
Map<String, Object> response = Payment.create(BeanMap.create(createAdaPaymentParam));
|
|
||||||
if (response != null && !response.isEmpty()) {
|
|
||||||
JSONObject expend = JSONObject.parseObject(response.get("expend").toString());
|
|
||||||
JSONObject pay_info = expend.getJSONObject("pay_info");
|
|
||||||
Map<String, Object> resultMap = JSONObject.parseObject(pay_info.toJSONString(), new TypeReference<Map<String, Object>>() {
|
|
||||||
});
|
|
||||||
if (resultMap != null) {
|
|
||||||
// 表示已经获取到支付参数了,后续再有支付请求就拒绝
|
|
||||||
redisCache.setCacheObject(redisKey, resultMap, 15, TimeUnit.MINUTES);
|
|
||||||
}
|
|
||||||
return resultMap;
|
|
||||||
}
|
|
||||||
} catch (BaseAdaPayException e) {
|
|
||||||
log.error("汇付-获取支付对象发生异常", e);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信支付订单逻辑 获取支付参数
|
|
||||||
* @param dto
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private Map<String, Object> wechatPayOrder(PayOrderDTO dto) throws Exception {
|
|
||||||
// 相同参数重复请求,返回同一个支付对象
|
|
||||||
String redisKey = CacheConstants.WECHAT_PAY_ORDER_PARAM + dto.getOrderCode();
|
|
||||||
Map<String, Object> cacheObject = redisCache.getCacheObject(redisKey);
|
|
||||||
if (cacheObject != null) {
|
|
||||||
return cacheObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
OrderBasicInfo orderInfo = dto.getOrderBasicInfo();
|
|
||||||
if (orderInfo == null) {
|
|
||||||
orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getOrderCode());
|
|
||||||
}
|
|
||||||
String openId = memberService.getOpenIdByCode(dto.getCode());
|
|
||||||
if (StringUtils.isBlank(openId)) {
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_GET_OPEN_ID_BY_CODE_ERROR);
|
|
||||||
}
|
|
||||||
WeixinPayDTO weixinPayDTO = new WeixinPayDTO();
|
|
||||||
weixinPayDTO.setOpenId(openId);
|
|
||||||
weixinPayDTO.setAmount(dto.getPayAmount().toString());
|
|
||||||
// 支付订单 附加参数
|
|
||||||
PaymentScenarioDTO paymentScenarioDTO = PaymentScenarioDTO.builder()
|
|
||||||
.type(ScenarioEnum.ORDER.getValue())
|
|
||||||
.orderCode(dto.getOrderCode())
|
|
||||||
.memberId(orderInfo.getMemberId())
|
|
||||||
.build();
|
|
||||||
weixinPayDTO.setAttach(JSONObject.toJSONString(paymentScenarioDTO));
|
|
||||||
weixinPayDTO.setDescription("充电费用");
|
|
||||||
Map<String, Object> payV3 = this.weixinPayV3(weixinPayDTO);
|
|
||||||
if (payV3 != null) {
|
|
||||||
// 表示已经获取到支付参数了,后续再有支付请求就拒绝
|
|
||||||
redisCache.setCacheObject(redisKey, payV3, 15, TimeUnit.MINUTES);
|
|
||||||
}
|
|
||||||
return payV3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 余额支付订单逻辑
|
|
||||||
* @param dto
|
|
||||||
*/
|
|
||||||
private void balancePayOrder(PayOrderDTO dto) {
|
|
||||||
// 记录支付流水
|
|
||||||
List<OrderPayRecord> payRecordList = Lists.newArrayList();
|
|
||||||
String orderCode = dto.getOrderCode();
|
|
||||||
BigDecimal chargeAmount = dto.getPayAmount();
|
|
||||||
// 查询该会员的余额
|
|
||||||
MemberVO memberVO = memberService.getMemberInfoByMemberId(dto.getMemberId());
|
|
||||||
BigDecimal totalAccountAmount = memberVO.getTotalAccountAmount();
|
|
||||||
|
|
||||||
if (totalAccountAmount.compareTo(chargeAmount) < 0) {
|
|
||||||
// 总余额小于充电金额
|
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_IS_INSUFFICIENT);
|
|
||||||
}
|
|
||||||
BigDecimal principalAmount = memberVO.getPrincipalBalance(); // 会员剩余本金金额
|
|
||||||
// BigDecimal giftAmount = memberVO.getGiftBalance(); // 会员剩余赠送余额
|
|
||||||
|
|
||||||
BigDecimal principalPay = null; // 30
|
|
||||||
BigDecimal giftPay = null; // 10
|
|
||||||
// 先扣除本金金额,再扣除赠送金额
|
|
||||||
BigDecimal subtract = principalAmount.subtract(chargeAmount);
|
|
||||||
if (subtract.compareTo(BigDecimal.ZERO) >= 0) {
|
|
||||||
principalPay = chargeAmount;
|
|
||||||
} else {
|
|
||||||
if (principalAmount.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
principalPay = principalAmount;
|
|
||||||
}
|
|
||||||
giftPay = subtract.negate();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新会员钱包
|
|
||||||
UpdateMemberBalanceDTO updateMemberBalanceDTO = UpdateMemberBalanceDTO.builder()
|
|
||||||
.memberId(dto.getMemberId())
|
|
||||||
.type(MemberWalletEnum.TYPE_OUT.getValue())
|
|
||||||
.subType(MemberWalletEnum.SUBTYPE_PAYMENT_FOR_ORDER.getValue())
|
|
||||||
.updatePrincipalBalance(principalPay)
|
|
||||||
.updateGiftBalance(giftPay)
|
|
||||||
.relatedOrderCode(orderCode)
|
|
||||||
.build();
|
|
||||||
memberBasicInfoService.updateMemberBalance(updateMemberBalanceDTO);
|
|
||||||
|
|
||||||
// 记录流水
|
|
||||||
if (principalPay != null) {
|
|
||||||
payRecordList.add(OrderPayRecord.builder()
|
|
||||||
.orderCode(orderCode)
|
|
||||||
.payMode(OrderPayRecordEnum.PRINCIPAL_BALANCE_PAYMENT.getValue())
|
|
||||||
.payAmount(principalPay)
|
|
||||||
.createBy(dto.getMemberId())
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
if (giftPay != null) {
|
|
||||||
payRecordList.add(OrderPayRecord.builder()
|
|
||||||
.orderCode(orderCode)
|
|
||||||
.payMode(OrderPayRecordEnum.GIFT_BALANCE_PAYMENT.getValue())
|
|
||||||
.payAmount(giftPay)
|
|
||||||
.createBy(dto.getMemberId())
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
// 余额支付可以直接调支付回调方法
|
|
||||||
PayOrderSuccessCallbackDTO callbackDTO = PayOrderSuccessCallbackDTO.builder()
|
|
||||||
.orderCode(orderCode)
|
|
||||||
.payAmount(chargeAmount)
|
|
||||||
.payMode(dto.getPayMode())
|
|
||||||
.build();
|
|
||||||
orderBasicInfoService.payOrderSuccessCallback(callbackDTO);
|
|
||||||
|
|
||||||
// 余额支付订单 记录会员交易流水
|
|
||||||
MemberTransactionRecord record = MemberTransactionRecord.builder()
|
|
||||||
.orderCode(orderCode)
|
|
||||||
.scenarioType(ScenarioEnum.ORDER.getValue())
|
|
||||||
.memberId(memberVO.getMemberId())
|
|
||||||
.actionType(ActionTypeEnum.FORWARD.getValue())
|
|
||||||
.payMode(PayModeEnum.PAYMENT_OF_BALANCE.getValue())
|
|
||||||
.paymentInstitutions(PaymentInstitutionsEnum.LOCAL_ACCOUNTS.getValue())
|
|
||||||
.amount(dto.getPayAmount()) // 单位元
|
|
||||||
.build();
|
|
||||||
memberTransactionRecordService.insertSelective(record);
|
|
||||||
|
|
||||||
// 订单支付流水入库
|
|
||||||
if (CollectionUtils.isNotEmpty(payRecordList)) {
|
|
||||||
orderPayRecordService.batchInsert(payRecordList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单支付成功 支付回调
|
|
||||||
* 支付成功后掉用这个方法
|
|
||||||
* 1. 修改订单支付状态
|
|
||||||
* 2. 发送启动充电指令
|
|
||||||
*/
|
|
||||||
/*public void payOrderSuccessCallback(PayOrderSuccessCallbackDTO dto) {
|
|
||||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getOrderCode());
|
|
||||||
BigDecimal payAmount = dto.getPayAmount();
|
|
||||||
|
|
||||||
// 修改订单
|
|
||||||
orderInfo.setPayMode(dto.getPayMode());
|
|
||||||
orderInfo.setPayStatus(Constants.ONE);
|
|
||||||
orderInfo.setPayAmount(payAmount);
|
|
||||||
orderInfo.setPayTime(new Date());
|
|
||||||
orderBasicInfoService.updateOrderBasicInfo(orderInfo);
|
|
||||||
|
|
||||||
if (StringUtils.equals(orderInfo.getStartType(), StartTypeEnum.NOW.getValue())) { // 立即启动充电
|
|
||||||
String pileSn = orderInfo.getPileSn();
|
|
||||||
// 发送启动充电指令前,再次下发计费模板
|
|
||||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
|
||||||
if (billingTemplateVO != null) {
|
|
||||||
pileRemoteService.publishPileBillingTemplate(pileSn, billingTemplateVO);
|
|
||||||
}
|
|
||||||
// 发送启动指令
|
|
||||||
pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), orderInfo.getPayAmount());
|
|
||||||
} else { // 预约充电
|
|
||||||
// 修改枪口状态为 占用预约
|
|
||||||
|
|
||||||
// 下发修改充电桩设置指令
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存订单信息到数据库
|
|
||||||
*
|
|
||||||
* @param dto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
// private String saveOrder2Database(GenerateOrderDTO dto) throws ParseException {
|
|
||||||
// String orderCode = IdUtils.getOrderCode();
|
|
||||||
// String transactionCode = IdUtils.generateTransactionCode(dto.getPileSn(), dto.getConnectorCode());
|
|
||||||
//
|
|
||||||
// if (StringUtils.isBlank(dto.getStartType())) {
|
|
||||||
// dto.setStartType(StartTypeEnum.NOW.getValue());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// String stationId = dto.getPileConnector().getStationId();
|
|
||||||
// // 查询站点信息
|
|
||||||
// PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(Long.valueOf(stationId));
|
|
||||||
// String merchantId = pileStationInfo != null ? String.valueOf(pileStationInfo.getMerchantId()) : "";
|
|
||||||
//
|
|
||||||
// // 订单基本信息
|
|
||||||
// OrderBasicInfo orderBasicInfo = OrderBasicInfo.builder()
|
|
||||||
// .orderCode(orderCode)
|
|
||||||
// .transactionCode(transactionCode)
|
|
||||||
// .orderStatus(OrderStatusEnum.NOT_START.getValue())
|
|
||||||
// .memberId(dto.getMemberId())
|
|
||||||
// .stationId(stationId)
|
|
||||||
// .merchantId(merchantId)
|
|
||||||
// .pileSn(dto.getPileSn())
|
|
||||||
// .connectorCode(dto.getConnectorCode())
|
|
||||||
// .pileConnectorCode(dto.getPileSn() + dto.getConnectorCode())
|
|
||||||
// .startMode(dto.getStartMode())
|
|
||||||
// .payStatus(Constants.ZERO)
|
|
||||||
// .payAmount(dto.getChargeAmount())
|
|
||||||
// .payMode(dto.getPayMode())
|
|
||||||
// .orderAmount(BigDecimal.ZERO)
|
|
||||||
// .virtualAmount(BigDecimal.ZERO)
|
|
||||||
// .settleAmount(BigDecimal.ZERO)
|
|
||||||
// .startType(dto.getStartType())
|
|
||||||
// .build();
|
|
||||||
// if (StringUtils.equals(dto.getStartType(), StartTypeEnum.APPOINTMENT.getValue())) {
|
|
||||||
// orderBasicInfo.setAppointmentTime(DateUtils.parseDate(dto.getAppointmentTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 订单详情
|
|
||||||
// BillingTemplateVO billingTemplate = dto.getBillingTemplate();
|
|
||||||
// log.info("订单使用的计费模板-orderCode:{}, billingTemplate:{}", orderCode, JSONObject.toJSONString(billingTemplate));
|
|
||||||
// BigDecimal sharpElectricityPrice = billingTemplate.getSharpElectricityPrice() != null ? billingTemplate.getSharpElectricityPrice() : BigDecimal.ZERO;
|
|
||||||
// BigDecimal sharpServicePrice = billingTemplate.getSharpServicePrice() != null ? billingTemplate.getSharpServicePrice() : BigDecimal.ZERO;
|
|
||||||
// BigDecimal peakElectricityPrice = billingTemplate.getPeakElectricityPrice() != null ? billingTemplate.getPeakElectricityPrice() : BigDecimal.ZERO;
|
|
||||||
// BigDecimal peakServicePrice = billingTemplate.getPeakServicePrice() != null ? billingTemplate.getPeakServicePrice() : BigDecimal.ZERO;
|
|
||||||
// BigDecimal flatElectricityPrice = billingTemplate.getFlatElectricityPrice() != null ? billingTemplate.getFlatElectricityPrice() : BigDecimal.ZERO;
|
|
||||||
// BigDecimal flatServicePrice = billingTemplate.getFlatServicePrice() != null ? billingTemplate.getFlatServicePrice() : BigDecimal.ZERO;
|
|
||||||
// BigDecimal valleyElectricityPrice = billingTemplate.getValleyElectricityPrice() != null ? billingTemplate.getValleyElectricityPrice() : BigDecimal.ZERO;
|
|
||||||
// BigDecimal valleyServicePrice = billingTemplate.getValleyServicePrice() != null ? billingTemplate.getValleyServicePrice() : BigDecimal.ZERO;
|
|
||||||
//
|
|
||||||
// OrderDetail orderDetail = OrderDetail.builder()
|
|
||||||
// .orderCode(orderCode)
|
|
||||||
// .sharpPrice(sharpElectricityPrice.add(sharpServicePrice))
|
|
||||||
// .sharpElectricityPrice(sharpElectricityPrice)
|
|
||||||
// .sharpServicePrice(sharpServicePrice)
|
|
||||||
// .peakPrice(peakElectricityPrice.add(peakServicePrice))
|
|
||||||
// .peakElectricityPrice(peakElectricityPrice)
|
|
||||||
// .peakServicePrice(peakServicePrice)
|
|
||||||
// .flatPrice(flatElectricityPrice.add(flatServicePrice))
|
|
||||||
// .flatElectricityPrice(flatElectricityPrice)
|
|
||||||
// .flatServicePrice(flatServicePrice)
|
|
||||||
// .valleyPrice(valleyElectricityPrice.add(valleyServicePrice))
|
|
||||||
// .valleyElectricityPrice(valleyElectricityPrice)
|
|
||||||
// .valleyServicePrice(valleyServicePrice)
|
|
||||||
// .build();
|
|
||||||
//
|
|
||||||
// OrderTransactionDTO createOrderTransactionDTO = OrderTransactionDTO.builder()
|
|
||||||
// .orderBasicInfo(orderBasicInfo)
|
|
||||||
// .orderDetail(orderDetail)
|
|
||||||
// .build();
|
|
||||||
// pileTransactionService.doCreateOrder(createOrderTransactionDTO);
|
|
||||||
// return orderCode;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验充电桩相关的信息
|
|
||||||
*
|
|
||||||
* @param dto
|
|
||||||
*/
|
|
||||||
// private void checkPileInfo(GenerateOrderDTO dto) {
|
|
||||||
// // 查询充电桩状态 是否空闲 枪口是否占用
|
|
||||||
// PileConnectorDetailVO pileConnector = pileService.queryPileConnectorDetail(dto.getPileSn() + dto.getConnectorCode());
|
|
||||||
// if (pileConnector == null) {
|
|
||||||
// log.error("checkPileInfo充电枪口为空 pileSn:{}, connectorCode:{}", dto.getPileSn(), dto.getConnectorCode());
|
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 查询站点状态
|
|
||||||
// PileStationVO stationInfo = pileStationInfoService.getStationInfo(pileConnector.getStationId());
|
|
||||||
// if (stationInfo == null || StringUtils.equals(stationInfo.getOpenFlag(), Constants.ZERO)) {
|
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_STATION_IS_NOT_OPEN);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 判断枪口状态
|
|
||||||
// if (!(StringUtils.equals(pileConnector.getConnectorStatus(), PileConnectorDataBaseStatusEnum.FREE.getValue())
|
|
||||||
// || StringUtils.equals(pileConnector.getConnectorStatus(), PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue()))) {
|
|
||||||
// log.error("checkPileInfo充电枪口状态不正确,当前状态为:{}", pileConnector.getConnectorStatus());
|
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_PILE_CONNECTOR_STATUS_ERROR);
|
|
||||||
// }
|
|
||||||
// // 查询充电桩的计费模板
|
|
||||||
// BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(dto.getPileSn());
|
|
||||||
// if (billingTemplateVO == null) {
|
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_BILLING_TEMPLATE_NULL_ERROR);
|
|
||||||
// }
|
|
||||||
// dto.setPileConnector(pileConnector);
|
|
||||||
// dto.setBillingTemplate(billingTemplateVO);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理前端传的参数
|
|
||||||
* pileConnectorCode = pileSn + connectorCode
|
|
||||||
*
|
|
||||||
* @param dto
|
|
||||||
*/
|
|
||||||
// public void analysisPileParameter(BasicPileDTO dto) {
|
|
||||||
// if (StringUtils.isBlank(dto.getPileSn()) || StringUtils.isBlank(dto.getConnectorCode())) {
|
|
||||||
// // 从pileConnectorCode解析
|
|
||||||
// String pileConnectorCode = dto.getPileConnectorCode();
|
|
||||||
// if (StringUtils.isNotEmpty(pileConnectorCode) && pileConnectorCode.length() == Constants.PILE_CONNECTOR_CODE_LENGTH) {
|
|
||||||
// dto.setPileSn(StringUtils.substring(pileConnectorCode, 0, pileConnectorCode.length() - 2));
|
|
||||||
// dto.setConnectorCode(StringUtils.substring(pileConnectorCode, pileConnectorCode.length() - 2, pileConnectorCode.length()));
|
|
||||||
// } else {
|
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_DATA_LENGTH_ERROR);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // 说明pileSn 和 connectorCode前端传了,那就校验一下长度
|
|
||||||
// if (dto.getPileSn().length() != Constants.PILE_SN_LENGTH || dto.getConnectorCode().length() != Constants.CONNECTOR_CODE_LENGTH) {
|
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_DATA_LENGTH_ERROR);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算订单
|
* 结算订单
|
||||||
* endCharging
|
* endCharging
|
||||||
@@ -733,6 +297,7 @@ public class OrderService {
|
|||||||
.orderCode(orderCode)
|
.orderCode(orderCode)
|
||||||
.payMode(OrderPayRecordEnum.WECHATPAY_PAYMENT.getValue())
|
.payMode(OrderPayRecordEnum.WECHATPAY_PAYMENT.getValue())
|
||||||
.payAmount(amount)
|
.payAmount(amount)
|
||||||
|
.acquirer(AcquirerEnum.WECHAT_PAY.getValue())
|
||||||
.createBy(null)
|
.createBy(null)
|
||||||
.build();
|
.build();
|
||||||
orderPayRecordService.batchInsert(Lists.newArrayList(orderPayRecord));
|
orderPayRecordService.batchInsert(Lists.newArrayList(orderPayRecord));
|
||||||
@@ -1342,6 +907,11 @@ public class OrderService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adapay支付成功回调
|
||||||
|
* @param data
|
||||||
|
* @throws JsonProcessingException
|
||||||
|
*/
|
||||||
private void paymentSucceeded(String data) throws JsonProcessingException {
|
private void paymentSucceeded(String data) throws JsonProcessingException {
|
||||||
//验签成功 保存到回调记录表中
|
//验签成功 保存到回调记录表中
|
||||||
JSONObject jsonObject = JSON.parseObject(data);
|
JSONObject jsonObject = JSON.parseObject(data);
|
||||||
@@ -1378,6 +948,7 @@ public class OrderService {
|
|||||||
.orderCode(orderCode)
|
.orderCode(orderCode)
|
||||||
.payMode(OrderPayRecordEnum.WECHATPAY_PAYMENT.getValue())
|
.payMode(OrderPayRecordEnum.WECHATPAY_PAYMENT.getValue())
|
||||||
.payAmount(amount)
|
.payAmount(amount)
|
||||||
|
.acquirer(AcquirerEnum.ADAPAY.getValue())
|
||||||
.createBy(null)
|
.createBy(null)
|
||||||
.build();
|
.build();
|
||||||
orderPayRecordService.batchInsert(Lists.newArrayList(orderPayRecord));
|
orderPayRecordService.batchInsert(Lists.newArrayList(orderPayRecord));
|
||||||
@@ -1417,7 +988,7 @@ public class OrderService {
|
|||||||
if (adapayMemberAccount == null) {
|
if (adapayMemberAccount == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
adapayMemberAccount.setDelFlag(Constants.ONE);
|
adapayMemberAccount.setStatus(Constants.TWO);
|
||||||
// 逻辑删除记录,并删除缓存
|
// 逻辑删除记录,并删除缓存
|
||||||
adapayMemberAccountService.updateAdapayMemberAccount(adapayMemberAccount);
|
adapayMemberAccountService.updateAdapayMemberAccount(adapayMemberAccount);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ public class SpringBootTestController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private YKCPushCommandService ykcPushCommandService;
|
private YKCPushCommandService ykcPushCommandService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAdapayMemberAccountService adapayMemberAccountService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPileMsgRecordService pileMsgRecordService;
|
private IPileMsgRecordService pileMsgRecordService;
|
||||||
|
|
||||||
@@ -526,12 +529,23 @@ public class SpringBootTestController {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryCorpMember() {
|
public void testQueryCorpMember() {
|
||||||
try {
|
List<AdapayMemberAccount> accountList = adapayMemberAccountService.selectAdapayMemberAccountList(new AdapayMemberAccount());
|
||||||
Map<String, Object> map = adapayMemberService.selectAdapayMember("5");
|
if (CollectionUtils.isNotEmpty(accountList)) {
|
||||||
System.out.println(map);
|
Long[] ids = accountList.stream().map(AdapayMemberAccount::getId).toArray(Long[]::new);
|
||||||
} catch (BaseAdaPayException e) {
|
adapayMemberAccountService.deleteAdapayMemberAccountByIds(ids);
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// Map<String, Object> map = adapayMemberService.selectAdapayMember("5");
|
||||||
|
//
|
||||||
|
// String adapayMemberId = "ACM29562569";
|
||||||
|
// AdapayCorpMemberVO adapayCorpMemberVO = adapayMemberService.queryCorpAdapayMemberInfo(adapayMemberId);
|
||||||
|
// System.out.println(adapayCorpMemberVO);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// } catch (BaseAdaPayException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.jsowell.common.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收单机构enum
|
||||||
|
*/
|
||||||
|
public enum AcquirerEnum {
|
||||||
|
LOCAL("0", "本账户余额"),
|
||||||
|
WECHAT_PAY("1", "微信支付"),
|
||||||
|
ADAPAY("2", "汇付支付"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
AcquirerEnum(String value, String label) {
|
||||||
|
this.value = value;
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.jsowell.common.enums.adapay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核状态
|
||||||
|
*/
|
||||||
|
public enum AdapayAuditStateEnum {
|
||||||
|
AWAIT_AUDIT("A", "待审核"),
|
||||||
|
AUDIT_FAILED("B", "审核失败"),
|
||||||
|
ACCOUNT_OPENING_FAILED("C", "开户失败"),
|
||||||
|
ACCOUNT_OPENED_NO_SETTLEMENT_ACCOUNT("D", "开户成功但未创建结算账户"),
|
||||||
|
ACCOUNT_SUCCESSFUL("E", "开户和创建结算账户成功") //
|
||||||
|
;
|
||||||
|
private String value;
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
AdapayAuditStateEnum(String value, String label) {
|
||||||
|
this.value = value;
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -604,24 +604,24 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
|
|||||||
if (Objects.isNull(orderBasicInfo.getChargeEndTime())) { // 结束时间
|
if (Objects.isNull(orderBasicInfo.getChargeEndTime())) { // 结束时间
|
||||||
orderBasicInfo.setChargeEndTime(DateUtils.parseDate(data.getEndTime()));
|
orderBasicInfo.setChargeEndTime(DateUtils.parseDate(data.getEndTime()));
|
||||||
}
|
}
|
||||||
if (!StringUtils.equals("0000000000000000", data.getLogicCard())) {
|
// if (!StringUtils.equals("0000000000000000", data.getLogicCard())) {
|
||||||
// 根据物理卡号查出当前为锁定状态的卡
|
// // 根据物理卡号查出当前为锁定状态的卡
|
||||||
PileAuthCard cardInfo = pileAuthCardService.selectSomeStatusCardInfo(CardStatusEnum.START_LOCK.getCode(), orderBasicInfo.getLogicCard());
|
// PileAuthCard cardInfo = pileAuthCardService.selectSomeStatusCardInfo(CardStatusEnum.START_LOCK.getCode(), orderBasicInfo.getLogicCard());
|
||||||
if (cardInfo != null) {
|
// if (cardInfo != null) {
|
||||||
// orderBasicInfo.setMemberId(cardInfo.getMemberId());
|
// // orderBasicInfo.setMemberId(cardInfo.getMemberId());
|
||||||
// 将此卡状态改为正常
|
// // 将此卡状态改为正常
|
||||||
cardInfo.setStatus(CardStatusEnum.NORMAL.getCode());
|
// cardInfo.setStatus(CardStatusEnum.NORMAL.getCode());
|
||||||
pileAuthCardService.updatePileAuthCard(cardInfo);
|
// pileAuthCardService.updatePileAuthCard(cardInfo);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// 如果是vin启动,将启动锁定状态改为正常
|
// // 如果是vin启动,将启动锁定状态改为正常
|
||||||
if (StringUtils.equals(data.getTransactionIdentifier(), "05")) {
|
// if (StringUtils.equals(data.getTransactionIdentifier(), "05")) {
|
||||||
MemberPlateNumberRelation plateInfo = memberPlateNumberRelationService.getMemberPlateInfoByVinCode(data.getVinCode());
|
// MemberPlateNumberRelation plateInfo = memberPlateNumberRelationService.getMemberPlateInfoByVinCode(data.getVinCode());
|
||||||
if (plateInfo != null && (StringUtils.equals(plateInfo.getVinStatus(), "2"))) {
|
// if (plateInfo != null && (StringUtils.equals(plateInfo.getVinStatus(), "2"))) {
|
||||||
plateInfo.setVinStatus("1");
|
// plateInfo.setVinStatus("1");
|
||||||
memberPlateNumberRelationService.updateMemberPlateNumberRelation(plateInfo);
|
// memberPlateNumberRelationService.updateMemberPlateNumberRelation(plateInfo);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
orderBasicInfoService.updateOrderBasicInfo(orderBasicInfo);
|
orderBasicInfoService.updateOrderBasicInfo(orderBasicInfo);
|
||||||
|
|
||||||
// 结算订单操作
|
// 结算订单操作
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.jsowell.common.util.id.IdUtils;
|
|||||||
import com.jsowell.pile.domain.AdapayMemberAccount;
|
import com.jsowell.pile.domain.AdapayMemberAccount;
|
||||||
import com.jsowell.pile.service.IAdapayMemberAccountService;
|
import com.jsowell.pile.service.IAdapayMemberAccountService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -408,6 +409,16 @@ public class AdapayMemberService {
|
|||||||
if (StringUtils.equals((String) member.get("status"), "failed")) {
|
if (StringUtils.equals((String) member.get("status"), "failed")) {
|
||||||
throw new BusinessException("", (String) member.get("error_msg"));
|
throw new BusinessException("", (String) member.get("error_msg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 逻辑删除原来审核不通过的记录
|
||||||
|
List<AdapayMemberAccount> accountList = adapayMemberAccountService.selectAdapayMemberAccountList(dto.getMerchantId());
|
||||||
|
if (CollectionUtils.isNotEmpty(accountList)) {
|
||||||
|
Long[] ids = accountList.stream()
|
||||||
|
.map(AdapayMemberAccount::getId)
|
||||||
|
.toArray(Long[]::new);
|
||||||
|
adapayMemberAccountService.deleteAdapayMemberAccountByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
// 保存到数据库
|
// 保存到数据库
|
||||||
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
|
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
|
||||||
adapayMemberAccount.setMerchantId(dto.getMerchantId());
|
adapayMemberAccount.setMerchantId(dto.getMerchantId());
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ public class OrderPayRecord {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal refundAmount;
|
private BigDecimal refundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收单机构(0-本账户余额;1-微信支付;2-汇付支付)
|
||||||
|
*/
|
||||||
|
private String acquirer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package com.jsowell.pile.service;
|
package com.jsowell.pile.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.jsowell.pile.domain.AdapayCallbackRecord;
|
import com.jsowell.pile.domain.AdapayCallbackRecord;
|
||||||
|
|
||||||
public interface AdapayCallbackRecordService {
|
public interface AdapayCallbackRecordService {
|
||||||
void saveAdapayCallbackRecord(AdapayCallbackRecord callbackRecord);
|
void saveAdapayCallbackRecord(AdapayCallbackRecord callbackRecord);
|
||||||
|
|
||||||
void saveAdapayCallbackRecord(String data) throws JsonProcessingException;
|
|
||||||
|
|
||||||
AdapayCallbackRecord selectByOrderCode(String orderCode);
|
AdapayCallbackRecord selectByOrderCode(String orderCode);
|
||||||
|
|
||||||
AdapayCallbackRecord selectByPaymentId(String paymentId);
|
AdapayCallbackRecord selectByPaymentId(String paymentId);
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ public interface IAdapayMemberAccountService {
|
|||||||
*/
|
*/
|
||||||
public List<AdapayMemberAccount> selectAdapayMemberAccountList(AdapayMemberAccount adapayMemberAccount);
|
public List<AdapayMemberAccount> selectAdapayMemberAccountList(AdapayMemberAccount adapayMemberAccount);
|
||||||
|
|
||||||
|
public List<AdapayMemberAccount> selectAdapayMemberAccountList(String merchantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增【请填写功能名称】
|
* 新增【请填写功能名称】
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -6,18 +6,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface IOrderPayRecordService {
|
public interface IOrderPayRecordService {
|
||||||
|
|
||||||
// int deleteByPrimaryKey(Integer id);
|
|
||||||
|
|
||||||
// int insert(OrderPayRecord record);
|
|
||||||
|
|
||||||
// int insertSelective(OrderPayRecord record);
|
|
||||||
|
|
||||||
// OrderPayRecord selectByPrimaryKey(Integer id);
|
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(OrderPayRecord record);
|
int updateByPrimaryKeySelective(OrderPayRecord record);
|
||||||
|
|
||||||
// int updateByPrimaryKey(OrderPayRecord record);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量保存订单支付记录
|
* 批量保存订单支付记录
|
||||||
* @param payRecordList
|
* @param payRecordList
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
package com.jsowell.pile.service.impl;
|
package com.jsowell.pile.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
|
||||||
import com.jsowell.common.constant.CacheConstants;
|
import com.jsowell.common.constant.CacheConstants;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
@@ -15,8 +10,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class AdapayCallbackRecordServiceImpl implements AdapayCallbackRecordService {
|
public class AdapayCallbackRecordServiceImpl implements AdapayCallbackRecordService {
|
||||||
@@ -32,29 +25,7 @@ public class AdapayCallbackRecordServiceImpl implements AdapayCallbackRecordServ
|
|||||||
adapayCallbackRecordMapper.insert(callbackRecord);
|
adapayCallbackRecordMapper.insert(callbackRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void saveAdapayCallbackRecord(String data) throws JsonProcessingException {
|
|
||||||
JSONObject jsonObject = JSON.parseObject(data);
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
|
|
||||||
AdapayCallbackRecord adapayCallbackRecord = mapper.readValue(jsonObject.toJSONString(), AdapayCallbackRecord.class);
|
|
||||||
adapayCallbackRecord.setExpend(jsonObject.getString("expend"));
|
|
||||||
adapayCallbackRecord.setPaymentId(jsonObject.getString("id"));
|
|
||||||
|
|
||||||
JSONObject descJson = JSON.parseObject(adapayCallbackRecord.getDescription());
|
|
||||||
String type = descJson.getString("type");
|
|
||||||
adapayCallbackRecord.setPayScenario(type);
|
|
||||||
String memberId = descJson.getString("memberId");
|
|
||||||
adapayCallbackRecord.setMemberId(memberId);
|
|
||||||
String orderCode = descJson.getString("orderCode");
|
|
||||||
adapayCallbackRecord.setOrderCode(orderCode);
|
|
||||||
BigDecimal amount = adapayCallbackRecord.getPayAmt();
|
|
||||||
|
|
||||||
// 保存到数据库
|
|
||||||
this.saveAdapayCallbackRecord(adapayCallbackRecord);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据订单号查询支付回调信息
|
* 根据订单号查询支付回调信息
|
||||||
* @param orderCode
|
* @param orderCode
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.pile.service.impl;
|
package com.jsowell.pile.service.impl;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.jsowell.common.constant.CacheConstants;
|
import com.jsowell.common.constant.CacheConstants;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
@@ -55,6 +56,16 @@ public class AdapayMemberAccountServiceImpl implements IAdapayMemberAccountServi
|
|||||||
return adapayMemberAccountMapper.selectAdapayMemberAccountList(adapayMemberAccount);
|
return adapayMemberAccountMapper.selectAdapayMemberAccountList(adapayMemberAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AdapayMemberAccount> selectAdapayMemberAccountList(String merchantId) {
|
||||||
|
if (StringUtils.isBlank(merchantId)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
|
||||||
|
adapayMemberAccount.setMerchantId(merchantId);
|
||||||
|
return selectAdapayMemberAccountList(adapayMemberAccount);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增【请填写功能名称】
|
* 新增【请填写功能名称】
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
|||||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
|
import com.jsowell.common.enums.AcquirerEnum;
|
||||||
import com.jsowell.common.enums.MemberWalletEnum;
|
import com.jsowell.common.enums.MemberWalletEnum;
|
||||||
import com.jsowell.common.enums.ykc.*;
|
import com.jsowell.common.enums.ykc.*;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
@@ -805,6 +806,30 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
transactionService.doUpdateOrder(dto);
|
transactionService.doUpdateOrder(dto);
|
||||||
logger.info("结算订单 end OrderTransactionDTO:{}", JSONObject.toJSONString(dto));
|
logger.info("结算订单 end OrderTransactionDTO:{}", JSONObject.toJSONString(dto));
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 将卡/vin状态解锁
|
||||||
|
if (!StringUtils.equals("0000000000000000", data.getLogicCard())) {
|
||||||
|
// 根据物理卡号查出当前为锁定状态的卡
|
||||||
|
PileAuthCard cardInfo = pileAuthCardService.selectSomeStatusCardInfo(CardStatusEnum.START_LOCK.getCode(), orderBasicInfo.getLogicCard());
|
||||||
|
if (cardInfo != null) {
|
||||||
|
// orderBasicInfo.setMemberId(cardInfo.getMemberId());
|
||||||
|
// 将此卡状态改为正常
|
||||||
|
cardInfo.setStatus(CardStatusEnum.NORMAL.getCode());
|
||||||
|
pileAuthCardService.updatePileAuthCard(cardInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果是vin启动,将启动锁定状态改为正常
|
||||||
|
if (StringUtils.equals(data.getTransactionIdentifier(), "05")) {
|
||||||
|
MemberPlateNumberRelation plateInfo = memberPlateNumberRelationService.getMemberPlateInfoByVinCode(data.getVinCode());
|
||||||
|
if (plateInfo != null && (StringUtils.equals(plateInfo.getVinStatus(), "2"))) {
|
||||||
|
plateInfo.setVinStatus("1");
|
||||||
|
memberPlateNumberRelationService.updateMemberPlateNumberRelation(plateInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("解锁卡/vin状态 error,", e);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// uniApp 发送停止充电订阅消息
|
// uniApp 发送停止充电订阅消息
|
||||||
WechatSendMsgDTO wechatSendMsgDTO = new WechatSendMsgDTO();
|
WechatSendMsgDTO wechatSendMsgDTO = new WechatSendMsgDTO();
|
||||||
@@ -2179,22 +2204,8 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
// 微信支付
|
// 微信支付
|
||||||
dto.setOrderBasicInfo(orderInfo);
|
dto.setOrderBasicInfo(orderInfo);
|
||||||
|
|
||||||
|
// 2023-07-11 全部改为汇付支付
|
||||||
Map<String, Object> weixinMap = adapayPayOrder(dto);
|
Map<String, Object> weixinMap = adapayPayOrder(dto);
|
||||||
// 从字典中获取使用汇付支付的站点
|
|
||||||
// List<SysDictData> adapay_station = DictUtils.getDictCache("adapay_station");
|
|
||||||
// List<String> stationIdList = Lists.newArrayList();
|
|
||||||
// if (CollectionUtils.isNotEmpty(adapay_station)) {
|
|
||||||
// for (SysDictData sysDictData : adapay_station) {
|
|
||||||
// stationIdList.add(sysDictData.getDictValue());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (stationIdList.contains(orderInfo.getStationId())) {
|
|
||||||
// logger.info("该站点:{}在字典中配置了使用汇付支付", orderInfo.getStationId());
|
|
||||||
// weixinMap = adapayPayOrder(dto);
|
|
||||||
// } else {
|
|
||||||
// logger.info("该站点:{}使用微信支付", orderInfo.getStationId());
|
|
||||||
// weixinMap = wechatPayOrder(dto);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 返回微信支付参数
|
// 返回微信支付参数
|
||||||
resultMap.put("weixinMap", weixinMap);
|
resultMap.put("weixinMap", weixinMap);
|
||||||
@@ -2472,6 +2483,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
.orderCode(orderCode)
|
.orderCode(orderCode)
|
||||||
.payMode(OrderPayRecordEnum.PRINCIPAL_BALANCE_PAYMENT.getValue())
|
.payMode(OrderPayRecordEnum.PRINCIPAL_BALANCE_PAYMENT.getValue())
|
||||||
.payAmount(principalPay)
|
.payAmount(principalPay)
|
||||||
|
.acquirer(AcquirerEnum.LOCAL.getValue())
|
||||||
.createBy(dto.getMemberId())
|
.createBy(dto.getMemberId())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
@@ -2480,6 +2492,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
.orderCode(orderCode)
|
.orderCode(orderCode)
|
||||||
.payMode(OrderPayRecordEnum.GIFT_BALANCE_PAYMENT.getValue())
|
.payMode(OrderPayRecordEnum.GIFT_BALANCE_PAYMENT.getValue())
|
||||||
.payAmount(giftPay)
|
.payAmount(giftPay)
|
||||||
|
.acquirer(AcquirerEnum.LOCAL.getValue())
|
||||||
.createBy(dto.getMemberId())
|
.createBy(dto.getMemberId())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,35 +15,11 @@ public class OrderPayRecordServiceImpl implements IOrderPayRecordService {
|
|||||||
private OrderPayRecordMapper orderPayRecordMapper;
|
private OrderPayRecordMapper orderPayRecordMapper;
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public int deleteByPrimaryKey(Integer id) {
|
|
||||||
// return orderPayRecordMapper.deleteByPrimaryKey(id);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public int insert(OrderPayRecord record) {
|
|
||||||
// return orderPayRecordMapper.insert(record);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public int insertSelective(OrderPayRecord record) {
|
|
||||||
// return orderPayRecordMapper.insertSelective(record);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public OrderPayRecord selectByPrimaryKey(Integer id) {
|
|
||||||
// return orderPayRecordMapper.selectByPrimaryKey(id);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateByPrimaryKeySelective(OrderPayRecord record) {
|
public int updateByPrimaryKeySelective(OrderPayRecord record) {
|
||||||
return orderPayRecordMapper.updateByPrimaryKeySelective(record);
|
return orderPayRecordMapper.updateByPrimaryKeySelective(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public int updateByPrimaryKey(OrderPayRecord record) {
|
|
||||||
// return orderPayRecordMapper.updateByPrimaryKey(record);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchInsert(List<OrderPayRecord> payRecordList) {
|
public int batchInsert(List<OrderPayRecord> payRecordList) {
|
||||||
|
|||||||
@@ -11,5 +11,5 @@ import lombok.NoArgsConstructor;
|
|||||||
@Builder
|
@Builder
|
||||||
public class UniAppOrderDetailVO {
|
public class UniAppOrderDetailVO {
|
||||||
|
|
||||||
|
private String orderCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,12 +103,21 @@
|
|||||||
delete from adapay_member_account where id = #{id}
|
delete from adapay_member_account where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteAdapayMemberAccountByIds" parameterType="String">
|
<!--<delete id="deleteAdapayMemberAccountByIds" parameterType="String">
|
||||||
delete from adapay_member_account where id in
|
delete from adapay_member_account where id in
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>-->
|
||||||
|
|
||||||
|
<update id="deleteAdapayMemberAccountByIds" parameterType="com.jsowell.pile.domain.AdapayMemberAccount">
|
||||||
|
update adapay_member_account
|
||||||
|
set del_flag = '1'
|
||||||
|
where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="selectByMerchantId" resultMap="AdapayMemberAccountResult">
|
<select id="selectByMerchantId" resultMap="AdapayMemberAccountResult">
|
||||||
select
|
select
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<result column="pay_mode" jdbcType="VARCHAR" property="payMode" />
|
<result column="pay_mode" jdbcType="VARCHAR" property="payMode" />
|
||||||
<result column="pay_amount" jdbcType="DECIMAL" property="payAmount" />
|
<result column="pay_amount" jdbcType="DECIMAL" property="payAmount" />
|
||||||
<result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
|
<result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
|
||||||
|
<result column="acquirer" jdbcType="VARCHAR" property="acquirer" />
|
||||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||||
@@ -17,8 +18,8 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
id, order_code, pay_mode, pay_amount, refund_amount, create_by, create_time, update_by, update_time,
|
id, order_code, pay_mode, pay_amount, refund_amount, acquirer,
|
||||||
del_flag
|
create_by, create_time, update_by, update_time, del_flag
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
@@ -32,77 +33,7 @@
|
|||||||
delete from order_pay_record
|
delete from order_pay_record
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderPayRecord" useGeneratedKeys="true">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
insert into order_pay_record (order_code, pay_mode, pay_amount, refund_amount,
|
|
||||||
create_by, create_time, update_by,
|
|
||||||
update_time, del_flag)
|
|
||||||
values (#{orderCode,jdbcType=VARCHAR}, #{payMode,jdbcType=VARCHAR}, #{payAmount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL},
|
|
||||||
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
|
|
||||||
#{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=CHAR})
|
|
||||||
</insert>
|
|
||||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderPayRecord" useGeneratedKeys="true">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
insert into order_pay_record
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="orderCode != null and orderCode != ''">
|
|
||||||
order_code,
|
|
||||||
</if>
|
|
||||||
<if test="payMode != null and payMode != ''">
|
|
||||||
pay_mode,
|
|
||||||
</if>
|
|
||||||
<if test="payAmount != null">
|
|
||||||
pay_amount,
|
|
||||||
</if>
|
|
||||||
<if test="refundAmount != null">
|
|
||||||
refund_amount,
|
|
||||||
</if>
|
|
||||||
<if test="createBy != null and createBy != ''">
|
|
||||||
create_by,
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
create_time,
|
|
||||||
</if>
|
|
||||||
<if test="updateBy != null and updateBy != ''">
|
|
||||||
update_by,
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
update_time,
|
|
||||||
</if>
|
|
||||||
<if test="delFlag != null and delFlag != ''">
|
|
||||||
del_flag,
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="orderCode != null and orderCode != ''">
|
|
||||||
#{orderCode,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="payMode != null and payMode != ''">
|
|
||||||
#{payMode,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="payAmount != null">
|
|
||||||
#{payAmount,jdbcType=DECIMAL},
|
|
||||||
</if>
|
|
||||||
<if test="refundAmount != null">
|
|
||||||
#{refundAmount,jdbcType=DECIMAL},
|
|
||||||
</if>
|
|
||||||
<if test="createBy != null and createBy != ''">
|
|
||||||
#{createBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
#{createTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updateBy != null and updateBy != ''">
|
|
||||||
#{updateBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
#{updateTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="delFlag != null and delFlag != ''">
|
|
||||||
#{delFlag,jdbcType=CHAR},
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.jsowell.pile.domain.OrderPayRecord">
|
<update id="updateByPrimaryKeySelective" parameterType="com.jsowell.pile.domain.OrderPayRecord">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
update order_pay_record
|
update order_pay_record
|
||||||
@@ -119,6 +50,9 @@
|
|||||||
<if test="refundAmount != null">
|
<if test="refundAmount != null">
|
||||||
refund_amount = #{refundAmount,jdbcType=DECIMAL},
|
refund_amount = #{refundAmount,jdbcType=DECIMAL},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="acquirer != null">
|
||||||
|
acquirer = #{acquirer,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="createBy != null and createBy != ''">
|
<if test="createBy != null and createBy != ''">
|
||||||
create_by = #{createBy,jdbcType=VARCHAR},
|
create_by = #{createBy,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
@@ -144,6 +78,7 @@
|
|||||||
pay_mode = #{payMode,jdbcType=VARCHAR},
|
pay_mode = #{payMode,jdbcType=VARCHAR},
|
||||||
pay_amount = #{payAmount,jdbcType=DECIMAL},
|
pay_amount = #{payAmount,jdbcType=DECIMAL},
|
||||||
refund_amount = #{refundAmount,jdbcType=DECIMAL},
|
refund_amount = #{refundAmount,jdbcType=DECIMAL},
|
||||||
|
acquirer = #{acquirer,jdbcType=VARCHAR},
|
||||||
create_by = #{createBy,jdbcType=VARCHAR},
|
create_by = #{createBy,jdbcType=VARCHAR},
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||||
@@ -154,12 +89,12 @@
|
|||||||
|
|
||||||
<insert id="batchInsert">
|
<insert id="batchInsert">
|
||||||
insert into order_pay_record
|
insert into order_pay_record
|
||||||
(order_code, pay_mode, pay_amount, create_by)
|
(order_code, pay_mode, pay_amount, acquirer, create_by)
|
||||||
values
|
values
|
||||||
<foreach collection="payRecordList" item="item" separator=",">
|
<foreach collection="payRecordList" item="item" separator=",">
|
||||||
(
|
(
|
||||||
#{item.orderCode,jdbcType=VARCHAR}, #{item.payMode,jdbcType=VARCHAR}, #{item.payAmount,jdbcType=DECIMAL},
|
#{item.orderCode,jdbcType=VARCHAR}, #{item.payMode,jdbcType=VARCHAR}, #{item.payAmount,jdbcType=DECIMAL},
|
||||||
#{item.createBy,jdbcType=VARCHAR}
|
#{item.acquirer,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ package com.jsowell.thirdparty.lianlian.util;
|
|||||||
|
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
|
import com.jsowell.common.util.StringUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.client.config.RequestConfig;
|
import org.apache.http.client.config.RequestConfig;
|
||||||
@@ -102,6 +105,7 @@ public class HttpRequestUtil {
|
|||||||
*/
|
*/
|
||||||
public static String sendPost(String token, String data, String url, String dataSecret,
|
public static String sendPost(String token, String data, String url, String dataSecret,
|
||||||
String dataSecretIV, String operatorId, String sigSecret){
|
String dataSecretIV, String operatorId, String sigSecret){
|
||||||
|
log.info("联联平台发送请求 data:{}", data);
|
||||||
//加密
|
//加密
|
||||||
byte[] encryptText = Cryptos.aesEncrypt(data.getBytes(),
|
byte[] encryptText = Cryptos.aesEncrypt(data.getBytes(),
|
||||||
dataSecret.getBytes(), dataSecretIV.getBytes());
|
dataSecret.getBytes(), dataSecretIV.getBytes());
|
||||||
@@ -125,11 +129,18 @@ public class HttpRequestUtil {
|
|||||||
log.info("接收到返回数据:{}", hutoolRequest);
|
log.info("接收到返回数据:{}", hutoolRequest);
|
||||||
// System.out.println("接收到返回数据:" + hutoolRequest);
|
// System.out.println("接收到返回数据:" + hutoolRequest);
|
||||||
|
|
||||||
Map<String, String> map = (Map<String, String>) JSON.parse(hutoolRequest);
|
Map<String, Object> map = (Map<String, Object>) JSON.parse(hutoolRequest);
|
||||||
|
|
||||||
log.info("返回数据map:{}", JSON.toJSONString(map));
|
log.info("返回数据map:{}", JSON.toJSONString(map));
|
||||||
String rData = map.get("Data");
|
|
||||||
String resultMsg = map.get("Msg");
|
int ret = (int) map.get("Ret");
|
||||||
|
String resultMsg = (String) map.get("Msg");
|
||||||
|
if (ret != 0) {
|
||||||
|
// 表示请求有异常
|
||||||
|
log.error("联联平台发送请求 error:{}, 源数据:{}", resultMsg, data);
|
||||||
|
return resultMsg;
|
||||||
|
}
|
||||||
|
String rData = (String) map.get("Data");
|
||||||
|
|
||||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(rData),
|
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(rData),
|
||||||
dataSecret.getBytes(), dataSecretIV.getBytes());
|
dataSecret.getBytes(), dataSecretIV.getBytes());
|
||||||
|
|||||||
@@ -1,65 +1,65 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { Notification, MessageBox, Message, Loading } from 'element-ui'
|
import {Notification, MessageBox, Message, Loading} from 'element-ui'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { getToken } from '@/utils/auth'
|
import {getToken} from '@/utils/auth'
|
||||||
import errorCode from '@/utils/errorCode'
|
import errorCode from '@/utils/errorCode'
|
||||||
import { tansParams, blobValidate } from "@/utils/common";
|
import {tansParams, blobValidate} from "@/utils/common";
|
||||||
import cache from '@/plugins/cache'
|
import cache from '@/plugins/cache'
|
||||||
import { saveAs } from 'file-saver'
|
import {saveAs} from 'file-saver'
|
||||||
|
|
||||||
let downloadLoadingInstance;
|
let downloadLoadingInstance;
|
||||||
// 是否显示重新登录
|
// 是否显示重新登录
|
||||||
export let isRelogin = { show: false };
|
export let isRelogin = {show: false};
|
||||||
|
|
||||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||||
baseURL: process.env.VUE_APP_BASE_API,
|
baseURL: process.env.VUE_APP_BASE_API,
|
||||||
// 超时
|
// 超时
|
||||||
timeout: 30000
|
timeout: 30000
|
||||||
})
|
})
|
||||||
|
|
||||||
// request拦截器
|
// request拦截器
|
||||||
service.interceptors.request.use(config => {
|
service.interceptors.request.use(config => {
|
||||||
// 是否需要设置 token
|
// 是否需要设置 token
|
||||||
const isToken = (config.headers || {}).isToken === false
|
const isToken = (config.headers || {}).isToken === false
|
||||||
// 是否需要防止数据重复提交
|
// 是否需要防止数据重复提交
|
||||||
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
|
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
|
||||||
if (getToken() && !isToken) {
|
if (getToken() && !isToken) {
|
||||||
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||||
}
|
|
||||||
// get请求映射params参数
|
|
||||||
if (config.method === 'get' && config.params) {
|
|
||||||
let url = config.url + '?' + tansParams(config.params);
|
|
||||||
url = url.slice(0, -1);
|
|
||||||
config.params = {};
|
|
||||||
config.url = url;
|
|
||||||
}
|
|
||||||
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
|
|
||||||
const requestObj = {
|
|
||||||
url: config.url,
|
|
||||||
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
|
|
||||||
time: new Date().getTime()
|
|
||||||
}
|
}
|
||||||
const sessionObj = cache.session.getJSON('sessionObj')
|
// get请求映射params参数
|
||||||
if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
|
if (config.method === 'get' && config.params) {
|
||||||
cache.session.setJSON('sessionObj', requestObj)
|
let url = config.url + '?' + tansParams(config.params);
|
||||||
} else {
|
url = url.slice(0, -1);
|
||||||
const s_url = sessionObj.url; // 请求地址
|
config.params = {};
|
||||||
const s_data = sessionObj.data; // 请求数据
|
config.url = url;
|
||||||
const s_time = sessionObj.time; // 请求时间
|
|
||||||
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
|
|
||||||
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
|
|
||||||
const message = '数据正在处理,请勿重复提交';
|
|
||||||
console.warn(`[${s_url}]: ` + message)
|
|
||||||
return Promise.reject(new Error(message))
|
|
||||||
} else {
|
|
||||||
cache.session.setJSON('sessionObj', requestObj)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
|
||||||
return config
|
const requestObj = {
|
||||||
|
url: config.url,
|
||||||
|
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
|
||||||
|
time: new Date().getTime()
|
||||||
|
}
|
||||||
|
const sessionObj = cache.session.getJSON('sessionObj')
|
||||||
|
if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
|
||||||
|
cache.session.setJSON('sessionObj', requestObj)
|
||||||
|
} else {
|
||||||
|
const s_url = sessionObj.url; // 请求地址
|
||||||
|
const s_data = sessionObj.data; // 请求数据
|
||||||
|
const s_time = sessionObj.time; // 请求时间
|
||||||
|
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
|
||||||
|
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
|
||||||
|
const message = '数据正在处理,请勿重复提交';
|
||||||
|
console.warn(`[${s_url}]: ` + message)
|
||||||
|
return Promise.reject(new Error(message))
|
||||||
|
} else {
|
||||||
|
cache.session.setJSON('sessionObj', requestObj)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return config
|
||||||
}, error => {
|
}, error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
@@ -67,92 +67,96 @@ service.interceptors.request.use(config => {
|
|||||||
|
|
||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
service.interceptors.response.use(res => {
|
service.interceptors.response.use(res => {
|
||||||
// 未设置状态码则默认成功状态
|
// 未设置状态码则默认成功状态
|
||||||
const code = res.data.code || 200;
|
const code = res.data.code || 200;
|
||||||
// 获取错误信息
|
// 获取错误信息
|
||||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||||
// 二进制数据则直接返回
|
// 二进制数据则直接返回
|
||||||
if(res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer'){
|
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
||||||
return res.data
|
return res.data
|
||||||
}
|
|
||||||
if (code === 401) {
|
|
||||||
if (!isRelogin.show) {
|
|
||||||
isRelogin.show = true;
|
|
||||||
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
|
||||||
confirmButtonText: '重新登录',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
|
||||||
}
|
}
|
||||||
).then(() => {
|
if (code === 401) {
|
||||||
isRelogin.show = false;
|
if (!isRelogin.show) {
|
||||||
store.dispatch('LogOut').then(() => {
|
isRelogin.show = true;
|
||||||
location.href = '/index';
|
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
||||||
|
confirmButtonText: '重新登录',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
isRelogin.show = false;
|
||||||
|
store.dispatch('LogOut').then(() => {
|
||||||
|
location.href = '/index';
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
isRelogin.show = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
|
} else if (code === 500) {
|
||||||
|
Message({
|
||||||
|
message: msg,
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return Promise.reject(new Error(msg))
|
||||||
|
} else if (code !== 200) {
|
||||||
|
Notification.error({
|
||||||
|
title: msg
|
||||||
|
})
|
||||||
|
return Promise.reject('error')
|
||||||
|
} else {
|
||||||
|
return res.data
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.log('err' + error)
|
||||||
|
let {message} = error;
|
||||||
|
if (message == "Network Error") {
|
||||||
|
message = "后端接口连接异常";
|
||||||
|
} else if (message.includes("timeout")) {
|
||||||
|
message = "系统接口请求超时";
|
||||||
|
} else if (message.includes("Request failed with status code")) {
|
||||||
|
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||||
|
}
|
||||||
|
Message({
|
||||||
|
message: message,
|
||||||
|
type: 'error',
|
||||||
|
duration: 5 * 1000
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
return Promise.reject(error)
|
||||||
isRelogin.show = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
|
||||||
} else if (code === 500) {
|
|
||||||
Message({
|
|
||||||
message: msg,
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
return Promise.reject(new Error(msg))
|
|
||||||
} else if (code !== 200) {
|
|
||||||
Notification.error({
|
|
||||||
title: msg
|
|
||||||
})
|
|
||||||
return Promise.reject('error')
|
|
||||||
} else {
|
|
||||||
return res.data
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
console.log('err' + error)
|
|
||||||
let { message } = error;
|
|
||||||
if (message == "Network Error") {
|
|
||||||
message = "后端接口连接异常";
|
|
||||||
}
|
|
||||||
else if (message.includes("timeout")) {
|
|
||||||
message = "系统接口请求超时";
|
|
||||||
}
|
|
||||||
else if (message.includes("Request failed with status code")) {
|
|
||||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
|
||||||
}
|
|
||||||
Message({
|
|
||||||
message: message,
|
|
||||||
type: 'error',
|
|
||||||
duration: 5 * 1000
|
|
||||||
})
|
|
||||||
return Promise.reject(error)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 通用下载方法
|
// 通用下载方法
|
||||||
export function download(url, params, filename) {
|
export function download(url, params, filename) {
|
||||||
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
|
downloadLoadingInstance = Loading.service({
|
||||||
return service.post(url, params, {
|
text: "正在下载数据,请稍候",
|
||||||
transformRequest: [(params) => { return tansParams(params) }],
|
spinner: "el-icon-loading",
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
background: "rgba(0, 0, 0, 0.7)",
|
||||||
responseType: 'blob'
|
})
|
||||||
}).then(async (data) => {
|
return service.post(url, params, {
|
||||||
const isLogin = await blobValidate(data);
|
transformRequest: [(params) => {
|
||||||
if (isLogin) {
|
return tansParams(params)
|
||||||
const blob = new Blob([data])
|
}],
|
||||||
saveAs(blob, filename)
|
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||||
} else {
|
responseType: 'blob'
|
||||||
const resText = await data.text();
|
}).then(async (data) => {
|
||||||
const rspObj = JSON.parse(resText);
|
const isLogin = await blobValidate(data);
|
||||||
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
if (isLogin) {
|
||||||
Message.error(errMsg);
|
const blob = new Blob([data])
|
||||||
}
|
saveAs(blob, filename)
|
||||||
downloadLoadingInstance.close();
|
} else {
|
||||||
}).catch((r) => {
|
const resText = await data.text();
|
||||||
console.error(r)
|
const rspObj = JSON.parse(resText);
|
||||||
Message.error('下载文件出现错误,请联系管理员!')
|
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||||
downloadLoadingInstance.close();
|
Message.error(errMsg);
|
||||||
})
|
}
|
||||||
|
downloadLoadingInstance.close();
|
||||||
|
}).catch((r) => {
|
||||||
|
console.error(r)
|
||||||
|
Message.error('下载文件出现错误,请联系管理员!')
|
||||||
|
downloadLoadingInstance.close();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default service
|
export default service
|
||||||
|
|||||||
@@ -130,11 +130,11 @@
|
|||||||
>导出
|
>导出
|
||||||
</el-button
|
</el-button
|
||||||
>
|
>
|
||||||
<div>
|
<!-- <div>
|
||||||
{{ dateDescription }}期间,总用电量{{ sumUsedElectricity }}度,总消费金额{{
|
{{ dateDescription }}期间,总用电量{{ sumUsedElectricity }}度,总消费金额{{
|
||||||
sumOrderAmount
|
sumOrderAmount
|
||||||
}}元,总结算金额{{ sumSettleAmount }}元
|
}}元,总结算金额{{ sumSettleAmount }}元
|
||||||
</div>
|
</div>-->
|
||||||
<el-popover placement="top-start" width="400" trigger="click">
|
<el-popover placement="top-start" width="400" trigger="click">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
:indeterminate="isIndeterminate"
|
:indeterminate="isIndeterminate"
|
||||||
@@ -480,7 +480,7 @@ export default {
|
|||||||
// 查询站点列表
|
// 查询站点列表
|
||||||
this.getStationList();
|
this.getStationList();
|
||||||
// 获取订单总金额
|
// 获取订单总金额
|
||||||
this.getOrderTotalData();
|
// this.getOrderTotalData();
|
||||||
},
|
},
|
||||||
/** 查询订单列表 */
|
/** 查询订单列表 */
|
||||||
getList() {
|
getList() {
|
||||||
|
|||||||
Reference in New Issue
Block a user