新增 查询充电报告接口

This commit is contained in:
Lemon
2025-11-24 10:05:20 +08:00
parent 0472df17c9
commit 91efa36e04
6 changed files with 57 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
package com.jsowell.pile.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 电池报告DTO
*
* @author Lemon
* @Date 2025/9/11 10:44:48
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BatteryChargeReportDTO {
private String orderCode;
/**
* 报告类型
* 1-web; 2-pdf
*/
private String reportType;
}

View File

@@ -3,6 +3,8 @@ package com.jsowell.pile.mapper;
import java.util.List;
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.Repository;

View File

@@ -3,6 +3,7 @@ package com.jsowell.pile.service;
import java.util.List;
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
import com.jsowell.pile.dto.BatteryChargeReportDTO;
import com.jsowell.pile.vo.uniapp.customer.ChargeAlgorithmRecordVO;
/**
@@ -83,4 +84,11 @@ public interface ChargeAlgorithmRecordService {
* @return
*/
ChargeAlgorithmRecord queryRecordByTaskId(String taskId);
/**
* 通过参数获取报告地址
* @param dto
* @return
*/
String getUrlByParams(BatteryChargeReportDTO dto);
}

View File

@@ -3,7 +3,10 @@ package com.jsowell.pile.service.impl;
import java.util.List;
import com.alibaba.fastjson2.JSON;
import com.jsowell.common.constant.Constants;
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.vo.uniapp.customer.ChargeAlgorithmRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
@@ -115,6 +118,25 @@ public class ChargeAlgorithmRecordServiceImpl implements ChargeAlgorithmRecordSe
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