|
@@ -0,0 +1,110 @@
|
|
|
+package com.slibra.web.controller.business;
|
|
|
+
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
+import com.slibra.business.req.AiChatReq;
|
|
|
+import com.slibra.business.req.AiChatRes;
|
|
|
+import com.slibra.business.res.BZXQLHInfo;
|
|
|
+import com.slibra.business.service.IFrontService;
|
|
|
+import com.slibra.common.core.controller.BaseController;
|
|
|
+import com.slibra.common.core.domain.AjaxResult;
|
|
|
+import com.slibra.common.core.domain.entity.SysUser;
|
|
|
+import com.slibra.common.utils.poi.ExcelUtil;
|
|
|
+import io.micrometer.core.annotation.Timed;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.checkerframework.checker.units.qual.C;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 大模型的相关接口
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/excel")
|
|
|
+@Slf4j
|
|
|
+public class ExcelController extends BaseController {
|
|
|
+
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ System.out.println(getExcelFormBZXQLH());;
|
|
|
+ }
|
|
|
+
|
|
|
+ //泵站、小区、楼号数据处理
|
|
|
+ public static List<BZXQLHInfo> getExcelFormBZXQLH() {
|
|
|
+ File file = new File("/Users/wangmiaomiao/Documents/Excel/demo.xlsx");
|
|
|
+ ExcelUtil<BZXQLHInfo> util = new ExcelUtil<BZXQLHInfo>(BZXQLHInfo.class);
|
|
|
+ List<BZXQLHInfo> dataList;
|
|
|
+ try {
|
|
|
+ dataList = util.importExcel("小区泵站信息", Files.newInputStream(file.toPath()), 1);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 需要操作:
|
|
|
+ * 插入泵站、插入小区、插入楼号、
|
|
|
+ * 插入小区和楼号关系表
|
|
|
+ * 插入泵站和小区楼号关系表
|
|
|
+ *
|
|
|
+ * 操作逻辑:
|
|
|
+ * 先按【区域】+【小区】分组,添加小区,然后获取楼号集合,添加楼号、楼号和小区的绑定关系。
|
|
|
+ * 插入数据库。
|
|
|
+ * 此次任务结束。
|
|
|
+ *
|
|
|
+ * 再次便利集合,一条一条匹配,然后再添加泵站【需要校验是否已经添加过了】,然后再绑定关系
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/moreExcel2DB")
|
|
|
+ public String moreExcel2DB(){
|
|
|
+ //Excel转JSON
|
|
|
+ List<BZXQLHInfo> excelFormBZXQLH = getExcelFormBZXQLH();
|
|
|
+ int size = 0;
|
|
|
+ if(!CollectionUtils.isEmpty(excelFormBZXQLH)){
|
|
|
+ size = excelFormBZXQLH.size();
|
|
|
+ //处理业务数据
|
|
|
+ //逻辑:
|
|
|
+ }
|
|
|
+
|
|
|
+ return "操作成功,新增泵站关联小区楼号" + size + "条";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|