Compare commits
4 Commits
b40f521c03
...
feat/energ
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1cb71efa4 | ||
|
|
042e14a9d3 | ||
|
|
40ea8e9065 | ||
|
|
02a6c2e5cb |
@@ -34,6 +34,13 @@
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-rpc</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,19 +1,33 @@
|
||||
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.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 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 加氢站")
|
||||
public interface HydrogenStationApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/hydrogen-station";
|
||||
|
||||
/**
|
||||
* 获取加氢站信息
|
||||
*
|
||||
* @param id 加氢站ID
|
||||
* @return 加氢站信息
|
||||
*/
|
||||
HydrogenStationRespDTO getStation(Long id);
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获取加氢站信息")
|
||||
CommonResult<HydrogenStationRespDTO> getStation(@RequestParam("id") @Parameter(description = "加氢站ID") Long id);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.asset.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.RpcConstants;
|
||||
|
||||
/**
|
||||
* API 相关的枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public class ApiConstants {
|
||||
|
||||
/**
|
||||
* 服务名
|
||||
*
|
||||
* 注意,需要保证和 spring.application.name 保持一致
|
||||
*/
|
||||
public static final String NAME = "asset-server";
|
||||
|
||||
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/asset";
|
||||
|
||||
public static final String VERSION = "1.0.0";
|
||||
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.contract;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -10,8 +8,6 @@ import java.util.Arrays;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ContractApprovalStatusEnum {
|
||||
|
||||
DRAFT(0, "草稿"),
|
||||
@@ -29,6 +25,18 @@ public enum ContractApprovalStatusEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
ContractApprovalStatusEnum(Integer status, String name) {
|
||||
this.status = status;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static ContractApprovalStatusEnum valueOf(Integer status) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getStatus().equals(status))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.contract;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -10,8 +8,6 @@ import java.util.Arrays;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ContractStatusEnum {
|
||||
|
||||
DRAFT(0, "草稿"),
|
||||
@@ -30,6 +26,18 @@ public enum ContractStatusEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
ContractStatusEnum(Integer status, String name) {
|
||||
this.status = status;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static ContractStatusEnum valueOf(Integer status) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getStatus().equals(status))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.contract;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -10,8 +8,6 @@ import java.util.Arrays;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ContractTypeEnum {
|
||||
|
||||
TRIAL(1, "试用合同"),
|
||||
@@ -26,6 +22,18 @@ public enum ContractTypeEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
ContractTypeEnum(Integer type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static ContractTypeEnum valueOf(Integer type) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getType().equals(type))
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.delivery;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 交车单状态枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeliveryOrderStatusEnum {
|
||||
|
||||
PENDING(0, "待完成"),
|
||||
@@ -18,6 +14,18 @@ public enum DeliveryOrderStatusEnum {
|
||||
private final Integer status;
|
||||
private final String name;
|
||||
|
||||
DeliveryOrderStatusEnum(Integer status, String name) {
|
||||
this.status = status;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static DeliveryOrderStatusEnum valueOf(Integer status) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getStatus().equals(status))
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.delivery;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 交车状态枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeliveryStatusEnum {
|
||||
|
||||
NOT_DELIVERED(0, "未交车"),
|
||||
@@ -18,6 +14,18 @@ public enum DeliveryStatusEnum {
|
||||
private final Integer status;
|
||||
private final String name;
|
||||
|
||||
DeliveryStatusEnum(Integer status, String name) {
|
||||
this.status = status;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static DeliveryStatusEnum valueOf(Integer status) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getStatus().equals(status))
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.delivery;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 交车任务状态枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeliveryTaskStatusEnum {
|
||||
|
||||
ACTIVE(0, "激活"),
|
||||
@@ -18,6 +14,18 @@ public enum DeliveryTaskStatusEnum {
|
||||
private final Integer status;
|
||||
private final String name;
|
||||
|
||||
DeliveryTaskStatusEnum(Integer status, String name) {
|
||||
this.status = status;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static DeliveryTaskStatusEnum valueOf(Integer status) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getStatus().equals(status))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.inspection;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -10,8 +8,6 @@ import java.util.Arrays;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum InspectionResultEnum {
|
||||
|
||||
PASS(1, "通过"),
|
||||
@@ -27,6 +23,18 @@ public enum InspectionResultEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
InspectionResultEnum(Integer result, String name) {
|
||||
this.result = result;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static InspectionResultEnum valueOf(Integer result) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getResult().equals(result))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.inspection;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -10,8 +8,6 @@ import java.util.Arrays;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum InspectionSourceTypeEnum {
|
||||
|
||||
PREPARE(1, "备车"),
|
||||
@@ -27,6 +23,18 @@ public enum InspectionSourceTypeEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
InspectionSourceTypeEnum(Integer type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static InspectionSourceTypeEnum valueOf(Integer type) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getType().equals(type))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.inspection;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -10,8 +8,6 @@ import java.util.Arrays;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum InspectionStatusEnum {
|
||||
|
||||
PENDING(0, "待检"),
|
||||
@@ -27,6 +23,18 @@ public enum InspectionStatusEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
InspectionStatusEnum(Integer status, String name) {
|
||||
this.status = status;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static InspectionStatusEnum valueOf(Integer status) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getStatus().equals(status))
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.prepare;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 备车状态枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum VehiclePrepareStatusEnum {
|
||||
|
||||
DRAFT(0, "待提交"),
|
||||
@@ -18,6 +14,18 @@ public enum VehiclePrepareStatusEnum {
|
||||
private final Integer status;
|
||||
private final String name;
|
||||
|
||||
VehiclePrepareStatusEnum(Integer status, String name) {
|
||||
this.status = status;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static VehiclePrepareStatusEnum valueOf(Integer status) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getStatus().equals(status))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.replacement;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -10,8 +8,6 @@ import java.util.Arrays;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ReplacementStatusEnum {
|
||||
|
||||
DRAFT(0, "草稿"),
|
||||
@@ -31,6 +27,18 @@ public enum ReplacementStatusEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
ReplacementStatusEnum(Integer status, String name) {
|
||||
this.status = status;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static ReplacementStatusEnum valueOf(Integer status) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getStatus().equals(status))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.asset.enums.replacement;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -10,8 +8,6 @@ import java.util.Arrays;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ReplacementTypeEnum {
|
||||
|
||||
TEMPORARY(1, "临时替换"),
|
||||
@@ -26,6 +22,18 @@ public enum ReplacementTypeEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
ReplacementTypeEnum(Integer type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static ReplacementTypeEnum valueOf(Integer type) {
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.getType().equals(type))
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
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.dto.HydrogenStationRespDTO;
|
||||
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.service.station.HydrogenStationService;
|
||||
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 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@RestController
|
||||
public class HydrogenStationApiImpl implements HydrogenStationApi {
|
||||
|
||||
@Resource
|
||||
private HydrogenStationService hydrogenStationService;
|
||||
|
||||
@Override
|
||||
public HydrogenStationRespDTO getStation(Long id) {
|
||||
public CommonResult<HydrogenStationRespDTO> getStation(Long id) {
|
||||
HydrogenStationDO station = hydrogenStationService.getHydrogenStation(id);
|
||||
return HydrogenStationConvert.INSTANCE.convertToApi(station);
|
||||
return success(HydrogenStationConvert.INSTANCE.convertToApi(station));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = {"cn.iocoder.yudao.module.infra.api"})
|
||||
@EnableFeignClients(basePackages = {"cn.iocoder.yudao.module.infra.api", "cn.iocoder.yudao.module.asset.api"})
|
||||
public class EnergyServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -86,7 +86,7 @@ public class DetailEventListener {
|
||||
log.info("[onRecordImported] 生成明细完成,count={}", details.size());
|
||||
|
||||
// 3. 检查站点配置,决定是否自动扣款
|
||||
HydrogenStationRespDTO station = hydrogenStationApi.getStation(event.getStationId());
|
||||
HydrogenStationRespDTO station = hydrogenStationApi.getStation(event.getStationId()).getData();
|
||||
if (station != null && Boolean.TRUE.equals(station.getAutoDeduct())) {
|
||||
log.info("[onRecordImported] 站点配置自动扣款,开始扣款流程");
|
||||
for (EnergyHydrogenDetailDO detail : details) {
|
||||
|
||||
@@ -97,7 +97,7 @@ public class HydrogenDetailServiceImpl implements HydrogenDetailService {
|
||||
// 3. 审核通过 → 检查是否需要扣款
|
||||
if (approved) {
|
||||
// 获取站点配置
|
||||
HydrogenStationRespDTO station = hydrogenStationApi.getStation(detail.getStationId());
|
||||
HydrogenStationRespDTO station = hydrogenStationApi.getStation(detail.getStationId()).getData();
|
||||
|
||||
// 如果配置为审核后扣款(autoDeduct=false),则执行扣款
|
||||
if (station != null && !Boolean.TRUE.equals(station.getAutoDeduct())) {
|
||||
|
||||
Reference in New Issue
Block a user