Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
c5bc8d14c6
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.common.security.config;
|
||||
|
||||
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.global.SystemGlobal;
|
||||
import com.bonus.common.security.interceptor.ReadHttpRequestWrapper;
|
||||
|
|
@ -29,7 +30,10 @@ public class MyFilter extends OncePerRequestFilter {
|
|||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
log.debug("进入MyFilter过滤器,parameterMap");
|
||||
// System.err.println(request.getRequestURI());
|
||||
if (SystemGlobal.POST.equals(request.getMethod()) || SystemGlobal.PUT.equals(request.getMethod()) ){
|
||||
String head=request.getHeader(SecurityConstants.FROM_SOURCE);
|
||||
if(SecurityConstants.INNER.equals(head)){
|
||||
filterChain.doFilter(request, response);
|
||||
}else if (SystemGlobal.POST.equals(request.getMethod()) || SystemGlobal.PUT.equals(request.getMethod()) ){
|
||||
//去除文件上传
|
||||
String header = request.getHeader(HttpHeaders.CONTENT_TYPE);
|
||||
if(StringUtils.isNotEmpty(header)){
|
||||
|
|
@ -46,4 +50,4 @@ public class MyFilter extends OncePerRequestFilter {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.common.security.interceptor;
|
||||
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.context.SecurityContextHolder;
|
||||
import com.bonus.common.core.utils.SafeUtil;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
|
|
@ -52,6 +53,10 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor {
|
|||
if (isFileUpload(request)) {
|
||||
return true;
|
||||
}
|
||||
String head=request.getHeader(SecurityConstants.FROM_SOURCE);
|
||||
if(SecurityConstants.INNER.equals(head)){
|
||||
return true;
|
||||
}
|
||||
|
||||
String requestUrl = request.getRequestURI();
|
||||
if (isWhiteUrl(requestUrl)){
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ import java.nio.file.Files;
|
|||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@RestController
|
||||
|
|
@ -43,43 +41,12 @@ public class ZipDownloadController {
|
|||
private FileUploadUtils fileUploadUtils;
|
||||
|
||||
private static final String TASK_PREFIX = "zip_task:"; // key 前缀
|
||||
private static final long TASK_EXPIRE_SECONDS = 2 * 3600; // 2小时过期
|
||||
|
||||
private final ExecutorService executor = Executors.newFixedThreadPool(4);
|
||||
|
||||
private static final MinioClient minioClient = MinioClient.builder()
|
||||
.endpoint("http://192.168.0.14:9090")
|
||||
.credentials("minio", "bonus@admin123")
|
||||
.build();
|
||||
private static final String bucket = "realname";
|
||||
|
||||
@PostMapping("/createZipTask")
|
||||
public ResponseEntity<DownloadTask> createZipTask(@RequestBody BmWorkerAtt o) {
|
||||
//查询文件地址
|
||||
List<ZipFileMapping> objectNames = service.getFileList(o);
|
||||
DownloadTask task = fileUploadUtils.zipFile(objectNames);
|
||||
// String taskId = UUID.randomUUID().toString();
|
||||
// String redisKey = TASK_PREFIX + taskId;
|
||||
//
|
||||
// DownloadTask task = new DownloadTask(taskId);
|
||||
// // 保存到 Redis,设置过期时间
|
||||
// redisTemplate.opsForValue().set(redisKey, task, TASK_EXPIRE_SECONDS, TimeUnit.SECONDS);
|
||||
// // 异步执行打包
|
||||
// executor.submit(() -> {
|
||||
// try {
|
||||
// String zipName = taskId + ".zip";
|
||||
// String zipPath = "/tmp/downloads/" + zipName;
|
||||
// generateZipFromMinIO(minioClient, bucket, objectNames, zipPath);
|
||||
// // 更新任务状态
|
||||
// task.setStatus("completed");
|
||||
// task.setDownloadUrl("/" + zipName);
|
||||
// redisTemplate.opsForValue().set(redisKey, task, TASK_EXPIRE_SECONDS, TimeUnit.SECONDS);
|
||||
// } catch (Exception e) {
|
||||
// task.setStatus("failed");
|
||||
// task.setErrorMessage(e.getMessage());
|
||||
// redisTemplate.opsForValue().set(redisKey, task, TASK_EXPIRE_SECONDS, TimeUnit.SECONDS);
|
||||
// }
|
||||
// });
|
||||
return ResponseEntity.accepted().body(task);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -235,6 +235,10 @@ public class FileUtilController {
|
|||
|
||||
@PostMapping("/zipFile")
|
||||
public R<DownloadTask> zipFile(@RequestBody List<ZipFileMapping> objectNames) {
|
||||
if (objectNames == null || objectNames.isEmpty()) {
|
||||
log.warn("Received null or empty zip file list");
|
||||
return R.fail("文件列表不能为空");
|
||||
}
|
||||
return R.ok(service.zipFile(objectNames));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,30 +42,30 @@ public class ThreeTableOneRosterTask {
|
|||
public void createThreeTableOneRosterData(){
|
||||
try{
|
||||
// 获取当前年月
|
||||
// YearMonth current = YearMonth.now();
|
||||
// // 获取上一个月
|
||||
// YearMonth lastMonth = current.minusMonths(1);
|
||||
// // 本月第一天
|
||||
// LocalDate firstDayOfThisMonth = YearMonth.now().atDay(1);
|
||||
// // 上个月第一天:先得到本月第一天,再减一个月
|
||||
// LocalDate firstDayOfLastMonth = YearMonth.now().minusMonths(1).atDay(1);
|
||||
//
|
||||
// // 获取上一个月的天数(即该月最后一天是几号)
|
||||
// int daysInLastMonth = lastMonth.lengthOfMonth();
|
||||
//
|
||||
// String startTime = firstDayOfLastMonth.format(FORMATTER)+" 00:00:00";
|
||||
// String endTime = firstDayOfThisMonth.format(FORMATTER)+" 00:00:00";
|
||||
YearMonth current = YearMonth.now();
|
||||
// 获取上一个月
|
||||
YearMonth lastMonth = current.minusMonths(1);
|
||||
// 本月第一天
|
||||
LocalDate firstDayOfThisMonth = YearMonth.now().atDay(1);
|
||||
// 上个月第一天:先得到本月第一天,再减一个月
|
||||
LocalDate firstDayOfLastMonth = YearMonth.now().minusMonths(1).atDay(1);
|
||||
|
||||
// 获取上一个月的天数(即该月最后一天是几号)
|
||||
int daysInLastMonth = lastMonth.lengthOfMonth();
|
||||
|
||||
String startTime = firstDayOfLastMonth.format(FORMATTER)+" 00:00:00";
|
||||
String endTime = firstDayOfThisMonth.format(FORMATTER)+" 00:00:00";
|
||||
|
||||
|
||||
// // 获取当前年月
|
||||
String current = "2025-12";
|
||||
// 获取上一个月
|
||||
String lastMonth = "2025-11";
|
||||
// 获取上一个月的天数(即该月最后一天是几号)
|
||||
int daysInLastMonth = 30;
|
||||
|
||||
String startTime = "2025-10-01"+" 00:00:00";
|
||||
String endTime = "2025-11-01"+" 00:00:00";
|
||||
// String current = "2025-12";
|
||||
// // 获取上一个月
|
||||
// String lastMonth = "2025-11";
|
||||
// // 获取上一个月的天数(即该月最后一天是几号)
|
||||
// int daysInLastMonth = 30;
|
||||
//
|
||||
// String startTime = "2025-10-01"+" 00:00:00";
|
||||
// String endTime = "2025-11-01"+" 00:00:00";
|
||||
|
||||
|
||||
//先去检测上一月是否已经生成三表一册
|
||||
|
|
@ -87,7 +87,7 @@ public class ThreeTableOneRosterTask {
|
|||
//3.考勤明细表
|
||||
List<ThreeTableOneRosterPo> listAtt = mapper.getWorkerAttData(lastMonth.toString(),mapBeanVo.getId());
|
||||
//YearMonth.parse(lastMonth)
|
||||
List<ThreeTableOneRosterPo> listAttDeal = dealAttData(listAtt,YearMonth.parse(lastMonth));
|
||||
List<ThreeTableOneRosterPo> listAttDeal = dealAttData(listAtt,YearMonth.parse(lastMonth.toString()));
|
||||
//4.农民工资支付表
|
||||
// 数据串联生成工资支付数据
|
||||
// 通过workerId,proId将listApply、listAttDeal数据填充到listRoster
|
||||
|
|
|
|||
Loading…
Reference in New Issue