Selaa lähdekoodia

update 将文档由swagger改为knife4j

18339543638 3 vuotta sitten
vanhempi
commit
5edb3336b1
32 muutettua tiedostoa jossa 284 lisäystä ja 135 poistoa
  1. 2 3
      coffee-admin/src/main/java/com/coffee/admin/AdminApplication.java
  2. 4 4
      coffee-common/pom.xml
  3. 3 3
      coffee-common/src/main/java/com/coffee/common/crud/controller/BaseDeleteController.java
  4. 7 9
      coffee-common/src/main/java/com/coffee/common/crud/controller/BaseQueryController.java
  5. 4 7
      coffee-common/src/main/java/com/coffee/common/crud/controller/BaseSaveController.java
  6. 2 2
      coffee-common/src/main/java/com/coffee/common/entity/GenericEntity.java
  7. 5 9
      coffee-common/src/main/java/com/coffee/common/entity/QueryParamEntity.java
  8. 5 12
      coffee-common/src/main/java/com/coffee/common/entity/param/Term.java
  9. 3 11
      coffee-framework/pom.xml
  10. 7 3
      coffee-framework/src/main/java/com/coffee/framework/config/SwaggerConfig.java
  11. 40 0
      coffee-framework/src/main/java/com/coffee/framework/config/WebAppMvcConfig.java
  12. 27 0
      coffee-system/src/main/java/com/coffee/bus/controller/BusAlarmController.java
  13. 1 0
      coffee-system/src/main/java/com/coffee/bus/controller/BusClinicController.java
  14. 27 0
      coffee-system/src/main/java/com/coffee/bus/controller/BusConstantController.java
  15. 5 5
      coffee-system/src/main/java/com/coffee/bus/controller/BusDeviceHistoryController.java
  16. 8 7
      coffee-system/src/main/java/com/coffee/bus/controller/BusDeviceUsingController.java
  17. 27 0
      coffee-system/src/main/java/com/coffee/bus/controller/BusDrugController.java
  18. 4 6
      coffee-system/src/main/java/com/coffee/bus/controller/BusHospitalController.java
  19. 3 6
      coffee-system/src/main/java/com/coffee/bus/controller/BusPatientController.java
  20. 27 0
      coffee-system/src/main/java/com/coffee/bus/controller/BusStatsAnalyseController.java
  21. 27 0
      coffee-system/src/main/java/com/coffee/bus/controller/BusStatsReportController.java
  22. 3 3
      coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceHistoryEntity.java
  23. 1 1
      coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceUseEntity.java
  24. 13 0
      coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceUsingEntity.java
  25. 1 5
      coffee-system/src/main/java/com/coffee/bus/entity/BusHospitalEntity.java
  26. 2 2
      coffee-system/src/main/java/com/coffee/bus/mapper/BusDeviceHistoryMapper.java
  27. 5 5
      coffee-system/src/main/java/com/coffee/bus/service/LocalBusDeviceHistoryService.java
  28. 4 4
      coffee-system/src/main/java/com/coffee/bus/service/LocalBusDeviceUsingService.java
  29. 1 1
      coffee-system/src/main/java/com/coffee/bus/websocket/listener/DeviceInfoListener.java
  30. 12 12
      coffee-system/src/main/java/com/coffee/bus/websocket/listener/HistoryInfoListener.java
  31. 0 2
      coffee-system/src/main/java/com/coffee/system/controller/SysAreaController.java
  32. 4 13
      pom.xml

+ 2 - 3
coffee-admin/src/main/java/com/coffee/admin/AdminApplication.java

@@ -8,16 +8,15 @@ import org.springframework.context.annotation.Import;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.tio.websocket.starter.EnableTioWebSocketServer;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+//import springfox.documentation.swagger2.annotations.EnableSwagger2;
 
 /**
  * Admin启动类
  *
  * @author Kevin
  */
-@SpringBootApplication(scanBasePackages ={"com.coffee"}, exclude = {DataSourceAutoConfiguration.class})
+@SpringBootApplication(scanBasePackages ={"com.coffee","springfox.documentation.schema"}, exclude = {DataSourceAutoConfiguration.class})
 @Import(cn.hutool.extra.spring.SpringUtil.class)
-@EnableSwagger2
 @EnableTioWebSocketServer
 @EnableScheduling
 @EnableAsync

+ 4 - 4
coffee-common/pom.xml

@@ -33,6 +33,10 @@
         <!--</dependency>-->
          <!--websocket 模块-->
         <!-- web 模块 -->
+        <dependency>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>knife4j-spring-boot-starter</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
@@ -58,10 +62,6 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis</artifactId>
         </dependency>
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-boot-starter</artifactId>
-        </dependency>
         <!-- pool 对象池 -->
         <dependency>
             <groupId>org.apache.commons</groupId>

+ 3 - 3
coffee-common/src/main/java/com/coffee/common/crud/controller/BaseDeleteController.java

@@ -5,7 +5,7 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.mapper.Mapper;
 import com.coffee.common.crud.BaseService;
 import com.coffee.common.result.R;
-import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.Serializable;
@@ -23,7 +23,7 @@ public interface BaseDeleteController<E, K extends Serializable> extends BaseCur
     BaseService<? extends Mapper<E>,E,K> getService();
 
     @PostMapping("/remove")
-    @Operation(summary = "根据ID删除")
+    @ApiOperation(value = "根据ID删除")
     default R delete(@RequestParam("ids") K id) {
         deleteAuth();
         if(StrUtil.isNullOrUndefined(String.valueOf(id))){
@@ -43,7 +43,7 @@ public interface BaseDeleteController<E, K extends Serializable> extends BaseCur
      **/
 
     @PostMapping("/delete/_batch")
-    @Operation(summary = "根据ID删除")
+    @ApiOperation(value = "根据ID删除")
     default R delete(@RequestBody List<String> ids) {
         deleteAuth();
         if(CollectionUtil.isEmpty(ids)){

+ 7 - 9
coffee-common/src/main/java/com/coffee/common/crud/controller/BaseQueryController.java

@@ -2,15 +2,13 @@ package com.coffee.common.crud.controller;
 
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.Mapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.IService;
 import com.coffee.common.crud.BaseService;
 import com.coffee.common.entity.QueryParamEntity;
 import com.coffee.common.result.R;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.Serializable;
@@ -29,23 +27,23 @@ public interface BaseQueryController<E, K extends Serializable> extends
      * @see
      */
     @PostMapping("/page")
-    @Operation(summary = "使用POST方式分页动态查询")
-    default R<IPage<E>> queryPager(@Parameter(hidden = true)@RequestBody QueryParamEntity<E> query) {
+    @ApiOperation(value = "使用POST方式分页动态查询")
+    default R<IPage<E>> queryPager(@ApiParam(hidden = true)@RequestBody QueryParamEntity<E> query) {
         queryAuth();
         return R.success(this.getService().list(query));
 
     }
 
     @PostMapping("/_count")
-    @Operation(summary = "使用POST方式查询总数")
-    default R<Long> count(@Parameter(hidden = true) @RequestBody(required = false) QueryParamEntity<E> query) {
+    @ApiOperation(value = "使用POST方式查询总数")
+    default R<Long> count(@ApiParam(hidden = true) @RequestBody(required = false) QueryParamEntity<E> query) {
         queryAuth();
         return R.success(ObjectUtil.isNull(query)?this.getService().count():this.getService().count(query));
     }
 
 
     @GetMapping("/view")
-    @Operation(summary = "根据ID查询")
+    @ApiOperation(value = "根据ID查询")
     default R<E> getById(@RequestParam("id") K id) {
         queryAuth();
         String key=String.valueOf(id);

+ 4 - 7
coffee-common/src/main/java/com/coffee/common/crud/controller/BaseSaveController.java

@@ -1,12 +1,9 @@
 package com.coffee.common.crud.controller;
 
-import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.mapper.Mapper;
 import com.coffee.common.crud.BaseService;
-import com.coffee.common.entity.RecordCreationEntity;
-import com.coffee.common.entity.RecordModifierEntity;
 import com.coffee.common.result.R;
-import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.Serializable;
@@ -28,14 +25,14 @@ public interface BaseSaveController<E,K extends Serializable> extends
 
 
     @PostMapping("/_batch")
-    @Operation(summary = "批量新增数据")
+    @ApiOperation(value = "批量新增数据")
     default R add(@RequestBody List<E> payload) {
         saveAuth();
         return getService().saveBatch(payload)?R.success():R.fail("数据新增失败");
     }
 
     @PostMapping("/add")
-    @Operation(summary = "新增单个数据,并返回新增后的数据.")
+    @ApiOperation(value = "新增单个数据,并返回新增后的数据.")
     default R add(@RequestBody E payload) {
         saveAuth();
         return getService().save(payload)?R.success(payload):R.fail("数据新增失败");
@@ -43,7 +40,7 @@ public interface BaseSaveController<E,K extends Serializable> extends
 
 
     @PostMapping("/edit")
-    @Operation(summary = "根据ID修改数据")
+    @ApiOperation(value = "根据ID修改数据")
     default R update(@RequestBody E payload) {
         editAuth();
         return getService().updateById(payload)?R.success():R.fail("更新失败");

+ 2 - 2
coffee-common/src/main/java/com/coffee/common/entity/GenericEntity.java

@@ -2,7 +2,7 @@ package com.coffee.common.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -11,7 +11,7 @@ public abstract class  GenericEntity<PK> implements Entity {
     private static final long serialVersionUID = 1L;
 
     @TableId(type = IdType.ASSIGN_ID)
-    @Schema(description = "id")
+    @ApiModelProperty(value = "id")
     @Getter
     @Setter
     private PK id;

+ 5 - 9
coffee-common/src/main/java/com/coffee/common/entity/QueryParamEntity.java

@@ -1,14 +1,10 @@
 package com.coffee.common.entity;
 
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.db.sql.Order;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.coffee.common.entity.param.Term;
-import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import org.springframework.data.domain.Sort;
 
 import java.util.Set;
 
@@ -22,19 +18,19 @@ public class QueryParamEntity<T> {
 
     private static final long serialVersionUID = 8097500947924037523L;
 
-    @Schema(description = "指定要查询的列")
+    @ApiModelProperty(value = "指定要查询的列")
     private Set<String> includes;
 
 //    @Schema(description = "指定不查询的列")
 //    private Set<String> excludes;
 
-    @Schema(description = "where条件表达式,与terms参数不能共存.语法: name = 张三 and age > 16")
+    @ApiModelProperty(value = "where条件表达式,与terms参数不能共存.语法: name = 张三 and age > 16")
     private Set<Term> wheres;
 
-    @Schema(description = "分页查询")
+    @ApiModelProperty(value = "分页查询")
     private Page<T> page;
 
-    @Schema(description = "排序规则,field传入字段名,Direction 传输ASC、DESC")
+    @ApiModelProperty(value = "排序规则,field传入字段名,Direction 传输ASC、DESC")
     private Set<Order> orders;
 
     private String tenantId;

+ 5 - 12
coffee-common/src/main/java/com/coffee/common/entity/param/Term.java

@@ -2,18 +2,11 @@ package com.coffee.common.entity.param;
 
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
-import lombok.SneakyThrows;
-
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedList;
 import java.util.List;
-import java.util.stream.Collectors;
 
 /**
  * 执行条件
@@ -25,24 +18,24 @@ public class Term implements Cloneable, Serializable {
     /**
      * 字段
      */
-    @Schema(description = "字段名")
+    @ApiModelProperty(value = "字段名")
     private String column;
 
     /**
      * 单值
      */
-    @Schema(description = "单条件")
+    @ApiModelProperty(value = "单条件")
     private Object value;
 
     /**
      * 多值 即用于in ,between
      */
-    @Schema(description = "多条件")
+    @ApiModelProperty(value = "多条件")
     private List<Object> values;
     /**
      * 条件类型
      */
-    @Schema(description = "动态条件类型",defaultValue = "eq")
+    @ApiModelProperty(value = "动态条件类型")
     private TermType termType = TermType.eq;
 
     private Type type =Type.and;

+ 3 - 11
coffee-framework/pom.xml

@@ -27,18 +27,10 @@
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>
         </dependency>
-        <!--swagger模块 -->
         <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger2</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger-ui</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-boot-starter</artifactId>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>knife4j-spring-boot-starter</artifactId>
+            <optional>true</optional>
         </dependency>
         <!-- 阿里数据库连接池 -->
         <dependency>

+ 7 - 3
coffee-framework/src/main/java/com/coffee/framework/config/SwaggerConfig.java

@@ -1,5 +1,7 @@
 package com.coffee.framework.config;
 
+
+import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
 import io.swagger.models.auth.In;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -13,12 +15,14 @@ import springfox.documentation.service.*;
 import springfox.documentation.spi.DocumentationType;
 import springfox.documentation.spi.service.contexts.SecurityContext;
 import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
 
 import java.util.*;
 
 @Configuration
-@EnableSwagger2
+@EnableKnife4j
+@EnableSwagger2WebMvc
+//@EnableSwagger2
 public class SwaggerConfig implements WebMvcConfigurer {
 
     public static final String VERSION = "1.0.0";
@@ -53,7 +57,7 @@ public class SwaggerConfig implements WebMvcConfigurer {
     public Docket bus(){
         return new Docket(DocumentationType.SWAGGER_2)
                 .select()
-                .apis(RequestHandlerSelectors.basePackage("com.coffee.bus"))
+                .apis(RequestHandlerSelectors.basePackage("com.coffee.bus.controller"))
                 .paths(PathSelectors.any())
                 .build()
                 .groupName("业务模块")

+ 40 - 0
coffee-framework/src/main/java/com/coffee/framework/config/WebAppMvcConfig.java

@@ -0,0 +1,40 @@
+package com.coffee.framework.config;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+ 
+import java.time.format.DateTimeFormatter;
+ 
+/**
+ * @Description TODO
+ * @Classname Knife4jWebMvcConfig
+ * @Date 2021/3/2 15:27
+ * @Created by jianxiapc
+ */
+@Configuration
+@ConditionalOnProperty(value = "spring.profiles.active",havingValue = "dev")
+public class WebAppMvcConfig implements WebMvcConfigurer {
+ 
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ 
+        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
+ 
+        /** 配置knife4j 显示文档 */
+        registry.addResourceHandler("doc.html")
+                .addResourceLocations("classpath:/META-INF/resources/");
+ 
+        /**
+         * 配置swagger-ui显示文档
+         */
+        registry.addResourceHandler("swagger-ui.html")
+                .addResourceLocations("classpath:/META-INF/resources/");
+        /** 公共部分内容 */
+        registry.addResourceHandler("/webjars/**")
+                .addResourceLocations("classpath:/META-INF/resources/webjars/");
+    }
+ 
+}

+ 27 - 0
coffee-system/src/main/java/com/coffee/bus/controller/BusAlarmController.java

@@ -0,0 +1,27 @@
+package com.coffee.bus.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName BusAlarmController.java
+ * @Description TODO
+ * @createTime 2022年04月08日 10:20:00
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/bus/alarm")
+@Api(tags = "设备报警管理",description = "统一权限前缀(bus:alarm),例如新增bus:alarm:add")
+public class BusAlarmController {
+    @GetMapping
+    @ApiOperation("改接口无意义,当该模块下存在接口时,将该接口删除")
+    public void show(){
+
+    }
+}

+ 1 - 0
coffee-system/src/main/java/com/coffee/bus/controller/BusClinicController.java

@@ -9,6 +9,7 @@ import com.coffee.common.crud.BaseService;
 import com.coffee.common.crud.controller.BaseCrudController;
 import io.swagger.annotations.Api;
 import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 

+ 27 - 0
coffee-system/src/main/java/com/coffee/bus/controller/BusConstantController.java

@@ -0,0 +1,27 @@
+package com.coffee.bus.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName BusConstantController.java
+ * @Description TODO
+ * @createTime 2022年04月08日 10:19:00
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/bus/constant")
+@Api(tags = "常量管理",description = "统一权限前缀(bus:constant),例如新增bus:constant:add")
+public class BusConstantController {
+    @GetMapping
+    @ApiOperation("改接口无意义,当该模块下存在接口时,将该接口删除")
+    public void show(){
+
+    }
+}

+ 5 - 5
coffee-system/src/main/java/com/coffee/bus/controller/BusPumpHistoryController.java → coffee-system/src/main/java/com/coffee/bus/controller/BusDeviceHistoryController.java

@@ -1,8 +1,8 @@
 package com.coffee.bus.controller;
 
 import com.baomidou.mybatisplus.core.mapper.Mapper;
-import com.coffee.bus.entity.BusPumpHistoryEntity;
-import com.coffee.bus.service.LocalBusPumpHistoryService;
+import com.coffee.bus.entity.BusDeviceHistoryEntity;
+import com.coffee.bus.service.LocalBusDeviceHistoryService;
 import com.coffee.common.crud.BaseService;
 import com.coffee.common.crud.controller.BaseCrudController;
 import io.swagger.annotations.Api;
@@ -21,8 +21,8 @@ import org.springframework.web.bind.annotation.RestController;
 @AllArgsConstructor
 @RequestMapping("/bus/netpump/history")
 @Api(tags = "网络泵历史数据管理",description = "统一权限前缀(netpump:history),netpump:history:add")
-public class BusPumpHistoryController extends BaseCrudController<BusPumpHistoryEntity, String> {
-    private final LocalBusPumpHistoryService historyService;
+public class BusDeviceHistoryController extends BaseCrudController<BusDeviceHistoryEntity, String> {
+    private final LocalBusDeviceHistoryService historyService;
 
     /**
      * 权限控制前缀
@@ -34,7 +34,7 @@ public class BusPumpHistoryController extends BaseCrudController<BusPumpHistoryE
     }
 
     @Override
-    public BaseService<? extends Mapper<BusPumpHistoryEntity>, BusPumpHistoryEntity, String> getService() {
+    public BaseService<? extends Mapper<BusDeviceHistoryEntity>, BusDeviceHistoryEntity, String> getService() {
         return historyService;
     }
 }

+ 8 - 7
coffee-system/src/main/java/com/coffee/bus/controller/BusPumpController.java → coffee-system/src/main/java/com/coffee/bus/controller/BusDeviceUsingController.java

@@ -14,7 +14,8 @@ import com.coffee.common.crud.BaseService;
 import com.coffee.common.crud.controller.BaseQueryController;
 import com.coffee.common.result.R;
 import io.swagger.annotations.Api;
-import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
@@ -27,27 +28,27 @@ import org.springframework.web.bind.annotation.*;
  */
 @RestController
 @AllArgsConstructor
-@RequestMapping("/bus/netpump")
+@RequestMapping({"/bus/netpump","/bus/device/using"})
 @Api(tags = "网络泵管理",description = "统一权限前缀(bus:pump),例如新增bus:pump:add")
-public class BusPumpController implements BaseQueryController<BusDeviceUsingEntity, String> {
+public class BusDeviceUsingController implements BaseQueryController<BusDeviceUsingEntity, String> {
     private final LocalBusDeviceUsingService netPumpService;
 
     @GetMapping("/warn/dict")
-    @Operation(summary = "网络泵提醒信息枚举,无权限配置")
+    @ApiOperation(value = "网络泵提醒信息枚举,无权限配置")
     public R alarm(){
         return R.success(NetPumpWarnEnum.values());
     }
 
 
     @GetMapping("/status/dict")
-    @Operation(summary = "网络泵状态枚举,无权限配置, alarm字段表示该状态是否为报警状态")
+    @ApiOperation(value = "网络泵状态枚举,无权限配置, alarm字段表示该状态是否为报警状态")
     public R status(){
         return R.success(NetPumpStatusEnum.values());
     }
 
     @PostMapping("/undo")
     @SaCheckPermission("bus:pump:undo")
-    @Operation(summary = "进行撤泵操作,权限为bus:pump:undo")
+    @ApiOperation(value = "进行撤泵操作,权限为bus:pump:undo")
     public R undo(@RequestBody UndoConfig undoConfig){
         netPumpService.undo(undoConfig);
         return R.success();
@@ -55,7 +56,7 @@ public class BusPumpController implements BaseQueryController<BusDeviceUsingEnti
 
     @PostMapping("/nopump")
     @SaCheckPermission("bus:pump:add")
-    @Operation(summary = "新增无泵数据,权限为bus:pump:add")
+    @ApiOperation(value = "新增无泵数据,权限为bus:pump:add")
     public R saveNoPump(@RequestBody NoPumpConfig noPump){
 
         return R.success();

+ 27 - 0
coffee-system/src/main/java/com/coffee/bus/controller/BusDrugController.java

@@ -0,0 +1,27 @@
+package com.coffee.bus.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName BusDrugController.java
+ * @Description TODO
+ * @createTime 2022年04月08日 10:18:00
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/bus/drug")
+@Api(tags = "药品管理",description = "统一权限前缀(bus:drug),例如新增bus:drug:add")
+public class BusDrugController {
+    @GetMapping
+    @ApiOperation("改接口无意义,当该模块下存在接口时,将该接口删除")
+    public void show(){
+
+    }
+}

+ 4 - 6
coffee-system/src/main/java/com/coffee/bus/controller/BusHospitalController.java

@@ -1,7 +1,6 @@
 package com.coffee.bus.controller;
 
-import cn.hutool.json.JSONUtil;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+
 import com.baomidou.mybatisplus.core.mapper.Mapper;
 import com.coffee.bus.bean.Script;
 import com.coffee.bus.entity.BusHospitalEntity;
@@ -11,9 +10,8 @@ import com.coffee.common.crud.BaseService;
 import com.coffee.common.crud.controller.BaseCrudController;
 import com.coffee.common.result.R;
 import io.swagger.annotations.Api;
-import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
-import lombok.Getter;
 import org.springframework.web.bind.annotation.*;
 
 /**
@@ -47,7 +45,7 @@ public class BusHospitalController extends BaseCrudController<BusHospitalEntity,
     }
 
     @PostMapping("/{id}/script")
-    @Operation(summary = "保存医院信息解析脚本")
+    @ApiOperation(value = "保存医院信息解析脚本")
     public R script(@PathVariable("id") String id,@RequestBody Script script){
         BusHospitalEntity busHospitalEntity = new BusHospitalEntity();
         busHospitalEntity.setId(id);
@@ -60,7 +58,7 @@ public class BusHospitalController extends BaseCrudController<BusHospitalEntity,
     }
 
     @PostMapping("/{id}/debug")
-    @Operation(summary = "执行医院解析脚本")
+    @ApiOperation(value = "执行医院解析脚本")
     public R debug(@PathVariable("id") String id,@RequestBody String param){
         return R.success( scriptManager.lookUpHospital(id).exec(param));
     }

+ 3 - 6
coffee-system/src/main/java/com/coffee/bus/controller/BusPatientController.java

@@ -1,17 +1,14 @@
 package com.coffee.bus.controller;
 
 import com.baomidou.mybatisplus.core.mapper.Mapper;
-import com.coffee.bus.entity.BusDoctorEntity;
 import com.coffee.bus.entity.BusPatientEntity;
-import com.coffee.bus.service.LocalBusDoctorService;
 import com.coffee.bus.service.LocalBusPatientService;
 import com.coffee.common.crud.BaseService;
 import com.coffee.common.crud.controller.BaseCrudController;
 import com.coffee.common.result.R;
 import io.swagger.annotations.Api;
-import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -49,7 +46,7 @@ public class BusPatientController extends BaseCrudController<BusPatientEntity, S
 
     //todo 使用
     @PostMapping("/syn/{hospitalId}/{patientCode}")
-    @Operation(summary = "同步更新患者信息,即等待更新完成后返回更新结果")
+    @ApiOperation(value = "同步更新患者信息,即等待更新完成后返回更新结果")
     public DeferredResult<R> syn(@PathVariable("hospitalId") String hospitalId, @PathVariable("patientCode")String patientCode){
         DeferredResult<R> result = new DeferredResult<>();
         result.onCompletion(()->{
@@ -63,7 +60,7 @@ public class BusPatientController extends BaseCrudController<BusPatientEntity, S
 
     //todo
     @PostMapping("/async/{hospitalId}/{patientCode}")
-    @Operation(summary = "异步更新患者信息,即立刻返回更新结果")
+    @ApiOperation(value = "异步更新患者信息,即立刻返回更新结果")
     public R async(@PathVariable("hospitalId") String hospitalId, @PathVariable("patientCode")String patientCode){
         return R.success();
     }

+ 27 - 0
coffee-system/src/main/java/com/coffee/bus/controller/BusStatsAnalyseController.java

@@ -0,0 +1,27 @@
+package com.coffee.bus.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName BusAnalyseController.java
+ * @Description TODO
+ * @createTime 2022年04月08日 10:24:00
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/bus/stats/analgesia")
+@Api(tags = "镇痛分析",description = "统一权限前缀(bus:analyse),例如新增bus:analyse:add")
+public class BusStatsAnalyseController {
+    @GetMapping
+    @ApiOperation("改接口无意义,当该模块下存在接口时,将该接口删除")
+    public void show(){
+
+    }
+}

+ 27 - 0
coffee-system/src/main/java/com/coffee/bus/controller/BusStatsReportController.java

@@ -0,0 +1,27 @@
+package com.coffee.bus.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName BusAnalyseController.java
+ * @Description TODO
+ * @createTime 2022年04月08日 10:24:00
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/bus/stats/report")
+@Api(tags = "报表分析",description = "统一权限前缀(bus:report),例如新增bus:report:add")
+public class BusStatsReportController {
+    @GetMapping
+    @ApiOperation("改接口无意义,当该模块下存在接口时,将该接口删除")
+    public void show(){
+
+    }
+}

+ 3 - 3
coffee-system/src/main/java/com/coffee/bus/entity/BusPumpHistoryEntity.java → coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceHistoryEntity.java

@@ -31,7 +31,7 @@ import java.util.Date;
 @Accessors(chain = true)
 @TableName(value = "bus_pump_history",autoResultMap = true)
 @ApiModel(value="网络泵历史数据", description="")
-public class BusPumpHistoryEntity extends TenantGenericEntity<String,String> {
+public class BusDeviceHistoryEntity extends TenantGenericEntity<String,String> {
 
     @ApiModelProperty(value = "网络泵id")
     private String deviceId;
@@ -154,8 +154,8 @@ public class BusPumpHistoryEntity extends TenantGenericEntity<String,String> {
         this.bedNo=clinic.getBedNo();
     }
 
-    public static BusPumpHistoryEntity of(BusDeviceUsingEntity pump, BusClinicEntity clinic){
-        BusPumpHistoryEntity history = new BusPumpHistoryEntity();
+    public static BusDeviceHistoryEntity of(BusDeviceUsingEntity pump, BusClinicEntity clinic){
+        BusDeviceHistoryEntity history = new BusDeviceHistoryEntity();
 
         //临床信息
         history.setClinicId(clinic.getId());

+ 1 - 1
coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceUseEntity.java

@@ -14,7 +14,7 @@ import lombok.Data;
  * @createTime 2022年03月30日 11:01:00
  */
 @Data
-@TableName("bus_device_use")
+//@TableName("bus_device_use")
 public class BusDeviceUseEntity extends GenericEntity<String> {
     @ApiModelProperty("临床id")
     private String clinicId;

+ 13 - 0
coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceUsingEntity.java

@@ -102,6 +102,19 @@ public class BusDeviceUsingEntity extends TenantGenericEntity<String,String> {
     @TableField(typeHandler = EnumOrdinalTypeHandler.class,javaType = true)
     private NetPumpWarnEnum warn;
 
+    @ApiModelProperty(value = "报警信息")
+    @TableField(exist = false,typeHandler = EnumOrdinalTypeHandler.class,javaType = true)
+    private NetPumpStatusEnum alarm;
+
+    @ApiModelProperty(value = "输注即将结束提醒")
+    private Boolean warnWillFinished;
+
+    @ApiModelProperty(value = "镇痛不足提醒")
+    private Boolean warnAnalgesicPoor;
+
+    @ApiModelProperty(value = "电量偏低提醒")
+    private Boolean warnLowBattery;
+
     @ApiModelProperty(value = "开始时间")
     @TableField(typeHandler = DateToBigIntHandler.class)
     private Date startTime;

+ 1 - 5
coffee-system/src/main/java/com/coffee/bus/entity/BusHospitalEntity.java

@@ -10,11 +10,7 @@ import com.coffee.common.entity.RecordModifierEntity;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
-import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.Setter;
 import org.hibernate.validator.constraints.Length;
 
 import java.util.Date;
@@ -31,7 +27,7 @@ import java.util.Date;
 @ApiModel(value="医院", description="医院实体类")
 public class BusHospitalEntity implements RecordModifierEntity, RecordCreationEntity {
     @TableId(type = IdType.ASSIGN_ID,value = "tenant_id")
-    @Schema(description = "tenant_id")
+    @ApiModelProperty(value = "tenant_id")
     private String id;
     /**
      * 医院所在区域编码

+ 2 - 2
coffee-system/src/main/java/com/coffee/bus/mapper/BusPumpHistoryMapper.java → coffee-system/src/main/java/com/coffee/bus/mapper/BusDeviceHistoryMapper.java

@@ -1,7 +1,7 @@
 package com.coffee.bus.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.coffee.bus.entity.BusPumpHistoryEntity;
+import com.coffee.bus.entity.BusDeviceHistoryEntity;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -12,5 +12,5 @@ import org.apache.ibatis.annotations.Mapper;
  * @createTime 2022年03月19日 09:15:00
  */
 @Mapper
-public interface BusPumpHistoryMapper extends BaseMapper<BusPumpHistoryEntity> {
+public interface BusDeviceHistoryMapper extends BaseMapper<BusDeviceHistoryEntity> {
 }

+ 5 - 5
coffee-system/src/main/java/com/coffee/bus/service/LocalBusPumpHistoryService.java → coffee-system/src/main/java/com/coffee/bus/service/LocalBusDeviceHistoryService.java

@@ -1,7 +1,7 @@
 package com.coffee.bus.service;
 
-import com.coffee.bus.entity.BusPumpHistoryEntity;
-import com.coffee.bus.mapper.BusPumpHistoryMapper;
+import com.coffee.bus.entity.BusDeviceHistoryEntity;
+import com.coffee.bus.mapper.BusDeviceHistoryMapper;
 import com.coffee.common.crud.BaseService;
 import org.springframework.stereotype.Service;
 
@@ -13,14 +13,14 @@ import org.springframework.stereotype.Service;
  * @createTime 2022年03月19日 09:27:00
  */
 @Service
-public class LocalBusPumpHistoryService extends BaseService<BusPumpHistoryMapper, BusPumpHistoryEntity,String> {
+public class LocalBusDeviceHistoryService extends BaseService<BusDeviceHistoryMapper, BusDeviceHistoryEntity,String> {
     @Override
-    public void validateBeforeSave(BusPumpHistoryEntity entity) {
+    public void validateBeforeSave(BusDeviceHistoryEntity entity) {
 
     }
 
     @Override
-    public void validateBeforeUpdate(BusPumpHistoryEntity entity) {
+    public void validateBeforeUpdate(BusDeviceHistoryEntity entity) {
 
     }
 

+ 4 - 4
coffee-system/src/main/java/com/coffee/bus/service/LocalBusDeviceUsingService.java

@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.coffee.bus.controller.vo.UndoConfig;
 import com.coffee.bus.entity.BusClinicEntity;
 import com.coffee.bus.entity.BusDeviceUsingEntity;
-import com.coffee.bus.entity.BusPumpHistoryEntity;
+import com.coffee.bus.entity.BusDeviceHistoryEntity;
 import com.coffee.bus.mapper.BusDeviceUsingMapper;
 import com.coffee.common.crud.BaseService;
 import lombok.AllArgsConstructor;
@@ -29,7 +29,7 @@ import java.util.stream.Collectors;
 @AllArgsConstructor
 public class LocalBusDeviceUsingService extends BaseService<BusDeviceUsingMapper, BusDeviceUsingEntity,String> {
     private final LocalBusClinicService clinicService;
-    private final LocalBusPumpHistoryService historyService;
+    private final LocalBusDeviceHistoryService historyService;
     @Override
     public void validateBeforeSave(BusDeviceUsingEntity entity) {
 
@@ -70,8 +70,8 @@ public class LocalBusDeviceUsingService extends BaseService<BusDeviceUsingMapper
         List<BusClinicEntity> clinics = clinicService.listByIds(clinicIds);
         Map<String, List<BusClinicEntity>> clinicMap = clinics.stream().collect(Collectors.groupingBy(BusClinicEntity::getId));
         //泵的撤泵数据插入到历史数据中
-        List<BusPumpHistoryEntity> pumpHistories = pumps.stream().map(pump -> {
-            BusPumpHistoryEntity history = BusPumpHistoryEntity.of(pump, clinicMap.get(pump.getClinicId()).get(0));
+        List<BusDeviceHistoryEntity> pumpHistories = pumps.stream().map(pump -> {
+            BusDeviceHistoryEntity history = BusDeviceHistoryEntity.of(pump, clinicMap.get(pump.getClinicId()).get(0));
             history.setUndoBy(undoConfig.getUndoBy());
             history.setUndoTime(undoConfig.getUndoTime());
             history.setDestroyer(undoConfig.getDestroyer());

+ 1 - 1
coffee-system/src/main/java/com/coffee/bus/websocket/listener/DeviceInfoListener.java

@@ -233,7 +233,7 @@ public class DeviceInfoListener {
         pump.setAlias(deviceOperator.getAlias());
     }
 
-    @Scheduled(cron = "0/15 * * * * ?")
+//    @Scheduled(cron = "0/15 * * * * ?")
     public void send() throws InterruptedException {
 //        List<BusDeviceUsingEntity> list = deviceUsingService.list();
 //        list.forEach(pump->{

+ 12 - 12
coffee-system/src/main/java/com/coffee/bus/websocket/listener/HistoryInfoListener.java

@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.coffee.bus.bean.HisInfo;
 import com.coffee.bus.entity.BusClinicEntity;
 import com.coffee.bus.entity.BusDeviceUsingEntity;
-import com.coffee.bus.entity.BusPumpHistoryEntity;
+import com.coffee.bus.entity.BusDeviceHistoryEntity;
 import com.coffee.bus.entity.BusPatientEntity;
 import com.coffee.bus.listener.event.bean.HistoryInfoEvent;
 import com.coffee.bus.script.ExecuteResult;
@@ -46,14 +46,14 @@ public class HistoryInfoListener {
 
     private final LocalBusClinicService clinicService;
 
-    private final LocalBusPumpHistoryService historyService;
+    private final LocalBusDeviceHistoryService historyService;
 
     private final RedisTemplate redisTemplate;
 
     private final LocalBusDeviceUsingService pumpService;
 
     @Autowired
-    public HistoryInfoListener(ScriptManager scriptManager, LocalBusPatientService patientService, LocalBusClinicService clinicService, LocalBusPumpHistoryService historyService, RedisTemplate redisTemplate, LocalBusDeviceUsingService pumpService) {
+    public HistoryInfoListener(ScriptManager scriptManager, LocalBusPatientService patientService, LocalBusClinicService clinicService, LocalBusDeviceHistoryService historyService, RedisTemplate redisTemplate, LocalBusDeviceUsingService pumpService) {
         this.scriptManager = scriptManager;
         this.patientService = patientService;
         this.clinicService = clinicService;
@@ -136,20 +136,20 @@ public class HistoryInfoListener {
     public void updateClinic(BusClinicEntity clinic,Long requestId){
         clinic.setId(String.valueOf(IdWorker.getId()));
         //找到此病号信息且未绑定临床号,获取临床绑定设备号,并将临床信息与此次信息进行绑定
-        List<BusPumpHistoryEntity> historyList = historyService.list(
-                new QueryWrapper<BusPumpHistoryEntity>()
+        List<BusDeviceHistoryEntity> historyList = historyService.list(
+                new QueryWrapper<BusDeviceHistoryEntity>()
                         .lambda()
-                        .select(BusPumpHistoryEntity::getId)
-                        .select(BusPumpHistoryEntity::getDeviceId)
-                        .eq(BusPumpHistoryEntity::getTenantId, clinic.getTenantId())
-                        .eq(BusPumpHistoryEntity::getPatientCode, clinic.getPatientCode())
-                        .le(requestId!=null, BusPumpHistoryEntity::getRequestId,requestId)
-                        .isNull(BusPumpHistoryEntity::getClinicId));
+                        .select(BusDeviceHistoryEntity::getId)
+                        .select(BusDeviceHistoryEntity::getDeviceId)
+                        .eq(BusDeviceHistoryEntity::getTenantId, clinic.getTenantId())
+                        .eq(BusDeviceHistoryEntity::getPatientCode, clinic.getPatientCode())
+                        .le(requestId!=null, BusDeviceHistoryEntity::getRequestId,requestId)
+                        .isNull(BusDeviceHistoryEntity::getClinicId));
         if (CollectionUtil.isNotEmpty(historyList)) {
             //历史信息与临床号绑定
             historyList.forEach(history-> history.fillClinic(clinic));
             historyService.updateBatchById(historyList);
-            clinic.setDeviceCodes(historyList.stream().map(BusPumpHistoryEntity::getDeviceId).collect(Collectors.toSet()));
+            clinic.setDeviceCodes(historyList.stream().map(BusDeviceHistoryEntity::getDeviceId).collect(Collectors.toSet()));
         }
 
         pumpService.update(new UpdateWrapper<BusDeviceUsingEntity>()

+ 0 - 2
coffee-system/src/main/java/com/coffee/system/controller/SysAreaController.java

@@ -11,8 +11,6 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-import springfox.documentation.oas.annotations.EnableOpenApi;
-
 import javax.annotation.Resource;
 
 /**

+ 4 - 13
pom.xml

@@ -36,6 +36,7 @@
         <springfox.version>3.0.0</springfox.version>
         <tio.version>3.6.0.v20200315-RELEASE</tio.version>
         <jython.version>2.7.1</jython.version>
+        <knife4j.version>2.0.7</knife4j.version>
     </properties>
 
     <modules>
@@ -85,19 +86,9 @@
             </dependency>
             <!--swagger模块 -->
             <dependency>
-                <groupId>io.springfox</groupId>
-                <artifactId>springfox-swagger2</artifactId>
-                <version>${springfox.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.springfox</groupId>
-                <artifactId>springfox-swagger-ui</artifactId>
-                <version>${springfox.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.springfox</groupId>
-                <artifactId>springfox-boot-starter</artifactId>
-                <version>${springfox.version}</version>
+                <groupId>com.github.xiaoymin</groupId>
+                <artifactId>knife4j-spring-boot-starter</artifactId>
+                <version>${knife4j.version}</version>
             </dependency>
             <!--阿里数据库连接池 -->
             <dependency>