浏览代码

Add 添加设备模块,优化登录逻辑

Yue 3 月之前
父节点
当前提交
48af569f60
共有 22 个文件被更改,包括 1085 次插入314 次删除
  1. 1 0
      .gitignore
  2. 5 0
      SERVER/ChickenFarmV3/pom.xml
  3. 4 0
      SERVER/ChickenFarmV3/vb-admin/pom.xml
  4. 1 1
      SERVER/ChickenFarmV3/vb-admin/src/main/resources/application-dev.yml
  5. 1 0
      SERVER/ChickenFarmV3/vb-modules/pom.xml
  6. 105 0
      SERVER/ChickenFarmV3/vb-modules/vb-device/pom.xml
  7. 104 0
      SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/controller/DeviceController.java
  8. 85 0
      SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/domain/Device.java
  9. 83 0
      SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/domain/bo/DeviceBo.java
  10. 87 0
      SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/domain/vo/DeviceVo.java
  11. 17 0
      SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/mapper/DeviceMapper.java
  12. 48 0
      SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/service/IDeviceService.java
  13. 115 0
      SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/service/impl/DeviceServiceImpl.java
  14. 7 0
      SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/resources/mapper/device/DeviceMapper.xml
  15. 8 7
      UI/VB.VUE/src/core/services/RequestService.ts
  16. 3 3
      UI/VB.VUE/src/layouts/main/header/navbar/UserAccountMenu.vue
  17. 3 3
      UI/VB.VUE/src/router/index.ts
  18. 5 2
      UI/VB.VUE/src/stores/_auth.ts
  19. 401 0
      UI/VB.VUE/src/views/device/device/index.vue
  20. 1 1
      UI/VB.VUE/src/views/mobile-home.vue
  21. 1 1
      UI/VB.VUE/vite.config.ts
  22. 0 296
      UI/VB.VUE/vite.config.ts.timestamp-1751524516784-ff27d13c9582a.mjs

+ 1 - 0
.gitignore

@@ -73,3 +73,4 @@ UI/VAP_V3.VUE/pnpm-lock.yaml
 .data/
 
 docs/部署文档/*.rar
+/SERVER/ChickenFarmV3/vber/server

+ 5 - 0
SERVER/ChickenFarmV3/pom.xml

@@ -381,6 +381,11 @@
                 <artifactId>vb-breeding</artifactId>
                 <version>${revision}</version>
             </dependency>
+            <dependency>
+                <groupId>com.vap</groupId>
+                <artifactId>vb-device</artifactId>
+                <version>${revision}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 

+ 4 - 0
SERVER/ChickenFarmV3/vb-admin/pom.xml

@@ -82,6 +82,10 @@
             <groupId>com.vap</groupId>
             <artifactId>vb-breeding</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-device</artifactId>
+        </dependency>
         <dependency>
             <groupId>de.codecentric</groupId>
             <artifactId>spring-boot-admin-starter-client</artifactId>

+ 1 - 1
SERVER/ChickenFarmV3/vb-admin/src/main/resources/application-dev.yml

@@ -24,7 +24,7 @@ spring:
           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
           # url: jdbc:mysql://127.0.0.1:3326/ChickenFarmDB_DEV?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
-          url: jdbc:mysql://192.168.0.104:3316/ChickenFarmDB_DEV2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
+          url: jdbc:mysql://192.168.0.104:3316/ChickenFarmDB_DEV_Y?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
           #url: jdbc:mysql://192.168.0.81:3326/ChickenFarmDB_v1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
           username: root
           # password: root

+ 1 - 0
SERVER/ChickenFarmV3/vb-modules/pom.xml

@@ -16,6 +16,7 @@
         <module>vb-workflow</module>
         <module>vb-base</module>
         <module>vb-breeding</module>
+        <module>vb-device</module>
     </modules>
 
     <artifactId>vb-modules</artifactId>

+ 105 - 0
SERVER/ChickenFarmV3/vb-modules/vb-device/pom.xml

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.vap</groupId>
+        <artifactId>vb-modules</artifactId>
+        <version>${revision}</version>
+    </parent>
+
+    <artifactId>vb-device</artifactId>
+    <name>${project.artifactId}</name>
+    <description>设备模块</description>
+
+
+    <dependencies>
+        <!-- 通用工具-->
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-doc</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-mybatis</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-translation</artifactId>
+        </dependency>
+
+        <!-- OSS功能模块 -->
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-oss</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-log</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-mail</artifactId>
+        </dependency>
+
+        <!-- excel-->
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-excel</artifactId>
+        </dependency>
+
+        <!-- SMS功能模块 -->
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-sms</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-tenant</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-security</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-idempotent</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-encrypt</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-websocket</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.vap</groupId>
+            <artifactId>vb-common-sse</artifactId>
+        </dependency>
+
+    </dependencies>
+
+
+</project>

+ 104 - 0
SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/controller/DeviceController.java

@@ -0,0 +1,104 @@
+package cn.vber.device.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.vber.common.core.domain.R;
+import cn.vber.common.core.validate.AddGroup;
+import cn.vber.common.core.validate.EditGroup;
+import cn.vber.common.excel.utils.ExcelUtil;
+import cn.vber.common.idempotent.annotation.RepeatSubmit;
+import cn.vber.common.log.annotation.Log;
+import cn.vber.common.log.enums.BusinessType;
+import cn.vber.common.mybatis.core.page.PageQuery;
+import cn.vber.common.mybatis.core.page.TableDataInfo;
+import cn.vber.common.web.core.BaseController;
+import cn.vber.device.domain.bo.DeviceBo;
+import cn.vber.device.domain.vo.DeviceVo;
+import cn.vber.device.service.IDeviceService;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 设备资产台账
+ *
+ * @author IwbY
+ * @date 2025-10-15
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/device/device")
+public class DeviceController extends BaseController {
+
+    private final IDeviceService deviceService;
+
+    /**
+     * 查询设备资产台账列表
+     */
+    @SaCheckPermission("device:device")
+    @GetMapping("/list")
+    public TableDataInfo<DeviceVo> list(DeviceBo bo, PageQuery pageQuery) {
+        return deviceService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 导出设备资产台账列表
+     */
+    @SaCheckPermission("device:device:export")
+    @Log(title = "设备资产台账", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(DeviceBo bo, HttpServletResponse response) {
+        List<DeviceVo> list = deviceService.queryList(bo);
+        ExcelUtil.exportExcel(list, "设备资产台账", DeviceVo.class, response);
+    }
+
+    /**
+     * 获取设备资产台账详细信息
+     *
+     * @param id 主键
+     */
+    @SaCheckPermission("device:device:query")
+    @GetMapping("/{id}")
+    public R<DeviceVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
+        return R.ok(deviceService.queryById(id));
+    }
+
+    /**
+     * 新增设备资产台账
+     */
+    @SaCheckPermission("device:device:add")
+    @Log(title = "设备资产台账", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceBo bo) {
+        return toAjax(deviceService.insertByBo(bo));
+    }
+
+    /**
+     * 修改设备资产台账
+     */
+    @SaCheckPermission("device:device:edit")
+    @Log(title = "设备资产台账", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceBo bo) {
+        return toAjax(deviceService.updateByBo(bo));
+    }
+
+    /**
+     * 删除设备资产台账
+     *
+     * @param ids 主键串
+     */
+    @SaCheckPermission("device:device:remove")
+    @Log(title = "设备资产台账", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
+        return toAjax(deviceService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 85 - 0
SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/domain/Device.java

@@ -0,0 +1,85 @@
+package cn.vber.device.domain;
+
+import cn.vber.common.mybatis.core.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+import java.util.Date;
+
+/**
+ * 设备资产台账对象 d_device
+ *
+ * @author IwbY
+ * @date 2025-10-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("d_device")
+public class Device extends BaseEntity {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 设备ID
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 设备名称
+     */
+    private String name;
+
+    /**
+     * 状态( 0:正常工作中 1:维修中 2:带病运行 3:退役)
+     */
+    private Integer status;
+
+    /**
+     * 安装位置
+     */
+    private String location;
+
+    /**
+     * 厂家
+     */
+    private String manufacturer;
+
+    /**
+     * 安装日期
+     */
+    private Date installationDate;
+
+    /**
+     * 负责人
+     */
+    private String responsiblePerson;
+
+    /**
+     * 负责人电话
+     */
+    private String responsiblePhone;
+
+    /**
+     * 说明书
+     */
+    private String manual;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 删除标志(0:未删除, 1:已删除)
+     */
+    @TableLogic
+    private String delFlag;
+
+
+}

+ 83 - 0
SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/domain/bo/DeviceBo.java

@@ -0,0 +1,83 @@
+package cn.vber.device.domain.bo;
+
+import cn.vber.common.core.validate.AddGroup;
+import cn.vber.common.core.validate.EditGroup;
+import cn.vber.common.mybatis.core.domain.BaseEntity;
+import cn.vber.device.domain.Device;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.github.linpeilie.annotations.AutoMapper;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 设备资产台账业务对象 d_device
+ *
+ * @author IwbY
+ * @date 2025-10-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = Device.class, reverseConvertGenerate = false)
+
+public class DeviceBo extends BaseEntity {
+
+    /**
+     * 设备ID
+     */
+    @NotNull(message = "设备ID不能为空", groups = {EditGroup.class})
+    private Long id;
+
+    /**
+     * 设备名称
+     */
+    @NotBlank(message = "设备名称不能为空", groups = {AddGroup.class, EditGroup.class})
+    private String name;
+
+    /**
+     * 状态( 0:正常工作中 1:维修中 2:带病运行 3:退役)
+     */
+    @NotNull(message = "状态( 0:正常工作中 1:维修中 2:带病运行 3:退役)不能为空", groups = {AddGroup.class, EditGroup.class})
+    private Integer status;
+
+    /**
+     * 安装位置
+     */
+    private String location;
+
+    /**
+     * 厂家
+     */
+    private String manufacturer;
+
+    /**
+     * 安装日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date installationDate;
+
+    /**
+     * 负责人
+     */
+    private String responsiblePerson;
+
+    /**
+     * 负责人电话
+     */
+    private String responsiblePhone;
+
+    /**
+     * 说明书
+     */
+    private String manual;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 87 - 0
SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/domain/vo/DeviceVo.java

@@ -0,0 +1,87 @@
+package cn.vber.device.domain.vo;
+
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import cn.idev.excel.annotation.ExcelProperty;
+import cn.vber.common.excel.annotation.ExcelDictFormat;
+import cn.vber.common.excel.convert.ExcelDictConvert;
+import cn.vber.device.domain.Device;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 设备资产台账视图对象 d_device
+ *
+ * @author IwbY
+ * @date 2025-10-15
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = Device.class)
+
+public class DeviceVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 设备ID
+     */
+    @ExcelProperty(value = "设备ID")
+    private Long id;
+
+    /**
+     * 设备名称
+     */
+    @ExcelProperty(value = "设备名称")
+    private String name;
+
+    /**
+     * 状态( 0:正常工作中 1:维修中 2:带病运行 3:退役)
+     */
+    @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(dictType = "device_status")
+    private Integer status;
+
+    /**
+     * 安装位置
+     */
+    @ExcelProperty(value = "安装位置")
+    private String location;
+
+    /**
+     * 厂家
+     */
+    @ExcelProperty(value = "厂家")
+    private String manufacturer;
+
+    /**
+     * 安装日期
+     */
+    @ExcelProperty(value = "安装日期")
+    private Date installationDate;
+
+    /**
+     * 负责人
+     */
+    @ExcelProperty(value = "负责人")
+    private String responsiblePerson;
+
+    /**
+     * 负责人电话
+     */
+    @ExcelProperty(value = "负责人电话")
+    private String responsiblePhone;
+
+
+    /**
+     * 说明书
+     */
+    private String manual;
+
+
+}

+ 17 - 0
SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/mapper/DeviceMapper.java

@@ -0,0 +1,17 @@
+package cn.vber.device.mapper;
+
+import cn.vber.common.mybatis.core.mapper.BaseMapperPlus;
+import cn.vber.device.domain.Device;
+import cn.vber.device.domain.vo.DeviceVo;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 设备资产台账Mapper接口
+ *
+ * @author IwbY
+ * @date 2025-10-15
+ */
+@Repository
+public interface DeviceMapper extends BaseMapperPlus<Device, DeviceVo> {
+
+}

+ 48 - 0
SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/service/IDeviceService.java

@@ -0,0 +1,48 @@
+package cn.vber.device.service;
+
+import cn.vber.common.mybatis.core.page.PageQuery;
+import cn.vber.common.mybatis.core.page.TableDataInfo;
+import cn.vber.device.domain.bo.DeviceBo;
+import cn.vber.device.domain.vo.DeviceVo;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 设备资产台账Service接口
+ *
+ * @author IwbY
+ * @date 2025-10-15
+ */
+public interface IDeviceService {
+
+    /**
+     * 查询设备资产台账
+     */
+    DeviceVo queryById(Long id);
+
+    /**
+     * 查询设备资产台账列表
+     */
+    TableDataInfo<DeviceVo> queryPageList(DeviceBo bo, PageQuery pageQuery);
+
+    /**
+     * 查询设备资产台账列表
+     */
+    List<DeviceVo> queryList(DeviceBo bo);
+
+    /**
+     * 新增设备资产台账
+     */
+    Boolean insertByBo(DeviceBo bo);
+
+    /**
+     * 修改设备资产台账
+     */
+    Boolean updateByBo(DeviceBo bo);
+
+    /**
+     * 校验并批量删除设备资产台账信息
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 115 - 0
SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/service/impl/DeviceServiceImpl.java

@@ -0,0 +1,115 @@
+package cn.vber.device.service.impl;
+
+import cn.vber.common.core.utils.MapstructUtils;
+import cn.vber.common.core.utils.StringUtils;
+import cn.vber.common.mybatis.core.page.PageQuery;
+import cn.vber.common.mybatis.core.page.TableDataInfo;
+import cn.vber.device.domain.Device;
+import cn.vber.device.domain.bo.DeviceBo;
+import cn.vber.device.domain.vo.DeviceVo;
+import cn.vber.device.mapper.DeviceMapper;
+import cn.vber.device.service.IDeviceService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 设备资产台账Service业务层处理
+ *
+ * @author IwbY
+ * @date 2025-10-15
+ */
+@RequiredArgsConstructor
+@Service
+public class DeviceServiceImpl implements IDeviceService {
+
+    private final DeviceMapper baseMapper;
+
+    /**
+     * 查询设备资产台账
+     */
+    @Override
+    public DeviceVo queryById(Long id) {
+        return baseMapper.selectVoById(id);
+    }
+
+    /**
+     * 查询设备资产台账列表
+     */
+    @Override
+    public TableDataInfo<DeviceVo> queryPageList(DeviceBo bo, PageQuery pageQuery) {
+        LambdaQueryWrapper<Device> lqw = buildQueryWrapper(bo);
+        Page<DeviceVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 查询设备资产台账列表
+     */
+    @Override
+    public List<DeviceVo> queryList(DeviceBo bo) {
+        LambdaQueryWrapper<Device> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<Device> buildQueryWrapper(DeviceBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<Device> lqw = Wrappers.lambdaQuery();
+        lqw.like(StringUtils.isNotBlank(bo.getName()), Device::getName, bo.getName());
+        lqw.eq(bo.getStatus() != null, Device::getStatus, bo.getStatus());
+        lqw.eq(StringUtils.isNotBlank(bo.getLocation()), Device::getLocation, bo.getLocation());
+        lqw.eq(StringUtils.isNotBlank(bo.getManufacturer()), Device::getManufacturer, bo.getManufacturer());
+        lqw.between(StringUtils.isNotEmpty(params.get("beginInstallationDate")) && StringUtils.isNotEmpty(params.get("endInstallationDate")),
+                Device::getInstallationDate, params.get("beginInstallationDate"), params.get("endInstallationDate"));
+        lqw.eq(StringUtils.isNotBlank(bo.getResponsiblePerson()), Device::getResponsiblePerson, bo.getResponsiblePerson());
+        return lqw;
+    }
+
+    /**
+     * 新增设备资产台账
+     */
+    @Override
+    public Boolean insertByBo(DeviceBo bo) {
+        Device add = MapstructUtils.convert(bo, Device.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insert(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 修改设备资产台账
+     */
+    @Override
+    public Boolean updateByBo(DeviceBo bo) {
+        Device update = MapstructUtils.convert(bo, Device.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateById(update) > 0;
+    }
+
+    /**
+     * 保存前的数据校验
+     */
+    private void validEntityBeforeSave(Device entity) {
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    /**
+     * 批量删除设备资产台账
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if (isValid) {
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return baseMapper.deleteByIds(ids) > 0;
+    }
+}

+ 7 - 0
SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/resources/mapper/device/DeviceMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.vber.device.mapper.DeviceMapper">
+
+</mapper>

+ 8 - 7
UI/VB.VUE/src/core/services/RequestService.ts

@@ -143,7 +143,7 @@ Rs.interceptors.response.use(
 		const code = res.data.code || HttpStatus.SUCCESS
 		const data = res.data
 		// 获取错误信息
-		const msg = errorCode[code] || res.data.msg || errorCode.default
+		let msg = errorCode[code] || res.data.msg || errorCode.default
 		// 二进制数据则直接返回
 		if (res.request.responseType === "blob" || res.request.responseType === "arraybuffer") {
 			return data
@@ -160,9 +160,7 @@ Rs.interceptors.response.use(
 					})
 					.then(() => {
 						isReLogin.show = false
-						appStore.authStore.logout().then(() => {
-							location.href = import.meta.env.VITE_APP_CONTEXT_PATH + "home"
-						})
+						appStore.authStore.logout()
 					})
 					.catch(() => {
 						isReLogin.show = false
@@ -173,8 +171,11 @@ Rs.interceptors.response.use(
 			if (config.errorAlert) {
 				msgUtil.msgError("没有权限,请联系管理员!")
 			}
-			return Promise.reject(msg)
+			return Promise.reject("没有权限,请联系管理员!")
 		} else if (code === HttpStatus.SERVER_ERROR) {
+			if (!import.meta.env.DEV) {
+				msg = "服务器异常,请联系管理员!"
+			}
 			if (config.errorAlert) {
 				msgUtil.msgError(msg)
 			}
@@ -406,8 +407,8 @@ export function downloadZip(url: string, filename: string, config?: any) {
 			})
 	})
 }
-export function downloadOss(ossId: string | number) {
-	const url = baseURL + "/resource/oss/download/" + ossId
+export function downloadOss(ossId: string | number, isObjectId: boolean = false) {
+	const url = `/resource/oss/download/${isObjectId ? `o/${ossId}` : ossId}`
 	downloadLoadingInstance = ElLoading.service({
 		text: "正在下载数据,请稍候",
 		background: "rgba(0, 0, 0, 0.7)"

+ 3 - 3
UI/VB.VUE/src/layouts/main/header/navbar/UserAccountMenu.vue

@@ -1,7 +1,7 @@
 <script setup lang="ts">
 import appStore from "@/stores"
 import apis from "@a"
-import VbWorkflow from "@/layouts/main/header/navbar/UserSubMenuWorkflow.vue"
+import router from "@r"
 
 const user = appStore.authStore.user
 const dynamic = computed(() => {
@@ -19,8 +19,8 @@ function refreshConfig() {
 	})
 }
 function signOut() {
-	appStore.authStore.logout().then(() => {
-		location.href = import.meta.env.VITE_APP_CONTEXT_PATH + "home"
+	appStore.authStore.logout(false).then(() => {
+		router.push("/login")
 	})
 }
 </script>

+ 3 - 3
UI/VB.VUE/src/router/index.ts

@@ -145,9 +145,9 @@ router.beforeEach((to, _from, next) => {
 					})
 					.catch((err) => {
 						isReLogin.show = false
-						authStore.logout().then(() => {
+						authStore.logout(false).then(() => {
 							message.msgError(err)
-							next({ path: import.meta.env.VITE_APP_CONTEXT_PATH + "home" })
+							router.push("/login")
 						})
 					})
 				appStore.appConfigStore.loadConfig()
@@ -161,7 +161,7 @@ router.beforeEach((to, _from, next) => {
 			// 在免登录白名单,直接进入
 			next()
 		} else {
-			next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
+			next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页
 			NProgressClose()
 		}
 	}

+ 5 - 2
UI/VB.VUE/src/stores/_auth.ts

@@ -3,7 +3,7 @@ import appStore from "@s"
 import apis from "@/api"
 import type { User } from "@@/types/User"
 import type { LoginData } from "@@/types/Account"
-import { isReLogin } from "@@/services/RequestService"
+import router from "@r"
 
 export const useAuthStore = defineStore("auth", () => {
 	const errors = ref({})
@@ -107,12 +107,15 @@ export const useAuthStore = defineStore("auth", () => {
 		})
 	}
 	// 退出系统
-	function logout() {
+	function logout(isJump = true) {
 		return new Promise((resolve, reject) => {
 			apis.loginApi
 				.logout()
 				.then(() => {
 					purgeAuth()
+					if (isJump) {
+						router.push(`/login?redirect=${encodeURIComponent(window.location.pathname)}`)
+					}
 					resolve(true)
 				})
 				.catch((error) => {

+ 401 - 0
UI/VB.VUE/src/views/device/device/index.vue

@@ -0,0 +1,401 @@
+<script setup lang="ts" name="Device">
+import rules, { rulesFormat } from "@@/config/rules"
+import apis from "@a"
+import dayjs from "dayjs"
+
+const tableRef = ref()
+const modalRef = ref()
+const pdfPreviewRef = ref()
+const opts = reactive({
+	columns: [
+		{ field: "id", name: "设备ID", width: 100, isSort: true, visible: false, tooltip: true },
+		{ field: "name", name: "设备名称", visible: true, isSort: false, width: 200, tooltip: true },
+		{ field: "status", name: "状态", visible: true, isSort: false, width: 100 },
+		{
+			field: "location",
+			name: "安装位置",
+			visible: true,
+			isSort: false,
+			width: 200,
+			tooltip: true
+		},
+		{
+			field: "manufacturer",
+			name: "厂家",
+			visible: true,
+			isSort: false,
+			width: 200,
+			tooltip: true
+		},
+		{ field: "installationDate", name: "安装日期", visible: true, isSort: false, width: 135 },
+		{
+			field: "responsiblePerson",
+			name: "负责人",
+			visible: true,
+			isSort: false,
+			width: 100,
+			tooltip: true
+		},
+		{
+			field: "responsiblePhone",
+			name: "负责人电话",
+			visible: true,
+			isSort: false,
+			width: 120,
+			tooltip: true
+		},
+		{
+			field: "manual",
+			name: "说明书",
+			visible: true,
+			isSort: false,
+			width: "auto",
+			tooltip: true
+		},
+		{ field: "actions", name: `操作`, width: 150 }
+	] as any[],
+	queryParams: {
+		name: undefined,
+		status: undefined,
+		location: undefined,
+		manufacturer: undefined,
+		dateRangeInstallationDate: undefined,
+		responsiblePerson: undefined
+	},
+	searchFormItems: [
+		{
+			field: "name",
+			label: "设备名称",
+			class: "w-100",
+			required: false,
+			placeholder: "请输入设备名称",
+			component: "I",
+			listeners: {
+				keyup: (e: KeyboardEvent) => {
+					if (e.code == "Enter") {
+						handleQuery()
+					}
+				}
+			}
+		},
+		{
+			field: "status",
+			label: "状态",
+			class: "w-100",
+			required: false,
+			component: "Dict",
+			props: {
+				placeholder: "请选择状态",
+				dictType: "device_status",
+				valueIsNumber: 1,
+				type: "select"
+			},
+			listeners: {
+				change: (v: any) => {
+					handleQuery()
+				}
+			}
+		},
+		{
+			field: "location",
+			label: "安装位置",
+			class: "w-100",
+			required: false,
+			placeholder: "请输入安装位置",
+			component: "I",
+			listeners: {
+				keyup: (e: KeyboardEvent) => {
+					if (e.code == "Enter") {
+						handleQuery()
+					}
+				}
+			}
+		},
+		{
+			field: "manufacturer",
+			label: "厂家",
+			class: "w-100",
+			required: false,
+			placeholder: "请输入厂家",
+			component: "I",
+			listeners: {
+				keyup: (e: KeyboardEvent) => {
+					if (e.code == "Enter") {
+						handleQuery()
+					}
+				}
+			}
+		},
+		{
+			field: "dateRangeInstallationDate",
+			label: "安装日期",
+			class: "w-100",
+			required: false,
+			component: "D",
+			placeholder: "请选择安装日期",
+			props: {
+				type: "daterange",
+				valueFormat: "YYYY-MM-DD",
+				rangeSeparator: "-",
+				startPlaceholder: "开始日期",
+				endPlaceholder: "结束日期"
+			},
+			listeners: {
+				change: (v: any) => {
+					queryParams.value.dateRangeInstallationDate = v
+					handleQuery()
+				}
+			},
+			span: 5
+		},
+		{
+			field: "responsiblePerson",
+			label: "负责人",
+			class: "w-100",
+			required: false,
+			placeholder: "请输入负责人",
+			component: "I",
+			listeners: {
+				keyup: (e: KeyboardEvent) => {
+					if (e.code == "Enter") {
+						handleQuery()
+					}
+				}
+			}
+		}
+	] as any,
+	permission: "device:device",
+	handleBtns: [],
+	handleFuns: {
+		handleCreate,
+		handleUpdate: () => {
+			const row = tableRef.value.getSelected()
+			handleUpdate(row)
+		},
+		handleDelete: () => {
+			const rows = tableRef.value.getSelecteds()
+			handleDelete(rows)
+		}
+	},
+	customBtns: [],
+	tableListFun: apis.device.deviceApi.list,
+	getEntityFun: apis.device.deviceApi.get,
+	deleteEntityFun: apis.device.deviceApi.del,
+	exportUrl: apis.device.deviceApi.exportUrl,
+	exportName: "Device",
+	modalTitle: "设备资产台账",
+	formItems: [
+		{
+			field: "name",
+			label: "设备名称",
+			class: "w-100",
+			required: true,
+			placeholder: "请输入设备名称",
+			component: "I"
+		},
+		{
+			field: "manufacturer",
+			label: "厂家",
+			class: "w-100",
+			required: true,
+			placeholder: "请输入厂家",
+			component: "I"
+		},
+		{
+			field: "location",
+			label: "安装位置",
+			class: "w-100",
+			required: true,
+			placeholder: "请输入安装位置",
+			component: "I"
+		},
+		{
+			field: "installationDate",
+			label: "安装日期",
+			class: "w-100",
+			required: true,
+			component: "D",
+			props: {
+				placeholder: "请选择安装日期",
+				type: "date",
+				valueFormat: "YYYY-MM-DD"
+			}
+		},
+		{
+			field: "responsiblePerson",
+			label: "负责人",
+			class: "w-100",
+			required: true,
+			placeholder: "请输入负责人",
+			component: "I"
+		},
+		{
+			field: "responsiblePhone",
+			label: "负责人电话",
+			class: "w-100",
+			required: true,
+			placeholder: "请输入负责人电话",
+			component: "I",
+			rules: [{ pattern: /^1[3-9]\d{9}$/, message: "请输入正确的手机号码", trigger: ["blur"] }]
+		},
+		{
+			field: "manual",
+			label: "说明书",
+			class: "w-100",
+			required: false,
+			placeholder: "请输入说明书",
+			component: "Vu",
+			props: {
+				uploadType: "file",
+				uploadUrl: "resource/oss/upload/device",
+				fileType: ["pdf", "doc", "docx"],
+				fileSize: 10,
+				limit: 5
+			}
+		}
+	] as any,
+	resetForm: () => {
+		form.value = emptyFormData.value
+	},
+	labelWidth: "80px",
+	emptyFormData: {
+		id: undefined,
+		name: undefined,
+		status: 0,
+		location: undefined,
+		manufacturer: undefined,
+		installationDate: undefined,
+		responsiblePerson: undefined,
+		responsiblePhone: undefined,
+		manual: undefined
+	}
+})
+const { queryParams, emptyFormData } = toRefs(opts)
+const form = ref<any>(emptyFormData.value)
+
+/** 搜索按钮操作 */
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	addDateRange(query, query.dateRangeInstallationDate, "InstallationDate")
+	addDateRange(query, query.dateRangeCreateTime)
+	addDateRange(query, query.dateRangeUpdateTime, "UpdateTime")
+	tableRef.value?.query(query)
+}
+
+/** 重置按钮操作 */
+function resetQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	query.dateRangeInstallationDate = [] as any
+	addDateRange(query, query.dateRangeInstallationDate, "InstallationDate")
+	query.dateRangeCreateTime = [] as any
+	addDateRange(query, query.dateRangeCreateTime)
+	query.dateRangeUpdateTime = [] as any
+	addDateRange(query, query.dateRangeUpdateTime, "UpdateTime")
+	//
+}
+function handleCreate() {
+	tableRef.value.defaultHandleFuns.handleCreate()
+}
+/** 修改按钮操作 */
+function handleUpdate(row: any) {
+	tableRef.value.defaultHandleFuns.handleUpdate("", row)
+}
+
+/** 删除按钮操作 */
+function handleDelete(rows: any[]) {
+	tableRef.value.defaultHandleFuns.handleDelete("", rows)
+}
+
+/** 提交按钮 */
+function submitForm() {
+	apis.device.deviceApi.addOrUpdate(form.value).then(() => {
+		handleQuery()
+	})
+}
+
+function handlePreviewPdf(file: string) {
+	const fileId = file.split("$")[0],
+		fileName = file.split("$")[1]
+	pdfPreviewRef.value.open({
+		fileId,
+		fileName
+	})
+}
+</script>
+<template>
+	<div class="app-container">
+		<VbDataTable
+			ref="tableRef"
+			keyField="id"
+			:columns="opts.columns"
+			:handle-perm="opts.permission"
+			:handle-btns="opts.handleBtns"
+			:handle-funs="opts.handleFuns"
+			:search-form-items="opts.searchFormItems"
+			:custom-btns="opts.customBtns"
+			:remote-fun="opts.tableListFun"
+			:get-entity-fun="opts.getEntityFun"
+			:delete-entity-fun="opts.deleteEntityFun"
+			:export-url="opts.exportUrl"
+			:export-name="opts.exportName"
+			:modal="modalRef"
+			:reset-form-fun="opts.resetForm"
+			v-model:form-data="form"
+			v-model:query-params="queryParams"
+			:check-multiple="true"
+			:reset-search-form-fun="resetQuery"
+			:custom-search-fun="handleQuery">
+			<template #manual="{ row }">
+				<template v-if="row.manual">
+					<template v-for="(file, key) in row.manual.split(',')" :key="key">
+						<span
+							v-if="file.split('$').length > 1"
+							class="text-primary p-1"
+							@click="handlePreviewPdf(file)">
+							{{ file.split("$")[1] }}
+						</span>
+					</template>
+				</template>
+			</template>
+			<template #status="{ row }">
+				<DictTag type="device_status" :value-is-number="1" :value="row.status"></DictTag>
+			</template>
+			<template #installationDate="{ row }">
+				{{ dayjs(row.installationDate).format("YYYY-MM-DD") }}
+			</template>
+			<template #actions="{ row }">
+				<vb-tooltip content="修改" placement="top">
+					<el-button
+						link
+						type="primary"
+						@click="handleUpdate(row)"
+						v-hasPermission="'device:device:edit'">
+						<template #icon>
+							<VbIcon icon-name="notepad-edit" icon-type="duotone" class="fs-3"></VbIcon>
+						</template>
+					</el-button>
+				</vb-tooltip>
+				<vb-tooltip content="删除" placement="top">
+					<el-button
+						link
+						type="primary"
+						@click="handleDelete([row])"
+						v-hasPermission="'device:device:remove'">
+						<template #icon>
+							<VbIcon icon-name="trash-square" icon-type="duotone" class="fs-3"></VbIcon>
+						</template>
+					</el-button>
+				</vb-tooltip>
+			</template>
+		</VbDataTable>
+		<VbModal
+			v-model:modal="modalRef"
+			:title="opts.modalTitle"
+			:form-data="form"
+			:form-items="opts.formItems"
+			:label-width="opts.labelWidth"
+			append-to-body
+			@confirm="submitForm"></VbModal>
+		<VbPdfPreview ref="pdfPreviewRef" />
+	</div>
+</template>

+ 1 - 1
UI/VB.VUE/src/views/mobile-home.vue

@@ -52,7 +52,7 @@ function handleCloseScanner() {
 
 				<div class="actions">
 					<el-button type="primary" round style="" @click="handleScan">
-						<i class="bi bi-qr-code-scan me-3 text-white fs-2"></i>
+						<i class="bi bi-hr me-3 text-white fs-2"></i>
 						<span class="fs-2">扫一扫</span>
 					</el-button>
 				</div>

+ 1 - 1
UI/VB.VUE/vite.config.ts

@@ -120,7 +120,7 @@ export default defineConfig(({ mode, command }) => {
 			strictPort: true,
 			open: true,
 			// 开启https
-			https: true,
+			https: false,
 			proxy: {
 				[env.VITE_APP_BASE_API]: {
 					//target: "http://localhost:8080",

文件差异内容过多而无法显示
+ 0 - 296
UI/VB.VUE/vite.config.ts.timestamp-1751524516784-ff27d13c9582a.mjs


部分文件因为文件数量过多而无法显示