From cb8444745067cb00f8155f2c6043dd38deefc427 Mon Sep 17 00:00:00 2001 From: yuyongle <1150359267@qq.com> Date: Tue, 5 Aug 2025 12:15:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E8=B5=84=E4=BA=A7bu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApplicationController.java | 10 +- .../controller/DepotLogController.java | 4 +- .../dromara/property/domain/Application.java | 4 +- .../org/dromara/property/domain/Asset.java | 4 +- .../org/dromara/property/domain/Depot.java | 2 +- .../org/dromara/property/domain/DepotLog.java | 12 +- .../domain/InspectionPointRecord.java | 58 +++++++++ .../property/domain/InspectionRoutePoint.java | 63 ++++++++++ .../property/domain/bo/ApplicationBo.java | 4 +- .../dromara/property/domain/bo/AssetBo.java | 8 +- .../property/domain/bo/AssetTypeBo.java | 2 +- .../property/domain/bo/CleanOrderBo.java | 7 ++ .../property/domain/bo/DepotLogBo.java | 6 +- .../domain/bo/InspectionPointRecordBo.java | 60 +++++++++ .../property/domain/bo/InspectionRouteBo.java | 7 ++ .../domain/bo/InspectionRoutePointBo.java | 66 ++++++++++ .../property/domain/vo/ApplicationVo.java | 4 +- .../property/domain/vo/AssetTypeVo.java | 2 +- .../dromara/property/domain/vo/AssetVo.java | 3 +- .../property/domain/vo/DepotLogVo.java | 32 ++++- .../dromara/property/domain/vo/DepotVo.java | 2 +- .../domain/vo/InspectionPointRecordVo.java | 70 +++++++++++ .../domain/vo/InspectionRoutePointVo.java | 76 ++++++++++++ .../mapper/InspectionPointRecordMapper.java | 17 +++ .../mapper/InspectionRoutePointMapper.java | 17 +++ .../property/service/IApplicationService.java | 7 ++ .../service/impl/ApplicationServiceImpl.java | 115 ++++++++++++++---- .../service/impl/AssetServiceImpl.java | 6 +- .../impl/CapitalApplicationServiceImpl.java | 3 +- .../service/impl/DepotLogServiceImpl.java | 87 +++++++++++-- .../impl/InspectionRouteServiceImpl.java | 12 ++ .../impl/ServiceWorkOrdersServiceImpl.java | 1 + 32 files changed, 704 insertions(+), 67 deletions(-) create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/InspectionPointRecord.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/InspectionRoutePoint.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionPointRecordBo.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionRoutePointBo.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionPointRecordVo.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionRoutePointVo.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/InspectionPointRecordMapper.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/InspectionRoutePointMapper.java diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ApplicationController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ApplicationController.java index 5f17fa20..038e46f0 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ApplicationController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ApplicationController.java @@ -62,7 +62,7 @@ public class ApplicationController extends BaseController { * * @param id 主键 */ - @SaCheckPermission("property:application:query") + //@SaCheckPermission("property:application:query") @GetMapping("/{id}") public R getInfo(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { @@ -90,7 +90,13 @@ public class ApplicationController extends BaseController { public R edit(@Validated(EditGroup.class) @RequestBody ApplicationBo bo) { return toAjax(applicationService.updateByBo(bo)); } - + /** + * 审核通过 + */ + @PostMapping("/verified") + public R verified(@Validated(EditGroup.class) @RequestBody ApplicationBo bo) { + return toAjax(applicationService.verifiedByBo(bo)); + } /** * 删除资产领用 * diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/DepotLogController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/DepotLogController.java index 6fe74b6b..390d083e 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/DepotLogController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/DepotLogController.java @@ -40,7 +40,7 @@ public class DepotLogController extends BaseController { /** * 查询仓库记录列表 */ - @SaCheckPermission("property:log:list") + //@SaCheckPermission("property:log:list") @GetMapping("/list") public TableDataInfo list(DepotLogBo bo, PageQuery pageQuery) { return depotLogService.queryPageList(bo, pageQuery); @@ -62,7 +62,7 @@ public class DepotLogController extends BaseController { * * @param id 主键 */ - @SaCheckPermission("property:log:query") + // @SaCheckPermission("property:log:query") @GetMapping("/{id}") public R getInfo(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Application.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Application.java index 91805b2f..64f9e14b 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Application.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Application.java @@ -42,12 +42,12 @@ public class Application extends TenantEntity { /** * 数量 */ - private Long number; + private Integer number; /** * 状态 */ - private Long state; + private Integer state; /** * 审批人id diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Asset.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Asset.java index dd3b05a7..40598e87 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Asset.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Asset.java @@ -4,6 +4,8 @@ import org.dromara.common.tenant.core.TenantEntity; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; @@ -47,7 +49,7 @@ public class Asset extends TenantEntity { /** * 价格 */ - private Long price; + private BigDecimal price; /** * 库存 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Depot.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Depot.java index eca7bc57..c9be067c 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Depot.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Depot.java @@ -45,7 +45,7 @@ public class Depot extends TenantEntity { /** * 状态 */ - private Long state; + private Integer state; /** * 创建人id diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/DepotLog.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/DepotLog.java index 14138671..c192b8d4 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/DepotLog.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/DepotLog.java @@ -4,6 +4,8 @@ import org.dromara.common.tenant.core.TenantEntity; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; @@ -42,7 +44,7 @@ public class DepotLog extends TenantEntity { /** * 流转类型 */ - private Long type; + private Integer type; /** * 流转时间 @@ -57,7 +59,7 @@ public class DepotLog extends TenantEntity { /** * 状态 */ - private Long state; + private Integer state; /** * 备注 @@ -67,17 +69,17 @@ public class DepotLog extends TenantEntity { /** * 价格 */ - private Long price; + private BigDecimal price; /** * 总价 */ - private Long priceSum; + private BigDecimal priceSum; /** * 数量 */ - private Long number; + private Integer number; /** * 供应商id diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/InspectionPointRecord.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/InspectionPointRecord.java new file mode 100644 index 00000000..6a198b2a --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/InspectionPointRecord.java @@ -0,0 +1,58 @@ +package org.dromara.property.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 巡检点签到记录对象 inspection_point_record + * + * @author mocheng + * @date 2025-08-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("inspection_point_record") +public class InspectionPointRecord extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id") + private Long id; + + /** + * 巡检点id + */ + private Long pointId; + + /** + * 签到人id + */ + private Long userId; + + /** + * 签到时间 + */ + private Date signTime; + + /** + * 备注 + */ + private String remark; + + /** + * 搜索值 + */ + private String searchValue; + + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/InspectionRoutePoint.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/InspectionRoutePoint.java new file mode 100644 index 00000000..7746ccfb --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/InspectionRoutePoint.java @@ -0,0 +1,63 @@ +package org.dromara.property.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 巡检路线巡检点关联对象 inspection_route_point + * + * @author mocheng + * @date 2025-08-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("inspection_route_point") +public class InspectionRoutePoint extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id") + private Long id; + + /** + * 巡检路线id + */ + private Long routeId; + + /** + * 巡检点id + */ + private Long pointId; + + /** + * 开始时间 + */ + private Date startTime; + + /** + * 结束时间 + */ + private Date endTime; + + /** + * 备注 + */ + private String remark; + + /** + * 搜索值 + */ + private String searchValue; + + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ApplicationBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ApplicationBo.java index dcd69e84..af8b802b 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ApplicationBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ApplicationBo.java @@ -41,12 +41,12 @@ public class ApplicationBo extends BaseEntity { /** * 数量 */ - private Long number; + private Integer number; /** * 状态 */ - private Long state; + private Integer state; /** * 审批人id diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AssetBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AssetBo.java index 97948ef5..284fb176 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AssetBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AssetBo.java @@ -8,6 +8,8 @@ import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; + +import java.math.BigDecimal; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; @@ -46,12 +48,12 @@ public class AssetBo extends BaseEntity { /** * 价格 */ - private Long price; + private BigDecimal price; /** * 库存 */ - private Long stock; + private Integer stock; /** * 计量单位 @@ -81,7 +83,7 @@ public class AssetBo extends BaseEntity { /** * 固定资产类型 */ - private Long type; + private Integer type; } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AssetTypeBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AssetTypeBo.java index be8b16b1..c24b83ac 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AssetTypeBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AssetTypeBo.java @@ -34,7 +34,7 @@ public class AssetTypeBo extends BaseEntity { /** * 排序 */ - private Long sort; + private Integer sort; } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CleanOrderBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CleanOrderBo.java index a4957a5b..fd6daed4 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CleanOrderBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CleanOrderBo.java @@ -90,6 +90,8 @@ public class CleanOrderBo extends BaseEntity { @NotBlank(message = "结束时间不能为空", groups = {AddGroup.class, EditGroup.class}) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") private String endTime; + + /** * 评价 */ @@ -102,6 +104,11 @@ public class CleanOrderBo extends BaseEntity { * 图片 */ private String imgUrl; + + /** + * 单位id + */ + @NotNull(message = "单位id不能为空", groups = {AddGroup.class, EditGroup.class}) private Long unitId; // /** diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/DepotLogBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/DepotLogBo.java index 86f4b228..1f5993c6 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/DepotLogBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/DepotLogBo.java @@ -8,6 +8,8 @@ import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; + +import java.math.BigDecimal; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; @@ -66,12 +68,12 @@ public class DepotLogBo extends BaseEntity { /** * 价格 */ - private Long price; + private BigDecimal price; /** * 总价 */ - private Long priceSum; + private BigDecimal priceSum; /** * 数量 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionPointRecordBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionPointRecordBo.java new file mode 100644 index 00000000..6d78b6e2 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionPointRecordBo.java @@ -0,0 +1,60 @@ +package org.dromara.property.domain.bo; + +import org.dromara.property.domain.InspectionPointRecord; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 巡检点签到记录业务对象 inspection_point_record + * + * @author mocheng + * @date 2025-08-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = InspectionPointRecord.class, reverseConvertGenerate = false) +public class InspectionPointRecordBo extends BaseEntity { + + /** + * 主键id + */ + @NotNull(message = "主键id不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 巡检点id + */ + @NotNull(message = "巡检点id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long pointId; + + /** + * 签到人id + */ + @NotNull(message = "签到人id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long userId; + + /** + * 签到时间 + */ + @NotNull(message = "签到时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date signTime; + + /** + * 备注 + */ + private String remark; + + /** + * 搜索值 + */ + private String searchValue; + + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionRouteBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionRouteBo.java index 14aefc3f..74d20196 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionRouteBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionRouteBo.java @@ -9,6 +9,8 @@ import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; import org.dromara.property.domain.InspectionRoute; +import java.util.List; + /** * 巡检路线业务对象 inspection_route * @@ -41,4 +43,9 @@ public class InspectionRouteBo extends BaseEntity { */ @NotNull(message = "排序不能为空", groups = { EditGroup.class }) private Integer sort; + /** + * 巡检路线巡检点关联 + */ + @NotEmpty(message = "巡检点不能为空", groups = { EditGroup.class }) + List inspectionRoutePointBoList; } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionRoutePointBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionRoutePointBo.java new file mode 100644 index 00000000..c202fcd2 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionRoutePointBo.java @@ -0,0 +1,66 @@ +package org.dromara.property.domain.bo; + +import org.dromara.property.domain.InspectionRoutePoint; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 巡检路线巡检点关联业务对象 inspection_route_point + * + * @author mocheng + * @date 2025-08-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = InspectionRoutePoint.class, reverseConvertGenerate = false) +public class InspectionRoutePointBo extends BaseEntity { + + /** + * 主键id + */ + @NotNull(message = "主键id不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 巡检路线id + */ + // @NotNull(message = "巡检路线id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long routeId; + + /** + * 巡检点id + */ + @NotNull(message = "巡检点id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long pointId; + + /** + * 开始时间 + */ + @NotNull(message = "开始时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date startTime; + + /** + * 结束时间 + */ + @NotNull(message = "结束时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date endTime; + + /** + * 备注 + */ + private String remark; + + /** + * 搜索值 + */ + private String searchValue; + + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ApplicationVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ApplicationVo.java index a2567b76..7db03f09 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ApplicationVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ApplicationVo.java @@ -64,13 +64,13 @@ public class ApplicationVo implements Serializable { * 数量 */ @ExcelProperty(value = "数量") - private Long number; + private Integer number; /** * 状态 */ @ExcelProperty(value = "状态") - private Long state; + private Integer state; /** * 审批人id diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AssetTypeVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AssetTypeVo.java index 19c444bf..d1b30eaf 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AssetTypeVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AssetTypeVo.java @@ -44,7 +44,7 @@ public class AssetTypeVo implements Serializable { * 排序 */ @ExcelProperty(value = "排序") - private Long sort; + private Integer sort; /** * 创建时间 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AssetVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AssetVo.java index b1879e8e..222b1dbf 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AssetVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AssetVo.java @@ -1,5 +1,6 @@ package org.dromara.property.domain.vo; +import java.math.BigDecimal; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import org.dromara.property.domain.Asset; @@ -64,7 +65,7 @@ public class AssetVo implements Serializable { * 价格 */ @ExcelProperty(value = "价格") - private Long price; + private BigDecimal price; /** * 库存 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/DepotLogVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/DepotLogVo.java index d88032be..22d68fb6 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/DepotLogVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/DepotLogVo.java @@ -1,5 +1,6 @@ package org.dromara.property.domain.vo; +import java.math.BigDecimal; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import org.dromara.property.domain.DepotLog; @@ -41,18 +42,28 @@ public class DepotLogVo implements Serializable { */ @ExcelProperty(value = "仓库id") private Long depotId; + /** + * 仓库名称 + */ + @ExcelProperty(value = "仓库名称") + private String depotName; /** * 资产id */ @ExcelProperty(value = "资产id") private Long assetId; + /** + * 资产名称 + */ + @ExcelProperty(value = "资产名称") + private String assetName; /** * 流转类型 */ @ExcelProperty(value = "流转类型") - private Long type; + private Integer type; /** * 流转时间 @@ -64,13 +75,17 @@ public class DepotLogVo implements Serializable { * 操作人id */ @ExcelProperty(value = "操作人id") - private Long userId; + private Long userId; /** + * 操作人id + */ + @ExcelProperty(value = "操作人名称") + private String userName; /** * 状态 */ @ExcelProperty(value = "状态") - private Long state; + private Integer state; /** * 备注 @@ -82,25 +97,30 @@ public class DepotLogVo implements Serializable { * 价格 */ @ExcelProperty(value = "价格") - private Long price; + private BigDecimal price; /** * 总价 */ @ExcelProperty(value = "总价") - private Long priceSum; + private BigDecimal priceSum; /** * 数量 */ @ExcelProperty(value = "数量") - private Long number; + private Integer number; /** * 供应商id */ @ExcelProperty(value = "供应商id") private Long supplierId; + /** + * 供应商名称 + */ + @ExcelProperty(value = "供应商名称") + private String supplierName; /** * 创建时间 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/DepotVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/DepotVo.java index 71ebc916..0dcf3b7a 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/DepotVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/DepotVo.java @@ -56,7 +56,7 @@ public class DepotVo implements Serializable { * 状态 */ @ExcelProperty(value = "状态") - private Long state; + private Integer state; /** * 创建时间 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionPointRecordVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionPointRecordVo.java new file mode 100644 index 00000000..b5fcfbec --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionPointRecordVo.java @@ -0,0 +1,70 @@ +package org.dromara.property.domain.vo; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.property.domain.InspectionPointRecord; +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; +import cn.idev.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 巡检点签到记录视图对象 inspection_point_record + * + * @author mocheng + * @date 2025-08-04 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = InspectionPointRecord.class) +public class InspectionPointRecordVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ExcelProperty(value = "主键id") + private Long id; + + /** + * 巡检点id + */ + @ExcelProperty(value = "巡检点id") + private Long pointId; + + /** + * 签到人id + */ + @ExcelProperty(value = "签到人id") + private Long userId; + + /** + * 签到时间 + */ + @ExcelProperty(value = "签到时间") + private Date signTime; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + /** + * 搜索值 + */ + @ExcelProperty(value = "搜索值") + private String searchValue; + + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionRoutePointVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionRoutePointVo.java new file mode 100644 index 00000000..9d42dcda --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionRoutePointVo.java @@ -0,0 +1,76 @@ +package org.dromara.property.domain.vo; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.property.domain.InspectionRoutePoint; +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; +import cn.idev.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 巡检路线巡检点关联视图对象 inspection_route_point + * + * @author mocheng + * @date 2025-08-04 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = InspectionRoutePoint.class) +public class InspectionRoutePointVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ExcelProperty(value = "主键id") + private Long id; + + /** + * 巡检路线id + */ + @ExcelProperty(value = "巡检路线id") + private Long routeId; + + /** + * 巡检点id + */ + @ExcelProperty(value = "巡检点id") + private Long pointId; + + /** + * 开始时间 + */ + @ExcelProperty(value = "开始时间") + private Date startTime; + + /** + * 结束时间 + */ + @ExcelProperty(value = "结束时间") + private Date endTime; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + /** + * 搜索值 + */ + @ExcelProperty(value = "搜索值") + private String searchValue; + + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/InspectionPointRecordMapper.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/InspectionPointRecordMapper.java new file mode 100644 index 00000000..529a2ae1 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/InspectionPointRecordMapper.java @@ -0,0 +1,17 @@ +package org.dromara.property.mapper; + +import org.apache.ibatis.annotations.Mapper; +import org.dromara.property.domain.InspectionPointRecord; +import org.dromara.property.domain.vo.InspectionPointRecordVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 巡检点签到记录Mapper接口 + * + * @author mocheng + * @date 2025-08-04 + */ +@Mapper +public interface InspectionPointRecordMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/InspectionRoutePointMapper.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/InspectionRoutePointMapper.java new file mode 100644 index 00000000..55ed8813 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/InspectionRoutePointMapper.java @@ -0,0 +1,17 @@ +package org.dromara.property.mapper; + +import org.apache.ibatis.annotations.Mapper; +import org.dromara.property.domain.InspectionRoutePoint; +import org.dromara.property.domain.vo.InspectionRoutePointVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 巡检路线巡检点关联Mapper接口 + * + * @author mocheng + * @date 2025-08-04 + */ +@Mapper +public interface InspectionRoutePointMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IApplicationService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IApplicationService.java index 3dadf24a..c12d39f6 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IApplicationService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IApplicationService.java @@ -66,4 +66,11 @@ public interface IApplicationService { * @return 是否删除成功 */ Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + /** + * 审核通过 + * @param bo + * @return + */ + Boolean verifiedByBo(ApplicationBo bo); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ApplicationServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ApplicationServiceImpl.java index 4f0e60db..80d4c0dd 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ApplicationServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ApplicationServiceImpl.java @@ -1,5 +1,7 @@ package org.dromara.property.service.impl; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import org.dromara.common.core.utils.MapstructUtils; @@ -11,9 +13,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.property.domain.Asset; +import org.dromara.property.domain.DepotLog; import org.dromara.property.domain.vo.AssetVo; import org.dromara.property.mapper.AssetMapper; +import org.dromara.property.mapper.DepotLogMapper; import org.dromara.system.api.RemoteUserService; import org.springframework.stereotype.Service; import org.dromara.property.domain.bo.ApplicationBo; @@ -21,12 +26,11 @@ import org.dromara.property.domain.vo.ApplicationVo; import org.dromara.property.domain.Application; import org.dromara.property.mapper.ApplicationMapper; import org.dromara.property.service.IApplicationService; +import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.sql.Array; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Collection; +import java.util.*; /** * 资产领用Service业务层处理 @@ -42,6 +46,7 @@ public class ApplicationServiceImpl implements IApplicationService { private final ApplicationMapper baseMapper; private final AssetMapper assetMapper; private final RemoteUserService remoteUserService; + private final DepotLogMapper depotLogMapper; /** * 查询资产领用 @@ -50,12 +55,14 @@ public class ApplicationServiceImpl implements IApplicationService { * @return 资产领用 */ @Override - public ApplicationVo queryById(Long id){ + public ApplicationVo queryById(Long id) { ApplicationVo applicationVo = baseMapper.selectVoById(id); applicationVo.setUserName(remoteUserService.selectUserNameById(applicationVo.getUserId())); - applicationVo.setAcceptanceUserName(remoteUserService.selectUserNameById(applicationVo.getAcceptanceUserId())); + if (ObjectUtil.isNotEmpty(applicationVo.getAcceptanceUserId())) { + applicationVo.setAcceptanceUserName(remoteUserService.selectUserNameById(applicationVo.getAcceptanceUserId())); + } AssetVo assetVo = assetMapper.selectVoById(applicationVo.getAssetId()); - applicationVo.setAssetName(assetVo==null?"资产不存在" : assetVo.getName()); + applicationVo.setAssetName(assetVo == null ? "资产不存在" : assetVo.getName()); return applicationVo; } @@ -70,21 +77,41 @@ public class ApplicationServiceImpl implements IApplicationService { public TableDataInfo queryPageList(ApplicationBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); - ArrayList ids = new ArrayList<>(); - result.getRecords().forEach(r -> ids.add(r.getUserId())); - result.getRecords().forEach(r -> ids.add(r.getAcceptanceUserId())); - Map userNamesByIds = remoteUserService.selectUserNamesByIds(ids); - result.getRecords().forEach(r ->r.setUserName(userNamesByIds.get(r.getUserId()))); - result.getRecords().forEach(r ->r.setAcceptanceUserName(userNamesByIds.get(r.getUserId()))); -// result.getRecords().forEach(r -> r.setUserName(remoteUserService.selectUserNameById(r.getUserId()))); -// result.getRecords().forEach(r -> r.setAcceptanceUserName(remoteUserService.selectUserNameById(r.getAcceptanceUserId()))); + + // 收集用户ID用于批量查询用户名 + Set userIds = new HashSet<>(); + result.getRecords().forEach(r -> { + if (r.getUserId() != null) { + userIds.add(r.getUserId()); + } + if (r.getAcceptanceUserId() != null) { + userIds.add(r.getAcceptanceUserId()); + } + }); + + // 批量获取用户名 + Map userNamesByIds = remoteUserService.selectUserNamesByIds(new ArrayList<>(userIds)); + + // 设置用户名(添加空值检查) + result.getRecords().forEach(r -> { + if (r.getUserId() != null) { + r.setUserName(userNamesByIds.get(r.getUserId())); + } + if (r.getAcceptanceUserId() != null) { + r.setAcceptanceUserName(userNamesByIds.get(r.getAcceptanceUserId())); + } + }); + + // 设置资产名称 result.getRecords().forEach(r -> { AssetVo assetVo = assetMapper.selectVoById(r.getAssetId()); - r.setAssetName(assetVo==null?"资产不存在" : assetVo.getName()); + r.setAssetName(assetVo == null ? "资产不存在" : assetVo.getName()); }); + return TableDataInfo.build(result); } + /** * 查询符合条件的资产领用列表 * @@ -99,7 +126,7 @@ public class ApplicationServiceImpl implements IApplicationService { applicationVos.forEach(r -> r.setAcceptanceUserName(remoteUserService.selectUserNameById(r.getAcceptanceUserId()))); applicationVos.forEach(r -> { AssetVo assetVo = assetMapper.selectVoById(r.getAssetId()); - r.setAssetName(assetVo==null?"资产不存在" : assetVo.getName()); + r.setAssetName(assetVo == null ? "资产不存在" : assetVo.getName()); }); return applicationVos; } @@ -140,20 +167,17 @@ public class ApplicationServiceImpl implements IApplicationService { * * @param bo 资产领用 * @return 是否修改成功 - * - * */ @Override public Boolean updateByBo(ApplicationBo bo) { Application update = MapstructUtils.convert(bo, Application.class); - validEntityBeforeSave(update); boolean b = baseMapper.updateById(update) > 0; - if (b&&bo.getState()==1){ + if (b && bo.getState() == 1) { Asset asset = assetMapper.selectById(bo.getAssetId()); - if (asset.getStock()>=update.getNumber()) { + if (asset.getStock() >= update.getNumber()) { UpdateWrapper assetUpdateWrapper = new UpdateWrapper<>(); - assetUpdateWrapper.eq("id",bo.getAssetId()) - .set("stock",assetMapper.selectVoById(bo.getAssetId()).getStock()-update.getNumber()); + assetUpdateWrapper.eq("id", bo.getAssetId()) + .set("stock", assetMapper.selectVoById(bo.getAssetId()).getStock() - update.getNumber()); assetMapper.update(assetUpdateWrapper); } @@ -164,8 +188,9 @@ public class ApplicationServiceImpl implements IApplicationService { /** * 保存前的数据校验 */ - private void validEntityBeforeSave(Application entity){ + private void validEntityBeforeSave(Application entity) { //TODO 做一些数据校验,如唯一约束 + entity.setApplicationTime(new Date()); } /** @@ -177,9 +202,47 @@ public class ApplicationServiceImpl implements IApplicationService { */ @Override public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if(isValid){ + if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 } return baseMapper.deleteByIds(ids) > 0; } + + /** + * 审核通过 + * + * @param bo + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean verifiedByBo(ApplicationBo bo) { + Application update = MapstructUtils.convert(bo, Application.class); + if (bo.getState().equals(1)) { + //查询领用资产 + Asset asset = assetMapper.selectById(bo.getAssetId()); + Assert.isTrue(ObjectUtil.isNotNull(asset), "领用资产不存在"); + BigDecimal stock = new BigDecimal(asset.getStock()); + BigDecimal number = new BigDecimal(bo.getNumber()); + BigDecimal remain = stock.subtract(number); + Assert.isTrue(remain.compareTo(BigDecimal.ZERO) >= 0, "库存不足无法领用"); + asset.setStock(Long.valueOf(String.valueOf(remain))); + boolean b = assetMapper.updateById(asset) > 0; + if (b) { + DepotLog depotLog = new DepotLog(); + depotLog.setDepotId(asset.getDepotId()); + depotLog.setAssetId(asset.getId()); + depotLog.setType(1); + depotLog.setTime(new Date()); + depotLog.setUserId(LoginHelper.getUserId()); + depotLog.setPrice(asset.getPrice()); + depotLog.setNumber(bo.getNumber()); + depotLog.setPriceSum((asset.getPrice().multiply(new BigDecimal(bo.getNumber())))); + depotLog.setSupplierId(asset.getSuppliersId()); + depotLogMapper.insert(depotLog); + } + } + boolean flag = baseMapper.updateById(update) > 0; + return flag; + } } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AssetServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AssetServiceImpl.java index d4318066..039ef3c6 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AssetServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AssetServiceImpl.java @@ -119,7 +119,11 @@ public class AssetServiceImpl implements IAssetService { lqw.eq(StringUtils.isNotBlank(bo.getModel()), Asset::getModel, bo.getModel()); lqw.eq(StringUtils.isNotBlank(bo.getSpecs()), Asset::getSpecs, bo.getSpecs()); lqw.eq(bo.getPrice() != null, Asset::getPrice, bo.getPrice()); - lqw.eq(bo.getStock() != null, Asset::getStock, bo.getStock()); + if(params.containsKey("stock")){ + lqw.gt(Asset::getStock, 0); + }else { + lqw.eq(bo.getStock() != null, Asset::getStock, bo.getStock()); + } lqw.eq(StringUtils.isNotBlank(bo.getUnit()), Asset::getUnit, bo.getUnit()); lqw.eq(bo.getDepotId() != null, Asset::getDepotId, bo.getDepotId()); lqw.eq(StringUtils.isNotBlank(bo.getMsg()), Asset::getMsg, bo.getMsg()); diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CapitalApplicationServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CapitalApplicationServiceImpl.java index ed58c698..02ed3ce6 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CapitalApplicationServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CapitalApplicationServiceImpl.java @@ -196,7 +196,7 @@ public class CapitalApplicationServiceImpl implements ICapitalApplicationService asset.setName(capitalInfo.getCapitalName()); asset.setSpecs(capitalInfo.getSpec()); asset.setSpecs(capitalInfo.getSpec()); - asset.setPrice(capitalInfo.getBuyUnitPrice().longValue()); + asset.setPrice(capitalInfo.getBuyUnitPrice()); asset.setSuppliersId(capitalApplication.getSupplier()); asset.setStorageTime(new Date()); asset.setType(0L); @@ -221,6 +221,7 @@ public class CapitalApplicationServiceImpl implements ICapitalApplicationService */ private void validEntityBeforeSave(CapitalApplication entity) { entity.setState("0"); + entity.setApplicationTime(new Date()); } /** diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/DepotLogServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/DepotLogServiceImpl.java index 90ec425a..35c9f725 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/DepotLogServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/DepotLogServiceImpl.java @@ -1,5 +1,7 @@ package org.dromara.property.service.impl; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -9,6 +11,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.dromara.property.domain.Asset; +import org.dromara.property.domain.Depot; +import org.dromara.property.mapper.AssetMapper; +import org.dromara.property.mapper.DepotMapper; +import org.dromara.system.api.RemoteUserService; import org.springframework.stereotype.Service; import org.dromara.property.domain.bo.DepotLogBo; import org.dromara.property.domain.vo.DepotLogVo; @@ -16,9 +23,8 @@ import org.dromara.property.domain.DepotLog; import org.dromara.property.mapper.DepotLogMapper; import org.dromara.property.service.IDepotLogService; -import java.util.List; -import java.util.Map; -import java.util.Collection; +import java.util.*; +import java.util.stream.Collectors; /** * 仓库记录Service业务层处理 @@ -32,6 +38,9 @@ import java.util.Collection; public class DepotLogServiceImpl implements IDepotLogService { private final DepotLogMapper baseMapper; + private final AssetMapper assetsMapper; + private final DepotMapper depotMapper; + private final RemoteUserService remoteUserService; /** * 查询仓库记录 @@ -40,8 +49,10 @@ public class DepotLogServiceImpl implements IDepotLogService { * @return 仓库记录 */ @Override - public DepotLogVo queryById(Long id){ - return baseMapper.selectVoById(id); + public DepotLogVo queryById(Long id) { + DepotLogVo depotLogVo = baseMapper.selectVoById(id); + handleData(depotLogVo,null,null,null); + return depotLogVo; } /** @@ -55,6 +66,41 @@ public class DepotLogServiceImpl implements IDepotLogService { public TableDataInfo queryPageList(DepotLogBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + // 收集用户ID用于批量查询用户名 + Set userIds = new HashSet<>(); + Set assetIds = new HashSet<>(); + Set depotIds = new HashSet<>(); + result.getRecords().forEach(r -> { + if (r.getUserId() != null) { + userIds.add(r.getUserId()); + } + if (ObjectUtil.isNotEmpty(r.getAssetId())) { + assetIds.add(r.getAssetId()); + } + if (ObjectUtil.isNotEmpty(r.getDepotId())) { + depotIds.add(r.getDepotId()); + } + }); + + // 批量获取用户名 + Map userNamesByIds = remoteUserService.selectUserNamesByIds(new ArrayList<>(userIds)); + //批量获取资产名 + Map assetNamesByIds = assetsMapper.selectList( + new LambdaQueryWrapper() + .select(Asset::getId, Asset::getName) + .in(Asset::getId, assetIds) + ).stream() + .collect(Collectors.toMap(Asset::getId, Asset::getName)); + //批量获取厂库名 + Map depotNamesByIds = depotMapper.selectList( + new LambdaQueryWrapper() + .select(Depot::getId, Depot::getDepotName) + .in(Depot::getId, depotIds) + ).stream() + .collect(Collectors.toMap(Depot::getId, Depot::getDepotName)); + result.getRecords().stream().forEach(s -> { + handleData(s, userNamesByIds, assetNamesByIds, depotNamesByIds); + }); return TableDataInfo.build(result); } @@ -87,6 +133,33 @@ public class DepotLogServiceImpl implements IDepotLogService { return lqw; } + /** + * 处理数据 + */ + private void handleData(DepotLogVo depotLogVo, Map userNamesByIds, Map assetNamesByIds, Map depotNamesByIds) { + //批量获取资产名 + if(CollUtil.isEmpty(assetNamesByIds)){ + assetNamesByIds = assetsMapper.selectList( + new LambdaQueryWrapper() + .select(Asset::getId, Asset::getName) + ).stream() + .collect(Collectors.toMap(Asset::getId, Asset::getName)); + } + + //批量获取厂库名 + if(CollUtil.isEmpty(depotNamesByIds)){ + depotNamesByIds = depotMapper.selectList( + new LambdaQueryWrapper() + .select(Depot::getId, Depot::getDepotName) + ).stream() + .collect(Collectors.toMap(Depot::getId, Depot::getDepotName)); + } + + depotLogVo.setAssetName(CollUtil.isNotEmpty(assetNamesByIds)?assetNamesByIds.get(depotLogVo.getAssetId()):null); + depotLogVo.setDepotName(CollUtil.isNotEmpty(depotNamesByIds)?depotNamesByIds.get(depotLogVo.getDepotName()):null); + depotLogVo.setUserName(CollUtil.isNotEmpty(userNamesByIds)?userNamesByIds.get(depotLogVo.getUserId()):remoteUserService.selectNicknameById(depotLogVo.getUserId())); + } + /** * 新增仓库记录 * @@ -120,7 +193,7 @@ public class DepotLogServiceImpl implements IDepotLogService { /** * 保存前的数据校验 */ - private void validEntityBeforeSave(DepotLog entity){ + private void validEntityBeforeSave(DepotLog entity) { //TODO 做一些数据校验,如唯一约束 } @@ -133,7 +206,7 @@ public class DepotLogServiceImpl implements IDepotLogService { */ @Override public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if(isValid){ + if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 } return baseMapper.deleteByIds(ids) > 0; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionRouteServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionRouteServiceImpl.java index 7a4e1dbf..70fb07b3 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionRouteServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionRouteServiceImpl.java @@ -10,9 +10,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.dromara.property.domain.InspectionRoute; +import org.dromara.property.domain.InspectionRoutePoint; import org.dromara.property.domain.bo.InspectionRouteBo; import org.dromara.property.domain.vo.InspectionRouteVo; import org.dromara.property.mapper.InspectionRouteMapper; +import org.dromara.property.mapper.InspectionRoutePointMapper; import org.dromara.property.service.IInspectionRouteService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -20,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; import java.util.Collection; +import java.util.stream.Collectors; /** * 巡检路线Service业务层处理 @@ -33,6 +36,7 @@ import java.util.Collection; public class InspectionRouteServiceImpl implements IInspectionRouteService { private final InspectionRouteMapper baseMapper; + private final InspectionRoutePointMapper routePointMapper; /** * 查询巡检路线 @@ -94,6 +98,14 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService { boolean flag = baseMapper.insert(add) > 0; if (flag) { bo.setId(add.getId()); + List routePointList = bo.getInspectionRoutePointBoList().stream() + .map(pointBo -> { + InspectionRoutePoint point = MapstructUtils.convert(pointBo, InspectionRoutePoint.class); + point.setRouteId(add.getId()); + return point; + }) + .collect(Collectors.toList()); + routePointMapper.insertBatch(routePointList); } return flag; } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java index 80b47600..17bd272f 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java @@ -174,6 +174,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { lqw.eq(bo.getCompleTime() != null, ServiceWorkOrders::getCompleTime, bo.getCompleTime()); lqw.eq(Objects.nonNull(bo.getServiceEvalua()), ServiceWorkOrders::getServiceEvalua, bo.getServiceEvalua()); lqw.eq(Objects.nonNull(bo.getType()), ServiceWorkOrders::getType, bo.getType()); + lqw.eq(StringUtils.isNotBlank(bo.getProcessingWeight()), ServiceWorkOrders::getProcessingWeight, bo.getProcessingWeight()); lqw.eq(StringUtils.isNotBlank(bo.getSearchValue()), ServiceWorkOrders::getSearchValue, bo.getSearchValue()); return lqw; }