update 电池报告算法Service移动至pile模块下

This commit is contained in:
Lemon
2026-03-10 09:22:22 +08:00
parent 6ddff8db35
commit cc1b58a9d1
7 changed files with 49 additions and 23 deletions

View File

@@ -5,8 +5,7 @@ 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.pile.dto.BatteryChargeReportDTO; import com.jsowell.pile.dto.BatteryChargeReportDTO;
import com.jsowell.thirdparty.platform.service.impl.BatteryChargeReportService; import com.jsowell.pile.service.batteryreport.BatteryChargeReportService;
import com.jsowell.thirdparty.platform.service.impl.ChargeAlgorithmService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;

View File

@@ -22,7 +22,7 @@ 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.pile.dto.BatteryChargeReportDTO;
import com.jsowell.thirdparty.platform.service.impl.BatteryChargeReportService; import com.jsowell.pile.service.batteryreport.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;

View File

@@ -27,7 +27,7 @@ import com.jsowell.pile.service.*;
import com.jsowell.pile.service.programlogic.AbstractProgramLogic; import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
import com.jsowell.pile.service.programlogic.ProgramLogicFactory; import com.jsowell.pile.service.programlogic.ProgramLogicFactory;
import com.jsowell.thirdparty.common.CommonService; import com.jsowell.thirdparty.common.CommonService;
import com.jsowell.thirdparty.platform.service.impl.BatteryChargeReportService; import com.jsowell.pile.service.batteryreport.BatteryChargeReportService;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;

View File

@@ -1,4 +1,4 @@
package com.jsowell.thirdparty.platform.domain; package com.jsowell.pile.domain.batteryreport;
import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.jsowell.thirdparty.platform.domain; package com.jsowell.pile.domain.batteryreport;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;

View File

@@ -1,4 +1,4 @@
package com.jsowell.thirdparty.platform.service.impl; package com.jsowell.pile.service.batteryreport;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
@@ -8,17 +8,16 @@ import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.*; import com.jsowell.common.core.domain.ykc.*;
import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.RandomUtil;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ChargeAlgorithmRecord; import com.jsowell.pile.domain.ChargeAlgorithmRecord;
import com.jsowell.pile.domain.batteryreport.BatteryChargeReportData;
import com.jsowell.pile.domain.batteryreport.BatteryReportResult;
import com.jsowell.pile.service.*; import com.jsowell.pile.service.*;
import com.jsowell.pile.thirdparty.ParameterConfigData; import com.jsowell.pile.thirdparty.ParameterConfigData;
import com.jsowell.pile.vo.uniapp.customer.OrderVO; import com.jsowell.pile.vo.uniapp.customer.OrderVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.PileDetailVO; import com.jsowell.pile.vo.web.PileDetailVO;
import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.thirdparty.platform.domain.BatteryChargeReportData;
import com.jsowell.thirdparty.platform.domain.BatteryReportResult;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@@ -8,6 +8,7 @@ import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.dto.BatteryChargeReportDTO; import com.jsowell.pile.dto.BatteryChargeReportDTO;
import com.jsowell.pile.service.ChargeAlgorithmRecordService; import com.jsowell.pile.service.ChargeAlgorithmRecordService;
import com.jsowell.pile.service.batteryreport.BatteryChargeReportService;
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;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -25,6 +26,9 @@ public class ChargeAlgorithmRecordServiceImpl implements ChargeAlgorithmRecordSe
@Autowired @Autowired
private ChargeAlgorithmRecordMapper chargeAlgorithmRecordMapper; private ChargeAlgorithmRecordMapper chargeAlgorithmRecordMapper;
@Autowired
private BatteryChargeReportService batteryChargeReportService;
/** /**
* 查询电池充电算法记录 * 查询电池充电算法记录
* *
@@ -125,20 +129,44 @@ public class ChargeAlgorithmRecordServiceImpl implements ChargeAlgorithmRecordSe
*/ */
@Override @Override
public String getUrlByParams(BatteryChargeReportDTO dto) { public String getUrlByParams(BatteryChargeReportDTO dto) {
ChargeAlgorithmRecord record = queryRecordByOrderCode(dto.getOrderCode()); // 参数校验
String reportType = dto.getReportType(); if (dto == null || StringUtils.isBlank(dto.getOrderCode())) {
if (StringUtils.equals(Constants.ONE, reportType)) { return StringUtils.EMPTY;
// 1-web 端
if (StringUtils.isNotBlank(record.getWebUrl())) {
return record.getWebUrl();
} }
}else if (StringUtils.equals(Constants.TWO, reportType)) {
// 2-pdf 端 ChargeAlgorithmRecord record = queryRecordByOrderCode(dto.getOrderCode());
if (StringUtils.isNotBlank(record.getPdfUrl())) { if (record == null) {
return StringUtils.EMPTY;
}
// 获取记录中的URL
String urlFromRecord = getUrlFromRecordByType(record, dto.getReportType());
if (StringUtils.isNotBlank(urlFromRecord)) {
return urlFromRecord;
}
// 如果记录中没有且taskId存在通过服务获取
if (StringUtils.isNotBlank(dto.getTaskId())) {
return batteryChargeReportService.getUrlByTaskId(dto.getTaskId(), dto.getReportType());
}
return StringUtils.EMPTY;
}
/**
* 通过记录获取URL
* @param record
* @param reportType
* @return
*/
private String getUrlFromRecordByType(ChargeAlgorithmRecord record, String reportType) {
if (StringUtils.equals(Constants.ONE, reportType)) {
return record.getWebUrl();
} else if (StringUtils.equals(Constants.TWO, reportType)) {
return record.getPdfUrl(); return record.getPdfUrl();
} }
} return null;
return "";
} }
/** /**