|
@@ -1,16 +1,14 @@
|
|
|
package com.fjhx.acc.controller;
|
|
|
|
|
|
-import com.alibaba.excel.EasyExcel;
|
|
|
import com.fjhx.acc.service.AccAccountService;
|
|
|
-import com.fjhx.applet.utils.OssUtil;
|
|
|
import com.fjhx.params.acc.AccountExcel;
|
|
|
import lombok.SneakyThrows;
|
|
|
+import org.springblade.core.excel.util.ExcelUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.io.ByteArrayInputStream;
|
|
|
-import java.io.ByteArrayOutputStream;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -29,16 +27,16 @@ public class AccAccountController {
|
|
|
@Autowired
|
|
|
private AccAccountService accAccountService;
|
|
|
|
|
|
- @SneakyThrows
|
|
|
@GetMapping("/refreshPassword")
|
|
|
- public R refreshPassword() {
|
|
|
+ public void refreshPassword(HttpServletResponse response) {
|
|
|
List<AccountExcel> list = accAccountService.refreshPassword();
|
|
|
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
|
- EasyExcel.write(byteArrayOutputStream, AccountExcel.class).sheet("员工账号密码").doWrite(list);
|
|
|
- byte[] bytes = byteArrayOutputStream.toByteArray();
|
|
|
- OssUtil.uploadFile("password.xlsx", new ByteArrayInputStream(bytes));
|
|
|
- byteArrayOutputStream.close();
|
|
|
- return R.success();
|
|
|
+ ExcelUtil.export(response, "员工密码", "员工密码", list, AccountExcel.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/refreshPasswordTest")
|
|
|
+ public void refreshPasswordTest(HttpServletResponse response) {
|
|
|
+ List<AccountExcel> list = accAccountService.refreshPasswordTest();
|
|
|
+ ExcelUtil.export(response, "员工密码", "员工密码", list, AccountExcel.class);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/updatePassword")
|