Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -210,6 +210,10 @@ api-decrypt:
|
||||
- /gps/equipment/dataAcceptance # GPS数据接收接口
|
||||
|
||||
springdoc:
|
||||
default-flat-param-object: true
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
tags-sorter: alpha
|
||||
api-docs:
|
||||
# 是否开启接口文档
|
||||
enabled: true
|
||||
@ -229,10 +233,14 @@ springdoc:
|
||||
components:
|
||||
# 鉴权方式配置
|
||||
security-schemes:
|
||||
apiKey:
|
||||
type: APIKEY
|
||||
Authorization:
|
||||
type: HTTP
|
||||
in: HEADER
|
||||
name: ${sa-token.token-name}
|
||||
Clientid:
|
||||
type: HTTP
|
||||
in: HEADER
|
||||
name: Clientid
|
||||
#这里定义了两个分组,可定义多个,也可以不定义
|
||||
group-configs:
|
||||
- group: 1.通用模块
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package org.dromara.common.doc.config;
|
||||
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.Paths;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
@ -9,6 +11,7 @@ import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.doc.config.properties.SpringDocProperties;
|
||||
import org.dromara.common.doc.handler.OpenApiHandler;
|
||||
import org.springdoc.core.configuration.SpringDocConfiguration;
|
||||
import org.springdoc.core.customizers.GlobalOpenApiCustomizer;
|
||||
import org.springdoc.core.customizers.OpenApiBuilderCustomizer;
|
||||
import org.springdoc.core.customizers.OpenApiCustomizer;
|
||||
import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
|
||||
@ -23,6 +26,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -61,7 +65,6 @@ public class SpringDocConfig {
|
||||
keySet.forEach(securityRequirement::addList);
|
||||
list.add(securityRequirement);
|
||||
openApi.security(list);
|
||||
|
||||
return openApi;
|
||||
}
|
||||
|
||||
@ -107,6 +110,15 @@ public class SpringDocConfig {
|
||||
}
|
||||
PlusPaths newPaths = new PlusPaths();
|
||||
oldPaths.forEach((k, v) -> newPaths.addPathItem(finalContextPath + k, v));
|
||||
newPaths.forEach((s, pathItem) -> {
|
||||
// 为所有接口添加鉴权
|
||||
pathItem.readOperations().forEach(operation -> {
|
||||
operation.addSecurityItem(new SecurityRequirement()
|
||||
.addList(HttpHeaders.AUTHORIZATION)
|
||||
.addList("Clientid")
|
||||
);
|
||||
});
|
||||
});
|
||||
openApi.setPaths(newPaths);
|
||||
};
|
||||
}
|
||||
@ -123,4 +135,26 @@ public class SpringDocConfig {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public GlobalOpenApiCustomizer orderGlobalOpenApiCustomizer() {
|
||||
return openApi -> {
|
||||
// 全局添加鉴权参数
|
||||
if(openApi.getPaths()!=null){
|
||||
openApi.getPaths().forEach((s, pathItem) -> {
|
||||
// 为所有接口添加鉴权
|
||||
List<Operation> operations = pathItem.readOperations();
|
||||
operations.forEach(operation -> {
|
||||
operation.addSecurityItem(new SecurityRequirement()
|
||||
.addList(HttpHeaders.AUTHORIZATION)
|
||||
.addList("Clientid")
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -57,4 +57,8 @@ public class BusPlanDocAssociationVo implements Serializable {
|
||||
* 需求数量
|
||||
*/
|
||||
private BigDecimal demandQuantity;
|
||||
|
||||
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
||||
@ -53,4 +53,9 @@ public class SubConstructionUserFileTemplateReq implements Serializable {
|
||||
*/
|
||||
private List<Long> userIdList;
|
||||
|
||||
/**
|
||||
* 用户角色
|
||||
*/
|
||||
private String userRole;
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package org.dromara.contractor.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
@ -17,6 +18,7 @@ import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.core.utils.file.FileUtils;
|
||||
import org.dromara.common.utils.IdCardEncryptorUtil;
|
||||
import org.dromara.contractor.constant.SubConstructionUserConstant;
|
||||
import org.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.domain.SubConstructionUserFile;
|
||||
@ -32,7 +34,6 @@ import org.dromara.project.domain.BusConstructionBlacklist;
|
||||
import org.dromara.project.domain.BusProject;
|
||||
import org.dromara.project.service.IBusConstructionBlacklistService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.safety.service.IWgzQuestionSavePdfService;
|
||||
import org.dromara.system.domain.vo.SysDictDataVo;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.service.ISysDictTypeService;
|
||||
@ -79,7 +80,7 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
||||
private ISysOssService ossService;
|
||||
|
||||
@Resource
|
||||
private IWgzQuestionSavePdfService wgzQuestionSavePdfService;
|
||||
private IdCardEncryptorUtil idCardEncryptorUtil;
|
||||
|
||||
/**
|
||||
* 查询施工人员文件存储
|
||||
@ -150,6 +151,7 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
||||
throw new ServiceException("项目不存在", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 2. 查询施工人员列表
|
||||
req.setUserRole("0");
|
||||
List<SubConstructionUser> constructionUserList = constructionUserService.list(this.buildTemplateQueryWrapper(req));
|
||||
// 3. 根目录名称
|
||||
String randomString = project.getId() + "_" + RandomUtil.randomString(8);
|
||||
@ -164,7 +166,11 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
||||
zipOut.closeEntry();
|
||||
// 7. 对每个人,创建其文件夹,再在其中创建子文件夹(如“三级安全教育”、“体检报告”...)及文件
|
||||
for (SubConstructionUser constructionUser : constructionUserList) {
|
||||
String personFolder = rootFolder + constructionUser.getUserName() + "-" + constructionUser.getSysUserId() + "/";
|
||||
// 获取身份证信息
|
||||
String sfzNumber = constructionUser.getSfzNumber();
|
||||
// 解密
|
||||
String decrypt = idCardEncryptorUtil.decrypt(sfzNumber);
|
||||
String personFolder = rootFolder + constructionUser.getUserName() + "-" + decrypt + "/";
|
||||
// 7.1. 写入个人文件夹条目
|
||||
zipOut.putNextEntry(new ZipEntry(personFolder));
|
||||
zipOut.closeEntry();
|
||||
@ -220,6 +226,22 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
||||
String destDirPath = basePath + "/" + DateUtils.getDate() + "/" + projectId + "/" + randomStr;
|
||||
// 构建需要修改的对象
|
||||
List<SubConstructionUserFile> constructionUserFileList = new ArrayList<>();
|
||||
// 获取所有身份证对应的用户信息
|
||||
List<SubConstructionUser> allUserList = constructionUserService.lambdaQuery()
|
||||
.select(SubConstructionUser::getId, SubConstructionUser::getSysUserId,
|
||||
SubConstructionUser::getUserName, SubConstructionUser::getSfzNumber)
|
||||
.eq(SubConstructionUser::getProjectId, projectId)
|
||||
.eq( SubConstructionUser::getUserRole, "0")
|
||||
.list();
|
||||
if (CollUtil.isEmpty(allUserList)) {
|
||||
throw new ServiceException("项目下无施工人员");
|
||||
}
|
||||
Map<String, Long> userMap = allUserList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
SubConstructionUser::getSfzNumber,
|
||||
SubConstructionUser::getSysUserId,
|
||||
(oldV, newV) -> newV
|
||||
));
|
||||
try {
|
||||
// 2. 创建临时文件
|
||||
tempZipFile = File.createTempFile(tempZipFilePath, null);
|
||||
@ -228,7 +250,7 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
||||
destDir = new File(destDirPath);
|
||||
ZipUtil.unzip(tempZipFile, destDir);
|
||||
// 4. 递归扫描目录
|
||||
scanUserFolders(destDir, constructionUserFileList);
|
||||
scanUserFolders(destDir, userMap, constructionUserFileList);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("文件上传失败", HttpStatus.ERROR);
|
||||
} finally {
|
||||
@ -403,6 +425,7 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
||||
String typeOfWork = req.getTypeOfWork();
|
||||
String clock = req.getClock();
|
||||
List<Long> userIdList = req.getUserIdList();
|
||||
String userRole = req.getUserRole();
|
||||
// 模糊查询
|
||||
lqw.like(StringUtils.isNotBlank(userName), SubConstructionUser::getUserName, userName);
|
||||
// 精确查询
|
||||
@ -411,9 +434,8 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
||||
lqw.eq(ObjectUtils.isNotEmpty(teamId), SubConstructionUser::getTeamId, teamId);
|
||||
lqw.eq(StringUtils.isNotBlank(typeOfWork), SubConstructionUser::getTypeOfWork, typeOfWork);
|
||||
lqw.eq(StringUtils.isNotBlank(clock), SubConstructionUser::getClock, clock);
|
||||
if (CollUtil.isNotEmpty(userIdList)) {
|
||||
lqw.in(SubConstructionUser::getId, userIdList);
|
||||
}
|
||||
lqw.in(CollUtil.isNotEmpty(userIdList), SubConstructionUser::getId, userIdList);
|
||||
lqw.eq(StringUtils.isNotBlank(userRole), SubConstructionUser::getUserRole, userRole);
|
||||
// 根据项目id获取黑名单施工人员
|
||||
List<Long> blacklistUserIdList = constructionBlacklistService.lambdaQuery()
|
||||
.eq(BusConstructionBlacklist::getProjectId, projectId)
|
||||
@ -451,28 +473,32 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
||||
/**
|
||||
* 递归扫描指定目录,找到 “姓名-Id” 格式的文件夹并解析
|
||||
*/
|
||||
public void scanUserFolders(File root, List<SubConstructionUserFile> resultList) {
|
||||
|
||||
public void scanUserFolders(File root, Map<String, Long> userMap, List<SubConstructionUserFile> resultList) {
|
||||
if (root == null || !root.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
File[] files = root.listFiles();
|
||||
if (files == null) return;
|
||||
|
||||
for (File file : files) {
|
||||
|
||||
if (file.isDirectory()) {
|
||||
|
||||
// 判断是否符合 “姓名-数字ID” 格式
|
||||
if (file.getName().matches(".+-\\d+")) {
|
||||
// 解析 UserId
|
||||
long userId = Long.parseLong(file.getName().replaceAll(".*-", ""));
|
||||
// 判断是否为 “姓名-身份证号” 格式
|
||||
String folderName = file.getName();
|
||||
int idx = folderName.lastIndexOf("-");
|
||||
if (idx > 0) {
|
||||
String idCard = folderName.substring(idx + 1);
|
||||
// 校验身份证
|
||||
if (IdcardUtil.isValidCard(idCard)) {
|
||||
// 根据身份证获取用户id
|
||||
String encrypt = idCardEncryptorUtil.encrypt(idCard);
|
||||
if (userMap.containsKey(encrypt)) {
|
||||
Long userId = userMap.get(encrypt);
|
||||
parseUserDocFolder(file, userId, resultList);
|
||||
|
||||
} else {
|
||||
// 目录不是目标,继续递归查找
|
||||
scanUserFolders(file, resultList);
|
||||
log.warn("未找到身份证为 {} 的施工人员", idCard);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
scanUserFolders(file, userMap, resultList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,10 +3,7 @@ package org.dromara.progress.controller;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
@ -14,7 +11,6 @@ import org.apache.poi.ss.util.RegionUtil;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.enums.FormatsType;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
@ -31,7 +27,6 @@ import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryDayTot
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryDetailByDayVo;
|
||||
import org.dromara.progress.service.IPgsProcessDailyReportService;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.progress.service.IPgsProgressPlanService;
|
||||
import org.dromara.project.domain.BusProject;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.quality.domain.QltQualityInspection;
|
||||
@ -40,19 +35,20 @@ import org.dromara.safety.domain.HseSafetyInspection;
|
||||
import org.dromara.safety.service.IHseSafetyInspectionService;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Validated
|
||||
@ -85,7 +81,7 @@ public class PgsReportExportController extends BaseController {
|
||||
@SaIgnore
|
||||
@GetMapping("/dayReport")
|
||||
public R<String> getStreamData(ReportExportDto dto) {
|
||||
String url = "";
|
||||
String url;
|
||||
LocalDate localDate = DateUtils.parseLocalDateTime(FormatsType.YYYY_MM_DD, dto.getDate());
|
||||
PgsProcessDailyReport one = dailyReportService.lambdaQuery()
|
||||
.eq(PgsProcessDailyReport::getReportDate, localDate)
|
||||
@ -130,7 +126,7 @@ public class PgsReportExportController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok(url);
|
||||
return R.ok("操作成功", url);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,22 +1,17 @@
|
||||
package org.dromara.progress.domain.vo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.progress.domain.PgsProcessDailyReport;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.progress.domain.PgsProcessDailyReport;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进度日报视图对象 pgs_process_daily_report
|
||||
*
|
||||
@ -63,5 +58,9 @@ public class PgsProcessDailyReportVo implements Serializable {
|
||||
@ExcelProperty(value = "下载路径")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import org.dromara.project.domain.vo.attendance.*;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -162,7 +163,6 @@ public interface IBusAttendanceService extends IService<BusAttendance>{
|
||||
*/
|
||||
TableDataInfo<AttendanceUserVo> getAttendanceUser(AttendanceCountDto dto, PageQuery pageQuery);
|
||||
|
||||
|
||||
/**
|
||||
* 指定月份的打卡人员考勤统计
|
||||
*/
|
||||
@ -188,7 +188,6 @@ public interface IBusAttendanceService extends IService<BusAttendance>{
|
||||
*/
|
||||
BusAttendanceClockDateForTwoWeekVo getTodayAttendanceData(TwoWeekDto dto);
|
||||
|
||||
|
||||
/**
|
||||
* 获取项目当天的出勤人员
|
||||
*/
|
||||
@ -223,4 +222,11 @@ public interface IBusAttendanceService extends IService<BusAttendance>{
|
||||
* 查询分包当天出勤人员
|
||||
*/
|
||||
TableDataInfo<SubAttendanceTodayUserVo> getSubTodayAttendanceUser(SubTodayUserDto dto, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询日期范围内打卡人员数量
|
||||
*/
|
||||
Long getAttendanceUserCountByDate(Long projectId,LocalDate startDate, LocalDate endDate);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -2675,4 +2675,15 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
}
|
||||
return new TableDataInfo<>(list, sysUserVoTableDataInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getAttendanceUserCountByDate(Long projectId, LocalDate startDate, LocalDate endDate) {
|
||||
List<BusAttendance> list = list(Wrappers.<BusAttendance>lambdaQuery()
|
||||
.eq(BusAttendance::getProjectId, projectId)
|
||||
.between(BusAttendance::getClockDate, startDate, endDate)
|
||||
.in(BusAttendance::getClockStatus, ATTENDANCE_LIST)
|
||||
);
|
||||
|
||||
return list.stream().map(BusAttendance::getUserId).distinct().count();
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,4 +46,6 @@ public class HseViolationRecordQueryReq implements Serializable {
|
||||
*/
|
||||
private Long correctorId;
|
||||
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
||||
@ -355,6 +355,7 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
|
||||
lqw.ge(HseViolationRecord::getViolationTime, startOfDay)
|
||||
.lt(HseViolationRecord::getViolationTime, startOfNextDay);
|
||||
}
|
||||
lqw.eq(StringUtils.isNotBlank(req.getStatus()),HseViolationRecord::getStatus, req.getStatus());
|
||||
lqw.orderByDesc(HseViolationRecord::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user