From 82a5383c0931faf76391ca0983813f1f1836ee15 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 21 五月 2026 13:23:36 +0800
Subject: [PATCH] 增加日志
---
src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java | 49 ++++++++++++++++++++++++++++++++++---------------
1 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java b/src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java
index 85ff013..a00cf7d 100644
--- a/src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java
+++ b/src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java
@@ -4,6 +4,8 @@
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.staff.dto.PerformanceShiftAddDto;
import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig;
@@ -17,6 +19,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.Collection;
@@ -41,24 +44,28 @@
@ApiOperation("浜哄憳鎺掔彮")
@PostMapping("/add")
+ @Log(title = "浜哄憳鎺掔彮", businessType = BusinessType.INSERT)
public R add(@RequestBody PerformanceShiftAddDto performanceShiftAddDto){
return R.ok(personalShiftService.performanceShiftAdd(performanceShiftAddDto));
}
@ApiOperation(value = "鏈堜唤鍒嗛〉鏌ヨ")
@GetMapping("page")
+ @Log(title = "鏈堜唤鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
public R performanceShiftPage(Integer size, Integer current, String time, String userName, Integer sysDeptId) {
return R.ok(personalShiftService.performanceShiftPage(new Page<>(current, size), time, userName, sysDeptId));
}
@ApiOperation(value = "骞翠唤鍒嗛〉鏌ヨ")
@GetMapping("pageYear")
+ @Log(title = "骞翠唤鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
public R performanceShiftPageYear(Integer size, Integer current, String time, String userName, Integer sysDeptId) {
return R.ok(personalShiftService.performanceShiftPageYear(new Page<>(current, size), time, userName, sysDeptId));
}
@ApiOperation(value = "鐝鐘舵�佷慨鏀�")
@PostMapping("update")
+ @Log(title = "鐝鐘舵�佷慨鏀�", businessType = BusinessType.UPDATE)
public R performanceShiftUpdate(@RequestBody PersonalShift personalShift) {
personalShiftService.performanceShiftUpdate(personalShift);
return R.ok();
@@ -66,32 +73,44 @@
@ApiOperation(value = "瀵煎嚭")
@GetMapping("export")
+ @Log(title = "瀵煎嚭", businessType = BusinessType.EXPORT)
public void exportToExcel(@NotNull(message = "鏃堕棿涓嶈兘涓虹┖锛�") String time, String userName, Integer sysDeptId, Boolean isMonth, HttpServletResponse response) throws Exception {
- Map<Object, Object> data;
+ ServletOutputStream out = response.getOutputStream();
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
- response.setHeader("requestType","excel");
- response.setHeader("Access-Control-Expose-Headers", "requestType");
+ response.setCharacterEncoding("utf-8");
+ response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + time + ".xlsx");
+
if (!isMonth) {
- data = personalShiftService.exportToYearExcel(time, userName, sysDeptId);
- // 璁剧疆鍗曞厓鏍兼牱寮�
- HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleYearUtils.getHeadStyle(), StyleYearUtils.getContentStyle());
- // 淇濆瓨鍒扮涓�涓猻heet涓�
- EasyExcel.write(response.getOutputStream())
+ Map<Object, Object> data = personalShiftService.exportToYearExcel(time, userName, sysDeptId);
+
+ HorizontalCellStyleStrategy style = new HorizontalCellStyleStrategy(
+ StyleYearUtils.getHeadStyle(),
+ StyleYearUtils.getContentStyle()
+ );
+
+ EasyExcel.write(out)
.head((List<List<String>>) data.get("header"))
- .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // 鑷�傚簲鍒楀
- .registerWriteHandler(horizontalCellStyleStrategy)
+ .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+ .registerWriteHandler(style)
.sheet("骞村害")
.doWrite((Collection<?>) data.get("data"));
+
} else {
- data = personalShiftService.exportToMonthExcel(time, userName, sysDeptId);
- // 璁剧疆鍗曞厓鏍兼牱寮�
- HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleMonthUtils.getHeadStyle(), StyleMonthUtils.getContentStyle());
- EasyExcel.write(response.getOutputStream())
+ Map<Object, Object> data = personalShiftService.exportToMonthExcel(time, userName, sysDeptId);
+
+ HorizontalCellStyleStrategy style = new HorizontalCellStyleStrategy(
+ StyleMonthUtils.getHeadStyle(),
+ StyleMonthUtils.getContentStyle()
+ );
+
+ EasyExcel.write(out)
.head((List<List<String>>) data.get("header"))
- .registerWriteHandler(horizontalCellStyleStrategy)
+ .registerWriteHandler(style)
.sheet("鏈堝害")
.doWrite((Collection<?>) data.get("data"));
}
+
+ out.flush();
}
--
Gitblit v1.9.3