From 49251095c2cc2414064270aa6c9175463c56ad20 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期五, 20 六月 2025 14:31:17 +0800
Subject: [PATCH] 修改bug 调整需求

---
 springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/api/DepartmentController.java |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/api/DepartmentController.java b/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/api/DepartmentController.java
index bb96718..46802b7 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/api/DepartmentController.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/api/DepartmentController.java
@@ -16,6 +16,7 @@
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import java.util.*;
@@ -226,4 +227,26 @@
 		List<Department> list = departmentService.list(new LambdaQueryWrapper<Department>().eq(Department::getTier, tier));
 		return R.ok(list);
 	}
+
+
+
+	@ResponseBody
+	@PostMapping("/importDepartment")
+	@ApiOperation(value = "单位导入", tags = {"西区纪委后台-单位管理"})
+	public R<?> importDepartment(MultipartFile file) {
+		String s = file.getOriginalFilename();
+		if (s == null || !("xls".equals(s.substring(s.lastIndexOf(".") + 1)) || "xlsx".equals(s.substring(s.lastIndexOf(".") + 1)))) {
+			return R.fail("只能上传.xls或.xlsx格式的文件");
+		}
+		SystemUserVo loginUserInfoWest = getLoginUserInfoWest();
+		String name = loginUserInfoWest.getName();
+		Integer id = loginUserInfoWest.getId();
+		try {
+			return departmentService.importDepartment(s, file,name,id);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return R.ok();
+	}
+
 }

--
Gitblit v1.7.1