Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java
master
赵鹏 2 months ago
parent
commit
4ba81d5de1
  1. 107
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java
  2. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java
  3. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java
  4. 10
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java
  5. 52
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java
  6. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java
  7. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java
  8. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java
  9. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java
  10. 9
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java
  11. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java
  12. 37
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/HomeController.java
  13. 16
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/vo/HomeSelectVO.java
  14. 13
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java
  15. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java
  16. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java
  17. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java
  18. 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java
  19. 7
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java
  20. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java
  21. 16
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java
  22. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java
  23. 15
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java
  24. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java
  25. 13
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java
  26. 26
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java
  27. 10
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java
  28. 16
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java
  29. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java
  30. 152
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java
  31. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java
  32. 45
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java
  33. 44
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml

107
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<Boolean> 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<TagLibraryDO> tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId());
enterprise.setTagList(tagLibraryDOS.stream().map(item->item.getTagName()).collect(Collectors.toList()));
//获取资质
LambdaQueryWrapper<EnterpriseQualificationDO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(EnterpriseQualificationDO::getEnterpriseId, enterprise.getId());
final List<EnterpriseQualificationDO> 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<PageResult<EnterpriseRespVO>> getEnterprisePage(EnterprisePageReqVO pageReqVO) {
PageResult<EnterpriseDO> pageResult = enterpriseService.getEnterprisePage(pageReqVO);
pageResult.getList().forEach(item->{
//企业审核状态
QueryWrapper<EnterpriseAuditLogDO> auditLogDOQueryWrapper = new QueryWrapper<>();
auditLogDOQueryWrapper.eq("enterprise_id", item.getId());
EnterpriseAuditLogDO enterpriseAuditLogDO = enterpriseAuditLogMapper.selectOne(auditLogDOQueryWrapper);
if (enterpriseAuditLogDO != null) {
item.setAudit(enterpriseAuditLogDO.getAudit());
}
//企业图片
LambdaQueryWrapper<FileInfoDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FileInfoDO::getDictType, 644l);
wrapper.eq(FileInfoDO::getDictData, 1l);
wrapper.eq(FileInfoDO::getUnitId, item.getId());
final List<Long> collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList());
final List<Map<String, String>> fileList = fileInfoService.getFileList("664", "1", item.getId().toString());
item.setFiles(fileList);
if (!collect.isEmpty()) {
final List<Map<String,String>> list = fileApi.listFile(collect);
item.setFiles(list);
}
// 企业标签
LambdaQueryWrapper<EnterpriseTagDO> tagDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
tagDOLambdaQueryWrapper.eq(EnterpriseTagDO::getEnterpriseId, item.getId());
List<EnterpriseTagDO> enterpriseTagDOS = enterpriseTagMapper.selectList(tagDOLambdaQueryWrapper);
if (enterpriseTagDOS != null && enterpriseTagDOS.size() > 0) {
List<Long> tagIds = enterpriseTagDOS.stream().map(EnterpriseTagDO::getTagId).collect(Collectors.toList());
List<TagLibraryDO> tagLibraryDOS = tagLibraryMapper.selectList(new LambdaQueryWrapper<TagLibraryDO>().in(TagLibraryDO::getId, tagIds));
if (tagLibraryDOS != null && tagLibraryDOS.size() > 0) {
List<String> tagNames = tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList());
item.setTagList(tagNames);
}
final List<TagLibraryDO> 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<PageResult<EnterpriseRespVO>> getEnterpriseByUserId(@Valid EnterprisePageReqVO pageReqVO) {
final PageResult<EnterpriseDO> pageResult = enterpriseService.getEnterpriseByUserId(pageReqVO);
pageResult.getList().forEach(item->{
//企业审核状态
QueryWrapper<EnterpriseAuditLogDO> auditLogDOQueryWrapper = new QueryWrapper<>();
auditLogDOQueryWrapper.eq("enterprise_id", item.getId());
EnterpriseAuditLogDO enterpriseAuditLogDO = enterpriseAuditLogMapper.selectOne(auditLogDOQueryWrapper);
if (enterpriseAuditLogDO != null) {
item.setAudit(enterpriseAuditLogDO.getAudit());
}
//企业图片
LambdaQueryWrapper<FileInfoDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FileInfoDO::getDictType, 644l);
wrapper.eq(FileInfoDO::getDictData, 1l);
wrapper.eq(FileInfoDO::getUnitId, item.getId());
final List<Long> collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList());
if (!collect.isEmpty()) {
final List<Map<String,String>> list = fileApi.listFile(collect);
item.setFiles(list);
}
final List<Map<String, String>> fileList = fileInfoService.getFileList("664", "1", item.getId().toString());
item.setFiles(fileList);
//企业标签
QueryWrapper<EnterpriseTagDO> enterpriseDOQueryWrapper = new QueryWrapper<>();
enterpriseDOQueryWrapper.eq("enterprise_id", item.getId());
final List<EnterpriseTagDO> enterpriseTagDOS = enterpriseTagMapper.selectList(enterpriseDOQueryWrapper);
List<String> tagList = new ArrayList<>();
if (!enterpriseTagDOS.isEmpty() && enterpriseTagDOS.size() > 0) {
enterpriseTagDOS.forEach(tagItem-> {
QueryWrapper<TagLibraryDO> tagLibraryDOQueryWrapper = new QueryWrapper<>();
tagLibraryDOQueryWrapper.eq("id", tagItem.getTagId());
TagLibraryDO tagLibraryDO = tagLibraryMapper.selectOne(tagLibraryDOQueryWrapper);
if (tagLibraryDO != null) {
tagList.add(tagLibraryDO.getTagName());
}
});
// 企业标签
final List<TagLibraryDO> 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));

3
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;

2
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("企业状态")

10
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;
}

52
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java

@ -67,17 +67,9 @@ public class InspectionsLogController {
return success(inspectionsLogService.signInList(inspectionsId));
}
@PutMapping("/cooperateWithSignIn")
@Operation(summary = "协同人员打卡")
@PreAuthorize("@ss.hasPermission('system:inspections-log:update')")
public CommonResult<Boolean> cooperateWithSignIn(Long inspectionsLogId) {
inspectionsLogService.cooperateWithSignIn(inspectionsLogId);
return success(true);
}
@PutMapping("/update")
@Operation(summary = "更新检查结果日志")
@PreAuthorize("@ss.hasPermission('system:inspections-log:update')")
// @PreAuthorize("@ss.hasPermission('system:inspections-log:update')")
public CommonResult<Boolean> updateInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO updateReqVO) {
inspectionsLogService.updateInspectionsLog(updateReqVO);
return success(true);
@ -95,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<InspectionsLogRespVO> getInspectionsLog(@RequestParam("id") Long id) {
InspectionsLogDO inspectionsLog = inspectionsLogService.getInspectionsLog(id);
//查图片
final List<Map<String, String>> fileList = fileInfoService.getFileList("644", "2", inspectionsLog.getId().toString());
inspectionsLog.setFileList(fileList);
return success(BeanUtils.toBean(inspectionsLog, InspectionsLogRespVO.class));
}
@ -105,6 +101,7 @@ public class InspectionsLogController {
@Operation(summary = "审核")
@PreAuthorize("@ss.hasPermission('system:enterpriseinspections:index')")
public CommonResult<String> inspectionsAudit(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) {
log.info("createReqVO:{}", createReqVO);
inspectionsLogService.inspectionsAudit(createReqVO);
return success("审核成功");
}
@ -112,8 +109,15 @@ public class InspectionsLogController {
@GetMapping("/appList")
@Operation(summary = "获得检查结果日志分页")
// @PreAuthorize("@ss.hasPermission('system:inspections-log:query')")
public CommonResult<PageResult<InspectionsLogRespVO>> getInspectionsLogPage(@Valid InspectionsLogPageReqVO pageReqVO) {
PageResult<InspectionsLogDO> pageResult = inspectionsLogService.getInspectionsLogPage(pageReqVO);
public CommonResult<List<InspectionsLogRespVO>> getInspectionsLogPage(@Valid InspectionsLogPageReqVO pageReqVO) {
List<InspectionsLogDO> pageResult = inspectionsLogService.getInspectionsLogPage(pageReqVO);
if (pageResult != null && pageResult.size() > 0) {
pageResult.forEach(item->{
//图片相关
final List<Map<String, String>> fileList = fileInfoService.getFileList("644", "2", item.getId().toString());
item.setFileList(fileList);
});
}
return success(BeanUtils.toBean(pageResult, InspectionsLogRespVO.class));
}
@ -134,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<InspectionsLogDO> 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<InspectionsLogDO> list = inspectionsLogService.getInspectionsLogPage(pageReqVO).getList();
// // 导出 Excel
// ExcelUtils.write(response, "检查结果日志.xls", "数据", InspectionsLogRespVO.class,
// BeanUtils.toBean(list, InspectionsLogRespVO.class));
// }
}

3
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;
}

3
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<Map<String, String>> fileList;

8
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;
//协同人员是否可以看到任务记录
}

8
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<PageResult<TaskInfoRespVO>> appPageByEnterpriseId( TaskInfoPageReqVO pageReqVO) {
PageResult<TaskInfoDO> pageResult = taskInfoService.appPageByEnterpriseId(pageReqVO);
return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 Excel")
@PreAuthorize("@ss.hasPermission('system:task-info:export')")

9
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;
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java

@ -128,8 +128,8 @@ public class TaskInfoRespVO {
//发布部门
private String deptName;
//检查记录id
private Long inspectionsId;

37
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<List<InspectionsLogAppListVO>> signInList(HomeSelectVO homeSelectVO) {
return success(homeService.appCount1(homeSelectVO));
}
}

16
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;
}

13
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<Map<String, String>> files;

3
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)

4
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;
}

4
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;
}

1
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<EnterpriseDO> {
.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())

7
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<TaskInfoDO> {
.orderByAsc(TaskInfoDO::getStatus));
}
//优化任务查询
PageResult<TaskInfoDO> selectMyPage(TaskInfoPageReqVO reqVO);
//根据企业id查任务
IPage<TaskInfoDO> selectPageByEnterpriseId(Page<TaskInfoDO> page, @Param("reqVO") TaskInfoPageReqVO reqVO);
}

2
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<Long> ids);
//根据用户id 查询部门
DeptDO getByUserId(Long userId);
}

16
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;
}
}

2
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<EnterpriseDO> getEnterpriseList(EnterprisePageReqVO pageReqVO);
PageResult<EnterpriseDO> getEnterpriseByUserId(EnterprisePageReqVO pageReqVO);
void auditEnterprise(Long id);
}

15
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);
}
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java

@ -273,11 +273,11 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
if (singnInLogList != null && singnInLogList.size() > 0) {
final List<String> collect = singnInLogList.stream().filter(signInLogDO -> signInLogDO.getIsInspect() == false).map(item2 -> item2.getRealName()).collect(Collectors.toList());
if (collect != null && collect.size() > 0) {
item.setCooperateWithName(collect.toString());
item.setCooperateWithName(String.join(",", collect));
}
final List<String> collect2 = singnInLogList.stream().filter(signInLogDO -> signInLogDO.getIsInspect() == true).map(item2 -> item2.getRealName()).collect(Collectors.toList());
if (collect2 != null && collect2.size() > 0) {
item.setInspectName(collect2.toString());
item.setInspectName(String.join(",", collect2));
}
}

13
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<FileInfoDO> getFileInfoPage(FileInfoPageReqVO pageReqVO);
List<Map<String,String>> 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);
}

26
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<FileInfoDO> 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);
}
}
}

10
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<InspectionsLogAppListVO> appCount1(HomeSelectVO homeSelectVO);
}

16
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<InspectionsLogAppListVO> appCount1(HomeSelectVO homeSelectVO) {
return null;
// return List.of();
}
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java

@ -53,12 +53,10 @@ public interface InspectionsLogService {
* @param pageReqVO 分页查询
* @return 检查结果日志分页
*/
PageResult<InspectionsLogDO> getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO);
List<InspectionsLogDO> getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO);
List<InspectionsLogDO> list(InspectionsLogPageReqVO pageReqVO);
void cooperateWithSignIn(Long inspectionsLogId);
void confirmSignIn(InspectionsLogSaveReqVO createReqVO);
void inspectionsAudit(InspectionsLogSaveReqVO createReqVO);

152
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,9 +102,17 @@ public class InspectionsLogServiceImpl implements InspectionsLogService {
if(collect.contains(loginUserId)) {
throw exception(SIGN_IN_LOG_ERROR2);
}
}
signInLogMapper.insert(new SignInLogDO().setInsId(inspectionsLogNew.getId()).setUserId(loginUserId).setRealName(user.getRealName()));
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<SignInLogDO> getSignInLog(Long insId) {
@ -143,29 +146,57 @@ public class InspectionsLogServiceImpl implements InspectionsLogService {
@Override
public InspectionsLogDO getInspectionsLog(Long id) {
//判断是否存在
validateInspectionsLogExists(id);
return inspectionsLogMapper.selectById(id);
}
@Override
public PageResult<InspectionsLogDO> getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO) {
public List<InspectionsLogDO> getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO) {
//不显示待确认签到的状态
pageReqVO.setPageNo(-1);
if (pageReqVO.getStatus() == null) {
pageReqVO.setMrStatus(0);
}
final PageResult<InspectionsLogDO> inspectionsLogDOPageResult = inspectionsLogMapper.selectPage(pageReqVO);
if (inspectionsLogDOPageResult.getList() != null && inspectionsLogDOPageResult.getList().size() > 0) {
inspectionsLogDOPageResult.getList().forEach(item->{
item.setUserList(this.getInspectionsLogAppListVO(item.getId()));
});
List<InspectionsLogDO> list = new ArrayList<>();
final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(pageReqVO.getInspectionsId());
if ( inspectionsLogNew != null ) {
//根据打卡次数判断 是否是二次整改
LambdaQueryWrapper<InspectionsLogDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InspectionsLogDO::getInspectionsId, pageReqVO.getInspectionsId());
wrapper.eq(InspectionsLogDO::getStatus, 3);
final List<InspectionsLogDO> 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<SignInLogDO> signInLog = this.getSignInLog(inspectionsLogNew.getId());
if (signInLog == null) {
throw exception(SIGN_IN_LOG_ERROR);
}
inspectionsLogNew.setUserList(this.getInspectionsLogAppListVO(inspectionsLogNew.getId()));
list.add(inspectionsLogNew);
}
}
return inspectionsLogDOPageResult;
return list;
}
//封装
public List<InspectionsLogAppListVO> getInspectionsLogAppListVO(Long insId) {
List<InspectionsLogAppListVO> appListVO = new ArrayList<>();
//取最新一条签到状态
final List<SignInLogDO> signInLog = this.getSignInLog(insId);
if (signInLog != null && signInLog.size() > 0) {
signInLog.forEach(signInLogDO->{
@ -194,43 +225,22 @@ public class InspectionsLogServiceImpl implements InspectionsLogService {
public List<InspectionsLogDO> list(InspectionsLogPageReqVO pageReqVO) {
QueryWrapper<InspectionsLogDO> wrapper = new QueryWrapper<>();
wrapper.eq("inspections_id", pageReqVO.getInspectionsId());
return inspectionsLogMapper.selectList(wrapper);
}
/**
* 协作人员签到
* @param inspectionsLogId
*/
@Override
public void cooperateWithSignIn(Long inspectionsLogId) {
// 校验存在
InspectionsLogDO inspectionsLogDO = inspectionsLogMapper.selectById(inspectionsLogId);
if (inspectionsLogDO == null) {
throw exception(INSPECTIONS_LOG_NOT_EXISTS);
}
//查询真实名称并插入
AdminUserDO user = adminUserService.getUser(getLoginUserId());
if (user == null) {
throw exception(USER_NOT_EXISTS);
}
final List<InspectionsLogDO> list = inspectionsLogMapper.selectList(wrapper);
if (list != null && list.size() > 0) {
list.forEach(item->{
if (item.getStatus() != null) {
final List<InspectionsLogAppListVO> inspectionsLogAppListVO = this.getInspectionsLogAppListVO(item.getId());
if (inspectionsLogAppListVO != null) {
List<String> inspectCollect = inspectionsLogAppListVO.stream().filter(item2 -> item2.getIsInspect() == true).map(map3 -> map3.getRealName()).collect(Collectors.toList());
item.setCooperateWithName(String.join(",", inspectCollect));
List<String> withCollect = inspectionsLogAppListVO.stream().filter(item2 -> item2.getIsInspect() == false).map(map3 -> map3.getRealName()).collect(Collectors.toList());
item.setInspectName(String.join(",", withCollect));
}
}
});
// 更新
if (inspectionsLogDO.getCooperateWithIds() == null ) {
inspectionsLogDO.setCooperateWithIds(getLoginUserId().toString());
inspectionsLogDO.setCooperateWithName(user.getRealName());
} else {
inspectionsLogDO.setCooperateWithIds(inspectionsLogDO.getCooperateWithIds() + "," + getLoginUserId());
inspectionsLogDO.setCooperateWithName(inspectionsLogDO.getCooperateWithName() + "," + user.getRealName());
}
inspectionsLogMapper.updateById(inspectionsLogDO);
//插入协同人员打卡记录表
SignInLogDO signInLogDO = new SignInLogDO();
signInLogDO.setInsId(inspectionsLogId);
signInLogDO.setUserId(getLoginUserId());
signInLogMapper.insert(signInLogDO);
return list;
}
@Override
@ -280,26 +290,50 @@ public class InspectionsLogServiceImpl implements InspectionsLogService {
}
//只有当前企业执行人才能提交审核
if (enterpriseInspectionsDO.getUserId() != getLoginUserId()) {
if (!getLoginUserId().equals(enterpriseInspectionsDO.getUserId())) {
throw exception(SIGN_IN_LOG_ERROR5);
}
//修改执行记录状态 添加日志表 方便查询 当前最新的一定是签到 查询出签到记录 和执行记录一起再一次插入
final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(createReqVO.getInspectionsId());
if (inspectionsLogNew == null) {
throw exception(INSPECTIONS_LOG_NOT_EXISTS);
}
InspectionsLogDO updateObj = BeanUtils.toBean(createReqVO, InspectionsLogDO.class);
inspectionsLogMapper.insert(updateObj);
//修改执行记录状态
List<SignInLogDO> signInLogDOS = signInLogMapper.selectList(new QueryWrapper<SignInLogDO>().eq("ins_id", inspectionsLogNew.getId()));
//插入图片
fileInfoService.saveFilesByDictData(createReqVO.getFileIds(), 644l,2l, updateObj.getId().toString());
//插入签到人 方便查询
if (signInLogDOS == null || signInLogDOS.size() > 0) {
List<SignInLogDO> newList = new ArrayList<>();
signInLogDOS.forEach(item-> {
//插入执行记录
SignInLogDO signInLogDO = new SignInLogDO();
signInLogDO.setInsId(updateObj.getId());
signInLogDO.setUserId(item.getUserId());
signInLogDO.setRealName(item.getRealName());
signInLogDO.setIsInspect(item.getIsInspect());
signInLogDO.setGpsLocation(item.getGpsLocation());
newList.add(signInLogDO);
});
signInLogMapper.insertBatch(newList);
}
}
@Override
public List<InspectionsLogAppListVO> 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());

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java

@ -61,4 +61,6 @@ public interface TaskInfoService {
void sendTask(Long taskId);
PageResult<TaskInfoDO> getTaskInfoAppPage(TaskInfoPageReqVO pageReqVO);
PageResult<TaskInfoDO> appPageByEnterpriseId(TaskInfoPageReqVO pageReqVO);
}

45
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java

@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
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.enterpriseinspections.vo.EnterpriseInspectionsPageReqVO;
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;
@ -16,9 +18,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;
@ -68,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
@ -328,4 +338,39 @@ public class TaskInfoServiceImpl implements TaskInfoService {
return taskInfoDOPageResult;
}
@Override
public PageResult<TaskInfoDO> appPageByEnterpriseId(TaskInfoPageReqVO pageReqVO) {
// 创建分页对象
Page<TaskInfoDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
final IPage<TaskInfoDO> taskInfoDOIPage = taskInfoMapper.selectPageByEnterpriseId(page, pageReqVO);
if (taskInfoDOIPage != null && taskInfoDOIPage.getRecords() != null && taskInfoDOIPage.getRecords().size() > 0) {
taskInfoDOIPage.getRecords().forEach(item->{
//根据任务和企业查询记录
LambdaQueryWrapper<EnterpriseInspectionsDO> 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<TagLibraryDO> 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());
}
}

44
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectMyPage" resultType="cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO">
SELECT
t.*,
count(ei.task_id),
SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) AS status_2_count
FROM task_info t
left join enterprise_inspections ei on t.id = ei.task_id
left join inspections_log il on ei.id = il.inspections_id
left join enterprises e on e.id = ei.enterprise_id
WHERE
t.deleted = 0 and ei.deleted = 0 and il.deleted = 0 GROUP BY t.id
<if test="userId != null and userId != ''">
AND t.user_id = #{userId}
</if>
<if test="deptId != null and deptId != ''">
AND e.department_id = #{deptId}
</if>
# ORDER BY t.create_time DESC
# LIMIT #{offset}, #{rows}
</select>
<select id="selectPageByEnterpriseId" resultType="cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO">
SELECT
t.*
FROM task_info t
left join enterprise_inspections ei on t.id = ei.task_id
WHERE
t.deleted = 0 and ei.deleted = 0 and ei.enterprise_id = #{reqVO.enterpriseId}
GROUP BY t.id
ORDER BY t.create_time DESC
</select>
</mapper>
Loading…
Cancel
Save