Browse Source

优化地理信息-导出和地理设施-导入两个接口,使得地理设施系统-设施采集的地理设施信息的导入和导出共用一个模板1

james 3 weeks ago
parent
commit
4941189243

+ 8 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/BaseGgpFacilityServiceImpl.java

@@ -435,6 +435,14 @@ public class BaseGgpFacilityServiceImpl extends AbstractCrudService<BaseGgpFacil
                 int rot=3;
                 for (FacilityImportVo facilityImportVo:facilityImportVos) {
                     BaseGgpFacility baseGgpFacility = BeanMapperUtils.map(facilityImportVo, BaseGgpFacility.class);
+                    List<BaseGgpFacilityTypeNumVO> typeList = baseFacilityTypeMapper.typeNumList(SecurityUtils.getTenantId());
+                    if (CollectionUtils.isNotEmpty(typeList)) {
+                        for (int j = 0; j < typeList.size(); j++) {
+                            if (baseGgpFacility.getFacilityType().equals(typeList.get(j).getTypeName())) {
+                                baseGgpFacility.setFacilityType(typeList.get(j).getTypeCode());
+                            }
+                        }
+                    }
                     if (StringUtils.isBlank(baseGgpFacility.getFacilityType())||StringUtils.isBlank(baseGgpFacility.getFacilityName())||StringUtils.isBlank(baseGgpFacility.getAddress())||StringUtils.isBlank(baseGgpFacility.getLatitude())||StringUtils.isBlank(baseGgpFacility.getLongitude())){
 
                         String tmp = ",第"+rot+"行数据导入失败,必填字段不能为空";

+ 4 - 2
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/FacilityImportVo.java

@@ -1,9 +1,11 @@
 package com.usky.iot.service.vo;
 
-import cn.afterturn.easypoi.excel.annotation.Excel;
 
+import com.usky.common.core.annotation.Excel;
 import lombok.Data;
 
+import java.time.LocalDateTime;
+
 /**
  * <p>
  * 
@@ -78,6 +80,6 @@ public class FacilityImportVo{
      * 创建时间
      */
     @Excel(name = "创建时间")
-    private String createTime;
+    private LocalDateTime createTime;
 
 }

+ 1 - 1
service-iot/service-iot-biz/src/main/resources/mapper/iot/BaseFacilityTypeMapper.xml

@@ -20,7 +20,7 @@
         <result column="tenant_id" property="tenantId" />
     </resultMap>
     <select id="typeNumList" resultType="com.usky.iot.service.vo.BaseGgpFacilityTypeNumVO">
-        SELECT d.id,d.type_name as typeName,d.type_code as typeCode,d.type_img as typeImg,IF(facility_type IS
+        SELECT d.type_code,d.type_name as typeName,d.type_code as typeCode,d.type_img as typeImg,IF(facility_type IS
         NULL,0,COUNT(*)) AS
         typeFacilityNum
         FROM base_facility_type d