Merge branch 'master' of http://pms.dtyx.net:3000/cuizhibin/znpt-backend
# Conflicts: # pom.xml
This commit is contained in:
commit
0f67c55892
|
@ -1,55 +1,218 @@
|
|||
package com.dite.znpt.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.dite.znpt.domain.AuditableEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/23/周三 17:26
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("equipment")
|
||||
@ApiModel(value="EquipmentEntity对象", description="设备信息表")
|
||||
public class EquipmentEntity extends AuditableEntity implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -6665040704562461286L;
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String equipmentId;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
@ApiModelProperty("设备型号")
|
||||
private String equipmentModel;
|
||||
|
||||
@ApiModelProperty("设备类型")
|
||||
private String equipmentType;
|
||||
|
||||
@ApiModelProperty("设备状态,枚举:EquipmentStatusEnum")
|
||||
private String equipmentStatus;
|
||||
|
||||
@ApiModelProperty("使用状态,0-空闲中,1-使用中")
|
||||
private String useStatus;
|
||||
|
||||
@ApiModelProperty("设备序列号")
|
||||
private String equipmentSn;
|
||||
|
||||
@ApiModelProperty("当前使用记录id")
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private String useRecordId;
|
||||
|
||||
@ApiModelProperty("删除标志(0代表存在 1代表删除)")
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private String delFlag;
|
||||
}
|
||||
package com.dite.znpt.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.dite.znpt.domain.AuditableEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/23/周三 17:26
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("equipment")
|
||||
@ApiModel(value="EquipmentEntity对象", description="设备信息表")
|
||||
public class EquipmentEntity extends AuditableEntity implements Serializable {
|
||||
private static final long serialVersionUID = -6665040704562461286L;
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String equipmentId;
|
||||
|
||||
@ApiModelProperty("资产编号")
|
||||
private String assetCode;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
@ApiModelProperty("设备型号")
|
||||
private String equipmentModel;
|
||||
|
||||
@ApiModelProperty("设备类型")
|
||||
private String equipmentType;
|
||||
|
||||
@ApiModelProperty("设备状态,枚举:EquipmentStatusEnum")
|
||||
private String equipmentStatus;
|
||||
|
||||
@ApiModelProperty("使用状态,0-空闲中,1-使用中")
|
||||
private String useStatus;
|
||||
|
||||
@ApiModelProperty("设备序列号")
|
||||
private String equipmentSn;
|
||||
|
||||
@ApiModelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@ApiModelProperty("配置规格/参数")
|
||||
private String specification;
|
||||
|
||||
@ApiModelProperty("位置状态")
|
||||
private String locationStatus;
|
||||
|
||||
@ApiModelProperty("设备当前物理位置")
|
||||
private String physicalLocation;
|
||||
|
||||
@ApiModelProperty("负责人")
|
||||
private String responsiblePerson;
|
||||
|
||||
@ApiModelProperty("健康状态")
|
||||
private String healthStatus;
|
||||
|
||||
@ApiModelProperty("采购时间")
|
||||
private LocalDateTime purchaseTime;
|
||||
|
||||
@ApiModelProperty("入库时间")
|
||||
private LocalDateTime inStockTime;
|
||||
|
||||
@ApiModelProperty("启用时间")
|
||||
private LocalDateTime activationTime;
|
||||
|
||||
@ApiModelProperty("预计报废时间")
|
||||
private LocalDateTime expectedScrapTime;
|
||||
|
||||
@ApiModelProperty("实际报废时间")
|
||||
private LocalDateTime actualScrapTime;
|
||||
|
||||
@ApiModelProperty("状态变更时间")
|
||||
private LocalDateTime statusChangeTime;
|
||||
|
||||
@ApiModelProperty("采购订单")
|
||||
private String purchaseOrder;
|
||||
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
// 移除采购价格字段,使用单价和总价替代
|
||||
// @ApiModelProperty("采购价格")
|
||||
// private BigDecimal purchasePrice;
|
||||
|
||||
@ApiModelProperty("当前净值")
|
||||
private BigDecimal currentNetValue;
|
||||
|
||||
@ApiModelProperty("折旧方法")
|
||||
private String depreciationMethod;
|
||||
|
||||
@ApiModelProperty("折旧年限")
|
||||
private Integer depreciationYears;
|
||||
|
||||
@ApiModelProperty("残值")
|
||||
private BigDecimal salvageValue;
|
||||
|
||||
@ApiModelProperty("保修截止日期")
|
||||
private LocalDateTime warrantyExpireDate;
|
||||
|
||||
@ApiModelProperty("上次维护日期")
|
||||
private LocalDateTime lastMaintenanceDate;
|
||||
|
||||
@ApiModelProperty("下次维护日期")
|
||||
private LocalDateTime nextMaintenanceDate;
|
||||
|
||||
@ApiModelProperty("维护人员")
|
||||
private String maintenancePerson;
|
||||
|
||||
@ApiModelProperty("库存条码")
|
||||
private String inventoryBarcode;
|
||||
|
||||
@ApiModelProperty("资产备注")
|
||||
private String assetRemark;
|
||||
|
||||
@ApiModelProperty("次户号")
|
||||
private String accountNumber;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("总价")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
// 移除备用状态字段,使用现有的 location_status 字段
|
||||
// @ApiModelProperty("备用状态")
|
||||
// private String spareStatus;
|
||||
|
||||
@ApiModelProperty("盘点依据")
|
||||
private String inventoryBasis;
|
||||
|
||||
@ApiModelProperty("动态记录")
|
||||
private String dynamicRecord;
|
||||
|
||||
// 移除认证状态字段,使用现有的 health_status 字段
|
||||
// @ApiModelProperty("认证状态")
|
||||
// private String certificationStatus;
|
||||
|
||||
@ApiModelProperty("使用部门/人")
|
||||
private String usingDepartment;
|
||||
|
||||
@ApiModelProperty("领用时间")
|
||||
private LocalDateTime borrowingTime;
|
||||
|
||||
@ApiModelProperty("归还时间")
|
||||
private LocalDateTime returnTime;
|
||||
|
||||
@ApiModelProperty("出库时间")
|
||||
private LocalDateTime outStockTime;
|
||||
|
||||
@ApiModelProperty("总使用时间")
|
||||
private String totalUsageTime;
|
||||
|
||||
@ApiModelProperty("折旧率")
|
||||
private BigDecimal depreciationRate;
|
||||
|
||||
@ApiModelProperty("折旧方法说明")
|
||||
private String depreciationMethodDesc;
|
||||
|
||||
@ApiModelProperty("发票")
|
||||
private String invoice;
|
||||
|
||||
@ApiModelProperty("发票状态")
|
||||
private String invoiceStatus;
|
||||
|
||||
@ApiModelProperty("附件")
|
||||
private String attachments;
|
||||
|
||||
@ApiModelProperty("照片")
|
||||
private String photos;
|
||||
|
||||
@ApiModelProperty("条码")
|
||||
private String barcode;
|
||||
|
||||
@ApiModelProperty("导入人")
|
||||
private String importer;
|
||||
|
||||
@ApiModelProperty("盘库时间/状态1")
|
||||
private String inventoryTimeStatus1;
|
||||
|
||||
@ApiModelProperty("盘库时间/状态2")
|
||||
private String inventoryTimeStatus2;
|
||||
|
||||
@ApiModelProperty("盘库时间/状态3")
|
||||
private String inventoryTimeStatus3;
|
||||
|
||||
@ApiModelProperty("盘点时间/状态1")
|
||||
private String inventoryCheckTimeStatus1;
|
||||
|
||||
@ApiModelProperty("盘点时间/状态2")
|
||||
private String inventoryCheckTimeStatus2;
|
||||
|
||||
@ApiModelProperty("盘点时间/状态3")
|
||||
private String inventoryCheckTimeStatus3;
|
||||
|
||||
@ApiModelProperty("当前使用记录id")
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private String useRecordId;
|
||||
|
||||
@ApiModelProperty("删除标志(0代表存在 1代表删除)")
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private String delFlag;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -26,4 +27,154 @@ public class EquipmentListReq implements Serializable {
|
|||
|
||||
@ApiModelProperty("设备状态,0-空闲中,1-使用,3-保养中,4-维修中,5-已报废")
|
||||
private String equipmentStatus;
|
||||
|
||||
@ApiModelProperty("设备序列号")
|
||||
private String equipmentSn;
|
||||
|
||||
@ApiModelProperty("资产编号")
|
||||
private String assetCode;
|
||||
|
||||
@ApiModelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@ApiModelProperty("位置状态")
|
||||
private String locationStatus;
|
||||
|
||||
@ApiModelProperty("健康状态")
|
||||
private String healthStatus;
|
||||
|
||||
@ApiModelProperty("负责人")
|
||||
private String responsiblePerson;
|
||||
|
||||
@ApiModelProperty("使用状态,0-空闲中,1-使用中")
|
||||
private String useStatus;
|
||||
|
||||
@ApiModelProperty("项目ID")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("设备型号")
|
||||
private String equipmentModel;
|
||||
|
||||
@ApiModelProperty("配置规格/参数")
|
||||
private String specification;
|
||||
|
||||
@ApiModelProperty("设备当前物理位置")
|
||||
private String physicalLocation;
|
||||
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
@ApiModelProperty("采购订单号")
|
||||
private String purchaseOrder;
|
||||
|
||||
@ApiModelProperty("维护人员")
|
||||
private String maintenancePerson;
|
||||
|
||||
@ApiModelProperty("次户号")
|
||||
private String accountNumber;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private java.math.BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("总价")
|
||||
private java.math.BigDecimal totalPrice;
|
||||
|
||||
@ApiModelProperty("盘点依据")
|
||||
private String inventoryBasis;
|
||||
|
||||
@ApiModelProperty("动态记录")
|
||||
private String dynamicRecord;
|
||||
|
||||
@ApiModelProperty("库存条码")
|
||||
private String inventoryBarcode;
|
||||
|
||||
@ApiModelProperty("资产备注")
|
||||
private String assetRemark;
|
||||
|
||||
@ApiModelProperty("使用部门/人")
|
||||
private String usingDepartment;
|
||||
|
||||
@ApiModelProperty("发票")
|
||||
private String invoice;
|
||||
|
||||
@ApiModelProperty("条码")
|
||||
private String barcode;
|
||||
|
||||
@ApiModelProperty("导入人")
|
||||
private String importer;
|
||||
|
||||
@ApiModelProperty("采购时间开始")
|
||||
private LocalDateTime purchaseTimeStart;
|
||||
|
||||
@ApiModelProperty("采购时间结束")
|
||||
private LocalDateTime purchaseTimeEnd;
|
||||
|
||||
@ApiModelProperty("入库时间开始")
|
||||
private LocalDateTime inStockTimeStart;
|
||||
|
||||
@ApiModelProperty("入库时间结束")
|
||||
private LocalDateTime inStockTimeEnd;
|
||||
|
||||
@ApiModelProperty("启用时间开始")
|
||||
private LocalDateTime activationTimeStart;
|
||||
|
||||
@ApiModelProperty("启用时间结束")
|
||||
private LocalDateTime activationTimeEnd;
|
||||
|
||||
@ApiModelProperty("预计报废时间开始")
|
||||
private LocalDateTime expectedScrapTimeStart;
|
||||
|
||||
@ApiModelProperty("预计报废时间结束")
|
||||
private LocalDateTime expectedScrapTimeEnd;
|
||||
|
||||
@ApiModelProperty("保修截止日期开始")
|
||||
private LocalDateTime warrantyExpireDateStart;
|
||||
|
||||
@ApiModelProperty("保修截止日期结束")
|
||||
private LocalDateTime warrantyExpireDateEnd;
|
||||
|
||||
@ApiModelProperty("上次维护日期开始")
|
||||
private LocalDateTime lastMaintenanceDateStart;
|
||||
|
||||
@ApiModelProperty("上次维护日期结束")
|
||||
private LocalDateTime lastMaintenanceDateEnd;
|
||||
|
||||
@ApiModelProperty("下次维护日期开始")
|
||||
private LocalDateTime nextMaintenanceDateStart;
|
||||
|
||||
@ApiModelProperty("下次维护日期结束")
|
||||
private LocalDateTime nextMaintenanceDateEnd;
|
||||
|
||||
@ApiModelProperty("创建时间开始")
|
||||
private LocalDateTime createTimeStart;
|
||||
|
||||
@ApiModelProperty("创建时间结束")
|
||||
private LocalDateTime createTimeEnd;
|
||||
|
||||
@ApiModelProperty("更新时间开始")
|
||||
private LocalDateTime updateTimeStart;
|
||||
|
||||
@ApiModelProperty("更新时间结束")
|
||||
private LocalDateTime updateTimeEnd;
|
||||
|
||||
@ApiModelProperty("当前页码")
|
||||
private Integer pageNum;
|
||||
|
||||
@ApiModelProperty("每页大小")
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty("排序字段")
|
||||
private String orderBy;
|
||||
|
||||
@ApiModelProperty("排序方向")
|
||||
private String orderDirection;
|
||||
|
||||
@ApiModelProperty("页码")
|
||||
private Integer page;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import javax.validation.constraints.NotBlank;
|
|||
import javax.validation.constraints.Size;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -22,7 +24,7 @@ public class EquipmentReq implements Serializable {
|
|||
|
||||
@ApiModelProperty("设备名称")
|
||||
@NotBlank(message = "设备名称不能为空")
|
||||
@Size(max = 100, message = "设备名称长度不能超过100个字")
|
||||
@Size(max = 200, message = "设备名称长度不能超过200个字")
|
||||
private String equipmentName;
|
||||
|
||||
@ApiModelProperty("设备类型, 枚举:EquipmentTypeEnum")
|
||||
|
@ -31,11 +33,204 @@ public class EquipmentReq implements Serializable {
|
|||
|
||||
@ApiModelProperty("设备型号")
|
||||
@NotBlank(message = "设备型号不能为空")
|
||||
@Size(max = 50, message = "设备型号长度不能超过50个字")
|
||||
@Size(max = 200, message = "设备型号长度不能超过200个字")
|
||||
private String equipmentModel;
|
||||
|
||||
@ApiModelProperty("设备SN")
|
||||
@NotBlank(message = "设备SN不能为空")
|
||||
@Size(max = 50, message = "设备SN长度不能超过50个字")
|
||||
@Size(max = 100, message = "设备SN长度不能超过100个字")
|
||||
private String equipmentSn;
|
||||
|
||||
@ApiModelProperty("资产编号")
|
||||
@Size(max = 50, message = "资产编号长度不能超过50个字")
|
||||
private String assetCode;
|
||||
|
||||
@ApiModelProperty("品牌")
|
||||
@Size(max = 100, message = "品牌长度不能超过100个字")
|
||||
private String brand;
|
||||
|
||||
@ApiModelProperty("配置规格/参数")
|
||||
@Size(max = 500, message = "配置规格长度不能超过500个字")
|
||||
private String specification;
|
||||
|
||||
@ApiModelProperty("设备状态,枚举:EquipmentStatusEnum")
|
||||
private String equipmentStatus;
|
||||
|
||||
@ApiModelProperty("使用状态,0-空闲中,1-使用中")
|
||||
private String useStatus;
|
||||
|
||||
@ApiModelProperty("位置状态")
|
||||
private String locationStatus;
|
||||
|
||||
@ApiModelProperty("设备当前物理位置")
|
||||
@Size(max = 200, message = "物理位置长度不能超过200个字")
|
||||
private String physicalLocation;
|
||||
|
||||
@ApiModelProperty("负责人")
|
||||
@Size(max = 100, message = "负责人长度不能超过100个字")
|
||||
private String responsiblePerson;
|
||||
|
||||
@ApiModelProperty("健康状态")
|
||||
private String healthStatus;
|
||||
|
||||
@ApiModelProperty("采购时间")
|
||||
private LocalDateTime purchaseTime;
|
||||
|
||||
@ApiModelProperty("入库时间")
|
||||
private LocalDateTime inStockTime;
|
||||
|
||||
@ApiModelProperty("启用时间")
|
||||
private LocalDateTime activationTime;
|
||||
|
||||
@ApiModelProperty("预计报废时间")
|
||||
private LocalDateTime expectedScrapTime;
|
||||
|
||||
@ApiModelProperty("实际报废时间")
|
||||
private LocalDateTime actualScrapTime;
|
||||
|
||||
@ApiModelProperty("状态变更时间")
|
||||
private LocalDateTime statusChangeTime;
|
||||
|
||||
@ApiModelProperty("采购订单")
|
||||
@Size(max = 100, message = "采购订单长度不能超过100个字")
|
||||
private String purchaseOrder;
|
||||
|
||||
@ApiModelProperty("供应商名称")
|
||||
@Size(max = 200, message = "供应商名称长度不能超过200个字")
|
||||
private String supplierName;
|
||||
|
||||
// 移除采购价格字段,使用单价和总价替代
|
||||
// @ApiModelProperty("采购价格")
|
||||
// private BigDecimal purchasePrice;
|
||||
|
||||
@ApiModelProperty("当前净值")
|
||||
private BigDecimal currentNetValue;
|
||||
|
||||
@ApiModelProperty("折旧方法")
|
||||
private String depreciationMethod;
|
||||
|
||||
@ApiModelProperty("折旧年限")
|
||||
private Integer depreciationYears;
|
||||
|
||||
@ApiModelProperty("残值")
|
||||
private BigDecimal salvageValue;
|
||||
|
||||
@ApiModelProperty("保修截止日期")
|
||||
private LocalDateTime warrantyExpireDate;
|
||||
|
||||
@ApiModelProperty("上次维护日期")
|
||||
private LocalDateTime lastMaintenanceDate;
|
||||
|
||||
@ApiModelProperty("下次维护日期")
|
||||
private LocalDateTime nextMaintenanceDate;
|
||||
|
||||
@ApiModelProperty("维护人员")
|
||||
@Size(max = 100, message = "维护人员长度不能超过100个字")
|
||||
private String maintenancePerson;
|
||||
|
||||
@ApiModelProperty("库存条码")
|
||||
@Size(max = 100, message = "库存条码长度不能超过100个字")
|
||||
private String inventoryBarcode;
|
||||
|
||||
@ApiModelProperty("资产备注")
|
||||
@Size(max = 1000, message = "资产备注长度不能超过1000个字")
|
||||
private String assetRemark;
|
||||
|
||||
@ApiModelProperty("次户号")
|
||||
private String accountNumber;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("总价")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
// 移除备用状态字段,使用现有的 location_status 字段
|
||||
// @ApiModelProperty("备用状态")
|
||||
// private String spareStatus;
|
||||
|
||||
@ApiModelProperty("盘点依据")
|
||||
private String inventoryBasis;
|
||||
|
||||
@ApiModelProperty("动态记录")
|
||||
private String dynamicRecord;
|
||||
|
||||
// 移除认证状态字段,使用现有的 health_status 字段
|
||||
// @ApiModelProperty("认证状态")
|
||||
// private String certificationStatus;
|
||||
|
||||
@ApiModelProperty("使用部门/人")
|
||||
@Size(max = 200, message = "使用部门/人长度不能超过200个字")
|
||||
private String usingDepartment;
|
||||
|
||||
@ApiModelProperty("领用时间")
|
||||
private LocalDateTime borrowingTime;
|
||||
|
||||
@ApiModelProperty("归还时间")
|
||||
private LocalDateTime returnTime;
|
||||
|
||||
@ApiModelProperty("出库时间")
|
||||
private LocalDateTime outStockTime;
|
||||
|
||||
@ApiModelProperty("总使用时间")
|
||||
@Size(max = 100, message = "总使用时间长度不能超过100个字")
|
||||
private String totalUsageTime;
|
||||
|
||||
@ApiModelProperty("折旧率")
|
||||
private BigDecimal depreciationRate;
|
||||
|
||||
@ApiModelProperty("折旧方法说明")
|
||||
@Size(max = 500, message = "折旧方法说明长度不能超过500个字")
|
||||
private String depreciationMethodDesc;
|
||||
|
||||
@ApiModelProperty("发票")
|
||||
@Size(max = 100, message = "发票长度不能超过100个字")
|
||||
private String invoice;
|
||||
|
||||
@ApiModelProperty("发票状态")
|
||||
@Size(max = 50, message = "发票状态长度不能超过50个字")
|
||||
private String invoiceStatus;
|
||||
|
||||
@ApiModelProperty("附件")
|
||||
@Size(max = 500, message = "附件长度不能超过500个字")
|
||||
private String attachments;
|
||||
|
||||
@ApiModelProperty("照片")
|
||||
@Size(max = 500, message = "照片长度不能超过500个字")
|
||||
private String photos;
|
||||
|
||||
@ApiModelProperty("条码")
|
||||
@Size(max = 100, message = "条码长度不能超过100个字")
|
||||
private String barcode;
|
||||
|
||||
@ApiModelProperty("导入人")
|
||||
@Size(max = 100, message = "导入人长度不能超过100个字")
|
||||
private String importer;
|
||||
|
||||
@ApiModelProperty("盘库时间/状态1")
|
||||
@Size(max = 100, message = "盘库时间/状态1长度不能超过100个字")
|
||||
private String inventoryTimeStatus1;
|
||||
|
||||
@ApiModelProperty("盘库时间/状态2")
|
||||
@Size(max = 100, message = "盘库时间/状态2长度不能超过100个字")
|
||||
private String inventoryTimeStatus2;
|
||||
|
||||
@ApiModelProperty("盘库时间/状态3")
|
||||
@Size(max = 100, message = "盘库时间/状态3长度不能超过100个字")
|
||||
private String inventoryTimeStatus3;
|
||||
|
||||
@ApiModelProperty("盘点时间/状态1")
|
||||
@Size(max = 100, message = "盘点时间/状态1长度不能超过100个字")
|
||||
private String inventoryCheckTimeStatus1;
|
||||
|
||||
@ApiModelProperty("盘点时间/状态2")
|
||||
@Size(max = 100, message = "盘点时间/状态2长度不能超过100个字")
|
||||
private String inventoryCheckTimeStatus2;
|
||||
|
||||
@ApiModelProperty("盘点时间/状态3")
|
||||
@Size(max = 100, message = "盘点时间/状态3长度不能超过100个字")
|
||||
private String inventoryCheckTimeStatus3;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -21,6 +23,9 @@ public class EquipmentResp implements Serializable {
|
|||
@ApiModelProperty("设备ID")
|
||||
private String equipmentId;
|
||||
|
||||
@ApiModelProperty("资产编号")
|
||||
private String assetCode;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
|
@ -36,6 +41,12 @@ public class EquipmentResp implements Serializable {
|
|||
@ApiModelProperty("设备SN")
|
||||
private String equipmentSn;
|
||||
|
||||
@ApiModelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@ApiModelProperty("配置规格/参数")
|
||||
private String specification;
|
||||
|
||||
@ApiModelProperty("设备状态, 枚举:EquipmentStatusEnum")
|
||||
private String equipmentStatus;
|
||||
|
||||
|
@ -45,6 +56,171 @@ public class EquipmentResp implements Serializable {
|
|||
@ApiModelProperty("设备使用状态,0-空闲中,1-使用中")
|
||||
private String useStatus;
|
||||
|
||||
@ApiModelProperty("位置状态")
|
||||
private String locationStatus;
|
||||
|
||||
@ApiModelProperty("位置状态描述")
|
||||
private String locationStatusLabel;
|
||||
|
||||
@ApiModelProperty("设备当前物理位置")
|
||||
private String physicalLocation;
|
||||
|
||||
@ApiModelProperty("负责人")
|
||||
private String responsiblePerson;
|
||||
|
||||
@ApiModelProperty("健康状态")
|
||||
private String healthStatus;
|
||||
|
||||
@ApiModelProperty("健康状态描述")
|
||||
private String healthStatusLabel;
|
||||
|
||||
@ApiModelProperty("采购时间")
|
||||
private LocalDateTime purchaseTime;
|
||||
|
||||
@ApiModelProperty("入库时间")
|
||||
private LocalDateTime inStockTime;
|
||||
|
||||
@ApiModelProperty("启用时间")
|
||||
private LocalDateTime activationTime;
|
||||
|
||||
@ApiModelProperty("预计报废时间")
|
||||
private LocalDateTime expectedScrapTime;
|
||||
|
||||
@ApiModelProperty("实际报废时间")
|
||||
private LocalDateTime actualScrapTime;
|
||||
|
||||
@ApiModelProperty("状态变更时间")
|
||||
private LocalDateTime statusChangeTime;
|
||||
|
||||
@ApiModelProperty("采购订单")
|
||||
private String purchaseOrder;
|
||||
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
// 移除采购价格字段,使用单价和总价替代
|
||||
// @ApiModelProperty("采购价格")
|
||||
// private BigDecimal purchasePrice;
|
||||
|
||||
@ApiModelProperty("当前净值")
|
||||
private BigDecimal currentNetValue;
|
||||
|
||||
@ApiModelProperty("折旧方法")
|
||||
private String depreciationMethod;
|
||||
|
||||
@ApiModelProperty("折旧年限")
|
||||
private Integer depreciationYears;
|
||||
|
||||
@ApiModelProperty("残值")
|
||||
private BigDecimal salvageValue;
|
||||
|
||||
@ApiModelProperty("保修截止日期")
|
||||
private LocalDateTime warrantyExpireDate;
|
||||
|
||||
@ApiModelProperty("上次维护日期")
|
||||
private LocalDateTime lastMaintenanceDate;
|
||||
|
||||
@ApiModelProperty("下次维护日期")
|
||||
private LocalDateTime nextMaintenanceDate;
|
||||
|
||||
@ApiModelProperty("维护人员")
|
||||
private String maintenancePerson;
|
||||
|
||||
@ApiModelProperty("库存条码")
|
||||
private String inventoryBarcode;
|
||||
|
||||
@ApiModelProperty("资产备注")
|
||||
private String assetRemark;
|
||||
|
||||
@ApiModelProperty("次户号")
|
||||
private String accountNumber;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("总价")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
// 移除备用状态字段,使用现有的 location_status 字段
|
||||
// @ApiModelProperty("备用状态")
|
||||
// private String spareStatus;
|
||||
|
||||
// @ApiModelProperty("备用状态描述")
|
||||
// private String spareStatusLabel;
|
||||
|
||||
@ApiModelProperty("盘点依据")
|
||||
private String inventoryBasis;
|
||||
|
||||
@ApiModelProperty("动态记录")
|
||||
private String dynamicRecord;
|
||||
|
||||
// 移除认证状态字段,使用现有的 health_status 字段
|
||||
// @ApiModelProperty("认证状态")
|
||||
// private String certificationStatus;
|
||||
|
||||
// @ApiModelProperty("认证状态描述")
|
||||
// private String certificationStatusLabel;
|
||||
|
||||
@ApiModelProperty("使用部门/人")
|
||||
private String usingDepartment;
|
||||
|
||||
@ApiModelProperty("领用时间")
|
||||
private LocalDateTime borrowingTime;
|
||||
|
||||
@ApiModelProperty("归还时间")
|
||||
private LocalDateTime returnTime;
|
||||
|
||||
@ApiModelProperty("出库时间")
|
||||
private LocalDateTime outStockTime;
|
||||
|
||||
@ApiModelProperty("总使用时间")
|
||||
private String totalUsageTime;
|
||||
|
||||
@ApiModelProperty("折旧率")
|
||||
private BigDecimal depreciationRate;
|
||||
|
||||
@ApiModelProperty("折旧方法说明")
|
||||
private String depreciationMethodDesc;
|
||||
|
||||
@ApiModelProperty("发票")
|
||||
private String invoice;
|
||||
|
||||
@ApiModelProperty("发票状态")
|
||||
private String invoiceStatus;
|
||||
|
||||
@ApiModelProperty("附件")
|
||||
private String attachments;
|
||||
|
||||
@ApiModelProperty("照片")
|
||||
private String photos;
|
||||
|
||||
@ApiModelProperty("条码")
|
||||
private String barcode;
|
||||
|
||||
@ApiModelProperty("导入人")
|
||||
private String importer;
|
||||
|
||||
@ApiModelProperty("盘库时间/状态1")
|
||||
private String inventoryTimeStatus1;
|
||||
|
||||
@ApiModelProperty("盘库时间/状态2")
|
||||
private String inventoryTimeStatus2;
|
||||
|
||||
@ApiModelProperty("盘库时间/状态3")
|
||||
private String inventoryTimeStatus3;
|
||||
|
||||
@ApiModelProperty("盘点时间/状态1")
|
||||
private String inventoryCheckTimeStatus1;
|
||||
|
||||
@ApiModelProperty("盘点时间/状态2")
|
||||
private String inventoryCheckTimeStatus2;
|
||||
|
||||
@ApiModelProperty("盘点时间/状态3")
|
||||
private String inventoryCheckTimeStatus3;
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
|
||||
|
@ -56,4 +232,10 @@ public class EquipmentResp implements Serializable {
|
|||
|
||||
@ApiModelProperty("使用人")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.dite.znpt.enums;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/31/周四 15:30
|
||||
* @description 设备健康状态枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum HealthStatusEnum {
|
||||
EXCELLENT("excellent", "优秀"),
|
||||
GOOD("good", "良好"),
|
||||
NORMAL("normal", "一般"),
|
||||
POOR("poor", "较差"),
|
||||
BAD("bad", "差");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
HealthStatusEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static HealthStatusEnum getByCode(String code) {
|
||||
for (HealthStatusEnum e : HealthStatusEnum.values()) {
|
||||
if (e.code.equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
HealthStatusEnum e = getByCode(code);
|
||||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> listAll() {
|
||||
List<JSONObject> list = new ArrayList<>(HealthStatusEnum.values().length);
|
||||
for (HealthStatusEnum e : HealthStatusEnum.values()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set(e.code, e.desc);
|
||||
list.add(jsonObject);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.dite.znpt.enums;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/31/周四 15:30
|
||||
* @description 设备位置状态枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum LocationStatusEnum {
|
||||
IN_STOCK("in_stock", "库存中"),
|
||||
ALLOCATED("allocated", "已分配"),
|
||||
REPAIR("repair", "维修中"),
|
||||
SCRAP("scrap", "待报废"),
|
||||
SCRAPPED("scrapped", "已报废"),
|
||||
BORROWED("borrowed", "外借中"),
|
||||
LOST("lost", "丢失");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
LocationStatusEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static LocationStatusEnum getByCode(String code) {
|
||||
for (LocationStatusEnum e : LocationStatusEnum.values()) {
|
||||
if (e.code.equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
LocationStatusEnum e = getByCode(code);
|
||||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> listAll() {
|
||||
List<JSONObject> list = new ArrayList<>(LocationStatusEnum.values().length);
|
||||
for (LocationStatusEnum e : LocationStatusEnum.values()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set(e.code, e.desc);
|
||||
list.add(jsonObject);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -1,24 +1,75 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.EquipmentEntity;
|
||||
import com.dite.znpt.domain.vo.EquipmentListReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentResp;
|
||||
import com.dite.znpt.domain.vo.EquipmentUseRecordReq;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 设备服务接口
|
||||
* @author Bear.G
|
||||
* @date 2025/7/23/周三 17:39
|
||||
* @description
|
||||
*/
|
||||
public interface EquipmentService extends IService<EquipmentEntity> {
|
||||
List<EquipmentResp> page(EquipmentListReq req);
|
||||
List<EquipmentResp> list(EquipmentListReq req);
|
||||
|
||||
/**
|
||||
* 分页查询设备信息
|
||||
*/
|
||||
IPage<EquipmentResp> page(EquipmentListReq req);
|
||||
|
||||
/**
|
||||
* 查询设备详情
|
||||
*/
|
||||
EquipmentResp detail(String equipmentId);
|
||||
|
||||
/**
|
||||
* 新增设备
|
||||
*/
|
||||
void save(EquipmentReq req);
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
*/
|
||||
void update(String equipmentId, EquipmentReq req);
|
||||
|
||||
/**
|
||||
* 删除设备
|
||||
*/
|
||||
void deleteById(String equipmentId);
|
||||
|
||||
/**
|
||||
* 批量删除设备
|
||||
*/
|
||||
void batchDelete(List<String> equipmentIds);
|
||||
|
||||
/**
|
||||
* 获取采购统计信息
|
||||
*/
|
||||
Object getProcurementStats();
|
||||
|
||||
/**
|
||||
* 导出采购记录
|
||||
*/
|
||||
byte[] exportProcurement(EquipmentListReq req);
|
||||
|
||||
/**
|
||||
* 分页查询设备采购记录
|
||||
*/
|
||||
IPage<EquipmentResp> procurementPage(EquipmentListReq req);
|
||||
|
||||
/**
|
||||
* 新增设备采购记录
|
||||
*/
|
||||
void saveProcurement(EquipmentReq req);
|
||||
|
||||
/**
|
||||
* 修改设备采购记录
|
||||
*/
|
||||
void updateProcurement(String equipmentId, EquipmentReq req);
|
||||
}
|
||||
|
|
|
@ -1,97 +1,421 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
// 移除EquipmentConverts导入,使用手动转换
|
||||
import com.dite.znpt.domain.entity.EquipmentEntity;
|
||||
import com.dite.znpt.domain.entity.EquipmentUseRecordEntity;
|
||||
import com.dite.znpt.domain.vo.EquipmentListReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentResp;
|
||||
import com.dite.znpt.domain.vo.EquipmentUseRecordReq;
|
||||
import com.dite.znpt.enums.EquipmentStatusEnum;
|
||||
import com.dite.znpt.enums.EquipmentTypeEnum;
|
||||
import com.dite.znpt.enums.HealthStatusEnum;
|
||||
import com.dite.znpt.enums.LocationStatusEnum;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.EquipmentMapper;
|
||||
import com.dite.znpt.service.EquipmentService;
|
||||
import com.dite.znpt.service.EquipmentUseRecordService;
|
||||
import com.dite.znpt.service.ProjectService;
|
||||
import com.dite.znpt.service.UserService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/23/周三 17:39
|
||||
* @description
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, EquipmentEntity> implements EquipmentService {
|
||||
|
||||
@Resource
|
||||
private EquipmentUseRecordService equipmentUseRecordService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
@Override
|
||||
public List<EquipmentResp> page(EquipmentListReq req) {
|
||||
PageUtil.startPage();
|
||||
return this.list(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EquipmentResp> list(EquipmentListReq req) {
|
||||
List<EquipmentResp> list = this.baseMapper.selectEquipmentResp(req);
|
||||
list.forEach(resp -> {
|
||||
resp.setEquipmentTypeLabel(EquipmentTypeEnum.getDescByCode(resp.getEquipmentType()));
|
||||
resp.setEquipmentStatusLabel(EquipmentStatusEnum.getDescByCode(resp.getEquipmentStatus()));
|
||||
});
|
||||
return list;
|
||||
public IPage<EquipmentResp> page(EquipmentListReq req) {
|
||||
log.info("开始执行设备分页查询,请求参数: {}", req);
|
||||
|
||||
// 创建分页对象,处理null值
|
||||
Integer pageNum = req.getPage() != null ? req.getPage() : (req.getPageNum() != null ? req.getPageNum() : 1);
|
||||
Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10;
|
||||
Page<EquipmentEntity> page = new Page<>(pageNum, pageSize);
|
||||
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<EquipmentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// 不需要手动添加 del_flag 条件,@TableLogic 注解会自动处理
|
||||
|
||||
// 添加搜索条件并记录日志
|
||||
int conditionCount = 0;
|
||||
|
||||
if (StringUtils.hasText(req.getEquipmentName())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentName, req.getEquipmentName());
|
||||
log.info("添加设备名称查询条件: {}", req.getEquipmentName());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentType())) {
|
||||
queryWrapper.eq(EquipmentEntity::getEquipmentType, req.getEquipmentType());
|
||||
log.info("添加设备类型查询条件: {}", req.getEquipmentType());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getEquipmentStatus, req.getEquipmentStatus());
|
||||
log.info("添加设备状态查询条件: {}", req.getEquipmentStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentSn())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentSn, req.getEquipmentSn());
|
||||
log.info("添加设备序列号查询条件: {}", req.getEquipmentSn());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getAssetCode())) {
|
||||
queryWrapper.like(EquipmentEntity::getAssetCode, req.getAssetCode());
|
||||
log.info("添加资产编号查询条件: {}", req.getAssetCode());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getBrand())) {
|
||||
queryWrapper.like(EquipmentEntity::getBrand, req.getBrand());
|
||||
log.info("添加品牌查询条件: {}", req.getBrand());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getLocationStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getLocationStatus, req.getLocationStatus());
|
||||
log.info("添加位置状态查询条件: {}", req.getLocationStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getHealthStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getHealthStatus, req.getHealthStatus());
|
||||
log.info("添加健康状态查询条件: {}", req.getHealthStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getResponsiblePerson())) {
|
||||
queryWrapper.like(EquipmentEntity::getResponsiblePerson, req.getResponsiblePerson());
|
||||
log.info("添加负责人查询条件: {}", req.getResponsiblePerson());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getUseStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getUseStatus, req.getUseStatus());
|
||||
log.info("添加使用状态查询条件: {}", req.getUseStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
// 新增查询条件
|
||||
if (StringUtils.hasText(req.getEquipmentModel())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentModel, req.getEquipmentModel());
|
||||
log.info("添加设备型号查询条件: {}", req.getEquipmentModel());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getSpecification())) {
|
||||
queryWrapper.like(EquipmentEntity::getSpecification, req.getSpecification());
|
||||
log.info("添加配置规格查询条件: {}", req.getSpecification());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getPhysicalLocation())) {
|
||||
queryWrapper.like(EquipmentEntity::getPhysicalLocation, req.getPhysicalLocation());
|
||||
log.info("添加物理位置查询条件: {}", req.getPhysicalLocation());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getSupplierName())) {
|
||||
queryWrapper.like(EquipmentEntity::getSupplierName, req.getSupplierName());
|
||||
log.info("添加供应商名称查询条件: {}", req.getSupplierName());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getMaintenancePerson())) {
|
||||
queryWrapper.like(EquipmentEntity::getMaintenancePerson, req.getMaintenancePerson());
|
||||
log.info("添加维护人员查询条件: {}", req.getMaintenancePerson());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getInventoryBarcode())) {
|
||||
queryWrapper.like(EquipmentEntity::getInventoryBarcode, req.getInventoryBarcode());
|
||||
log.info("添加库存条码查询条件: {}", req.getInventoryBarcode());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getAssetRemark())) {
|
||||
queryWrapper.like(EquipmentEntity::getAssetRemark, req.getAssetRemark());
|
||||
log.info("添加资产备注查询条件: {}", req.getAssetRemark());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
// 新增字段查询条件
|
||||
if (StringUtils.hasText(req.getUsingDepartment())) {
|
||||
queryWrapper.like(EquipmentEntity::getUsingDepartment, req.getUsingDepartment());
|
||||
log.info("添加使用部门/人查询条件: {}", req.getUsingDepartment());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getInvoice())) {
|
||||
queryWrapper.like(EquipmentEntity::getInvoice, req.getInvoice());
|
||||
log.info("添加发票查询条件: {}", req.getInvoice());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getBarcode())) {
|
||||
queryWrapper.like(EquipmentEntity::getBarcode, req.getBarcode());
|
||||
log.info("添加条码查询条件: {}", req.getBarcode());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getImporter())) {
|
||||
queryWrapper.like(EquipmentEntity::getImporter, req.getImporter());
|
||||
log.info("添加导入人查询条件: {}", req.getImporter());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
// 新增采购相关字段查询条件
|
||||
if (StringUtils.hasText(req.getAccountNumber())) {
|
||||
queryWrapper.like(EquipmentEntity::getAccountNumber, req.getAccountNumber());
|
||||
log.info("添加次户号查询条件: {}", req.getAccountNumber());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getQuantity() != null) {
|
||||
queryWrapper.eq(EquipmentEntity::getQuantity, req.getQuantity());
|
||||
log.info("添加数量查询条件: {}", req.getQuantity());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getUnitPrice() != null) {
|
||||
queryWrapper.eq(EquipmentEntity::getUnitPrice, req.getUnitPrice());
|
||||
log.info("添加单价查询条件: {}", req.getUnitPrice());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getTotalPrice() != null) {
|
||||
queryWrapper.eq(EquipmentEntity::getTotalPrice, req.getTotalPrice());
|
||||
log.info("添加总价查询条件: {}", req.getTotalPrice());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getInventoryBasis())) {
|
||||
queryWrapper.like(EquipmentEntity::getInventoryBasis, req.getInventoryBasis());
|
||||
log.info("添加盘点依据查询条件: {}", req.getInventoryBasis());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getDynamicRecord())) {
|
||||
queryWrapper.like(EquipmentEntity::getDynamicRecord, req.getDynamicRecord());
|
||||
log.info("添加动态记录查询条件: {}", req.getDynamicRecord());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
// 时间范围查询
|
||||
if (req.getPurchaseTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getPurchaseTime, req.getPurchaseTimeStart());
|
||||
log.info("添加采购时间开始查询条件: {}", req.getPurchaseTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getPurchaseTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getPurchaseTime, req.getPurchaseTimeEnd());
|
||||
log.info("添加采购时间结束查询条件: {}", req.getPurchaseTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getInStockTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getInStockTime, req.getInStockTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getInStockTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getInStockTime, req.getInStockTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getActivationTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getActivationTime, req.getActivationTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getActivationTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getActivationTime, req.getActivationTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getExpectedScrapTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getExpectedScrapTime, req.getExpectedScrapTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getExpectedScrapTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getExpectedScrapTime, req.getExpectedScrapTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getWarrantyExpireDateStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getWarrantyExpireDate, req.getWarrantyExpireDateStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getWarrantyExpireDateEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getWarrantyExpireDate, req.getWarrantyExpireDateEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getLastMaintenanceDateStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getLastMaintenanceDate, req.getLastMaintenanceDateStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getLastMaintenanceDateEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getLastMaintenanceDate, req.getLastMaintenanceDateEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getNextMaintenanceDateStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getNextMaintenanceDate, req.getNextMaintenanceDateStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getNextMaintenanceDateEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getNextMaintenanceDate, req.getNextMaintenanceDateEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getCreateTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getCreateTime, req.getCreateTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getCreateTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getCreateTime, req.getCreateTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getUpdateTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getUpdateTime, req.getUpdateTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getUpdateTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getUpdateTime, req.getUpdateTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
log.info("总共添加了 {} 个查询条件", conditionCount);
|
||||
|
||||
// 排序处理
|
||||
if (StringUtils.hasText(req.getOrderBy())) {
|
||||
String orderBy = req.getOrderBy();
|
||||
String orderDirection = "desc".equalsIgnoreCase(req.getOrderDirection()) ? "desc" : "asc";
|
||||
|
||||
switch (orderBy.toLowerCase()) {
|
||||
case "equipment_name":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentName);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentName);
|
||||
}
|
||||
break;
|
||||
case "equipment_sn":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentSn);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentSn);
|
||||
}
|
||||
break;
|
||||
case "asset_code":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getAssetCode);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getAssetCode);
|
||||
}
|
||||
break;
|
||||
case "equipment_type":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentType);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentType);
|
||||
}
|
||||
break;
|
||||
case "equipment_status":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentStatus);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentStatus);
|
||||
}
|
||||
break;
|
||||
case "brand":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getBrand);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getBrand);
|
||||
}
|
||||
break;
|
||||
case "responsible_person":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getResponsiblePerson);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getResponsiblePerson);
|
||||
}
|
||||
break;
|
||||
case "purchase_time":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getPurchaseTime);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getPurchaseTime);
|
||||
}
|
||||
break;
|
||||
case "purchase_price":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getTotalPrice);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getTotalPrice);
|
||||
}
|
||||
break;
|
||||
case "update_time":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getUpdateTime);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getUpdateTime);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// 默认按创建时间倒序
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getCreateTime);
|
||||
break;
|
||||
}
|
||||
log.info("添加排序条件: {} {}", orderBy, orderDirection);
|
||||
} else {
|
||||
// 默认按创建时间倒序
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getCreateTime);
|
||||
log.info("使用默认排序: 按创建时间倒序");
|
||||
}
|
||||
|
||||
log.info("执行分页查询,SQL条件: {}", queryWrapper.getTargetSql());
|
||||
|
||||
// 执行分页查询
|
||||
IPage<EquipmentEntity> equipmentPage = this.page(page, queryWrapper);
|
||||
|
||||
log.info("查询完成,总记录数: {}, 当前页记录数: {}", equipmentPage.getTotal(), equipmentPage.getRecords().size());
|
||||
|
||||
// 转换为响应对象
|
||||
List<EquipmentResp> equipmentRespList = equipmentPage.getRecords().stream()
|
||||
.map(this::convertToResp)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 创建响应分页对象
|
||||
Page<EquipmentResp> respPage = new Page<>(equipmentPage.getCurrent(), equipmentPage.getSize(), equipmentPage.getTotal());
|
||||
respPage.setRecords(equipmentRespList);
|
||||
|
||||
return respPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EquipmentResp detail(String equipmentId) {
|
||||
EquipmentResp resp = this.baseMapper.getEquipmentRespByEquipmentId(equipmentId);
|
||||
resp.setEquipmentTypeLabel(EquipmentTypeEnum.getDescByCode(resp.getEquipmentType()));
|
||||
resp.setEquipmentStatusLabel(EquipmentStatusEnum.getDescByCode(resp.getEquipmentStatus()));
|
||||
return resp;
|
||||
EquipmentEntity equipment = this.getById(equipmentId);
|
||||
if (equipment == null) {
|
||||
throw new ServiceException(Message.EQUIPMENT_ID_NOT_EXIST);
|
||||
}
|
||||
return convertToResp(equipment);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void save(EquipmentReq req) {
|
||||
EquipmentEntity entity = Converts.INSTANCE.toEquipmentUseRecordEntity(req);
|
||||
if(null != getByEquipmentSn(entity.getEquipmentSn())){
|
||||
EquipmentEntity entity = convertToEntity(req);
|
||||
if (getByEquipmentSn(entity.getEquipmentSn()) != null) {
|
||||
throw new ServiceException(Message.EQUIPMENT_SN_EXIST);
|
||||
}
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
private EquipmentEntity getByEquipmentSn(String equipmentSn){
|
||||
return this.getOne(Wrappers.lambdaQuery(EquipmentEntity.class).eq(EquipmentEntity::getEquipmentSn, equipmentSn));
|
||||
private EquipmentEntity getByEquipmentSn(String equipmentSn) {
|
||||
LambdaQueryWrapper<EquipmentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(EquipmentEntity::getEquipmentSn, equipmentSn);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void update(String equipmentId, EquipmentReq req) {
|
||||
EquipmentEntity equipment = this.getById(equipmentId);
|
||||
if(null == equipment){
|
||||
if (equipment == null) {
|
||||
throw new ServiceException(Message.EQUIPMENT_ID_NOT_EXIST);
|
||||
}
|
||||
if(!equipment.getEquipmentSn().equals(req.getEquipmentSn()) && null != getByEquipmentSn(req.getEquipmentSn())){
|
||||
if (!equipment.getEquipmentSn().equals(req.getEquipmentSn()) && getByEquipmentSn(req.getEquipmentSn()) != null) {
|
||||
throw new ServiceException(Message.EQUIPMENT_SN_EXIST);
|
||||
}
|
||||
EquipmentEntity entity = Converts.INSTANCE.toEquipmentUseRecordEntity(req);
|
||||
EquipmentEntity entity = convertToEntity(req);
|
||||
entity.setEquipmentId(equipmentId);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
@ -100,9 +424,393 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
@Override
|
||||
public void deleteById(String equipmentId) {
|
||||
EquipmentEntity equipment = this.getById(equipmentId);
|
||||
if(null == equipment){
|
||||
if (equipment == null) {
|
||||
throw new ServiceException(Message.EQUIPMENT_ID_NOT_EXIST);
|
||||
}
|
||||
this.removeById(equipmentId);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void batchDelete(List<String> equipmentIds) {
|
||||
if (equipmentIds == null || equipmentIds.isEmpty()) {
|
||||
throw new ServiceException("设备ID列表不能为空");
|
||||
}
|
||||
this.removeByIds(equipmentIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] exportProcurement(EquipmentListReq req) {
|
||||
// 这里可以实现导出功能,返回Excel文件的字节数组
|
||||
// 暂时返回空数组,实际项目中需要实现具体的导出逻辑
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 将EquipmentReq转换为EquipmentEntity
|
||||
*/
|
||||
private EquipmentEntity convertToEntity(EquipmentReq req) {
|
||||
EquipmentEntity entity = new EquipmentEntity();
|
||||
entity.setAssetCode(req.getAssetCode());
|
||||
entity.setEquipmentName(req.getEquipmentName());
|
||||
entity.setEquipmentModel(req.getEquipmentModel());
|
||||
entity.setEquipmentType(req.getEquipmentType());
|
||||
entity.setEquipmentStatus(req.getEquipmentStatus());
|
||||
entity.setUseStatus(req.getUseStatus());
|
||||
entity.setEquipmentSn(req.getEquipmentSn());
|
||||
entity.setBrand(req.getBrand());
|
||||
entity.setSpecification(req.getSpecification());
|
||||
entity.setLocationStatus(req.getLocationStatus());
|
||||
entity.setPhysicalLocation(req.getPhysicalLocation());
|
||||
entity.setResponsiblePerson(req.getResponsiblePerson());
|
||||
entity.setHealthStatus(req.getHealthStatus());
|
||||
entity.setPurchaseTime(req.getPurchaseTime());
|
||||
entity.setInStockTime(req.getInStockTime());
|
||||
entity.setActivationTime(req.getActivationTime());
|
||||
entity.setExpectedScrapTime(req.getExpectedScrapTime());
|
||||
entity.setActualScrapTime(req.getActualScrapTime());
|
||||
entity.setStatusChangeTime(req.getStatusChangeTime());
|
||||
entity.setPurchaseOrder(req.getPurchaseOrder());
|
||||
entity.setSupplierName(req.getSupplierName());
|
||||
entity.setCurrentNetValue(req.getCurrentNetValue());
|
||||
entity.setDepreciationMethod(req.getDepreciationMethod());
|
||||
entity.setDepreciationYears(req.getDepreciationYears());
|
||||
entity.setSalvageValue(req.getSalvageValue());
|
||||
entity.setWarrantyExpireDate(req.getWarrantyExpireDate());
|
||||
entity.setLastMaintenanceDate(req.getLastMaintenanceDate());
|
||||
entity.setNextMaintenanceDate(req.getNextMaintenanceDate());
|
||||
entity.setMaintenancePerson(req.getMaintenancePerson());
|
||||
entity.setInventoryBarcode(req.getInventoryBarcode());
|
||||
entity.setAssetRemark(req.getAssetRemark());
|
||||
|
||||
// 新增采购相关字段
|
||||
entity.setAccountNumber(req.getAccountNumber());
|
||||
entity.setQuantity(req.getQuantity());
|
||||
entity.setUnitPrice(req.getUnitPrice());
|
||||
entity.setTotalPrice(req.getTotalPrice());
|
||||
entity.setInventoryBasis(req.getInventoryBasis());
|
||||
entity.setDynamicRecord(req.getDynamicRecord());
|
||||
|
||||
// 新增字段转换
|
||||
entity.setUsingDepartment(req.getUsingDepartment());
|
||||
entity.setBorrowingTime(req.getBorrowingTime());
|
||||
entity.setReturnTime(req.getReturnTime());
|
||||
entity.setOutStockTime(req.getOutStockTime());
|
||||
entity.setTotalUsageTime(req.getTotalUsageTime());
|
||||
entity.setDepreciationRate(req.getDepreciationRate());
|
||||
entity.setDepreciationMethodDesc(req.getDepreciationMethodDesc());
|
||||
entity.setInvoice(req.getInvoice());
|
||||
entity.setInvoiceStatus(req.getInvoiceStatus());
|
||||
entity.setAttachments(req.getAttachments());
|
||||
entity.setPhotos(req.getPhotos());
|
||||
entity.setBarcode(req.getBarcode());
|
||||
entity.setImporter(req.getImporter());
|
||||
entity.setInventoryTimeStatus1(req.getInventoryTimeStatus1());
|
||||
entity.setInventoryTimeStatus2(req.getInventoryTimeStatus2());
|
||||
entity.setInventoryTimeStatus3(req.getInventoryTimeStatus3());
|
||||
entity.setInventoryCheckTimeStatus1(req.getInventoryCheckTimeStatus1());
|
||||
entity.setInventoryCheckTimeStatus2(req.getInventoryCheckTimeStatus2());
|
||||
entity.setInventoryCheckTimeStatus3(req.getInventoryCheckTimeStatus3());
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为响应对象
|
||||
*/
|
||||
private EquipmentResp convertToResp(EquipmentEntity entity) {
|
||||
EquipmentResp resp = new EquipmentResp();
|
||||
resp.setEquipmentId(entity.getEquipmentId());
|
||||
resp.setAssetCode(entity.getAssetCode());
|
||||
resp.setEquipmentName(entity.getEquipmentName());
|
||||
resp.setEquipmentType(entity.getEquipmentType());
|
||||
resp.setEquipmentTypeLabel(EquipmentTypeEnum.getDescByCode(entity.getEquipmentType()));
|
||||
resp.setEquipmentModel(entity.getEquipmentModel());
|
||||
resp.setEquipmentSn(entity.getEquipmentSn());
|
||||
resp.setBrand(entity.getBrand());
|
||||
resp.setSpecification(entity.getSpecification());
|
||||
resp.setEquipmentStatus(entity.getEquipmentStatus());
|
||||
resp.setEquipmentStatusLabel(EquipmentStatusEnum.getDescByCode(entity.getEquipmentStatus()));
|
||||
resp.setUseStatus(entity.getUseStatus());
|
||||
resp.setLocationStatus(entity.getLocationStatus());
|
||||
resp.setLocationStatusLabel(LocationStatusEnum.getDescByCode(entity.getLocationStatus()));
|
||||
resp.setPhysicalLocation(entity.getPhysicalLocation());
|
||||
resp.setResponsiblePerson(entity.getResponsiblePerson());
|
||||
resp.setHealthStatus(entity.getHealthStatus());
|
||||
resp.setHealthStatusLabel(HealthStatusEnum.getDescByCode(entity.getHealthStatus()));
|
||||
resp.setPurchaseTime(entity.getPurchaseTime());
|
||||
resp.setInStockTime(entity.getInStockTime());
|
||||
resp.setActivationTime(entity.getActivationTime());
|
||||
resp.setExpectedScrapTime(entity.getExpectedScrapTime());
|
||||
resp.setActualScrapTime(entity.getActualScrapTime());
|
||||
resp.setStatusChangeTime(entity.getStatusChangeTime());
|
||||
resp.setPurchaseOrder(entity.getPurchaseOrder());
|
||||
resp.setSupplierName(entity.getSupplierName());
|
||||
resp.setCurrentNetValue(entity.getCurrentNetValue());
|
||||
resp.setDepreciationMethod(entity.getDepreciationMethod());
|
||||
resp.setDepreciationYears(entity.getDepreciationYears());
|
||||
resp.setSalvageValue(entity.getSalvageValue());
|
||||
resp.setWarrantyExpireDate(entity.getWarrantyExpireDate());
|
||||
resp.setLastMaintenanceDate(entity.getLastMaintenanceDate());
|
||||
resp.setNextMaintenanceDate(entity.getNextMaintenanceDate());
|
||||
resp.setMaintenancePerson(entity.getMaintenancePerson());
|
||||
resp.setInventoryBarcode(entity.getInventoryBarcode());
|
||||
resp.setAssetRemark(entity.getAssetRemark());
|
||||
|
||||
// 新增采购相关字段
|
||||
resp.setAccountNumber(entity.getAccountNumber());
|
||||
resp.setQuantity(entity.getQuantity());
|
||||
resp.setUnitPrice(entity.getUnitPrice());
|
||||
resp.setTotalPrice(entity.getTotalPrice());
|
||||
resp.setInventoryBasis(entity.getInventoryBasis());
|
||||
resp.setDynamicRecord(entity.getDynamicRecord());
|
||||
|
||||
// 新增字段转换
|
||||
resp.setUsingDepartment(entity.getUsingDepartment());
|
||||
resp.setBorrowingTime(entity.getBorrowingTime());
|
||||
resp.setReturnTime(entity.getReturnTime());
|
||||
resp.setOutStockTime(entity.getOutStockTime());
|
||||
resp.setTotalUsageTime(entity.getTotalUsageTime());
|
||||
resp.setDepreciationRate(entity.getDepreciationRate());
|
||||
resp.setDepreciationMethodDesc(entity.getDepreciationMethodDesc());
|
||||
resp.setInvoice(entity.getInvoice());
|
||||
resp.setInvoiceStatus(entity.getInvoiceStatus());
|
||||
resp.setAttachments(entity.getAttachments());
|
||||
resp.setPhotos(entity.getPhotos());
|
||||
resp.setBarcode(entity.getBarcode());
|
||||
resp.setImporter(entity.getImporter());
|
||||
resp.setInventoryTimeStatus1(entity.getInventoryTimeStatus1());
|
||||
resp.setInventoryTimeStatus2(entity.getInventoryTimeStatus2());
|
||||
resp.setInventoryTimeStatus3(entity.getInventoryTimeStatus3());
|
||||
resp.setInventoryCheckTimeStatus1(entity.getInventoryCheckTimeStatus1());
|
||||
resp.setInventoryCheckTimeStatus2(entity.getInventoryCheckTimeStatus2());
|
||||
resp.setInventoryCheckTimeStatus3(entity.getInventoryCheckTimeStatus3());
|
||||
|
||||
resp.setCreateTime(entity.getCreateTime());
|
||||
resp.setUpdateTime(entity.getUpdateTime());
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
// 采购管理相关方法实现
|
||||
@Override
|
||||
public IPage<EquipmentResp> procurementPage(EquipmentListReq req) {
|
||||
log.info("开始执行设备采购记录分页查询,请求参数: {}", req);
|
||||
|
||||
// 创建分页对象,处理null值
|
||||
Integer pageNum = req.getPage() != null ? req.getPage() : (req.getPageNum() != null ? req.getPageNum() : 1);
|
||||
Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10;
|
||||
Page<EquipmentEntity> page = new Page<>(pageNum, pageSize);
|
||||
|
||||
// 构建查询条件,参考设备分页查询的逻辑
|
||||
LambdaQueryWrapper<EquipmentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// 不需要手动添加 del_flag 条件,@TableLogic 注解会自动处理
|
||||
|
||||
// 添加搜索条件并记录日志
|
||||
int conditionCount = 0;
|
||||
|
||||
if (StringUtils.hasText(req.getEquipmentName())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentName, req.getEquipmentName());
|
||||
log.info("添加设备名称查询条件: {}", req.getEquipmentName());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentType())) {
|
||||
queryWrapper.eq(EquipmentEntity::getEquipmentType, req.getEquipmentType());
|
||||
log.info("添加设备类型查询条件: {}", req.getEquipmentType());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getEquipmentStatus, req.getEquipmentStatus());
|
||||
log.info("添加设备状态查询条件: {}", req.getEquipmentStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentSn())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentSn, req.getEquipmentSn());
|
||||
log.info("添加设备序列号查询条件: {}", req.getEquipmentSn());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getAssetCode())) {
|
||||
queryWrapper.like(EquipmentEntity::getAssetCode, req.getAssetCode());
|
||||
log.info("添加资产编号查询条件: {}", req.getAssetCode());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getBrand())) {
|
||||
queryWrapper.like(EquipmentEntity::getBrand, req.getBrand());
|
||||
log.info("添加品牌查询条件: {}", req.getBrand());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getLocationStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getLocationStatus, req.getLocationStatus());
|
||||
log.info("添加位置状态查询条件: {}", req.getLocationStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getHealthStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getHealthStatus, req.getHealthStatus());
|
||||
log.info("添加健康状态查询条件: {}", req.getHealthStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getResponsiblePerson())) {
|
||||
queryWrapper.like(EquipmentEntity::getResponsiblePerson, req.getResponsiblePerson());
|
||||
log.info("添加负责人查询条件: {}", req.getResponsiblePerson());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getPhysicalLocation())) {
|
||||
queryWrapper.like(EquipmentEntity::getPhysicalLocation, req.getPhysicalLocation());
|
||||
log.info("添加物理位置查询条件: {}", req.getPhysicalLocation());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
// 添加采购相关的搜索条件
|
||||
if (StringUtils.hasText(req.getPurchaseOrder())) {
|
||||
queryWrapper.like(EquipmentEntity::getPurchaseOrder, req.getPurchaseOrder());
|
||||
log.info("添加采购订单查询条件: {}", req.getPurchaseOrder());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getSupplierName())) {
|
||||
queryWrapper.like(EquipmentEntity::getSupplierName, req.getSupplierName());
|
||||
log.info("添加供应商查询条件: {}", req.getSupplierName());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getAccountNumber())) {
|
||||
queryWrapper.like(EquipmentEntity::getAccountNumber, req.getAccountNumber());
|
||||
log.info("添加次户号查询条件: {}", req.getAccountNumber());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getQuantity() != null) {
|
||||
queryWrapper.eq(EquipmentEntity::getQuantity, req.getQuantity());
|
||||
log.info("添加数量查询条件: {}", req.getQuantity());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getUnitPrice() != null) {
|
||||
queryWrapper.eq(EquipmentEntity::getUnitPrice, req.getUnitPrice());
|
||||
log.info("添加单价查询条件: {}", req.getUnitPrice());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getTotalPrice() != null) {
|
||||
queryWrapper.eq(EquipmentEntity::getTotalPrice, req.getTotalPrice());
|
||||
log.info("添加总价查询条件: {}", req.getTotalPrice());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getInventoryBasis())) {
|
||||
queryWrapper.like(EquipmentEntity::getInventoryBasis, req.getInventoryBasis());
|
||||
log.info("添加盘点依据查询条件: {}", req.getInventoryBasis());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getDynamicRecord())) {
|
||||
queryWrapper.like(EquipmentEntity::getDynamicRecord, req.getDynamicRecord());
|
||||
log.info("添加动态记录查询条件: {}", req.getDynamicRecord());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
log.info("总共添加了 {} 个查询条件", conditionCount);
|
||||
|
||||
// 按采购时间倒序排列
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getPurchaseTime);
|
||||
|
||||
// 执行查询
|
||||
IPage<EquipmentEntity> result = this.page(page, queryWrapper);
|
||||
|
||||
// 转换为响应对象
|
||||
List<EquipmentResp> records = result.getRecords().stream()
|
||||
.map(this::convertToResp)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 创建新的分页结果
|
||||
Page<EquipmentResp> respPage = new Page<>(result.getCurrent(), result.getSize(), result.getTotal());
|
||||
respPage.setRecords(records);
|
||||
|
||||
log.info("设备采购记录分页查询完成,总记录数: {}", result.getTotal());
|
||||
return respPage;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void saveProcurement(EquipmentReq req) {
|
||||
log.info("开始新增设备采购记录,请求参数: {}", req);
|
||||
|
||||
// 验证采购订单号唯一性
|
||||
if (StringUtils.hasText(req.getPurchaseOrder())) {
|
||||
LambdaQueryWrapper<EquipmentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(EquipmentEntity::getPurchaseOrder, req.getPurchaseOrder());
|
||||
long count = this.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new ServiceException("采购订单号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 设置采购相关的时间字段
|
||||
if (req.getPurchaseTime() == null) {
|
||||
req.setPurchaseTime(LocalDateTime.now());
|
||||
}
|
||||
|
||||
// 转换为实体并保存
|
||||
EquipmentEntity entity = convertToEntity(req);
|
||||
this.save(entity);
|
||||
|
||||
log.info("设备采购记录新增成功,设备ID: {}", entity.getEquipmentId());
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateProcurement(String equipmentId, EquipmentReq req) {
|
||||
log.info("开始修改设备采购记录,设备ID: {}, 请求参数: {}", equipmentId, req);
|
||||
|
||||
// 检查设备是否存在
|
||||
EquipmentEntity existingEntity = this.getById(equipmentId);
|
||||
if (existingEntity == null) {
|
||||
throw new ServiceException("设备不存在");
|
||||
}
|
||||
|
||||
// 验证采购订单号唯一性(排除当前设备)
|
||||
if (StringUtils.hasText(req.getPurchaseOrder())) {
|
||||
LambdaQueryWrapper<EquipmentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(EquipmentEntity::getPurchaseOrder, req.getPurchaseOrder())
|
||||
.ne(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
long count = this.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new ServiceException("采购订单号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 转换为实体并更新
|
||||
EquipmentEntity entity = convertToEntity(req);
|
||||
entity.setEquipmentId(equipmentId);
|
||||
this.updateById(entity);
|
||||
|
||||
log.info("设备采购记录修改成功,设备ID: {}", equipmentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getProcurementStats() {
|
||||
log.info("开始获取采购统计信息");
|
||||
|
||||
// 统计采购总金额
|
||||
LambdaQueryWrapper<EquipmentEntity> priceWrapper = new LambdaQueryWrapper<>();
|
||||
priceWrapper.isNotNull(EquipmentEntity::getTotalPrice);
|
||||
List<EquipmentEntity> priceEntities = this.list(priceWrapper);
|
||||
double totalAmount = priceEntities.stream()
|
||||
.mapToDouble(entity -> entity.getTotalPrice() != null ? entity.getTotalPrice().doubleValue() : 0)
|
||||
.sum();
|
||||
|
||||
// 统计供应商数量
|
||||
LambdaQueryWrapper<EquipmentEntity> supplierWrapper = new LambdaQueryWrapper<>();
|
||||
supplierWrapper.isNotNull(EquipmentEntity::getSupplierName)
|
||||
.groupBy(EquipmentEntity::getSupplierName);
|
||||
long supplierCount = this.count(supplierWrapper);
|
||||
|
||||
// 统计采购设备数量
|
||||
LambdaQueryWrapper<EquipmentEntity> equipmentWrapper = new LambdaQueryWrapper<>();
|
||||
equipmentWrapper.isNotNull(EquipmentEntity::getPurchaseOrder);
|
||||
long equipmentCount = this.count(equipmentWrapper);
|
||||
|
||||
// 构建统计结果
|
||||
java.util.Map<String, Object> stats = new java.util.HashMap<>();
|
||||
stats.put("totalAmount", totalAmount);
|
||||
stats.put("supplierCount", supplierCount);
|
||||
stats.put("equipmentCount", equipmentCount);
|
||||
stats.put("averageAmount", equipmentCount > 0 ? totalAmount / equipmentCount : 0);
|
||||
|
||||
log.info("采购统计信息获取完成,总金额: {}, 供应商数: {}, 设备数: {}", totalAmount, supplierCount, equipmentCount);
|
||||
return stats;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.dite.znpt.web.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.dite.znpt.domain.PageResult;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.vo.EquipmentListReq;
|
||||
|
@ -12,31 +13,29 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/23/周三 17:41
|
||||
* @description
|
||||
*/
|
||||
@Api(tags = "设备信息")
|
||||
@Api(tags = "设备信息----------------------------")
|
||||
@RestController
|
||||
@RequestMapping("/equipment")
|
||||
public class EquipmentController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(EquipmentController.class);
|
||||
|
||||
@Resource
|
||||
private EquipmentService equipmentService;
|
||||
|
||||
@ApiOperation(value = "分页查询设备信息列表", httpMethod = "GET")
|
||||
@GetMapping("/page")
|
||||
public PageResult<EquipmentResp> page(EquipmentListReq req) {
|
||||
return PageResult.ok(equipmentService.page(req));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询设备信息列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public Result<List<EquipmentResp>> list(EquipmentListReq req) {
|
||||
return Result.ok(equipmentService.list(req));
|
||||
IPage<EquipmentResp> page = equipmentService.page(req);
|
||||
return PageResult.ok(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询设备信息详情", httpMethod = "GET")
|
||||
|
@ -66,4 +65,47 @@ public class EquipmentController {
|
|||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询设备采购记录", httpMethod = "GET")
|
||||
@GetMapping("/procurement/page")
|
||||
public PageResult<EquipmentResp> procurementPage(EquipmentListReq req) {
|
||||
log.info("=== 设备采购记录查询接口被调用 ===");
|
||||
log.info("接收到的请求参数: {}", req);
|
||||
log.info("设备名称: {}", req.getEquipmentName());
|
||||
log.info("设备类型: {}", req.getEquipmentType());
|
||||
log.info("供应商名称: {}", req.getSupplierName());
|
||||
log.info("采购订单号: {}", req.getPurchaseOrder());
|
||||
log.info("次户号: {}", req.getAccountNumber());
|
||||
log.info("数量: {}", req.getQuantity());
|
||||
log.info("单价: {}", req.getUnitPrice());
|
||||
log.info("总价: {}", req.getTotalPrice());
|
||||
log.info("盘点依据: {}", req.getInventoryBasis());
|
||||
log.info("动态记录: {}", req.getDynamicRecord());
|
||||
log.info("页码: {}", req.getPage());
|
||||
log.info("每页大小: {}", req.getPageSize());
|
||||
log.info("排序字段: {}", req.getOrderBy());
|
||||
log.info("排序方向: {}", req.getOrderDirection());
|
||||
|
||||
IPage<EquipmentResp> page = equipmentService.procurementPage(req);
|
||||
return PageResult.ok(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增设备采购记录", httpMethod = "POST")
|
||||
@PostMapping("/procurement")
|
||||
public Result<?> addProcurement(@Validated @RequestBody EquipmentReq req){
|
||||
equipmentService.saveProcurement(req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改设备采购记录", httpMethod = "PUT")
|
||||
@PutMapping("/procurement/{equipmentId}")
|
||||
public Result<?> editProcurement(@PathVariable String equipmentId, @Validated @RequestBody EquipmentReq req){
|
||||
equipmentService.updateProcurement(equipmentId, req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取采购统计信息", httpMethod = "GET")
|
||||
@GetMapping("/procurement/stats")
|
||||
public Result<?> getProcurementStats(){
|
||||
return Result.ok(equipmentService.getProcurementStats());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue