mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
add 新增运营端小程序"我的钱包"界面接口
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package com.jsowell.api.uniapp.business;
|
||||
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.pile.dto.MerchantOrderReportDTO;
|
||||
import com.jsowell.pile.service.BusinessFinancialService;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessFinancialQueryResultVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 运营端财务信息相关Controller
|
||||
*
|
||||
* @author Lemon
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/financial")
|
||||
public class BusinessFinancialController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private BusinessFinancialService businessFinancialService;
|
||||
|
||||
/**
|
||||
* 我的钱包界面查询接口
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 钱包信息查询结果
|
||||
*/
|
||||
@PostMapping("/")
|
||||
public RestApiResponse<?> getMyWallet(@RequestBody MerchantOrderReportDTO dto) {
|
||||
logger.info("我的钱包查询 merchantId:{}", dto != null ? dto.getMerchantId() : null);
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
// 参数验证
|
||||
if (dto == null || StringUtils.isBlank(dto.getMerchantId())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
|
||||
BusinessFinancialQueryResultVO result = businessFinancialService.getMyWallet(dto);
|
||||
response = new RestApiResponse<>(result);
|
||||
logger.info("我的钱包查询成功 merchantId:{}", dto.getMerchantId());
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("我的钱包查询业务异常 merchantId:{}, code:{}, message:{}",
|
||||
dto != null ? dto.getMerchantId() : null, e.getCode(), e.getMessage(), e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("我的钱包查询系统异常 merchantId:{}",
|
||||
dto != null ? dto.getMerchantId() : null, e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
101
jsowell-admin/src/test/java/MemberBindingCarNoHttpTest.java
Normal file
101
jsowell-admin/src/test/java/MemberBindingCarNoHttpTest.java
Normal file
@@ -0,0 +1,101 @@
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitRecordDTO;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MemberBindingCarNoHttpTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// 1️⃣ 接口地址(和 curl 完全一致)
|
||||
String url = "https://apitest.jsowellcloud.com/order/commission/retryMerchantSplit";
|
||||
|
||||
// 2️⃣ 登录态 token(去掉 Bearer 前缀,setBearerAuth 会自动添加)
|
||||
String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImEyNmNhZmNiLTk5YzQtNDZkNi05M2EyLTg2NGYyOGVmYmFkYSJ9.Hv5-CztUtq04POwcUeBwvPLr2CzAnXcvnAZzNTH0zFo8ZxsP1ZoeqK7Pnohg4a-cdwvlpGFrXLDQ_gkr5psyBw";
|
||||
|
||||
|
||||
|
||||
String endTime = "2025-11-28";
|
||||
String startTime = "2025-11-28";
|
||||
|
||||
List<Integer> merchantIds = Arrays.asList(
|
||||
444, 281, 399, 355, 86, 162, 252, 341, 267, 327,
|
||||
312, 400, 384, 282, 297, 370, 87, 356, 41, 313,
|
||||
222, 255, 343, 447, 177, 25, 329, 147, 268, 283,
|
||||
298, 101, 314, 385, 401, 132, 193, 118, 166, 209,
|
||||
56, 357, 223, 416, 269, 88, 449, 330, 284, 402,
|
||||
102, 475, 149, 299, 237, 375, 210, 345, 72, 270,
|
||||
167, 134, 179, 26, 386, 316, 417, 89, 331, 451,
|
||||
195, 358, 103, 44, 376, 211, 432, 150, 119, 459,
|
||||
58, 259, 285, 301, 180, 73, 238, 477, 387, 28,
|
||||
452, 403, 226, 196, 272, 136, 332, 104, 45, 435,
|
||||
151, 460, 418, 377, 59, 302, 212, 319, 359, 349,
|
||||
273, 453, 388, 404, 170, 239, 29, 121, 227, 419,
|
||||
261, 106, 436, 138, 183, 76, 287, 198, 60, 462,
|
||||
47, 304, 389, 378, 481, 274, 351, 334, 214, 122,
|
||||
420, 321, 30, 405, 154, 228, 437, 172, 288, 352,
|
||||
108, 184, 263, 139, 322, 363, 275, 97, 199, 31,
|
||||
78, 421, 155, 391, 307, 123, 229, 353, 215, 173,
|
||||
380, 408, 185, 241, 364, 336, 276, 466, 140, 63,
|
||||
110, 422, 392, 32, 354, 230, 409, 309, 124, 324,
|
||||
186, 201, 51, 393, 141, 277, 337, 382, 33, 292,
|
||||
64, 366, 442, 310, 187, 489, 244, 468, 158, 410,
|
||||
232, 111, 425, 202, 125, 338, 81, 443, 188, 160,
|
||||
221, 34, 469, 143, 397, 427, 233, 294, 66, 54,
|
||||
126, 471, 367, 161, 189, 144, 113, 429, 295, 190,
|
||||
145, 114, 246, 127, 474, 82, 236, 368, 70, 146,
|
||||
369, 278, 115, 130, 248, 279, 131, 83, 280, 84,
|
||||
251, 116, 85, 35, 36, 3, 37, 9,
|
||||
17, 18, 19, 21, 22, 23, 24
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.setAccept(MediaType.parseMediaTypes("*/*"));
|
||||
headers.setBearerAuth(token); // 等价于 Authorization: Bearer xxx
|
||||
|
||||
int success = 0;
|
||||
int fail = 0;
|
||||
|
||||
for (Integer merchantId : merchantIds) {
|
||||
|
||||
QueryOrderSplitRecordDTO dto = new QueryOrderSplitRecordDTO();
|
||||
dto.setMerchantId(String.valueOf(merchantId));
|
||||
dto.setStartTime(startTime);
|
||||
dto.setEndTime(endTime);
|
||||
|
||||
HttpEntity<String> request =
|
||||
new HttpEntity<>(JSON.toJSONString(dto), headers);
|
||||
|
||||
try {
|
||||
ResponseEntity<String> response =
|
||||
restTemplate.postForEntity(url, request, String.class);
|
||||
|
||||
System.out.println("成功处理 merchantId=" + merchantId
|
||||
+ " response=" + response.getBody());
|
||||
success++;
|
||||
|
||||
// 👇 可选:防止接口被限流
|
||||
Thread.sleep(100);
|
||||
|
||||
} catch (Exception e) {
|
||||
fail++;
|
||||
System.err.println("处理失败 merchantId=" + merchantId);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("====== 批量处理完成 ======");
|
||||
System.out.println("成功:" + success);
|
||||
System.out.println("失败:" + fail);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user