Просмотр исходного кода

营销户表信息,增加公共用水类型、是否计费、是否计量

欧阳劲驰 1 месяц назад
Родитель
Сommit
fbe09f6d09

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

@@ -0,0 +1,45 @@
+package com.shkpr.service.customgateway.core.constants;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 计费类型
+ *
+ * @author 欧阳劲驰
+ * @since 1.0.0
+ */
+@Getter
+@AllArgsConstructor
+public enum CustomerBillingType implements ExcelEnum {
+    // 计费的
+    CHARGED((short) 0, "是"),
+    // 免费的
+    FREE((short) 1, "否"),
+    ;
+
+    /**
+     * 码
+     */
+    private final Short code;
+    /**
+     * 名称
+     */
+    private final String name;
+
+    /**
+     * @return 单元格值
+     */
+    @Override
+    public String getLabel() {
+        return this.name;
+    }
+
+    /**
+     * @return 对象值
+     */
+    @Override
+    public Object getValue() {
+        return this.code;
+    }
+}

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

@@ -11,11 +11,11 @@ import lombok.Getter;
  */
 @Getter
 @AllArgsConstructor
-public enum CustomerMeterType {
+public enum CustomerMeterType  implements  ExcelEnum{
     //机械表
     NO_CYCLE_INFO((short) 0, "机械表"),
     //远传表
-    MONTHLY((short) 1, "远传表"),
+    MONTHLY((short) 1, "远传表"),
     ;
     /**
      * 码
@@ -27,16 +27,18 @@ public enum CustomerMeterType {
     private final String name;
 
     /**
-     * 获取编码集合
-     *
-     * @return 编码集合
+     * @return 单元格值
      */
-    public static short[] codes() {
-        CustomerMeterType[] values = values();
-        short[] codes = new short[values.length];
-        for (int i = 0; i < values.length; i++) {
-            codes[i] = values[i].getCode();
-        }
-        return codes;
+    @Override
+    public String getLabel() {
+        return this.name;
+    }
+
+    /**
+     * @return 对象值
+     */
+    @Override
+    public Object getValue() {
+        return this.code;
     }
 }

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

@@ -0,0 +1,45 @@
+package com.shkpr.service.customgateway.core.constants;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 未计量类型
+ *
+ * @author 欧阳劲驰
+ * @since 1.0.0
+ */
+@Getter
+@AllArgsConstructor
+public enum CustomerMeteringType implements ExcelEnum {
+    // 计量的
+    METERED((short) 0, "是"),
+    // 未计量的
+    UNMETERED((short) 1, "否"),
+    ;
+
+    /**
+     * 码
+     */
+    private final Short code;
+    /**
+     * 名称
+     */
+    private final String name;
+
+    /**
+     * @return 单元格值
+     */
+    @Override
+    public String getLabel() {
+        return this.name;
+    }
+
+    /**
+     * @return 对象值
+     */
+    @Override
+    public Object getValue() {
+        return this.code;
+    }
+}

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

@@ -0,0 +1,45 @@
+package com.shkpr.service.customgateway.core.constants;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 公共用水类型
+ *
+ * @author 欧阳劲驰
+ * @since 1.0.0
+ */
+@Getter
+@AllArgsConstructor
+public enum CustomerPublicServiceType implements ExcelEnum {
+    // 非公共用水
+    NOT_PUBLIC_SERVICE((short) 0, "非公共用水"),
+    // 公共用水
+    PUBLIC_SERVICE((short) 1, "公共用水"),
+    ;
+
+    /**
+     * 码
+     */
+    private final Short code;
+    /**
+     * 名称
+     */
+    private final String name;
+
+    /**
+     * @return 单元格值
+     */
+    @Override
+    public String getLabel() {
+        return this.name;
+    }
+
+    /**
+     * @return 对象值
+     */
+    @Override
+    public Object getValue() {
+        return this.code;
+    }
+}

+ 24 - 1
custom-gateway-core/src/main/java/com/shkpr/service/customgateway/core/domain/po/CustomerInfo.java

@@ -1,6 +1,10 @@
 package com.shkpr.service.customgateway.core.domain.po;
 
 import com.shkpr.service.customgateway.core.annotation.ExcelMapping;
+import com.shkpr.service.customgateway.core.constants.CustomerBillingType;
+import com.shkpr.service.customgateway.core.constants.CustomerMeterType;
+import com.shkpr.service.customgateway.core.constants.CustomerMeteringType;
+import com.shkpr.service.customgateway.core.constants.CustomerPublicServiceType;
 import lombok.Data;
 import org.locationtech.jts.geom.Geometry;
 
@@ -68,8 +72,9 @@ public class CustomerInfo {
     private String stampInfo;
 
     /**
-     * 水表类型
+     * 水表类型:0机械表,1远传水表
      */
+    @ExcelMapping(value = "表具类型", enumClass = CustomerMeterType.class)
     private Short meterType;
 
     /**
@@ -142,4 +147,22 @@ public class CustomerInfo {
      * 水表GIS空间几何信息
      */
     private Geometry geomGis;
+
+    /**
+     * 公共用水类型:0非公共用水,1公共用水
+     */
+    @ExcelMapping(value = "公共用水类型", enumClass = CustomerPublicServiceType.class)
+    private Short publicServType;
+
+    /**
+     * 计费类型:0计费的,1免费的
+     */
+    @ExcelMapping(value = "是否计费", enumClass = CustomerBillingType.class)
+    private Short billingType;
+
+    /**
+     * 未计量类型:0计量的,1未计量的
+     */
+    @ExcelMapping(value = "是否计量", enumClass = CustomerMeteringType.class)
+    private Short meteringType;
 }

+ 2 - 2
custom-gateway-core/src/main/java/com/shkpr/service/customgateway/core/domain/po/CustomerMeterRead.java

@@ -32,13 +32,13 @@ public class CustomerMeterRead {
     private LocalDate forDate;
 
     /**
-     * 抄表数据
+     * 抄见量
      */
     @ExcelMapping("抄见量(本月用水量)")
     private Float readValue;
 
     /**
-     * 抄表类型
+     * 抄表周期:0无抄表周期信息,1月抄,2单月抄,3双月抄,4季度上抄,5季度中抄,6季度下抄,7半年抄,8一月多抄
      */
     @ExcelMapping(value = "抄表周期", enumClass = CustomerReadType.class)
     private Short readType;

+ 9 - 0
custom-gateway-core/src/main/resources/mapper/CustomerInfoMapper.xml

@@ -24,6 +24,9 @@
             <if test="readBookType != null">readbook_type,</if>
             <if test="gis != null and gis != ''">gis,</if>
             <if test="geomGis != null">geom_gis,</if>
+            <if test="publicServType != null">public_serv_type,</if>
+            <if test="billingType != null">billing_type,</if>
+            <if test="meteringType != null">metering_type,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             #{code,jdbcType=VARCHAR},
@@ -48,6 +51,9 @@
             <if test="readBookType != null">#{readBookType,jdbcType=SMALLINT},</if>
             <if test="gis != null and gis != ''">#{gis,jdbcType=VARCHAR},</if>
             <if test="geomGis != null">#{geomGis,jdbcType=OTHER},</if>
+            <if test="publicServType != null">#{publicServType,jdbcType=SMALLINT},</if>
+            <if test="billingType != null">#{billingType,jdbcType=SMALLINT},</if>
+            <if test="meteringType != null">#{meteringType,jdbcType=SMALLINT},</if>
         </trim>
         on conflict (code) do update set
         <trim suffixOverrides=",">
@@ -70,6 +76,9 @@
             <if test="readBookType != null">readbook_type = excluded.readbook_type,</if>
             <if test="gis != null and gis != ''">gis = excluded.gis,</if>
             <if test="geomGis != null">geom_gis = excluded.geom_gis,</if>
+            <if test="publicServType != null">public_serv_type = excluded.public_serv_type,</if>
+            <if test="billingType != null">billing_type = excluded.billing_type,</if>
+            <if test="meteringType != null">metering_type = excluded.metering_type,</if>
         </trim>
     </insert>
 </mapper>

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

@@ -13,7 +13,6 @@ import com.shkpr.service.customgateway.core.utils.CommTool;
 import com.shkpr.service.customgateway.core.utils.ExcelUtil;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
-import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -71,7 +70,6 @@ public class CustomerController {
     public ResultResponse<String> customerInfoImport(HttpServletRequest request
             , @RequestHeader(value = Api.HEADER_CLIENT_TYPE, required = false) String strClientType
             , @RequestHeader(value = Api.HEADER_USER_AGENT, required = false) String strUserAgent
-            , @RequestParam(value = "meterType", required = false) Short meterType
             , @RequestParam(value = "file", required = false) MultipartFile file) throws SelfException {
         //初始化序列
         requestSeq.putIfAbsent(Api.URI_XXX_CUSTOMER_INFO_IMPORT, new AtomicInteger(0));
@@ -79,7 +77,7 @@ public class CustomerController {
         final String requestURI = request.getRequestURI();
         final String strPlatform = CommTool.getPlatformByAgent(strClientType, strUserAgent);
         //参数校验
-        if (meterType == null || file == null || file.isEmpty() || !ArrayUtils.contains(CustomerMeterType.codes(), meterType))
+        if (file == null || file.isEmpty())
             throw new SelfException(ResponseCode.STATUS_ERROR_JSON_FORMAT.getCode() + ""
                     , String.format(Api.EXCEPTION_FORMAT
                     , strPlatform
@@ -109,8 +107,6 @@ public class CustomerController {
             //获取数据
             List<CustomerInfo> dates = dataEntry.getValue().stream()
                     .peek(info -> {
-                        //表类型
-                        info.setMeterType(meterType);
                         //抄表周期
                         info.setReadCycle(CustomerReadType.getCode(info.getReadCycleName()));
                         //表状态