diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java index 5165da1..a654e96 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java @@ -31,6 +31,8 @@ import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Operation; +import java.time.LocalDateTime; +import java.time.Period; import java.util.*; import java.io.IOException; import java.util.stream.Collectors; @@ -72,11 +74,11 @@ public class EnterpriseController { @Resource private EnterpriseAuditLogMapper enterpriseAuditLogMapper; @Resource - private TagLibraryMapper tagLibraryMapper; + private AdminUserService adminUserService; @Resource - private EnterpriseTagMapper enterpriseTagMapper; + private TagLibraryService tagLibraryService; @Resource - private AdminUserService adminUserService; + private FileInfoService fileInfoService; @PostMapping("/create") @Operation(summary = "创建企业") @@ -100,6 +102,14 @@ public class EnterpriseController { return success(true); } + @PutMapping("/audit") + @Operation(summary = "企业审核") +// @PreAuthorize("@ss.hasPermission('system:enterprise:update')") + public CommonResult audit(@RequestParam("id") Long id) { + enterpriseService.auditEnterprise(id); + return success(true); + } + @DeleteMapping("/delete") @Operation(summary = "删除企业") @Parameter(name = "id", description = "编号", required = true) @@ -127,10 +137,30 @@ public class EnterpriseController { enterprise.setFiles(list); } + //获取标签 + final List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); + enterprise.setTagList(tagLibraryDOS.stream().map(item->item.getTagName()).collect(Collectors.toList())); + //获取资质 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(EnterpriseQualificationDO::getEnterpriseId, enterprise.getId()); final List enterpriseQualificationList = enterpriseQualificationMapper.selectList(queryWrapper); + + if (enterpriseQualificationList != null && enterpriseQualificationList.size() > 0) { + enterpriseQualificationList.forEach(item->{ + LocalDateTime now = LocalDateTime.now(); + LocalDateTime past = item.getExpiryDate().minus(Period.ofDays(30)); + if (item.getExpiryDate().isBefore(now)) { + item.setStatus(3); + } else if (past.isBefore(now)) { + item.setStatus(2); + } else { + item.setStatus(1); + } + + }); + } + enterprise.setQualificationList(enterpriseQualificationList); } //获取企业标签 @@ -156,35 +186,14 @@ public class EnterpriseController { public CommonResult> getEnterprisePage(EnterprisePageReqVO pageReqVO) { PageResult pageResult = enterpriseService.getEnterprisePage(pageReqVO); pageResult.getList().forEach(item->{ - //企业审核状态 - QueryWrapper auditLogDOQueryWrapper = new QueryWrapper<>(); - auditLogDOQueryWrapper.eq("enterprise_id", item.getId()); - EnterpriseAuditLogDO enterpriseAuditLogDO = enterpriseAuditLogMapper.selectOne(auditLogDOQueryWrapper); - if (enterpriseAuditLogDO != null) { - item.setAudit(enterpriseAuditLogDO.getAudit()); - } //企业图片 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(FileInfoDO::getDictType, 644l); - wrapper.eq(FileInfoDO::getDictData, 1l); - wrapper.eq(FileInfoDO::getUnitId, item.getId()); - final List collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList()); + final List> fileList = fileInfoService.getFileList("664", "1", item.getId().toString()); + item.setFiles(fileList); - if (!collect.isEmpty()) { - final List> list = fileApi.listFile(collect); - item.setFiles(list); - } // 企业标签 - LambdaQueryWrapper tagDOLambdaQueryWrapper = new LambdaQueryWrapper<>(); - tagDOLambdaQueryWrapper.eq(EnterpriseTagDO::getEnterpriseId, item.getId()); - List enterpriseTagDOS = enterpriseTagMapper.selectList(tagDOLambdaQueryWrapper); - if (enterpriseTagDOS != null && enterpriseTagDOS.size() > 0) { - List tagIds = enterpriseTagDOS.stream().map(EnterpriseTagDO::getTagId).collect(Collectors.toList()); - List tagLibraryDOS = tagLibraryMapper.selectList(new LambdaQueryWrapper().in(TagLibraryDO::getId, tagIds)); - if (tagLibraryDOS != null && tagLibraryDOS.size() > 0) { - List tagNames = tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList()); - item.setTagList(tagNames); - } + final List tagLibraryDOS1 = tagLibraryService.listByEnterpriseId(item.getId()); + if (tagLibraryDOS1 != null && tagLibraryDOS1.size() > 0) { + item.setTagList(tagLibraryDOS1.stream().map(item1->item1.getTagName()).collect(Collectors.toList())); } }); @@ -197,44 +206,16 @@ public class EnterpriseController { public CommonResult> getEnterpriseByUserId(@Valid EnterprisePageReqVO pageReqVO) { final PageResult pageResult = enterpriseService.getEnterpriseByUserId(pageReqVO); pageResult.getList().forEach(item->{ - //企业审核状态 - QueryWrapper auditLogDOQueryWrapper = new QueryWrapper<>(); - auditLogDOQueryWrapper.eq("enterprise_id", item.getId()); - EnterpriseAuditLogDO enterpriseAuditLogDO = enterpriseAuditLogMapper.selectOne(auditLogDOQueryWrapper); - if (enterpriseAuditLogDO != null) { - item.setAudit(enterpriseAuditLogDO.getAudit()); - } - //企业图片 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(FileInfoDO::getDictType, 644l); - wrapper.eq(FileInfoDO::getDictData, 1l); - wrapper.eq(FileInfoDO::getUnitId, item.getId()); - final List collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList()); - - if (!collect.isEmpty()) { - final List> list = fileApi.listFile(collect); - item.setFiles(list); - } + final List> fileList = fileInfoService.getFileList("664", "1", item.getId().toString()); + item.setFiles(fileList); - //企业标签 - QueryWrapper enterpriseDOQueryWrapper = new QueryWrapper<>(); - enterpriseDOQueryWrapper.eq("enterprise_id", item.getId()); - final List enterpriseTagDOS = enterpriseTagMapper.selectList(enterpriseDOQueryWrapper); - List tagList = new ArrayList<>(); - if (!enterpriseTagDOS.isEmpty() && enterpriseTagDOS.size() > 0) { - - enterpriseTagDOS.forEach(tagItem-> { - QueryWrapper tagLibraryDOQueryWrapper = new QueryWrapper<>(); - tagLibraryDOQueryWrapper.eq("id", tagItem.getTagId()); - TagLibraryDO tagLibraryDO = tagLibraryMapper.selectOne(tagLibraryDOQueryWrapper); - if (tagLibraryDO != null) { - tagList.add(tagLibraryDO.getTagName()); - } - }); + // 企业标签 + final List tagLibraryDOS1 = tagLibraryService.listByEnterpriseId(item.getId()); + if (tagLibraryDOS1 != null && tagLibraryDOS1.size() > 0) { + item.setTagList(tagLibraryDOS1.stream().map(item1->item1.getTagName()).collect(Collectors.toList())); } - item.setTagList(tagList); }); return success(BeanUtils.toBean(pageResult, EnterpriseRespVO.class)); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java index 24f3fa6..d48de4f 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java @@ -30,6 +30,9 @@ public class EnterprisePageReqVO extends PageParam { @Schema(description = "企业类型:1.大型、2.中型、3.小型、4.环保重点", example = "2") private String type; + @Schema(description = "是否已审核") + private Boolean isAudit; + @Schema(description = "企业所属区域:1.东区、2.西区、3.北区、4.南区") private String region; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java index 13e3a2d..3ca2a74 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java @@ -44,6 +44,8 @@ public class EnterpriseRespVO { @ExcelProperty("企业地址") private String address; + @Schema(description = "是否已审核") + private Boolean isAudit; @Schema(description = "企业状态") @ExcelProperty("企业状态") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java index eb2c43b..868963a 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java @@ -29,6 +29,9 @@ public class EnterpriseSaveReqVO { @Schema(description = "企业所属区域:1.东区、2.西区、3.北区、4.南区") private String region; + @Schema(description = "是否已审核") + private Boolean isAudit; + @Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") private String enterprisesName; @@ -73,4 +76,11 @@ public class EnterpriseSaveReqVO { @Schema(description = "文件id", example = "26433") private Long[] fileIds; + @Schema(description = "审核状态", example = "26433") + private Integer audit; + + @Schema(description = "审核信息", example = "26433") + private String content; + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java index 0a4b6c9..4fe29c9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java @@ -69,7 +69,7 @@ public class InspectionsLogController { @PutMapping("/update") @Operation(summary = "更新检查结果日志") - @PreAuthorize("@ss.hasPermission('system:inspections-log:update')") +// @PreAuthorize("@ss.hasPermission('system:inspections-log:update')") public CommonResult updateInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO updateReqVO) { inspectionsLogService.updateInspectionsLog(updateReqVO); return success(true); @@ -87,9 +87,13 @@ public class InspectionsLogController { @GetMapping("/get") @Operation(summary = "获得检查结果日志") @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") +// @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") public CommonResult getInspectionsLog(@RequestParam("id") Long id) { InspectionsLogDO inspectionsLog = inspectionsLogService.getInspectionsLog(id); + //查图片 + final List> fileList = fileInfoService.getFileList("644", "2", inspectionsLog.getId().toString()); + inspectionsLog.setFileList(fileList); + return success(BeanUtils.toBean(inspectionsLog, InspectionsLogRespVO.class)); } @@ -97,6 +101,7 @@ public class InspectionsLogController { @Operation(summary = "审核") @PreAuthorize("@ss.hasPermission('system:enterpriseinspections:index')") public CommonResult inspectionsAudit(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) { + log.info("createReqVO:{}", createReqVO); inspectionsLogService.inspectionsAudit(createReqVO); return success("审核成功"); } @@ -104,8 +109,15 @@ public class InspectionsLogController { @GetMapping("/appList") @Operation(summary = "获得检查结果日志分页") // @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") - public CommonResult> getInspectionsLogPage(@Valid InspectionsLogPageReqVO pageReqVO) { - PageResult pageResult = inspectionsLogService.getInspectionsLogPage(pageReqVO); + public CommonResult> getInspectionsLogPage(@Valid InspectionsLogPageReqVO pageReqVO) { + List pageResult = inspectionsLogService.getInspectionsLogPage(pageReqVO); + if (pageResult != null && pageResult.size() > 0) { + pageResult.forEach(item->{ + //图片相关 + final List> fileList = fileInfoService.getFileList("644", "2", item.getId().toString()); + item.setFileList(fileList); + }); + } return success(BeanUtils.toBean(pageResult, InspectionsLogRespVO.class)); } @@ -126,17 +138,17 @@ public class InspectionsLogController { return success(BeanUtils.toBean(list, InspectionsLogRespVO.class)); } - @GetMapping("/export-excel") - @Operation(summary = "导出检查结果日志 Excel") - @PreAuthorize("@ss.hasPermission('system:inspections-log:export')") - @ApiAccessLog(operateType = EXPORT) - public void exportInspectionsLogExcel(@Valid InspectionsLogPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = inspectionsLogService.getInspectionsLogPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "检查结果日志.xls", "数据", InspectionsLogRespVO.class, - BeanUtils.toBean(list, InspectionsLogRespVO.class)); - } +// @GetMapping("/export-excel") +// @Operation(summary = "导出检查结果日志 Excel") +// @PreAuthorize("@ss.hasPermission('system:inspections-log:export')") +// @ApiAccessLog(operateType = EXPORT) +// public void exportInspectionsLogExcel(@Valid InspectionsLogPageReqVO pageReqVO, +// HttpServletResponse response) throws IOException { +// pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +// List list = inspectionsLogService.getInspectionsLogPage(pageReqVO).getList(); +// // 导出 Excel +// ExcelUtils.write(response, "检查结果日志.xls", "数据", InspectionsLogRespVO.class, +// BeanUtils.toBean(list, InspectionsLogRespVO.class)); +// } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java index 82a1ad5..21102a0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java @@ -37,4 +37,7 @@ public class InspectionsLogPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; + //整改截至日期 + private LocalDateTime correctionTime; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java index 2f47c5e..cce8557 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java @@ -43,6 +43,9 @@ public class InspectionsLogRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; + //整改截至日期 + private LocalDateTime correctionTime; + @Schema(description = "相关文件") private List> fileList; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java index a6ee30d..c236801 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; import java.util.*; @Schema(description = "管理后台 - 检查结果日志新增/修改 Request VO") @@ -40,5 +41,12 @@ public class InspectionsLogSaveReqVO { @Schema(description = "执法人ID", example = "1") private Long inspectId; + @Schema(description = "文件id", example = "26433") + private Long[] fileIds; + + //整改截至日期 + private LocalDateTime correctionTime; + + //协同人员是否可以看到任务记录 } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java index 1e65152..c4e6c7e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java @@ -218,6 +218,14 @@ public class TaskInfoController { return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class)); } + @GetMapping("/appPageByEnterpriseId") + @Operation(summary = "获得任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。分页") + @PreAuthorize("@ss.hasPermission('system:task-info:query')") + public CommonResult> appPageByEnterpriseId( TaskInfoPageReqVO pageReqVO) { + PageResult pageResult = taskInfoService.appPageByEnterpriseId(pageReqVO); + return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class)); + } + @GetMapping("/export-excel") @Operation(summary = "导出任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 Excel") @PreAuthorize("@ss.hasPermission('system:task-info:export')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java index 458f8bc..4afca96 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java @@ -78,4 +78,13 @@ public class TaskInfoPageReqVO extends PageParam { @Schema(description = "按时间查询", example = "1") private Integer selectWeek; + @Schema(description = "用户id", example = "1") + private Integer userId; + + @Schema(description = "部门id", example = "1") + private Integer deptId; + + @Schema(description = "企业id", example = "1") + private Long enterpriseId; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java index b67f19d..34a6e2b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java @@ -123,8 +123,8 @@ public class TaskInfoRespVO { //发布部门 private String deptName; - - + //检查记录id + private Long inspectionsId; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/HomeController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/HomeController.java new file mode 100644 index 0000000..4db2c16 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/HomeController.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.system.controller.home; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; +import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO; +import cn.iocoder.yudao.module.system.service.home.HomeService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +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 javax.annotation.Resource; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 检查结果日志") +@RestController +@RequestMapping("/system/home") +@Validated +@Slf4j +public class HomeController { + + @Resource + private HomeService homeService; + + @GetMapping("/appCount1") + @Operation(summary = "app首页统计第一块") +// @PreAuthorize("@ss.hasPermission('system:inspections-log:create')") + public CommonResult> signInList(HomeSelectVO homeSelectVO) { + return success(homeService.appCount1(homeSelectVO)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/vo/HomeSelectVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/vo/HomeSelectVO.java new file mode 100644 index 0000000..4e147b7 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/vo/HomeSelectVO.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.system.controller.home.vo; + +import lombok.Data; +/** + 首页查询条件 + **/ + +@Data +public class HomeSelectVO { + + //周期 取字典 + private Integer selectWeek; + + //部门 + private Long deptId; +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java index b14d2a6..bff37ab 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.dal.dataobject.enterprise; import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO; import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.time.LocalDate; @@ -56,6 +57,9 @@ public class EnterpriseDO extends BaseDO { */ private String address; + //是都已审核 + private Boolean isAudit; + /** * 企业状态 */ @@ -89,15 +93,6 @@ public class EnterpriseDO extends BaseDO { */ private String signRadius; - -// /** -// * 管理部门 -// */ -// private Long deptId; - - @TableField(exist = false) - private Integer audit; - @TableField(exist = false) private List> files; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java index 31a4340..42793cc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java @@ -57,6 +57,9 @@ public class InspectionsLogDO extends BaseDO { //协同人员的id 还是要加上 会有同名的情况 private String cooperateWithIds; + + //整改截至日期 + private LocalDateTime correctionTime; //协同人员是否可以看到任务记录 //相关文件 @TableField(exist = false) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java index 7a6fb1c..d6e56ae 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java @@ -59,4 +59,8 @@ public class EnterpriseQualificationDO extends BaseDO { @TableField(exist = false) private String enterpriseName; + //资质状态 + @TableField(exist = false) + private Integer status; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java index 4270eeb..f3a3717 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java @@ -36,7 +36,6 @@ public class TaskInfoDO extends BaseDO { @TableId private Long id; - //任务编号 // @TableField(exist = false) private String taskNumber; @@ -119,4 +118,7 @@ public class TaskInfoDO extends BaseDO { //发布部门 @TableField(exist = false) private String deptName; + + @TableField(exist = false) + private Long inspectionsId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java index 6b6757b..24f72a4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java @@ -28,6 +28,7 @@ public interface EnterpriseMapper extends BaseMapperX { .eqIfPresent(EnterpriseDO::getRegion, reqVO.getRegion()) .likeIfPresent(EnterpriseDO::getEnterprisesName, reqVO.getEnterprisesName()) .eqIfPresent(EnterpriseDO::getAddress, reqVO.getAddress()) + .eqIfPresent(EnterpriseDO::getIsAudit, 1) .eqIfPresent(EnterpriseDO::getEnterprisesStatus, reqVO.getEnterprisesStatus()) .likeIfPresent(EnterpriseDO::getContactName, reqVO.getContactName()) .eqIfPresent(EnterpriseDO::getEnvironmentalContactPhone, reqVO.getEnvironmentalContactPhone()) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java index 33b487b..47ac243 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java @@ -6,8 +6,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.*; +import org.apache.ibatis.annotations.Param; /** * 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 Mapper @@ -57,7 +60,11 @@ public interface TaskInfoMapper extends BaseMapperX { .orderByAsc(TaskInfoDO::getStatus)); } + //优化任务查询 + PageResult selectMyPage(TaskInfoPageReqVO reqVO); + //根据企业id查任务 + IPage selectPageByEnterpriseId(Page page, @Param("reqVO") TaskInfoPageReqVO reqVO); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java index a0b765e..340feb6 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java @@ -114,4 +114,6 @@ public interface DeptService { */ void validateDeptList(Collection ids); + //根据用户id 查询部门 + DeptDO getByUserId(Long userId); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java index 5ffbbd3..8983b76 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java @@ -8,7 +8,9 @@ import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper; +import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.google.common.annotations.VisibleForTesting; @@ -37,6 +39,8 @@ public class DeptServiceImpl implements DeptService { @Resource private DeptMapper deptMapper; + @Resource + private AdminUserMapper adminUserMapper; @Override @CacheEvict(cacheNames = RedisKeyConstants.DEPT_CHILDREN_ID_LIST, @@ -221,4 +225,16 @@ public class DeptServiceImpl implements DeptService { }); } + @Override + public DeptDO getByUserId(Long userId) { + final AdminUserDO adminUserDO = adminUserMapper.selectById(userId); + if (adminUserDO == null) { + throw exception(USER_NOT_EXISTS); + } + if (adminUserDO.getDeptId() != null) { + return getDept(adminUserDO.getDeptId()); + } + return null; + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java index c747a68..c6da1fa 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java @@ -66,4 +66,6 @@ public interface EnterpriseService { List getEnterpriseList(EnterprisePageReqVO pageReqVO); PageResult getEnterpriseByUserId(EnterprisePageReqVO pageReqVO); + + void auditEnterprise(Long id); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java index 0143068..d26d8e2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java @@ -52,12 +52,8 @@ public class EnterpriseServiceImpl implements EnterpriseService { @Resource private EnterpriseMapper enterpriseMapper; @Resource - private FileInfoService fileInfoService; - @Resource private FileInfoMapper fileInfoMapper; @Resource - private AdminUserService adminUserService; - @Resource private EnterpriseAuditLogMapper enterpriseAuditLogMapper; @Resource private EnterpriseTagMapper enterpriseTagMapper; @@ -228,5 +224,16 @@ public class EnterpriseServiceImpl implements EnterpriseService { return enterpriseDOPageResult; } + //审核状态 + @Override + public void auditEnterprise(Long id) { + final EnterpriseDO enterpriseDO = enterpriseMapper.selectById(id); + if (enterpriseDO == null) { + throw exception(ENTERPRISE_NOT_EXISTS); + } + enterpriseDO.setIsAudit(true); + + enterpriseMapper.updateById(enterpriseDO); + } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java index 108f145..fe778be 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java @@ -4,7 +4,6 @@ import java.util.*; import cn.iocoder.yudao.module.system.controller.admin.fileInfo.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; import javax.validation.Valid; @@ -54,4 +53,16 @@ public interface FileInfoService { PageResult getFileInfoPage(FileInfoPageReqVO pageReqVO); List> getFileList(String dictType, String dictData, String unitId); + + /** + * 根据字典类型和字典数据保存附件信息 + * @param dictType + * @param dictData + * @param unitId + * @return + * @Author dx + * @Date 2025-02-16 上午9:34 + **/ + void saveFilesByDictData(Long[] fileIds, Long dictType, Long dictData, String unitId); + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java index f2b99ec..4bbbc67 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java @@ -98,4 +98,30 @@ public class FileInfoServiceImpl implements FileInfoService { return mapList; } + /** + * 根据字典类型和字典数据保存附件信息 + * + * @param dictType + * @param dictData + * @param unitId + * @return + * @Author dx + * @Date 2025-02-16 上午9:34 + **/ + @Override + public void saveFilesByDictData(Long[] fileIds, Long dictType, Long dictData, String unitId) { + if (fileIds != null && fileIds.length > 0) { + List list = new ArrayList<>(); + for (Long fileId : fileIds) { + FileInfoDO fileInfoDO = new FileInfoDO(); + fileInfoDO.setDictData(dictData); //文件类型 + fileInfoDO.setDictType(dictType); + fileInfoDO.setUnitId(unitId); + fileInfoDO.setInfraFileId(fileId); + list.add(fileInfoDO); + } + fileInfoMapper.insertBatch(list); + } + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java new file mode 100644 index 0000000..6a56fb6 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java @@ -0,0 +1,10 @@ +package cn.iocoder.yudao.module.system.service.home; + +import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; +import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO; + +import java.util.List; + +public interface HomeService { + List appCount1(HomeSelectVO homeSelectVO); +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java new file mode 100644 index 0000000..7df28c5 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.system.service.home; + +import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; +import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class HomeServiceImpl implements HomeService{ + @Override + public List appCount1(HomeSelectVO homeSelectVO) { + return null; +// return List.of(); + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java index 24b16ee..95e7f72 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java @@ -53,7 +53,7 @@ public interface InspectionsLogService { * @param pageReqVO 分页查询 * @return 检查结果日志分页 */ - PageResult getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO); + List getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO); List list(InspectionsLogPageReqVO pageReqVO); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java index 75918f4..4313973 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.signinlog.SignInLogMapper; import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper; import cn.iocoder.yudao.module.system.service.dept.DeptService; import cn.iocoder.yudao.module.system.service.enterpriseinspections.EnterpriseInspectionsService; +import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.alibaba.excel.util.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -59,6 +60,8 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { private EnterpriseInspectionsService enterpriseInspectionsService; @Resource private DeptService deptService; + @Resource + private FileInfoService fileInfoService; @Override @Transactional @@ -83,15 +86,7 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { InspectionsLogDO inspectionsLog = BeanUtils.toBean(createReqVO, InspectionsLogDO.class); final int insert = inspectionsLogMapper.insert(inspectionsLog); if (insert > 0) { - final SignInLogDO signInLogDO = new SignInLogDO(); - signInLogDO.setInsId(inspectionsLog.getId()); - signInLogDO.setUserId(loginUserId); - signInLogDO.setRealName(user.getRealName()); - signInLogDO.setGpsLocation(createReqVO.getGpsLocation()); - if (loginUserId == inspections.getUserId()) { - signInLogDO.setIsInspect(true); - } - signInLogMapper.insert(signInLogDO); + inspectionsLogNew.setId(inspectionsLog.getId()); } } else { @@ -107,18 +102,17 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { if(collect.contains(loginUserId)) { throw exception(SIGN_IN_LOG_ERROR2); } + } - final SignInLogDO signInLogDO = new SignInLogDO(); - signInLogDO.setInsId(inspectionsLogNew.getId()); - signInLogDO.setUserId(loginUserId); - signInLogDO.setRealName(user.getRealName()); - signInLogDO.setGpsLocation(createReqVO.getGpsLocation()); - if (loginUserId == inspections.getUserId()) { - signInLogDO.setIsInspect(true); - } - signInLogMapper.insert(signInLogDO); - + final SignInLogDO signInLogDO = new SignInLogDO(); + signInLogDO.setInsId(inspectionsLogNew.getId()); + signInLogDO.setUserId(loginUserId); + signInLogDO.setRealName(user.getRealName()); + signInLogDO.setGpsLocation(createReqVO.getGpsLocation()); + if (loginUserId.equals(inspections.getUserId())) { + signInLogDO.setIsInspect(true); } + signInLogMapper.insert(signInLogDO); } public List getSignInLog(Long insId) { @@ -152,34 +146,52 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { @Override public InspectionsLogDO getInspectionsLog(Long id) { + //判断是否存在 + validateInspectionsLogExists(id); return inspectionsLogMapper.selectById(id); } @Override - public PageResult getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO) { + public List getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO) { //不显示待确认签到的状态 - pageReqVO.setPageNo(-1); if (pageReqVO.getStatus() == null) { pageReqVO.setMrStatus(0); } - final PageResult inspectionsLogDOPageResult = inspectionsLogMapper.selectPage(pageReqVO); - if (inspectionsLogDOPageResult.getList() != null && inspectionsLogDOPageResult.getList().size() > 0) { - inspectionsLogDOPageResult.getList().forEach(item->{ - final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(item.getInspectionsId()); - if (enterpriseInspectionsDO == null) { - throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + + List list = new ArrayList<>(); + final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(pageReqVO.getInspectionsId()); + if ( inspectionsLogNew != null ) { + + //根据打卡次数判断 是否是二次整改 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(InspectionsLogDO::getInspectionsId, pageReqVO.getInspectionsId()); + wrapper.eq(InspectionsLogDO::getStatus, 3); + final List listOld = inspectionsLogMapper.selectList(wrapper); + + + if (listOld != null && listOld.size() > 0) { + listOld.forEach(item->{ + item.setUserList(this.getInspectionsLogAppListVO(inspectionsLogNew.getId())); + list.add(item); + }); + } + + if (inspectionsLogNew.getStatus() != 3) { + //查看打卡记录 + final List signInLog = this.getSignInLog(inspectionsLogNew.getId()); + if (signInLog == null) { + throw exception(SIGN_IN_LOG_ERROR); } + inspectionsLogNew.setUserList(this.getInspectionsLogAppListVO(inspectionsLogNew.getId())); + list.add(inspectionsLogNew); + } - item.setUserList(this.getInspectionsLogAppListVO(item.getId())); - }); } - - return inspectionsLogDOPageResult; + return list; } - //封装 public List getInspectionsLogAppListVO(Long insId) { List appListVO = new ArrayList<>(); @@ -216,7 +228,7 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { final List list = inspectionsLogMapper.selectList(wrapper); if (list != null && list.size() > 0) { list.forEach(item->{ - if (item.getStatus() != null && item.getStatus() == 1) { + if (item.getStatus() != null) { final List inspectionsLogAppListVO = this.getInspectionsLogAppListVO(item.getId()); if (inspectionsLogAppListVO != null) { List inspectCollect = inspectionsLogAppListVO.stream().filter(item2 -> item2.getIsInspect() == true).map(map3 -> map3.getRealName()).collect(Collectors.toList()); @@ -231,7 +243,6 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { return list; } - @Override public void confirmSignIn(InspectionsLogSaveReqVO createReqVO) { @@ -279,7 +290,7 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { } //只有当前企业执行人才能提交审核 - if (enterpriseInspectionsDO.getUserId() != getLoginUserId()) { + if (!getLoginUserId().equals(enterpriseInspectionsDO.getUserId())) { throw exception(SIGN_IN_LOG_ERROR5); } @@ -292,11 +303,12 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { InspectionsLogDO updateObj = BeanUtils.toBean(createReqVO, InspectionsLogDO.class); inspectionsLogMapper.insert(updateObj); - - List signInLogDOS = signInLogMapper.selectList(new QueryWrapper().eq("ins_id", inspectionsLogNew.getId())); + //插入图片 + fileInfoService.saveFilesByDictData(createReqVO.getFileIds(), 644l,2l, updateObj.getId().toString()); + //插入签到人 方便查询 if (signInLogDOS == null || signInLogDOS.size() > 0) { List newList = new ArrayList<>(); signInLogDOS.forEach(item-> { @@ -317,14 +329,12 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { @Override public List signInList(Long inspectionsId) { - //查询最新状态 final InspectionsLogDO inspectionsLogDO = enterpriseInspectionsService.getInspectionsLogNew(inspectionsId); if (inspectionsLogDO != null) { - //如果当前状态不是待确认打卡的状态报错 -// if (inspectionsLogDO.getStatus() != 0) { -// throw exception(SIGN_IN_LOG_ERROR3); -// } + if (inspectionsLogDO.getStatus() == 3) { + return Collections.emptyList(); + } //根据记录查询 return this.getInspectionsLogAppListVO(inspectionsLogDO.getId()); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java index 15c7e3c..de54492 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java @@ -59,4 +59,6 @@ public interface TaskInfoService { void sendTask(Long taskId); PageResult getTaskInfoAppPage(TaskInfoPageReqVO pageReqVO); + + PageResult appPageByEnterpriseId(TaskInfoPageReqVO pageReqVO); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java index f986d0f..2f40f7c 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.infra.api.job.JobApi; import cn.iocoder.yudao.module.system.controller.admin.tasktag.vo.TaskTagPageReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; @@ -15,9 +16,13 @@ import cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections.Enterprise import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper; import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; +import cn.iocoder.yudao.module.system.service.dept.DeptService; +import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -69,6 +74,10 @@ public class TaskInfoServiceImpl implements TaskInfoService { private AdminUserService adminUserService; @Resource private AdminUserMapper adminUserMapper; + @Resource + private DeptService deptService; + @Resource + private TagLibraryService tagLibraryService; @Override @Transactional @@ -296,4 +305,39 @@ public class TaskInfoServiceImpl implements TaskInfoService { return taskInfoDOPageResult; } + @Override + public PageResult appPageByEnterpriseId(TaskInfoPageReqVO pageReqVO) { + // 创建分页对象 + Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); + final IPage taskInfoDOIPage = taskInfoMapper.selectPageByEnterpriseId(page, pageReqVO); + if (taskInfoDOIPage != null && taskInfoDOIPage.getRecords() != null && taskInfoDOIPage.getRecords().size() > 0) { + taskInfoDOIPage.getRecords().forEach(item->{ + + //根据任务和企业查询记录 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(EnterpriseInspectionsDO::getTaskId, item.getId()); + wrapper.eq(EnterpriseInspectionsDO::getEnterpriseId, pageReqVO.getEnterpriseId()); + final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectOne(wrapper); + + item.setInspectionsId(enterpriseInspectionsDO.getId()); + + //发布部门, + final Long userId = Long.valueOf(item.getCreator()); + final DeptDO deptDO = deptService.getByUserId(userId); + item.setDeptName(deptDO.getName()); + + // 任务标签 + final List tagLibraryDOS = tagLibraryService.listByTaskId(item.getId()); + if (tagLibraryDOS != null && tagLibraryDOS.size() > 0) { + item.setTagList(tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList())); + } + + }); + } + + + // 查询列表 + return new PageResult<>(taskInfoDOIPage.getRecords(), taskInfoDOIPage.getTotal()); + } + }