diff --git a/xinnengyuan/ruoyi-admin/src/main/resources/application.yml b/xinnengyuan/ruoyi-admin/src/main/resources/application.yml index 2f2a5f62..11258a14 100644 --- a/xinnengyuan/ruoyi-admin/src/main/resources/application.yml +++ b/xinnengyuan/ruoyi-admin/src/main/resources/application.yml @@ -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.通用模块 diff --git a/xinnengyuan/ruoyi-common/ruoyi-common-doc/pom.xml b/xinnengyuan/ruoyi-common/ruoyi-common-doc/pom.xml index 2f0b5838..7d207ae9 100644 --- a/xinnengyuan/ruoyi-common/ruoyi-common-doc/pom.xml +++ b/xinnengyuan/ruoyi-common/ruoyi-common-doc/pom.xml @@ -44,7 +44,7 @@ com.github.xiaoymin knife4j-openapi3-jakarta-spring-boot-starter - 4.4.0 + 4.5.0 diff --git a/xinnengyuan/ruoyi-common/ruoyi-common-doc/src/main/java/org/dromara/common/doc/config/SpringDocConfig.java b/xinnengyuan/ruoyi-common/ruoyi-common-doc/src/main/java/org/dromara/common/doc/config/SpringDocConfig.java index 069ef9ac..59633f18 100644 --- a/xinnengyuan/ruoyi-common/ruoyi-common-doc/src/main/java/org/dromara/common/doc/config/SpringDocConfig.java +++ b/xinnengyuan/ruoyi-common/ruoyi-common-doc/src/main/java/org/dromara/common/doc/config/SpringDocConfig.java @@ -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 operations = pathItem.readOperations(); + operations.forEach(operation -> { + operation.addSecurityItem(new SecurityRequirement() + .addList(HttpHeaders.AUTHORIZATION) + .addList("Clientid") + ); + }); + }); + } + + }; + + } + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/domain/vo/BusPlanDocAssociationVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/domain/vo/BusPlanDocAssociationVo.java index 69ff6b00..3becdfad 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/domain/vo/BusPlanDocAssociationVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/domain/vo/BusPlanDocAssociationVo.java @@ -57,4 +57,8 @@ public class BusPlanDocAssociationVo implements Serializable { * 需求数量 */ private BigDecimal demandQuantity; + + + private String remark; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/dto/constructionuserfile/SubConstructionUserFileTemplateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/dto/constructionuserfile/SubConstructionUserFileTemplateReq.java index 42499afc..99258a65 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/dto/constructionuserfile/SubConstructionUserFileTemplateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/dto/constructionuserfile/SubConstructionUserFileTemplateReq.java @@ -53,4 +53,9 @@ public class SubConstructionUserFileTemplateReq implements Serializable { */ private List userIdList; + /** + * 用户角色 + */ + private String userRole; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java index bd3b60d4..7c28b00c 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java @@ -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 constructionUserList = constructionUserService.list(this.buildTemplateQueryWrapper(req)); // 3. 根目录名称 String randomString = project.getId() + "_" + RandomUtil.randomString(8); @@ -164,7 +166,11 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl constructionUserFileList = new ArrayList<>(); + // 获取所有身份证对应的用户信息 + List 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 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 userIdList = req.getUserIdList(); + String userRole = req.getUserRole(); // 模糊查询 lqw.like(StringUtils.isNotBlank(userName), SubConstructionUser::getUserName, userName); // 精确查询 @@ -411,9 +434,8 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl blacklistUserIdList = constructionBlacklistService.lambdaQuery() .eq(BusConstructionBlacklist::getProjectId, projectId) @@ -451,28 +473,32 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl resultList) { - + public void scanUserFolders(File root, Map userMap, List 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(".*-", "")); - parseUserDocFolder(file, userId, resultList); - + // 判断是否为 “姓名-身份证号” 格式 + 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 { + log.warn("未找到身份证为 {} 的施工人员", idCard); + } + } } else { - // 目录不是目标,继续递归查找 - scanUserFolders(file, resultList); + scanUserFolders(file, userMap, resultList); } } } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsReportExportController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsReportExportController.java index 9b38f993..642a3823 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsReportExportController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsReportExportController.java @@ -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 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); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/PgsProcessDailyReportVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/PgsProcessDailyReportVo.java index 892631f5..3701c223 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/PgsProcessDailyReportVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/PgsProcessDailyReportVo.java @@ -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; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusAttendanceService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusAttendanceService.java index 64cbe1c5..09b5f68b 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusAttendanceService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusAttendanceService.java @@ -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{ */ TableDataInfo getAttendanceUser(AttendanceCountDto dto, PageQuery pageQuery); - /** * 指定月份的打卡人员考勤统计 */ @@ -188,7 +188,6 @@ public interface IBusAttendanceService extends IService{ */ BusAttendanceClockDateForTwoWeekVo getTodayAttendanceData(TwoWeekDto dto); - /** * 获取项目当天的出勤人员 */ @@ -223,4 +222,11 @@ public interface IBusAttendanceService extends IService{ * 查询分包当天出勤人员 */ TableDataInfo getSubTodayAttendanceUser(SubTodayUserDto dto, PageQuery pageQuery); + + /** + * 查询日期范围内打卡人员数量 + */ + Long getAttendanceUserCountByDate(Long projectId,LocalDate startDate, LocalDate endDate); + + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceServiceImpl.java index 00c6ab5b..bd9d6e2a 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceServiceImpl.java @@ -2675,4 +2675,15 @@ public class BusAttendanceServiceImpl extends ServiceImpl(list, sysUserVoTableDataInfo.getTotal()); } + + @Override + public Long getAttendanceUserCountByDate(Long projectId, LocalDate startDate, LocalDate endDate) { + List list = list(Wrappers.lambdaQuery() + .eq(BusAttendance::getProjectId, projectId) + .between(BusAttendance::getClockDate, startDate, endDate) + .in(BusAttendance::getClockStatus, ATTENDANCE_LIST) + ); + + return list.stream().map(BusAttendance::getUserId).distinct().count(); + } } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/violationrecord/HseViolationRecordQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/violationrecord/HseViolationRecordQueryReq.java index eb53ab72..5df372d0 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/violationrecord/HseViolationRecordQueryReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/violationrecord/HseViolationRecordQueryReq.java @@ -46,4 +46,6 @@ public class HseViolationRecordQueryReq implements Serializable { */ private Long correctorId; + private String status; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseViolationRecordServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseViolationRecordServiceImpl.java index f9d19603..ef0b8efe 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseViolationRecordServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseViolationRecordServiceImpl.java @@ -355,6 +355,7 @@ public class HseViolationRecordServiceImpl extends ServiceImpl