From 2d5acdce9287d504186f6ed200e6043043d2b429 Mon Sep 17 00:00:00 2001 From: jiang Date: Tue, 30 Dec 2025 23:29:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/order/domain/OrderInfoDto.java | 3 + .../order/service/impl/OrderServiceImpl.java | 30 +++--- .../domain/ToolLedgerAllEntity.java | 2 + .../toolLedger/domain/ToolLedgerEntity.java | 4 +- .../service/Impl/ToolLedgerServiceImpl.java | 4 +- .../warehousing/domain/WarehousingEntity.java | 2 + .../mapper/material/device/DevInfoMapper.xml | 102 ++++-------------- .../mapper/material/device/DevMergeMapper.xml | 2 +- .../mapper/material/index/IndexMapper.xml | 4 +- .../material/toolLedger/ToolLedgerMapper.xml | 25 +++-- .../warehousing/WarehousingMapper.xml | 5 +- 11 files changed, 76 insertions(+), 107 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderInfoDto.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderInfoDto.java index 7d08979..3e91483 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderInfoDto.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderInfoDto.java @@ -205,4 +205,7 @@ public class OrderInfoDto { @ApiModelProperty(value = "买方所属公司") private Long buyerCompanyId; + + private String pageType; + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java index e1aa07b..4f22764 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java @@ -541,7 +541,11 @@ public class OrderServiceImpl implements OrderService { if (userId != null && deptId != null && !userId.equals(ADMIN_ID) && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) { - devInfo.setBuyerCompany(deptId.intValue()); + if ("1".equals(devInfo.getPageType())) { + devInfo.setBuyerCompany(deptId.intValue()); + } else { + devInfo.setSellerCompany(deptId.intValue()); + } } List orderInfoDtos = orderMapper.getOrderDetails(devInfo); @@ -568,18 +572,18 @@ public class OrderServiceImpl implements OrderService { list.removeIf(Objects::isNull); dto.setDetailsList(list); if (!list.isEmpty()) { - Optional minOrderStatus = list.stream().min(Comparator.comparingInt(p -> Integer.parseInt(p.getOrderStatus()))); - minOrderStatus.ifPresent(orderDetailDto -> dto.setOrderStatus(orderDetailDto.getOrderStatus())); - //根据订单id去lease_repair_record表中查询是否已填写退租检修信息 - int count = leaseRepairRecordMapper.selectLeaseContent(String.valueOf(dto.getOrderId())); - if (count > 0) { - dto.setIsLeaseContent(1); - } else { - dto.setIsLeaseContent(0); - } - dto.setPartBacked(list.stream().anyMatch(o -> OrderStatusEnum.ORDER_UNDER_LEASE.getStatus().toString().equals(o.getOrderStatus()))); - LeaseRepair leaseRepair = new LeaseRepair(); - leaseRepair.setOrderId(String.valueOf(dto.getOrderId())); + Optional minOrderStatus = list.stream().min(Comparator.comparingInt(p -> Integer.parseInt(p.getOrderStatus()))); + minOrderStatus.ifPresent(orderDetailDto -> dto.setOrderStatus(orderDetailDto.getOrderStatus())); + //根据订单id去lease_repair_record表中查询是否已填写退租检修信息 + int count = leaseRepairRecordMapper.selectLeaseContent(String.valueOf(dto.getOrderId())); + if (count > 0) { + dto.setIsLeaseContent(1); + } else { + dto.setIsLeaseContent(0); + } + dto.setPartBacked(list.stream().anyMatch(o -> OrderStatusEnum.ORDER_UNDER_LEASE.getStatus().toString().equals(o.getOrderStatus()))); + LeaseRepair leaseRepair = new LeaseRepair(); + leaseRepair.setOrderId(String.valueOf(dto.getOrderId())); // 将符合条件的订单加入结果集 resultList.add(dto); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/domain/ToolLedgerAllEntity.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/domain/ToolLedgerAllEntity.java index 6d3e671..df2c6e1 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/domain/ToolLedgerAllEntity.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/domain/ToolLedgerAllEntity.java @@ -213,4 +213,6 @@ public class ToolLedgerAllEntity implements Serializable { private List propertyVoList = new ArrayList<>(); private String proName; + + private String companyName; } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/domain/ToolLedgerEntity.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/domain/ToolLedgerEntity.java index 1f6400d..06b84df 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/domain/ToolLedgerEntity.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/domain/ToolLedgerEntity.java @@ -20,7 +20,7 @@ import java.util.List; public class ToolLedgerEntity implements Serializable { //用于excel导出的序号一列,不需要业务逻辑处理 - @Excel(name = "序号", isSequence = true, type = Excel.Type.EXPORT , sort = 0) + @Excel(name = "序号", isSequence = true, type = Excel.Type.EXPORT, sort = 0) int sequence; @@ -231,4 +231,6 @@ public class ToolLedgerEntity implements Serializable { * 说明:装备采购发票的URL列表,存储发票扫描件或照片 */ private List purchaseInvoices; + + private String companyName; } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/service/Impl/ToolLedgerServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/service/Impl/ToolLedgerServiceImpl.java index ab726ca..7e18d76 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/service/Impl/ToolLedgerServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/toolLedger/service/Impl/ToolLedgerServiceImpl.java @@ -41,7 +41,9 @@ public class ToolLedgerServiceImpl implements ToolLedgerService { Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); Long userId = SecurityUtils.getLoginUser().getUserid(); // 管理员和省公司可查看所有数据 - if (!userId.equals(ADMIN_ID) || !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) { + if (userId != null && deptId != null + && !userId.equals(ADMIN_ID) + && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) { entity.setCompanyId(deptId); } return mapper.list(entity); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/warehousing/domain/WarehousingEntity.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/warehousing/domain/WarehousingEntity.java index 8e3c603..7b850da 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/warehousing/domain/WarehousingEntity.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/warehousing/domain/WarehousingEntity.java @@ -85,4 +85,6 @@ public class WarehousingEntity implements Serializable { private Long companyId; private Long userId; + + private String isStatus; } diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml index f620aed..de6cbd8 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml @@ -97,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" d.device_name AS deviceName, d.device_count AS deviceCount, d.type_id AS typeId, - d.ma_status AS maStatus, + '1' AS maStatus, d.brand AS brand, d.production_date AS productionDate, d.working_hours AS workingHours, @@ -114,7 +114,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" d.province_id AS provinceId, d.city_id AS cityId, d.area_id AS areaId, - mtv.maxTypeId AS maType, null AS toolType, c.company_name AS companyNameOrigin, @@ -148,14 +147,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" '' AS devSubcategory, tt.type_name AS devName, '1' AS devType, - tl.manage_mode AS manageMode, + tt.manage_type AS manageMode, tl.id AS maId, tl.tool_code AS `code`, tl.identify_code AS identifyCode, tt1.type_name AS deviceName, tl.available_num AS deviceCount, tl.type_id AS typeId, - tl.STATUS AS maStatus, + '1' AS maStatus, '' AS brand, tl.production_date AS productionDate, 0 AS workingHours, @@ -195,124 +194,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) ) t -- 外层筛选条件:所有动态和固定筛选条件集中在这里 - WHERE - -- 1. 基础筛选条件 - - t.maId = #{maId} - + WHERE 1=1 - AND - t.code = #{code} + AND t.code = #{code} - AND - t.deviceName LIKE CONCAT('%', #{deviceName}, '%') - - - AND - t.maStatus IN (1, 2, 3) + AND t.deviceName LIKE CONCAT('%', #{deviceName}, '%') - - AND - - t.leaseScope = #{leaseScope} + AND t.leaseScope = #{leaseScope} - - AND - - t.location = #{location} + AND t.location = #{location} - - AND - - t.provinceId = #{provinceId} + AND t.provinceId = #{provinceId} - - AND - - t.cityId = #{cityId} + AND t.cityId = #{cityId} - - AND - - t.areaId = #{areaId} + AND t.areaId = #{areaId} - - AND - - t.brand = #{brand} + AND t.brand = #{brand} -- 2. 设备年龄筛选(工具表无生产时间则自动过滤,不影响) - - AND - - TIMESTAMPDIFF(YEAR, t.productionDateOrigin, NOW()) >= #{ageMin} + AND TIMESTAMPDIFF(YEAR, t.productionDateOrigin, NOW()) >= #{ageMin} AND TIMESTAMPDIFF(YEAR, t.productionDateOrigin, NOW()) <= #{ageMax} - - AND - - TIMESTAMPDIFF(YEAR, t.productionDateOrigin, NOW()) <= #{ageMax} + AND TIMESTAMPDIFF(YEAR, t.productionDateOrigin, NOW()) <= #{ageMax} -- 3. 工时筛选(工具表工时为0,可根据需求调整) - - AND - - t.workingHoursOrigin >= #{workingHoursMin} + AND t.workingHoursOrigin >= #{workingHoursMin} AND t.workingHoursOrigin <= #{workingHoursMax} -- 4. 其他基础筛选 - - AND - - t.description = #{description} + AND t.description = #{description} - - AND - - t.gpsCode = #{gpsCode} + AND t.gpsCode = #{gpsCode} - - AND - - t.companyId = #{companyId} + AND t.companyId = #{companyId} - - AND - - t.specification = #{specification} + AND t.specification = #{specification} - - AND - - t.deposit = #{deposit} + AND t.deposit = #{deposit} -- 5. 时间范围筛选 - - AND - - t.updateTimeOrigin BETWEEN #{startTime} AND #{endTime} + AND t.updateTimeOrigin BETWEEN #{startTime} AND #{endTime} -- 6. 关键字模糊筛选(覆盖设备和工具的所有关键字段) - - AND - + AND ( -- 设备表关键字段 LOCATE(#{keyWord}, t.mainGx) > 0 diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevMergeMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevMergeMapper.xml index 8d735e9..4e72dd4 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevMergeMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevMergeMapper.xml @@ -138,7 +138,7 @@ '1', '0', - '0' + '1' ) diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/index/IndexMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/index/IndexMapper.xml index 2539afa..1e453ee 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/index/IndexMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/index/IndexMapper.xml @@ -108,7 +108,7 @@ ORDER BY t.applyTime DESC; SELECT - tt.type_id AS typeId, + tl.type_id AS typeId, tt.type_name AS typeName, tt.unit_name AS unitName, - tt.manage_type AS manageMode, + sd.dept_abbreviation AS companyName, + tl.manage_mode AS manageMode, tt1.type_name AS parentTypeName, -- 1级父节点名称 tt2.type_name AS grandparentTypeName, -- 2级父节点名称 tt3.type_name AS greatGrandparentName, -- 3级父节点名称 @@ -80,6 +81,7 @@ FROM tool_type tt LEFT JOIN tool_ledger tl ON tl.type_id = tt.type_id + LEFT JOIN sys_dept sd ON sd.dept_id = tl.company_id -- 关联1级父节点(直接父节点) INNER JOIN tool_type tt1 ON tt.parent_id = tt1.type_id -- 关联2级父节点(祖父节点) @@ -103,12 +105,18 @@ - AND (tl.company_id = #{companyId} OR tl.company_id IS NULL) + AND tl.company_id = #{companyId} AND tt.type_name LIKE CONCAT('%', #{typeName}, '%') - GROUP BY tl.type_id,tl.company_id + GROUP BY + tl.manage_mode, + tl.type_id + + ,tl.company_id + + ORDER BY tl.create_time DESC @@ -154,10 +162,8 @@