Browse Source

计量器具证书及资料库调整

Zimo 1 tuần trước cách đây
mục cha
commit
2ca5471ecb

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/qhse/cert/vo/IotMeasureCertPageReqVO.java

@@ -61,4 +61,7 @@ public class IotMeasureCertPageReqVO extends PageParam {
 
     @Schema(description = "60天预警")
     private Boolean alertWarn;
+
+    @Schema(description = "培训周期")
+    private String trainCycle;
 }

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/qhse/cert/vo/IotMeasureCertRespVO.java

@@ -82,4 +82,7 @@ public class IotMeasureCertRespVO {
 
     @Schema(description = "是否60天预警")
     private Boolean alertWarn;
+
+    @Schema(description = "培训周期")
+    private String trainCycle;
 }

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/qhse/cert/vo/IotMeasureCertSaveReqVO.java

@@ -58,4 +58,6 @@ public class IotMeasureCertSaveReqVO {
     private Long userId;
     private String userName;
 
+    @Schema(description = "培训周期")
+    private String trainCycle;
 }

+ 2 - 4
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/qhse/file/vo/QhseInfoSaveReqVO.java

@@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.pms.controller.admin.qhse.file.vo;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
-import javax.validation.constraints.NotEmpty;
-
 @Schema(description = "管理后台 - QHSE文件资料新增/修改 Request VO")
 @Data
 public class QhseInfoSaveReqVO {
@@ -19,14 +17,14 @@ public class QhseInfoSaveReqVO {
     private Long deptId;
 
     @Schema(description = "文件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
-    @NotEmpty(message = "文件名称不能为空")
+//    @NotEmpty(message = "文件名称不能为空")
     private String filename;
 
     @Schema(description = "文件类型", example = "1")
     private String fileType;
 
     @Schema(description = "文件路径", requiredMode = Schema.RequiredMode.REQUIRED)
-    @NotEmpty(message = "文件路径不能为空")
+//    @NotEmpty(message = "文件路径不能为空")
     private String filePath;
 
     @Schema(description = "备注", example = "随便")

+ 5 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/qhse/cert/IotMeasureCertDO.java

@@ -92,4 +92,9 @@ public class IotMeasureCertDO extends BaseDO {
      * 是否90天预警
      */
     private Boolean alertWarn;
+
+    /**
+     * 培训周期
+     */
+    private String trainCycle;
 }

+ 8 - 12
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/qhse/file/QhseInfoServiceImpl.java

@@ -78,20 +78,19 @@ public class QhseInfoServiceImpl implements QhseInfoService {
         String deviceCode = "";
         String deptName = "";
 
-        QhseFileTreeDO iotTreeDO = qhseFileTreeMapper.selectById(createReqVO.getClassId());
-        deptId = Long.valueOf(iotTreeDO.getDeptId());
+        deptId = createReqVO.getDeptId();
         if (Objects.nonNull(deptId)) {
             DeptRespDTO dept = deptApi.getDept(deptId);
             if (Objects.nonNull(dept)) {
                 deptName = dept.getName();
             }
         }
-        importFileTree(createReqVO.getFolderJson(), classId, deptId, createReqVO.getDeviceId(), deviceCode, deptName);
+        importFileTree(createReqVO.getFolderJson(), classId, deptId, deptName);
     }
 
 
     private final ObjectMapper objectMapper = new ObjectMapper();
-    public void importFileTree(String jsonData, Long parentId, Long deptId, Long deviceId, String deviceCode, String deptName) {
+    public void importFileTree(String jsonData, Long parentId, Long deptId, String deptName) {
         try {
             // 解析JSON数组
             JsonNode rootNode = objectMapper.readTree(jsonData);
@@ -110,13 +109,13 @@ public class QhseInfoServiceImpl implements QhseInfoService {
                     });
                     Long fileClassId = null;
                     if (folderStructureNode != null) {
-                        fileClassId = processFolderStructure(folderStructureNode, parentId, deptId, deviceCode, deptName, fileNames);
+                        fileClassId = processFolderStructure(folderStructureNode, parentId, deptId,  deptName, fileNames);
                     }
 
                     // todo 处理文件
                     JsonNode filesNode = itemNode.get("files");
                     if (filesNode != null && filesNode.isArray()&&Objects.nonNull(fileClassId)) {
-                        processFiles(filesNode, parentId, fileClassId, deviceId, deptId, deviceCode, deptName);
+                        processFiles(filesNode, parentId, fileClassId, deptId,  deptName);
                     }
                 }
             }
@@ -129,7 +128,7 @@ public class QhseInfoServiceImpl implements QhseInfoService {
     /**
      * 处理文件
      */
-    private void processFiles(JsonNode filesNode, Long rootParentId,Long fileClassId, Long deviceId, Long deptId, String deviceCode, String deptName) {
+    private void processFiles(JsonNode filesNode, Long rootParentId,Long fileClassId, Long deptId, String deptName) {
         for (JsonNode fileNode : filesNode) {
             String path = fileNode.get("path").asText();
             String filePath = fileNode.get("filePath").asText();
@@ -150,12 +149,10 @@ public class QhseInfoServiceImpl implements QhseInfoService {
             QhseInfoDO iotInfoDO = qhseInfoMapper.selectOne("filename", fileName, "class_id", fileClassId);
             if (iotInfoDO == null) {
                 QhseInfoDO info = new QhseInfoDO();
-                info.setDeviceId(deviceId);
                 info.setDeptId(deptId);
                 info.setClassId(fileClassId);
                 info.setFilename(fileName);
                 info.setDeleted(false);
-                info.setDeviceCode(deviceCode);
                 info.setDeptName(deptName);
                 info.setFileType("file");
                 if (fileName.contains("jpg")||fileName.contains("jpeg")||fileName.contains("png")||fileName.contains("gif")) {
@@ -188,7 +185,7 @@ public class QhseInfoServiceImpl implements QhseInfoService {
         return folder.getId();
     }
 
-    private Long processFolderStructure(JsonNode folderStructureNode, Long parentId, Long deptId, String deviceCode, String deptName, List<String> fileNames) {
+    private Long processFolderStructure(JsonNode folderStructureNode, Long parentId, Long deptId,  String deptName, List<String> fileNames) {
         Iterator<String> fieldNames = folderStructureNode.fieldNames();
 
         while (fieldNames.hasNext()) {
@@ -216,7 +213,6 @@ public class QhseInfoServiceImpl implements QhseInfoService {
                 folder.setDeleted(false);
                 folder.setType("file");
                 folder.setDeptId(Math.toIntExact(deptId));
-                folder.setDeviceCode(deviceCode);
                 folder.setDeptName(deptName);
                 qhseFileTreeMapper.insert(folder);
                 currentNodeId = folder.getId();
@@ -226,7 +222,7 @@ public class QhseInfoServiceImpl implements QhseInfoService {
             JsonNode childrenNode = folderNode.get("children");
             if (childrenNode != null && !childrenNode.isNull() && !childrenNode.isEmpty()) {
                 // 递归调用,如果子节点处理中返回了parentId,则向上传递
-                Long result = processFolderStructure(childrenNode, currentNodeId, deptId, deviceCode, deptName, fileNames);
+                Long result = processFolderStructure(childrenNode, currentNodeId, deptId,  deptName, fileNames);
                 if (result != null) {
                     return result; // 子节点处理中遇到了目标,返回结果
                 }