Browse Source

增加抄表周期修改

欧阳劲驰 11 giờ trước cách đây
mục cha
commit
9686237be0

+ 2 - 0
custom-gateway-core/src/main/java/com/shkpr/service/customgateway/core/constants/CustomerMeterType.java

@@ -27,6 +27,8 @@ public enum CustomerMeterType {
     private final String name;
 
     /**
+     * 获取编码集合
+     *
      * @return 编码集合
      */
     public static short[] codes() {

+ 24 - 9
custom-gateway-core/src/main/java/com/shkpr/service/customgateway/core/constants/CustomerReadType.java

@@ -3,6 +3,8 @@ package com.shkpr.service.customgateway.core.constants;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
 
+import java.util.Arrays;
+
 /**
  * 营销抄表类型
  *
@@ -11,25 +13,25 @@ import lombok.Getter;
  */
 @Getter
 @AllArgsConstructor
-public enum CustomerReadType implements ExcelEnum{
+public enum CustomerReadType implements ExcelEnum {
     //无抄表周期信息
     NO_CYCLE_INFO((short) 0, "无抄表周期信息"),
     //每月抄表
-    MONTHLY((short)1, "月抄"),
+    MONTHLY((short) 1, "月抄"),
     //单月抄表
-    SINGLE_MONTH((short)2, "单月抄"),
+    SINGLE_MONTH((short) 2, "单月抄"),
     //双月抄表
-    DOUBLE_MONTH((short)3, "双月抄"),
+    DOUBLE_MONTH((short) 3, "双月抄"),
     //季度上抄表
-    QUARTER_FIRST((short)4, "季度上抄"),
+    QUARTER_FIRST((short) 4, "季度上抄"),
     //季度中抄表
-    QUARTER_MID((short)5, "季度中抄"),
+    QUARTER_MID((short) 5, "季度中抄"),
     //季度下抄表
-    QUARTER_LAST((short)6, "季度下抄"),
+    QUARTER_LAST((short) 6, "季度下抄"),
     //半年抄表
-    SEMI_ANNUAL((short)7, "半年抄"),
+    SEMI_ANNUAL((short) 7, "半年抄"),
     //一月多抄
-    MULTIPLE_PER_MONTH((short)9, "一月多抄"),
+    MULTIPLE_PER_MONTH((short) 9, "一月多抄"),
     ;
     /**
      * 码
@@ -40,6 +42,19 @@ public enum CustomerReadType implements ExcelEnum{
      */
     private final String name;
 
+    /**
+     * 获取code
+     *
+     * @param name 名称
+     * @return code
+     */
+    public static short getCode(String name) {
+        return Arrays.stream(values())
+                .filter(it -> it.getName().equals(name))
+                .findFirst().orElse(NO_CYCLE_INFO)
+                .getCode();
+    }
+
     @Override
     public String getLabel() {
         return this.name;

+ 4 - 1
custom-gateway-zydma/src/main/java/com/shkpr/service/customgateway/zydma/controller/CustomerController.java

@@ -108,9 +108,12 @@ public class CustomerController {
         if (MapUtils.isNotEmpty(excel)) for (Map.Entry<String, List<CustomerInfo>> dataEntry : excel.entrySet()) {
             //获取数据
             List<CustomerInfo> dates = dataEntry.getValue().stream()
-                    //修改表类型,表状态为正常
                     .peek(info -> {
+                        //表类型
                         info.setMeterType(meterType);
+                        //抄表周期
+                        info.setReadCycle(CustomerReadType.getCode(info.getReadCycleName()));
+                        //表状态
                         info.setStatusCode(CustomerInfoStatus.NORMAL.getCode());
                         info.setStatusName(CustomerInfoStatus.NORMAL.getName());
                     })