Parcourir la source

fix 输注处理代码,不完全

龙三郎 il y a 3 ans
Parent
commit
2e721c55b1

+ 11 - 15
coffee-system/src/main/java/com/coffee/aliyun/AliyunConsumerGroupService.java

@@ -13,7 +13,9 @@ import com.coffee.bus.listener.event.bean.DeviceInfoEvent;
 import com.coffee.bus.service.LocalBusDeviceService;
 import com.coffee.bus.service.LocalBusInfusionHistoryService;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.PostConstruct;
@@ -36,23 +38,17 @@ import java.util.concurrent.TimeUnit;
 @Service
 @Slf4j
 public class AliyunConsumerGroupService {
+    @Autowired
+    @Lazy
+    private AliyunIotSubscribeClient client;
+    @Autowired
+    @Lazy
+    private LocalBusDeviceService deviceService;
+    @Autowired
+    @Lazy
+    private LocalBusInfusionHistoryService infusionHistoryService;
 
-    // 初始化订阅客户端
-    private final AliyunIotSubscribeClient client;
 
-    // 设备Service
-    private final LocalBusDeviceService deviceService;
-
-    // 输注Service
-    private final LocalBusInfusionHistoryService infusionHistoryService;
-
-    public AliyunConsumerGroupService(AliyunIotSubscribeClient client,
-                                      LocalBusDeviceService deviceService,
-                                      LocalBusInfusionHistoryService infusionHistoryService) {
-        this.client = client;
-        this.deviceService = deviceService;
-        this.infusionHistoryService = infusionHistoryService;
-    }
 
     @Value("${aliyun.server-subscription.enable:false}")
     private boolean isEnable;

+ 3 - 3
coffee-system/src/main/java/com/coffee/bus/entity/BusInfusionHistoryEntity.java

@@ -169,9 +169,9 @@ public class BusInfusionHistoryEntity extends TenantGenericEntity<String,String>
     @DecimalMin(value = "0",message ="自调比例最小值不得超过0" )
     private BigDecimal flowAdjustRate;
 
-    @ApiModelProperty(value = "加减档提示",readOnly = true)
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private FlowStatusEnum warnFlow;
+//    @ApiModelProperty(value = "加减档提示",readOnly = true)
+//    @TableField(updateStrategy = FieldStrategy.IGNORED)
+//    private FlowStatusEnum warnFlow;
 
 
     @ApiModelProperty(value = "泵运行状态",readOnly = true)

+ 28 - 1
coffee-system/src/main/java/com/coffee/bus/enums/FlowStatusEnum.java

@@ -1,11 +1,18 @@
 package com.coffee.bus.enums;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
 /**
  * @Author XX
  * @Date 2022-04-26 09:28:34
  * @Version 1.0
  * @Description XXX
  */
+@AllArgsConstructor
+@JsonFormat(shape = JsonFormat.Shape.OBJECT)
 public enum FlowStatusEnum {
     /**
      * 0 --- 正常(默认值)
@@ -15,5 +22,25 @@ public enum FlowStatusEnum {
      * 4 --- 减档
      * 5 --- 低输注状态
      */
-    DUFAULT, ADDLIMIT, HIGHEST, UP, DOWN, LOWEST
+//    DUFAULT, ADDLIMIT, HIGHEST, UP, DOWN, LOWEST
+
+    /**
+     * 请在添加或修改的过程中不要改变枚举的顺序!!!!!!!!!!!!!!!
+     * 如若新增,请在最后尾部新增
+     * 切记不可删除!!!!!!!!!!!!
+     */
+    Running(0,"正在运行"),
+    Waiting(1,"待机中"),
+    Shutdown(2,"关机");
+
+
+    /**
+     * 与枚举ordinal保持一致
+     */
+    @Getter
+    @ApiModelProperty("运行状态编码")
+    private Integer value;
+    @Getter
+    @ApiModelProperty("运行状态内容")
+    private String text;
 }

+ 8 - 3
coffee-system/src/main/java/com/coffee/bus/service/LocalBusInfusionHistoryService.java

@@ -15,6 +15,8 @@ import com.coffee.bus.mapper.BusInfusionHistoryMapper;
 import com.coffee.common.crud.BaseService;
 import jodd.util.ObjectUtil;
 import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
 import java.util.Objects;
@@ -27,11 +29,14 @@ import java.util.Objects;
  * @createTime 2022年03月19日 09:27:00
  */
 @Service
-@AllArgsConstructor
 public class LocalBusInfusionHistoryService extends BaseService<BusInfusionHistoryMapper, BusInfusionHistoryEntity,String> {
 
-    private final LocalBusDeviceService deviceService;
-    private final LocalBusPatientService patientService;
+    @Autowired
+    @Lazy
+    private LocalBusDeviceService deviceService;
+    @Autowired
+    @Lazy
+    private LocalBusPatientService patientService;
 
     @Override
     public void validateBeforeSave(BusInfusionHistoryEntity entity) {