mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-08 20:10:16 +08:00
update 电池充电报告Service
This commit is contained in:
@@ -3,6 +3,7 @@ package com.jsowell.api.thirdparty;
|
|||||||
import com.jsowell.common.annotation.Anonymous;
|
import com.jsowell.common.annotation.Anonymous;
|
||||||
import com.jsowell.common.core.controller.BaseController;
|
import com.jsowell.common.core.controller.BaseController;
|
||||||
import com.jsowell.common.response.RestApiResponse;
|
import com.jsowell.common.response.RestApiResponse;
|
||||||
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.thirdparty.platform.dto.BatteryChargeReportDTO;
|
import com.jsowell.thirdparty.platform.dto.BatteryChargeReportDTO;
|
||||||
import com.jsowell.thirdparty.platform.service.impl.BatteryChargeReportService;
|
import com.jsowell.thirdparty.platform.service.impl.BatteryChargeReportService;
|
||||||
import com.jsowell.thirdparty.platform.service.impl.ChargeAlgorithmService;
|
import com.jsowell.thirdparty.platform.service.impl.ChargeAlgorithmService;
|
||||||
@@ -31,8 +32,12 @@ public class ChargeAlgorithmController extends BaseController {
|
|||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
// String result = chargeAlgorithmService.pushOrderInfo(orderCode);
|
// String result = chargeAlgorithmService.pushOrderInfo(orderCode);
|
||||||
String result = batteryChargeReportService.getTaskIdByOrderCode(dto.getOrderCode(), dto.getReportType());
|
String taskId = batteryChargeReportService.getTaskIdByOrderCode(dto.getOrderCode());
|
||||||
response = new RestApiResponse<>(result);
|
String url = "";
|
||||||
|
if (StringUtils.isNotBlank(taskId)) {
|
||||||
|
url = batteryChargeReportService.getUrlByTaskId(taskId, dto.getReportType());
|
||||||
|
}
|
||||||
|
response = new RestApiResponse<>(url);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("算法应用推送订单信息 error, ", e);
|
logger.error("算法应用推送订单信息 error, ", e);
|
||||||
response = new RestApiResponse<>(e);
|
response = new RestApiResponse<>(e);
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ import com.jsowell.thirdparty.parking.common.bean.QcyunParkCouponDTO;
|
|||||||
import com.jsowell.thirdparty.parking.service.LTYTService;
|
import com.jsowell.thirdparty.parking.service.LTYTService;
|
||||||
import com.jsowell.thirdparty.parking.service.QcyunsService;
|
import com.jsowell.thirdparty.parking.service.QcyunsService;
|
||||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||||
|
import com.jsowell.thirdparty.platform.service.impl.BatteryChargeReportService;
|
||||||
import com.jsowell.thirdparty.platform.util.Cryptos;
|
import com.jsowell.thirdparty.platform.util.Cryptos;
|
||||||
import com.jsowell.thirdparty.platform.util.Encodes;
|
import com.jsowell.thirdparty.platform.util.Encodes;
|
||||||
import com.jsowell.thirdparty.platform.util.GBSignUtils;
|
import com.jsowell.thirdparty.platform.util.GBSignUtils;
|
||||||
@@ -292,6 +293,9 @@ public class SpringBootTestController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrderSplitRecordService orderSplitRecordService;
|
private OrderSplitRecordService orderSplitRecordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BatteryChargeReportService batteryChargeReportService;
|
||||||
|
|
||||||
@Qualifier("zhongDianLianPlatformServiceImpl")
|
@Qualifier("zhongDianLianPlatformServiceImpl")
|
||||||
private ThirdPartyPlatformService platformLogic;
|
private ThirdPartyPlatformService platformLogic;
|
||||||
|
|
||||||
@@ -305,6 +309,21 @@ public class SpringBootTestController {
|
|||||||
|
|
||||||
private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10, JsowellThreadFactory.forName("test-thread-factory"));
|
private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10, JsowellThreadFactory.forName("test-thread-factory"));
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBatteryReport() throws InterruptedException {
|
||||||
|
String orderCode = "C25787997784";
|
||||||
|
String taskId = batteryChargeReportService.getTaskIdByOrderCode(orderCode);
|
||||||
|
|
||||||
|
|
||||||
|
// String taskId = "f46d86c5fc9942c3a4806aa97120d279";
|
||||||
|
String url = batteryChargeReportService.getUrlByTaskId(taskId, Constants.TWO);
|
||||||
|
if (StringUtils.isBlank(url)) {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
url = batteryChargeReportService.getUrlByTaskId(taskId, Constants.TWO);
|
||||||
|
}
|
||||||
|
System.out.println(url);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThread() {
|
public void testThread() {
|
||||||
threadFactory.newThread(() -> System.out.println("testThread:"+ Thread.currentThread().getName()));
|
threadFactory.newThread(() -> System.out.println("testThread:"+ Thread.currentThread().getName()));
|
||||||
|
|||||||
@@ -33,4 +33,6 @@ public class BatteryReportResult {
|
|||||||
private String taskId;
|
private String taskId;
|
||||||
|
|
||||||
private String directUrl;
|
private String directUrl;
|
||||||
|
|
||||||
|
private String timestamp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.jsowell.thirdparty.platform.service.impl;
|
|||||||
|
|
||||||
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.jsowell.common.constant.CacheConstants;
|
import com.jsowell.common.constant.CacheConstants;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.core.domain.ykc.*;
|
import com.jsowell.common.core.domain.ykc.*;
|
||||||
@@ -74,7 +75,7 @@ public class BatteryChargeReportService {
|
|||||||
*
|
*
|
||||||
* @param orderCode
|
* @param orderCode
|
||||||
*/
|
*/
|
||||||
public String getTaskIdByOrderCode(String orderCode, String reportType) {
|
public String getTaskIdByOrderCode(String orderCode) {
|
||||||
// 根据订单号查询订单信息
|
// 根据订单号查询订单信息
|
||||||
OrderVO orderVO = orderBasicInfoService.getChargeOrderInfoByOrderCode(orderCode);
|
OrderVO orderVO = orderBasicInfoService.getChargeOrderInfoByOrderCode(orderCode);
|
||||||
if (orderVO == null) {
|
if (orderVO == null) {
|
||||||
@@ -124,7 +125,8 @@ public class BatteryChargeReportService {
|
|||||||
}
|
}
|
||||||
// 获取对应的 url
|
// 获取对应的 url
|
||||||
// 将 result 部分转换成 BatteryReportResult 对象
|
// 将 result 部分转换成 BatteryReportResult 对象
|
||||||
BatteryReportResult batteryReportResult = (BatteryReportResult) resultMap.get("result");
|
// BatteryReportResult batteryReportResult = (BatteryReportResult) resultMap.get("result");
|
||||||
|
BatteryReportResult batteryReportResult = JSONObject.parseObject(resultMap.get("result").toString(), BatteryReportResult.class);;
|
||||||
String pdfUrl = batteryReportResult.getPdfUrl();
|
String pdfUrl = batteryReportResult.getPdfUrl();
|
||||||
if (StringUtils.isBlank(pdfUrl)) {
|
if (StringUtils.isBlank(pdfUrl)) {
|
||||||
String webUrl = batteryReportResult.getWebUrl();
|
String webUrl = batteryReportResult.getWebUrl();
|
||||||
|
|||||||
Reference in New Issue
Block a user