mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-14 15:00:14 +08:00
新增 查询充电报告接口
This commit is contained in:
@@ -4,7 +4,7 @@ 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.common.util.StringUtils;
|
||||||
import com.jsowell.thirdparty.platform.dto.BatteryChargeReportDTO;
|
import com.jsowell.pile.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;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import com.jsowell.pile.vo.uniapp.customer.OrderVO;
|
|||||||
import com.jsowell.pile.vo.uniapp.customer.ParkingOrderVO;
|
import com.jsowell.pile.vo.uniapp.customer.ParkingOrderVO;
|
||||||
import com.jsowell.pile.vo.uniapp.customer.UniAppOrderVO;
|
import com.jsowell.pile.vo.uniapp.customer.UniAppOrderVO;
|
||||||
import com.jsowell.service.OrderService;
|
import com.jsowell.service.OrderService;
|
||||||
|
import com.jsowell.pile.dto.BatteryChargeReportDTO;
|
||||||
|
import com.jsowell.thirdparty.platform.service.impl.BatteryChargeReportService;
|
||||||
import com.jsowell.wxpay.dto.WechatSendMsgDTO;
|
import com.jsowell.wxpay.dto.WechatSendMsgDTO;
|
||||||
import com.jsowell.wxpay.service.WxAppletRemoteService;
|
import com.jsowell.wxpay.service.WxAppletRemoteService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -53,6 +55,8 @@ public class OrderController extends BaseController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderBasicInfoService orderBasicInfoService;
|
private OrderBasicInfoService orderBasicInfoService;
|
||||||
|
@Autowired
|
||||||
|
private BatteryChargeReportService batteryChargeReportService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成订单/创建订单
|
* 生成订单/创建订单
|
||||||
@@ -459,4 +463,23 @@ public class OrderController extends BaseController {
|
|||||||
logger.info("关闭订单:{}", orderCode);
|
logger.info("关闭订单:{}", orderCode);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询充电报告
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/getBatteryReport")
|
||||||
|
public RestApiResponse<?> getBatteryReport(@RequestBody BatteryChargeReportDTO dto) {
|
||||||
|
RestApiResponse<?> response = null;
|
||||||
|
try {
|
||||||
|
String url = chargeAlgorithmRecordService.getUrlByParams(dto);
|
||||||
|
response = new RestApiResponse<>(ImmutableMap.of("url", url));
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("查询订单号:{} 的充电报告 error:", dto.getOrderCode(), e);
|
||||||
|
response = new RestApiResponse<>(e);
|
||||||
|
}
|
||||||
|
logger.info("查询订单号:{} 的充电报告 params:{}, result:{}", dto.getOrderCode(), JSON.toJSONString(dto), response);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jsowell.thirdparty.platform.dto;
|
package com.jsowell.pile.dto;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@@ -3,6 +3,8 @@ package com.jsowell.pile.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
|
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
|
||||||
|
import com.jsowell.pile.dto.BatteryChargeReportDTO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.jsowell.pile.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
|
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
|
||||||
|
import com.jsowell.pile.dto.BatteryChargeReportDTO;
|
||||||
import com.jsowell.pile.vo.uniapp.customer.ChargeAlgorithmRecordVO;
|
import com.jsowell.pile.vo.uniapp.customer.ChargeAlgorithmRecordVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,4 +84,11 @@ public interface ChargeAlgorithmRecordService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ChargeAlgorithmRecord queryRecordByTaskId(String taskId);
|
ChargeAlgorithmRecord queryRecordByTaskId(String taskId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过参数获取报告地址
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getUrlByParams(BatteryChargeReportDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ package com.jsowell.pile.service.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
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 com.jsowell.pile.dto.BatteryChargeReportDTO;
|
||||||
import com.jsowell.pile.service.ChargeAlgorithmRecordService;
|
import com.jsowell.pile.service.ChargeAlgorithmRecordService;
|
||||||
import com.jsowell.pile.vo.uniapp.customer.ChargeAlgorithmRecordVO;
|
import com.jsowell.pile.vo.uniapp.customer.ChargeAlgorithmRecordVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -115,6 +118,25 @@ public class ChargeAlgorithmRecordServiceImpl implements ChargeAlgorithmRecordSe
|
|||||||
return chargeAlgorithmRecordMapper.queryRecordByTaskId(taskId);
|
return chargeAlgorithmRecordMapper.queryRecordByTaskId(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过参数获取报告URL
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getUrlByParams(BatteryChargeReportDTO dto) {
|
||||||
|
ChargeAlgorithmRecord record = queryRecordByOrderCode(dto.getOrderCode());
|
||||||
|
String reportType = dto.getReportType();
|
||||||
|
if (StringUtils.equals(Constants.ONE, reportType)) {
|
||||||
|
// 1-web 端
|
||||||
|
return record.getWebUrl();
|
||||||
|
}else if (StringUtils.equals(Constants.TWO, reportType)) {
|
||||||
|
// 2-pdf 端
|
||||||
|
return record.getPdfUrl();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过订单号查询充电电池算法报告
|
* 通过订单号查询充电电池算法报告
|
||||||
* @param orderCode
|
* @param orderCode
|
||||||
|
|||||||
Reference in New Issue
Block a user