feat(energy): Energy 模块优化完成
后端优化: - 创建加氢站表,删除 energy_station_config - 简化事件驱动(7个→3个) - 合并导入流程(自动匹配+生成明细) - 优化审核流程(审核+扣款合并+批量审核) - 修复跨模块依赖(创建 Asset API 接口层) 前端优化: - 简化导入交互(3步→1步) - 批量审核功能 - 快速生成账单(本月/上月) - 批量价格配置(前端完成) 技术改进: - 微服务架构规范(API 优先) - 事务一致性保证 - 用户体验优化
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.asset.api.contract;
|
||||
|
||||
import cn.iocoder.yudao.module.asset.api.contract.dto.ContractRespDTO;
|
||||
|
||||
/**
|
||||
* 合同 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface ContractApi {
|
||||
|
||||
/**
|
||||
* 查询客户的生效中合同
|
||||
*
|
||||
* @param customerId 客户ID
|
||||
* @return 合同信息
|
||||
*/
|
||||
ContractRespDTO getActiveByCustomerId(Long customerId);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.asset.api.contract.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 合同响应 DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class ContractRespDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 合同ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 合同编号
|
||||
*/
|
||||
private String contractNo;
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 合同状态
|
||||
*/
|
||||
private Integer contractStatus;
|
||||
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
private LocalDateTime startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
private LocalDateTime endDate;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.asset.api.customer;
|
||||
|
||||
import cn.iocoder.yudao.module.asset.api.customer.dto.CustomerRespDTO;
|
||||
|
||||
/**
|
||||
* 客户 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface CustomerApi {
|
||||
|
||||
/**
|
||||
* 通过名称模糊查询客户
|
||||
*
|
||||
* @param name 客户名称
|
||||
* @return 客户信息
|
||||
*/
|
||||
CustomerRespDTO getByNameLike(String name);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.asset.api.customer.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 客户响应 DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class CustomerRespDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String customerName;
|
||||
|
||||
/**
|
||||
* 客户编码
|
||||
*/
|
||||
private String customerCode;
|
||||
|
||||
/**
|
||||
* 客户类型
|
||||
*/
|
||||
private Integer customerType;
|
||||
|
||||
/**
|
||||
* 客户状态
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.asset.api.station;
|
||||
|
||||
import cn.iocoder.yudao.module.asset.api.station.dto.HydrogenStationRespDTO;
|
||||
|
||||
/**
|
||||
* 加氢站 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface HydrogenStationApi {
|
||||
|
||||
/**
|
||||
* 获取加氢站信息
|
||||
*
|
||||
* @param id 加氢站ID
|
||||
* @return 加氢站信息
|
||||
*/
|
||||
HydrogenStationRespDTO getStation(Long id);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.asset.api.station.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 加氢站响应 DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class HydrogenStationRespDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 站点ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 站点名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 是否自动扣款
|
||||
*/
|
||||
private Boolean autoDeduct;
|
||||
|
||||
/**
|
||||
* 站点编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 站点状态
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.asset.api.vehicle;
|
||||
|
||||
import cn.iocoder.yudao.module.asset.api.vehicle.dto.VehicleRespDTO;
|
||||
|
||||
/**
|
||||
* 车辆 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface VehicleApi {
|
||||
|
||||
/**
|
||||
* 通过车牌号查询车辆
|
||||
*
|
||||
* @param vehicleNo 车牌号
|
||||
* @return 车辆信息
|
||||
*/
|
||||
VehicleRespDTO getByVehicleNo(String vehicleNo);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.asset.api.vehicle.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 车辆响应 DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class VehicleRespDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 车辆ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String plateNo;
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
private Integer vehicleType;
|
||||
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.asset.api;
|
||||
|
||||
import cn.iocoder.yudao.module.asset.api.contract.ContractApi;
|
||||
import cn.iocoder.yudao.module.asset.api.contract.dto.ContractRespDTO;
|
||||
import cn.iocoder.yudao.module.asset.convert.contract.ContractConvert;
|
||||
import cn.iocoder.yudao.module.asset.dal.dataobject.contract.ContractDO;
|
||||
import cn.iocoder.yudao.module.asset.dal.mysql.contract.ContractMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 合同 API 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
public class ContractApiImpl implements ContractApi {
|
||||
|
||||
@Resource
|
||||
private ContractMapper contractMapper;
|
||||
|
||||
@Override
|
||||
public ContractRespDTO getActiveByCustomerId(Long customerId) {
|
||||
ContractDO contract = contractMapper.selectOne(
|
||||
new LambdaQueryWrapper<ContractDO>()
|
||||
.eq(ContractDO::getCustomerId, customerId)
|
||||
.eq(ContractDO::getContractStatus, 2) // 2=进行中
|
||||
.gt(ContractDO::getEndDate, LocalDateTime.now())
|
||||
.orderByDesc(ContractDO::getStartDate)
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
return ContractConvert.INSTANCE.convertToApi(contract);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.asset.api;
|
||||
|
||||
import cn.iocoder.yudao.module.asset.api.customer.CustomerApi;
|
||||
import cn.iocoder.yudao.module.asset.api.customer.dto.CustomerRespDTO;
|
||||
import cn.iocoder.yudao.module.asset.convert.customer.CustomerConvert;
|
||||
import cn.iocoder.yudao.module.asset.dal.dataobject.customer.CustomerDO;
|
||||
import cn.iocoder.yudao.module.asset.dal.mysql.customer.CustomerMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 客户 API 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
public class CustomerApiImpl implements CustomerApi {
|
||||
|
||||
@Resource
|
||||
private CustomerMapper customerMapper;
|
||||
|
||||
@Override
|
||||
public CustomerRespDTO getByNameLike(String name) {
|
||||
CustomerDO customer = customerMapper.selectOne(
|
||||
new LambdaQueryWrapper<CustomerDO>()
|
||||
.like(CustomerDO::getCustomerName, name)
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
return CustomerConvert.INSTANCE.convertToApi(customer);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.asset.api;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 加氢站 API 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
public class HydrogenStationApiImpl implements HydrogenStationApi {
|
||||
|
||||
@Resource
|
||||
private HydrogenStationService hydrogenStationService;
|
||||
|
||||
@Override
|
||||
public HydrogenStationRespDTO getStation(Long id) {
|
||||
HydrogenStationDO station = hydrogenStationService.getHydrogenStation(id);
|
||||
return HydrogenStationConvert.INSTANCE.convertToApi(station);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.asset.api;
|
||||
|
||||
import cn.iocoder.yudao.module.asset.api.vehicle.VehicleApi;
|
||||
import cn.iocoder.yudao.module.asset.api.vehicle.dto.VehicleRespDTO;
|
||||
import cn.iocoder.yudao.module.asset.convert.vehicle.VehicleConvert;
|
||||
import cn.iocoder.yudao.module.asset.dal.dataobject.vehicle.VehicleBaseDO;
|
||||
import cn.iocoder.yudao.module.asset.dal.mysql.vehicle.VehicleBaseMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 车辆 API 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
public class VehicleApiImpl implements VehicleApi {
|
||||
|
||||
@Resource
|
||||
private VehicleBaseMapper vehicleBaseMapper;
|
||||
|
||||
@Override
|
||||
public VehicleRespDTO getByVehicleNo(String vehicleNo) {
|
||||
VehicleBaseDO vehicle = vehicleBaseMapper.selectOne(VehicleBaseDO::getPlateNo, vehicleNo);
|
||||
return VehicleConvert.INSTANCE.convertToApi(vehicle);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.asset.convert.contract;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.asset.api.contract.dto.ContractRespDTO;
|
||||
import cn.iocoder.yudao.module.asset.controller.admin.contract.vo.*;
|
||||
import cn.iocoder.yudao.module.asset.dal.dataobject.contract.*;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -52,4 +53,9 @@ public interface ContractConvert {
|
||||
|
||||
List<ContractAttachmentDO> convertAttachmentList(List<ContractAttachmentVO> list);
|
||||
|
||||
/**
|
||||
* 转换为 API DTO
|
||||
*/
|
||||
ContractRespDTO convertToApi(ContractDO bean);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.asset.convert.customer;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.asset.api.customer.dto.CustomerRespDTO;
|
||||
import cn.iocoder.yudao.module.asset.controller.admin.customer.vo.CustomerRespVO;
|
||||
import cn.iocoder.yudao.module.asset.controller.admin.customer.vo.CustomerSaveReqVO;
|
||||
import cn.iocoder.yudao.module.asset.dal.dataobject.customer.CustomerDO;
|
||||
@@ -27,4 +28,9 @@ public interface CustomerConvert {
|
||||
|
||||
List<CustomerRespVO> convertList(List<CustomerDO> list);
|
||||
|
||||
/**
|
||||
* 转换为 API DTO
|
||||
*/
|
||||
CustomerRespDTO convertToApi(CustomerDO bean);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.asset.convert.station;
|
||||
|
||||
import cn.iocoder.yudao.module.asset.api.station.dto.HydrogenStationRespDTO;
|
||||
import cn.iocoder.yudao.module.asset.controller.admin.station.vo.HydrogenStationRespVO;
|
||||
import cn.iocoder.yudao.module.asset.controller.admin.station.vo.HydrogenStationSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.asset.dal.dataobject.station.HydrogenStationDO;
|
||||
@@ -33,4 +34,9 @@ public interface HydrogenStationConvert {
|
||||
*/
|
||||
List<HydrogenStationSimpleRespVO> convertSimpleList(List<HydrogenStationDO> list);
|
||||
|
||||
/**
|
||||
* 转换为 API DTO
|
||||
*/
|
||||
HydrogenStationRespDTO convertToApi(HydrogenStationDO bean);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.asset.convert.vehicle;
|
||||
|
||||
import cn.iocoder.yudao.module.asset.api.vehicle.dto.VehicleRespDTO;
|
||||
import cn.iocoder.yudao.module.asset.controller.admin.vehicle.vo.VehicleRespVO;
|
||||
import cn.iocoder.yudao.module.asset.controller.admin.vehicle.vo.VehicleSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.asset.dal.dataobject.vehicle.VehicleBaseDO;
|
||||
@@ -7,6 +8,7 @@ import cn.iocoder.yudao.module.asset.dal.dataobject.vehicle.VehicleBusinessDO;
|
||||
import cn.iocoder.yudao.module.asset.dal.dataobject.vehicle.VehicleLocationDO;
|
||||
import cn.iocoder.yudao.module.asset.dal.dataobject.vehicle.VehicleStatusDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
@@ -122,4 +124,10 @@ public interface VehicleConvert {
|
||||
return list.stream().map(this::convertSimple).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为 API DTO
|
||||
*/
|
||||
@Mapping(source = "plateNo", target = "plateNo")
|
||||
VehicleRespDTO convertToApi(VehicleBaseDO bean);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user