Quellcode durchsuchen

sop开发框架使用测试代码提交

yucheng vor 3 Jahren
Ursprung
Commit
b5e6b25a43

+ 2 - 9
fm-sop/pom.xml

@@ -3,18 +3,11 @@
          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">
     <parent>
-        <artifactId>integrated-platform</artifactId>
+        <artifactId>fm-business</artifactId>
         <groupId>com.persagy</groupId>
-        <version>1.0.0</version>
+        <version>3.0.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>fm-sop</artifactId>
     <packaging>jar</packaging>
-    <dependencies>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <optional>true</optional>
-        </dependency>
-    </dependencies>
 </project>

+ 39 - 0
fm-sop/src/main/java/com/persagy/fm/sop/controller/SopController.java

@@ -0,0 +1,39 @@
+package com.persagy.fm.sop.controller;
+
+import com.persagy.common.exception.BusinessException;
+import com.persagy.fm.sop.model.SopDTO;
+import com.persagy.fm.sop.service.ISopService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * sop api
+ * @author Charlie Yu
+ * @date 2021-03-05
+ */
+@RestController
+@Slf4j
+@RequestMapping("/sop/")
+public class SopController {
+
+    @Autowired
+    private ISopService sopService;
+
+    /**
+     * 保存草稿
+     * @param dto
+     * @return
+     */
+    @PostMapping("/saveDraftSop")
+    public SopDTO saveDraftSop(@RequestBody SopDTO dto){
+        if(StringUtils.isAnyBlank(dto.getSopName())) {
+            throw new BusinessException("名称不能为空");
+        }
+        return sopService.insert(dto);
+    }
+}

+ 53 - 0
fm-sop/src/main/java/com/persagy/fm/sop/model/SopDTO.java

@@ -0,0 +1,53 @@
+package com.persagy.fm.sop.model;
+
+import com.persagy.fm.common.model.entity.AuditableEntity;
+import lombok.Data;
+
+/**
+ * SOP实体
+ * @author Charlie Yu
+ * @date 2021-03-05
+ */
+@Data
+public class SopDTO extends AuditableEntity {
+
+    /** 项目主键 */
+    private String projectId;
+    /** 项目类型 */
+    private String projectType;
+    /** 名称 */
+    private String sopName;
+    /** 类型 */
+    private String sopType;
+    /** 是否有无对象的步骤 */
+    private Boolean noneFlag;
+    /** 专业编码 */
+    private String domains;
+    /** 工单类型 */
+    private String orderType;
+    /** 所需工具 */
+    private String tools;
+    /** 适用对象 */
+    private String fitObjs;
+    /** 设备型号 */
+    private String deviceType;
+    /** 自定义标签 */
+    private String labels;
+    /** 步骤 */
+    private String steps;
+    /** 相关资料 */
+    private String relatedData;
+    /** 状态 1-已发布、2-已作废 */
+    private String sopStatus;
+    /** 发布状态 1-正常、2-待修订、3-修订中 */
+    private String publishStatus;
+    /** 引用的sop */
+    private String refSops;
+    /** 版本号 */
+    private String version;
+    /** 版本数量 */
+    private String versionCount;
+    /** 版本说明 */
+    private String versionExplain;
+
+}

+ 18 - 0
fm-sop/src/main/java/com/persagy/fm/sop/service/ISopService.java

@@ -0,0 +1,18 @@
+package com.persagy.fm.sop.service;
+
+import com.persagy.fm.sop.model.SopDTO;
+
+/**
+ * Sop服务接口
+ * @author Charlie Yu
+ * @date 2021-03-05
+ */
+public interface ISopService {
+
+    /**
+     * 新增
+     * @param dto
+     * @return
+     */
+    SopDTO insert(SopDTO dto);
+}

+ 24 - 0
fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopServiceImpl.java

@@ -0,0 +1,24 @@
+package com.persagy.fm.sop.service.impl;
+
+import com.persagy.fm.sop.model.SopDTO;
+import com.persagy.fm.sop.service.ISopService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * sop服务实现
+ * @author Charlie Yu
+ * @date 2021-03-05
+ */
+@Service
+@Transactional
+@Slf4j
+public class SopServiceImpl implements ISopService {
+
+    @Override
+    public SopDTO insert(SopDTO dto) {
+        log.error("here----");
+        return dto;
+    }
+}

+ 18 - 0
fm-sop/src/main/resources/bootstrap.yml

@@ -0,0 +1,18 @@
+server:
+  port: ${SERVER_PORT:9937}
+
+spring: 
+  application:
+    name: sop
+
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*.xml
+  typeAliasesPackage: com.persagy.fm.sop.model
+
+integrated:
+  swagger:
+    enabled: true
+    title: sop
+    description: sop接口文档
+    version: 3.0.0
+    base-package: com.persagy.fm.sop.controller

+ 21 - 2
pom.xml

@@ -3,9 +3,9 @@
          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">
     <parent>
-        <artifactId>integrated-platform</artifactId>
+        <artifactId>fm-parent</artifactId>
         <groupId>com.persagy</groupId>
-        <version>1.0.0</version>
+        <version>3.0.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>pom</packaging>
@@ -18,4 +18,23 @@
         <module>fm-task</module>
         <module>fm-workorder</module>
     </modules>
+    <dependencies>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>fm-common</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>fm-server</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>integrated-config-client</artifactId>
+        </dependency>
+    </dependencies>
 </project>