mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
Merge branch 'dev-new' into dev-new-rabbitmq
# Conflicts: # jsowell-admin/src/test/java/PaymentTestController.java
This commit is contained in:
39
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/ChargeAlgorithmController.java
vendored
Normal file
39
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/ChargeAlgorithmController.java
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.jsowell.api.thirdparty;
|
||||
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.thirdparty.platform.service.impl.ChargeAlgorithmService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 算法应用Controller
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2024/12/17 15:20:36
|
||||
*/
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/chargealgorithm")
|
||||
public class ChargeAlgorithmController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ChargeAlgorithmService chargeAlgorithmService;
|
||||
|
||||
@GetMapping("/pushOrderInfo/{orderCode}")
|
||||
public RestApiResponse<?> pushOrderInfo(@PathVariable("orderCode") String orderCode) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String result = chargeAlgorithmService.pushOrderInfo(orderCode);
|
||||
response = new RestApiResponse<>(result);
|
||||
}catch (Exception e) {
|
||||
logger.error("算法应用推送订单信息 error, ", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.jsowell.api.thirdparty;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.domain.AjaxResult;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPartyReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.pile.dto.QueryOperatorInfoDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||
@@ -12,12 +13,10 @@ import com.jsowell.thirdparty.lianlian.common.CommonResult;
|
||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -33,6 +32,7 @@ public class GuiZhouPlatformController extends ThirdPartyBaseController {
|
||||
@Qualifier("guiZhouPlatformServiceImpl")
|
||||
private ThirdPartyPlatformService platformLogic;
|
||||
|
||||
|
||||
/**
|
||||
* getToken
|
||||
*/
|
||||
@@ -150,4 +150,63 @@ public class GuiZhouPlatformController extends ThirdPartyBaseController {
|
||||
}
|
||||
return CommonResult.failed("查询充电站状态信息发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 历史充电订单信息推送
|
||||
*/
|
||||
@GetMapping("/v1/notificationChargeOrderInfoHistory/{orderCode}")
|
||||
public RestApiResponse<?> notificationChargeOrderInfoHistory(@PathVariable("orderCode") String orderCode) {
|
||||
RestApiResponse<?> response = null;
|
||||
String result = null;
|
||||
try {
|
||||
result = platformLogic.notificationChargeOrderInfoHistory(orderCode);
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("贵州平台推送充电站历史充电订单信息 error", e);
|
||||
return new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("贵州平台推送充电站历史充电订单信息 result:{}", result);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送充换电站用能统计信息
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/v1/notificationOperationStatsInfo/{stationId}")
|
||||
public RestApiResponse<?> notificationOperationStatsInfo(@PathVariable("stationId") String stationId) {
|
||||
RestApiResponse<?> response = null;
|
||||
String result = null;
|
||||
try {
|
||||
result = platformLogic.notificationOperationStatsInfo(stationId);
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("贵州平台推送充换电站用能统计信息 error", e);
|
||||
return new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("贵州平台推送充换电站用能统计信息 result:{}", result);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送充换电站实时功率
|
||||
* @param stationIds
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/v1/notificationPowerInfo/{stationIds}")
|
||||
public RestApiResponse<?> notificationPowerInfo(@PathVariable("stationIds") List<String> stationIds) {
|
||||
RestApiResponse<?> response = null;
|
||||
String result = null;
|
||||
try {
|
||||
result = platformLogic.notificationPowerInfo(stationIds);
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("贵州平台推送充换电站用能统计信息 error", e);
|
||||
return new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("贵州平台推送充换电站用能统计信息 result:{}", result);
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,14 +11,12 @@ import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.JWTUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.dto.PushInfoParamDTO;
|
||||
import com.jsowell.pile.dto.PushRealTimeInfoDTO;
|
||||
import com.jsowell.pile.dto.PushStationInfoDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.thirdparty.lianlian.common.CommonResult;
|
||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.service.impl.ZhongDianLianPlatformServiceImpl;
|
||||
import com.jsowell.thirdparty.platform.util.Cryptos;
|
||||
import com.jsowell.thirdparty.platform.util.Encodes;
|
||||
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
|
||||
@@ -383,4 +381,12 @@ public class ZDLController extends ThirdPartyBaseController {
|
||||
logger.info("宁波平台推送订单信息 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
@PostMapping("/tempPushHistoryOrderInfo")
|
||||
public RestApiResponse<?> tempPushHistoryOrderInfo(@RequestBody QueryOrderDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
String result = platformLogic.pushOrderInfo(dto);
|
||||
response = new RestApiResponse<>(result);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,6 +422,7 @@ public class OrderService {
|
||||
order.setStartTime(DateUtils.formatDateTime(orderBasicInfo.getChargeStartTime()));
|
||||
order.setEndTime(DateUtils.formatDateTime(orderBasicInfo.getChargeEndTime()));
|
||||
order.setCreateTime(DateUtils.formatDateTime(orderBasicInfo.getCreateTime()));
|
||||
order.setStopReasonCode(orderBasicInfo.getStopReasonCode());
|
||||
order.setStopReasonMsg(orderBasicInfo.getReason());
|
||||
order.setStartSOC(orderBasicInfo.getStartSoc());
|
||||
order.setEndSOC(orderBasicInfo.getEndSoc());
|
||||
@@ -580,6 +581,7 @@ public class OrderService {
|
||||
}
|
||||
PileStationVO stationInfo = pileStationInfoService.getStationInfo(orderBasicInfo.getStationId());
|
||||
vo.setStationName(stationInfo.getStationName());
|
||||
vo.setStopReasonCode(orderBasicInfo.getStopReasonCode());
|
||||
vo.setReason(orderBasicInfo.getReason());
|
||||
vo.setOrderAmount(String.valueOf(orderBasicInfo.getOrderAmount()));
|
||||
vo.setPayAmount(String.valueOf(orderBasicInfo.getPayAmount()));
|
||||
|
||||
@@ -112,15 +112,17 @@ public class PileService {
|
||||
|
||||
public int batchCreatePile(BatchCreatePileDTO dto) {
|
||||
String softwareProtocol = dto.getSoftwareProtocol();
|
||||
if (StringUtils.isBlank(softwareProtocol)) {
|
||||
throw new BusinessException(ReturnCodeEnum.valueOf("软件协议不能为空"));
|
||||
}
|
||||
// if (StringUtils.isBlank(softwareProtocol)) {
|
||||
// throw new BusinessException(ReturnCodeEnum.valueOf("软件协议不能为空"));
|
||||
// }
|
||||
// 批量生成sn号
|
||||
List<String> snList = null;
|
||||
if (StringUtils.equals(SoftwareProtocolEnum.YOU_DIAN.getValue(), softwareProtocol)) {
|
||||
snList = snUtils.generateEBikeSN(dto.getNum());
|
||||
} else {
|
||||
} else if (StringUtils.equals(SoftwareProtocolEnum.YUN_KUAI_CHONG.getValue(), softwareProtocol)){
|
||||
snList = snUtils.generateEVPileSN(dto.getNum());
|
||||
} else {
|
||||
throw new BusinessException(ReturnCodeEnum.valueOf("软件协议不正确"));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -488,42 +490,54 @@ public class PileService {
|
||||
// 为空说明此用户未注册平台账号
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_USER_IS_NOT_REGISTER);
|
||||
}
|
||||
// 被分享的用户memberId
|
||||
String memberId = memberBasicInfo.getMemberId();
|
||||
|
||||
List<PileMemberRelation> relationList = pileMemberRelationService.selectPileMemberRelationByPileSn(dto.getPileSn());
|
||||
if (CollectionUtils.isEmpty(relationList)) {
|
||||
// 充电桩没有绑定任何人
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_NO_ADMIN_FOR_PILE);
|
||||
}
|
||||
// 使用stream把relationList转为map, key为type, value为List<PileMemberRelation>
|
||||
Map<String, List<PileMemberRelation>> map = relationList.stream().collect(Collectors.groupingBy(PileMemberRelation::getType));
|
||||
List<PileMemberRelation> adminMemberRelationList = map.get(Constants.ONE); // 管理员列表
|
||||
|
||||
List<String> adminList = relationList.stream()
|
||||
.filter(x -> x.getType().equals(Constants.ONE)) // 1-管理员用户
|
||||
if (CollectionUtils.isEmpty(adminMemberRelationList)) {
|
||||
// 充电桩没有管理员
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_NO_ADMIN_FOR_PILE);
|
||||
}
|
||||
List<String> adminList = adminMemberRelationList.stream()
|
||||
.map(PileMemberRelation::getMemberId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(adminList)) {
|
||||
// 没有管理员
|
||||
}
|
||||
|
||||
// 校验身份
|
||||
if (adminList.contains(dto.getMemberId())) {
|
||||
// 校验身份 入参是否是管理员
|
||||
if (adminList.contains(memberId)) {
|
||||
// 如果不为空,说明被分享的用户是管理员,抛出异常
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_AUTHENTICATION_ERROR);
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ALREADY_AN_ADMIN);
|
||||
}
|
||||
|
||||
List<String> userList = relationList.stream()
|
||||
.filter(x -> !x.getType().equals(Constants.TWO)) // 2-普通用户
|
||||
.map(PileMemberRelation::getMemberId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (userList.contains(memberBasicInfo.getMemberId())) {
|
||||
List<String> userList = Lists.newArrayList();
|
||||
List<PileMemberRelation> userMemberRelations = map.get(Constants.TWO); // 普通用户列表
|
||||
if (CollectionUtils.isNotEmpty(userMemberRelations)) {
|
||||
userList = userMemberRelations.stream()
|
||||
.map(PileMemberRelation::getMemberId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 校验身份 入参是否是普通用户
|
||||
if (userList.contains(memberId)) {
|
||||
// 不为空说明已绑定
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_USER_HAS_BEEN_THIS_PILE);
|
||||
} else {
|
||||
// 进行绑定,此用户为普通用户
|
||||
PileMemberRelation info = new PileMemberRelation();
|
||||
info.setPileSn(dto.getPileSn());
|
||||
info.setMemberId(memberBasicInfo.getMemberId());
|
||||
info.setType(Constants.TWO);
|
||||
pileMemberRelationService.insertPileMemberRelation(info);
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ALREADY_AN_USER);
|
||||
}
|
||||
PileMemberRelation pileMemberRelation = adminMemberRelationList.get(0); // 获取管理员列表的第一个元素
|
||||
// 进行绑定,此用户为普通用户
|
||||
PileMemberRelation info = new PileMemberRelation();
|
||||
info.setPileSn(dto.getPileSn());
|
||||
info.setMemberId(memberId);
|
||||
info.setType(Constants.TWO);
|
||||
if (pileMemberRelation != null && StringUtils.isNotBlank(pileMemberRelation.getDeviceId())) {
|
||||
info.setDeviceId(pileMemberRelation.getDeviceId());
|
||||
info.setDeviceName(pileMemberRelation.getDeviceName());
|
||||
}
|
||||
pileMemberRelationService.insertPileMemberRelation(info);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -650,6 +664,7 @@ public class PileService {
|
||||
}
|
||||
vo.setMemberId(personalChargingRecord.getMemberId());
|
||||
vo.setSumChargingDegree(personalChargingRecord.getTotalUsedElectricity().toString());
|
||||
vo.setStopReasonCode(personalChargingRecord.getStopReasonCode());
|
||||
vo.setStopReasonMsg(personalChargingRecord.getReason());
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.huifu.adapay.model.PaymentReverse;
|
||||
import com.huifu.adapay.model.Refund;
|
||||
@@ -84,6 +85,200 @@ public class PaymentTestController {
|
||||
return list;
|
||||
}
|
||||
|
||||
// 需要重新分账的订单信息(针对未分账的订单)
|
||||
public JSONArray getPaymentList() {
|
||||
String jsonArrayString = "[" +
|
||||
"{\"orderCode\":\"C25133803815\", \"settleAmount\":\"42.94\", \"paymentId\":\"002212024071413111510658428550211133440\"}" +
|
||||
"]";
|
||||
return JSONArray.parseArray(jsonArrayString);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量执行分账
|
||||
*/
|
||||
@Test
|
||||
public void batchCreatePaymentConfirm() {
|
||||
JSONArray paymentList = getPaymentList();
|
||||
// TODO 获取默认结算账户,如需分给对应商户就填写正确的汇付会员id
|
||||
// AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.getDefault();
|
||||
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
|
||||
adapayMemberAccount.setAdapayMemberId("ACM25158725");
|
||||
for (int i = 0; i < paymentList.size(); i++) {
|
||||
JSONObject jsonObject = (JSONObject) paymentList.get(i);
|
||||
BigDecimal confirmAmt = jsonObject.getBigDecimal("settleAmount"); // 确认金额就是结算金额
|
||||
String paymentId = jsonObject.getString("paymentId"); // 支付id
|
||||
String orderCode = jsonObject.getString("orderCode"); // 订单编号
|
||||
|
||||
// 延时分账,使用确认交易API
|
||||
PaymentConfirmResponse paymentConfirmResponse = adapayService.createPaymentConfirmRequest(paymentId,
|
||||
adapayMemberAccount, confirmAmt, orderCode, wechatAppId1);
|
||||
System.out.println(JSON.toJSONString(paymentConfirmResponse));
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<String> list1 = Lists.newArrayList(
|
||||
"C84866578627",
|
||||
"C69407733440",
|
||||
"C46698893183",
|
||||
"C23481086913",
|
||||
"C46631353044",
|
||||
"C82315862441",
|
||||
"C48515444163",
|
||||
"C88894523461",
|
||||
"C63539142496",
|
||||
"C88227376749",
|
||||
"C69808468000",
|
||||
"C29756635462",
|
||||
"C48171513017",
|
||||
"C82929694510",
|
||||
"C42286214889",
|
||||
"C40531240168",
|
||||
"C42818195903",
|
||||
"C44772182853",
|
||||
"C63995701102",
|
||||
"C84653836282",
|
||||
"C82929004110",
|
||||
"C42248888826",
|
||||
"C42871512014",
|
||||
"C61630741271",
|
||||
"C44120948533",
|
||||
"C86510728306",
|
||||
"C23698728789",
|
||||
"C40725164803",
|
||||
"C46426468297",
|
||||
"C80876734677",
|
||||
"C65208404269",
|
||||
"C48131292456",
|
||||
"C27264263390",
|
||||
"C42620874381",
|
||||
"C27264478506",
|
||||
"C82758563554",
|
||||
"C44588350706",
|
||||
"C86153980315",
|
||||
"C86782182478",
|
||||
"C42077527679",
|
||||
"C80606430852",
|
||||
"C21377880382",
|
||||
"C63590496985",
|
||||
"C25745398205",
|
||||
"C63136978056",
|
||||
"C21983806615",
|
||||
"C42016184953",
|
||||
"C27458903931",
|
||||
"C40590975531",
|
||||
"C44987731257",
|
||||
"C63554143992",
|
||||
"C46468609277",
|
||||
"C23483139052",
|
||||
"C67759764676",
|
||||
"C65286550984",
|
||||
"C44772583755",
|
||||
"C65037735356",
|
||||
"C23065540340",
|
||||
"C82330428460",
|
||||
"C40136408323",
|
||||
"C65896968515",
|
||||
"C80093965053",
|
||||
"C23029064125",
|
||||
"C46291260090",
|
||||
"C40915419435",
|
||||
"C69234709266",
|
||||
"C61064626771",
|
||||
"C84216893653",
|
||||
"C69869670458",
|
||||
"C44755242724",
|
||||
"C63706872923",
|
||||
"C61047783388",
|
||||
"C80663278468",
|
||||
"C46232390797",
|
||||
"C44561702210",
|
||||
"C61404525849",
|
||||
"C80813608253"
|
||||
);
|
||||
List<String> list2 = Lists.newArrayList(
|
||||
"C69407733440",
|
||||
"C84866578627",
|
||||
"C46698893183",
|
||||
"C46631353044",
|
||||
"C23481086913",
|
||||
"C88894523461",
|
||||
"C48515444163",
|
||||
"C82315862441",
|
||||
"C48171513017",
|
||||
"C29756635462",
|
||||
"C69808468000",
|
||||
"C88227376749",
|
||||
"C63539142496",
|
||||
"C42818195903",
|
||||
"C40531240168",
|
||||
"C42286214889",
|
||||
"C82929694510",
|
||||
"C63995701102",
|
||||
"C44772182853",
|
||||
"C84653836282",
|
||||
"C42871512014",
|
||||
"C42248888826",
|
||||
"C82929004110",
|
||||
"C44120948533",
|
||||
"C61630741271",
|
||||
"C23698728789",
|
||||
"C86510728306",
|
||||
"C80876734677",
|
||||
"C46426468297",
|
||||
"C40725164803",
|
||||
"C48131292456",
|
||||
"C65208404269",
|
||||
"C82758563554",
|
||||
"C27264263390",
|
||||
"C27264478506",
|
||||
"C42620874381",
|
||||
"C25745398205",
|
||||
"C86153980315",
|
||||
"C63590496985",
|
||||
"C21377880382",
|
||||
"C80606430852",
|
||||
"C44588350706",
|
||||
"C42077527679",
|
||||
"C86782182478",
|
||||
"C40590975531",
|
||||
"C27458903931",
|
||||
"C42016184953",
|
||||
"C21983806615",
|
||||
"C63136978056",
|
||||
"C44772583755",
|
||||
"C46468609277",
|
||||
"C65286550984",
|
||||
"C63554143992",
|
||||
"C67759764676",
|
||||
"C44987731257",
|
||||
"C23483139052",
|
||||
"C23065540340",
|
||||
"C65037735356",
|
||||
"C80093965053",
|
||||
"C65896968515",
|
||||
"C82330428460",
|
||||
"C40136408323",
|
||||
"C23029064125",
|
||||
"C63706872923",
|
||||
"C40915419435",
|
||||
"C44755242724",
|
||||
"C69869670458",
|
||||
"C84216893653",
|
||||
"C61064626771",
|
||||
"C69234709266",
|
||||
"C46291260090",
|
||||
"C80813608253",
|
||||
"C61404525849",
|
||||
"C61047783388",
|
||||
"C44561702210",
|
||||
"C46232390797",
|
||||
"C80663278468");
|
||||
Sets.SetView<String> difference = Sets.intersection(Sets.newHashSet(list1), Sets.newHashSet(list2));
|
||||
System.out.println(difference);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分账信息
|
||||
* @throws BaseAdaPayException
|
||||
@@ -232,10 +427,10 @@ public class PaymentTestController {
|
||||
*/
|
||||
@Test
|
||||
public void createPaymentReverseRequestTest() {
|
||||
String paymentId = "002212024120516445110710666157707481088";
|
||||
BigDecimal refundAmount = new BigDecimal("32.31");
|
||||
String memberId = "46690495";
|
||||
String orderCode = "C86577082495";
|
||||
String paymentId = "002212024102215301510694702317666226176";
|
||||
BigDecimal refundAmount = new BigDecimal("15.42");
|
||||
String memberId = "42833137";
|
||||
String orderCode = "C21960272918";
|
||||
|
||||
// 延迟分账未确认调撤销调撤销接口退款
|
||||
PaymentReverseOperation operation = new PaymentReverseOperation();
|
||||
@@ -273,35 +468,4 @@ public class PaymentTestController {
|
||||
String wechatAppId = wechatAppId1; // 万车充id
|
||||
adapayService.createBalancePaymentRequest(outMemberId, inMemberId, transAmt, title, desc, wechatAppId);
|
||||
}
|
||||
|
||||
// 需要重新分账的订单信息(针对未分账的订单)
|
||||
public JSONArray getPaymentList() {
|
||||
String jsonArrayString = "[" +
|
||||
"{\"orderCode\":\"C25133803815\", \"settleAmount\":\"42.94\", \"paymentId\":\"002212024071413111510658428550211133440\"}" +
|
||||
"]";
|
||||
return JSONArray.parseArray(jsonArrayString);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量执行分账
|
||||
*/
|
||||
@Test
|
||||
public void batchCreatePaymentConfirm() {
|
||||
JSONArray paymentList = getPaymentList();
|
||||
// TODO 获取默认结算账户,如需分给对应商户就填写正确的汇付会员id
|
||||
// AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.getDefault();
|
||||
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
|
||||
adapayMemberAccount.setAdapayMemberId("ACM25158725");
|
||||
for (int i = 0; i < paymentList.size(); i++) {
|
||||
JSONObject jsonObject = (JSONObject) paymentList.get(i);
|
||||
BigDecimal confirmAmt = jsonObject.getBigDecimal("settleAmount"); // 确认金额就是结算金额
|
||||
String paymentId = jsonObject.getString("paymentId"); // 支付id
|
||||
String orderCode = jsonObject.getString("orderCode"); // 订单编号
|
||||
|
||||
// 延时分账,使用确认交易API
|
||||
PaymentConfirmResponse paymentConfirmResponse = adapayService.createPaymentConfirmRequest(paymentId,
|
||||
adapayMemberAccount, confirmAmt, orderCode, wechatAppId1);
|
||||
System.out.println(JSON.toJSONString(paymentConfirmResponse));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user