fix: 修复 Energy 模块 Feign 客户端配置
This commit is contained in:
@@ -1,19 +1,33 @@
|
|||||||
package cn.iocoder.yudao.module.asset.api.station;
|
package cn.iocoder.yudao.module.asset.api.station;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.asset.api.station.dto.HydrogenStationRespDTO;
|
import cn.iocoder.yudao.module.asset.api.station.dto.HydrogenStationRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.asset.enums.ApiConstants;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加氢站 API 接口
|
* 加氢站 API 接口
|
||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
|
@FeignClient(name = ApiConstants.NAME)
|
||||||
|
@Tag(name = "RPC 服务 - 加氢站")
|
||||||
public interface HydrogenStationApi {
|
public interface HydrogenStationApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/hydrogen-station";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取加氢站信息
|
* 获取加氢站信息
|
||||||
*
|
*
|
||||||
* @param id 加氢站ID
|
* @param id 加氢站ID
|
||||||
* @return 加氢站信息
|
* @return 加氢站信息
|
||||||
*/
|
*/
|
||||||
HydrogenStationRespDTO getStation(Long id);
|
@GetMapping(PREFIX + "/get")
|
||||||
|
@Operation(summary = "获取加氢站信息")
|
||||||
|
CommonResult<HydrogenStationRespDTO> getStation(@RequestParam("id") @Parameter(description = "加氢站ID") Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,30 @@
|
|||||||
package cn.iocoder.yudao.module.asset.api;
|
package cn.iocoder.yudao.module.asset.api;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.asset.api.station.HydrogenStationApi;
|
import cn.iocoder.yudao.module.asset.api.station.HydrogenStationApi;
|
||||||
import cn.iocoder.yudao.module.asset.api.station.dto.HydrogenStationRespDTO;
|
import cn.iocoder.yudao.module.asset.api.station.dto.HydrogenStationRespDTO;
|
||||||
import cn.iocoder.yudao.module.asset.convert.station.HydrogenStationConvert;
|
import cn.iocoder.yudao.module.asset.convert.station.HydrogenStationConvert;
|
||||||
import cn.iocoder.yudao.module.asset.dal.dataobject.station.HydrogenStationDO;
|
import cn.iocoder.yudao.module.asset.dal.dataobject.station.HydrogenStationDO;
|
||||||
import cn.iocoder.yudao.module.asset.service.station.HydrogenStationService;
|
import cn.iocoder.yudao.module.asset.service.station.HydrogenStationService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加氢站 API 实现类
|
* 加氢站 API 实现类
|
||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Service
|
@RestController
|
||||||
public class HydrogenStationApiImpl implements HydrogenStationApi {
|
public class HydrogenStationApiImpl implements HydrogenStationApi {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private HydrogenStationService hydrogenStationService;
|
private HydrogenStationService hydrogenStationService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HydrogenStationRespDTO getStation(Long id) {
|
public CommonResult<HydrogenStationRespDTO> getStation(Long id) {
|
||||||
HydrogenStationDO station = hydrogenStationService.getHydrogenStation(id);
|
HydrogenStationDO station = hydrogenStationService.getHydrogenStation(id);
|
||||||
return HydrogenStationConvert.INSTANCE.convertToApi(station);
|
return success(HydrogenStationConvert.INSTANCE.convertToApi(station));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class DetailEventListener {
|
|||||||
log.info("[onRecordImported] 生成明细完成,count={}", details.size());
|
log.info("[onRecordImported] 生成明细完成,count={}", details.size());
|
||||||
|
|
||||||
// 3. 检查站点配置,决定是否自动扣款
|
// 3. 检查站点配置,决定是否自动扣款
|
||||||
HydrogenStationRespDTO station = hydrogenStationApi.getStation(event.getStationId());
|
HydrogenStationRespDTO station = hydrogenStationApi.getStation(event.getStationId()).getData();
|
||||||
if (station != null && Boolean.TRUE.equals(station.getAutoDeduct())) {
|
if (station != null && Boolean.TRUE.equals(station.getAutoDeduct())) {
|
||||||
log.info("[onRecordImported] 站点配置自动扣款,开始扣款流程");
|
log.info("[onRecordImported] 站点配置自动扣款,开始扣款流程");
|
||||||
for (EnergyHydrogenDetailDO detail : details) {
|
for (EnergyHydrogenDetailDO detail : details) {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class HydrogenDetailServiceImpl implements HydrogenDetailService {
|
|||||||
// 3. 审核通过 → 检查是否需要扣款
|
// 3. 审核通过 → 检查是否需要扣款
|
||||||
if (approved) {
|
if (approved) {
|
||||||
// 获取站点配置
|
// 获取站点配置
|
||||||
HydrogenStationRespDTO station = hydrogenStationApi.getStation(detail.getStationId());
|
HydrogenStationRespDTO station = hydrogenStationApi.getStation(detail.getStationId()).getData();
|
||||||
|
|
||||||
// 如果配置为审核后扣款(autoDeduct=false),则执行扣款
|
// 如果配置为审核后扣款(autoDeduct=false),则执行扣款
|
||||||
if (station != null && !Boolean.TRUE.equals(station.getAutoDeduct())) {
|
if (station != null && !Boolean.TRUE.equals(station.getAutoDeduct())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user