LAPTOP-FO2T5SIU\35838 1 gadu atpakaļ
vecāks
revīzija
751a778469

+ 37 - 5
pro-base/src/main/java/com/idea/buildManage/controller/ParkInfoController.java

@@ -1,21 +1,28 @@
 package com.idea.buildManage.controller;
 
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
+import com.idea.buildManage.excel.ParkFloorDiscExcel;
+import com.idea.buildManage.excel.ParkFloorDiscListener;
+import com.idea.buildManage.excel.ParkInfoExcel;
+import com.idea.buildManage.excel.ParkInfoListener;
 import com.idea.buildManage.model.ParkInfo;
 import com.idea.buildManage.service.ParkInfoService;
+import com.idea.util.ExcelUtils;
 import com.rockstar.common.base.BaseController;
 import com.rockstar.common.domain.AjaxResult;
 import com.rockstar.frame.model.extend.DateTrans;
 import com.rockstar.frame.model.extend.TableSplitResult;
 import com.rockstar.frame.model.extend.Tablepar;
+import com.rockstar.system.service.SysDictService;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
 import java.util.Date;
 
 /**
@@ -29,6 +36,8 @@ public class ParkInfoController extends BaseController {
     //主表
     @Autowired
     private ParkInfoService modelService;
+    @Autowired
+    private SysDictService sysDictService;
 
 
     @PostMapping(value = "list",produces = {"application/json;charset=UTF-8"})
@@ -123,6 +132,29 @@ public class ParkInfoController extends BaseController {
         return success(modelService.selectByIds(ids));
     }
 
-
+    /**
+     * 楼栋导入
+     * @param file
+     * @return
+     */
+    @PostMapping(value = "handleImport", produces = {"application/json;charset=UTF-8"})
+    @ResponseBody
+    public AjaxResult handleImport(@RequestParam("file") MultipartFile file) {
+        JSONObject jsonObject = new JSONObject();
+        ParkInfoListener listener = new ParkInfoListener(modelService,sysDictService,jsonObject);
+        try {
+            ExcelUtils excelUtils = new ExcelUtils();
+            File excel = excelUtils.multipartFileToFile(file);
+            if (null == excel) {
+                return AjaxResult.error("导入失败");
+            }
+            EasyExcel.read(excel, ParkInfoExcel.class, listener).headRowNumber(1).sheet().doRead();
+            excel.delete();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return AjaxResult.error(e.getMessage());
+        }
+        return AjaxResult.success(jsonObject);
+    }
 
 }

+ 19 - 9
pro-base/src/main/java/com/idea/buildManage/excel/MnpBuildingListener.java

@@ -1,5 +1,6 @@
 package com.idea.buildManage.excel;
 
+import cn.hutool.core.util.IdUtil;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.event.AnalysisEventListener;
 import com.alibaba.fastjson.JSONObject;
@@ -8,6 +9,7 @@ import com.idea.buildManage.service.MnpBuildingService;
 import com.idea.buildManage.service.ParkFloorDiscService;
 import com.idea.buildManage.service.ParkInfoService;
 import com.rockstar.frame.service.FrameUserService;
+import com.rockstar.shiro.util.ShiroUtils;
 import com.rockstar.system.service.SysDictService;
 import com.rockstar.util.StringUtils;
 import org.apache.commons.collections.CollectionUtils;
@@ -15,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -199,15 +202,10 @@ public class MnpBuildingListener extends AnalysisEventListener<MnpBuildingExcel>
                     data.setLandCode(excel.getLandCode());
                     data.setRemark(excel.getRemark());
                     data.setPriceRemark(excel.getPriceRemark());
-                    count = list.size();
-                    jsonObject.put("successCount", count);
-                    jsonObject.put("errorList", badList);
-                    jsonObject.put("errorCount", badList.size());
-                    //保存
-                    saveData();
-
-                    excelList.clear();
-                    list.clear();
+                    data.setId(IdUtil.simpleUUID());
+                    data.setCreatedId(ShiroUtils.getUserId());
+                    data.setCreatedAt(new Date());
+                    list.add(data);
 
                 }catch (Exception e){
                     e.printStackTrace();
@@ -216,6 +214,18 @@ public class MnpBuildingListener extends AnalysisEventListener<MnpBuildingExcel>
                     badList.add(excel);
                 }
             }
+
+            count = list.size();
+            jsonObject.put("successCount", count);
+            jsonObject.put("errorList", badList);
+            jsonObject.put("errorCount", badList.size());
+            //保存
+            saveData();
+
+            excelList.clear();
+            list.clear();
+        }else {
+            throw new RuntimeException("excel无数据");
         }
 
     }

+ 29 - 13
pro-base/src/main/java/com/idea/buildManage/excel/ParkFloorDiscListener.java

@@ -1,11 +1,13 @@
 package com.idea.buildManage.excel;
 
+import cn.hutool.core.util.IdUtil;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.event.AnalysisEventListener;
 import com.alibaba.fastjson.JSONObject;
 import com.idea.buildManage.model.ParkFloorDisc;
 import com.idea.buildManage.service.ParkFloorDiscService;
 import com.idea.buildManage.service.ParkInfoService;
+import com.rockstar.shiro.util.ShiroUtils;
 import com.rockstar.system.service.SysDictService;
 import com.rockstar.util.StringUtils;
 import org.apache.commons.collections.CollectionUtils;
@@ -14,6 +16,7 @@ import org.springframework.stereotype.Component;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -51,6 +54,10 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
     @Override
     public void doAfterAllAnalysed(AnalysisContext analysisContext) {
 
+
+        // 支付方式字典
+        List<Map<String, String>> paymentMethods = sysDictService.selectDictList("PAYMENT_METHODS");
+
         if(CollectionUtils.isNotEmpty(excelList)){
             ParkFloorDisc data;
             ParkFloorDiscExcel excel = null;
@@ -67,6 +74,7 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
                     if(StringUtils.isEmpty(excel.getName())){
                         throw new RuntimeException("楼分期名称为空");
                     }
+                    data.setName(excel.getName());
                     // 判断小区是否存在
                     if(StringUtils.isEmpty(parkNameIdMap.get(excel.getGroupName()))){
                         throw new RuntimeException("楼盘/小区不存在");
@@ -120,22 +128,20 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
 
                     // 支付方式
                     if (StringUtils.isNotEmpty(excel.getPaymentMethods())) {
-                        try {
-                            data.setPaymentMethods(Integer.valueOf(excel.getPaymentMethods()));
-                        } catch (NumberFormatException e) {
+                        for (Map<String, String> stringStringMap : paymentMethods) {
+                            if (stringStringMap.get("label").equals(excel.getPaymentMethods())) {
+                                data.setPaymentMethods(Integer.valueOf(stringStringMap.get("value")));
+                            }
+                        }
+                        // 没匹配上的情况
+                        if(data.getPaymentMethods() == null){
                             throw new RuntimeException("支付方式格式有误");
                         }
                     }
-
-                    count = list.size();
-                    jsonObject.put("successCount", count);
-                    jsonObject.put("errorList", badList);
-                    jsonObject.put("errorCount", badList.size());
-                    //保存
-                    saveData();
-
-                    excelList.clear();
-                    list.clear();
+                    data.setId(IdUtil.simpleUUID());
+                    data.setCreatedId(ShiroUtils.getUserId());
+                    data.setCreatedAt(new Date());
+                    list.add(data);
 
                 }catch (Exception e){
                     e.printStackTrace();
@@ -145,8 +151,18 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
                 }
             }
 
+            count = list.size();
+            jsonObject.put("successCount", count);
+            jsonObject.put("errorList", badList);
+            jsonObject.put("errorCount", badList.size());
+            //保存
+            saveData();
 
+            excelList.clear();
+            list.clear();
 
+        }else {
+            throw new RuntimeException("excel无数据");
         }
 
 

+ 85 - 0
pro-base/src/main/java/com/idea/buildManage/excel/ParkInfoExcel.java

@@ -0,0 +1,85 @@
+package com.idea.buildManage.excel;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+public class ParkInfoExcel implements Serializable {
+
+    @ExcelProperty(value = "楼盘/小区名称")
+    private String groupName;
+
+    private String createdId;
+
+    private Date createdAt;
+
+    private Date updatedAt;
+
+    @ExcelProperty(value = "性质")
+    private String nature;
+
+    @ExcelProperty(value = "预销售许可证编号")
+    private String preSalesLicenseNumber;
+
+    @ExcelProperty(value = "开发公司")
+    private String companyName;
+
+    @ExcelProperty(value = "总建筑面积(㎡)")
+    private String buildArea;
+
+    @ExcelProperty(value = "总用地面积(㎡)")
+    private String landArea;
+
+    @ExcelProperty(value = "立项批文")
+    private String projectApprovalDocument;
+
+    @ExcelProperty(value = "工程规划许可证")
+    private String engineeringPlanningPermit;
+
+    @ExcelProperty(value = "施工许可证")
+    private String constructionPermit;
+
+    @ExcelProperty(value = "土地证号")
+    private String landCertificateNumber;
+
+    @ExcelProperty(value = "用地许可证号")
+    private String landUsePermitNumber;
+
+    @ExcelProperty(value = "容积率")
+    private String volumeRatio;
+
+    @ExcelProperty(value = "绿化率")
+    private String greenRatio;
+
+    @ExcelProperty(value = "标准单价")
+    private String price;
+
+    @ExcelProperty(value = "超标单价")
+    private String exceededPrice;
+
+    @ExcelProperty(value = "楼盘面积测绘状态")
+    private String areaStatus;
+
+    @ExcelProperty(value = "楼盘销售状态")
+    private String saleStatus;
+
+    @ExcelProperty(value = "行政区划")
+    private String regionalismCode;
+
+    @ExcelProperty(value = "详细地址")
+    private String address;
+
+    @ExcelProperty(value = "备注")
+    private String introduction;
+
+    @ExcelIgnore
+    private String reason;
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 159 - 0
pro-base/src/main/java/com/idea/buildManage/excel/ParkInfoListener.java

@@ -0,0 +1,159 @@
+package com.idea.buildManage.excel;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.IdUtil;
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.alibaba.fastjson.JSONObject;
+import com.idea.buildManage.model.ParkFloorDisc;
+import com.idea.buildManage.model.ParkInfo;
+import com.idea.buildManage.service.ParkFloorDiscService;
+import com.idea.buildManage.service.ParkInfoService;
+import com.rockstar.shiro.util.ShiroUtils;
+import com.rockstar.system.service.SysDictService;
+import com.rockstar.util.StringUtils;
+import org.apache.commons.collections.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+public class ParkInfoListener extends AnalysisEventListener<ParkInfoExcel> {
+
+    private List<ParkInfo> list = new ArrayList<>();
+
+    private List<ParkInfoExcel> excelList = new ArrayList<>();
+
+    private List<ParkInfoExcel> badList = new ArrayList<>();
+
+    Integer count;
+
+    private JSONObject jsonObject;
+
+    private ParkInfoService parkInfoService;
+    private SysDictService sysDictService;
+
+
+    public ParkInfoListener(ParkInfoService parkInfoService,
+                            SysDictService sysDictService, JSONObject jsonObject) {
+        this.parkInfoService = parkInfoService;
+        this.sysDictService = sysDictService;
+        this.jsonObject = jsonObject;
+    }
+
+
+    @Override
+    public void invoke(ParkInfoExcel parkInfoExcel, AnalysisContext analysisContext) {
+        excelList.add(parkInfoExcel);
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+
+
+        // 性质字典
+        List<Map<String, String>> groupNature = sysDictService.selectDictList("GROUP_NATURE");
+        // 测绘状态字典
+        List<Map<String, String>> mappingStatus = sysDictService.selectDictList("MAPPING_STATUS");
+        // 销售状态
+        List<Map<String, String>> saleStatus = sysDictService.selectDictList("SALE_STATUS");
+
+        if(CollectionUtils.isNotEmpty(excelList)){
+            ParkInfo data;
+            ParkInfoExcel excel = null;
+
+            for(int i = 0; i < excelList.size(); i++){
+                try {
+                    data = new ParkInfo();
+                    excel = excelList.get(i);
+
+                    if(StringUtils.isEmpty(excel.getGroupName())){
+                        throw new RuntimeException("楼盘/小区名称为空");
+                    }
+                    data.setGroupName(excel.getGroupName());
+                    if(StringUtils.isEmpty(excel.getNature())){
+                        throw new RuntimeException("性质为空");
+                    }
+                    for (Map<String, String> stringStringMap : groupNature) {
+                        if (stringStringMap.get("label").equals(excel.getNature())) {
+                            data.setNature(stringStringMap.get("value"));
+                        }
+                    }
+                    // 没匹配上的情况
+                    if(StringUtils.isEmpty(data.getNature())){
+                        throw new RuntimeException("性质格式有误");
+                    }
+                    // 预销售许可证编号
+                    if(StringUtils.isEmpty(excel.getPreSalesLicenseNumber())){
+                        throw new RuntimeException("预销售许可证编号为空");
+                    }
+                    data.setPreSalesLicenseNumber(excel.getPreSalesLicenseNumber());
+                    // 楼盘面积测绘状态
+                    if(StringUtils.isEmpty(excel.getAreaStatus())){
+                        throw new RuntimeException("性质为空");
+                    }
+                    for (Map<String, String> stringStringMap : mappingStatus) {
+                        if (stringStringMap.get("label").equals(excel.getAreaStatus())) {
+                            data.setAreaStatus(Integer.valueOf(stringStringMap.get("value")));
+                        }
+                    }
+                    // 没匹配上的情况
+                    if(StringUtils.isEmpty(data.getNature())){
+                        throw new RuntimeException("性质格式有误");
+                    }
+                    // 楼盘销售状态
+                    if(StringUtils.isEmpty(excel.getSaleStatus())){
+                        throw new RuntimeException("楼盘销售状态为空");
+                    }
+                    for (Map<String, String> stringStringMap : saleStatus) {
+                        if (stringStringMap.get("label").equals(excel.getSaleStatus())) {
+                            data.setSaleStatus(Integer.valueOf(stringStringMap.get("value")));
+                        }
+                    }
+                    // 没匹配上的情况
+                    if(data.getSaleStatus() == null){
+                        throw new RuntimeException("楼盘销售状态格式有误");
+                    }
+
+                    String[] IGNORE_ISOLATOR_PROPERTIES = new String[]{"groupName", "nature", "preSalesLicenseNumber", "areaStatus", "saleStatus"};
+                    BeanUtil.copyProperties(excel,data,IGNORE_ISOLATOR_PROPERTIES);
+                    String id = IdUtil.simpleUUID();
+                    data.setId(id);
+                    data.setGroupId(id);
+                    data.setCreatedId(ShiroUtils.getUserId());
+                    data.setCreatedAt(new Date());
+                    list.add(data);
+
+                }catch (Exception e){
+                    e.printStackTrace();
+                    String message = e.getMessage();
+                    excel.setReason(message);
+                    badList.add(excel);
+                }
+            }
+
+            count = list.size();
+            jsonObject.put("successCount", count);
+            jsonObject.put("errorList", badList);
+            jsonObject.put("errorCount", badList.size());
+            //保存
+            saveData();
+
+            excelList.clear();
+            list.clear();
+
+        }else {
+            throw new RuntimeException("excel无数据");
+        }
+
+
+    }
+
+    private void saveData(){
+        if (CollectionUtils.isNotEmpty(list)) {
+            parkInfoService.insertBatch(list);
+        }
+    }
+}

+ 76 - 0
pro-base/src/main/java/com/idea/buildManage/excel/ParkRoomExcel.java

@@ -0,0 +1,76 @@
+package com.idea.buildManage.excel;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class ParkRoomExcel implements Serializable {
+
+    @ExcelProperty(value = "楼盘/小区名称")
+    private String groupName;
+
+    @ExcelProperty(value = "分期名称")
+    private String discName;
+
+    @ExcelProperty(value = "单元/楼栋号")
+    private String buildNum;
+
+    @ExcelProperty(value = "户室号")
+    private String roomNo;
+
+    @ExcelProperty(value = "所在层")
+    private String floor;
+
+    @ExcelProperty(value = "预测套内面积")
+    private String predictionInternalArea;
+
+    @ExcelProperty(value = "预测分摊面积")
+    private String predictionShareArea;
+
+    @ExcelProperty(value = "预测建筑面积")
+    private String predictionBuildArea;
+
+    @ExcelProperty(value = "预测土地面积")
+    private String predictionLandArea;
+
+    @ExcelProperty(value = "实测套内面积")
+    private String actualInternalArea;
+
+    @ExcelProperty(value = "实测分摊面积")
+    private String actualShareArea;
+
+    @ExcelProperty(value = "实测建筑面积")
+    private String actualBuildArea;
+
+    @ExcelProperty(value = "实测土地面积")
+    private String actualLandArea;
+
+    @ExcelProperty(value = "用途")
+    private String roomUse;
+
+    @ExcelProperty(value = "户编号")
+    private String roomNumber;
+
+    @ExcelProperty(value = "装修情况")
+    private String decorationSituation;
+
+    @ExcelProperty(value = "2.2M以")
+    private String twoPointTwo;
+
+    @ExcelProperty(value = "户型")
+    private String houseType;
+
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+    @ExcelProperty(value = "可售状态")
+    private String saleStatus;
+
+    @ExcelIgnore
+    private String reason;
+
+}

+ 264 - 0
pro-base/src/main/java/com/idea/buildManage/excel/ParkRoomListener.java

@@ -0,0 +1,264 @@
+package com.idea.buildManage.excel;
+
+import cn.hutool.core.util.IdUtil;
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.alibaba.fastjson.JSONObject;
+import com.idea.buildManage.model.MnpBuilding;
+import com.idea.buildManage.model.ParkRoom;
+import com.idea.buildManage.service.MnpBuildingService;
+import com.idea.buildManage.service.ParkFloorDiscService;
+import com.idea.buildManage.service.ParkInfoService;
+import com.idea.buildManage.service.ParkRoomService;
+import com.rockstar.shiro.util.ShiroUtils;
+import com.rockstar.system.service.SysDictService;
+import com.rockstar.util.StringUtils;
+import org.apache.commons.collections.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+public class ParkRoomListener extends AnalysisEventListener<ParkRoomExcel> {
+
+    private List<ParkRoom> list = new ArrayList<>();
+
+    private List<ParkRoomExcel> excelList = new ArrayList<>();
+
+    private List<ParkRoomExcel> badList = new ArrayList<>();
+
+    Integer count;
+
+    private JSONObject jsonObject;
+    private ParkRoomService roomService;
+    private MnpBuildingService buildingService;
+    private ParkFloorDiscService floorDiscService;
+    private ParkInfoService parkInfoService;
+    private SysDictService sysDictService;
+
+
+    public ParkRoomListener(MnpBuildingService buildingService, ParkFloorDiscService floorDiscService,
+                            ParkInfoService parkInfoService, SysDictService sysDictService, JSONObject jsonObject) {
+        this.buildingService = buildingService;
+        this.floorDiscService = floorDiscService;
+        this.parkInfoService = parkInfoService;
+        this.sysDictService = sysDictService;
+        this.jsonObject = jsonObject;
+    }
+
+
+    @Override
+    public void invoke(ParkRoomExcel parkRoomExcel, AnalysisContext analysisContext) {
+        excelList.add(parkRoomExcel);
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+
+
+        // 用途字典
+        List<Map<String, String>> houseUsage = sysDictService.selectDictList("HOUSE_USAGE");
+        // 装修情况字典
+        List<Map<String, String>> decorationSituation = sysDictService.selectDictList("DECORATION_SITUATION");
+        // 可售状态字典
+        List<Map<String, String>> saleStatus = sysDictService.selectDictList("SALE_STATUS");
+
+
+        if(CollectionUtils.isNotEmpty(excelList)){
+            ParkRoom data;
+            ParkRoomExcel excel = null;
+            Map<String, String> buildNameIdMap = buildingService.getNameIdMap();
+            Map<String, String> discNameIdMap = floorDiscService.getNameIdMap();
+            Map<String, String> parkNameIdMap = parkInfoService.getNameIdMap();
+            for(int i = 0; i < excelList.size(); i++){
+                try {
+                    data = new ParkRoom();
+                    excel = excelList.get(i);
+                    if (StringUtils.isEmpty(excel.getGroupName())) {
+                        throw new RuntimeException("楼盘/小区名称为空");
+                    }
+                    if (StringUtils.isEmpty(excel.getDiscName())) {
+                        throw new RuntimeException("分期名称为空");
+                    }
+                    if (StringUtils.isEmpty(excel.getBuildNum())) {
+                        throw new RuntimeException("单元楼栋号为空");
+                    }
+                    // 判断小区是否存在
+                    if(StringUtils.isEmpty(parkNameIdMap.get(excel.getGroupName()))){
+                        throw new RuntimeException("楼盘/小区不存在");
+                    }
+                    data.setGroupId(parkNameIdMap.get(excel.getGroupName()));
+                    // 判断分期是否存在
+                    if(StringUtils.isEmpty(discNameIdMap.get(excel.getGroupName()))){
+                        throw new RuntimeException("分期不存在");
+                    }
+                    data.setDiscId(discNameIdMap.get(excel.getGroupName()));
+                    // 判断楼栋是否存在
+                    if(StringUtils.isEmpty(buildNameIdMap.get(excel.getBuildNum()))){
+                        throw new RuntimeException("楼栋不存在");
+                    }
+                    // 户室号
+                    if (StringUtils.isEmpty(excel.getRoomNo())) {
+                        throw new RuntimeException("户室号为空");
+                    }
+                    data.setRoomNo(excel.getRoomNo());
+                    // 所在层
+                    if (StringUtils.isEmpty(excel.getFloor())) {
+                        throw new RuntimeException("所在层为空");
+                    }
+                    data.setFloor(excel.getFloor());
+                    // 预测套内面积
+                    if (StringUtils.isEmpty(excel.getPredictionInternalArea())) {
+                        throw new RuntimeException("预测套内面积为空");
+                    }
+                    try {
+                        data.setPredictionInternalArea(Double.valueOf(excel.getPredictionInternalArea()));
+                    }catch (NumberFormatException e){
+                        throw new RuntimeException("预测套内面积格式有误");
+                    }
+                    // 预测分摊面积
+                    if (StringUtils.isEmpty(excel.getPredictionShareArea())) {
+                        throw new RuntimeException("预测分摊面积为空");
+                    }
+                    try {
+                        data.setPredictionShareArea(Double.valueOf(excel.getPredictionShareArea()));
+                    }catch (NumberFormatException e){
+                        throw new RuntimeException("预测分摊面积格式有误");
+                    }
+                    // 预测建筑面积
+                    if (StringUtils.isEmpty(excel.getPredictionBuildArea())) {
+                        throw new RuntimeException("预测建筑面积为空");
+                    }
+                    try {
+                        data.setPredictionBuildArea(Double.valueOf(excel.getPredictionBuildArea()));
+                    }catch (NumberFormatException e){
+                        throw new RuntimeException("预测建筑面积格式有误");
+                    }
+                    // 预测土地面积
+                    if (StringUtils.isEmpty(excel.getPredictionLandArea())) {
+                        throw new RuntimeException("预测土地面积为空");
+                    }
+                    try {
+                        data.setPredictionLandArea(Double.valueOf(excel.getPredictionLandArea()));
+                    }catch (NumberFormatException e){
+                        throw new RuntimeException("预测土地面积");
+                    }
+
+                    // 实测套内面积
+                    if (StringUtils.isEmpty(excel.getActualInternalArea())) {
+                        throw new RuntimeException("实测套内面积为空");
+                    }
+                    try {
+                        data.setActualInternalArea(Double.valueOf(excel.getActualInternalArea()));
+                    }catch (NumberFormatException e){
+                        throw new RuntimeException("实测套内面积格式有误");
+                    }
+                    // 实测分摊面积
+                    if (StringUtils.isEmpty(excel.getActualShareArea())) {
+                        throw new RuntimeException("实测分摊面积为空");
+                    }
+                    try {
+                        data.setActualShareArea(Double.valueOf(excel.getActualShareArea()));
+                    }catch (NumberFormatException e){
+                        throw new RuntimeException("实测分摊面积格式有误");
+                    }
+                    // 实测建筑面积
+                    if (StringUtils.isEmpty(excel.getActualBuildArea())) {
+                        throw new RuntimeException("实测建筑面积");
+                    }
+                    try {
+                        data.setActualBuildArea(Double.valueOf(excel.getActualBuildArea()));
+                    }catch (NumberFormatException e){
+                        throw new RuntimeException("预测建筑面积格式有误");
+                    }
+                    // 实测土地面积
+                    if (StringUtils.isEmpty(excel.getActualLandArea())) {
+                        throw new RuntimeException("实测土地面积");
+                    }
+                    try {
+                        data.setActualLandArea(Double.valueOf(excel.getActualLandArea()));
+                    }catch (NumberFormatException e){
+                        throw new RuntimeException("实测土地面积格式有误");
+                    }
+                    // 用途
+                    if (StringUtils.isNotEmpty(excel.getRoomUse())) {
+                        throw new RuntimeException("用途为空");
+                    }
+                    for (Map<String, String> stringStringMap : houseUsage) {
+                        if (stringStringMap.get("label").equals(excel.getRoomUse())) {
+                            data.setRoomUse(Integer.valueOf(stringStringMap.get("value")));
+                        }
+                    }
+                    // 没匹配上的情况
+                    if(data.getRoomUse() == null){
+                        throw new RuntimeException("用途格式有误");
+                    }
+                    // 户编号
+                    if (StringUtils.isNotEmpty(excel.getRoomNumber())) {
+                        throw new RuntimeException("户编号为空");
+                    }
+                    data.setRoomNumber(excel.getRoomNumber());
+                    // 装修情况
+                    if (StringUtils.isNotEmpty(excel.getDecorationSituation())) {
+                        throw new RuntimeException("装修情况为空");
+                    }
+                    for (Map<String, String> stringStringMap : decorationSituation) {
+                        if (stringStringMap.get("label").equals(excel.getDecorationSituation())) {
+                            data.setDecorationSituation(Integer.valueOf(stringStringMap.get("value")));
+                        }
+                    }
+                    // 没匹配上的情况
+                    if(data.getDecorationSituation() == null){
+                        throw new RuntimeException("装修情况格式有误");
+                    }
+                    data.setRemark(excel.getRemark());
+                    // 可售状态
+                    if (StringUtils.isNotEmpty(excel.getSaleStatus())) {
+                        throw new RuntimeException("可售状态为空");
+                    }
+                    for (Map<String, String> stringStringMap : saleStatus) {
+                        if (stringStringMap.get("label").equals(excel.getSaleStatus())) {
+                            data.setSaleStatus(Integer.valueOf(stringStringMap.get("value")));
+                        }
+                    }
+                    // 没匹配上的情况
+                    if(data.getSaleStatus() == null){
+                        throw new RuntimeException("可售状态格式有误");
+                    }
+                    data.setId(IdUtil.simpleUUID());
+                    data.setCreatedId(ShiroUtils.getUserId());
+                    data.setCreatedAt(new Date());
+                    list.add(data);
+
+                }catch (Exception e){
+                    e.printStackTrace();
+                    String message = e.getMessage();
+                    excel.setReason(message);
+                    badList.add(excel);
+                }
+
+                count = list.size();
+                jsonObject.put("successCount", count);
+                jsonObject.put("errorList", badList);
+                jsonObject.put("errorCount", badList.size());
+                //保存
+                saveData();
+
+                excelList.clear();
+                list.clear();
+            }
+        }else {
+            throw new RuntimeException("excel无数据");
+        }
+
+    }
+
+    private void saveData(){
+        if (CollectionUtils.isNotEmpty(list)) {
+            roomService.insertBatch(list);
+        }
+    }
+
+
+}

+ 13 - 0
pro-base/src/main/java/com/idea/buildManage/mapper/ParkInfoExtendMapper.java

@@ -0,0 +1,13 @@
+package com.idea.buildManage.mapper;
+
+import com.idea.buildManage.model.ParkFloorDisc;
+import com.idea.buildManage.model.ParkInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ParkInfoExtendMapper {
+
+    int insertBatch(@Param("list") List<ParkInfo> record);
+
+}

+ 13 - 4
pro-base/src/main/java/com/idea/buildManage/service/MnpBuildingService.java

@@ -6,19 +6,21 @@ import com.github.pagehelper.PageInfo;
 import com.idea.buildManage.dto.MnpBuildingDto;
 import com.idea.buildManage.mapper.MnpBuildingExtendMapper;
 import com.idea.buildManage.mapper.MnpBuildingMapper;
-import com.idea.buildManage.model.MnpBuilding;
-import com.idea.buildManage.model.MnpBuildingExample;
-import com.idea.buildManage.model.ParkRoomExample;
+import com.idea.buildManage.model.*;
 import com.rockstar.common.base.BaseService;
 import com.rockstar.frame.mapper.FrameDataMapper;
 import com.rockstar.frame.model.extend.DateTrans;
 import com.rockstar.frame.model.extend.Tablepar;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class MnpBuildingService implements BaseService<MnpBuilding, MnpBuildingExample> {
@@ -153,6 +155,13 @@ public class MnpBuildingService implements BaseService<MnpBuilding, MnpBuildingE
         extendMapper.batchInsert(list);
     }
 
-
+    public Map<String,String> getNameIdMap() {
+        Map<String, String> map = new HashMap<>();
+        List<MnpBuilding> list = selectByExample(new MnpBuildingExample());
+        if (CollectionUtils.isNotEmpty(list)) {
+            map = list.stream().collect(Collectors.toMap(MnpBuilding::getBuildNum, MnpBuilding::getId, (v1, v2) ->v1));
+        }
+        return map;
+    }
 
 }

+ 1 - 1
pro-base/src/main/java/com/idea/buildManage/service/ParkFloorDiscService.java

@@ -219,7 +219,7 @@ public class ParkFloorDiscService implements BaseService<ParkFloorDisc, ParkFloo
     }
 
     public void insertBatch(List<ParkFloorDisc> list){
-
+            extendMapper.insertBatch(list);
     }
 
 

+ 10 - 0
pro-base/src/main/java/com/idea/buildManage/service/ParkInfoService.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.idea.buildManage.mapper.ParkFloorDiscExtendMapper;
 import com.idea.buildManage.mapper.ParkFloorDiscMapper;
+import com.idea.buildManage.mapper.ParkInfoExtendMapper;
 import com.idea.buildManage.mapper.ParkInfoMapper;
 import com.idea.buildManage.model.*;
 import com.rockstar.common.base.BaseService;
@@ -44,6 +45,8 @@ public class ParkInfoService implements BaseService<ParkInfo, ParkInfoExample> {
     private MnpBuildingService mnpBuildingService;
     @Autowired
     private ParkFloorDiscExtendMapper extendMapper;
+    @Autowired
+    private ParkInfoExtendMapper infoExtendMapper;
 
     /**
      * 分页查询
@@ -355,4 +358,11 @@ public class ParkInfoService implements BaseService<ParkInfo, ParkInfoExample> {
         return map;
     }
 
+    /**
+     * 批量导入
+     * @param list
+     */
+    public void insertBatch(List<ParkInfo> list) {
+        infoExtendMapper.insertBatch(list);
+    }
 }

+ 8 - 1
pro-base/src/main/java/com/idea/buildManage/service/ParkRoomService.java

@@ -8,6 +8,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.idea.buildManage.mapper.ParkRoomExtendMapper;
 import com.idea.buildManage.mapper.ParkRoomMapper;
+import com.idea.buildManage.model.MnpBuilding;
 import com.idea.buildManage.model.ParkRoom;
 import com.idea.buildManage.model.ParkRoomExample;
 import com.idea.buildManage.response.ParkRoomResponse;
@@ -184,6 +185,12 @@ public class ParkRoomService implements BaseService<ParkRoom, ParkRoomExample> {
         return area.doubleValue();
     }
 
-
+    /**
+     * 批量插入
+     * @param list
+     */
+    public void insertBatch(List<ParkRoom> list){
+        extendMapper.insertBatch(list);
+    }
 
 }

+ 9 - 9
pro-base/src/main/resources/mybatis/buildManage/MnpBuildingExtendMapper.xml

@@ -14,15 +14,15 @@
     )
     values
     <foreach collection="list" item="item" separator=",">
-      (#{id,jdbcType=VARCHAR}, #{groupId,jdbcType=VARCHAR}, #{groupName,jdbcType=VARCHAR},
-      #{discId,jdbcType=VARCHAR}, #{discName,jdbcType=VARCHAR}, #{orderNum,jdbcType=INTEGER},
-      #{buildNum,jdbcType=VARCHAR}, #{constructionNum,jdbcType=VARCHAR}, #{area,jdbcType=DOUBLE},
-      #{residentialArea,jdbcType=DOUBLE}, #{unResidentialArea,jdbcType=DOUBLE}, #{coverAnArea,jdbcType=DOUBLE},
-      #{undergroundArea,jdbcType=DOUBLE}, #{roomNum,jdbcType=VARCHAR}, #{numberInfo,jdbcType=VARCHAR},
-      #{floors,jdbcType=INTEGER}, #{overgroundFloors,jdbcType=INTEGER}, #{undergroundFloors,jdbcType=INTEGER},
-      #{structure,jdbcType=VARCHAR}, #{regionalismCode,jdbcType=VARCHAR}, #{landCode,jdbcType=VARCHAR},
-      #{createdId,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
-      #{updatedId,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{priceRemark,jdbcType=LONGVARCHAR}
+      (#{item.id,jdbcType=VARCHAR}, #{item.groupId,jdbcType=VARCHAR}, #{item.groupName,jdbcType=VARCHAR},
+      #{item.discId,jdbcType=VARCHAR}, #{item.discName,jdbcType=VARCHAR}, #{item.orderNum,jdbcType=INTEGER},
+      #{item.buildNum,jdbcType=VARCHAR}, #{item.constructionNum,jdbcType=VARCHAR}, #{item.area,jdbcType=DOUBLE},
+      #{item.residentialArea,jdbcType=DOUBLE}, #{item.unResidentialArea,jdbcType=DOUBLE}, #{item.coverAnArea,jdbcType=DOUBLE},
+      #{item.undergroundArea,jdbcType=DOUBLE}, #{item.roomNum,jdbcType=VARCHAR}, #{item.numberInfo,jdbcType=VARCHAR},
+      #{item.floors,jdbcType=INTEGER}, #{item.overgroundFloors,jdbcType=INTEGER}, #{item.undergroundFloors,jdbcType=INTEGER},
+      #{item.structure,jdbcType=VARCHAR}, #{item.regionalismCode,jdbcType=VARCHAR}, #{item.landCode,jdbcType=VARCHAR},
+      #{item.createdId,jdbcType=VARCHAR}, #{item.createdAt,jdbcType=TIMESTAMP}, #{item.updatedAt,jdbcType=TIMESTAMP},
+      #{item.updatedId,jdbcType=VARCHAR}, #{item.remark,jdbcType=LONGVARCHAR}, #{item.priceRemark,jdbcType=LONGVARCHAR}
       )
     </foreach>
   </insert>

+ 5 - 5
pro-base/src/main/resources/mybatis/buildManage/ParkFloorDiscExtendMapper.xml

@@ -40,11 +40,11 @@
                                      updated_at)
         values
         <foreach collection="list" item="item" separator=",">
-            (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{groupId,jdbcType=VARCHAR},
-            #{unitPrice,jdbcType=DECIMAL}, #{propertyUnitPrice,jdbcType=DECIMAL}, #{maintenanceFunds,jdbcType=DECIMAL},
-            #{subscriptionFunds,jdbcType=DECIMAL}, #{proportion,jdbcType=DOUBLE}, #{paymentMethods,jdbcType=INTEGER},
-            #{createdId,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedId,jdbcType=VARCHAR},
-            #{updatedAt,jdbcType=TIMESTAMP})
+            (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.groupId,jdbcType=VARCHAR},
+            #{item.unitPrice,jdbcType=DECIMAL}, #{item.propertyUnitPrice,jdbcType=DECIMAL}, #{item.maintenanceFunds,jdbcType=DECIMAL},
+            #{item.subscriptionFunds,jdbcType=DECIMAL}, #{item.proportion,jdbcType=DOUBLE}, #{item.paymentMethods,jdbcType=INTEGER},
+            #{item.createdId,jdbcType=VARCHAR}, #{item.createdAt,jdbcType=TIMESTAMP}, #{item.updatedId,jdbcType=VARCHAR},
+            #{item.updatedAt,jdbcType=TIMESTAMP})
         </foreach>
     </insert>
 

+ 32 - 0
pro-base/src/main/resources/mybatis/buildManage/ParkInfoExtendMapper.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.idea.buildManage.mapper.ParkInfoExtendMapper">
+
+
+  <insert id="insertBatch">
+
+    insert into park_info (id, group_id, group_name,
+                           created_id, created_at, updated_at,
+                           nature, pre_sales_license_number, company_id,
+                           build_area, land_area, project_approval_document,
+                           engineering_planning_permit, construction_permit,
+                           land_certificate_number, land_use_permit_number,
+                           volume_ratio, green_ratio, price,
+                           exceeded_price, area_status, sale_status,
+                           regionalism_code, address, introduction
+    )
+    values
+      <foreach collection="list" item="item" separator=",">
+        (#{item.id,jdbcType=VARCHAR}, #{item.groupId,jdbcType=VARCHAR}, #{item.groupName,jdbcType=VARCHAR},
+            #{item.createdId,jdbcType=VARCHAR}, #{item.createdAt,jdbcType=TIMESTAMP}, #{item.updatedAt,jdbcType=TIMESTAMP},
+            #{item.nature,jdbcType=VARCHAR}, #{item.preSalesLicenseNumber,jdbcType=VARCHAR}, #{item.companyId,jdbcType=VARCHAR},
+            #{item.buildArea,jdbcType=DOUBLE}, #{item.landArea,jdbcType=DOUBLE}, #{item.projectApprovalDocument,jdbcType=VARCHAR},
+            #{item.engineeringPlanningPermit,jdbcType=VARCHAR}, #{item.constructionPermit,jdbcType=VARCHAR},
+            #{item.landCertificateNumber,jdbcType=VARCHAR}, #{item.landUsePermitNumber,jdbcType=VARCHAR},
+            #{item.volumeRatio,jdbcType=DOUBLE}, #{item.greenRatio,jdbcType=DOUBLE}, #{item.price,jdbcType=DECIMAL},
+            #{item.exceededPrice,jdbcType=DECIMAL}, #{item.areaStatus,jdbcType=INTEGER}, #{item.saleStatus,jdbcType=INTEGER},
+            #{item.regionalismCode,jdbcType=VARCHAR}, #{item.address,jdbcType=VARCHAR}, #{item.introduction,jdbcType=LONGVARCHAR}
+           )
+      </foreach>
+  </insert>
+</mapper>

+ 10 - 10
pro-base/src/main/resources/mybatis/buildManage/ParkRoomExtendMapper.xml

@@ -57,16 +57,16 @@
                            two_point_two, remark)
     values
     <foreach collection="list" item="item" separator=",">
-      (#{id,jdbcType=VARCHAR}, #{buildId,jdbcType=VARCHAR}, #{discId,jdbcType=VARCHAR},
-      #{groupId,jdbcType=VARCHAR}, #{roomNo,jdbcType=VARCHAR}, #{floor,jdbcType=VARCHAR},
-      #{predictionInternalArea,jdbcType=DOUBLE}, #{predictionShareArea,jdbcType=DOUBLE},
-      #{predictionBuildArea,jdbcType=DOUBLE}, #{predictionLandArea,jdbcType=DOUBLE},
-      #{actualInternalArea,jdbcType=DOUBLE}, #{actualShareArea,jdbcType=DOUBLE}, #{actualBuildArea,jdbcType=DOUBLE},
-      #{actualLandArea,jdbcType=DOUBLE}, #{roomUse,jdbcType=INTEGER}, #{roomNumber,jdbcType=VARCHAR},
-      #{decorationSituation,jdbcType=INTEGER}, #{houseTypeId,jdbcType=VARCHAR}, #{houseTypePicture,jdbcType=VARCHAR},
-      #{createdId,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
-      #{updatedId,jdbcType=VARCHAR}, #{saleStatus,jdbcType=INTEGER}, #{soldStatus,jdbcType=INTEGER},
-      #{twoPointTwo,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR})
+      (#{item.id,jdbcType=VARCHAR}, #{item.buildId,jdbcType=VARCHAR}, #{item.discId,jdbcType=VARCHAR},
+      #{item.groupId,jdbcType=VARCHAR}, #{item.roomNo,jdbcType=VARCHAR}, #{item.floor,jdbcType=VARCHAR},
+      #{item.predictionInternalArea,jdbcType=DOUBLE}, #{item.predictionShareArea,jdbcType=DOUBLE},
+      #{item.predictionBuildArea,jdbcType=DOUBLE}, #{item.predictionLandArea,jdbcType=DOUBLE},
+      #{item.actualInternalArea,jdbcType=DOUBLE}, #{item.actualShareArea,jdbcType=DOUBLE}, #{item.actualBuildArea,jdbcType=DOUBLE},
+      #{item.actualLandArea,jdbcType=DOUBLE}, #{item.roomUse,jdbcType=INTEGER}, #{item.roomNumber,jdbcType=VARCHAR},
+      #{item.decorationSituation,jdbcType=INTEGER}, #{item.houseTypeId,jdbcType=VARCHAR}, #{item.houseTypePicture,jdbcType=VARCHAR},
+      #{item.createdId,jdbcType=VARCHAR}, #{item.createdAt,jdbcType=TIMESTAMP}, #{item.updatedAt,jdbcType=TIMESTAMP},
+      #{item.updatedId,jdbcType=VARCHAR}, #{item.saleStatus,jdbcType=INTEGER}, #{item.soldStatus,jdbcType=INTEGER},
+      #{item.twoPointTwo,jdbcType=VARCHAR}, #{item.remark,jdbcType=LONGVARCHAR})
     </foreach>
   </insert>
 

+ 2 - 2
pro-main/src/main/resources/application.yml

@@ -9,8 +9,8 @@ rock:
   #上传文件尺寸 默认200M
   fileSize: 209715200
   #上传路径
-#  profile: /home/project/snap_manage/upload/
-  profile: d:/upload/pro/
+  profile: /home/project/snap_manage/upload/
+#  profile: d:/upload/pro/
   # 服务器运维管理
   ops:
     tag: server